Merge "Made user preferences load from the master by default"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:table_attribs
123 !! text
124 <noinclude>
125 |</noinclude>style="color:red;"|Foo
126 !! endarticle
127
128 !! article
129 Template:table_attribs_2
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 |Bar||Baz
134 !! endarticle
135
136 !! article
137 Template:table_attribs_3
138 !! text
139 <noinclude>
140 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
141 !! endarticle
142
143 !! article
144 Template:table_attribs_4
145 !! text
146 | style="background-color:#DC241f;" width="10px" |
147 !! endarticle
148
149 !! article
150 Template:table_header_cells
151 !! text
152 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
153 !! endarticle
154
155 !! article
156 Template:table_cells
157 !! text
158 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
159 !! endarticle
160
161 !! article
162 Template:image_attribs
163 !! text
164 <noinclude>
165 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
166 !! endarticle
167
168 ## See T48811 for details
169 !! article
170 Template:mixed_attr_content_template
171 !! text
172 style="color:red;" title="T48811"
173 |-
174 |foo
175 !! endarticle
176
177 !! article
178 Template:definition_list
179 !! text
180 one
181 ::two
182 !! endarticle
183
184 !! article
185 A?b
186 !! text
187 Weirdo titles!
188 !! endarticle
189
190 !!article
191 Template:Bullet
192 !!text
193 * Bar
194 !!endarticle
195
196 !!article
197 Template:OpenTable
198 !!text
199 {|
200 !!endarticle
201
202 !!article
203 Template:EmptyLITest
204 !!text
205 *a
206 *
207 *
208 *b
209 !!endarticle
210
211 !!article
212 Template:EmptyTRTest
213 !!text
214 {|
215 |-
216 |-
217 |foo
218 |-
219 |-
220 |bar
221 |}
222 !!endarticle
223
224 !!article
225 Template:EmptyTRWithHTMLAttrTest
226 !!text
227 <table>
228 <tr align="center"></tr>
229 <tr><td>foo</td></tr>
230 <tr align="center"></tr>
231 <tr><td>bar</td></tr>
232 </table>
233 !!endarticle
234
235 ###
236 ### Basic tests
237 ###
238 !! test
239 Blank input
240 !! wikitext
241 !! html
242 !! end
243
244
245 !! test
246 Simple paragraph
247 !! wikitext
248 This is a simple paragraph.
249 !! html
250 <p>This is a simple paragraph.
251 </p>
252 !! end
253
254 !! test
255 Paragraphs with extra newline spacing
256 !! wikitext
257 foo
258
259 bar
260
261
262 baz
263
264
265
266 booz
267 !! html
268 <p>foo
269 </p><p>bar
270 </p><p><br />
271 baz
272 </p><p><br />
273 </p><p>booz
274 </p>
275 !! end
276
277 !! test
278 Paragraphs with newline spacing with comment lines in between
279 !! wikitext
280 ----
281 a
282 <!--foo-->
283 b
284 ----
285 a
286 <!--foo--><!--More than 1 comment, still stripped-->
287 b
288 ----
289 a
290 <!--foo--> <!----> <!-- bar -->
291 b
292 ----
293 a
294 <!--foo-->
295
296 b
297 ----
298 a
299
300 <!--foo-->
301 b
302 ----
303 a
304 <!--foo-->
305
306
307 b
308 ----
309 a
310
311
312 <!--foo-->
313 b
314 ----
315 !! html
316 <hr />
317 <p>a
318 b
319 </p>
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 b
327 </p>
328 <hr />
329 <p>a
330 </p><p>b
331 </p>
332 <hr />
333 <p>a
334 </p><p>b
335 </p>
336 <hr />
337 <p>a
338 </p><p><br />
339 b
340 </p>
341 <hr />
342 <p>a
343 </p><p><br />
344 b
345 </p>
346 <hr />
347
348 !! end
349
350 !! test
351 Paragraphs with newline spacing with non-empty white-space lines in between
352 !! wikitext
353 ----
354 a
355
356 b
357 ----
358 a
359
360
361 b
362 ----
363 !! html
364 <hr />
365 <p>a
366 </p><p>b
367 </p>
368 <hr />
369 <p>a
370 </p><p><br />
371 b
372 </p>
373 <hr />
374
375 !! end
376
377 !! test
378 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
379 !! wikitext
380 ----
381 a
382 <!--foo-->
383 b
384 ----
385 a
386 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
387 b
388 ----
389 a
390
391 <!--foo-->
392 <!--bar-->
393 b
394 ----
395 a
396
397 <!--foo-->
398 <!--bar-->
399
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 b
406 </p>
407 <hr />
408 <p>a
409 b
410 </p>
411 <hr />
412 <p>a
413 </p><p>b
414 </p>
415 <hr />
416 <p>a
417 </p><p><br />
418 b
419 </p>
420 <hr />
421
422 !! end
423
424 !! test
425 Extra newlines: More paragraphs with indented comment
426 !! wikitext
427 a
428
429 <!--boo-->
430
431 b
432 !! html
433 <p>a
434 </p><p><br />
435 b
436 </p>
437 !!end
438
439 !! test
440 Extra newlines followed by heading
441 !! wikitext
442 a
443
444
445
446 =b=
447 [[a]]
448
449
450 =b=
451 !! html
452 <p>a
453 </p><p><br />
454 </p>
455 <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>
456 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
457 </p><p><br />
458 </p>
459 <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>
460
461 !! end
462
463 !! test
464 Extra newlines between heading and content are swallowed
465 !! wikitext
466 =b=
467
468
469
470 [[a]]
471 !! html
472 <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>
473 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
474 </p>
475 !! end
476
477 !! test
478 Parsing an URL
479 !! wikitext
480 http://fr.wikipedia.org/wiki/🍺
481 <!-- EasterEgg we love beer, better be able be able to link to it -->
482 !! html
483 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
484 </p>
485 !! end
486
487 # Note that the html+tidy output removes the spaces after the <li>,
488 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
489 # This is an issue for all tests with lists. We intentionally do
490 # *not* add html+tidy clauses for these, as we don't want to
491 # document/test the broken behavior. (Parsoid matches the non-tidy
492 # output in these cases.)
493
494 !! test
495 Simple list
496 !! wikitext
497 * Item 1
498 * Item 2
499 !! html
500 <ul><li> Item 1</li>
501 <li> Item 2</li></ul>
502
503 !! end
504
505 !! test
506 Italics and bold
507 !! wikitext
508 * plain
509 * plain''italic''plain
510 * plain''italic''plain''italic''plain
511 * plain'''bold'''plain
512 * plain'''bold'''plain'''bold'''plain
513 * plain''italic''plain'''bold'''plain
514 * plain'''bold'''plain''italic''plain
515 * plain''italic'''bold-italic'''italic''plain
516 * plain'''bold''bold-italic''bold'''plain
517 * plain'''''bold-italic'''italic''plain
518 * plain'''''bold-italic''bold'''plain
519 * plain''italic'''bold-italic'''''plain
520 * plain'''bold''bold-italic'''''plain
521 * plain l'''italic''plain
522 * plain l''''bold''' plain
523 !! html
524 <ul><li> plain</li>
525 <li> plain<i>italic</i>plain</li>
526 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
527 <li> plain<b>bold</b>plain</li>
528 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
529 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
530 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
531 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
532 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
533 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
534 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
535 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
536 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
537 <li> plain l'<i>italic</i>plain</li>
538 <li> plain l'<b>bold</b> plain</li></ul>
539
540 !! end
541
542 # this example taken from the [[simple:Moon]] article (bug 47326)
543 !! test
544 Italics and possessives (1)
545 !! wikitext
546 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
547 !! html
548 <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
549 </p>
550 !! end
551
552 # this example taken from [[en:Flaming Pie]] (bug 49926)
553 !! test
554 Italics and possessives (2)
555 !! wikitext
556 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
557 !! html
558 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
559 </p>
560 !! end
561
562 # this example taken from [[en:Dictionary]] (bug 49926)
563 !! test
564 Italics and possessives (3)
565 !! wikitext
566 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''.
567 !! html
568 <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>.
569 </p>
570 !! end
571
572
573 ###
574 ### 2-quote opening sequence tests
575 ###
576 !! test
577 Italics and bold: 2-quote opening sequence: (2,2)
578 !! wikitext
579 ''foo''
580 !! html
581 <p><i>foo</i>
582 </p>
583 !!end
584
585 !! test
586 Italics and bold: 2-quote opening sequence: (2,3)
587 !! wikitext
588 ''foo'''
589 !! html/*
590 <p><i>foo'</i>
591 </p>
592 !!end
593
594 !! test
595 Italics and bold: 2-quote opening sequence: (2,4)
596 !! options
597 parsoid=wt2html
598 !! wikitext
599 ''foo''''
600 !! html/*
601 <p><i>foo''</i>
602 </p>
603 !!end
604
605 # same html as previous, but wikitext adjusted to match parsoid html2wt
606 !! test
607 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
608 !! wikitext
609 ''foo<nowiki>''</nowiki>''
610 !! html
611 <p><i>foo''</i>
612 </p>
613 !! end
614
615 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
616 !! test
617 Italics and bold: 2-quote opening sequence: (2,5)
618 !! options
619 parsoid=wt2html
620 !! wikitext
621 ''foo'''''
622 !! html/php
623 <p><i>foo</i>
624 </p>
625 !! html/parsoid
626 <p><i>foo</i><b></b>
627 </p>
628 !!end
629
630 # same html as previous, but wikitext adjusted to match parsoid html2wt
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
633 !! wikitext
634 ''foo'''''<nowiki/>'''
635 !! html/php
636 <p><i>foo</i>
637 </p>
638 !! html/parsoid
639 <p><i>foo</i><b></b>
640 </p>
641 !! end
642
643
644 ###
645 ### 3-quote opening sequence tests
646 ###
647
648 !! test
649 Italics and bold: 3-quote opening sequence: (3,2)
650 !! wikitext
651 '''foo''
652 !! html/*
653 <p>'<i>foo</i>
654 </p>
655 !!end
656
657 !! test
658 Italics and bold: 3-quote opening sequence: (3,3)
659 !! wikitext
660 '''foo'''
661 !! html
662 <p><b>foo</b>
663 </p>
664 !!end
665
666 !! test
667 Italics and bold: 3-quote opening sequence: (3,4)
668 !! wikitext
669 '''foo''''
670 !! html/*
671 <p><b>foo'</b>
672 </p>
673 !!end
674
675 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
676 !! test
677 Italics and bold: 3-quote opening sequence: (3,5)
678 !! options
679 parsoid=wt2html
680 !! wikitext
681 '''foo'''''
682 !! html/php
683 <p><b>foo</b>
684 </p>
685 !! html/parsoid
686 <p><b>foo</b><i></i>
687 </p>
688 !!end
689
690 # same html as previous, but wikitext adjusted to match parsoid html2wt
691 !! test
692 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
693 !! wikitext
694 '''foo'''''<nowiki/>''
695 !! html/php
696 <p><b>foo</b>
697 </p>
698 !! html/parsoid
699 <p><b>foo</b><i></i>
700 </p>
701 !! end
702
703
704 ###
705 ### 4-quote opening sequence tests
706 ###
707
708 !! test
709 Italics and bold: 4-quote opening sequence: (4,2)
710 !! options
711 parsoid=wt2html
712 !! wikitext
713 ''''foo''
714 !! html/*
715 <p>''<i>foo</i>
716 </p>
717 !!end
718
719 # same html as previous, but wikitext adjusted to match parsoid html2wt
720 !! test
721 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
722 !! wikitext
723 <nowiki>''</nowiki>''foo''
724 !! html
725 <p>''<i>foo</i>
726 </p>
727 !! end
728
729 !! test
730 Italics and bold: 4-quote opening sequence: (4,3)
731 !! wikitext
732 ''''foo'''
733 !! html/*
734 <p>'<b>foo</b>
735 </p>
736 !!end
737
738 !! test
739 Italics and bold: 4-quote opening sequence: (4,4)
740 !! options
741 parsoid=wt2html
742 !! wikitext
743 ''''foo''''
744 !! html/*
745 <p>'<b>foo'</b>
746 </p>
747 !!end
748
749 # same html as previous, but wikitext adjusted to match parsoid html2wt
750 !! test
751 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
752 !! wikitext
753 '<nowiki/>'''foo''''
754 !! html
755 <p>'<b>foo'</b>
756 </p>
757 !! end
758
759 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
760 !! test
761 Italics and bold: 4-quote opening sequence: (4,5)
762 !! options
763 parsoid=wt2html
764 !! wikitext
765 ''''foo'''''
766 !! html/php
767 <p>'<b>foo</b>
768 </p>
769 !! html/parsoid
770 <p>'<b>foo</b><i></i>
771 </p>
772 !!end
773
774 # same html as previous, but wikitext adjusted to match parsoid html2wt
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
777 !! wikitext
778 '<nowiki/>'''foo'''''<nowiki/>''
779 !! html/php
780 <p>'<b>foo</b>
781 </p>
782 !! html/parsoid
783 <p>'<b>foo</b><i></i>
784 </p>
785 !! end
786
787
788 ###
789 ### 5-quote opening sequence tests
790 ###
791
792 !! test
793 Italics and bold: 5-quote opening sequence: (5,2)
794 !! options
795 parsoid=wt2html
796 !! wikitext
797 '''''foo''
798 !! html/*
799 <p><b><i>foo</i></b>
800 </p>
801 !!end
802
803 # same html as previous, but wikitext adjusted to match parsoid html2wt
804 # skipping wt2html and html2html because it wants to put <i> before <b>
805 !! test
806 Italics and bold: 5-quote opening sequence: (5,2+3)
807 !! options
808 parsoid=wt2wt,html2wt
809 !! wikitext
810 '''''foo'''''
811 !! html
812 <p><b><i>foo</i></b>
813 </p>
814 !! end
815
816 !! test
817 Italics and bold: 5-quote opening sequence: (5,3)
818 !! options
819 parsoid=wt2html
820 !! wikitext
821 '''''foo'''
822 !! html/*
823 <p><i><b>foo</b></i>
824 </p>
825 !!end
826
827 # same html as previous, but wikitext adjusted to match parsoid html2wt
828 !! test
829 Italics and bold: 5-quote opening sequence: (5,3+2)
830 !! wikitext
831 '''''foo'''''
832 !! html
833 <p><i><b>foo</b></i>
834 </p>
835 !! end
836
837 !! test
838 Italics and bold: 5-quote opening sequence: (5,4)
839 !! options
840 parsoid=wt2html
841 !! wikitext
842 '''''foo''''
843 !! html/*
844 <p><i><b>foo'</b></i>
845 </p>
846 !!end
847
848 !! test
849 Italics and bold: 5-quote opening sequence: (5,5)
850 !! wikitext
851 '''''foo'''''
852 !! html
853 <p><i><b>foo</b></i>
854 </p>
855 !!end
856
857 !! test
858 Italics and bold: 5-quote opening sequence: (5,6)
859 !! wikitext
860 '''''foo''''''
861 !! html/*
862 <p><i><b>foo'</b></i>
863 </p>
864 !! end
865
866 ###
867 ### multiple quote sequences in a line
868 ###
869 !! test
870 Italics and bold: multiple quote sequences: (2,4,2)
871 !! options
872 parsoid=wt2html
873 !! wikitext
874 ''foo''''bar''
875 !! html/*
876 <p><i>foo'<b>bar</b></i>
877 </p>
878 !!end
879
880
881 # same html as previous, but wikitext adjusted to match parsoid html2wt
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
884 !! wikitext
885 ''foo'<nowiki/>'''bar'''''
886 !! html
887 <p><i>foo'<b>bar</b></i>
888 </p>
889 !! end
890
891
892 !! test
893 Italics and bold: multiple quote sequences: (2,4,3)
894 !! options
895 parsoid=wt2html
896 !! wikitext
897 ''foo''''bar'''
898 !! html/*
899 <p><i>foo'<b>bar</b></i>
900 </p>
901 !!end
902
903
904 # same html as previous, but wikitext adjusted to match parsoid html2wt
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
907 !! wikitext
908 ''foo'<nowiki/>'''bar'''''
909 !! html
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !! end
913
914
915 !! test
916 Italics and bold: multiple quote sequences: (2,4,4)
917 !! options
918 parsoid=wt2html
919 !! wikitext
920 ''foo''''bar''''
921 !! html/*
922 <p><i>foo'<b>bar'</b></i>
923 </p>
924 !!end
925
926
927 # same html as previous, but wikitext adjusted to match parsoid html2wt
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
930 !! wikitext
931 ''foo'<nowiki/>'''bar'<nowiki/>'''''
932 !! html
933 <p><i>foo'<b>bar'</b></i>
934 </p>
935 !! end
936
937
938 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
939 !! test
940 Italics and bold: multiple quote sequences: (3,4,2)
941 !! options
942 parsoid=wt2html
943 !! wikitext
944 '''foo''''bar''
945 !! html/php
946 <p><b>foo'</b>bar
947 </p>
948 !! html/parsoid
949 <p><b>foo'</b>bar<i></i>
950 </p>
951 !!end
952
953 # same html as previous, but wikitext adjusted to match parsoid html2wt
954 !! test
955 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
956 !! options
957 parsoid
958 !! wikitext
959 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
960 !! html/php
961 <p><b>foo'</b>bar
962 </p>
963 !! html/parsoid
964 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
965 </p>
966 !! end
967
968
969 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
970 !! test
971 Italics and bold: multiple quote sequences: (3,4,3)
972 !! options
973 parsoid=wt2html
974 !! wikitext
975 '''foo''''bar'''
976 !! html/php
977 <p><b>foo'</b>bar
978 </p>
979 !! html/parsoid
980 <p><b>foo'</b>bar<b></b>
981 </p>
982 !!end
983
984 # same html as previous, but wikitext adjusted to match parsoid html2wt
985 !! test
986 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
987 !! wikitext
988 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
989 !! html/php
990 <p><b>foo'</b>bar
991 </p>
992 !! html/parsoid
993 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
994 </p>
995 !! end
996
997 ###
998 ### other quote tests
999 ###
1000 !! test
1001 Italics and bold: other quote tests: (2,3,5)
1002 !! wikitext
1003 ''this is about '''foo's family'''''
1004 !! html
1005 <p><i>this is about <b>foo's family</b></i>
1006 </p>
1007 !!end
1008
1009
1010 !! test
1011 Italics and bold: other quote tests: (2,(3,3),2)
1012 !! wikitext
1013 ''this is about '''foo's''' family''
1014 !! html
1015 <p><i>this is about <b>foo's</b> family</i>
1016 </p>
1017 !!end
1018
1019
1020 !! test
1021 Italics and bold: other quote tests: (3,2,3,2)
1022 !! options
1023 parsoid=wt2html
1024 !! wikitext
1025 '''this is about ''foo'''s family''
1026 !! html/*
1027 <p><b>this is about <i>foo</i></b><i>s family</i>
1028 </p>
1029 !!end
1030
1031
1032 # same html as previous, but wikitext adjusted to match parsoid html2wt
1033 !! test
1034 Italics and bold: other quote tests: (3,2,3+2+2,2)
1035 !! wikitext
1036 '''this is about ''foo'''''<nowiki/>''s family''
1037 !! html
1038 <p><b>this is about <i>foo</i></b><i>s family</i>
1039 </p>
1040 !! end
1041
1042
1043 !! test
1044 Italics and bold: other quote tests: (3,2,3,3)
1045 !! wikitext
1046 '''this is about ''foo'''s family'''
1047 !! html/*
1048 <p>'<i>this is about </i>foo<b>s family</b>
1049 </p>
1050 !!end
1051
1052
1053 !! test
1054 Italics and bold: other quote tests: (3,(2,2),3)
1055 !! wikitext
1056 '''this is about ''foo's'' family'''
1057 !! html
1058 <p><b>this is about <i>foo's</i> family</b>
1059 </p>
1060 !!end
1061
1062
1063 !! test
1064 Italicized possessive
1065 !! wikitext
1066 The ''[[Main Page]]'''s talk page.
1067 !! html/php
1068 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1069 </p>
1070 !! html/parsoid
1071 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1072 !! end
1073
1074 !! test
1075 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1076 (Requires tidy for PHP parser output to be fixed up)
1077 !! options
1078 parsoid=wt2html,wt2wt
1079 !! wikitext
1080 {|
1081 !''a!!''b
1082 |''a||''b
1083 |}
1084 !! html/php+tidy
1085 <table>
1086 <tr>
1087 <th><i>a</i></th>
1088 <th><i>b</i></th>
1089 <td><i>a</i></td>
1090 <td><i>b</i></td>
1091 </tr>
1092 </table>
1093 !! html/parsoid
1094 <table>
1095 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1096 <td><i>a</i></td><td><i>b</i></td></tr>
1097 </tbody></table>
1098 !! end
1099
1100 ###
1101 ### Non-html5 tags
1102 ###
1103
1104 !! test
1105 Non-html5 tags should be accepted
1106 !! wikitext
1107 <center>''foo''</center>
1108 <big>''foo''</big>
1109 <font>''foo''</font>
1110 <strike>''foo''</strike>
1111 <tt>''foo''</tt>
1112 !! html
1113 <center><i>foo</i></center>
1114 <p><big><i>foo</i></big>
1115 <font><i>foo</i></font>
1116 <strike><i>foo</i></strike>
1117 <tt><i>foo</i></tt>
1118 </p>
1119 !! end
1120
1121 !! test
1122 <wbr> is valid wikitext (bug 52468)
1123 !! wikitext
1124 <wbr>
1125 !! html
1126 <p><wbr />
1127 </p>
1128 !! end
1129
1130 # <strike> is HTML4, <s> is HTML4/5.
1131 !! test
1132 <s> or <strike> for strikethrough
1133 !! wikitext
1134 <strike>strike</strike>
1135
1136 <s>s</s>
1137 !! html
1138 <p><strike>strike</strike>
1139 </p><p><s>s</s>
1140 </p>
1141 !! end
1142
1143 ## a not permitted
1144 ## i,b,br omitted
1145 !! test
1146 Text-level semantic html elements in wikitext
1147 !! wikitext
1148 <em>text</em>
1149 <strong>text</strong>
1150 <small>text</small>
1151 <s>text</s>
1152 <cite>text</cite>
1153 <q>text</q>
1154 <dfn>text</dfn>
1155 <abbr>text</abbr>
1156 <data>text</data>
1157 <time>text</time>
1158 <code>text</code>
1159 <var>text</var>
1160 <samp>text</samp>
1161 <kbd>text</kbd>
1162 <sub>text</sub>
1163 <u>text</u>
1164 <mark>text</mark>
1165 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1166 <bdi>text</bdi>
1167 <bdo>text</bdo>
1168 <span>text</span>
1169 <wbr />
1170 !! html
1171 <p><em>text</em>
1172 <strong>text</strong>
1173 <small>text</small>
1174 <s>text</s>
1175 <cite>text</cite>
1176 <q>text</q>
1177 <dfn>text</dfn>
1178 <abbr>text</abbr>
1179 <data>text</data>
1180 <time>text</time>
1181 <code>text</code>
1182 <var>text</var>
1183 <samp>text</samp>
1184 <kbd>text</kbd>
1185 <sub>text</sub>
1186 <u>text</u>
1187 <mark>text</mark>
1188 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1189 <bdi>text</bdi>
1190 <bdo>text</bdo>
1191 <span>text</span>
1192 <wbr />
1193 </p>
1194 !! end
1195
1196 # test cases taken from
1197 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1198 !! test
1199 Ruby markup (W3C-style)
1200 !! wikitext
1201 ; Mono-ruby for individual base characters
1202 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1203 ; Group ruby
1204 : <ruby>今日<rt>きょう</rt></ruby>
1205 ; Jukugo ruby
1206 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1207 ; Inline ruby
1208 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1209 ; Double-sided ruby
1210 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1211 <ruby>
1212 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1213 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1214 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1215 </ruby>
1216 !! html
1217 <dl><dt> Mono-ruby for individual base characters</dt>
1218 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1219 <dt> Group ruby</dt>
1220 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1221 <dt> Jukugo ruby</dt>
1222 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1223 <dt> Inline ruby</dt>
1224 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1225 <dt> Double-sided ruby</dt>
1226 <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>
1227 <p><ruby>
1228 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1229 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1230 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1231 </ruby>
1232 </p>
1233 !! end
1234
1235 # The next two test different paths in the sanitizer.
1236 !! test
1237 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1238 !! wikitext
1239 <blockquote|>a</blockquote>
1240
1241 <b→> doesn't terminate </b→>
1242
1243 <bä> doesn't terminate </bä>
1244
1245 <boo> doesn't terminate </boo>
1246
1247 <s.foo> doesn't terminate </s.foo>
1248
1249 <sub-ID#1>
1250 !! html
1251 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1252 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1253 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1254 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1255 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1256 </p><p>&lt;sub-ID#1&gt;
1257 </p>
1258 !! end
1259
1260 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1261 # If the non-word-character tag made it through the sanitizer, tidy
1262 # would munge it up.
1263 !! test
1264 Non-word characters don't terminate tag names + tidy
1265 !! wikitext
1266 <blockquote|>a</blockquote>
1267
1268 <b→> doesn't terminate </b→>
1269
1270 <bä> doesn't terminate </bä>
1271
1272 <boo> doesn't terminate </boo>
1273
1274 <s.foo> doesn't terminate </s.foo>
1275
1276 <sub-ID#1>
1277 !! html+tidy
1278 <p>&lt;blockquote|&gt;a</p>
1279 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1280 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1281 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1282 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1283 <p>&lt;sub-ID#1&gt;</p>
1284 !! end
1285
1286 ###
1287 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1288 ### This checks that HTML5 tags (with non-word characters in the tag
1289 ### name) make it safely through the parser -- the Sanitizer will
1290 ### munge them later, as it should.
1291 ###
1292 !! test
1293 Non-word characters are valid in extension tags (T19663)
1294 !! wikitext
1295 <tåg>tåg</tåg>
1296 !! html
1297 <pre>
1298 'tåg'
1299 array (
1300 )
1301 </pre>
1302
1303 !! end
1304
1305 !! test
1306 Isolated close tags should be treated as literal text (bug 52760)
1307 !! wikitext
1308 </b>
1309
1310 <s.foo>s</s>
1311 !! html+tidy
1312 <p>&lt;s.foo&gt;s</p>
1313 !! end
1314
1315 ###
1316 ### Special characters
1317 ###
1318
1319 !! test
1320 Bare pipe character (bug 52363)
1321 !! wikitext
1322 |
1323 !! html
1324 <p>|
1325 </p>
1326 !! end
1327
1328 !! test
1329 Bare pipe character from a template (bug 52363)
1330 !! wikitext
1331 {{pipe}}
1332 !! html
1333 <p>|
1334 </p>
1335 !! end
1336
1337 ###
1338 ### <nowiki> test cases
1339 ###
1340
1341 !! test
1342 <nowiki> unordered list
1343 !! wikitext
1344 <nowiki>* This is not an unordered list item.</nowiki>
1345 !! html
1346 <p>* This is not an unordered list item.
1347 </p>
1348 !! end
1349
1350 !! test
1351 <nowiki> spacing
1352 !! wikitext
1353 <nowiki>Lorem ipsum dolor
1354
1355 sed abit.
1356 sed nullum.
1357
1358 :and a colon
1359 </nowiki>
1360 !! html
1361 <p>Lorem ipsum dolor
1362
1363 sed abit.
1364 sed nullum.
1365
1366 :and a colon
1367
1368 </p>
1369 !! end
1370
1371 !! test
1372 nowiki 3
1373 !! wikitext
1374 :There is not nowiki.
1375 :There is <nowiki>nowiki</nowiki>.
1376
1377 #There is not nowiki.
1378 #There is <nowiki>nowiki</nowiki>.
1379
1380 *There is not nowiki.
1381 *There is <nowiki>nowiki</nowiki>.
1382 !! html
1383 <dl><dd>There is not nowiki.</dd>
1384 <dd>There is nowiki.</dd></dl>
1385 <ol><li>There is not nowiki.</li>
1386 <li>There is nowiki.</li></ol>
1387 <ul><li>There is not nowiki.</li>
1388 <li>There is nowiki.</li></ul>
1389
1390 !! end
1391
1392 !! test
1393 Entities inside <nowiki>
1394 !! wikitext
1395 <nowiki>&lt;</nowiki>
1396 !! html
1397 <p>&lt;
1398 </p>
1399 !! end
1400
1401 !! test
1402 Entities inside template parameters
1403 !! options
1404 parsoid
1405 !! wikitext
1406 {{echo|&ndash;}}
1407 !! html
1408 <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>
1409 !! end
1410
1411 !! test
1412 Properly escape nowiki when combined with other wiki markup
1413 !! options
1414 parsoid=html2wt
1415 !! html
1416 <p>* &lt;/nowiki&gt; tag</p>
1417 !! wikitext
1418 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1419 !! end
1420
1421 !! test
1422 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1423 !! options
1424 parsoid=html2wt
1425 !! html
1426 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1427 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1428 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1429 !! wikitext
1430 This text: L'[[Foo]]
1431 This text: L<nowiki>''</nowiki>[[Foo]]
1432 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1433 !! end
1434
1435 # This test fails because wikitext whitespace is not normalized before comparing.
1436 !! test
1437 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1438 !! options
1439 parsoid=html2wt
1440 !! html
1441 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1442 </p>
1443 !! wikitext
1444 This text : L<nowiki>''</nowiki>[[Foo]]
1445 !! end
1446
1447 # This test and the next one are html2wt only as they test that incorrect wikitext
1448 # passed in template arguments gets escaped or wrapped in nowikis where required.
1449 !! test
1450 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1451 !! options
1452 parsoid=html2wt
1453 !! html/parsoid
1454 <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>
1455 <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>
1456 !! wikitext
1457 {{echo|foo{{!}}bar}}
1458 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1459 !! end
1460
1461 !! test
1462 T53961: Output correct nowikis in template arguments
1463 !! options
1464 parsoid=html2wt
1465 !! html/parsoid
1466 <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>
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="#mwt2"></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 [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></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="#mwt4"></span>
1470 <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>
1471 !! wikitext
1472 {{echo|a [ b}}
1473 {{echo|a <nowiki>}}</nowiki> b}}
1474 {{echo|<nowiki>a [[ b</nowiki>}}
1475 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1476 {{echo|a <nowiki>}</nowiki>}}
1477 !! end
1478
1479 ###
1480 ### Comments
1481 ###
1482 !! test
1483 Comments and Indent-Pre
1484 !! wikitext
1485 <!-- comment 1 --> asdf
1486
1487 <!-- comment 1 --> asdf
1488 <!-- comment 2 -->
1489
1490 <!-- comment 1 --> asdf
1491 <!-- comment 2 -->xyz
1492
1493 <!-- comment 1 --> asdf
1494 <!-- comment 2 --> xyz
1495 !! html
1496 <pre>asdf
1497 </pre>
1498 <pre>asdf
1499 </pre>
1500 <pre>asdf
1501 </pre>
1502 <p>xyz
1503 </p>
1504 <pre>asdf
1505 xyz
1506 </pre>
1507 !! end
1508
1509 !! test
1510 Comment test 2a
1511 !! wikitext
1512 asdf
1513 <!-- comment 1 -->
1514 jkl
1515 !! html
1516 <p>asdf
1517 jkl
1518 </p>
1519 !! end
1520
1521 !! test
1522 Comment test 2b
1523 !! wikitext
1524 asdf
1525 <!-- comment 1 -->
1526
1527 jkl
1528 !! html
1529 <p>asdf
1530 </p><p>jkl
1531 </p>
1532 !! end
1533
1534 !! test
1535 Comment test 3
1536 !! wikitext
1537 asdf
1538 <!-- comment 1 -->
1539 <!-- comment 2 -->
1540 jkl
1541 !! html
1542 <p>asdf
1543 jkl
1544 </p>
1545 !! end
1546
1547 !! test
1548 Comment test 4
1549 !! wikitext
1550 asdf<!-- comment 1 -->jkl
1551 !! html
1552 <p>asdfjkl
1553 </p>
1554 !! end
1555
1556 !! test
1557 Comment spacing
1558 !! wikitext
1559 a
1560 <!-- foo --> b <!-- bar -->
1561 c
1562 !! html
1563 <p>a
1564 </p>
1565 <pre> b
1566 </pre>
1567 <p>c
1568 </p>
1569 !! end
1570
1571 !! test
1572 Comment whitespace
1573 !! wikitext
1574 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1575 !! html
1576
1577 !! end
1578
1579 !! test
1580 Comment semantics and delimiters
1581 !! wikitext
1582 <!-- --><!----><!-----><!------>
1583 !! html
1584
1585 !! end
1586
1587 !! test
1588 Comment semantics and delimiters, redux
1589 !! wikitext
1590 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1591 -- foo -- funky huh? ... -->
1592 !! html
1593
1594 !! end
1595
1596 !! test
1597 Comment semantics and delimiters: directors cut
1598 !! wikitext
1599 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1600 everything starting with < followed by !-- until the first -- and > we see,
1601 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1602 -->-->
1603 !! html
1604 <p>--&gt;
1605 </p>
1606 !! end
1607
1608 !! test
1609 Comment semantics: nesting
1610 !! wikitext
1611 <!--<!-- no, we're not going to do anything fancy here -->-->
1612 !! html
1613 <p>--&gt;
1614 </p>
1615 !! end
1616
1617 !! test
1618 Comment semantics: unclosed comment at end
1619 !! wikitext
1620 <!--This comment will run out to the end of the document
1621 !! html
1622
1623 !! end
1624
1625 # Bug 58184: document parsoid's behaviour
1626 !! test
1627 Suppress comment closing tag in lenient browsers
1628 !! options
1629 parsoid=wt2html,html2html
1630 !! wikitext
1631 <!-- Browsers--!> think this is closed -->
1632 !! html/php
1633
1634 !! html/parsoid
1635 <!-- Browsers--¡> think this is closed -->
1636 !! end
1637
1638 !! test
1639 Comment in template title
1640 !! wikitext
1641 {{f<!---->oo}}
1642 !! html
1643 <p>FOO
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment on its own line post-expand
1649 !! wikitext
1650 a
1651 {{blank}}<!---->
1652 b
1653 !! html
1654 <p>a
1655 </p><p>b
1656 </p>
1657 !! end
1658
1659 !! test
1660 Comment on its own line post-expand with non-significant whitespace
1661 !! wikitext
1662 a
1663 {{blank}} <!---->
1664 b
1665 !! html
1666 <p>a
1667 </p><p>b
1668 </p>
1669 !! end
1670
1671 !! test
1672 Multiple comments should still parse as SOL-transparent
1673 !! options
1674 parsoid=wt2html,wt2wt
1675 !! wikitext
1676 <!--c1-->*a
1677 <!--c2--><!--c3--><!--c4-->*b
1678 !! html
1679 <ul>
1680 <li>a
1681 </li>
1682 <li>b
1683 </li>
1684 </ul>
1685 !! end
1686
1687 ###
1688 ### paragraph wrapping tests
1689 ###
1690 !! test
1691 No block tags
1692 !! wikitext
1693 a
1694
1695 b
1696 !! html
1697 <p>a
1698 </p><p>b
1699 </p>
1700 !! end
1701
1702 !! test
1703 Block tag on one line (<div>)
1704 !! wikitext
1705 a <div>foo</div>
1706
1707 b
1708 !! html
1709 a <div>foo</div>
1710 <p>b
1711 </p>
1712 !! html+tidy
1713 <p>a</p>
1714 <div>foo</div>
1715 <p>b</p>
1716 !! end
1717
1718 !! test
1719 Block tag on one line (<blockquote>)
1720 !! wikitext
1721 a <blockquote>foo</blockquote>
1722
1723 b
1724 !! html
1725 a <blockquote>foo</blockquote>
1726 <p>b
1727 </p>
1728 !! html+tidy
1729 <p>a</p>
1730 <blockquote>
1731 <p>foo</p>
1732 </blockquote>
1733 <p>b</p>
1734 !! end
1735
1736 !! test
1737 Block tag on both lines (<div>)
1738 !! wikitext
1739 a <div>foo</div>
1740
1741 b <div>foo</div>
1742 !! html
1743 a <div>foo</div>
1744 b <div>foo</div>
1745
1746 !! html+tidy
1747 <p>a</p>
1748 <div>foo</div>
1749 <p>b</p>
1750 <div>foo</div>
1751 !! end
1752
1753 !! test
1754 Block tag on both lines (<blockquote>)
1755 !! wikitext
1756 a <blockquote>foo</blockquote>
1757
1758 b <blockquote>foo</blockquote>
1759 !! html
1760 a <blockquote>foo</blockquote>
1761 b <blockquote>foo</blockquote>
1762
1763 !! html+tidy
1764 <p>a</p>
1765 <blockquote>
1766 <p>foo</p>
1767 </blockquote>
1768 <p>b</p>
1769 <blockquote>
1770 <p>foo</p>
1771 </blockquote>
1772 !! end
1773
1774 !! test
1775 Multiple lines without block tags
1776 !! wikitext
1777 <div>foo</div> a
1778 b
1779 c
1780 d<!--foo--> e
1781 x <div>foo</div> z
1782 !! html
1783 <div>foo</div> a
1784 <p>b
1785 c
1786 d e
1787 </p>
1788 x <div>foo</div> z
1789
1790 !! html+tidy
1791 <div>foo</div>
1792 <p>a</p>
1793 <p>b c d e</p>
1794 <p>x</p>
1795 <div>foo</div>
1796 <p>z</p>
1797 !! end
1798
1799 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1800 # So, we have a separate section for Parsoid. We don't want
1801 # to mimic this stripping behavior in Parsoid. It affects
1802 # editing experience and also requires us to maintain additional
1803 # info for RT-ing.
1804 !! test
1805 Empty lines between lines with block tags
1806 !! wikitext
1807 <div></div>
1808
1809
1810 <div></div>a
1811
1812 b
1813 <div>a</div>b
1814
1815 <div>b</div>d
1816
1817
1818 <div>e</div>
1819 !! html
1820 <div></div>
1821 <p><br />
1822 </p>
1823 <div></div>a
1824 <p>b
1825 </p>
1826 <div>a</div>b
1827 <div>b</div>d
1828 <p><br />
1829 </p>
1830 <div>e</div>
1831
1832 !! html+tidy
1833 <p><br /></p>
1834 <p>a</p>
1835 <p>b</p>
1836 <div>a</div>
1837 <p>b</p>
1838 <div>b</div>
1839 <p>d</p>
1840 <p><br /></p>
1841 <div>e</div>
1842 !! html/parsoid
1843 <div data-parsoid='{"stx":"html"}'></div>
1844
1845 <p><br /></p>
1846 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1847
1848 <p>b</p>
1849 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1850
1851 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1852
1853 <p><br /></p>
1854 <div data-parsoid='{"stx":"html"}'>e</div>
1855 !! end
1856
1857 ## PHP parser emits output which is broken
1858 !! test
1859 Unclosed HTML p-tags should be handled properly
1860 !! wikitext
1861 <div><p>foo</div>
1862 a
1863
1864 b
1865 !! html/php+tidy
1866 <div>
1867 <p>foo</p>
1868 </div>
1869 <p>a</p>
1870 <p>b</p>
1871 !! html/parsoid
1872 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1873 <p>a</p>
1874 <p>b</p>
1875 !! end
1876
1877 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1878 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1879 ## them for now.
1880 !! test
1881 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1882 !! options
1883 parsoid=wt2html
1884 !! wikitext
1885 a [[Category:A1]] [[Category:A2]]
1886 [[Category:A3]]
1887 [[Category:A4]]
1888 !! html/parsoid
1889 <p>a</p>
1890 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1891 !! end
1892
1893 !! test
1894 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1895 !! options
1896 parsoid=wt2html
1897 !! wikitext
1898 [[Category:A1]]a
1899 !! html/parsoid
1900 <link href="Category:A1"/><p>a</p>
1901 !! end
1902
1903 ###
1904 ### Preformatted text
1905 ###
1906 !! test
1907 Preformatted text
1908 !! wikitext
1909 This is some
1910 Preformatted text
1911 With ''italic''
1912 And '''bold'''
1913 And a [[Main Page|link]]
1914 !! html
1915 <pre>This is some
1916 Preformatted text
1917 With <i>italic</i>
1918 And <b>bold</b>
1919 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1920 </pre>
1921 !! end
1922
1923 !! test
1924 Tabs don't trigger preformatted text
1925 !! wikitext
1926 This is not
1927 preformatted text.
1928 This is preformatted text.
1929 So is this.
1930 !! html
1931 <p> This is not
1932 preformatted text.
1933 </p>
1934 <pre>This is preformatted text.
1935 So is this.
1936 </pre>
1937 !! end
1938
1939 !! test
1940 Ident preformatting with inline content
1941 !! wikitext
1942 a
1943 ''b''
1944 !! html
1945 <pre>a
1946 <i>b</i>
1947 </pre>
1948 !! end
1949
1950 !! test
1951 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1952 !! wikitext
1953 <pre><nowiki>
1954 <b>
1955 <cite>
1956 <em>
1957 </nowiki></pre>
1958 !! html
1959 <pre>
1960 &lt;b&gt;
1961 &lt;cite&gt;
1962 &lt;em&gt;
1963 </pre>
1964
1965 !! end
1966
1967 !! test
1968 Regression with preformatted in <center>
1969 !! wikitext
1970 <center>
1971 Blah
1972 </center>
1973 !! html
1974 <center>
1975 <pre>Blah
1976 </pre>
1977 </center>
1978
1979 !! end
1980
1981 !! test
1982 Bug 52763: Preformatted in <blockquote>
1983 !! wikitext
1984 <blockquote>
1985 Blah
1986 {|
1987 |
1988 indented cell (no pre-wrapping!)
1989 |}
1990 </blockquote>
1991 !! html
1992 <blockquote>
1993 <p> Blah
1994 </p>
1995 <table>
1996 <tr>
1997 <td>
1998 <p> indented cell (no pre-wrapping!)
1999 </p>
2000 </td></tr></table>
2001 </blockquote>
2002
2003 !! end
2004
2005 !! test
2006 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2007 !! wikitext
2008 <blockquote>
2009 Foo
2010
2011 Bar
2012 </blockquote>
2013 !! html
2014 <blockquote>
2015 <p>Foo
2016 </p><p>Bar
2017 </p>
2018 </blockquote>
2019
2020 !! end
2021
2022 !! test
2023 Bug 15491: <ins>/<del> in blockquote
2024 !! wikitext
2025 <blockquote>
2026 Foo <del>bar</del> <ins>baz</ins> quux
2027 </blockquote>
2028 !! html
2029 <blockquote>
2030 <p>Foo <del>bar</del> <ins>baz</ins> quux
2031 </p>
2032 </blockquote>
2033
2034 !! end
2035
2036 # Note that the p-wrapping is newline sensitive, which could be
2037 # considered a bug: tidy will wrap only the 'Foo' in the example
2038 # below in a <p> tag. (see comment 23-25 of bug #6200)
2039 !! test
2040 Bug 15491: <ins>/<del> in blockquote (2)
2041 !! wikitext
2042 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2043 </blockquote>
2044 !! html
2045 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2046 </blockquote>
2047
2048 !! html+tidy
2049 <blockquote>
2050 <p>Foo</p>
2051 <del>bar</del> <ins>baz</ins> quux</blockquote>
2052 !! end
2053
2054 !! test
2055 <pre> with attributes (bug 3202)
2056 !! wikitext
2057 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2058 !! html
2059 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2060
2061 !! end
2062
2063 !! test
2064 <pre> with width attribute (bug 3202)
2065 !! wikitext
2066 <pre width="8">Narrow screen goodies</pre>
2067 !! html
2068 <pre width="8">Narrow screen goodies</pre>
2069
2070 !! end
2071
2072 !! test
2073 <pre> with forbidden attribute (bug 3202)
2074 !! wikitext
2075 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2076 !! html
2077 <pre width="8">Narrow screen goodies</pre>
2078
2079 !! end
2080
2081 !! test
2082 Entities inside <pre>
2083 !! wikitext
2084 <pre>&lt;</pre>
2085 !! html
2086 <pre>&lt;</pre>
2087
2088 !! end
2089
2090 !! test
2091 <pre> with forbidden attribute values (bug 3202)
2092 !! wikitext
2093 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2094 !! html
2095 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2096
2097 !! end
2098
2099 !! test
2100 <nowiki> inside <pre> (bug 13238)
2101 !! wikitext
2102 <pre>
2103 <nowiki>
2104 </pre>
2105 <pre>
2106 <nowiki></nowiki>
2107 </pre>
2108 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2109 !! html
2110 <pre>
2111 &lt;nowiki&gt;
2112 </pre>
2113 <pre>
2114
2115 </pre>
2116 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2117
2118 !! end
2119
2120 !! test
2121 <nowiki> and <pre> preference (first one wins)
2122 !! wikitext
2123 <pre>
2124 <nowiki>
2125 </pre>
2126 </nowiki>
2127 </pre>
2128
2129 <nowiki>
2130 <pre>
2131 <nowiki>
2132 </pre>
2133 </nowiki>
2134 </pre>
2135
2136 !! html
2137 <pre>
2138 &lt;nowiki&gt;
2139 </pre>
2140 <p>&lt;/nowiki&gt;
2141 &lt;/pre&gt;
2142 </p><p>
2143 &lt;pre&gt;
2144 &lt;nowiki&gt;
2145 &lt;/pre&gt;
2146
2147 &lt;/pre&gt;
2148 </p>
2149 !! end
2150
2151 !! test
2152 </pre> inside nowiki
2153 !! wikitext
2154 <nowiki></pre></nowiki>
2155 !! html
2156 <p>&lt;/pre&gt;
2157 </p>
2158 !! end
2159
2160 # Parsoid doesn't strip empty tags, like Tidy does.
2161 !! test
2162 Empty pre; pre inside other HTML tags (bug 54946)
2163 !! options
2164 parsoid=wt2html,wt2wt
2165 !! wikitext
2166 a
2167
2168 <div><pre>
2169 foo
2170 </pre></div>
2171 <pre></pre>
2172 !! html/php
2173 <p>a
2174 </p>
2175 <div><pre>
2176 foo
2177 </pre></div>
2178 <pre></pre>
2179
2180 !! html/php+tidy
2181 <p>a</p>
2182 <div>
2183 <pre>
2184 foo
2185 </pre></div>
2186 !! html/parsoid
2187 <p>a</p>
2188
2189 <div><pre>foo
2190 </pre></div>
2191 <pre></pre>
2192 !! end
2193
2194 !! test
2195 HTML pre followed by indent-pre
2196 !! wikitext
2197 <pre>foo</pre>
2198 bar
2199 !! html
2200 <pre>foo</pre>
2201 <pre>bar
2202 </pre>
2203 !! end
2204
2205 !!test
2206 Block tag pre
2207 !!options
2208 parsoid
2209 !! wikitext
2210 <p><pre>foo</pre></p>
2211 !! html
2212 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2213 !!end
2214
2215 !!test
2216 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2217 !! wikitext
2218 {{echo|}}
2219 !! html
2220
2221 !!end
2222
2223 !!test
2224 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2225 !! wikitext
2226 {{echo|
2227 foo}}
2228 !! html
2229 <p>foo
2230 </p>
2231 !!end
2232
2233 !! test
2234 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2235 !! wikitext
2236 {{echo|a
2237 b}}
2238 !! html
2239 <pre>a
2240 </pre>
2241 <p>b
2242 </p>
2243 !!end
2244
2245 !! test
2246 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2247 !! wikitext
2248 {{echo|a
2249 b
2250 c
2251 d
2252 e
2253 }}
2254 !! html
2255 <pre>a
2256 </pre>
2257 <p>b
2258 c
2259 </p>
2260 <pre>d
2261 </pre>
2262 <p>e
2263 </p>
2264 !!end
2265
2266 !!test
2267 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2268 !! wikitext
2269 {{echo| foo}}
2270
2271 {{echo| foo}}{{echo| bar}}
2272
2273 {{echo| foo}}
2274 {{echo| bar}}
2275
2276 {{echo|<!--cmt--> foo}}
2277
2278 <!--cmt-->{{echo| foo}}
2279
2280 {{echo|{{echo| }}bar}}
2281 !! html
2282 <pre>foo
2283 </pre>
2284 <pre>foo bar
2285 </pre>
2286 <pre>foo
2287 bar
2288 </pre>
2289 <pre>foo
2290 </pre>
2291 <pre>foo
2292 </pre>
2293 <pre>bar
2294 </pre>
2295 !!end
2296
2297 !! test
2298 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2299 !! wikitext
2300 {{echo| }}a
2301
2302 {{echo|
2303 }}a
2304
2305 {{echo|
2306 b}}
2307
2308 {{echo|a
2309 }}b
2310
2311 {{echo|a
2312 }} b
2313 !! html
2314 <pre>a
2315 </pre>
2316 <p><br />
2317 </p>
2318 <pre>a
2319 </pre>
2320 <p><br />
2321 </p>
2322 <pre>b
2323 </pre>
2324 <p>a
2325 </p>
2326 <pre>b
2327 </pre>
2328 <p>a
2329 </p>
2330 <pre>b
2331 </pre>
2332 !!end
2333
2334 !! test
2335 Things that look like <pre> tags aren't treated as such
2336 !! wikitext
2337 Barack Obama <President> of the United States
2338 <President></President>
2339 !! html
2340 <p>Barack Obama &lt;President&gt; of the United States
2341 &lt;President&gt;&lt;/President&gt;
2342 </p>
2343 !! end
2344
2345 ## PHP parser discards the "<pre " string
2346 !! test
2347 Handle broken pre-like tags (bug 64025)
2348 !! options
2349 parsoid=wt2html
2350 !! wikitext
2351 {{echo|<pre <pre>x</pre>}}
2352
2353 <table><pre </table>
2354 !! html/php
2355 <pre>x</pre>
2356 <table><pre></pre></table>
2357
2358 !! html/parsoid
2359 <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>
2360
2361
2362 <p>&lt;pre </p>
2363
2364 <table></table>
2365 !! end
2366
2367 !! test
2368 Parsoid: handle pre with space after attribute
2369 !! options
2370 parsoid=wt2html
2371 !! wikitext
2372 <pre style="width:50%;" >{{echo|foo}}</pre>
2373 !! html
2374 <pre style="width:50%;">{{echo|foo}}</pre>
2375 !! end
2376
2377 # TODO / maybe: fix wt2wt for this
2378 !! test
2379 Parsoid: Don't paragraph-wrap fosterable content
2380 !! options
2381 parsoid=wt2html
2382 !! wikitext
2383 {|
2384 <td></td>
2385 <td></td>
2386
2387
2388
2389 |}
2390 !! html
2391 <table>
2392
2393 <tbody>
2394 <tr>
2395 <td></td>
2396
2397 <td></td></tr>
2398
2399
2400
2401 </tbody></table>
2402 !! end
2403
2404 !! test
2405 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2406 !! options
2407 parsoid=wt2html
2408 !! wikitext
2409 {|
2410 <td>
2411 <td>
2412 </td>
2413
2414
2415
2416 |}
2417 !! html
2418 <table>
2419
2420 <tbody>
2421 <tr>
2422 <td></td>
2423
2424 <td>
2425 </td></tr>
2426
2427
2428
2429 </tbody></table>
2430 !! end
2431
2432
2433 #--------------------------------------------------------------------
2434 # Transclusion parameter whitespace stripping tests
2435 # Behavior is different for positional and named parameters
2436 #--------------------------------------------------------------------
2437 !! test
2438 Templates: Strip leading and trailing whitespace from named-param values
2439 !! wikitext
2440 {{echo|1= a }}
2441
2442 {{echo|1= {{echo|b}} }}
2443
2444 {{echo| 1 =
2445 c }}
2446
2447 {{echo| 1 =
2448 * d
2449 }}
2450 !! html
2451 <p>a
2452 </p><p>b
2453 </p><p>c
2454 </p>
2455 <ul><li> d</li></ul>
2456
2457 !! end
2458
2459 !! test
2460 Templates: Don't strip whitespace from positional-param values
2461 !! wikitext
2462 {{echo|a }}
2463
2464 {{echo|{{echo|b}} }}
2465
2466 {{echo| c
2467 }}
2468
2469 {{echo| {{echo|d}}
2470 }}
2471
2472 {{echo|
2473 e}}
2474
2475 {{echo|
2476 * f}}
2477
2478 {{echo|
2479 }}g
2480 !! html
2481 <p>a
2482 </p><p>b
2483 </p>
2484 <pre>c
2485 </pre>
2486 <p><br />
2487 </p>
2488 <pre>d
2489 </pre>
2490 <p><br />
2491 </p>
2492 <pre>e
2493 </pre>
2494 <p><br />
2495 </p>
2496 <ul><li> f</li></ul>
2497 <p><br />
2498 </p>
2499 <pre>g
2500 </pre>
2501 !! end
2502
2503 !! test
2504 Templates: Handle empty comment-and-ws-only lines correctly
2505 !! wikitext
2506 {{echo|foo
2507 <!--should be ignored-->
2508 <!--should be ignored as well-->
2509 bar}}
2510 !! html
2511 <p>foo
2512 bar
2513 </p>
2514 !! end
2515
2516 !! test
2517 Templates: Handle comments in the target
2518 !! wikitext
2519 {{echo
2520 <!-- should be ignored -->
2521 |foo}}
2522
2523 {{echo<!-- should be ignored -->
2524 |foo}}
2525
2526 {{echo<!-- should be ignored -->|foo}}
2527
2528 {{<!-- should be ignored -->echo|foo}}
2529 !!html/parsoid
2530 <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>
2531
2532 <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>
2533
2534 <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>
2535
2536 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2537 !!end
2538
2539 !! test
2540 Templates: Handle comments in parameter names (bug 67657)
2541 !! wikitext
2542 {{echo|1
2543 <!-- should be ignored -->
2544 =foo}}
2545
2546 {{echo|
2547 <!-- should be ignored -->
2548 1 = foo}}
2549
2550 {{echo|1<!-- should be ignored --> = foo}}
2551
2552 {{echo|<!-- should be ignored -->1 = foo}}
2553 !!html/parsoid
2554 <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>
2555
2556 <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>
2557
2558 <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>
2559
2560 <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>
2561 !!end
2562
2563 !! test
2564 Templates: Other wikitext in parameter names (bug 67657)
2565 !! wikitext
2566 {{echo|''1''=foo}}
2567 !!html/parsoid
2568 <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>
2569 !!html/php
2570 <p>{{{1}}}
2571 </p>
2572 !!end
2573
2574 #--------------------------------------------------------------------
2575 # Transclusion parameter escaping tests
2576 #--------------------------------------------------------------------
2577 !! test
2578 Templates: Parsoid parameter escaping test 1
2579 !! options
2580 parsoid
2581 !! wikitext
2582 {{echo|[foo]|{{echo|[bar]}}}}
2583 !! html
2584 <p about="#mwt1" typeof="mw:Transclusion"
2585 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2586 !! end
2587
2588 !! test
2589 Parsoid: Pipes in external links in template parameter
2590 !! options
2591 parsoid
2592 !! wikitext
2593 {{echo|[{{echo|http://example.com}} link]}}
2594 !! html
2595 <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>
2596 !! end
2597
2598 !! test
2599 Parsoid: pipe in transclusion parameter
2600 !! options
2601 parsoid
2602 !! wikitext
2603 {{echo|http://foo.com/a&#124;b}}
2604 !! html
2605 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2606 typeof="mw:Transclusion"
2607 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>
2608 !! end
2609
2610 !! test
2611 Parsoid: Pipe in external link target and content in template parameter
2612 !! options
2613 parsoid=html2wt,wt2wt
2614 !! wikitext
2615 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2616 !! html
2617 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2618 typeof="mw:Transclusion"
2619 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2620 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2621 !! end
2622
2623 !! test
2624 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2625 !! options
2626 parsoid
2627 !! wikitext
2628 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2629 !! html
2630 <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>
2631 !! end
2632
2633 !! test
2634 Templates: Don't escape already nowiki-escaped text in template parameters
2635 !! options
2636 parsoid=html2wt,wt2wt
2637 !! wikitext
2638 {{echo|foo<nowiki>|</nowiki>bar}}
2639 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2640 {{echo|<nowiki></nowiki>}}
2641 !! html
2642 <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>
2643 <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>
2644 <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>
2645 </p>
2646 !! end
2647
2648 ## Bug 52824
2649 !! test
2650 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2651 !! options
2652 parsoid=html2wt,wt2wt
2653 !! wikitext
2654 {{echo|{{echo|1=bar}}}}
2655 !! html
2656 <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>
2657 !! end
2658
2659 ## Bug 56733
2660 !! test
2661 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2662 !! options
2663 parsoid
2664 !! wikitext
2665 {{echo|a : b}}
2666 !! html
2667 <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>
2668 !! end
2669
2670 ## Bug T73412
2671 !! test
2672 Templates: Preserve blank parameter names
2673 !! wikitext
2674 {{echo|=foo}}
2675 !! html/php
2676 <p>{{{1}}}
2677 </p>
2678 !! html/parsoid
2679 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2680 !! end
2681
2682 ###
2683 ### Parsoid-centric tests for testing RT edge cases for pre
2684 ###
2685
2686 !!test
2687 1a. Indent-Pre and Comments
2688 !! wikitext
2689 a
2690 <!--a-->
2691 c
2692 !! html
2693 <pre>a
2694 </pre>
2695 <p>c
2696 </p>
2697 !!end
2698
2699 !!test
2700 1b. Indent-Pre and Comments
2701 !! wikitext
2702 a
2703 <!--a-->
2704 c
2705 !! html
2706 <pre>a
2707 </pre>
2708 <p>c
2709 </p>
2710 !!end
2711
2712 !!test
2713 1c. Indent-Pre and Comments
2714 !! wikitext
2715 <!--a--> a
2716
2717 <!--a--> a
2718 !! html
2719 <pre> a
2720 </pre>
2721 <pre> a
2722 </pre>
2723 !!end
2724
2725 !!test
2726 1d. Indent-Pre and Comments
2727 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2728 !! wikitext
2729 <!--a--> a
2730
2731 <!--b-->b
2732 !! html
2733 <pre>a
2734 </pre>
2735 <pre>b
2736 </pre>
2737 !!end
2738
2739 !!test
2740 2a. Indent-Pre and tables
2741 !! wikitext
2742 {|
2743 |-
2744 !h1!!h2
2745 |foo||bar
2746 |}
2747 !! html
2748 <table>
2749
2750 <tr>
2751 <th>h1</th>
2752 <th>h2
2753 </th>
2754 <td>foo</td>
2755 <td>bar
2756 </td></tr></table>
2757
2758 !!end
2759
2760 !!test
2761 2b. Indent-Pre and tables
2762 !! wikitext
2763 {|
2764 |-
2765 |foo
2766 |}
2767 !! html
2768 <table>
2769
2770 <tr>
2771 <td>foo
2772 </td></tr></table>
2773
2774 !!end
2775
2776 !!test
2777 2c. Indent-Pre and tables (bug 42252)
2778 !! wikitext
2779 {|
2780 |+ foo
2781 ! | bar
2782 |}
2783 !! html
2784 <table>
2785 <caption> foo
2786 </caption>
2787 <tr>
2788 <th> bar
2789 </th></tr></table>
2790
2791 !!end
2792
2793 !!test
2794 2d. Indent-Pre and tables
2795 !! wikitext
2796 a
2797 {|
2798 | b
2799 |}
2800 !! html/php
2801 <pre>a
2802 </pre>
2803 <table>
2804 <tr>
2805 <td> b
2806 </td></tr></table>
2807
2808 !! html/parsoid
2809 <pre>a</pre>
2810 <table>
2811 <tbody><tr><td> b</td></tr>
2812 </tbody></table>
2813 !!end
2814
2815 !!test
2816 2e. Indent-Pre and table-line syntax
2817 !! wikitext
2818 a
2819 | b
2820 | c
2821 !! html/php
2822 <pre>a
2823 | b
2824 | c
2825 </pre>
2826 !!end
2827
2828 !!test
2829 2f. Indent-pre started by table-line syntax
2830 !! wikitext
2831 a
2832 | b
2833 | c
2834 !! html/php
2835 <p>a
2836 </p>
2837 <pre>| b
2838 | c
2839 </pre>
2840 !! html/parsoid
2841 <p>a</p>
2842 <pre>
2843 | b
2844 | c</pre>
2845 !!end
2846
2847 !!test
2848 3a. Indent-Pre and block tags (single-line html)
2849 !! wikitext
2850 a <p> foo </p>
2851 b <div> foo </div>
2852 c <blockquote> foo </blockquote>
2853 <span> foo </span>
2854 !! html
2855 a <p> foo </p>
2856 b <div> foo </div>
2857 c <blockquote> foo </blockquote>
2858 <pre><span> foo </span>
2859 </pre>
2860 !! html/parsoid
2861 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2862 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2863 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2864 <pre><span> foo </span>
2865 </pre>
2866 !! html+tidy
2867 <p>a</p>
2868 <p>foo</p>
2869 <p>b</p>
2870 <div>foo</div>
2871 <p>c</p>
2872 <blockquote>
2873 <p>foo</p>
2874 </blockquote>
2875 <pre>
2876 <span> foo </span>
2877 </pre>
2878 !! end
2879
2880 !!test
2881 3b. Indent-Pre and block tags (multi-line html)
2882 !! wikitext
2883 a <span>foo</span>
2884 b <div> foo </div>
2885 !! html
2886 <pre>a <span>foo</span>
2887 </pre>
2888 b <div> foo </div>
2889
2890 !! html/parsoid
2891 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2892 b <div data-parsoid='{"stx":"html"}'> foo </div>
2893 !! html+tidy
2894 <pre>
2895 a <span>foo</span>
2896 </pre>
2897 <p>b</p>
2898 <div>foo</div>
2899 !!end
2900
2901 !!test
2902 3c. Indent-Pre and block tags (pre-content on separate line)
2903 !! wikitext
2904 <p>
2905 foo
2906 </p>
2907
2908 <div>
2909 foo
2910 </div>
2911
2912 <center>
2913 foo
2914 </center>
2915
2916 <blockquote>
2917 foo
2918 </blockquote>
2919
2920 <blockquote>
2921 <pre>
2922 foo
2923 </pre>
2924 </blockquote>
2925
2926 <table><tr><td>
2927 foo
2928 </td></tr></table>
2929
2930 <ul><li>
2931 foo
2932 </li></ul>
2933
2934 !! html
2935 <p>
2936 foo
2937 </p>
2938 <div>
2939 <pre>foo
2940 </pre>
2941 </div>
2942 <center>
2943 <pre>foo
2944 </pre>
2945 </center>
2946 <blockquote>
2947 <p> foo
2948 </p>
2949 </blockquote>
2950 <blockquote>
2951 <pre>
2952 foo
2953 </pre>
2954 </blockquote>
2955 <table><tr><td>
2956 <pre>foo
2957 </pre>
2958 </td></tr></table>
2959 <ul><li>
2960 foo
2961 </li></ul>
2962
2963 !!end
2964
2965 !!test
2966 4. Indent-Pre and extension tags
2967 !! wikitext
2968 a <gallery>
2969 File:foobar.jpg
2970 </gallery>
2971 !! html
2972 a <ul class="gallery mw-gallery-traditional">
2973 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2974 <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>
2975 <div class="gallerytext">
2976 </div>
2977 </div></li>
2978 </ul>
2979
2980 !! html+tidy
2981 <p>a</p>
2982 <ul class="gallery mw-gallery-traditional">
2983 <li class="gallerybox" style="width: 155px">
2984 <div style="width: 155px">
2985 <div class="thumb" style="width: 150px;">
2986 <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>
2987 </div>
2988 <div class="gallerytext"></div>
2989 </div>
2990 </li>
2991 </ul>
2992 !!end
2993
2994 !! test
2995 Table wikitext syntax outside wiki-tables
2996 !! wikitext
2997 a
2998 ! not a table heading
2999 |- not a table row
3000 | not a table cell
3001 | class="foo bar" | baz
3002 b
3003 |}
3004 |-
3005 c
3006 !! html
3007 <p>a
3008 ! not a table heading
3009 |- not a table row
3010 | not a table cell
3011 | class="foo bar" | baz
3012 b
3013 |}
3014 |-
3015 c
3016 </p>
3017 !! end
3018
3019 !!test
3020 Render paragraphs when indent-pre is suppressed in blocklevels
3021 !! wikitext
3022 <blockquote>
3023 foo
3024
3025 bar
3026 </blockquote>
3027 !! html
3028 <blockquote>
3029 <p> foo
3030 </p><p> bar
3031 </p>
3032 </blockquote>
3033
3034 !!end
3035
3036 !!test
3037 4. Multiple spaces at start-of-line
3038 !! wikitext
3039 <p> foo </p>
3040 foo
3041 {|
3042 |foo
3043 |}
3044 !! html
3045 <p> foo </p>
3046 <pre> foo
3047 </pre>
3048 <table>
3049 <tr>
3050 <td>foo
3051 </td></tr></table>
3052
3053 !!end
3054
3055 ## NOTE: the leading white-space chars on empty line are significant
3056 !! test
3057 5a. White-space in indent-pre
3058 !! wikitext
3059 a<br />
3060
3061 b
3062 !! html
3063 <pre>a<br />
3064
3065 b
3066 </pre>
3067 !! end
3068
3069 ## NOTE: the leading white-space chars on empty line are significant
3070 !! test
3071 5b. White-space in indent-pre
3072 !! wikitext
3073 a
3074
3075 b
3076
3077
3078 c
3079 !! html
3080 <pre>a
3081
3082 b
3083
3084
3085 c
3086 </pre>
3087 !! end
3088
3089 !! test
3090 5c. White-space in indent-pre
3091 !! wikitext
3092 ''a''
3093 ''b''
3094 ''c''
3095 !! html
3096 <pre><i>a</i>
3097 <i>b</i>
3098 <i>c</i>
3099 </pre>
3100 !! end
3101
3102 !! test
3103 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3104 !! wikitext
3105 a
3106
3107 <!-- continue -->
3108 b
3109
3110 c
3111
3112 d
3113 !! html
3114 <pre>a
3115
3116 b
3117 </pre>
3118 <pre>c
3119
3120 </pre>
3121 <p>d
3122 </p>
3123 !! end
3124
3125 !! test
3126 7a. Indent-pre and category links
3127 !! options
3128 parsoid=wt2html,wt2wt
3129 !! wikitext
3130 [[Category:foo]] <!-- No pre-wrapping -->
3131 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3132 !! html
3133 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3134 <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 -->
3135 !! end
3136
3137 !! test
3138 7b. Indent-pre and category links
3139 !! options
3140 parsoid=wt2html,wt2wt
3141 !! wikitext
3142 [[Category:foo]] a
3143 [[Category:foo]] {{echo|b}}
3144 !! html
3145 <pre>
3146 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3147 <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>
3148 !! end
3149
3150 ###
3151 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3152 ###
3153
3154 !!test
3155 HTML-pre: 1. embedded newlines
3156 !! wikitext
3157 <pre>foo</pre>
3158
3159 <pre>
3160 foo
3161 </pre>
3162
3163 <pre>
3164
3165 foo
3166 </pre>
3167
3168 <pre>
3169
3170
3171 foo
3172 </pre>
3173 !! html
3174 <pre>foo</pre>
3175 <pre>
3176 foo
3177 </pre>
3178 <pre>
3179
3180 foo
3181 </pre>
3182 <pre>
3183
3184
3185 foo
3186 </pre>
3187
3188 !! html/parsoid
3189 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3190
3191 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3192 foo
3193 </pre>
3194
3195 <pre data-parsoid='{"stx":"html"}'>
3196
3197 foo
3198 </pre>
3199
3200 <pre data-parsoid='{"stx":"html"}'>
3201
3202
3203 foo
3204 </pre>
3205 !!end
3206
3207 !! test
3208 HTML-pre: big spaces
3209 !! wikitext
3210 <pre>
3211
3212
3213
3214
3215 haha
3216
3217
3218
3219
3220 haha
3221
3222
3223
3224
3225 </pre>
3226 !! html
3227 <pre>
3228
3229
3230
3231
3232 haha
3233
3234
3235
3236
3237 haha
3238
3239
3240
3241
3242 </pre>
3243
3244 !! html/parsoid
3245 <pre data-parsoid='{"stx":"html"}'>
3246
3247
3248
3249
3250 haha
3251
3252
3253
3254
3255 haha
3256
3257
3258
3259
3260 </pre>
3261 !! end
3262
3263 !!test
3264 HTML-pre: 2: indented text
3265 !! wikitext
3266 <pre>
3267 foo
3268 </pre>
3269 !! html
3270 <pre>
3271 foo
3272 </pre>
3273
3274 !!end
3275
3276 !!test
3277 HTML-pre: 3: other wikitext
3278 !! wikitext
3279 <pre>
3280 * foo
3281 # bar
3282 = no-h =
3283 '' no-italic ''
3284 [[ NoLink ]]
3285 </pre>
3286 !! html
3287 <pre>
3288 * foo
3289 # bar
3290 = no-h =
3291 '' no-italic ''
3292 [[ NoLink ]]
3293 </pre>
3294
3295 !!end
3296
3297 ###
3298 ### Definition lists
3299 ###
3300 !! test
3301 Simple definition
3302 !! wikitext
3303 ; name : Definition
3304 !! html
3305 <dl><dt> name&#160;</dt>
3306 <dd> Definition</dd></dl>
3307
3308 !! end
3309
3310 !! test
3311 Definition list for indentation only
3312 !! wikitext
3313 : Indented text
3314 !! html
3315 <dl><dd> Indented text</dd></dl>
3316
3317 !! end
3318
3319 !! test
3320 Definition list with no space
3321 !! wikitext
3322 ;name:Definition
3323 !! html
3324 <dl><dt>name</dt>
3325 <dd>Definition</dd></dl>
3326
3327 !!end
3328
3329 !! test
3330 Definition list with URL link
3331 !! wikitext
3332 ; http://example.com/ : definition
3333 !! html
3334 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3335 <dd> definition</dd></dl>
3336
3337 !! end
3338
3339 !! test
3340 Definition list with bracketed URL link
3341 !! wikitext
3342 ;[http://www.example.com/ Example]:Something about it
3343 !! html
3344 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3345 <dd>Something about it</dd></dl>
3346
3347 !! end
3348
3349 !! test
3350 Definition list with wikilink containing colon
3351 !! wikitext
3352 ; [[Help:FAQ]]: The least-read page on Wikipedia
3353 !! html
3354 <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>
3355 <dd> The least-read page on Wikipedia</dd></dl>
3356
3357 !! end
3358
3359 # At Brion's and JeLuF's insistence... :)
3360 !! test
3361 Definition list with news link containing colon
3362 !! wikitext
3363 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3364 !! html/php
3365 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3366 <dd> This isn't even a real newsgroup!</dd></dl>
3367
3368 !! html/parsoid
3369 <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>
3370 !! end
3371
3372 !! test
3373 Malformed definition list with colon
3374 !! wikitext
3375 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3376 !! html
3377 <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>
3378
3379 !! end
3380
3381 !! test
3382 Definition lists: colon in external link text
3383 !! wikitext
3384 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3385 !! html
3386 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3387 <dd> OK, I made that up</dd></dl>
3388
3389 !! end
3390
3391 !! test
3392 Definition lists: colon in HTML attribute
3393 !! wikitext
3394 ;<b style="display: inline">bold</b>
3395 !! html
3396 <dl><dt><b style="display: inline">bold</b></dt></dl>
3397
3398 !! end
3399
3400 !! test
3401 Definition lists: self-closed tag
3402 !! wikitext
3403 ;one<br/>two : two-line fun
3404 !! html
3405 <dl><dt>one<br />two&#160;</dt>
3406 <dd> two-line fun</dd></dl>
3407
3408 !! end
3409
3410 !! test
3411 Bug 11748: Literal closing tags
3412 !! wikitext
3413 <dl>
3414 <dt>test 1</dt>
3415 <dd>test test test test test</dd>
3416 <dt>test 2</dt>
3417 <dd>test test test test test</dd>
3418 </dl>
3419 !! html
3420 <dl>
3421 <dt>test 1</dt>
3422 <dd>test test test test test</dd>
3423 <dt>test 2</dt>
3424 <dd>test test test test test</dd>
3425 </dl>
3426
3427 !! end
3428
3429 !! test
3430 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3431 !! wikitext
3432 <ul><li>
3433 ; term : description
3434 * unordered
3435 </li></ul>
3436 !! html
3437 <ul><li>
3438 <dl><dt> term&#160;</dt>
3439 <dd> description</dd></dl>
3440 <ul><li> unordered</li></ul>
3441 </li></ul>
3442
3443 !! end
3444
3445 !! test
3446
3447 Definition list with empty definition and following paragraph
3448 !! wikitext
3449 ; term:
3450 Paragraph text
3451 !! html
3452 <dl><dt> term</dt>
3453 <dd></dd></dl>
3454 <p>Paragraph text
3455 </p>
3456 !! end
3457
3458 !! test
3459 Nested definition lists using html syntax
3460 !! wikitext
3461 <dl><dt>x</dt>
3462 <dd>a</dd>
3463 <dd>b</dd></dl>
3464
3465 !! end
3466
3467 !! test
3468 Definition Lists: No nesting: Multiple dd's
3469 !! wikitext
3470 ;x
3471 :a
3472 :b
3473 !! html
3474 <dl><dt>x</dt>
3475 <dd>a</dd>
3476 <dd>b</dd></dl>
3477
3478 !! end
3479
3480 !! test
3481 Definition Lists: Indentation: Regular
3482 !! wikitext
3483 :i1
3484 ::i2
3485 :::i3
3486 !! html
3487 <dl><dd>i1
3488 <dl><dd>i2
3489 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3490
3491 !! end
3492
3493 !! test
3494 Definition Lists: Indentation: Missing 1st level
3495 !! wikitext
3496 ::i2
3497 :::i3
3498 !! html
3499 <dl><dd><dl><dd>i2
3500 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3501
3502 !! end
3503
3504 !! test
3505 Definition Lists: Indentation: Multi-level indent
3506 !! wikitext
3507 :::i3
3508 !! html
3509 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3510
3511 !! end
3512
3513 !! test
3514 Definition Lists: Hacky use to indent tables
3515 !! wikitext
3516 ::{|
3517 |foo
3518 |bar
3519 |}
3520 this text
3521 should be left alone
3522 !! html
3523 <dl><dd><dl><dd><table>
3524 <tr>
3525 <td>foo
3526 </td>
3527 <td>bar
3528 </td></tr></table></dd></dl></dd></dl>
3529 <p>this text
3530 should be left alone
3531 </p>
3532 !! end
3533
3534 !! test
3535 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3536 !! wikitext
3537 <!-- foo -->
3538 ::{|
3539 |foo
3540 |bar
3541 |}<!-- bar -->
3542 this text
3543 should be left alone
3544 !! html/parsoid
3545 <!-- foo -->
3546 <dl><dd><dl><dd><table><tr>
3547 <td>foo</td>
3548 <td>bar</td>
3549 </tr></table><!-- bar --></dd></dl></dd></dl>
3550 <p>this text
3551 should be left alone</p>
3552 !! end
3553
3554 !! test
3555 Definition Lists: Hacky use to indent tables, with comment before table
3556 !! wikitext
3557 ::<!-- foo -->{|
3558 |foo
3559 |}
3560 !! html/parsoid
3561 <dl><dd><dl><dd><!-- foo --><table><tr>
3562 <td>foo</td>
3563 </tr></table></dd></dl></dd></dl>
3564 !! end
3565
3566 # Bug 52473
3567 !! test
3568 Definition Lists: Hacky use to indent tables (WS-insensitive)
3569 !! options
3570 parsoid
3571 !! wikitext
3572 : {|
3573 |a
3574 |}
3575 !! html
3576 <dl>
3577 <dd> <table><tr><td>a</td></tr></table> </dd>
3578 </dl>
3579 !! end
3580 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3581 ## as an empty dt item. It also ignores all but the last ";" when followed
3582 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3583 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3584 ## ";"s.
3585 ##
3586 ## Ex: ";;t2 ::d2" is transformed into:
3587 ##
3588 ## <dl>
3589 ## <dt>t2 </dt>
3590 ## <dd>
3591 ## <dl>
3592 ## <dt></dt>
3593 ## <dd>d2</dd>
3594 ## </dl>
3595 ## </dd>
3596 ## </dl>
3597 ##
3598 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3599 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3600 ##
3601 ## <dl>
3602 ## <dt>
3603 ## <dl>
3604 ## <dt>t2 </dt>
3605 ## <dd>:d2</dd>
3606 ## </dl>
3607 ## </dt>
3608 ## </dl>
3609 ##
3610 ## All Parsoid only definition list tests have this difference.
3611 ##
3612 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3613 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3614
3615 !! test
3616 Table / list interaction: indented table with lists in table contents
3617 !! wikitext
3618 :{|
3619 |-
3620 | a
3621 * b
3622 |-
3623 | c
3624 * d
3625 |}
3626 !! html
3627 <dl><dd><table>
3628
3629 <tr>
3630 <td> a
3631 <ul><li> b</li></ul>
3632 </td></tr>
3633 <tr>
3634 <td> c
3635 <ul><li> d</li></ul>
3636 </td></tr></table></dd></dl>
3637
3638 !! end
3639
3640 !!test
3641 Table / list interaction: lists nested in tables nested in indented lists
3642 !! wikitext
3643 :{|
3644 |
3645 :a
3646 :b
3647 |
3648 *c
3649 *d
3650 |}
3651
3652 *e
3653 *f
3654 !! html
3655 <dl><dd><table>
3656 <tr>
3657 <td>
3658 <dl><dd>a</dd>
3659 <dd>b</dd></dl>
3660 </td>
3661 <td>
3662 <ul><li>c</li>
3663 <li>d</li></ul>
3664 </td></tr></table></dd></dl>
3665 <ul><li>e</li>
3666 <li>f</li></ul>
3667
3668 !!end
3669
3670 !! test
3671 Definition Lists: Nesting: Multi-level (Parsoid only)
3672 !! options
3673 parsoid
3674 !! wikitext
3675 ;t1 :d1
3676 ;;t2 ::d2
3677 ;;;t3 :::d3
3678 !! html
3679 <dl>
3680 <dt>t1 </dt>
3681 <dd>d1</dd>
3682 <dt>
3683 <dl>
3684 <dt>t2 </dt>
3685 <dd>:d2</dd>
3686 <dt>
3687 <dl>
3688 <dt>t3 </dt>
3689 <dd>::d3</dd>
3690 </dl>
3691 </dt>
3692 </dl>
3693 </dt>
3694 </dl>
3695
3696
3697 !! end
3698
3699
3700 !! test
3701 Definition Lists: Nesting: Test 2 (Parsoid only)
3702 !! options
3703 parsoid
3704 !! wikitext
3705 ;t1
3706 ::d2
3707 !! html
3708 <dl>
3709 <dt>t1</dt>
3710 <dd>
3711 <dl>
3712 <dd>d2</dd>
3713 </dl>
3714 </dd>
3715 </dl>
3716
3717 !! end
3718
3719
3720 !! test
3721 Definition Lists: Nesting: Test 3 (Parsoid only)
3722 !! options
3723 parsoid
3724 !! wikitext
3725 :;t1
3726 ::::d2
3727 !! html
3728 <dl>
3729 <dd>
3730 <dl>
3731 <dt>t1</dt>
3732 <dd>
3733 <dl>
3734 <dd>
3735 <dl>
3736 <dd>d2</dd>
3737 </dl>
3738 </dd>
3739 </dl>
3740 </dd>
3741 </dl>
3742 </dd>
3743 </dl>
3744
3745 !! end
3746
3747
3748 !! test
3749 Definition Lists: Nesting: Test 4
3750 !! wikitext
3751 ::;t3
3752 :::d3
3753 !! html
3754 <dl><dd><dl><dd><dl><dt>t3</dt>
3755 <dd>d3</dd></dl></dd></dl></dd></dl>
3756
3757 !! end
3758
3759
3760 ## The Parsoid team believes the following three test exposes a
3761 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3762 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3763 ## It also exposes a "misfeature" in tidy, which doesn't like
3764 ## <dl> tags with a single <dt> child; it converts the <dt> into
3765 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3766 !! test
3767 Definition Lists: Mixed Lists: Test 1
3768 !! wikitext
3769 :;* foo
3770 ::* bar
3771 :; baz
3772 !! html/php
3773 <dl><dd><dl><dt><ul><li> foo</li>
3774 <li> bar</li></ul></dt></dl>
3775 <dl><dt> baz</dt></dl></dd></dl>
3776
3777 !! html/php+tidy
3778 <dl>
3779 <dd>
3780 <dl>
3781 <dd>
3782 <ul>
3783 <li>foo</li>
3784 <li>bar</li>
3785 </ul>
3786 </dd>
3787 </dl>
3788 <dl>
3789 <dt>baz</dt>
3790 </dl>
3791 </dd>
3792 </dl>
3793 !! html/parsoid
3794 <dl>
3795 <dd><dl>
3796 <dt><ul>
3797 <li> foo
3798 </li>
3799 </ul></dt>
3800 <dd><ul>
3801 <li> bar
3802 </li>
3803 </ul></dd>
3804 <dt> baz</dt>
3805 </dl></dd>
3806 </dl>
3807 !! end
3808
3809 !! test
3810 Definition Lists: Mixed Lists: Test 2
3811 !! wikitext
3812 *: d1
3813 *: d2
3814 !! html
3815 <ul><li><dl><dd> d1</dd>
3816 <dd> d2</dd></dl></li></ul>
3817
3818 !! end
3819
3820
3821 !! test
3822 Definition Lists: Mixed Lists: Test 3
3823 !! wikitext
3824 *::: d1
3825 *::: d2
3826 !! html
3827 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3828 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3829
3830 !! end
3831
3832
3833 !! test
3834 Definition Lists: Mixed Lists: Test 4
3835 !! wikitext
3836 *;d1 :d2
3837 *;d3 :d4
3838 !! html
3839 <ul><li><dl><dt>d1&#160;</dt>
3840 <dd>d2</dd>
3841 <dt>d3&#160;</dt>
3842 <dd>d4</dd></dl></li></ul>
3843
3844 !! end
3845
3846
3847 !! test
3848 Definition Lists: Mixed Lists: Test 5
3849 !! wikitext
3850 *:d1
3851 *:: d2
3852 !! html
3853 <ul><li><dl><dd>d1
3854 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3855
3856 !! end
3857
3858
3859 !! test
3860 Definition Lists: Mixed Lists: Test 6
3861 !! wikitext
3862 #*:d1
3863 #*::: d3
3864 !! html
3865 <ol><li><ul><li><dl><dd>d1
3866 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3867
3868 !! end
3869
3870
3871 !! test
3872 Definition Lists: Mixed Lists: Test 7
3873 !! wikitext
3874 :* d1
3875 :* d2
3876 !! html
3877 <dl><dd><ul><li> d1</li>
3878 <li> d2</li></ul></dd></dl>
3879
3880 !! end
3881
3882
3883 !! test
3884 Definition Lists: Mixed Lists: Test 8
3885 !! wikitext
3886 :* d1
3887 ::* d2
3888 !! html
3889 <dl><dd><ul><li> d1</li></ul>
3890 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3891
3892 !! end
3893
3894
3895 !! test
3896 Definition Lists: Mixed Lists: Test 9
3897 !! wikitext
3898 *;foo :bar
3899 !! html
3900 <ul><li><dl><dt>foo&#160;</dt>
3901 <dd>bar</dd></dl></li></ul>
3902
3903 !! end
3904
3905
3906 !! test
3907 Definition Lists: Mixed Lists: Test 10
3908 !! wikitext
3909 *#;foo :bar
3910 !! html
3911 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3912 <dd>bar</dd></dl></li></ol></li></ul>
3913
3914 !! end
3915
3916 # The Parsoid team disagrees with the PHP parser's seemingly-random
3917 # rules regarding dd/dt on the next two tests. Parsoid is more
3918 # consistent, and recognizes the shared nesting and keeps the
3919 # still-open tags around until the nesting is complete.
3920 # (And tidy again converts <dt> to <dd> before 'bar'.)
3921
3922 !! test
3923 Definition Lists: Mixed Lists: Test 11
3924 !! wikitext
3925 *#*#;*;;foo :bar
3926 *#*#;boo :baz
3927 !! html/php
3928 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3929 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3930 <dl><dt>boo&#160;</dt>
3931 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3932
3933 !! html/php+tidy
3934 <ul>
3935 <li>
3936 <ol>
3937 <li>
3938 <ul>
3939 <li>
3940 <ol>
3941 <li>
3942 <dl>
3943 <dt>foo&#160;</dt>
3944 <dd>
3945 <ul>
3946 <li>
3947 <dl>
3948 <dd>
3949 <dl>
3950 <dt>bar</dt>
3951 </dl>
3952 </dd>
3953 </dl>
3954 </li>
3955 </ul>
3956 </dd>
3957 </dl>
3958 <dl>
3959 <dt>boo&#160;</dt>
3960 <dd>baz</dd>
3961 </dl>
3962 </li>
3963 </ol>
3964 </li>
3965 </ul>
3966 </li>
3967 </ol>
3968 </li>
3969 </ul>
3970 !! html/parsoid
3971 <ul>
3972 <li>
3973 <ol>
3974 <li>
3975 <ul>
3976 <li>
3977 <ol>
3978 <li>
3979 <dl>
3980 <dt>
3981 <ul>
3982 <li>
3983 <dl>
3984 <dt>
3985 <dl>
3986 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3987 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3988 </dl></dt>
3989 </dl></li>
3990 </ul></dt>
3991 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3992 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3993 </dl></li>
3994 </ol></li>
3995 </ul></li>
3996 </ol></li>
3997 </ul>
3998 !! end
3999
4000
4001 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4002 !! test
4003 Definition Lists: Weird Ones: Test 1
4004 !! wikitext
4005 *#;*::;; foo : bar (who uses this?)
4006 !! html/php
4007 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4008 <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>
4009
4010 !! html/php+tidy
4011 <ul>
4012 <li>
4013 <ol>
4014 <li>
4015 <dl>
4016 <dt>foo&#160;</dt>
4017 <dd>
4018 <ul>
4019 <li>
4020 <dl>
4021 <dd>
4022 <dl>
4023 <dd>
4024 <dl>
4025 <dd>
4026 <dl>
4027 <dt>bar (who uses this?)</dt>
4028 </dl>
4029 </dd>
4030 </dl>
4031 </dd>
4032 </dl>
4033 </dd>
4034 </dl>
4035 </li>
4036 </ul>
4037 </dd>
4038 </dl>
4039 </li>
4040 </ol>
4041 </li>
4042 </ul>
4043 !! html/parsoid
4044 <ul>
4045 <li>
4046 <ol>
4047 <li>
4048 <dl>
4049 <dt>
4050 <ul>
4051 <li>
4052 <dl>
4053 <dd>
4054 <dl>
4055 <dd>
4056 <dl>
4057 <dt>
4058 <dl>
4059 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
4060 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4061 </dl></dt>
4062 </dl></dd>
4063 </dl></dd>
4064 </dl></li>
4065 </ul></dt>
4066 </dl></li>
4067 </ol></li>
4068 </ul>
4069 !! end
4070
4071 !! test
4072 Definition Lists: colons occurring in tags
4073 !! wikitext
4074 ;a:b
4075 ;'''a:b'''
4076 ;<i>a:b</i>
4077 ;<span>a:b</span>
4078 ;<div>a:b</div>
4079 ;<div>a
4080 :b</div>
4081 ;{{echo|a:b}}
4082 ;{{echo|''a:b''}}
4083 !! html+tidy
4084 <dl>
4085 <dt>a</dt>
4086 <dd>b</dd>
4087 <dt><b>a:b</b></dt>
4088 <dt><i>a:b</i></dt>
4089 <dt><span>a:b</span></dt>
4090 <dd>
4091 <div>a:b</div>
4092 </dd>
4093 <dd>
4094 <div>a
4095 <dl>
4096 <dd>b</dd>
4097 </dl>
4098 </div>
4099 </dd>
4100 <dt>a</dt>
4101 <dd>b</dd>
4102 <dt><i>a:b</i></dt>
4103 </dl>
4104 !! end
4105
4106 !! test
4107 Definition Lists: colons and tables 1
4108 !! wikitext
4109 :{|
4110 | x
4111 |}
4112 :{|
4113 | y
4114 |}
4115 !! html
4116 <dl><dd><table>
4117 <tr>
4118 <td> x
4119 </td></tr></table></dd></dl>
4120 <dl><dd><table>
4121 <tr>
4122 <td> y
4123 </td></tr></table></dd></dl>
4124
4125 !! end
4126
4127 # Parsoid's output (as documented below) differs from php's in this case.
4128 # This is probably a bug. If we fixup parsoid to match php's output, the
4129 # above test should pass and the below test case can be removed. It is
4130 # unclear which output is more desirable.
4131
4132 !! test
4133 Definition Lists: colons and tables 2
4134 !! wikitext
4135 :{|
4136 | x
4137 |}
4138 :{|
4139 | y
4140 |}
4141 !! html/parsoid
4142 <dl><dd><table>
4143 <tr>
4144 <td> x
4145 </td></tr></table></dd>
4146 <dd><table>
4147 <tr>
4148 <td> y
4149 </td></tr></table></dd></dl>
4150 !! end
4151
4152 !! test
4153 Definition Lists: template interaction
4154 !! wikitext
4155 ::{{definition_list}}
4156
4157 :one
4158 ::{{definition_list}}
4159 :::two
4160 :::three
4161 ::four
4162 !! html/parsoid
4163 <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">
4164 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4165
4166 <dl><dd data-parsoid='{}'>one
4167 <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">
4168 </span><dd about="#mwt2">two
4169 <dl><dd>two</dd>
4170 <dd>three</dd></dl></dd>
4171 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4172 !! end
4173
4174
4175 ###
4176 ### External links
4177 ###
4178 !! test
4179 External links: non-bracketed
4180 !! wikitext
4181 Non-bracketed: http://example.com
4182 !! html
4183 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4184 </p>
4185 !! end
4186
4187 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4188 !! test
4189 External links: numbered
4190 !! wikitext
4191 Numbered: [http://example.com]
4192 Numbered: [http://example.net]
4193 Numbered: [http://example.com]
4194 !! html/php
4195 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4196 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4197 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4198 </p>
4199 !! html/parsoid
4200 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4201 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4202 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4203 !!end
4204
4205 !! test
4206 External links: specified text
4207 !! wikitext
4208 Specified text: [http://example.com link]
4209 !! html
4210 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4211 </p>
4212 !!end
4213
4214 !! test
4215 External links: trail
4216 !! wikitext
4217 Linktrails should not work for external links: [http://example.com link]s
4218 !! html
4219 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4220 </p>
4221 !! end
4222
4223 !! test
4224 External links: dollar sign in URL
4225 !! wikitext
4226 http://example.com/1$2345
4227 !! html
4228 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4229 </p>
4230 !! end
4231
4232 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4233 !! test
4234 External links: dollar sign in URL (autonumber)
4235 !! wikitext
4236 [http://example.com/1$2345]
4237 !! html/php
4238 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4239 </p>
4240 !! html/parsoid
4241 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4242 !!end
4243
4244 !! test
4245 External links: open square bracket forbidden in URL (bug 4377)
4246 !! options
4247 parsoid=wt2html,wt2wt,html2html
4248 !! wikitext
4249 http://example.com/1[2345
4250 !! html/php
4251 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4252 </p>
4253 !! html/parsoid
4254 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4255 !! end
4256
4257 !! test
4258 External links: open square bracket forbidden in URL (named) (bug 4377)
4259 !! options
4260 parsoid=wt2html,html2html
4261 !! wikitext
4262 [http://example.com/1[2345]
4263 !! html/php
4264 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4265 </p>
4266 !! html/parsoid
4267 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4268 !!end
4269
4270 # parsoid adds a space before the link name
4271 !! test
4272 External links: open square bracket forbidden in URL (named) (bug 4377)
4273 Parsoid variant.
4274 !! wikitext
4275 [http://example.com/1 [2345]
4276 !! html
4277 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4278 </p>
4279 !!end
4280
4281 !! test
4282 External links: nowiki in URL link text (bug 6230)
4283 !! wikitext
4284 [http://example.com/ <nowiki>''example site''</nowiki>]
4285 !! html
4286 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4287 </p>
4288 !! end
4289
4290 !! test
4291 External links: newline forbidden in text (bug 6230 regression check)
4292 !! wikitext
4293 [http://example.com/ first
4294 second]
4295 !! html
4296 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4297 second]
4298 </p>
4299 !!end
4300
4301 !! test
4302 External links: Pipe char between url and text
4303 !! wikitext
4304 [http://example.com | link]
4305 !! html
4306 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4307 </p>
4308 !!end
4309
4310 !! test
4311 External links: protocol-relative URL in brackets
4312 !! wikitext
4313 [//example.com/ Test]
4314 !! html
4315 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4316 </p>
4317 !! end
4318
4319 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4320 !! test
4321 External links: protocol-relative URL in brackets without text
4322 !! wikitext
4323 [//example.com]
4324 !! html/php
4325 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4326 </p>
4327 !! html/parsoid
4328 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4329 !! end
4330
4331 !! test
4332 External links: protocol-relative URL in free text is left alone
4333 !! wikitext
4334 //example.com/Foo
4335 !! html
4336 <p>//example.com/Foo
4337 </p>
4338 !!end
4339
4340 !! test
4341 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4342 !! wikitext
4343 foo//example.com/Foo
4344 !! html
4345 <p>foo//example.com/Foo
4346 </p>
4347 !! end
4348
4349 !! test
4350 External links: with no contents
4351 !! wikitext
4352 [http://en.wikipedia.org/wiki/Foo]
4353
4354 [[wikipedia:Foo|Bar]]
4355
4356 [[wikipedia:Foo|<span>Bar</span>]]
4357 !! html/php
4358 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4359 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4360 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4361 </p>
4362 !! html/parsoid
4363 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4364 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4365 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4366 !! end
4367
4368 !! test
4369 External links: Free with trailing punctuation
4370 !! wikitext
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)
4379 http://example.com/url_with_(brackets)
4380 (http://example.com/url_without_brackets)
4381 http://example.com/url_with_entity&nbsp;
4382 http://example.com/url_with_entity&#xA0;
4383 http://example.com/url_with_entity&#160;
4384 http://example.com/url_with_entity&lt;
4385 http://example.com/url_with_entity&#x3C;
4386 http://example.com/url_with_entity&#60;
4387 !! html/php
4388 <p><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">http://example.com</a>)
4396 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4397 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</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>
4401 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4402 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4403 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4404 </p>
4405 !! html/parsoid
4406 <p><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">http://example.com</a>)
4414 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4415 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</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>
4419 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4420 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4421 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4422 !! end
4423
4424 !! test
4425 External links: No preceding word characters allowed (bug 65278)
4426 !! wikitext
4427 NOPEhttp://example.com
4428 N0http://example.com
4429 ok:http://example.com
4430 ok-http://example.com
4431 !! html
4432 <p>NOPEhttp://example.com
4433 N0http://example.com
4434 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4435 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4436 </p>
4437 !! end
4438
4439 !! test
4440 External image
4441 !! wikitext
4442 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4443 !! html
4444 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4445 </p>
4446 !! end
4447
4448 !! test
4449 External image from https
4450 !! wikitext
4451 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4452 !! html
4453 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4454 </p>
4455 !! end
4456
4457 !! test
4458 External image (when not allowed)
4459 !! options
4460 wgAllowExternalImages=0
4461 !! wikitext
4462 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4463 !! html
4464 <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>
4465 </p>
4466 !! end
4467
4468 !! test
4469 Link to non-http image, no img tag
4470 !! wikitext
4471 Link to non-http image, no img tag: ftp://example.com/test.jpg
4472 !! html
4473 <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>
4474 </p>
4475 !! end
4476
4477 !! test
4478 External links: terminating separator
4479 !! wikitext
4480 Terminating separator: http://example.com/thing,
4481 !! html
4482 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4483 </p>
4484 !! end
4485
4486 !! test
4487 External links: intervening separator
4488 !! wikitext
4489 Intervening separator: http://example.com/1,2,3
4490 !! html
4491 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4492 </p>
4493 !! end
4494
4495 !! test
4496 External links: old bug with URL in query
4497 !! wikitext
4498 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4499 !! html
4500 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4501 </p>
4502 !! end
4503
4504 !! test
4505 External links: old URL-in-URL bug, mixed protocols
4506 !! wikitext
4507 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4508 !! html
4509 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4510 </p>
4511 !!end
4512
4513 !! test
4514 External links: URL in text
4515 !! wikitext
4516 URL in text: [http://example.com http://example.com]
4517 !! html
4518 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4519 </p>
4520 !! end
4521
4522 !! test
4523 External links: Clickable images
4524 !! wikitext
4525 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4526 !! html/php
4527 <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>
4528 </p>
4529 !! html/parsoid
4530 <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>
4531 !! end
4532
4533 !! test
4534 External links: raw ampersand
4535 !! wikitext
4536 Old &amp; use: http://x&y
4537 !! html
4538 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4539 </p>
4540 !! end
4541
4542 !! test
4543 External links: encoded ampersand
4544 !! wikitext
4545 Old &amp; use: http://x&amp;y
4546 !! html/php
4547 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4548 </p>
4549 !! html/parsoid
4550 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4551 !! end
4552
4553 !! test
4554 External links: encoded equals (bug 6102)
4555 !! wikitext
4556 http://example.com/?foo&#61;bar
4557 !! html/php
4558 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4559 </p>
4560 !! html/parsoid
4561 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4562 !! end
4563
4564 ##
4565 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4566 ## does it number them. As discussed in bug 53505, we can identify
4567 ## autonumbered links via CSS.
4568 ##
4569
4570 !! test
4571 External links: [raw ampersand]
4572 !! wikitext
4573 Old &amp; use: [http://x&y]
4574 !! html/php
4575 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4576 </p>
4577 !! html/parsoid
4578 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4579 !! end
4580
4581 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4582 # mode will return the [raw ampersand] wikitext
4583 !! test
4584 External links: [encoded ampersand]
4585 !! options
4586 parsoid=wt2html,wt2wt,html2html
4587 !! wikitext
4588 Old &amp; use: [http://x&amp;y]
4589 !! html/php
4590 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4591 </p>
4592 !! html/parsoid
4593 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4594 !! end
4595
4596 !! test
4597 External links: [raw equals]
4598 !! wikitext
4599 [http://example.com/?foo=bar]
4600 !! html/php
4601 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4602 </p>
4603 !! html/parsoid
4604 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4605 !! end
4606
4607 # note that parsoid html is identical to [raw equals] case; so html2wt
4608 # mode will return the [raw equals] wikitext
4609 !! test
4610 External links: [encoded equals] (bug 6102)
4611 !! options
4612 parsoid=wt2html,wt2wt,html2html
4613 !! wikitext
4614 [http://example.com/?foo&#61;bar]
4615 !! html/php
4616 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4617 </p>
4618 !! html/parsoid
4619 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4620 !! end
4621
4622 # xxx parsoid strips the IDN character, so the round-trip tests will
4623 # obviously fail and are disabled. --cscott
4624 !! test
4625 External links: [IDN ignored character reference in hostname; strip it right off]
4626 !! options
4627 parsoid=wt2html,wt2wt,html2html
4628 !! wikitext
4629 [http://e&zwnj;xample.com/]
4630 !! html/php
4631 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4632 </p>
4633 !! html/parsoid
4634 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4635 !! end
4636
4637 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4638 # Where an external link could easily circumvent the sanitization of the text of
4639 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4640 # test demands a higher standard. That's a bit strange.
4641 #
4642 # Example:
4643 #
4644 # http://e‌xample.com -> [http://example.com|http://example.com]
4645 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4646 #
4647 # The first example is sanitized, but the second is not. Any security benefits
4648 # from this production are trivial to circumvent. Either remove this test and
4649 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4650 # the test accordingly.
4651 #
4652 # All our love,
4653 # The Parsoid team.
4654 # xxx parsoid strips the IDN character, so the round-trip tests will
4655 # obviously fail and are disabled. --cscott
4656 !! test
4657 External links: IDN ignored character reference in hostname; strip it right off
4658 !! options
4659 parsoid=wt2html,html2html
4660 !! wikitext
4661 http://e&zwnj;xample.com/
4662 !! html/php
4663 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4664 </p>
4665 !! html/parsoid
4666 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4667 !! end
4668
4669 !! test
4670 External links: www.jpeg.org (bug 554)
4671 !! wikitext
4672 http://www.jpeg.org
4673 !! html
4674 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4675 </p>
4676 !! end
4677
4678 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4679 !! test
4680 External links: URL within URL (original bug 2)
4681 !! wikitext
4682 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4683 !! html/php
4684 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4685 </p>
4686 !! html/parsoid
4687 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4688 !! end
4689
4690 !! test
4691 BUG 361: URL inside bracketed URL
4692 !! wikitext
4693 [http://www.example.com/foo http://www.example.com/bar]
4694 !! html
4695 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4696 </p>
4697 !! end
4698
4699 !! test
4700 BUG 361: URL within URL, not bracketed
4701 !! wikitext
4702 http://www.example.com/foo?=http://www.example.com/bar
4703 !! html
4704 <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>
4705 </p>
4706 !! end
4707
4708 !! test
4709 BUG 289: ">"-token in URL-tail
4710 !! wikitext
4711 http://www.example.com/<hello>
4712 !! html
4713 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4714 </p>
4715 !!end
4716
4717 !! test
4718 BUG 289: literal ">"-token in URL-tail
4719 !! wikitext
4720 http://www.example.com/<b>html</b>
4721 !! html/php
4722 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4723 </p>
4724 !! html/parsoid
4725 <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>
4726 !! end
4727
4728 !! test
4729 BUG 289: ">"-token in bracketed URL
4730 !! wikitext
4731 [http://www.example.com/<hello> stuff]
4732 !! html
4733 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4734 </p>
4735 !!end
4736
4737 !! test
4738 BUG 289: literal ">"-token in bracketed URL
4739 !! wikitext
4740 [http://www.example.com/<b>html</b> stuff]
4741 !! html
4742 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4743 </p>
4744 !!end
4745
4746 !! test
4747 BUG 289: literal double quote at end of URL
4748 !! wikitext
4749 http://www.example.com/"hello"
4750 !! html
4751 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4752 </p>
4753 !!end
4754
4755 !! test
4756 BUG 289: literal double quote in bracketed URL
4757 !! wikitext
4758 [http://www.example.com/"hello" stuff]
4759 !! html
4760 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4761 </p>
4762 !!end
4763
4764 !! test
4765 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4766 !! wikitext
4767 [http://www.example.com test]
4768 !! html
4769 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4770 </p>
4771 !! end
4772
4773 !! test
4774 External links: link text with spaces
4775 !! wikitext
4776 [http://www.example.com a b c]
4777 [http://www.example.com ''a'' ''b'']
4778 !! html
4779 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4780 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4781 </p>
4782 !! end
4783
4784 !! test
4785 External links: wiki links within external link (Bug 3695)
4786 !! wikitext
4787 [http://example.com [[wikilink]] embedded in ext link]
4788 !! html/php
4789 <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>
4790 </p>
4791 !! html/parsoid
4792 <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>
4793 !! end
4794
4795 !! test
4796 BUG 787: Links with one slash after the url protocol are invalid
4797 !! wikitext
4798 http:/example.com
4799
4800 [http:/example.com title]
4801 !! html
4802 <p>http:/example.com
4803 </p><p>[http:/example.com title]
4804 </p>
4805 !! end
4806
4807 !! test
4808 Bracketed external links with template-generated invalid target
4809 !! wikitext
4810 [{{echo|http:/example.com}} title]
4811 !! html
4812 <p>[http:/example.com title]
4813 </p>
4814 !! end
4815
4816 !! test
4817 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4818 !! wikitext
4819 ''[http://example.com text'']
4820 [http://example.com '''text]'''
4821 ''Something [http://example.com in italic'']
4822 ''Something [http://example.com mixed''''', even bold]'''
4823 '''''Now [http://example.com both''''']
4824 !! html
4825 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4826 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4827 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4828 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4829 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4830 </p>
4831 !! end
4832
4833
4834 !! test
4835 Bug 4781: %26 in URL
4836 !! wikitext
4837 http://www.example.com/?title=AT%26T
4838 !! html/php
4839 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4840 </p>
4841 !! html/parsoid
4842 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4843 !! end
4844
4845 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4846 # % is actually legal in HTML5. Any change in output would need testing though.
4847 !! test
4848 Bug 4781, 5267: %25 in URL
4849 !! wikitext
4850 http://www.example.com/?title=100%25_Bran
4851 !! html/php
4852 <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>
4853 </p>
4854 !! html/parsoid
4855 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4856 !! end
4857
4858 !! test
4859 Bug 4781, 5267: %28, %29 in URL
4860 !! wikitext
4861 http://www.example.com/?title=Ben-Hur_%281959_film%29
4862 !! html/php
4863 <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>
4864 </p>
4865 !! html/parsoid
4866 <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>
4867 !! end
4868
4869
4870 !! test
4871 Bug 4781: %26 in autonumber URL
4872 !! wikitext
4873 [http://www.example.com/?title=AT%26T]
4874 !! html/php
4875 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4876 </p>
4877 !! html/parsoid
4878 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4879 !! end
4880
4881 !! test
4882 Bug 4781, 5267: %26 in autonumber URL
4883 !! wikitext
4884 [http://www.example.com/?title=100%25_Bran]
4885 !! html/php
4886 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4887 </p>
4888 !! html/parsoid
4889 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4890 !! end
4891
4892 !! test
4893 Bug 4781, 5267: %28, %29 in autonumber URL
4894 !! wikitext
4895 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4896 !! html/php
4897 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4898 </p>
4899 !! html/parsoid
4900 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4901 !! end
4902
4903
4904 !! test
4905 Bug 4781: %26 in bracketed URL
4906 !! wikitext
4907 [http://www.example.com/?title=AT%26T link]
4908 !! html/php
4909 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4910 </p>
4911 !! html/parsoid
4912 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4913 !! end
4914
4915 !! test
4916 Bug 4781, 5267: %25 in bracketed URL
4917 !! wikitext
4918 [http://www.example.com/?title=100%25_Bran link]
4919 !! html
4920 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4921 </p>
4922 !! end
4923
4924 !! test
4925 Bug 4781, 5267: %28, %29 in bracketed URL
4926 !! wikitext
4927 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4928 !! html/php
4929 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4930 </p>
4931 !! html/parsoid
4932 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4933 !! end
4934
4935 !! test
4936 External link containing a period in the anchor. (bug 63947)
4937 !! wikitext
4938 [//foo.org/bar#baz. bang]
4939
4940 [//foo.org/bar. bang]
4941 !! html/php
4942 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4943 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4944 </p>
4945 !! html/parsoid
4946 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4947 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4948 !! end
4949
4950 !! test
4951 External link containing a single quote. (bug 63947)
4952 !! wikitext
4953 [//foo.org/bar'baz]
4954
4955 [//foo.org/bar'baz bang]
4956 !! html/php
4957 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4958 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4959 </p>
4960 !! html/parsoid
4961 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4962 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4963 !! end
4964
4965
4966 !! test
4967 External link containing a period in the anchor. (bug 63947)
4968 !! wikitext
4969 [//foo.org/bar#baz. bang]
4970
4971 [//foo.org/bar. bang]
4972 !! html/php
4973 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4974 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4975 </p>
4976 !! html/parsoid
4977 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4978 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4979 !! end
4980
4981 !! test
4982 External link containing a single quote. (bug 63947)
4983 !! wikitext
4984 [//foo.org/bar'baz]
4985
4986 [//foo.org/bar'baz bang]
4987 !! html/php
4988 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4989 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4990 </p>
4991 !! html/parsoid
4992 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4993 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4994 !! end
4995
4996
4997 !! test
4998 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4999 !! wikitext
5000 Some [http://example.com/ pretty ''italics'' and stuff]!
5001 !! html
5002 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5003 </p>
5004 !! end
5005
5006 !! test
5007 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5008 !! wikitext
5009 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5010 !! html
5011 <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>
5012 </p>
5013 !! end
5014
5015 !! test
5016 External link containing double-single-quotes with no space separating the url from text in italics
5017 !! wikitext
5018 [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]].]
5019 !! html/php
5020 <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>
5021 </p>
5022 !! html/php+tidy
5023 <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>
5024 !! html/parsoid
5025 <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>
5026 !! end
5027
5028 !! test
5029 External link with comments in link text
5030 !! wikitext
5031 [http://www.google.com Google <!-- comment -->]
5032 !! html
5033 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5034 </p>
5035 !! end
5036
5037 !! test
5038 URL-encoding in URL functions (single parameter)
5039 !! wikitext
5040 {{localurl:Some page|amp=&}}
5041 !! html
5042 <p>/index.php?title=Some_page&amp;amp=&amp;
5043 </p>
5044 !! end
5045
5046 !! test
5047 URL-encoding in URL functions (multiple parameters)
5048 !! wikitext
5049 {{localurl:Some page|q=?&amp=&}}
5050 !! html
5051 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5052 </p>
5053 !! end
5054
5055 !! test
5056 Brackets in urls
5057 !! wikitext
5058 http://example.com/index.php?foozoid%5B%5D=bar
5059
5060 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5061 !! html/php
5062 <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><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>
5064 </p>
5065 !! html/parsoid
5066 <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>
5067
5068 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5069 !! end
5070
5071 !! test
5072 IPv6 urls (bug 21261)
5073 !! options
5074 disabled
5075 !! wikitext
5076 http://[2404:130:0:1000::187:2]/index.php
5077 !! html
5078 <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>
5079 </p>
5080 !! end
5081
5082 !! test
5083 Non-extlinks in brackets
5084 !! wikitext
5085 [foo]
5086 [foo bar]
5087 [foo ''bar'']
5088 [fool's] errand
5089 [fool's errand]
5090 [{{echo|foo}}]
5091 [{{echo|foo}} bar]
5092 [{{echo|foo}} ''bar'']
5093 [{{echo|foo}}l's] errand
5094 [{{echo|foo}}l's errand]
5095 [url={{echo|foo}}]
5096 [url=http://example.com]
5097 !! html
5098 <p>[foo]
5099 [foo bar]
5100 [foo <i>bar</i>]
5101 [fool's] errand
5102 [fool's errand]
5103 [foo]
5104 [foo bar]
5105 [foo <i>bar</i>]
5106 [fool's] errand
5107 [fool's errand]
5108 [url=foo]
5109 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5110 </p>
5111 !! end
5112
5113 !! test
5114 Percent encoding in external links
5115 !! wikitext
5116 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5117 !! html/php
5118 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5119 </p>
5120 !! html/parsoid
5121 <p><a rel="mw:ExtLink"
5122 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5123 !! end
5124
5125 !! test
5126 Use url link syntax for links where the content is equal the link target
5127 !! wikitext
5128 http://example.com
5129 !! html/php
5130 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5131 </p>
5132 !! html/parsoid
5133 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5134 !! end
5135
5136 !! test
5137 Parenthesis in external links, especially URL links
5138 !! wikitext
5139 http://example.com)
5140
5141 http://example.com/test)
5142
5143 http://example.com/(test)
5144
5145 http://example.com/((test)
5146
5147 (http://example.com/(test))
5148
5149 (http://example.com/(test)))))
5150
5151 http://example.com/a)b
5152
5153 [http://example.com) foo]
5154 !! html/php
5155 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</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/(test)))))">http://example.com/(test)))))</a>
5161 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5162 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5163 </p>
5164 !! html/parsoid
5165 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</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/(test)))))">http://example.com/(test)))))</a></p>
5171 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5172 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5173 !! end
5174
5175 !! test
5176 Parenthesis in external links, w/ transclusion or comment
5177 !! wikitext
5178 (http://example.com/{{echo|hi}})
5179
5180 (http://example.com<!-- hi -->)
5181 !! html/php
5182 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5183 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5184 </p>
5185 !! html/parsoid
5186 <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>
5187
5188 <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>
5189 !! end
5190
5191 !! test
5192 Replace invalid link targets when serializing
5193 !! options
5194 parsoid=html2wt
5195 !! html
5196 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5197 !! wikitext
5198 [[MediaWiki:Badtitletext|Manual]]
5199 !! end
5200
5201 ###
5202 ### Quotes
5203 ###
5204
5205 !! test
5206 Quotes
5207 !! wikitext
5208 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5209
5210 Normal text. '''''Bold italic text.''''' Normal text.
5211 !! html
5212 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5213 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5214 </p>
5215 !! end
5216
5217
5218 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5219 # parser strips. The wikitext contains just the first half of the bold
5220 # quote pair.
5221 !! test
5222 Unclosed and unmatched quotes
5223 !! wikitext
5224 '''''Bold italic text '''with bold deactivated''' in between.'''''
5225
5226 '''''Bold italic text ''with italic deactivated'' in between.'''''
5227
5228 '''Bold text..
5229
5230 ..spanning two paragraphs (should not work).'''
5231
5232 '''Bold tag left open
5233
5234 ''Italic tag left open
5235
5236 Normal text.
5237
5238 <!-- Unmatching number of opening, closing tags: -->
5239 '''This year''''s election ''should'' beat '''last year''''s.
5240
5241 ''Tom'''s car is bigger than ''Susan'''s.
5242
5243 Plain ''italic'''s plain
5244 !! html/php
5245 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5246 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5247 </p><p><b>Bold text..</b>
5248 </p><p>..spanning two paragraphs (should not work).
5249 </p><p><b>Bold tag left open</b>
5250 </p><p><i>Italic tag left open</i>
5251 </p><p>Normal text.
5252 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5253 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5254 </p><p>Plain <i>italic'</i>s plain
5255 </p>
5256 !! html/parsoid
5257 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5258 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5259 </p><p><b>Bold text..</b>
5260 </p><p>..spanning two paragraphs (should not work).<b></b>
5261 </p><p><b>Bold tag left open</b>
5262 </p><p><i>Italic tag left open</i>
5263 </p><p>Normal text.
5264 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5265 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5266 </p><p>Plain <i>italic'</i>s plain
5267 </p>
5268 !! end
5269
5270 ###
5271 ### Tables
5272 ###
5273 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5274 ###
5275
5276 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5277 # is the bare minimum required by the spec, see:
5278 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5279 # Parsoid team replies: empty table tags are legal in HTML5
5280 !! test
5281 A table with no data.
5282 !! options
5283 parsoid=wt2html
5284 !! wikitext
5285 {||}
5286 !! html/php
5287
5288 !! html/parsoid
5289 <table></table>
5290
5291 !! end
5292
5293 !! test
5294 A table with stray table end tags on start tag line (wt2html)
5295 !! options
5296 parsoid=wt2html
5297 !! wikitext
5298 {|style="color: red;"|}
5299
5300 {|style="color: red;" |}
5301 |foo
5302 |}
5303
5304 {|style="color: red;"|} id="foo"
5305 |foo
5306 |}
5307
5308 {|style="color: red;" |} id="foo"
5309 |foo
5310 |}
5311 !! html
5312 <table style="color: red;"></table>
5313
5314 <table style="color: red;">
5315 <tbody><tr>
5316 <td>foo</td>
5317 </tr></tbody>
5318 </table>
5319
5320 <table style="color: red;" id="foo">
5321 <tbody><tr>
5322 <td>foo</td>
5323 </tr></tbody>
5324 </table>
5325
5326 <table style="color: red;" id="foo">
5327 <tbody><tr>
5328 <td>foo</td>
5329 </tr></tbody>
5330 </table>
5331
5332 !! end
5333
5334 !! test
5335 A table with no data (take 2)
5336 !! wikitext
5337 {|
5338 |}
5339 !! html/parsoid
5340 <table></table>
5341 !! end
5342
5343 # A table with nothing but a caption is invalid XHTML, we might want to render
5344 # this as <p>caption</p>
5345 # Parsoid team replies: table with only a caption is legal in HTML5
5346 !! test
5347 A table with nothing but a caption
5348 !! wikitext
5349 {|
5350 |+ caption
5351 |}
5352 !! html/php
5353 <table>
5354 <caption> caption
5355 </caption><tr><td></td></tr></table>
5356
5357 !! html/parsoid
5358 <table><caption> caption</caption></table>
5359 !! end
5360
5361 !! test
5362 A table with caption with default-spaced attributes and a table row
5363 !! wikitext
5364 {|
5365 |+ style="color: red;" | caption1
5366 |-
5367 | foo
5368 |}
5369 !! html
5370 <table>
5371 <caption style="color: red;"> caption1
5372 </caption>
5373 <tr>
5374 <td> foo
5375 </td></tr></table>
5376
5377 !! end
5378
5379 !! test
5380 A table with captions with non-default spaced attributes and a table row
5381 !! wikitext
5382 {|
5383 |+style="color: red;"|caption2
5384 |+ style="color: red;"| caption3
5385 |-
5386 | foo
5387 |}
5388 !! html
5389 <table>
5390 <caption style="color: red;">caption2
5391 </caption>
5392 <caption style="color: red;"> caption3
5393 </caption>
5394 <tr>
5395 <td> foo
5396 </td></tr></table>
5397
5398 !! end
5399
5400 !! test
5401 Table td-cell syntax variations
5402 !! wikitext
5403 {|
5404 | foo bar foo | baz
5405 | foo bar foo || baz
5406 | style='color:red;' | baz
5407 | style='color:red;' || baz
5408 |}
5409 !! html
5410 <table>
5411 <tr>
5412 <td> baz
5413 </td>
5414 <td> foo bar foo </td>
5415 <td> baz
5416 </td>
5417 <td style="color:red;"> baz
5418 </td>
5419 <td> style='color:red;' </td>
5420 <td> baz
5421 </td></tr></table>
5422
5423 !! end
5424
5425 !! test
5426 Simple table
5427 !! wikitext
5428 {|
5429 | 1 || 2
5430 |-
5431 | 3 || 4
5432 |}
5433 !! html
5434 <table>
5435 <tr>
5436 <td> 1 </td>
5437 <td> 2
5438 </td></tr>
5439 <tr>
5440 <td> 3 </td>
5441 <td> 4
5442 </td></tr></table>
5443
5444 !! end
5445
5446 !! test
5447 Simple table but with multiple dashes for row wikitext
5448 !! wikitext
5449 {|
5450 | foo
5451 |-----
5452 | bar
5453 |}
5454 !! html
5455 <table>
5456 <tr>
5457 <td> foo
5458 </td></tr>
5459 <tr>
5460 <td> bar
5461 </td></tr></table>
5462
5463 !! end
5464 !! test
5465 Multiplication table
5466 !! wikitext
5467 {| border="1" cellpadding="2"
5468 |+Multiplication table
5469 |-
5470 ! &times; !! 1 !! 2 !! 3
5471 |-
5472 ! 1
5473 | 1 || 2 || 3
5474 |-
5475 ! 2
5476 | 2 || 4 || 6
5477 |-
5478 ! 3
5479 | 3 || 6 || 9
5480 |-
5481 ! 4
5482 | 4 || 8 || 12
5483 |-
5484 ! 5
5485 | 5 || 10 || 15
5486 |}
5487 !! html
5488 <table border="1" cellpadding="2">
5489 <caption>Multiplication table
5490 </caption>
5491 <tr>
5492 <th> &#215; </th>
5493 <th> 1 </th>
5494 <th> 2 </th>
5495 <th> 3
5496 </th></tr>
5497 <tr>
5498 <th> 1
5499 </th>
5500 <td> 1 </td>
5501 <td> 2 </td>
5502 <td> 3
5503 </td></tr>
5504 <tr>
5505 <th> 2
5506 </th>
5507 <td> 2 </td>
5508 <td> 4 </td>
5509 <td> 6
5510 </td></tr>
5511 <tr>
5512 <th> 3
5513 </th>
5514 <td> 3 </td>
5515 <td> 6 </td>
5516 <td> 9
5517 </td></tr>
5518 <tr>
5519 <th> 4
5520 </th>
5521 <td> 4 </td>
5522 <td> 8 </td>
5523 <td> 12
5524 </td></tr>
5525 <tr>
5526 <th> 5
5527 </th>
5528 <td> 5 </td>
5529 <td> 10 </td>
5530 <td> 15
5531 </td></tr></table>
5532
5533 !! end
5534
5535 !! test
5536 Accept "||" in table headings
5537 !! wikitext
5538 {|
5539 !h1 || h2
5540 |}
5541 !! html
5542 <table>
5543 <tr>
5544 <th>h1 </th>
5545 <th> h2
5546 </th></tr></table>
5547
5548 !! end
5549
5550 !! test
5551 Accept "!!" in table data
5552 !! wikitext
5553 {|
5554 | Foo!! ||
5555 |}
5556 !! html
5557 <table>
5558 <tr>
5559 <td> Foo!! </td>
5560 <td>
5561 </td></tr></table>
5562
5563 !! html/parsoid
5564 <table>
5565 <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>
5566 </tbody></table>
5567 !! end
5568
5569 !! test
5570 Accept "||" in indented table headings
5571 !! wikitext
5572 :{|
5573 !h1 || h2
5574 |}
5575 !! html
5576 <dl><dd><table>
5577 <tr>
5578 <th>h1 </th>
5579 <th> h2
5580 </th></tr></table></dd></dl>
5581
5582 !! end
5583
5584 !! test
5585 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5586 !! wikitext
5587 {|
5588 !| h1
5589 || a
5590 |}
5591 !! html
5592 <table>
5593 <tr>
5594 <th> h1
5595 </th>
5596 <td> a
5597 </td></tr></table>
5598
5599 !! end
5600
5601 !!test
5602 Accept "| !" at start of line in tables (ignore !-attribute)
5603 !! wikitext
5604 {|
5605 |-
5606 | !style="color:red" | bar
5607 |}
5608 !! html
5609 <table>
5610
5611 <tr>
5612 <td> bar
5613 </td></tr></table>
5614
5615 !!end
5616
5617 !!test
5618 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 +/-
5619 !! wikitext
5620 {|
5621 |-
5622 |style='color:red;'|+1
5623 |style='color:blue;'|-1
5624 |-
5625 | 1 || 2 || 3
5626 | 1 ||+2 ||-3
5627 |-
5628 | +1
5629 | -1
5630 |}
5631 !! html
5632 <table>
5633
5634 <tr>
5635 <td style="color:red;">+1
5636 </td>
5637 <td style="color:blue;">-1
5638 </td></tr>
5639 <tr>
5640 <td> 1 </td>
5641 <td> 2 </td>
5642 <td> 3
5643 </td>
5644 <td> 1 </td>
5645 <td>+2 </td>
5646 <td>-3
5647 </td></tr>
5648 <tr>
5649 <td> +1
5650 </td>
5651 <td> -1
5652 </td></tr></table>
5653
5654 !!end
5655
5656 !! test
5657 Table rowspan
5658 !! wikitext
5659 {| border=1
5660 | Cell 1, row 1
5661 |rowspan=2| Cell 2, row 1 (and 2)
5662 | Cell 3, row 1
5663 |-
5664 | Cell 1, row 2
5665 | Cell 3, row 2
5666 |}
5667 !! html
5668 <table border="1">
5669 <tr>
5670 <td> Cell 1, row 1
5671 </td>
5672 <td rowspan="2"> Cell 2, row 1 (and 2)
5673 </td>
5674 <td> Cell 3, row 1
5675 </td></tr>
5676 <tr>
5677 <td> Cell 1, row 2
5678 </td>
5679 <td> Cell 3, row 2
5680 </td></tr></table>
5681
5682 !! end
5683
5684 !! test
5685 Nested table
5686 !! wikitext
5687 {| border=1
5688 | &alpha;
5689 |
5690 {| bgcolor=#ABCDEF border=2
5691 |nested
5692 |-
5693 |table
5694 |}
5695 |the original table again
5696 |}
5697 !! html
5698 <table border="1">
5699 <tr>
5700 <td> &#945;
5701 </td>
5702 <td>
5703 <table bgcolor="#ABCDEF" border="2">
5704 <tr>
5705 <td>nested
5706 </td></tr>
5707 <tr>
5708 <td>table
5709 </td></tr></table>
5710 </td>
5711 <td>the original table again
5712 </td></tr></table>
5713
5714 !! end
5715
5716 !! test
5717 Invalid attributes in table cell (bug 1830)
5718 !! wikitext
5719 {|
5720 |Cell:|broken
5721 |}
5722 !! html
5723 <table>
5724 <tr>
5725 <td>broken
5726 </td></tr></table>
5727
5728 !! end
5729
5730 # The "|}" to close the table is missing from the input, so parsoid's
5731 # *2wt modes will fail.
5732 !! test
5733 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5734 !! options
5735 parsoid=wt2html,html2html
5736 !! wikitext
5737 {|
5738 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5739 !! html/php
5740 <table>
5741 <tr>
5742 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5743 <td>]" onmouseover="alert(document.cookie)"&gt;test
5744 </td>
5745 </tr>
5746 </table>
5747
5748 !! html/parsoid
5749 <table><tbody>
5750 <tr>
5751 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5752 !! end
5753
5754 # FIXME: The php output is broken.
5755 !! test
5756 ! and || in td attributes should not be parsed as <th>/<td>
5757 !! wikitext
5758 {|
5759 | style="color: red !important;" data-contrived="put this here ||" | foo
5760 |}
5761 !! html/php
5762 <table>
5763 <tr>
5764 <td> style="color: red !important;" data-contrived="put this here </td>
5765 <td> foo
5766 </td></tr></table>
5767
5768 !! html/parsoid
5769 <table>
5770 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5771 </tbody></table>
5772 !! end
5773
5774 !! test
5775 Indented table markup mixed with indented pre content (proposed in bug 6200)
5776 !! wikitext
5777 <table>
5778 <tr>
5779 <td>
5780 Text that should be rendered preformatted
5781 </td>
5782 </tr>
5783 </table>
5784 !! html
5785 <table>
5786 <tr>
5787 <td>
5788 <pre>Text that should be rendered preformatted
5789 </pre>
5790 </td>
5791 </tr>
5792 </table>
5793
5794 !! end
5795
5796 !! test
5797 1. Template-generated table cell attributes and cell content
5798 !! wikitext
5799 {|
5800 |{{table_attribs}}
5801 | {{table_attribs}}
5802 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5803 |align=center {{table_attribs}}
5804 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5805 |}
5806 !! html
5807 <table>
5808 <tr>
5809 <td style="color:red;">Foo
5810 </td>
5811 <td style="color:red;">Foo
5812 </td>
5813 <td style="color:red;">Foo
5814 </td>
5815 <td align="center" style="color:red;">Foo
5816 </td>
5817 <td align="center" style="color:red;">Foo
5818 </td></tr></table>
5819
5820 !! end
5821
5822 !! test
5823 2. Template-generated table cell attributes and cell content
5824 !! wikitext
5825 {|
5826 |{{table_attribs_2}}
5827 |}
5828 !! html/php
5829 <table>
5830 <tr>
5831 <td style="color:red;">Foo
5832 </td>
5833 <td>Bar</td>
5834 <td>Baz
5835 </td></tr></table>
5836
5837 !! html/parsoid
5838 <table>
5839 <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>
5840 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
5841 </tbody></table>
5842 !! end
5843
5844 !! test
5845 3. Template-generated table cell attributes and cell content
5846 !! wikitext
5847 {|
5848 !align=center {{table_header_cells}}
5849 |-
5850 |align=center {{table_cells}}
5851 |}
5852 !! html/php
5853 <table>
5854 <tr>
5855 <th align="center" style="color:red;">Foo</th>
5856 <th style="color:red;"><i>Bar</i></th>
5857 <th style="color:brown;"><i>Foo</i> and Baz
5858 </th></tr>
5859 <tr>
5860 <td align="center" style="color:red;">Foo</td>
5861 <td style="color:red;"><i>Bar</i></td>
5862 <td style="color:brown;"><i>Foo</i> and Baz
5863 </td></tr></table>
5864
5865 !! html/parsoid
5866 <table>
5867 <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>
5868 <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>
5869 </tbody></table>
5870 !! end
5871
5872 !! test
5873 Table with row followed by newlines and table heading
5874 !! wikitext
5875 {|
5876 |-
5877
5878 ! foo
5879 |}
5880 !! html
5881 <table>
5882
5883
5884 <tr>
5885 <th> foo
5886 </th></tr></table>
5887
5888 !! end
5889
5890 !! test
5891 Table with empty line following the start tag
5892 !! wikitext
5893 {|
5894
5895 |-
5896 | foo
5897 |}
5898 !! html
5899 <table>
5900
5901
5902 <tr>
5903 <td> foo
5904 </td></tr></table>
5905
5906 !! end
5907
5908 # FIXME: Preserve the attribute properly (with an empty string as value) in
5909 # the PHP parser. Parsoid implements the behavior below.
5910 !! test
5911 Table attributes with empty value
5912 !! wikitext
5913 {|
5914 | style=| hello
5915 |}
5916 !! html/parsoid
5917 <table>
5918 <tbody>
5919 <tr>
5920 <td style=""> hello
5921 </td></tr></tbody></table>
5922
5923 !! end
5924
5925 !! test
5926 Wikitext table with a lot of comments
5927 !! wikitext
5928 {|
5929 <!-- c0 -->
5930 | foo
5931 <!-- c1 -->
5932 |- <!-- c2 -->
5933 <!-- c3 -->
5934 |<!-- c4 -->
5935 <!-- c5 -->
5936 |}
5937 !! html
5938 <table>
5939 <tr>
5940 <td> foo
5941 </td></tr>
5942 <tr>
5943 <td>
5944 </td></tr></table>
5945
5946 !! end
5947
5948 !! test
5949 Wikitext table with double-line table cell
5950 !! wikitext
5951 {|
5952 |a
5953 b
5954 |}
5955 !! html
5956 <table>
5957 <tr>
5958 <td>a
5959 <p>b
5960 </p>
5961 </td></tr></table>
5962
5963 !! end
5964
5965 !! test
5966 Table cell with a single comment
5967 !! wikitext
5968 {|
5969 | <!-- c1 -->
5970 | a
5971 |}
5972 !! html
5973 <table>
5974 <tr>
5975 <td>
5976 </td>
5977 <td> a
5978 </td></tr></table>
5979
5980 !! end
5981
5982 !! test
5983 Table-cell after a comment-only-empty-line
5984 !! wikitext
5985 {|
5986 |a
5987 <!--c1-->
5988 <!--c2-->| b
5989 |}
5990 !! html
5991 <table>
5992 <tr>
5993 <td>a
5994 </td>
5995 <td> b
5996 </td></tr></table>
5997
5998 !! html/parsoid
5999 <table>
6000 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6001 <!--c1-->
6002 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6003 </tbody></table>
6004
6005 !! end
6006
6007 !! test
6008 Build table with {{!}}
6009 !! wikitext
6010 {{{!}} class="wikitable"
6011 ! header
6012 ! second header
6013 {{!}}- style="color:red;"
6014 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6015 {{!}}}
6016 !! html
6017 <table class="wikitable">
6018 <tr>
6019 <th> header
6020 </th>
6021 <th> second header
6022 </th></tr>
6023 <tr style="color:red;">
6024 <td> data </td>
6025 <td style="color:red;"> second data
6026 </td></tr></table>
6027
6028 !! end
6029
6030 !! test
6031 Build table with pipe as data
6032 !! wikitext
6033 {| class="wikitable"
6034 ! header
6035 ! second header
6036 |- style="color:red;"
6037 | data || style="color:red;" | second data
6038 |-
6039 | style="color:red;" | data with | || style="color:red;" | second data with |
6040 |-
6041 || data with | ||| second data with |
6042 |}
6043 !! html
6044 <table class="wikitable">
6045 <tr>
6046 <th> header
6047 </th>
6048 <th> second header
6049 </th></tr>
6050 <tr style="color:red;">
6051 <td> data </td>
6052 <td style="color:red;"> second data
6053 </td></tr>
6054 <tr>
6055 <td style="color:red;"> data with | </td>
6056 <td style="color:red;"> second data with |
6057 </td></tr>
6058 <tr>
6059 <td> data with | </td>
6060 <td> second data with |
6061 </td></tr></table>
6062
6063 !! end
6064
6065 !! test
6066 Build table with wikilink
6067 !! wikitext
6068 {| class="wikitable"
6069 ! header || second header
6070 |- style="color:red;"
6071 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6072 |-
6073 | data || second data [[Main Page|link|text with pipe]]
6074 |}
6075 !! html
6076 <table class="wikitable">
6077 <tr>
6078 <th> header </th>
6079 <th> second header
6080 </th></tr>
6081 <tr style="color:red;">
6082 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6083 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6084 </td></tr>
6085 <tr>
6086 <td> data </td>
6087 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6088 </td></tr></table>
6089
6090 !! end
6091
6092 # The expected HTML structure in this test is debatable. The PHP parser does
6093 # not parse this kind of table at all. The main focus for Parsoid is on
6094 # round-tripping, so this output is ok for now. TODO: revisit!
6095 !! test
6096 Wikitext table with html-syntax row
6097 !! wikitext
6098 {|
6099 |-
6100 <td>foo</td>
6101 |}
6102 !! html/parsoid
6103 <table>
6104 <tbody>
6105 <tr>
6106 <td>foo</td></tr></tbody></table>
6107 !! end
6108
6109 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6110 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6111 ## PHP parser, which tidy then compounds by fostering the content
6112 ## entirely out of the table. Parsoid recognizes the table context
6113 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6114 ## depends on PHP's treatment of broken table markup!
6115 !! test
6116 Implicit <td> after a |-
6117 !! options
6118 parsoid=wt2html,html2html
6119 !! wikitext
6120 {|
6121 |-
6122 a
6123 |}
6124 !! html/php
6125 <table>
6126
6127 a
6128 </table>
6129
6130 !! html/php+tidy
6131 <p>a</p>
6132 !! html/parsoid
6133 <table>
6134 <tr><td>a</td></tr>
6135 </table>
6136 !! end
6137
6138 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6139 !! test
6140 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6141 !! options
6142 parsoid=wt2html,html2html
6143 !! wikitext
6144 {|
6145 |-
6146 |
6147 a
6148 |-
6149 b
6150 |}
6151 !! html/php
6152 <table>
6153
6154 <tr>
6155 <td>
6156 <pre>a
6157 </pre>
6158 </td></tr>
6159 b
6160 </table>
6161
6162 !! html/php+tidy
6163 <p>b</p>
6164 <table>
6165 <tr>
6166 <td>
6167 <pre>
6168 a
6169 </pre></td>
6170 </tr>
6171 </table>
6172 !! html/parsoid
6173 <table>
6174 <tbody>
6175 <tr><td><pre>a</pre></td></tr>
6176 <tr><td> b</td></tr>
6177 </tbody>
6178 </table>
6179 !! end
6180
6181 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6182 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6183 !! test
6184 Lists should be recognized in an implicit <td> context
6185 !! options
6186 parsoid=wt2html,html2html
6187 !! wikitext
6188 {|
6189 |-
6190 *a
6191 |}
6192 !! html/php
6193 <table>
6194
6195 <ul><li>a</li></ul>
6196 </table>
6197
6198 !! html/php+tidy
6199 <ul>
6200 <li>a</li>
6201 </ul>
6202 !! html/parsoid
6203 <table>
6204 <tr>
6205 <td><ul>
6206 <li>a</li>
6207 </ul></td>
6208 </tr>
6209 </table>
6210 !! end
6211
6212 !! test
6213 Table cells not properly parsed in an implicit-td context
6214 !! wikitext
6215 {|
6216 |-
6217 {{table_attribs_4}} || a || b
6218 |}
6219 !! html/php+tidy
6220 <table>
6221 <tr>
6222 <td style="background-color:#DC241f;" width="10px"></td>
6223 <td>a</td>
6224 <td>b</td>
6225 </tr>
6226 </table>
6227 !! html/parsoid
6228 <table>
6229 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6230 <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>
6231 </tbody></table>
6232 !! end
6233
6234 !! test
6235 Parsoid: Round-trip tables directly followed by content (bug 51219)
6236 !! options
6237 parsoid=wt2html,wt2wt
6238 !! wikitext
6239 {|
6240 |foo
6241 |} bar
6242
6243 {|
6244 |baz
6245 |}<b>quux</b>
6246 !! html+tidy
6247 <table>
6248 <tr>
6249 <td>foo</td>
6250 </tr>
6251 </table>
6252 <p>bar</p>
6253 <table>
6254 <tr>
6255 <td>baz</td>
6256 </tr>
6257 </table>
6258 <p><b>quux</b></p>
6259 !! end
6260
6261 !! test
6262 Parsoid: Default to a newline after tables in new content (bug 51219)
6263 !! options
6264 parsoid=html2wt
6265 !! html
6266 <table><tbody>
6267 <tr><td>foo</td></tr></tbody></table> bar
6268 <table><tbody>
6269 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6270 !! wikitext
6271 {|
6272 |foo
6273 |}
6274 <nowiki> </nowiki>bar
6275 {|
6276 |baz
6277 |}
6278 '''quux'''
6279 !! end
6280
6281 !! test
6282 Parsoid: newline inducing block nodes don't suppress <nowiki>
6283 !! options
6284 parsoid=html2wt
6285 !! html
6286 a<h1>foo</h1>
6287 !! wikitext
6288 <nowiki> </nowiki>a
6289
6290 = foo =
6291 !! end
6292
6293 !! test
6294 Parsoid: Row-syntax table headings followed by comment & table cells
6295 !! options
6296 parsoid=wt2html,wt2wt
6297 !! wikitext
6298 {|
6299 ! foo || bar
6300 <!-- foo --> || baz || quux
6301 |}
6302 !! html/php
6303 <table>
6304 <tr>
6305 <th> foo </th>
6306 <th> bar
6307 </th>
6308 <td> baz </td>
6309 <td> quux
6310 </td></tr></table>
6311
6312 !! html/parsoid
6313 <table>
6314 <tbody><tr><th> foo </th><th> bar
6315 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6316 </tbody></table>
6317 !! end
6318
6319
6320 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6321 # preserves it.
6322 !!test
6323 Parsoid: Recover better from broken table attributes
6324 !!options
6325 parsoid=wt2html
6326 !!wikitext
6327 {| class="foo
6328 | class="bar" |
6329 foo
6330 |}
6331 !!html/php+tidy
6332 <table>
6333 <tr>
6334 <td class="bar">
6335 <p>foo</p>
6336 </td>
6337 </tr>
6338 </table>
6339 !!html/parsoid
6340 <table class="foo">
6341 <tr>
6342 <td class="bar">
6343 <p>foo</p></td></tr>
6344 </tbody></table>
6345 !!end
6346
6347 !! test
6348 Strip unsupported table tags
6349 !! options
6350 parsoid=html2wt
6351 !! html
6352 <table>
6353 <thead>
6354 <tr>
6355 <th>Month</th>
6356 <th>Savings</th>
6357 </tr>
6358 </thead>
6359 <tbody>
6360 <tr>
6361 <td>January</td>
6362 <td>$100</td>
6363 </tr>
6364 <tr>
6365 <td>February</td>
6366 <td>$80</td>
6367 </tr>
6368 </tbody>
6369 <tfoot>
6370 <tr>
6371 <td>Sum</td>
6372 <td>$180</td>
6373 </tr>
6374 </tfoot>
6375 </table>
6376 !! wikitext
6377 {|
6378
6379 !Month
6380 !Savings
6381
6382 |January
6383 |$100
6384
6385 |-
6386 |February
6387 |$80
6388
6389 |Sum
6390 |$180
6391
6392 |}
6393 !! end
6394
6395 !!test
6396 Testing serialization after deletion of table cells
6397 !!options
6398 parsoid={
6399 "modes": ["wt2wt"],
6400 "changes": [
6401 ["#x", "remove"]
6402 ]
6403 }
6404 !!wikitext
6405 {|
6406 !h1 !!h2 !!h3
6407 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6408 |}
6409 !! wikitext/edited
6410 {|
6411 !h1 !!h2 !!h3
6412 |c2 |||c3
6413 |}
6414 !!end
6415
6416 ###
6417 ### Internal links
6418 ###
6419 !! test
6420 Plain link, capitalized
6421 !! wikitext
6422 [[Main Page]]
6423 !! html
6424 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6425 </p>
6426 !! end
6427
6428 !! test
6429 Plain link, uncapitalized
6430 !! wikitext
6431 [[main Page]]
6432 !! html
6433 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6434 </p>
6435 !! end
6436
6437 !! test
6438 Piped link
6439 !! wikitext
6440 [[Main Page|The Main Page]]
6441 !! html
6442 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6443 </p>
6444 !! end
6445
6446 !! test
6447 Piped link with comment in link text
6448 !! wikitext
6449 [[Main Page|The Main<!--front--> Page]]
6450 !! html
6451 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6452 </p>
6453 !! end
6454
6455 !! test
6456 Piped link with multiple pipe characters in link text
6457 !! wikitext
6458 [[Main Page||The|Main|Page|]]
6459 !! html/php
6460 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6461 </p>
6462 !! html/parsoid
6463 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6464 !! end
6465
6466 !! test
6467 Broken link
6468 !! wikitext
6469 [[Zigzagzogzagzig]]
6470 !! html
6471 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6472 </p>
6473 !! end
6474
6475 !! test
6476 Broken link with fragment
6477 !! wikitext
6478 [[Zigzagzogzagzig#zug]]
6479 !! html
6480 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6481 </p>
6482 !! end
6483
6484 !! test
6485 Special page link with fragment
6486 !! wikitext
6487 [[Special:Version#anchor]]
6488 !! html
6489 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6490 </p>
6491 !! end
6492
6493 !! test
6494 Nonexistent special page link with fragment
6495 !! wikitext
6496 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6497 !! html
6498 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6499 </p>
6500 !! end
6501
6502 !! test
6503 Link with prefix
6504 !! wikitext
6505 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6506 !! html
6507 <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>
6508 </p>
6509 !! end
6510
6511 !! test
6512 Link with suffix
6513 !! wikitext
6514 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6515 !! html
6516 <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>!!!
6517 </p>
6518 !! end
6519
6520 !! article
6521 prefixed article
6522 !! text
6523 Some text
6524 !! endarticle
6525
6526 !! test
6527 Bug 43661: Piped links with identical prefixes
6528 !! wikitext
6529 [[prefixed article|prefixed articles with spaces]]
6530
6531 [[prefixed article|prefixed articlesaoeu]]
6532
6533 [[Main Page|Main Page test]]
6534 !! html
6535 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6536 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6537 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6538 </p>
6539 !! end
6540
6541
6542 !! test
6543 Link with HTML entity in suffix / tail
6544 !! wikitext
6545 [[Main Page]]&quot;, [[Main Page]]&#97;
6546 !! html/php
6547 <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;
6548 </p>
6549 !! html/parsoid
6550 <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>
6551 !! end
6552
6553 !! test
6554 Link with 3 brackets
6555 !! wikitext
6556 [[[Main Page]]]
6557 !! html
6558 <p>[[[Main Page]]]
6559 </p>
6560 !! end
6561
6562 !! test
6563 Link with 4 brackets
6564 !! wikitext
6565 [[[[Main Page]]]]
6566 !! html
6567 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6568 </p>
6569 !! end
6570
6571 !! test
6572 Piped link with 3 brackets
6573 !! wikitext
6574 [[[main page|the main page]]]
6575 !! html
6576 <p>[[[main page|the main page]]]
6577 </p>
6578 !! end
6579
6580 !! test
6581 Piped link with extlink-like text
6582 !! wikitext
6583 [[Main Page|[bar]]]
6584 [[Main Page|This is a [bar]]]
6585 !! html/php
6586 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6587 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6588 </p>
6589 !! html/parsoid
6590 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6591 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6592 !! end
6593
6594 !! test
6595 Link with multiple pipes
6596 !! wikitext
6597 [[Main Page|The|Main|Page]]
6598 !! html
6599 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6600 </p>
6601 !! end
6602
6603 # Note that parsoid does not munge anchor text; all non-space
6604 # characters are valid in HTML5 ids.
6605 !! test
6606 Anchor containing a #. (bug 63430)
6607 !! wikitext
6608 [[Main Page#And#Link]]
6609 !! html/php
6610 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6611 </p>
6612 !! html/parsoid
6613 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6614 !! end
6615
6616 !! test
6617 Link to namespaces
6618 !! wikitext
6619 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6620 !! html
6621 <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>
6622 </p>
6623 !! end
6624
6625 !! test
6626 Link with space in namespace
6627 !! wikitext
6628 [[User talk:Foo bar]]
6629 !! html
6630 <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>
6631 </p>
6632 !! end
6633
6634 !! article
6635 MemoryAlpha:AlphaTest
6636 !! text
6637 This is an article in the MemoryAlpha namespace
6638 (which shadows the memoryalpha interwiki link).
6639 !! endarticle
6640
6641 !! test
6642 Namespace takes precedence over interwiki link (bug 51680)
6643 !! wikitext
6644 [[MemoryAlpha:AlphaTest]]
6645 !! html
6646 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6647 </p>
6648 !! end
6649
6650 # The previous test doesn't work correctly in html2*, due to not recognizing the
6651 # link as an internal one. This one checks for the correct behavior.
6652 !! test
6653 Link to namespace preferred over interwiki with correct rel attribute
6654 !! options
6655 parsoid=html2wt,html2html
6656 !! html
6657 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6658 !! wikitext
6659 [[MemoryAlpha:AlphaTest]]
6660 !! end
6661
6662 !! test
6663 Piped link to namespace
6664 !! wikitext
6665 [[Meta:Disclaimers|The disclaimers]]
6666 !! html
6667 <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>
6668 </p>
6669 !! end
6670
6671 !! test
6672 Link containing }
6673 !! wikitext
6674 [[Usually caused by a typo (oops}]]
6675 !! html
6676 <p>[[Usually caused by a typo (oops}]]
6677 </p>
6678 !! end
6679
6680 !! article
6681 7% Solution
6682 !! text
6683 Just a test of an article title containing a percent.
6684 !! endarticle
6685
6686 !! test
6687 Link containing % (not as a hex sequence)
6688 !! wikitext
6689 [[7% Solution]]
6690 !! html/php
6691 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6692 </p>
6693 !! html/parsoid
6694 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6695 !! end
6696
6697 # note that the parsoid HTML is identical to the previous test output,
6698 # so the previous test ensures that the html2wt mode will generate the
6699 # "not as a hex sequence" wikitext.
6700 !! test
6701 Link containing % as a single hex sequence interpreted to char
6702 !! options
6703 parsoid=wt2wt,wt2html,html2html
6704 !! wikitext
6705 [[7%25 Solution]]
6706 !! html/php
6707 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6708 </p>
6709 !! html/parsoid
6710 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6711 !!end
6712
6713 !! test
6714 Link containing % as a double hex sequence interpreted to hex sequence
6715 !! wikitext
6716 [[7%2525 Solution]]
6717 !! html
6718 <p>[[7%2525 Solution]]
6719 </p>
6720 !!end
6721
6722 # note that parsoid does not munge anchor text; all non-space
6723 # characters are valid in HTML5 anchors.
6724 !! test
6725 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6726 Example for such a section: == < ==
6727 !! wikitext
6728 [[%23%3c]][[%23%3e]]
6729 !! html/php
6730 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6731 </p>
6732 !! html/parsoid
6733 <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>
6734 !! end
6735
6736 !! test
6737 Link containing "<#" and ">#" as a hex sequences
6738 !! wikitext
6739 [[%3c%23]][[%3e%23]]
6740 !! html
6741 <p>[[%3c%23]][[%3e%23]]
6742 </p>
6743 !! end
6744
6745 !! test
6746 Link containing an equals sign
6747 !! wikitext
6748 [[Special:BookSources/isbn=4-00-026157-6]]
6749 !! html/php
6750 <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>
6751 </p>
6752 !! html/parsoid
6753 <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>
6754 !! end
6755
6756 !! article
6757 Foo~bar
6758 !! text
6759 Just a test of an article title containing a tilde.
6760 !! endarticle
6761
6762 # note that links containing signatures, like [[Foo~~~~]], are
6763 # massaged by the pre-save transform (PST) and so the tildes are never
6764 # seen by the parser.
6765 !! test
6766 Link containing a tilde
6767 !! wikitext
6768 [[Foo~bar]]
6769 !! html/php
6770 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6771 </p>
6772 !! html/parsoid
6773 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6774 !! end
6775
6776 !! test
6777 Link containing double-single-quotes '' (bug 4598)
6778 !! wikitext
6779 [[Lista d''e paise d''o munno]]
6780 !! html/php
6781 <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>
6782 </p>
6783 !! html/parsoid
6784 <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>
6785 !! end
6786
6787 !! test
6788 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6789 !! wikitext
6790 Some [[Link|pretty ''italics'' and stuff]]!
6791 !! html/php
6792 <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>!
6793 </p>
6794 !! html/parsoid
6795 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6796 !! end
6797
6798 !! test
6799 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6800 !! wikitext
6801 ''Some [[Link|pretty ''italics'' and stuff]]!''
6802 !! html
6803 <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>
6804 </p>
6805 !! end
6806
6807 !! test
6808 Link with double quotes in title part (literal) and alternate part (interpreted)
6809 !! wikitext
6810 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6811
6812 [[''Pentecoste'']]
6813
6814 [[''Pentecoste''|Pentecoste]]
6815
6816 [[''Pentecoste''|''Pentecoste'']]
6817 !! html/php
6818 <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>
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)">Pentecoste</a>
6821 </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>
6822 </p>
6823 !! html/parsoid
6824 <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>
6825 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6826 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6827 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6828 !! end
6829
6830 !! test
6831 Broken image links with HTML captions (bug 39700)
6832 !! wikitext
6833 [[File:Nonexistent|<script></script>]]
6834 [[File:Nonexistent|100x100px|<script></script>]]
6835 [[File:Nonexistent|&lt;]]
6836 [[File:Nonexistent|a<i>b</i>c]]
6837 !! html/php
6838 <p><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;script&gt;&lt;/script&gt;</a>
6840 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6841 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6842 </p>
6843 !! html/parsoid
6844 <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>
6845 <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>
6846 <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>
6847 <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>
6848 !! end
6849
6850 !! test
6851 Plain link to URL
6852 !! wikitext
6853 [[http://www.example.com]]
6854 !! html/php
6855 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6856 </p>
6857 !! html/parsoid
6858 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6859 !! end
6860
6861 !! test
6862 Plain link to URL with link text
6863 !! wikitext
6864 [[http://www.example.com Link text]]
6865 !! html
6866 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6867 </p>
6868 !! end
6869
6870 !! test
6871 Plain link to protocol-relative URL
6872 !! wikitext
6873 [[//www.example.com]]
6874 !! html/php
6875 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6876 </p>
6877 !! html/parsoid
6878 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6879 !! end
6880
6881 !! test
6882 Plain link to protocol-relative URL with link text
6883 !! wikitext
6884 [[//www.example.com Link text]]
6885 !! html
6886 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6887 </p>
6888 !! end
6889
6890 !! test
6891 Plain link to page with question mark in title
6892 !! wikitext
6893 [[A?b]]
6894
6895 [[A?b|Baz]]
6896 !! html
6897 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6898 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6899 </p>
6900 !! end
6901
6902
6903 # I'm fairly sure the expected result here is wrong.
6904 # We want these to be URL links, not pseudo-pages with URLs for titles....
6905 # However the current output is also pretty screwy.
6906 #
6907 # ----
6908 # I'm changing it to match the current output--it arguably makes more
6909 # sense in the light of the test above. Old expected result was:
6910 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6911 #</p>
6912 # But I think this test is bordering on "garbage in, garbage out" anyway.
6913 # -- wtm
6914 !! test
6915 Piped link to URL
6916 !! wikitext
6917 Piped link to URL: [[http://www.example.com|an example URL]]
6918 !! html/php
6919 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6920 </p>
6921 !! html/parsoid
6922 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6923 !! end
6924
6925 !! test
6926 BUG 2: [[page|http://url/]] should link to page, not http://url/
6927 !! wikitext
6928 [[Main Page|http://url/]]
6929 !! html/php
6930 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6931 </p>
6932 !! html/parsoid
6933 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6934 !! end
6935
6936 # Parsoid does not mark self-links, by design.
6937 !! test
6938 BUG 337: Escaped self-links should be bold
6939 !! options
6940 title=[[Bug462]]
6941 !! wikitext
6942 [[Bu&#103;462]] [[Bug462]]
6943 !! html/php
6944 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6945 </p>
6946 !! html/php+tidy
6947 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6948 !! html/parsoid
6949 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6950 !! end
6951
6952 !! test
6953 Self-link to section should not be bold
6954 !! options
6955 title=[[Main Page]]
6956 !! wikitext
6957 [[Main Page#section]]
6958 !! html
6959 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6960 </p>
6961 !! end
6962
6963 !! article
6964 00
6965 !! text
6966 This is 00.
6967 !! endarticle
6968
6969 !!test
6970 Self-link to numeric title
6971 !!options
6972 title=[[0]]
6973 !! wikitext
6974 [[0]]
6975 !! html
6976 <p><strong class="selflink">0</strong>
6977 </p>
6978 !!end
6979
6980 !!test
6981 Link to numeric-equivalent title
6982 !!options
6983 title=[[0]]
6984 !! wikitext
6985 [[00]]
6986 !! html
6987 <p><a href="/wiki/00" title="00">00</a>
6988 </p>
6989 !!end
6990
6991 !! test
6992 <nowiki> inside a link
6993 !! wikitext
6994 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6995 !! html
6996 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6997 </p>
6998 !! end
6999
7000 !! test
7001 Non-breaking spaces in title
7002 !! wikitext
7003 [[&nbsp; Main &nbsp; Page &nbsp;]]
7004 !! html
7005 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7006 </p>
7007 !!end
7008
7009 !! test
7010 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7011 !! options
7012 language=ca
7013 !! wikitext
7014 '''[[Main Page]]'''
7015 !! html
7016 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7017 </p>
7018 !! end
7019
7020 !! test
7021 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7022 !! options
7023 language=ca
7024 !! wikitext
7025 ''[[Main Page]]''
7026 !! html
7027 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7028 </p>
7029 !! end
7030
7031 !! test
7032 Internal link with en linktrail: no apostrophes (bug 27473)
7033 !! options
7034 language=en
7035 !! wikitext
7036 [[Something]]'nice
7037 !! html
7038 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7039 </p>
7040 !! end
7041
7042 !! test
7043 Internal link with ca linktrail with apostrophes (bug 27473)
7044 !! options
7045 language=ca
7046 !! wikitext
7047 [[Something]]'nice
7048 !! html
7049 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7050 </p>
7051 !! end
7052
7053 !! test
7054 Internal link with kaa linktrail with apostrophes (bug 27473)
7055 !! options
7056 language=kaa
7057 !! wikitext
7058 [[Something]]'nice
7059 !! html
7060 <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>
7061 </p>
7062 !! end
7063
7064 !! test
7065 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7066 !! wikitext
7067 [[User:Foo/Test/63636:Bar|Test]]
7068 !! html/php
7069 <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>
7070 </p>
7071 !! html/parsoid
7072 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7073 !! end
7074
7075 !! test
7076 Purely hash wikilink
7077 !! options
7078 title=[[User:test/123]]
7079 !! wikitext
7080 [[#a|b]]
7081 !! html/php
7082 <p><a href="#a">b</a>
7083 </p>
7084 !! html/parsoid
7085 <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>
7086 !! end
7087
7088 !! test
7089 1. Interaction of linktrail and template encapsulation
7090 !! options
7091 parsoid
7092 !! wikitext
7093 {{echo|[[Foo]]}}l
7094 !! html
7095 <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>
7096 !! end
7097
7098 !! test
7099 2. Interaction of linktrail and template encapsulation
7100 !! options
7101 parsoid
7102 !! wikitext
7103 {{echo|Some [[Fool]]}}s
7104 !! html
7105 <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>
7106 !! end
7107
7108 !! test
7109 3. Interaction of linktrail and template encapsulation
7110 !! options
7111 parsoid
7112 !! wikitext
7113 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7114 !! html
7115 <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>
7116 !! end
7117
7118 !! article
7119 Söfnuður
7120 !! text
7121 Test.
7122 !! endarticle
7123
7124 !! test
7125 Internal link with is link prefix
7126 !! options
7127 language=is
7128 !! wikitext
7129 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7130 !! html
7131 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7132 </p>
7133 !! end
7134
7135 !! article
7136 Mótmælendatrú
7137 !! text
7138 Test.
7139 !! endarticle
7140
7141 !! test
7142 Internal link with is link trail and link prefix
7143 !! options
7144 language=is
7145 !! wikitext
7146 [[mótmælendatrú|xxx]]ar
7147 [[mótmælendatrú]]ar
7148 mótmælenda[[söfnuður]]
7149 mótmælenda[[söfnuður|söfnuðir]]
7150 mótmælenda[[söfnuður|söfnuðir]]xxx
7151 !! html
7152 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7153 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7154 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7155 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7156 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7157 </p>
7158 !! end
7159
7160 !! test
7161 Parsoid link trail escaping
7162 !! options
7163 parsoid=html2wt,html2html
7164 !! html
7165 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7166 !! wikitext
7167 [[apple]]<nowiki/>s
7168 !! end
7169
7170 !! test
7171 Parsoid link prefix escaping
7172 !! options
7173 language=is
7174 parsoid=html2wt,html2html
7175 !! html
7176 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7177 !! wikitext
7178 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7179 !! end
7180
7181 !! test
7182 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7183 !! wikitext
7184 [[Foo| bar]]
7185
7186 [[Foo| ''bar'']]
7187
7188 [http://wp.org foo]
7189
7190 [http://wp.org ''foo'']
7191 !! html
7192 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7193 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7194 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7195 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7196 </p>
7197 !! end
7198
7199 !! test
7200 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7201 !! options
7202 parsoid
7203 !! wikitext
7204 [[Foo|{{echo|a}} b {{echo|c}}]]
7205 !! html
7206 <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>
7207 !! end
7208
7209 !! test
7210 Link with angle bracket after anchor
7211 !! wikitext
7212 [[Foo#<bar>]]
7213 !! html/php
7214 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7215 </p>
7216 !! html/parsoid
7217 <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>
7218 !! end
7219
7220 ###
7221 ### Interwiki links (see maintenance/interwiki.sql)
7222 ###
7223
7224 !! test
7225 Inline interwiki link
7226 !! options
7227 parsoid=wt2html,wt2wt,html2html
7228 !! wikitext
7229 [[MeatBall:SoftSecurity]]
7230 !! html/php
7231 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7232 </p>
7233 !! html/parsoid
7234 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7235 !! end
7236
7237 !! test
7238 Inline interwiki link with empty title (bug 2372)
7239 !! options
7240 parsoid=wt2html,wt2wt,html2html
7241 !! wikitext
7242 [[MeatBall:]]
7243 !! html/php
7244 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7245 </p>
7246 !! html/parsoid
7247 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7248 !! end
7249
7250 !! test
7251 Interwiki link encoding conversion (bug 1636)
7252 !! wikitext
7253 *[[Wikipedia:ro:Olteni&#0355;a]]
7254 *[[Wikipedia:ro:Olteni&#355;a]]
7255 !! html
7256 <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>
7257 <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>
7258
7259 !! html+tidy
7260 <ul>
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 <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>
7263 </ul>
7264 !! end
7265
7266 !! test
7267 Interwiki link with fragment (bug 2130)
7268 !! wikitext
7269 [[MeatBall:SoftSecurity#foo]]
7270 !! html
7271 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7272 </p>
7273 !! end
7274
7275 # Ideally the wikipedia: prefix here should be proto-relative too
7276 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7277 # define the 'en' prefix, and originally the test used 'wikipedia',
7278 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7279 # article.
7280 !! test
7281 Different interwiki prefixes mapping to the same URL
7282 !! wikitext
7283 [[:en:Foo]]
7284
7285 [[:en:Foo|Foo]]
7286
7287 [[wikipedia:Foo]]
7288
7289 [[:wikipedia:Foo|Foo]]
7290
7291 [[wikipedia:en:Foo]]
7292
7293 [[:wikipedia:en:Foo]]
7294
7295 [[ wikiPEdia :Foo]]
7296 !! html/parsoid
7297 <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>
7298
7299 <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>
7300
7301 <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>
7302
7303 <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>
7304
7305 <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>
7306
7307 <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>
7308
7309 <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>
7310 !! end
7311
7312 !! test
7313 Interwiki links that cannot be represented in wiki syntax
7314 !! wikitext
7315 [[meatball:ok]]
7316 [[meatball:ok#foo|ok with fragment]]
7317 [[meatball:ok_as_well?|ok ending with ? mark]]
7318 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7319 [http://de.wikipedia.org/wiki/#foo is just fragment]
7320
7321 !! html/php
7322 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7323 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7324 <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>
7325 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7326 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7327 </p>
7328 !! html/parsoid
7329 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7330 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7331 <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>
7332 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7333 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7334 !! end
7335
7336 !! test
7337 Interwiki links: trail
7338 !! wikitext
7339 [[wikipedia:Foo|Ba]]r
7340 !! html/php
7341 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7342 </p>
7343 !! html/parsoid
7344 <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>
7345 !! end
7346
7347 !! test
7348 Local interwiki link
7349 !! options
7350 parsoid=wt2html,wt2wt,html2html
7351 !! wikitext
7352 [[local:Template:Foo]]
7353 !! html/php
7354 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7355 </p>
7356 !! html/parsoid
7357 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7358 !! end
7359
7360 # Parsoid does not mark self-links, by design.
7361 !! test
7362 Local interwiki link: self-link to current page
7363 !! options
7364 title=[[Main Page]]
7365 parsoid=wt2html,wt2wt,html2html
7366 !! wikitext
7367 [[local:Main Page]]
7368 !! html/php
7369 <p><strong class="selflink">local:Main Page</strong>
7370 </p>
7371 !! html/parsoid
7372 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7373 !! end
7374
7375 !! test
7376 Local interwiki link: prefix only (bug 64167)
7377 !! options
7378 parsoid=wt2html,wt2wt,html2html
7379 !! wikitext
7380 [[local:]]
7381 !! html/php
7382 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7383 </p>
7384 !! html/parsoid
7385 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7386 !! end
7387
7388 !! test
7389 Local interwiki link: with additional interwiki prefix (bug 61357)
7390 !! options
7391 parsoid=wt2html,wt2wt,html2html
7392 !! wikitext
7393 [[local:meatball:Hello]]
7394 !! html/php
7395 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7396 </p>
7397 !! html/parsoid
7398 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7399 !! end
7400
7401 !! test
7402 Multiple local interwiki link prefixes
7403 !! wikitext
7404 [[local:local:local:local:mi:local:Foo]]
7405 !! options
7406 parsoid=wt2html,wt2wt,html2html
7407 !! html/php
7408 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7409 </p>
7410 !! html/parsoid
7411 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7412 !! end
7413
7414 ###
7415 ### Interlanguage links
7416 ### Language links (so that searching for '### language' matches..)
7417 ###
7418
7419 !! test
7420 Interlanguage link
7421 !! options
7422 parsoid=wt2html,wt2wt,html2html
7423 !! wikitext
7424 Blah blah blah
7425 [[zh:Chinese]]
7426 !! html/php
7427 <p>Blah blah blah
7428 </p>
7429 !! html/parsoid
7430 <p>Blah blah blah</p>
7431 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7432 !! end
7433
7434 !! test
7435 Interlanguage link with spacing
7436 !! options
7437 parsoid=wt2html,wt2wt,html2html
7438 !! wikitext
7439 Blah blah blah
7440 [[ zh : Chinese ]]
7441 !! html/php
7442 <p>Blah blah blah
7443 </p>
7444 !! html/parsoid
7445 <p>Blah blah blah</p>
7446 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7447 !! end
7448
7449 !! test
7450 Double interlanguage link
7451 !! options
7452 parsoid=wt2html,wt2wt,html2html
7453 !! wikitext
7454 Blah blah blah
7455 [[es:Spanish]]
7456 [[zh:Chinese]]
7457 !! html/php
7458 <p>Blah blah blah
7459 </p>
7460 !! html/parsoid
7461 <p>Blah blah blah</p>
7462 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7463 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7464 !! end
7465
7466 !! test
7467 Interlanguage link variations
7468 !! options
7469 parsoid=wt2html,wt2wt,html2html
7470 !! wikitext
7471 Blah blah blah
7472 [[ es :Spanish]]
7473 [[ ZH :Chinese]]
7474 [[es:Foo_bar]]
7475 [[es:Foo bar]]
7476 !! html/php
7477 <p>Blah blah blah
7478 </p>
7479 !! html/parsoid
7480 <p>Blah blah blah</p>
7481 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7482 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7483 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7484 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7485 !! end
7486
7487 !! test
7488 Interlanguage link, with prefix links
7489 !! options
7490 language=ln
7491 !! wikitext
7492 Blah blah blah
7493 [[zh:Chinese]]
7494 !! html/php
7495 <p>Blah blah blah
7496 </p>
7497 !! html/parsoid
7498 <p>Blah blah blah</p>
7499 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7500 !! end
7501
7502 !! test
7503 Double interlanguage link, with prefix links (bug 8897)
7504 !! options
7505 language=ln
7506 !! wikitext
7507 Blah blah blah
7508 [[es:Spanish]]
7509 [[zh:Chinese]]
7510 !! html/php
7511 <p>Blah blah blah
7512 </p>
7513 !! html/parsoid
7514 <p>Blah blah blah</p>
7515 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7516 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7517 !! end
7518
7519 !! test
7520 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7521 !! wikitext
7522 Blah blah blah
7523 [[mul:Article]]
7524 !! html/php
7525 <p>Blah blah blah
7526 </p>
7527 !! html/parsoid
7528 <p>Blah blah blah</p>
7529 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7530 !! end
7531
7532 !! test
7533 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7534 !! options
7535 language=ln
7536 !! wikitext
7537 [[WW&nbsp;II]]
7538 !! html
7539 <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>
7540 </p>
7541 !! end
7542
7543 !! test
7544 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7545 !! options
7546 parsoid=html2wt
7547 !! html
7548 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7549 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7550 !! wikitext
7551 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7552
7553 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7554 !! end
7555
7556 !! test
7557 Parsoid: handle constructor well
7558 !! wikitext
7559 [[constructor]]
7560
7561 [[constructor:foo]]
7562 !! html/php
7563 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7564 </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>
7565 </p>
7566 !! html/parsoid
7567 <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>
7568
7569 <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>
7570 !! end
7571
7572 !! article
7573 ko:
7574 !! text
7575 Test.
7576 !! endarticle
7577
7578 # Note that `ko` isn't a known interlanguage prefix
7579 !! test
7580 Parsoid: recognize interlanguage links without a target page
7581 !! options
7582 ill
7583 !! wikitext
7584 [[es:]]
7585
7586 [[ko:]]
7587 !! html/php
7588 es:
7589 !! html/parsoid
7590 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7591
7592 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7593 !! end
7594
7595 # Note that `ko` isn't a known interwiki prefix
7596 !! test
7597 Parsoid: recognize interwiki links without a target page
7598 !! options
7599 parsoid=wt2html,wt2wt,html2html
7600 !! wikitext
7601 [[:es:]]
7602
7603 [[:ko:]]
7604 !! html/php
7605 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7606 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7607 </p>
7608 !! html/parsoid
7609 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7610 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7611 !! end
7612
7613 !! test
7614 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7615 !! wikitext
7616 [[mi:Foo]]
7617 !! html/php
7618 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7619 </p>
7620 !! html/parsoid
7621 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7622 !! end
7623
7624 !! test
7625 Interlanguage link with preceding local interwiki link (bug 68085)
7626 !! options
7627 parsoid=wt2html,wt2wt,html2html
7628 !! wikitext
7629 Blah blah blah
7630 [[local:es:Spanish]]
7631 !! html/php
7632 <p>Blah blah blah
7633 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7634 </p>
7635 !! html/parsoid
7636 <p>Blah blah blah
7637 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7638 !! end
7639
7640 !! test
7641 Looks like an interlanguage link, but is actually a local interwiki
7642 !! options
7643 parsoid=wt2html,wt2wt,html2html
7644 !! wikitext
7645 Blah blah blah
7646 [[mi:Template:Foo]]
7647 !! html/php
7648 <p>Blah blah blah
7649 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7650 </p>
7651 !! html/parsoid
7652 <p>Blah blah blah
7653 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7654 !! end
7655
7656 ###
7657 ### Redirects, Parsoid-only
7658 ###
7659 !! test
7660 1. Simple redirect to page
7661 !! options
7662 parsoid
7663 !! wikitext
7664 #REDIRECT [[Main Page]]
7665 !! html
7666 <link rel="mw:PageProp/redirect" href="./Main_Page">
7667 !! end
7668
7669 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7670 !! test
7671 2. Other redirect variants
7672 !! options
7673 parsoid=wt2html,wt2wt
7674 !! wikitext
7675 #REDIRECT [[Main_Page]]
7676 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7677 !! html/parsoid
7678 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7679 !! end
7680
7681 !! test
7682 Empty redirect
7683 !! options
7684 parsoid=wt2html,wt2wt
7685 !! wikitext
7686 #REDIRECT [[]]
7687 !! html
7688 <ol>
7689 <li>REDIRECT [[]]</li></ol>
7690 !! end
7691
7692 !! test
7693 Optional colon in #REDIRECT
7694 !! options
7695 # the colon is archaic syntax. we support it for wt2html, but we
7696 # don't care that it roundtrips back to the modern syntax.
7697 parsoid=wt2html,html2html
7698 !! wikitext
7699 #REDIRECT:[[Main Page]]
7700 !! html
7701 <link rel="mw:PageProp/redirect" href="./Main_Page">
7702 !! end
7703
7704 !! test
7705 Whitespace in #REDIRECT with optional colon
7706 !! options
7707 # the colon and gratuitous whitespace is archaic syntax. we support
7708 # it for wt2html, but we don't care that it roundtrips back to the
7709 # modern syntax (without extra whitespace)
7710 parsoid=wt2html,html2html
7711 !! wikitext
7712
7713 #REDIRECT
7714 :
7715 [[Main Page]]
7716 !! html
7717 <link rel="mw:PageProp/redirect" href="./Main_Page">
7718 !! end
7719
7720 !! test
7721 Piped link in #REDIRECT
7722 !! options
7723 # content after piped link is ignored. we support this syntax,
7724 # but don't care that the piped link is lost when we roundtrip this.
7725 parsoid=wt2html
7726 !! wikitext
7727 #REDIRECT [[Main Page|bar]]
7728 !! html
7729 <link rel="mw:PageProp/redirect" href="./Main_Page">
7730 !! end
7731
7732 !! test
7733 Redirect to category
7734 !! options
7735 parsoid=wt2html
7736 !! wikitext
7737 #REDIRECT [[Category:Foo]]
7738 !! html
7739 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7740 !! end
7741
7742 !! test
7743 Redirect to category with URL encoding
7744 !! options
7745 parsoid=wt2html
7746 !! wikitext
7747 #REDIRECT [[Category%3AFoo]]
7748 !! html
7749 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7750 !! end
7751
7752 !! test
7753 Redirect to category page
7754 !! options
7755 parsoid=wt2html,html2html
7756 !! wikitext
7757 #REDIRECT [[:Category:Foo]]
7758 !! html
7759 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7760 !! end
7761
7762 !! test
7763 Redirect to image page (1)
7764 !! options
7765 parsoid
7766 !! wikitext
7767 #REDIRECT [[File:Wiki.png]]
7768 !! html
7769 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7770 !! end
7771
7772 !! test
7773 Redirect to image page (2)
7774 !! options
7775 parsoid
7776 !! wikitext
7777 #REDIRECT [[Image:Wiki.png]]
7778 !! html
7779 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7780 !! end
7781
7782 !! test
7783 Redirect to language
7784 !! options
7785 parsoid
7786 !! wikitext
7787 #REDIRECT [[en:File:Wiki.png]]
7788 !! html
7789 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7790 !! end
7791
7792 !! test
7793 Redirect to interwiki
7794 !! options
7795 parsoid
7796 !! wikitext
7797 #REDIRECT [[meatball:File:Wiki.png]]
7798 !! html
7799 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7800 !! end
7801
7802 !! test
7803 Non-English #REDIRECT
7804 !! options
7805 parsoid
7806 language=is
7807 !! wikitext
7808 #TILVÍSUN [[Main Page]]
7809 !! html
7810 <link rel="mw:PageProp/redirect" href="./Main_Page">
7811 !! end
7812
7813 !! test
7814 New redirect
7815 !! options
7816 parsoid=html2wt
7817 !! html
7818 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7819 !! wikitext
7820 Foo
7821 #REDIRECT [[Foo]]
7822 !! end
7823
7824 ##
7825 ## XHTML tidiness
7826 ###
7827
7828 !! test
7829 <br> to <br />
7830 !! wikitext
7831 1<br>2<br />3
7832 !! html
7833 <p>1<br />2<br />3
7834 </p>
7835 !! end
7836
7837 !! test
7838 Broken br tag sanitization
7839 !! wikitext
7840 </br>
7841 !! html/php
7842 <p>&lt;/br&gt;
7843 </p>
7844 !! end
7845
7846 # TODO: Fix html2html mode (bug 51055)!
7847 !! test
7848 Parsoid: Broken br tag recognition
7849 !! options
7850 parsoid=wt2html
7851 !! wikitext
7852 </br>
7853
7854 <br/ >
7855 !! html+tidy
7856 <p><br /></p>
7857 <p><br /></p>
7858 !! end
7859
7860 !! test
7861 Incorrecly removing closing slashes from correctly formed XHTML
7862 !! wikitext
7863 <br style="clear:both;" />
7864 !! html
7865 <p><br style="clear:both;" />
7866 </p>
7867 !! end
7868
7869 !! test
7870 Failing to transform badly formed HTML into correct XHTML
7871 !! wikitext
7872 <br style="clear: left;">
7873 <br style="clear: right;">
7874 <br style="clear: both;">
7875 !! html
7876 <p><br style="clear: left;" />
7877 <br style="clear: right;" />
7878 <br style="clear: both;" />
7879 </p>
7880 !!end
7881
7882 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7883 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7884 !! test
7885 Handling html with a div self-closing tag
7886 !! wikitext
7887 <div title />
7888 <div title/>
7889 <div title/ >
7890 <div title=bar />
7891 <div title=bar/>
7892 <div title=bar/ >
7893 !! html/php
7894 <p>&lt;div title /&gt;
7895 &lt;div title/&gt;
7896 </p>
7897 <div>
7898 <p>&lt;div title=bar /&gt;
7899 &lt;div title=bar/&gt;
7900 </p>
7901 <div title="bar/"></div>
7902 </div>
7903
7904 !! html/parsoid
7905 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7906 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7907 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7908 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7909 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7910 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7911 !! end
7912
7913 !! test
7914 Handling html with a br self-closing tag
7915 !! wikitext
7916 <br title />
7917 <br title/>
7918 <br title/ >
7919 <br title=bar />
7920 <br title=bar/>
7921 <br title=bar/ >
7922 !! html/php
7923 <p><br title="title" />
7924 <br title="title" />
7925 <br />
7926 <br title="bar" />
7927 <br title="bar" />
7928 <br title="bar/" />
7929 </p>
7930 !! html/parsoid
7931 <p><br title="" />
7932 <br title="" />
7933 <br title="" />
7934 <br title="bar" />
7935 <br title="bar" />
7936 <br title="bar/" />
7937 </p>
7938 !! end
7939
7940 !! test
7941 Horizontal ruler (should it add that extra space?)
7942 !! wikitext
7943 <hr>
7944 <hr >
7945 foo <hr
7946 > bar
7947 !! html+tidy
7948 <hr />
7949 <hr />
7950 <p>foo</p>
7951 <hr />
7952 <p>bar</p>
7953 !! end
7954
7955 !! test
7956 Horizontal ruler -- 4+ dashes render hr
7957 !! wikitext
7958 ----
7959 !! html
7960 <hr />
7961
7962 !! end
7963
7964 !! test
7965 Horizontal ruler -- eats additional dashes on the same line
7966 !! wikitext
7967 ---------
7968 !! html
7969 <hr />
7970
7971 !! end
7972
7973 !! test
7974 Horizontal ruler -- does not collapse dashes on consecutive lines
7975 !! wikitext
7976 ----
7977 ----
7978 !! html
7979 <hr />
7980 <hr />
7981
7982 !! end
7983
7984 !! test
7985 Horizontal ruler -- <4 dashes render as plain text
7986 !! wikitext
7987 ---
7988 !! html
7989 <p>---
7990 </p>
7991 !! end
7992
7993 !! test
7994 Horizontal ruler -- Supports content following dashes on same line
7995 !! wikitext
7996 ---- Foo
7997 !! html
7998 <hr /> Foo
7999
8000 !! html+tidy
8001 <hr />
8002 <p>Foo</p>
8003 !! end
8004
8005 ###
8006 ### Block-level elements
8007 ###
8008 !! test
8009 Common list
8010 !! wikitext
8011 *Common list
8012 * item 2
8013 *item 3
8014 !! html
8015 <ul><li>Common list</li>
8016 <li> item 2</li>
8017 <li>item 3</li></ul>
8018
8019 !! end
8020
8021 !! test
8022 Numbered list
8023 !! wikitext
8024 #Numbered list
8025 #item 2
8026 # item 3
8027 !! html
8028 <ol><li>Numbered list</li>
8029 <li>item 2</li>
8030 <li> item 3</li></ol>
8031
8032 !! end
8033
8034 !! test
8035 Mixed list
8036 !! wikitext
8037 *Mixed list
8038 *# with numbers
8039 ** and bullets
8040 *# and numbers
8041 *bullets again
8042 **bullet level 2
8043 ***bullet level 3
8044 ***#Number on level 4
8045 **bullet level 2
8046 **#Number on level 3
8047 **#Number on level 3
8048 *#number level 2
8049 *Level 1
8050 *** Level 3
8051 #** Level 3, but ordered
8052 !! html
8053 <ul><li>Mixed list
8054 <ol><li> with numbers</li></ol>
8055 <ul><li> and bullets</li></ul>
8056 <ol><li> and numbers</li></ol></li>
8057 <li>bullets again
8058 <ul><li>bullet level 2
8059 <ul><li>bullet level 3
8060 <ol><li>Number on level 4</li></ol></li></ul></li>
8061 <li>bullet level 2
8062 <ol><li>Number on level 3</li>
8063 <li>Number on level 3</li></ol></li></ul>
8064 <ol><li>number level 2</li></ol></li>
8065 <li>Level 1
8066 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8067 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8068
8069 !! end
8070
8071 !! test
8072 Nested lists 1
8073 !! wikitext
8074 *foo
8075 **bar
8076 !! html
8077 <ul><li>foo
8078 <ul><li>bar</li></ul></li></ul>
8079
8080 !! end
8081
8082 !! test
8083 Nested lists 2
8084 !! wikitext
8085 **foo
8086 *bar
8087 !! html
8088 <ul><li><ul><li>foo</li></ul></li>
8089 <li>bar</li></ul>
8090
8091 !! end
8092
8093 !! test
8094 Nested lists 3 (first element empty)
8095 !! wikitext
8096 *
8097 **bar
8098 !! html
8099 <ul><li>
8100 <ul><li>bar</li></ul></li></ul>
8101
8102 !! end
8103
8104 !! test
8105 Nested lists 4 (first element empty)
8106 !! wikitext
8107 **
8108 *bar
8109 !! html
8110 <ul><li><ul><li></li></ul></li>
8111 <li>bar</li></ul>
8112
8113 !! end
8114
8115 !! test
8116 Nested lists 5 (both elements empty)
8117 !! wikitext
8118 **
8119 *
8120 !! html
8121 <ul><li><ul><li></li></ul></li>
8122 <li></li></ul>
8123
8124 !! end
8125
8126 !! test
8127 Nested lists 6 (both elements empty)
8128 !! wikitext
8129 *
8130 **
8131 !! html
8132 <ul><li>
8133 <ul><li></li></ul></li></ul>
8134
8135 !! end
8136
8137 !! test
8138 Nested lists 7 (skip initial nesting levels)
8139 !! wikitext
8140 *** foo
8141 !! html
8142 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8143
8144 !! end
8145
8146 !! test
8147 Nested lists 8 (multiple nesting transitions)
8148 !! wikitext
8149 * foo
8150 *** bar
8151 ** baz
8152 * boo
8153 !! html
8154 <ul><li> foo
8155 <ul><li><ul><li> bar</li></ul></li>
8156 <li> baz</li></ul></li>
8157 <li> boo</li></ul>
8158
8159 !! end
8160
8161 !! test
8162 Nested lists 9 (extension interaction)
8163 !! options
8164 parsoid
8165 !! wikitext
8166 *<references />
8167 !! html/parsoid
8168 <ul><li data-parsoid='{}'><ol class="references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8169 !! end
8170
8171 !! test
8172 1. Lists with start-of-line-transparent tokens before bullets: Comments
8173 !! wikitext
8174 *foo
8175 *<!--cmt-->bar
8176 <!--cmt-->*baz
8177 !! html
8178 <ul><li>foo</li>
8179 <li>bar</li>
8180 <li>baz</li></ul>
8181
8182 !! end
8183
8184 !! test
8185 2. Lists with start-of-line-transparent tokens before bullets: Template close
8186 !! wikitext
8187 *foo {{echo|bar
8188 }}*baz
8189 !! html
8190 <ul><li>foo bar</li>
8191 <li>baz</li></ul>
8192
8193 !! end
8194
8195 !! test
8196 List items are not parsed correctly following a <pre> block (bug 785)
8197 !! wikitext
8198 * <pre>foo</pre>
8199 * <pre>bar</pre>
8200 * zar
8201 !! html
8202 <ul><li> <pre>foo</pre></li>
8203 <li> <pre>bar</pre></li>
8204 <li> zar</li></ul>
8205
8206 !! end
8207
8208 !! test
8209 List items from template
8210 !! wikitext
8211
8212 {{inner list}}
8213 * item 2
8214
8215 * item 0
8216 {{inner list}}
8217 * item 2
8218
8219 * item 0
8220 * notSOL{{inner list}}
8221 * item 2
8222 !! html
8223 <ul><li> item 1</li>
8224 <li> item 2</li></ul>
8225 <ul><li> item 0</li>
8226 <li> item 1</li>
8227 <li> item 2</li></ul>
8228 <ul><li> item 0</li>
8229 <li> notSOL</li>
8230 <li> item 1</li>
8231 <li> item 2</li></ul>
8232
8233 !! end
8234
8235 !! test
8236 List interrupted by empty line or heading
8237 !! wikitext
8238 * foo
8239
8240 ** bar
8241 == A heading ==
8242 * Another list item
8243 !! html
8244 <ul><li> foo</li></ul>
8245 <ul><li><ul><li> bar</li></ul></li></ul>
8246 <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>
8247 <ul><li> Another list item</li></ul>
8248
8249 !!end
8250
8251 !!test
8252 Multiple list tags generated by templates
8253 !! wikitext
8254 {{echo|<li>}}a
8255 {{echo|<li>}}b
8256 {{echo|<li>}}c
8257 !! html
8258 <li>a
8259 <li>b
8260 <li>c</li>
8261 </li>
8262 </li>
8263
8264 !! html+tidy
8265 <ul>
8266 <li>a</li>
8267 <li>b</li>
8268 <li>c</li>
8269 </ul>
8270 !!end
8271
8272 !!test
8273 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8274 !! wikitext
8275 *a
8276 <!--This line will NOT split the list-->
8277 *b
8278 <!--This line will NOT split the list either-->
8279 *c
8280 <!--foo--> <!----> <!--This line NOT split the list either-->
8281 *d
8282 !! html
8283 <ul><li>a</li>
8284 <li>b</li>
8285 <li>c</li>
8286 <li>d</li></ul>
8287
8288 !!end
8289
8290 !!test
8291 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8292 !! wikitext
8293 *a
8294 <!--This line will NOT split the list-->
8295 *b
8296 <!--This line will NOT split the list either-->
8297 *c
8298 <!--foo--> <!----> <!--This line NOT split the list
8299 either-->
8300 *d
8301 !! html
8302 <ul><li>a</li>
8303 <li>b</li>
8304 <li>c</li>
8305 <li>d</li></ul>
8306
8307 !!end
8308
8309 !!test
8310 Test the li-hack
8311 (The PHP parser relies on Tidy for the hack)
8312 !!options
8313 parsoid=wt2html,wt2wt
8314 !! wikitext
8315 * foo
8316 * <li>li-hack
8317 * {{echo|<li>templated li-hack}}
8318 * <!--foo--> <li> unsupported li-hack with preceding comments
8319
8320 <ul>
8321 <li><li>not a li-hack
8322 </li>
8323 </ul>
8324 !! html+tidy
8325 <ul>
8326 <li>foo</li>
8327 <li>li-hack</li>
8328 <li>templated li-hack</li>
8329 <li>unsupported li-hack with preceding comments</li>
8330 </ul>
8331 <ul>
8332 <li>not a li-hack</li>
8333 </ul>
8334 !!end
8335
8336 !! test
8337 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8338 !! options
8339 parsoid
8340 !! wikitext
8341 # foo
8342 ## bar
8343 * foo
8344 ** bar
8345 : foo
8346 :: bar
8347 !! html
8348 <ol>
8349 <li> foo<ol>
8350 <li> bar</li>
8351 </ol></li>
8352 </ol><ul>
8353 <li> foo<ul>
8354 <li> bar</li>
8355 </ul></li>
8356 </ul><dl>
8357 <dd> foo<dl>
8358 <dd> bar</dd>
8359 </dl></dd>
8360 </dl>
8361 !! end
8362
8363 !! test
8364 Parsoid: Test of whitespace serialization with Templated bullets
8365 !! options
8366 parsoid
8367 !! wikitext
8368 * {{bullet}}
8369 !! html
8370 <ul>
8371 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8372 </ul>
8373 !! end
8374
8375 # ------------------------------------------------------------------------
8376 # The next set of tests are about Parsoid's ability to handle badly nested
8377 # tags (parse, minimize scope of fixup, and roundtrip back)
8378 # ------------------------------------------------------------------------
8379
8380 !! test
8381 Unbalanced closing block tags break a list
8382 (php parser relies on Tidy to fix up)
8383 !! wikitext
8384 <div>
8385 *a</div><div>
8386 *b</div>
8387 !! html+tidy
8388 <div>
8389 <ul>
8390 <li>a</li>
8391 </ul>
8392 </div>
8393 <div>
8394 <ul>
8395 <li>b</li>
8396 </ul>
8397 </div>
8398 !! end
8399
8400 # Parsoid fails this test, but it might be tricky to support properly.
8401 # See bug 68395.
8402 !! test
8403 Unbalanced closing non-block tags don't break a list
8404 (php parser relies on Tidy to fix up)
8405 !! wikitext
8406 <span>
8407 *a</span><span>
8408 *b</span>
8409 !! html/php+tidy
8410 <ul>
8411 <li><span>a</span></li>
8412 <li><span>b</span></li>
8413 </ul>
8414 !! html/parsoid
8415 <span>
8416 <ul>
8417 <li>a<span></span>
8418 </li>
8419 <li>b
8420 </li>
8421 </ul>
8422 </span>
8423 !! end
8424
8425 !! test
8426 Unclosed formatting tags that straddle lists are closed and reopened
8427 (php parser relies on Tidy to fix up)
8428 !! options
8429 parsoid=wt2html,wt2wt,html2html
8430 !! wikitext
8431 # <s> a
8432 # b </s>
8433 !! html/php+tidy
8434 <ol>
8435 <li><s>a</s></li>
8436 <li><s>b</s></li>
8437 </ol>
8438 !! html/parsoid
8439 <ol><li> <s> a</s></li>
8440 <li><s> b </s></li></ol>
8441 !! end
8442
8443 # See bug 68395.
8444 !!test
8445 1. List embedded in a formatting tag
8446 !! wikitext
8447 <small>
8448 * foo
8449 </small>
8450 !! html/php+tidy
8451 <ul>
8452 <li><small>foo</small></li>
8453 </ul>
8454 !! html/parsoid
8455 <small>
8456 <ul>
8457 <li> foo</li>
8458 </ul>
8459 </small>
8460 !!end
8461
8462 ## Ugly Parsoid output here
8463 ## Not sure what the right output is.
8464 !!test
8465 2. List embedded in a formatting tag
8466 !! wikitext
8467 <small>
8468 *a
8469 *b</small>
8470 !! html/php+tidy
8471 <ul>
8472 <li><small>a</small></li>
8473 <li><small>b</small></li>
8474 </ul>
8475 !! html/parsoid
8476 <small></small>
8477 <ul><small>
8478 <li>a</li>
8479 </small>
8480 <li><small>b</small></li>
8481 </ul>
8482 !!end
8483
8484 # Ugly Parsoid and PHP parser output here
8485 # Not sure if we want to make this a test!
8486 #
8487 ## !!test
8488 ## 3. Unclosed formatting tags in list elements
8489 ## !! wikitext
8490 ## *<small>a
8491 ## *<small>b
8492 ## !! html/php+tidy
8493 ## <ul>
8494 ## <li><small>a</small></li>
8495 ## <li><small><small>b</small></small></li>
8496 ## </ul>
8497 ## !! html/parsoid
8498 ## <ul>
8499 ## <li><small>a</small></li>
8500 ## <small>
8501 ## <li><small>b</small></li>
8502 ## </small></ul>
8503 ## !!end
8504
8505 # This is a bug in the PHP parser + tidy combination.
8506 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8507 # and then fostered out of the table by tidy.)
8508 # We believe the Parsoid output to be correct.
8509 !! test
8510 Table with missing opening <tr> tag
8511 !! options
8512 parsoid=wt2html,wt2wt
8513 !! wikitext
8514 <table>
8515 <td>foo</td>
8516 </tr>
8517 </table>
8518 !! html+tidy
8519 <table>
8520 <tr>
8521 <td>foo</td>
8522 </tr>
8523 </table>
8524 !! end
8525
8526 ###
8527 ### Magic Words
8528 ###
8529
8530 # Note that the current date is hard-coded as
8531 # 1970-01-01T00:02:03Z (a Thursday)
8532 # when running parser tests. The timezone is also fixed to GMT, so
8533 # local date will be identical to current date.
8534
8535 !! test
8536 Magic Word: {{CURRENTDAY}}
8537 !! wikitext
8538 {{CURRENTDAY}}
8539 !! html
8540 <p>1
8541 </p>
8542 !! end
8543
8544 !! test
8545 Magic Word: {{CURRENTDAY2}}
8546 !! wikitext
8547 {{CURRENTDAY2}}
8548 !! html
8549 <p>01
8550 </p>
8551 !! end
8552
8553 !! test
8554 Magic Word: {{CURRENTDAYNAME}}
8555 !! wikitext
8556 {{CURRENTDAYNAME}}
8557 !! html
8558 <p>Thursday
8559 </p>
8560 !! end
8561
8562 !! test
8563 Magic Word: {{CURRENTDOW}}
8564 !! wikitext
8565 {{CURRENTDOW}}
8566 !! html
8567 <p>4
8568 </p>
8569 !! end
8570
8571 !! test
8572 Magic Word: {{CURRENTMONTH}}
8573 !! wikitext
8574 {{CURRENTMONTH}}
8575 !! html
8576 <p>01
8577 </p>
8578 !! end
8579
8580 !! test
8581 Magic Word: {{CURRENTMONTH1}}
8582 !! wikitext
8583 {{CURRENTMONTH1}}
8584 !! html
8585 <p>1
8586 </p>
8587 !! end
8588
8589 !! test
8590 Magic Word: {{CURRENTMONTHABBREV}}
8591 !! wikitext
8592 {{CURRENTMONTHABBREV}}
8593 !! html
8594 <p>Jan
8595 </p>
8596 !! end
8597
8598 !! test
8599 Magic Word: {{CURRENTMONTHNAME}}
8600 !! wikitext
8601 {{CURRENTMONTHNAME}}
8602 !! html
8603 <p>January
8604 </p>
8605 !! end
8606
8607 !! test
8608 Magic Word: {{CURRENTMONTHNAMEGEN}}
8609 !! wikitext
8610 {{CURRENTMONTHNAMEGEN}}
8611 !! html
8612 <p>January
8613 </p>
8614 !! end
8615
8616 !! test
8617 Magic Word: {{CURRENTTIME}}
8618 !! wikitext
8619 {{CURRENTTIME}}
8620 !! html
8621 <p>00:02
8622 </p>
8623 !! end
8624
8625 !! test
8626 Magic Word: {{CURRENTHOUR}}
8627 !! wikitext
8628 {{CURRENTHOUR}}
8629 !! html
8630 <p>00
8631 </p>
8632 !! end
8633
8634 !! test
8635 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8636 !! wikitext
8637 {{CURRENTWEEK}}
8638 !! html
8639 <p>1
8640 </p>
8641 !! end
8642
8643 !! test
8644 Magic Word: {{CURRENTYEAR}}
8645 !! wikitext
8646 {{CURRENTYEAR}}
8647 !! html
8648 <p>1970
8649 </p>
8650 !! end
8651
8652 !! test
8653 Magic Word: {{CURRENTTIMESTAMP}}
8654 !! wikitext
8655 {{CURRENTTIMESTAMP}}
8656 !! html
8657 <p>19700101000203
8658 </p>
8659 !! end
8660
8661 !! test
8662 Magic Words LOCAL (UTC)
8663 !! wikitext
8664 * {{LOCALMONTH}}
8665 * {{LOCALMONTH1}}
8666 * {{LOCALMONTHNAME}}
8667 * {{LOCALMONTHNAMEGEN}}
8668 * {{LOCALMONTHABBREV}}
8669 * {{LOCALDAY}}
8670 * {{LOCALDAY2}}
8671 * {{LOCALDAYNAME}}
8672 * {{LOCALYEAR}}
8673 * {{LOCALTIME}}
8674 * {{LOCALHOUR}}
8675 * {{LOCALWEEK}}
8676 * {{LOCALDOW}}
8677 * {{LOCALTIMESTAMP}}
8678 !! html
8679 <ul><li> 01</li>
8680 <li> 1</li>
8681 <li> January</li>
8682 <li> January</li>
8683 <li> Jan</li>
8684 <li> 1</li>
8685 <li> 01</li>
8686 <li> Thursday</li>
8687 <li> 1970</li>
8688 <li> 00:02</li>
8689 <li> 00</li>
8690 <li> 1</li>
8691 <li> 4</li>
8692 <li> 19700101000203</li></ul>
8693
8694 !! end
8695
8696 !! test
8697 Magic Word: {{FULLPAGENAME}}
8698 !! options
8699 title=[[User:Ævar Arnfjörð Bjarmason]]
8700 !! wikitext
8701 {{FULLPAGENAME}}
8702 !! html
8703 <p>User:Ævar Arnfjörð Bjarmason
8704 </p>
8705 !! end
8706
8707 !! test
8708 Magic Word: {{FULLPAGENAMEE}}
8709 !! options
8710 title=[[User:Ævar Arnfjörð Bjarmason]]
8711 !! wikitext
8712 {{FULLPAGENAMEE}}
8713 !! html
8714 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8715 </p>
8716 !! end
8717
8718 !! test
8719 Magic Word: {{TALKSPACE}}
8720 !! options
8721 title=[[User:Ævar Arnfjörð Bjarmason]]
8722 !! wikitext
8723 {{TALKSPACE}}
8724 !! html
8725 <p>User talk
8726 </p>
8727 !! end
8728
8729 !! test
8730 Magic Word: {{TALKSPACE}}, same namespace
8731 !! options
8732 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8733 !! wikitext
8734 {{TALKSPACE}}
8735 !! html
8736 <p>User talk
8737 </p>
8738 !! end
8739
8740 !! test
8741 Magic Word: {{TALKSPACE}}, main namespace
8742 !! options
8743 title=[[Parser Test]]
8744 !! wikitext
8745 {{TALKSPACE}}
8746 !! html
8747 <p>Talk
8748 </p>
8749 !! end
8750
8751 !! test
8752 Magic Word: {{TALKSPACEE}}
8753 !! options
8754 title=[[User:Ævar Arnfjörð Bjarmason]]
8755 !! wikitext
8756 {{TALKSPACEE}}
8757 !! html
8758 <p>User_talk
8759 </p>
8760 !! end
8761
8762 !! test
8763 Magic Word: {{SUBJECTSPACE}}
8764 !! options
8765 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8766 !! wikitext
8767 {{SUBJECTSPACE}}
8768 !! html
8769 <p>User
8770 </p>
8771 !! end
8772
8773 !! test
8774 Magic Word: {{SUBJECTSPACE}}, same namespace
8775 !! options
8776 title=[[User:Ævar Arnfjörð Bjarmason]]
8777 !! wikitext
8778 {{SUBJECTSPACE}}
8779 !! html
8780 <p>User
8781 </p>
8782 !! end
8783
8784 !! test
8785 Magic Word: {{SUBJECTSPACE}}, main namespace
8786 !! options
8787 title=[[Parser Test]]
8788 !! wikitext
8789 {{SUBJECTSPACE}}
8790 !! html
8791
8792 !! end
8793
8794 !! test
8795 Magic Word: {{SUBJECTSPACEE}}
8796 !! options
8797 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8798 !! wikitext
8799 {{SUBJECTSPACEE}}
8800 !! html
8801 <p>User
8802 </p>
8803 !! end
8804
8805 !! test
8806 Magic Word: {{NAMESPACE}}
8807 !! options
8808 title=[[User:Ævar Arnfjörð Bjarmason]]
8809 !! wikitext
8810 {{NAMESPACE}}
8811 !! html
8812 <p>User
8813 </p>
8814 !! end
8815
8816 !! test
8817 Magic Word: {{NAMESPACEE}}
8818 !! options
8819 title=[[User:Ævar Arnfjörð Bjarmason]]
8820 !! wikitext
8821 {{NAMESPACEE}}
8822 !! html
8823 <p>User
8824 </p>
8825 !! end
8826
8827 !! test
8828 Magic Word: {{NAMESPACENUMBER}}
8829 !! options
8830 title=[[User:Ævar Arnfjörð Bjarmason]]
8831 !! wikitext
8832 {{NAMESPACENUMBER}}
8833 !! html
8834 <p>2
8835 </p>
8836 !! end
8837
8838 !! test
8839 Magic Word: {{SUBPAGENAME}}
8840 !! options
8841 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8842 !! wikitext
8843 {{SUBPAGENAME}}
8844 !! html
8845 <p>sub ö
8846 </p>
8847 !! end
8848
8849 !! test
8850 Magic Word: {{SUBPAGENAMEE}}
8851 !! options
8852 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8853 !! wikitext
8854 {{SUBPAGENAMEE}}
8855 !! html
8856 <p>sub_%C3%B6
8857 </p>
8858 !! end
8859
8860 !! test
8861 Magic Word: {{ROOTPAGENAME}}
8862 !! options
8863 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8864 !! wikitext
8865 {{ROOTPAGENAME}}
8866 !! html
8867 <p>Ævar Arnfjörð Bjarmason
8868 </p>
8869 !! end
8870
8871 !! test
8872 Magic Word: {{ROOTPAGENAMEE}}
8873 !! options
8874 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8875 !! wikitext
8876 {{ROOTPAGENAMEE}}
8877 !! html
8878 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8879 </p>
8880 !! end
8881
8882 !! test
8883 Magic Word: {{BASEPAGENAME}}
8884 !! options
8885 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8886 !! wikitext
8887 {{BASEPAGENAME}}
8888 !! html
8889 <p>Ævar Arnfjörð Bjarmason
8890 </p>
8891 !! end
8892
8893 !! test
8894 Magic Word: {{BASEPAGENAMEE}}
8895 !! options
8896 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8897 !! wikitext
8898 {{BASEPAGENAMEE}}
8899 !! html
8900 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8901 </p>
8902 !! end
8903
8904 !! test
8905 Magic Word: {{TALKPAGENAME}}
8906 !! options
8907 title=[[User:Ævar Arnfjörð Bjarmason]]
8908 !! wikitext
8909 {{TALKPAGENAME}}
8910 !! html
8911 <p>User talk:Ævar Arnfjörð Bjarmason
8912 </p>
8913 !! end
8914
8915 !! test
8916 Magic Word: {{TALKPAGENAMEE}}
8917 !! options
8918 title=[[User:Ævar Arnfjörð Bjarmason]]
8919 !! wikitext
8920 {{TALKPAGENAMEE}}
8921 !! html
8922 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8923 </p>
8924 !! end
8925
8926 !! test
8927 Magic Word: {{SUBJECTPAGENAME}}
8928 !! options
8929 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8930 !! wikitext
8931 {{SUBJECTPAGENAME}}
8932 !! html
8933 <p>User:Ævar Arnfjörð Bjarmason
8934 </p>
8935 !! end
8936
8937 !! test
8938 Magic Word: {{SUBJECTPAGENAMEE}}
8939 !! options
8940 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8941 !! wikitext
8942 {{SUBJECTPAGENAMEE}}
8943 !! html
8944 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8945 </p>
8946 !! end
8947
8948 !! test
8949 Magic Word: {{NUMBEROFFILES}}
8950 !! wikitext
8951 {{NUMBEROFFILES}}
8952 !! html
8953 <p>5
8954 </p>
8955 !! end
8956
8957 !! test
8958 Magic Word: {{PAGENAME}}
8959 !! options
8960 title=[[User:Ævar Arnfjörð Bjarmason]]
8961 !! wikitext
8962 {{PAGENAME}}
8963 !! html
8964 <p>Ævar Arnfjörð Bjarmason
8965 </p>
8966 !! end
8967
8968 !! test
8969 Magic Word: {{PAGENAME}} with metacharacters
8970 !! options
8971 title=[['foo & bar = baz']]
8972 !! wikitext
8973 ''{{PAGENAME}}''
8974 !! html/php
8975 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8976 </p>
8977 !! html+tidy
8978 <p><i>'foo &amp; bar = baz'</i></p>
8979 !! end
8980
8981 !! test
8982 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8983 !! options
8984 title=[[*RFC 1234 http://example.com/]]
8985 !! wikitext
8986 {{PAGENAME}}
8987 !! html/php
8988 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8989 </p>
8990 !! html+tidy
8991 <p>*RFC 1234 http://example.com/</p>
8992 !! end
8993
8994 !! test
8995 Magic Word: {{PAGENAMEE}}
8996 !! options
8997 title=[[User:Ævar Arnfjörð Bjarmason]]
8998 !! wikitext
8999 {{PAGENAMEE}}
9000 !! html
9001 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9002 </p>
9003 !! end
9004
9005 !! test
9006 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9007 !! options
9008 title=[[*RFC 1234 http://example.com/]]
9009 !! wikitext
9010 {{PAGENAMEE}}
9011 !! html/php
9012 <p>&#42;RFC_1234_http&#58;//example.com/
9013 </p>
9014 !! html+tidy
9015 <p>*RFC_1234_http://example.com/</p>
9016 !! end
9017
9018 !! test
9019 Magic Word: {{REVISIONID}}
9020 !! wikitext
9021 {{REVISIONID}}
9022 !! html
9023 <p>1337
9024 </p>
9025 !! end
9026
9027 !! test
9028 Magic Word: {{SCRIPTPATH}}
9029 !! wikitext
9030 {{SCRIPTPATH}}
9031 !! html
9032 <p>/
9033 </p>
9034 !! end
9035
9036 !! test
9037 Magic Word: {{STYLEPATH}}
9038 !! wikitext
9039 {{STYLEPATH}}
9040 !! html
9041 <p>/skins
9042 </p>
9043 !! end
9044
9045 !! test
9046 Magic Word: {{SERVER}}
9047 !! wikitext
9048 {{SERVER}}
9049 !! html
9050 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9051 </p>
9052 !! end
9053
9054 !! test
9055 Magic Word: {{SERVERNAME}}
9056 !! wikitext
9057 {{SERVERNAME}}
9058 !! html
9059 <p>example.org
9060 </p>
9061 !! end
9062
9063 !! test
9064 Magic Word: {{SITENAME}}
9065 !! wikitext
9066 {{SITENAME}}
9067 !! html
9068 <p>MediaWiki
9069 </p>
9070 !! end
9071
9072 !! test
9073 Case-sensitive magic words, when cased differently, should just be template transclusions
9074 !! wikitext
9075 {{CurrentMonth}}
9076 {{currentday}}
9077 {{cURreNTweEK}}
9078 {{currentHour}}
9079 !! html
9080 <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>
9081 <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>
9082 <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>
9083 <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>
9084 </p>
9085 !! end
9086
9087 !! test
9088 Case-insensitive magic words should still work with weird casing.
9089 !! wikitext
9090 {{sErVeRNaMe}}
9091 {{LCFirst:AOEU}}
9092 {{ucFIRST:aoeu}}
9093 {{SERver}}
9094 !! html
9095 <p>example.org
9096 aOEU
9097 Aoeu
9098 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9099 </p>
9100 !! end
9101
9102 # From plwiki:PLOS_ONE
9103 !! test
9104 Parsoid: Page property magic word with magic word contents
9105 !! wikitext
9106 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9107 !! html/parsoid
9108 <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>"}]]}'/>
9109 !! end
9110
9111 !! test
9112 Parsoid: Template-generated DISPLAYTITLE
9113 !! wikitext
9114 {{{{echo|DISPLAYTITLE}}:Foo}}
9115 !! html/parsoid
9116 <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}}]}'/>
9117 !! end
9118
9119 !! test
9120 Namespace 1 {{ns:1}}
9121 !! wikitext
9122 {{ns:1}}
9123 !! html
9124 <p>Talk
9125 </p>
9126 !! end
9127
9128 !! test
9129 Namespace 1 {{ns:01}}
9130 !! wikitext
9131 {{ns:01}}
9132 !! html
9133 <p>Talk
9134 </p>
9135 !! end
9136
9137 !! test
9138 Namespace 0 {{ns:0}} (bug 4783)
9139 !! wikitext
9140 {{ns:0}}
9141 !! html
9142
9143 !! end
9144
9145 !! test
9146 Namespace 0 {{ns:00}} (bug 4783)
9147 !! wikitext
9148 {{ns:00}}
9149 !! html
9150
9151 !! end
9152
9153 !! test
9154 Namespace -1 {{ns:-1}}
9155 !! wikitext
9156 {{ns:-1}}
9157 !! html
9158 <p>Special
9159 </p>
9160 !! end
9161
9162 !! test
9163 Namespace User {{ns:User}}
9164 !! wikitext
9165 {{ns:User}}
9166 !! html
9167 <p>User
9168 </p>
9169 !! end
9170
9171 !! test
9172 Namespace User talk {{ns:User_talk}}
9173 !! wikitext
9174 {{ns:User_talk}}
9175 !! html
9176 <p>User talk
9177 </p>
9178 !! end
9179
9180 !! test
9181 Namespace User talk {{ns:uSeR tAlK}}
9182 !! wikitext
9183 {{ns:uSeR tAlK}}
9184 !! html
9185 <p>User talk
9186 </p>
9187 !! end
9188
9189 !! test
9190 Namespace File {{ns:File}}
9191 !! wikitext
9192 {{ns:File}}
9193 !! html
9194 <p>File
9195 </p>
9196 !! end
9197
9198 !! test
9199 Namespace File {{ns:Image}}
9200 !! wikitext
9201 {{ns:Image}}
9202 !! html
9203 <p>File
9204 </p>
9205 !! end
9206
9207 !! test
9208 Namespace (lang=de) Benutzer {{ns:User}}
9209 !! options
9210 language=de
9211 !! wikitext
9212 {{ns:User}}
9213 !! html
9214 <p>Benutzer
9215 </p>
9216 !! end
9217
9218 !! test
9219 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9220 !! options
9221 language=de
9222 !! wikitext
9223 {{ns:3}}
9224 !! html
9225 <p>Benutzer Diskussion
9226 </p>
9227 !! end
9228
9229
9230 !! test
9231 Urlencode
9232 !! wikitext
9233 {{urlencode:hi world?!}}
9234 {{urlencode:hi world?!|WIKI}}
9235 {{urlencode:hi world?!|PATH}}
9236 {{urlencode:hi world?!|QUERY}}
9237 !! html
9238 <p>hi+world%3F%21
9239 hi_world%3F!
9240 hi%20world%3F%21
9241 hi+world%3F%21
9242 </p>
9243 !! end
9244
9245 !! test
9246 Magic Word: prioritize type info over data-parsoid
9247 !! options
9248 parsoid=html2wt
9249 !! html
9250 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9251 !! wikitext
9252 __FORCETOC__
9253 !! end
9254
9255 !! test
9256 Magic Word: serialize on separate line (parsoid)
9257 !! options
9258 parsoid=wt2wt,html2wt
9259 !! wikitext
9260 foo
9261 __NOTOC__
9262 bar
9263 !! html
9264 foo<meta property="mw:PageProp/notoc"/>bar
9265 !! end
9266
9267 !! test
9268 Magic Word: rt non-english wikis
9269 !! options
9270 parsoid=wt2wt
9271 language=de
9272 !! wikitext
9273 __NOEDITSECTION__
9274 !! html
9275 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9276 !! end
9277
9278 ###
9279 ### Magic links
9280 ###
9281 !! test
9282 Magic links: internal link to RFC (bug 479)
9283 !! wikitext
9284 [[RFC 123]]
9285 !! html
9286 <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>
9287 </p>
9288 !! end
9289
9290 !! test
9291 Magic links: RFC (bug 479)
9292 !! wikitext
9293 RFC 822
9294 !! html
9295 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9296 </p>
9297 !! end
9298
9299 !! test
9300 Magic links: RFC (bug 65278)
9301 !! wikitext
9302 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9303 !! html
9304 <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.
9305 </p>
9306 !! end
9307
9308 !! test
9309 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9310 !! wikitext
9311 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9312 RFC
9313 822
9314 !! html
9315 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9316 RFC
9317 822
9318 </p>
9319 !! end
9320
9321 !! test
9322 Magic links: ISBN (bug 1937)
9323 !! wikitext
9324 ISBN 0-306-40615-2
9325 !! html
9326 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9327 </p>
9328 !! end
9329
9330 !! test
9331 Magic links: ISBN (bug 65278)
9332 !! wikitext
9333 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9334 !! html/php
9335 <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.
9336 </p>
9337 !! html/parsoid
9338 <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>
9339 !! end
9340
9341 !! test
9342 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9343 !! wikitext
9344 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9345 ISBN
9346 9780316098113
9347 ISBN 978
9348 0316098113
9349 !! html
9350 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9351 ISBN
9352 9780316098113
9353 ISBN 978
9354 0316098113
9355 </p>
9356 !! end
9357
9358 !! test
9359 Magic links: PMID incorrectly converts space to underscore
9360 !! wikitext
9361 PMID 1234
9362 !! html
9363 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9364 </p>
9365 !! end
9366
9367 !! test
9368 Magic links: PMID (bug 65278)
9369 !! wikitext
9370 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9371 !! html
9372 <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.
9373 </p>
9374 !! end
9375
9376 !! test
9377 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9378 !! wikitext
9379 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9380 PMID
9381 1234
9382 !! html
9383 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9384 PMID
9385 1234
9386 </p>
9387 !! end
9388
9389 ###
9390 ### Templates
9391 ####
9392
9393 !! test
9394 Nonexistent template
9395 !! wikitext
9396 {{thistemplatedoesnotexist}}
9397 !! html
9398 <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>
9399 </p>
9400 !! end
9401
9402 !! test
9403 Template with invalid target containing tags
9404 !! wikitext
9405 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9406 !! html
9407 <p>{{a<b>b</b>|foo|a=b|a = b}}
9408 </p>
9409 !! end
9410
9411 !! test
9412 Template with invalid target containing unclosed tag
9413 !! wikitext
9414 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9415 !! html
9416 <p>{{a<b>|foo|a=b|a = b}}</b>
9417 </p>
9418 !! end
9419
9420 !! test
9421 Template with invalid target containing wikilink
9422 !! wikitext
9423 {{[[Main Page]]}}
9424 !! html/php
9425 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9426 </p>
9427 !! html/parsoid
9428 <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>
9429 !! end
9430
9431 !! test
9432 Template with just whitespace in it, bug #68421
9433 !! wikitext
9434 {{echo|{{ }}}}
9435 !! html/parsoid
9436 <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>
9437 !! end
9438
9439 !! article
9440 Template:test
9441 !! text
9442 This is a test template
9443 !! endarticle
9444
9445 !! test
9446 Simple template
9447 !! wikitext
9448 {{test}}
9449 !! html
9450 <p>This is a test template
9451 </p>
9452 !! end
9453
9454 !! test
9455 Template with explicit namespace
9456 !! wikitext
9457 {{Template:test}}
9458 !! html
9459 <p>This is a test template
9460 </p>
9461 !! end
9462
9463
9464 !! article
9465 Template:paramtest
9466 !! text
9467 This is a test template with parameter {{{param}}}
9468 !! endarticle
9469
9470 !! test
9471 Template parameter
9472 !! wikitext
9473 {{paramtest|param=foo}}
9474 !! html
9475 <p>This is a test template with parameter foo
9476 </p>
9477 !! end
9478
9479 !! article
9480 Template:paramtestnum
9481 !! text
9482 [[{{{1}}}|{{{2}}}]]
9483 !! endarticle
9484
9485 !! test
9486 Template unnamed parameter
9487 !! wikitext
9488 {{paramtestnum|Main Page|the main page}}
9489 !! html
9490 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9491 </p>
9492 !! end
9493
9494 !! article
9495 Template:templatesimple
9496 !! text
9497 (test)
9498 !! endarticle
9499
9500 !! article
9501 Template:templateredirect
9502 !! text
9503 #redirect [[Template:templatesimple]]
9504 !! endarticle
9505
9506 !! article
9507 Template:templateasargtestnum
9508 !! text
9509 {{{{{1}}}}}
9510 !! endarticle
9511
9512 !! article
9513 Template:templateasargtest
9514 !! text
9515 {{template{{{templ}}}}}
9516 !! endarticle
9517
9518 !! article
9519 Template:templateasargtest2
9520 !! text
9521 {{{{{templ}}}}}
9522 !! endarticle
9523
9524 !! test
9525 Template with template name as unnamed argument
9526 !! wikitext
9527 {{templateasargtestnum|templatesimple}}
9528 !! html
9529 <p>(test)
9530 </p>
9531 !! end
9532
9533 !! test
9534 Template with template name as argument
9535 !! wikitext
9536 {{templateasargtest|templ=simple}}
9537 !! html
9538 <p>(test)
9539 </p>
9540 !! end
9541
9542 !! test
9543 Template with template name as argument (2)
9544 !! wikitext
9545 {{templateasargtest2|templ=templatesimple}}
9546 !! html
9547 <p>(test)
9548 </p>
9549 !! end
9550
9551 !! article
9552 Template:templateasargtestdefault
9553 !! text
9554 {{{{{templ|templatesimple}}}}}
9555 !! endarticle
9556
9557 !! article
9558 Template:templa
9559 !! text
9560 '''templ'''
9561 !! endarticle
9562
9563 !! test
9564 Template with default value
9565 !! wikitext
9566 {{templateasargtestdefault}}
9567 !! html
9568 <p>(test)
9569 </p>
9570 !! end
9571
9572 !! test
9573 Template with default value (value set)
9574 !! wikitext
9575 {{templateasargtestdefault|templ=templa}}
9576 !! html
9577 <p><b>templ</b>
9578 </p>
9579 !! end
9580
9581 !! test
9582 Template redirect
9583 !! wikitext
9584 {{templateredirect}}
9585 !! html
9586 <p>(test)
9587 </p>
9588 !! end
9589
9590 !! test
9591 Template with argument in separate line
9592 !! wikitext
9593 {{ templateasargtest |
9594 templ = simple }}
9595 !! html
9596 <p>(test)
9597 </p>
9598 !! end
9599
9600 !! test
9601 Template with complex template as argument
9602 !! wikitext
9603 {{paramtest|
9604 param ={{ templateasargtest |
9605 templ = simple }}}}
9606 !! html
9607 <p>This is a test template with parameter (test)
9608 </p>
9609 !! end
9610
9611 !! test
9612 Template with thumb image (with link in description)
9613 !! wikitext
9614 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9615 !! html/php
9616 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>
9617
9618 !! html+tidy
9619 <p>This is a test template with parameter</p>
9620 <div class="thumb tright">
9621 <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>
9622 <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>
9623 </div>
9624 </div>
9625 !! html/parsoid
9626 <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>
9627 !! end
9628
9629 !! article
9630 Template:complextemplate
9631 !! text
9632 {{{1}}} {{paramtest|
9633 param ={{{param}}}}}
9634 !! endarticle
9635
9636 !! test
9637 Template with complex arguments
9638 !! wikitext
9639 {{complextemplate|
9640 param ={{ templateasargtest |
9641 templ = simple }}|[[Template:complextemplate|link]]}}
9642 !! html
9643 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9644 </p>
9645 !! end
9646
9647 !! test
9648 BUG 553: link with two variables in a piped link
9649 !! wikitext
9650 {|
9651 |[[{{{1}}}|{{{2}}}]]
9652 |}
9653 !! html
9654 <table>
9655 <tr>
9656 <td>[[{{{1}}}|{{{2}}}]]
9657 </td></tr></table>
9658
9659 !! end
9660
9661 !! test
9662 Magic variable as template parameter
9663 !! wikitext
9664 {{paramtest|param={{SITENAME}}}}
9665 !! html
9666 <p>This is a test template with parameter MediaWiki
9667 </p>
9668 !! end
9669
9670 !! article
9671 Template:linktest
9672 !! text
9673 [[{{{param}}}|link]]
9674 !! endarticle
9675
9676 !! test
9677 Template parameter as link source
9678 !! wikitext
9679 {{linktest|param=Main Page}}
9680 !! html
9681 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9682 </p>
9683 !! end
9684
9685 !!article
9686 Template:paramtest2
9687 !! text
9688 including another template, {{paramtest|param={{{arg}}}}}
9689 !! endarticle
9690
9691 !! test
9692 Template passing argument to another template
9693 !! wikitext
9694 {{paramtest2|arg='hmm'}}
9695 !! html
9696 <p>including another template, This is a test template with parameter 'hmm'
9697 </p>
9698 !! end
9699
9700 !! article
9701 Template:Linktest2
9702 !! text
9703 Main Page
9704 !! endarticle
9705
9706 !! test
9707 Template as link source
9708 !! wikitext
9709 [[{{linktest2}}]]
9710
9711 [[{{linktest2}}|Main Page]]
9712
9713 [[{{linktest2}}]]Page
9714 !! html
9715 <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>
9717 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9718 </p>
9719 !! end
9720
9721
9722 !! article
9723 Template:loop1
9724 !! text
9725 {{loop2}}
9726 !! endarticle
9727
9728 !! article
9729 Template:loop2
9730 !! text
9731 {{loop1}}
9732 !! endarticle
9733
9734 !! test
9735 Template infinite loop
9736 !! wikitext
9737 {{loop1}}
9738 !! html
9739 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9740 </p>
9741 !! end
9742
9743 !! test
9744 Template from main namespace
9745 !! wikitext
9746 {{:Main Page}}
9747 !! html
9748 <p>blah blah
9749 </p>
9750 !! end
9751
9752 !! article
9753 Template:table
9754 !! text
9755 {|
9756 | 1 || 2
9757 |-
9758 | 3 || 4
9759 |}
9760 !! endarticle
9761
9762 !! test
9763 BUG 529: Template with table, not included at beginning of line
9764 !! wikitext
9765 foo {{table}}
9766 !! html
9767 <p>foo
9768 </p>
9769 <table>
9770 <tr>
9771 <td> 1 </td>
9772 <td> 2
9773 </td></tr>
9774 <tr>
9775 <td> 3 </td>
9776 <td> 4
9777 </td></tr></table>
9778
9779 !! end
9780
9781 !! test
9782 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9783 !! wikitext
9784 foo
9785 {{table}}
9786 !! html
9787 <p>foo
9788 </p>
9789 <table>
9790 <tr>
9791 <td> 1 </td>
9792 <td> 2
9793 </td></tr>
9794 <tr>
9795 <td> 3 </td>
9796 <td> 4
9797 </td></tr></table>
9798
9799 !! end
9800
9801 !! test
9802 BUG 41: Template parameters shown as broken links
9803 !! wikitext
9804 {{{parameter}}}
9805 !! html
9806 <p>{{{parameter}}}
9807 </p>
9808 !! end
9809
9810 !! test
9811 Template with targets containing wikilinks
9812 !! wikitext
9813 {{[[foo]]}}
9814
9815 {{[[{{echo|foo}}]]}}
9816
9817 {{{{echo|[[foo}}]]}}
9818 !! html
9819 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9820 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9821 </p><p>{{[[foo}}]]
9822 </p>
9823 !! end
9824
9825 !! article
9826 Template:MSGNW test
9827 !! text
9828 ''None'' of '''this''' should be
9829 * interpreted
9830 but rather passed unmodified
9831 {{test}}
9832 <gallery>
9833 File:Foobar.jpg
9834 </gallery>
9835 !! endarticle
9836
9837 # hmm, fix this or just deprecate msgnw and document its behavior?
9838 !! test
9839 msgnw keyword
9840 !! wikitext
9841 {{msgnw:MSGNW test}}
9842 !! html
9843 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9844 &#42; interpreted
9845 &#32;but rather passed unmodified
9846 &#123;&#123;test&#125;&#125;
9847 &#60;gallery&#62;
9848 File:Foobar.jpg
9849 &#60;/gallery&#62;
9850 </p>
9851 !! end
9852
9853 !! test
9854 int keyword
9855 !! wikitext
9856 {{int:youhavenewmessages|lots of money|not!}}
9857 !! html
9858 <p>You have lots of money (not!).
9859 </p>
9860 !! end
9861
9862 !! article
9863 Template:Includes
9864 !! text
9865 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9866 !! endarticle
9867
9868 !! test
9869 <includeonly> and <noinclude> being included
9870 !! wikitext
9871 {{Includes}}
9872 !! html
9873 <p>Foobar
9874 </p>
9875 !! end
9876
9877 !! article
9878 Template:Includes2
9879 !! text
9880 <onlyinclude>Foo</onlyinclude>bar
9881 !! endarticle
9882
9883 !! test
9884 <onlyinclude> being included
9885 !! wikitext
9886 {{Includes2}}
9887 !! html
9888 <p>Foo
9889 </p>
9890 !! end
9891
9892
9893 !! article
9894 Template:Includes3
9895 !! text
9896 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9897 !! endarticle
9898
9899 !! test
9900 <onlyinclude> and <includeonly> being included
9901 !! wikitext
9902 {{Includes3}}
9903 !! html
9904 <p>Foo
9905 </p>
9906 !! end
9907
9908 !! test
9909 <includeonly> and <noinclude> on a page
9910 !! wikitext
9911 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9912 !! html
9913 <p>Foozar
9914 </p>
9915 !! end
9916
9917 !! test
9918 Un-closed <noinclude>
9919 !! wikitext
9920 <noinclude>
9921 !! html
9922 !! end
9923
9924 !! test
9925 <onlyinclude> on a page
9926 !! wikitext
9927 <onlyinclude>Foo</onlyinclude>bar
9928 !! html
9929 <p>Foobar
9930 </p>
9931 !! end
9932
9933 !! test
9934 Un-closed <onlyinclude>
9935 !! wikitext
9936 <onlyinclude>
9937 !! html
9938 !! end
9939
9940 !!test
9941 Self-closed noinclude, includeonly, onlyinclude tags
9942 !! wikitext
9943 <noinclude />
9944 <includeonly />
9945 <onlyinclude />
9946 !! html
9947 <p><br />
9948 </p>
9949 !!end
9950
9951 !!test
9952 Unbalanced includeonly and noinclude tags
9953 !! wikitext
9954 {|
9955 |a</noinclude>
9956 |b</noinclude></noinclude>
9957 |c</noinclude></includeonly>
9958 |d</includeonly></includeonly>
9959 |}
9960 !! html
9961 <table>
9962 <tr>
9963 <td>a
9964 </td>
9965 <td>b
9966 </td>
9967 <td>c&lt;/includeonly&gt;
9968 </td>
9969 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9970 </td></tr></table>
9971
9972 !!end
9973
9974 !! article
9975 Template:Includeonly section
9976 !! text
9977 <includeonly>
9978 ==Includeonly section==
9979 </includeonly>
9980 ==Section T-1==
9981 !!endarticle
9982
9983 !! test
9984 Bug 6563: Edit link generation for section shown by <includeonly>
9985 !! wikitext
9986 {{includeonly section}}
9987 !! html
9988 <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>
9989 <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>
9990
9991 !! end
9992
9993 # Uses same input as the contents of [[Template:Includeonly section]]
9994 !! test
9995 Bug 6563: Section extraction for section shown by <includeonly>
9996 !! options
9997 section=T-2
9998 !! wikitext
9999 <includeonly>
10000 ==Includeonly section==
10001 </includeonly>
10002 ==Section T-2==
10003 !! html
10004 ==Section T-2==
10005 !! end
10006
10007 !! test
10008 Bug 6563: Edit link generation for section suppressed by <includeonly>
10009 !! wikitext
10010 <includeonly>
10011 ==Includeonly section==
10012 </includeonly>
10013 ==Section 1==
10014 !! html
10015 <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>
10016
10017 !! end
10018
10019 !! test
10020 Bug 6563: Section extraction for section suppressed by <includeonly>
10021 !! options
10022 section=1
10023 !! wikitext
10024 <includeonly>
10025 ==Includeonly section==
10026 </includeonly>
10027 ==Section 1==
10028 !! html
10029 ==Section 1==
10030 !! end
10031
10032 !! test
10033 Un-closed <includeonly>
10034 !! wikitext
10035 <includeonly>
10036 !! html
10037 !! end
10038
10039 !! test
10040 Includes and comments at SOL
10041 !! wikitext
10042 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10043
10044 <noinclude>
10045 some
10046 </noinclude>* stuff
10047 * here
10048
10049 <includeonly>can have stuff</includeonly>=== here ===
10050
10051 !! html/php
10052 <h2><span class="mw-headline" id="hu">hu</span></h2>
10053 <p>some
10054 </p>
10055 <ul><li> stuff</li>
10056 <li> here</li></ul>
10057 <h3><span class="mw-headline" id="here">here</span></h3>
10058
10059 !! html/parsoid
10060 <!-- 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>
10061
10062 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10063 <p>some</p>
10064 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10065 <li> here</li></ul>
10066
10067 <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>
10068
10069 !! end
10070
10071 # TODO: test with DOM fragment reuse!
10072 !! test
10073 Parsoid: DOM fragment reuse
10074 !! options
10075 parsoid=wt2wt,wt2html
10076 !! wikitext
10077 a{{echo|b<table></table>c}}d
10078
10079 a{{echo|b
10080 <table></table>
10081 c}}d
10082
10083 {{echo|a
10084
10085 <table></table>
10086
10087 b}}
10088 !! html
10089 <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>
10090
10091 <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">
10092 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10093 </span><p about="#mwt2">cd</p>
10094
10095 <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">
10096
10097 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10098
10099 </span><p about="#mwt3">b</p>
10100 !! end
10101
10102 !! test
10103 Parsoid: Merge double tds (bug 50603)
10104 !! options
10105 parsoid
10106 !! wikitext
10107 {|
10108 |{{echo|{{!}} foo}}
10109 |}
10110 !! html
10111 <table><tbody>
10112 <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>
10113 </tbody></table>
10114 !! end
10115
10116 !! test
10117 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10118 !! options
10119 parsoid
10120 !! wikitext
10121 {{echo|<div>}}
10122 {|
10123 |{{echo|{{!}} foo}}
10124 |}
10125 {{echo|</div>}}
10126 !! html
10127 <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}}]}'>
10128 <table><tbody>
10129 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10130 </tbody></table>
10131 </div>
10132 !! end
10133
10134 ###
10135 ### <includeonly> and <noinclude> in attributes
10136 ###
10137 !!test
10138 0. includeonly around the entire attribute
10139 !! wikitext
10140 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10141 !! html
10142 <p><span id="v2">bar</span>
10143 </p>
10144 !!end
10145
10146 !!test
10147 1. includeonly in html attr key
10148 !! wikitext
10149 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10150 !! html
10151 <p><span id="foo">bar</span>
10152 </p>
10153 !!end
10154
10155 !!test
10156 2. includeonly in html attr value
10157 !! wikitext
10158 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10159 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10160 !! html
10161 <p><span id="v1">bar</span>
10162 <span id="v1">bar</span>
10163 </p>
10164 !!end
10165
10166 !!test
10167 3. includeonly in part of an attr value
10168 !! wikitext
10169 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10170 !! html
10171 <p><span style="color:red;">bar</span>
10172 </p>
10173 !!end
10174
10175 !!test
10176 4. includeonly in table attributes
10177 !! wikitext
10178 {|
10179 |- <noinclude>
10180 |-
10181 |a
10182 </noinclude>
10183 |- <includeonly>
10184 |-
10185 |b
10186 </includeonly>
10187 |}
10188 !! html
10189 <table>
10190
10191
10192 <tr>
10193 <td>a
10194 </td></tr>
10195 </table>
10196
10197 !!end
10198
10199 ###
10200 ### Token Stream Patcher tests
10201 ###
10202 ### These tests won't always pass wt2wt and other modes because
10203 ### on serialization, the table will be output on a new line.
10204 ### For now, we are blacklisting them, and using this to test selser.
10205 ###
10206
10207 !!test
10208 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10209 !!options
10210 parsoid=wt2html,wt2wt
10211 !!wikitext
10212 {{echo|}}{| width = '100%'
10213 |foo
10214 |}
10215 !!html/parsoid
10216 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10217 <tbody><tr><td>foo</td></tr>
10218 </tbody></table>
10219 !!end
10220
10221 !!test
10222 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10223 !!options
10224 parsoid=wt2html,wt2wt
10225 !!wikitext
10226 <includeonly>a</includeonly>{| {{{b}}}
10227 |c
10228 |}
10229 !!html/parsoid
10230 <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}}}":""}}'>
10231 <tbody><tr><td>c</td></tr>
10232 </tbody></table>
10233
10234 !!end
10235
10236 ###
10237 ### Testing parsing of templates where a template arg
10238 ### has the same name as the template itself.
10239 ###
10240
10241 !! article
10242 Template:quote
10243 !! text
10244 {{{quote|{{{1}}}}}}
10245 !! endarticle
10246
10247 !!test
10248 Templates: Template Name/Arg clash: 1. Use of positional param
10249 !! wikitext
10250 {{quote|foo}}
10251 !! html
10252 <p>foo
10253 </p>
10254 !!end
10255
10256 !!test
10257 Templates: Template Name/Arg clash: 2. Use of named param
10258 !! wikitext
10259 {{quote|quote=foo}}
10260 !! html
10261 <p>foo
10262 </p>
10263 !!end
10264
10265 !!test
10266 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10267 !! wikitext
10268 {{quote|quote}}
10269 !! html
10270 <p>quote
10271 </p>
10272 !!end
10273
10274 ###
10275 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10276 ###
10277
10278 !!test
10279 Templates: 1. Simple use
10280 !! wikitext
10281 {{echo|Foo}}
10282 !! html
10283 <p>Foo
10284 </p>
10285 !!end
10286
10287 !!test
10288 Templates: 2. Inside a block tag
10289 !! wikitext
10290 <div>{{echo|Foo}}</div>
10291 <blockquote>{{echo|Foo}}</blockquote>
10292 !! html
10293 <div>Foo</div>
10294 <blockquote>Foo</blockquote>
10295
10296 !! html+tidy
10297 <div>Foo</div>
10298 <blockquote>
10299 <p>Foo</p>
10300 </blockquote>
10301 !!end
10302
10303 !!test
10304 Templates: P-wrapping: 1a. Templates on consecutive lines
10305 !! wikitext
10306 {{echo|Foo}}
10307 {{echo|bar}}
10308 !! html
10309 <p>Foo
10310 bar
10311 </p>
10312 !!end
10313
10314 !!test
10315 Templates: P-wrapping: 1b. Templates on consecutive lines
10316 !! wikitext
10317 Foo
10318
10319 {{echo|bar}}
10320 {{echo|baz}}
10321 !! html
10322 <p>Foo
10323 </p><p>bar
10324 baz
10325 </p>
10326 !!end
10327
10328 !!test
10329 Templates: P-wrapping: 1c. Templates on consecutive lines
10330 !! wikitext
10331 {{echo|Foo}}
10332 {{echo|bar}} <div>baz</div>
10333 !! html
10334 <p>Foo
10335 </p>
10336 bar <div>baz</div>
10337
10338 !! html+tidy
10339 <p>Foo</p>
10340 <p>bar</p>
10341 <div>baz</div>
10342 !! end
10343
10344 !!test
10345 Templates: P-wrapping: 1d. Template preceded by comment-only line
10346 !!options
10347 parsoid
10348 !! wikitext
10349 <!-- foo -->
10350 {{echo|Bar}}
10351 !! html
10352 <!-- foo -->
10353
10354 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10355 !!end
10356
10357 !!test
10358 Templates: Inline Text: 1. Multiple template uses
10359 !! wikitext
10360 {{echo|Foo}}bar{{echo|baz}}
10361 !! html
10362 <p>Foobarbaz
10363 </p>
10364 !!end
10365
10366 !!test
10367 Templates: Inline Text: 2. Back-to-back template uses
10368 !! wikitext
10369 {{echo|Foo}}{{echo|bar}}
10370 !! html
10371 <p>Foobar
10372 </p>
10373 !!end
10374
10375 !!test
10376 Templates: Block Tags: 1. Multiple template uses
10377 !! wikitext
10378 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10379 !! html
10380 <div>Foo</div><div>bar</div><div>baz</div>
10381
10382 !!end
10383
10384 !!test
10385 Templates: Block Tags: 2. Back-to-back template uses
10386 !! wikitext
10387 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10388 !! html
10389 <div>Foo</div><div>bar</div>
10390
10391 !!end
10392
10393 # This is an edge case relating to paragraph wrapping.
10394 !!test
10395 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10396 !! wikitext
10397 {{echo|a
10398 b</p>}}
10399 !! html/parsoid
10400 <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
10401 b</p>
10402 !!end
10403
10404 !!test
10405 Templates: Links: 1. Simple example
10406 !! wikitext
10407 {{echo|[[Foo|bar]]}}
10408 !! html
10409 <p><a href="/wiki/Foo" title="Foo">bar</a>
10410 </p>
10411 !!end
10412
10413 !!test
10414 Templates: Links: 2. Generation of link href
10415 !! wikitext
10416 [[{{echo|Foo}}|bar]]
10417 !! html
10418 <p><a href="/wiki/Foo" title="Foo">bar</a>
10419 </p>
10420 !!end
10421
10422 !!test
10423 Templates: Links: 3. Generation of part of a link href
10424 !! wikitext
10425 [[Fo{{echo|o}}|bar]]
10426
10427 [[Foo{{echo|bar}}]]
10428
10429 [[Foo{{echo|bar}}baz]]
10430
10431 [[Foo{{echo|bar}}|bar]]
10432
10433 [[:Foo{{echo|bar}}]]
10434
10435 [[:Foo{{echo|bar}}|bar]]
10436 !! html
10437 <p><a href="/wiki/Foo" title="Foo">bar</a>
10438 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10439 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10440 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10441 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10442 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10443 </p>
10444 !!end
10445
10446 !!test
10447 Templates: Links: 4. Multiple templates generating link href
10448 !! wikitext
10449 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10450 !! html
10451 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10452 </p>
10453 !!end
10454
10455 !!test
10456 Templates: Links: 5. Generation of link text
10457 !! wikitext
10458 [[Foo|{{echo|bar}}]]
10459 !! html
10460 <p><a href="/wiki/Foo" title="Foo">bar</a>
10461 </p>
10462 !!end
10463
10464 !!test
10465 Templates: Links: 5. Nested templates (only outermost template should be marked)
10466 !! wikitext
10467 {{echo|[[{{echo|Foo}}|bar]]}}
10468 !! html
10469 <p><a href="/wiki/Foo" title="Foo">bar</a>
10470 </p>
10471 !!end
10472
10473 !!test
10474 Templates: HTML Tag: 1. Generation of HTML attr. key
10475 !! wikitext
10476 <div {{echo|style}}="color:red;">foo</div>
10477 !! html
10478 <div style="color:red;">foo</div>
10479
10480 !!end
10481
10482 !!test
10483 Templates: HTML Tag: 2. Generation of HTML attr. value
10484 !! wikitext
10485 <div style={{echo|'color:red;'}}>foo</div>
10486 !! html
10487 <div style="color:red;">foo</div>
10488
10489 !!end
10490
10491 !!test
10492 Templates: HTML Tag: 3. Generation of HTML attr key and value
10493 !! wikitext
10494 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10495 !! html
10496 <div style="color:red;">foo</div>
10497
10498 !!end
10499
10500 !!test
10501 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10502 !! wikitext
10503 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10504 !! html
10505 <div title="This is a long title with just one piece templated">foo</div>
10506
10507 !!end
10508
10509 !!test
10510 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10511 !! wikitext
10512 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10513 !! html
10514 <div title="This is a long title with just one piece templated">foo</div>
10515
10516 !!end
10517
10518 !!test
10519 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10520 !! wikitext
10521 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10522 !! html
10523 <div title="This is a long title with just one piece templated">foo</div>
10524
10525 !!end
10526
10527 # SSS FIXME: While it is great we added support for all this,
10528 # do we want to make this part of the spec? Maybe we want to
10529 # deprecate this kind of usage in the future?
10530 !!test
10531 Templates: HTML Tag: 7. Generation of partial attribute key string
10532 !! wikitext
10533 <div st{{echo|yle}}="color:red;">foo</div>
10534 !! html
10535 <div style="color:red;">foo</div>
10536
10537 !!end
10538
10539 !! test
10540 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10541 !! wikitext
10542 <div {{echo|1=id="v1"}}>bar</div>
10543 !! html
10544 <div id="v1">bar</div>
10545
10546 !!end
10547
10548 !! test
10549 Templates: HTML Tag: 9. Multiple template-generated attributes
10550 !! wikitext
10551 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10552 !! html
10553 <div id="v1" title="foo">bar</div>
10554
10555 !!end
10556
10557 !! test
10558 Templates: Support for templates generating attributes and content
10559 !! wikitext
10560 {| {{mixed_attr_content_template}}
10561 |-
10562 |bar
10563 |}
10564 !! html/php
10565 <table style="color:red;" title="T48811">
10566
10567 <tr>
10568 <td>foo
10569 </td></tr>
10570 <tr>
10571 <td>bar
10572 </td></tr></table>
10573
10574 !! html/parsoid
10575 <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|}"]}'>
10576 <tbody><tr>
10577 <td>foo</td></tr>
10578 <tr>
10579 <td>bar</td></tr>
10580 </tbody></table>
10581 !!end
10582
10583 !! test
10584 1. Entities and nowikis inside templated attributes should be handled correctly
10585 !! wikitext
10586 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10587 !! html/php
10588 <div style="background:#f9f9f9;">foo</div>
10589
10590 !! html/parsoid
10591 <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>
10592 !! end
10593
10594 !! test
10595 2. Entities and nowikis inside templated attributes should be handled correctly
10596 !! wikitext
10597 {|
10598 |{{table_attribs_3}}
10599 |}
10600 !! html/php
10601 <table>
10602 <tr>
10603 <td style="background:#f9f9f9;">Foo
10604 </td></tr></table>
10605
10606 !! html/parsoid
10607 <table>
10608 <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>
10609 </tbody></table>
10610 !! end
10611
10612 !!test
10613 Templates: HTML Tables: 1. Generating start of a HTML table
10614 !! wikitext
10615 {{echo|<table><tr><td>foo</td>}}</tr></table>
10616 !! html
10617 <table><tr><td>foo</td></tr></table>
10618
10619 !!end
10620
10621 !!test
10622 Templates: HTML Tables: 2a. Generating middle of a HTML table
10623 !! wikitext
10624 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10625 !! html
10626 <table><tr><td>foo</td></tr></table>
10627
10628 !!end
10629
10630 !!test
10631 Templates: HTML Tables: 2b. Generating middle of a HTML table
10632 !! wikitext
10633 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10634 !! html
10635 <table><tr><td>foo</td></tr></table>
10636
10637 !!end
10638
10639 !!test
10640 Templates: HTML Tables: 3. Generating end of a HTML table
10641 !! wikitext
10642 <table><tr>{{echo|<td>foo</td></tr></table>}}
10643 !! html
10644 <table><tr><td>foo</td></tr></table>
10645
10646 !!end
10647
10648 !!test
10649 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10650 !! wikitext
10651 {{echo|<table>}}<tr><td>foo</td></tr></table>
10652 !! html
10653 <table><tr><td>foo</td></tr></table>
10654
10655 !!end
10656
10657 !!test
10658 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10659 !! wikitext
10660 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10661 !! html
10662 <table><tr><td>foo</td></tr></table>
10663
10664 !!end
10665
10666 !!test
10667 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10668 !! wikitext
10669 <table><tr>{{echo|<td>}}foo</td></tr></table>
10670 !! html
10671 <table><tr><td>foo</td></tr></table>
10672
10673 !!end
10674
10675 !!test
10676 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10677 !! wikitext
10678 <table><tr><td>foo{{echo|</td>}}</tr></table>
10679 !! html
10680 <table><tr><td>foo</td></tr></table>
10681
10682 !!end
10683
10684 !!test
10685 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10686 !! wikitext
10687 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10688 !! html
10689 <table><tr><td>foo</td></tr></table>
10690
10691 !!end
10692
10693 !!test
10694 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10695 !! wikitext
10696 <table><tr><td>foo</td></tr>{{echo|</table>}}
10697 !! html
10698 <table><tr><td>foo</td></tr></table>
10699
10700 !!end
10701
10702 !!test
10703 Templates: HTML Tables: 5. Proper fostering of categories from inside
10704 !!options
10705 parsoid=wt2html,wt2wt
10706 !! wikitext
10707 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10708 <!--Two categories (Bug 50330)-->
10709 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10710 !! html
10711 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10712 <!--Two categories (Bug 50330)-->
10713 <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>
10714 !!end
10715
10716 !!test
10717 Templates: Wiki Tables: 1a. Fostering of entire template content
10718 !! wikitext
10719 {|
10720 {{echo|a}}
10721 |}
10722 !! html
10723 <table>
10724 a
10725 <tr><td></td></tr></table>
10726
10727 !! html+tidy
10728 <p>a</p>
10729 <table>
10730 <tr>
10731 <td></td>
10732 </tr>
10733 </table>
10734 !! end
10735
10736 !!test
10737 Templates: Wiki Tables: 1b. Fostering of entire template content
10738 !! wikitext
10739 {|
10740 {{echo|<div>}}
10741 foo
10742 {{echo|</div>}}
10743 |}
10744 !! html
10745 <table>
10746 <div>
10747 <p>foo
10748 </p>
10749 </div>
10750 <tr><td></td></tr></table>
10751
10752 !! html+tidy
10753 <div>
10754 <p>foo</p>
10755 </div>
10756 <table>
10757 <tr>
10758 <td></td>
10759 </tr>
10760 </table>
10761 !! end
10762
10763 !!test
10764 Templates: Wiki Tables: 2. Fostering of partial template content
10765 !! wikitext
10766 {|
10767 {{echo|a
10768 <div>b</div>}}
10769 |}
10770 !! html
10771 <table>
10772 a
10773 <div>b</div>
10774 <tr><td></td></tr></table>
10775
10776 !! html+tidy
10777 <p>a</p>
10778 <div>b</div>
10779 <table>
10780 <tr>
10781 <td></td>
10782 </tr>
10783 </table>
10784 !! end
10785
10786 !!test
10787 Templates: Wiki Tables: 3. td-content via multiple templates
10788 !! wikitext
10789 {|
10790 {{echo|{{pipe}}a}}{{echo|b}}
10791 |}
10792 !! html
10793 <table>
10794 <tr>
10795 <td>ab
10796 </td></tr></table>
10797
10798 !!end
10799
10800 !!test
10801 Templates: Wiki Tables: 4. Templated tags, no content
10802 !! wikitext
10803 {{tbl-start}}
10804 {{tbl-end}}
10805 !! html
10806 <table>
10807 <tr><td></td></tr></table>
10808
10809 !!end
10810
10811 !!test
10812 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10813 !! wikitext
10814 {{tbl-start}}
10815 |foo
10816 {{tbl-end}}
10817 !! html
10818 <table>
10819 <tr>
10820 <td>foo
10821 </td></tr></table>
10822
10823 !!end
10824
10825 !!test
10826 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10827 !! wikitext
10828 {{tbl-start}}
10829 {{!}}foo
10830 {{tbl-end}}
10831 !! html
10832 <table>
10833 <tr>
10834 <td>foo
10835 </td></tr></table>
10836
10837 !!end
10838
10839 !!test
10840 Templates: Lists: Multi-line list-items via templates
10841 !! wikitext
10842 *{{echo|a {{nonexistent|
10843 unused}}}}
10844 *{{echo|b {{nonexistent|
10845 unused}}}}
10846 !! html
10847 <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>
10848 <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>
10849
10850 !!end
10851
10852 !!test
10853 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10854 !! wikitext
10855 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10856 !! html
10857 <p><i>ab</i>c<i>d</i>e
10858 </p>
10859 !!end
10860
10861 !!test
10862 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10863 (PHP parser generates misnested html)
10864 !! wikitext
10865 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10866 !! html/parsoid
10867 <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>
10868 !!end
10869
10870 !!test
10871 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10872 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10873 !! options
10874 parsoid=wt2html,wt2wt
10875 !! wikitext
10876 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10877 !! html
10878 <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>
10879 <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>
10880 <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>
10881 !!end
10882
10883 !!test
10884 Templates: Ugly nesting: 4. Divs opened/closed across templates
10885 !! wikitext
10886 a<div>b{{echo|c</div>d}}e
10887 !! html
10888 a<div>bc</div>de
10889
10890 !! html+tidy
10891 <p>a</p>
10892 <div>bc</div>
10893 <p>de</p>
10894 !! end
10895
10896 !!test
10897 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10898 (Parsoid-centric)
10899 !! options
10900 parsoid
10901 !! wikitext
10902 {|
10903 |{{echo|foo</table>}}
10904 |bar
10905 |}
10906 !! html
10907 <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|}"]}'>
10908
10909 <tbody>
10910 <tr>
10911 <td>foo</td></tr></tbody></table><span about="#mwt1">
10912 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10913 |}</span>
10914 !!end
10915
10916 !!test
10917 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10918 (Parsoid-centric)
10919 !! options
10920 parsoid
10921 !! wikitext
10922 <table>
10923 <tr>
10924 <td>
10925 <table>
10926 <tr>
10927 <td>1. {{echo|foo </table>}}</td>
10928 <td> bar </td>
10929 <td>2. {{echo|baz </table>}}</td>
10930 </tr>
10931 <tr>
10932 <td>abc</td>
10933 </tr>
10934 </table>
10935 </td>
10936 </tr>
10937 <tr>
10938 <td>xyz</td>
10939 </tr>
10940 </table>
10941 !! html
10942 <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>"]}'>
10943 <tbody><tr>
10944 <td>
10945 <table>
10946 <tbody><tr>
10947 <td>1. foo </td></tr></tbody></table></td>
10948 <td> bar </td>
10949 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10950 </span><span about="#mwt2">
10951 </span><span about="#mwt2">
10952 </span><span about="#mwt2">abc</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">
10958 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10959 </span><span about="#mwt2">
10960 </span>
10961 !!end
10962
10963 !! test
10964 Templates: Ugly templates: 3. newline-only template parameter
10965 !! wikitext
10966 foo {{echo|
10967 }}
10968 !! html
10969 <p>foo
10970 </p>
10971 !! end
10972
10973 # This looks like a bug: a single newline triggers p/br for some reason.
10974 !! test
10975 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10976 !! wikitext
10977 {{echo|
10978 }}
10979 !! html
10980 <p><br />
10981 </p>
10982 !! end
10983
10984 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10985 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10986 !! test
10987 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10988 !! wikitext
10989 {{echo|<table>}}
10990 {{echo|<div>foo}}
10991 {{echo|</table>}}
10992 !! html/parsoid
10993 <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
10994 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10995 </table>
10996 !! end
10997
10998 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10999 # that are "identical" and generate nesting cycles in the algorithm
11000 !! test
11001 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11002 !! wikitext
11003 {{echo|<table><tr><td><table>}}
11004 {{echo|<div>}}
11005 {{echo|</div>}}
11006 !! html/parsoid
11007 <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"}'>
11008 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11009 </table></td></tr></tbody></table>
11010 !! end
11011
11012 !!test
11013 Parser Functions: 1. Simple example
11014 !! wikitext
11015 {{uc:foo}}
11016 !! html
11017 <p>FOO
11018 </p>
11019 !!end
11020
11021 !!test
11022 Parser Functions: 2. Nested use (only outermost should be marked up)
11023 !! wikitext
11024 {{uc:{{lc:FOO}}}}
11025 !! html
11026 <p>FOO
11027 </p>
11028 !!end
11029
11030 ###
11031 ### Pre-save transform tests
11032 ###
11033 !! test
11034 pre-save transform: subst:
11035 !! options
11036 PST
11037 !! wikitext
11038 {{subst:test}}
11039 !! html
11040 This is a test template
11041 !! end
11042
11043 !! test
11044 pre-save transform: normal template
11045 !! options
11046 PST
11047 !! wikitext
11048 {{test}}
11049 !! html
11050 {{test}}
11051 !! end
11052
11053 !! test
11054 pre-save transform: nonexistent template
11055 !! options
11056 PST
11057 !! wikitext
11058 {{thistemplatedoesnotexist}}
11059 !! html
11060 {{thistemplatedoesnotexist}}
11061 !! end
11062
11063
11064 !! test
11065 pre-save transform: subst magic variables
11066 !! options
11067 PST
11068 !! wikitext
11069 {{subst:SITENAME}}
11070 !! html
11071 MediaWiki
11072 !! end
11073
11074 # This is bug 89, which I fixed. -- wtm
11075 !! test
11076 pre-save transform: subst: templates with parameters
11077 !! options
11078 pst
11079 !! wikitext
11080 {{subst:paramtest|param="something else"}}
11081 !! html
11082 This is a test template with parameter "something else"
11083 !! end
11084
11085 !! article
11086 Template:nowikitest
11087 !! text
11088 <nowiki>'''not wiki'''</nowiki>
11089 !! endarticle
11090
11091 !! test
11092 pre-save transform: nowiki in subst (bug 1188)
11093 !! options
11094 pst
11095 !! wikitext
11096 {{subst:nowikitest}}
11097 !! html
11098 <nowiki>'''not wiki'''</nowiki>
11099 !! end
11100
11101
11102 !! article
11103 Template:commenttest
11104 !! text
11105 This template has <!-- a comment --> in it.
11106 !! endarticle
11107
11108 !! test
11109 pre-save transform: comment in subst (bug 1936)
11110 !! options
11111 pst
11112 !! wikitext
11113 {{subst:commenttest}}
11114 !! html
11115 This template has <!-- a comment --> in it.
11116 !! end
11117
11118 !! test
11119 pre-save transform: unclosed tag
11120 !! options
11121 pst noxml
11122 !! wikitext
11123 <nowiki>'''not wiki'''
11124 !! html
11125 <nowiki>'''not wiki'''
11126 !! end
11127
11128 !! test
11129 pre-save transform: mixed tag case
11130 !! options
11131 pst noxml
11132 !! wikitext
11133 <NOwiki>'''not wiki'''</noWIKI>
11134 !! html
11135 <NOwiki>'''not wiki'''</noWIKI>
11136 !! end
11137
11138 !! test
11139 pre-save transform: unclosed comment in <nowiki>
11140 !! options
11141 pst noxml
11142 !! wikitext
11143 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11144 !! html
11145 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11146 !!end
11147
11148 # Leading @ in this template definition works around a limitation
11149 # in parsoid's parserTests which otherwise strips the <span> from the
11150 # result (confusing it for a template wrapper)
11151 !! article
11152 Template:dangerous
11153 !!text
11154 @<span onmouseover="alert('crap')">Oh no</span>
11155 !!endarticle
11156
11157 !!test
11158 (confirming safety of fix for subst bug 1936)
11159 !! wikitext
11160 {{Template:dangerous}}
11161 !! html
11162 <p>@<span>Oh no</span>
11163 </p>
11164 !! end
11165
11166 !! test
11167 pre-save transform: comment containing gallery (bug 5024)
11168 !! options
11169 pst
11170 !! wikitext
11171 <!-- <gallery>data</gallery> -->
11172 !! html
11173 <!-- <gallery>data</gallery> -->
11174 !!end
11175
11176 !! test
11177 pre-save transform: comment containing extension
11178 !! options
11179 pst
11180 !! wikitext
11181 <!-- <tag>data</tag> -->
11182 !! html
11183 <!-- <tag>data</tag> -->
11184 !!end
11185
11186 !! test
11187 pre-save transform: comment containing nowiki
11188 !! options
11189 pst
11190 !! wikitext
11191 <!-- <nowiki>data</nowiki> -->
11192 !! html
11193 <!-- <nowiki>data</nowiki> -->
11194 !!end
11195
11196 !! test
11197 pre-save transform: <noinclude> in subst (bug 3298)
11198 !! options
11199 pst
11200 !! wikitext
11201 {{subst:Includes}}
11202 !! html
11203 Foobar
11204 !! end
11205
11206 !! test
11207 pre-save transform: <onlyinclude> in subst (bug 3298)
11208 !! options
11209 pst
11210 !! wikitext
11211 {{subst:Includes2}}
11212 !! html
11213 Foo
11214 !! end
11215
11216 !! article
11217 Template:SubstTest
11218 !!text
11219 {{<includeonly>subst:</includeonly>Includes}}
11220 !! endarticle
11221
11222 !! article
11223 Template:SafeSubstTest
11224 !! text
11225 {{<includeonly>safesubst:</includeonly>Includes}}
11226 !! endarticle
11227
11228 !! test
11229 bug 22297: safesubst: works during PST
11230 !! options
11231 pst
11232 !! wikitext
11233 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11234 !! html
11235 FoobarFoobar
11236 !! end
11237
11238 !! test
11239 bug 22297: safesubst: works during normal parse
11240 !! wikitext
11241 {{SafeSubstTest}}
11242 !! html
11243 <p>Foobar
11244 </p>
11245 !! end
11246
11247 !! test
11248 subst: does not work during normal parse
11249 !! wikitext
11250 {{SubstTest}}
11251 !! html
11252 <p>{{subst:Includes}}
11253 </p>
11254 !! end
11255
11256 !! test
11257 pre-save transform: context links ("pipe trick")
11258 !! options
11259 pst
11260 !! wikitext
11261 [[Article (context)|]]
11262 [[Bar:Article|]]
11263 [[:Bar:Article|]]
11264 [[Bar:Article (context)|]]
11265 [[:Bar:Article (context)|]]
11266 [[|Article]]
11267 [[|Article (context)]]
11268 [[Bar:X (Y) Z|]]
11269 [[:Bar:X (Y) Z|]]
11270 !! html
11271 [[Article (context)|Article]]
11272 [[Bar:Article|Article]]
11273 [[:Bar:Article|Article]]
11274 [[Bar:Article (context)|Article]]
11275 [[:Bar:Article (context)|Article]]
11276 [[Article]]
11277 [[Article (context)]]
11278 [[Bar:X (Y) Z|X (Y) Z]]
11279 [[:Bar:X (Y) Z|X (Y) Z]]
11280 !! end
11281
11282 !! test
11283 pre-save transform: context links ("pipe trick") with interwiki prefix
11284 !! options
11285 pst
11286 !! wikitext
11287 [[interwiki:Article|]]
11288 [[:interwiki:Article|]]
11289 [[interwiki:Bar:Article|]]
11290 [[:interwiki:Bar:Article|]]
11291 !! html
11292 [[interwiki:Article|Article]]
11293 [[:interwiki:Article|Article]]
11294 [[interwiki:Bar:Article|Bar:Article]]
11295 [[:interwiki:Bar:Article|Bar:Article]]
11296 !! end
11297
11298 !! test
11299 pre-save transform: context links ("pipe trick") with parens in title
11300 !! options
11301 pst title=[[Somearticle (context)]]
11302 !! wikitext
11303 [[|Article]]
11304 !! html
11305 [[Article (context)|Article]]
11306 !! end
11307
11308 !! test
11309 pre-save transform: context links ("pipe trick") with comma in title
11310 !! options
11311 pst title=[[Someplace, Somewhere]]
11312 !! wikitext
11313 [[|Otherplace]]
11314 [[Otherplace, Elsewhere|]]
11315 [[Otherplace, Elsewhere, Anywhere|]]
11316 !! html
11317 [[Otherplace, Somewhere|Otherplace]]
11318 [[Otherplace, Elsewhere|Otherplace]]
11319 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11320 !! end
11321
11322 !! test
11323 pre-save transform: context links ("pipe trick") with parens and comma
11324 !! options
11325 pst title=[[Someplace (IGNORED), Somewhere]]
11326 !! wikitext
11327 [[|Otherplace]]
11328 [[Otherplace (place), Elsewhere|]]
11329 !! html
11330 [[Otherplace, Somewhere|Otherplace]]
11331 [[Otherplace (place), Elsewhere|Otherplace]]
11332 !! end
11333
11334 !! test
11335 pre-save transform: context links ("pipe trick") with comma and parens
11336 !! options
11337 pst title=[[Who, me? (context)]]
11338 !! wikitext
11339 [[|Yes, you.]]
11340 [[Me, Myself, and I (1937 song)|]]
11341 !! html
11342 [[Yes, you. (context)|Yes, you.]]
11343 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11344 !! end
11345
11346 !! test
11347 pre-save transform: context links ("pipe trick") with namespace
11348 !! options
11349 pst title=[[Ns:Somearticle]]
11350 !! wikitext
11351 [[|Article]]
11352 !! html
11353 [[Ns:Article|Article]]
11354 !! end
11355
11356 !! test
11357 pre-save transform: context links ("pipe trick") with namespace and parens
11358 !! options
11359 pst title=[[Ns:Somearticle (context)]]
11360 !! wikitext
11361 [[|Article]]
11362 !! html
11363 [[Ns:Article (context)|Article]]
11364 !! end
11365
11366 !! test
11367 pre-save transform: context links ("pipe trick") with namespace and comma
11368 !! options
11369 pst title=[[Ns:Somearticle, Context, Whatever]]
11370 !! wikitext
11371 [[|Article]]
11372 !! html
11373 [[Ns:Article, Context, Whatever|Article]]
11374 !! end
11375
11376 !! test
11377 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11378 !! options
11379 pst title=[[Ns:Somearticle, Context (context)]]
11380 !! wikitext
11381 [[|Article]]
11382 !! html
11383 [[Ns:Article (context)|Article]]
11384 !! end
11385
11386 !! test
11387 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11388 !! options
11389 pst title=[[Ns:Somearticle (IGNORED), Context]]
11390 !! wikitext
11391 [[|Article]]
11392 !! html
11393 [[Ns:Article, Context|Article]]
11394 !! end
11395
11396 !! test
11397 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11398 !! options
11399 pst
11400 !! wikitext
11401 [[Article(context)|]]
11402 [[Bar:Article(context)|]]
11403 [[:Bar:Article(context)|]]
11404 [[|Article(context)]]
11405 [[Bar:X(Y)Z|]]
11406 [[:Bar:X(Y)Z|]]
11407 !! html
11408 [[Article(context)|Article]]
11409 [[Bar:Article(context)|Article]]
11410 [[:Bar:Article(context)|Article]]
11411 [[Article(context)]]
11412 [[Bar:X(Y)Z|X(Y)Z]]
11413 [[:Bar:X(Y)Z|X(Y)Z]]
11414 !! end
11415
11416 !! test
11417 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11418 !! options
11419 pst
11420 !! wikitext
11421 [[Article (context)|]]
11422 [[Bar:Article (context)|]]
11423 [[:Bar:Article (context)|]]
11424 [[|Article (context)]]
11425 [[Bar:X (Y) Z|]]
11426 [[:Bar:X (Y) Z|]]
11427 !! html
11428 [[Article (context)|Article]]
11429 [[Bar:Article (context)|Article]]
11430 [[:Bar:Article (context)|Article]]
11431 [[Article (context)]]
11432 [[Bar:X (Y) Z|X (Y) Z]]
11433 [[:Bar:X (Y) Z|X (Y) Z]]
11434 !! end
11435
11436 !! test
11437 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11438 !! options
11439 pst
11440 !! wikitext
11441 [[Article(context)|]]
11442 [[Bar:Article(context)|]]
11443 [[:Bar:Article(context)|]]
11444 [[|Article(context)]]
11445 [[Bar:X(Y)Z|]]
11446 [[:Bar:X(Y)Z|]]
11447 !! html
11448 [[Article(context)|Article]]
11449 [[Bar:Article(context)|Article]]
11450 [[:Bar:Article(context)|Article]]
11451 [[Article(context)]]
11452 [[Bar:X(Y)Z|X(Y)Z]]
11453 [[:Bar:X(Y)Z|X(Y)Z]]
11454 !! end
11455
11456 !! test
11457 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11458 !! options
11459 pst
11460 !! wikitext
11461 [[Article (context), context|]]
11462 [[Article (context),context|]]
11463 [[Bar:Article (context), context|]]
11464 [[Bar:Article (context),context|]]
11465 [[:Bar:Article (context), context|]]
11466 [[:Bar:Article (context),context|]]
11467 !! html
11468 [[Article (context), context|Article]]
11469 [[Article (context),context|Article]]
11470 [[Bar:Article (context), context|Article]]
11471 [[Bar:Article (context),context|Article]]
11472 [[:Bar:Article (context), context|Article]]
11473 [[:Bar:Article (context),context|Article]]
11474 !! end
11475
11476 !! test
11477 pre-save transform: trim trailing empty lines
11478 !! options
11479 pst
11480 !! wikitext
11481 Empty lines are trimmed
11482
11483
11484
11485
11486 !! html
11487 Empty lines are trimmed
11488 !! end
11489
11490 !! test
11491 pre-save transform: Signature expansion
11492 !! options
11493 pst
11494 !! wikitext
11495 * ~~~
11496 * <noinclude>~~~</noinclude>
11497 * <includeonly>~~~</includeonly>
11498 * <onlyinclude>~~~</onlyinclude>
11499 !! html
11500 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11501 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11502 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11503 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11504 !! end
11505
11506
11507 !! test
11508 pre-save transform: Signature expansion in nowiki tags (bug 93)
11509 !! options
11510 pst disabled
11511 !! wikitext
11512 Shall not expand:
11513
11514 <nowiki>~~~~</nowiki>
11515
11516 <includeonly><nowiki>~~~~</nowiki></includeonly>
11517
11518 <noinclude><nowiki>~~~~</nowiki></noinclude>
11519
11520 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11521
11522 {{subst:Foo}} shall be converted to FOO
11523
11524 As well as inside noinclude/onlyinclude
11525 <noinclude>{{subst:Foo}}</noinclude>
11526 <onlyinclude>{{subst:Foo}}</onlyinclude>
11527
11528 But not inside includeonly
11529 <includeonly>{{subst:Foo}}</includeonly>
11530 !! html
11531 Shall not expand:
11532
11533 <nowiki>~~~~</nowiki>
11534
11535 <includeonly><nowiki>~~~~</nowiki></includeonly>
11536
11537 <noinclude><nowiki>~~~~</nowiki></noinclude>
11538
11539 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11540
11541 FOO shall be converted to FOO
11542
11543 As well as inside noinclude/onlyinclude
11544 <noinclude>FOO</noinclude>
11545 <onlyinclude>FOO</onlyinclude>
11546
11547 But not inside includeonly
11548 <includeonly>{{subst:Foo}}</includeonly>
11549 !! end
11550
11551 !! test
11552 Parsoid: Recognize nowiki with trailing space in tags
11553 !! options
11554 parsoid=wt2html
11555 !! wikitext
11556 <nowiki ><div>[[foo]]</nowiki >
11557
11558 a<nowiki / >b
11559
11560 c<nowiki />d
11561
11562 e<nowiki/ >f
11563 !! html
11564 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11565 <p>ab</p>
11566 <p>cd</p>
11567 <p>ef</p>
11568 !! end
11569
11570 !! test
11571 Parsoid: Recognize nowiki with odd capitalization
11572 !! options
11573 parsoid=wt2html
11574 !! wikitext
11575 <noWikI ><div>[[foo]]</Nowiki >
11576 !! html
11577 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11578 !! end
11579
11580
11581 !! test
11582 Parsoid: Escape nowiki with trailing space in tags
11583 !! options
11584 parsoid=html2wt
11585 !! html
11586 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11587 <p>a&lt;nowiki /&gt;b</p>
11588 <p>c&lt;nowiki/ &gt;d</p>
11589 !! wikitext
11590 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11591
11592 a&lt;nowiki /&gt;b
11593
11594 c&lt;nowiki/ &gt;d
11595 !! end
11596
11597 !! test
11598 Parsoid: Escape weird noWikI capitalizations
11599 !! options
11600 parsoid=html2wt
11601 !! html
11602 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11603 !! wikitext
11604 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11605 !! end
11606
11607 ###
11608 ### Message transform tests
11609 ###
11610 !! test
11611 message transform: magic variables
11612 !! options
11613 msg
11614 !! wikitext
11615 {{SITENAME}}
11616 !! html
11617 MediaWiki
11618 !! end
11619
11620 !! test
11621 message transform: should not transform wiki markup
11622 !! options
11623 msg
11624 !! wikitext
11625 ''test''
11626 !! html
11627 ''test''
11628 !! end
11629
11630 !! test
11631 message transform: <noinclude> in transcluded template (bug 4926)
11632 !! options
11633 msg
11634 !! wikitext
11635 {{Includes}}
11636 !! html
11637 Foobar
11638 !! end
11639
11640 !! test
11641 message transform: <onlyinclude> in transcluded template (bug 4926)
11642 !! options
11643 msg
11644 !! wikitext
11645 {{Includes2}}
11646 !! html
11647 Foo
11648 !! end
11649
11650 !! test
11651 {{#special:}} page name, known
11652 !! options
11653 msg
11654 !! wikitext
11655 {{#special:Recentchanges}}
11656 !! html
11657 Special:RecentChanges
11658 !! end
11659
11660 !! test
11661 {{#special:}} page name with subpage, known
11662 !! options
11663 msg
11664 !! wikitext
11665 {{#special:Recentchanges/param}}
11666 !! html
11667 Special:RecentChanges/param
11668 !! end
11669
11670 !! test
11671 {{#special:}} page name, unknown
11672 !! options
11673 msg
11674 !! wikitext
11675 {{#special:foobar nonexistent}}
11676 !! html
11677 Special:Foobar nonexistent
11678 !! end
11679
11680 !! test
11681 {{#speciale:}} page name, known
11682 !! options
11683 msg
11684 !! wikitext
11685 {{#speciale:Recentchanges}}
11686 !! html
11687 Special:RecentChanges
11688 !! end
11689
11690 !! test
11691 {{#speciale:}} page name with subpage, known
11692 !! options
11693 msg
11694 !! wikitext
11695 {{#speciale:Recentchanges/param}}
11696 !! html
11697 Special:RecentChanges/param
11698 !! end
11699
11700 !! test
11701 {{#speciale:}} page name, unknown
11702 !! options
11703 msg
11704 !! wikitext
11705 {{#speciale:foobar nonexistent}}
11706 !! html
11707 Special:Foobar_nonexistent
11708 !! end
11709
11710 ###
11711 ### Images
11712 ###
11713 ### For Parsoid-specific tests, see
11714 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11715
11716 !! test
11717 Simple image
11718 !! options
11719 parsoid=wt2html,wt2wt,html2html
11720 !! wikitext
11721 [[Image:foobar.jpg]]
11722 !! html/php
11723 <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>
11724 </p>
11725 !! html/parsoid
11726 <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>
11727 !! end
11728
11729 !! test
11730 Simple image (using File: namespace, now canonical)
11731 !! wikitext
11732 [[File:Foobar.jpg]]
11733 !! html/php
11734 <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>
11735 </p>
11736 !! html/parsoid
11737 <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>
11738 !! end
11739
11740 !! test
11741 Right-aligned image
11742 !! wikitext
11743 [[File:Foobar.jpg|right]]
11744 !! html/php
11745 <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>
11746
11747 !! html/parsoid
11748 <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>
11749 !! end
11750
11751 !! test
11752 Image with caption
11753 !! wikitext
11754 [[File:Foobar.jpg|right|Caption text]]
11755 !! html/php
11756 <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>
11757
11758 !! html/parsoid
11759 <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>
11760 !! end
11761
11762 !! test
11763 Image with caption, bug 53312 #1
11764 !! wikitext
11765 [[File:Foobar.jpg|right|Caption page stuff]]
11766 !! html/php
11767 <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>
11768
11769 !! html/parsoid
11770 <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>
11771 !! end
11772
11773 !! test
11774 Image with caption, bug 53312 #2
11775 !! wikitext
11776 [[File:Foobar.jpg|right|Caption page=]]
11777 !! html/php
11778 <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>
11779
11780 !! html/parsoid
11781 <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>
11782 !! end
11783
11784 !! test
11785 Image with caption, bug 53312 #3
11786 !! wikitext
11787 [[File:Foobar.jpg|right|Caption page=stuff]]
11788 !! html/php
11789 <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>
11790
11791 !! html/parsoid
11792 <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>
11793 !! end
11794
11795 !! test
11796 Allow empty links in image captions (Bug 60753)
11797 !! options
11798 thumbsize=220
11799 !! wikitext
11800 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11801 [[]]
11802 [[Link2]]
11803 ]]
11804 !! html/php
11805 <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>
11806
11807 !! html/parsoid
11808 <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>
11809 [[]]
11810 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11811 </figcaption></figure>
11812 !! end
11813
11814 !! test
11815 Titles in unlinked images (T23454)
11816 !! wikitext
11817 [[File:Foobar.jpg|link=|stuff]]
11818 !! html/php
11819 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11820 </p>
11821 !! end
11822
11823 !! test
11824 Link with empty target
11825 !! wikitext
11826 [[]]
11827 !! html
11828 <p>[[]]
11829 </p>
11830 !! end
11831
11832 !! test
11833 Image with link trail
11834 !! wikitext
11835 Linktrails should not work for images: [[File:Foobar.jpg]]s
11836 !! html/php
11837 <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
11838 </p>
11839 !! html/parsoid
11840 <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>
11841 !! end
11842
11843 !! test
11844 Image with empty attribute
11845 !! options
11846 parsoid=wt2html,wt2wt,html2html
11847 !! wikitext
11848 [[File:Foobar.jpg|right||Caption text]]
11849 !! html/php
11850 <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>
11851
11852 !! html/parsoid
11853 <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>
11854 !! end
11855
11856 !! test
11857 1. Block image with individual attributes from templates
11858 !! wikitext
11859 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11860 !! html/php
11861 <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>
11862
11863 !! html/parsoid
11864 <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>
11865 !! end
11866
11867 !! test
11868 2. Block Image with individual attributes from templates
11869 !! wikitext
11870 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11871 !! html/php
11872 <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>
11873
11874 !! html/parsoid
11875 <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>
11876 !! end
11877
11878 !! test
11879 3. Inline image with individual attributes from templates
11880 !! wikitext
11881 [[File:Foobar.jpg|{{echo|50px}}]]
11882 !! html/php
11883 <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>
11884 </p>
11885 !! html/parsoid
11886 <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>
11887 !! end
11888
11889 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11890 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11891 !! test
11892 Image with multiple attributes from the same template
11893 !! wikitext
11894 [[File:Foobar.jpg|{{image_attribs}}]]
11895 !! html/php
11896 <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>
11897
11898 !! html/parsoid
11899 <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>
11900 !! end
11901
11902 !! test
11903 Image with link tails
11904 !! options
11905 thumbsize=220
11906 !! wikitext
11907 123[[File:Foobar.jpg]]456
11908 123[[File:Foobar.jpg|right]]456
11909 123[[File:Foobar.jpg|thumb]]456
11910 !! html/php
11911 <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
11912 </p>
11913 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
11914 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
11915
11916 !! html/php+tidy
11917 <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>
11918 <p>123</p>
11919 <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>
11920 <p>456 123</p>
11921 <div class="thumb tright">
11922 <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>
11923 <div class="thumbcaption">
11924 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11925 </div>
11926 </div>
11927 </div>
11928 <p>456</p>
11929 !! html/parsoid
11930 <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>
11931 <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>
11932 <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>
11933 !! end
11934
11935 !! test
11936 Image with multiple captions -- only last one is accepted
11937 !! wikitext
11938 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11939 !! html/php
11940 <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>
11941
11942 !! html/parsoid
11943 <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>
11944 !! end
11945
11946 !! test
11947 Image with multiple widths -- use last
11948 !! wikitext
11949 [[File:Foobar.jpg|200px|300px|caption]]
11950 !! html/php
11951 <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>
11952 </p>
11953 !! html/parsoid
11954 <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>
11955 !! end
11956
11957 !! test
11958 Image with multiple alignments -- use first (bug 48664)
11959 !! options
11960 thumbsize=220
11961 !! wikitext
11962 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11963
11964 [[File:Foobar.jpg|middle|text-top|caption]]
11965 !! html/php
11966 <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>
11967 <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>
11968 </p>
11969 !! html/parsoid
11970 <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>
11971 <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>
11972 !! end
11973
11974 !! test
11975 Image with width attribute at different positions
11976 !! wikitext
11977 [[File:Foobar.jpg|200px|right|Caption]]
11978 [[File:Foobar.jpg|right|200px|Caption]]
11979 [[File:Foobar.jpg|right|Caption|200px]]
11980 !! html/php
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 <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>
11984
11985 !! html/parsoid
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 <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>
11989 !! end
11990
11991 # a sad bit of backward-compatibility
11992 !! test
11993 Image with size specified with pxpx (bug 13500, 51628)
11994 !! options
11995 parsoid=wt2html,wt2wt,html2html
11996 !! wikitext
11997 [[File:Foobar.jpg|20pxpx]]
11998 [[File:Foobar.jpg|200x20pxpx]]
11999 !! html/php
12000 <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>
12001 <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>
12002 </p>
12003 !! html/parsoid
12004 <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>
12005 !! end
12006
12007 !! test
12008 Image with link parameter, wiki target
12009 !! wikitext
12010 [[File:Foobar.jpg|link=Main Page]]
12011 !! html/php
12012 <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>
12013 </p>
12014 !! html/parsoid
12015 <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>
12016 !! end
12017
12018 # parsoid bug 49293 (part 1)
12019 !! test
12020 Image with link parameter, URL target
12021 !! wikitext
12022 [[File:Foobar.jpg|link=http://example.com/]]
12023 !! html/php
12024 <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>
12025 </p>
12026 !! html/parsoid
12027 <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>
12028 !! end
12029
12030 # parsoid bug 49293 (part 2)
12031 !! test
12032 Image with link parameter, protocol-less URL target
12033 !! wikitext
12034 [[File:Foobar.jpg|link=//example.com/]]
12035 !! html/php
12036 <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>
12037 </p>
12038 !! html/parsoid
12039 <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>
12040 !! end
12041
12042 !! test
12043 Image with link parameter, wgExternalLinkTarget
12044 !! wikitext
12045 [[Image:foobar.jpg|link=http://example.com/]]
12046 !! config
12047 wgExternalLinkTarget='foobar'
12048 !! html
12049 <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>
12050 </p>
12051 !! end
12052
12053 !! test
12054 Image with link parameter, wgNoFollowLinks set to false
12055 !! wikitext
12056 [[Image:foobar.jpg|link=http://example.com/]]
12057 !! config
12058 wgNoFollowLinks=false
12059 !! html
12060 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12061 </p>
12062 !! end
12063
12064 !! test
12065 Image with link parameter, wgNoFollowDomainExceptions
12066 !! wikitext
12067 [[Image:foobar.jpg|link=http://example.com/]]
12068 !! config
12069 wgNoFollowDomainExceptions='example.com'
12070 !! html
12071 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12072 </p>
12073 !! end
12074
12075 !! test
12076 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12077 !! wikitext
12078 [[Image:foobar.jpg|link=http://example.com/|Title]]
12079 !! config
12080 wgExternalLinkTarget='foobar'
12081 !! html
12082 <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>
12083 </p>
12084 !! end
12085
12086 !! test
12087 Image with empty link parameter
12088 !! wikitext
12089 [[File:Foobar.jpg|link=]]
12090 !! html/php
12091 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12092 </p>
12093 !! html/parsoid
12094 <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>
12095 !! end
12096
12097 !! test
12098 Image with link parameter (wiki target) and unnamed parameter
12099 !! wikitext
12100 [[File:Foobar.jpg|link=Main_Page|Title]]
12101 !! html/php
12102 <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>
12103 </p>
12104 !! html/parsoid
12105 <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>
12106 !! end
12107
12108 !! test
12109 Image with link parameter (URL target) and unnamed parameter
12110 !! wikitext
12111 [[File:Foobar.jpg|link=http://example.com/|Title]]
12112 !! html/php
12113 <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>
12114 </p>
12115 !! html/parsoid
12116 <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>
12117 !! end
12118
12119 !! test
12120 Thumbnail image with link parameter
12121 !! options
12122 thumbsize=220
12123 parsoid=wt2html,wt2wt,html2html
12124 !! wikitext
12125 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12126 !! html/php
12127 <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>
12128
12129 !! html/parsoid
12130 <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>
12131 !! end
12132
12133 !! test
12134 Manually-specified thumbnail image
12135 !! options
12136 thumbsize=220
12137 !! wikitext
12138 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12139 !! html/php
12140 <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>
12141
12142 !! html/parsoid
12143 <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>
12144 !! end
12145
12146 !! test
12147 Manually-specified thumbnail image with explicit link to wiki page
12148 !! options
12149 thumbsize=220
12150 parsoid=wt2html,wt2wt,html2html
12151 !! wikitext
12152 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12153 !! html/php
12154 <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>
12155
12156 !! html/parsoid
12157 <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>
12158 !! end
12159
12160 !! test
12161 Manually-specified thumbnail image with explicit link to url
12162 !! options
12163 thumbsize=220
12164 parsoid=wt2html,wt2wt,html2html
12165 !! wikitext
12166 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12167 !! html/php
12168 <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>
12169
12170 !! html/parsoid
12171 <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>
12172 !! end
12173
12174 !! test
12175 Manually-specified thumbnail image with explicit no link
12176 !! options
12177 thumbsize=220
12178 parsoid=wt2html,wt2wt,html2html
12179 !! wikitext
12180 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12181 !! html/php
12182 <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>
12183
12184 !! html/parsoid
12185 <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>
12186 !! end
12187
12188 !! test
12189 Manually-specified thumbnail image with explicit link and alt text
12190 !! options
12191 thumbsize=220
12192 parsoid=wt2html,wt2wt,html2html
12193 !! wikitext
12194 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12195 !! html/php
12196 <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>
12197
12198 !! html/parsoid
12199 <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>
12200 !! end
12201
12202 !! test
12203 Image with frame and link
12204 !! options
12205 parsoid=wt2html,wt2wt,html2html
12206 !! wikitext
12207 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12208 !! html/php
12209 <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>
12210
12211 !! html/parsoid
12212 <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>
12213 !! end
12214
12215 !! test
12216 Image with frame and link and explicit alt
12217 !! options
12218 parsoid=wt2html,wt2wt,html2html
12219 !! wikitext
12220 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12221 !! html/php
12222 <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>
12223
12224 !! html/parsoid
12225 <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>
12226 !! end
12227
12228 !! test
12229 Image with wiki markup in implicit alt
12230 !! options
12231 parsoid=wt2html,wt2wt,html2html
12232 !! wikitext
12233 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12234
12235 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12236 !! html/php
12237 <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>
12238 </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>
12239 </p>
12240 !! html/parsoid
12241 <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>
12242 <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>
12243 !! end
12244
12245 !! test
12246 Alt image option should handle most kinds of wikitext without barfing
12247 !! wikitext
12248 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12249 !! html/php
12250 <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>
12251
12252 !! html/parsoid
12253 <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>
12254 !! end
12255
12256 ###################
12257 # Conflicting image format options.
12258 # First option specified should 'win'.
12259 # All three cases in each test should be identical.
12260
12261 !! test
12262 Image with 'frameless' first.
12263 !! options
12264 parsoid=wt2html,wt2wt,html2html
12265 !! wikitext
12266 [[File:Foobar.jpg|frameless|caption]]
12267
12268 [[File:Foobar.jpg|frameless|frame|caption]]
12269
12270 [[File:Foobar.jpg|frameless|thumb|caption]]
12271 !! html/php
12272 <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><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>
12275 </p>
12276 !! html/parsoid
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 <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>
12280 !! end
12281
12282 !! test
12283 Image with 'frame' first.
12284 !! options
12285 parsoid=wt2html,wt2wt,html2html
12286 !! wikitext
12287 [[File:Foobar.jpg|frame|caption]]
12288 [[File:Foobar.jpg|frame|frameless|caption]]
12289 [[File:Foobar.jpg|frame|thumb|caption]]
12290 !! html/php
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 <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>
12294
12295 !! html/parsoid
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 <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>
12299 !! end
12300
12301 !! test
12302 Image with 'thumb' first.
12303 !! options
12304 parsoid=wt2html,wt2wt,html2html
12305 !! wikitext
12306 [[File:Foobar.jpg|thumb|caption]]
12307 [[File:Foobar.jpg|thumb|frameless|caption]]
12308 [[File:Foobar.jpg|thumb|frame|caption]]
12309 !! html/php
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 <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>
12313
12314 !! html/parsoid
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 <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>
12318 !! end
12319
12320 ###################
12321 # Image sizing.
12322 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12323 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12324 # Foobar has actual size of 1941x220
12325 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12326 # a scalable format.
12327 # 2. Framed images always ignore size options; always render at default size.
12328 # 3. "Unspecified format" and border are the only types which can be
12329 # enlarged.
12330
12331 !! test
12332 Image: "unspecified format" and border enlarge
12333 !! options
12334 parsoid=wt2html,wt2wt,html2html
12335 !! wikitext
12336 [[File:Foobar.jpg|2000px]]
12337
12338 [[File:Foobar.jpg|border|2000px]]
12339 !! html/php
12340 <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>
12341 </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>
12342 </p>
12343 !! html/parsoid
12344 <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>
12345 <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>
12346 !! end
12347
12348 !! test
12349 Image: "unspecified format" and border reduce
12350 !! options
12351 parsoid=wt2html,wt2wt,html2html
12352 !! wikitext
12353 [[File:Foobar.jpg|1000px]]
12354
12355 [[File:Foobar.jpg|border|1000px]]
12356 !! html/php
12357 <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>
12358 </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>
12359 </p>
12360 !! html/parsoid
12361 <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>
12362 <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>
12363 !! end
12364
12365 !! test
12366 Image: thumbs reduce
12367 !! options
12368 parsoid=wt2html,wt2wt,html2html
12369 !! wikitext
12370 [[File:Foobar.jpg|thumb|50px]]
12371 !! html/php
12372 <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>
12373
12374 !! html/parsoid
12375 <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>
12376 !! end
12377
12378 !! test
12379 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12380 !! options
12381 parsoid=wt2html,wt2wt,html2html
12382 !! wikitext
12383 [[File:Foobar.jpg|thumb|2000px]]
12384
12385 [[File:Foobar.svg|thumb|2000px]]
12386 !! html/php
12387 <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>
12388 <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>
12389
12390 !! html/parsoid
12391 <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>
12392 <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>
12393 !! end
12394
12395 !! test
12396 Image: frameless can reduce in size
12397 !! options
12398 parsoid=wt2html,wt2wt,html2html
12399 !! wikitext
12400 [[File:Foobar.jpg|frameless|50px]]
12401 !! html/php
12402 <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>
12403 </p>
12404 !! html/parsoid
12405 <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>
12406 !! end
12407
12408 !! test
12409 Image: bitmap frameless can't be enlarged past original size, but vector can
12410 !! options
12411 parsoid=wt2html,wt2wt,html2html
12412 !! wikitext
12413 [[File:Foobar.jpg|frameless|2000px]]
12414
12415 [[File:Foobar.svg|frameless|2000px]]
12416 !! html/php
12417 <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>
12418 </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>
12419 </p>
12420 !! html/parsoid
12421 <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>
12422 <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>
12423 !! end
12424
12425 !! test
12426 Image: framed images are always unscaled.
12427 !! options
12428 parsoid=wt2html,wt2wt,html2html
12429 !! wikitext
12430 [[File:Foobar.jpg|frame]]
12431
12432 [[File:Foobar.jpg|frame|50px]]
12433
12434 [[File:Foobar.jpg|frame|50x50px]]
12435
12436 [[File:Foobar.jpg|frame|2000px]]
12437 !! html/php
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 <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>
12442
12443 !! html/parsoid
12444 <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>
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 <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>
12448 !! end
12449
12450 ###################
12451
12452 !! test
12453 Link to image page- image page normally doesn't exists, hence edit link
12454 Add test with existing image page
12455 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12456 !! wikitext
12457 [[:Image:test]]
12458 !! html
12459 <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>
12460 </p>
12461 !! end
12462
12463 !! test
12464 bug 18784 Link to non-existent image page with caption should use caption as link text
12465 !! wikitext
12466 [[:Image:test|caption]]
12467 !! html
12468 <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>
12469 </p>
12470 !! end
12471
12472 !! test
12473 Frameless image caption with a free URL
12474 !! wikitext
12475 [[File:Foobar.jpg|http://example.com]]
12476 !! html/php
12477 <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>
12478 </p>
12479 !! html/parsoid
12480 <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>
12481 !! end
12482
12483 !! test
12484 Thumbnail image caption with a free URL
12485 !! options
12486 thumbsize=220
12487 !! wikitext
12488 [[File:Foobar.jpg|thumb|http://example.com]]
12489 !! html/php
12490 <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>
12491
12492 !! html/parsoid
12493 <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>
12494 !! end
12495
12496 !! test
12497 Thumbnail image caption with a free URL and explicit alt
12498 !! options
12499 thumbsize=220
12500 parsoid=wt2html,wt2wt,html2html
12501 !! wikitext
12502 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12503 !! html/php
12504 <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>
12505
12506 !! html/parsoid
12507 <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>
12508 !! end
12509
12510 !! test
12511 SVG thumbnails with no language set
12512 !! options
12513 !! wikitext
12514 [[File:Foobar.svg|thumb|caption]]
12515 !! html/php
12516 <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>
12517
12518 !! html/parsoid
12519 <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>
12520 !! end
12521
12522 !! test
12523 SVG thumbnails with language de
12524 !! options
12525 parsoid=wt2html,wt2wt,html2html
12526 !! wikitext
12527 [[File:Foobar.svg|thumb|caption|lang=de]]
12528 !! html/php
12529 <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>
12530
12531 !! html/parsoid
12532 <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>
12533 !! end
12534
12535 !! test
12536 SVG thumbnails with invalid language code
12537 !! options
12538 parsoid=wt2html,wt2wt,html2html
12539 !! wikitext
12540 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12541 !! html/php
12542 <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>
12543
12544 !! html/parsoid
12545 <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>
12546 !! end
12547
12548 !! test
12549 BUG 1887: A ISBN with a thumbnail
12550 !! wikitext
12551 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12552 !! html/php
12553 <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>
12554
12555 !! html/parsoid
12556 <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>
12557 !! end
12558
12559 !! test
12560 BUG 1887: A RFC with a thumbnail
12561 !! wikitext
12562 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12563 !! html/php
12564 <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>
12565
12566 !! html/parsoid
12567 <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>
12568 !! end
12569
12570 !! test
12571 BUG 1887: A mailto link with a thumbnail
12572 !! wikitext
12573 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12574 !! html/php
12575 <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>
12576
12577 !! html/parsoid
12578 <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>
12579 !! end
12580
12581 # Pending resolution to bug 368
12582 !! test
12583 BUG 648: Frameless image caption with a link
12584 !! wikitext
12585 [[File:Foobar.jpg|text with a [[link]] in it]]
12586 !! html/php
12587 <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>
12588 </p>
12589 !! html/parsoid
12590 <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>
12591 !! end
12592
12593 !! test
12594 BUG 648: Frameless image caption with a link (suffix)
12595 !! wikitext
12596 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12597 !! html/php
12598 <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>
12599 </p>
12600 !! html/parsoid
12601 <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>
12602 !! end
12603
12604 !! test
12605 BUG 648: Frameless image caption with an interwiki link
12606 !! wikitext
12607 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12608 !! html/php
12609 <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>
12610 </p>
12611 !! html/parsoid
12612 <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>
12613 !! end
12614
12615 !! test
12616 BUG 648: Frameless image caption with a piped interwiki link
12617 !! wikitext
12618 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12619 !! html/php
12620 <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>
12621 </p>
12622 !! html/parsoid
12623 <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>
12624 !! end
12625
12626 !! test
12627 Escape HTML special chars in image alt text
12628 !! wikitext
12629 [[File:Foobar.jpg|& < > "]]
12630 !! html/php
12631 <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>
12632 </p>
12633 !! html/parsoid
12634 <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>
12635 !! end
12636
12637 !! test
12638 BUG 499: Alt text should have &#1234;, not &amp;1234;
12639 !! wikitext
12640 [[File:Foobar.jpg|&#9792;]]
12641 !! html/php
12642 <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>
12643 </p>
12644 !! html/parsoid
12645 <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>
12646 !! end
12647
12648 !! test
12649 Broken image caption with link
12650 !! options
12651 parsoid=wt2html,wt2wt,html2html
12652 !! wikitext
12653 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12654 !! html/php
12655 <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.
12656 </p>
12657 !! html/parsoid
12658 <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>
12659 !! end
12660
12661 !! test
12662 Image caption containing another image
12663 !! wikitext
12664 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12665 !! html/php
12666 <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>
12667
12668 !! html/parsoid
12669 <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>
12670 !! end
12671
12672 !! test
12673 Image: caption containing a newline
12674 !! wikitext
12675 [[File:Foobar.jpg|This
12676 *is some text]]
12677 !! html/php
12678 <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>
12679 </p>
12680 !! html/parsoid
12681 <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>
12682 !!end
12683
12684 !!test
12685 Image: caption containing leading space
12686 (The leading space should not trigger nowiki escaping in wt2wt mode)
12687 !! wikitext
12688 [[File:Foobar.jpg|thumb| bar]]
12689 !! html/php
12690 <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>
12691
12692 !! html/parsoid
12693 <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>
12694 !!end
12695
12696 !! test
12697 Image: caption containing a table
12698 !! options
12699 parsoid=wt2html,wt2wt,html2html
12700 !! wikitext
12701 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12702 {|
12703 ! Foo !! Bar
12704 |-
12705 | Foo1 || Bar1
12706 |}
12707 and some more text.]]
12708 !! html/php
12709 <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>
12710
12711 !! html/parsoid
12712 <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
12713 <table>
12714 <tbody>
12715 <tr><th>Foo </th><th>Bar</th></tr>
12716 <tr>
12717 <td>Foo1 </td>
12718 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12719 !! end
12720
12721 !! test
12722 Bug 3090: External links other than http: in image captions
12723 !! wikitext
12724 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12725 !! html/php
12726 <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>
12727
12728 !! html/parsoid
12729 <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>
12730 !! end
12731
12732 !! test
12733 Custom class
12734 !! options
12735 parsoid=wt2html,wt2wt,html2html
12736 !! wikitext
12737 [[Image:foobar.jpg|a|class=b]]
12738 !! html/php
12739 <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>
12740 </p>
12741 !! html/parsoid
12742 <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>
12743 !! end
12744
12745 !! test
12746 Localized image handling (1).
12747 !! options
12748 parsoid=wt2html,wt2wt,html2html
12749 language=es
12750 !! wikitext
12751 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12752 !! html/php
12753 <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>
12754
12755 !! html/parsoid
12756 <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>
12757 !! end
12758
12759 !! test
12760 Localized image handling (2).
12761 !! options
12762 thumbsize=220
12763 parsoid=wt2html,wt2wt,html2html
12764 language=es
12765 !! wikitext
12766 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12767 !! html/php
12768 <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>
12769
12770 !! html/parsoid
12771 <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>
12772 !! end
12773
12774 !! test
12775 "border", "frameless" and "class" attributes on an image.
12776 !! options
12777 thumbsize=220
12778 parsoid=wt2html,wt2wt,html2html
12779 !! wikitext
12780 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12781 !! html/php
12782 <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>
12783 </p>
12784 !! html/parsoid
12785 <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>
12786 !! end
12787
12788 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12789 !! test
12790 Invalid image attributes (bug 62500)
12791 !! options
12792 thumbsize=220
12793 parsoid=wt2html,wt2wt,html2html
12794 !! wikitext
12795 [[File:Foobar.jpg|thumb|float|left|caption]]
12796
12797 [[File:Foobar.jpg|thumb|righ|caption]]
12798
12799 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12800 !! html/php
12801 <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>
12802 <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>
12803 <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>
12804
12805 !! html/parsoid
12806 <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>
12807 <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>
12808 <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>
12809 !! end
12810
12811 !! article
12812 File:Barfoo.jpg
12813 !! text
12814 #REDIRECT [[File:Barfoo.jpg]]
12815 !! endarticle
12816
12817 # FIXME: Parsoid should run this test -- but we'd need to teach the
12818 # mockAPI about the redirected Barfoo.jpg image.
12819 !! test
12820 Redirected image
12821 !! wikitext
12822 [[Image:Barfoo.jpg]]
12823 !! html/php
12824 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12825 </p>
12826 !! end
12827
12828 !! test
12829 Missing image with uploads disabled
12830 !! options
12831 wgEnableUploads=0
12832 !! wikitext
12833 [[File:Foobaz.jpg]]
12834 !! html/php
12835 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12836 </p>
12837 !! html/parsoid
12838 <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>
12839 !! end
12840
12841 # Parsoid-specific testing for images
12842 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12843 # Currently imperfect due to a flaw in the Parsoid testrunner
12844 # Work in progress
12845 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12846 # image tests.
12847
12848 !! test
12849 Parsoid-specific image handling - simple image with size and middle alignment
12850 !! wikitext
12851 [[File:Foobar.jpg|middle|50px]]
12852 !! html/parsoid
12853 <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>
12854 !! end
12855
12856 !! test
12857 Parsoid-specific image handling - simple image with size, middle alignment,
12858 non-standard namespace alias
12859 !! options
12860 parsoid=wt2wt,wt2html,html2html
12861 !! wikitext
12862 [[Image:Foobar.jpg|middle|50px]]
12863 !! html/parsoid
12864 <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>
12865 !! end
12866
12867 !! test
12868 Parsoid-specific image handling - simple image with size and middle alignment
12869 (existing content)
12870 !! wikitext
12871 [[File:Foobar.jpg|50px|middle]]
12872 !! html/parsoid
12873 <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>
12874 !! end
12875
12876 !! test
12877 Parsoid-specific image handling - simple image with size and middle alignment
12878 and non-standard namespace name
12879 !! options
12880 parsoid=wt2html,wt2wt,html2html
12881 !! wikitext
12882 [[Image:Foobar.jpg|50px|middle]]
12883 !! html/parsoid
12884 <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>
12885 !! end
12886
12887 !! test
12888 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12889 !! wikitext
12890 [[File:Foobar.jpg|500x10px|baseline|caption]]
12891 !! html/parsoid
12892 <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>
12893 !! end
12894
12895 !! test
12896 Parsoid-specific image handling - simple image with border and size spec
12897 !! wikitext
12898 [[File:Foobar.jpg|50px|border|caption]]
12899 !! html/parsoid
12900 <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>
12901 !! end
12902
12903 !! test
12904 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12905 !! wikitext
12906 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12907 !! html/parsoid
12908 <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>
12909 !! end
12910
12911 !! test
12912 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12913 (existing content)
12914 !! wikitext
12915 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12916 !! html/parsoid
12917 <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>
12918 !! end
12919
12920 !! test
12921 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12922 !! wikitext
12923 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12924 !! html/parsoid
12925 <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>
12926 !! end
12927
12928 !! test
12929 Parsoid-specific image handling - thumbnail with specific size, halign,
12930 valign, and caption (existing content)
12931 !! wikitext
12932 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12933 !! html/parsoid
12934 <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>
12935 !! end
12936
12937 !! test
12938 Parsoid-specific image handling - framed image with specific size and caption
12939 (size is ignored)
12940 !! options
12941 parsoid=wt2html,wt2wt,html2html
12942 !! wikitext
12943 [[File:Foobar.jpg|frame|500x50px|caption]]
12944 !! html/parsoid
12945 <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>
12946 !! end
12947
12948 !! test
12949 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12950 (size is ignored)
12951 !! options
12952 parsoid=wt2html,wt2wt,html2html
12953 !! wikitext
12954 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12955 !! html/parsoid
12956 <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>
12957 !! end
12958
12959 !! test
12960 Parsoid-specific image handling - frameless image with specific size, border, and caption
12961 !! wikitext
12962 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12963 !! html/parsoid
12964 <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>
12965 !! end
12966
12967 !! test
12968 Parsoid-specific image handling - simple image with a formatted caption
12969 !! wikitext
12970 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12971 !! html/parsoid
12972 <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>
12973 !! end
12974
12975 !! test
12976 Parsoid-specific image handling - caption with a template in it
12977 !! wikitext
12978 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12979 !! html/parsoid
12980 <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>
12981 !! end
12982
12983 !! test
12984 Parsoid-specific image handling - caption with unbalanced tags in it
12985 !! options
12986 parsoid=wt2html,wt2wt,html2html
12987 !! wikitext
12988 foo
12989 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12990 bar
12991 !! html/parsoid
12992 <p>foo</p>
12993 <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>
12994 <p>bar</p>
12995 !! end
12996
12997 !! test
12998 Parsoid-specific image handling - empty caption (1)
12999 !! options
13000 parsoid=wt2html,wt2wt
13001 !! wikitext
13002 [[File:Foobar.jpg|thumb|]]
13003 !! html/parsoid
13004 <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>
13005 !! end
13006
13007 # empty captions don't get serialized unless we're in the "round trip" case
13008 !! test
13009 Parsoid-specific image handling - empty caption (2)
13010 !! options
13011 parsoid=html2wt
13012 !! html/parsoid
13013 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13014 <a href="File:Foobar.jpg">
13015 <img resource="./File:Foobar.jpg"
13016 src="//example.com/images/3/3a/Foobar.jpg"
13017 height="25" width="220"/>
13018 </a>
13019 <figcaption></figcaption>
13020 </figure>
13021 !! wikitext
13022 [[File:Foobar.jpg|thumb]]
13023 !! end
13024
13025 !! test
13026 Parsoid-specific image handling - whitespace caption
13027 !! wikitext
13028 [[File:Foobar.jpg|thumb| ]]
13029 !! html/parsoid
13030 <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>
13031 !! end
13032
13033 !! test
13034 Parsoid-specific image handling - lang option
13035 !! wikitext
13036 foo
13037 [[File:Foobar.svg|lang=de|caption]]
13038 bar
13039 !! html/parsoid
13040 <p>foo
13041 <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>
13042 bar</p>
13043 !! end
13044
13045
13046 ###
13047 ### Subpages
13048 ###
13049 !! article
13050 Subpage test/subpage
13051 !! text
13052 foo
13053 !! endarticle
13054
13055 !! test
13056 Subpage link
13057 !! options
13058 subpage title=[[Subpage test]]
13059 !! wikitext
13060 [[/subpage]]
13061 !! html
13062 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13063 </p>
13064 !! end
13065
13066 !! test
13067 Subpage noslash link
13068 !! options
13069 subpage title=[[Subpage test]]
13070 !! wikitext
13071 [[/subpage/]]
13072 !! html
13073 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13074 </p>
13075 !! end
13076
13077 !! article
13078 Subpage test/1/2/subpage
13079 !! text
13080 blah
13081 !! endarticle
13082
13083 !! test
13084 Relative subpage noslash link
13085 !! options
13086 parsoid=wt2wt,wt2html,html2html
13087 subpage title=[[Subpage test/1/2/3/4]]
13088 !! wikitext
13089 [[../../subpage/]]
13090
13091 [[../../subpage]]
13092 !! html/php
13093 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13094 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13095 </p>
13096 !! html/parsoid
13097 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13098 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13099 !! end
13100
13101 !! test
13102 Parsoid: dot-slash prefixed wikilinks
13103 !! wikitext
13104 [[./foo]]
13105
13106 [[././bar]]
13107
13108 [[././baz/]]
13109 !! html/php
13110 <p>[[./foo]]
13111 </p><p>[[././bar]]
13112 </p><p>[[././baz/]]
13113 </p>
13114 !! html/parsoid
13115 <p>[[./foo]]
13116 </p><p>[[././bar]]
13117 </p><p>[[././baz/]]
13118 </p>
13119 !! end
13120
13121 !! test
13122 Render invalid page names as plain text (bug 51090)
13123 !! wikitext
13124 [[./../foo|bar]]
13125 [[foo�|bar]]
13126 [[foo/.|bar]]
13127 [[foo/..|bar]]
13128 [[foo~~~bar]]
13129 [[foo>bar]]
13130 [[foo[bar]]
13131 [[.]]
13132 [[..]]
13133 [[foo././bar]]
13134
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 [[{{echo|foo<bar}}]]
13146 !!html/php
13147 <p>[[./../foo|bar]]
13148 [[foo�|bar]]
13149 [[foo/.|bar]]
13150 [[foo/..|bar]]
13151 [[foo~~~bar]]
13152 [[foo&gt;bar]]
13153 [[foo[bar]]
13154 [[.]]
13155 [[..]]
13156 [[foo././bar]]
13157 </p><p>[[./../foo|bar]]
13158 [[foo/.|bar]]
13159 [[foo/..|bar]]
13160 [[foo~~~~bar]]
13161 [[foo&gt;bar]]
13162 [[foo././bar]]
13163 [[foo{bar]]
13164 [[foo}bar]]
13165 [[foo[bar]]
13166 [[foo]bar]]
13167 [[foo&lt;bar]]
13168 </p>
13169 !!html/parsoid
13170 <p>[[./../foo|bar]]
13171 [[foo�|bar]]
13172 [[foo/.|bar]]
13173 [[foo/..|bar]]
13174 [[foo~~~bar]]
13175 [[foo>bar]]
13176 [[foo[bar]]
13177 [[.]]
13178 [[..]]
13179 [[foo././bar]]</p>
13180
13181 <p>[[<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/.."}},"i":0}}]}'>foo/..</span>|bar]]
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]bar"}},"i":0}}]}'>foo]bar</span>]]
13191 [[<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>
13192 !!end
13193
13194 !! test
13195 Disabled subpages
13196 !! wikitext
13197 [[/subpage]]
13198 !! html
13199 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13200 </p>
13201 !! end
13202
13203 !! test
13204 BUG 561: {{/Subpage}}
13205 !! options
13206 subpage title=[[Page]]
13207 !! wikitext
13208 {{/Subpage}}
13209 !! html
13210 <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>
13211 </p>
13212 !! end
13213
13214 ###
13215 ### Categories
13216 ###
13217 !! article
13218 Category:MediaWiki User's Guide
13219 !! text
13220 blah
13221 !! endarticle
13222
13223 !! test
13224 Link to category
13225 !! wikitext
13226 [[:Category:MediaWiki User's Guide]]
13227 !! html
13228 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13229 </p>
13230 !! end
13231
13232 !! test
13233 Simple category
13234 !! options
13235 cat
13236 !! wikitext
13237 [[Category:MediaWiki User's Guide]]
13238 !! html
13239 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13240 !! end
13241
13242 !! test
13243 PAGESINCATEGORY invalid title fatal (r33546 fix)
13244 !! wikitext
13245 {{PAGESINCATEGORY:<bogus>}}
13246 !! html
13247 <p>0
13248 </p>
13249 !! end
13250
13251 !! test
13252 Category with different sort key
13253 !! options
13254 cat
13255 !! wikitext
13256 [[Category:MediaWiki User's Guide|Foo]]
13257 !! html
13258 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13259 !! end
13260
13261 !! test
13262 Category with identical sort key
13263 !! options
13264 cat
13265 !! wikitext
13266 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13267 !! html
13268 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13269 !! end
13270
13271 !! test
13272 Category with empty sort key
13273 !! options
13274 cat
13275 pst
13276 !! wikitext
13277 [[Category:MediaWiki User's Guide|]]
13278 !! html
13279 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13280 !! end
13281
13282 !! test
13283 Category with empty sort key and parentheses
13284 !! options
13285 cat
13286 pst
13287 !! wikitext
13288 [[Category:Foo (bar)|]]
13289 !! html
13290 [[Category:Foo (bar)|Foo]]
13291 !! end
13292
13293 !! test
13294 Category with link tail
13295 !! options
13296 cat
13297 pst
13298 !! wikitext
13299 123[[Category:Foo]]456
13300 !! html
13301 123[[Category:Foo]]456
13302 !! end
13303
13304 !! test
13305 Category with template
13306 !! options
13307 cat
13308 pst
13309 !! wikitext
13310 [[Category:{{echo|Foo}}]]
13311 !! html
13312 [[Category:{{echo|Foo}}]]
13313 !! end
13314
13315 !! test
13316 Category with template in sort key
13317 !! options
13318 cat
13319 pst
13320 !! wikitext
13321 [[Category:Foo|{{echo|Bar}}]]
13322 !! html
13323 [[Category:Foo|{{echo|Bar}}]]
13324 !! end
13325
13326 !! test
13327 Category with template in sort key and title
13328 !! options
13329 cat
13330 pst
13331 !! wikitext
13332 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13333 !! html
13334 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13335 !! end
13336
13337 !! test
13338 Category / paragraph interactions
13339 !! wikitext
13340 Foo [[Category:Baz]] Bar
13341
13342 Foo [[Category:Baz]]
13343 Bar
13344
13345 Foo
13346 [[Category:Baz]]
13347 Bar
13348
13349 Foo
13350 [[Category:Baz]] Bar
13351
13352 Foo
13353 [[Category:Baz]]
13354 [[Category:Baz]]
13355 [[Category:Baz]]
13356 Bar
13357
13358 [[Category:Baz]]
13359 [[Category:Baz]]
13360 [[Category:Baz]]
13361
13362 [[Category:Baz]]
13363 {{echo|[[Category:Baz]]}}
13364 [[Category:Baz]]
13365 !! html
13366 <p>Foo Bar
13367 </p><p>Foo
13368 Bar
13369 </p><p>Foo
13370 Bar
13371 </p><p>Foo Bar
13372 </p><p>Foo
13373 Bar
13374 </p>
13375 !! end
13376
13377 !! test
13378 Parsoid: Serialize link to category page with colon escape
13379 !! options
13380 parsoid
13381 !! wikitext
13382
13383 [[:Category:Foo]]
13384 [[:Category:Foo|Bar]]
13385 !! html
13386 <p>
13387 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13388 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13389 </p>
13390 !! end
13391
13392 !! test
13393 Parsoid: Link prefix/suffixes aren't applied to category links
13394 !! options
13395 parsoid=wt2html,wt2wt,html2html
13396 language=is
13397 !! wikitext
13398 x[[Category:Foo]]y
13399 !! html
13400 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13401 !! end
13402
13403 !! test
13404 Parsoid: Serialize link to file page with colon escape
13405 !! options
13406 parsoid
13407 !! wikitext
13408
13409 [[:File:Foo.png]]
13410 [[:File:Foo.png|Bar]]
13411 !! html
13412 <p>
13413 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13414 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13415 </p>
13416 !! end
13417
13418 !! test
13419 Parsoid: Serialize a genuine category link without colon escape
13420 !! options
13421 parsoid
13422 !! wikitext
13423 [[Category:Foo]]
13424 [[Category:Foo|Bar]]
13425 !! html
13426 <link rel="mw:PageProp/Category" href="Category:Foo">
13427 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13428 !! end
13429
13430 !! test
13431 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13432 !! options
13433 parsoid=html2wt
13434 !! html
13435 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13436 !! wikitext
13437 [[Category:Toxine bactérienne]]
13438 !! end
13439
13440 !! test
13441 Parsoid: Defaultsort
13442 !! wikitext
13443 {{DEFAULTSORT:Foo}}
13444 !! html/parsoid
13445 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13446 !! end
13447
13448 !! test
13449 Parsoid: Defaultsort (template-generated)
13450 !! wikitext
13451 {{{{echo|DEFAULTSORT}}:Foo}}
13452 !! html/parsoid
13453 <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}}]}'/>
13454 !! end
13455
13456 ###
13457 ### Inter-language links
13458 ###
13459 !! test
13460 Interlanguage links
13461 !! options
13462 ill
13463 !! wikitext
13464 [[es:Alimento]]
13465 [[fr:Nourriture]]
13466 [[zh:食品]]
13467 !! html/php
13468 es:Alimento fr:Nourriture zh:食品
13469 !! html/parsoid
13470 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13471 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13472 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13473 !! end
13474
13475 !! test
13476 Duplicate interlanguage links (bug 24502)
13477 !! options
13478 ill
13479 !! wikitext
13480 [[es:1]]
13481 [[es:2]]
13482 [[fr:1]]
13483 [[fr:2]]
13484 !! html/php
13485 es:1 fr:1
13486 !! html/parsoid
13487 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13488 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13489 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13490 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13491 !! end
13492
13493 ###
13494 ### Sections
13495 ###
13496 !! test
13497 Basic section headings
13498 !! wikitext
13499 == Headline 1 ==
13500 Some text
13501
13502 ==Headline 2==
13503 More
13504 ===Smaller headline===
13505 Blah blah
13506 !! html
13507 <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>
13508 <p>Some text
13509 </p>
13510 <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>
13511 <p>More
13512 </p>
13513 <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>
13514 <p>Blah blah
13515 </p>
13516 !! end
13517
13518 !! test
13519 Section headings with TOC
13520 !! wikitext
13521 == Headline 1 ==
13522 === Subheadline 1 ===
13523 ===== Skipping a level =====
13524 ====== Skipping a level ======
13525
13526 == Headline 2 ==
13527 Some text
13528 ===Another headline===
13529 !! html
13530 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13531 <ul>
13532 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13533 <ul>
13534 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13535 <ul>
13536 <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>
13537 <ul>
13538 <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>
13539 </ul>
13540 </li>
13541 </ul>
13542 </li>
13543 </ul>
13544 </li>
13545 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13546 <ul>
13547 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13548 </ul>
13549 </li>
13550 </ul>
13551 </div>
13552
13553 <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>
13554 <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>
13555 <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>
13556 <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>
13557 <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>
13558 <p>Some text
13559 </p>
13560 <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>
13561
13562 !! end
13563
13564 !! test
13565 TOC anchors don't collide
13566 !! wikitext
13567 __FORCETOC__
13568 == Headline 2 ==
13569 == Headline ==
13570 == Headline 2 ==
13571 == Headline ==
13572 !! html
13573 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13574 <ul>
13575 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13576 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13577 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13578 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13579 </ul>
13580 </div>
13581
13582 <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>
13583 <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>
13584 <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>
13585 <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>
13586
13587 !! end
13588
13589 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13590 !! test
13591 Handling of sections up to level 6 and beyond
13592 !! wikitext
13593 = Level 1 Heading=
13594 == Level 2 Heading==
13595 === Level 3 Heading===
13596 ==== Level 4 Heading====
13597 ===== Level 5 Heading=====
13598 ====== Level 6 Heading======
13599 ======= Level 7 Heading=======
13600 ======== Level 8 Heading========
13601 ========= Level 9 Heading=========
13602 ========== Level 10 Heading==========
13603 !! html
13604 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13605 <ul>
13606 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13607 <ul>
13608 <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>
13609 <ul>
13610 <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>
13611 <ul>
13612 <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>
13613 <ul>
13614 <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>
13615 <ul>
13616 <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>
13617 <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>
13618 <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>
13619 <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>
13620 <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>
13621 </ul>
13622 </li>
13623 </ul>
13624 </li>
13625 </ul>
13626 </li>
13627 </ul>
13628 </li>
13629 </ul>
13630 </li>
13631 </ul>
13632 </div>
13633
13634 <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>
13635 <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>
13636 <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>
13637 <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>
13638 <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>
13639 <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>
13640 <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>
13641 <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>
13642 <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>
13643 <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>
13644
13645 !! end
13646
13647 !! test
13648 TOC regression (T11764)
13649 !! wikitext
13650 == title 1 ==
13651 === title 1.1 ===
13652 ==== title 1.1.1 ====
13653 === title 1.2 ===
13654 == title 2 ==
13655 === title 2.1 ===
13656 !! html
13657 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13658 <ul>
13659 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13660 <ul>
13661 <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>
13662 <ul>
13663 <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>
13664 </ul>
13665 </li>
13666 <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>
13667 </ul>
13668 </li>
13669 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13670 <ul>
13671 <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>
13672 </ul>
13673 </li>
13674 </ul>
13675 </div>
13676
13677 <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>
13678 <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>
13679 <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>
13680 <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>
13681 <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>
13682 <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>
13683
13684 !! end
13685
13686 !! test
13687 TOC with wgMaxTocLevel=3 (bug 6204)
13688 !! options
13689 wgMaxTocLevel=3
13690 !! wikitext
13691 == title 1 ==
13692 === title 1.1 ===
13693 ==== title 1.1.1 ====
13694 === title 1.2 ===
13695 == title 2 ==
13696 === title 2.1 ===
13697 !! html
13698 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13699 <ul>
13700 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13701 <ul>
13702 <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>
13703 <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>
13704 </ul>
13705 </li>
13706 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13707 <ul>
13708 <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>
13709 </ul>
13710 </li>
13711 </ul>
13712 </div>
13713
13714 <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>
13715 <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>
13716 <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>
13717 <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>
13718 <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>
13719 <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>
13720
13721 !! end
13722
13723 !! test
13724 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13725 !! options
13726 wgMaxTocLevel=3
13727 !! wikitext
13728 ==Section 1==
13729 ===Section 1.1===
13730 ====Section 1.1.1====
13731 ====Section 1.1.1.1====
13732 ==Section 2==
13733 !! html
13734 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13735 <ul>
13736 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13737 <ul>
13738 <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>
13739 </ul>
13740 </li>
13741 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13742 </ul>
13743 </div>
13744
13745 <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>
13746 <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>
13747 <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>
13748 <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>
13749 <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>
13750
13751 !! end
13752
13753
13754 !! test
13755 Resolving duplicate section names
13756 !! wikitext
13757 == Foo bar ==
13758 == Foo bar ==
13759 !! html
13760 <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>
13761 <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>
13762
13763 !! end
13764
13765 !! test
13766 Resolving duplicate section names with differing case (bug 10721)
13767 !! wikitext
13768 == Foo bar ==
13769 == Foo Bar ==
13770 !! html
13771 <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>
13772 <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>
13773
13774 !! end
13775
13776 !! article
13777 Template:sections
13778 !! text
13779 ===Section 1===
13780 ==Section 2==
13781 !! endarticle
13782
13783 !! test
13784 Template with sections, __NOTOC__
13785 !! wikitext
13786 __NOTOC__
13787 ==Section 0==
13788 {{sections}}
13789 ==Section 4==
13790 !! html
13791 <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>
13792 <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>
13793 <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>
13794 <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>
13795
13796 !! end
13797
13798 !! test
13799 __NOEDITSECTION__ keyword
13800 !! wikitext
13801 __NOEDITSECTION__
13802 ==Section 1==
13803 ==Section 2==
13804 !! html
13805 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13806 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13807
13808 !! end
13809
13810 !! test
13811 Link inside a section heading
13812 !! wikitext
13813 ==Section with a [[Main Page|link]] in it==
13814 !! html
13815 <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>
13816
13817 !! end
13818
13819 !! test
13820 TOC regression (T14077)
13821 !! wikitext
13822 __TOC__
13823 == title 1 ==
13824 === title 1.1 ===
13825 == title 2 ==
13826 !! html
13827 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13828 <ul>
13829 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13830 <ul>
13831 <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>
13832 </ul>
13833 </li>
13834 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13835 </ul>
13836 </div>
13837
13838 <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>
13839 <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>
13840 <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>
13841
13842 !! end
13843
13844 !! test
13845 BUG 1219 URL next to image (good)
13846 !! wikitext
13847 http://example.com [[File:Foobar.jpg]]
13848 !! html/php
13849 <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>
13850 </p>
13851 !! html/parsoid
13852 <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>
13853 !!end
13854
13855 !! test
13856 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13857 !! wikitext
13858 ===
13859 The line above must have a trailing space!
13860 === <!--
13861 --> <!-- -->
13862 But just in case it doesn't...
13863 !! html
13864 <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>
13865 <p>The line above must have a trailing space!
13866 </p>
13867 <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>
13868 <p>But just in case it doesn't...
13869 </p>
13870 !! end
13871
13872 !! test
13873 Header with special characters (bug 25462)
13874 !! wikitext
13875 The tooltips shall not show entities to the user (ie. be double escaped)
13876
13877 == text > text ==
13878 section 1
13879
13880 == text < text ==
13881 section 2
13882
13883 == text & text ==
13884 section 3
13885
13886 == text ' text ==
13887 section 4
13888
13889 == text " text ==
13890 section 5
13891 !! html
13892 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13893 </p>
13894 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13895 <ul>
13896 <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>
13897 <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>
13898 <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>
13899 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13900 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13901 </ul>
13902 </div>
13903
13904 <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>
13905 <p>section 1
13906 </p>
13907 <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>
13908 <p>section 2
13909 </p>
13910 <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>
13911 <p>section 3
13912 </p>
13913 <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>
13914 <p>section 4
13915 </p>
13916 <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>
13917 <p>section 5
13918 </p>
13919 !! end
13920
13921 !! test
13922 Header with space, plus and underscore as entity
13923 !! wikitext
13924 Id should not contain + for spaces
13925
13926 == Space between Text ==
13927 section 1
13928
13929 == Space-Entity&#32;between&#32;Text ==
13930 section 2
13931
13932 == Plus+between+Text ==
13933 section 3
13934
13935 == Plus-Entity&#43;between&#43;Text ==
13936 section 4
13937
13938 == Underscore_between_Text ==
13939 section 5
13940
13941 == Underscore-Entity&#95;between&#95;Text ==
13942 section 6
13943
13944 [[#Space between Text]]
13945 [[#Space-Entity&#32;between&#32;Text]]
13946 [[#Plus+between+Text]]
13947 [[#Plus-Entity&#43;between&#43;Text]]
13948 [[#Underscore_between_Text]]
13949 [[#Underscore-Entity&#95;between&#95;Text]]
13950 !! html
13951 <p>Id should not contain + for spaces
13952 </p>
13953 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13954 <ul>
13955 <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>
13956 <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>
13957 <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>
13958 <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>
13959 <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>
13960 <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>
13961 </ul>
13962 </div>
13963
13964 <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>
13965 <p>section 1
13966 </p>
13967 <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>
13968 <p>section 2
13969 </p>
13970 <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>
13971 <p>section 3
13972 </p>
13973 <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>
13974 <p>section 4
13975 </p>
13976 <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>
13977 <p>section 5
13978 </p>
13979 <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>
13980 <p>section 6
13981 </p><p><a href="#Space_between_Text">#Space between Text</a>
13982 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13983 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13984 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13985 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13986 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13987 </p>
13988 !! end
13989
13990 !! test
13991 Headers with excess '=' characters
13992 (Are similar tests necessary beyond the 1st level?)
13993 !! wikitext
13994 =foo==
13995 ==foo=
13996 =''italic'' heading==
13997 ==''italic'' heading=
13998 !! html
13999 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14000 <ul>
14001 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14002 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14003 <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>
14004 <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>
14005 </ul>
14006 </div>
14007
14008 <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>
14009 <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>
14010 <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>
14011 <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>
14012
14013 !! end
14014
14015 !! test
14016 HTML headers vs TOC (bug 23393)
14017 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14018 !! wikitext
14019 <h1>Header 1</h1>
14020 == Header 1.1 ==
14021 == Header 1.2 ==
14022
14023 <h1>Header 2
14024 </h1>
14025 == Header 2.1 ==
14026 == Header 2.2 ==
14027 __NOEDITSECTION__
14028 !! html
14029 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14030 <ul>
14031 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14032 <ul>
14033 <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>
14034 <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>
14035 </ul>
14036 </li>
14037 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14038 <ul>
14039 <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>
14040 <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>
14041 </ul>
14042 </li>
14043 </ul>
14044 </div>
14045
14046 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14047 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14048 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14049 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14050 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14051 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14052
14053 !! end
14054
14055 !! test
14056 Single-line or multiline-comments can follow headings
14057 !! options
14058 parsoid=wt2html,wt2wt
14059 !! wikitext
14060 ==foo==<!---->
14061 ==bar==<!--c1-->
14062 ==baz==<!--
14063 c2
14064 c3-->
14065 !! html
14066 <h2><span class="mw-headline" id="foo">foo</span></h2>
14067 <h2><span class="mw-headline" id="bar">bar</span></h2>
14068 <h2><span class="mw-headline" id="baz">baz</span></h2>
14069
14070 !! end
14071
14072 !! test
14073 BUG 1219 URL next to image (broken)
14074 !! wikitext
14075 http://example.com[[File:Foobar.jpg]]
14076 !! html/php
14077 <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>
14078 </p>
14079 !! html/parsoid
14080 <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>
14081 !!end
14082
14083 !! test
14084 Bug 1186 news: in the middle of text
14085 !! wikitext
14086 http://en.wikinews.org/wiki/Wikinews:Workplace
14087 !! html
14088 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14089 </p>
14090 !!end
14091
14092
14093 !! test
14094 Namespaced link must have a title
14095 !! wikitext
14096 [[Project:]]
14097 !! html
14098 <p>[[Project:]]
14099 </p>
14100 !!end
14101
14102 !! test
14103 Namespaced link must have a title (bad fragment version)
14104 !! wikitext
14105 [[Project:#fragment]]
14106 !! html
14107 <p>[[Project:#fragment]]
14108 </p>
14109 !!end
14110
14111
14112 ###
14113 ### HTML tags and HTML attributes
14114 ###
14115
14116 !! test
14117 div with no attributes
14118 !! wikitext
14119 <div>HTML rocks</div>
14120 !! html
14121 <div>HTML rocks</div>
14122
14123 !! end
14124
14125 !! test
14126 div with double-quoted attribute
14127 !! wikitext
14128 <div id="rock">HTML rocks</div>
14129 !! html
14130 <div id="rock">HTML rocks</div>
14131
14132 !! end
14133
14134 !! test
14135 div with single-quoted attribute
14136 !! wikitext
14137 <div id='rock'>HTML rocks</div>
14138 !! html
14139 <div id="rock">HTML rocks</div>
14140
14141 !! end
14142
14143 !! test
14144 div with unquoted attribute
14145 !! wikitext
14146 <div id=rock>HTML rocks</div>
14147 !! html
14148 <div id="rock">HTML rocks</div>
14149
14150 !! end
14151
14152 !! test
14153 div with illegal double attributes
14154 !! wikitext
14155 <div id="a" id="b">HTML rocks</div>
14156 !! html
14157 <div id="b">HTML rocks</div>
14158
14159 !!end
14160
14161 # FIXME: produce empty string instead of "class" in the PHP parser, following
14162 # the HTML5 spec.
14163 !! test
14164 div with empty attribute value, space before equals
14165 !! options
14166 parsoid
14167 !! wikitext
14168 <div class =>HTML rocks</div>
14169 !! html
14170 <div class="">HTML rocks</div>
14171
14172 !! end
14173
14174 !! test
14175 div with multiple empty attribute values
14176 !! options
14177 parsoid
14178 !! wikitext
14179 <div id= title=>HTML rocks</div>
14180 !! html
14181 <div id="" title="">HTML rocks</div>
14182
14183 !! end
14184
14185 !! test
14186 table with multiple empty attribute values
14187 !! options
14188 parsoid
14189 !! wikitext
14190 {| title= id=
14191 | hi
14192 |}
14193 !! html
14194 <table title="" id="">
14195 <tbody><tr><td> hi</td></tr>
14196 </tbody></table>
14197 !! end
14198
14199 !! test
14200 div with braces in attribute value
14201 !! wikitext
14202 <div title="{}">Foo</div>
14203 !! html/php
14204 <div title="&#123;}">Foo</div>
14205
14206 !! html/parsoid
14207 <div title="{}">Foo</div>
14208 !! end
14209
14210 # This it very inconsistent in the PHP parser: it returns
14211 # class="class" if there is a space between the name and the equal sign (see
14212 # 'div with empty attribute value, space before equals'), but strips the
14213 # attribute completely if the space is missing. We hope that not much content
14214 # depends on this, so are implementing the behavior below in Parsoid for
14215 # consistencies' sake.
14216 # FIXME: fix this behavior in the PHP parser?
14217 !! test
14218 div with empty attribute value, no space before equals
14219 !! options
14220 parsoid=wt2html,html2html
14221 !! wikitext
14222 <div class=>HTML rocks</div>
14223 !! html/php
14224 <div>HTML rocks</div>
14225
14226 !! html/parsoid
14227 <div class="">HTML rocks</div>
14228 !! end
14229
14230 !! test
14231 HTML multiple attributes correction
14232 !! wikitext
14233 <p class="error" class="awesome">Awesome!</p>
14234 !! html
14235 <p class="awesome">Awesome!</p>
14236
14237 !!end
14238
14239 !! test
14240 Table multiple attributes correction
14241 !! wikitext
14242 {|
14243 !+ class="error" class="awesome"| status
14244 |}
14245 !! html
14246 <table>
14247 <tr>
14248 <th class="awesome"> status
14249 </th></tr></table>
14250
14251 !!end
14252
14253 !! test
14254 DIV IN UPPERCASE
14255 !! wikitext
14256 <DIV ID="x">HTML ROCKS</DIV>
14257 !! html
14258 <div id="x">HTML ROCKS</div>
14259
14260 !!end
14261
14262 !! test
14263 Non-ASCII pseudo-tags are rendered as text
14264 !! wikitext
14265 <khyô>
14266 !! html
14267 <p>&lt;khyô&gt;
14268 </p>
14269 !! end
14270
14271 !! test
14272 Pseudo-tag with URL 'name' renders as url link
14273 !! wikitext
14274 <http://example.com/>
14275 !! html
14276 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14277 </p>
14278 !! end
14279
14280 !! test
14281 text with amp in the middle of nowhere
14282 !! wikitext
14283 Remember AT&T?
14284 !! html
14285 <p>Remember AT&amp;T?
14286 </p>
14287 !! end
14288
14289 !! test
14290 text with character entity: eacute
14291 !! wikitext
14292 I always thought &eacute; was a cute letter.
14293 !! html
14294 <p>I always thought &#233; was a cute letter.
14295 </p>
14296 !! html+tidy
14297 <p>I always thought é was a cute letter.</p>
14298 !! end
14299
14300 !! test
14301 text with entity-escaped character entity-like string: eacute
14302 !! wikitext
14303 I always thought &amp;eacute; was a cute letter.
14304 !! html
14305 <p>I always thought &amp;eacute; was a cute letter.
14306 </p>
14307 !! end
14308
14309 !! test
14310 text with undefined character entity: xacute
14311 !! wikitext
14312 I always thought &xacute; was a cute letter.
14313 !! html
14314 <p>I always thought &amp;xacute; was a cute letter.
14315 </p>
14316 !! end
14317
14318 # TODO: generalize to PHP parser?
14319 !! test
14320 HTML5 tags
14321 !! options
14322 parsoid
14323 !! wikitext
14324 <data value="5">five</data>
14325 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14326 <mark>This highlighted text</mark>
14327 !! html
14328 <p><data value="5">five</data>
14329 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14330 <mark>This highlighted text</mark></p>
14331 !! end
14332
14333 !! test
14334 HTML tag with leading space is parsed as text
14335 !! wikitext
14336 < div>foo< /div>
14337 !! html
14338 <p>&lt; div&gt;foo&lt; /div&gt;
14339 </p>
14340 !! end
14341
14342 ###
14343 ### Nesting tests (see bug 41545, 50604, 51081)
14344 ###
14345
14346 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14347 # Note that html2wt is considerably more difficult if we use <b> in
14348 # the test case, instead of <big>
14349 !! test
14350 Ensure that HTML adoption agency algorithm is properly implemented.
14351 !! wikitext
14352 <big>X<big>Y</big>Z</big>
14353 !! html
14354 <p><big>X<big>Y</big>Z</big>
14355 </p>
14356 !! end
14357
14358 # This was bug 41545 in the PHP parser.
14359 # Note that tidy doesn't handle this correctly.
14360 !! test
14361 Nesting of <kbd>
14362 !! wikitext
14363 <kbd>X<kbd>Y</kbd>Z</kbd>
14364 !! html
14365 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14366 </p>
14367 !! end
14368
14369 # The following cases were bug 51081 in the PHP parser.
14370 # Note that there are some other nestable tags (b, i, etc) which are
14371 # not covered; see bug 51081 for discussion.
14372
14373 # Note that tidy doesn't handle this correctly.
14374 !! test
14375 Nesting of <em>
14376 !! wikitext
14377 <em>X<em>Y</em>Z</em>
14378 !! html
14379 <p><em>X<em>Y</em>Z</em>
14380 </p>
14381 !! end
14382
14383 # Note that tidy doesn't handle this correctly.
14384 !! test
14385 Nesting of <strong>
14386 !! wikitext
14387 <strong>X<strong>Y</strong>Z</strong>
14388 !! html
14389 <p><strong>X<strong>Y</strong>Z</strong>
14390 </p>
14391 !! end
14392
14393 !! test
14394 Nesting of <q>
14395 !! wikitext
14396 <q>X<q>Y</q>Z</q>
14397 !! html+tidy
14398 <p><q>X<q>Y</q>Z</q></p>
14399 !! end
14400
14401 # Note that tidy doesn't handle this correctly.
14402 !! test
14403 Nesting of <ruby>
14404 !! wikitext
14405 <ruby>X<ruby>Y</ruby>Z</ruby>
14406 !! html
14407 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14408 </p>
14409 !! end
14410
14411 # Note that tidy doesn't handle this correctly.
14412 !! test
14413 Nesting of <bdo>
14414 !! wikitext
14415 <bdo>X<bdo>Y</bdo>Z</bdo>
14416 !! html
14417 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14418 </p>
14419 !! end
14420
14421
14422 ###
14423 ### Media links
14424 ###
14425
14426 !! test
14427 Media link
14428 !! wikitext
14429 [[Media:Foobar.jpg]]
14430 !! html
14431 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14432 </p>
14433 !! end
14434
14435 !! test
14436 Media link with text
14437 !! wikitext
14438 [[Media:Foobar.jpg|A neat file to look at]]
14439 !! html
14440 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14441 </p>
14442 !! end
14443
14444 # FIXME: this is still bad HTML tag nesting
14445 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
14446 !! test
14447 Media link with nasty text
14448 !! wikitext
14449 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14450 !! html
14451 <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>
14452
14453 !! html+tidy
14454 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
14455 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
14456 !! end
14457
14458 !! test
14459 Media link to nonexistent file (bug 1702)
14460 !! wikitext
14461 [[Media:No such.jpg]]
14462 !! html
14463 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14464 </p>
14465 !! end
14466
14467 !! test
14468 Image link to nonexistent file (bug 1850 - good)
14469 !! wikitext
14470 [[File:No_such.jpg]]
14471 !! html/php
14472 <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>
14473 </p>
14474 !! html/parsoid
14475 <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>
14476 !! end
14477
14478 !! test
14479 :Image link to nonexistent file (bug 1850 - bad)
14480 !! wikitext
14481 [[:Image:No such.jpg]]
14482 !! html/php
14483 <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>
14484 </p>
14485 !! html/parsoid
14486 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14487 !! end
14488
14489
14490
14491 !! test
14492 Character reference normalization in link text (bug 1938)
14493 !! wikitext
14494 [[Main Page|this&that]]
14495 !! html
14496 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14497 </p>
14498 !!end
14499
14500 !! article
14501 אַ
14502 !! text
14503 Test for unicode normalization
14504
14505 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14506 !! endarticle
14507
14508 !! test
14509 (bug 19451) Links should refer to the normalized form.
14510 !! wikitext
14511 [[&#xFB2E;]]
14512 [[&#x5d0;&#x5b7;]]
14513 [[&#x5d0;ַ]]
14514 [[א&#x5b7;]]
14515 [[אַ]]
14516 !! html
14517 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14518 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14519 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14520 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14521 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14522 </p>
14523 !! end
14524
14525 !! test
14526 Empty attribute crash test (bug 2067)
14527 !! wikitext
14528 <font color="">foo</font>
14529 !! html
14530 <p><font color="">foo</font>
14531 </p>
14532 !! end
14533
14534 !! test
14535 Empty attribute crash test single-quotes (bug 2067)
14536 !! wikitext
14537 <font color=''>foo</font>
14538 !! html
14539 <p><font color="">foo</font>
14540 </p>
14541 !! end
14542
14543 !! test
14544 Attribute test: equals, then nothing
14545 !! wikitext
14546 <font color=>foo</font>
14547 !! html
14548 <p><font>foo</font>
14549 </p>
14550 !! end
14551
14552 !! test
14553 Attribute test: unquoted value
14554 !! wikitext
14555 <font color=x>foo</font>
14556 !! html
14557 <p><font color="x">foo</font>
14558 </p>
14559 !! end
14560
14561 !! test
14562 Attribute test: unquoted but illegal value (hash)
14563 !! wikitext
14564 <font color=#x>foo</font>
14565 !! html
14566 <p><font color="#x">foo</font>
14567 </p>
14568 !! end
14569
14570 !! test
14571 Attribute test: no value
14572 !! wikitext
14573 <font color>foo</font>
14574 !! html
14575 <p><font color="color">foo</font>
14576 </p>
14577 !! end
14578
14579 !! test
14580 Bug 2095: link with three closing brackets
14581 !! wikitext
14582 [[Main Page]]]
14583 !! html/php
14584 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14585 </p>
14586 !! html/parsoid
14587 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14588 !! end
14589
14590 !! test
14591 Bug 2095: link with pipe and three closing brackets
14592 !! wikitext
14593 [[Main Page|link]]]
14594 !! html/php
14595 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14596 </p>
14597 !! html/parsoid
14598 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14599 !! end
14600
14601 !! test
14602 Bug 2095: link with pipe and three closing brackets, version 2
14603 !! wikitext
14604 [[Main Page|[http://example.com/]]]
14605 !! html/php
14606 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14607 </p>
14608 !! html/parsoid
14609 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14610 !! end
14611
14612
14613 ###
14614 ### Safety
14615 ###
14616
14617 !! article
14618 Template:Dangerous attribute
14619 !! text
14620 " onmouseover="alert(document.cookie)
14621 !! endarticle
14622
14623 !! article
14624 Template:Dangerous style attribute
14625 !! text
14626 border-size: expression(alert(document.cookie))
14627 !! endarticle
14628
14629 !! article
14630 Template:Div style
14631 !! text
14632 <div style="float: right; {{{1}}}">Magic div</div>
14633 !! endarticle
14634
14635 !! test
14636 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14637 !! wikitext
14638 <div title="{{test}}"></div>
14639 !! html
14640 <div title="This is a test template"></div>
14641
14642 !! end
14643
14644 # Parsoid has enough context to handle this case
14645 !! test
14646 Bug 2304: HTML attribute safety (dangerous template; 2309)
14647 !! wikitext
14648 <div title="{{dangerous attribute}}"></div>
14649 !! html/php
14650 <div title=""></div>
14651
14652 !! html/parsoid
14653 <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>
14654 !! end
14655
14656 !! test
14657 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14658 !! wikitext
14659 <div style="{{dangerous style attribute}}"></div>
14660 !! html
14661 <div style="/* insecure input */"></div>
14662
14663 !! end
14664
14665 !! test
14666 Bug 2304: HTML attribute safety (safe parameter; 2309)
14667 !! wikitext
14668 {{div style|width: 200px}}
14669 !! html
14670 <div style="float: right; width: 200px">Magic div</div>
14671
14672 !! end
14673
14674 !! test
14675 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14676 !! wikitext
14677 {{div style|width: expression(alert(document.cookie))}}
14678 !! html
14679 <div style="/* insecure input */">Magic div</div>
14680
14681 !! end
14682
14683 !! test
14684 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14685 !! wikitext
14686 {{div style|"><script>alert(document.cookie)</script>}}
14687 !! html
14688 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14689
14690 !! end
14691
14692 !! test
14693 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14694 !! wikitext
14695 {{div style|" ><script>alert(document.cookie)</script>}}
14696 !! html
14697 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14698
14699 !! end
14700
14701 !! test
14702 Bug 2304: HTML attribute safety (link)
14703 !! wikitext
14704 <div title="[[Main Page]]"></div>
14705 !! html
14706 <div title="&#91;&#91;Main Page]]"></div>
14707
14708 !! end
14709
14710 !! test
14711 Bug 2304: HTML attribute safety (italics)
14712 !! wikitext
14713 <div title="''foobar''"></div>
14714 !! html
14715 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14716
14717 !! end
14718
14719 !! test
14720 Bug 2304: HTML attribute safety (bold)
14721 !! wikitext
14722 <div title="'''foobar'''"></div>
14723 !! html
14724 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14725
14726 !! end
14727
14728
14729 !! test
14730 Bug 2304: HTML attribute safety (ISBN)
14731 !! wikitext
14732 <div title="ISBN 1234567890"></div>
14733 !! html
14734 <div title="&#73;SBN 1234567890"></div>
14735
14736 !! end
14737
14738 !! test
14739 Bug 2304: HTML attribute safety (RFC)
14740 !! wikitext
14741 <div title="RFC 1234"></div>
14742 !! html
14743 <div title="&#82;FC 1234"></div>
14744
14745 !! end
14746
14747 !! test
14748 Bug 2304: HTML attribute safety (PMID)
14749 !! wikitext
14750 <div title="PMID 1234567890"></div>
14751 !! html
14752 <div title="&#80;MID 1234567890"></div>
14753
14754 !! end
14755
14756 !! test
14757 Bug 2304: HTML attribute safety (web link)
14758 !! wikitext
14759 <div title="http://example.com/"></div>
14760 !! html
14761 <div title="http&#58;//example.com/"></div>
14762
14763 !! end
14764
14765 !! test
14766 Bug 2304: HTML attribute safety (named web link)
14767 !! wikitext
14768 <div title="[http://example.com/ link]"></div>
14769 !! html
14770 <div title="&#91;http&#58;//example.com/ link]"></div>
14771
14772 !! end
14773
14774 !! test
14775 Bug 3244: HTML attribute safety (extension; safe)
14776 !! wikitext
14777 <div style="<nowiki>background:blue</nowiki>"></div>
14778 !! html
14779 <div style="background:blue"></div>
14780
14781 !! end
14782
14783 !! test
14784 Bug 3244: HTML attribute safety (extension; unsafe)
14785 !! wikitext
14786 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14787 !! html
14788 <div style="/* insecure input */"></div>
14789
14790 !! end
14791
14792 # More MSIE fun discovered by Tom Gilder
14793
14794 !! test
14795 MSIE CSS safety test: spurious slash
14796 !! wikitext
14797 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14798 !! html
14799 <div style="/* insecure input */">evil</div>
14800
14801 !! end
14802
14803 !! test
14804 MSIE CSS safety test: hex code
14805 !! wikitext
14806 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14807 !! html
14808 <div style="/* insecure input */">evil</div>
14809
14810 !! end
14811
14812 !! test
14813 MSIE CSS safety test: comment in url
14814 !! wikitext
14815 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14816 !! html
14817 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14818
14819 !! end
14820
14821 !! test
14822 MSIE CSS safety test: comment in expression
14823 !! wikitext
14824 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14825 !! html
14826 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14827
14828 !! end
14829
14830 !! test
14831 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14832 !! wikitext
14833 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14834 !! html
14835 <p style="/* invalid control char */">A</p>
14836
14837 !! end
14838
14839 !! test
14840 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14841 !! wikitext
14842 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14843 <div style="top:EXPRESSION(alert())">B</div>
14844 !! html
14845 <p style="/* insecure input */">A</p>
14846 <div style="/* insecure input */">B</div>
14847
14848 !! end
14849
14850 !! test
14851 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14852 !! wikitext
14853 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14854 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14855 !! html
14856 <div style="/* insecure input */">A</div>
14857 <p style="/* insecure input */">B</p>
14858
14859 !! end
14860
14861 !! test
14862 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14863 !! wikitext
14864 <div style="background-image:url⁽javascript:alert())">A</div>
14865 <div style="background-image:url₍javascript:alert())">B</div>
14866 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14867 !! html
14868 <div style="/* insecure input */">A</div>
14869 <div style="/* insecure input */">B</div>
14870 <p style="/* insecure input */">C</p>
14871
14872 !! end
14873
14874 !! test
14875 Opera -o-link CSS
14876 !! wikitext
14877 <div
14878 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;"
14879 style="-o-link:attr(title);-o-link-source:current">X</div>
14880 !! html
14881 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14882
14883 !! end
14884
14885 !! test
14886 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14887 !! wikitext
14888 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14889 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14890 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14891 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14892 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14893 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14894 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14895 !! html
14896 <p style="/* insecure input */">A</p>
14897 <p style="/* insecure input */">B</p>
14898 <p style="/* insecure input */">C</p>
14899 <p style="/* insecure input */">D</p>
14900 <p style="/* insecure input */">E</p>
14901 <p style="/* insecure input */">F</p>
14902 <p style="/* insecure input */">G</p>
14903
14904 !! end
14905
14906 !! test
14907 Table attribute legitimate extension
14908 !! wikitext
14909 {|
14910 !+ style="<nowiki>color:blue</nowiki>"| status
14911 |}
14912 !! html
14913 <table>
14914 <tr>
14915 <th style="color:blue"> status
14916 </th></tr></table>
14917
14918 !!end
14919
14920 !! test
14921 Table attribute safety
14922 !! wikitext
14923 {|
14924 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14925 |}
14926 !! html
14927 <table>
14928 <tr>
14929 <th style="/* insecure input */"> status
14930 </th></tr></table>
14931
14932 !! end
14933
14934 !! test
14935 CSS line continuation 1
14936 !! wikitext
14937 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14938 !! html
14939 <div style="/* insecure input */"></div>
14940
14941 !! end
14942
14943 !! test
14944 CSS line continuation 2
14945 !! wikitext
14946 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14947 !! html
14948 <div style="/* insecure input */"></div>
14949
14950 !! end
14951
14952 !! article
14953 Template:Identity
14954 !! text
14955 {{{1}}}
14956 !! endarticle
14957
14958 !! test
14959 Expansion of multi-line templates in attribute values (bug 6255)
14960 !! wikitext
14961 <div style="background: {{identity|#00FF00}}">-</div>
14962 !! html
14963 <div style="background: #00FF00">-</div>
14964
14965 !! end
14966
14967
14968 !! test
14969 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14970 !! wikitext
14971 <div style="background:
14972 #00FF00">-</div>
14973 !! html/php
14974 <div style="background: #00FF00">-</div>
14975
14976 !! html/parsoid
14977 <div style="background:
14978 #00FF00">-</div>
14979 !! end
14980
14981 !! test
14982 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14983 !! wikitext
14984 <div style="background: &#10;#00FF00">-</div>
14985 !! html
14986 <div style="background: &#10;#00FF00">-</div>
14987
14988 !! end
14989
14990 !! test
14991 evil <math>-wiki-tags without Extension:Math enabled
14992 !! wikitext
14993 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14994 !! html+tidy
14995 <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>
14996 !! end
14997
14998 ###
14999 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15000 ###
15001 !! test
15002 Parser hook: empty input
15003 !! wikitext
15004 <tag></tag>
15005 !! html
15006 <pre>
15007 ''
15008 array (
15009 )
15010 </pre>
15011
15012 !! end
15013
15014 !! test
15015 Parser hook: empty input using terminated empty elements
15016 !! wikitext
15017 <tag/>
15018 !! html
15019 <pre>
15020 NULL
15021 array (
15022 )
15023 </pre>
15024
15025 !! end
15026
15027 !! test
15028 Parser hook: empty input using terminated empty elements (space before)
15029 !! wikitext
15030 <tag />
15031 !! html
15032 <pre>
15033 NULL
15034 array (
15035 )
15036 </pre>
15037
15038 !! end
15039
15040 !! test
15041 Parser hook: basic input
15042 !! wikitext
15043 <tag>input</tag>
15044 !! html
15045 <pre>
15046 'input'
15047 array (
15048 )
15049 </pre>
15050
15051 !! end
15052
15053
15054 !! test
15055 Parser hook: case insensitive
15056 !! wikitext
15057 <TAG>input</TAG>
15058 !! html
15059 <pre>
15060 'input'
15061 array (
15062 )
15063 </pre>
15064
15065 !! end
15066
15067
15068 !! test
15069 Parser hook: case insensitive, redux
15070 !! wikitext
15071 <TaG>input</TAg>
15072 !! html
15073 <pre>
15074 'input'
15075 array (
15076 )
15077 </pre>
15078
15079 !! end
15080
15081 !! test
15082 Parser hook: nested tags
15083 !! options
15084 noxml
15085 !! wikitext
15086 <tag><tag></tag></tag>
15087 !! html
15088 <pre>
15089 '<tag>'
15090 array (
15091 )
15092 </pre>&lt;/tag&gt;
15093
15094 !! end
15095
15096 !! test
15097 Parser hook: basic arguments
15098 !! wikitext
15099 <tag width=200 height = "100" depth = '50' square></tag>
15100 !! html
15101 <pre>
15102 ''
15103 array (
15104 'width' => '200',
15105 'height' => '100',
15106 'depth' => '50',
15107 'square' => 'square',
15108 )
15109 </pre>
15110
15111 !! end
15112
15113 !! test
15114 Parser hook: argument containing a forward slash (bug 5344)
15115 !! wikitext
15116 <tag filename='/tmp/bla'></tag>
15117 !! html
15118 <pre>
15119 ''
15120 array (
15121 'filename' => '/tmp/bla',
15122 )
15123 </pre>
15124
15125 !! end
15126
15127 !! test
15128 Parser hook: empty input using terminated empty elements (bug 2374)
15129 !! wikitext
15130 <tag foo=bar/>text
15131 !! html
15132 <pre>
15133 NULL
15134 array (
15135 'foo' => 'bar',
15136 )
15137 </pre>text
15138
15139 !! end
15140
15141 # </tag> should be output literally since there is no matching tag that begins it
15142 !! test
15143 Parser hook: basic arguments using terminated empty elements (bug 2374)
15144 !! wikitext
15145 <tag width=200 height = "100" depth = '50' square/>
15146 other stuff
15147 </tag>
15148 !! html
15149 <pre>
15150 NULL
15151 array (
15152 'width' => '200',
15153 'height' => '100',
15154 'depth' => '50',
15155 'square' => 'square',
15156 )
15157 </pre>
15158 <p>other stuff
15159 &lt;/tag&gt;
15160 </p>
15161 !! end
15162
15163 ###
15164 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15165 ###
15166
15167 !! test
15168 Parser hook: static parser hook not inside a comment
15169 !! wikitext
15170 <statictag>hello, world</statictag>
15171 <statictag action=flush/>
15172 !! html
15173 <p>hello, world
15174 </p>
15175 !! end
15176
15177
15178 !! test
15179 Parser hook: static parser hook inside a comment
15180 !! wikitext
15181 <!-- <statictag>hello, world</statictag> -->
15182 <statictag action=flush/>
15183 !! html
15184 <p><br />
15185 </p>
15186 !! end
15187
15188 # Nested template calls; this case was broken by Parser.php rev 1.506,
15189 # since reverted.
15190
15191 !! article
15192 Template:One-parameter
15193 !! text
15194 (My parameter is: {{{1}}})
15195 !! endarticle
15196
15197 !! article
15198 Template:Map-one-parameter
15199 !! text
15200 {{{{{1}}}|{{{2}}}}}
15201 !! endarticle
15202
15203 !! test
15204 Nested template calls
15205 !! wikitext
15206 {{Map-one-parameter|One-parameter|param}}
15207 !! html
15208 <p>(My parameter is: param)
15209 </p>
15210 !! end
15211
15212
15213 ###
15214 ### Sanitizer
15215 ###
15216
15217 # HTML+Tidy effectively strips out the empty tags completely
15218 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15219 # which Tidy would have done for the PHP parser had there been content inside it.
15220 !! test
15221 Sanitizer: Closing of open tags
15222 !! wikitext
15223 <s></s><table></table>
15224 !! html
15225 <s></s><table></table>
15226
15227 !! html/parsoid
15228 <p><s></s></p><table></table>
15229 !! end
15230
15231 !! test
15232 Sanitizer: Closing of open but not closed tags
15233 !! wikitext
15234 <s>foo
15235 !! html
15236 <p><s>foo</s>
15237 </p>
15238 !! end
15239
15240 !! test
15241 Sanitizer: Closing of closed but not open tags
15242 !! wikitext
15243 </s>
15244 !! html
15245 <p>&lt;/s&gt;
15246 </p>
15247 !! end
15248
15249 !! test
15250 Sanitizer: Closing of closed but not open table tags
15251 !! wikitext
15252 Table not started</td></tr></table>
15253 !! html
15254 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15255 </p>
15256 !! end
15257
15258 !! test
15259 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15260 !! wikitext
15261 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15262 !! html
15263 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15264 </p>
15265 !! end
15266
15267 # In HTML5, the restrictions are that id must contain at least one character,
15268 # and must not contain any space characters.
15269 !! test
15270 Sanitizer: Validating the contents of the id attribute (bug 4515)
15271 !! options
15272 disabled
15273 !! wikitext
15274 <br id="" /><br id="a space" />
15275 !! html
15276 Something ...
15277 !! end
15278
15279 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15280 !! test
15281 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15282 !! options
15283 disabled
15284 !! wikitext
15285 <br id="foo" /><br id="foo" />
15286 !! html
15287 Something need to be done. foo-2 ?
15288 !! end
15289
15290 !! test
15291 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15292 !! wikitext
15293 <div itemscope>
15294 <meta itemprop="hello" content="world">
15295 <meta http-equiv="refresh" content="5">
15296 <meta itemprop="hello" http-equiv="refresh" content="5">
15297 <link itemprop="hello" href="{{SERVER}}">
15298 <link rel="stylesheet" href="{{SERVER}}">
15299 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15300 </div>
15301 !! html
15302 <div itemscope="itemscope">
15303 <p> <meta itemprop="hello" content="world" />
15304 &lt;meta http-equiv="refresh" content="5"&gt;
15305 <meta itemprop="hello" content="5" />
15306 </p>
15307 <link itemprop="hello" href="http&#58;//example.org" />
15308 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15309 <link itemprop="hello" href="http&#58;//example.org" />
15310 </div>
15311
15312 !! end
15313
15314 !! test
15315 Language converter: output gets cut off unexpectedly (bug 5757)
15316 !! options
15317 language=zh
15318 !! wikitext
15319 this bit is safe: }-
15320
15321 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15322
15323 then we get cut off here: }-
15324
15325 all additional text is vanished
15326 !! html
15327 <p>this bit is safe: }-
15328 </p><p>but if we add a conversion instance: xxx
15329 </p><p>then we get cut off here: }-
15330 </p><p>all additional text is vanished
15331 </p>
15332 !! end
15333
15334 !! test
15335 Self closed html pairs (bug 5487)
15336 !! options
15337 !! wikitext
15338 <center><font id="bug" />Centered text</center>
15339 <div><font id="bug2" />In div text</div>
15340 !! html
15341 <center>&lt;font id="bug" /&gt;Centered text</center>
15342 <div>&lt;font id="bug2" /&gt;In div text</div>
15343
15344 !! end
15345
15346 #
15347 #
15348 #
15349
15350 !! test
15351 Punctuation: nbsp before exclamation
15352 !! wikitext
15353 C'est grave !
15354 !! html
15355 <p>C'est grave&#160;!
15356 </p>
15357 !! end
15358
15359 !! test
15360 Punctuation: CSS !important (bug 11874)
15361 !! wikitext
15362 <div style="width:50% !important">important</div>
15363 !! html
15364 <div style="width:50% !important">important</div>
15365
15366 !!end
15367
15368 !! test
15369 Punctuation: CSS ! important (bug 11874; with space after)
15370 !! wikitext
15371 <div style="width:50% ! important">important</div>
15372 !! html
15373 <div style="width:50% ! important">important</div>
15374
15375 !!end
15376
15377 !! test
15378 HTML bullet list, closed tags (bug 5497)
15379 !! wikitext
15380 <ul>
15381 <li>One</li>
15382 <li>Two</li>
15383 </ul>
15384 !! html/php
15385 <ul>
15386 <li>One</li>
15387 <li>Two</li>
15388 </ul>
15389
15390 !! html/parsoid
15391 <ul data-parsoid='{"stx":"html"}'>
15392 <li data-parsoid='{"stx":"html"}'>One</li>
15393 <li data-parsoid='{"stx":"html"}'>Two</li>
15394 </ul>
15395
15396 !! end
15397
15398 !! test
15399 HTML bullet list, unclosed tags (bug 5497)
15400 !! wikitext
15401 <ul>
15402 <li>One
15403 <li>Two
15404 </ul>
15405 !! html/php+tidy
15406 <ul>
15407 <li>One</li>
15408 <li>Two</li>
15409 </ul>
15410 !! html/parsoid
15411 <ul data-parsoid='{"stx":"html"}'>
15412 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15413 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15414 </ul>
15415
15416 !! end
15417
15418 !! test
15419 HTML ordered list, closed tags (bug 5497)
15420 !! wikitext
15421 <ol>
15422 <li>One</li>
15423 <li>Two</li>
15424 </ol>
15425 !! html/php
15426 <ol>
15427 <li>One</li>
15428 <li>Two</li>
15429 </ol>
15430
15431 !! html/parsoid
15432 <ol data-parsoid='{"stx":"html"}'>
15433 <li data-parsoid='{"stx":"html"}'>One</li>
15434 <li data-parsoid='{"stx":"html"}'>Two</li>
15435 </ol>
15436
15437 !! end
15438
15439 !! test
15440 HTML ordered list, unclosed tags (bug 5497)
15441 !! options
15442 !! wikitext
15443 <ol>
15444 <li>One
15445 <li>Two
15446 </ol>
15447 !! html/php+tidy
15448 <ol>
15449 <li>One</li>
15450 <li>Two</li>
15451 </ol>
15452 !! html/parsoid
15453 <ol data-parsoid='{"stx":"html"}'>
15454 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15455 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15456 </ol>
15457
15458 !! end
15459
15460 !! test
15461 HTML nested bullet list, closed tags (bug 5497)
15462 !! wikitext
15463 <ul>
15464 <li>One</li>
15465 <li>Two:
15466 <ul>
15467 <li>Sub-one</li>
15468 <li>Sub-two</li>
15469 </ul>
15470 </li>
15471 </ul>
15472 !! html
15473 <ul>
15474 <li>One</li>
15475 <li>Two:
15476 <ul>
15477 <li>Sub-one</li>
15478 <li>Sub-two</li>
15479 </ul>
15480 </li>
15481 </ul>
15482
15483 !! end
15484
15485 !! test
15486 HTML nested bullet list, open tags (bug 5497)
15487 !! wikitext
15488 <ul>
15489 <li>One
15490 <li>Two:
15491 <ul>
15492 <li>Sub-one
15493 <li>Sub-two
15494 </ul>
15495 </ul>
15496 !! html/php+tidy
15497 <ul>
15498 <li>One</li>
15499 <li>Two:
15500 <ul>
15501 <li>Sub-one</li>
15502 <li>Sub-two</li>
15503 </ul>
15504 </li>
15505 </ul>
15506 !! html/parsoid
15507 <ul>
15508 <li>One
15509 </li>
15510 <li>Two:
15511 <ul>
15512 <li>Sub-one
15513 </li>
15514 <li>Sub-two
15515 </li>
15516 </ul>
15517 </li>
15518 </ul>
15519
15520 !! end
15521
15522 !! test
15523 HTML nested ordered list, closed tags (bug 5497)
15524 !! wikitext
15525 <ol>
15526 <li>One</li>
15527 <li>Two:
15528 <ol>
15529 <li>Sub-one</li>
15530 <li>Sub-two</li>
15531 </ol>
15532 </li>
15533 </ol>
15534 !! html
15535 <ol>
15536 <li>One</li>
15537 <li>Two:
15538 <ol>
15539 <li>Sub-one</li>
15540 <li>Sub-two</li>
15541 </ol>
15542 </li>
15543 </ol>
15544
15545 !! end
15546
15547 !! test
15548 HTML nested ordered list, open tags (bug 5497)
15549 !! wikitext
15550 <ol>
15551 <li>One
15552 <li>Two:
15553 <ol>
15554 <li>Sub-one
15555 <li>Sub-two
15556 </ol>
15557 </ol>
15558 !! html/php
15559 <ol>
15560 <li>One
15561 <li>Two:
15562 <ol>
15563 <li>Sub-one
15564 <li>Sub-two
15565 </ol>
15566 </ol>
15567
15568 !! html/parsoid
15569 <ol>
15570 <li>One
15571 </li>
15572 <li>Two:
15573 <ol>
15574 <li>Sub-one
15575 </li>
15576 <li>Sub-two
15577 </li>
15578 </ol>
15579 </li>
15580 </ol>
15581
15582 !! end
15583
15584 !! test
15585 HTML ordered list item with parameters oddity
15586 !! wikitext
15587 <ol><li id="fragment">One</li>
15588 </ol>
15589 !! html
15590 <ol><li id="fragment">One</li>
15591 </ol>
15592
15593 !! end
15594
15595 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15596 !!test
15597 bug 5918: autonumbering
15598 !! wikitext
15599 [http://first/] [http://second] [ftp://ftp]
15600
15601 ftp://inlineftp
15602
15603 [mailto:enclosed@mail.tld With target]
15604
15605 [mailto:enclosed@mail.tld]
15606
15607 mailto:inline@mail.tld
15608 !! html/php
15609 <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>
15610 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15611 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15612 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15613 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15614 </p>
15615 !! html/parsoid
15616 <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>
15617 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15618 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15619 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15620 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15621 !! end
15622
15623
15624 #
15625 # Security and HTML correctness
15626 # From Nick Jenkins' fuzz testing
15627 #
15628
15629 !! test
15630 Fuzz testing: Parser13
15631 !! wikitext
15632 {|
15633 | http://a|
15634 !! html
15635 <table>
15636 <tr>
15637 <td>
15638 </td>
15639 </tr>
15640 </table>
15641
15642 !! end
15643
15644 !! test
15645 Fuzz testing: Parser14
15646 !! wikitext
15647 == onmouseover= ==
15648 http://__TOC__
15649 !! html
15650 <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>
15651 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15652 <ul>
15653 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15654 </ul>
15655 </div>
15656
15657
15658 !! html+tidy
15659 <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>
15660 <p>http://</p>
15661 <div id="toc" class="toc">
15662 <div id="toctitle">
15663 <h2>Contents</h2>
15664 </div>
15665 <ul>
15666 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15667 </ul>
15668 </div>
15669 <p></p>
15670 !! end
15671
15672 !! test
15673 Fuzz testing: Parser14-table
15674 !! wikitext
15675 ==a==
15676 {| STYLE=__TOC__
15677 !! html
15678 <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>
15679 <table style="&#95;_TOC&#95;_">
15680 <tr><td></td></tr>
15681 </table>
15682
15683 !! html+tidy
15684 <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>
15685 <table style="__TOC__">
15686 <tr>
15687 <td></td>
15688 </tr>
15689 </table>
15690 !! end
15691
15692 # Known to produce bogus xml (extra </td>)
15693 !! test
15694 Fuzz testing: Parser16
15695 !! options
15696 noxml
15697 !! wikitext
15698 {|
15699 !https://||||||
15700 !! html
15701 <table>
15702 <tr>
15703 <th>https://</th>
15704 <th></th>
15705 <th></th>
15706 <th>
15707 </td>
15708 </tr>
15709 </table>
15710
15711 !! html+tidy
15712 <table>
15713 <tr>
15714 <th>https://</th>
15715 <th></th>
15716 <th></th>
15717 <th></th>
15718 </tr>
15719 </table>
15720 !! end
15721
15722 !! test
15723 Fuzz testing: Parser21
15724 !! wikitext
15725 {|
15726 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15727 |
15728 !! html
15729 <table>
15730 <tr>
15731 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15732 </th>
15733 <td>
15734 </td>
15735 </tr>
15736 </table>
15737
15738 !! end
15739
15740 !! test
15741 Fuzz testing: Parser22
15742 !! wikitext
15743 http://===r:::https://b
15744
15745 {|
15746 !! html
15747 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15748 </p>
15749 <table>
15750 <tr><td></td></tr>
15751 </table>
15752
15753 !! end
15754
15755 # Known to produce bad XML for now
15756 !! test
15757 Fuzz testing: Parser24
15758 !! options
15759 noxml
15760 !! wikitext
15761 {|
15762 {{{|
15763 <u CLASS=
15764 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15765 <br style="onmouseover='alert(document.cookie);' " />
15766
15767 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15768 |
15769 !! html
15770 <table>
15771 {{{|
15772 <u class="&#124;">}}}} &gt;
15773 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15774
15775 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15776 <tr>
15777 <td></u>
15778 </td>
15779 </tr>
15780 </table>
15781
15782 !! end
15783
15784 # Note: the current result listed for this is not what the original one was,
15785 # but the original bug was JavaScript injection, which is fixed in any case.
15786 # It's not clear that the original result listed was any more correct than the
15787 # current one. Original result:
15788 # <p>{{{|
15789 # </p>
15790 # <li class="&#124;&#124;">
15791 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15792 !!test
15793 Fuzz testing: Parser25 (bug 6055)
15794 !! wikitext
15795 {{{
15796 |
15797 <LI CLASS=||
15798 >
15799 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15800 !! html
15801 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15802 </p>
15803 !! end
15804
15805 !!test
15806 Fuzz testing: URL adjacent extension (with space, clean)
15807 !! wikitext
15808 http://example.com <nowiki>junk</nowiki>
15809 !! html/php
15810 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15811 </p>
15812 !! html/parsoid
15813 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15814 !! end
15815
15816 !!test
15817 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15818 !! wikitext
15819 http://example.com<nowiki>junk</nowiki>
15820 !! html/php
15821 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15822 </p>
15823 !! html/parsoid
15824 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15825 !! end
15826
15827 !!test
15828 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15829 !! wikitext
15830 http://example.com<pre>junk</pre>
15831 !! html/php
15832 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15833
15834 !! html/php+tidy
15835 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15836 <pre>
15837 junk
15838 </pre>
15839 !! html/parsoid
15840 <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>
15841 !!end
15842
15843 !!test
15844 Fuzz testing: image with bogus manual thumbnail
15845 !! wikitext
15846 [[Image:foobar.jpg|thumbnail= ]]
15847 !! html/php
15848 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15849
15850 !! html/parsoid
15851 <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>
15852 !!end
15853
15854 !! test
15855 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15856 !! wikitext
15857 <pre dir="&#10;"></pre>
15858 !! html
15859 <pre dir="&#10;"></pre>
15860
15861 !! end
15862
15863 !! test
15864 Parsing optional HTML elements (Bug 6171)
15865 !! options
15866 !! wikitext
15867 <table>
15868 <tr>
15869 <td> Some tabular data</td>
15870 <td> More tabular data ...
15871 <td> And yet som tabular data</td>
15872 </tr>
15873 </table>
15874 !! html
15875 <table>
15876 <tr>
15877 <td> Some tabular data</td>
15878 <td> More tabular data ...
15879 </td><td> And yet som tabular data</td>
15880 </tr>
15881 </table>
15882
15883 !! end
15884
15885 !! test
15886 Correct handling of <td>, <tr> (Bug 6171)
15887 !! options
15888 !! wikitext
15889 <table>
15890 <tr>
15891 <td> Some tabular data</td>
15892 <td> More tabular data ...</td>
15893 <td> And yet som tabular data</td>
15894 </tr>
15895 </table>
15896 !! html
15897 <table>
15898 <tr>
15899 <td> Some tabular data</td>
15900 <td> More tabular data ...</td>
15901 <td> And yet som tabular data</td>
15902 </tr>
15903 </table>
15904
15905 !! end
15906
15907
15908 !! test
15909 Parsing crashing regression (fr:JavaScript)
15910 !! wikitext
15911 </body></x>
15912 !! html
15913 <p>&lt;/body&gt;&lt;/x&gt;
15914 </p>
15915 !! end
15916
15917 !! test
15918 Inline wiki vs wiki block nesting
15919 !! wikitext
15920 '''Bold paragraph
15921
15922 New wiki paragraph
15923 !! html
15924 <p><b>Bold paragraph</b>
15925 </p><p>New wiki paragraph
15926 </p>
15927 !! end
15928
15929 # FIXME: The current php output is documented
15930 # and desired output is the parsoid target.
15931 !! test
15932 Inline HTML vs wiki block nesting
15933 !! wikitext
15934 <b>Bold paragraph
15935
15936 New wiki paragraph
15937 !! html/php
15938 <p><b>Bold paragraph
15939 </p><p>New wiki paragraph</b>
15940 </p>
15941 !! html/parsoid
15942 <p><b>Bold paragraph</b>
15943 </p><p>New wiki paragraph
15944 </p>
15945 !! end
15946
15947 # Original result was this:
15948 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15949 # </p>
15950 # While that might be marginally more intuitive, maybe, the six-apostrophe
15951 # construct is clearly pathological and the result stated here (which is what
15952 # the parser actually does) is about as reasonable as anything.
15953 !!test
15954 Mixing markup for italics and bold
15955 !! options
15956 !! wikitext
15957 '''bold''''''bold''bolditalics'''''
15958 !! html
15959 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15960 </p>
15961 !! end
15962
15963
15964 !! article
15965 Xyzzyx
15966 !! text
15967 Article for special page transclusion test
15968 !! endarticle
15969
15970 !! test
15971 Special page transclusion
15972 !! options
15973 !! wikitext
15974 {{Special:Prefixindex/Xyzzyx}}
15975 !! html
15976 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15977
15978 !! end
15979
15980 !! test
15981 Special page transclusion twice (bug 5021)
15982 !! options
15983 !! wikitext
15984 {{Special:Prefixindex/Xyzzyx}}
15985 {{Special:Prefixindex/Xyzzyx}}
15986 !! html
15987 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15988 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15989
15990 !! end
15991
15992 !! test
15993 Transclusion of default MediaWiki message
15994 !! wikitext
15995 {{MediaWiki:Mainpage}}
15996 !! html
15997 <p>Main Page
15998 </p>
15999 !! end
16000
16001 !! test
16002 Transclusion of nonexistent MediaWiki message
16003 !! wikitext
16004 {{MediaWiki:Mainpagexxx}}
16005 !! html
16006 <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>
16007 </p>
16008 !! end
16009
16010 !! test
16011 Transclusion of MediaWiki message with underscore
16012 !! wikitext
16013 {{MediaWiki:history_short}}
16014 !! html
16015 <p>History
16016 </p>
16017 !! end
16018
16019 !! test
16020 Transclusion of MediaWiki message with space
16021 !! wikitext
16022 {{MediaWiki:history short}}
16023 !! html
16024 <p>History
16025 </p>
16026 !! end
16027
16028 !! test
16029 Invalid header with following text
16030 !! wikitext
16031 = x = y
16032 !! html
16033 <p>= x = y
16034 </p>
16035 !! end
16036
16037
16038 !! test
16039 Section extraction test (section 0)
16040 !! options
16041 section=0
16042 !! wikitext
16043 start
16044 ==a==
16045 ===aa===
16046 ====aaa====
16047 ==b==
16048 ===ba===
16049 ===bb===
16050 ====bba====
16051 ===bc===
16052 ==c==
16053 ===ca===
16054 !! html
16055 start
16056 !! end
16057
16058 !! test
16059 Section extraction test (section 1)
16060 !! options
16061 section=1
16062 !! wikitext
16063 start
16064 ==a==
16065 ===aa===
16066 ====aaa====
16067 ==b==
16068 ===ba===
16069 ===bb===
16070 ====bba====
16071 ===bc===
16072 ==c==
16073 ===ca===
16074 !! html
16075 ==a==
16076 ===aa===
16077 ====aaa====
16078 !! end
16079
16080 !! test
16081 Section extraction test (section 2)
16082 !! options
16083 section=2
16084 !! wikitext
16085 start
16086 ==a==
16087 ===aa===
16088 ====aaa====
16089 ==b==
16090 ===ba===
16091 ===bb===
16092 ====bba====
16093 ===bc===
16094 ==c==
16095 ===ca===
16096 !! html
16097 ===aa===
16098 ====aaa====
16099 !! end
16100
16101 !! test
16102 Section extraction test (section 3)
16103 !! options
16104 section=3
16105 !! wikitext
16106 start
16107 ==a==
16108 ===aa===
16109 ====aaa====
16110 ==b==
16111 ===ba===
16112 ===bb===
16113 ====bba====
16114 ===bc===
16115 ==c==
16116 ===ca===
16117 !! html
16118 ====aaa====
16119 !! end
16120
16121 !! test
16122 Section extraction test (section 4)
16123 !! options
16124 section=4
16125 !! wikitext
16126 start
16127 ==a==
16128 ===aa===
16129 ====aaa====
16130 ==b==
16131 ===ba===
16132 ===bb===
16133 ====bba====
16134 ===bc===
16135 ==c==
16136 ===ca===
16137 !! html
16138 ==b==
16139 ===ba===
16140 ===bb===
16141 ====bba====
16142 ===bc===
16143 !! end
16144
16145 !! test
16146 Section extraction test (section 5)
16147 !! options
16148 section=5
16149 !! wikitext
16150 start
16151 ==a==
16152 ===aa===
16153 ====aaa====
16154 ==b==
16155 ===ba===
16156 ===bb===
16157 ====bba====
16158 ===bc===
16159 ==c==
16160 ===ca===
16161 !! html
16162 ===ba===
16163 !! end
16164
16165 !! test
16166 Section extraction test (section 6)
16167 !! options
16168 section=6
16169 !! wikitext
16170 start
16171 ==a==
16172 ===aa===
16173 ====aaa====
16174 ==b==
16175 ===ba===
16176 ===bb===
16177 ====bba====
16178 ===bc===
16179 ==c==
16180 ===ca===
16181 !! html
16182 ===bb===
16183 ====bba====
16184 !! end
16185
16186 !! test
16187 Section extraction test (section 7)
16188 !! options
16189 section=7
16190 !! wikitext
16191 start
16192 ==a==
16193 ===aa===
16194 ====aaa====
16195 ==b==
16196 ===ba===
16197 ===bb===
16198 ====bba====
16199 ===bc===
16200 ==c==
16201 ===ca===
16202 !! html
16203 ====bba====
16204 !! end
16205
16206 !! test
16207 Section extraction test (section 8)
16208 !! options
16209 section=8
16210 !! wikitext
16211 start
16212 ==a==
16213 ===aa===
16214 ====aaa====
16215 ==b==
16216 ===ba===
16217 ===bb===
16218 ====bba====
16219 ===bc===
16220 ==c==
16221 ===ca===
16222 !! html
16223 ===bc===
16224 !! end
16225
16226 !! test
16227 Section extraction test (section 9)
16228 !! options
16229 section=9
16230 !! wikitext
16231 start
16232 ==a==
16233 ===aa===
16234 ====aaa====
16235 ==b==
16236 ===ba===
16237 ===bb===
16238 ====bba====
16239 ===bc===
16240 ==c==
16241 ===ca===
16242 !! html
16243 ==c==
16244 ===ca===
16245 !! end
16246
16247 !! test
16248 Section extraction test (section 10)
16249 !! options
16250 section=10
16251 !! wikitext
16252 start
16253 ==a==
16254 ===aa===
16255 ====aaa====
16256 ==b==
16257 ===ba===
16258 ===bb===
16259 ====bba====
16260 ===bc===
16261 ==c==
16262 ===ca===
16263 !! html
16264 ===ca===
16265 !! end
16266
16267 !! test
16268 Section extraction test (nonexistent section 11)
16269 !! options
16270 section=11
16271 !! wikitext
16272 start
16273 ==a==
16274 ===aa===
16275 ====aaa====
16276 ==b==
16277 ===ba===
16278 ===bb===
16279 ====bba====
16280 ===bc===
16281 ==c==
16282 ===ca===
16283 !! html
16284 !! end
16285
16286 !! test
16287 Section extraction test with bogus heading (section 1)
16288 !! options
16289 section=1
16290 !! wikitext
16291 ==a==
16292 ==bogus== not a legal section
16293 ==b==
16294 !! html
16295 ==a==
16296 ==bogus== not a legal section
16297 !! end
16298
16299 !! test
16300 Section extraction test with bogus heading (section 2)
16301 !! options
16302 section=2
16303 !! wikitext
16304 ==a==
16305 ==bogus== not a legal section
16306 ==b==
16307 !! html
16308 ==b==
16309 !! end
16310
16311 !! test
16312 Section extraction test with comment after heading (section 1)
16313 !! options
16314 section=1
16315 !! wikitext
16316 ==a==
16317 ==b== <!-- -->
16318 ==c==
16319 !! html
16320 ==a==
16321 !! end
16322
16323 !! test
16324 Section extraction test with comment after heading (section 2)
16325 !! options
16326 section=2
16327 !! wikitext
16328 ==a==
16329 ==b== <!-- -->
16330 ==c==
16331 !! html
16332 ==b== <!-- -->
16333 !! end
16334
16335 !! test
16336 Section extraction test with bogus <nowiki> heading (section 1)
16337 !! options
16338 section=1
16339 !! wikitext
16340 ==a==
16341 ==bogus== <nowiki>not a legal section</nowiki>
16342 ==b==
16343 !! html
16344 ==a==
16345 ==bogus== <nowiki>not a legal section</nowiki>
16346 !! end
16347
16348 !! test
16349 Section extraction test with bogus <nowiki> heading (section 2)
16350 !! options
16351 section=2
16352 !! wikitext
16353 ==a==
16354 ==bogus== <nowiki>not a legal section</nowiki>
16355 ==b==
16356 !! html
16357 ==b==
16358 !! end
16359
16360
16361 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16362 # instead of respecting commented sections
16363 !! test
16364 Section extraction prefixed by comment (section 1)
16365 !! options
16366 section=1
16367 !! wikitext
16368 <!-- -->==sec1==
16369 ==sec2==
16370 !! html
16371 ==sec2==
16372 !!end
16373
16374 !! test
16375 Section extraction prefixed by comment (section 2)
16376 !! options
16377 section=2
16378 !! wikitext
16379 <!-- -->==sec1==
16380 ==sec2==
16381 !! html
16382
16383 !!end
16384
16385
16386 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16387 # instead of respecting HTML-style headings
16388 !! test
16389 Section extraction, mixed wiki and html (section 1)
16390 !! options
16391 section=1
16392 !! wikitext
16393 <h2>unmarked</h2>
16394 unmarked
16395 ==1==
16396 one
16397 ==2==
16398 two
16399 !! html
16400 ==1==
16401 one
16402 !! end
16403
16404 !! test
16405 Section extraction, mixed wiki and html (section 2)
16406 !! options
16407 section=2
16408 !! wikitext
16409 <h2>unmarked</h2>
16410 unmarked
16411 ==1==
16412 one
16413 ==2==
16414 two
16415 !! html
16416 ==2==
16417 two
16418 !! end
16419
16420
16421 # Formerly testing for bug 3342
16422 !! test
16423 Section extraction, heading surrounded by <noinclude>
16424 !! options
16425 section=1
16426 !! wikitext
16427 <noinclude>==unmarked==</noinclude>
16428 ==marked==
16429 !! html
16430 ==marked==
16431 !!end
16432
16433 # Test behavior of bug 19910
16434 !! test
16435 Sectiion with all-equals
16436 !! options
16437 section=2
16438 !! wikitext
16439 ===
16440 The line above must have a trailing space
16441 === <!--
16442 --> <!-- -->
16443 But just in case it doesn't...
16444 !! html
16445 === <!--
16446 --> <!-- -->
16447 But just in case it doesn't...
16448 !! end
16449
16450 !! test
16451 Section replacement test (section 0)
16452 !! options
16453 replace=0,"xxx"
16454 !! wikitext
16455 start
16456 ==a==
16457 ===aa===
16458 ====aaa====
16459 ==b==
16460 ===ba===
16461 ===bb===
16462 ====bba====
16463 ===bc===
16464 ==c==
16465 ===ca===
16466 !! html
16467 xxx
16468
16469 ==a==
16470 ===aa===
16471 ====aaa====
16472 ==b==
16473 ===ba===
16474 ===bb===
16475 ====bba====
16476 ===bc===
16477 ==c==
16478 ===ca===
16479 !! end
16480
16481 !! test
16482 Section replacement test (section 1)
16483 !! options
16484 replace=1,"xxx"
16485 !! wikitext
16486 start
16487 ==a==
16488 ===aa===
16489 ====aaa====
16490 ==b==
16491 ===ba===
16492 ===bb===
16493 ====bba====
16494 ===bc===
16495 ==c==
16496 ===ca===
16497 !! html
16498 start
16499 xxx
16500
16501 ==b==
16502 ===ba===
16503 ===bb===
16504 ====bba====
16505 ===bc===
16506 ==c==
16507 ===ca===
16508 !! end
16509
16510 !! test
16511 Section replacement test (section 2)
16512 !! options
16513 replace=2,"xxx"
16514 !! wikitext
16515 start
16516 ==a==
16517 ===aa===
16518 ====aaa====
16519 ==b==
16520 ===ba===
16521 ===bb===
16522 ====bba====
16523 ===bc===
16524 ==c==
16525 ===ca===
16526 !! html
16527 start
16528 ==a==
16529 xxx
16530
16531 ==b==
16532 ===ba===
16533 ===bb===
16534 ====bba====
16535 ===bc===
16536 ==c==
16537 ===ca===
16538 !! end
16539
16540 !! test
16541 Section replacement test (section 3)
16542 !! options
16543 replace=3,"xxx"
16544 !! wikitext
16545 start
16546 ==a==
16547 ===aa===
16548 ====aaa====
16549 ==b==
16550 ===ba===
16551 ===bb===
16552 ====bba====
16553 ===bc===
16554 ==c==
16555 ===ca===
16556 !! html
16557 start
16558 ==a==
16559 ===aa===
16560 xxx
16561
16562 ==b==
16563 ===ba===
16564 ===bb===
16565 ====bba====
16566 ===bc===
16567 ==c==
16568 ===ca===
16569 !! end
16570
16571 !! test
16572 Section replacement test (section 4)
16573 !! options
16574 replace=4,"xxx"
16575 !! wikitext
16576 start
16577 ==a==
16578 ===aa===
16579 ====aaa====
16580 ==b==
16581 ===ba===
16582 ===bb===
16583 ====bba====
16584 ===bc===
16585 ==c==
16586 ===ca===
16587 !! html
16588 start
16589 ==a==
16590 ===aa===
16591 ====aaa====
16592 xxx
16593
16594 ==c==
16595 ===ca===
16596 !! end
16597
16598 !! test
16599 Section replacement test (section 5)
16600 !! options
16601 replace=5,"xxx"
16602 !! wikitext
16603 start
16604 ==a==
16605 ===aa===
16606 ====aaa====
16607 ==b==
16608 ===ba===
16609 ===bb===
16610 ====bba====
16611 ===bc===
16612 ==c==
16613 ===ca===
16614 !! html
16615 start
16616 ==a==
16617 ===aa===
16618 ====aaa====
16619 ==b==
16620 xxx
16621
16622 ===bb===
16623 ====bba====
16624 ===bc===
16625 ==c==
16626 ===ca===
16627 !! end
16628
16629 !! test
16630 Section replacement test (section 6)
16631 !! options
16632 replace=6,"xxx"
16633 !! wikitext
16634 start
16635 ==a==
16636 ===aa===
16637 ====aaa====
16638 ==b==
16639 ===ba===
16640 ===bb===
16641 ====bba====
16642 ===bc===
16643 ==c==
16644 ===ca===
16645 !! html
16646 start
16647 ==a==
16648 ===aa===
16649 ====aaa====
16650 ==b==
16651 ===ba===
16652 xxx
16653
16654 ===bc===
16655 ==c==
16656 ===ca===
16657 !! end
16658
16659 !! test
16660 Section replacement test (section 7)
16661 !! options
16662 replace=7,"xxx"
16663 !! wikitext
16664 start
16665 ==a==
16666 ===aa===
16667 ====aaa====
16668 ==b==
16669 ===ba===
16670 ===bb===
16671 ====bba====
16672 ===bc===
16673 ==c==
16674 ===ca===
16675 !! html
16676 start
16677 ==a==
16678 ===aa===
16679 ====aaa====
16680 ==b==
16681 ===ba===
16682 ===bb===
16683 xxx
16684
16685 ===bc===
16686 ==c==
16687 ===ca===
16688 !! end
16689
16690 !! test
16691 Section replacement test (section 8)
16692 !! options
16693 replace=8,"xxx"
16694 !! wikitext
16695 start
16696 ==a==
16697 ===aa===
16698 ====aaa====
16699 ==b==
16700 ===ba===
16701 ===bb===
16702 ====bba====
16703 ===bc===
16704 ==c==
16705 ===ca===
16706 !! html
16707 start
16708 ==a==
16709 ===aa===
16710 ====aaa====
16711 ==b==
16712 ===ba===
16713 ===bb===
16714 ====bba====
16715 xxx
16716
16717 ==c==
16718 ===ca===
16719 !!end
16720
16721 !! test
16722 Section replacement test (section 9)
16723 !! options
16724 replace=9,"xxx"
16725 !! wikitext
16726 start
16727 ==a==
16728 ===aa===
16729 ====aaa====
16730 ==b==
16731 ===ba===
16732 ===bb===
16733 ====bba====
16734 ===bc===
16735 ==c==
16736 ===ca===
16737 !! html
16738 start
16739 ==a==
16740 ===aa===
16741 ====aaa====
16742 ==b==
16743 ===ba===
16744 ===bb===
16745 ====bba====
16746 ===bc===
16747 xxx
16748 !! end
16749
16750 !! test
16751 Section replacement test (section 10)
16752 !! options
16753 replace=10,"xxx"
16754 !! wikitext
16755 start
16756 ==a==
16757 ===aa===
16758 ====aaa====
16759 ==b==
16760 ===ba===
16761 ===bb===
16762 ====bba====
16763 ===bc===
16764 ==c==
16765 ===ca===
16766 !! html
16767 start
16768 ==a==
16769 ===aa===
16770 ====aaa====
16771 ==b==
16772 ===ba===
16773 ===bb===
16774 ====bba====
16775 ===bc===
16776 ==c==
16777 xxx
16778 !! end
16779
16780 !! test
16781 Section replacement test with initial whitespace (bug 13728)
16782 !! options
16783 replace=2,"xxx"
16784 !! wikitext
16785 Preformatted initial line
16786 ==a==
16787 ===a===
16788 !! html
16789 Preformatted initial line
16790 ==a==
16791 xxx
16792 !! end
16793
16794
16795 !! test
16796 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16797 !! options
16798 section=1
16799 !! wikitext
16800 ==a==
16801 a
16802 !! html
16803 ==a==
16804 a
16805 !! end
16806
16807 !! test
16808 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16809 !! options
16810 section=1
16811 !! wikitext
16812 ==a==
16813 a
16814 !! html
16815 ==a==
16816 a
16817 !! end
16818
16819
16820 !! test
16821 Section extraction, <pre> around bogus header (bug 10309)
16822 !! options
16823 noxml section=2
16824 !! wikitext
16825 == Section One ==
16826 <pre>
16827 =======
16828 </pre>
16829
16830 == Section Two ==
16831 stuff
16832 !! html
16833 == Section Two ==
16834 stuff
16835 !! end
16836
16837 !! test
16838 Section replacement, <pre> around bogus header (bug 10309)
16839 !! options
16840 noxml replace=2,"xxx"
16841 !! wikitext
16842 == Section One ==
16843 <pre>
16844 =======
16845 </pre>
16846
16847 == Section Two ==
16848 stuff
16849 !! html
16850 == Section One ==
16851 <pre>
16852 =======
16853 </pre>
16854
16855 xxx
16856 !! end
16857
16858
16859
16860 !! test
16861 Handling of &#x0A; in URLs
16862 !! wikitext
16863 ** irc://&#x0A;a
16864 !! html/php
16865 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16866
16867 !! html/parsoid
16868 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16869 a">irc://
16870 a</a></li></ul></li></ul>
16871 !! end
16872
16873 !! test
16874 Handling of %0A in URLs
16875 !! wikitext
16876 ** irc://%0Aa
16877 !! html/php
16878 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16879
16880 !! html/parsoid
16881 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16882 !! end
16883
16884
16885 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16886 !! test
16887 5 quotes, code coverage +1 line
16888 !! options
16889 parsoid=wt2html
16890 !! wikitext
16891 '''''
16892 !! html/php
16893 !! html/parsoid
16894 <p><b><i></i></b></p>
16895 !! end
16896
16897 # same html as previous, but wikitext adjusted to match parsoid html2wt
16898 # note that wt2html and html2html will put the <i> before the <b>
16899 !! test
16900 5 quotes, code coverage +1 line w/ nowiki (1)
16901 !! options
16902 parsoid=wt2wt,html2wt
16903 !! wikitext
16904 '''''<nowiki/>'''''
16905 !! html/php
16906 <p><i></i>
16907 </p>
16908 !! html/parsoid
16909 <p><b><i></i></b></p>
16910 !! end
16911
16912 # same as previous, just swapping the <i> and <b>
16913 !! test
16914 5 quotes, code coverage +1 line w/ nowiki (2)
16915 !! wikitext
16916 '''''<nowiki/>'''''
16917 !! html/php
16918 <p><i></i>
16919 </p>
16920 !! html/parsoid
16921 <p><i><b></b></i></p>
16922 !! end
16923
16924 !! test
16925 Special:Search page linking.
16926 !! wikitext
16927 {{Special:search}}
16928 !! html
16929 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16930 </p>
16931 !! end
16932
16933 !! test
16934 {{!}} is a magic word
16935 !! wikitext
16936 {{!}} is a magic word there and {{!}} is still a magic word here
16937 !! html/php
16938 <p>| is a magic word there and | is still a magic word here
16939 </p>
16940 !! html/parsoid
16941 <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>
16942 !! end
16943
16944 !! test
16945 Say the magic word
16946 !! options
16947 title=[[Parser test]]
16948 !! wikitext
16949 * {{PAGENAME}}
16950 * {{PAGENAMEE}}
16951 * {{FULLPAGENAME}}
16952 * {{FULLPAGENAMEE}}
16953 * {{BASEPAGENAME}}
16954 * {{BASEPAGENAMEE}}
16955 * {{SUBPAGENAME}}
16956 * {{SUBPAGENAMEE}}
16957 * {{ROOTPAGENAME}}
16958 * {{ROOTPAGENAMEE}}
16959 * {{TALKPAGENAME}}
16960 * {{TALKPAGENAMEE}}
16961 * {{SUBJECTPAGENAME}}
16962 * {{SUBJECTPAGENAMEE}}
16963 * {{NAMESPACEE}}
16964 * {{NAMESPACE}}
16965 * {{NAMESPACENUMBER}}
16966 * {{TALKSPACE}}
16967 * {{TALKSPACEE}}
16968 * {{SUBJECTSPACE}}
16969 * {{SUBJECTSPACEE}}
16970 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16971 !! html
16972 <ul><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> Parser_test</li>
16982 <li> Talk:Parser test</li>
16983 <li> Talk:Parser_test</li>
16984 <li> Parser test</li>
16985 <li> Parser_test</li>
16986 <li> </li>
16987 <li> </li>
16988 <li> 0</li>
16989 <li> Talk</li>
16990 <li> Talk</li>
16991 <li> </li>
16992 <li> </li>
16993 <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>
16994
16995 !! end
16996 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16997
16998 !! test
16999 Gallery
17000 !! wikitext
17001 <gallery>
17002 image1.png |
17003 image2.gif|||||
17004
17005 image3|
17006 image4 |300px| centre
17007 image5.svg| http://///////
17008 [[x|xx]]]]
17009 * image6
17010 </gallery>
17011 !! html
17012 <ul class="gallery mw-gallery-traditional">
17013 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17014 <div class="thumb" style="height: 150px;">Image1.png</div>
17015 <div class="gallerytext">
17016 </div>
17017 </div></li>
17018 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17019 <div class="thumb" style="height: 150px;">Image2.gif</div>
17020 <div class="gallerytext">
17021 <p>||||
17022 </p>
17023 </div>
17024 </div></li>
17025 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17026 <div class="thumb" style="height: 150px;">Image3</div>
17027 <div class="gallerytext">
17028 </div>
17029 </div></li>
17030 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17031 <div class="thumb" style="height: 150px;">Image4</div>
17032 <div class="gallerytext">
17033 <p>300px| centre
17034 </p>
17035 </div>
17036 </div></li>
17037 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17038 <div class="thumb" style="height: 150px;">Image5.svg</div>
17039 <div class="gallerytext">
17040 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17041 </p>
17042 </div>
17043 </div></li>
17044 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17045 <div class="thumb" style="height: 150px;">* image6</div>
17046 <div class="gallerytext">
17047 </div>
17048 </div></li>
17049 </ul>
17050
17051 !! end
17052
17053 !! test
17054 Gallery (with options)
17055 !! wikitext
17056 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17057 File:Nonexistent.jpg|caption
17058 File:Nonexistent.jpg
17059 image:foobar.jpg|some '''caption''' [[Main Page]]
17060 image:foobar.jpg
17061 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17062 </gallery>
17063 !! html
17064 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17065 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17066 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17067 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17068 <div class="gallerytext">
17069 <p>caption
17070 </p>
17071 </div>
17072 </div></li>
17073 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17074 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17075 <div class="gallerytext">
17076 </div>
17077 </div></li>
17078 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17079 <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>
17080 <div class="gallerytext">
17081 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17082 </p>
17083 </div>
17084 </div></li>
17085 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17086 <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>
17087 <div class="gallerytext">
17088 </div>
17089 </div></li>
17090 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17091 <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>
17092 <div class="gallerytext">
17093 <p>Blabla|blabla.
17094 </p>
17095 </div>
17096 </div></li>
17097 </ul>
17098
17099 !! end
17100
17101 !! test
17102 Gallery with link that has fragment
17103 !! wikitext
17104 <gallery>
17105 image:foobar.jpg|link=Main_Page
17106 image:foobar.jpg|link=Main_Page#section
17107 image:foobar.jpg|link=Main Page#section|caption
17108 </gallery>
17109 !! html
17110 <ul class="gallery mw-gallery-traditional">
17111 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17112 <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>
17113 <div class="gallerytext">
17114 </div>
17115 </div></li>
17116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17117 <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>
17118 <div class="gallerytext">
17119 </div>
17120 </div></li>
17121 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17122 <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>
17123 <div class="gallerytext">
17124 <p>caption
17125 </p>
17126 </div>
17127 </div></li>
17128 </ul>
17129
17130 !! end
17131
17132 !! test
17133 Gallery with wikitext inside caption
17134 !! wikitext
17135 <gallery>
17136 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17137 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17138 </gallery>
17139 !! html
17140 <ul class="gallery mw-gallery-traditional">
17141 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17142 <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>
17143 <div class="gallerytext">
17144 <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>
17145 </p>
17146 </div>
17147 </div></li>
17148 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17149 <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>
17150 <div class="gallerytext">
17151 <p>This is a test template
17152 </p>
17153 </div>
17154 </div></li>
17155 </ul>
17156
17157 !! end
17158
17159 !! test
17160 gallery (with showfilename option)
17161 !! wikitext
17162 <gallery showfilename>
17163 File:Nonexistent.jpg|caption
17164 File:Nonexistent.jpg
17165 image:foobar.jpg|some '''caption''' [[Main Page]]
17166 File:Foobar.jpg
17167 </gallery>
17168 !! html
17169 <ul class="gallery mw-gallery-traditional">
17170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17171 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17172 <div class="gallerytext">
17173 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17174 caption
17175 </p>
17176 </div>
17177 </div></li>
17178 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17179 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17180 <div class="gallerytext">
17181 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17182 </p>
17183 </div>
17184 </div></li>
17185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17186 <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>
17187 <div class="gallerytext">
17188 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17189 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17190 </p>
17191 </div>
17192 </div></li>
17193 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17194 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
17195 <div class="gallerytext">
17196 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17197 </p>
17198 </div>
17199 </div></li>
17200 </ul>
17201
17202 !! end
17203
17204 !! test
17205 Gallery (with namespace-less filenames)
17206 !! wikitext
17207 <gallery>
17208 File:Nonexistent.jpg
17209 Nonexistent.jpg
17210 image:foobar.jpg
17211 foobar.jpg
17212 </gallery>
17213 !! html
17214 <ul class="gallery mw-gallery-traditional">
17215 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17216 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17217 <div class="gallerytext">
17218 </div>
17219 </div></li>
17220 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17221 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17222 <div class="gallerytext">
17223 </div>
17224 </div></li>
17225 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17226 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
17227 <div class="gallerytext">
17228 </div>
17229 </div></li>
17230 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17231 <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>
17232 <div class="gallerytext">
17233 </div>
17234 </div></li>
17235 </ul>
17236
17237 !! end
17238
17239 !! test
17240 HTML Hex character encoding (spells the word "JavaScript")
17241 !! options
17242 parsoid=wt2html,wt2wt,html2html
17243 !! wikitext
17244 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17245 !! html/php
17246 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17247 </p>
17248 !! html/php+tidy
17249 <p>JavaScript</p>
17250 !! html/parsoid
17251 <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>
17252 !! end
17253
17254 !! test
17255 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17256 !! wikitext
17257 &#xsee;&#XSEE;
17258 !! html/php
17259 <p>&amp;#xsee;&amp;#XSEE;
17260 </p>
17261 !! html/parsoid
17262 <p>&amp;#xsee;&amp;#XSEE;</p>
17263 !! end
17264
17265 !! test
17266 HTML Hex character encoding mixed case
17267 !! options
17268 parsoid=wt2html,wt2wt,html2html
17269 !! wikitext
17270 &#xEE;&#Xee;
17271 !! html/php
17272 <p>&#xee;&#xee;
17273 </p>
17274 !! html/php+tidy
17275 <p>îî</p>
17276 !! html/parsoid
17277 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17278 !! end
17279
17280 !! test
17281 __FORCETOC__ override
17282 !! wikitext
17283 __NEWSECTIONLINK__
17284 __FORCETOC__
17285 !! html
17286 <p><br />
17287 </p>
17288 !! end
17289
17290 !! test
17291 ISBN code coverage
17292 !! wikitext
17293 ISBN 978-0-1234-56&#x20;789
17294 !! html
17295 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17296 </p>
17297 !! html+tidy
17298 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17299 !! html/parsoid
17300 <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>
17301 !! end
17302
17303 !! test
17304 ISBN followed by 5 spaces
17305 !! wikitext
17306 ISBN
17307 !! html
17308 <p>ISBN
17309 </p>
17310 !! end
17311
17312 !! test
17313 Double ISBN
17314 !! wikitext
17315 ISBN ISBN 1234567890
17316 !! html/php
17317 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17318 </p>
17319 !! html/parsoid
17320 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17321 !! end
17322
17323 !! test
17324 ISBN with an X
17325 !! wikitext
17326 ISBN 3-462-04561-X
17327 ISBN 080442957X
17328 ISBN 978080442957X
17329 !! html/php
17330 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17331 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17332 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17333 </p>
17334 !! html/parsoid
17335 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17336 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17337 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17338 !! end
17339
17340 !! test
17341 ISBN with empty prefix (parsoid test)
17342 !! wikitext
17343 ISBN 1234567890
17344 !! html/php
17345 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17346 </p>
17347 !! html/parsoid
17348 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17349 !! end
17350
17351 !! test
17352 Bug 22905: <abbr> followed by ISBN followed by </a>
17353 !! wikitext
17354 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17355 !! html/php
17356 <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>
17357 </p>
17358 !! html/parsoid
17359 <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>
17360 !! end
17361
17362 !! test
17363 Double RFC
17364 !! wikitext
17365 RFC RFC 1234
17366 !! html
17367 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17368 </p>
17369 !! end
17370
17371 !! test
17372 Double RFC with a wiki link
17373 !! wikitext
17374 RFC [[RFC 1234]]
17375 !! html
17376 <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>
17377 </p>
17378 !! end
17379
17380 !! test
17381 RFC code coverage
17382 !! wikitext
17383 RFC 983&#x20;987
17384 !! html
17385 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17386 </p>
17387 !! html+tidy
17388 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17389 !! end
17390
17391 !! test
17392 Centre-aligned image
17393 !! wikitext
17394 [[Image:foobar.jpg|centre]]
17395 !! html
17396 <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>
17397
17398 !!end
17399
17400 !! test
17401 None-aligned image
17402 !! wikitext
17403 [[Image:foobar.jpg|none]]
17404 !! html
17405 <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>
17406
17407 !!end
17408
17409 !! test
17410 Width + Height sized image (using px) (height is ignored)
17411 !! wikitext
17412 [[Image:foobar.jpg|640x480px]]
17413 !! html
17414 <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>
17415 </p>
17416 !!end
17417
17418 !! test
17419 Width-sized image (using px, no following whitespace)
17420 !! wikitext
17421 [[Image:foobar.jpg|640px]]
17422 !! html
17423 <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>
17424 </p>
17425 !!end
17426
17427 !! test
17428 Width-sized image (using px, with following whitespace - test regression from r39467)
17429 !! wikitext
17430 [[Image:foobar.jpg|640px ]]
17431 !! html
17432 <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>
17433 </p>
17434 !!end
17435
17436 !! test
17437 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17438 !! wikitext
17439 [[Image:foobar.jpg| 640px]]
17440 !! html
17441 <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>
17442 </p>
17443 !!end
17444
17445 !! test
17446 Image with page parameter
17447 !! options
17448 djvu
17449 !! wikitext
17450 [[File:LoremIpsum.djvu|page=2]]
17451 !! html/php
17452 <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>
17453 </p>
17454 !! html/parsoid
17455 <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>
17456 !! end
17457
17458 !! test
17459 Another italics / bold test
17460 !! wikitext
17461 ''' ''x'
17462 !! html
17463 <pre>'<i> </i>x'
17464 </pre>
17465 !!end
17466
17467 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17468 !! test
17469 dt/dd/dl test
17470 !! wikitext
17471 :;;;::
17472 !! html/php
17473 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17474
17475 !! html/parsoid
17476 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17477
17478 !!end
17479
17480
17481 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17482 !! test
17483 Images with the "|" character in the comment
17484 !! wikitext
17485 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17486 !! html/php
17487 <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>
17488
17489 !! html/parsoid
17490 <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>
17491 !! end
17492
17493 !! test
17494 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17495 !! wikitext
17496 <html><script>alert(1);</script></html>
17497 !! html
17498 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17499 </p>
17500 !! end
17501
17502 !! test
17503 HTML with raw HTML ($wgRawHtml==true)
17504 !! options
17505 wgRawHtml=1
17506 !! wikitext
17507 <html><script>alert(1);</script></html>
17508 !! html
17509 <p><script>alert(1);</script>
17510 </p>
17511 !! end
17512
17513 !! test
17514 Parents of subpages, one level up
17515 !! options
17516 subpage title=[[Subpage test/L1/L2/L3]]
17517 !! wikitext
17518 [[../|L2]]
17519 !! html
17520 <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>
17521 </p>
17522 !! end
17523
17524
17525 !! test
17526 Parents of subpages, one level up, not named
17527 !! options
17528 subpage title=[[Subpage test/L1/L2/L3]]
17529 !! wikitext
17530 [[../]]
17531 !! html
17532 <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>
17533 </p>
17534 !! end
17535
17536
17537
17538 !! test
17539 Parents of subpages, two levels up
17540 !! options
17541 subpage title=[[Subpage test/L1/L2/L3]]
17542 !! wikitext
17543 [[../../|L1]]2
17544
17545 [[../../|L1]]l
17546 !! html
17547 <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
17548 </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>
17549 </p>
17550 !! end
17551
17552 !! test
17553 Parents of subpages, two levels up, without trailing slash or name.
17554 !! options
17555 subpage title=[[Subpage test/L1/L2/L3]]
17556 !! wikitext
17557 [[../..]]
17558 !! html
17559 <p>[[../..]]
17560 </p>
17561 !! end
17562
17563 !! test
17564 Parents of subpages, two levels up, with lots of extra trailing slashes.
17565 !! options
17566 subpage title=[[Subpage test/L1/L2/L3]]
17567 !! wikitext
17568 [[../../////]]
17569 !! html
17570 <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>
17571 </p>
17572 !! end
17573
17574 !! article
17575 Subpage test/L1/L2/L3Sibling
17576 !! text
17577 Sibling article
17578 !! endarticle
17579
17580 !! test
17581 Transclusion of a sibling page (one level up)
17582 !! options
17583 subpage title=[[Subpage test/L1/L2/L3]]
17584 !! wikitext
17585 {{../L3Sibling}}
17586 !! html
17587 <p>Sibling article
17588 </p>
17589 !! end
17590
17591 !! test
17592 Transclusion of a child page
17593 !! options
17594 subpage title=[[Subpage test/L1/L2]]
17595 !! wikitext
17596 {{/L3Sibling}}
17597 !! html
17598 <p>Sibling article
17599 </p>
17600 !! end
17601
17602 !! test
17603 Non-transclusion because of too many up levels
17604 !! options
17605 subpage title=[[Subpage test/L1/L2/L3]]
17606 !! wikitext
17607 {{../../../../More than parent}}
17608 !! html
17609 <p>{{../../../../More than parent}}
17610 </p>
17611 !! end
17612
17613 !! test
17614 Definition list code coverage
17615 !! wikitext
17616 ; title : def
17617 ; title : def
17618 ;title: def
17619 !! html/php
17620 <dl><dt> title &#160;</dt>
17621 <dd> def</dd>
17622 <dt> title&#160;</dt>
17623 <dd> def</dd>
17624 <dt>title</dt>
17625 <dd> def</dd></dl>
17626
17627 !! html/parsoid
17628 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17629 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17630 <dt>title</dt><dd> def</dd></dl>
17631 !! end
17632
17633 !! test
17634 Don't fall for the self-closing div
17635 !! wikitext
17636 <div>hello world</div/>
17637 !! html
17638 <div>hello world</div>
17639
17640 !! end
17641
17642 !! test
17643 MSGNW magic word
17644 !! wikitext
17645 {{MSGNW:msg}}
17646 !! html
17647 <p>&#91;&#91;:Template:Msg&#93;&#93;
17648 </p>
17649 !! end
17650
17651 !! test
17652 RAW magic word
17653 !! wikitext
17654 {{RAW:QUERTY}}
17655 !! html
17656 <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>
17657 </p>
17658 !! end
17659
17660 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17661 !! test
17662 Always escape literal '>' in output, not just after '<'
17663 !! wikitext
17664 ><>
17665 !! html
17666 <p>&gt;&lt;&gt;
17667 </p>
17668 !! end
17669
17670 !! test
17671 Template caching
17672 !! wikitext
17673 {{Test}}
17674 {{Test}}
17675 !! html
17676 <p>This is a test template
17677 This is a test template
17678 </p>
17679 !! end
17680
17681
17682 !! article
17683 MediaWiki:Fake
17684 !! text
17685 ==header==
17686 !! endarticle
17687
17688 !! test
17689 Inclusion of !userCanEdit() content
17690 !! wikitext
17691 {{MediaWiki:Fake}}
17692 !! html
17693 <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>
17694
17695 !! end
17696
17697
17698 !! test
17699 Out-of-order TOC heading levels
17700 !! wikitext
17701 ==2==
17702 ======6======
17703 ===3===
17704 =1=
17705 =====5=====
17706 ==2==
17707 !! html
17708 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17709 <ul>
17710 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17711 <ul>
17712 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17713 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17714 </ul>
17715 </li>
17716 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17717 <ul>
17718 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17719 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17720 </ul>
17721 </li>
17722 </ul>
17723 </div>
17724
17725 <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>
17726 <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>
17727 <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>
17728 <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>
17729 <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>
17730 <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>
17731
17732 !! end
17733
17734
17735 !! test
17736 ISBN with a dummy number
17737 !! wikitext
17738 ISBN ---
17739 !! html
17740 <p>ISBN ---
17741 </p>
17742 !! end
17743
17744
17745 !! test
17746 ISBN with space-delimited number
17747 !! wikitext
17748 ISBN 92 9017 032 8
17749 !! html
17750 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17751 </p>
17752 !! end
17753
17754
17755 !! test
17756 ISBN with multiple spaces, no number
17757 !! wikitext
17758 ISBN foo
17759 !! html
17760 <p>ISBN foo
17761 </p>
17762 !! end
17763
17764
17765 !! test
17766 ISBN length
17767 !! wikitext
17768 ISBN 123456789
17769
17770 ISBN 1234567890
17771
17772 ISBN 12345678901
17773 !! html
17774 <p>ISBN 123456789
17775 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17776 </p><p>ISBN 12345678901
17777 </p>
17778 !! end
17779
17780
17781 !! test
17782 ISBN with trailing year (bug 8110)
17783 !! wikitext
17784 ISBN 1-234-56789-0 - 2006
17785
17786 ISBN 1 234 56789 0 - 2006
17787 !! html
17788 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17789 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17790 </p>
17791 !! end
17792
17793
17794 !! test
17795 anchorencode
17796 !! wikitext
17797 {{anchorencode:foo bar©#%n}}
17798 !! html
17799 <p>foo_bar.C2.A9.23.25n
17800 </p>
17801 !! end
17802
17803 !! test
17804 anchorencode trims spaces
17805 !! wikitext
17806 {{anchorencode: __pretty__please__}}
17807 !! html
17808 <p>pretty_please
17809 </p>
17810 !! end
17811
17812 !! test
17813 anchorencode deals with links
17814 !! wikitext
17815 {{anchorencode: [[hello|world]] [[hi]]}}
17816 !! html
17817 <p>world_hi
17818 </p>
17819 !! end
17820
17821 !! test
17822 anchorencode deals with templates
17823 !! wikitext
17824 {{anchorencode: {{Foo}} }}
17825 !! html
17826 <p>FOO
17827 </p>
17828 !! end
17829
17830 !! test
17831 anchorencode encodes like the TOC generator: (bug 18431)
17832 !! wikitext
17833 === _ +:.3A%3A&&amp;]] ===
17834 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17835 __NOEDITSECTION__
17836 !! html
17837 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17838 <p>.2B:.3A.253A.26.26.5D.5D
17839 </p>
17840 !! end
17841
17842 !! test
17843 Bug 6200: blockquotes and paragraph formatting
17844 !! wikitext
17845 <blockquote>
17846 foo
17847 </blockquote>
17848
17849 bar
17850
17851 baz
17852 !! html
17853 <blockquote>
17854 <p>foo
17855 </p>
17856 </blockquote>
17857 <p>bar
17858 </p>
17859 <pre>baz
17860 </pre>
17861 !! end
17862
17863 !! test
17864 Bug 8293: Use of center tag ruins paragraph formatting
17865 !! wikitext
17866 <center>
17867 foo
17868 </center>
17869
17870 bar
17871
17872 baz
17873 !! html
17874 <center>
17875 <p>foo
17876 </p>
17877 </center>
17878 <p>bar
17879 </p>
17880 <pre>baz
17881 </pre>
17882 !! end
17883
17884 !!test
17885 Parsing of overlapping (improperly nested) inline html tags
17886 !! wikitext
17887 <span><s>x</span></s>
17888 !! html/php
17889 <p><span><s>x&lt;/span&gt;</s></span>
17890 </p>
17891 !! html/parsoid
17892 <p><span><s>x</s></span>
17893 </p>
17894 !!end
17895
17896 ###
17897 ### Language variants related tests
17898 ###
17899 !! test
17900 Self-link in language variants
17901 !! options
17902 title=[[Dunav]] language=sr
17903 !! wikitext
17904 Both [[Dunav]] and [[Дунав]] are names for this river.
17905 !! html
17906 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17907 </p>
17908 !!end
17909
17910 !! article
17911 Дуна
17912 !! text
17913 content
17914 !! endarticle
17915
17916 !! test
17917 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17918 !! options
17919 title=[[Duna]] language=sr
17920 !! wikitext
17921 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17922 !! html
17923 <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.
17924 </p>
17925 !! end
17926
17927 !! test
17928 Link to a section of a variant of this title shouldn't be parsed as self-link
17929 !! options
17930 title=[[Duna]] language=sr
17931 !! wikitext
17932 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17933 !! html
17934 <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.
17935 </p>
17936 !! end
17937
17938 !! test
17939 Link to pages in language variants
17940 !! options
17941 language=sr
17942 !! wikitext
17943 Main Page can be written as [[Маин Паге]]
17944 !! html
17945 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17946 </p>
17947 !!end
17948
17949
17950 !! test
17951 Multiple links to pages in language variants
17952 !! options
17953 language=sr
17954 !! wikitext
17955 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17956 !! html
17957 <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>.
17958 </p>
17959 !!end
17960
17961
17962 !! test
17963 Simple template in language variants
17964 !! options
17965 language=sr
17966 !! wikitext
17967 {{тест}}
17968 !! html
17969 <p>This is a test template
17970 </p>
17971 !! end
17972
17973
17974 !! test
17975 Template with explicit namespace in language variants
17976 !! options
17977 language=sr
17978 !! wikitext
17979 {{Template:тест}}
17980 !! html
17981 <p>This is a test template
17982 </p>
17983 !! end
17984
17985
17986 !! test
17987 Basic test for template parameter in language variants
17988 !! options
17989 language=sr
17990 !! wikitext
17991 {{парамтест|param=foo}}
17992 !! html
17993 <p>This is a test template with parameter foo
17994 </p>
17995 !! end
17996
17997
17998 !! test
17999 Simple category in language variants
18000 !! options
18001 language=sr cat
18002 !! wikitext
18003 [[Category:МедиаWики Усер'с Гуиде]]
18004 !! html
18005 <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>
18006 !! end
18007
18008
18009 !! article
18010 Category:分类
18011 !! text
18012 blah
18013 !! endarticle
18014
18015 !! article
18016 Category:分類
18017 !! text
18018 blah
18019 !! endarticle
18020
18021 !! test
18022 Don't convert blue categorylinks to another variant (bug 33210)
18023 !! options
18024 language=zh cat
18025 !! wikitext
18026 [[A]][[Category:分类]]
18027 !! html
18028 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18029 !! end
18030
18031
18032 !! test
18033 Stripping -{}- tags (language variants)
18034 !! options
18035 language=sr
18036 !! wikitext
18037 Latin proverb: -{Ne nuntium necare}-
18038 !! html
18039 <p>Latin proverb: Ne nuntium necare
18040 </p>
18041 !! end
18042
18043
18044 !! test
18045 Prevent conversion with -{}- tags (language variants)
18046 !! options
18047 language=sr variant=sr-ec
18048 !! wikitext
18049 Latinski: -{Ne nuntium necare}-
18050 !! html
18051 <p>Латински: Ne nuntium necare
18052 </p>
18053 !! end
18054
18055
18056 !! test
18057 Prevent conversion of text with -{}- tags (language variants)
18058 !! options
18059 language=sr variant=sr-ec
18060 !! wikitext
18061 Latinski: -{Ne nuntium necare}-
18062 !! html
18063 <p>Латински: Ne nuntium necare
18064 </p>
18065 !! end
18066
18067
18068 !! test
18069 Prevent conversion of links with -{}- tags (language variants)
18070 !! options
18071 language=sr variant=sr-ec
18072 !! wikitext
18073 -{[[Main Page]]}-
18074 !! html
18075 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18076 </p>
18077 !! end
18078
18079
18080 !! test
18081 -{}- tags within headlines (within html for parserConvert())
18082 !! options
18083 language=sr variant=sr-ec
18084 !! wikitext
18085 == -{Naslov}- ==
18086 !! html
18087 <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>
18088
18089 !! end
18090
18091
18092 !! test
18093 Explicit definition of language variant alternatives
18094 !! options
18095 language=zh variant=zh-tw
18096 !! wikitext
18097 -{zh:China;zh-tw:Taiwan}-, not China
18098 !! html
18099 <p>Taiwan, not China
18100 </p>
18101 !! end
18102
18103
18104 !! test
18105 Conversion around HTML tags
18106 !! options
18107 language=sr variant=sr-ec
18108 !! wikitext
18109 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18110 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18111 !! html
18112 <p>
18113 <span title="ЛаCтин">ски</span>
18114 </p>
18115 !! end
18116
18117
18118 !! test
18119 Explicit session-wise language variant mapping (A flag and - flag)
18120 !! options
18121 language=zh variant=zh-tw
18122 !! wikitext
18123 Taiwan is not China.
18124 But -{A|zh:China;zh-tw:Taiwan}- is China,
18125 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18126 and -{China}- is China.
18127 !! html
18128 <p>Taiwan is not China.
18129 But Taiwan is Taiwan,
18130 (This should be stripped!)
18131 and China is China.
18132 </p>
18133 !! end
18134
18135 !! test
18136 Explicit session-wise language variant mapping (H flag for hide)
18137 !! options
18138 language=zh variant=zh-tw
18139 !! wikitext
18140 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18141 Taiwan is China.
18142 !! html
18143 <p>(This should be stripped!)
18144 Taiwan is Taiwan.
18145 </p>
18146 !! end
18147
18148 !! test
18149 Adding explicit conversion rule for title (T flag)
18150 !! options
18151 language=zh variant=zh-tw showtitle
18152 !! wikitext
18153 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18154 !! html
18155 Taiwan
18156 <p>Should be stripped!
18157 </p>
18158 !! end
18159
18160 !! test
18161 Testing that changing the language variant here in the tests actually works
18162 !! options
18163 language=zh variant=zh showtitle
18164 !! wikitext
18165 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18166 !! html
18167 China
18168 <p>Should be stripped!
18169 </p>
18170 !! end
18171
18172 !! test
18173 Recursive conversion of alt and title attrs shouldn't clear converter state
18174 !! options
18175 language=zh variant=zh-cn showtitle
18176 !! wikitext
18177 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18178 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18179 !! html
18180 China
18181 <p>
18182 Should be stripped<span title="Exclamation">!</span>
18183 </p>
18184 !! end
18185
18186 !! test
18187 Bug 24072: more test on conversion rule for title
18188 !! options
18189 language=zh variant=zh-tw showtitle
18190 !! wikitext
18191 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18192 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18193 !! html
18194 Taiwan
18195 <p>This should be stripped!
18196 This won't take interferes with the title rule.
18197 </p>
18198 !! end
18199
18200 !! test
18201 Partly disable title conversion if variant == main language code
18202 !! options
18203 language=zh variant=zh title=[[ZH]] showtitle
18204 !! wikitext
18205 -{T|zh-cn:CN;zh-tw:TW}-
18206 !! html
18207 ZH
18208 <p>
18209 </p>
18210 !! end
18211
18212 !! test
18213 Partly disable title conversion if variant == main language code, more
18214 !! options
18215 language=zh variant=zh title=[[ZH]] showtitle
18216 !! wikitext
18217 -{T|TW}-
18218 !! html
18219 ZH
18220 <p>
18221 </p>
18222 !! end
18223
18224 !! test
18225 Raw output of variant escape tags (R flag)
18226 !! options
18227 language=zh variant=zh-tw
18228 !! wikitext
18229 Raw: -{R|zh:China;zh-tw:Taiwan}-
18230 !! html
18231 <p>Raw: zh:China;zh-tw:Taiwan
18232 </p>
18233 !! end
18234
18235 !! test
18236 Nested using of manual convert syntax
18237 !! options
18238 language=zh variant=zh-hk
18239 !! wikitext
18240 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18241 !! html
18242 <p>Nested: Hello Hong Kong!
18243 </p>
18244 !! end
18245
18246 !! test
18247 Proper conversion of text in external links
18248 !! options
18249 language=sr variant=sr-ec
18250 !! wikitext
18251 http://www.google.com
18252 gopher://www.google.com
18253 [http://www.google.com http://www.google.com]
18254 [gopher://www.google.com gopher://www.google.com]
18255 [https://www.google.com irc://www.google.com]
18256 [ftp://www.google.com www.google.com/ftp://dir]
18257 [//www.google.com www.google.com]
18258 !! html
18259 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18260 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18261 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18262 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18263 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18264 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18265 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18266 </p>
18267 !! end
18268
18269 !! test
18270 Do not convert roman numbers to language variants
18271 !! options
18272 language=sr variant=sr-ec
18273 !! wikitext
18274 Fridrih IV je car.
18275 !! html
18276 <p>Фридрих IV је цар.
18277 </p>
18278 !! end
18279
18280 !! test
18281 Unclosed language converter markup "-{"
18282 !! options
18283 language=sr
18284 !! wikitext
18285 -{T|hello
18286 !! html
18287 <p>-{T|hello
18288 </p>
18289 !! end
18290
18291 !! test
18292 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18293 !! options
18294 language=sr
18295 !! wikitext
18296 -{R|=&gt;}-
18297 !! html
18298 <p>=&gt;
18299 </p>
18300 !!end
18301
18302 !! test
18303 Don't break link parsing if language converter markup is in the caption.
18304 !! options
18305 language=sr variant=sr-ec
18306 !! wikitext
18307 [[Main Page|-{R|main page}-]]
18308 !! html
18309 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18310 </p>
18311 !! end
18312
18313 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18314 !! test
18315 Don't break image parsing if language converter markup is in the caption.
18316 !! options
18317 language=sr
18318 !! wikitext
18319 [[File:Foobar.jpg|-{R|caption}-]]
18320 !! html/parsoid
18321 <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>
18322 </p>
18323 !! end
18324
18325 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18326 !! test
18327 Don't break list handling if language converter markup is in the item.
18328 !! options
18329 language=zh variant=zh-cn
18330 !! wikitext
18331 ;-{zh-cn:AAA;zh-tw:BBB}-
18332 !! html/php
18333 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18334
18335 !! html/parsoid
18336 <dl><dt>AAA
18337 </dt></dl>
18338 !! end
18339
18340 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18341 !! test
18342 Don't break table handling if language converter markup is in the cell.
18343 !! options
18344 language=sr variant=sr-ec
18345 !! wikitext
18346 {|
18347 |-
18348 | -{R|B}-
18349 |}
18350 !! html/php
18351 <table>
18352
18353 <tr>
18354 <td>Б}-
18355 </td></tr></table>
18356
18357 !! html/parsoid
18358 <table>
18359
18360 <tr>
18361 <td> B
18362 </td></tr></table>
18363
18364 !! end
18365
18366 !! test
18367 Bug 529: Uncovered bullet
18368 !! wikitext
18369 * Foo {{bullet}}
18370 !! html
18371 <ul><li> Foo </li>
18372 <li> Bar</li></ul>
18373
18374 !! end
18375
18376 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18377 # Templates in Wikipedia rely on this behavior, as tidy has always been
18378 # enabled there. These tests are normally run *without* tidy, so specify the
18379 # full output here.
18380 # To test realistic parsing behavior, apply a tidy-like transformation to both
18381 # the expected output and your parser's output.
18382 !! test
18383 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18384 !! wikitext
18385 ******* Foo {{bullet}}
18386 !! html
18387 <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>
18388 <li> Bar</li></ul>
18389
18390 !! end
18391
18392 !! test
18393 Bug 529: Uncovered table already at line-start
18394 !! wikitext
18395 x
18396
18397 {{table}}
18398 y
18399 !! html
18400 <p>x
18401 </p>
18402 <table>
18403 <tr>
18404 <td> 1 </td>
18405 <td> 2
18406 </td></tr>
18407 <tr>
18408 <td> 3 </td>
18409 <td> 4
18410 </td></tr></table>
18411 <p>y
18412 </p>
18413 !! end
18414
18415 !! test
18416 Bug 529: Uncovered bullet in parser function result
18417 !! wikitext
18418 * Foo {{lc:{{bullet}} }}
18419 !! html
18420 <ul><li> Foo </li>
18421 <li> bar</li></ul>
18422
18423 !! end
18424
18425 !! test
18426 Bug 5678: Double-parsed template argument
18427 !! wikitext
18428 {{lc:{{{1}}}|hello}}
18429 !! html
18430 <p>{{{1}}}
18431 </p>
18432 !! end
18433
18434 !! test
18435 Bug 5678: Double-parsed template invocation
18436 !! wikitext
18437 {{lc:{{paramtest {{!}} param = hello }} }}
18438 !! html
18439 <p>{{paramtest | param = hello }}
18440 </p>
18441 !! end
18442
18443 !! test
18444 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18445 !! options
18446 language=cs
18447 title=[[Main Page]]
18448 !! wikitext
18449 {{PRVNÍVELKÉ:ěščř}}
18450 {{prvnívelké:ěščř}}
18451 {{PRVNÍMALÉ:ěščř}}
18452 {{prvnímalé:ěščř}}
18453 {{MALÁ:ěščř}}
18454 {{malá:ěščř}}
18455 {{VELKÁ:ěščř}}
18456 {{velká:ěščř}}
18457 !! html
18458 <p>Ěščř
18459 Ěščř
18460 ěščř
18461 ěščř
18462 ěščř
18463 ěščř
18464 ĚŠČŘ
18465 ĚŠČŘ
18466 </p>
18467 !! end
18468
18469 !! test
18470 Morwen/13: Unclosed link followed by heading
18471 !! wikitext
18472 [[link
18473 ==heading==
18474 !! html
18475 <p>[[link
18476 </p>
18477 <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>
18478
18479 !! end
18480
18481 !! test
18482 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18483 !! wikitext
18484 {{foo|
18485 =heading=
18486 !! html
18487 <p>{{foo|
18488 </p>
18489 <h1><span class="mw-headline" id="heading">heading</span></h1>
18490
18491 !! end
18492
18493 !! test
18494 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18495 !! wikitext
18496 {{foo|
18497 ==heading==
18498 !! html
18499 <p>{{foo|
18500 </p>
18501 <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>
18502
18503 !! end
18504
18505 !! test
18506 Tildes in comments
18507 !! options
18508 pst
18509 !! wikitext
18510 <!-- ~~~~ -->
18511 !! html
18512 <!-- ~~~~ -->
18513 !! end
18514
18515 !! test
18516 Paragraphs inside divs (no extra line breaks)
18517 !! wikitext
18518 <div>Line one
18519
18520 Line two</div>
18521 !! html
18522 <div>Line one
18523 Line two</div>
18524
18525 !! end
18526
18527 !! test
18528 Paragraphs inside divs (extra line break on open)
18529 !! wikitext
18530 <div>
18531 Line one
18532
18533 Line two</div>
18534 !! html
18535 <div>
18536 <p>Line one
18537 </p>
18538 Line two</div>
18539
18540 !! end
18541
18542 !! test
18543 Paragraphs inside divs (extra line break on close)
18544 !! wikitext
18545 <div>Line one
18546
18547 Line two
18548 </div>
18549 !! html
18550 <div>Line one
18551 <p>Line two
18552 </p>
18553 </div>
18554
18555 !! end
18556
18557 !! test
18558 Paragraphs inside divs (extra line break on open and close)
18559 !! wikitext
18560 <div>
18561 Line one
18562
18563 Line two
18564 </div>
18565 !! html
18566 <div>
18567 <p>Line one
18568 </p><p>Line two
18569 </p>
18570 </div>
18571
18572 !! end
18573
18574 !! test
18575 Nesting tags, paragraphs on lines which begin with <div>
18576 !! wikitext
18577 <div></div><strong>A
18578 B</strong>
18579 !! html/php+tidy
18580 <p><strong>A</strong></p>
18581 <p><strong>B</strong></p>
18582 !! html/parsoid
18583 <div></div>
18584 <p><strong>A
18585 B</strong>
18586 </p>
18587 !! end
18588
18589 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18590 !! test
18591 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18592 !! wikitext
18593 <blockquote>Line one
18594
18595 Line two</blockquote>
18596 !! html
18597 <blockquote>Line one
18598 Line two</blockquote>
18599
18600 !! html+tidy
18601 <blockquote>
18602 <p>Line one Line two</p>
18603 </blockquote>
18604 !! end
18605
18606 !! test
18607 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18608 !! wikitext
18609 <blockquote>
18610 Line one
18611
18612 Line two</blockquote>
18613 !! html
18614 <blockquote>
18615 <p>Line one
18616 </p>
18617 Line two</blockquote>
18618
18619 !! html+tidy
18620 <blockquote>
18621 <p>Line one</p>
18622 Line two</blockquote>
18623 !! end
18624
18625 !! test
18626 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18627 !! wikitext
18628 <blockquote>Line one
18629
18630 Line two
18631 </blockquote>
18632 !! html
18633 <blockquote>Line one
18634 <p>Line two
18635 </p>
18636 </blockquote>
18637
18638 !! html+tidy
18639 <blockquote>
18640 <p>Line one</p>
18641 <p>Line two</p>
18642 </blockquote>
18643 !! end
18644
18645 !! test
18646 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18647 !! wikitext
18648 <blockquote>
18649 Line one
18650
18651 Line two
18652 </blockquote>
18653 !! html
18654 <blockquote>
18655 <p>Line one
18656 </p><p>Line two
18657 </p>
18658 </blockquote>
18659
18660 !! html+tidy
18661 <blockquote>
18662 <p>Line one</p>
18663 <p>Line two</p>
18664 </blockquote>
18665 !! end
18666
18667 !! test
18668 Paragraphs inside blockquotes/divs (no extra line breaks)
18669 !! wikitext
18670 <blockquote><div>Line one
18671
18672 Line two</div></blockquote>
18673 !! html
18674 <blockquote><div>Line one
18675 Line two</div></blockquote>
18676
18677 !! end
18678
18679 !! test
18680 Paragraphs inside blockquotes/divs (extra line break on open)
18681 !! wikitext
18682 <blockquote><div>
18683 Line one
18684
18685 Line two</div></blockquote>
18686 !! html
18687 <blockquote><div>
18688 <p>Line one
18689 </p>
18690 Line two</div></blockquote>
18691
18692 !! end
18693
18694 !! test
18695 Paragraphs inside blockquotes/divs (extra line break on close)
18696 !! wikitext
18697 <blockquote><div>Line one
18698
18699 Line two
18700 </div></blockquote>
18701 !! html
18702 <blockquote><div>Line one
18703 <p>Line two
18704 </p>
18705 </div></blockquote>
18706
18707 !! end
18708
18709 !! test
18710 Paragraphs inside blockquotes/divs (extra line break on open and close)
18711 !! wikitext
18712 <blockquote><div>
18713 Line one
18714
18715 Line two
18716 </div></blockquote>
18717 !! html
18718 <blockquote><div>
18719 <p>Line one
18720 </p><p>Line two
18721 </p>
18722 </div></blockquote>
18723
18724 !! end
18725
18726 !! test
18727 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18728 !! options
18729 wgLinkHolderBatchSize=0
18730 !! wikitext
18731 [[meatball:1]]
18732 [[meatball:2]]
18733 [[meatball:3]]
18734 !! html
18735 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18736 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18737 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18738 </p>
18739 !! end
18740
18741 !! test
18742 Free external link invading image caption
18743 !! wikitext
18744 [[Image:Foobar.jpg|thumb|http://x|hello]]
18745 !! html
18746 <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>
18747
18748 !! end
18749
18750 !! test
18751 Bug 15196: localised external link numbers
18752 !! options
18753 language=fa
18754 !! wikitext
18755 [http://en.wikipedia.org/]
18756 !! html/php
18757 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18758 </p>
18759 !! html/parsoid
18760 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18761 !! end
18762
18763 !! test
18764 Multibyte character in padleft
18765 !! wikitext
18766 {{padleft:-Hello|7|Æ}}
18767 !! html
18768 <p>Æ-Hello
18769 </p>
18770 !! end
18771
18772 !! test
18773 Multibyte character in padright
18774 !! wikitext
18775 {{padright:Hello-|7|Æ}}
18776 !! html
18777 <p>Hello-Æ
18778 </p>
18779 !! end
18780
18781 !!test
18782 formatdate parser function
18783 !! wikitext
18784 {{#formatdate:2009-03-24}}
18785 !! html
18786 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18787 </p>
18788 !! end
18789
18790 !!test
18791 formatdate parser function, with default format
18792 !! wikitext
18793 {{#formatdate:2009-03-24|mdy}}
18794 !! html
18795 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18796 </p>
18797 !! end
18798
18799 !! test
18800 Spacing of numbers in formatted dates
18801 !! wikitext
18802 {{#formatdate:January 15}}
18803 !! html
18804 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18805 </p>
18806 !! end
18807
18808 !! test
18809 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
18810 !! options
18811 language=nl title=[[MediaWiki:Common.css]]
18812 !! wikitext
18813 {{#formatdate:2009-03-24|dmy}}
18814 !! html
18815 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18816 </p>
18817 !! end
18818
18819 #
18820 #
18821 #
18822
18823 #
18824 # Edit comments
18825 #
18826
18827 !! test
18828 Edit comment with link
18829 !! options
18830 comment
18831 !! wikitext
18832 I like the [[Main Page]] a lot
18833 !! html
18834 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18835 !!end
18836
18837 !! test
18838 Edit comment with link and link text
18839 !! options
18840 comment
18841 !! wikitext
18842 I like the [[Main Page|best pages]] a lot
18843 !! html
18844 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18845 !!end
18846
18847 !! test
18848 Edit comment with link and link text with suffix
18849 !! options
18850 comment
18851 !! wikitext
18852 I like the [[Main Page|best page]]s a lot
18853 !! html
18854 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18855 !!end
18856
18857 !! test
18858 Edit comment with section link (non-local, eg in history list)
18859 !! options
18860 comment title=[[Main Page]]
18861 !! wikitext
18862 /* External links */ removed bogus entries
18863 !! html
18864 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18865 !!end
18866
18867 !! test
18868 Edit comment with section link and text before it (non-local, eg in history list)
18869 !! options
18870 comment title=[[Main Page]]
18871 !! wikitext
18872 pre-comment text /* External links */ removed bogus entries
18873 !! html
18874 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>
18875 !!end
18876
18877 !! test
18878 Edit comment with section link (local, eg in diff view)
18879 !! options
18880 comment local title=[[Main Page]]
18881 !! wikitext
18882 /* External links */ removed bogus entries
18883 !! html
18884 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18885 !!end
18886
18887 !! test
18888 Edit comment with subpage link (bug 14080)
18889 !! options
18890 comment
18891 subpage
18892 title=[[Subpage test]]
18893 !! wikitext
18894 Poked at a [[/subpage]] here...
18895 !! html
18896 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18897 !!end
18898
18899 !! test
18900 Edit comment with subpage link and link text (bug 14080)
18901 !! options
18902 comment
18903 subpage
18904 title=[[Subpage test]]
18905 !! wikitext
18906 Poked at a [[/subpage|neat little page]] here...
18907 !! html
18908 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18909 !!end
18910
18911 !! test
18912 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18913 !! options
18914 comment
18915 title=[[Subpage test]]
18916 !! wikitext
18917 Poked at a [[/subpage]] here...
18918 !! html
18919 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...
18920 !!end
18921
18922 !! test
18923 Edit comment with bare anchor link (local, as on diff)
18924 !! options
18925 comment
18926 local
18927 title=[[Main Page]]
18928 !! wikitext
18929 [[#section]]
18930 !! html
18931 <a href="#section">#section</a>
18932 !! end
18933
18934 !! test
18935 Edit comment with bare anchor link (non-local, as on history)
18936 !! options
18937 comment
18938 title=[[Main Page]]
18939 !! wikitext
18940 [[#section]]
18941 !! html
18942 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18943 !! end
18944
18945 !! test
18946 Anchor starting with underscore
18947 !! wikitext
18948 [[#_ref|One]]
18949 !! html
18950 <p><a href="#_ref">One</a>
18951 </p>
18952 !! end
18953
18954 !! test
18955 Id starting with underscore
18956 !! wikitext
18957 <div id="_ref"></div>
18958 !! html
18959 <div id="_ref"></div>
18960
18961 !! end
18962
18963 !! test
18964 Space normalisation on autocomment (bug 22784)
18965 !! options
18966 comment
18967 title=[[Main Page]]
18968 !! wikitext
18969 /* __hello__world__ */
18970 !! html
18971 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18972 !! end
18973
18974 !! test
18975 percent-encoding and + signs in comments (Bug 26410)
18976 !! options
18977 comment
18978 !! wikitext
18979 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18980 !! html
18981 <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>
18982 !! end
18983
18984 # Parsoid doesn't support this yet: see bug 73581
18985 # but it *should* omit the 'src' attribute if the image is bad.
18986 # PHP side of tests was disabled in
18987 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18988 # because of issues in the PHP parserTests infrastructure
18989 # (but the output below is indeed what the PHP side emits)
18990 !! test
18991 Bad images - basic functionality
18992 !! wikitext
18993 [[File:Bad.jpg]]
18994 !! DISABLED/html/php
18995 !! html/parsoid
18996 <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>
18997 !! end
18998
18999 !! test
19000 Bad images - bug 16039: text after bad image disappears
19001 !! wikitext
19002 Foo bar
19003 [[File:Bad.jpg]]
19004 Bar foo
19005 !! DISABLED/html/php
19006 <p>Foo bar
19007 </p><p>Bar foo
19008 </p>
19009 !! html/parsoid
19010 <p>Foo bar
19011 <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>
19012 Bar foo</p>
19013 !! end
19014
19015 !! test
19016 Verify that displaytitle works (bug #22501) no displaytitle
19017 !! options
19018 showtitle
19019 !! config
19020 wgAllowDisplayTitle=true
19021 wgRestrictDisplayTitle=false
19022 !! wikitext
19023 this is not the the title
19024 !! html
19025 Parser test
19026 <p>this is not the the title
19027 </p>
19028 !! end
19029
19030 !! test
19031 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19032 !! options
19033 showtitle
19034 title=[[Screen]]
19035 !! config
19036 wgAllowDisplayTitle=true
19037 wgRestrictDisplayTitle=false
19038 !! wikitext
19039 this is not the the title
19040 {{DISPLAYTITLE:whatever}}
19041 !! html
19042 whatever
19043 <p>this is not the the title
19044 </p>
19045 !! end
19046
19047 !! test
19048 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19049 !! options
19050 showtitle
19051 title=[[Screen]]
19052 !! config
19053 wgAllowDisplayTitle=true
19054 wgRestrictDisplayTitle=true
19055 !! wikitext
19056 this is not the the title
19057 {{DISPLAYTITLE:whatever}}
19058 !! html
19059 Screen
19060 <p>this is not the the title
19061 </p>
19062 !! end
19063
19064 !! test
19065 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19066 !! options
19067 showtitle
19068 title=[[Screen]]
19069 !! config
19070 wgAllowDisplayTitle=true
19071 wgRestrictDisplayTitle=true
19072 !! wikitext
19073 this is not the the title
19074 {{DISPLAYTITLE:screen}}
19075 !! html
19076 screen
19077 <p>this is not the the title
19078 </p>
19079 !! end
19080
19081 !! test
19082 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19083 !! options
19084 showtitle
19085 title=[[Screen]]
19086 !! config
19087 wgAllowDisplayTitle=false
19088 !! wikitext
19089 this is not the the title
19090 {{DISPLAYTITLE:screen}}
19091 !! html
19092 Screen
19093 <p>this is not the the title
19094 <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>
19095 </p>
19096 !! end
19097
19098 !! test
19099 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19100 !! options
19101 showtitle
19102 title=[[Screen]]
19103 !! config
19104 wgAllowDisplayTitle=false
19105 !! wikitext
19106 this is not the the title
19107 !! html
19108 Screen
19109 <p>this is not the the title
19110 </p>
19111 !! end
19112
19113 !! test
19114 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19115 !! options
19116 showtitle
19117 title=[[Screen]]
19118 !! config
19119 wgAllowDisplayTitle=true
19120 wgRestrictDisplayTitle=true
19121 !! wikitext
19122 this is not the the title
19123 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19124 !! html
19125 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19126 <p>this is not the the title
19127 </p>
19128 !! end
19129
19130 !! test
19131 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19132 !! options
19133 showtitle
19134 title=[[Screen]]
19135 !! config
19136 wgAllowDisplayTitle=true
19137 wgRestrictDisplayTitle=true
19138 !! wikitext
19139 this is not the the title
19140 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19141 !! html
19142 <span style="color: red;">s</span>creen
19143 <p>this is not the the title
19144 </p>
19145 !! end
19146
19147 !! test
19148 Page status indicators: Empty name is invalid
19149 !! options
19150 showindicators
19151 !! wikitext
19152 <indicator name=" "></indicator>
19153 <indicator></indicator>
19154 !! html
19155 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19156 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19157 </p>
19158 !! end
19159
19160 !! test
19161 Page status indicators: Weird syntaxes that are okay
19162 !! options
19163 showindicators
19164 !! wikitext
19165 <indicator name="empty" />
19166 <indicator name></indicator>
19167 !! html
19168 empty=
19169 name=
19170 <p><br />
19171 </p>
19172 !! end
19173
19174 !! test
19175 Page status indicators: Torture test
19176 !! options
19177 showindicators
19178 !! wikitext
19179 <indicator name="01">hello world</indicator>
19180 <indicator name="02">[[Main Page]]</indicator>
19181 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19182 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19183 <indicator name="05">* foo
19184 * bar</indicator>
19185 <indicator name="06"><nowiki>foo</nowiki></indicator>
19186 <indicator name="07"> Preformatted</indicator>
19187 <indicator name="08"><div>Broken tag</indicator>
19188 <indicator name="09">{| class=wikitable
19189 | cell
19190 |}</indicator>
19191 <indicator name="10">Two
19192
19193 paragraphs</indicator>
19194 !! html
19195 01=hello world
19196 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19197 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" />
19198 04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a>
19199 05=<ul><li> foo</li>
19200 <li> bar</li></ul>
19201
19202 06=foo
19203 07=<pre>Preformatted
19204 </pre>
19205 08=<div>Broken tag</div>
19206
19207 09=<table class="wikitable">
19208 <tr>
19209 <td> cell
19210 </td></tr></table>
19211
19212 10=<p>Two
19213 </p><p>paragraphs
19214 </p>
19215 <p><br />
19216 </p><p><br />
19217 </p><p><br />
19218 </p><p><br />
19219 </p><p><br />
19220 </p>
19221 !! end
19222
19223 !! test
19224 preload: check <noinclude> and <includeonly>
19225 !! options
19226 preload
19227 !! wikitext
19228 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19229 !! html
19230 Hello kind world.
19231 !! end
19232
19233 !! test
19234 preload: check <onlyinclude>
19235 !! options
19236 preload
19237 !! wikitext
19238 Goodbye <onlyinclude>Hello world</onlyinclude>
19239 !! html
19240 Hello world
19241 !! end
19242
19243 !! test
19244 preload: can pass tags through if we want to
19245 !! options
19246 preload
19247 !! wikitext
19248 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19249 !! html
19250 <includeonly>Hello world</includeonly>
19251 !! end
19252
19253 !! test
19254 preload: check that it doesn't try to do tricks
19255 !! options
19256 preload
19257 !! wikitext
19258 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19259 !! html
19260 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19261 !! end
19262
19263 !! test
19264 Play a bit with r67090 and bug 3158
19265 !! wikitext
19266 <div style="width:50% !important">&nbsp;</div>
19267 <div style="width:50%&nbsp;!important">&nbsp;</div>
19268 <div style="width:50%&#160;!important">&nbsp;</div>
19269 <div style="border : solid;">&nbsp;</div>
19270 !! html/php
19271 <div style="width:50% !important">&#160;</div>
19272 <div style="width:50% !important">&#160;</div>
19273 <div style="width:50% !important">&#160;</div>
19274 <div style="border&#160;: solid;">&#160;</div>
19275
19276 !! html/parsoid
19277 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19278 <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>
19279 <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>
19280 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19281
19282 !! end
19283
19284 !! test
19285 HTML5 data attributes
19286 !! wikitext
19287 <span data-foo="bar">Baz</span>
19288 <p data-abc-def_hij="">Quuz</p>
19289 !! html
19290 <p><span data-foo="bar">Baz</span>
19291 </p>
19292 <p data-abc-def_hij="">Quuz</p>
19293
19294 !! end
19295
19296 !! test
19297 percent-encoding and + signs in internal links (Bug 26410)
19298 !! wikitext
19299 [[User:+%]] [[Page+title%]]
19300 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19301 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19302 [[%33%45]] [[%33%45+]]
19303 !! html/php
19304 <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>
19305 <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>
19306 <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>
19307 <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>
19308 </p>
19309 !! html/parsoid
19310 <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>
19311 !! end
19312
19313 !! test
19314 Special characters in embedded file links (bug 27679)
19315 !! wikitext
19316 [[File:Contains & ampersand.jpg]]
19317 [[File:Does not exist.jpg|Title with & ampersand]]
19318 !! html/php
19319 <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>
19320 <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>
19321 </p>
19322 !! html/parsoid
19323 <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>
19324 <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>
19325 !! end
19326
19327 !! test
19328 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19329 !! wikitext
19330 Text&apos;s been normalized?
19331 !! html
19332 <p>Text&#39;s been normalized?
19333 </p>
19334 !! end
19335
19336 !! test
19337 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19338 !! wikitext
19339 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19340 !! html
19341 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19342 </p>
19343 !! end
19344
19345 !! test
19346 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19347 !! wikitext
19348 [http://www.example.org/ ideograms]
19349 !! html
19350 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19351 </p>
19352 !! end
19353
19354 !! test
19355 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19356 !! wikitext
19357 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19358 !! html
19359 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19360 </p>
19361 !! end
19362
19363 !! article
19364 Mediawiki:loop1
19365 !! text
19366 {{Identical|A}}
19367 !! endarticle
19368
19369 !! article
19370 Mediawiki:loop2
19371 !! text
19372 {{Identical|B}}
19373 !! endarticle
19374
19375 !! article
19376 Template:Identical
19377 !! text
19378 {{int:loop1}}
19379 {{int:loop2}}
19380 !! endarticle
19381
19382 !! test
19383 Bug 31098 Template which includes system messages which includes the template
19384 !! wikitext
19385 {{Identical}}
19386 !! html
19387 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19388 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19389 </p>
19390 !! end
19391
19392 !! test
19393 Bug31490 Turkish: ucfirst 'blah'
19394 !! options
19395 language=tr
19396 !! wikitext
19397 {{ucfirst:blah}}
19398 !! html
19399 <p>Blah
19400 </p>
19401 !! end
19402
19403 !! test
19404 Bug31490 Turkish: ucfirst 'ix'
19405 !! options
19406 language=tr
19407 !! wikitext
19408 {{ucfirst:ix}}
19409 !! html
19410 <p>İx
19411 </p>
19412 !! end
19413
19414 !! test
19415 Bug31490 Turkish: lcfirst 'BLAH'
19416 !! options
19417 language=tr
19418 !! wikitext
19419 {{lcfirst:BLAH}}
19420 !! html
19421 <p>bLAH
19422 </p>
19423 !! end
19424
19425 !! test
19426 Bug31490 Turkish: ucfırst (with a dotless i)
19427 !! options
19428 language=tr
19429 !! wikitext
19430 {{ucfırst:blah}}
19431 !! html
19432 <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>
19433 </p>
19434 !! end
19435
19436 !! test
19437 Bug31490 ucfırst (with a dotless i) with English language
19438 !! options
19439 language=en
19440 !! wikitext
19441 {{ucfırst:blah}}
19442 !! html
19443 <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>
19444 </p>
19445 !! end
19446
19447 !! test
19448 Bug 26375: TOC with italics
19449 !! options
19450 title=[[Main Page]]
19451 !! wikitext
19452 __TOC__
19453 == ''Lost'' episodes ==
19454 !! html
19455 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19456 <ul>
19457 <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>
19458 </ul>
19459 </div>
19460
19461 <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>
19462
19463 !! end
19464
19465 !! test
19466 Bug 26375: TOC with bold
19467 !! options
19468 title=[[Main Page]]
19469 !! wikitext
19470 __TOC__
19471 == '''should be bold''' then normal text ==
19472 !! html
19473 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19474 <ul>
19475 <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>
19476 </ul>
19477 </div>
19478
19479 <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>
19480
19481 !! end
19482
19483 !! test
19484 Bug 33845: Headings become cursive in TOC when they contain an image
19485 !! options
19486 title=[[Main Page]]
19487 !! wikitext
19488 __TOC__
19489 == Image [[Image:foobar.jpg]] ==
19490 !! html
19491 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19492 <ul>
19493 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19494 </ul>
19495 </div>
19496
19497 <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>
19498
19499 !! end
19500
19501 !! test
19502 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19503 !! options
19504 title=[[Main Page]]
19505 !! wikitext
19506 __TOC__
19507 == <blockquote>Quote</blockquote> ==
19508 !! html
19509 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19510 <ul>
19511 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19512 </ul>
19513 </div>
19514
19515 <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>
19516
19517 !! html+tidy
19518 <p></p>
19519 <div id="toc" class="toc">
19520 <div id="toctitle">
19521 <h2>Contents</h2>
19522 </div>
19523 <ul>
19524 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19525 </ul>
19526 </div>
19527 <p></p>
19528 <h2><span class="mw-headline" id="Quote"></span></h2>
19529 <blockquote>
19530 <p><span class="mw-headline" id="Quote">Quote</span></p>
19531 </blockquote>
19532 <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>
19533 !! end
19534
19535 !! test
19536 Unclosed tags in TOC
19537 !! options
19538 title=[[Main Page]]
19539 !! wikitext
19540 __TOC__
19541 == Proof: 2 < 3 ==
19542 <small>Hanc marginis exiguitas non caperet.</small>
19543 QED
19544 !! html
19545 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19546 <ul>
19547 <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>
19548 </ul>
19549 </div>
19550
19551 <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>
19552 <p><small>Hanc marginis exiguitas non caperet.</small>
19553 QED
19554 </p>
19555 !! end
19556
19557 !! test
19558 Multiple tags in TOC
19559 !! wikitext
19560 __TOC__
19561 == <i>Foo</i> <b>Bar</b> ==
19562
19563 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19564 !! html
19565 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19566 <ul>
19567 <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>
19568 <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>
19569 </ul>
19570 </div>
19571
19572 <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>
19573 <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>
19574
19575 !! html+tidy
19576 <p></p>
19577 <div id="toc" class="toc">
19578 <div id="toctitle">
19579 <h2>Contents</h2>
19580 </div>
19581 <ul>
19582 <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>
19583 <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>
19584 </ul>
19585 </div>
19586 <p></p>
19587 <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>
19588 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19589 <blockquote>
19590 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19591 </blockquote>
19592 <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>
19593 !! end
19594
19595 !! test
19596 Tags with parameters in TOC
19597 !! wikitext
19598 __TOC__
19599 == <sup class="in-h2">Hello</sup> ==
19600
19601 == <sup class="a > b">Evilbye</sup> ==
19602 !! html
19603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19604 <ul>
19605 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19606 <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>
19607 </ul>
19608 </div>
19609
19610 <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>
19611 <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>
19612
19613 !! end
19614
19615 !! test
19616 span tags with directionality in TOC
19617 !! wikitext
19618 __TOC__
19619 == <span dir="ltr">C++</span> ==
19620
19621 == <span dir="rtl">זבנג!</span> ==
19622
19623 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19624
19625 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19626
19627 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19628 !! html
19629 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19630 <ul>
19631 <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>
19632 <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>
19633 <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>
19634 <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>
19635 <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>
19636 </ul>
19637 </div>
19638
19639 <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>
19640 <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>
19641 <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>
19642 <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>
19643 <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>
19644
19645 !! end
19646
19647 !! test
19648 Bug 72884: bdi element in ToC
19649 !! wikitext
19650 __TOC__
19651 == <bdi>test</bdi> ==
19652 !! html
19653 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19654 <ul>
19655 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19656 </ul>
19657 </div>
19658
19659 <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>
19660
19661 !! end
19662
19663 # Note that the html output does not have the <p></p>, but the
19664 # html+tidy output *does*. This is because the empty <p></p> is
19665 # removed by the sanitizer, but only when tidy is *not* enabled (!).
19666 !! test
19667 Empty <p> tag in TOC, removed by Sanitizer (T92892)
19668 !! wikitext
19669 __TOC__
19670 == x ==
19671 !! html
19672 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19673 <ul>
19674 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19675 </ul>
19676 </div>
19677
19678 <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>
19679
19680 !! html+tidy
19681 <p></p>
19682 <div id="toc" class="toc">
19683 <div id="toctitle">
19684 <h2>Contents</h2>
19685 </div>
19686 <ul>
19687 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19688 </ul>
19689 </div>
19690 <p></p>
19691 <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>
19692 !! end
19693
19694 !! article
19695 MediaWiki:Bug32057
19696 !! text
19697 == {{int:headline_sample}} ==
19698 !! endarticle
19699
19700 !! test
19701 Bug 32057: Title needed when expanding <h> nodes.
19702 !! options
19703 title=[[Main Page]]
19704 !! wikitext
19705 {{int:Bug32057}}
19706 !! html
19707 <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>
19708
19709 !! end
19710
19711 !! test
19712 Strip marker in urlencode
19713 !! wikitext
19714 {{urlencode:x<nowiki/>y}}
19715 {{urlencode:x<nowiki/>y|wiki}}
19716 {{urlencode:x<nowiki/>y|path}}
19717 !! html
19718 <p>xy
19719 xy
19720 xy
19721 </p>
19722 !! end
19723
19724 !! test
19725 Strip marker in lc
19726 !! wikitext
19727 {{lc:x<nowiki/>y}}
19728 !! html
19729 <p>xy
19730 </p>
19731 !! end
19732
19733 !! test
19734 Strip marker in uc
19735 !! wikitext
19736 {{uc:x<nowiki/>y}}
19737 !! html
19738 <p>XY
19739 </p>
19740 !! end
19741
19742 !! test
19743 Strip marker in formatNum
19744 !! wikitext
19745 {{formatnum:1<nowiki/>2}}
19746 {{formatnum:1<nowiki/>2|R}}
19747 !! html
19748 <p>12
19749 12
19750 </p>
19751 !! end
19752
19753 !! test
19754 Check noCommafy in formatNum
19755 !! options
19756 language=be-tarask
19757 !! wikitext
19758 {{formatnum:123456.78}}
19759 {{formatnum:123456.78|NOSEP}}
19760 !! html
19761 <p>123 456,78
19762 123456.78
19763 </p>
19764 !! end
19765
19766 !! test
19767 Wrong option for formatNum (bug 56199)
19768 !! wikitext
19769 {{formatnum:1,234.56|Random}}
19770 {{formatnum:1,234.56|EVERYTHING}}
19771 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19772 !! html
19773 <p>1,234.56
19774 1,234.56
19775 1,234.56
19776 </p>
19777 !! end
19778
19779 !! test
19780 Strip marker in grammar
19781 !! options
19782 language=fi
19783 !! wikitext
19784 {{grammar:elative|foo<nowiki/>bar}}
19785 !! html
19786 <p>foobarista
19787 </p>
19788 !! end
19789
19790 !! test
19791 Strip marker in padleft
19792 !! wikitext
19793 {{padleft:|2|x<nowiki/>y}}
19794 !! html
19795 <p>xy
19796 </p>
19797 !! end
19798
19799 !! test
19800 Strip marker in padright
19801 !! wikitext
19802 {{padright:|2|x<nowiki/>y}}
19803 !! html
19804 <p>xy
19805 </p>
19806 !! end
19807
19808 !! test
19809 Strip marker in anchorencode
19810 !! wikitext
19811 {{anchorencode:x<nowiki/>y}}
19812 !! html
19813 <p>xy
19814 </p>
19815 !! end
19816
19817 !! test
19818 nowiki inside link inside heading (bug 18295)
19819 !! wikitext
19820 ==[[foo|x<nowiki>y</nowiki>z]]==
19821 !! html
19822 <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>
19823
19824 !! end
19825
19826 !! test
19827 new support for bdi element (bug 31817)
19828 !! wikitext
19829 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19830 !! html
19831 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19832
19833 !!end
19834
19835 !! test
19836 Ignore pipe between table row attributes
19837 !! wikitext
19838 {|
19839 | quux
19840 |- id=foo | style='color: red'
19841 | bar
19842 |}
19843 !! html
19844 <table>
19845 <tr>
19846 <td> quux
19847 </td></tr>
19848 <tr id="foo" style="color: red">
19849 <td> bar
19850 </td></tr></table>
19851
19852 !! end
19853
19854 !!test
19855 Gallery override link with WikiLink (bug 34852)
19856 !! wikitext
19857 <gallery>
19858 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19859 </gallery>
19860 !! html
19861 <ul class="gallery mw-gallery-traditional">
19862 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19863 <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>
19864 <div class="gallerytext">
19865 <p>caption
19866 </p>
19867 </div>
19868 </div></li>
19869 </ul>
19870
19871 !! end
19872
19873 !!test
19874 Gallery override link with absolute external link (bug 34852)
19875 !! wikitext
19876 <gallery>
19877 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19878 </gallery>
19879 !! html
19880 <ul class="gallery mw-gallery-traditional">
19881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19882 <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>
19883 <div class="gallerytext">
19884 <p>caption
19885 </p>
19886 </div>
19887 </div></li>
19888 </ul>
19889
19890 !! end
19891
19892 !!test
19893 Gallery override link with malicious javascript (bug 34852)
19894 !! wikitext
19895 <gallery>
19896 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19897 </gallery>
19898 !! html
19899 <ul class="gallery mw-gallery-traditional">
19900 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19901 <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>
19902 <div class="gallerytext">
19903 <p>caption
19904 </p>
19905 </div>
19906 </div></li>
19907 </ul>
19908
19909 !! end
19910
19911 !!test
19912 Gallery with invalid title as link (bug 43964)
19913 !! wikitext
19914 <gallery>
19915 File:foobar.jpg|link=<
19916 </gallery>
19917 !! html
19918 <ul class="gallery mw-gallery-traditional">
19919 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19920 <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>
19921 <div class="gallerytext">
19922 </div>
19923 </div></li>
19924 </ul>
19925
19926 !! end
19927
19928 !!test
19929 Language parser function
19930 !! wikitext
19931 {{#language:ar}}
19932 !! html
19933 <p>العربية
19934 </p>
19935 !! end
19936
19937 !!test
19938 Padleft and padright as substr
19939 !! wikitext
19940 {{padleft:|3|abcde}}
19941 {{padright:|3|abcde}}
19942 !! html
19943 <p>abc
19944 abc
19945 </p>
19946 !! end
19947
19948 !!test
19949 Special parser function
19950 !! wikitext
19951 {{#special:RandomPage}}
19952 {{#special:BaDtItLe}}
19953 {{#special:Foobar}}
19954 !! html
19955 <p>Special:Random
19956 Special:Badtitle
19957 Special:Foobar
19958 </p>
19959 !! end
19960
19961 !!test
19962 Bug 34939 - Case insensitive link parsing ([HttP://])
19963 !! wikitext
19964 [HttP://MediaWiki.Org/]
19965 !! html/php
19966 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19967 </p>
19968 !! html/parsoid
19969 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19970 !! end
19971
19972 !!test
19973 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19974 !! wikitext
19975 [HttP://MediaWiki.Org/ MediaWiki]
19976 !! html
19977 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19978 </p>
19979 !! end
19980
19981 !!test
19982 Bug 34939 - Case insensitive link parsing (HttP://)
19983 !! wikitext
19984 HttP://MediaWiki.Org/
19985 !! html/php
19986 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19987 </p>
19988 !! html/parsoid
19989 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19990 !! end
19991
19992 !!test
19993 Disable TOC
19994 !! options
19995 notoc
19996 !! wikitext
19997 Lead
19998 == Section 1 ==
19999 == Section 2 ==
20000 == Section 3 ==
20001 == Section 4 ==
20002 == Section 5 ==
20003 !! html
20004 <p>Lead
20005 </p>
20006
20007 <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>
20008 <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>
20009 <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>
20010 <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>
20011 <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>
20012
20013 !! end
20014
20015
20016 ###
20017 ### Parsoid-specific tests
20018 ### Parsoid-PHP parser incompatibilities
20019 ###
20020 !!test
20021 1. SOL-sensitive wikitext tokens as template-args
20022 !!options
20023 parsoid=wt2html,wt2wt
20024 !! wikitext
20025 {{echo|*a}}
20026 {{echo|#a}}
20027 {{echo|:a}}
20028 !! html
20029 <span about="#mwt1" typeof="mw:Transclusion">
20030 </span><ul about="#mwt1"><li>a</li>
20031 </ul>
20032 <span about="#mwt2" typeof="mw:Transclusion">
20033 </span><ol about="#mwt2"><li>a</li>
20034 </ol>
20035 <span about="#mwt3" typeof="mw:Transclusion">
20036 </span><dl about="#mwt3"><dd>a</dd>
20037 </dl>
20038 !!end
20039
20040 #### -----------------------------------------------------------------
20041 #### Parsoid-specific functionality tests
20042 #### -----------------------------------------------------------------
20043
20044 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20045 # We know wt2wt will fail, but we expect selser to pass.
20046 # Due to the nature of our testing, wt2wt and selser tests will enter the
20047 # blacklist and we'll catch selser regressions based on changes to the
20048 # blacklist entries for selser tests.
20049 !! test
20050 1. Bad treebuilder fixup of formatting elt is cleaned up
20051 !! options
20052 parsoid=wt2html,wt2wt
20053 !! wikitext
20054 {|
20055 |
20056 <small>
20057 [[Image:Foobar.jpg|right|Test]]
20058 </small>
20059 |}
20060 !! html/parsoid
20061 <table>
20062 <tbody><tr><td>
20063 <small>
20064 <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>
20065 </small>
20066 </td></tr>
20067 </tbody></table>
20068 !! end
20069
20070 !! test
20071 2. Bad treebuilder fixup of formatting elt is cleaned up
20072 !! options
20073 parsoid=wt2html,wt2wt
20074 !! wikitext
20075 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20076
20077 <small>[[Image:Foobar.jpg|right|300px]]</small>
20078 !! html/parsoid
20079 <p><b>foo</b></p>
20080 <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>
20081 <p><b>bar</b></p>
20082 <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>
20083 !! end
20084
20085 #### ----------------------------------------------------------------
20086 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20087 #### tags. Parsoid's output for these tags differs from that of the
20088 #### PHP parser.
20089 #### ----------------------------------------------------------------
20090
20091 !!test
20092 Ref: 1. ref-location should be replaced with an index span
20093 !!options
20094 parsoid
20095 !! wikitext
20096 A <ref>foo</ref>
20097 B <ref name="x">foo</ref>
20098 C <ref name="y" />
20099 <references />
20100 !! html
20101 <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>
20102 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>
20103 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>
20104 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20105 <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>
20106 <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>
20107 <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>
20108 </ol>
20109 !!end
20110
20111 !!test
20112 Ref: 2. ref-tags with identical names should all get the same index
20113 !!options
20114 parsoid
20115 !! wikitext
20116 A <ref name="x">foo</ref>
20117 B <ref name="x" />
20118 <references />
20119 !! html
20120 <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>
20121 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>
20122 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20123 <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>
20124 </ol>
20125 !!end
20126
20127 !!test
20128 Ref: 3. spaces in ref-names should be ignored
20129 !!options
20130 parsoid
20131 !! wikitext
20132 A <ref name="x">foo</ref>
20133 B <ref name=" x " />
20134 C <ref name= x />
20135 <references />
20136 !! html
20137 <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>
20138 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>
20139 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>
20140 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20141 <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>
20142 </ol>
20143 !!end
20144
20145 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20146 !!test
20147 Ref: 4. 'constructor' should be accepted as a valid ref-name
20148 !!options
20149 parsoid
20150 !! wikitext
20151 A <ref name="constructor">foo</ref>
20152 <references />
20153 !! html
20154 <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>
20155 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20156 <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>
20157 </ol>
20158 !!end
20159
20160 !!test
20161 Ref: 5. body should accept generic wikitext
20162 !!options
20163 parsoid
20164 !! wikitext
20165 A <ref>
20166 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20167 </ref>
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></p>
20172
20173 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20174 <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>
20175 </span></li>
20176 </ol>
20177 !!end
20178
20179 !!test
20180 Ref: 6. indent-pres should not be output in ref-body
20181 !!options
20182 parsoid
20183 !! wikitext
20184 A <ref>
20185 foo
20186 bar
20187 baz
20188 </ref>
20189
20190 <references />
20191 !! html
20192 <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>
20193
20194 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20195 <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
20196 bar
20197 baz
20198 </span></li>
20199 </ol>
20200 !!end
20201
20202 !!test
20203 Ref: 7. No p-wrapping in ref-body
20204 !!options
20205 parsoid
20206 !! wikitext
20207 A <ref>
20208 foo
20209
20210 bar
20211
20212
20213 baz
20214
20215
20216
20217 booz
20218 </ref>
20219
20220 <references />
20221 !! html
20222 <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>
20223
20224 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20225 <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
20226
20227 bar
20228
20229
20230 baz
20231
20232
20233
20234 booz
20235 </span></li>
20236 </ol>
20237 !!end
20238
20239 !!test
20240 Ref: 8. transclusion wikitext has lower precedence
20241 !!options
20242 parsoid
20243 !! wikitext
20244 A <ref> foo {{echo|</ref> B C}}
20245
20246 <references />
20247 !! html
20248 <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>
20249 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20250 <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>
20251 </ol>
20252 !!end
20253
20254 !!test
20255 Ref: 9. unclosed comments should not leak out of ref-body
20256 !!options
20257 parsoid
20258 !! wikitext
20259 A <ref> foo <!--</ref> B C
20260 <references />
20261 !! html
20262 <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>
20263 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20264 <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>
20265 </ol>
20266 !!end
20267
20268 !!test
20269 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20270 !!options
20271 parsoid
20272 !! wikitext
20273 A <ref> <b> foo </ref> B C
20274
20275 <references />
20276 !! html
20277 <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>
20278
20279
20280 <ol class="references" typeof="mw:Extension/references" about="#mwt4" 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"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
20282 </ol>
20283 !!end
20284
20285 !!test
20286 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20287 !!options
20288 parsoid
20289 !! wikitext
20290 A <ref>foo</ref> B
20291 C <ref>bar</ref> D
20292 <references />
20293 !! html
20294 <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
20295 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>
20296 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20297 <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>
20298 <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>
20299 </ol>
20300 !!end
20301
20302 !!test
20303 Ref: 12. ref-tags act as trailing newline migration barrier
20304 !!options
20305 parsoid
20306 !! wikitext
20307 <!--the newline at the end of this line moves out of the p-tag-->a
20308
20309 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
20310 <ref />
20311
20312 c
20313 <references />
20314 !! html
20315 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
20316
20317
20318 <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>
20319 <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>
20320
20321 <p>c</p>
20322 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20323 <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>
20324 <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>
20325 !!end
20326
20327 !!test
20328 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20329 !!options
20330 parsoid
20331 !! wikitext
20332 <ref>foo</ref> A
20333 <ref>bar
20334 </ref> B
20335 <references />
20336 !! html
20337 <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
20338 <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>
20339 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20340 <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>
20341 <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
20342 </span></li>
20343 </ol>
20344 !!end
20345
20346 !!test
20347 Ref: 14. A nested ref-tag should be emitted as plain text
20348 !!options
20349 parsoid
20350 !! wikitext
20351 <ref>foo <ref>bar</ref> baz</ref>
20352
20353 <references />
20354 !! html
20355 <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>
20356 </p>
20357 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20358 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
20359 </ol>
20360 !!end
20361
20362 !!test
20363 Ref: 15. ref-tags with identical names should get identical indexes
20364 !!options
20365 parsoid
20366 !! wikitext
20367 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20368 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20369
20370 <references />
20371 !! html
20372 <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>
20373 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>
20374
20375 <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>
20376 </ol>
20377 !!end
20378
20379 ## We don't bother wt2wt-ing non-standard whitespace
20380 !!test
20381 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20382 !!options
20383 parsoid=wt2html
20384 !! wikitext
20385 A <ref >foo</ref >
20386
20387 <references />
20388 !! html
20389 <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>
20390 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20391 <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>
20392 !!end
20393
20394 !!test
20395 Ref: 17. Generate valid HTML5 id/about attributes
20396 !!options
20397 parsoid
20398 !!wikitext
20399 <ref name="a b">foo</ref>
20400
20401 <references />
20402 !!html
20403 <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>
20404 </p>
20405
20406 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20407 <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>
20408 </ol>
20409 !!end
20410
20411 !!test
20412 Ref: 18. T58916: Extension attributes should be parsed as plain text
20413 !!options
20414 parsoid
20415 !!wikitext
20416 <ref name="{{echo|a}}">foo</ref>
20417
20418 <references />
20419 !!html
20420 <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>
20421 </p>
20422
20423 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20424 <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>
20425 </ol>
20426 !!end
20427
20428 !!test
20429 Ref: 19. ref-tags with identical name encodings should get identical indexes
20430 !!options
20431 parsoid
20432 !! wikitext
20433 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20434
20435 <references />
20436 !! html
20437 <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>
20438 </p>
20439 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20440 <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>
20441 </ol>
20442 !!end
20443
20444 !!test
20445 Ref: 20. ref-tags with identical names but different content should keep it
20446 !!options
20447 parsoid
20448 !! wikitext
20449 A <ref name="foo">Foo one</ref>
20450 B <ref name="foo">Foo two</ref>
20451 C <ref name="foo" />
20452
20453 <references />
20454 !! html
20455 <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>
20456 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>
20457 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>
20458
20459 <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>
20460 </ol>
20461 !!end
20462
20463 !!test
20464 References: 1. references tag without any refs should be handled properly
20465 !!options
20466 parsoid
20467 !! wikitext
20468 <references />
20469 !! html
20470 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20471 !!end
20472
20473 !!test
20474 References: 2. references tag with group only outputs references from that group
20475 !!options
20476 parsoid
20477 !! wikitext
20478 A <ref group="a">foo</ref>
20479 B <ref group="b">bar</ref>
20480 C <ref>baz</ref>
20481
20482 <references group="a" />
20483 <references />
20484 <references group="b" />
20485 !! html
20486 <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>
20487 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>
20488 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>
20489
20490 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
20491 <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>
20492 </ol>
20493 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
20494 <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>
20495 </ol>
20496 <ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20497 <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>
20498 </ol>
20499 !!end
20500
20501 !!test
20502 References: 3. ref list should be cleared after processing references
20503 !!options
20504 parsoid
20505 !! wikitext
20506 A <ref>foo</ref>
20507
20508 <references />
20509
20510 B <ref>bar</ref>
20511
20512 <references />
20513 !! html
20514 <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>
20515
20516 <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>
20517 </ol>
20518
20519 <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>
20520
20521 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20522 <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>
20523 </ol>
20524 !!end
20525
20526 !!test
20527 References: 4. only referenced group should be cleared after processing references
20528 !!options
20529 parsoid
20530 !! wikitext
20531 A <ref group="a">afoo</ref>
20532 B <ref>bfoo</ref>
20533
20534 <references group="a" />
20535
20536 C <ref>cfoo</ref>
20537
20538 <references />
20539 !! html
20540 <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>
20541 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>
20542
20543 <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>
20544 </ol>
20545
20546 <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>
20547
20548 <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>
20549 </ol>
20550 !!end
20551
20552 !!test
20553 References: 5. ref tags in references should be processed while ignoring all other content
20554 !!options
20555 parsoid
20556 !! wikitext
20557 A <ref name="a" />
20558 B <ref name="b">bar</ref>
20559
20560 <references>
20561 <ref name="a">foo</ref>
20562 This should just get lost.
20563 </references>
20564 !! html
20565 <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>
20566 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>
20567
20568
20569 <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>
20570 </ol>
20571 !!end
20572
20573 !!test
20574 References: 6. <references /> from a transclusion
20575 !!options
20576 parsoid
20577 !! wikitext
20578 <ref>Foo</ref> {{echo|<references />}}
20579 !! html
20580 <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>
20581 </ol>
20582 !!end
20583
20584 !! test
20585 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20586 !! options
20587 parsoid
20588 !! wikitext
20589 A <ref>foo bar for a</ref>
20590 B <ref group="X" name="b" />
20591
20592 <references />
20593
20594 <references group="X">
20595 <ref name="b">foo</ref>
20596 </references>
20597 !! html
20598 <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>
20599 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>
20600 </p>
20601
20602 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20603 <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>
20604 </ol>
20605
20606 <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"}}'>
20607 <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>
20608 </ol>
20609 !! end
20610
20611 !! test
20612 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20613 !! options
20614 parsoid
20615 !! wikitext
20616 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20617 <references />
20618 !! html
20619 <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>
20620 <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>
20621 </ol>
20622 !!end
20623
20624 # This test only works in wt2html now as the <references /> are always generated
20625 # unless selser is active. Once T72722 is fixed, we should add a changes test
20626 # here to ensure that unrelated changes don't add the new <references /> in
20627 # wt2wt.
20628 !! test
20629 References: 9. Generate missing references list at the end
20630 !! options
20631 parsoid
20632 !! wikitext
20633 A <ref>foo</ref>
20634 B <ref group="inexistent">bar</ref>
20635 !! html
20636 <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>
20637 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20638 <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>
20639 </ol>
20640 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20641 <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>
20642 </ol>
20643 !! end
20644
20645 !! test
20646 Entities in ref name
20647 !! options
20648 parsoid
20649 !! wikitext
20650 <ref name="test &amp; me">hi</ref>
20651 <references />
20652 !! html
20653 <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>
20654 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20655 <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>
20656 </ol>
20657 !! end
20658
20659 # This test is wt2html only because we're permitting the serializer to produce
20660 # dirty diffs, normalizing the unclosed references to the self-closed version.
20661 !! test
20662 Generate references for unclosed references tag
20663 !! options
20664 parsoid=wt2html
20665 !! wikitext
20666 a<ref>foo</ref>
20667
20668 <references>
20669 !! html
20670 <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>
20671 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20672 <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>
20673 !! end
20674
20675 !! test
20676 New reference serializes on its own line
20677 !! options
20678 parsoid=wt2wt,html2wt
20679 !! wikitext
20680 foo
20681 <references />
20682 !! html
20683 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20684 !! end
20685
20686 #### ----------------------------------------------------------------
20687 #### Parsoid-only testing of Parsoid's impl of LST
20688 #### Not implemented yet, see
20689 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
20690 #### ----------------------------------------------------------------
20691
20692 !!test
20693 LST Sections: 1. Simple section start and end
20694 !! wikitext
20695 <section begin="2011-05-16" />
20696 <section end="2014-04-10 (MW 1.23wmf22)" />
20697 !! html/parsoid
20698 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
20699 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
20700 !! end
20701
20702 #--------- Test stripping of empty nodes in template content ----------
20703 !!test
20704 Empty LI and TR nodes should be stripped from template content
20705 !!wikitext
20706 {{EmptyLITest}}
20707 {{EmptyTRTest}}
20708 !!html/parsoid
20709 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20710 <li>a</li>
20711 <li>b</li>
20712 </ul>
20713 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20714 <tbody>
20715 <tr>
20716 <td>foo</td>
20717 </tr>
20718 <tr>
20719 <td>bar</td>
20720 </tr>
20721 </tbody>
20722 </table>
20723 !!end
20724
20725 !!test
20726 Empty LI and TR nodes should not be stripped from top-level content
20727 !!wikitext
20728 * a
20729 *
20730 * b
20731 {|
20732 |-
20733 |-
20734 |foo
20735 |}
20736 !!html/parsoid
20737 <ul>
20738 <li> a</li>
20739 <li></li>
20740 <li> b</li>
20741 </ul>
20742 <table>
20743 <tbody>
20744 <tr></tr>
20745 <tr>
20746 <td>foo</td>
20747 </tr>
20748 </tbody>
20749 </table>
20750 !!end
20751
20752 !!test
20753 Empty TR nodes should not be stripped if they have any attributes set
20754 !!wikitext
20755 {{EmptyTRWithHTMLAttrTest}}
20756 !!html/parsoid
20757 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20758 <tr align="center"></tr>
20759 <tr><td>foo</td></tr>
20760 <tr align="center"></tr>
20761 <tr><td>bar</td></tr>
20762 </table>
20763 !!end
20764
20765 #### ----------------------------------------------------------------
20766 #### The following section of tests are primarily to test
20767 #### wikitext escaping capabilities of Parsoid. Given that
20768 #### escaping can be done any number of ways, the wikitext (input)
20769 #### is always adjusted to reflect how Parsoid adds nowiki
20770 #### escape tags.
20771 ####
20772 #### We are marking several tests as parsoid-only since the
20773 #### HTML in the result section is different from what the
20774 #### PHP parser generates for it.
20775 #### ----------------------------------------------------------------
20776
20777
20778 #### --------------- Headings ---------------
20779 #### 0. Unnested
20780 #### 1. Nested inside html <h1>=foo=</h1>
20781 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20782 #### 3. Nested inside html with wikitext split by html tags
20783 #### 4. No escape needed
20784 #### 5. Empty headings <h1></h1>
20785 #### 6. Heading chars in SOL context
20786 #### ----------------------------------------
20787 !! test
20788 Headings: 0. Unnested
20789 !! options
20790 parsoid
20791 !! wikitext
20792 <nowiki>=foo=</nowiki>
20793
20794 <nowiki> =foo= </nowiki>
20795 <!--cmt-->
20796 <nowiki>=foo=</nowiki>
20797
20798 =foo''a''<nowiki>=</nowiki>
20799 !! html
20800 <p><span typeof="mw:Nowiki">=foo=</span></p>
20801
20802 <p><span typeof="mw:Nowiki"> =foo= </span>
20803 <!--cmt-->
20804 <span typeof="mw:Nowiki">=foo=</span></p>
20805
20806 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20807 !!end
20808
20809 # New headings and existing headings are handled differently
20810 !! test
20811 Headings: 1. Nested inside html
20812 !! options
20813 parsoid=html2wt
20814 !! html
20815 <h1>=foo=</h1>
20816 <h2>=foo=</h2>
20817 <h3>=foo=</h3>
20818
20819 <h1 data-parsoid=''>=foo=</h1>
20820 <h2 data-parsoid=''>=foo=</h2>
20821 <h3 data-parsoid=''>=foo=</h3>
20822 <h4 data-parsoid=''>=foo=</h4>
20823 <h5 data-parsoid=''>=foo=</h5>
20824 <h6 data-parsoid=''>=foo=</h6>
20825 !! wikitext
20826 = =foo= =
20827
20828 == =foo= ==
20829
20830 === =foo= ===
20831
20832 =<nowiki>=foo=</nowiki>=
20833 ==<nowiki>=foo=</nowiki>==
20834 ===<nowiki>=foo=</nowiki>===
20835 ====<nowiki>=foo=</nowiki>====
20836 =====<nowiki>=foo=</nowiki>=====
20837 ======<nowiki>=foo=</nowiki>======
20838
20839 !!end
20840
20841 !! test
20842 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20843 !! options
20844 parsoid=html2wt
20845 !! html
20846 <h1>foo</h1>*bar
20847 <h1>foo</h1>=bar
20848 <h1>foo</h1>=bar=
20849 !! wikitext
20850 = foo =
20851 <nowiki>*</nowiki>bar
20852
20853 = foo =
20854 =bar
20855
20856 = foo =
20857 <nowiki>=bar=</nowiki>
20858 !!end
20859
20860 !! test
20861 Headings: 3. Nested inside html with wikitext split by html tags
20862 !! options
20863 parsoid=html2wt,wt2wt
20864 !! wikitext
20865 = ='''bold'''<nowiki>foo=</nowiki> =
20866 !! html/parsoid
20867 <h1>=<b>bold</b>foo=</h1>
20868 !!end
20869
20870 !! test
20871 Headings: 4a. No escaping needed (testing just h1 and h2)
20872 !! wikitext
20873 = =foo =
20874
20875 = foo= =
20876
20877 = =foo= =
20878
20879 = =foo= bar =
20880
20881 == =foo ==
20882
20883 == foo= ==
20884
20885 = = =
20886
20887 = ''=''foo= =
20888 !! html/parsoid
20889 <h1>=foo</h1>
20890 <h1>foo=</h1>
20891 <h1> =foo= </h1>
20892 <h1>=foo= bar</h1>
20893 <h2>=foo</h2>
20894 <h2>foo=</h2>
20895 <h1>=</h1>
20896 <h1><i>=</i>foo=</h1>
20897 !!end
20898
20899 !! test
20900 Headings: 4b. No escaping needed (inside p-tags)
20901 !! options
20902 parsoid=html2wt
20903 !! html
20904 <p>===
20905 =foo= x
20906 =foo= <s></s>
20907 </p>
20908 !! wikitext
20909 ===
20910 =foo= x
20911 =foo= <s></s>
20912 !!end
20913
20914 !! test
20915 Headings: 5. Empty headings
20916 !! options
20917 parsoid
20918 !! wikitext
20919 =<nowiki/>=
20920
20921 ==<nowiki/>==
20922
20923 ===<nowiki/>===
20924
20925 ====<nowiki/>====
20926
20927 =====<nowiki/>=====
20928
20929 ======<nowiki/>======
20930 !! html
20931 <h1></h1>
20932 <h2></h2>
20933 <h3></h3>
20934 <h4></h4>
20935 <h5></h5>
20936 <h6></h6>
20937 !!end
20938
20939 !! test
20940 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20941 !! options
20942 parsoid
20943 !! wikitext
20944 <nowiki>=a=</nowiki>
20945
20946 <nowiki>=a=</nowiki>
20947
20948 <nowiki>=a=</nowiki>
20949
20950 <nowiki>=a=</nowiki>
20951 !! html
20952 <p>=a=</p>
20953 <p>=a= </p>
20954 <p>=a= </p>
20955 <p>=a= </p>
20956 !!end
20957
20958 !! test
20959 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20960 !! options
20961 parsoid
20962 !! wikitext
20963 <nowiki>=a=
20964 b</nowiki>
20965
20966 <nowiki>=a=
20967 b</nowiki>
20968
20969 <nowiki>=a=
20970 b</nowiki>
20971
20972 <nowiki>=a=
20973 b</nowiki>
20974 !! html
20975 <p>=a=
20976 b</p>
20977 <p>=a=
20978 b</p>
20979 <p>=a=
20980 b</p>
20981 <p>=a=
20982 b</p>
20983 </p>
20984 !!end
20985
20986 !! test
20987 Headings: 6c. Heading chars in SOL context (leading newline break)
20988 !! options
20989 parsoid
20990 !! wikitext
20991 a
20992 <nowiki>=b=</nowiki>
20993 !! html
20994 <p>a
20995 =b=</p>
20996 !!end
20997
20998 !! test
20999 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21000 !! options
21001 parsoid
21002 !! wikitext
21003 <!--c0--><nowiki>=a=</nowiki>
21004
21005 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21006 !! html
21007 <p><!--c0-->=a=</p>
21008 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21009 !!end
21010
21011 !! test
21012 Headings: 6d. Heading chars in SOL context (No escaping needed)
21013 !! options
21014 parsoid=html2wt
21015 !! html
21016 =a=<div>b</div>
21017 !! wikitext
21018 =a=<div>b</div>
21019 !!end
21020
21021 !! test
21022 Headings: 7. Insert a newline between new content and headings
21023 !! options
21024 parsoid=html2wt
21025 !! html
21026 <h2>NEW</h2>
21027 <p>new</p>
21028 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21029 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21030 !! wikitext
21031 == NEW ==
21032 new
21033
21034 ==A==
21035 a
21036
21037 !! end
21038
21039 #### --------------- Lists ---------------
21040 #### 0. Outside nests (*foo, etc.)
21041 #### 1. Nested inside html <ul><li>*foo</li></ul>
21042 #### 2. Inside definition lists
21043 #### 3. Only bullets at start should be escaped
21044 #### 4. No escapes needed
21045 #### 5. No unnecessary escapes
21046 #### 6. Escape bullets in SOL position
21047 #### 7. Escape bullets in a multi-line context
21048 #### ----------------------------------------
21049
21050 !! test
21051 Lists: 0. Outside nests
21052 !! wikitext
21053 <nowiki>*</nowiki>foo
21054
21055 <nowiki>#</nowiki>foo
21056
21057 <nowiki>;Foo:</nowiki>bar
21058 !! html
21059 <p>*foo
21060 </p><p>#foo
21061 </p><p>;Foo:bar
21062 </p>
21063 !!end
21064
21065 !! test
21066 Lists: 1. Nested inside html
21067 !! wikitext
21068 *<nowiki>*foo</nowiki>
21069
21070 *<nowiki>#foo</nowiki>
21071
21072 *<nowiki>:foo</nowiki>
21073
21074 *<nowiki>;foo</nowiki>
21075
21076 #<nowiki>*foo</nowiki>
21077
21078 #<nowiki>#foo</nowiki>
21079
21080 #<nowiki>:foo</nowiki>
21081
21082 #<nowiki>;foo</nowiki>
21083 !! html
21084 <ul><li>*foo</li></ul>
21085 <ul><li>#foo</li></ul>
21086 <ul><li>:foo</li></ul>
21087 <ul><li>;foo</li></ul>
21088 <ol><li>*foo</li></ol>
21089 <ol><li>#foo</li></ol>
21090 <ol><li>:foo</li></ol>
21091 <ol><li>;foo</li></ol>
21092
21093 !!end
21094
21095 !! test
21096 Lists: 2. Inside definition lists
21097 !! wikitext
21098 ;<nowiki>;foo</nowiki>
21099
21100 ;<nowiki>:foo</nowiki>
21101
21102 ;<nowiki>:foo</nowiki>
21103 :bar
21104
21105 :<nowiki>:foo</nowiki>
21106 !! html
21107 <dl><dt>;foo</dt></dl>
21108 <dl><dt>:foo</dt></dl>
21109 <dl><dt>:foo</dt>
21110 <dd>bar</dd></dl>
21111 <dl><dd>:foo</dd></dl>
21112
21113 !!end
21114
21115 !! test
21116 Lists: 3. Only bullets at start of text should be escaped
21117 !! wikitext
21118 *<nowiki>*foo*bar</nowiki>
21119
21120 *<nowiki>*foo</nowiki>''it''*bar
21121 !! html
21122 <ul><li>*foo*bar</li></ul>
21123 <ul><li>*foo<i>it</i>*bar</li></ul>
21124
21125 !!end
21126
21127 !! test
21128 Lists: 4. No escapes needed
21129 !! options
21130 parsoid
21131 !! wikitext
21132 *foo*bar
21133
21134 *''foo''*bar
21135
21136 *[[Foo]]: bar
21137
21138 *[[Foo]]*bar
21139 !! html
21140 <ul>
21141 <li>foo*bar
21142 </li>
21143 </ul>
21144 <ul>
21145 <li><i>foo</i>*bar
21146 </li>
21147 </ul>
21148 <ul>
21149 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21150 </li>
21151 </ul>
21152 <ul>
21153 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21154 </li>
21155 </ul>
21156 !!end
21157
21158 !! test
21159 Lists: 5. No unnecessary escapes
21160 !! wikitext
21161 * bar <span><nowiki>[[foo]]</nowiki></span>
21162
21163 * =bar <span><nowiki>[[foo]]</nowiki></span>
21164
21165 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21166
21167 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21168
21169 * =bar <span>foo]]</span>=
21170
21171 * <s></s>: a
21172
21173 * ''* foo''
21174 !! html
21175 <ul><li> bar <span>[[foo]]</span></li></ul>
21176 <ul><li> =bar <span>[[foo]]</span></li></ul>
21177 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21178 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21179 <ul><li> =bar <span>foo]]</span>=</li></ul>
21180 <ul><li> <s></s>: a</li></ul>
21181 <ul><li> <i>* foo</i></li></ul>
21182
21183 !!end
21184
21185 !! test
21186 Lists: 6. Escape bullets in SOL position
21187 !! options
21188 parsoid=html2wt
21189 !! html
21190 <p><!--cmt-->*foo</p>
21191 !! wikitext
21192 <!--cmt--><nowiki>*</nowiki>foo
21193 !!end
21194
21195 !! test
21196 Lists: 7. Escape bullets in a multi-line context
21197 !! wikitext
21198 a
21199 <nowiki>*</nowiki>b
21200 !! html
21201 <p>a
21202 *b
21203 </p>
21204 !!end
21205
21206 !! test
21207 Lists: 8. Escape colons only if not present in tags
21208 !! options
21209 parsoid=html2wt
21210 !! html
21211 <dl><dt>a:b<i>c:d</i></dt></dl>
21212 !! wikitext
21213 ; <nowiki>a:b</nowiki>''c:d''
21214 !! end
21215
21216 #### --------------- HRs ---------------
21217 #### 1. Single line
21218 #### -----------------------------------
21219
21220 !! test
21221 HRs: 1. Single line
21222 !! wikitext
21223 ----<nowiki>----</nowiki>
21224 ----=foo=
21225 ----*foo
21226 !! html+tidy
21227 <hr />
21228 <p>----</p>
21229 <hr />
21230 <p>=foo=</p>
21231 <hr />
21232 <p>*foo</p>
21233 !! end
21234
21235 #### --------------- Tables ---------------
21236 #### 1a. Simple example
21237 #### 1b. No escaping needed (!foo)
21238 #### 1c. No escaping needed (|foo)
21239 #### 1d. No escaping needed (|}foo)
21240 ####
21241 #### 2a. Nested in td (<td>foo|bar</td>)
21242 #### 2b. Nested in td (<td>foo||bar</td>)
21243 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21244 ####
21245 #### 3a. Nested in th (<th>foo!bar</th>)
21246 #### 3b. Nested in th (<th>foo!!bar</th>)
21247 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21248 ####
21249 #### 4a. Escape -
21250 #### 4b. Escape +
21251 #### 4c. No escaping needed
21252 #### --------------------------------------
21253
21254 !! test
21255 Tables: 1a. Simple example
21256 !! wikitext
21257 <nowiki>{|
21258 |}</nowiki>
21259 !! html
21260 <p>{|
21261 |}
21262 </p>
21263 !! end
21264
21265 !! test
21266 Tables: 1b. No escaping needed
21267 !! wikitext
21268 !foo
21269 !! html
21270 <p>!foo
21271 </p>
21272 !! end
21273
21274 !! test
21275 Tables: 1c. No escaping needed
21276 !! wikitext
21277 |foo
21278 !! html
21279 <p>|foo
21280 </p>
21281 !! end
21282
21283 !! test
21284 Tables: 1d. No escaping needed
21285 !! wikitext
21286 |}foo
21287 !! html
21288 <p>|}foo
21289 </p>
21290 !! end
21291
21292 !! test
21293 Tables: 2a. Nested in td
21294 !! options
21295 parsoid=html2wt
21296 !! html/parsoid
21297 <table><tbody><tr>
21298 <td>foo|bar</td></tr>
21299 <tr><td>x<div>a|b</div></td>
21300 </tbody></table>
21301 !! wikitext
21302 {|
21303 |<nowiki>foo|bar</nowiki>
21304 |-
21305 |x<div><nowiki>a|b</nowiki></div>
21306 |}
21307 !! html/php+tidy
21308 <table>
21309 <tr>
21310 <td>foo|bar</td>
21311 </tr>
21312 <tr>
21313 <td>x
21314 <div>a|b</div>
21315 </td>
21316 </tr>
21317 </table>
21318 !! end
21319
21320 !! test
21321 Tables: 2b. Nested in td
21322 !! options
21323 parsoid=html2wt
21324 !! html/parsoid
21325 <table><tbody><tr>
21326 <td>foo||bar</td>
21327 <td>a<i>b||c</i></td>
21328 <td>a<i><div>b||c</div></i></td>
21329 </tr></tbody></table>
21330 !! wikitext
21331 {|
21332 |<nowiki>foo||bar</nowiki>
21333 |a''<nowiki>b||c</nowiki>''
21334 |a''<div><nowiki>b||c</nowiki></div>''
21335 |}
21336 !! html/php
21337 <table>
21338 <tr>
21339 <td>foo||bar
21340 </td>
21341 <td>a<i>b||c</i>
21342 </td>
21343 <td>a<i><div>b||c</div></i>
21344 </td></tr></table>
21345
21346 !! end
21347
21348 !! test
21349 Tables: 2c. Nested in td -- no escaping needed
21350 !! wikitext
21351 {|
21352
21353 |foo!!bar
21354 |}
21355 !! html/*
21356 <table>
21357
21358 <tr>
21359 <td>foo!!bar
21360 </td></tr></table>
21361
21362 !! end
21363
21364 !! test
21365 Tables: 3a. Nested in th
21366 !! wikitext
21367 {|
21368
21369 !foo!bar
21370 |}
21371 !! html/*
21372 <table>
21373
21374 <tr>
21375 <th>foo!bar
21376 </th></tr></table>
21377
21378 !! end
21379
21380 !! test
21381 Tables: 3b. Nested in th
21382 !! options
21383 parsoid=html2wt
21384 !! html/parsoid
21385 <table><tbody>
21386 <tr><th>foo!!bar</th>
21387 <th><i>foo|bar</i></th>
21388 <th><i>foo!!bar</i></th>
21389 <th><i><span>foo!!bar</span></i></th>
21390 </tr></tbody></table>
21391 !! wikitext
21392 {|
21393 !<nowiki>foo!!bar</nowiki>
21394 !''<nowiki>foo|bar</nowiki>''
21395 !''<nowiki>foo!!bar</nowiki>''
21396 !''<span><nowiki>foo!!bar</nowiki></span>''
21397 |}
21398 !! html/php
21399 <table>
21400 <tr>
21401 <th>foo!!bar
21402 </th>
21403 <th><i>foo|bar</i>
21404 </th>
21405 <th><i>foo!!bar</i>
21406 </th>
21407 <th><i><span>foo!!bar</span></i>
21408 </th></tr></table>
21409
21410 !! end
21411
21412 !! test
21413 Tables: 3c. Nested in th
21414 !! options
21415 parsoid=html2wt
21416 !! html/parsoid
21417 <table><tbody>
21418 <tr><th>foo||bar</th>
21419 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21420 </tr></tbody></table>
21421 !! wikitext
21422 {|
21423 !<nowiki>foo||bar</nowiki>
21424 !<nowiki>foo||bar</nowiki>
21425 |}
21426 !! html/php
21427 <table>
21428 <tr>
21429 <th>foo||bar
21430 </th>
21431 <th>foo||bar
21432 </th></tr></table>
21433
21434 !! end
21435
21436 !! test
21437 Tables: 4a. Escape -
21438 !! options
21439 parsoid=html2wt
21440 !! html/*
21441 <table>
21442
21443 <tr>
21444 <th>-bar
21445 </th></tr>
21446 <tr>
21447 <td>-bar
21448 </td></tr></table>
21449
21450 !! wikitext
21451 {|
21452
21453 !-bar
21454
21455 |-
21456 |<nowiki>-bar</nowiki>
21457 |}
21458 !! end
21459
21460 !! test
21461 Tables: 4b. Escape +
21462 !! options
21463 parsoid=html2wt
21464 !! html/*
21465 <table>
21466
21467 <tr>
21468 <th>+bar
21469 </th></tr>
21470 <tr>
21471 <td>+bar
21472 </td></tr></table>
21473
21474 !! wikitext
21475 {|
21476
21477 !+bar
21478
21479 |-
21480 |<nowiki>+bar</nowiki>
21481 |}
21482 !! end
21483
21484 !! test
21485 Tables: 4c. No escaping needed
21486 !! wikitext
21487 {|
21488 |foo-bar
21489 |foo+bar
21490 |-
21491 |''foo''-bar
21492 |''foo''+bar
21493 |-
21494 |foo
21495 bar|baz
21496 +bar
21497 -bar
21498 |-
21499 |x
21500 <div>a|b</div>
21501 |}
21502 !! html/php
21503 <table>
21504 <tr>
21505 <td>foo-bar
21506 </td>
21507 <td>foo+bar
21508 </td></tr>
21509 <tr>
21510 <td><i>foo</i>-bar
21511 </td>
21512 <td><i>foo</i>+bar
21513 </td></tr>
21514 <tr>
21515 <td>foo
21516 <p>bar|baz
21517 +bar
21518 -bar
21519 </p>
21520 </td></tr>
21521 <tr>
21522 <td>x
21523 <div>a|b</div>
21524 </td></tr></table>
21525
21526 !! html/parsoid
21527 <table><tbody>
21528 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21529 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21530 <tr><td>foo
21531 <p>bar|baz
21532 +bar
21533 -bar</p></td></tr>
21534 <tr><td>x
21535 <div>a|b</div></td>
21536 </tbody></table>
21537 !! end
21538
21539 !! test
21540 Tables: 4d. No escaping needed
21541 !! wikitext
21542 {|
21543 |[[Foo]]-bar
21544 ||+1
21545 ||-2
21546 |}
21547 !! html/php
21548 <table>
21549 <tr>
21550 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21551 </td>
21552 <td>+1
21553 </td>
21554 <td>-2
21555 </td></tr></table>
21556
21557 !! html/parsoid
21558 <table>
21559 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21560 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21561 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21562 </tbody></table>
21563 !! end
21564
21565 !! test
21566 Tables: Digest broken attributes on table and tr tag
21567 !! options
21568 parsoid=wt2html
21569 !! wikitext
21570 {| || |} ++
21571 |- || || ++ --
21572 |- > [
21573 |}
21574 !! html
21575 <table>
21576 <tbody>
21577 <tr></tr>
21578 <tr></tr>
21579 </tbody></table>
21580 !! end
21581
21582 #### --------------- Links ----------------
21583 #### 1. Quote marks in link text
21584 #### 2. Wikilinks: Escapes needed
21585 #### 3. Wikilinks: No escapes needed
21586 #### 4. Extlinks: Escapes needed
21587 #### 5. Extlinks: No escapes needed
21588 #### --------------------------------------
21589 !! test
21590 Links 1. WikiLinks: No escapes needed
21591 !! wikitext
21592 [[Foo|Foo''boo'']]
21593 [[Foo|[Foobar]]]
21594 [[Foo|x [Foobar] x]]
21595 !! html/php
21596 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21597 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21598 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21599 </p>
21600 !! html/parsoid
21601 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21602 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21603 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21604 !! end
21605
21606 !! test
21607 Links 2. WikiLinks: Escapes needed
21608 !! options
21609 parsoid=html2wt
21610 !! html/parsoid
21611 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21612 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21613 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21614 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21615 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21616 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21617 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21618 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21619 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21620 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21621 !! wikitext
21622 [[Foo|<nowiki>Foobar]</nowiki>]]
21623 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21624 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21625 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21626 [[Foo|<nowiki>|Bar</nowiki>]]
21627 [[Foo|<nowiki>]]bar</nowiki>]]
21628 [[Foo|<nowiki>[[bar</nowiki>]]
21629 [[Foo|<nowiki>x [[ y</nowiki>]]
21630 [[Foo|<nowiki>x ]] y</nowiki>]]
21631 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21632 !! html/php
21633 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21634 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21635 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21636 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21637 <a href="/wiki/Foo" title="Foo">|Bar</a>
21638 <a href="/wiki/Foo" title="Foo">]]bar</a>
21639 <a href="/wiki/Foo" title="Foo">[[bar</a>
21640 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21641 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21642 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21643 </p>
21644 !! end
21645
21646 !! test
21647 Links 3. WikiLinks: No escapes needed
21648 !! wikitext
21649 [[Foo|[Foobar]]
21650 [[Foo|foo|bar]]
21651 !! html/php
21652 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21653 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21654 </p>
21655 !! html/parsoid
21656 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21657 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21658 !! end
21659
21660 !! test
21661 Links 4. ExtLinks: Escapes needed
21662 !! options
21663 parsoid=html2wt
21664 !! html/parsoid
21665 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21666 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21667 <p>[http://google.com]</p>
21668 <p>[http://google.com google]</p>
21669 !! wikitext
21670 [http://google.com <nowiki>[google]</nowiki>]
21671 [http://google.com <nowiki>google]</nowiki>]
21672
21673 <nowiki>[http://google.com]</nowiki>
21674
21675 <nowiki>[http://google.com google]</nowiki>
21676
21677 !! html/php
21678 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21679 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21680 </p><p>[http://google.com]
21681 </p><p>[http://google.com google]
21682 </p>
21683 !! end
21684
21685 !! test
21686 Links 5. ExtLinks: No escapes needed
21687 !! wikitext
21688 [http://google.com [google]
21689 !! html/php
21690 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21691 </p>
21692 !! html/parsoid
21693 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21694 !! end
21695
21696 !! test
21697 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21698 !! html/parsoid
21699 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21700 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21701 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21702 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21703 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21704 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21705 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21706 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21707 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21708 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21709 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21710 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21711 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21712 </p>
21713 !! wikitext
21714 x<nowiki/>http://example.com<nowiki/>y
21715 http://example.com<nowiki/>?x
21716 http://example.com<nowiki/>&x
21717 http://example.com<nowiki/>'x
21718 http://example.com<nowiki/>,x
21719 http://example.com<nowiki/>.x
21720 http://example.com<nowiki/>;x
21721 http://example.com<nowiki/>:x
21722 http://example.com<nowiki/>;x
21723 http://example.com<nowiki/>!x
21724 http://example.com<nowiki/>=x
21725 http://example.com<nowiki/>(x)
21726 http://example.com(x<nowiki/>)
21727 !! end
21728
21729 !! test
21730 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21731 !! html/parsoid
21732 <p>x
21733 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21734 y
21735 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21736 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21737 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21738 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21739 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21740 </p>
21741 !! wikitext
21742 x
21743 http://example.com
21744 y
21745 "http://example.com"
21746 (http://example.com)
21747 (http://example.com) foo
21748 http://example.com,
21749 http://example.com, foo
21750 !! html/php
21751 <p>x
21752 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21753 y
21754 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21755 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21756 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21757 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21758 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21759 </p>
21760 !! end
21761
21762 !! test
21763 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21764 !! html/parsoid
21765 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21766 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21767 !! wikitext
21768 http://example.com.,;:!?\
21769 -http://example.com:
21770 !! html/php
21771 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21772 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21773 </p>
21774 !! end
21775
21776 !! test
21777 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21778 !! html/parsoid
21779 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21780 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21781 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21782 !! wikitext
21783 RFC 123<nowiki/>4
21784 RFC 123<nowiki/>y
21785 X<nowiki/>RFC 123<nowiki/>y
21786 !! end
21787
21788 !! test
21789 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21790 !! html/parsoid
21791 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21792 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21793 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21794 </p>
21795 !! wikitext
21796 RFC 123?foo
21797 RFC 123&foo
21798 -RFC 123-
21799 !! html/php
21800 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21801 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21802 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21803 </p>
21804 !! end
21805
21806 !! test
21807 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21808 !! html/parsoid
21809 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21810 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21811 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21812 !! wikitext
21813 PMID 123<nowiki/>4
21814 PMID 123<nowiki/>y
21815 X<nowiki/>PMID 123<nowiki/>y
21816 !! end
21817
21818 !! test
21819 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21820 !! html/parsoid
21821 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21822 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21823 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21824 </p>
21825 !! wikitext
21826 PMID 123?foo
21827 PMID 123&foo
21828 -PMID 123-
21829 !! html/php
21830 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21831 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21832 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21833 </p>
21834 !! end
21835
21836 !! test
21837 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21838 !! html/parsoid
21839 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21840 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21841 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21842 </p>
21843 !! wikitext
21844 ISBN 1234567890<nowiki/>1
21845 ISBN 1234567890<nowiki/>x
21846 a<nowiki/>ISBN 1234567890<nowiki/>b
21847 !! end
21848
21849 !! test
21850 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21851 !! html/parsoid
21852 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21853 !! wikitext
21854 -ISBN 1234567890's
21855 !! html/php
21856 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21857 </p>
21858 !! end
21859
21860 !! test
21861 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21862 !! options
21863 parsoid=html2wt
21864 !! html/*
21865 <p>this is not a link: http://example.com
21866 </p>
21867 !! wikitext
21868 this is not a link: <nowiki>http://example.com</nowiki>
21869 !! end
21870
21871 !! test
21872 Links 15. Link trails can't become link prefixes.
21873 !! options
21874 language=is
21875 !! wikitext
21876 [[Söfnuður]]-[[00]]
21877 !! html/php
21878 <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>
21879 </p>
21880 !! html/parsoid
21881 <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>
21882 !! end
21883
21884 #### --------------- Quotes ---------------
21885 #### 1. Quotes inside <b> and <i>
21886 #### 2. Link fragments separated by <i> and <b> tags
21887 #### 3. Link fragments inside <i> and <b>
21888 #### 4. No escaping needed
21889 #### --------------------------------------
21890 !! test
21891 1a. Quotes inside <b> and <i>
21892 !! options
21893 parsoid=html2wt,wt2wt
21894 !! wikitext
21895 ''<nowiki/>'foo'''
21896 ''<nowiki>''foo''</nowiki>''
21897 ''<nowiki>'''foo'''</nowiki>''
21898 ''foo''<nowiki/>'s
21899 '''<nowiki/>'foo''''
21900 '''<nowiki>''foo''</nowiki>'''
21901 '''<nowiki>'''foo'''</nowiki>'''
21902 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21903 '''foo'''<nowiki/>'s
21904 '''foo''
21905 ''foo''<nowiki/>'
21906 ''foo'''<nowiki/>'
21907 '''foo''<nowiki/>'
21908 ''''foo'''
21909 '''foo'''<nowiki/>'
21910 ''''foo'''<nowiki/>'
21911 ''fools'<span> errand</span>''
21912 ''<span>fool</span>'s errand''
21913 '<nowiki/>''foo'' bar '''baz''
21914 a|!*#-:;+-~[]{}b'''x''
21915 !! html/*
21916 <p><i>'foo'</i>
21917 <i>''foo''</i>
21918 <i>'''foo'''</i>
21919 <i>foo</i>'s
21920 <b>'foo'</b>
21921 <b>''foo''</b>
21922 <b>'''foo'''</b>
21923 <b>foo'<i>bar'</i>baz</b>
21924 <b>foo</b>'s
21925 '<i>foo</i>
21926 <i>foo</i>'
21927 <i>foo'</i>'
21928 '<i>foo</i>'
21929 '<b>foo</b>
21930 <b>foo</b>'
21931 '<b>foo</b>'
21932 <i>fools'<span> errand</span></i>
21933 <i><span>fool</span>'s errand</i>
21934 '<i>foo</i> bar '<i>baz</i>
21935 a|!*#-:;+-~[]{}b'<i>x</i>
21936 </p>
21937 !! end
21938
21939 !! test
21940 1b. Quotes inside <b> and <i> with other tags on same line
21941 !! options
21942 parsoid=html2wt,wt2wt
21943 !! wikitext
21944 '''a'' foo ''[[bar]]''
21945 ''a''' foo ''[[bar]]''
21946 ''a''' foo '''{{echo|[[bar]]}}'''
21947 [[foo]] x'''[[bar]]''
21948 '''foo'' <ref>test</ref>
21949 '''foo'' <div title="name">test</div>
21950 '''foo'' and <br> bar
21951 <references />
21952 !! html
21953 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21954 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21955 <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>
21956 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21957 '<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>
21958 '<i>foo</i> <div title="name">test</div>
21959 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21960 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21961 <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>
21962 </ol>
21963 !! end
21964
21965 !! test
21966 2. Link fragments separated by <i> and <b> tags
21967 !! wikitext
21968 [[''foo''<nowiki>hello]]</nowiki>
21969
21970 [['''foo'''<nowiki>hello]]</nowiki>
21971 !! html
21972 <p>[[<i>foo</i>hello]]
21973 </p><p>[[<b>foo</b>hello]]
21974 </p>
21975 !! end
21976
21977 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21978 # this is one of the shortcomings of this format
21979 !! test
21980 3. Link fragments inside <i> and <b>
21981 !! wikitext
21982 ''[[foo''<nowiki>]]</nowiki>
21983
21984 '''[[foo'''<nowiki>]]</nowiki>
21985 !! html
21986 <p><i>[[foo</i>]]
21987 </p><p><b>[[foo</b>]]
21988 </p>
21989 !! end
21990
21991 !! test
21992 4. No escaping needed
21993 !! wikitext
21994 '<span>''bar''</span>'
21995 '<span>'''bar'''</span>'
21996 'a:b'foo
21997 !! html
21998 <p>'<span><i>bar</i></span>'
21999 '<span><b>bar</b></span>'
22000 'a:b'foo
22001 </p>
22002 !! end
22003
22004 #### ----------- Paragraphs ---------------
22005 #### 1. No unnecessary escapes
22006 #### --------------------------------------
22007
22008 !! test
22009 1. No unnecessary escapes
22010 !! wikitext
22011 bar <span><nowiki>[[foo]]</nowiki></span>
22012
22013 =bar <span><nowiki>[[foo]]</nowiki></span>
22014
22015 [[bar <span><nowiki>[[foo]]</nowiki></span>
22016
22017 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22018
22019 =bar <span>foo]]</span><nowiki>=</nowiki>
22020 !! html
22021 <p>bar <span>[[foo]]</span>
22022 </p><p>=bar <span>[[foo]]</span>
22023 </p><p>[[bar <span>[[foo]]</span>
22024 </p><p>]]bar <span>[[foo]]</span>
22025 </p><p>=bar <span>foo]]</span>=
22026 </p>
22027 !!end
22028
22029 #### ----------------------- PRE --------------------------
22030 #### 1. Leading whitespace in SOL context should be escaped
22031 #### ------------------------------------------------------
22032 !! test
22033 1. Leading whitespace in SOL context should be escaped
22034 !! options
22035 parsoid
22036 !! wikitext
22037 <nowiki> </nowiki>a
22038
22039 <nowiki> </nowiki> a
22040
22041 <nowiki> </nowiki>a(tab)
22042
22043 <nowiki> </nowiki> a
22044 <!--cmt-->
22045 <nowiki> </nowiki> a
22046
22047 a
22048 <nowiki> </nowiki>b
22049
22050 a
22051 <nowiki> </nowiki>b
22052
22053 a
22054 <nowiki> </nowiki> b
22055 !! html
22056 <p> a</p>
22057 <p> a</p>
22058 <p> a(tab)</p>
22059 <p> a</p>
22060 <p><!--cmt--> a</p>
22061 <p>a
22062 b</p>
22063 <p>a
22064 b</p>
22065 <p>a
22066 b</p>
22067 !! end
22068
22069 !! test
22070 2. Leading whitespace in non-indent-pre contexts should not be escaped
22071 !! options
22072 parsoid
22073 !! wikitext
22074 foo <ref>''a''
22075 b</ref>
22076 <references />
22077 !! html
22078 <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>
22079 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22080 <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>
22081 b</span></li>
22082 </ol>
22083 !! end
22084
22085 !! test
22086 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22087 !! options
22088 parsoid
22089 !! wikitext
22090 <blockquote>
22091 a
22092 <span>b</span>
22093 c
22094 </blockquote>
22095 !! html
22096 <blockquote>
22097 <p>
22098 a
22099 <span>b</span>
22100 c</p>
22101 </blockquote>
22102 !! end
22103
22104 !! test
22105 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22106 !! options
22107 parsoid
22108 !! wikitext
22109 [[File:Foobar.jpg|thumb|caption]]
22110 !! html
22111 !! html/parsoid
22112 <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>
22113 !! end
22114
22115 !! test
22116 5. Nowiki escaping should account for indent-pres
22117 !! options
22118 parsoid=html2wt
22119 !! html
22120 <pre>==foo==</pre>
22121 !! wikitext
22122 ==foo==
22123 !! end
22124
22125 #### --------------- Behavior Switches --------------------
22126 !! test
22127 1. Valid behavior switches should be escaped
22128 !! options
22129 parsoid=html2wt
22130 !! html
22131 __TOC__
22132 <i>__TOC__</i>
22133 !! wikitext
22134 <nowiki>__TOC__</nowiki>
22135 ''<nowiki>__TOC__</nowiki>''
22136 !! end
22137
22138 !! test
22139 2. Invalid behavior switches should not be escaped
22140 !! options
22141 parsoid=html2wt
22142 !! html
22143 __TOO__
22144 __|__
22145 !! wikitext
22146 __TOO__
22147 __|__
22148 !! end
22149
22150 #### --------------- HTML tags ---------------
22151 #### 1. a tags
22152 #### 2. other tags
22153 #### 3. multi-line html tag
22154 #### 4. extension tags
22155 #### -----------------------------------------
22156 !! test
22157 1. a tags
22158 !! options
22159 parsoid
22160 !! wikitext
22161 <a href="http://google.com">google</a>
22162 !! html
22163 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22164 !! end
22165
22166 !! test
22167 2. other tags
22168 !! wikitext
22169 * <nowiki><div>foo</div></nowiki>
22170 * <nowiki><div style="color:red">foo</div></nowiki>
22171 * <nowiki><td></nowiki>
22172 !! html
22173 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22174 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22175 <li> &lt;td&gt;</li></ul>
22176
22177 !! end
22178
22179 !! test
22180 3. multi-line html tag
22181 !! wikitext
22182 <nowiki><div
22183 >foo</div
22184 ></nowiki>
22185 !! html
22186 <p>&lt;div
22187 &gt;foo&lt;/div
22188 &gt;
22189 </p>
22190 !! end
22191
22192 !! test
22193 4. extension tags
22194 !! wikitext
22195 <nowiki><ref>foo</ref></nowiki>
22196
22197 <nowiki><ref>bar</nowiki>
22198
22199 baz<nowiki></ref></nowiki>
22200 !! html
22201 <p>&lt;ref&gt;foo&lt;/ref&gt;
22202 </p><p>&lt;ref&gt;bar
22203 </p><p>baz&lt;/ref&gt;
22204 </p>
22205 !! end
22206
22207 #### --------------- Others ---------------
22208 !! test
22209 Escaping nowikis
22210 !! wikitext
22211 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22212 !! html
22213 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22214 </p>
22215 !! end
22216
22217 ## The quote-char in the input is necessary for triggering the bug
22218 !! test
22219 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22220 !! options
22221 parsoid=wt2wt,html2wt
22222 !! wikitext
22223 foo's bar :
22224 !! html
22225 <p>foo's bar :</p>
22226 !! end
22227
22228 !! test
22229
22230 Tag-like HTML structures are passed through as text
22231 !! wikitext
22232 <x y>
22233
22234 <x.y>
22235
22236 <x-y>
22237
22238 1>2
22239
22240 x<y
22241
22242 a>b
22243
22244 1<d e>f
22245 !! html
22246 <p>&lt;x y&gt;
22247 </p><p>&lt;x.y&gt;
22248 </p><p>&lt;x-y&gt;
22249 </p><p>1&gt;2
22250 </p><p>x&lt;y
22251 </p><p>a&gt;b
22252 </p><p>1&lt;d e&gt;f
22253 </p>
22254 !! end
22255
22256 !! test
22257 HTML tag with necessary entities in attributes
22258 !! wikitext
22259 <span title="&amp;amp;">foo</span>
22260 !! html
22261 <p><span title="&amp;amp;">foo</span>
22262 </p>
22263 !! end
22264
22265 !! test
22266 HTML tag with 'unnecessary' entity encoding in attributes
22267 !! wikitext
22268 <span title="&amp;">foo</span>
22269 !! html
22270 <p><span title="&amp;">foo</span>
22271 </p>
22272 !! end
22273
22274 !! test
22275 HTML tag with broken attribute value quoting
22276 !! wikitext
22277 <span title="Hello world>Foo</span>
22278 !! html/php
22279 <p><span>Foo</span>
22280 </p>
22281 !! html/parsoid
22282 <p><span title="Hello world">Foo</span>
22283 </p>
22284 !! end
22285
22286 !! test
22287 Parsoid-only: HTML tag with broken attribute value quoting
22288 !! options
22289 parsoid
22290 !! wikitext
22291 <span title="Hello world>Foo</span>
22292 !! html
22293 <p><span title="Hello world">Foo</span>
22294 </p>
22295 !! end
22296
22297 !! test
22298 Table with broken attribute value quoting
22299 !! wikitext
22300 {|
22301 | title="Hello world|Foo
22302 |}
22303 !! html/php
22304 <table>
22305 <tr>
22306 <td>Foo
22307 </td></tr></table>
22308
22309 !! html/parsoid
22310 <table>
22311 <tr>
22312 <td title="Hello world">Foo
22313 </td></tr></table>
22314
22315 !! end
22316
22317 !! test
22318 Table with broken attribute value quoting on consecutive lines
22319 !! wikitext
22320 {|
22321 | title="Hello world|Foo
22322 | style="color:red|Bar
22323 |}
22324 !! html/php
22325 <table>
22326 <tr>
22327 <td>Foo
22328 </td>
22329 <td>Bar
22330 </td></tr></table>
22331
22332 !! html/parsoid
22333 <table><tbody>
22334 <tr>
22335 <td title="Hello world">Foo
22336 </td><td style="color: red">Bar
22337 </td></tr></tbody></table>
22338
22339 !! end
22340
22341 !! test
22342 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22343 !! options
22344 parsoid
22345 !! wikitext
22346 {{}}
22347 !! html
22348 {{}}
22349 !! end
22350
22351 !! test
22352 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22353 !! options
22354 parsoid
22355 !! wikitext
22356 }}{{
22357 !! html
22358 }}{{
22359 !! end
22360
22361 !!test
22362 Accept empty td cell attribute
22363 !! wikitext
22364 {|
22365 | align="center" | foo || |
22366 |}
22367 !! html
22368 <table>
22369 <tr>
22370 <td align="center"> foo </td>
22371 <td>
22372 </td></tr></table>
22373
22374 !!end
22375
22376 !!test
22377 Non-empty attributes in th-cells
22378 !! wikitext
22379 {|
22380 ! Foo !! style="color: red" | Bar
22381 |}
22382 !! html
22383 <table>
22384 <tr>
22385 <th> Foo </th>
22386 <th style="color: red"> Bar
22387 </th></tr></table>
22388
22389 !!end
22390
22391 !!test
22392 Accept empty attributes in th-cells
22393 !! wikitext
22394 {|
22395 !| foo !!| bar
22396 |}
22397 !! html
22398 <table>
22399 <tr>
22400 <th> foo </th>
22401 <th> bar
22402 </th></tr></table>
22403
22404 !!end
22405
22406 !!test
22407 Empty table rows go away
22408 !! wikitext
22409 {|
22410 | Hello
22411 | there
22412 |- class="foo"
22413 |-
22414 |}
22415 !! html
22416 <table>
22417 <tr>
22418 <td> Hello
22419 </td>
22420 <td> there
22421 </td></tr>
22422
22423 </table>
22424
22425 !! end
22426
22427 ###
22428 ### Parsoid-centric tests for testing RTing of inter-element separators
22429 ### Edge cases not tested by existing parser tests and specific to
22430 ### Parsoid-specific serialization strategies.
22431 ###
22432
22433 !!test
22434 RT-ed inter-element separators should be valid separators
22435 !! wikitext
22436 {|
22437 |- [[foo]]
22438 |}
22439 !! html
22440 <table>
22441
22442 </table>
22443
22444 !!end
22445
22446 # Parsoid-only since PHP parser relies on Tidy for correct output
22447 !!test
22448 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22449 !!options
22450 parsoid
22451 !! wikitext
22452 {|
22453 |<small>foo
22454 bar
22455 |}
22456
22457 {|
22458 |<small>foo<small>
22459 |}
22460 !! html
22461 <table>
22462 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22463 <p>bar</p></small></td></tr>
22464 </tbody></table>
22465
22466 <table>
22467 <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>
22468 </tbody></table>
22469 !!end
22470
22471 !!test
22472 Empty TD followed by TD with tpl-generated attribute
22473 !! wikitext
22474 {|
22475 |-
22476 |
22477 |{{echo|style='color:red'}}|foo
22478 |}
22479 !! html
22480 <table>
22481
22482 <tr>
22483 <td>
22484 </td>
22485 <td>foo
22486 </td></tr></table>
22487
22488 !!end
22489
22490 !!test
22491 Indented table with an empty td
22492 !! wikitext
22493 {|
22494 |-
22495 |
22496 |foo
22497 |}
22498 !! html
22499 <table>
22500
22501 <tr>
22502 <td>
22503 </td>
22504 <td>foo
22505 </td></tr></table>
22506
22507 !!end
22508
22509 ## We have some newline diffs RT-ing this edge case
22510 ## and it is not important enough -- we seem to be emitting
22511 ## at most 2 newlines after a </tr> and this is unrelated to
22512 ## the issue from T85627 that this is testing.
22513 !!test
22514 Indented table with blank lines in between (T85627)
22515 !! options
22516 parsoid=wt2html
22517 !! wikitext
22518 {|
22519 |foo
22520
22521
22522 |}
22523 !! html
22524 <table>
22525
22526 <tr>
22527 <td>foo
22528 </td></tr></table>
22529
22530 !!end
22531
22532 !!test
22533 Indented block & table
22534 !! wikitext
22535 <div>foo</div>
22536 {|
22537 |foo
22538 |}
22539 !! html/php
22540 <div>foo</div>
22541 <table>
22542 <tr>
22543 <td>foo
22544 </td></tr></table>
22545
22546 !! html/parsoid
22547 <div data-parsoid='{"stx":"html"}'>foo</div>
22548 <table><tbody>
22549 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22550 </tbody></table>
22551 !!end
22552
22553 !! test
22554 Indent and comment before table row
22555 !! wikitext
22556 {|
22557 <!--hi-->|-
22558 | there
22559 |}
22560 !! html/php
22561 <table>
22562
22563 <tr>
22564 <td> there
22565 </td></tr></table>
22566
22567 !! html/parsoid
22568 <table>
22569 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22570 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22571 </tbody></table>
22572 !! end
22573
22574 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22575 !!test
22576 Empty TR followed by a template-generated TR
22577 !!options
22578 parsoid
22579 !! wikitext
22580 {|
22581 |-
22582 {{echo|<tr><td>foo</td></tr>}}
22583 |}
22584 !! html
22585 <table>
22586 <tbody>
22587 <tr></tr>
22588 <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}}]}'>
22589 <td>foo</td></tr>
22590 </tbody></table>
22591 !!end
22592
22593 ## PHP and parsoid output differ for this, and since this is primarily
22594 ## for testing Parsoid's serializer, marking this Parsoid only
22595 !!test
22596 Empty TR followed by mixed-ws-comment line should RT correctly
22597 !!options
22598 parsoid
22599 !! wikitext
22600 {|
22601 |-
22602 <!--c-->
22603 |-
22604 <!--c--> <!--d-->
22605 |}
22606 !! html
22607 <table>
22608 <tbody>
22609 <tr></tr>
22610 <!--c-->
22611 <tr>
22612 <!--c--> </tr><!--d-->
22613 </tbody></table>
22614
22615 !!end
22616
22617 !!test
22618 Multi-line image caption generated by templates with/without trailing newlines
22619 !! wikitext
22620 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22621 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22622 !! html/parsoid
22623 <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>
22624 <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>
22625 !!end
22626
22627 !! test
22628 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22629 !! options
22630 parsoid=html2wt
22631 !! html
22632 <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>
22633
22634 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22635 !! wikitext
22636 <includeonly>foo</includeonly>
22637 new para
22638
22639 [[./Category:Foo]]
22640
22641 = new heading =
22642 !! end
22643
22644 ## PHP emits broken html for this, and since this is primarily
22645 ## a Parsoid serializer test, marking this Parsoid only
22646 !!test
22647 Improperly nested inline or quotes tags with whitespace in between
22648 !!options
22649 parsoid
22650 !! wikitext
22651 <span> <s>x</span> </s>
22652 ''' ''x''' ''
22653 !! html
22654 <p><span> <s>x</s></span><s> </s>
22655 <b> <i>x</i></b><i> </i>
22656 </p>
22657 !!end
22658
22659 !!test
22660 Encapsulate protected attributes from wt
22661 !!options
22662 parsoid
22663 !! wikitext
22664 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22665 !! html
22666 <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>
22667 </body>
22668 !!end
22669
22670 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22671 ## Having nested or stray pre tags results in the attempt to add duplicates,
22672 ## causing an assertion fail. This test tries to prevent that situation.
22673 !!test
22674 Ensure ParagraphWrapper can deal with stray closing pre tags
22675 !!options
22676 parsoid=wt2html
22677 !! wikitext
22678 plain text</pre>
22679 !! html
22680 plain text
22681 !!end
22682
22683 !!test
22684 1. Ensure fostered text content is wrapped in element nodes
22685 !!options
22686 parsoid=wt2html
22687 !! wikitext
22688 <table>hi</table><table>ho</table>
22689 !! html
22690 <p>hi</p>
22691 <table></table>
22692 <p>ho</p>
22693 <table></table>
22694 !!end
22695
22696 !!test
22697 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22698 !!options
22699 parsoid=wt2html,wt2wt
22700 !! wikitext
22701 <table>
22702 <tr> || ||
22703 <td> a
22704 </table>
22705 !! html
22706 <p> || ||
22707 </p><table>
22708 <tbody><tr><td> a</td></tr>
22709 </tbody></table>
22710 !!end
22711
22712 !!test
22713 Encapsulation properly handles null DSR information from foster box
22714 !!options
22715 parsoid=wt2html,wt2wt
22716 !! wikitext
22717 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22718 !! html
22719 <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>
22720 !!end
22721
22722 !!test
22723 1. Encapsulate foster-parented transclusion content
22724 !!options
22725 parsoid=wt2wt,wt2html
22726 !! wikitext
22727 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22728 !! html
22729 <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>
22730 <tbody>
22731 <tr>
22732 <td>bar</td>
22733 </tr>
22734 </tbody>
22735 </table>
22736 !!end
22737
22738 !!test
22739 2. Encapsulate foster-parented transclusion content
22740 !!options
22741 parsoid=wt2wt,wt2html
22742 !! wikitext
22743 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22744 !! html
22745 <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>
22746 <table>
22747 <tbody>
22748 <tr>
22749 <td>bar</td>
22750 </tr>
22751 </tbody>
22752 </table>
22753 !!end
22754
22755 !!test
22756 3. Encapsulate foster-parented transclusion content
22757 !!options
22758 parsoid=wt2wt,wt2html
22759 !! wikitext
22760 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22761 !! html
22762 <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;]}">
22763 <p>foo</p>
22764 </div>
22765 <table>
22766 <tbody>
22767 <tr>
22768 <td>bar</td>
22769 </tr>
22770 </tbody>
22771 </table>
22772 !!end
22773
22774 !!test
22775 4. Encapsulate foster-parented transclusion content
22776 !!options
22777 parsoid=wt2wt,wt2html
22778 !! wikitext
22779 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22780 !! html
22781 <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;]}">
22782 <p>foo</p>
22783 </div>
22784 <table>
22785 <tbody>
22786 <tr>
22787 <td>bar</td>
22788 </tr>
22789 </tbody>
22790 </table>
22791 !!end
22792
22793 !!test
22794 5. Encapsulate foster-parented transclusion content
22795 !!options
22796 parsoid=wt2wt,wt2html
22797 !! wikitext
22798 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22799 !! html
22800 <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>
22801 <table>
22802 <tbody>
22803 <tr>
22804 <td>
22805 <div>
22806 <p>foo</p>
22807 </div>
22808 </td>
22809 </tr>
22810 </tbody>
22811 </table>
22812 !!end
22813
22814 !!test
22815 6. Encapsulate foster-parented transclusion content
22816 !!options
22817 parsoid=wt2wt,wt2html
22818 !! wikitext
22819 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22820 !! html
22821 <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>
22822 <table>
22823 <tbody>
22824 <tr>
22825 <td>
22826 <div>
22827 <p>foo</p>
22828 </div>
22829 </td>
22830 </tr>
22831 </tbody>
22832 </table>
22833 <p>ok</p>
22834 !!end
22835
22836 !!test
22837 7. Encapsulate foster-parented transclusion content
22838 !!options
22839 parsoid=wt2wt,wt2html
22840 !! wikitext
22841 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22842 !! html
22843 <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>
22844 <table>
22845 <tbody>
22846 <tr>
22847 <td>bar</td>
22848 </tr>
22849 </tbody>
22850 </table>
22851 !!end
22852
22853 !!test
22854 8. Encapsulate foster-parented transclusion content
22855 !!options
22856 parsoid=wt2wt,wt2html
22857 !! wikitext
22858 {{echo|a
22859 }}{|{{echo|style='color:red'}}
22860 |-
22861 |b
22862 |}
22863 !! html
22864 <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>
22865 <tbody>
22866 <tr>
22867 <td>b</td>
22868 </tr>
22869 </tbody>
22870 </table>
22871 !!end
22872
22873 !!test
22874 9. Encapsulate foster-parented transclusion content
22875 !!options
22876 parsoid=wt2wt,wt2html
22877 !! wikitext
22878 <table>{{echo|hi</table>hello}}
22879 !! html
22880 <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>
22881 !!end
22882
22883 !!test
22884 Table in fosterable position
22885 !!options
22886 parsoid=wt2html,wt2wt
22887 !! wikitext
22888 {{OpenTable}}
22889 <div>
22890 {|
22891 |}
22892 </div>
22893 |}
22894 !! html
22895 <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">
22896 </span>
22897 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22898
22899 <table>
22900 </table>
22901 !!end
22902
22903 # Parsoid only for bug 64747
22904 !! test
22905 Properly encapsulate empty-content transclusions in fosterable positions
22906 !! wikitext
22907 <table>
22908 {{#if:|
22909 <td>foo</td>
22910 }}
22911 </table>
22912 !! html/parsoid
22913 <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":["","","",""]}]]}'>
22914
22915 </table>
22916 !! end
22917
22918 !!test
22919 Support <object> element with .data attribute
22920 !!options
22921 parsoid=html2wt
22922 !! html
22923 <object data="test.swf"></object>
22924 !! wikitext
22925 <object data="test.swf"></object>
22926 !!end
22927
22928 !! test
22929 Don't block XML namespace declaration
22930 !! wikitext
22931 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22932 !! html/php
22933 <p><span>MediaWiki</span>
22934 </p>
22935 !! html/parsoid
22936 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22937 !! end
22938
22939 # -----------------------------------------------------------------
22940 # The following section of tests are primarily to spec requirements
22941 # around serialization of new/edited content.
22942 #
22943 # All these tests are marked Parsoid html2wt and html2html only
22944 # ----------------------------------------------------------------
22945
22946 # 'mi' is a localinterwiki prefix as well as a language
22947 !! test
22948 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22949 !! options
22950 parsoid=html2wt
22951 !! html
22952 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22953 !! wikitext
22954 [[Foo]]
22955 !! end
22956
22957 !! test
22958 New wiki links (href variations)
22959 !! options
22960 parsoid=html2wt
22961 !! html
22962 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22963 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22964 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22965 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22966 !! wikitext
22967 [[Foo_bar]]
22968 [[Foo_bar]]
22969 [[Foo_bar]]
22970 [[Toxine bactérienne]]
22971 !! end
22972
22973 !! test
22974 New wiki links (content string variations)
22975 !! options
22976 parsoid=html2wt
22977 !! html
22978 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22979 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22980 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22981 !! wikitext
22982 [[Foo_bar]]
22983 [[Foo bar]]
22984 [[Foo_bar|./Foo_bar]]
22985 !! end
22986
22987 !! test
22988 New category links (href variations)
22989 !! options
22990 parsoid=html2wt
22991 !! html
22992 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22993 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22994 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22995 !! wikitext
22996 [[Category:Toxine bactérienne]]
22997 [[Category:Toxine bactérienne]]
22998 [[Category:Toxine bactérienne]]
22999 !! end
23000
23001 !! test
23002 New sol transparent links don't need indent-pre nowiki protection
23003 !! options
23004 parsoid=html2wt
23005 language=de
23006 !! html
23007 <link rel="mw:PageProp/redirect" href="./Main_Page">
23008 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23009 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23010 !! wikitext
23011 #WEITERLEITUNG [[Main Page]]
23012 <!-- this is good --> [[Category:Good]]
23013 <!-- this is great --> [[Kategorie:Great]]
23014 !! end
23015
23016 !! test
23017 New interlanguage links (href variations)
23018 !! options
23019 parsoid=html2wt
23020 !! html
23021 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23022 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23023 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23024 !! wikitext
23025 [[es:Toxine bactérienne]]
23026 [[es:Toxine_bactérienne]]
23027 [[es:Toxine_bactérienne]]
23028 !! end
23029
23030 !! test
23031 Image: Modifying size of an image (1)
23032 !! options
23033 parsoid={
23034 "modes": ["wt2wt"],
23035 "changes": [
23036 ["img[height]", "attr", "height", "22"],
23037 ["img[width]", "attr", "width", "200"]
23038 ]
23039 }
23040 !! wikitext
23041 [[Image:Foobar.jpg|230x230px]]
23042 !! wikitext/edited
23043 [[Image:Foobar.jpg|200x200px]]
23044 !!end
23045
23046 !! test
23047 Image: Modifying size of an image (2)
23048 !! options
23049 parsoid={
23050 "modes": ["wt2wt"],
23051 "changes": [
23052 ["img[height]", "attr", "height", "100"],
23053 ["img[width]", "attr", "width", "500"]
23054 ]
23055 }
23056 !! wikitext
23057 [[Image:Foobar.jpg|230x230px]]
23058 !! wikitext/edited
23059 [[Image:Foobar.jpg|500x500px]]
23060 !!end
23061
23062 # Change in size is ignored so long as class='mw-default-size'
23063 !! test
23064 Image: Modifying size of an image (3)
23065 !! options
23066 parsoid={
23067 "modes": ["wt2wt"],
23068 "changes": [
23069 ["figure[class]", "removeClass", "mw-default-size"],
23070 ["figure img", "attr", "height", "19"],
23071 ["figure img", "attr", "width", "170"]
23072 ]
23073 }
23074 !! wikitext
23075 [[Image:Foobar.jpg|thumb]]
23076 !! wikitext/edited
23077 [[Image:Foobar.jpg|thumb|170x170px]]
23078 !!end
23079
23080 !! test
23081 Image: Modifying alignment of an image (bug 48665)
23082 !! options
23083 parsoid={
23084 "modes": ["wt2wt"],
23085 "changes": [
23086 ["figure[class]", "removeClass", "mw-halign-right"],
23087 ["figure[class]", "addClass", "mw-halign-left"]
23088 ]
23089 }
23090 !! wikitext
23091 [[Image:Foobar.jpg|thumb|caption|right]]
23092 !! wikitext/edited
23093 [[Image:Foobar.jpg|thumb|caption|left]]
23094 !! end
23095
23096 !! test
23097 Image: Modifying mw-default-size of an frameless image (bug 62805)
23098 !! options
23099 parsoid={
23100 "modes": ["wt2wt"],
23101 "changes": [
23102 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23103 ]
23104 }
23105 !! wikitext
23106 [[Image:Foobar.jpg|frameless|right]]
23107 !! wikitext/edited
23108 [[Image:Foobar.jpg|frameless|right|220x220px]]
23109 !! end
23110
23111 !! test
23112 Image: Modifying valign of an image (bug 49221)
23113 !! options
23114 parsoid={
23115 "modes": ["wt2wt"],
23116 "changes": [
23117 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23118 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23119 ]
23120 }
23121 !! wikitext
23122 [[File:Foobar.jpg|20px|middle]]
23123 !! wikitext/edited
23124 [[File:Foobar.jpg|20px|text-top]]
23125 !! end
23126
23127 !! test
23128 Image: Modifying alt attribute of an image (bug 56400)
23129 !! options
23130 parsoid={
23131 "modes": ["wt2wt"],
23132 "changes": [
23133 ["img[alt]", "attr", "alt", "some alternate edited text"]
23134 ]
23135 }
23136 !! wikitext
23137 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23138 !! wikitext/edited
23139 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23140 !!end
23141
23142 !! test
23143 Image: Modifying caption of an image
23144 !! options
23145 parsoid={
23146 "modes": ["wt2wt"],
23147 "changes": [
23148 ["figcaption", "text", "new caption"]
23149 ]
23150 }
23151 !! wikitext
23152 [[Image:Foobar.jpg|thumb|original caption]]
23153 !! wikitext/edited
23154 [[Image:Foobar.jpg|thumb|new caption]]
23155 !!end
23156
23157 !! test
23158 Image: empty alt attribute (bug 48924)
23159 !! options
23160 parsoid
23161 !! wikitext
23162 [[File:Foobar.jpg|thumb|alt=|bar]]
23163 !! html
23164 <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>
23165 !! end
23166
23167 #!! test
23168 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23169 #!! options
23170 #parsoid=html2wt
23171 #language=ar
23172 #!! html
23173 #<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>
23174 #!! wikitext
23175 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23176 #!! end
23177
23178 !! test
23179 Image: Block level image should have \n before and after
23180 !! wikitext
23181 123
23182 [[File:Foobar.jpg|right|thumb|150x150px]]
23183 456
23184 !! html/parsoid
23185 <p>123</p>
23186 <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>
23187 <p>456</p>
23188 !!end
23189
23190 !! test
23191 Image: New block level image should have \n before and after (existing content)
23192 !! wikitext
23193 123
23194 [[File:Foobar.jpg|right|thumb|150x150px]]
23195 456
23196 !! html/parsoid
23197 <p>123</p>
23198 <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>
23199 <p>456</p>
23200 !!end
23201
23202 !! test
23203 Image: upright option (parsoid)
23204 !! options
23205 parsoid
23206 !! wikitext
23207 [[File:Foobar.jpg|thumb|upright|caption]]
23208 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23209 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23210 !! html
23211 <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>
23212 <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>
23213 <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>
23214 !!end
23215
23216 !! test
23217 Image: upright option is ignored on inline and frame images (parsoid)
23218 !! options
23219 parsoid
23220 !! wikitext
23221 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23222 !! html
23223 <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>
23224 !!end
23225
23226 !! test
23227 Image: from basic HTML (1)
23228 !! options
23229 parsoid=html2wt
23230 !! html/parsoid
23231 <span typeof="mw:Image">
23232 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
23233 </span>
23234 !! wikitext
23235 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23236 !! end
23237
23238 !! test
23239 Image: from basic HTML (2)
23240 !! options
23241 parsoid=html2wt
23242 !! html/parsoid
23243 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
23244 !! wikitext
23245 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23246 !! end
23247
23248 !! test
23249 Image: from basic HTML (3)
23250 !! options
23251 parsoid=html2wt
23252 !! html/parsoid
23253 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
23254 !! wikitext
23255 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
23256 !! end
23257
23258 !! test
23259 Image: from basic HTML (4)
23260 !! options
23261 parsoid=html2wt
23262 !! html/parsoid
23263 <img src="File:Foobar.jpg">
23264 !! wikitext
23265 [[File:Foobar.jpg|link=]]
23266 !! end
23267
23268 !! test
23269 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
23270 !! options
23271 parsoid=html2wt
23272 !! html
23273 <ul>
23274 <li><p>foo</p></li>
23275 </ul>
23276 !! wikitext
23277 * foo
23278 !! end
23279
23280 !! test
23281 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
23282 !! options
23283 parsoid=html2wt
23284 !! html
23285 <ul> <li>foo</li></ul>
23286 !! wikitext
23287 * foo
23288 !! end
23289
23290 !! test
23291 Don't strip leading whitespace when handling indent-pre suppressing tags
23292 !! options
23293 parsoid=html2wt
23294 !! html
23295 <table>
23296 <tr><td> indented row</td></tr>
23297 </table>
23298 <blockquote><p>
23299 <b>This is very bold of you!</b>
23300 </p>
23301 <table><tr><td>
23302 indented cell (no pre-wrapping!)
23303 </td></tr></table>
23304 </blockquote>
23305 <p>foo</p>
23306 <div>bar</div>
23307 !! wikitext
23308 {|
23309 | indented row
23310 |}
23311 <blockquote>
23312 '''This is very bold of you!'''
23313
23314 {|
23315 |
23316 indented cell (no pre-wrapping!)
23317 |}
23318 </blockquote>
23319 foo
23320 <div>bar</div>
23321 !! end
23322
23323 !! test
23324 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
23325 !! options
23326 parsoid=html2wt
23327 !! wikitext
23328 foo
23329 <nowiki> </nowiki><span>bar</span>
23330
23331 <span>foo2
23332 <nowiki> </nowiki></span>bar2
23333
23334 <div>foo</div>
23335 <nowiki> </nowiki><span>bar</span>
23336
23337 <div>
23338 <nowiki> </nowiki><span>foo</span>
23339 </div>
23340 !! html
23341 <p>foo</p>
23342 <span>bar</span>
23343
23344 <span>foo2
23345 </span>bar2
23346
23347 <div>foo</div>
23348 <span>bar</span>
23349
23350 <div>
23351 <span>foo</span>
23352 </div>
23353 !! end
23354
23355 !! test
23356 Lists: Add space after bullets
23357 !! options
23358 parsoid=html2wt
23359 !! html
23360 <ul>
23361 <li>foo</li>
23362 <li> bar</li>
23363 <li><span> baz</span></li>
23364 </ul>
23365 !! wikitext
23366 * foo
23367 * bar
23368 * <span> baz</span>
23369 !! end
23370
23371 !! test
23372 Lists: Dont insert newlines in a serialized list item.
23373 !! options
23374 parsoid=html2wt
23375 !! html
23376 <ul><li>a<br>b</li><li>c</li></ul>
23377 !! wikitext
23378 * a<br>b
23379 * c
23380 !! end
23381
23382 !! test
23383 Headings: Add space before/after == (Bug 51744)
23384 !! options
23385 parsoid=html2wt
23386 !! html
23387 <h2>foo</h2>
23388 <h2> bar</h2>
23389 <h2>baz </h2>
23390 <h2><span> baz</span></h2>
23391 !! wikitext
23392 == foo ==
23393
23394 == bar ==
23395
23396 == baz ==
23397
23398 == <span> baz</span> ==
23399 !! end
23400
23401 !! test
23402 Headings: Force metas to serialize before/after
23403 !! options
23404 parsoid=html2wt
23405 !! html
23406 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23407 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23408
23409 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23410 !! wikitext
23411 == hello there ==
23412 [[Category:A1]]
23413
23414 [[Category:A2]]
23415 == hi pal ==
23416
23417 <!--foo--> [[Category:A3]]
23418 == how goes it ==
23419 !! end
23420
23421 !! test
23422 Parsoid: Serialize positional parameters with = in them as named parameter
23423 !! options
23424 parsoid=html2wt
23425 !! html
23426 <p about="#mwt1" typeof="mw:Transclusion"
23427 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23428
23429 <p about="#mwt1" typeof="mw:Transclusion"
23430 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23431
23432 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23433 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23434 <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>
23435 !! wikitext
23436 {{echo|1 = f=oo}}
23437
23438 {{echo|1 = f=oo|2 = bar}}
23439
23440 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23441 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23442 {{echo|<nowiki>f=oo</nowiki>|bar}}
23443 !! end
23444
23445 !! test
23446 Parsoid: Serialize positional parameters with = in extlink as named parameter
23447 !! options
23448 parsoid=html2wt
23449 !! html
23450 <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>
23451 !! wikitext
23452 {{echo|1 = http://stuff?is=ok}}
23453 !! end
23454
23455 !! test
23456 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23457 !! options
23458 parsoid=html2wt
23459 !! html
23460 <div>a<p>b</p></div>
23461 <div>a
23462 <p>b</p></div>
23463 <div>
23464 a
23465 <p>b</p></div>
23466 !! wikitext
23467 <div>a
23468 b
23469 </div>
23470 <div>a
23471 b
23472 </div>
23473 <div>
23474 a
23475
23476 b
23477 </div>
23478 !! end
23479
23480 !! test
23481 Substrings resembling wikitext in hrefs should not get nowiki escapes
23482 !! options
23483 parsoid=html2wt
23484 !! html
23485 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23486 !! wikitext
23487 [[Foo''bar''baz]]
23488 !! end
23489
23490 !! test
23491 Enforce single-line context in the serializer
23492 !! options
23493 parsoid=html2wt
23494 !! html
23495 <h2>testing
23496 123</h2>
23497
23498 <ul><li>asd
23499 sdf</li></ul>
23500 !! wikitext
23501 == testing 123 ==
23502
23503 * asd sdf
23504 !! end
23505
23506 #-----------------------------
23507 # I/B quote minimization tests
23508 #-----------------------------
23509
23510 !! test
23511 1. I/B quote minimization: wikitext-only tags should be combined
23512 !! options
23513 parsoid=html2wt
23514 !! html
23515 <p><i>A</i><i>B</i></p>
23516 <p><b>A</b><b>B</b></p>
23517 <p><i>A</i><b><i>B</i></b></p>
23518 <p><b>A</b><i><b>B</b></i></p>
23519 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23520 <p><i><b>A</b></i><i><b>B</b></i></p>
23521 <p><i><b>A</b></i><b><i>B</i></b></p>
23522 <p><b><i>A</i></b><i><b>B</b></i></p>
23523 !! wikitext
23524 ''AB''
23525
23526 '''AB'''
23527
23528 ''A'''B'''''
23529
23530 '''A''B'''''
23531
23532 '''A''BC''D'''
23533
23534 '''''AB'''''
23535
23536 '''''AB'''''
23537
23538 '''''AB'''''
23539 !! end
23540
23541 !! test
23542 2. I/B quote minimization: wikitext and html tags should not be combined
23543 !! options
23544 parsoid=html2wt
23545 !! html
23546 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23547 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23548 !! wikitext
23549 ''A''<i>B</i>
23550
23551 ''A''<nowiki/>'''<i>B</i>'''
23552 !! end
23553
23554 !! test
23555 3. I/B quote minimization: templated content stops minimization
23556 !! options
23557 parsoid=html2wt
23558 !! html
23559 <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>
23560 <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>
23561 !! wikitext
23562 ''A''{{echo|''B''}}
23563
23564 ''A''{{echo|'''''B'''''}}
23565 !! end
23566
23567 !! test
23568 4. I/B quote minimization: new content should be mimimized with adjacent old content
23569 !! options
23570 parsoid=html2wt
23571 !! html
23572 <p><i>A</i><i>B</i></p>
23573 <p><b>A</b><b>B</b></p>
23574 <p><i>A</i><b><i>B</i></b></p>
23575 !! wikitext
23576 ''AB''
23577
23578 '''AB'''
23579
23580 ''A'''B'''''
23581 !! end
23582
23583 !! test
23584 5a. Merge adjacent quote nodes if they've been edited
23585 !! options
23586 parsoid={
23587 "modes": ["wt2wt"],
23588 "changes": [
23589 ["p", "contents", "remove", ":contains('b')"]
23590 ]
23591 }
23592 !! wikitext
23593 ''a''b''c''
23594 !! wikitext/edited
23595 ''ac''
23596 !! end
23597
23598 !! test
23599 5b. Merge adjacent quote nodes if they've been edited
23600 !! options
23601 parsoid={
23602 "modes": ["wt2wt"],
23603 "changes": [
23604 ["#x", "remove"]
23605 ]
23606 }
23607 !! wikitext
23608 ''a''<span id="x">b</span>''c''
23609 !! wikitext/edited
23610 ''ac''
23611 !! end
23612
23613 #------------------------------------
23614 # End of I/B quote minimization tests
23615 #------------------------------------
23616
23617 !!test
23618 Bug 54262: New entities
23619 !! options
23620 parsoid=html2wt
23621 !! wikitext
23622 &nbsp;
23623 !! html
23624 <span typeof="mw:Entity">&nbsp;</span>
23625 !! end
23626
23627 ## Note that there is no wikitext output for 'unknownproperty' ##
23628 ## Unknown magic words are silently dropped ##
23629
23630 !! test
23631 Magic words
23632 !! options
23633 parsoid=html2wt
23634 !! html
23635 <meta property='mw:PageProp/toc' />
23636 <meta property='mw:PageProp/notoc' />
23637 <meta property='mw:PageProp/forcetoc' />
23638 <meta property='mw:PageProp/index' />
23639 <meta property='mw:PageProp/noindex' />
23640 <meta property='mw:PageProp/nogallery' />
23641 <meta property='mw:PageProp/noeditsection' />
23642 <meta property='mw:PageProp/notitleconvert' />
23643 <meta property='mw:PageProp/nocontentconvert' />
23644 <meta property='mw:PageProp/unknownproperty' />
23645 !! wikitext
23646 __TOC__
23647 __NOTOC__
23648 __FORCETOC__
23649 __INDEX__
23650 __NOINDEX__
23651 __NOGALLERY__
23652 __NOEDITSECTION__
23653 __NOTITLECONVERT__
23654 __NOCONTENTCONVERT__
23655 !! end
23656
23657 !! test
23658 Consecutive <pre>s should not get merged
23659 !! options
23660 parsoid=html2wt,html2html
23661 !! html
23662 <pre>a</pre><pre>b</pre>
23663
23664 <pre>c
23665 </pre><pre>
23666 d</pre>
23667
23668 <pre>e
23669
23670 </pre><pre>
23671
23672 f</pre>
23673 !! wikitext
23674 a
23675
23676 b
23677
23678 c
23679
23680 d
23681
23682 e
23683
23684
23685
23686 f
23687 !! end
23688
23689 !! test
23690 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23691 !! options
23692 parsoid=html2wt
23693 !! html
23694 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23695 !! wikitext
23696 [[Special:BookSources/1234567890|ISBN 1234567895]]
23697 !! end
23698
23699 !! test
23700 Edited RFC links not serializable as RFC links should serialize as extlinks
23701 !! options
23702 parsoid=html2wt
23703 !! html
23704 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23705 !! wikitext
23706 [//tools.ietf.org/html/rfc123 New RFC]
23707 !! end
23708
23709 !! test
23710 Edited PMID links not serializable as PMID links should serialize as extlinks
23711 !! options
23712 parsoid=html2wt
23713 !! html
23714 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23715 !! wikitext
23716 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23717 !! end
23718
23719 !! test
23720 WTS of autolinks with trailing/surrounding context
23721 !! options
23722 parsoid=html2wt
23723 !! html/parsoid
23724 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23725 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23726 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23727 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23728 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23729 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23730 !! wikitext
23731 http://cscott.net<nowiki/>'''foo'''
23732
23733 http://cscott.net<b>foo</b>
23734
23735 '''http://cscott.net<nowiki/>'''
23736
23737 '''http://cscott.net '''
23738
23739 '''http://cscott.net<nowiki/>x'''
23740
23741 http://cscott.net<nowiki/>x
23742 !! end
23743
23744 !! test
23745 WTS of autolinks with nowikis (round-trip)
23746 !! wikitext
23747 x<nowiki/>http://cscott.net<nowiki/>x
23748 !! html/parsoid
23749 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23750 !! end
23751
23752 # this is the "easy" test because it leaves in place all the
23753 # data-parsoid information indicating this is an autolink
23754 !! test
23755 WTS of autolinks with escapes (editing)
23756 !! options
23757 parsoid={
23758 "modes": ["wt2wt"],
23759 "changes": [
23760 [ "meta", "remove" ]
23761 ]
23762 }
23763 !! wikitext
23764 x<nowiki/>http://cscott.net<nowiki/>x
23765 !! wikitext/edited
23766 x<nowiki/>http://cscott.net<nowiki/>x
23767 !! end
23768
23769 !! test
23770 Edited Redirect link should emit a non-piped wikitext link
23771 !! options
23772 parsoid=html2wt
23773 !! html
23774 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23775 !! wikitext
23776 #REDIRECT [[Bar]]
23777 !! end
23778
23779 !! test
23780 T75121: Infer extension name from typeOf if data-mw is not present
23781 !! options
23782 parsoid=html2wt
23783 !! html
23784 <div typeOf="mw:Extension/foo"></div>
23785 !! wikitext
23786 <foo />
23787 !! end
23788
23789 # Note that the <p> wrapping isn't present in PHP parser output
23790 # The important thing for this test is that P-wrapping doesn't
23791 # interfere with the <nowiki> protection for leading - in <td>
23792 # (which isn't necessary for <th>).
23793 !! test
23794 T88318: p-wrapped dash in table.
23795 !! options
23796 parsoid=html2wt,wt2wt
23797 !! html/parsoid
23798 <table><tbody>
23799 <tr><th><p>-</p></th><th><p>- </p></th></tr>
23800 <tr><td><p>-</p></td><td><p>- </p></td></tr>
23801 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
23802 </tbody></table>
23803 !! wikitext
23804 {|
23805 !-
23806 !-
23807 |-
23808 |<nowiki>-</nowiki>
23809 |<nowiki>- </nowiki>
23810 |-
23811 |<small>-</small>
23812 |<br>
23813 -
23814 |<br>
23815 -
23816 |}
23817 !! html/php+tidy
23818 <table>
23819 <tr>
23820 <th>-</th>
23821 <th>-</th>
23822 </tr>
23823 <tr>
23824 <td>-</td>
23825 <td>-</td>
23826 </tr>
23827 <tr>
23828 <td><small>-</small></td>
23829 <td><br />
23830 <p>-</p>
23831 </td>
23832 <td><br />
23833 <p>-</p>
23834 </td>
23835 </tr>
23836 </table>
23837 !! end
23838
23839 # -----------------------------------------------------------------
23840 # End of section for Parsoid-only html2wt tests for serialization
23841 # of new content
23842 # -----------------------------------------------------------------
23843
23844 TODO:
23845 more images
23846 more tables
23847 character entities
23848 and much more
23849 Try for 100% code coverage