Update the documentation at the top of parserTests.txt
[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 formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 #
33 # You can also set the following parser properties via test options:
34 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
35 # wgLinkHolderBatchSize, wgRawHtml
36 #
37 # For testing purposes, temporary articles can created:
38 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
39 # where '/' denotes a newline.
40
41 # This is the standard article assumed to exist.
42 !! article
43 Main Page
44 !! text
45 blah blah
46 !! endarticle
47
48 !!article
49 Template:Foo
50 !!text
51 FOO
52 !!endarticle
53
54 !! article
55 Template:Blank
56 !! text
57 !! endarticle
58
59 !! article
60 Template:pipe
61 !! text
62 |
63 !! endarticle
64
65 !!article
66 MediaWiki:bad image list
67 !!text
68 * [[File:Bad.jpg]] except [[Nasty page]]
69 !!endarticle
70
71 !! article
72 Template:inner list
73 !! text
74 * item 1
75 !! endarticle
76
77 !! article
78 Template:tbl-start
79 !! text
80 {|
81 !! endarticle
82
83 !! article
84 Template:tbl-end
85 !! text
86 |}
87 !! endarticle
88
89 !! article
90 Template:!
91 !! text
92 |
93 !! endarticle
94
95 !! article
96 Template:echo
97 !! text
98 {{{1}}}
99 !! endarticle
100
101 !! article
102 Template:echo_with_span
103 !! text
104 <span>{{{1}}}</span>
105 !! endarticle
106
107 !! article
108 Template:echo_with_div
109 !! text
110 <div>{{{1}}}</div>
111 !! endarticle
112
113 !! article
114 Template:attr_str
115 !! text
116 {{{1}}}="{{{2}}}"
117 !! endarticle
118
119 !! article
120 Template:table_attribs
121 !! text
122 <noinclude>
123 |</noinclude>style="color: red"| Foo
124 !! endarticle
125
126 !! article
127 Template:table_cells
128 !! text
129 {{table_attribs}} || Bar || Baz
130 !! endarticle
131
132 !! article
133 Template:image_attribs
134 !! text
135 <noinclude>
136 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
137 !! endarticle
138
139 !! article
140 A?b
141 !! text
142 Weirdo titles!
143 !! endarticle
144
145 !!article
146 Template:Bullet
147 !!text
148 * Bar
149 !!endarticle
150
151 !!article
152 Template:OpenTable
153 !!text
154 {|
155 !!endarticle
156
157 ###
158 ### Basic tests
159 ###
160 !! test
161 Blank input
162 !! wikitext
163 !! html
164 !! end
165
166
167 !! test
168 Simple paragraph
169 !! wikitext
170 This is a simple paragraph.
171 !! html
172 <p>This is a simple paragraph.
173 </p>
174 !! end
175
176 !! test
177 Paragraphs with extra newline spacing
178 !! wikitext
179 foo
180
181 bar
182
183
184 baz
185
186
187
188 booz
189 !! html
190 <p>foo
191 </p><p>bar
192 </p><p><br />
193 baz
194 </p><p><br />
195 </p><p>booz
196 </p>
197 !! end
198
199 !! test
200 Paragraphs with newline spacing with comment lines in between
201 !! wikitext
202 ----
203 a
204 <!--foo-->
205 b
206 ----
207 a
208 <!--foo--><!--More than 1 comment, still stripped-->
209 b
210 ----
211 a
212 <!--foo--> <!----> <!-- bar -->
213 b
214 ----
215 a
216 <!--foo-->
217
218 b
219 ----
220 a
221
222 <!--foo-->
223 b
224 ----
225 a
226 <!--foo-->
227
228
229 b
230 ----
231 a
232
233
234 <!--foo-->
235 b
236 ----
237 !! html
238 <hr />
239 <p>a
240 b
241 </p>
242 <hr />
243 <p>a
244 b
245 </p>
246 <hr />
247 <p>a
248 b
249 </p>
250 <hr />
251 <p>a
252 </p><p>b
253 </p>
254 <hr />
255 <p>a
256 </p><p>b
257 </p>
258 <hr />
259 <p>a
260 </p><p><br />
261 b
262 </p>
263 <hr />
264 <p>a
265 </p><p><br />
266 b
267 </p>
268 <hr />
269
270 !! end
271
272 !! test
273 Paragraphs with newline spacing with non-empty white-space lines in between
274 !! wikitext
275 ----
276 a
277
278 b
279 ----
280 a
281
282
283 b
284 ----
285 !! html
286 <hr />
287 <p>a
288 </p><p>b
289 </p>
290 <hr />
291 <p>a
292 </p><p><br />
293 b
294 </p>
295 <hr />
296
297 !! end
298
299 !! test
300 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
301 !! wikitext
302 ----
303 a
304 <!--foo-->
305 b
306 ----
307 a
308 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
309 b
310 ----
311 a
312
313 <!--foo-->
314 <!--bar-->
315 b
316 ----
317 a
318
319 <!--foo-->
320 <!--bar-->
321
322 b
323 ----
324 !! html
325 <hr />
326 <p>a
327 b
328 </p>
329 <hr />
330 <p>a
331 b
332 </p>
333 <hr />
334 <p>a
335 </p><p>b
336 </p>
337 <hr />
338 <p>a
339 </p><p><br />
340 b
341 </p>
342 <hr />
343
344 !! end
345
346 !! test
347 Extra newlines: More paragraphs with indented comment
348 !! wikitext
349 a
350
351 <!--boo-->
352
353 b
354 !! html
355 <p>a
356 </p><p><br />
357 b
358 </p>
359 !!end
360
361 !! test
362 Extra newlines followed by heading
363 !! wikitext
364 a
365
366
367
368 =b=
369 [[a]]
370
371
372 =b=
373 !! html
374 <p>a
375 </p><p><br />
376 </p>
377 <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>
378 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
379 </p><p><br />
380 </p>
381 <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>
382
383 !! end
384
385 !! test
386 Extra newlines between heading and content are swallowed
387 !! wikitext
388 =b=
389
390
391
392 [[a]]
393 !! html
394 <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>
395 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
396 </p>
397 !! end
398
399 !! test
400 Parsing an URL
401 !! wikitext
402 http://fr.wikipedia.org/wiki/🍺
403 <!-- EasterEgg we love beer, better be able be able to link to it -->
404 !! html
405 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
406 </p>
407 !! end
408
409 !! test
410 Simple list
411 !! wikitext
412 * Item 1
413 * Item 2
414 !! html
415 <ul>
416 <li> Item 1
417 </li>
418 <li> Item 2
419 </li>
420 </ul>
421
422 !! end
423
424 !! test
425 Italics and bold
426 !! wikitext
427 * plain
428 * plain''italic''plain
429 * plain''italic''plain''italic''plain
430 * plain'''bold'''plain
431 * plain'''bold'''plain'''bold'''plain
432 * plain''italic''plain'''bold'''plain
433 * plain'''bold'''plain''italic''plain
434 * plain''italic'''bold-italic'''italic''plain
435 * plain'''bold''bold-italic''bold'''plain
436 * plain'''''bold-italic'''italic''plain
437 * plain'''''bold-italic''bold'''plain
438 * plain''italic'''bold-italic'''''plain
439 * plain'''bold''bold-italic'''''plain
440 * plain l'''italic''plain
441 * plain l''''bold''' plain
442 !! html
443 <ul>
444 <li> plain
445 </li>
446 <li> plain<i>italic</i>plain
447 </li>
448 <li> plain<i>italic</i>plain<i>italic</i>plain
449 </li>
450 <li> plain<b>bold</b>plain
451 </li>
452 <li> plain<b>bold</b>plain<b>bold</b>plain
453 </li>
454 <li> plain<i>italic</i>plain<b>bold</b>plain
455 </li>
456 <li> plain<b>bold</b>plain<i>italic</i>plain
457 </li>
458 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
459 </li>
460 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
461 </li>
462 <li> plain<i><b>bold-italic</b>italic</i>plain
463 </li>
464 <li> plain<b><i>bold-italic</i>bold</b>plain
465 </li>
466 <li> plain<i>italic<b>bold-italic</b></i>plain
467 </li>
468 <li> plain<b>bold<i>bold-italic</i></b>plain
469 </li>
470 <li> plain l'<i>italic</i>plain
471 </li>
472 <li> plain l'<b>bold</b> plain
473 </li>
474 </ul>
475
476 !! end
477
478 # this example taken from the [[simple:Moon]] article (bug 47326)
479 !! test
480 Italics and possessives (1)
481 !! wikitext
482 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
483 !! html
484 <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
485 </p>
486 !! end
487
488 # this example taken from [[en:Flaming Pie]] (bug 49926)
489 !! test
490 Italics and possessives (2)
491 !! wikitext
492 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
493 !! html
494 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
495 </p>
496 !! end
497
498 # this example taken from [[en:Dictionary]] (bug 49926)
499 !! test
500 Italics and possessives (3)
501 !! wikitext
502 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''.
503 !! html
504 <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>.
505 </p>
506 !! end
507
508
509 ###
510 ### 2-quote opening sequence tests
511 ###
512 !! test
513 Italics and bold: 2-quote opening sequence: (2,2)
514 !! wikitext
515 ''foo''
516 !! html
517 <p><i>foo</i>
518 </p>
519 !!end
520
521
522 !! test
523 Italics and bold: 2-quote opening sequence: (2,3)
524 !! wikitext
525 ''foo'''
526 !! html
527 <p><i>foo'</i>
528 </p>
529 !!end
530
531
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4)
534 !! wikitext
535 ''foo''''
536 !! html
537 <p><i>foo''</i>
538 </p>
539 !!end
540
541
542 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
543 !! test
544 Italics and bold: 2-quote opening sequence: (2,5)
545 !! wikitext
546 ''foo'''''
547 !! html/php
548 <p><i>foo</i>
549 </p>
550 !! html/parsoid
551 <p><i>foo</i><b></b>
552 </p>
553 !!end
554
555
556 ###
557 ### 3-quote opening sequence tests
558 ###
559
560 !! test
561 Italics and bold: 3-quote opening sequence: (3,2)
562 !! wikitext
563 '''foo''
564 !! html
565 <p>'<i>foo</i>
566 </p>
567 !!end
568
569
570 !! test
571 Italics and bold: 3-quote opening sequence: (3,3)
572 !! wikitext
573 '''foo'''
574 !! html
575 <p><b>foo</b>
576 </p>
577 !!end
578
579
580 !! test
581 Italics and bold: 3-quote opening sequence: (3,4)
582 !! wikitext
583 '''foo''''
584 !! html
585 <p><b>foo'</b>
586 </p>
587 !!end
588
589
590 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
591 !! test
592 Italics and bold: 3-quote opening sequence: (3,5)
593 !! wikitext
594 '''foo'''''
595 !! html/php
596 <p><b>foo</b>
597 </p>
598 !! html/parsoid
599 <p><b>foo</b><i></i>
600 </p>
601 !!end
602
603
604 ###
605 ### 4-quote opening sequence tests
606 ###
607
608 !! test
609 Italics and bold: 4-quote opening sequence: (4,2)
610 !! wikitext
611 ''''foo''
612 !! html
613 <p>''<i>foo</i>
614 </p>
615 !!end
616
617
618 !! test
619 Italics and bold: 4-quote opening sequence: (4,3)
620 !! wikitext
621 ''''foo'''
622 !! html
623 <p>'<b>foo</b>
624 </p>
625 !!end
626
627
628 !! test
629 Italics and bold: 4-quote opening sequence: (4,4)
630 !! wikitext
631 ''''foo''''
632 !! html
633 <p>'<b>foo'</b>
634 </p>
635 !!end
636
637
638 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
639 !! test
640 Italics and bold: 4-quote opening sequence: (4,5)
641 !! wikitext
642 ''''foo'''''
643 !! html/php
644 <p>'<b>foo</b>
645 </p>
646 !! html/parsoid
647 <p>'<b>foo</b><i></i>
648 </p>
649 !!end
650
651
652 ###
653 ### 5-quote opening sequence tests
654 ###
655
656 !! test
657 Italics and bold: 5-quote opening sequence: (5,2)
658 !! options
659 !! wikitext
660 '''''foo''
661 !! html
662 <p><b><i>foo</i></b>
663 </p>
664 !!end
665
666
667 !! test
668 Italics and bold: 5-quote opening sequence: (5,3)
669 !! wikitext
670 '''''foo'''
671 !! html
672 <p><i><b>foo</b></i>
673 </p>
674 !!end
675
676
677 !! test
678 Italics and bold: 5-quote opening sequence: (5,4)
679 !! wikitext
680 '''''foo''''
681 !! html
682 <p><i><b>foo'</b></i>
683 </p>
684 !!end
685
686
687 !! test
688 Italics and bold: 5-quote opening sequence: (5,5)
689 !! wikitext
690 '''''foo'''''
691 !! html
692 <p><i><b>foo</b></i>
693 </p>
694 !!end
695
696 ###
697 ### multiple quote sequences in a line
698 ###
699 !! test
700 Italics and bold: multiple quote sequences: (2,4,2)
701 !! wikitext
702 ''foo''''bar''
703 !! html
704 <p><i>foo'<b>bar</b></i>
705 </p>
706 !!end
707
708
709 !! test
710 Italics and bold: multiple quote sequences: (2,4,3)
711 !! wikitext
712 ''foo''''bar'''
713 !! html
714 <p><i>foo'<b>bar</b></i>
715 </p>
716 !!end
717
718
719 !! test
720 Italics and bold: multiple quote sequences: (2,4,4)
721 !! wikitext
722 ''foo''''bar''''
723 !! html
724 <p><i>foo'<b>bar'</b></i>
725 </p>
726 !!end
727
728
729 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
730 !! test
731 Italics and bold: multiple quote sequences: (3,4,2)
732 !! wikitext
733 '''foo''''bar''
734 !! html/php
735 <p><b>foo'</b>bar
736 </p>
737 !! html/parsoid
738 <p><b>foo'</b>bar<i></i>
739 </p>
740 !!end
741
742
743 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
744 !! test
745 Italics and bold: multiple quote sequences: (3,4,3)
746 !! wikitext
747 '''foo''''bar'''
748 !! html/php
749 <p><b>foo'</b>bar
750 </p>
751 !! html/parsoid
752 <p><b>foo'</b>bar<b></b>
753 </p>
754 !!end
755
756 ###
757 ### other quote tests
758 ###
759 !! test
760 Italics and bold: other quote tests: (2,3,5)
761 !! wikitext
762 ''this is about '''foo's family'''''
763 !! html
764 <p><i>this is about <b>foo's family</b></i>
765 </p>
766 !!end
767
768
769 !! test
770 Italics and bold: other quote tests: (2,(3,3),2)
771 !! wikitext
772 ''this is about '''foo's''' family''
773 !! html
774 <p><i>this is about <b>foo's</b> family</i>
775 </p>
776 !!end
777
778
779 !! test
780 Italics and bold: other quote tests: (3,2,3,2)
781 !! wikitext
782 '''this is about ''foo'''s family''
783 !! html
784 <p><b>this is about <i>foo</i></b><i>s family</i>
785 </p>
786 !!end
787
788
789 !! test
790 Italics and bold: other quote tests: (3,2,3,3)
791 !! options
792 !! wikitext
793 '''this is about ''foo'''s family'''
794 !! html
795 <p>'<i>this is about </i>foo<b>s family</b>
796 </p>
797 !!end
798
799
800 !! test
801 Italics and bold: other quote tests: (3,(2,2),3)
802 !! wikitext
803 '''this is about ''foo's'' family'''
804 !! html
805 <p><b>this is about <i>foo's</i> family</b>
806 </p>
807 !!end
808
809
810 !! test
811 Italicized possessive
812 !! wikitext
813 The ''[[Main Page]]'''s talk page.
814 !! html
815 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
816 </p>
817 !! end
818
819 !! test
820 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
821 (Requires tidy for PHP parser output to be fixed up)
822 !! options
823 parsoid=wt2html,wt2wt
824 !! wikitext
825 {|
826 !''a!!''b
827 |''a||''b
828 |}
829 !! html
830 <table>
831 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
832 <td><i>a</i></td><td><i>b</i></td></tr>
833 </tbody></table>
834 !! end
835
836 ###
837 ### Non-html5 tags
838 ###
839
840 !! test
841 Non-html5 tags should be accepted
842 !! wikitext
843 <center>''foo''</center>
844 <big>''foo''</big>
845 <font>''foo''</font>
846 <strike>''foo''</strike>
847 <tt>''foo''</tt>
848 !! html
849 <center><i>foo</i></center>
850 <p><big><i>foo</i></big>
851 <font><i>foo</i></font>
852 <strike><i>foo</i></strike>
853 <tt><i>foo</i></tt>
854 </p>
855 !! end
856
857 !! test
858 <wbr> is valid wikitext (bug 52468)
859 !! wikitext
860 <wbr>
861 !! html
862 <p><wbr />
863 </p>
864 !! end
865
866 # <strike> is HTML4, <s> is HTML4/5.
867 !! test
868 <s> or <strike> for strikethrough
869 !! wikitext
870 <strike>strike</strike>
871
872 <s>s</s>
873 !! html
874 <p><strike>strike</strike>
875 </p><p><s>s</s>
876 </p>
877 !! end
878
879 !! test
880 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
881 !! wikitext
882 <b→> doesn't work! </b→>
883
884 <bä> doesn't work! </bä>
885
886 <boo> works fine </boo>
887
888 <s.foo>s.foo</s.foo>
889
890 <sub-ID#1>
891 !! html
892 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
893 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
894 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
895 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
896 </p><p>&lt;sub-ID#1&gt;
897 </p>
898 !! end
899
900 !! test
901 Isolated close tags should be treated as literal text (bug 52760)
902 !! wikitext
903 </b>
904
905 <s.foo>s</s>
906 !! html
907 <p>&lt;/b&gt;
908 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
909 </p>
910 !! end
911
912 ###
913 ### Special characters
914 ###
915
916 !! test
917 Bare pipe character (bug 52363)
918 !! wikitext
919 |
920 !! html
921 <p>|
922 </p>
923 !! end
924
925 !! test
926 Bare pipe character from a template (bug 52363)
927 !! wikitext
928 {{pipe}}
929 !! html
930 <p>|
931 </p>
932 !! end
933
934 ###
935 ### <nowiki> test cases
936 ###
937
938 !! test
939 <nowiki> unordered list
940 !! wikitext
941 <nowiki>* This is not an unordered list item.</nowiki>
942 !! html
943 <p>* This is not an unordered list item.
944 </p>
945 !! end
946
947 !! test
948 <nowiki> spacing
949 !! wikitext
950 <nowiki>Lorem ipsum dolor
951
952 sed abit.
953 sed nullum.
954
955 :and a colon
956 </nowiki>
957 !! html
958 <p>Lorem ipsum dolor
959
960 sed abit.
961 sed nullum.
962
963 :and a colon
964
965 </p>
966 !! end
967
968 !! test
969 nowiki 3
970 !! wikitext
971 :There is not nowiki.
972 :There is <nowiki>nowiki</nowiki>.
973
974 #There is not nowiki.
975 #There is <nowiki>nowiki</nowiki>.
976
977 *There is not nowiki.
978 *There is <nowiki>nowiki</nowiki>.
979 !! html
980 <dl>
981 <dd>There is not nowiki.
982 </dd>
983 <dd>There is nowiki.
984 </dd>
985 </dl>
986 <ol>
987 <li>There is not nowiki.
988 </li>
989 <li>There is nowiki.
990 </li>
991 </ol>
992 <ul>
993 <li>There is not nowiki.
994 </li>
995 <li>There is nowiki.
996 </li>
997 </ul>
998
999 !! end
1000
1001 !! test
1002 Entities inside <nowiki>
1003 !! wikitext
1004 <nowiki>&lt;</nowiki>
1005 !! html
1006 <p>&lt;
1007 </p>
1008 !! end
1009
1010 !! test
1011 Entities inside template parameters
1012 !! options
1013 parsoid
1014 !! wikitext
1015 {{echo|&ndash;}}
1016 !! html
1017 <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>
1018 </p>
1019 !! end
1020
1021 ###
1022 ### Comments
1023 ###
1024 !! test
1025 Comments and Indent-Pre
1026 !! wikitext
1027 <!-- comment 1 --> asdf
1028
1029 <!-- comment 1 --> asdf
1030 <!-- comment 2 -->
1031
1032 <!-- comment 1 --> asdf
1033 <!-- comment 2 -->xyz
1034
1035 <!-- comment 1 --> asdf
1036 <!-- comment 2 --> xyz
1037 !! html
1038 <pre>asdf
1039 </pre>
1040 <pre>asdf
1041 </pre>
1042 <pre>asdf
1043 </pre>
1044 <p>xyz
1045 </p>
1046 <pre>asdf
1047 xyz
1048 </pre>
1049 !! end
1050
1051 !! test
1052 Comment test 2a
1053 !! wikitext
1054 asdf
1055 <!-- comment 1 -->
1056 jkl
1057 !! html
1058 <p>asdf
1059 jkl
1060 </p>
1061 !! end
1062
1063 !! test
1064 Comment test 2b
1065 !! wikitext
1066 asdf
1067 <!-- comment 1 -->
1068
1069 jkl
1070 !! html
1071 <p>asdf
1072 </p><p>jkl
1073 </p>
1074 !! end
1075
1076 !! test
1077 Comment test 3
1078 !! wikitext
1079 asdf
1080 <!-- comment 1 -->
1081 <!-- comment 2 -->
1082 jkl
1083 !! html
1084 <p>asdf
1085 jkl
1086 </p>
1087 !! end
1088
1089 !! test
1090 Comment test 4
1091 !! wikitext
1092 asdf<!-- comment 1 -->jkl
1093 !! html
1094 <p>asdfjkl
1095 </p>
1096 !! end
1097
1098 !! test
1099 Comment spacing
1100 !! wikitext
1101 a
1102 <!-- foo --> b <!-- bar -->
1103 c
1104 !! html
1105 <p>a
1106 </p>
1107 <pre> b
1108 </pre>
1109 <p>c
1110 </p>
1111 !! end
1112
1113 !! test
1114 Comment whitespace
1115 !! wikitext
1116 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1117 !! html
1118
1119 !! end
1120
1121 !! test
1122 Comment semantics and delimiters
1123 !! wikitext
1124 <!-- --><!----><!-----><!------>
1125 !! html
1126
1127 !! end
1128
1129 !! test
1130 Comment semantics and delimiters, redux
1131 !! wikitext
1132 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1133 -- foo -- funky huh? ... -->
1134 !! html
1135
1136 !! end
1137
1138 !! test
1139 Comment semantics and delimiters: directors cut
1140 !! wikitext
1141 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1142 everything starting with < followed by !-- until the first -- and > we see,
1143 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1144 -->-->
1145 !! html
1146 <p>--&gt;
1147 </p>
1148 !! end
1149
1150 !! test
1151 Comment semantics: nesting
1152 !! wikitext
1153 <!--<!-- no, we're not going to do anything fancy here -->-->
1154 !! html
1155 <p>--&gt;
1156 </p>
1157 !! end
1158
1159 !! test
1160 Comment semantics: unclosed comment at end
1161 !! wikitext
1162 <!--This comment will run out to the end of the document
1163 !! html
1164
1165 !! end
1166
1167 !! test
1168 Comment in template title
1169 !! wikitext
1170 {{f<!---->oo}}
1171 !! html
1172 <p>FOO
1173 </p>
1174 !! end
1175
1176 !! test
1177 Comment on its own line post-expand
1178 !! wikitext
1179 a
1180 {{blank}}<!---->
1181 b
1182 !! html
1183 <p>a
1184 </p><p>b
1185 </p>
1186 !! end
1187
1188 !! test
1189 Comment on its own line post-expand with non-significant whitespace
1190 !! wikitext
1191 a
1192 {{blank}} <!---->
1193 b
1194 !! html
1195 <p>a
1196 </p><p>b
1197 </p>
1198 !! end
1199
1200 ###
1201 ### paragraph wrapping tests
1202 ###
1203 !! test
1204 No block tags
1205 !! wikitext
1206 a
1207
1208 b
1209 !! html
1210 <p>a
1211 </p><p>b
1212 </p>
1213 !! end
1214
1215 !! test
1216 Block tag on one line (<div>)
1217 !! wikitext
1218 a <div>foo</div>
1219
1220 b
1221 !! html
1222 a <div>foo</div>
1223 <p>b
1224 </p>
1225 !! end
1226
1227 !! test
1228 Block tag on one line (<blockquote>)
1229 !! wikitext
1230 a <blockquote>foo</blockquote>
1231
1232 b
1233 !! html
1234 a <blockquote>foo</blockquote>
1235 <p>b
1236 </p>
1237 !! end
1238
1239 !! test
1240 Block tag on both lines (<div>)
1241 !! wikitext
1242 a <div>foo</div>
1243
1244 b <div>foo</div>
1245 !! html
1246 a <div>foo</div>
1247 b <div>foo</div>
1248
1249 !! end
1250
1251 !! test
1252 Block tag on both lines (<blockquote>)
1253 !! wikitext
1254 a <blockquote>foo</blockquote>
1255
1256 b <blockquote>foo</blockquote>
1257 !! html
1258 a <blockquote>foo</blockquote>
1259 b <blockquote>foo</blockquote>
1260
1261 !! end
1262
1263 !! test
1264 Multiple lines without block tags
1265 !! wikitext
1266 <div>foo</div> a
1267 b
1268 c
1269 d<!--foo--> e
1270 x <div>foo</div> z
1271 !! html
1272 <div>foo</div> a
1273 <p>b
1274 c
1275 d e
1276 </p>
1277 x <div>foo</div> z
1278
1279 !! end
1280
1281 !! test
1282 Empty lines between lines with block tags
1283 !! wikitext
1284 <div></div>
1285
1286
1287 <div></div>a
1288
1289 b
1290 <div>a</div>b
1291
1292 <div>b</div>d
1293
1294
1295 <div>e</div>
1296 !! html
1297 <div></div>
1298 <p><br />
1299 </p>
1300 <div></div>a
1301 <p>b
1302 </p>
1303 <div>a</div>b
1304 <div>b</div>d
1305 <p><br />
1306 </p>
1307 <div>e</div>
1308
1309 !! end
1310
1311 ## PHP parser emits output which is broken
1312 !! test
1313 Unclosed HTML p-tags should be handled properly
1314 !! wikitext
1315 <div><p>foo</div>
1316 a
1317
1318 b
1319 !! html/parsoid
1320 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1321 <p>a</p>
1322 <p>b</p>
1323 !! end
1324
1325 ###
1326 ### Preformatted text
1327 ###
1328 !! test
1329 Preformatted text
1330 !! wikitext
1331 This is some
1332 Preformatted text
1333 With ''italic''
1334 And '''bold'''
1335 And a [[Main Page|link]]
1336 !! html
1337 <pre>This is some
1338 Preformatted text
1339 With <i>italic</i>
1340 And <b>bold</b>
1341 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1342 </pre>
1343 !! end
1344
1345 !! test
1346 Tabs don't trigger preformatted text
1347 !! wikitext
1348 This is not
1349 preformatted text.
1350 This is preformatted text.
1351 So is this.
1352 !! html
1353 <p> This is not
1354 preformatted text.
1355 </p>
1356 <pre>This is preformatted text.
1357 So is this.
1358 </pre>
1359 !! end
1360
1361 !! test
1362 Ident preformatting with inline content
1363 !! wikitext
1364 a
1365 ''b''
1366 !! html
1367 <pre>a
1368 <i>b</i>
1369 </pre>
1370 !! end
1371
1372 !! test
1373 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1374 !! wikitext
1375 <pre><nowiki>
1376 <b>
1377 <cite>
1378 <em>
1379 </nowiki></pre>
1380 !! html
1381 <pre>
1382 &lt;b&gt;
1383 &lt;cite&gt;
1384 &lt;em&gt;
1385 </pre>
1386
1387 !! end
1388
1389 !! test
1390 Regression with preformatted in <center>
1391 !! wikitext
1392 <center>
1393 Blah
1394 </center>
1395 !! html
1396 <center>
1397 <pre>Blah
1398 </pre>
1399 </center>
1400
1401 !! end
1402
1403 !! test
1404 Bug 52763: Preformatted in <blockquote>
1405 !! wikitext
1406 <blockquote>
1407 Blah
1408 {|
1409 |
1410 indented cell (no pre-wrapping!)
1411 |}
1412 </blockquote>
1413 !! html
1414 <blockquote>
1415 <p> Blah
1416 </p>
1417 <table>
1418 <tr>
1419 <td>
1420 <p> indented cell (no pre-wrapping!)
1421 </p>
1422 </td></tr></table>
1423 </blockquote>
1424
1425 !! end
1426
1427 !! test
1428 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1429 !! wikitext
1430 <blockquote>
1431 Foo
1432
1433 Bar
1434 </blockquote>
1435 !! html
1436 <blockquote>
1437 <p>Foo
1438 </p><p>Bar
1439 </p>
1440 </blockquote>
1441
1442 !! end
1443
1444 !! test
1445 Bug 15491: <ins>/<del> in blockquote
1446 !! wikitext
1447 <blockquote>
1448 Foo <del>bar</del> <ins>baz</ins> quux
1449 </blockquote>
1450 !! html
1451 <blockquote>
1452 <p>Foo <del>bar</del> <ins>baz</ins> quux
1453 </p>
1454 </blockquote>
1455
1456 !! end
1457
1458 # Note that the p-wrapping is newline sensitive, which could be
1459 # considered a bug: tidy will wrap only the 'Foo' in the example
1460 # below in a <p> tag. (see comment 23-25 of bug #6200)
1461 !! test
1462 Bug 15491: <ins>/<del> in blockquote (2)
1463 !! wikitext
1464 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1465 </blockquote>
1466 !! html
1467 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1468 </blockquote>
1469
1470 !! end
1471
1472 !! test
1473 <pre> with attributes (bug 3202)
1474 !! wikitext
1475 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1476 !! html
1477 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1478
1479 !! end
1480
1481 !! test
1482 <pre> with width attribute (bug 3202)
1483 !! wikitext
1484 <pre width="8">Narrow screen goodies</pre>
1485 !! html
1486 <pre width="8">Narrow screen goodies</pre>
1487
1488 !! end
1489
1490 !! test
1491 <pre> with forbidden attribute (bug 3202)
1492 !! wikitext
1493 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1494 !! html
1495 <pre width="8">Narrow screen goodies</pre>
1496
1497 !! end
1498
1499 !! test
1500 Entities inside <pre>
1501 !! wikitext
1502 <pre>&lt;</pre>
1503 !! html
1504 <pre>&lt;</pre>
1505
1506 !! end
1507
1508 !! test
1509 <pre> with forbidden attribute values (bug 3202)
1510 !! wikitext
1511 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1512 !! html
1513 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1514
1515 !! end
1516
1517 !! test
1518 <nowiki> inside <pre> (bug 13238)
1519 !! wikitext
1520 <pre>
1521 <nowiki>
1522 </pre>
1523 <pre>
1524 <nowiki></nowiki>
1525 </pre>
1526 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1527 !! html
1528 <pre>
1529 &lt;nowiki&gt;
1530 </pre>
1531 <pre>
1532
1533 </pre>
1534 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1535
1536 !! end
1537
1538 !! test
1539 <nowiki> and <pre> preference (first one wins)
1540 !! wikitext
1541 <pre>
1542 <nowiki>
1543 </pre>
1544 </nowiki>
1545 </pre>
1546
1547 <nowiki>
1548 <pre>
1549 <nowiki>
1550 </pre>
1551 </nowiki>
1552 </pre>
1553
1554 !! html
1555 <pre>
1556 &lt;nowiki&gt;
1557 </pre>
1558 <p>&lt;/nowiki&gt;
1559 &lt;/pre&gt;
1560 </p><p>
1561 &lt;pre&gt;
1562 &lt;nowiki&gt;
1563 &lt;/pre&gt;
1564
1565 &lt;/pre&gt;
1566 </p>
1567 !! end
1568
1569 !! test
1570 </pre> inside nowiki
1571 !! wikitext
1572 <nowiki></pre></nowiki>
1573 !! html
1574 <p>&lt;/pre&gt;
1575 </p>
1576 !! end
1577
1578 !! test
1579 Empty pre; pre inside other HTML tags (bug 54946)
1580 !! wikitext
1581 a
1582
1583 <div><pre>
1584 foo
1585 </pre></div>
1586 <pre></pre>
1587 !! html
1588 <p>a
1589 </p>
1590 <div><pre>
1591 foo
1592 </pre></div>
1593 <pre></pre>
1594
1595 !! end
1596
1597 !! test
1598 HTML pre followed by indent-pre
1599 !! wikitext
1600 <pre>foo</pre>
1601 bar
1602 !! html
1603 <pre>foo</pre>
1604 <pre>bar
1605 </pre>
1606 !! end
1607
1608 !!test
1609 Block tag pre
1610 !!options
1611 parsoid
1612 !! wikitext
1613 <p><pre>foo</pre></p>
1614 !! html
1615 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1616 !!end
1617
1618 !!test
1619 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1620 !! wikitext
1621 {{echo|}}
1622 !! html
1623
1624 !!end
1625
1626 !!test
1627 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1628 !! wikitext
1629 {{echo|
1630 foo}}
1631 !! html
1632 <p>foo
1633 </p>
1634 !!end
1635
1636 !! test
1637 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1638 !! wikitext
1639 {{echo|a
1640 b}}
1641 !! html
1642 <pre>a
1643 </pre>
1644 <p>b
1645 </p>
1646 !!end
1647
1648 !! test
1649 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1650 !! wikitext
1651 {{echo|a
1652 b
1653 c
1654 d
1655 e
1656 }}
1657 !! html
1658 <pre>a
1659 </pre>
1660 <p>b
1661 c
1662 </p>
1663 <pre>d
1664 </pre>
1665 <p>e
1666 </p>
1667 !!end
1668
1669 !!test
1670 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1671 !! wikitext
1672 {{echo| foo}}
1673
1674 {{echo| foo}}{{echo| bar}}
1675
1676 {{echo| foo}}
1677 {{echo| bar}}
1678
1679 {{echo|<!--cmt--> foo}}
1680
1681 <!--cmt-->{{echo| foo}}
1682
1683 {{echo|{{echo| }}bar}}
1684 !! html
1685 <pre>foo
1686 </pre>
1687 <pre>foo bar
1688 </pre>
1689 <pre>foo
1690 bar
1691 </pre>
1692 <pre>foo
1693 </pre>
1694 <pre>foo
1695 </pre>
1696 <pre>bar
1697 </pre>
1698 !!end
1699
1700 !! test
1701 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1702 !! wikitext
1703 {{echo| }}a
1704
1705 {{echo|
1706 }}a
1707
1708 {{echo|
1709 b}}
1710
1711 {{echo|a
1712 }}b
1713
1714 {{echo|a
1715 }} b
1716 !! html
1717 <pre>a
1718 </pre>
1719 <p><br />
1720 </p>
1721 <pre>a
1722 </pre>
1723 <p><br />
1724 </p>
1725 <pre>b
1726 </pre>
1727 <p>a
1728 </p>
1729 <pre>b
1730 </pre>
1731 <p>a
1732 </p>
1733 <pre>b
1734 </pre>
1735 !!end
1736
1737 !! test
1738 Things that look like <pre> tags aren't treated as such
1739 !! wikitext
1740 Barack Obama <President> of the United States
1741 !! html
1742 <p>Barack Obama &lt;President&gt; of the United States
1743 </p>
1744 !! end
1745
1746 !! test
1747 Parsoid: handle pre with space after attribute
1748 !! options
1749 parsoid=wt2html
1750 !! wikitext
1751 <pre style="width:50%;" >{{echo|foo}}</pre>
1752 !! html
1753 <pre style="width:50%;">{{echo|foo}}</pre>
1754 !! end
1755
1756 # TODO / maybe: fix wt2wt for this
1757 !! test
1758 Parsoid: Don't paragraph-wrap fosterable content
1759 !! options
1760 parsoid=wt2html
1761 !! wikitext
1762 {|
1763 <td></td>
1764 <td></td>
1765
1766
1767
1768 |}
1769 !! html
1770 <table>
1771
1772 <tbody>
1773 <tr>
1774 <td></td>
1775
1776 <td></td></tr>
1777
1778
1779
1780 </tbody></table>
1781 !! end
1782
1783 !! test
1784 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1785 !! options
1786 parsoid=wt2html
1787 !! wikitext
1788 {|
1789 <td>
1790 <td>
1791 </td>
1792
1793
1794
1795 |}
1796 !! html
1797 <table>
1798
1799 <tbody>
1800 <tr>
1801 <td></td>
1802
1803 <td>
1804 </td></tr>
1805
1806
1807
1808 </tbody></table>
1809 !! end
1810
1811
1812 #--------------------------------------------------------------------
1813 # Transclusion parameter whitespace stripping tests
1814 # Behavior is different for positional and named parameters
1815 #--------------------------------------------------------------------
1816 !! test
1817 Templates: Strip leading and trailing whitespace from named-param values
1818 !! wikitext
1819 {{echo|1= a }}
1820
1821 {{echo|1= {{echo|b}} }}
1822
1823 {{echo| 1 =
1824 c }}
1825
1826 {{echo| 1 =
1827 * d
1828 }}
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p><p>c
1833 </p>
1834 <ul>
1835 <li> d
1836 </li>
1837 </ul>
1838
1839 !! end
1840
1841 !! test
1842 Templates: Don't strip whitespace from positional-param values
1843 !! wikitext
1844 {{echo|a }}
1845
1846 {{echo|{{echo|b}} }}
1847
1848 {{echo| c
1849 }}
1850
1851 {{echo| {{echo|d}}
1852 }}
1853
1854 {{echo|
1855 e}}
1856
1857 {{echo|
1858 * f}}
1859
1860 {{echo|
1861 }}g
1862 !! html
1863 <p>a
1864 </p><p>b
1865 </p>
1866 <pre>c
1867 </pre>
1868 <p><br />
1869 </p>
1870 <pre>d
1871 </pre>
1872 <p><br />
1873 </p>
1874 <pre>e
1875 </pre>
1876 <p><br />
1877 </p>
1878 <ul>
1879 <li> f
1880 </li>
1881 </ul>
1882 <p><br />
1883 </p>
1884 <pre>g
1885 </pre>
1886 !! end
1887
1888 !! test
1889 Templates: Handle empty comment-and-ws-only lines correctly
1890 !! wikitext
1891 {{echo|foo
1892 <!--should be ignored-->
1893 <!--should be ignored as well-->
1894 bar}}
1895 !! html
1896 <p>foo
1897 bar
1898 </p>
1899 !! end
1900
1901 #--------------------------------------------------------------------
1902 # Transclusion parameter escaping tests
1903 #--------------------------------------------------------------------
1904 !! test
1905 Templates: Parsoid parameter escaping test 1
1906 !! options
1907 parsoid
1908 !! wikitext
1909 {{echo|[foo]|{{echo|[bar]}}}}
1910 !! html
1911 <p about="#mwt1" typeof="mw:Transclusion"
1912 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1913 !! end
1914
1915 !! test
1916 Parsoid: Pipes in external links in template parameter
1917 !! options
1918 parsoid
1919 !! wikitext
1920 {{echo|[{{echo|http://example.com}} link]}}
1921 !! html
1922 <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>
1923 !! end
1924
1925 !! test
1926 Parsoid: pipe in transclusion parameter
1927 !! options
1928 parsoid
1929 !! wikitext
1930 {{echo|http://foo.com/a&#124;b}}
1931 !! html
1932 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1933 typeof="mw:Transclusion"
1934 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>
1935 !! end
1936
1937 !! test
1938 Parsoid: Pipe in external link target and content in template parameter
1939 !! options
1940 parsoid=html2wt,wt2wt
1941 !! wikitext
1942 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1943 !! html
1944 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1945 typeof="mw:Transclusion"
1946 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1947 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1948 !! end
1949
1950 !! test
1951 Templates: Don't escape already nowiki-escaped text in template parameters
1952 !! options
1953 parsoid=html2wt,wt2wt
1954 !! wikitext
1955 {{echo|foo<nowiki>|</nowiki>bar}}
1956 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1957 {{echo|<nowiki></nowiki>}}
1958 !! html
1959 <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>
1960 <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>
1961 <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>
1962 </p>
1963 !! end
1964
1965 ## Bug 52824
1966 !! test
1967 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1968 !! options
1969 parsoid=html2wt,wt2wt
1970 !! wikitext
1971 {{echo|{{echo|1=bar}}}}
1972 !! html
1973 <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>
1974 !! end
1975
1976 ## Bug 56733
1977 !! test
1978 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
1979 !! options
1980 parsoid
1981 !! wikitext
1982 {{echo|a : b}}
1983 !! html
1984 <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>
1985 !! end
1986
1987 ###
1988 ### Parsoid-centric tests for testing RT edge cases for pre
1989 ###
1990
1991 !!test
1992 1a. Indent-Pre and Comments
1993 !! wikitext
1994 a
1995 <!--a-->
1996 c
1997 !! html
1998 <pre>a
1999 </pre>
2000 <p>c
2001 </p>
2002 !!end
2003
2004 !!test
2005 1b. Indent-Pre and Comments
2006 !! wikitext
2007 a
2008 <!--a-->
2009 c
2010 !! html
2011 <pre>a
2012 </pre>
2013 <p>c
2014 </p>
2015 !!end
2016
2017 !!test
2018 1c. Indent-Pre and Comments
2019 !! wikitext
2020 <!--a--> a
2021
2022 <!--a--> a
2023 !! html
2024 <pre> a
2025 </pre>
2026 <pre> a
2027 </pre>
2028 !!end
2029
2030 !!test
2031 1d. Indent-Pre and Comments
2032 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2033 !! wikitext
2034 <!--a--> a
2035
2036 <!--b-->b
2037 !! html
2038 <pre>a
2039 </pre>
2040 <pre>b
2041 </pre>
2042 !!end
2043
2044 !!test
2045 2a. Indent-Pre and tables
2046 !! wikitext
2047 {|
2048 |-
2049 !h1!!h2
2050 |foo||bar
2051 |}
2052 !! html
2053 <table>
2054
2055 <tr>
2056 <th>h1</th>
2057 <th>h2
2058 </th>
2059 <td>foo</td>
2060 <td>bar
2061 </td></tr></table>
2062
2063 !!end
2064
2065 !!test
2066 2b. Indent-Pre and tables
2067 !! wikitext
2068 {|
2069 |-
2070 |foo
2071 |}
2072 !! html
2073 <table>
2074
2075 <tr>
2076 <td>foo
2077 </td></tr></table>
2078
2079 !!end
2080
2081 !!test
2082 2c. Indent-Pre and tables (bug 42252)
2083 !! wikitext
2084 {|
2085 |+ foo
2086 ! | bar
2087 |}
2088 !! html
2089 <table>
2090 <caption> foo
2091 </caption>
2092 <tr>
2093 <th> bar
2094 </th></tr></table>
2095
2096 !!end
2097
2098 !!test
2099 3a. Indent-Pre and block tags (single-line html)
2100 !! wikitext
2101 a <p> foo </p>
2102 b <div> foo </div>
2103 c <blockquote> foo </blockquote>
2104 <span> foo </span>
2105 !! html
2106 a <p> foo </p>
2107 b <div> foo </div>
2108 c <blockquote> foo </blockquote>
2109 <pre><span> foo </span>
2110 </pre>
2111 !!end
2112
2113 !!test
2114 3b. Indent-Pre and block tags (multi-line html)
2115 !! wikitext
2116 a <span>foo</span>
2117 b <div> foo </div>
2118 !! html
2119 <pre>a <span>foo</span>
2120 </pre>
2121 b <div> foo </div>
2122
2123 !!end
2124
2125 !!test
2126 3c. Indent-Pre and block tags (pre-content on separate line)
2127 !! wikitext
2128 <p>
2129 foo
2130 </p>
2131
2132 <div>
2133 foo
2134 </div>
2135
2136 <center>
2137 foo
2138 </center>
2139
2140 <blockquote>
2141 foo
2142 </blockquote>
2143
2144 <blockquote>
2145 <pre>
2146 foo
2147 </pre>
2148 </blockquote>
2149
2150 <table><tr><td>
2151 foo
2152 </td></tr></table>
2153
2154 <ul><li>
2155 foo
2156 </li></ul>
2157
2158 !! html
2159 <p>
2160 foo
2161 </p>
2162 <div>
2163 <pre>foo
2164 </pre>
2165 </div>
2166 <center>
2167 <pre>foo
2168 </pre>
2169 </center>
2170 <blockquote>
2171 <p> foo
2172 </p>
2173 </blockquote>
2174 <blockquote>
2175 <pre>
2176 foo
2177 </pre>
2178 </blockquote>
2179 <table><tr><td>
2180 <pre>foo
2181 </pre>
2182 </td></tr></table>
2183 <ul><li>
2184 foo
2185 </li></ul>
2186
2187 !!end
2188
2189 !!test
2190 4. Indent-Pre and extension tags
2191 !! wikitext
2192 a <gallery>
2193 File:foobar.jpg
2194 </gallery>
2195 !! html
2196 a <ul class="gallery mw-gallery-traditional">
2197 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2198 <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" /></a></div></div>
2199 <div class="gallerytext">
2200 </div>
2201 </div></li>
2202 </ul>
2203
2204 !!end
2205
2206 !! test
2207 Leading pipes outside of tables
2208 !! options
2209 parsoid
2210 !! wikitext
2211 | foo
2212 !! html
2213 <p>| foo</p>
2214 !! end
2215
2216 !! test
2217 Leading pipes outside of tables 2
2218 !! options
2219 parsoid
2220 !! wikitext
2221 a
2222 | foo
2223 b
2224 !! html
2225 <p>a
2226 | foo
2227 b</p>
2228 !! end
2229
2230 !! test
2231 Leading pipes outside of tables 3
2232 !! options
2233 parsoid
2234 !! wikitext
2235 a
2236 | class="foo bar" | baz
2237 b
2238 !! html
2239 <p>a
2240 | class="foo bar" | baz
2241 b</p>
2242 !! end
2243
2244 !!test
2245 Render paragraphs when indent-pre is suppressed in blocklevels
2246 !! wikitext
2247 <blockquote>
2248 foo
2249
2250 bar
2251 </blockquote>
2252 !! html
2253 <blockquote>
2254 <p> foo
2255 </p><p> bar
2256 </p>
2257 </blockquote>
2258
2259 !!end
2260
2261 !!test
2262 4. Multiple spaces at start-of-line
2263 !! wikitext
2264 <p> foo </p>
2265 foo
2266 {|
2267 |foo
2268 |}
2269 !! html
2270 <p> foo </p>
2271 <pre> foo
2272 </pre>
2273 <table>
2274 <tr>
2275 <td>foo
2276 </td></tr></table>
2277
2278 !!end
2279
2280 ## NOTE: the leading white-space chars on empty line are significant
2281 !! test
2282 5a. White-space in indent-pre
2283 !! wikitext
2284 a<br />
2285
2286 b
2287 !! html
2288 <pre>a<br />
2289
2290 b
2291 </pre>
2292 !! end
2293
2294 ## NOTE: the leading white-space chars on empty line are significant
2295 !! test
2296 5b. White-space in indent-pre
2297 !! wikitext
2298 a
2299
2300 b
2301
2302
2303 c
2304 !! html
2305 <pre>a
2306
2307 b
2308
2309
2310 c
2311 </pre>
2312 !! end
2313
2314 !! test
2315 5c. White-space in indent-pre
2316 !! wikitext
2317 ''a''
2318 ''b''
2319 ''c''
2320 !! html
2321 <pre><i>a</i>
2322 <i>b</i>
2323 <i>c</i>
2324 </pre>
2325 !! end
2326
2327 !! test
2328 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2329 !! wikitext
2330 a
2331
2332 <!-- continue -->
2333 b
2334
2335 c
2336
2337 d
2338 !! html
2339 <pre>a
2340
2341 b
2342 </pre>
2343 <pre>c
2344
2345 </pre>
2346 <p>d
2347 </p>
2348 !! end
2349
2350 !! test
2351 7a. Indent-pre and category links
2352 !! options
2353 parsoid=wt2html,wt2wt
2354 !! wikitext
2355 [[Category:foo]] <!-- No pre-wrapping -->
2356 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2357 !! html
2358 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2359 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2360 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2361 !! end
2362
2363 !! test
2364 7b. Indent-pre and category links
2365 !! options
2366 parsoid=wt2html,wt2wt
2367 !! wikitext
2368 [[Category:foo]] a
2369 [[Category:foo]] {{echo|b}}
2370 !! html
2371 <pre>
2372 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2373
2374 <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>
2375 !! end
2376
2377 ###
2378 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2379 ###
2380
2381 !!test
2382 HTML-pre: 1. embedded newlines
2383 !! wikitext
2384 <pre>foo</pre>
2385
2386 <pre>
2387 foo
2388 </pre>
2389
2390 <pre>
2391
2392 foo
2393 </pre>
2394
2395 <pre>
2396
2397
2398 foo
2399 </pre>
2400 !! html
2401 <pre>foo</pre>
2402 <pre>
2403 foo
2404 </pre>
2405 <pre>
2406
2407 foo
2408 </pre>
2409 <pre>
2410
2411
2412 foo
2413 </pre>
2414
2415 !!end
2416
2417 !!test
2418 HTML-pre: 2: indented text
2419 !! wikitext
2420 <pre>
2421 foo
2422 </pre>
2423 !! html
2424 <pre>
2425 foo
2426 </pre>
2427
2428 !!end
2429
2430 !!test
2431 HTML-pre: 3: other wikitext
2432 !! wikitext
2433 <pre>
2434 * foo
2435 # bar
2436 = no-h =
2437 '' no-italic ''
2438 [[ NoLink ]]
2439 </pre>
2440 !! html
2441 <pre>
2442 * foo
2443 # bar
2444 = no-h =
2445 '' no-italic ''
2446 [[ NoLink ]]
2447 </pre>
2448
2449 !!end
2450
2451 ###
2452 ### Definition lists
2453 ###
2454 !! test
2455 Simple definition
2456 !! wikitext
2457 ; name : Definition
2458 !! html
2459 <dl>
2460 <dt> name&#160;</dt>
2461 <dd> Definition
2462 </dd>
2463 </dl>
2464
2465 !! end
2466
2467 !! test
2468 Definition list for indentation only
2469 !! wikitext
2470 : Indented text
2471 !! html
2472 <dl>
2473 <dd> Indented text
2474 </dd>
2475 </dl>
2476
2477 !! end
2478
2479 !! test
2480 Definition list with no space
2481 !! wikitext
2482 ;name:Definition
2483 !! html
2484 <dl>
2485 <dt>name</dt>
2486 <dd>Definition
2487 </dd>
2488 </dl>
2489
2490 !!end
2491
2492 !! test
2493 Definition list with URL link
2494 !! wikitext
2495 ; http://example.com/ : definition
2496 !! html
2497 <dl>
2498 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2499 <dd> definition
2500 </dd>
2501 </dl>
2502
2503 !! end
2504
2505 !! test
2506 Definition list with bracketed URL link
2507 !! wikitext
2508 ;[http://www.example.com/ Example]:Something about it
2509 !! html
2510 <dl>
2511 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2512 <dd>Something about it
2513 </dd>
2514 </dl>
2515
2516 !! end
2517
2518 !! test
2519 Definition list with wikilink containing colon
2520 !! wikitext
2521 ; [[Help:FAQ]]: The least-read page on Wikipedia
2522 !! html
2523 <dl>
2524 <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>
2525 <dd> The least-read page on Wikipedia
2526 </dd>
2527 </dl>
2528
2529 !! end
2530
2531 # At Brion's and JeLuF's insistence... :)
2532 !! test
2533 Definition list with news link containing colon
2534 !! wikitext
2535 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2536 !! html
2537 <dl>
2538 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2539 <dd> This isn't even a real newsgroup!
2540 </dd>
2541 </dl>
2542
2543 !! end
2544
2545 !! test
2546 Malformed definition list with colon
2547 !! wikitext
2548 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2549 !! html
2550 <dl>
2551 <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
2552 </dt>
2553 </dl>
2554
2555 !! end
2556
2557 !! test
2558 Definition lists: colon in external link text
2559 !! wikitext
2560 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2561 !! html
2562 <dl>
2563 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2564 <dd> OK, I made that up
2565 </dd>
2566 </dl>
2567
2568 !! end
2569
2570 !! test
2571 Definition lists: colon in HTML attribute
2572 !! wikitext
2573 ;<b style="display: inline">bold</b>
2574 !! html
2575 <dl>
2576 <dt><b style="display: inline">bold</b>
2577 </dt>
2578 </dl>
2579
2580 !! end
2581
2582 !! test
2583 Definition lists: self-closed tag
2584 !! wikitext
2585 ;one<br/>two : two-line fun
2586 !! html
2587 <dl>
2588 <dt>one<br />two&#160;</dt>
2589 <dd> two-line fun
2590 </dd>
2591 </dl>
2592
2593 !! end
2594
2595 !! test
2596 Bug 11748: Literal closing tags
2597 !! wikitext
2598 <dl>
2599 <dt>test 1</dt>
2600 <dd>test test test test test</dd>
2601 <dt>test 2</dt>
2602 <dd>test test test test test</dd>
2603 </dl>
2604 !! html
2605 <dl>
2606 <dt>test 1</dt>
2607 <dd>test test test test test</dd>
2608 <dt>test 2</dt>
2609 <dd>test test test test test</dd>
2610 </dl>
2611
2612 !! end
2613
2614 !! test
2615 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2616 !! wikitext
2617 <ul><li>
2618 ; term : description
2619 * unordered
2620 </li></ul>
2621 !! html
2622 <ul><li>
2623 <dl>
2624 <dt> term&#160;</dt>
2625 <dd> description
2626 </dd>
2627 </dl>
2628 <ul>
2629 <li> unordered
2630 </li>
2631 </ul>
2632 </li></ul>
2633
2634 !! end
2635
2636 !! test
2637
2638 Definition list with empty definition and following paragraph
2639 !! wikitext
2640 ; term:
2641 Paragraph text
2642 !! html
2643 <dl>
2644 <dt> term</dt>
2645 <dd>
2646 </dd>
2647 </dl>
2648 <p>Paragraph text
2649 </p>
2650 !! end
2651
2652 !! test
2653 Nested definition lists using html syntax
2654 !! wikitext
2655 <dl><dd>
2656 <dl>
2657 <dd>Foo</dd>
2658 </dl>
2659 </dd></dl>
2660 !! html
2661 <dl><dd>
2662 <dl>
2663 <dd>Foo</dd>
2664 </dl>
2665 </dd></dl>
2666
2667 !! end
2668
2669 !! test
2670 Definition Lists: No nesting: Multiple dd's
2671 !! wikitext
2672 ;x
2673 :a
2674 :b
2675 !! html
2676 <dl>
2677 <dt>x
2678 </dt>
2679 <dd>a
2680 </dd>
2681 <dd>b
2682 </dd>
2683 </dl>
2684
2685 !! end
2686
2687 !! test
2688 Definition Lists: Indentation: Regular
2689 !! wikitext
2690 :i1
2691 ::i2
2692 :::i3
2693 !! html
2694 <dl>
2695 <dd>i1
2696 <dl>
2697 <dd>i2
2698 <dl>
2699 <dd>i3
2700 </dd>
2701 </dl>
2702 </dd>
2703 </dl>
2704 </dd>
2705 </dl>
2706
2707 !! end
2708
2709 !! test
2710 Definition Lists: Indentation: Missing 1st level
2711 !! wikitext
2712 ::i2
2713 :::i3
2714 !! html
2715 <dl>
2716 <dd><dl>
2717 <dd>i2
2718 <dl>
2719 <dd>i3
2720 </dd>
2721 </dl>
2722 </dd>
2723 </dl>
2724 </dd>
2725 </dl>
2726
2727 !! end
2728
2729 !! test
2730 Definition Lists: Indentation: Multi-level indent
2731 !! wikitext
2732 :::i3
2733 !! html
2734 <dl>
2735 <dd><dl>
2736 <dd><dl>
2737 <dd>i3
2738 </dd>
2739 </dl>
2740 </dd>
2741 </dl>
2742 </dd>
2743 </dl>
2744
2745 !! end
2746
2747 !! test
2748 Definition Lists: Hacky use to indent tables
2749 !! wikitext
2750 ::{|
2751 |foo
2752 |bar
2753 |}
2754 this text
2755 should be left alone
2756 !! html
2757 <dl><dd><dl><dd><table>
2758 <tr>
2759 <td>foo
2760 </td>
2761 <td>bar
2762 </td></tr></table></dd></dl></dd></dl>
2763 <p>this text
2764 should be left alone
2765 </p>
2766 !! end
2767
2768 # Bug 52473
2769 !! test
2770 Definition Lists: Hacky use to indent tables (WS-insensitive)
2771 !! options
2772 parsoid
2773 !! wikitext
2774 : {|
2775 |a
2776 |}
2777 !! html
2778 <dl>
2779 <dd> <table><tr><td>a</td></tr></table> </dd>
2780 </dl>
2781 !! end
2782 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2783 ## as an empty dt item. It also ignores all but the last ";" when followed
2784 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2785 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2786 ## ";"s.
2787 ##
2788 ## Ex: ";;t2 ::d2" is transformed into:
2789 ##
2790 ## <dl>
2791 ## <dt>t2 </dt>
2792 ## <dd>
2793 ## <dl>
2794 ## <dt></dt>
2795 ## <dd>d2</dd>
2796 ## </dl>
2797 ## </dd>
2798 ## </dl>
2799 ##
2800 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2801 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2802 ##
2803 ## <dl>
2804 ## <dt>
2805 ## <dl>
2806 ## <dt>t2 </dt>
2807 ## <dd>:d2</dd>
2808 ## </dl>
2809 ## </dt>
2810 ## </dl>
2811 ##
2812 ## All Parsoid only definition list tests have this difference.
2813 ##
2814 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2815 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2816
2817 !! test
2818 Table / list interaction: indented table with lists in table contents
2819 !! wikitext
2820 :{|
2821 |-
2822 | a
2823 * b
2824 |-
2825 | c
2826 * d
2827 |}
2828 !! html
2829 <dl><dd><table>
2830
2831 <tr>
2832 <td> a
2833 <ul>
2834 <li> b
2835 </li>
2836 </ul>
2837 </td></tr>
2838 <tr>
2839 <td> c
2840 <ul>
2841 <li> d
2842 </li>
2843 </ul>
2844 </td></tr></table></dd></dl>
2845
2846 !! end
2847
2848 !!test
2849 Table / list interaction: lists nested in tables nested in indented lists
2850 !! wikitext
2851 :{|
2852 |
2853 :a
2854 :b
2855 |
2856 *c
2857 *d
2858 |}
2859
2860 *e
2861 *f
2862 !! html
2863 <dl><dd><table>
2864 <tr>
2865 <td>
2866 <dl>
2867 <dd>a
2868 </dd>
2869 <dd>b
2870 </dd>
2871 </dl>
2872 </td>
2873 <td>
2874 <ul>
2875 <li>c
2876 </li>
2877 <li>d
2878 </li>
2879 </ul>
2880 </td></tr></table></dd></dl>
2881 <ul>
2882 <li>e
2883 </li>
2884 <li>f
2885 </li>
2886 </ul>
2887
2888 !!end
2889
2890 !! test
2891 Definition Lists: Nesting: Multi-level (Parsoid only)
2892 !! options
2893 parsoid
2894 !! wikitext
2895 ;t1 :d1
2896 ;;t2 ::d2
2897 ;;;t3 :::d3
2898 !! html
2899 <dl>
2900 <dt>t1 </dt>
2901 <dd>d1</dd>
2902 <dt>
2903 <dl>
2904 <dt>t2 </dt>
2905 <dd>:d2</dd>
2906 <dt>
2907 <dl>
2908 <dt>t3 </dt>
2909 <dd>::d3</dd>
2910 </dl>
2911 </dt>
2912 </dl>
2913 </dt>
2914 </dl>
2915
2916
2917 !! end
2918
2919
2920 !! test
2921 Definition Lists: Nesting: Test 2 (Parsoid only)
2922 !! options
2923 parsoid
2924 !! wikitext
2925 ;t1
2926 ::d2
2927 !! html
2928 <dl>
2929 <dt>t1</dt>
2930 <dd>
2931 <dl>
2932 <dd>d2</dd>
2933 </dl>
2934 </dd>
2935 </dl>
2936
2937 !! end
2938
2939
2940 !! test
2941 Definition Lists: Nesting: Test 3 (Parsoid only)
2942 !! options
2943 parsoid
2944 !! wikitext
2945 :;t1
2946 ::::d2
2947 !! html
2948 <dl>
2949 <dd>
2950 <dl>
2951 <dt>t1</dt>
2952 <dd>
2953 <dl>
2954 <dd>
2955 <dl>
2956 <dd>d2</dd>
2957 </dl>
2958 </dd>
2959 </dl>
2960 </dd>
2961 </dl>
2962 </dd>
2963 </dl>
2964
2965 !! end
2966
2967
2968 !! test
2969 Definition Lists: Nesting: Test 4
2970 !! wikitext
2971 ::;t3
2972 :::d3
2973 !! html
2974 <dl>
2975 <dd><dl>
2976 <dd><dl>
2977 <dt>t3
2978 </dt>
2979 <dd>d3
2980 </dd>
2981 </dl>
2982 </dd>
2983 </dl>
2984 </dd>
2985 </dl>
2986
2987 !! end
2988
2989
2990 ## The Parsoid team believes the following three test exposes a
2991 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2992 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2993 !! test
2994 Definition Lists: Mixed Lists: Test 1
2995 !! wikitext
2996 :;* foo
2997 ::* bar
2998 :; baz
2999 !! html/php
3000 <dl>
3001 <dd><dl>
3002 <dt><ul>
3003 <li> foo
3004 </li>
3005 <li> bar
3006 </li>
3007 </ul>
3008 </dt>
3009 </dl>
3010 <dl>
3011 <dt> baz
3012 </dt>
3013 </dl>
3014 </dd>
3015 </dl>
3016
3017 !! html/parsoid
3018 <dl>
3019 <dd><dl>
3020 <dt><ul>
3021 <li> foo
3022 </li>
3023 </ul></dt>
3024 <dd><ul>
3025 <li> bar
3026 </li>
3027 </ul></dd>
3028 <dt> baz</dt>
3029 </dl></dd>
3030 </dl>
3031 !! end
3032
3033 !! test
3034 Definition Lists: Mixed Lists: Test 2
3035 !! wikitext
3036 *: d1
3037 *: d2
3038 !! html
3039 <ul>
3040 <li><dl>
3041 <dd> d1
3042 </dd>
3043 <dd> d2
3044 </dd>
3045 </dl>
3046 </li>
3047 </ul>
3048
3049 !! end
3050
3051
3052 !! test
3053 Definition Lists: Mixed Lists: Test 3
3054 !! wikitext
3055 *::: d1
3056 *::: d2
3057 !! html
3058 <ul>
3059 <li><dl>
3060 <dd><dl>
3061 <dd><dl>
3062 <dd> d1
3063 </dd>
3064 <dd> d2
3065 </dd>
3066 </dl>
3067 </dd>
3068 </dl>
3069 </dd>
3070 </dl>
3071 </li>
3072 </ul>
3073
3074 !! end
3075
3076
3077 !! test
3078 Definition Lists: Mixed Lists: Test 4
3079 !! wikitext
3080 *;d1 :d2
3081 *;d3 :d4
3082 !! html
3083 <ul>
3084 <li><dl>
3085 <dt>d1&#160;</dt>
3086 <dd>d2
3087 </dd>
3088 <dt>d3&#160;</dt>
3089 <dd>d4
3090 </dd>
3091 </dl>
3092 </li>
3093 </ul>
3094
3095 !! end
3096
3097
3098 !! test
3099 Definition Lists: Mixed Lists: Test 5
3100 !! wikitext
3101 *:d1
3102 *:: d2
3103 !! html
3104 <ul>
3105 <li><dl>
3106 <dd>d1
3107 <dl>
3108 <dd> d2
3109 </dd>
3110 </dl>
3111 </dd>
3112 </dl>
3113 </li>
3114 </ul>
3115
3116 !! end
3117
3118
3119 !! test
3120 Definition Lists: Mixed Lists: Test 6
3121 !! wikitext
3122 #*:d1
3123 #*::: d3
3124 !! html
3125 <ol>
3126 <li><ul>
3127 <li><dl>
3128 <dd>d1
3129 <dl>
3130 <dd><dl>
3131 <dd> d3
3132 </dd>
3133 </dl>
3134 </dd>
3135 </dl>
3136 </dd>
3137 </dl>
3138 </li>
3139 </ul>
3140 </li>
3141 </ol>
3142
3143 !! end
3144
3145
3146 !! test
3147 Definition Lists: Mixed Lists: Test 7
3148 !! wikitext
3149 :* d1
3150 :* d2
3151 !! html
3152 <dl>
3153 <dd><ul>
3154 <li> d1
3155 </li>
3156 <li> d2
3157 </li>
3158 </ul>
3159 </dd>
3160 </dl>
3161
3162 !! end
3163
3164
3165 !! test
3166 Definition Lists: Mixed Lists: Test 8
3167 !! wikitext
3168 :* d1
3169 ::* d2
3170 !! html
3171 <dl>
3172 <dd><ul>
3173 <li> d1
3174 </li>
3175 </ul>
3176 <dl>
3177 <dd><ul>
3178 <li> d2
3179 </li>
3180 </ul>
3181 </dd>
3182 </dl>
3183 </dd>
3184 </dl>
3185
3186 !! end
3187
3188
3189 !! test
3190 Definition Lists: Mixed Lists: Test 9
3191 !! wikitext
3192 *;foo :bar
3193 !! html
3194 <ul>
3195 <li><dl>
3196 <dt>foo&#160;</dt>
3197 <dd>bar
3198 </dd>
3199 </dl>
3200 </li>
3201 </ul>
3202
3203 !! end
3204
3205
3206 !! test
3207 Definition Lists: Mixed Lists: Test 10
3208 !! wikitext
3209 *#;foo :bar
3210 !! html
3211 <ul>
3212 <li><ol>
3213 <li><dl>
3214 <dt>foo&#160;</dt>
3215 <dd>bar
3216 </dd>
3217 </dl>
3218 </li>
3219 </ol>
3220 </li>
3221 </ul>
3222
3223 !! end
3224
3225 # The Parsoid team disagrees with the PHP parser's seemingly-random
3226 # rules regarding dd/dt on the next two tests. Parsoid is more
3227 # consistent, and recognizes the shared nesting and keeps the
3228 # still-open tags around until the nesting is complete.
3229
3230 !! test
3231 Definition Lists: Mixed Lists: Test 11
3232 !! wikitext
3233 *#*#;*;;foo :bar
3234 *#*#;boo :baz
3235 !! html/php
3236 <ul>
3237 <li><ol>
3238 <li><ul>
3239 <li><ol>
3240 <li><dl>
3241 <dt>foo&#160;</dt>
3242 <dd><ul>
3243 <li><dl>
3244 <dt><dl>
3245 <dt>bar
3246 </dt>
3247 </dl>
3248 </dd>
3249 </dl>
3250 </li>
3251 </ul>
3252 </dd>
3253 </dl>
3254 <dl>
3255 <dt>boo&#160;</dt>
3256 <dd>baz
3257 </dd>
3258 </dl>
3259 </li>
3260 </ol>
3261 </li>
3262 </ul>
3263 </li>
3264 </ol>
3265 </li>
3266 </ul>
3267
3268 !! html/parsoid
3269 <ul>
3270 <li>
3271 <ol>
3272 <li>
3273 <ul>
3274 <li>
3275 <ol>
3276 <li>
3277 <dl>
3278 <dt>
3279 <ul>
3280 <li>
3281 <dl>
3282 <dt>
3283 <dl>
3284 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3285 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3286 </dl></dt>
3287 </dl></li>
3288 </ul></dt>
3289 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3290 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3291 </dl></li>
3292 </ol></li>
3293 </ul></li>
3294 </ol></li>
3295 </ul>
3296 !! end
3297
3298
3299 !! test
3300 Definition Lists: Weird Ones: Test 1
3301 !! wikitext
3302 *#;*::;; foo : bar (who uses this?)
3303 !! html/php
3304 <ul>
3305 <li><ol>
3306 <li><dl>
3307 <dt> foo&#160;</dt>
3308 <dd><ul>
3309 <li><dl>
3310 <dd><dl>
3311 <dd><dl>
3312 <dt><dl>
3313 <dt> bar (who uses this?)
3314 </dt>
3315 </dl>
3316 </dd>
3317 </dl>
3318 </dd>
3319 </dl>
3320 </dd>
3321 </dl>
3322 </li>
3323 </ul>
3324 </dd>
3325 </dl>
3326 </li>
3327 </ol>
3328 </li>
3329 </ul>
3330
3331 !! html/parsoid
3332 <ul>
3333 <li>
3334 <ol>
3335 <li>
3336 <dl>
3337 <dt>
3338 <ul>
3339 <li>
3340 <dl>
3341 <dd>
3342 <dl>
3343 <dd>
3344 <dl>
3345 <dt>
3346 <dl>
3347 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3348 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3349 </dl></dt>
3350 </dl></dd>
3351 </dl></dd>
3352 </dl></li>
3353 </ul></dt>
3354 </dl></li>
3355 </ol></li>
3356 </ul>
3357 !! end
3358
3359 ###
3360 ### External links
3361 ###
3362 !! test
3363 External links: non-bracketed
3364 !! wikitext
3365 Non-bracketed: http://example.com
3366 !! html
3367 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3368 </p>
3369 !! end
3370
3371 !! test
3372 External links: numbered
3373 !! wikitext
3374 Numbered: [http://example.com]
3375 Numbered: [http://example.net]
3376 Numbered: [http://example.com]
3377 !! html
3378 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3379 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3380 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3381 </p>
3382 !!end
3383
3384 !! test
3385 External links: specified text
3386 !! wikitext
3387 Specified text: [http://example.com link]
3388 !! html
3389 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3390 </p>
3391 !!end
3392
3393 !! test
3394 External links: trail
3395 !! wikitext
3396 Linktrails should not work for external links: [http://example.com link]s
3397 !! html
3398 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3399 </p>
3400 !! end
3401
3402 !! test
3403 External links: dollar sign in URL
3404 !! wikitext
3405 http://example.com/1$2345
3406 !! html
3407 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3408 </p>
3409 !! end
3410
3411 !! test
3412 External links: dollar sign in URL (named)
3413 !! wikitext
3414 [http://example.com/1$2345]
3415 !! html
3416 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3417 </p>
3418 !!end
3419
3420 !! test
3421 External links: open square bracket forbidden in URL (bug 4377)
3422 !! wikitext
3423 http://example.com/1[2345
3424 !! html
3425 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3426 </p>
3427 !! end
3428
3429 !! test
3430 External links: open square bracket forbidden in URL (named) (bug 4377)
3431 !! wikitext
3432 [http://example.com/1[2345]
3433 !! html
3434 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3435 </p>
3436 !!end
3437
3438 !! test
3439 External links: nowiki in URL link text (bug 6230)
3440 !! wikitext
3441 [http://example.com/ <nowiki>''example site''</nowiki>]
3442 !! html
3443 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3444 </p>
3445 !! end
3446
3447 !! test
3448 External links: newline forbidden in text (bug 6230 regression check)
3449 !! wikitext
3450 [http://example.com/ first
3451 second]
3452 !! html
3453 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3454 second]
3455 </p>
3456 !!end
3457
3458 !! test
3459 External links: Pipe char between url and text
3460 !! wikitext
3461 [http://example.com | link]
3462 !! html
3463 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3464 </p>
3465 !!end
3466
3467 !! test
3468 External links: protocol-relative URL in brackets
3469 !! wikitext
3470 [//example.com/ Test]
3471 !! html
3472 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3473 </p>
3474 !! end
3475
3476 !! test
3477 External links: protocol-relative URL in brackets without text
3478 !! wikitext
3479 [//example.com]
3480 !! html
3481 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3482 </p>
3483 !! end
3484
3485 !! test
3486 External links: protocol-relative URL in free text is left alone
3487 !! wikitext
3488 //example.com/Foo
3489 !! html
3490 <p>//example.com/Foo
3491 </p>
3492 !!end
3493
3494 !! test
3495 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3496 !! wikitext
3497 foo//example.com/Foo
3498 !! html
3499 <p>foo//example.com/Foo
3500 </p>
3501 !! end
3502
3503 !! test
3504 External image
3505 !! wikitext
3506 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3507 !! html
3508 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3509 </p>
3510 !! end
3511
3512 !! test
3513 External image from https
3514 !! wikitext
3515 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3516 !! html
3517 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3518 </p>
3519 !! end
3520
3521 !! test
3522 External image (when not allowed)
3523 !! options
3524 wgAllowExternalImages=0
3525 !! wikitext
3526 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3527 !! html
3528 <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>
3529 </p>
3530 !! end
3531
3532 !! test
3533 Link to non-http image, no img tag
3534 !! wikitext
3535 Link to non-http image, no img tag: ftp://example.com/test.jpg
3536 !! html
3537 <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>
3538 </p>
3539 !! end
3540
3541 !! test
3542 External links: terminating separator
3543 !! wikitext
3544 Terminating separator: http://example.com/thing,
3545 !! html
3546 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3547 </p>
3548 !! end
3549
3550 !! test
3551 External links: intervening separator
3552 !! wikitext
3553 Intervening separator: http://example.com/1,2,3
3554 !! html
3555 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3556 </p>
3557 !! end
3558
3559 !! test
3560 External links: old bug with URL in query
3561 !! wikitext
3562 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3563 !! html
3564 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3565 </p>
3566 !! end
3567
3568 !! test
3569 External links: old URL-in-URL bug, mixed protocols
3570 !! wikitext
3571 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3572 !! html
3573 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3574 </p>
3575 !!end
3576
3577 !! test
3578 External links: URL in text
3579 !! wikitext
3580 URL in text: [http://example.com http://example.com]
3581 !! html
3582 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3583 </p>
3584 !! end
3585
3586 !! test
3587 External links: Clickable images
3588 !! wikitext
3589 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3590 !! html
3591 <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>
3592 </p>
3593 !!end
3594
3595 !! test
3596 External links: raw ampersand
3597 !! wikitext
3598 Old &amp; use: http://x&y
3599 !! html
3600 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3601 </p>
3602 !! end
3603
3604 !! test
3605 External links: encoded ampersand
3606 !! wikitext
3607 Old &amp; use: http://x&amp;y
3608 !! html
3609 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3610 </p>
3611 !! end
3612
3613 !! test
3614 External links: encoded equals (bug 6102)
3615 !! wikitext
3616 http://example.com/?foo&#61;bar
3617 !! html
3618 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3619 </p>
3620 !! end
3621
3622 !! test
3623 External links: [raw ampersand]
3624 !! wikitext
3625 Old &amp; use: [http://x&y]
3626 !! html
3627 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3628 </p>
3629 !! end
3630
3631 !! test
3632 External links: [encoded ampersand]
3633 !! wikitext
3634 Old &amp; use: [http://x&amp;y]
3635 !! html
3636 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3637 </p>
3638 !! end
3639
3640 !! test
3641 External links: [encoded equals] (bug 6102)
3642 !! wikitext
3643 [http://example.com/?foo&#61;bar]
3644 !! html
3645 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3646 </p>
3647 !! end
3648
3649 !! test
3650 External links: [IDN ignored character reference in hostname; strip it right off]
3651 !! wikitext
3652 [http://e&zwnj;xample.com/]
3653 !! html
3654 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3655 </p>
3656 !! end
3657
3658 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3659 # Where an external link could easily circumvent the sanitization of the text of
3660 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3661 # test demands a higher standard. That's a bit strange.
3662 #
3663 # Example:
3664 #
3665 # http://e‌xample.com -> [http://example.com|http://example.com]
3666 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3667 #
3668 # The first example is sanitized, but the second is not. Any security benefits
3669 # from this production are trivial to circumvent. Either remove this test and
3670 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3671 # the test accordingly.
3672 #
3673 # All our love,
3674 # The Parsoid team.
3675 !! test
3676 External links: IDN ignored character reference in hostname; strip it right off
3677 !! wikitext
3678 http://e&zwnj;xample.com/
3679 !! html
3680 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3681 </p>
3682 !! end
3683
3684 !! test
3685 External links: www.jpeg.org (bug 554)
3686 !! wikitext
3687 http://www.jpeg.org
3688 !! html
3689 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3690 </p>
3691 !! end
3692
3693 !! test
3694 External links: URL within URL (original bug 2)
3695 !! wikitext
3696 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3697 !! html
3698 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3699 </p>
3700 !! end
3701
3702 !! test
3703 BUG 361: URL inside bracketed URL
3704 !! wikitext
3705 [http://www.example.com/foo http://www.example.com/bar]
3706 !! html
3707 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3708 </p>
3709 !! end
3710
3711 !! test
3712 BUG 361: URL within URL, not bracketed
3713 !! wikitext
3714 http://www.example.com/foo?=http://www.example.com/bar
3715 !! html
3716 <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>
3717 </p>
3718 !! end
3719
3720 !! test
3721 BUG 289: ">"-token in URL-tail
3722 !! wikitext
3723 http://www.example.com/<hello>
3724 !! html
3725 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3726 </p>
3727 !!end
3728
3729 !! test
3730 BUG 289: literal ">"-token in URL-tail
3731 !! wikitext
3732 http://www.example.com/<b>html</b>
3733 !! html
3734 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3735 </p>
3736 !!end
3737
3738 !! test
3739 BUG 289: ">"-token in bracketed URL
3740 !! wikitext
3741 [http://www.example.com/<hello> stuff]
3742 !! html
3743 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3744 </p>
3745 !!end
3746
3747 !! test
3748 BUG 289: literal ">"-token in bracketed URL
3749 !! wikitext
3750 [http://www.example.com/<b>html</b> stuff]
3751 !! html
3752 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3753 </p>
3754 !!end
3755
3756 !! test
3757 BUG 289: literal double quote at end of URL
3758 !! wikitext
3759 http://www.example.com/"hello"
3760 !! html
3761 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3762 </p>
3763 !!end
3764
3765 !! test
3766 BUG 289: literal double quote in bracketed URL
3767 !! wikitext
3768 [http://www.example.com/"hello" stuff]
3769 !! html
3770 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3771 </p>
3772 !!end
3773
3774 !! test
3775 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3776 !! wikitext
3777 [http://www.example.com test]
3778 !! html
3779 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3780 </p>
3781 !! end
3782
3783 !! test
3784 External links: link text with spaces
3785 !! wikitext
3786 [http://www.example.com a b c]
3787 [http://www.example.com ''a'' ''b'']
3788 !! html
3789 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3790 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3791 </p>
3792 !! end
3793
3794 !! test
3795 External links: wiki links within external link (Bug 3695)
3796 !! wikitext
3797 [http://example.com [[wikilink]] embedded in ext link]
3798 !! html/php
3799 <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>
3800 </p>
3801 !! html/parsoid
3802 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
3803 !! end
3804
3805 !! test
3806 BUG 787: Links with one slash after the url protocol are invalid
3807 !! wikitext
3808 http:/example.com
3809
3810 [http:/example.com title]
3811 !! html
3812 <p>http:/example.com
3813 </p><p>[http:/example.com title]
3814 </p>
3815 !! end
3816
3817 !! test
3818 Bracketed external links with template-generated invalid target
3819 !! wikitext
3820 [{{echo|http:/example.com}} title]
3821 !! html
3822 <p>[http:/example.com title]
3823 </p>
3824 !! end
3825
3826 !! test
3827 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3828 !! wikitext
3829 ''[http://example.com text'']
3830 [http://example.com '''text]'''
3831 ''Something [http://example.com in italic'']
3832 ''Something [http://example.com mixed''''', even bold]'''
3833 '''''Now [http://example.com both''''']
3834 !! html
3835 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3836 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3837 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3838 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3839 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3840 </p>
3841 !! end
3842
3843
3844 !! test
3845 Bug 4781: %26 in URL
3846 !! wikitext
3847 http://www.example.com/?title=AT%26T
3848 !! html
3849 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3850 </p>
3851 !! end
3852
3853 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3854 # % is actually legal in HTML5. Any change in output would need testing though.
3855 !! test
3856 Bug 4781, 5267: %25 in URL
3857 !! wikitext
3858 http://www.example.com/?title=100%25_Bran
3859 !! html
3860 <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>
3861 </p>
3862 !! end
3863
3864 !! test
3865 Bug 4781, 5267: %28, %29 in URL
3866 !! wikitext
3867 http://www.example.com/?title=Ben-Hur_%281959_film%29
3868 !! html
3869 <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>
3870 </p>
3871 !! end
3872
3873
3874 !! test
3875 Bug 4781: %26 in autonumber URL
3876 !! wikitext
3877 [http://www.example.com/?title=AT%26T]
3878 !! html
3879 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3880 </p>
3881 !! end
3882
3883 !! test
3884 Bug 4781, 5267: %26 in autonumber URL
3885 !! wikitext
3886 [http://www.example.com/?title=100%25_Bran]
3887 !! html
3888 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3889 </p>
3890 !! end
3891
3892 !! test
3893 Bug 4781, 5267: %28, %29 in autonumber URL
3894 !! wikitext
3895 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3896 !! html
3897 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3898 </p>
3899 !! end
3900
3901
3902 !! test
3903 Bug 4781: %26 in bracketed URL
3904 !! wikitext
3905 [http://www.example.com/?title=AT%26T link]
3906 !! html
3907 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3908 </p>
3909 !! end
3910
3911 !! test
3912 Bug 4781, 5267: %26 in bracketed URL
3913 !! wikitext
3914 [http://www.example.com/?title=100%25_Bran link]
3915 !! html
3916 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3917 </p>
3918 !! end
3919
3920 !! test
3921 Bug 4781, 5267: %28, %29 in bracketed URL
3922 !! wikitext
3923 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3924 !! html
3925 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3926 </p>
3927 !! end
3928
3929 !! test
3930 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3931 !! wikitext
3932 Some [http://example.com/ pretty ''italics'' and stuff]!
3933 !! html
3934 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3935 </p>
3936 !! end
3937
3938 !! test
3939 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3940 !! wikitext
3941 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3942 !! html
3943 <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>
3944 </p>
3945 !! end
3946
3947 !! test
3948 External link containing double-single-quotes with no space separating the url from text in italics
3949 !! wikitext
3950 [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]].]
3951 !! html/php
3952 <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>
3953 </p>
3954 !! html/parsoid
3955 <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)">Museo Picasso</a><span>.</span></p>
3956 !! end
3957
3958 !! test
3959 External link with comments in link text
3960 !! wikitext
3961 [http://www.google.com Google <!-- comment -->]
3962 !! html
3963 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3964 </p>
3965 !! end
3966
3967 !! test
3968 URL-encoding in URL functions (single parameter)
3969 !! wikitext
3970 {{localurl:Some page|amp=&}}
3971 !! html
3972 <p>/index.php?title=Some_page&amp;amp=&amp;
3973 </p>
3974 !! end
3975
3976 !! test
3977 URL-encoding in URL functions (multiple parameters)
3978 !! wikitext
3979 {{localurl:Some page|q=?&amp=&}}
3980 !! html
3981 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3982 </p>
3983 !! end
3984
3985 !! test
3986 Brackets in urls
3987 !! wikitext
3988 http://example.com/index.php?foozoid%5B%5D=bar
3989
3990 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3991 !! html
3992 <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>
3993 </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>
3994 </p>
3995 !! end
3996
3997 !! test
3998 IPv6 urls (bug 21261)
3999 !! options
4000 disabled
4001 !! wikitext
4002 http://[2404:130:0:1000::187:2]/index.php
4003 !! html
4004 <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>
4005 </p>
4006 !! end
4007
4008 !! test
4009 Non-extlinks in brackets
4010 !! wikitext
4011 [foo]
4012 [foo bar]
4013 [foo ''bar'']
4014 [fool's] errand
4015 [fool's errand]
4016 [{{echo|foo}}]
4017 [{{echo|foo}} bar]
4018 [{{echo|foo}} ''bar'']
4019 [{{echo|foo}}l's] errand
4020 [{{echo|foo}}l's errand]
4021 [url={{echo|foo}}]
4022 [url=http://example.com]
4023 !! html
4024 <p>[foo]
4025 [foo bar]
4026 [foo <i>bar</i>]
4027 [fool's] errand
4028 [fool's errand]
4029 [foo]
4030 [foo bar]
4031 [foo <i>bar</i>]
4032 [fool's] errand
4033 [fool's errand]
4034 [url=foo]
4035 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4036 </p>
4037 !! end
4038
4039 !! test
4040 Percent encoding in external links
4041 !! wikitext
4042 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4043 !! html/php
4044 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4045 </p>
4046 !! html/parsoid
4047 <p><a rel="mw:ExtLink"
4048 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4049 !! end
4050
4051 !! test
4052 Use url link syntax for links where the content is equal the link target
4053 !! wikitext
4054 http://example.com
4055 !! html/php
4056 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4057 </p>
4058 !! html/parsoid
4059 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4060 !! end
4061
4062 !! test
4063 Parenthesis in external links, especially URL links
4064 !! wikitext
4065 http://example.com)
4066
4067 http://example.com/test)
4068
4069 http://example.com/(test)
4070
4071 http://example.com/((test)
4072
4073 (http://example.com/(test))
4074
4075 (http://example.com/(test)))))
4076
4077 http://example.com/a)b
4078
4079 [http://example.com) foo]
4080 !! html/php
4081 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4082 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4083 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4084 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4085 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4086 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4087 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4088 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4089 </p>
4090 !! html/parsoid
4091 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4092 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4093 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4094 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4095 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4096 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4097 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4098 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4099 !! end
4100
4101 !! test
4102 Parenthesis in external links, w/ transclusion or comment
4103 !! wikitext
4104 (http://example.com/{{echo|hi}})
4105
4106 (http://example.com<!-- hi -->)
4107 !! html/php
4108 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4109 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4110 </p>
4111 !! html/parsoid
4112 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[20,31,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;]}]]}\">hi&lt;/span>"}]]}' 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}}"}}'>http://example.com/hi</a>)</p>
4113
4114 <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>
4115 !! end
4116
4117 ###
4118 ### Quotes
4119 ###
4120
4121 !! test
4122 Quotes
4123 !! wikitext
4124 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4125
4126 Normal text. '''''Bold italic text.''''' Normal text.
4127 !! html
4128 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4129 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4130 </p>
4131 !! end
4132
4133
4134 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4135 # parser strips. The wikitext contains just the first half of the bold
4136 # quote pair.
4137 !! test
4138 Unclosed and unmatched quotes
4139 !! wikitext
4140 '''''Bold italic text '''with bold deactivated''' in between.'''''
4141
4142 '''''Bold italic text ''with italic deactivated'' in between.'''''
4143
4144 '''Bold text..
4145
4146 ..spanning two paragraphs (should not work).'''
4147
4148 '''Bold tag left open
4149
4150 ''Italic tag left open
4151
4152 Normal text.
4153
4154 <!-- Unmatching number of opening, closing tags: -->
4155 '''This year''''s election ''should'' beat '''last year''''s.
4156
4157 ''Tom'''s car is bigger than ''Susan'''s.
4158
4159 Plain ''italic'''s plain
4160 !! html/php
4161 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4162 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4163 </p><p><b>Bold text..</b>
4164 </p><p>..spanning two paragraphs (should not work).
4165 </p><p><b>Bold tag left open</b>
4166 </p><p><i>Italic tag left open</i>
4167 </p><p>Normal text.
4168 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4169 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4170 </p><p>Plain <i>italic'</i>s plain
4171 </p>
4172 !! html/parsoid
4173 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4174 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4175 </p><p><b>Bold text..</b>
4176 </p><p>..spanning two paragraphs (should not work).<b></b>
4177 </p><p><b>Bold tag left open</b>
4178 </p><p><i>Italic tag left open</i>
4179 </p><p>Normal text.
4180 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4181 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4182 </p><p>Plain <i>italic'</i>s plain
4183 </p>
4184 !! end
4185
4186 ###
4187 ### Tables
4188 ###
4189 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4190 ###
4191
4192 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4193 # is the bare minimum required by the spec, see:
4194 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4195 # Parsoid team replies: empty table tags are legal in HTML5
4196 !! test
4197 A table with no data.
4198 !! options
4199 parsoid=wt2html
4200 !! wikitext
4201 {||}
4202 !! html/php
4203
4204 !! html/parsoid
4205 <table></table>
4206
4207 !! end
4208
4209 !! test
4210 A table with stray table end tags on start tag line (wt2html)
4211 !! options
4212 parsoid=wt2html
4213 !! wikitext
4214 {|style="color: red;"|}
4215
4216 {|style="color: red;" |}
4217 |foo
4218 |}
4219
4220 {|style="color: red;"|} id="foo"
4221 |foo
4222 |}
4223
4224 {|style="color: red;" |} id="foo"
4225 |foo
4226 |}
4227 !! html
4228 <table style="color: red;"></table>
4229
4230 <table style="color: red;">
4231 <tbody><tr>
4232 <td>foo</td>
4233 </tr></tbody>
4234 </table>
4235
4236 <table style="color: red;" id="foo">
4237 <tbody><tr>
4238 <td>foo</td>
4239 </tr></tbody>
4240 </table>
4241
4242 <table style="color: red;" id="foo">
4243 <tbody><tr>
4244 <td>foo</td>
4245 </tr></tbody>
4246 </table>
4247
4248 !! end
4249
4250 !! test
4251 A table with no data (take 2)
4252 !! wikitext
4253 {|
4254 |}
4255 !! html/parsoid
4256 <table></table>
4257 !! end
4258
4259 # A table with nothing but a caption is invalid XHTML, we might want to render
4260 # this as <p>caption</p>
4261 # Parsoid team replies: table with only a caption is legal in HTML5
4262 !! test
4263 A table with nothing but a caption
4264 !! wikitext
4265 {|
4266 |+ caption
4267 |}
4268 !! html/php
4269 <table>
4270 <caption> caption
4271 </caption><tr><td></td></tr></table>
4272
4273 !! html/parsoid
4274 <table><caption> caption</caption></table>
4275 !! end
4276
4277 !! test
4278 A table with caption with default-spaced attributes and a table row
4279 !! wikitext
4280 {|
4281 |+ style="color: red;" | caption1
4282 |-
4283 | foo
4284 |}
4285 !! html
4286 <table>
4287 <caption style="color: red;"> caption1
4288 </caption>
4289 <tr>
4290 <td> foo
4291 </td></tr></table>
4292
4293 !! end
4294
4295 !! test
4296 A table with captions with non-default spaced attributes and a table row
4297 !! wikitext
4298 {|
4299 |+style="color: red;"|caption2
4300 |+ style="color: red;"| caption3
4301 |-
4302 | foo
4303 |}
4304 !! html
4305 <table>
4306 <caption style="color: red;">caption2
4307 </caption>
4308 <caption style="color: red;"> caption3
4309 </caption>
4310 <tr>
4311 <td> foo
4312 </td></tr></table>
4313
4314 !! end
4315
4316 !! test
4317 Table td-cell syntax variations
4318 !! wikitext
4319 {|
4320 | foo bar foo | baz
4321 | foo bar foo || baz
4322 | style='color:red;' | baz
4323 | style='color:red;' || baz
4324 |}
4325 !! html
4326 <table>
4327 <tr>
4328 <td> baz
4329 </td>
4330 <td> foo bar foo </td>
4331 <td> baz
4332 </td>
4333 <td style="color:red;"> baz
4334 </td>
4335 <td> style='color:red;' </td>
4336 <td> baz
4337 </td></tr></table>
4338
4339 !! end
4340
4341 !! test
4342 Simple table
4343 !! wikitext
4344 {|
4345 | 1 || 2
4346 |-
4347 | 3 || 4
4348 |}
4349 !! html
4350 <table>
4351 <tr>
4352 <td> 1 </td>
4353 <td> 2
4354 </td></tr>
4355 <tr>
4356 <td> 3 </td>
4357 <td> 4
4358 </td></tr></table>
4359
4360 !! end
4361
4362 !! test
4363 Simple table but with multiple dashes for row wikitext
4364 !! wikitext
4365 {|
4366 | foo
4367 |-----
4368 | bar
4369 |}
4370 !! html
4371 <table>
4372 <tr>
4373 <td> foo
4374 </td></tr>
4375 <tr>
4376 <td> bar
4377 </td></tr></table>
4378
4379 !! end
4380 !! test
4381 Multiplication table
4382 !! wikitext
4383 {| border="1" cellpadding="2"
4384 |+Multiplication table
4385 |-
4386 ! &times; !! 1 !! 2 !! 3
4387 |-
4388 ! 1
4389 | 1 || 2 || 3
4390 |-
4391 ! 2
4392 | 2 || 4 || 6
4393 |-
4394 ! 3
4395 | 3 || 6 || 9
4396 |-
4397 ! 4
4398 | 4 || 8 || 12
4399 |-
4400 ! 5
4401 | 5 || 10 || 15
4402 |}
4403 !! html
4404 <table border="1" cellpadding="2">
4405 <caption>Multiplication table
4406 </caption>
4407 <tr>
4408 <th> &#215; </th>
4409 <th> 1 </th>
4410 <th> 2 </th>
4411 <th> 3
4412 </th></tr>
4413 <tr>
4414 <th> 1
4415 </th>
4416 <td> 1 </td>
4417 <td> 2 </td>
4418 <td> 3
4419 </td></tr>
4420 <tr>
4421 <th> 2
4422 </th>
4423 <td> 2 </td>
4424 <td> 4 </td>
4425 <td> 6
4426 </td></tr>
4427 <tr>
4428 <th> 3
4429 </th>
4430 <td> 3 </td>
4431 <td> 6 </td>
4432 <td> 9
4433 </td></tr>
4434 <tr>
4435 <th> 4
4436 </th>
4437 <td> 4 </td>
4438 <td> 8 </td>
4439 <td> 12
4440 </td></tr>
4441 <tr>
4442 <th> 5
4443 </th>
4444 <td> 5 </td>
4445 <td> 10 </td>
4446 <td> 15
4447 </td></tr></table>
4448
4449 !! end
4450
4451 !! test
4452 Accept "||" in table headings
4453 !! wikitext
4454 {|
4455 !h1 || h2
4456 |}
4457 !! html
4458 <table>
4459 <tr>
4460 <th>h1 </th>
4461 <th> h2
4462 </th></tr></table>
4463
4464 !! end
4465
4466 !! test
4467 Accept "||" in indented table headings
4468 !! wikitext
4469 :{|
4470 !h1 || h2
4471 |}
4472 !! html
4473 <dl><dd><table>
4474 <tr>
4475 <th>h1 </th>
4476 <th> h2
4477 </th></tr></table></dd></dl>
4478
4479 !! end
4480
4481 !! test
4482 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4483 !! wikitext
4484 {|
4485 !| h1
4486 || a
4487 |}
4488 !! html
4489 <table>
4490 <tr>
4491 <th> h1
4492 </th>
4493 <td> a
4494 </td></tr></table>
4495
4496 !! end
4497
4498 !!test
4499 Accept "| !" at start of line in tables (ignore !-attribute)
4500 !! wikitext
4501 {|
4502 |-
4503 | !style="color:red" | bar
4504 |}
4505 !! html
4506 <table>
4507
4508 <tr>
4509 <td> bar
4510 </td></tr></table>
4511
4512 !!end
4513
4514 !!test
4515 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 +/-
4516 !! wikitext
4517 {|
4518 |-
4519 |style='color:red;'|+1
4520 |style='color:blue;'|-1
4521 |-
4522 | 1 || 2 || 3
4523 | 1 ||+2 ||-3
4524 |-
4525 | +1
4526 | -1
4527 |}
4528 !! html
4529 <table>
4530
4531 <tr>
4532 <td style="color:red;">+1
4533 </td>
4534 <td style="color:blue;">-1
4535 </td></tr>
4536 <tr>
4537 <td> 1 </td>
4538 <td> 2 </td>
4539 <td> 3
4540 </td>
4541 <td> 1 </td>
4542 <td>+2 </td>
4543 <td>-3
4544 </td></tr>
4545 <tr>
4546 <td> +1
4547 </td>
4548 <td> -1
4549 </td></tr></table>
4550
4551 !!end
4552
4553 !! test
4554 Table rowspan
4555 !! wikitext
4556 {| border=1
4557 | Cell 1, row 1
4558 |rowspan=2| Cell 2, row 1 (and 2)
4559 | Cell 3, row 1
4560 |-
4561 | Cell 1, row 2
4562 | Cell 3, row 2
4563 |}
4564 !! html
4565 <table border="1">
4566 <tr>
4567 <td> Cell 1, row 1
4568 </td>
4569 <td rowspan="2"> Cell 2, row 1 (and 2)
4570 </td>
4571 <td> Cell 3, row 1
4572 </td></tr>
4573 <tr>
4574 <td> Cell 1, row 2
4575 </td>
4576 <td> Cell 3, row 2
4577 </td></tr></table>
4578
4579 !! end
4580
4581 !! test
4582 Nested table
4583 !! wikitext
4584 {| border=1
4585 | &alpha;
4586 |
4587 {| bgcolor=#ABCDEF border=2
4588 |nested
4589 |-
4590 |table
4591 |}
4592 |the original table again
4593 |}
4594 !! html
4595 <table border="1">
4596 <tr>
4597 <td> &#945;
4598 </td>
4599 <td>
4600 <table bgcolor="#ABCDEF" border="2">
4601 <tr>
4602 <td>nested
4603 </td></tr>
4604 <tr>
4605 <td>table
4606 </td></tr></table>
4607 </td>
4608 <td>the original table again
4609 </td></tr></table>
4610
4611 !! end
4612
4613 !! test
4614 Invalid attributes in table cell (bug 1830)
4615 !! wikitext
4616 {|
4617 |Cell:|broken
4618 |}
4619 !! html
4620 <table>
4621 <tr>
4622 <td>broken
4623 </td></tr></table>
4624
4625 !! end
4626
4627
4628 !! test
4629 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4630 !! wikitext
4631 {|
4632 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4633 !! html
4634 <table>
4635 <tr>
4636 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4637 <td>]" onmouseover="alert(document.cookie)"&gt;test
4638 </td>
4639 </tr>
4640 </table>
4641
4642 !! end
4643
4644
4645 !! test
4646 Indented table markup mixed with indented pre content (proposed in bug 6200)
4647 !! wikitext
4648 <table>
4649 <tr>
4650 <td>
4651 Text that should be rendered preformatted
4652 </td>
4653 </tr>
4654 </table>
4655 !! html
4656 <table>
4657 <tr>
4658 <td>
4659 <pre>Text that should be rendered preformatted
4660 </pre>
4661 </td>
4662 </tr>
4663 </table>
4664
4665 !! end
4666
4667 !! test
4668 Template-generated table cell attributes and cell content
4669 !! wikitext
4670 {|
4671 |{{table_attribs}}
4672 | {{table_attribs}}
4673 |}
4674 !! html
4675 <table>
4676 <tr>
4677 <td style="color: red"> Foo
4678 </td>
4679 <td style="color: red"> Foo
4680 </td></tr></table>
4681
4682 !! end
4683
4684 !! test
4685 Template-generated table cell attributes and cell content (2)
4686 !! wikitext
4687 {|
4688 |align=center {{table_attribs}}
4689 |}
4690 !! html
4691 <table>
4692 <tr>
4693 <td align="center" style="color: red"> Foo
4694 </td></tr></table>
4695
4696 !! end
4697
4698 !! test
4699 Template-generated table cell attributes and cell content (3)
4700 !! wikitext
4701 {|
4702 |align=center {{table_cells}}
4703 |}
4704 !! html
4705 <table>
4706 <tr>
4707 <td align="center" style="color: red"> Foo </td>
4708 <td> Bar </td>
4709 <td> Baz
4710 </td></tr></table>
4711
4712 !! end
4713
4714 !! test
4715 Table with row followed by newlines and table heading
4716 !! wikitext
4717 {|
4718 |-
4719
4720 ! foo
4721 |}
4722 !! html
4723 <table>
4724
4725
4726 <tr>
4727 <th> foo
4728 </th></tr></table>
4729
4730 !! end
4731
4732 !! test
4733 Table with empty line following the start tag
4734 !! wikitext
4735 {|
4736
4737 |-
4738 | foo
4739 |}
4740 !! html
4741 <table>
4742
4743
4744 <tr>
4745 <td> foo
4746 </td></tr></table>
4747
4748 !! end
4749
4750 # FIXME: Preserve the attribute properly (with an empty string as value) in
4751 # the PHP parser. Parsoid implements the behavior below.
4752 !! test
4753 Table attributes with empty value
4754 !! wikitext
4755 {|
4756 | style=| hello
4757 |}
4758 !! html/parsoid
4759 <table>
4760 <tbody>
4761 <tr>
4762 <td style=""> hello
4763 </td></tr></tbody></table>
4764
4765 !! end
4766
4767 !! test
4768 Wikitext table with a lot of comments
4769 !! wikitext
4770 {|
4771 <!-- c0 -->
4772 | foo
4773 <!-- c1 -->
4774 |- <!-- c2 -->
4775 <!-- c3 -->
4776 |<!-- c4 -->
4777 <!-- c5 -->
4778 |}
4779 !! html
4780 <table>
4781 <tr>
4782 <td> foo
4783 </td></tr>
4784 <tr>
4785 <td>
4786 </td></tr></table>
4787
4788 !! end
4789
4790 !! test
4791 Wikitext table with double-line table cell
4792 !! wikitext
4793 {|
4794 |a
4795 b
4796 |}
4797 !! html
4798 <table>
4799 <tr>
4800 <td>a
4801 <p>b
4802 </p>
4803 </td></tr></table>
4804
4805 !! end
4806
4807 !! test
4808 Table cell with a single comment
4809 !! wikitext
4810 {|
4811 | <!-- c1 -->
4812 | a
4813 |}
4814 !! html
4815 <table>
4816 <tr>
4817 <td>
4818 </td>
4819 <td> a
4820 </td></tr></table>
4821
4822 !! end
4823
4824 # The expected HTML structure in this test is debatable. The PHP parser does
4825 # not parse this kind of table at all. The main focus for Parsoid is on
4826 # round-tripping, so this output is ok for now. TODO: revisit!
4827 !! test
4828 Wikitext table with html-syntax row
4829 !! wikitext
4830 {|
4831 |-
4832 <td>foo</td>
4833 |}
4834 !! html/parsoid
4835 <table>
4836 <tbody>
4837 <tr>
4838 <td>foo</td></tr></tbody></table>
4839 !! end
4840
4841 !! test
4842 Implicit <td> after a |-
4843 (PHP parser relies on Tidy to add the missing <td> tags)
4844 !! options
4845 parsoid=wt2html,wt2wt
4846 !! wikitext
4847 {|
4848 |-
4849 a
4850 |}
4851 !! html
4852 <table>
4853 <tr><td>a</td></tr>
4854 </table>
4855 !! end
4856
4857 !! test
4858 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4859 (PHP parser relies on Tidy to add the missing <td> tags)
4860 !! options
4861 parsoid=wt2html,wt2wt
4862 !! wikitext
4863 {|
4864 |-
4865 |
4866 a
4867 |-
4868 b
4869 |}
4870 !! html
4871 <table>
4872 <tbody>
4873 <tr><td><pre>a</pre></td></tr>
4874 <tr><td> b</td></tr>
4875 </tbody>
4876 </table>
4877 !! end
4878
4879 !! test
4880 Lists should be recognized in an implicit <td> context
4881 (PHP parser relies on Tidy to add the missing <td> tags)
4882 !! options
4883 parsoid=wt2html,wt2wt
4884 !! wikitext
4885 {|
4886 |-
4887 *a
4888 |}
4889 !! html
4890 <table>
4891 <tr>
4892 <td><ul>
4893 <li>a</li>
4894 </ul></td>
4895 </tr>
4896 </table>
4897 !! end
4898
4899 !! test
4900 Parsoid: Round-trip tables directly followed by content (bug 51219)
4901 !! options
4902 parsoid=wt2html,wt2wt
4903 !! wikitext
4904 {|
4905 |foo
4906 |} bar
4907
4908 {|
4909 |baz
4910 |}<b>quux</b>
4911 !! html
4912 <table><tbody>
4913 <tr>
4914 <td>foo</td></tr></tbody></table> bar
4915 <table>
4916 <tbody>
4917 <tr>
4918 <td>baz</td></tr></tbody></table><b>quux</b>
4919 !! end
4920
4921 !! test
4922 Parsoid: Default to a newline after tables in new content (bug 51219)
4923 !! options
4924 parsoid=html2wt
4925 !! wikitext
4926 {|
4927 |foo
4928 |}
4929 <nowiki> </nowiki>bar
4930 {|
4931 |baz
4932 |}
4933 '''quux'''
4934 !! html
4935 <table><tbody>
4936 <tr><td>foo</td></tr></tbody></table> bar
4937 <table><tbody>
4938 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4939 !! end
4940
4941 !! test
4942 Parsoid: newline inducing block nodes don't suppress <nowiki>
4943 !! options
4944 parsoid=html2wt
4945 !! wikitext
4946 <nowiki> </nowiki>a
4947
4948 = foo =
4949 !! html
4950 a<h1>foo</h1>
4951 !! end
4952
4953 ###
4954 ### Internal links
4955 ###
4956 !! test
4957 Plain link, capitalized
4958 !! wikitext
4959 [[Main Page]]
4960 !! html
4961 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4962 </p>
4963 !! end
4964
4965 !! test
4966 Plain link, uncapitalized
4967 !! wikitext
4968 [[main Page]]
4969 !! html
4970 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4971 </p>
4972 !! end
4973
4974 !! test
4975 Piped link
4976 !! wikitext
4977 [[Main Page|The Main Page]]
4978 !! html
4979 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4980 </p>
4981 !! end
4982
4983 !! test
4984 Piped link with comment in link text
4985 !! wikitext
4986 [[Main Page|The Main<!--front--> Page]]
4987 !! html
4988 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4989 </p>
4990 !! end
4991
4992 !! test
4993 Broken link
4994 !! wikitext
4995 [[Zigzagzogzagzig]]
4996 !! html
4997 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4998 </p>
4999 !! end
5000
5001 !! test
5002 Broken link with fragment
5003 !! wikitext
5004 [[Zigzagzogzagzig#zug]]
5005 !! html
5006 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5007 </p>
5008 !! end
5009
5010 !! test
5011 Special page link with fragment
5012 !! wikitext
5013 [[Special:Version#anchor]]
5014 !! html
5015 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5016 </p>
5017 !! end
5018
5019 !! test
5020 Nonexistent special page link with fragment
5021 !! wikitext
5022 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5023 !! html
5024 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5025 </p>
5026 !! end
5027
5028 !! test
5029 Link with prefix
5030 !! wikitext
5031 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5032 !! html
5033 <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>
5034 </p>
5035 !! end
5036
5037 !! test
5038 Link with suffix
5039 !! wikitext
5040 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5041 !! html
5042 <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>!!!
5043 </p>
5044 !! end
5045
5046 !! article
5047 prefixed article
5048 !! text
5049 Some text
5050 !! endarticle
5051
5052 !! test
5053 Bug 43661: Piped links with identical prefixes
5054 !! wikitext
5055 [[prefixed article|prefixed articles with spaces]]
5056
5057 [[prefixed article|prefixed articlesaoeu]]
5058
5059 [[Main Page|Main Page test]]
5060 !! html
5061 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5062 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5063 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5064 </p>
5065 !! end
5066
5067
5068 !! test
5069 Link with HTML entity in suffix / tail
5070 !! wikitext
5071 [[Main Page]]&quot;, [[Main Page]]&#97;
5072 !! html
5073 <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;
5074 </p>
5075 !! end
5076
5077 !! test
5078 Link with 3 brackets
5079 !! wikitext
5080 [[[Main Page]]]
5081 !! html
5082 <p>[[[Main Page]]]
5083 </p>
5084 !! end
5085
5086 !! test
5087 Link with 4 brackets
5088 !! wikitext
5089 [[[[Main Page]]]]
5090 !! html
5091 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5092 </p>
5093 !! end
5094
5095 !! test
5096 Piped link with 3 brackets
5097 !! wikitext
5098 [[[main page|the main page]]]
5099 !! html
5100 <p>[[[main page|the main page]]]
5101 </p>
5102 !! end
5103
5104 !! test
5105 Piped link with extlink-like text
5106 !! wikitext
5107 [[Main Page|[bar]]]
5108 [[Main Page|This is a [bar]]]
5109 !! html
5110 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5111 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5112 </p>
5113 !! end
5114
5115 !! test
5116 Link with multiple pipes
5117 !! wikitext
5118 [[Main Page|The|Main|Page]]
5119 !! html
5120 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5121 </p>
5122 !! end
5123
5124 !! test
5125 Link to namespaces
5126 !! wikitext
5127 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5128 !! html
5129 <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>
5130 </p>
5131 !! end
5132
5133 !! article
5134 MemoryAlpha:AlphaTest
5135 !! text
5136 This is an article in the MemoryAlpha namespace
5137 (which shadows the memoryalpha interwiki link).
5138 !! endarticle
5139
5140 !! test
5141 Namespace takes precedence over interwiki link (bug 51680)
5142 !! wikitext
5143 [[MemoryAlpha:AlphaTest]]
5144 !! html
5145 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5146 </p>
5147 !! end
5148
5149 # The previous test doesn't work correctly in html2*, due to not recognizing the
5150 # link as an internal one. This one checks for the correct behavior.
5151 !! test
5152 Link to namespace preferred over interwiki with correct rel attribute
5153 !! options
5154 parsoid=html2wt,html2html
5155 !! wikitext
5156 [[MemoryAlpha:AlphaTest]]
5157 !! html
5158 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5159 </p>
5160 !! end
5161
5162 !! test
5163 Piped link to namespace
5164 !! wikitext
5165 [[Meta:Disclaimers|The disclaimers]]
5166 !! html
5167 <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>
5168 </p>
5169 !! end
5170
5171 !! test
5172 Link containing }
5173 !! wikitext
5174 [[Usually caused by a typo (oops}]]
5175 !! html
5176 <p>[[Usually caused by a typo (oops}]]
5177 </p>
5178 !! end
5179
5180 !! test
5181 Link containing % (not as a hex sequence)
5182 !! wikitext
5183 [[7% Solution]]
5184 !! html
5185 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5186 </p>
5187 !! end
5188
5189 !! test
5190 Link containing % as a single hex sequence interpreted to char
5191 !! wikitext
5192 [[7%25 Solution]]
5193 !! html
5194 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5195 </p>
5196 !!end
5197
5198 !! test
5199 Link containing % as a double hex sequence interpreted to hex sequence
5200 !! wikitext
5201 [[7%2525 Solution]]
5202 !! html
5203 <p>[[7%2525 Solution]]
5204 </p>
5205 !!end
5206
5207 !! test
5208 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5209 Example for such a section: == < ==
5210 !! wikitext
5211 [[%23%3c]][[%23%3e]]
5212 !! html
5213 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5214 </p>
5215 !! end
5216
5217 !! test
5218 Link containing "<#" and ">#" as a hex sequences
5219 !! wikitext
5220 [[%3c%23]][[%3e%23]]
5221 !! html
5222 <p>[[%3c%23]][[%3e%23]]
5223 </p>
5224 !! end
5225
5226 !! test
5227 Link containing an equals sign
5228 !! wikitext
5229 [[Special:BookSources/isbn=4-00-026157-6]]
5230 !! html
5231 <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>
5232 </p>
5233 !! end
5234
5235 !! article
5236 Foo~bar
5237 !! text
5238 Just a test of an article title containing a tilde.
5239 !! endarticle
5240
5241 # note that links containing signatures, like [[Foo~~~~]], are
5242 # massaged by the pre-save transform (PST) and so the tildes are never
5243 # seen by the parser.
5244 !! test
5245 Link containing a tilde
5246 !! wikitext
5247 [[Foo~bar]]
5248 !! html
5249 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5250 </p>
5251 !! end
5252
5253 !! test
5254 Link containing double-single-quotes '' (bug 4598)
5255 !! wikitext
5256 [[Lista d''e paise d''o munno]]
5257 !! html
5258 <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>
5259 </p>
5260 !! end
5261
5262 !! test
5263 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5264 !! wikitext
5265 Some [[Link|pretty ''italics'' and stuff]]!
5266 !! html
5267 <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>!
5268 </p>
5269 !! end
5270
5271 !! test
5272 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5273 !! wikitext
5274 ''Some [[Link|pretty ''italics'' and stuff]]!
5275 !! html
5276 <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>
5277 </p>
5278 !! end
5279
5280 !! test
5281 Link with double quotes in title part (literal) and alternate part (interpreted)
5282 !! wikitext
5283 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5284
5285 [[''Pentecoste'']]
5286
5287 [[''Pentecoste''|Pentecoste]]
5288
5289 [[''Pentecoste''|''Pentecoste'']]
5290 !! html
5291 <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>
5292 </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>
5293 </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>
5294 </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>
5295 </p>
5296 !! end
5297
5298 !! test
5299 Broken image links with HTML captions (bug 39700)
5300 !! wikitext
5301 [[File:Nonexistent|<script></script>]]
5302 [[File:Nonexistent|100px|<script></script>]]
5303 [[File:Nonexistent|&lt;]]
5304 [[File:Nonexistent|a<i>b</i>c]]
5305 !! html
5306 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5307 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5308 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5309 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5310 </p>
5311 !! end
5312
5313 !! test
5314 Plain link to URL
5315 !! wikitext
5316 [[http://www.example.com]]
5317 !! html
5318 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5319 </p>
5320 !! end
5321
5322 !! test
5323 Plain link to URL with link text
5324 !! wikitext
5325 [[http://www.example.com Link text]]
5326 !! html
5327 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5328 </p>
5329 !! end
5330
5331 !! test
5332 Plain link to protocol-relative URL
5333 !! wikitext
5334 [[//www.example.com]]
5335 !! html
5336 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5337 </p>
5338 !! end
5339
5340 !! test
5341 Plain link to protocol-relative URL with link text
5342 !! wikitext
5343 [[//www.example.com Link text]]
5344 !! html
5345 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5346 </p>
5347 !! end
5348
5349 !! test
5350 Plain link to page with question mark in title
5351 !! wikitext
5352 [[A?b]]
5353
5354 [[A?b|Baz]]
5355 !! html
5356 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5357 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5358 </p>
5359 !! end
5360
5361
5362 # I'm fairly sure the expected result here is wrong.
5363 # We want these to be URL links, not pseudo-pages with URLs for titles....
5364 # However the current output is also pretty screwy.
5365 #
5366 # ----
5367 # I'm changing it to match the current output--it arguably makes more
5368 # sense in the light of the test above. Old expected result was:
5369 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5370 #</p>
5371 # But I think this test is bordering on "garbage in, garbage out" anyway.
5372 # -- wtm
5373 !! test
5374 Piped link to URL
5375 !! wikitext
5376 Piped link to URL: [[http://www.example.com|an example URL]]
5377 !! html
5378 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5379 </p>
5380 !! end
5381
5382 !! test
5383 BUG 2: [[page|http://url/]] should link to page, not http://url/
5384 !! wikitext
5385 [[Main Page|http://url/]]
5386 !! html
5387 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5388 </p>
5389 !! end
5390
5391 !! test
5392 BUG 337: Escaped self-links should be bold
5393 !! options
5394 title=[[Bug462]]
5395 !! wikitext
5396 [[Bu&#103;462]] [[Bug462]]
5397 !! html
5398 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5399 </p>
5400 !! end
5401
5402 !! test
5403 Self-link to section should not be bold
5404 !! options
5405 title=[[Main Page]]
5406 !! wikitext
5407 [[Main Page#section]]
5408 !! html
5409 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5410 </p>
5411 !! end
5412
5413 !! article
5414 00
5415 !! text
5416 This is 00.
5417 !! endarticle
5418
5419 !!test
5420 Self-link to numeric title
5421 !!options
5422 title=[[0]]
5423 !! wikitext
5424 [[0]]
5425 !! html
5426 <p><strong class="selflink">0</strong>
5427 </p>
5428 !!end
5429
5430 !!test
5431 Link to numeric-equivalent title
5432 !!options
5433 title=[[0]]
5434 !! wikitext
5435 [[00]]
5436 !! html
5437 <p><a href="/wiki/00" title="00">00</a>
5438 </p>
5439 !!end
5440
5441 !! test
5442 <nowiki> inside a link
5443 !! wikitext
5444 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5445 !! html
5446 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5447 </p>
5448 !! end
5449
5450 !! test
5451 Non-breaking spaces in title
5452 !! wikitext
5453 [[&nbsp; Main &nbsp; Page &nbsp;]]
5454 !! html
5455 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5456 </p>
5457 !!end
5458
5459 !! test
5460 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5461 !! options
5462 language=ca
5463 !! wikitext
5464 '''[[Main Page]]'''
5465 !! html
5466 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5467 </p>
5468 !! end
5469
5470 !! test
5471 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5472 !! options
5473 language=ca
5474 !! wikitext
5475 ''[[Main Page]]''
5476 !! html
5477 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5478 </p>
5479 !! end
5480
5481 !! test
5482 Internal link with en linktrail: no apostrophes (bug 27473)
5483 !! options
5484 language=en
5485 !! wikitext
5486 [[Something]]'nice
5487 !! html
5488 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5489 </p>
5490 !! end
5491
5492 !! test
5493 Internal link with ca linktrail with apostrophes (bug 27473)
5494 !! options
5495 language=ca
5496 !! wikitext
5497 [[Something]]'nice
5498 !! html
5499 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5500 </p>
5501 !! end
5502
5503 !! test
5504 Internal link with kaa linktrail with apostrophes (bug 27473)
5505 !! options
5506 language=kaa
5507 !! wikitext
5508 [[Something]]'nice
5509 !! html
5510 <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>
5511 </p>
5512 !! end
5513
5514 !! test
5515 1. Interaction of linktrail and template encapsulation
5516 !! options
5517 parsoid
5518 !! wikitext
5519 {{echo|[[Foo]]}}l
5520 !! html
5521 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
5522 !! end
5523
5524 !! test
5525 2. Interaction of linktrail and template encapsulation
5526 !! options
5527 parsoid
5528 !! wikitext
5529 {{echo|Some [[Fool]]}}s
5530 !! html
5531 <p data-parsoid='{}'><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" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
5532 !! end
5533
5534 !! test
5535 3. Interaction of linktrail and template encapsulation
5536 !! options
5537 parsoid
5538 !! wikitext
5539 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5540 !! html
5541 <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" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
5542 !! end
5543
5544 !! article
5545 Söfnuður
5546 !! text
5547 Test.
5548 !! endarticle
5549
5550 !! test
5551 Internal link with is link prefix
5552 !! options
5553 language=is
5554 !! wikitext
5555 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5556 !! html
5557 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5558 </p>
5559 !! end
5560
5561 !! article
5562 Mótmælendatrú
5563 !! text
5564 Test.
5565 !! endarticle
5566
5567 !! test
5568 Internal link with is link trail and link prefix
5569 !! options
5570 language=is
5571 !! wikitext
5572 [[mótmælendatrú|xxx]]ar
5573 [[mótmælendatrú]]ar
5574 mótmælenda[[söfnuður]]
5575 mótmælenda[[söfnuður|söfnuðir]]
5576 mótmælenda[[söfnuður|söfnuðir]]xxx
5577 !! html
5578 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5579 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5580 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5581 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5582 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5583 </p>
5584 !! end
5585
5586 !! test
5587 Parsoid link trail escaping
5588 !! options
5589 parsoid=html2wt,html2html
5590 !! wikitext
5591 [[apple]]<nowiki/>s
5592 !! html
5593 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5594 !! end
5595
5596 !! test
5597 Parsoid link prefix escaping
5598 !! options
5599 language=is
5600 parsoid=html2wt,html2html
5601 !! wikitext
5602 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5603 !! html
5604 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5605 !! end
5606
5607 !! test
5608 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5609 !! wikitext
5610 [[Foo| bar]]
5611
5612 [[Foo| ''bar'']]
5613
5614 [http://wp.org foo]
5615
5616 [http://wp.org ''foo'']
5617 !! html
5618 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5619 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
5620 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5621 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5622 </p>
5623 !! end
5624
5625 !! test
5626 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5627 !! options
5628 parsoid
5629 !! wikitext
5630 [[Foo|{{echo|a}} b {{echo|c}}]]
5631 !! html
5632 <p><a rel="mw:WikiLink" href="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>
5633 !! end
5634
5635 ###
5636 ### Interwiki links (see maintenance/interwiki.sql)
5637 ###
5638
5639 !! test
5640 Inline interwiki link
5641 !! wikitext
5642 [[MeatBall:SoftSecurity]]
5643 !! html
5644 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5645 </p>
5646 !! end
5647
5648 !! test
5649 Inline interwiki link with empty title (bug 2372)
5650 !! wikitext
5651 [[MeatBall:]]
5652 !! html
5653 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5654 </p>
5655 !! end
5656
5657 !! test
5658 Interwiki link encoding conversion (bug 1636)
5659 !! wikitext
5660 *[[Wikipedia:ro:Olteni&#0355;a]]
5661 *[[Wikipedia:ro:Olteni&#355;a]]
5662 !! html
5663 <ul>
5664 <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>
5665 </li>
5666 <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>
5667 </li>
5668 </ul>
5669
5670 !! end
5671
5672 !! test
5673 Interwiki link with fragment (bug 2130)
5674 !! wikitext
5675 [[MeatBall:SoftSecurity#foo]]
5676 !! html
5677 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5678 </p>
5679 !! end
5680
5681 # Ideally the wikipedia: prefix here should be proto-relative too
5682 !! test
5683 Different interwiki prefixes mapping to the same URL
5684 !! options
5685 parsoid
5686 !! wikitext
5687 [[wikipedia:Foo]]
5688
5689 [[:en:Foo]]
5690 !! html
5691 <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}'>wikipedia:Foo</a></p>
5692
5693 <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}'>en:Foo</a></p>
5694 !! end
5695
5696 !! test
5697 Interwiki links that cannot be represented in wiki syntax
5698 !! options
5699 parsoid
5700 !! wikitext
5701 [[meatball:ok]]
5702 [[meatball:ok#foo|ok with fragment]]
5703 [[meatball:ok_as_well?|ok ending with ? mark]]
5704 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5705 [http://de.wikipedia.org/wiki/#foo is just fragment]
5706
5707 !! html
5708 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5709 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5710 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
5711 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5712 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5713 !! end
5714
5715 !! test
5716 Interwiki links: trail
5717 !! options
5718 parsoid
5719 !! wikitext
5720 [[wikipedia:Foo|Ba]]r
5721 !! html
5722 <p data-parsoid='{}'><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"}'>Bar</a></p>
5723 !! end
5724
5725 ###
5726 ### Interlanguage links
5727 ### Language links (so that searching for '### language' matches..)
5728 ###
5729
5730 !! test
5731 Interlanguage link
5732 !! wikitext
5733 Blah blah blah
5734 [[zh:Chinese]]
5735 !! html
5736 <p>Blah blah blah
5737 </p>
5738 !! end
5739
5740 !! test
5741 Double interlanguage link
5742 !! wikitext
5743 Blah blah blah
5744 [[es:Spanish]]
5745 [[zh:Chinese]]
5746 !! html
5747 <p>Blah blah blah
5748 </p>
5749 !! end
5750
5751 !! test
5752 Interlanguage link, with prefix links
5753 !! options
5754 language=ln
5755 !! wikitext
5756 Blah blah blah
5757 [[zh:Chinese]]
5758 !! html
5759 <p>Blah blah blah
5760 </p>
5761 !! end
5762
5763 !! test
5764 Double interlanguage link, with prefix links (bug 8897)
5765 !! options
5766 language=ln
5767 !! wikitext
5768 Blah blah blah
5769 [[es:Spanish]]
5770 [[zh:Chinese]]
5771 !! html
5772 <p>Blah blah blah
5773 </p>
5774 !! end
5775
5776 !! test
5777 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5778 !! options
5779 language=ln
5780 !! wikitext
5781 [[WW&nbsp;II]]
5782 !! html
5783 <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>
5784 </p>
5785 !! end
5786
5787 !! test
5788 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5789 !! options
5790 parsoid=html2wt
5791 !! wikitext
5792 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5793
5794 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5795 !! html
5796 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5797 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5798 !! end
5799
5800 !! test
5801 Parsoid: handle constructor well
5802 !! options
5803 parsoid
5804 !! wikitext
5805 [[constructor]]
5806
5807 [[constructor:foo]]
5808 !! html
5809 <p><a rel="mw:WikiLink" href="./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>
5810
5811 <p><a rel="mw:WikiLink" href="./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>
5812 !! end
5813
5814 !! test
5815 Parsoid: recognize interlanguage links without a target page
5816 !! options
5817 parsoid
5818 !! wikitext
5819 [[ko:]]
5820 !! html
5821 <p>
5822 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5823 !! end
5824
5825 !! test
5826 Parsoid: recognize interwiki links without a target page
5827 !! options
5828 parsoid
5829 !! wikitext
5830 [[:ko:]]
5831 !! html
5832 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
5833 !! end
5834
5835 !! test
5836 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
5837 !! options
5838 parsoid
5839 !! wikitext
5840 [[en:Foo]]
5841 !! html
5842 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
5843 !! end
5844
5845 ###
5846 ### Redirects, Parsoid-only
5847 ###
5848 !! test
5849 1. Simple redirect to page
5850 !! options
5851 parsoid
5852 !! wikitext
5853 #REDIRECT [[Main Page]]
5854 !! html
5855 <link rel="mw:PageProp/redirect" href="./Main_Page">
5856 !! end
5857
5858 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
5859 !! test
5860 2. Other redirect variants
5861 !! options
5862 parsoid=wt2html,wt2wt
5863 !! wikitext
5864 #REDIRECT [[Main_Page]]
5865 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
5866 !! html
5867 <link rel="mw:PageProp/redirect" href="./Main_Page">
5868 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
5869 !! end
5870
5871 !! test
5872 Optional colon in #REDIRECT
5873 !! options
5874 # the colon is archaic syntax. we support it for wt2html, but we
5875 # don't care that it roundtrips back to the modern syntax.
5876 parsoid=wt2html,html2html
5877 !! wikitext
5878 #REDIRECT:[[Main Page]]
5879 !! html
5880 <link rel="mw:PageProp/redirect" href="./Main_Page">
5881 !! end
5882
5883 !! test
5884 Whitespace in #REDIRECT with optional colon
5885 !! options
5886 # the colon and gratuitous whitespace is archaic syntax. we support
5887 # it for wt2html, but we don't care that it roundtrips back to the
5888 # modern syntax (without extra whitespace)
5889 parsoid=wt2html,html2html
5890 !! wikitext
5891
5892 #REDIRECT
5893 :
5894 [[Main Page]]
5895 !! html
5896 <link rel="mw:PageProp/redirect" href="./Main_Page">
5897 !! end
5898
5899 !! test
5900 Piped link in #REDIRECT
5901 !! options
5902 # content after piped link is ignored. we support this syntax,
5903 # but don't care that the piped link is lost when we roundtrip this.
5904 parsoid=wt2html
5905 !! wikitext
5906 #REDIRECT [[Main Page|bar]]
5907 !! html
5908 <link rel="mw:PageProp/redirect" href="./Main_Page">
5909 !! end
5910
5911 !! test
5912 Redirect to category
5913 !! options
5914 parsoid=wt2html
5915 !! wikitext
5916 #REDIRECT [[Category:Foo]]
5917 !! html
5918 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5919 !! end
5920
5921 !! test
5922 Redirect to category with URL encoding
5923 !! options
5924 parsoid=wt2html
5925 !! wikitext
5926 #REDIRECT [[Category%3AFoo]]
5927 !! html
5928 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5929 !! end
5930
5931 !! test
5932 Redirect to category page
5933 !! options
5934 parsoid=wt2html,html2html
5935 !! wikitext
5936 #REDIRECT [[:Category:Foo]]
5937 !! html
5938 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5939 !! end
5940
5941 !! test
5942 Redirect to image page (1)
5943 !! options
5944 parsoid
5945 !! wikitext
5946 #REDIRECT [[File:Wiki.png]]
5947 !! html
5948 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5949 !! end
5950
5951 !! test
5952 Redirect to image page (2)
5953 !! options
5954 parsoid
5955 !! wikitext
5956 #REDIRECT [[Image:Wiki.png]]
5957 !! html
5958 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5959 !! end
5960
5961 !! test
5962 Redirect to language
5963 !! options
5964 parsoid
5965 !! wikitext
5966 #REDIRECT [[en:File:Wiki.png]]
5967 !! html
5968 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5969 !! end
5970
5971 !! test
5972 Redirect to interwiki
5973 !! options
5974 parsoid
5975 !! wikitext
5976 #REDIRECT [[meatball:File:Wiki.png]]
5977 !! html
5978 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5979 !! end
5980
5981 !! test
5982 Non-English #REDIRECT
5983 !! options
5984 parsoid
5985 language=is
5986 !! wikitext
5987 #TILVÍSUN [[Main Page]]
5988 !! html
5989 <link rel="mw:PageProp/redirect" href="./Main_Page">
5990 !! end
5991
5992 !! test
5993 New redirect
5994 !! options
5995 parsoid=html2wt
5996 !! wikitext
5997 Foo
5998 #REDIRECT [[Foo]]
5999 !! html
6000 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6001 !! end
6002
6003 ##
6004 ## XHTML tidiness
6005 ###
6006
6007 !! test
6008 <br> to <br />
6009 !! wikitext
6010 1<br>2<br />3
6011 !! html
6012 <p>1<br />2<br />3
6013 </p>
6014 !! end
6015
6016 !! test
6017 Broken br tag sanitization
6018 !! wikitext
6019 </br>
6020 !! html/php
6021 <p>&lt;/br&gt;
6022 </p>
6023 !! end
6024
6025 # TODO: Fix html2html mode (bug 51055)!
6026 !! test
6027 Parsoid: Broken br tag recognition
6028 !! options
6029 parsoid=wt2html
6030 !! wikitext
6031 </br>
6032 !! html/parsoid
6033 <p><br></p>
6034 !! end
6035
6036 !! test
6037 Incorrecly removing closing slashes from correctly formed XHTML
6038 !! wikitext
6039 <br style="clear:both;" />
6040 !! html
6041 <p><br style="clear:both;" />
6042 </p>
6043 !! end
6044
6045 !! test
6046 Failing to transform badly formed HTML into correct XHTML
6047 !! wikitext
6048 <br style="clear: left;">
6049 <br style="clear: right;">
6050 <br style="clear: both;">
6051 !! html
6052 <p><br style="clear: left;" />
6053 <br style="clear: right;" />
6054 <br style="clear: both;" />
6055 </p>
6056 !!end
6057
6058 !! test
6059 Handling html with a div self-closing tag
6060 !! wikitext
6061 <div title />
6062 <div title/>
6063 <div title/ >
6064 <div title=bar />
6065 <div title=bar/>
6066 <div title=bar/ >
6067 !! html
6068 <p>&lt;div title /&gt;
6069 &lt;div title/&gt;
6070 </p>
6071 <div>
6072 <p>&lt;div title=bar /&gt;
6073 &lt;div title=bar/&gt;
6074 </p>
6075 <div title="bar/"></div>
6076 </div>
6077
6078 !! end
6079
6080 !! test
6081 Handling html with a br self-closing tag
6082 !! wikitext
6083 <br title />
6084 <br title/>
6085 <br title/ >
6086 <br title=bar />
6087 <br title=bar/>
6088 <br title=bar/ >
6089 !! html
6090 <p><br title="title" />
6091 <br title="title" />
6092 <br />
6093 <br title="bar" />
6094 <br title="bar" />
6095 <br title="bar/" />
6096 </p>
6097 !! end
6098
6099 !! test
6100 Horizontal ruler (should it add that extra space?)
6101 !! wikitext
6102 <hr>
6103 <hr >
6104 foo <hr
6105 > bar
6106 !! html
6107 <hr />
6108 <hr />
6109 foo <hr /> bar
6110
6111 !! end
6112
6113 !! test
6114 Horizontal ruler -- 4+ dashes render hr
6115 !! wikitext
6116 ----
6117 !! html
6118 <hr />
6119
6120 !! end
6121
6122 !! test
6123 Horizontal ruler -- eats additional dashes on the same line
6124 !! wikitext
6125 ---------
6126 !! html
6127 <hr />
6128
6129 !! end
6130
6131 !! test
6132 Horizontal ruler -- does not collapse dashes on consecutive lines
6133 !! wikitext
6134 ----
6135 ----
6136 !! html
6137 <hr />
6138 <hr />
6139
6140 !! end
6141
6142 !! test
6143 Horizontal ruler -- <4 dashes render as plain text
6144 !! wikitext
6145 ---
6146 !! html
6147 <p>---
6148 </p>
6149 !! end
6150
6151 !! test
6152 Horizontal ruler -- Supports content following dashes on same line
6153 !! wikitext
6154 ---- Foo
6155 !! html
6156 <hr /> Foo
6157
6158 !! end
6159
6160 ###
6161 ### Block-level elements
6162 ###
6163 !! test
6164 Common list
6165 !! wikitext
6166 *Common list
6167 * item 2
6168 *item 3
6169 !! html
6170 <ul>
6171 <li>Common list
6172 </li>
6173 <li> item 2
6174 </li>
6175 <li>item 3
6176 </li>
6177 </ul>
6178
6179 !! end
6180
6181 !! test
6182 Numbered list
6183 !! wikitext
6184 #Numbered list
6185 #item 2
6186 # item 3
6187 !! html
6188 <ol>
6189 <li>Numbered list
6190 </li>
6191 <li>item 2
6192 </li>
6193 <li> item 3
6194 </li>
6195 </ol>
6196
6197 !! end
6198
6199 !! test
6200 Mixed list
6201 !! wikitext
6202 *Mixed list
6203 *# with numbers
6204 ** and bullets
6205 *# and numbers
6206 *bullets again
6207 **bullet level 2
6208 ***bullet level 3
6209 ***#Number on level 4
6210 **bullet level 2
6211 **#Number on level 3
6212 **#Number on level 3
6213 *#number level 2
6214 *Level 1
6215 *** Level 3
6216 #** Level 3, but ordered
6217 !! html
6218 <ul>
6219 <li>Mixed list
6220 <ol>
6221 <li> with numbers
6222 </li>
6223 </ol>
6224 <ul>
6225 <li> and bullets
6226 </li>
6227 </ul>
6228 <ol>
6229 <li> and numbers
6230 </li>
6231 </ol>
6232 </li>
6233 <li>bullets again
6234 <ul>
6235 <li>bullet level 2
6236 <ul>
6237 <li>bullet level 3
6238 <ol>
6239 <li>Number on level 4
6240 </li>
6241 </ol>
6242 </li>
6243 </ul>
6244 </li>
6245 <li>bullet level 2
6246 <ol>
6247 <li>Number on level 3
6248 </li>
6249 <li>Number on level 3
6250 </li>
6251 </ol>
6252 </li>
6253 </ul>
6254 <ol>
6255 <li>number level 2
6256 </li>
6257 </ol>
6258 </li>
6259 <li>Level 1
6260 <ul>
6261 <li><ul>
6262 <li> Level 3
6263 </li>
6264 </ul>
6265 </li>
6266 </ul>
6267 </li>
6268 </ul>
6269 <ol>
6270 <li><ul>
6271 <li><ul>
6272 <li> Level 3, but ordered
6273 </li>
6274 </ul>
6275 </li>
6276 </ul>
6277 </li>
6278 </ol>
6279
6280 !! end
6281
6282 !! test
6283 Nested lists 1
6284 !! wikitext
6285 *foo
6286 **bar
6287 !! html
6288 <ul>
6289 <li>foo
6290 <ul>
6291 <li>bar
6292 </li>
6293 </ul>
6294 </li>
6295 </ul>
6296
6297 !! end
6298
6299 !! test
6300 Nested lists 2
6301 !! wikitext
6302 **foo
6303 *bar
6304 !! html
6305 <ul>
6306 <li><ul>
6307 <li>foo
6308 </li>
6309 </ul>
6310 </li>
6311 <li>bar
6312 </li>
6313 </ul>
6314
6315 !! end
6316
6317 !! test
6318 Nested lists 3 (first element empty)
6319 !! wikitext
6320 *
6321 **bar
6322 !! html
6323 <ul>
6324 <li>
6325 <ul>
6326 <li>bar
6327 </li>
6328 </ul>
6329 </li>
6330 </ul>
6331
6332 !! end
6333
6334 !! test
6335 Nested lists 4 (first element empty)
6336 !! wikitext
6337 **
6338 *bar
6339 !! html
6340 <ul>
6341 <li><ul>
6342 <li>
6343 </li>
6344 </ul>
6345 </li>
6346 <li>bar
6347 </li>
6348 </ul>
6349
6350 !! end
6351
6352 !! test
6353 Nested lists 5 (both elements empty)
6354 !! wikitext
6355 **
6356 *
6357 !! html
6358 <ul>
6359 <li><ul>
6360 <li>
6361 </li>
6362 </ul>
6363 </li>
6364 <li>
6365 </li>
6366 </ul>
6367
6368 !! end
6369
6370 !! test
6371 Nested lists 6 (both elements empty)
6372 !! wikitext
6373 *
6374 **
6375 !! html
6376 <ul>
6377 <li>
6378 <ul>
6379 <li>
6380 </li>
6381 </ul>
6382 </li>
6383 </ul>
6384
6385 !! end
6386
6387 !! test
6388 Nested lists 7 (skip initial nesting levels)
6389 !! wikitext
6390 *** foo
6391 !! html
6392 <ul>
6393 <li><ul>
6394 <li><ul>
6395 <li> foo
6396 </li>
6397 </ul>
6398 </li>
6399 </ul>
6400 </li>
6401 </ul>
6402
6403 !! end
6404
6405 !! test
6406 Nested lists 8 (multiple nesting transitions)
6407 !! wikitext
6408 * foo
6409 *** bar
6410 ** baz
6411 * boo
6412 !! html
6413 <ul>
6414 <li> foo
6415 <ul>
6416 <li><ul>
6417 <li> bar
6418 </li>
6419 </ul>
6420 </li>
6421 <li> baz
6422 </li>
6423 </ul>
6424 </li>
6425 <li> boo
6426 </li>
6427 </ul>
6428
6429 !! end
6430
6431 !! test
6432 1. Lists with start-of-line-transparent tokens before bullets: Comments
6433 !! wikitext
6434 *foo
6435 *<!--cmt-->bar
6436 <!--cmt-->*baz
6437 !! html
6438 <ul>
6439 <li>foo
6440 </li>
6441 <li>bar
6442 </li>
6443 <li>baz
6444 </li>
6445 </ul>
6446
6447 !! end
6448
6449 !! test
6450 2. Lists with start-of-line-transparent tokens before bullets: Template close
6451 !! wikitext
6452 *foo {{echo|bar
6453 }}*baz
6454 !! html
6455 <ul>
6456 <li>foo bar
6457 </li>
6458 <li>baz
6459 </li>
6460 </ul>
6461
6462 !! end
6463
6464 !! test
6465 List items are not parsed correctly following a <pre> block (bug 785)
6466 !! wikitext
6467 * <pre>foo</pre>
6468 * <pre>bar</pre>
6469 * zar
6470 !! html
6471 <ul>
6472 <li> <pre>foo</pre>
6473 </li>
6474 <li> <pre>bar</pre>
6475 </li>
6476 <li> zar
6477 </li>
6478 </ul>
6479
6480 !! end
6481
6482 !! test
6483 List items from template
6484 !! wikitext
6485
6486 {{inner list}}
6487 * item 2
6488
6489 * item 0
6490 {{inner list}}
6491 * item 2
6492
6493 * item 0
6494 * notSOL{{inner list}}
6495 * item 2
6496 !! html
6497 <ul>
6498 <li> item 1
6499 </li>
6500 <li> item 2
6501 </li>
6502 </ul>
6503 <ul>
6504 <li> item 0
6505 </li>
6506 <li> item 1
6507 </li>
6508 <li> item 2
6509 </li>
6510 </ul>
6511 <ul>
6512 <li> item 0
6513 </li>
6514 <li> notSOL
6515 </li>
6516 <li> item 1
6517 </li>
6518 <li> item 2
6519 </li>
6520 </ul>
6521
6522 !! end
6523
6524 !! test
6525 List interrupted by empty line or heading
6526 !! wikitext
6527 * foo
6528
6529 ** bar
6530 == A heading ==
6531 * Another list item
6532 !! html
6533 <ul>
6534 <li> foo
6535 </li>
6536 </ul>
6537 <ul>
6538 <li><ul>
6539 <li> bar
6540 </li>
6541 </ul>
6542 </li>
6543 </ul>
6544 <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>
6545 <ul>
6546 <li> Another list item
6547 </li>
6548 </ul>
6549
6550 !!end
6551
6552 !!test
6553 Multiple list tags generated by templates
6554 !! wikitext
6555 {{echo|<li>}}a
6556 {{echo|<li>}}b
6557 {{echo|<li>}}c
6558 !! html
6559 <li>a
6560 <li>b
6561 <li>c</li>
6562 </li>
6563 </li>
6564
6565 !!end
6566
6567 !!test
6568 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6569 !! wikitext
6570 *a
6571 <!--This line will NOT split the list-->
6572 *b
6573 <!--This line will NOT split the list either-->
6574 *c
6575 <!--foo--> <!----> <!--This line NOT split the list either-->
6576 *d
6577 !! html
6578 <ul>
6579 <li>a
6580 </li>
6581 <li>b
6582 </li>
6583 <li>c
6584 </li>
6585 <li>d
6586 </li>
6587 </ul>
6588
6589 !!end
6590
6591 !!test
6592 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6593 !! wikitext
6594 *a
6595 <!--This line will NOT split the list-->
6596 *b
6597 <!--This line will NOT split the list either-->
6598 *c
6599 <!--foo--> <!----> <!--This line NOT split the list
6600 either-->
6601 *d
6602 !! html
6603 <ul>
6604 <li>a
6605 </li>
6606 <li>b
6607 </li>
6608 <li>c
6609 </li>
6610 <li>d
6611 </li>
6612 </ul>
6613
6614 !!end
6615
6616 !!test
6617 Test the li-hack
6618 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6619 !!options
6620 parsoid=wt2html,wt2wt
6621 !! wikitext
6622 * foo
6623 * <li>li-hack
6624 * {{echo|<li>templated li-hack}}
6625 * <!--foo--> <li> unsupported li-hack with preceding comments
6626
6627 <ul>
6628 <li><li>not a li-hack
6629 </li>
6630 </ul>
6631 !! html
6632 <ul>
6633 <li> foo</li>
6634 <li>li-hack</li>
6635 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
6636 <li> <!--foo--> </li>
6637 <li> li-hack with preceding comments</li>
6638 </ul>
6639
6640 <ul>
6641 <li></li>
6642 <li>not a li-hack
6643 </li>
6644 </ul>
6645 !!end
6646
6647 !! test
6648 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6649 !! options
6650 parsoid
6651 !! wikitext
6652 # foo
6653 ## bar
6654 * foo
6655 ** bar
6656 : foo
6657 :: bar
6658 !! html
6659 <ol>
6660 <li> foo<ol>
6661 <li> bar</li>
6662 </ol></li>
6663 </ol><ul>
6664 <li> foo<ul>
6665 <li> bar</li>
6666 </ul></li>
6667 </ul><dl>
6668 <dd> foo<dl>
6669 <dd> bar</dd>
6670 </dl></dd>
6671 </dl>
6672 !! end
6673
6674 !! test
6675 Parsoid: Test of whitespace serialization with Templated bullets
6676 !! options
6677 parsoid
6678 !! wikitext
6679 * {{bullet}}
6680 !! html
6681 <ul>
6682 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6683 </ul>
6684 !! end
6685
6686 # ------------------------------------------------------------------------
6687 # The next set of tests are about Parsoid's ability to handle badly nested
6688 # tags (parse, minimize scope of fixup, and roundtrip back)
6689 # ------------------------------------------------------------------------
6690
6691 !! test
6692 Unbalanced closing block tags break a list
6693 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6694 !! wikitext
6695 <div>
6696 *a</div><div>
6697 *b</div>
6698 !! html/parsoid
6699 <div>
6700 <ul>
6701 <li>a
6702 </li>
6703 </ul></div><div>
6704 <ul>
6705 <li>b
6706 </li>
6707 </ul></div>
6708 !! end
6709
6710 !! test
6711 Unbalanced closing non-block tags don't break a list
6712 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6713 !! wikitext
6714 <span>
6715 *a</span><span>
6716 *b</span>
6717 !! html/parsoid
6718 <p><span></span>
6719 </p>
6720 <ul>
6721 <li>a<span></span>
6722 </li>
6723 <li>b
6724 </li>
6725 </ul>
6726 !! end
6727
6728 !! test
6729 Unclosed formatting tags that straddle lists are closed and reopened
6730 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6731 !! wikitext
6732 # <s> a
6733 # b </s>
6734 !! html/parsoid
6735 <ol>
6736 <li> <s> a </s>
6737 </li>
6738 <li> <s> b </s>
6739 </li>
6740 </ol>
6741 !! end
6742
6743 !!test
6744 List embedded in a non-block tag
6745 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6746 !! wikitext
6747 <small>
6748 * foo
6749 </small>
6750 !! html/parsoid
6751 <p><small></small></p>
6752 <small>
6753 <ul>
6754 <li> foo</li>
6755 </ul>
6756 </small>
6757 <p><small></small></p>
6758 !!end
6759
6760 !! test
6761 Table with missing opening <tr> tag
6762 !! options
6763 parsoid=wt2html,wt2wt
6764 !! wikitext
6765 <table>
6766 <td>foo</td>
6767 </tr>
6768 </table>
6769 !! html/parsoid
6770 <table>
6771 <tr>
6772 <td>foo</td>
6773 </tr>
6774 </table>
6775 !! end
6776
6777 ###
6778 ### Magic Words
6779 ###
6780
6781 # Note that the current date is hard-coded as
6782 # 1970-01-01T00:02:03Z (a Thursday)
6783 # when running parser tests. The timezone is also fixed to GMT, so
6784 # local date will be identical to current date.
6785
6786 !! test
6787 Magic Word: {{CURRENTDAY}}
6788 !! wikitext
6789 {{CURRENTDAY}}
6790 !! html
6791 <p>1
6792 </p>
6793 !! end
6794
6795 !! test
6796 Magic Word: {{CURRENTDAY2}}
6797 !! wikitext
6798 {{CURRENTDAY2}}
6799 !! html
6800 <p>01
6801 </p>
6802 !! end
6803
6804 !! test
6805 Magic Word: {{CURRENTDAYNAME}}
6806 !! wikitext
6807 {{CURRENTDAYNAME}}
6808 !! html
6809 <p>Thursday
6810 </p>
6811 !! end
6812
6813 !! test
6814 Magic Word: {{CURRENTDOW}}
6815 !! wikitext
6816 {{CURRENTDOW}}
6817 !! html
6818 <p>4
6819 </p>
6820 !! end
6821
6822 !! test
6823 Magic Word: {{CURRENTMONTH}}
6824 !! wikitext
6825 {{CURRENTMONTH}}
6826 !! html
6827 <p>01
6828 </p>
6829 !! end
6830
6831 !! test
6832 Magic Word: {{CURRENTMONTH1}}
6833 !! wikitext
6834 {{CURRENTMONTH1}}
6835 !! html
6836 <p>1
6837 </p>
6838 !! end
6839
6840 !! test
6841 Magic Word: {{CURRENTMONTHABBREV}}
6842 !! wikitext
6843 {{CURRENTMONTHABBREV}}
6844 !! html
6845 <p>Jan
6846 </p>
6847 !! end
6848
6849 !! test
6850 Magic Word: {{CURRENTMONTHNAME}}
6851 !! wikitext
6852 {{CURRENTMONTHNAME}}
6853 !! html
6854 <p>January
6855 </p>
6856 !! end
6857
6858 !! test
6859 Magic Word: {{CURRENTMONTHNAMEGEN}}
6860 !! wikitext
6861 {{CURRENTMONTHNAMEGEN}}
6862 !! html
6863 <p>January
6864 </p>
6865 !! end
6866
6867 !! test
6868 Magic Word: {{CURRENTTIME}}
6869 !! wikitext
6870 {{CURRENTTIME}}
6871 !! html
6872 <p>00:02
6873 </p>
6874 !! end
6875
6876 !! test
6877 Magic Word: {{CURRENTHOUR}}
6878 !! wikitext
6879 {{CURRENTHOUR}}
6880 !! html
6881 <p>00
6882 </p>
6883 !! end
6884
6885 !! test
6886 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6887 !! wikitext
6888 {{CURRENTWEEK}}
6889 !! html
6890 <p>1
6891 </p>
6892 !! end
6893
6894 !! test
6895 Magic Word: {{CURRENTYEAR}}
6896 !! wikitext
6897 {{CURRENTYEAR}}
6898 !! html
6899 <p>1970
6900 </p>
6901 !! end
6902
6903 !! test
6904 Magic Word: {{CURRENTTIMESTAMP}}
6905 !! wikitext
6906 {{CURRENTTIMESTAMP}}
6907 !! html
6908 <p>19700101000203
6909 </p>
6910 !! end
6911
6912 !! test
6913 Magic Words LOCAL (UTC)
6914 !! wikitext
6915 * {{LOCALMONTH}}
6916 * {{LOCALMONTH1}}
6917 * {{LOCALMONTHNAME}}
6918 * {{LOCALMONTHNAMEGEN}}
6919 * {{LOCALMONTHABBREV}}
6920 * {{LOCALDAY}}
6921 * {{LOCALDAY2}}
6922 * {{LOCALDAYNAME}}
6923 * {{LOCALYEAR}}
6924 * {{LOCALTIME}}
6925 * {{LOCALHOUR}}
6926 * {{LOCALWEEK}}
6927 * {{LOCALDOW}}
6928 * {{LOCALTIMESTAMP}}
6929 !! html
6930 <ul>
6931 <li> 01
6932 </li>
6933 <li> 1
6934 </li>
6935 <li> January
6936 </li>
6937 <li> January
6938 </li>
6939 <li> Jan
6940 </li>
6941 <li> 1
6942 </li>
6943 <li> 01
6944 </li>
6945 <li> Thursday
6946 </li>
6947 <li> 1970
6948 </li>
6949 <li> 00:02
6950 </li>
6951 <li> 00
6952 </li>
6953 <li> 1
6954 </li>
6955 <li> 4
6956 </li>
6957 <li> 19700101000203
6958 </li>
6959 </ul>
6960
6961 !! end
6962
6963 !! test
6964 Magic Word: {{FULLPAGENAME}}
6965 !! options
6966 title=[[User:Ævar Arnfjörð Bjarmason]]
6967 !! wikitext
6968 {{FULLPAGENAME}}
6969 !! html
6970 <p>User:Ævar Arnfjörð Bjarmason
6971 </p>
6972 !! end
6973
6974 !! test
6975 Magic Word: {{FULLPAGENAMEE}}
6976 !! options
6977 title=[[User:Ævar Arnfjörð Bjarmason]]
6978 !! wikitext
6979 {{FULLPAGENAMEE}}
6980 !! html
6981 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6982 </p>
6983 !! end
6984
6985 !! test
6986 Magic Word: {{TALKSPACE}}
6987 !! options
6988 title=[[User:Ævar Arnfjörð Bjarmason]]
6989 !! wikitext
6990 {{TALKSPACE}}
6991 !! html
6992 <p>User talk
6993 </p>
6994 !! end
6995
6996 !! test
6997 Magic Word: {{TALKSPACE}}, same namespace
6998 !! options
6999 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7000 !! wikitext
7001 {{TALKSPACE}}
7002 !! html
7003 <p>User talk
7004 </p>
7005 !! end
7006
7007 !! test
7008 Magic Word: {{TALKSPACE}}, main namespace
7009 !! options
7010 title=[[Parser Test]]
7011 !! wikitext
7012 {{TALKSPACE}}
7013 !! html
7014 <p>Talk
7015 </p>
7016 !! end
7017
7018 !! test
7019 Magic Word: {{TALKSPACEE}}
7020 !! options
7021 title=[[User:Ævar Arnfjörð Bjarmason]]
7022 !! wikitext
7023 {{TALKSPACEE}}
7024 !! html
7025 <p>User_talk
7026 </p>
7027 !! end
7028
7029 !! test
7030 Magic Word: {{SUBJECTSPACE}}
7031 !! options
7032 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7033 !! wikitext
7034 {{SUBJECTSPACE}}
7035 !! html
7036 <p>User
7037 </p>
7038 !! end
7039
7040 !! test
7041 Magic Word: {{SUBJECTSPACE}}, same namespace
7042 !! options
7043 title=[[User:Ævar Arnfjörð Bjarmason]]
7044 !! wikitext
7045 {{SUBJECTSPACE}}
7046 !! html
7047 <p>User
7048 </p>
7049 !! end
7050
7051 !! test
7052 Magic Word: {{SUBJECTSPACE}}, main namespace
7053 !! options
7054 title=[[Parser Test]]
7055 !! wikitext
7056 {{SUBJECTSPACE}}
7057 !! html
7058
7059 !! end
7060
7061 !! test
7062 Magic Word: {{SUBJECTSPACEE}}
7063 !! options
7064 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7065 !! wikitext
7066 {{SUBJECTSPACEE}}
7067 !! html
7068 <p>User
7069 </p>
7070 !! end
7071
7072 !! test
7073 Magic Word: {{NAMESPACE}}
7074 !! options
7075 title=[[User:Ævar Arnfjörð Bjarmason]]
7076 !! wikitext
7077 {{NAMESPACE}}
7078 !! html
7079 <p>User
7080 </p>
7081 !! end
7082
7083 !! test
7084 Magic Word: {{NAMESPACEE}}
7085 !! options
7086 title=[[User:Ævar Arnfjörð Bjarmason]]
7087 !! wikitext
7088 {{NAMESPACEE}}
7089 !! html
7090 <p>User
7091 </p>
7092 !! end
7093
7094 !! test
7095 Magic Word: {{NAMESPACENUMBER}}
7096 !! options
7097 title=[[User:Ævar Arnfjörð Bjarmason]]
7098 !! wikitext
7099 {{NAMESPACENUMBER}}
7100 !! html
7101 <p>2
7102 </p>
7103 !! end
7104
7105 !! test
7106 Magic Word: {{SUBPAGENAME}}
7107 !! options
7108 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7109 !! wikitext
7110 {{SUBPAGENAME}}
7111 !! html
7112 <p>sub ö
7113 </p>
7114 !! end
7115
7116 !! test
7117 Magic Word: {{SUBPAGENAMEE}}
7118 !! options
7119 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7120 !! wikitext
7121 {{SUBPAGENAMEE}}
7122 !! html
7123 <p>sub_%C3%B6
7124 </p>
7125 !! end
7126
7127 !! test
7128 Magic Word: {{ROOTPAGENAME}}
7129 !! options
7130 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7131 !! wikitext
7132 {{ROOTPAGENAME}}
7133 !! html
7134 <p>Ævar Arnfjörð Bjarmason
7135 </p>
7136 !! end
7137
7138 !! test
7139 Magic Word: {{ROOTPAGENAMEE}}
7140 !! options
7141 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7142 !! wikitext
7143 {{ROOTPAGENAMEE}}
7144 !! html
7145 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7146 </p>
7147 !! end
7148
7149 !! test
7150 Magic Word: {{BASEPAGENAME}}
7151 !! options
7152 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7153 !! wikitext
7154 {{BASEPAGENAME}}
7155 !! html
7156 <p>Ævar Arnfjörð Bjarmason
7157 </p>
7158 !! end
7159
7160 !! test
7161 Magic Word: {{BASEPAGENAMEE}}
7162 !! options
7163 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7164 !! wikitext
7165 {{BASEPAGENAMEE}}
7166 !! html
7167 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7168 </p>
7169 !! end
7170
7171 !! test
7172 Magic Word: {{TALKPAGENAME}}
7173 !! options
7174 title=[[User:Ævar Arnfjörð Bjarmason]]
7175 !! wikitext
7176 {{TALKPAGENAME}}
7177 !! html
7178 <p>User talk:Ævar Arnfjörð Bjarmason
7179 </p>
7180 !! end
7181
7182 !! test
7183 Magic Word: {{TALKPAGENAMEE}}
7184 !! options
7185 title=[[User:Ævar Arnfjörð Bjarmason]]
7186 !! wikitext
7187 {{TALKPAGENAMEE}}
7188 !! html
7189 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7190 </p>
7191 !! end
7192
7193 !! test
7194 Magic Word: {{SUBJECTPAGENAME}}
7195 !! options
7196 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7197 !! wikitext
7198 {{SUBJECTPAGENAME}}
7199 !! html
7200 <p>User:Ævar Arnfjörð Bjarmason
7201 </p>
7202 !! end
7203
7204 !! test
7205 Magic Word: {{SUBJECTPAGENAMEE}}
7206 !! options
7207 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7208 !! wikitext
7209 {{SUBJECTPAGENAMEE}}
7210 !! html
7211 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7212 </p>
7213 !! end
7214
7215 !! test
7216 Magic Word: {{NUMBEROFFILES}}
7217 !! wikitext
7218 {{NUMBEROFFILES}}
7219 !! html
7220 <p>4
7221 </p>
7222 !! end
7223
7224 !! test
7225 Magic Word: {{PAGENAME}}
7226 !! options
7227 title=[[User:Ævar Arnfjörð Bjarmason]]
7228 !! wikitext
7229 {{PAGENAME}}
7230 !! html
7231 <p>Ævar Arnfjörð Bjarmason
7232 </p>
7233 !! end
7234
7235 !! test
7236 Magic Word: {{PAGENAME}} with metacharacters
7237 !! options
7238 title=[['foo & bar = baz']]
7239 !! wikitext
7240 ''{{PAGENAME}}''
7241 !! html
7242 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7243 </p>
7244 !! end
7245
7246 !! test
7247 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7248 !! options
7249 title=[[*RFC 1234 http://example.com/]]
7250 !! wikitext
7251 {{PAGENAME}}
7252 !! html
7253 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7254 </p>
7255 !! end
7256
7257 !! test
7258 Magic Word: {{PAGENAMEE}}
7259 !! options
7260 title=[[User:Ævar Arnfjörð Bjarmason]]
7261 !! wikitext
7262 {{PAGENAMEE}}
7263 !! html
7264 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7265 </p>
7266 !! end
7267
7268 !! test
7269 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7270 !! options
7271 title=[[*RFC 1234 http://example.com/]]
7272 !! wikitext
7273 {{PAGENAMEE}}
7274 !! html
7275 <p>&#42;RFC_1234_http&#58;//example.com/
7276 </p>
7277 !! end
7278
7279 !! test
7280 Magic Word: {{REVISIONID}}
7281 !! wikitext
7282 {{REVISIONID}}
7283 !! html
7284 <p>1337
7285 </p>
7286 !! end
7287
7288 !! test
7289 Magic Word: {{SCRIPTPATH}}
7290 !! wikitext
7291 {{SCRIPTPATH}}
7292 !! html
7293 <p>/
7294 </p>
7295 !! end
7296
7297 !! test
7298 Magic Word: {{STYLEPATH}}
7299 !! wikitext
7300 {{STYLEPATH}}
7301 !! html
7302 <p>/skins
7303 </p>
7304 !! end
7305
7306 !! test
7307 Magic Word: {{SERVER}}
7308 !! wikitext
7309 {{SERVER}}
7310 !! html
7311 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7312 </p>
7313 !! end
7314
7315 !! test
7316 Magic Word: {{SERVERNAME}}
7317 !! wikitext
7318 {{SERVERNAME}}
7319 !! html
7320 <p>example.org
7321 </p>
7322 !! end
7323
7324 !! test
7325 Magic Word: {{SITENAME}}
7326 !! wikitext
7327 {{SITENAME}}
7328 !! html
7329 <p>MediaWiki
7330 </p>
7331 !! end
7332
7333 !! test
7334 Case-sensitive magic words, when cased differently, should just be template transclusions
7335 !! wikitext
7336 {{CurrentMonth}}
7337 {{currentday}}
7338 {{cURreNTweEK}}
7339 {{currentHour}}
7340 !! html
7341 <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>
7342 <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>
7343 <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>
7344 <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>
7345 </p>
7346 !! end
7347
7348 !! test
7349 Case-insensitive magic words should still work with weird casing.
7350 !! wikitext
7351 {{sErVeRNaMe}}
7352 {{LCFirst:AOEU}}
7353 {{ucFIRST:aoeu}}
7354 {{SERver}}
7355 !! html
7356 <p>example.org
7357 aOEU
7358 Aoeu
7359 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7360 </p>
7361 !! end
7362
7363 !! test
7364 Namespace 1 {{ns:1}}
7365 !! wikitext
7366 {{ns:1}}
7367 !! html
7368 <p>Talk
7369 </p>
7370 !! end
7371
7372 !! test
7373 Namespace 1 {{ns:01}}
7374 !! wikitext
7375 {{ns:01}}
7376 !! html
7377 <p>Talk
7378 </p>
7379 !! end
7380
7381 !! test
7382 Namespace 0 {{ns:0}} (bug 4783)
7383 !! wikitext
7384 {{ns:0}}
7385 !! html
7386
7387 !! end
7388
7389 !! test
7390 Namespace 0 {{ns:00}} (bug 4783)
7391 !! wikitext
7392 {{ns:00}}
7393 !! html
7394
7395 !! end
7396
7397 !! test
7398 Namespace -1 {{ns:-1}}
7399 !! wikitext
7400 {{ns:-1}}
7401 !! html
7402 <p>Special
7403 </p>
7404 !! end
7405
7406 !! test
7407 Namespace User {{ns:User}}
7408 !! wikitext
7409 {{ns:User}}
7410 !! html
7411 <p>User
7412 </p>
7413 !! end
7414
7415 !! test
7416 Namespace User talk {{ns:User_talk}}
7417 !! wikitext
7418 {{ns:User_talk}}
7419 !! html
7420 <p>User talk
7421 </p>
7422 !! end
7423
7424 !! test
7425 Namespace User talk {{ns:uSeR tAlK}}
7426 !! wikitext
7427 {{ns:uSeR tAlK}}
7428 !! html
7429 <p>User talk
7430 </p>
7431 !! end
7432
7433 !! test
7434 Namespace File {{ns:File}}
7435 !! wikitext
7436 {{ns:File}}
7437 !! html
7438 <p>File
7439 </p>
7440 !! end
7441
7442 !! test
7443 Namespace File {{ns:Image}}
7444 !! wikitext
7445 {{ns:Image}}
7446 !! html
7447 <p>File
7448 </p>
7449 !! end
7450
7451 !! test
7452 Namespace (lang=de) Benutzer {{ns:User}}
7453 !! options
7454 language=de
7455 !! wikitext
7456 {{ns:User}}
7457 !! html
7458 <p>Benutzer
7459 </p>
7460 !! end
7461
7462 !! test
7463 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7464 !! options
7465 language=de
7466 !! wikitext
7467 {{ns:3}}
7468 !! html
7469 <p>Benutzer Diskussion
7470 </p>
7471 !! end
7472
7473
7474 !! test
7475 Urlencode
7476 !! wikitext
7477 {{urlencode:hi world?!}}
7478 {{urlencode:hi world?!|WIKI}}
7479 {{urlencode:hi world?!|PATH}}
7480 {{urlencode:hi world?!|QUERY}}
7481 !! html
7482 <p>hi+world%3F%21
7483 hi_world%3F!
7484 hi%20world%3F%21
7485 hi+world%3F%21
7486 </p>
7487 !! end
7488
7489 !! test
7490 Magic Word: prioritize type info over data-parsoid
7491 !! options
7492 parsoid=html2wt
7493 !! wikitext
7494 __FORCETOC__
7495 !! html
7496 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7497 !! end
7498
7499 !! test
7500 Magic Word: serialize on separate line (parsoid)
7501 !! options
7502 parsoid=wt2wt,html2wt
7503 !! wikitext
7504 foo
7505 __NOTOC__
7506 bar
7507 !! html
7508 foo<meta property="mw:PageProp/notoc"/>bar
7509 !! end
7510
7511 !! test
7512 Magic Word: rt non-english wikis
7513 !! options
7514 parsoid=wt2wt
7515 language=de
7516 !! wikitext
7517 __NOEDITSECTION__
7518 !! html
7519 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7520 !! end
7521
7522 ###
7523 ### Magic links
7524 ###
7525 !! test
7526 Magic links: internal link to RFC (bug 479)
7527 !! wikitext
7528 [[RFC 123]]
7529 !! html
7530 <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>
7531 </p>
7532 !! end
7533
7534 !! test
7535 Magic links: RFC (bug 479)
7536 !! wikitext
7537 RFC 822
7538 !! html
7539 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7540 </p>
7541 !! end
7542
7543 !! test
7544 Magic links: ISBN (bug 1937)
7545 !! wikitext
7546 ISBN 0-306-40615-2
7547 !! html
7548 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7549 </p>
7550 !! end
7551
7552 !! test
7553 Magic links: PMID incorrectly converts space to underscore
7554 !! wikitext
7555 PMID 1234
7556 !! html
7557 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7558 </p>
7559 !! end
7560
7561 ###
7562 ### Templates
7563 ####
7564
7565 !! test
7566 Nonexistent template
7567 !! wikitext
7568 {{thistemplatedoesnotexist}}
7569 !! html
7570 <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>
7571 </p>
7572 !! end
7573
7574 !! test
7575 Template with invalid target containing tags
7576 !! wikitext
7577 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7578 !! html
7579 <p>{{a<b>b</b>|foo|a=b|a = b}}
7580 </p>
7581 !! end
7582
7583 !! test
7584 Template with invalid target containing unclosed tag
7585 !! wikitext
7586 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7587 !! html
7588 <p>{{a<b>|foo|a=b|a = b}}</b>
7589 </p>
7590 !! end
7591
7592 !! test
7593 Template with invalid target containing wikilink
7594 !! wikitext
7595 {{[[Main Page]]}}
7596 !! html/php
7597 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7598 </p>
7599 !! html/parsoid
7600 <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>
7601 !! end
7602
7603 !! article
7604 Template:test
7605 !! text
7606 This is a test template
7607 !! endarticle
7608
7609 !! test
7610 Simple template
7611 !! wikitext
7612 {{test}}
7613 !! html
7614 <p>This is a test template
7615 </p>
7616 !! end
7617
7618 !! test
7619 Template with explicit namespace
7620 !! wikitext
7621 {{Template:test}}
7622 !! html
7623 <p>This is a test template
7624 </p>
7625 !! end
7626
7627
7628 !! article
7629 Template:paramtest
7630 !! text
7631 This is a test template with parameter {{{param}}}
7632 !! endarticle
7633
7634 !! test
7635 Template parameter
7636 !! wikitext
7637 {{paramtest|param=foo}}
7638 !! html
7639 <p>This is a test template with parameter foo
7640 </p>
7641 !! end
7642
7643 !! article
7644 Template:paramtestnum
7645 !! text
7646 [[{{{1}}}|{{{2}}}]]
7647 !! endarticle
7648
7649 !! test
7650 Template unnamed parameter
7651 !! wikitext
7652 {{paramtestnum|Main Page|the main page}}
7653 !! html
7654 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7655 </p>
7656 !! end
7657
7658 !! article
7659 Template:templatesimple
7660 !! text
7661 (test)
7662 !! endarticle
7663
7664 !! article
7665 Template:templateredirect
7666 !! text
7667 #redirect [[Template:templatesimple]]
7668 !! endarticle
7669
7670 !! article
7671 Template:templateasargtestnum
7672 !! text
7673 {{{{{1}}}}}
7674 !! endarticle
7675
7676 !! article
7677 Template:templateasargtest
7678 !! text
7679 {{template{{{templ}}}}}
7680 !! endarticle
7681
7682 !! article
7683 Template:templateasargtest2
7684 !! text
7685 {{{{{templ}}}}}
7686 !! endarticle
7687
7688 !! test
7689 Template with template name as unnamed argument
7690 !! wikitext
7691 {{templateasargtestnum|templatesimple}}
7692 !! html
7693 <p>(test)
7694 </p>
7695 !! end
7696
7697 !! test
7698 Template with template name as argument
7699 !! wikitext
7700 {{templateasargtest|templ=simple}}
7701 !! html
7702 <p>(test)
7703 </p>
7704 !! end
7705
7706 !! test
7707 Template with template name as argument (2)
7708 !! wikitext
7709 {{templateasargtest2|templ=templatesimple}}
7710 !! html
7711 <p>(test)
7712 </p>
7713 !! end
7714
7715 !! article
7716 Template:templateasargtestdefault
7717 !! text
7718 {{{{{templ|templatesimple}}}}}
7719 !! endarticle
7720
7721 !! article
7722 Template:templa
7723 !! text
7724 '''templ'''
7725 !! endarticle
7726
7727 !! test
7728 Template with default value
7729 !! wikitext
7730 {{templateasargtestdefault}}
7731 !! html
7732 <p>(test)
7733 </p>
7734 !! end
7735
7736 !! test
7737 Template with default value (value set)
7738 !! wikitext
7739 {{templateasargtestdefault|templ=templa}}
7740 !! html
7741 <p><b>templ</b>
7742 </p>
7743 !! end
7744
7745 !! test
7746 Template redirect
7747 !! wikitext
7748 {{templateredirect}}
7749 !! html
7750 <p>(test)
7751 </p>
7752 !! end
7753
7754 !! test
7755 Template with argument in separate line
7756 !! wikitext
7757 {{ templateasargtest |
7758 templ = simple }}
7759 !! html
7760 <p>(test)
7761 </p>
7762 !! end
7763
7764 !! test
7765 Template with complex template as argument
7766 !! wikitext
7767 {{paramtest|
7768 param ={{ templateasargtest |
7769 templ = simple }}}}
7770 !! html
7771 <p>This is a test template with parameter (test)
7772 </p>
7773 !! end
7774
7775 !! test
7776 Template with thumb image (with link in description)
7777 !! wikitext
7778 {{paramtest|
7779 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7780 !! html
7781 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>
7782
7783 !! end
7784
7785 !! article
7786 Template:complextemplate
7787 !! text
7788 {{{1}}} {{paramtest|
7789 param ={{{param}}}}}
7790 !! endarticle
7791
7792 !! test
7793 Template with complex arguments
7794 !! wikitext
7795 {{complextemplate|
7796 param ={{ templateasargtest |
7797 templ = simple }}|[[Template:complextemplate|link]]}}
7798 !! html
7799 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7800 </p>
7801 !! end
7802
7803 !! test
7804 BUG 553: link with two variables in a piped link
7805 !! wikitext
7806 {|
7807 |[[{{{1}}}|{{{2}}}]]
7808 |}
7809 !! html
7810 <table>
7811 <tr>
7812 <td>[[{{{1}}}|{{{2}}}]]
7813 </td></tr></table>
7814
7815 !! end
7816
7817 !! test
7818 Magic variable as template parameter
7819 !! wikitext
7820 {{paramtest|param={{SITENAME}}}}
7821 !! html
7822 <p>This is a test template with parameter MediaWiki
7823 </p>
7824 !! end
7825
7826 !! article
7827 Template:linktest
7828 !! text
7829 [[{{{param}}}|link]]
7830 !! endarticle
7831
7832 !! test
7833 Template parameter as link source
7834 !! wikitext
7835 {{linktest|param=Main Page}}
7836 !! html
7837 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7838 </p>
7839 !! end
7840
7841 !!test
7842 Template-generated attribute string (k='v')
7843 !! wikitext
7844 <span {{attr_str|id|v1}}>bar</span>
7845 !! html
7846 <p><span id="v1">bar</span>
7847 </p>
7848 !!end
7849
7850 !!article
7851 Template:paramtest2
7852 !! text
7853 including another template, {{paramtest|param={{{arg}}}}}
7854 !! endarticle
7855
7856 !! test
7857 Template passing argument to another template
7858 !! wikitext
7859 {{paramtest2|arg='hmm'}}
7860 !! html
7861 <p>including another template, This is a test template with parameter 'hmm'
7862 </p>
7863 !! end
7864
7865 !! article
7866 Template:Linktest2
7867 !! text
7868 Main Page
7869 !! endarticle
7870
7871 !! test
7872 Template as link source
7873 !! wikitext
7874 [[{{linktest2}}]]
7875
7876 [[{{linktest2}}|Main Page]]
7877
7878 [[{{linktest2}}]]Page
7879 !! html
7880 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7881 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7882 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7883 </p>
7884 !! end
7885
7886
7887 !! article
7888 Template:loop1
7889 !! text
7890 {{loop2}}
7891 !! endarticle
7892
7893 !! article
7894 Template:loop2
7895 !! text
7896 {{loop1}}
7897 !! endarticle
7898
7899 !! test
7900 Template infinite loop
7901 !! wikitext
7902 {{loop1}}
7903 !! html
7904 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7905 </p>
7906 !! end
7907
7908 !! test
7909 Template from main namespace
7910 !! wikitext
7911 {{:Main Page}}
7912 !! html
7913 <p>blah blah
7914 </p>
7915 !! end
7916
7917 !! article
7918 Template:table
7919 !! text
7920 {|
7921 | 1 || 2
7922 |-
7923 | 3 || 4
7924 |}
7925 !! endarticle
7926
7927 !! test
7928 BUG 529: Template with table, not included at beginning of line
7929 !! wikitext
7930 foo {{table}}
7931 !! html
7932 <p>foo
7933 </p>
7934 <table>
7935 <tr>
7936 <td> 1 </td>
7937 <td> 2
7938 </td></tr>
7939 <tr>
7940 <td> 3 </td>
7941 <td> 4
7942 </td></tr></table>
7943
7944 !! end
7945
7946 !! test
7947 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7948 !! wikitext
7949 foo
7950 {{table}}
7951 !! html
7952 <p>foo
7953 </p>
7954 <table>
7955 <tr>
7956 <td> 1 </td>
7957 <td> 2
7958 </td></tr>
7959 <tr>
7960 <td> 3 </td>
7961 <td> 4
7962 </td></tr></table>
7963
7964 !! end
7965
7966 !! test
7967 BUG 41: Template parameters shown as broken links
7968 !! wikitext
7969 {{{parameter}}}
7970 !! html
7971 <p>{{{parameter}}}
7972 </p>
7973 !! end
7974
7975 !! test
7976 Template with targets containing wikilinks
7977 !! wikitext
7978 {{[[foo]]}}
7979
7980 {{[[{{echo|foo}}]]}}
7981
7982 {{{{echo|[[foo}}]]}}
7983 !! html
7984 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7985 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7986 </p><p>{{[[foo}}]]
7987 </p>
7988 !! end
7989
7990 !! article
7991 Template:MSGNW test
7992 !! text
7993 ''None'' of '''this''' should be
7994 * interpreted
7995 but rather passed unmodified
7996 {{test}}
7997 !! endarticle
7998
7999 # hmm, fix this or just deprecate msgnw and document its behavior?
8000 !! test
8001 msgnw keyword
8002 !! options
8003 disabled
8004 !! wikitext
8005 {{msgnw:MSGNW test}}
8006 !! html
8007 <p>''None'' of '''this''' should be
8008 * interpreted
8009 but rather passed unmodified
8010 {{test}}
8011 </p>
8012 !! end
8013
8014 !! test
8015 int keyword
8016 !! wikitext
8017 {{int:youhavenewmessages|lots of money|not!}}
8018 !! html
8019 <p>You have lots of money (not!).
8020 </p>
8021 !! end
8022
8023 !! article
8024 Template:Includes
8025 !! text
8026 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8027 !! endarticle
8028
8029 !! test
8030 <includeonly> and <noinclude> being included
8031 !! wikitext
8032 {{Includes}}
8033 !! html
8034 <p>Foobar
8035 </p>
8036 !! end
8037
8038 !! article
8039 Template:Includes2
8040 !! text
8041 <onlyinclude>Foo</onlyinclude>bar
8042 !! endarticle
8043
8044 !! test
8045 <onlyinclude> being included
8046 !! wikitext
8047 {{Includes2}}
8048 !! html
8049 <p>Foo
8050 </p>
8051 !! end
8052
8053
8054 !! article
8055 Template:Includes3
8056 !! text
8057 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8058 !! endarticle
8059
8060 !! test
8061 <onlyinclude> and <includeonly> being included
8062 !! wikitext
8063 {{Includes3}}
8064 !! html
8065 <p>Foo
8066 </p>
8067 !! end
8068
8069 !! test
8070 <includeonly> and <noinclude> on a page
8071 !! wikitext
8072 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8073 !! html
8074 <p>Foozar
8075 </p>
8076 !! end
8077
8078 !! test
8079 Un-closed <noinclude>
8080 !! wikitext
8081 <noinclude>
8082 !! html
8083 !! end
8084
8085 !! test
8086 <onlyinclude> on a page
8087 !! wikitext
8088 <onlyinclude>Foo</onlyinclude>bar
8089 !! html
8090 <p>Foobar
8091 </p>
8092 !! end
8093
8094 !! test
8095 Un-closed <onlyinclude>
8096 !! wikitext
8097 <onlyinclude>
8098 !! html
8099 !! end
8100
8101 !!test
8102 Self-closed noinclude, includeonly, onlyinclude tags
8103 !! wikitext
8104 <noinclude />
8105 <includeonly />
8106 <onlyinclude />
8107 !! html
8108 <p><br />
8109 </p>
8110 !!end
8111
8112 !!test
8113 Unbalanced includeonly and noinclude tags
8114 !! wikitext
8115 {|
8116 |a</noinclude>
8117 |b</noinclude></noinclude>
8118 |c</noinclude></includeonly>
8119 |d</includeonly></includeonly>
8120 |}
8121 !! html
8122 <table>
8123 <tr>
8124 <td>a
8125 </td>
8126 <td>b
8127 </td>
8128 <td>c&lt;/includeonly&gt;
8129 </td>
8130 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8131 </td></tr></table>
8132
8133 !!end
8134
8135 !! article
8136 Template:Includeonly section
8137 !! text
8138 <includeonly>
8139 ==Includeonly section==
8140 </includeonly>
8141 ==Section T-1==
8142 !!endarticle
8143
8144 !! test
8145 Bug 6563: Edit link generation for section shown by <includeonly>
8146 !! wikitext
8147 {{includeonly section}}
8148 !! html
8149 <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>
8150 <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>
8151
8152 !! end
8153
8154 # Uses same input as the contents of [[Template:Includeonly section]]
8155 !! test
8156 Bug 6563: Section extraction for section shown by <includeonly>
8157 !! options
8158 section=T-2
8159 !! wikitext
8160 <includeonly>
8161 ==Includeonly section==
8162 </includeonly>
8163 ==Section T-2==
8164 !! html
8165 ==Section T-2==
8166 !! end
8167
8168 !! test
8169 Bug 6563: Edit link generation for section suppressed by <includeonly>
8170 !! wikitext
8171 <includeonly>
8172 ==Includeonly section==
8173 </includeonly>
8174 ==Section 1==
8175 !! html
8176 <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>
8177
8178 !! end
8179
8180 !! test
8181 Bug 6563: Section extraction for section suppressed by <includeonly>
8182 !! options
8183 section=1
8184 !! wikitext
8185 <includeonly>
8186 ==Includeonly section==
8187 </includeonly>
8188 ==Section 1==
8189 !! html
8190 ==Section 1==
8191 !! end
8192
8193 !! test
8194 Un-closed <includeonly>
8195 !! wikitext
8196 <includeonly>
8197 !! html
8198 !! end
8199
8200 # TODO: test with DOM fragment reuse!
8201 !! test
8202 Parsoid: DOM fragment reuse
8203 !! options
8204 parsoid=wt2wt,wt2html
8205 !! wikitext
8206 a{{echo|b<table></table>c}}d
8207
8208 a{{echo|b
8209 <table></table>
8210 c}}d
8211
8212 {{echo|a
8213
8214 <table></table>
8215
8216 b}}
8217 !! html
8218 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8219 <table></table>c"}},"i":0}}]}'>b</span>
8220 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8221
8222
8223 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2">
8224 </span>
8225 <table about="#mwt2"></table><span about="#mwt2">
8226 </span>
8227 <p about="#mwt2">cd</p>
8228
8229
8230 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3">
8231
8232 </span>
8233 <table about="#mwt3"></table><span about="#mwt3">
8234
8235 </span>
8236 <p about="#mwt3">b</p>
8237 !! end
8238
8239 !! test
8240 Parsoid: Merge double tds (bug 50603)
8241 !! options
8242 parsoid
8243 !! wikitext
8244 {|
8245 |{{echo|{{!}} foo}}
8246 |}
8247 !! html
8248 <table><tbody>
8249 <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>
8250 </tbody></table>
8251 !! end
8252
8253 !! test
8254 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8255 !! options
8256 parsoid
8257 !! wikitext
8258 {{echo|<div>}}
8259 {|
8260 |{{echo|{{!}} foo}}
8261 |}
8262 {{echo|</div>}}
8263 !! html
8264 <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}}]}'>
8265 <table><tbody>
8266 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8267 </tbody></table>
8268 </div>
8269 !! end
8270
8271 ###
8272 ### <includeonly> and <noinclude> in attributes
8273 ###
8274 !!test
8275 0. includeonly around the entire attribute
8276 !! wikitext
8277 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8278 !! html
8279 <p><span id="v2">bar</span>
8280 </p>
8281 !!end
8282
8283 !!test
8284 1. includeonly in html attr key
8285 !! wikitext
8286 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8287 !! html
8288 <p><span id="foo">bar</span>
8289 </p>
8290 !!end
8291
8292 !!test
8293 2. includeonly in html attr value
8294 !! wikitext
8295 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8296 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8297 !! html
8298 <p><span id="v1">bar</span>
8299 <span id="v1">bar</span>
8300 </p>
8301 !!end
8302
8303 !!test
8304 3. includeonly in part of an attr value
8305 !! wikitext
8306 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8307 !! html
8308 <p><span style="color:red;">bar</span>
8309 </p>
8310 !!end
8311
8312 !!test
8313 4. includeonly in table attributes
8314 !! wikitext
8315 {|
8316 |- <noinclude>
8317 |-
8318 |a
8319 </noinclude>
8320 |- <includeonly>
8321 |-
8322 |b
8323 </includeonly>
8324 |}
8325 !! html
8326 <table>
8327
8328
8329 <tr>
8330 <td>a
8331 </td></tr>
8332 </table>
8333
8334 !!end
8335
8336 ###
8337 ### Testing parsing of templates where a template arg
8338 ### has the same name as the template itself.
8339 ###
8340
8341 !! article
8342 Template:quote
8343 !! text
8344 {{{quote|{{{1}}}}}}
8345 !! endarticle
8346
8347 !!test
8348 Templates: Template Name/Arg clash: 1. Use of positional param
8349 !! wikitext
8350 {{quote|foo}}
8351 !! html
8352 <p>foo
8353 </p>
8354 !!end
8355
8356 !!test
8357 Templates: Template Name/Arg clash: 2. Use of named param
8358 !! wikitext
8359 {{quote|quote=foo}}
8360 !! html
8361 <p>foo
8362 </p>
8363 !!end
8364
8365 !!test
8366 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8367 !! wikitext
8368 {{quote|quote}}
8369 !! html
8370 <p>quote
8371 </p>
8372 !!end
8373
8374 ###
8375 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8376 ###
8377
8378 !!test
8379 Templates: 1. Simple use
8380 !! wikitext
8381 {{echo|Foo}}
8382 !! html
8383 <p>Foo
8384 </p>
8385 !!end
8386
8387 !!test
8388 Templates: 2. Inside a block tag
8389 !! wikitext
8390 <div>{{echo|Foo}}</div>
8391 <blockquote>{{echo|Foo}}</blockquote>
8392 !! html
8393 <div>Foo</div>
8394 <blockquote>Foo</blockquote>
8395
8396 !!end
8397
8398 !!test
8399 Templates: P-wrapping: 1a. Templates on consecutive lines
8400 !! wikitext
8401 {{echo|Foo}}
8402 {{echo|bar}}
8403 !! html
8404 <p>Foo
8405 bar
8406 </p>
8407 !!end
8408
8409 !!test
8410 Templates: P-wrapping: 1b. Templates on consecutive lines
8411 !! wikitext
8412 Foo
8413
8414 {{echo|bar}}
8415 {{echo|baz}}
8416 !! html
8417 <p>Foo
8418 </p><p>bar
8419 baz
8420 </p>
8421 !!end
8422
8423 !!test
8424 Templates: P-wrapping: 1c. Templates on consecutive lines
8425 !! wikitext
8426 {{echo|Foo}}
8427 {{echo|bar}} <div>baz</div>
8428 !! html
8429 <p>Foo
8430 </p>
8431 bar <div>baz</div>
8432
8433 !!end
8434
8435 !!test
8436 Templates: P-wrapping: 1d. Template preceded by comment-only line
8437 !!options
8438 parsoid
8439 !! wikitext
8440 <!-- foo -->
8441 {{echo|Bar}}
8442 !! html
8443 <!-- foo -->
8444
8445 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8446 !!end
8447
8448 !!test
8449 Templates: Inline Text: 1. Multiple tmeplate uses
8450 !! wikitext
8451 {{echo|Foo}}bar{{echo|baz}}
8452 !! html
8453 <p>Foobarbaz
8454 </p>
8455 !!end
8456
8457 !!test
8458 Templates: Inline Text: 2. Back-to-back template uses
8459 !! wikitext
8460 {{echo|Foo}}{{echo|bar}}
8461 !! html
8462 <p>Foobar
8463 </p>
8464 !!end
8465
8466 !!test
8467 Templates: Block Tags: 1. Multiple template uses
8468 !! wikitext
8469 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8470 !! html
8471 <div>Foo</div><div>bar</div><div>baz</div>
8472
8473 !!end
8474
8475 !!test
8476 Templates: Block Tags: 2. Back-to-back template uses
8477 !! wikitext
8478 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8479 !! html
8480 <div>Foo</div><div>bar</div>
8481
8482 !!end
8483
8484 !!test
8485 Templates: Links: 1. Simple example
8486 !! wikitext
8487 {{echo|[[Foo|bar]]}}
8488 !! html
8489 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8490 </p>
8491 !!end
8492
8493 !!test
8494 Templates: Links: 2. Generation of link href
8495 !! wikitext
8496 [[{{echo|Foo}}|bar]]
8497 !! html
8498 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8499 </p>
8500 !!end
8501
8502 !!test
8503 Templates: Links: 3. Generation of part of a link href
8504 !! wikitext
8505 [[Fo{{echo|o}}|bar]]
8506
8507 [[Foo{{echo|bar}}]]
8508
8509 [[Foo{{echo|bar}}baz]]
8510
8511 [[Foo{{echo|bar}}|bar]]
8512
8513 [[:Foo{{echo|bar}}]]
8514
8515 [[:Foo{{echo|bar}}|bar]]
8516 !! html
8517 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8518 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8519 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8520 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8521 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8522 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8523 </p>
8524 !!end
8525
8526 !!test
8527 Templates: Links: 4. Multiple templates generating link href
8528 !! wikitext
8529 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8530 !! html
8531 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8532 </p>
8533 !!end
8534
8535 !!test
8536 Templates: Links: 5. Generation of link text
8537 !! wikitext
8538 [[Foo|{{echo|bar}}]]
8539 !! html
8540 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8541 </p>
8542 !!end
8543
8544 !!test
8545 Templates: Links: 5. Nested templates (only outermost template should be marked)
8546 !! wikitext
8547 {{echo|[[{{echo|Foo}}|bar]]}}
8548 !! html
8549 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8550 </p>
8551 !!end
8552
8553 !!test
8554 Templates: HTML Tag: 1. Generation of HTML attr. key
8555 !! wikitext
8556 <div {{echo|style}}="color:red;">foo</div>
8557 !! html
8558 <div style="color:red;">foo</div>
8559
8560 !!end
8561
8562 !!test
8563 Templates: HTML Tag: 2. Generation of HTML attr. value
8564 !! wikitext
8565 <div style={{echo|'color:red;'}}>foo</div>
8566 !! html
8567 <div style="color:red;">foo</div>
8568
8569 !!end
8570
8571 !!test
8572 Templates: HTML Tag: 3. Generation of HTML attr key and value
8573 !! wikitext
8574 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8575 !! html
8576 <div style="color:red;">foo</div>
8577
8578 !!end
8579
8580 !!test
8581 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8582 !! wikitext
8583 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8584 !! html
8585 <div title="This is a long title with just one piece templated">foo</div>
8586
8587 !!end
8588
8589 !!test
8590 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8591 !! wikitext
8592 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8593 !! html
8594 <div title="This is a long title with just one piece templated">foo</div>
8595
8596 !!end
8597
8598 !!test
8599 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8600 !! wikitext
8601 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8602 !! html
8603 <div title="This is a long title with just one piece templated">foo</div>
8604
8605 !!end
8606
8607 !!test
8608 Templates: HTML Tag: 7. Generation of partial attribute key string
8609 !! wikitext
8610 <div st{{echo|yle}}="color:red;">foo</div>
8611 !! html
8612 <div style="color:red;">foo</div>
8613
8614 !!end
8615
8616 !!test
8617 Templates: HTML Tables: 1. Generating start of a HTML table
8618 !! wikitext
8619 {{echo|<table><tr><td>foo</td>}}</tr></table>
8620 !! html
8621 <table><tr><td>foo</td></tr></table>
8622
8623 !!end
8624
8625 !!test
8626 Templates: HTML Tables: 2a. Generating middle of a HTML table
8627 !! wikitext
8628 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8629 !! html
8630 <table><tr><td>foo</td></tr></table>
8631
8632 !!end
8633
8634 !!test
8635 Templates: HTML Tables: 2b. Generating middle of a HTML table
8636 !! wikitext
8637 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8638 !! html
8639 <table><tr><td>foo</td></tr></table>
8640
8641 !!end
8642
8643 !!test
8644 Templates: HTML Tables: 3. Generating end of a HTML table
8645 !! wikitext
8646 <table><tr>{{echo|<td>foo</td></tr></table>}}
8647 !! html
8648 <table><tr><td>foo</td></tr></table>
8649
8650 !!end
8651
8652 !!test
8653 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8654 !! wikitext
8655 {{echo|<table>}}<tr><td>foo</td></tr></table>
8656 !! html
8657 <table><tr><td>foo</td></tr></table>
8658
8659 !!end
8660
8661 !!test
8662 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8663 !! wikitext
8664 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8665 !! html
8666 <table><tr><td>foo</td></tr></table>
8667
8668 !!end
8669
8670 !!test
8671 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8672 !! wikitext
8673 <table><tr>{{echo|<td>}}foo</td></tr></table>
8674 !! html
8675 <table><tr><td>foo</td></tr></table>
8676
8677 !!end
8678
8679 !!test
8680 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8681 !! wikitext
8682 <table><tr><td>foo{{echo|</td>}}</tr></table>
8683 !! html
8684 <table><tr><td>foo</td></tr></table>
8685
8686 !!end
8687
8688 !!test
8689 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8690 !! wikitext
8691 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8692 !! html
8693 <table><tr><td>foo</td></tr></table>
8694
8695 !!end
8696
8697 !!test
8698 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8699 !! wikitext
8700 <table><tr><td>foo</td></tr>{{echo|</table>}}
8701 !! html
8702 <table><tr><td>foo</td></tr></table>
8703
8704 !!end
8705
8706 !!test
8707 Templates: HTML Tables: 5. Proper fostering of categories from inside
8708 !!options
8709 parsoid=wt2html,wt2wt
8710 !! wikitext
8711 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8712 <!--Two categories (Bug 50330)-->
8713 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8714 !! html
8715 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8716 <!--Two categories (Bug 50330)-->
8717 <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>
8718 !!end
8719
8720 !!test
8721 Templates: Wiki Tables: 1a. Fostering of entire template content
8722 !! wikitext
8723 {|
8724 {{echo|a}}
8725 |}
8726 !! html
8727 <table>
8728 a
8729 <tr><td></td></tr></table>
8730
8731 !!end
8732
8733 !!test
8734 Templates: Wiki Tables: 1b. Fostering of entire template content
8735 !! wikitext
8736 {|
8737 {{echo|<div>}}
8738 foo
8739 {{echo|</div>}}
8740 |}
8741 !! html
8742 <table>
8743 <div>
8744 <p>foo
8745 </p>
8746 </div>
8747 <tr><td></td></tr></table>
8748
8749 !!end
8750
8751 !!test
8752 Templates: Wiki Tables: 2. Fostering of partial template content
8753 !! wikitext
8754 {|
8755 {{echo|a
8756 <div>b</div>}}
8757 |}
8758 !! html
8759 <table>
8760 a
8761 <div>b</div>
8762 <tr><td></td></tr></table>
8763
8764 !!end
8765
8766 !!test
8767 Templates: Wiki Tables: 3. td-content via multiple templates
8768 !! wikitext
8769 {|
8770 {{echo|{{pipe}}a}}{{echo|b}}
8771 |}
8772 !! html
8773 <table>
8774 <tr>
8775 <td>ab
8776 </td></tr></table>
8777
8778 !!end
8779
8780 !!test
8781 Templates: Wiki Tables: 4. Templated tags, no content
8782 !! wikitext
8783 {{tbl-start}}
8784 {{tbl-end}}
8785 !! html
8786 <table>
8787 <tr><td></td></tr></table>
8788
8789 !!end
8790
8791 !!test
8792 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8793 !! wikitext
8794 {{tbl-start}}
8795 |foo
8796 {{tbl-end}}
8797 !! html
8798 <table>
8799 <tr>
8800 <td>foo
8801 </td></tr></table>
8802
8803 !!end
8804
8805 !!test
8806 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8807 !! wikitext
8808 {{tbl-start}}
8809 {{!}}foo
8810 {{tbl-end}}
8811 !! html
8812 <table>
8813 <tr>
8814 <td>foo
8815 </td></tr></table>
8816
8817 !!end
8818
8819 !!test
8820 Templates: Lists: Multi-line list-items via templates
8821 !! wikitext
8822 *{{echo|a {{nonexistent|
8823 unused}}}}
8824 *{{echo|b {{nonexistent|
8825 unused}}}}
8826 !! html
8827 <ul>
8828 <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>
8829 </li>
8830 <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>
8831 </li>
8832 </ul>
8833
8834 !!end
8835
8836 !!test
8837 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8838 !! wikitext
8839 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8840 !! html
8841 <p><i>ab</i>c<i>d</i>e
8842 </p>
8843 !!end
8844
8845 !!test
8846 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8847 (PHP parser generates misnested html)
8848 !! wikitext
8849 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8850 !! html/parsoid
8851 <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>
8852 !!end
8853
8854 !!test
8855 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8856 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8857 !! options
8858 parsoid=wt2html,wt2wt
8859 !! wikitext
8860 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8861 !! html
8862 <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>
8863 <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>
8864 <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>
8865 !!end
8866
8867 !!test
8868 Templates: Ugly nesting: 4. Divs opened/closed across templates
8869 !! wikitext
8870 a<div>b{{echo|c</div>d}}e
8871 !! html
8872 a<div>bc</div>de
8873
8874 !!end
8875
8876 !!test
8877 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8878 (Parsoid-centric)
8879 !! options
8880 parsoid
8881 !! wikitext
8882 {|
8883 |{{echo|foo</table>}}
8884 |bar
8885 |}
8886 !! html
8887 <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|}"]}'>
8888
8889 <tbody>
8890 <tr>
8891 <td>foo</td></tr></tbody></table><span about="#mwt1">
8892 </span><span about="#mwt1">|bar</span><span about="#mwt1">
8893 |}</span>
8894 !!end
8895
8896 !!test
8897 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8898 (Parsoid-centric)
8899 !! options
8900 parsoid
8901 !! wikitext
8902 <table>
8903 <tr>
8904 <td>
8905 <table>
8906 <tr>
8907 <td>1. {{echo|foo </table>}}</td>
8908 <td> bar </td>
8909 <td>2. {{echo|baz </table>}}</td>
8910 </tr>
8911 <tr>
8912 <td>abc</td>
8913 </tr>
8914 </table>
8915 </td>
8916 </tr>
8917 <tr>
8918 <td>xyz</td>
8919 </tr>
8920 </table>
8921 !! html
8922 <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>"]}'>
8923 <tbody><tr>
8924 <td>
8925 <table>
8926 <tbody><tr>
8927 <td>1. foo </td></tr></tbody></table></td>
8928 <td> bar </td>
8929 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8930 </span><span about="#mwt2">
8931 </span><span about="#mwt2">
8932 </span><span about="#mwt2">abc</span><span about="#mwt2">
8933 </span><span about="#mwt2">
8934 </span><span about="#mwt2">
8935 </span><span about="#mwt2">
8936 </span><span about="#mwt2">
8937 </span><span about="#mwt2">
8938 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8939 </span><span about="#mwt2">
8940 </span>
8941 !!end
8942
8943 !! test
8944 Templates: Ugly templates: 3. newline-only template parameter
8945 !! wikitext
8946 foo {{echo|
8947 }}
8948 !! html
8949 <p>foo
8950 </p>
8951 !! end
8952
8953 # This looks like a bug: a single newline triggers p/br for some reason.
8954 !! test
8955 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8956 !! wikitext
8957 {{echo|
8958 }}
8959 !! html
8960 <p><br />
8961 </p>
8962 !! end
8963
8964
8965 !!test
8966 Parser Functions: 1. Simple example
8967 !! wikitext
8968 {{uc:foo}}
8969 !! html
8970 <p>FOO
8971 </p>
8972 !!end
8973
8974 !!test
8975 Parser Functions: 2. Nested use (only outermost should be marked up)
8976 !! wikitext
8977 {{uc:{{lc:FOO}}}}
8978 !! html
8979 <p>FOO
8980 </p>
8981 !!end
8982
8983 ###
8984 ### Pre-save transform tests
8985 ###
8986 !! test
8987 pre-save transform: subst:
8988 !! options
8989 PST
8990 !! wikitext
8991 {{subst:test}}
8992 !! html
8993 This is a test template
8994 !! end
8995
8996 !! test
8997 pre-save transform: normal template
8998 !! options
8999 PST
9000 !! wikitext
9001 {{test}}
9002 !! html
9003 {{test}}
9004 !! end
9005
9006 !! test
9007 pre-save transform: nonexistent template
9008 !! options
9009 PST
9010 !! wikitext
9011 {{thistemplatedoesnotexist}}
9012 !! html
9013 {{thistemplatedoesnotexist}}
9014 !! end
9015
9016
9017 !! test
9018 pre-save transform: subst magic variables
9019 !! options
9020 PST
9021 !! wikitext
9022 {{subst:SITENAME}}
9023 !! html
9024 MediaWiki
9025 !! end
9026
9027 # This is bug 89, which I fixed. -- wtm
9028 !! test
9029 pre-save transform: subst: templates with parameters
9030 !! options
9031 pst
9032 !! wikitext
9033 {{subst:paramtest|param="something else"}}
9034 !! html
9035 This is a test template with parameter "something else"
9036 !! end
9037
9038 !! article
9039 Template:nowikitest
9040 !! text
9041 <nowiki>'''not wiki'''</nowiki>
9042 !! endarticle
9043
9044 !! test
9045 pre-save transform: nowiki in subst (bug 1188)
9046 !! options
9047 pst
9048 !! wikitext
9049 {{subst:nowikitest}}
9050 !! html
9051 <nowiki>'''not wiki'''</nowiki>
9052 !! end
9053
9054
9055 !! article
9056 Template:commenttest
9057 !! text
9058 This template has <!-- a comment --> in it.
9059 !! endarticle
9060
9061 !! test
9062 pre-save transform: comment in subst (bug 1936)
9063 !! options
9064 pst
9065 !! wikitext
9066 {{subst:commenttest}}
9067 !! html
9068 This template has <!-- a comment --> in it.
9069 !! end
9070
9071 !! test
9072 pre-save transform: unclosed tag
9073 !! options
9074 pst noxml
9075 !! wikitext
9076 <nowiki>'''not wiki'''
9077 !! html
9078 <nowiki>'''not wiki'''
9079 !! end
9080
9081 !! test
9082 pre-save transform: mixed tag case
9083 !! options
9084 pst noxml
9085 !! wikitext
9086 <NOwiki>'''not wiki'''</noWIKI>
9087 !! html
9088 <NOwiki>'''not wiki'''</noWIKI>
9089 !! end
9090
9091 !! test
9092 pre-save transform: unclosed comment in <nowiki>
9093 !! options
9094 pst noxml
9095 !! wikitext
9096 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9097 !! html
9098 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9099 !!end
9100
9101 # Leading @ in this template definition works around a limitation
9102 # in parsoid's parserTests which otherwise strips the <span> from the
9103 # result (confusing it for a template wrapper)
9104 !! article
9105 Template:dangerous
9106 !!text
9107 @<span onmouseover="alert('crap')">Oh no</span>
9108 !!endarticle
9109
9110 !!test
9111 (confirming safety of fix for subst bug 1936)
9112 !! wikitext
9113 {{Template:dangerous}}
9114 !! html
9115 <p>@<span>Oh no</span>
9116 </p>
9117 !! end
9118
9119 !! test
9120 pre-save transform: comment containing gallery (bug 5024)
9121 !! options
9122 pst
9123 !! wikitext
9124 <!-- <gallery>data</gallery> -->
9125 !! html
9126 <!-- <gallery>data</gallery> -->
9127 !!end
9128
9129 !! test
9130 pre-save transform: comment containing extension
9131 !! options
9132 pst
9133 !! wikitext
9134 <!-- <tag>data</tag> -->
9135 !! html
9136 <!-- <tag>data</tag> -->
9137 !!end
9138
9139 !! test
9140 pre-save transform: comment containing nowiki
9141 !! options
9142 pst
9143 !! wikitext
9144 <!-- <nowiki>data</nowiki> -->
9145 !! html
9146 <!-- <nowiki>data</nowiki> -->
9147 !!end
9148
9149 !! test
9150 pre-save transform: <noinclude> in subst (bug 3298)
9151 !! options
9152 pst
9153 !! wikitext
9154 {{subst:Includes}}
9155 !! html
9156 Foobar
9157 !! end
9158
9159 !! test
9160 pre-save transform: <onlyinclude> in subst (bug 3298)
9161 !! options
9162 pst
9163 !! wikitext
9164 {{subst:Includes2}}
9165 !! html
9166 Foo
9167 !! end
9168
9169 !! article
9170 Template:SubstTest
9171 !!text
9172 {{<includeonly>subst:</includeonly>Includes}}
9173 !! endarticle
9174
9175 !! article
9176 Template:SafeSubstTest
9177 !! text
9178 {{<includeonly>safesubst:</includeonly>Includes}}
9179 !! endarticle
9180
9181 !! test
9182 bug 22297: safesubst: works during PST
9183 !! options
9184 pst
9185 !! wikitext
9186 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9187 !! html
9188 FoobarFoobar
9189 !! end
9190
9191 !! test
9192 bug 22297: safesubst: works during normal parse
9193 !! wikitext
9194 {{SafeSubstTest}}
9195 !! html
9196 <p>Foobar
9197 </p>
9198 !! end
9199
9200 !! test
9201 subst: does not work during normal parse
9202 !! wikitext
9203 {{SubstTest}}
9204 !! html
9205 <p>{{subst:Includes}}
9206 </p>
9207 !! end
9208
9209 !! test
9210 pre-save transform: context links ("pipe trick")
9211 !! options
9212 pst
9213 !! wikitext
9214 [[Article (context)|]]
9215 [[Bar:Article|]]
9216 [[:Bar:Article|]]
9217 [[Bar:Article (context)|]]
9218 [[:Bar:Article (context)|]]
9219 [[|Article]]
9220 [[|Article (context)]]
9221 [[Bar:X (Y) Z|]]
9222 [[:Bar:X (Y) Z|]]
9223 !! html
9224 [[Article (context)|Article]]
9225 [[Bar:Article|Article]]
9226 [[:Bar:Article|Article]]
9227 [[Bar:Article (context)|Article]]
9228 [[:Bar:Article (context)|Article]]
9229 [[Article]]
9230 [[Article (context)]]
9231 [[Bar:X (Y) Z|X (Y) Z]]
9232 [[:Bar:X (Y) Z|X (Y) Z]]
9233 !! end
9234
9235 !! test
9236 pre-save transform: context links ("pipe trick") with interwiki prefix
9237 !! options
9238 pst
9239 !! wikitext
9240 [[interwiki:Article|]]
9241 [[:interwiki:Article|]]
9242 [[interwiki:Bar:Article|]]
9243 [[:interwiki:Bar:Article|]]
9244 !! html
9245 [[interwiki:Article|Article]]
9246 [[:interwiki:Article|Article]]
9247 [[interwiki:Bar:Article|Bar:Article]]
9248 [[:interwiki:Bar:Article|Bar:Article]]
9249 !! end
9250
9251 !! test
9252 pre-save transform: context links ("pipe trick") with parens in title
9253 !! options
9254 pst title=[[Somearticle (context)]]
9255 !! wikitext
9256 [[|Article]]
9257 !! html
9258 [[Article (context)|Article]]
9259 !! end
9260
9261 !! test
9262 pre-save transform: context links ("pipe trick") with comma in title
9263 !! options
9264 pst title=[[Someplace, Somewhere]]
9265 !! wikitext
9266 [[|Otherplace]]
9267 [[Otherplace, Elsewhere|]]
9268 [[Otherplace, Elsewhere, Anywhere|]]
9269 !! html
9270 [[Otherplace, Somewhere|Otherplace]]
9271 [[Otherplace, Elsewhere|Otherplace]]
9272 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9273 !! end
9274
9275 !! test
9276 pre-save transform: context links ("pipe trick") with parens and comma
9277 !! options
9278 pst title=[[Someplace (IGNORED), Somewhere]]
9279 !! wikitext
9280 [[|Otherplace]]
9281 [[Otherplace (place), Elsewhere|]]
9282 !! html
9283 [[Otherplace, Somewhere|Otherplace]]
9284 [[Otherplace (place), Elsewhere|Otherplace]]
9285 !! end
9286
9287 !! test
9288 pre-save transform: context links ("pipe trick") with comma and parens
9289 !! options
9290 pst title=[[Who, me? (context)]]
9291 !! wikitext
9292 [[|Yes, you.]]
9293 [[Me, Myself, and I (1937 song)|]]
9294 !! html
9295 [[Yes, you. (context)|Yes, you.]]
9296 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9297 !! end
9298
9299 !! test
9300 pre-save transform: context links ("pipe trick") with namespace
9301 !! options
9302 pst title=[[Ns:Somearticle]]
9303 !! wikitext
9304 [[|Article]]
9305 !! html
9306 [[Ns:Article|Article]]
9307 !! end
9308
9309 !! test
9310 pre-save transform: context links ("pipe trick") with namespace and parens
9311 !! options
9312 pst title=[[Ns:Somearticle (context)]]
9313 !! wikitext
9314 [[|Article]]
9315 !! html
9316 [[Ns:Article (context)|Article]]
9317 !! end
9318
9319 !! test
9320 pre-save transform: context links ("pipe trick") with namespace and comma
9321 !! options
9322 pst title=[[Ns:Somearticle, Context, Whatever]]
9323 !! wikitext
9324 [[|Article]]
9325 !! html
9326 [[Ns:Article, Context, Whatever|Article]]
9327 !! end
9328
9329 !! test
9330 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9331 !! options
9332 pst title=[[Ns:Somearticle, Context (context)]]
9333 !! wikitext
9334 [[|Article]]
9335 !! html
9336 [[Ns:Article (context)|Article]]
9337 !! end
9338
9339 !! test
9340 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9341 !! options
9342 pst title=[[Ns:Somearticle (IGNORED), Context]]
9343 !! wikitext
9344 [[|Article]]
9345 !! html
9346 [[Ns:Article, Context|Article]]
9347 !! end
9348
9349 !! test
9350 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9351 !! options
9352 pst
9353 !! wikitext
9354 [[Article(context)|]]
9355 [[Bar:Article(context)|]]
9356 [[:Bar:Article(context)|]]
9357 [[|Article(context)]]
9358 [[Bar:X(Y)Z|]]
9359 [[:Bar:X(Y)Z|]]
9360 !! html
9361 [[Article(context)|Article]]
9362 [[Bar:Article(context)|Article]]
9363 [[:Bar:Article(context)|Article]]
9364 [[Article(context)]]
9365 [[Bar:X(Y)Z|X(Y)Z]]
9366 [[:Bar:X(Y)Z|X(Y)Z]]
9367 !! end
9368
9369 !! test
9370 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9371 !! options
9372 pst
9373 !! wikitext
9374 [[Article (context)|]]
9375 [[Bar:Article (context)|]]
9376 [[:Bar:Article (context)|]]
9377 [[|Article (context)]]
9378 [[Bar:X (Y) Z|]]
9379 [[:Bar:X (Y) Z|]]
9380 !! html
9381 [[Article (context)|Article]]
9382 [[Bar:Article (context)|Article]]
9383 [[:Bar:Article (context)|Article]]
9384 [[Article (context)]]
9385 [[Bar:X (Y) Z|X (Y) Z]]
9386 [[:Bar:X (Y) Z|X (Y) Z]]
9387 !! end
9388
9389 !! test
9390 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9391 !! options
9392 pst
9393 !! wikitext
9394 [[Article(context)|]]
9395 [[Bar:Article(context)|]]
9396 [[:Bar:Article(context)|]]
9397 [[|Article(context)]]
9398 [[Bar:X(Y)Z|]]
9399 [[:Bar:X(Y)Z|]]
9400 !! html
9401 [[Article(context)|Article]]
9402 [[Bar:Article(context)|Article]]
9403 [[:Bar:Article(context)|Article]]
9404 [[Article(context)]]
9405 [[Bar:X(Y)Z|X(Y)Z]]
9406 [[:Bar:X(Y)Z|X(Y)Z]]
9407 !! end
9408
9409 !! test
9410 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9411 !! options
9412 pst
9413 !! wikitext
9414 [[Article (context), context|]]
9415 [[Article (context),context|]]
9416 [[Bar:Article (context), context|]]
9417 [[Bar:Article (context),context|]]
9418 [[:Bar:Article (context), context|]]
9419 [[:Bar:Article (context),context|]]
9420 !! html
9421 [[Article (context), context|Article]]
9422 [[Article (context),context|Article]]
9423 [[Bar:Article (context), context|Article]]
9424 [[Bar:Article (context),context|Article]]
9425 [[:Bar:Article (context), context|Article]]
9426 [[:Bar:Article (context),context|Article]]
9427 !! end
9428
9429 !! test
9430 pre-save transform: trim trailing empty lines
9431 !! options
9432 pst
9433 !! wikitext
9434 Empty lines are trimmed
9435
9436
9437
9438
9439 !! html
9440 Empty lines are trimmed
9441 !! end
9442
9443 !! test
9444 pre-save transform: Signature expansion
9445 !! options
9446 pst
9447 !! wikitext
9448 * ~~~
9449 * <noinclude>~~~</noinclude>
9450 * <includeonly>~~~</includeonly>
9451 * <onlyinclude>~~~</onlyinclude>
9452 !! html
9453 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9454 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9455 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9456 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9457 !! end
9458
9459
9460 !! test
9461 pre-save transform: Signature expansion in nowiki tags (bug 93)
9462 !! options
9463 pst disabled
9464 !! wikitext
9465 Shall not expand:
9466
9467 <nowiki>~~~~</nowiki>
9468
9469 <includeonly><nowiki>~~~~</nowiki></includeonly>
9470
9471 <noinclude><nowiki>~~~~</nowiki></noinclude>
9472
9473 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9474
9475 {{subst:Foo}} shall be converted to FOO
9476
9477 As well as inside noinclude/onlyinclude
9478 <noinclude>{{subst:Foo}}</noinclude>
9479 <onlyinclude>{{subst:Foo}}</onlyinclude>
9480
9481 But not inside includeonly
9482 <includeonly>{{subst:Foo}}</includeonly>
9483 !! html
9484 Shall not expand:
9485
9486 <nowiki>~~~~</nowiki>
9487
9488 <includeonly><nowiki>~~~~</nowiki></includeonly>
9489
9490 <noinclude><nowiki>~~~~</nowiki></noinclude>
9491
9492 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9493
9494 FOO shall be converted to FOO
9495
9496 As well as inside noinclude/onlyinclude
9497 <noinclude>FOO</noinclude>
9498 <onlyinclude>FOO</onlyinclude>
9499
9500 But not inside includeonly
9501 <includeonly>{{subst:Foo}}</includeonly>
9502 !! end
9503
9504 !! test
9505 Parsoid: Recognize nowiki with trailing space in tags
9506 !! options
9507 parsoid=wt2html
9508 !! wikitext
9509 <nowiki ><div>[[foo]]</nowiki >
9510
9511 a<nowiki / >b
9512
9513 c<nowiki />d
9514
9515 e<nowiki/ >f
9516 !! html
9517 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9518 <p>ab</p>
9519 <p>cd</p>
9520 <p>ef</p>
9521 !! end
9522
9523 !! test
9524 Parsoid: Recognize nowiki with odd capitalization
9525 !! options
9526 parsoid=wt2html
9527 !! wikitext
9528 <noWikI ><div>[[foo]]</Nowiki >
9529 !! html
9530 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9531 !! end
9532
9533
9534 !! test
9535 Parsoid: Escape nowiki with trailing space in tags
9536 !! options
9537 parsoid=html2wt
9538 !! wikitext
9539 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9540
9541 a&lt;nowiki /&gt;b
9542
9543 c&lt;nowiki/ &gt;d
9544 !! html
9545 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9546 <p>a&lt;nowiki /&gt;b</p>
9547 <p>c&lt;nowiki/ &gt;d</p>
9548 !! end
9549
9550 !! test
9551 Parsoid: Escape weird noWikI capitalizations
9552 !! options
9553 parsoid=html2wt
9554 !! wikitext
9555 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9556 !! html
9557 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9558 !! end
9559
9560 ###
9561 ### Message transform tests
9562 ###
9563 !! test
9564 message transform: magic variables
9565 !! options
9566 msg
9567 !! wikitext
9568 {{SITENAME}}
9569 !! html
9570 MediaWiki
9571 !! end
9572
9573 !! test
9574 message transform: should not transform wiki markup
9575 !! options
9576 msg
9577 !! wikitext
9578 ''test''
9579 !! html
9580 ''test''
9581 !! end
9582
9583 !! test
9584 message transform: <noinclude> in transcluded template (bug 4926)
9585 !! options
9586 msg
9587 !! wikitext
9588 {{Includes}}
9589 !! html
9590 Foobar
9591 !! end
9592
9593 !! test
9594 message transform: <onlyinclude> in transcluded template (bug 4926)
9595 !! options
9596 msg
9597 !! wikitext
9598 {{Includes2}}
9599 !! html
9600 Foo
9601 !! end
9602
9603 !! test
9604 {{#special:}} page name, known
9605 !! options
9606 msg
9607 !! wikitext
9608 {{#special:Recentchanges}}
9609 !! html
9610 Special:RecentChanges
9611 !! end
9612
9613 !! test
9614 {{#special:}} page name with subpage, known
9615 !! options
9616 msg
9617 !! wikitext
9618 {{#special:Recentchanges/param}}
9619 !! html
9620 Special:RecentChanges/param
9621 !! end
9622
9623 !! test
9624 {{#special:}} page name, unknown
9625 !! options
9626 msg
9627 !! wikitext
9628 {{#special:foobar nonexistent}}
9629 !! html
9630 Special:Foobar nonexistent
9631 !! end
9632
9633 !! test
9634 {{#speciale:}} page name, known
9635 !! options
9636 msg
9637 !! wikitext
9638 {{#speciale:Recentchanges}}
9639 !! html
9640 Special:RecentChanges
9641 !! end
9642
9643 !! test
9644 {{#speciale:}} page name with subpage, known
9645 !! options
9646 msg
9647 !! wikitext
9648 {{#speciale:Recentchanges/param}}
9649 !! html
9650 Special:RecentChanges/param
9651 !! end
9652
9653 !! test
9654 {{#speciale:}} page name, unknown
9655 !! options
9656 msg
9657 !! wikitext
9658 {{#speciale:foobar nonexistent}}
9659 !! html
9660 Special:Foobar_nonexistent
9661 !! end
9662
9663 ###
9664 ### Images
9665 ###
9666 ### For Parsoid-specific tests, see
9667 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9668
9669 !! test
9670 Simple image
9671 !! options
9672 parsoid=wt2html,wt2wt,html2html
9673 !! wikitext
9674 [[Image:foobar.jpg]]
9675 !! html/php
9676 <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>
9677 </p>
9678 !! html/parsoid
9679 <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>
9680 </p>
9681 !! end
9682
9683 !! test
9684 Simple image (using File: namespace, now canonical)
9685 !! wikitext
9686 [[File:Foobar.jpg]]
9687 !! html/php
9688 <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>
9689 </p>
9690 !! html/parsoid
9691 <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>
9692 </p>
9693 !! end
9694
9695 !! test
9696 Right-aligned image
9697 !! wikitext
9698 [[File:Foobar.jpg|right]]
9699 !! html/php
9700 <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>
9701
9702 !! html/parsoid
9703 <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>
9704 !! end
9705
9706 !! test
9707 Image with caption
9708 !! wikitext
9709 [[File:Foobar.jpg|right|Caption text]]
9710 !! html/php
9711 <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>
9712
9713 !! html/parsoid
9714 <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>
9715 !! end
9716
9717 !! test
9718 Image with caption, bug 53312 #1
9719 !! wikitext
9720 [[File:Foobar.jpg|right|Caption page stuff]]
9721 !! html/php
9722 <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>
9723
9724 !! html/parsoid
9725 <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>
9726 !! end
9727
9728 !! test
9729 Image with caption, bug 53312 #2
9730 !! wikitext
9731 [[File:Foobar.jpg|right|Caption page=]]
9732 !! html/php
9733 <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>
9734
9735 !! html/parsoid
9736 <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>
9737 !! end
9738
9739 !! test
9740 Image with caption, bug 53312 #3
9741 !! wikitext
9742 [[File:Foobar.jpg|right|Caption page=stuff]]
9743 !! html/php
9744 <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>
9745
9746 !! html/parsoid
9747 <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>
9748 !! end
9749
9750 !! test
9751 Allow empty links in image captions (Bug 60753)
9752 !! wikitext
9753 [[File:Foobar.jpg|thumb|Caption [[Link1]]
9754 [[]]
9755 [[Link2]]
9756 ]]
9757 !! html/php
9758 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
9759
9760 !! html/parsoid
9761 <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"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><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 data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
9762 [[]]
9763 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
9764 </figcaption></figure>
9765 !! end
9766
9767 !! test
9768 Link with empty target
9769 !! wikitext
9770 [[]]
9771 !! html
9772 <p>[[]]
9773 </p>
9774 !! end
9775
9776 !! test
9777 Image with empty attribute
9778 !! options
9779 parsoid=wt2html,wt2wt,html2html
9780 !! wikitext
9781 [[File:Foobar.jpg|right||Caption text]]
9782 !! html/php
9783 <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>
9784
9785 !! html/parsoid
9786 <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>
9787 !! end
9788
9789 !! test
9790 1. Block image with individual attributes from templates
9791 !! wikitext
9792 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
9793 !! html/php
9794 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
9795
9796 !! html/parsoid
9797 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[24,38,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;]}]]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
9798 !! end
9799
9800 !! test
9801 2. Block Image with individual attributes from templates
9802 !! wikitext
9803 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
9804 !! html/php
9805 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
9806
9807 !! html/parsoid
9808 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,32,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;]}]]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" 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}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[33,47,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;]}]]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
9809 !! end
9810
9811 !! test
9812 3. Inline image with individual attributes from templates
9813 !! wikitext
9814 [[File:Foobar.jpg|{{echo|50px}}]]
9815 !! html/php
9816 <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>
9817 </p>
9818 !! html/parsoid
9819 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,31,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;]}]]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><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>
9820 !! end
9821
9822 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
9823 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
9824 !! test
9825 Image with multiple attributes from the same template
9826 !! wikitext
9827 [[File:Foobar.jpg|{{image_attribs}}]]
9828 !! html/php
9829 <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>
9830
9831 !! html/parsoid
9832 <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>
9833 !! end
9834
9835 !! test
9836 Image with link tails
9837 !! wikitext
9838 123[[File:Foobar.jpg]]456
9839 123[[File:Foobar.jpg|right]]456
9840 123[[File:Foobar.jpg|thumb]]456
9841 !! html/php
9842 <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
9843 </p>
9844 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
9845 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
9846
9847 !! html/parsoid
9848 <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>
9849 123<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>456
9850 123<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>456
9851 !! end
9852
9853 !! test
9854 Image with multiple captions -- only last one is accepted
9855 !! wikitext
9856 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9857 !! html/php
9858 <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>
9859
9860 !! html/parsoid
9861 <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>
9862 !! end
9863
9864 !! test
9865 Image with multiple widths -- use last
9866 !! wikitext
9867 [[File:Foobar.jpg|200px|300px|caption]]
9868 !! html/php
9869 <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>
9870 </p>
9871 !! html/parsoid
9872 <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>
9873 !! end
9874
9875 !! test
9876 Image with multiple alignments -- use first (bug 48664)
9877 !! wikitext
9878 [[File:Foobar.jpg|thumb|left|right|center|caption]]
9879
9880 [[File:Foobar.jpg|middle|text-top|caption]]
9881 !! html/php
9882 <div class="thumb tleft"><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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
9883 <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>
9884 </p>
9885 !! html/parsoid
9886 <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>
9887 <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>
9888 !! end
9889
9890 !! test
9891 Image with width attribute at different positions
9892 !! wikitext
9893 [[File:Foobar.jpg|200px|right|Caption]]
9894 [[File:Foobar.jpg|right|200px|Caption]]
9895 [[File:Foobar.jpg|right|Caption|200px]]
9896 !! html/php
9897 <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>
9898 <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>
9899 <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>
9900
9901 !! html/parsoid
9902 <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>
9903 <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>
9904 <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>
9905 !! end
9906
9907 # a sad bit of backward-compatibility
9908 !! test
9909 Image with size specified with pxpx (bug 13500, 51628)
9910 !! options
9911 parsoid=wt2html,wt2wt,html2html
9912 !! wikitext
9913 [[File:Foobar.jpg|20pxpx]]
9914 [[File:Foobar.jpg|200x20pxpx]]
9915 !! html/php
9916 <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>
9917 <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>
9918 </p>
9919 !! html/parsoid
9920 <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>
9921 !! end
9922
9923 !! test
9924 Image with link parameter, wiki target
9925 !! wikitext
9926 [[File:Foobar.jpg|link=Main Page]]
9927 !! html/php
9928 <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>
9929 </p>
9930 !! html/parsoid
9931 <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>
9932 !! end
9933
9934 # parsoid bug 49293 (part 1)
9935 !! test
9936 Image with link parameter, URL target
9937 !! wikitext
9938 [[File:Foobar.jpg|link=http://example.com/]]
9939 !! html/php
9940 <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>
9941 </p>
9942 !! html/parsoid
9943 <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>
9944 !! end
9945
9946 # parsoid bug 49293 (part 2)
9947 !! test
9948 Image with link parameter, protocol-less URL target
9949 !! wikitext
9950 [[File:Foobar.jpg|link=//example.com/]]
9951 !! html/php
9952 <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>
9953 </p>
9954 !! html/parsoid
9955 <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>
9956 !! end
9957
9958 !! test
9959 Image with link parameter, wgExternalLinkTarget
9960 !! wikitext
9961 [[Image:foobar.jpg|link=http://example.com/]]
9962 !! config
9963 wgExternalLinkTarget='foobar'
9964 !! html
9965 <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>
9966 </p>
9967 !! end
9968
9969 !! test
9970 Image with link parameter, wgNoFollowLinks set to false
9971 !! wikitext
9972 [[Image:foobar.jpg|link=http://example.com/]]
9973 !! config
9974 wgNoFollowLinks=false
9975 !! html
9976 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9977 </p>
9978 !! end
9979
9980 !! test
9981 Image with link parameter, wgNoFollowDomainExceptions
9982 !! wikitext
9983 [[Image:foobar.jpg|link=http://example.com/]]
9984 !! config
9985 wgNoFollowDomainExceptions='example.com'
9986 !! html
9987 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9988 </p>
9989 !! end
9990
9991 !! test
9992 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9993 !! wikitext
9994 [[Image:foobar.jpg|link=http://example.com/|Title]]
9995 !! config
9996 wgExternalLinkTarget='foobar'
9997 !! html
9998 <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>
9999 </p>
10000 !! end
10001
10002 !! test
10003 Image with empty link parameter
10004 !! wikitext
10005 [[File:Foobar.jpg|link=]]
10006 !! html/php
10007 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10008 </p>
10009 !! html/parsoid
10010 <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>
10011 !! end
10012
10013 !! test
10014 Image with link parameter (wiki target) and unnamed parameter
10015 !! wikitext
10016 [[File:Foobar.jpg|link=Main_Page|Title]]
10017 !! html/php
10018 <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>
10019 </p>
10020 !! html/parsoid
10021 <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>
10022 !! end
10023
10024 !! test
10025 Image with link parameter (URL target) and unnamed parameter
10026 !! wikitext
10027 [[File:Foobar.jpg|link=http://example.com/|Title]]
10028 !! html/php
10029 <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>
10030 </p>
10031 !! html/parsoid
10032 <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>
10033 !! end
10034
10035 !! test
10036 Thumbnail image with link parameter
10037 !! options
10038 parsoid=wt2html,wt2wt,html2html
10039 !! wikitext
10040 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10041 !! html/php
10042 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10043
10044 !! html/parsoid
10045 <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>
10046 !! end
10047
10048 !! test
10049 Manually-specified thumbnail image
10050 !! wikitext
10051 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10052 !! html/php
10053 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10054
10055 !! html/parsoid
10056 <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>
10057 !! end
10058
10059 !! test
10060 Manually-specified thumbnail image with explicit link to wiki page
10061 !! options
10062 parsoid=wt2html,wt2wt,html2html
10063 !! wikitext
10064 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10065 !! html/php
10066 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10067
10068 !! html/parsoid
10069 <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>
10070 !! end
10071
10072 !! test
10073 Manually-specified thumbnail image with explicit link to url
10074 !! options
10075 parsoid=wt2html,wt2wt,html2html
10076 !! wikitext
10077 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10078 !! html/php
10079 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10080
10081 !! html/parsoid
10082 <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>
10083 !! end
10084
10085 !! test
10086 Manually-specified thumbnail image with explicit no link
10087 !! options
10088 parsoid=wt2html,wt2wt,html2html
10089 !! wikitext
10090 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10091 !! html/php
10092 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10093
10094 !! html/parsoid
10095 <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>
10096 !! end
10097
10098 !! test
10099 Manually-specified thumbnail image with explicit link and alt text
10100 !! options
10101 parsoid=wt2html,wt2wt,html2html
10102 !! wikitext
10103 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10104 !! html/php
10105 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10106
10107 !! html/parsoid
10108 <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>
10109 !! end
10110
10111 !! test
10112 Image with frame and link
10113 !! options
10114 parsoid=wt2html,wt2wt,html2html
10115 !! wikitext
10116 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10117 !! html/php
10118 <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>
10119
10120 !! html/parsoid
10121 <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">Main Page</a></figcaption></figure>
10122 !! end
10123
10124 !! test
10125 Image with frame and link and explicit alt
10126 !! options
10127 parsoid=wt2html,wt2wt,html2html
10128 !! wikitext
10129 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10130 !! html/php
10131 <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>
10132
10133 !! html/parsoid
10134 <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">Main Page</a></figcaption></figure>
10135 !! end
10136
10137 !! test
10138 Image with wiki markup in implicit alt
10139 !! options
10140 parsoid=wt2html,wt2wt,html2html
10141 !! wikitext
10142 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10143
10144 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10145 !! html/php
10146 <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>
10147 </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>
10148 </p>
10149 !! html/parsoid
10150 <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>
10151 <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>
10152 !! end
10153
10154 ###################
10155 # Image sizing.
10156 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10157 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10158 # Foobar has actual size of 1941x220
10159 # 1. Thumbs & frameless always reduce, can't be enlarged
10160 # 2. Framed images ignore width; always render at default size.
10161 # If given a height, they respect height but continue to ignore width.
10162 # 3. "Unspecified format" and border are the only types which can be
10163 # enlarged.
10164
10165 !! test
10166 Image: "unspecified format" and border enlarge
10167 !! options
10168 parsoid=wt2html,wt2wt,html2html
10169 !! wikitext
10170 [[File:Foobar.jpg|2000px]]
10171
10172 [[File:Foobar.jpg|border|2000px]]
10173 !! html/php
10174 <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>
10175 </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>
10176 </p>
10177 !! html/parsoid
10178 <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>
10179 <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>
10180 !! end
10181
10182 !! test
10183 Image: "unspecified format" and border reduce
10184 !! options
10185 parsoid=wt2html,wt2wt,html2html
10186 !! wikitext
10187 [[File:Foobar.jpg|1000px]]
10188
10189 [[File:Foobar.jpg|border|1000px]]
10190 !! html/php
10191 <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>
10192 </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>
10193 </p>
10194 !! html/parsoid
10195 <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>
10196 <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>
10197 !! end
10198
10199 !! test
10200 Image: thumbs reduce
10201 !! options
10202 parsoid=wt2html,wt2wt,html2html
10203 !! wikitext
10204 [[File:Foobar.jpg|thumb|50px]]
10205 !! html/php
10206 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10207
10208 !! html/parsoid
10209 <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>
10210 !! end
10211
10212 !! test
10213 Image: thumbs can't be enlarged past original size
10214 !! options
10215 parsoid=wt2html,wt2wt,html2html
10216 !! wikitext
10217 [[File:Foobar.jpg|thumb|2000px]]
10218 !! html/php
10219 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10220
10221 !! html/parsoid
10222 <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>
10223 !! end
10224
10225 !! test
10226 Image: frameless can reduce in size
10227 !! options
10228 parsoid=wt2html,wt2wt,html2html
10229 !! wikitext
10230 [[File:Foobar.jpg|frameless|50px]]
10231 !! html/php
10232 <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>
10233 </p>
10234 !! html/parsoid
10235 <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>
10236 !! end
10237
10238 !! test
10239 Image: frameless can't be enlarged past original size
10240 !! options
10241 parsoid=wt2html,wt2wt,html2html
10242 !! wikitext
10243 [[File:Foobar.jpg|frameless|2000px]]
10244 !! html/php
10245 <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>
10246 </p>
10247 !! html/parsoid
10248 <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>
10249 !! end
10250
10251 !! test
10252 Image: framed images ignore size if only width is given
10253 !! options
10254 parsoid=wt2html,wt2wt,html2html
10255 !! wikitext
10256 [[File:Foobar.jpg|frame]]
10257
10258 [[File:Foobar.jpg|frame|50px]]
10259
10260 [[File:Foobar.jpg|frame|2000px]]
10261 !! html/php
10262 <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>
10263 <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>
10264 <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>
10265
10266 !! html/parsoid
10267 <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><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><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>
10268 !! end
10269
10270 !! test
10271 Image: framed images respect size if given a height, but ignore width.
10272 !! wikitext
10273 [[File:Foobar.jpg|frame|50x50px]]
10274 !! html/php
10275 <div class="thumb tright"><div class="thumbinner" style="width:444px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" width="442" height="50" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
10276
10277 !! html/parsoid
10278 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="50" width="442"/></a></figure>
10279 !! end
10280
10281 ###################
10282
10283 !! test
10284 Link to image page- image page normally doesn't exists, hence edit link
10285 Add test with existing image page
10286 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10287 !! wikitext
10288 [[:Image:test]]
10289 !! html
10290 <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>
10291 </p>
10292 !! end
10293
10294 !! test
10295 bug 18784 Link to non-existent image page with caption should use caption as link text
10296 !! wikitext
10297 [[:Image:test|caption]]
10298 !! html
10299 <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>
10300 </p>
10301 !! end
10302
10303 !! test
10304 Frameless image caption with a free URL
10305 !! wikitext
10306 [[File:Foobar.jpg|http://example.com]]
10307 !! html/php
10308 <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>
10309 </p>
10310 !! html/parsoid
10311 <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>
10312 !! end
10313
10314 !! test
10315 Thumbnail image caption with a free URL
10316 !! wikitext
10317 [[File:Foobar.jpg|thumb|http://example.com]]
10318 !! html/php
10319 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10320
10321 !! html/parsoid
10322 <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>
10323 !! end
10324
10325 !! test
10326 Thumbnail image caption with a free URL and explicit alt
10327 !! options
10328 parsoid=wt2html,wt2wt,html2html
10329 !! wikitext
10330 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10331 !! html/php
10332 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" 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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10333
10334 !! html/parsoid
10335 <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>
10336 !! end
10337
10338 !! test
10339 SVG thumbnails with no language set
10340 !! options
10341 !! wikitext
10342 [[File:Foobar.svg|thumb|caption]]
10343 !! html
10344 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10345
10346 !! end
10347
10348 !! test
10349 SVG thumbnails with language de
10350 !! options
10351 !! wikitext
10352 [[File:Foobar.svg|thumb|caption|lang=de]]
10353 !! html
10354 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10355
10356 !! end
10357
10358 !! test
10359 SVG thumbnails with invalid language code
10360 !! options
10361 !! wikitext
10362 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10363 !! html
10364 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
10365
10366 !! end
10367
10368 !! test
10369 BUG 1887: A ISBN with a thumbnail
10370 !! wikitext
10371 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
10372 !! html
10373 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
10374
10375 !! end
10376
10377 !! test
10378 BUG 1887: A RFC with a thumbnail
10379 !! wikitext
10380 [[Image:foobar.jpg|thumb|This is RFC 12354]]
10381 !! html
10382 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
10383
10384 !! end
10385
10386 !! test
10387 BUG 1887: A mailto link with a thumbnail
10388 !! wikitext
10389 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
10390 !! html
10391 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
10392
10393 !! end
10394
10395 # Pending resolution to bug 368
10396 !! test
10397 BUG 648: Frameless image caption with a link
10398 !! wikitext
10399 [[Image:foobar.jpg|text with a [[link]] in it]]
10400 !! html
10401 <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>
10402 </p>
10403 !! end
10404
10405 !! test
10406 BUG 648: Frameless image caption with a link (suffix)
10407 !! wikitext
10408 [[Image:foobar.jpg|text with a [[link]]foo in it]]
10409 !! html
10410 <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>
10411 </p>
10412 !! end
10413
10414 !! test
10415 BUG 648: Frameless image caption with an interwiki link
10416 !! wikitext
10417 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
10418 !! html
10419 <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>
10420 </p>
10421 !! end
10422
10423 !! test
10424 BUG 648: Frameless image caption with a piped interwiki link
10425 !! wikitext
10426 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10427 !! html
10428 <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>
10429 </p>
10430 !! end
10431
10432 !! test
10433 Escape HTML special chars in image alt text
10434 !! wikitext
10435 [[Image:foobar.jpg|& < > "]]
10436 !! html
10437 <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>
10438 </p>
10439 !! end
10440
10441 !! test
10442 BUG 499: Alt text should have &#1234;, not &amp;1234;
10443 !! wikitext
10444 [[Image:foobar.jpg|&#9792;]]
10445 !! html
10446 <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>
10447 </p>
10448 !! end
10449
10450 !! test
10451 Broken image caption with link
10452 !! wikitext
10453 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10454 !! html
10455 <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.
10456 </p>
10457 !! end
10458
10459 !! test
10460 Image caption containing another image
10461 !! wikitext
10462 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
10463 !! html
10464 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
10465
10466 !! end
10467
10468 !! test
10469 Image caption containing a newline
10470 !! wikitext
10471 [[Image:Foobar.jpg|This
10472 *is some text]]
10473 !! html
10474 <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>
10475 </p>
10476 !!end
10477
10478 !!test
10479 Parsoid: Image caption containing leading space
10480 (The leading space should not trigger nowiki escaping in wt2wt mode)
10481 !! wikitext
10482 [[Image:Foobar.jpg|thumb| bar]]
10483 !! html
10484 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
10485
10486 !!end
10487
10488 !! test
10489 Images: caption containing a table
10490 !! wikitext
10491 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10492 {|
10493 ! Foo !! Bar
10494 |-
10495 | Foo1 || Bar1
10496 |}
10497 and some more text.]]
10498 !! html/php
10499 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
10500
10501 !! html/parsoid
10502 <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
10503 <table>
10504 <tbody>
10505 <tr><th>Foo </th><th>Bar</th></tr>
10506 <tr>
10507 <td>Foo1 </td>
10508 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10509 !! end
10510
10511 !! test
10512 Bug 3090: External links other than http: in image captions
10513 !! wikitext
10514 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10515 !! html/php
10516 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
10517
10518 !! html/parsoid
10519 <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>
10520 !! end
10521
10522 !! test
10523 Custom class
10524 !! options
10525 parsoid=wt2html,wt2wt,html2html
10526 !! wikitext
10527 [[Image:foobar.jpg|a|class=b]]
10528 !! html/php
10529 <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>
10530 </p>
10531 !! html/parsoid
10532 <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>
10533 !! end
10534
10535 !! test
10536 Localized image handling (1).
10537 !! options
10538 parsoid=wt2html,wt2wt,html2html
10539 language=es
10540 !! wikitext
10541 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10542 !! html/php
10543 <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>
10544
10545 !! html/parsoid
10546 <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>
10547 !! end
10548
10549 !! test
10550 Localized image handling (2).
10551 !! options
10552 parsoid=wt2html,wt2wt,html2html
10553 language=es
10554 !! wikitext
10555 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10556 !! html/php
10557 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><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/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10558
10559 !! html/parsoid
10560 <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>
10561 !! end
10562
10563 !! test
10564 "border", "frameless" and "class" attributes on an image.
10565 !! options
10566 parsoid=wt2html,wt2wt,html2html
10567 !! wikitext
10568 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10569 !! html/php
10570 <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" class="extra thumbborder" 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>
10571 </p>
10572 !! html/parsoid
10573 <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>
10574 !! end
10575
10576 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10577 !! test
10578 Invalid image attributes (bug 62500)
10579 !! options
10580 parsoid=wt2html,wt2wt,html2html
10581 !! wikitext
10582 [[File:Foobar.jpg|thumb|float|left|caption]]
10583
10584 [[File:Foobar.jpg|thumb|righ|caption]]
10585
10586 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10587 !! html/php
10588 <div class="thumb tleft"><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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10589 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10590 <div class="thumb tleft"><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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10591
10592 !! html/parsoid
10593 <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><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><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>
10594 !! end
10595
10596 !! article
10597 File:Barfoo.jpg
10598 !! text
10599 #REDIRECT [[File:Barfoo.jpg]]
10600 !! endarticle
10601
10602 !! test
10603 Redirected image
10604 !! wikitext
10605 [[Image:Barfoo.jpg]]
10606 !! html
10607 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10608 </p>
10609 !! end
10610
10611 !! test
10612 Missing image with uploads disabled
10613 !! options
10614 wgEnableUploads=0
10615 !! wikitext
10616 [[Image:Foobaz.jpg]]
10617 !! html
10618 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10619 </p>
10620 !! end
10621
10622 # Parsoid-specific testing for images
10623 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10624 # Currently imperfect due to a flaw in the Parsoid testrunner
10625 # Work in progress
10626 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10627 # image tests.
10628
10629 !! test
10630 Parsoid-specific image handling - simple image with size and middle alignment
10631 !! wikitext
10632 [[File:Foobar.jpg|middle|50px]]
10633 !! html/parsoid
10634 <p><span class="mw-valign-middle" typeof="mw:Image">
10635 <a href="File:Foobar.jpg">
10636 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10637 </a>
10638 </span>
10639 </p>
10640 !! end
10641
10642 !! test
10643 Parsoid-specific image handling - simple image with size, middle alignment,
10644 non-standard namespace alias
10645 !! options
10646 parsoid=wt2wt,wt2html,html2html
10647 !! wikitext
10648 [[Image:Foobar.jpg|middle|50px]]
10649 !! html/parsoid
10650 <p><span class="mw-valign-middle" typeof="mw:Image">
10651 <a href="File:Foobar.jpg">
10652 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10653 </a>
10654 </span>
10655 </p>
10656 !! end
10657
10658 !! test
10659 Parsoid-specific image handling - simple image with size and middle alignment
10660 (existing content)
10661 !! wikitext
10662 [[File:Foobar.jpg|50px|middle]]
10663 !! html/parsoid
10664 <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>
10665 !! end
10666
10667 !! test
10668 Parsoid-specific image handling - simple image with size and middle alignment
10669 and non-standard namespace name
10670 !! options
10671 parsoid=wt2html,wt2wt,html2html
10672 !! wikitext
10673 [[Image:Foobar.jpg|50px|middle]]
10674 !! html/parsoid
10675 <p><span class="mw-valign-middle" typeof="mw:Image">
10676 <a href="File:Foobar.jpg">
10677 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10678 </a>
10679 </span>
10680 </p>
10681 !! end
10682
10683 !! test
10684 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10685 !! wikitext
10686 [[File:Foobar.jpg|500x10px|baseline|caption]]
10687 !! html/parsoid
10688 <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>
10689 !! end
10690
10691 !! test
10692 Parsoid-specific image handling - simple image with border and size spec
10693 !! wikitext
10694 [[File:Foobar.jpg|50px|border|caption]]
10695 !! html/parsoid
10696 <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>
10697 !! end
10698
10699 !! test
10700 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10701 !! wikitext
10702 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10703 !! html/parsoid
10704 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10705 <a href="File:Foobar.jpg">
10706 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10707 </a>
10708 <figcaption>caption content</figcaption>
10709 </figure>
10710 !! end
10711
10712 !! test
10713 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10714 (existing content)
10715 !! wikitext
10716 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10717 !! html/parsoid
10718 <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>
10719 !! end
10720
10721 !! test
10722 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10723 !! wikitext
10724 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10725 !! html/parsoid
10726 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10727 <a href="File:Foobar.jpg">
10728 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10729 </a>
10730 <figcaption>caption</figcaption>
10731 </figure>
10732 !! end
10733
10734 !! test
10735 Parsoid-specific image handling - thumbnail with specific size, halign,
10736 valign, and caption (existing content)
10737 !! wikitext
10738 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10739 !! html/parsoid
10740 <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>
10741 !! end
10742
10743 !! test
10744 Parsoid-specific image handling - framed image with specific size and caption
10745 !! wikitext
10746 [[Image:Foobar.jpg|frame|500x50px|caption]]
10747 !! html/parsoid
10748 <figure typeof="mw:Image/Frame">
10749 <a href="File:Foobar.jpg">
10750 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10751 </a>
10752 <figcaption>caption</figcaption>
10753 </figure>
10754 !! end
10755
10756 !! test
10757 Parsoid-specific image handling - framed image with specific size and caption
10758 (existing content)
10759 !! wikitext
10760 [[File:Foobar.jpg|442x50px|frame|caption]]
10761 !! html/parsoid
10762 <figure typeof="mw:Image/Frame" data-parsoid='{"optList":[{"ck":"width","ak":"442x50px"},{"ck":"framed","ak":"frame"},{"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><figcaption>caption</figcaption></figure>
10763 !! end
10764
10765 !! test
10766 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10767 !! wikitext
10768 [[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10769 !! html/parsoid
10770 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10771 <a href="File:Foobar.jpg">
10772 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10773 </a>
10774 <figcaption>caption</figcaption>
10775 </figure>
10776 !! end
10777
10778 !! test
10779 Parsoid-specific image handling - framed image with specific size, halign,
10780 valign, and caption (existing content)
10781 !! wikitext
10782 [[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
10783 !! html/parsoid
10784 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame" data-parsoid='{"optList":[{"ck":"width","ak":"442x50px"},{"ck":"framed","ak":"frame"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"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><figcaption>caption</figcaption></figure>
10785 !! end
10786
10787 !! test
10788 Parsoid-specific image handling - frameless image with specific size, border, and caption
10789 !! wikitext
10790 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
10791 !! html/parsoid
10792 <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>
10793 !! end
10794
10795 !! test
10796 Parsoid-specific image handling - simple image with a formatted caption
10797 !! wikitext
10798 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10799 !! html/parsoid
10800 <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>"}'>
10801 <a href="File:Foobar.jpg">
10802 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10803 </a></span></p>
10804 !! end
10805
10806 !! test
10807 Parsoid-specific image handling - caption with a template in it
10808 !! wikitext
10809 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
10810 !! html/parsoid
10811 <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>
10812 !! end
10813
10814 !! test
10815 Parsoid-specific image handling - caption with unbalanced tags in it
10816 !! options
10817 parsoid=wt2html,wt2wt,html2html
10818 !! wikitext
10819 foo
10820 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
10821 bar
10822 !! html/parsoid
10823 <p>foo</p>
10824 <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>
10825 <p>bar</p>
10826 !! end
10827
10828 !! test
10829 Parsoid-specific image handling - empty caption
10830 !! wikitext
10831 [[File:Foobar.jpg|thumb|]]
10832 !! html/parsoid
10833 <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>
10834 !! end
10835
10836 !! test
10837 Parsoid-specific image handling - whitespace caption
10838 !! wikitext
10839 [[File:Foobar.jpg|thumb| ]]
10840 !! html/parsoid
10841 <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>
10842 !! end
10843
10844 !! test
10845 Parsoid-specific image handling - lang option
10846 !! wikitext
10847 foo
10848 [[File:Foobar.svg|lang=de|caption]]
10849 bar
10850 !! html/parsoid
10851 <p>foo
10852 <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>
10853 bar</p>
10854 !! end
10855
10856
10857 ###
10858 ### Subpages
10859 ###
10860 !! article
10861 Subpage test/subpage
10862 !! text
10863 foo
10864 !! endarticle
10865
10866 !! test
10867 Subpage link
10868 !! options
10869 subpage title=[[Subpage test]]
10870 !! wikitext
10871 [[/subpage]]
10872 !! html
10873 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10874 </p>
10875 !! end
10876
10877 !! test
10878 Subpage noslash link
10879 !! options
10880 subpage title=[[Subpage test]]
10881 !! wikitext
10882 [[/subpage/]]
10883 !! html
10884 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10885 </p>
10886 !! end
10887
10888 # TODO: make this PHP-parser compatible!
10889 !! test
10890 Relative subpage noslash link
10891 !! options
10892 parsoid=wt2wt,wt2html,html2html
10893 subpage title=[[Subpage test/1/2/3/4]]
10894 !! wikitext
10895 [[../../subpage/]]
10896
10897 [[../../subpage]]
10898 !! html
10899 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10900 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10901 !! end
10902
10903 # TODO: make this PHP-parser compatible!
10904 !! test
10905 Parsoid: dot-slash prefixed wikilinks
10906 !! options
10907 parsoid=wt2wt,wt2html,html2html
10908 !! wikitext
10909 [[./foo]]
10910
10911 [[././bar]]
10912
10913 [[././baz/]]
10914 !! html
10915 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10916 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10917 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10918 !! end
10919
10920 !! test
10921 Disabled subpages
10922 !! wikitext
10923 [[/subpage]]
10924 !! html
10925 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10926 </p>
10927 !! end
10928
10929 !! test
10930 BUG 561: {{/Subpage}}
10931 !! options
10932 subpage title=[[Page]]
10933 !! wikitext
10934 {{/Subpage}}
10935 !! html
10936 <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>
10937 </p>
10938 !! end
10939
10940 ###
10941 ### Categories
10942 ###
10943 !! article
10944 Category:MediaWiki User's Guide
10945 !! text
10946 blah
10947 !! endarticle
10948
10949 !! test
10950 Link to category
10951 !! wikitext
10952 [[:Category:MediaWiki User's Guide]]
10953 !! html
10954 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10955 </p>
10956 !! end
10957
10958 !! test
10959 Simple category
10960 !! options
10961 cat
10962 !! wikitext
10963 [[Category:MediaWiki User's Guide]]
10964 !! html
10965 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10966 !! end
10967
10968 !! test
10969 PAGESINCATEGORY invalid title fatal (r33546 fix)
10970 !! wikitext
10971 {{PAGESINCATEGORY:<bogus>}}
10972 !! html
10973 <p>0
10974 </p>
10975 !! end
10976
10977 !! test
10978 Category with different sort key
10979 !! options
10980 cat
10981 !! wikitext
10982 [[Category:MediaWiki User's Guide|Foo]]
10983 !! html
10984 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10985 !! end
10986
10987 !! test
10988 Category with identical sort key
10989 !! options
10990 cat
10991 !! wikitext
10992 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10993 !! html
10994 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10995 !! end
10996
10997 !! test
10998 Category with empty sort key
10999 !! options
11000 cat
11001 pst
11002 !! wikitext
11003 [[Category:MediaWiki User's Guide|]]
11004 !! html
11005 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11006 !! end
11007
11008 !! test
11009 Category with empty sort key and parentheses
11010 !! options
11011 cat
11012 pst
11013 !! wikitext
11014 [[Category:Foo (bar)|]]
11015 !! html
11016 [[Category:Foo (bar)|Foo]]
11017 !! end
11018
11019 !! test
11020 Category with link tail
11021 !! options
11022 cat
11023 pst
11024 !! wikitext
11025 123[[Category:Foo]]456
11026 !! html
11027 123[[Category:Foo]]456
11028 !! end
11029
11030 !! test
11031 Category with template
11032 !! options
11033 cat
11034 pst
11035 !! wikitext
11036 [[Category:{{echo|Foo}}]]
11037 !! html
11038 [[Category:{{echo|Foo}}]]
11039 !! end
11040
11041 !! test
11042 Category with template in sort key
11043 !! options
11044 cat
11045 pst
11046 !! wikitext
11047 [[Category:Foo|{{echo|Bar}}]]
11048 !! html
11049 [[Category:Foo|{{echo|Bar}}]]
11050 !! end
11051
11052 !! test
11053 Category with template in sort key and title
11054 !! options
11055 cat
11056 pst
11057 !! wikitext
11058 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11059 !! html
11060 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11061 !! end
11062
11063 !! test
11064 Category / paragraph interactions
11065 !! wikitext
11066 Foo [[Category:Baz]] Bar
11067
11068 Foo [[Category:Baz]]
11069 Bar
11070
11071 Foo
11072 [[Category:Baz]]
11073 Bar
11074
11075 Foo
11076 [[Category:Baz]] Bar
11077
11078 Foo
11079 [[Category:Baz]]
11080 [[Category:Baz]]
11081 [[Category:Baz]]
11082 Bar
11083
11084 [[Category:Baz]]
11085 [[Category:Baz]]
11086 [[Category:Baz]]
11087
11088 [[Category:Baz]]
11089 {{echo|[[Category:Baz]]}}
11090 [[Category:Baz]]
11091 !! html
11092 <p>Foo Bar
11093 </p><p>Foo
11094 Bar
11095 </p><p>Foo
11096 Bar
11097 </p><p>Foo Bar
11098 </p><p>Foo
11099 Bar
11100 </p>
11101 !! end
11102
11103 !! test
11104 Parsoid: Serialize link to category page with colon escape
11105 !! options
11106 parsoid
11107 !! wikitext
11108
11109 [[:Category:Foo]]
11110 [[:Category:Foo|Bar]]
11111 !! html
11112 <p>
11113 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11114 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11115 </p>
11116 !! end
11117
11118 !! test
11119 Parsoid: Link prefix/suffixes aren't applied to category links
11120 !! options
11121 parsoid=wt2html,wt2wt,html2html
11122 language=is
11123 !! wikitext
11124 x[[Category:Foo]]y
11125 !! html
11126 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11127 !! end
11128
11129 !! test
11130 Parsoid: Serialize link to file page with colon escape
11131 !! options
11132 parsoid
11133 !! wikitext
11134
11135 [[:File:Foo.png]]
11136 [[:File:Foo.png|Bar]]
11137 !! html
11138 <p>
11139 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11140 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11141 </p>
11142 !! end
11143
11144 !! test
11145 Parsoid: Serialize a genuine category link without colon escape
11146 !! options
11147 parsoid
11148 !! wikitext
11149 [[Category:Foo]]
11150 [[Category:Foo|Bar]]
11151 !! html
11152 <link rel="mw:PageProp/Category" href="Category:Foo">
11153 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11154 !! end
11155
11156 !! test
11157 Parsoid: Defaultsort
11158 !! options
11159 parsoid
11160 !! wikitext
11161 {{DEFAULTSORT:Foo}}
11162 !! html
11163 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11164 !! end
11165
11166 ###
11167 ### Inter-language links
11168 ###
11169 !! test
11170 Inter-language links
11171 !! options
11172 ill
11173 !! wikitext
11174 [[es:Alimento]]
11175 [[fr:Nourriture]]
11176 [[zh:&#39135;&#21697;]]
11177 !! html
11178 es:Alimento fr:Nourriture zh:食品
11179 !! end
11180
11181 !! test
11182 Duplicate interlanguage links (bug 24502)
11183 !! options
11184 ill
11185 !! wikitext
11186 [[es:1]]
11187 [[es:2]]
11188 [[fr:1]]
11189 [[fr:2]]
11190 !! html
11191 es:1 fr:1
11192 !! end
11193
11194 ###
11195 ### Sections
11196 ###
11197 !! test
11198 Basic section headings
11199 !! wikitext
11200 == Headline 1 ==
11201 Some text
11202
11203 ==Headline 2==
11204 More
11205 ===Smaller headline===
11206 Blah blah
11207 !! html
11208 <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>
11209 <p>Some text
11210 </p>
11211 <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>
11212 <p>More
11213 </p>
11214 <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>
11215 <p>Blah blah
11216 </p>
11217 !! end
11218
11219 !! test
11220 Section headings with TOC
11221 !! wikitext
11222 == Headline 1 ==
11223 === Subheadline 1 ===
11224 ===== Skipping a level =====
11225 ====== Skipping a level ======
11226
11227 == Headline 2 ==
11228 Some text
11229 ===Another headline===
11230 !! html
11231 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11232 <ul>
11233 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11234 <ul>
11235 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11236 <ul>
11237 <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>
11238 <ul>
11239 <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>
11240 </ul>
11241 </li>
11242 </ul>
11243 </li>
11244 </ul>
11245 </li>
11246 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11247 <ul>
11248 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11249 </ul>
11250 </li>
11251 </ul>
11252 </div>
11253
11254 <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>
11255 <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>
11256 <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>
11257 <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>
11258 <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>
11259 <p>Some text
11260 </p>
11261 <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>
11262
11263 !! end
11264
11265 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11266 !! test
11267 Handling of sections up to level 6 and beyond
11268 !! wikitext
11269 = Level 1 Heading=
11270 == Level 2 Heading==
11271 === Level 3 Heading===
11272 ==== Level 4 Heading====
11273 ===== Level 5 Heading=====
11274 ====== Level 6 Heading======
11275 ======= Level 7 Heading=======
11276 ======== Level 8 Heading========
11277 ========= Level 9 Heading=========
11278 ========== Level 10 Heading==========
11279 !! html
11280 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11281 <ul>
11282 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11283 <ul>
11284 <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>
11285 <ul>
11286 <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>
11287 <ul>
11288 <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>
11289 <ul>
11290 <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>
11291 <ul>
11292 <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>
11293 <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>
11294 <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>
11295 <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>
11296 <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>
11297 </ul>
11298 </li>
11299 </ul>
11300 </li>
11301 </ul>
11302 </li>
11303 </ul>
11304 </li>
11305 </ul>
11306 </li>
11307 </ul>
11308 </div>
11309
11310 <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>
11311 <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>
11312 <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>
11313 <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>
11314 <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>
11315 <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>
11316 <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>
11317 <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>
11318 <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>
11319 <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>
11320
11321 !! end
11322
11323 !! test
11324 TOC regression (bug 9764)
11325 !! wikitext
11326 == title 1 ==
11327 === title 1.1 ===
11328 ==== title 1.1.1 ====
11329 === title 1.2 ===
11330 == title 2 ==
11331 === title 2.1 ===
11332 !! html
11333 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11334 <ul>
11335 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11336 <ul>
11337 <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>
11338 <ul>
11339 <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>
11340 </ul>
11341 </li>
11342 <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>
11343 </ul>
11344 </li>
11345 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11346 <ul>
11347 <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>
11348 </ul>
11349 </li>
11350 </ul>
11351 </div>
11352
11353 <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>
11354 <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>
11355 <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>
11356 <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>
11357 <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>
11358 <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>
11359
11360 !! end
11361
11362 !! test
11363 TOC with wgMaxTocLevel=3 (bug 6204)
11364 !! options
11365 wgMaxTocLevel=3
11366 !! wikitext
11367 == title 1 ==
11368 === title 1.1 ===
11369 ==== title 1.1.1 ====
11370 === title 1.2 ===
11371 == title 2 ==
11372 === title 2.1 ===
11373 !! html
11374 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11375 <ul>
11376 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11377 <ul>
11378 <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>
11379 <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>
11380 </ul>
11381 </li>
11382 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11383 <ul>
11384 <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>
11385 </ul>
11386 </li>
11387 </ul>
11388 </div>
11389
11390 <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>
11391 <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>
11392 <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>
11393 <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>
11394 <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>
11395 <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>
11396
11397 !! end
11398
11399 !! test
11400 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11401 !! options
11402 wgMaxTocLevel=3
11403 !! wikitext
11404 ==Section 1==
11405 ===Section 1.1===
11406 ====Section 1.1.1====
11407 ====Section 1.1.1.1====
11408 ==Section 2==
11409 !! html
11410 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11411 <ul>
11412 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11413 <ul>
11414 <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>
11415 </ul>
11416 </li>
11417 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11418 </ul>
11419 </div>
11420
11421 <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>
11422 <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>
11423 <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>
11424 <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>
11425 <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>
11426
11427 !! end
11428
11429
11430 !! test
11431 Resolving duplicate section names
11432 !! wikitext
11433 == Foo bar ==
11434 == Foo bar ==
11435 !! html
11436 <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>
11437 <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>
11438
11439 !! end
11440
11441 !! test
11442 Resolving duplicate section names with differing case (bug 10721)
11443 !! wikitext
11444 == Foo bar ==
11445 == Foo Bar ==
11446 !! html
11447 <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>
11448 <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>
11449
11450 !! end
11451
11452 !! article
11453 Template:sections
11454 !! text
11455 ===Section 1===
11456 ==Section 2==
11457 !! endarticle
11458
11459 !! test
11460 Template with sections, __NOTOC__
11461 !! wikitext
11462 __NOTOC__
11463 ==Section 0==
11464 {{sections}}
11465 ==Section 4==
11466 !! html
11467 <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>
11468 <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>
11469 <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>
11470 <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>
11471
11472 !! end
11473
11474 !! test
11475 __NOEDITSECTION__ keyword
11476 !! wikitext
11477 __NOEDITSECTION__
11478 ==Section 1==
11479 ==Section 2==
11480 !! html
11481 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11482 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11483
11484 !! end
11485
11486 !! test
11487 Link inside a section heading
11488 !! wikitext
11489 ==Section with a [[Main Page|link]] in it==
11490 !! html
11491 <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>
11492
11493 !! end
11494
11495 !! test
11496 TOC regression (bug 12077)
11497 !! wikitext
11498 __TOC__
11499 == title 1 ==
11500 === title 1.1 ===
11501 == title 2 ==
11502 !! html
11503 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11504 <ul>
11505 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11506 <ul>
11507 <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>
11508 </ul>
11509 </li>
11510 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11511 </ul>
11512 </div>
11513
11514 <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>
11515 <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>
11516 <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>
11517
11518 !! end
11519
11520 !! test
11521 BUG 1219 URL next to image (good)
11522 !! wikitext
11523 http://example.com [[Image:foobar.jpg]]
11524 !! html
11525 <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>
11526 </p>
11527 !!end
11528
11529 !! test
11530 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11531 !! wikitext
11532 ===
11533 The line above must have a trailing space!
11534 === <!--
11535 --> <!-- -->
11536 But just in case it doesn't...
11537 !! html
11538 <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>
11539 <p>The line above must have a trailing space!
11540 </p>
11541 <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>
11542 <p>But just in case it doesn't...
11543 </p>
11544 !! end
11545
11546 !! test
11547 Header with special characters (bug 25462)
11548 !! wikitext
11549 The tooltips shall not show entities to the user (ie. be double escaped)
11550
11551 == text > text ==
11552 section 1
11553
11554 == text < text ==
11555 section 2
11556
11557 == text & text ==
11558 section 3
11559
11560 == text ' text ==
11561 section 4
11562
11563 == text " text ==
11564 section 5
11565 !! html
11566 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11567 </p>
11568 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11569 <ul>
11570 <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>
11571 <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>
11572 <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>
11573 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11574 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11575 </ul>
11576 </div>
11577
11578 <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>
11579 <p>section 1
11580 </p>
11581 <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>
11582 <p>section 2
11583 </p>
11584 <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>
11585 <p>section 3
11586 </p>
11587 <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>
11588 <p>section 4
11589 </p>
11590 <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>
11591 <p>section 5
11592 </p>
11593 !! end
11594
11595 !! test
11596 Headers with excess '=' characters
11597 (Are similar tests necessary beyond the 1st level?)
11598 !! wikitext
11599 =foo==
11600 ==foo=
11601 =''italic'' heading==
11602 ==''italic'' heading=
11603 !! html
11604 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11605 <ul>
11606 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11607 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11608 <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>
11609 <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>
11610 </ul>
11611 </div>
11612
11613 <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>
11614 <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>
11615 <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>
11616 <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>
11617
11618 !! end
11619
11620 !! test
11621 HTML headers vs TOC (bug 23393)
11622 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11623 !! wikitext
11624 <h1>Header 1</h1>
11625 == Header 1.1 ==
11626 == Header 1.2 ==
11627
11628 <h1>Header 2
11629 </h1>
11630 == Header 2.1 ==
11631 == Header 2.2 ==
11632 __NOEDITSECTION__
11633 !! html
11634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11635 <ul>
11636 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11637 <ul>
11638 <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>
11639 <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>
11640 </ul>
11641 </li>
11642 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11643 <ul>
11644 <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>
11645 <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>
11646 </ul>
11647 </li>
11648 </ul>
11649 </div>
11650
11651 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11652 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11653 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11654 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11655 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11656 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11657
11658 !! end
11659
11660 !! test
11661 BUG 1219 URL next to image (broken)
11662 !! wikitext
11663 http://example.com[[Image:foobar.jpg]]
11664 !! html
11665 <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>
11666 </p>
11667 !!end
11668
11669 !! test
11670 Bug 1186 news: in the middle of text
11671 !! wikitext
11672 http://en.wikinews.org/wiki/Wikinews:Workplace
11673 !! html
11674 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11675 </p>
11676 !!end
11677
11678
11679 !! test
11680 Namespaced link must have a title
11681 !! wikitext
11682 [[Project:]]
11683 !! html
11684 <p>[[Project:]]
11685 </p>
11686 !!end
11687
11688 !! test
11689 Namespaced link must have a title (bad fragment version)
11690 !! wikitext
11691 [[Project:#fragment]]
11692 !! html
11693 <p>[[Project:#fragment]]
11694 </p>
11695 !!end
11696
11697
11698 ###
11699 ### HTML tags and HTML attributes
11700 ###
11701
11702 !! test
11703 div with no attributes
11704 !! wikitext
11705 <div>HTML rocks</div>
11706 !! html
11707 <div>HTML rocks</div>
11708
11709 !! end
11710
11711 !! test
11712 div with double-quoted attribute
11713 !! wikitext
11714 <div id="rock">HTML rocks</div>
11715 !! html
11716 <div id="rock">HTML rocks</div>
11717
11718 !! end
11719
11720 !! test
11721 div with single-quoted attribute
11722 !! wikitext
11723 <div id='rock'>HTML rocks</div>
11724 !! html
11725 <div id="rock">HTML rocks</div>
11726
11727 !! end
11728
11729 !! test
11730 div with unquoted attribute
11731 !! wikitext
11732 <div id=rock>HTML rocks</div>
11733 !! html
11734 <div id="rock">HTML rocks</div>
11735
11736 !! end
11737
11738 !! test
11739 div with illegal double attributes
11740 !! wikitext
11741 <div id="a" id="b">HTML rocks</div>
11742 !! html
11743 <div id="b">HTML rocks</div>
11744
11745 !!end
11746
11747 # FIXME: produce empty string instead of "class" in the PHP parser, following
11748 # the HTML5 spec.
11749 !! test
11750 div with empty attribute value, space before equals
11751 !! options
11752 parsoid
11753 !! wikitext
11754 <div class =>HTML rocks</div>
11755 !! html
11756 <div class="">HTML rocks</div>
11757
11758 !! end
11759
11760 # The PHP parser escapes the opening brace to &#123; for some reason, so
11761 # disabled this test for it.
11762 !! test
11763 div with braces in attribute value
11764 !! options
11765 parsoid
11766 !! wikitext
11767 <div title="{}">Foo</div>
11768 !! html
11769 <div title="{}">Foo</div>
11770 !! end
11771
11772 # This it very inconsistent in the PHP parser: it returns
11773 # class="class" if there is a space between the name and the equal sign (see
11774 # 'div with empty attribute value, space before equals'), but strips the
11775 # attribute completely if the space is missing. We hope that not much content
11776 # depends on this, so are implementing the behavior below in Parsoid for
11777 # consistencies' sake. Disabled for the PHP parser.
11778 # FIXME: fix this behavior in the PHP parser?
11779 !! test
11780 div with empty attribute value, no space before equals
11781 !! options
11782 parsoid
11783 !! wikitext
11784 <div class=>HTML rocks</div>
11785 !! html
11786 <div class="">HTML rocks</div>
11787
11788 !! end
11789
11790 !! test
11791 HTML multiple attributes correction
11792 !! wikitext
11793 <p class="error" class="awesome">Awesome!</p>
11794 !! html
11795 <p class="awesome">Awesome!</p>
11796
11797 !!end
11798
11799 !! test
11800 Table multiple attributes correction
11801 !! wikitext
11802 {|
11803 !+ class="error" class="awesome"| status
11804 |}
11805 !! html
11806 <table>
11807 <tr>
11808 <th class="awesome"> status
11809 </th></tr></table>
11810
11811 !!end
11812
11813 !! test
11814 DIV IN UPPERCASE
11815 !! wikitext
11816 <DIV ID="x">HTML ROCKS</DIV>
11817 !! html
11818 <div id="x">HTML ROCKS</div>
11819
11820 !!end
11821
11822 !! test
11823 Non-ASCII pseudo-tags are rendered as text
11824 !! wikitext
11825 <khyô>
11826 !! html
11827 <p>&lt;khyô&gt;
11828 </p>
11829 !! end
11830
11831 !! test
11832 Pseudo-tag with URL 'name' renders as url link
11833 !! wikitext
11834 <http://example.com/>
11835 !! html
11836 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11837 </p>
11838 !! end
11839
11840 !! test
11841 text with amp in the middle of nowhere
11842 !! wikitext
11843 Remember AT&T?
11844 !! html
11845 <p>Remember AT&amp;T?
11846 </p>
11847 !! end
11848
11849 !! test
11850 text with character entity: eacute
11851 !! wikitext
11852 I always thought &eacute; was a cute letter.
11853 !! html
11854 <p>I always thought &#233; was a cute letter.
11855 </p>
11856 !! end
11857
11858 !! test
11859 text with entity-escaped character entity-like string: eacute
11860 !! wikitext
11861 I always thought &amp;eacute; was a cute letter.
11862 !! html
11863 <p>I always thought &amp;eacute; was a cute letter.
11864 </p>
11865 !! end
11866
11867 !! test
11868 text with undefined character entity: xacute
11869 !! wikitext
11870 I always thought &xacute; was a cute letter.
11871 !! html
11872 <p>I always thought &amp;xacute; was a cute letter.
11873 </p>
11874 !! end
11875
11876 # TODO: generalize to PHP parser?
11877 !! test
11878 HTML5 tags
11879 !! options
11880 parsoid
11881 !! wikitext
11882 <data value="5">five</data>
11883 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11884 <mark>This highlighted text</mark>
11885 !! html
11886 <p><data value="5">five</data>
11887 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11888 <mark>This highlighted text</mark></p>
11889 !! end
11890
11891 !! test
11892 HTML tag with leading space is parsed as text
11893 !! wikitext
11894 < div>foo< /div>
11895 !! html
11896 <p>&lt; div&gt;foo&lt; /div&gt;
11897 </p>
11898 !! end
11899
11900 ###
11901 ### Nesting tests (see bug 41545, 50604, 51081)
11902 ###
11903
11904 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11905 # Note that html2wt is considerably more difficult if we use <b> in
11906 # the test case, instead of <big>
11907 !! test
11908 Ensure that HTML adoption agency algorithm is properly implemented.
11909 !! wikitext
11910 <big>X<big>Y</big>Z</big>
11911 !! html
11912 <p><big>X<big>Y</big>Z</big>
11913 </p>
11914 !! end
11915
11916 # This was bug 41545 in the PHP parser.
11917 !! test
11918 Nesting of <kbd>
11919 !! wikitext
11920 <kbd>X<kbd>Y</kbd>Z</kbd>
11921 !! html
11922 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11923 </p>
11924 !! end
11925
11926 # The following cases were bug 51081 in the PHP parser.
11927 # Note that there are some other nestable tags (b, i, etc) which are
11928 # not covered; see bug 51081 for discussion.
11929 !! test
11930 Nesting of <em>
11931 !! wikitext
11932 <em>X<em>Y</em>Z</em>
11933 !! html
11934 <p><em>X<em>Y</em>Z</em>
11935 </p>
11936 !! end
11937
11938 !! test
11939 Nesting of <strong>
11940 !! wikitext
11941 <strong>X<strong>Y</strong>Z</strong>
11942 !! html
11943 <p><strong>X<strong>Y</strong>Z</strong>
11944 </p>
11945 !! end
11946
11947 !! test
11948 Nesting of <q>
11949 !! wikitext
11950 <q>X<q>Y</q>Z</q>
11951 !! html
11952 <p><q>X<q>Y</q>Z</q>
11953 </p>
11954 !! end
11955
11956 !! test
11957 Nesting of <ruby>
11958 !! wikitext
11959 <ruby>X<ruby>Y</ruby>Z</ruby>
11960 !! html
11961 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11962 </p>
11963 !! end
11964
11965 !! test
11966 Nesting of <bdo>
11967 !! wikitext
11968 <bdo>X<bdo>Y</bdo>Z</bdo>
11969 !! html
11970 <p><bdo>X<bdo>Y</bdo>Z</bdo>
11971 </p>
11972 !! end
11973
11974
11975 ###
11976 ### Media links
11977 ###
11978
11979 !! test
11980 Media link
11981 !! wikitext
11982 [[Media:Foobar.jpg]]
11983 !! html
11984 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
11985 </p>
11986 !! end
11987
11988 !! test
11989 Media link with text
11990 !! wikitext
11991 [[Media:Foobar.jpg|A neat file to look at]]
11992 !! html
11993 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
11994 </p>
11995 !! end
11996
11997 # FIXME: this is still bad HTML tag nesting
11998 !! test
11999 Media link with nasty text
12000 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12001 !! wikitext
12002 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12003 !! html
12004 <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>
12005
12006 !! end
12007
12008 !! test
12009 Media link to nonexistent file (bug 1702)
12010 !! wikitext
12011 [[Media:No such.jpg]]
12012 !! html
12013 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12014 </p>
12015 !! end
12016
12017 !! test
12018 Image link to nonexistent file (bug 1850 - good)
12019 !! wikitext
12020 [[Image:No such.jpg]]
12021 !! html
12022 <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>
12023 </p>
12024 !! end
12025
12026 !! test
12027 :Image link to nonexistent file (bug 1850 - bad)
12028 !! wikitext
12029 [[:Image:No such.jpg]]
12030 !! html
12031 <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>
12032 </p>
12033 !! end
12034
12035
12036
12037 !! test
12038 Character reference normalization in link text (bug 1938)
12039 !! wikitext
12040 [[Main Page|this&that]]
12041 !! html
12042 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12043 </p>
12044 !!end
12045
12046 !! article
12047 אַ
12048 !! text
12049 Test for unicode normalization
12050
12051 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12052 !! endarticle
12053
12054 !! test
12055 (bug 19451) Links should refer to the normalized form.
12056 !! wikitext
12057 [[&#xFB2E;]]
12058 [[&#x5d0;&#x5b7;]]
12059 [[&#x5d0;ַ]]
12060 [[א&#x5b7;]]
12061 [[אַ]]
12062 !! html
12063 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12064 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12065 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12066 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12067 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12068 </p>
12069 !! end
12070
12071 !! test
12072 Empty attribute crash test (bug 2067)
12073 !! wikitext
12074 <font color="">foo</font>
12075 !! html
12076 <p><font color="">foo</font>
12077 </p>
12078 !! end
12079
12080 !! test
12081 Empty attribute crash test single-quotes (bug 2067)
12082 !! wikitext
12083 <font color=''>foo</font>
12084 !! html
12085 <p><font color="">foo</font>
12086 </p>
12087 !! end
12088
12089 !! test
12090 Attribute test: equals, then nothing
12091 !! wikitext
12092 <font color=>foo</font>
12093 !! html
12094 <p><font>foo</font>
12095 </p>
12096 !! end
12097
12098 !! test
12099 Attribute test: unquoted value
12100 !! wikitext
12101 <font color=x>foo</font>
12102 !! html
12103 <p><font color="x">foo</font>
12104 </p>
12105 !! end
12106
12107 !! test
12108 Attribute test: unquoted but illegal value (hash)
12109 !! wikitext
12110 <font color=#x>foo</font>
12111 !! html
12112 <p><font color="#x">foo</font>
12113 </p>
12114 !! end
12115
12116 !! test
12117 Attribute test: no value
12118 !! wikitext
12119 <font color>foo</font>
12120 !! html
12121 <p><font color="color">foo</font>
12122 </p>
12123 !! end
12124
12125 !! test
12126 Bug 2095: link with three closing brackets
12127 !! wikitext
12128 [[Main Page]]]
12129 !! html
12130 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12131 </p>
12132 !! end
12133
12134 !! test
12135 Bug 2095: link with pipe and three closing brackets
12136 !! wikitext
12137 [[Main Page|link]]]
12138 !! html
12139 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12140 </p>
12141 !! end
12142
12143 !! test
12144 Bug 2095: link with pipe and three closing brackets, version 2
12145 !! wikitext
12146 [[Main Page|[http://example.com/]]]
12147 !! html
12148 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12149 </p>
12150 !! end
12151
12152
12153 ###
12154 ### Safety
12155 ###
12156
12157 !! article
12158 Template:Dangerous attribute
12159 !! text
12160 " onmouseover="alert(document.cookie)
12161 !! endarticle
12162
12163 !! article
12164 Template:Dangerous style attribute
12165 !! text
12166 border-size: expression(alert(document.cookie))
12167 !! endarticle
12168
12169 !! article
12170 Template:Div style
12171 !! text
12172 <div style="float: right; {{{1}}}">Magic div</div>
12173 !! endarticle
12174
12175 !! test
12176 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12177 !! wikitext
12178 <div title="{{test}}"></div>
12179 !! html
12180 <div title="This is a test template"></div>
12181
12182 !! end
12183
12184 !! test
12185 Bug 2304: HTML attribute safety (dangerous template; 2309)
12186 !! wikitext
12187 <div title="{{dangerous attribute}}"></div>
12188 !! html
12189 <div title=""></div>
12190
12191 !! end
12192
12193 !! test
12194 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12195 !! wikitext
12196 <div style="{{dangerous style attribute}}"></div>
12197 !! html
12198 <div style="/* insecure input */"></div>
12199
12200 !! end
12201
12202 !! test
12203 Bug 2304: HTML attribute safety (safe parameter; 2309)
12204 !! wikitext
12205 {{div style|width: 200px}}
12206 !! html
12207 <div style="float: right; width: 200px">Magic div</div>
12208
12209 !! end
12210
12211 !! test
12212 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12213 !! wikitext
12214 {{div style|width: expression(alert(document.cookie))}}
12215 !! html
12216 <div style="/* insecure input */">Magic div</div>
12217
12218 !! end
12219
12220 !! test
12221 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12222 !! wikitext
12223 {{div style|"><script>alert(document.cookie)</script>}}
12224 !! html
12225 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12226
12227 !! end
12228
12229 !! test
12230 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12231 !! wikitext
12232 {{div style|" ><script>alert(document.cookie)</script>}}
12233 !! html
12234 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12235
12236 !! end
12237
12238 !! test
12239 Bug 2304: HTML attribute safety (link)
12240 !! wikitext
12241 <div title="[[Main Page]]"></div>
12242 !! html
12243 <div title="&#91;&#91;Main Page]]"></div>
12244
12245 !! end
12246
12247 !! test
12248 Bug 2304: HTML attribute safety (italics)
12249 !! wikitext
12250 <div title="''foobar''"></div>
12251 !! html
12252 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12253
12254 !! end
12255
12256 !! test
12257 Bug 2304: HTML attribute safety (bold)
12258 !! wikitext
12259 <div title="'''foobar'''"></div>
12260 !! html
12261 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12262
12263 !! end
12264
12265
12266 !! test
12267 Bug 2304: HTML attribute safety (ISBN)
12268 !! wikitext
12269 <div title="ISBN 1234567890"></div>
12270 !! html
12271 <div title="&#73;SBN 1234567890"></div>
12272
12273 !! end
12274
12275 !! test
12276 Bug 2304: HTML attribute safety (RFC)
12277 !! wikitext
12278 <div title="RFC 1234"></div>
12279 !! html
12280 <div title="&#82;FC 1234"></div>
12281
12282 !! end
12283
12284 !! test
12285 Bug 2304: HTML attribute safety (PMID)
12286 !! wikitext
12287 <div title="PMID 1234567890"></div>
12288 !! html
12289 <div title="&#80;MID 1234567890"></div>
12290
12291 !! end
12292
12293 !! test
12294 Bug 2304: HTML attribute safety (web link)
12295 !! wikitext
12296 <div title="http://example.com/"></div>
12297 !! html
12298 <div title="http&#58;//example.com/"></div>
12299
12300 !! end
12301
12302 !! test
12303 Bug 2304: HTML attribute safety (named web link)
12304 !! wikitext
12305 <div title="[http://example.com/ link]"></div>
12306 !! html
12307 <div title="&#91;http&#58;//example.com/ link]"></div>
12308
12309 !! end
12310
12311 !! test
12312 Bug 3244: HTML attribute safety (extension; safe)
12313 !! wikitext
12314 <div style="<nowiki>background:blue</nowiki>"></div>
12315 !! html
12316 <div style="background:blue"></div>
12317
12318 !! end
12319
12320 !! test
12321 Bug 3244: HTML attribute safety (extension; unsafe)
12322 !! wikitext
12323 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12324 !! html
12325 <div style="/* insecure input */"></div>
12326
12327 !! end
12328
12329 # More MSIE fun discovered by Tom Gilder
12330
12331 !! test
12332 MSIE CSS safety test: spurious slash
12333 !! wikitext
12334 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12335 !! html
12336 <div style="/* insecure input */">evil</div>
12337
12338 !! end
12339
12340 !! test
12341 MSIE CSS safety test: hex code
12342 !! wikitext
12343 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12344 !! html
12345 <div style="/* insecure input */">evil</div>
12346
12347 !! end
12348
12349 !! test
12350 MSIE CSS safety test: comment in url
12351 !! wikitext
12352 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12353 !! html
12354 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12355
12356 !! end
12357
12358 !! test
12359 MSIE CSS safety test: comment in expression
12360 !! wikitext
12361 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12362 !! html
12363 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12364
12365 !! end
12366
12367 !! test
12368 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12369 !! wikitext
12370 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12371 !! html
12372 <p style="/* invalid control char */">A</p>
12373
12374 !! end
12375
12376 !! test
12377 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12378 !! wikitext
12379 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12380 <div style="top:EXPRESSION(alert())">B</div>
12381 !! html
12382 <p style="/* insecure input */">A</p>
12383 <div style="/* insecure input */">B</div>
12384
12385 !! end
12386
12387 !! test
12388 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12389 !! wikitext
12390 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12391 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12392 !! html
12393 <div style="/* insecure input */">A</div>
12394 <p style="/* insecure input */">B</p>
12395
12396 !! end
12397
12398 !! test
12399 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12400 !! wikitext
12401 <div style="background-image:url⁽javascript:alert())">A</div>
12402 <div style="background-image:url₍javascript:alert())">B</div>
12403 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12404 !! html
12405 <div style="/* insecure input */">A</div>
12406 <div style="/* insecure input */">B</div>
12407 <p style="/* insecure input */">C</p>
12408
12409 !! end
12410
12411 !! test
12412 Opera -o-link CSS
12413 !! wikitext
12414 <div
12415 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;"
12416 style="-o-link:attr(title);-o-link-source:current">X</div>
12417 !! html
12418 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12419
12420 !! end
12421
12422 !! test
12423 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12424 !! wikitext
12425 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12426 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12427 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12428 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12429 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12430 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12431 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12432 !! html
12433 <p style="/* insecure input */">A</p>
12434 <p style="/* insecure input */">B</p>
12435 <p style="/* insecure input */">C</p>
12436 <p style="/* insecure input */">D</p>
12437 <p style="/* insecure input */">E</p>
12438 <p style="/* insecure input */">F</p>
12439 <p style="/* insecure input */">G</p>
12440
12441 !! end
12442
12443 !! test
12444 Table attribute legitimate extension
12445 !! wikitext
12446 {|
12447 !+ style="<nowiki>color:blue</nowiki>"| status
12448 |}
12449 !! html
12450 <table>
12451 <tr>
12452 <th style="color:blue"> status
12453 </th></tr></table>
12454
12455 !!end
12456
12457 !! test
12458 Table attribute safety
12459 !! wikitext
12460 {|
12461 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12462 |}
12463 !! html
12464 <table>
12465 <tr>
12466 <th style="/* insecure input */"> status
12467 </th></tr></table>
12468
12469 !! end
12470
12471 !! test
12472 CSS line continuation 1
12473 !! wikitext
12474 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12475 !! html
12476 <div style="/* insecure input */"></div>
12477
12478 !! end
12479
12480 !! test
12481 CSS line continuation 2
12482 !! wikitext
12483 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12484 !! html
12485 <div style="/* insecure input */"></div>
12486
12487 !! end
12488
12489 !! article
12490 Template:Identity
12491 !! text
12492 {{{1}}}
12493 !! endarticle
12494
12495 !! test
12496 Expansion of multi-line templates in attribute values (bug 6255)
12497 !! wikitext
12498 <div style="background: {{identity|#00FF00}}">-</div>
12499 !! html
12500 <div style="background: #00FF00">-</div>
12501
12502 !! end
12503
12504
12505 !! test
12506 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12507 !! wikitext
12508 <div style="background:
12509 #00FF00">-</div>
12510 !! html
12511 <div style="background: #00FF00">-</div>
12512
12513 !! end
12514
12515 !! test
12516 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12517 !! wikitext
12518 <div style="background: &#10;#00FF00">-</div>
12519 !! html
12520 <div style="background: &#10;#00FF00">-</div>
12521
12522 !! end
12523
12524 ###
12525 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12526 ###
12527 !! test
12528 Parser hook: empty input
12529 !! wikitext
12530 <tag></tag>
12531 !! html
12532 <pre>
12533 ''
12534 array (
12535 )
12536 </pre>
12537
12538 !! end
12539
12540 !! test
12541 Parser hook: empty input using terminated empty elements
12542 !! wikitext
12543 <tag/>
12544 !! html
12545 <pre>
12546 NULL
12547 array (
12548 )
12549 </pre>
12550
12551 !! end
12552
12553 !! test
12554 Parser hook: empty input using terminated empty elements (space before)
12555 !! wikitext
12556 <tag />
12557 !! html
12558 <pre>
12559 NULL
12560 array (
12561 )
12562 </pre>
12563
12564 !! end
12565
12566 !! test
12567 Parser hook: basic input
12568 !! wikitext
12569 <tag>input</tag>
12570 !! html
12571 <pre>
12572 'input'
12573 array (
12574 )
12575 </pre>
12576
12577 !! end
12578
12579
12580 !! test
12581 Parser hook: case insensitive
12582 !! wikitext
12583 <TAG>input</TAG>
12584 !! html
12585 <pre>
12586 'input'
12587 array (
12588 )
12589 </pre>
12590
12591 !! end
12592
12593
12594 !! test
12595 Parser hook: case insensitive, redux
12596 !! wikitext
12597 <TaG>input</TAg>
12598 !! html
12599 <pre>
12600 'input'
12601 array (
12602 )
12603 </pre>
12604
12605 !! end
12606
12607 !! test
12608 Parser hook: nested tags
12609 !! options
12610 noxml
12611 !! wikitext
12612 <tag><tag></tag></tag>
12613 !! html
12614 <pre>
12615 '<tag>'
12616 array (
12617 )
12618 </pre>&lt;/tag&gt;
12619
12620 !! end
12621
12622 !! test
12623 Parser hook: basic arguments
12624 !! wikitext
12625 <tag width=200 height = "100" depth = '50' square></tag>
12626 !! html
12627 <pre>
12628 ''
12629 array (
12630 'width' => '200',
12631 'height' => '100',
12632 'depth' => '50',
12633 'square' => 'square',
12634 )
12635 </pre>
12636
12637 !! end
12638
12639 !! test
12640 Parser hook: argument containing a forward slash (bug 5344)
12641 !! wikitext
12642 <tag filename='/tmp/bla'></tag>
12643 !! html
12644 <pre>
12645 ''
12646 array (
12647 'filename' => '/tmp/bla',
12648 )
12649 </pre>
12650
12651 !! end
12652
12653 !! test
12654 Parser hook: empty input using terminated empty elements (bug 2374)
12655 !! wikitext
12656 <tag foo=bar/>text
12657 !! html
12658 <pre>
12659 NULL
12660 array (
12661 'foo' => 'bar',
12662 )
12663 </pre>text
12664
12665 !! end
12666
12667 # </tag> should be output literally since there is no matching tag that begins it
12668 !! test
12669 Parser hook: basic arguments using terminated empty elements (bug 2374)
12670 !! wikitext
12671 <tag width=200 height = "100" depth = '50' square/>
12672 other stuff
12673 </tag>
12674 !! html
12675 <pre>
12676 NULL
12677 array (
12678 'width' => '200',
12679 'height' => '100',
12680 'depth' => '50',
12681 'square' => 'square',
12682 )
12683 </pre>
12684 <p>other stuff
12685 &lt;/tag&gt;
12686 </p>
12687 !! end
12688
12689 ###
12690 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12691 ###
12692
12693 !! test
12694 Parser hook: static parser hook not inside a comment
12695 !! wikitext
12696 <statictag>hello, world</statictag>
12697 <statictag action=flush/>
12698 !! html
12699 <p>hello, world
12700 </p>
12701 !! end
12702
12703
12704 !! test
12705 Parser hook: static parser hook inside a comment
12706 !! wikitext
12707 <!-- <statictag>hello, world</statictag> -->
12708 <statictag action=flush/>
12709 !! html
12710 <p><br />
12711 </p>
12712 !! end
12713
12714 # Nested template calls; this case was broken by Parser.php rev 1.506,
12715 # since reverted.
12716
12717 !! article
12718 Template:One-parameter
12719 !! text
12720 (My parameter is: {{{1}}})
12721 !! endarticle
12722
12723 !! article
12724 Template:Map-one-parameter
12725 !! text
12726 {{{{{1}}}|{{{2}}}}}
12727 !! endarticle
12728
12729 !! test
12730 Nested template calls
12731 !! wikitext
12732 {{Map-one-parameter|One-parameter|param}}
12733 !! html
12734 <p>(My parameter is: param)
12735 </p>
12736 !! end
12737
12738
12739 ###
12740 ### Sanitizer
12741 ###
12742 !! test
12743 Sanitizer: Closing of open tags
12744 !! wikitext
12745 <s></s><table></table>
12746 !! html
12747 <s></s><table></table>
12748
12749 !! end
12750
12751 !! test
12752 Sanitizer: Closing of open but not closed tags
12753 !! wikitext
12754 <s>foo
12755 !! html
12756 <p><s>foo</s>
12757 </p>
12758 !! end
12759
12760 !! test
12761 Sanitizer: Closing of closed but not open tags
12762 !! wikitext
12763 </s>
12764 !! html
12765 <p>&lt;/s&gt;
12766 </p>
12767 !! end
12768
12769 !! test
12770 Sanitizer: Closing of closed but not open table tags
12771 !! wikitext
12772 Table not started</td></tr></table>
12773 !! html
12774 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12775 </p>
12776 !! end
12777
12778 !! test
12779 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12780 !! wikitext
12781 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12782 !! html
12783 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12784 </p>
12785 !! end
12786
12787 !! test
12788 Sanitizer: Validating the contents of the id attribute (bug 4515)
12789 !! options
12790 disabled
12791 !! wikitext
12792 <br id=9 />
12793 !! html
12794 Something, but definitely not <br id="9" />...
12795 !! end
12796
12797 !! test
12798 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12799 !! options
12800 disabled
12801 !! wikitext
12802 <br id="foo" /><br id="foo" />
12803 !! html
12804 Something need to be done. foo-2 ?
12805 !! end
12806
12807 !! test
12808 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12809 !! wikitext
12810 <div itemscope>
12811 <meta itemprop="hello" content="world">
12812 <meta http-equiv="refresh" content="5">
12813 <meta itemprop="hello" http-equiv="refresh" content="5">
12814 <link itemprop="hello" href="{{SERVER}}">
12815 <link rel="stylesheet" href="{{SERVER}}">
12816 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12817 </div>
12818 !! html
12819 <div itemscope="itemscope">
12820 <p> <meta itemprop="hello" content="world" />
12821 &lt;meta http-equiv="refresh" content="5"&gt;
12822 <meta itemprop="hello" content="5" />
12823 </p>
12824 <link itemprop="hello" href="http&#58;//example.org" />
12825 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12826 <link itemprop="hello" href="http&#58;//example.org" />
12827 </div>
12828
12829 !! end
12830
12831 !! test
12832 Language converter: output gets cut off unexpectedly (bug 5757)
12833 !! options
12834 language=zh
12835 !! wikitext
12836 this bit is safe: }-
12837
12838 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12839
12840 then we get cut off here: }-
12841
12842 all additional text is vanished
12843 !! html
12844 <p>this bit is safe: }-
12845 </p><p>but if we add a conversion instance: xxx
12846 </p><p>then we get cut off here: }-
12847 </p><p>all additional text is vanished
12848 </p>
12849 !! end
12850
12851 !! test
12852 Self closed html pairs (bug 5487)
12853 !! options
12854 !! wikitext
12855 <center><font id="bug" />Centered text</center>
12856 <div><font id="bug2" />In div text</div>
12857 !! html
12858 <center>&lt;font id="bug" /&gt;Centered text</center>
12859 <div>&lt;font id="bug2" /&gt;In div text</div>
12860
12861 !! end
12862
12863 #
12864 #
12865 #
12866
12867 !! test
12868 Punctuation: nbsp before exclamation
12869 !! wikitext
12870 C'est grave !
12871 !! html
12872 <p>C'est grave&#160;!
12873 </p>
12874 !! end
12875
12876 !! test
12877 Punctuation: CSS !important (bug 11874)
12878 !! wikitext
12879 <div style="width:50% !important">important</div>
12880 !! html
12881 <div style="width:50% !important">important</div>
12882
12883 !!end
12884
12885 !! test
12886 Punctuation: CSS ! important (bug 11874; with space after)
12887 !! wikitext
12888 <div style="width:50% ! important">important</div>
12889 !! html
12890 <div style="width:50% ! important">important</div>
12891
12892 !!end
12893
12894
12895 !! test
12896 HTML bullet list, closed tags (bug 5497)
12897 !! wikitext
12898 <ul>
12899 <li>One</li>
12900 <li>Two</li>
12901 </ul>
12902 !! html
12903 <ul>
12904 <li>One</li>
12905 <li>Two</li>
12906 </ul>
12907
12908 !! end
12909
12910 !! test
12911 HTML bullet list, unclosed tags (bug 5497)
12912 !! options
12913 disabled
12914 !! wikitext
12915 <ul>
12916 <li>One
12917 <li>Two
12918 </ul>
12919 !! html
12920 <ul>
12921 <li>One
12922 </li>
12923 <li>Two
12924 </li>
12925 </ul>
12926
12927 !! end
12928
12929 !! test
12930 HTML ordered list, closed tags (bug 5497)
12931 !! wikitext
12932 <ol>
12933 <li>One</li>
12934 <li>Two</li>
12935 </ol>
12936 !! html
12937 <ol>
12938 <li>One</li>
12939 <li>Two</li>
12940 </ol>
12941
12942 !! end
12943
12944 !! test
12945 HTML ordered list, unclosed tags (bug 5497)
12946 !! options
12947 disabled
12948 !! wikitext
12949 <ol>
12950 <li>One
12951 <li>Two
12952 </ol>
12953 !! html
12954 <ol>
12955 <li>One
12956 </li>
12957 <li>Two
12958 </li>
12959 </ol>
12960
12961 !! end
12962
12963 !! test
12964 HTML nested bullet list, closed tags (bug 5497)
12965 !! wikitext
12966 <ul>
12967 <li>One</li>
12968 <li>Two:
12969 <ul>
12970 <li>Sub-one</li>
12971 <li>Sub-two</li>
12972 </ul>
12973 </li>
12974 </ul>
12975 !! html
12976 <ul>
12977 <li>One</li>
12978 <li>Two:
12979 <ul>
12980 <li>Sub-one</li>
12981 <li>Sub-two</li>
12982 </ul>
12983 </li>
12984 </ul>
12985
12986 !! end
12987
12988 !! test
12989 HTML nested bullet list, open tags (bug 5497)
12990 !! options
12991 disabled
12992 !! wikitext
12993 <ul>
12994 <li>One
12995 <li>Two:
12996 <ul>
12997 <li>Sub-one
12998 <li>Sub-two
12999 </ul>
13000 </ul>
13001 !! html
13002 <ul>
13003 <li>One
13004 </li>
13005 <li>Two:
13006 <ul>
13007 <li>Sub-one
13008 </li>
13009 <li>Sub-two
13010 </li>
13011 </ul>
13012 </li>
13013 </ul>
13014
13015 !! end
13016
13017 !! test
13018 HTML nested ordered list, closed tags (bug 5497)
13019 !! wikitext
13020 <ol>
13021 <li>One</li>
13022 <li>Two:
13023 <ol>
13024 <li>Sub-one</li>
13025 <li>Sub-two</li>
13026 </ol>
13027 </li>
13028 </ol>
13029 !! html
13030 <ol>
13031 <li>One</li>
13032 <li>Two:
13033 <ol>
13034 <li>Sub-one</li>
13035 <li>Sub-two</li>
13036 </ol>
13037 </li>
13038 </ol>
13039
13040 !! end
13041
13042 !! test
13043 HTML nested ordered list, open tags (bug 5497)
13044 !! options
13045 disabled
13046 !! wikitext
13047 <ol>
13048 <li>One
13049 <li>Two:
13050 <ol>
13051 <li>Sub-one
13052 <li>Sub-two
13053 </ol>
13054 </ol>
13055 !! html
13056 <ol>
13057 <li>One
13058 </li>
13059 <li>Two:
13060 <ol>
13061 <li>Sub-one
13062 </li>
13063 <li>Sub-two
13064 </li>
13065 </ol>
13066 </li>
13067 </ol>
13068
13069 !! end
13070
13071 !! test
13072 HTML ordered list item with parameters oddity
13073 !! wikitext
13074 <ol><li id="fragment">One</li>
13075 </ol>
13076 !! html
13077 <ol><li id="fragment">One</li>
13078 </ol>
13079
13080 !! end
13081
13082 !!test
13083 bug 5918: autonumbering
13084 !! wikitext
13085 [http://first/] [http://second] [ftp://ftp]
13086
13087 ftp://inlineftp
13088
13089 [mailto:enclosed@mail.tld With target]
13090
13091 [mailto:enclosed@mail.tld]
13092
13093 mailto:inline@mail.tld
13094 !! html
13095 <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>
13096 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13097 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13098 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13099 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13100 </p>
13101 !! end
13102
13103
13104 #
13105 # Security and HTML correctness
13106 # From Nick Jenkins' fuzz testing
13107 #
13108
13109 !! test
13110 Fuzz testing: Parser13
13111 !! wikitext
13112 {|
13113 | http://a|
13114 !! html
13115 <table>
13116 <tr>
13117 <td>
13118 </td>
13119 </tr>
13120 </table>
13121
13122 !! end
13123
13124 !! test
13125 Fuzz testing: Parser14
13126 !! wikitext
13127 == onmouseover= ==
13128 http://__TOC__
13129 !! html
13130 <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>
13131 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13132 <ul>
13133 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13134 </ul>
13135 </div>
13136
13137
13138 !! end
13139
13140 !! test
13141 Fuzz testing: Parser14-table
13142 !! wikitext
13143 ==a==
13144 {| STYLE=__TOC__
13145 !! html
13146 <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>
13147 <table style="&#95;_TOC&#95;_">
13148 <tr><td></td></tr>
13149 </table>
13150
13151 !! end
13152
13153 # Known to produce bogus xml (extra </td>)
13154 !! test
13155 Fuzz testing: Parser16
13156 !! options
13157 noxml
13158 !! wikitext
13159 {|
13160 !https://||||||
13161 !! html
13162 <table>
13163 <tr>
13164 <th>https://</th>
13165 <th></th>
13166 <th></th>
13167 <th>
13168 </td>
13169 </tr>
13170 </table>
13171
13172 !! end
13173
13174 !! test
13175 Fuzz testing: Parser21
13176 !! wikitext
13177 {|
13178 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13179 |
13180 !! html
13181 <table>
13182 <tr>
13183 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13184 </th>
13185 <td>
13186 </td>
13187 </tr>
13188 </table>
13189
13190 !! end
13191
13192 !! test
13193 Fuzz testing: Parser22
13194 !! wikitext
13195 http://===r:::https://b
13196
13197 {|
13198 !! html
13199 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13200 </p>
13201 <table>
13202 <tr><td></td></tr>
13203 </table>
13204
13205 !! end
13206
13207 # Known to produce bad XML for now
13208 !! test
13209 Fuzz testing: Parser24
13210 !! options
13211 noxml
13212 !! wikitext
13213 {|
13214 {{{|
13215 <u CLASS=
13216 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13217 <br style="onmouseover='alert(document.cookie);' " />
13218
13219 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13220 |
13221 !! html
13222 <table>
13223 {{{|
13224 <u class="&#124;">}}}} &gt;
13225 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13226
13227 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13228 <tr>
13229 <td></u>
13230 </td>
13231 </tr>
13232 </table>
13233
13234 !! end
13235
13236 # Note: the current result listed for this is not what the original one was,
13237 # but the original bug was JavaScript injection, which is fixed in any case.
13238 # It's not clear that the original result listed was any more correct than the
13239 # current one. Original result:
13240 # <p>{{{|
13241 # </p>
13242 # <li class="&#124;&#124;">
13243 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13244 !!test
13245 Fuzz testing: Parser25 (bug 6055)
13246 !! wikitext
13247 {{{
13248 |
13249 <LI CLASS=||
13250 >
13251 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13252 !! html
13253 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13254 </p>
13255 !! end
13256
13257 !!test
13258 Fuzz testing: URL adjacent extension (with space, clean)
13259 !! options
13260 !! wikitext
13261 http://example.com <nowiki>junk</nowiki>
13262 !! html
13263 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13264 </p>
13265 !!end
13266
13267 !!test
13268 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13269 !! options
13270 !! wikitext
13271 http://example.com<nowiki>junk</nowiki>
13272 !! html
13273 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13274 </p>
13275 !!end
13276
13277 !!test
13278 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13279 !! options
13280 !! wikitext
13281 http://example.com<pre>junk</pre>
13282 !! html
13283 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13284
13285 !!end
13286
13287 !!test
13288 Fuzz testing: image with bogus manual thumbnail
13289 !! wikitext
13290 [[Image:foobar.jpg|thumbnail= ]]
13291 !! html/php
13292 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13293
13294 !! html/parsoid
13295 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13296 !!end
13297
13298 !! test
13299 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13300 !! wikitext
13301 <pre dir="&#10;"></pre>
13302 !! html
13303 <pre dir="&#10;"></pre>
13304
13305 !! end
13306
13307 !! test
13308 Parsing optional HTML elements (Bug 6171)
13309 !! options
13310 !! wikitext
13311 <table>
13312 <tr>
13313 <td> Some tabular data</td>
13314 <td> More tabular data ...
13315 <td> And yet som tabular data</td>
13316 </tr>
13317 </table>
13318 !! html
13319 <table>
13320 <tr>
13321 <td> Some tabular data</td>
13322 <td> More tabular data ...
13323 </td><td> And yet som tabular data</td>
13324 </tr>
13325 </table>
13326
13327 !! end
13328
13329 !! test
13330 Correct handling of <td>, <tr> (Bug 6171)
13331 !! options
13332 !! wikitext
13333 <table>
13334 <tr>
13335 <td> Some tabular data</td>
13336 <td> More tabular data ...</td>
13337 <td> And yet som tabular data</td>
13338 </tr>
13339 </table>
13340 !! html
13341 <table>
13342 <tr>
13343 <td> Some tabular data</td>
13344 <td> More tabular data ...</td>
13345 <td> And yet som tabular data</td>
13346 </tr>
13347 </table>
13348
13349 !! end
13350
13351
13352 !! test
13353 Parsing crashing regression (fr:JavaScript)
13354 !! wikitext
13355 </body></x>
13356 !! html
13357 <p>&lt;/body&gt;&lt;/x&gt;
13358 </p>
13359 !! end
13360
13361 !! test
13362 Inline wiki vs wiki block nesting
13363 !! wikitext
13364 '''Bold paragraph
13365
13366 New wiki paragraph
13367 !! html
13368 <p><b>Bold paragraph</b>
13369 </p><p>New wiki paragraph
13370 </p>
13371 !! end
13372
13373 !! test
13374 Inline HTML vs wiki block nesting
13375 !! options
13376 disabled
13377 !! wikitext
13378 <b>Bold paragraph
13379
13380 New wiki paragraph
13381 !! html
13382 <p><b>Bold paragraph</b>
13383 </p><p>New wiki paragraph
13384 </p>
13385 !! end
13386
13387 # Original result was this:
13388 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13389 # </p>
13390 # While that might be marginally more intuitive, maybe, the six-apostrophe
13391 # construct is clearly pathological and the result stated here (which is what
13392 # the parser actually does) is about as reasonable as anything.
13393 !!test
13394 Mixing markup for italics and bold
13395 !! options
13396 !! wikitext
13397 '''bold''''''bold''bolditalics'''''
13398 !! html
13399 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13400 </p>
13401 !! end
13402
13403
13404 !! article
13405 Xyzzyx
13406 !! text
13407 Article for special page transclusion test
13408 !! endarticle
13409
13410 !! test
13411 Special page transclusion
13412 !! options
13413 !! wikitext
13414 {{Special:Prefixindex/Xyzzyx}}
13415 !! html
13416 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13417
13418 !! end
13419
13420 !! test
13421 Special page transclusion twice (bug 5021)
13422 !! options
13423 !! wikitext
13424 {{Special:Prefixindex/Xyzzyx}}
13425 {{Special:Prefixindex/Xyzzyx}}
13426 !! html
13427 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13428 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13429
13430 !! end
13431
13432 !! test
13433 Transclusion of default MediaWiki message
13434 !! wikitext
13435 {{MediaWiki:Mainpage}}
13436 !! html
13437 <p>Main Page
13438 </p>
13439 !! end
13440
13441 !! test
13442 Transclusion of nonexistent MediaWiki message
13443 !! wikitext
13444 {{MediaWiki:Mainpagexxx}}
13445 !! html
13446 <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>
13447 </p>
13448 !! end
13449
13450 !! test
13451 Transclusion of MediaWiki message with underscore
13452 !! wikitext
13453 {{MediaWiki:history_short}}
13454 !! html
13455 <p>History
13456 </p>
13457 !! end
13458
13459 !! test
13460 Transclusion of MediaWiki message with space
13461 !! wikitext
13462 {{MediaWiki:history short}}
13463 !! html
13464 <p>History
13465 </p>
13466 !! end
13467
13468 !! test
13469 Invalid header with following text
13470 !! wikitext
13471 = x = y
13472 !! html
13473 <p>= x = y
13474 </p>
13475 !! end
13476
13477
13478 !! test
13479 Section extraction test (section 0)
13480 !! options
13481 section=0
13482 !! wikitext
13483 start
13484 ==a==
13485 ===aa===
13486 ====aaa====
13487 ==b==
13488 ===ba===
13489 ===bb===
13490 ====bba====
13491 ===bc===
13492 ==c==
13493 ===ca===
13494 !! html
13495 start
13496 !! end
13497
13498 !! test
13499 Section extraction test (section 1)
13500 !! options
13501 section=1
13502 !! wikitext
13503 start
13504 ==a==
13505 ===aa===
13506 ====aaa====
13507 ==b==
13508 ===ba===
13509 ===bb===
13510 ====bba====
13511 ===bc===
13512 ==c==
13513 ===ca===
13514 !! html
13515 ==a==
13516 ===aa===
13517 ====aaa====
13518 !! end
13519
13520 !! test
13521 Section extraction test (section 2)
13522 !! options
13523 section=2
13524 !! wikitext
13525 start
13526 ==a==
13527 ===aa===
13528 ====aaa====
13529 ==b==
13530 ===ba===
13531 ===bb===
13532 ====bba====
13533 ===bc===
13534 ==c==
13535 ===ca===
13536 !! html
13537 ===aa===
13538 ====aaa====
13539 !! end
13540
13541 !! test
13542 Section extraction test (section 3)
13543 !! options
13544 section=3
13545 !! wikitext
13546 start
13547 ==a==
13548 ===aa===
13549 ====aaa====
13550 ==b==
13551 ===ba===
13552 ===bb===
13553 ====bba====
13554 ===bc===
13555 ==c==
13556 ===ca===
13557 !! html
13558 ====aaa====
13559 !! end
13560
13561 !! test
13562 Section extraction test (section 4)
13563 !! options
13564 section=4
13565 !! wikitext
13566 start
13567 ==a==
13568 ===aa===
13569 ====aaa====
13570 ==b==
13571 ===ba===
13572 ===bb===
13573 ====bba====
13574 ===bc===
13575 ==c==
13576 ===ca===
13577 !! html
13578 ==b==
13579 ===ba===
13580 ===bb===
13581 ====bba====
13582 ===bc===
13583 !! end
13584
13585 !! test
13586 Section extraction test (section 5)
13587 !! options
13588 section=5
13589 !! wikitext
13590 start
13591 ==a==
13592 ===aa===
13593 ====aaa====
13594 ==b==
13595 ===ba===
13596 ===bb===
13597 ====bba====
13598 ===bc===
13599 ==c==
13600 ===ca===
13601 !! html
13602 ===ba===
13603 !! end
13604
13605 !! test
13606 Section extraction test (section 6)
13607 !! options
13608 section=6
13609 !! wikitext
13610 start
13611 ==a==
13612 ===aa===
13613 ====aaa====
13614 ==b==
13615 ===ba===
13616 ===bb===
13617 ====bba====
13618 ===bc===
13619 ==c==
13620 ===ca===
13621 !! html
13622 ===bb===
13623 ====bba====
13624 !! end
13625
13626 !! test
13627 Section extraction test (section 7)
13628 !! options
13629 section=7
13630 !! wikitext
13631 start
13632 ==a==
13633 ===aa===
13634 ====aaa====
13635 ==b==
13636 ===ba===
13637 ===bb===
13638 ====bba====
13639 ===bc===
13640 ==c==
13641 ===ca===
13642 !! html
13643 ====bba====
13644 !! end
13645
13646 !! test
13647 Section extraction test (section 8)
13648 !! options
13649 section=8
13650 !! wikitext
13651 start
13652 ==a==
13653 ===aa===
13654 ====aaa====
13655 ==b==
13656 ===ba===
13657 ===bb===
13658 ====bba====
13659 ===bc===
13660 ==c==
13661 ===ca===
13662 !! html
13663 ===bc===
13664 !! end
13665
13666 !! test
13667 Section extraction test (section 9)
13668 !! options
13669 section=9
13670 !! wikitext
13671 start
13672 ==a==
13673 ===aa===
13674 ====aaa====
13675 ==b==
13676 ===ba===
13677 ===bb===
13678 ====bba====
13679 ===bc===
13680 ==c==
13681 ===ca===
13682 !! html
13683 ==c==
13684 ===ca===
13685 !! end
13686
13687 !! test
13688 Section extraction test (section 10)
13689 !! options
13690 section=10
13691 !! wikitext
13692 start
13693 ==a==
13694 ===aa===
13695 ====aaa====
13696 ==b==
13697 ===ba===
13698 ===bb===
13699 ====bba====
13700 ===bc===
13701 ==c==
13702 ===ca===
13703 !! html
13704 ===ca===
13705 !! end
13706
13707 !! test
13708 Section extraction test (nonexistent section 11)
13709 !! options
13710 section=11
13711 !! wikitext
13712 start
13713 ==a==
13714 ===aa===
13715 ====aaa====
13716 ==b==
13717 ===ba===
13718 ===bb===
13719 ====bba====
13720 ===bc===
13721 ==c==
13722 ===ca===
13723 !! html
13724 !! end
13725
13726 !! test
13727 Section extraction test with bogus heading (section 1)
13728 !! options
13729 section=1
13730 !! wikitext
13731 ==a==
13732 ==bogus== not a legal section
13733 ==b==
13734 !! html
13735 ==a==
13736 ==bogus== not a legal section
13737 !! end
13738
13739 !! test
13740 Section extraction test with bogus heading (section 2)
13741 !! options
13742 section=2
13743 !! wikitext
13744 ==a==
13745 ==bogus== not a legal section
13746 ==b==
13747 !! html
13748 ==b==
13749 !! end
13750
13751 !! test
13752 Section extraction test with comment after heading (section 1)
13753 !! options
13754 section=1
13755 !! wikitext
13756 ==a==
13757 ==b== <!-- -->
13758 ==c==
13759 !! html
13760 ==a==
13761 !! end
13762
13763 !! test
13764 Section extraction test with comment after heading (section 2)
13765 !! options
13766 section=2
13767 !! wikitext
13768 ==a==
13769 ==b== <!-- -->
13770 ==c==
13771 !! html
13772 ==b== <!-- -->
13773 !! end
13774
13775 !! test
13776 Section extraction test with bogus <nowiki> heading (section 1)
13777 !! options
13778 section=1
13779 !! wikitext
13780 ==a==
13781 ==bogus== <nowiki>not a legal section</nowiki>
13782 ==b==
13783 !! html
13784 ==a==
13785 ==bogus== <nowiki>not a legal section</nowiki>
13786 !! end
13787
13788 !! test
13789 Section extraction test with bogus <nowiki> heading (section 2)
13790 !! options
13791 section=2
13792 !! wikitext
13793 ==a==
13794 ==bogus== <nowiki>not a legal section</nowiki>
13795 ==b==
13796 !! html
13797 ==b==
13798 !! end
13799
13800
13801 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13802 # instead of respecting commented sections
13803 !! test
13804 Section extraction prefixed by comment (section 1)
13805 !! options
13806 section=1
13807 !! wikitext
13808 <!-- -->==sec1==
13809 ==sec2==
13810 !! html
13811 ==sec2==
13812 !!end
13813
13814 !! test
13815 Section extraction prefixed by comment (section 2)
13816 !! options
13817 section=2
13818 !! wikitext
13819 <!-- -->==sec1==
13820 ==sec2==
13821 !! html
13822
13823 !!end
13824
13825
13826 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13827 # instead of respecting HTML-style headings
13828 !! test
13829 Section extraction, mixed wiki and html (section 1)
13830 !! options
13831 section=1
13832 !! wikitext
13833 <h2>unmarked</h2>
13834 unmarked
13835 ==1==
13836 one
13837 ==2==
13838 two
13839 !! html
13840 ==1==
13841 one
13842 !! end
13843
13844 !! test
13845 Section extraction, mixed wiki and html (section 2)
13846 !! options
13847 section=2
13848 !! wikitext
13849 <h2>unmarked</h2>
13850 unmarked
13851 ==1==
13852 one
13853 ==2==
13854 two
13855 !! html
13856 ==2==
13857 two
13858 !! end
13859
13860
13861 # Formerly testing for bug 3342
13862 !! test
13863 Section extraction, heading surrounded by <noinclude>
13864 !! options
13865 section=1
13866 !! wikitext
13867 <noinclude>==unmarked==</noinclude>
13868 ==marked==
13869 !! html
13870 ==marked==
13871 !!end
13872
13873 # Test behavior of bug 19910
13874 !! test
13875 Sectiion with all-equals
13876 !! options
13877 section=2
13878 !! wikitext
13879 ===
13880 The line above must have a trailing space
13881 === <!--
13882 --> <!-- -->
13883 But just in case it doesn't...
13884 !! html
13885 === <!--
13886 --> <!-- -->
13887 But just in case it doesn't...
13888 !! end
13889
13890 !! test
13891 Section replacement test (section 0)
13892 !! options
13893 replace=0,"xxx"
13894 !! wikitext
13895 start
13896 ==a==
13897 ===aa===
13898 ====aaa====
13899 ==b==
13900 ===ba===
13901 ===bb===
13902 ====bba====
13903 ===bc===
13904 ==c==
13905 ===ca===
13906 !! html
13907 xxx
13908
13909 ==a==
13910 ===aa===
13911 ====aaa====
13912 ==b==
13913 ===ba===
13914 ===bb===
13915 ====bba====
13916 ===bc===
13917 ==c==
13918 ===ca===
13919 !! end
13920
13921 !! test
13922 Section replacement test (section 1)
13923 !! options
13924 replace=1,"xxx"
13925 !! wikitext
13926 start
13927 ==a==
13928 ===aa===
13929 ====aaa====
13930 ==b==
13931 ===ba===
13932 ===bb===
13933 ====bba====
13934 ===bc===
13935 ==c==
13936 ===ca===
13937 !! html
13938 start
13939 xxx
13940
13941 ==b==
13942 ===ba===
13943 ===bb===
13944 ====bba====
13945 ===bc===
13946 ==c==
13947 ===ca===
13948 !! end
13949
13950 !! test
13951 Section replacement test (section 2)
13952 !! options
13953 replace=2,"xxx"
13954 !! wikitext
13955 start
13956 ==a==
13957 ===aa===
13958 ====aaa====
13959 ==b==
13960 ===ba===
13961 ===bb===
13962 ====bba====
13963 ===bc===
13964 ==c==
13965 ===ca===
13966 !! html
13967 start
13968 ==a==
13969 xxx
13970
13971 ==b==
13972 ===ba===
13973 ===bb===
13974 ====bba====
13975 ===bc===
13976 ==c==
13977 ===ca===
13978 !! end
13979
13980 !! test
13981 Section replacement test (section 3)
13982 !! options
13983 replace=3,"xxx"
13984 !! wikitext
13985 start
13986 ==a==
13987 ===aa===
13988 ====aaa====
13989 ==b==
13990 ===ba===
13991 ===bb===
13992 ====bba====
13993 ===bc===
13994 ==c==
13995 ===ca===
13996 !! html
13997 start
13998 ==a==
13999 ===aa===
14000 xxx
14001
14002 ==b==
14003 ===ba===
14004 ===bb===
14005 ====bba====
14006 ===bc===
14007 ==c==
14008 ===ca===
14009 !! end
14010
14011 !! test
14012 Section replacement test (section 4)
14013 !! options
14014 replace=4,"xxx"
14015 !! wikitext
14016 start
14017 ==a==
14018 ===aa===
14019 ====aaa====
14020 ==b==
14021 ===ba===
14022 ===bb===
14023 ====bba====
14024 ===bc===
14025 ==c==
14026 ===ca===
14027 !! html
14028 start
14029 ==a==
14030 ===aa===
14031 ====aaa====
14032 xxx
14033
14034 ==c==
14035 ===ca===
14036 !! end
14037
14038 !! test
14039 Section replacement test (section 5)
14040 !! options
14041 replace=5,"xxx"
14042 !! wikitext
14043 start
14044 ==a==
14045 ===aa===
14046 ====aaa====
14047 ==b==
14048 ===ba===
14049 ===bb===
14050 ====bba====
14051 ===bc===
14052 ==c==
14053 ===ca===
14054 !! html
14055 start
14056 ==a==
14057 ===aa===
14058 ====aaa====
14059 ==b==
14060 xxx
14061
14062 ===bb===
14063 ====bba====
14064 ===bc===
14065 ==c==
14066 ===ca===
14067 !! end
14068
14069 !! test
14070 Section replacement test (section 6)
14071 !! options
14072 replace=6,"xxx"
14073 !! wikitext
14074 start
14075 ==a==
14076 ===aa===
14077 ====aaa====
14078 ==b==
14079 ===ba===
14080 ===bb===
14081 ====bba====
14082 ===bc===
14083 ==c==
14084 ===ca===
14085 !! html
14086 start
14087 ==a==
14088 ===aa===
14089 ====aaa====
14090 ==b==
14091 ===ba===
14092 xxx
14093
14094 ===bc===
14095 ==c==
14096 ===ca===
14097 !! end
14098
14099 !! test
14100 Section replacement test (section 7)
14101 !! options
14102 replace=7,"xxx"
14103 !! wikitext
14104 start
14105 ==a==
14106 ===aa===
14107 ====aaa====
14108 ==b==
14109 ===ba===
14110 ===bb===
14111 ====bba====
14112 ===bc===
14113 ==c==
14114 ===ca===
14115 !! html
14116 start
14117 ==a==
14118 ===aa===
14119 ====aaa====
14120 ==b==
14121 ===ba===
14122 ===bb===
14123 xxx
14124
14125 ===bc===
14126 ==c==
14127 ===ca===
14128 !! end
14129
14130 !! test
14131 Section replacement test (section 8)
14132 !! options
14133 replace=8,"xxx"
14134 !! wikitext
14135 start
14136 ==a==
14137 ===aa===
14138 ====aaa====
14139 ==b==
14140 ===ba===
14141 ===bb===
14142 ====bba====
14143 ===bc===
14144 ==c==
14145 ===ca===
14146 !! html
14147 start
14148 ==a==
14149 ===aa===
14150 ====aaa====
14151 ==b==
14152 ===ba===
14153 ===bb===
14154 ====bba====
14155 xxx
14156
14157 ==c==
14158 ===ca===
14159 !!end
14160
14161 !! test
14162 Section replacement test (section 9)
14163 !! options
14164 replace=9,"xxx"
14165 !! wikitext
14166 start
14167 ==a==
14168 ===aa===
14169 ====aaa====
14170 ==b==
14171 ===ba===
14172 ===bb===
14173 ====bba====
14174 ===bc===
14175 ==c==
14176 ===ca===
14177 !! html
14178 start
14179 ==a==
14180 ===aa===
14181 ====aaa====
14182 ==b==
14183 ===ba===
14184 ===bb===
14185 ====bba====
14186 ===bc===
14187 xxx
14188 !! end
14189
14190 !! test
14191 Section replacement test (section 10)
14192 !! options
14193 replace=10,"xxx"
14194 !! wikitext
14195 start
14196 ==a==
14197 ===aa===
14198 ====aaa====
14199 ==b==
14200 ===ba===
14201 ===bb===
14202 ====bba====
14203 ===bc===
14204 ==c==
14205 ===ca===
14206 !! html
14207 start
14208 ==a==
14209 ===aa===
14210 ====aaa====
14211 ==b==
14212 ===ba===
14213 ===bb===
14214 ====bba====
14215 ===bc===
14216 ==c==
14217 xxx
14218 !! end
14219
14220 !! test
14221 Section replacement test with initial whitespace (bug 13728)
14222 !! options
14223 replace=2,"xxx"
14224 !! wikitext
14225 Preformatted initial line
14226 ==a==
14227 ===a===
14228 !! html
14229 Preformatted initial line
14230 ==a==
14231 xxx
14232 !! end
14233
14234
14235 !! test
14236 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14237 !! options
14238 section=1
14239 !! wikitext
14240 ==a==
14241 a
14242 !! html
14243 ==a==
14244 a
14245 !! end
14246
14247 !! test
14248 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14249 !! options
14250 section=1
14251 !! wikitext
14252 ==a==
14253 a
14254 !! html
14255 ==a==
14256 a
14257 !! end
14258
14259
14260 !! test
14261 Section extraction, <pre> around bogus header (bug 10309)
14262 !! options
14263 noxml section=2
14264 !! wikitext
14265 == Section One ==
14266 <pre>
14267 =======
14268 </pre>
14269
14270 == Section Two ==
14271 stuff
14272 !! html
14273 == Section Two ==
14274 stuff
14275 !! end
14276
14277 !! test
14278 Section replacement, <pre> around bogus header (bug 10309)
14279 !! options
14280 noxml replace=2,"xxx"
14281 !! wikitext
14282 == Section One ==
14283 <pre>
14284 =======
14285 </pre>
14286
14287 == Section Two ==
14288 stuff
14289 !! html
14290 == Section One ==
14291 <pre>
14292 =======
14293 </pre>
14294
14295 xxx
14296 !! end
14297
14298
14299
14300 !! test
14301 Handling of &#x0A; in URLs
14302 !! wikitext
14303 **irc://&#x0A;a
14304 !! html
14305 <ul>
14306 <li><ul>
14307 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14308 </li>
14309 </ul>
14310 </li>
14311 </ul>
14312
14313 !!end
14314
14315 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14316 !! test
14317 5 quotes, code coverage +1 line
14318 !! wikitext
14319 '''''
14320 !! html/php
14321 !! html/parsoid
14322 <p><b><i></i></b></p>
14323 !! end
14324
14325 !! test
14326 Special:Search page linking.
14327 !! wikitext
14328 {{Special:search}}
14329 !! html
14330 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14331 </p>
14332 !! end
14333
14334 !! test
14335 Say the magic word
14336 !! options
14337 title=[[Parser test]]
14338 !! wikitext
14339 * {{PAGENAME}}
14340 * {{PAGENAMEE}}
14341 * {{FULLPAGENAME}}
14342 * {{FULLPAGENAMEE}}
14343 * {{BASEPAGENAME}}
14344 * {{BASEPAGENAMEE}}
14345 * {{SUBPAGENAME}}
14346 * {{SUBPAGENAMEE}}
14347 * {{ROOTPAGENAME}}
14348 * {{ROOTPAGENAMEE}}
14349 * {{TALKPAGENAME}}
14350 * {{TALKPAGENAMEE}}
14351 * {{SUBJECTPAGENAME}}
14352 * {{SUBJECTPAGENAMEE}}
14353 * {{NAMESPACEE}}
14354 * {{NAMESPACE}}
14355 * {{NAMESPACENUMBER}}
14356 * {{TALKSPACE}}
14357 * {{TALKSPACEE}}
14358 * {{SUBJECTSPACE}}
14359 * {{SUBJECTSPACEE}}
14360 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14361 !! html
14362 <ul>
14363 <li> Parser test
14364 </li>
14365 <li> Parser_test
14366 </li>
14367 <li> Parser test
14368 </li>
14369 <li> Parser_test
14370 </li>
14371 <li> Parser test
14372 </li>
14373 <li> Parser_test
14374 </li>
14375 <li> Parser test
14376 </li>
14377 <li> Parser_test
14378 </li>
14379 <li> Parser test
14380 </li>
14381 <li> Parser_test
14382 </li>
14383 <li> Talk:Parser test
14384 </li>
14385 <li> Talk:Parser_test
14386 </li>
14387 <li> Parser test
14388 </li>
14389 <li> Parser_test
14390 </li>
14391 <li>
14392 </li>
14393 <li>
14394 </li>
14395 <li> 0
14396 </li>
14397 <li> Talk
14398 </li>
14399 <li> Talk
14400 </li>
14401 <li>
14402 </li>
14403 <li>
14404 </li>
14405 <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>
14406 </li>
14407 </ul>
14408
14409 !! end
14410 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14411
14412 !! test
14413 Gallery
14414 !! wikitext
14415 <gallery>
14416 image1.png |
14417 image2.gif|||||
14418
14419 image3|
14420 image4 |300px| centre
14421 image5.svg| http://///////
14422 [[x|xx]]]]
14423 * image6
14424 </gallery>
14425 !! html
14426 <ul class="gallery mw-gallery-traditional">
14427 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14428 <div class="thumb" style="height: 150px;">Image1.png</div>
14429 <div class="gallerytext">
14430 </div>
14431 </div></li>
14432 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14433 <div class="thumb" style="height: 150px;">Image2.gif</div>
14434 <div class="gallerytext">
14435 <p>||||
14436 </p>
14437 </div>
14438 </div></li>
14439 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14440 <div class="thumb" style="height: 150px;">Image3</div>
14441 <div class="gallerytext">
14442 </div>
14443 </div></li>
14444 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14445 <div class="thumb" style="height: 150px;">Image4</div>
14446 <div class="gallerytext">
14447 <p>300px| centre
14448 </p>
14449 </div>
14450 </div></li>
14451 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14452 <div class="thumb" style="height: 150px;">Image5.svg</div>
14453 <div class="gallerytext">
14454 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14455 </p>
14456 </div>
14457 </div></li>
14458 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14459 <div class="thumb" style="height: 150px;">* image6</div>
14460 <div class="gallerytext">
14461 </div>
14462 </div></li>
14463 </ul>
14464
14465 !! end
14466
14467 !! test
14468 Gallery (with options)
14469 !! wikitext
14470 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14471 File:Nonexistant.jpg|caption
14472 File:Nonexistant.jpg
14473 image:foobar.jpg|some '''caption''' [[Main Page]]
14474 image:foobar.jpg
14475 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14476 </gallery>
14477 !! html
14478 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14479 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14480 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14481 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14482 <div class="gallerytext">
14483 <p>caption
14484 </p>
14485 </div>
14486 </div></li>
14487 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14488 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14489 <div class="gallerytext">
14490 </div>
14491 </div></li>
14492 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14493 <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" /></a></div></div>
14494 <div class="gallerytext">
14495 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14496 </p>
14497 </div>
14498 </div></li>
14499 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14500 <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" /></a></div></div>
14501 <div class="gallerytext">
14502 </div>
14503 </div></li>
14504 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14505 <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" /></a></div></div>
14506 <div class="gallerytext">
14507 <p>Blabla|blabla.
14508 </p>
14509 </div>
14510 </div></li>
14511 </ul>
14512
14513 !! end
14514
14515 !! test
14516 Gallery with wikitext inside caption
14517 !! wikitext
14518 <gallery>
14519 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14520 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14521 </gallery>
14522 !! html
14523 <ul class="gallery mw-gallery-traditional">
14524 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14525 <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" /></a></div></div>
14526 <div class="gallerytext">
14527 <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>
14528 </p>
14529 </div>
14530 </div></li>
14531 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14532 <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" /></a></div></div>
14533 <div class="gallerytext">
14534 <p>This is a test template
14535 </p>
14536 </div>
14537 </div></li>
14538 </ul>
14539
14540 !! end
14541
14542 !! test
14543 gallery (with showfilename option)
14544 !! wikitext
14545 <gallery showfilename>
14546 File:Nonexistant.jpg|caption
14547 File:Nonexistant.jpg
14548 image:foobar.jpg|some '''caption''' [[Main Page]]
14549 File:Foobar.jpg
14550 </gallery>
14551 !! html
14552 <ul class="gallery mw-gallery-traditional">
14553 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14554 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14555 <div class="gallerytext">
14556 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14557 caption
14558 </p>
14559 </div>
14560 </div></li>
14561 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14562 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14563 <div class="gallerytext">
14564 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14565 </p>
14566 </div>
14567 </div></li>
14568 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14569 <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" /></a></div></div>
14570 <div class="gallerytext">
14571 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14572 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14573 </p>
14574 </div>
14575 </div></li>
14576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14577 <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" /></a></div></div>
14578 <div class="gallerytext">
14579 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14580 </p>
14581 </div>
14582 </div></li>
14583 </ul>
14584
14585 !! end
14586
14587 !! test
14588 Gallery (with namespace-less filenames)
14589 !! wikitext
14590 <gallery>
14591 File:Nonexistant.jpg
14592 Nonexistant.jpg
14593 image:foobar.jpg
14594 foobar.jpg
14595 </gallery>
14596 !! html
14597 <ul class="gallery mw-gallery-traditional">
14598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14599 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14600 <div class="gallerytext">
14601 </div>
14602 </div></li>
14603 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14604 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14605 <div class="gallerytext">
14606 </div>
14607 </div></li>
14608 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14609 <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" /></a></div></div>
14610 <div class="gallerytext">
14611 </div>
14612 </div></li>
14613 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14614 <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" /></a></div></div>
14615 <div class="gallerytext">
14616 </div>
14617 </div></li>
14618 </ul>
14619
14620 !! end
14621
14622 !! test
14623 HTML Hex character encoding (spells the word "JavaScript")
14624 !! wikitext
14625 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14626 !! html
14627 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14628 </p>
14629 !! end
14630
14631 !! test
14632 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14633 !! wikitext
14634 &#xsee;&#XSEE;
14635 !! html
14636 <p>&amp;#xsee;&amp;#XSEE;
14637 </p>
14638 !! end
14639
14640 !! test
14641 HTML Hex character encoding mixed case
14642 !! wikitext
14643 &#xEE;&#Xee;
14644 !! html
14645 <p>&#xee;&#xee;
14646 </p>
14647 !! end
14648
14649 !! test
14650 __FORCETOC__ override
14651 !! wikitext
14652 __NEWSECTIONLINK__
14653 __FORCETOC__
14654 !! html
14655 <p><br />
14656 </p>
14657 !! end
14658
14659 !! test
14660 ISBN code coverage
14661 !! wikitext
14662 ISBN 978-0-1234-56&#x20;789
14663 !! html
14664 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14665 </p>
14666 !! end
14667
14668 !! test
14669 ISBN followed by 5 spaces
14670 !! wikitext
14671 ISBN
14672 !! html
14673 <p>ISBN
14674 </p>
14675 !! end
14676
14677 !! test
14678 Double ISBN
14679 !! wikitext
14680 ISBN ISBN 1234567890
14681 !! html
14682 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14683 </p>
14684 !! end
14685
14686 !! test
14687 ISBN with an X
14688 !! wikitext
14689 ISBN 3-462-04561-X
14690 !! html
14691 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
14692 </p>
14693 !! end
14694
14695 !! test
14696 Bug 22905: <abbr> followed by ISBN followed by </a>
14697 !! wikitext
14698 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14699 !! html
14700 <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>
14701 </p>
14702 !! end
14703
14704 !! test
14705 Double RFC
14706 !! wikitext
14707 RFC RFC 1234
14708 !! html
14709 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14710 </p>
14711 !! end
14712
14713 !! test
14714 Double RFC with a wiki link
14715 !! wikitext
14716 RFC [[RFC 1234]]
14717 !! html
14718 <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>
14719 </p>
14720 !! end
14721
14722 !! test
14723 RFC code coverage
14724 !! wikitext
14725 RFC 983&#x20;987
14726 !! html
14727 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14728 </p>
14729 !! end
14730
14731 !! test
14732 Centre-aligned image
14733 !! wikitext
14734 [[Image:foobar.jpg|centre]]
14735 !! html
14736 <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>
14737
14738 !!end
14739
14740 !! test
14741 None-aligned image
14742 !! wikitext
14743 [[Image:foobar.jpg|none]]
14744 !! html
14745 <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>
14746
14747 !!end
14748
14749 !! test
14750 Width + Height sized image (using px) (height is ignored)
14751 !! wikitext
14752 [[Image:foobar.jpg|640x480px]]
14753 !! html
14754 <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>
14755 </p>
14756 !!end
14757
14758 !! test
14759 Width-sized image (using px, no following whitespace)
14760 !! wikitext
14761 [[Image:foobar.jpg|640px]]
14762 !! html
14763 <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>
14764 </p>
14765 !!end
14766
14767 !! test
14768 Width-sized image (using px, with following whitespace - test regression from r39467)
14769 !! wikitext
14770 [[Image:foobar.jpg|640px ]]
14771 !! html
14772 <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>
14773 </p>
14774 !!end
14775
14776 !! test
14777 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14778 !! wikitext
14779 [[Image:foobar.jpg| 640px]]
14780 !! html
14781 <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>
14782 </p>
14783 !!end
14784
14785 !! test
14786 Another italics / bold test
14787 !! wikitext
14788 ''' ''x'
14789 !! html
14790 <pre>'<i> </i>x'
14791 </pre>
14792 !!end
14793
14794 # Note the results may be incorrect, as parserTest output included this:
14795 # XML error: Mismatched tag at byte 6120:
14796 # ...<dd> </dt></dl> </dd...
14797 !! test
14798 dt/dd/dl test
14799 !! options
14800 disabled
14801 !! wikitext
14802 :;;;::
14803 !! html
14804 <dl>
14805 <dd><dl>
14806 <dt><dl>
14807 <dt><dl>
14808 <dt><dl>
14809 <dd><dl>
14810 <dd>
14811 </dd>
14812 </dl>
14813 </dd>
14814 </dl>
14815 </dt>
14816 </dl>
14817 </dt>
14818 </dl>
14819 </dt>
14820 </dl>
14821 </dd>
14822 </dl>
14823
14824 !!end
14825
14826
14827 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14828 !! test
14829 Images with the "|" character in the comment
14830 !! wikitext
14831 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14832 !! html
14833 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
14834
14835 !!end
14836
14837 !! test
14838 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14839 !! wikitext
14840 <html><script>alert(1);</script></html>
14841 !! html
14842 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14843 </p>
14844 !! end
14845
14846 !! test
14847 HTML with raw HTML ($wgRawHtml==true)
14848 !! options
14849 wgRawHtml=1
14850 !! wikitext
14851 <html><script>alert(1);</script></html>
14852 !! html
14853 <p><script>alert(1);</script>
14854 </p>
14855 !! end
14856
14857 !! test
14858 Parents of subpages, one level up
14859 !! options
14860 subpage title=[[Subpage test/L1/L2/L3]]
14861 !! wikitext
14862 [[../|L2]]
14863 !! html
14864 <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>
14865 </p>
14866 !! end
14867
14868
14869 !! test
14870 Parents of subpages, one level up, not named
14871 !! options
14872 subpage title=[[Subpage test/L1/L2/L3]]
14873 !! wikitext
14874 [[../]]
14875 !! html
14876 <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>
14877 </p>
14878 !! end
14879
14880
14881
14882 !! test
14883 Parents of subpages, two levels up
14884 !! options
14885 subpage title=[[Subpage test/L1/L2/L3]]
14886 !! wikitext
14887 [[../../|L1]]2
14888
14889 [[../../|L1]]l
14890 !! html
14891 <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
14892 </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>
14893 </p>
14894 !! end
14895
14896 !! test
14897 Parents of subpages, two levels up, without trailing slash or name.
14898 !! options
14899 subpage title=[[Subpage test/L1/L2/L3]]
14900 !! wikitext
14901 [[../..]]
14902 !! html
14903 <p>[[../..]]
14904 </p>
14905 !! end
14906
14907 !! test
14908 Parents of subpages, two levels up, with lots of extra trailing slashes.
14909 !! options
14910 subpage title=[[Subpage test/L1/L2/L3]]
14911 !! wikitext
14912 [[../../////]]
14913 !! html
14914 <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)">///</a>
14915 </p>
14916 !! end
14917
14918 !! article
14919 Subpage test/L1/L2/L3Sibling
14920 !! text
14921 Sibling article
14922 !! endarticle
14923
14924 !! test
14925 Transclusion of a sibling page (one level up)
14926 !! options
14927 subpage title=[[Subpage test/L1/L2/L3]]
14928 !! wikitext
14929 {{../L3Sibling}}
14930 !! html
14931 <p>Sibling article
14932 </p>
14933 !! end
14934
14935 !! test
14936 Transclusion of a child page
14937 !! options
14938 subpage title=[[Subpage test/L1/L2]]
14939 !! wikitext
14940 {{/L3Sibling}}
14941 !! html
14942 <p>Sibling article
14943 </p>
14944 !! end
14945
14946 !! test
14947 Non-transclusion because of too many up levels
14948 !! options
14949 subpage title=[[Subpage test/L1/L2/L3]]
14950 !! wikitext
14951 {{../../../../More than parent}}
14952 !! html
14953 <p>{{../../../../More than parent}}
14954 </p>
14955 !! end
14956
14957 !! test
14958 Definition list code coverage
14959 !! wikitext
14960 ; title : def
14961 ; title : def
14962 ;title: def
14963 !! html
14964 <dl>
14965 <dt> title &#160;</dt>
14966 <dd> def
14967 </dd>
14968 <dt> title&#160;</dt>
14969 <dd> def
14970 </dd>
14971 <dt>title</dt>
14972 <dd> def
14973 </dd>
14974 </dl>
14975
14976 !! end
14977
14978 !! test
14979 Don't fall for the self-closing div
14980 !! wikitext
14981 <div>hello world</div/>
14982 !! html
14983 <div>hello world</div>
14984
14985 !! end
14986
14987 !! test
14988 MSGNW magic word
14989 !! wikitext
14990 {{MSGNW:msg}}
14991 !! html
14992 <p>&#91;&#91;:Template:Msg&#93;&#93;
14993 </p>
14994 !! end
14995
14996 !! test
14997 RAW magic word
14998 !! wikitext
14999 {{RAW:QUERTY}}
15000 !! html
15001 <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>
15002 </p>
15003 !! end
15004
15005 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15006 !! test
15007 Always escape literal '>' in output, not just after '<'
15008 !! wikitext
15009 ><>
15010 !! html
15011 <p>&gt;&lt;&gt;
15012 </p>
15013 !! end
15014
15015 !! test
15016 Template caching
15017 !! wikitext
15018 {{Test}}
15019 {{Test}}
15020 !! html
15021 <p>This is a test template
15022 This is a test template
15023 </p>
15024 !! end
15025
15026
15027 !! article
15028 MediaWiki:Fake
15029 !! text
15030 ==header==
15031 !! endarticle
15032
15033 !! test
15034 Inclusion of !userCanEdit() content
15035 !! wikitext
15036 {{MediaWiki:Fake}}
15037 !! html
15038 <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>
15039
15040 !! end
15041
15042
15043 !! test
15044 Out-of-order TOC heading levels
15045 !! wikitext
15046 ==2==
15047 ======6======
15048 ===3===
15049 =1=
15050 =====5=====
15051 ==2==
15052 !! html
15053 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15054 <ul>
15055 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15056 <ul>
15057 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15058 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15059 </ul>
15060 </li>
15061 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15062 <ul>
15063 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15064 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15065 </ul>
15066 </li>
15067 </ul>
15068 </div>
15069
15070 <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>
15071 <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>
15072 <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>
15073 <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>
15074 <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>
15075 <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>
15076
15077 !! end
15078
15079
15080 !! test
15081 ISBN with a dummy number
15082 !! wikitext
15083 ISBN ---
15084 !! html
15085 <p>ISBN ---
15086 </p>
15087 !! end
15088
15089
15090 !! test
15091 ISBN with space-delimited number
15092 !! wikitext
15093 ISBN 92 9017 032 8
15094 !! html
15095 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15096 </p>
15097 !! end
15098
15099
15100 !! test
15101 ISBN with multiple spaces, no number
15102 !! wikitext
15103 ISBN foo
15104 !! html
15105 <p>ISBN foo
15106 </p>
15107 !! end
15108
15109
15110 !! test
15111 ISBN length
15112 !! wikitext
15113 ISBN 123456789
15114
15115 ISBN 1234567890
15116
15117 ISBN 12345678901
15118 !! html
15119 <p>ISBN 123456789
15120 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15121 </p><p>ISBN 12345678901
15122 </p>
15123 !! end
15124
15125
15126 !! test
15127 ISBN with trailing year (bug 8110)
15128 !! wikitext
15129 ISBN 1-234-56789-0 - 2006
15130
15131 ISBN 1 234 56789 0 - 2006
15132 !! html
15133 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15134 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15135 </p>
15136 !! end
15137
15138
15139 !! test
15140 anchorencode
15141 !! wikitext
15142 {{anchorencode:foo bar©#%n}}
15143 !! html
15144 <p>foo_bar.C2.A9.23.25n
15145 </p>
15146 !! end
15147
15148 !! test
15149 anchorencode trims spaces
15150 !! wikitext
15151 {{anchorencode: __pretty__please__}}
15152 !! html
15153 <p>pretty_please
15154 </p>
15155 !! end
15156
15157 !! test
15158 anchorencode deals with links
15159 !! wikitext
15160 {{anchorencode: [[hello|world]] [[hi]]}}
15161 !! html
15162 <p>world_hi
15163 </p>
15164 !! end
15165
15166 !! test
15167 anchorencode deals with templates
15168 !! wikitext
15169 {{anchorencode: {{Foo}} }}
15170 !! html
15171 <p>FOO
15172 </p>
15173 !! end
15174
15175 !! test
15176 anchorencode encodes like the TOC generator: (bug 18431)
15177 !! wikitext
15178 === _ +:.3A%3A&&amp;]] ===
15179 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15180 __NOEDITSECTION__
15181 !! html
15182 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15183 <p>.2B:.3A.253A.26.26.5D.5D
15184 </p>
15185 !! end
15186
15187 !! test
15188 Bug 6200: blockquotes and paragraph formatting
15189 !! wikitext
15190 <blockquote>
15191 foo
15192 </blockquote>
15193
15194 bar
15195
15196 baz
15197 !! html
15198 <blockquote>
15199 <p>foo
15200 </p>
15201 </blockquote>
15202 <p>bar
15203 </p>
15204 <pre>baz
15205 </pre>
15206 !! end
15207
15208 !! test
15209 Bug 8293: Use of center tag ruins paragraph formatting
15210 !! wikitext
15211 <center>
15212 foo
15213 </center>
15214
15215 bar
15216
15217 baz
15218 !! html
15219 <center>
15220 <p>foo
15221 </p>
15222 </center>
15223 <p>bar
15224 </p>
15225 <pre>baz
15226 </pre>
15227 !! end
15228
15229 !!test
15230 Parsing of overlapping (improperly nested) inline html tags
15231 !! wikitext
15232 <span><s>x</span></s>
15233 !! html/php
15234 <p><span><s>x&lt;/span&gt;</s></span>
15235 </p>
15236 !! html/parsoid
15237 <p><span><s>x</s></span>
15238 </p>
15239 !!end
15240
15241 ###
15242 ### Language variants related tests
15243 ###
15244 !! test
15245 Self-link in language variants
15246 !! options
15247 title=[[Dunav]] language=sr
15248 !! wikitext
15249 Both [[Dunav]] and [[Дунав]] are names for this river.
15250 !! html
15251 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15252 </p>
15253 !!end
15254
15255 !! article
15256 Дуна
15257 !! text
15258 content
15259 !! endarticle
15260
15261 !! test
15262 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15263 !! options
15264 title=[[Duna]] language=sr
15265 !! wikitext
15266 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15267 !! html
15268 <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.
15269 </p>
15270 !! end
15271
15272 !! test
15273 Link to a section of a variant of this title shouldn't be parsed as self-link
15274 !! options
15275 title=[[Duna]] language=sr
15276 !! wikitext
15277 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15278 !! html
15279 <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.
15280 </p>
15281 !! end
15282
15283 !! test
15284 Link to pages in language variants
15285 !! options
15286 language=sr
15287 !! wikitext
15288 Main Page can be written as [[Маин Паге]]
15289 !! html
15290 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15291 </p>
15292 !!end
15293
15294
15295 !! test
15296 Multiple links to pages in language variants
15297 !! options
15298 language=sr
15299 !! wikitext
15300 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15301 !! html
15302 <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>.
15303 </p>
15304 !!end
15305
15306
15307 !! test
15308 Simple template in language variants
15309 !! options
15310 language=sr
15311 !! wikitext
15312 {{тест}}
15313 !! html
15314 <p>This is a test template
15315 </p>
15316 !! end
15317
15318
15319 !! test
15320 Template with explicit namespace in language variants
15321 !! options
15322 language=sr
15323 !! wikitext
15324 {{Template:тест}}
15325 !! html
15326 <p>This is a test template
15327 </p>
15328 !! end
15329
15330
15331 !! test
15332 Basic test for template parameter in language variants
15333 !! options
15334 language=sr
15335 !! wikitext
15336 {{парамтест|param=foo}}
15337 !! html
15338 <p>This is a test template with parameter foo
15339 </p>
15340 !! end
15341
15342
15343 !! test
15344 Simple category in language variants
15345 !! options
15346 language=sr cat
15347 !! wikitext
15348 [[Category:МедиаWики Усер'с Гуиде]]
15349 !! html
15350 <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>
15351 !! end
15352
15353
15354 !! article
15355 Category:分类
15356 !! text
15357 blah
15358 !! endarticle
15359
15360 !! article
15361 Category:分類
15362 !! text
15363 blah
15364 !! endarticle
15365
15366 !! test
15367 Don't convert blue categorylinks to another variant (bug 33210)
15368 !! options
15369 language=zh cat
15370 !! wikitext
15371 [[A]][[Category:分类]]
15372 !! html
15373 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15374 !! end
15375
15376
15377 !! test
15378 Stripping -{}- tags (language variants)
15379 !! options
15380 language=sr
15381 !! wikitext
15382 Latin proverb: -{Ne nuntium necare}-
15383 !! html
15384 <p>Latin proverb: Ne nuntium necare
15385 </p>
15386 !! end
15387
15388
15389 !! test
15390 Prevent conversion with -{}- tags (language variants)
15391 !! options
15392 language=sr variant=sr-ec
15393 !! wikitext
15394 Latinski: -{Ne nuntium necare}-
15395 !! html
15396 <p>Латински: Ne nuntium necare
15397 </p>
15398 !! end
15399
15400
15401 !! test
15402 Prevent conversion of text with -{}- tags (language variants)
15403 !! options
15404 language=sr variant=sr-ec
15405 !! wikitext
15406 Latinski: -{Ne nuntium necare}-
15407 !! html
15408 <p>Латински: Ne nuntium necare
15409 </p>
15410 !! end
15411
15412
15413 !! test
15414 Prevent conversion of links with -{}- tags (language variants)
15415 !! options
15416 language=sr variant=sr-ec
15417 !! wikitext
15418 -{[[Main Page]]}-
15419 !! html
15420 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15421 </p>
15422 !! end
15423
15424
15425 !! test
15426 -{}- tags within headlines (within html for parserConvert())
15427 !! options
15428 language=sr variant=sr-ec
15429 !! wikitext
15430 == -{Naslov}- ==
15431 !! html
15432 <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>
15433
15434 !! end
15435
15436
15437 !! test
15438 Explicit definition of language variant alternatives
15439 !! options
15440 language=zh variant=zh-tw
15441 !! wikitext
15442 -{zh:China;zh-tw:Taiwan}-, not China
15443 !! html
15444 <p>Taiwan, not China
15445 </p>
15446 !! end
15447
15448
15449 !! test
15450 Conversion around HTML tags
15451 !! options
15452 language=sr variant=sr-ec
15453 !! wikitext
15454 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15455 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15456 !! html
15457 <p>
15458 <span title="ЛаCтин">ски</span>
15459 </p>
15460 !! end
15461
15462
15463 !! test
15464 Explicit session-wise language variant mapping (A flag and - flag)
15465 !! options
15466 language=zh variant=zh-tw
15467 !! wikitext
15468 Taiwan is not China.
15469 But -{A|zh:China;zh-tw:Taiwan}- is China,
15470 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15471 and -{China}- is China.
15472 !! html
15473 <p>Taiwan is not China.
15474 But Taiwan is Taiwan,
15475 (This should be stripped!)
15476 and China is China.
15477 </p>
15478 !! end
15479
15480 !! test
15481 Explicit session-wise language variant mapping (H flag for hide)
15482 !! options
15483 language=zh variant=zh-tw
15484 !! wikitext
15485 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15486 Taiwan is China.
15487 !! html
15488 <p>(This should be stripped!)
15489 Taiwan is Taiwan.
15490 </p>
15491 !! end
15492
15493 !! test
15494 Adding explicit conversion rule for title (T flag)
15495 !! options
15496 language=zh variant=zh-tw showtitle
15497 !! wikitext
15498 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15499 !! html
15500 Taiwan
15501 <p>Should be stripped!
15502 </p>
15503 !! end
15504
15505 !! test
15506 Testing that changing the language variant here in the tests actually works
15507 !! options
15508 language=zh variant=zh showtitle
15509 !! wikitext
15510 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15511 !! html
15512 China
15513 <p>Should be stripped!
15514 </p>
15515 !! end
15516
15517 !! test
15518 Recursive conversion of alt and title attrs shouldn't clear converter state
15519 !! options
15520 language=zh variant=zh-cn showtitle
15521 !! wikitext
15522 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15523 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15524 !! html
15525 China
15526 <p>
15527 Should be stripped<span title="Exclamation">!</span>
15528 </p>
15529 !! end
15530
15531 !! test
15532 Bug 24072: more test on conversion rule for title
15533 !! options
15534 language=zh variant=zh-tw showtitle
15535 !! wikitext
15536 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15537 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15538 !! html
15539 Taiwan
15540 <p>This should be stripped!
15541 This won't take interferes with the title rule.
15542 </p>
15543 !! end
15544
15545 !! test
15546 Partly disable title conversion if variant == main language code
15547 !! options
15548 language=zh variant=zh title=[[ZH]] showtitle
15549 !! wikitext
15550 -{T|zh-cn:CN;zh-tw:TW}-
15551 !! html
15552 ZH
15553 <p>
15554 </p>
15555 !! end
15556
15557 !! test
15558 Partly disable title conversion if variant == main language code, more
15559 !! options
15560 language=zh variant=zh title=[[ZH]] showtitle
15561 !! wikitext
15562 -{T|TW}-
15563 !! html
15564 ZH
15565 <p>
15566 </p>
15567 !! end
15568
15569 !! test
15570 Raw output of variant escape tags (R flag)
15571 !! options
15572 language=zh variant=zh-tw
15573 !! wikitext
15574 Raw: -{R|zh:China;zh-tw:Taiwan}-
15575 !! html
15576 <p>Raw: zh:China;zh-tw:Taiwan
15577 </p>
15578 !! end
15579
15580 !! test
15581 Nested using of manual convert syntax
15582 !! options
15583 language=zh variant=zh-hk
15584 !! wikitext
15585 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15586 !! html
15587 <p>Nested: Hello Hong Kong!
15588 </p>
15589 !! end
15590
15591 !! test
15592 Proper conversion of text in external links
15593 !! options
15594 language=sr variant=sr-ec
15595 !! wikitext
15596 http://www.google.com
15597 gopher://www.google.com
15598 [http://www.google.com http://www.google.com]
15599 [gopher://www.google.com gopher://www.google.com]
15600 [https://www.google.com irc://www.google.com]
15601 [ftp://www.google.com www.google.com/ftp://dir]
15602 [//www.google.com www.google.com]
15603 !! html
15604 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15605 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15606 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15607 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15608 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15609 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15610 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15611 </p>
15612 !! end
15613
15614 !! test
15615 Do not convert roman numbers to language variants
15616 !! options
15617 language=sr variant=sr-ec
15618 !! wikitext
15619 Fridrih IV je car.
15620 !! html
15621 <p>Фридрих IV је цар.
15622 </p>
15623 !! end
15624
15625 !! test
15626 Unclosed language converter markup "-{"
15627 !! options
15628 language=sr
15629 !! wikitext
15630 -{T|hello
15631 !! html
15632 <p>-{T|hello
15633 </p>
15634 !! end
15635
15636 !! test
15637 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15638 !! options
15639 language=sr
15640 !! wikitext
15641 -{R|=&gt;}-
15642 !! html
15643 <p>=&gt;
15644 </p>
15645 !!end
15646
15647 !! test
15648 Don't break link parsing if language converter markup is in the caption.
15649 !! options
15650 language=sr variant=sr-ec
15651 !! wikitext
15652 [[Main Page|-{R|main page}-]]
15653 !! html
15654 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15655 </p>
15656 !! end
15657
15658 # This test is currently broken in the PHP parser (bug 52661)
15659 !! test
15660 Don't break image parsing if language converter markup is in the caption.
15661 !! options
15662 language=sr
15663 disabled
15664 !! wikitext
15665 [[File:Foobar.jpg|-{R|caption}-]]
15666 !! html
15667 <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>
15668 </p>
15669 !! end
15670
15671 # This test is currently broken in the PHP parser (bug 52661)
15672 !! test
15673 Don't break list handling if language converter markup is in the item.
15674 !! options
15675 language=zh variant=zh-cn
15676 disabled
15677 !! wikitext
15678 ;-{zh-cn:AAA;zh-tw:BBB}-
15679 !! html
15680 <dl><dt>AAA
15681 </dt></dl>
15682
15683 !! end
15684
15685 # This test is currently broken in the PHP parser (bug 52661)
15686 !! test
15687 Don't break table handling if language converter markup is in the cell.
15688 !! options
15689 language=sr variant=sr-ec
15690 disabled
15691 !! wikitext
15692 {|
15693 |-
15694 | -{R|B}-
15695 |}
15696 !! html
15697 <table>
15698
15699 <tr>
15700 <td> B
15701 </td></tr></table>
15702
15703 !! end
15704
15705 !! test
15706 Bug 529: Uncovered bullet
15707 !! wikitext
15708 * Foo {{bullet}}
15709 !! html
15710 <ul>
15711 <li> Foo
15712 </li>
15713 <li> Bar
15714 </li>
15715 </ul>
15716
15717 !! end
15718
15719 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15720 # Templates in Wikipedia rely on this behavior, as tidy has always been
15721 # enabled there. These tests are normally run *without* tidy, so specify the
15722 # full output here.
15723 # To test realistic parsing behavior, apply a tidy-like transformation to both
15724 # the expected output and your parser's output.
15725 !! test
15726 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15727 !! wikitext
15728 ******* Foo {{bullet}}
15729 !! html
15730 <ul>
15731 <li><ul>
15732 <li><ul>
15733 <li><ul>
15734 <li><ul>
15735 <li><ul>
15736 <li><ul>
15737 <li> Foo
15738 </li>
15739 </ul>
15740 </li>
15741 </ul>
15742 </li>
15743 </ul>
15744 </li>
15745 </ul>
15746 </li>
15747 </ul>
15748 </li>
15749 </ul>
15750 </li>
15751 <li> Bar
15752 </li>
15753 </ul>
15754
15755 !! end
15756
15757 !! test
15758 Bug 529: Uncovered table already at line-start
15759 !! wikitext
15760 x
15761
15762 {{table}}
15763 y
15764 !! html
15765 <p>x
15766 </p>
15767 <table>
15768 <tr>
15769 <td> 1 </td>
15770 <td> 2
15771 </td></tr>
15772 <tr>
15773 <td> 3 </td>
15774 <td> 4
15775 </td></tr></table>
15776 <p>y
15777 </p>
15778 !! end
15779
15780 !! test
15781 Bug 529: Uncovered bullet in parser function result
15782 !! wikitext
15783 * Foo {{lc:{{bullet}} }}
15784 !! html
15785 <ul>
15786 <li> Foo
15787 </li>
15788 <li> bar
15789 </li>
15790 </ul>
15791
15792 !! end
15793
15794 !! test
15795 Bug 5678: Double-parsed template argument
15796 !! wikitext
15797 {{lc:{{{1}}}|hello}}
15798 !! html
15799 <p>{{{1}}}
15800 </p>
15801 !! end
15802
15803 !! test
15804 Bug 5678: Double-parsed template invocation
15805 !! wikitext
15806 {{lc:{{paramtest {{!}} param = hello }} }}
15807 !! html
15808 <p>{{paramtest | param = hello }}
15809 </p>
15810 !! end
15811
15812 !! test
15813 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15814 !! options
15815 language=cs
15816 title=[[Main Page]]
15817 !! wikitext
15818 {{PRVNÍVELKÉ:ěščř}}
15819 {{prvnívelké:ěščř}}
15820 {{PRVNÍMALÉ:ěščř}}
15821 {{prvnímalé:ěščř}}
15822 {{MALÁ:ěščř}}
15823 {{malá:ěščř}}
15824 {{VELKÁ:ěščř}}
15825 {{velká:ěščř}}
15826 !! html
15827 <p>Ěščř
15828 Ěščř
15829 ěščř
15830 ěščř
15831 ěščř
15832 ěščř
15833 ĚŠČŘ
15834 ĚŠČŘ
15835 </p>
15836 !! end
15837
15838 !! test
15839 Morwen/13: Unclosed link followed by heading
15840 !! wikitext
15841 [[link
15842 ==heading==
15843 !! html
15844 <p>[[link
15845 </p>
15846 <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>
15847
15848 !! end
15849
15850 !! test
15851 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15852 !! wikitext
15853 {{foo|
15854 =heading=
15855 !! html
15856 <p>{{foo|
15857 </p>
15858 <h1><span class="mw-headline" id="heading">heading</span></h1>
15859
15860 !! end
15861
15862 !! test
15863 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15864 !! wikitext
15865 {{foo|
15866 ==heading==
15867 !! html
15868 <p>{{foo|
15869 </p>
15870 <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>
15871
15872 !! end
15873
15874 !! test
15875 Tildes in comments
15876 !! options
15877 pst
15878 !! wikitext
15879 <!-- ~~~~ -->
15880 !! html
15881 <!-- ~~~~ -->
15882 !! end
15883
15884 !! test
15885 Paragraphs inside divs (no extra line breaks)
15886 !! wikitext
15887 <div>Line one
15888
15889 Line two</div>
15890 !! html
15891 <div>Line one
15892 Line two</div>
15893
15894 !! end
15895
15896 !! test
15897 Paragraphs inside divs (extra line break on open)
15898 !! wikitext
15899 <div>
15900 Line one
15901
15902 Line two</div>
15903 !! html
15904 <div>
15905 <p>Line one
15906 </p>
15907 Line two</div>
15908
15909 !! end
15910
15911 !! test
15912 Paragraphs inside divs (extra line break on close)
15913 !! wikitext
15914 <div>Line one
15915
15916 Line two
15917 </div>
15918 !! html
15919 <div>Line one
15920 <p>Line two
15921 </p>
15922 </div>
15923
15924 !! end
15925
15926 !! test
15927 Paragraphs inside divs (extra line break on open and close)
15928 !! wikitext
15929 <div>
15930 Line one
15931
15932 Line two
15933 </div>
15934 !! html
15935 <div>
15936 <p>Line one
15937 </p><p>Line two
15938 </p>
15939 </div>
15940
15941 !! end
15942
15943 !! test
15944 Nesting tags, paragraphs on lines which begin with <div>
15945 !! options
15946 disabled
15947 !! wikitext
15948 <div></div><strong>A
15949 B</strong>
15950 !! html
15951 <div></div>
15952 <p><strong>A
15953 B</strong>
15954 </p>
15955 !! end
15956
15957 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15958 !! test
15959 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15960 !! wikitext
15961 <blockquote>Line one
15962
15963 Line two</blockquote>
15964 !! html
15965 <blockquote>Line one
15966 Line two</blockquote>
15967
15968 !! end
15969
15970 !! test
15971 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15972 !! wikitext
15973 <blockquote>
15974 Line one
15975
15976 Line two</blockquote>
15977 !! html
15978 <blockquote>
15979 <p>Line one
15980 </p>
15981 Line two</blockquote>
15982
15983 !! end
15984
15985 !! test
15986 Bug 6200: paragraphs inside blockquotes (extra line break on close)
15987 !! wikitext
15988 <blockquote>Line one
15989
15990 Line two
15991 </blockquote>
15992 !! html
15993 <blockquote>Line one
15994 <p>Line two
15995 </p>
15996 </blockquote>
15997
15998 !! end
15999
16000 !! test
16001 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16002 !! wikitext
16003 <blockquote>
16004 Line one
16005
16006 Line two
16007 </blockquote>
16008 !! html
16009 <blockquote>
16010 <p>Line one
16011 </p><p>Line two
16012 </p>
16013 </blockquote>
16014
16015 !! end
16016
16017 !! test
16018 Paragraphs inside blockquotes/divs (no extra line breaks)
16019 !! wikitext
16020 <blockquote><div>Line one
16021
16022 Line two</div></blockquote>
16023 !! html
16024 <blockquote><div>Line one
16025 Line two</div></blockquote>
16026
16027 !! end
16028
16029 !! test
16030 Paragraphs inside blockquotes/divs (extra line break on open)
16031 !! wikitext
16032 <blockquote><div>
16033 Line one
16034
16035 Line two</div></blockquote>
16036 !! html
16037 <blockquote><div>
16038 <p>Line one
16039 </p>
16040 Line two</div></blockquote>
16041
16042 !! end
16043
16044 !! test
16045 Paragraphs inside blockquotes/divs (extra line break on close)
16046 !! wikitext
16047 <blockquote><div>Line one
16048
16049 Line two
16050 </div></blockquote>
16051 !! html
16052 <blockquote><div>Line one
16053 <p>Line two
16054 </p>
16055 </div></blockquote>
16056
16057 !! end
16058
16059 !! test
16060 Paragraphs inside blockquotes/divs (extra line break on open and close)
16061 !! wikitext
16062 <blockquote><div>
16063 Line one
16064
16065 Line two
16066 </div></blockquote>
16067 !! html
16068 <blockquote><div>
16069 <p>Line one
16070 </p><p>Line two
16071 </p>
16072 </div></blockquote>
16073
16074 !! end
16075
16076 !! test
16077 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16078 !! options
16079 wgLinkHolderBatchSize=0
16080 !! wikitext
16081 [[meatball:1]]
16082 [[meatball:2]]
16083 [[meatball:3]]
16084 !! html
16085 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16086 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16087 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16088 </p>
16089 !! end
16090
16091 !! test
16092 Free external link invading image caption
16093 !! wikitext
16094 [[Image:Foobar.jpg|thumb|http://x|hello]]
16095 !! html
16096 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
16097
16098 !! end
16099
16100 !! test
16101 Bug 15196: localised external link numbers
16102 !! options
16103 language=fa
16104 !! wikitext
16105 [http://en.wikipedia.org/]
16106 !! html
16107 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16108 </p>
16109 !! end
16110
16111 !! test
16112 Multibyte character in padleft
16113 !! wikitext
16114 {{padleft:-Hello|7|Æ}}
16115 !! html
16116 <p>Æ-Hello
16117 </p>
16118 !! end
16119
16120 !! test
16121 Multibyte character in padright
16122 !! wikitext
16123 {{padright:Hello-|7|Æ}}
16124 !! html
16125 <p>Hello-Æ
16126 </p>
16127 !! end
16128
16129 !!test
16130 formatdate parser function
16131 !! wikitext
16132 {{#formatdate:2009-03-24}}
16133 !! html
16134 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16135 </p>
16136 !! end
16137
16138 !!test
16139 formatdate parser function, with default format
16140 !! wikitext
16141 {{#formatdate:2009-03-24|mdy}}
16142 !! html
16143 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16144 </p>
16145 !! end
16146
16147 !! test
16148 Spacing of numbers in formatted dates
16149 !! wikitext
16150 {{#formatdate:January 15}}
16151 !! html
16152 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16153 </p>
16154 !! end
16155
16156 !! test
16157 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
16158 !! options
16159 language=nl title=[[MediaWiki:Common.css]]
16160 !! wikitext
16161 {{#formatdate:2009-03-24|dmy}}
16162 !! html
16163 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16164 </p>
16165 !! end
16166
16167 #
16168 #
16169 #
16170
16171 #
16172 # Edit comments
16173 #
16174
16175 !! test
16176 Edit comment with link
16177 !! options
16178 comment
16179 !! wikitext
16180 I like the [[Main Page]] a lot
16181 !! html
16182 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16183 !!end
16184
16185 !! test
16186 Edit comment with link and link text
16187 !! options
16188 comment
16189 !! wikitext
16190 I like the [[Main Page|best pages]] a lot
16191 !! html
16192 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16193 !!end
16194
16195 !! test
16196 Edit comment with link and link text with suffix
16197 !! options
16198 comment
16199 !! wikitext
16200 I like the [[Main Page|best page]]s a lot
16201 !! html
16202 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16203 !!end
16204
16205 !! test
16206 Edit comment with section link (non-local, eg in history list)
16207 !! options
16208 comment title=[[Main Page]]
16209 !! wikitext
16210 /* External links */ removed bogus entries
16211 !! html
16212 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16213 !!end
16214
16215 !! test
16216 Edit comment with section link and text before it (non-local, eg in history list)
16217 !! options
16218 comment title=[[Main Page]]
16219 !! wikitext
16220 pre-comment text /* External links */ removed bogus entries
16221 !! html
16222 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>
16223 !!end
16224
16225 !! test
16226 Edit comment with section link (local, eg in diff view)
16227 !! options
16228 comment local title=[[Main Page]]
16229 !! wikitext
16230 /* External links */ removed bogus entries
16231 !! html
16232 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16233 !!end
16234
16235 !! test
16236 Edit comment with subpage link (bug 14080)
16237 !! options
16238 comment
16239 subpage
16240 title=[[Subpage test]]
16241 !! wikitext
16242 Poked at a [[/subpage]] here...
16243 !! html
16244 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16245 !!end
16246
16247 !! test
16248 Edit comment with subpage link and link text (bug 14080)
16249 !! options
16250 comment
16251 subpage
16252 title=[[Subpage test]]
16253 !! wikitext
16254 Poked at a [[/subpage|neat little page]] here...
16255 !! html
16256 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16257 !!end
16258
16259 !! test
16260 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16261 !! options
16262 comment
16263 title=[[Subpage test]]
16264 !! wikitext
16265 Poked at a [[/subpage]] here...
16266 !! html
16267 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...
16268 !!end
16269
16270 !! test
16271 Edit comment with bare anchor link (local, as on diff)
16272 !! options
16273 comment
16274 local
16275 title=[[Main Page]]
16276 !! wikitext
16277 [[#section]]
16278 !! html
16279 <a href="#section">#section</a>
16280 !! end
16281
16282 !! test
16283 Edit comment with bare anchor link (non-local, as on history)
16284 !! options
16285 comment
16286 title=[[Main Page]]
16287 !! wikitext
16288 [[#section]]
16289 !! html
16290 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16291 !! end
16292
16293 !! test
16294 Anchor starting with underscore
16295 !! wikitext
16296 [[#_ref|One]]
16297 !! html
16298 <p><a href="#_ref">One</a>
16299 </p>
16300 !! end
16301
16302 !! test
16303 Id starting with underscore
16304 !! wikitext
16305 <div id="_ref"></div>
16306 !! html
16307 <div id="_ref"></div>
16308
16309 !! end
16310
16311 !! test
16312 Space normalisation on autocomment (bug 22784)
16313 !! options
16314 comment
16315 title=[[Main Page]]
16316 !! wikitext
16317 /* __hello__world__ */
16318 !! html
16319 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16320 !! end
16321
16322 !! test
16323 percent-encoding and + signs in comments (Bug 26410)
16324 !! options
16325 comment
16326 !! wikitext
16327 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16328 !! html
16329 <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>
16330 !! end
16331
16332 !! test
16333 Bad images - basic functionality
16334 !! options
16335 disabled
16336 !! wikitext
16337 [[File:Bad.jpg]]
16338 !! html
16339 !! end
16340
16341 !! test
16342 Bad images - bug 16039: text after bad image disappears
16343 !! options
16344 disabled
16345 !! wikitext
16346 Foo bar
16347 [[File:Bad.jpg]]
16348 Bar foo
16349 !! html
16350 <p>Foo bar
16351 </p><p>Bar foo
16352 </p>
16353 !! end
16354
16355 !! test
16356 Verify that displaytitle works (bug #22501) no displaytitle
16357 !! options
16358 showtitle
16359 !! config
16360 wgAllowDisplayTitle=true
16361 wgRestrictDisplayTitle=false
16362 !! wikitext
16363 this is not the the title
16364 !! html
16365 Parser test
16366 <p>this is not the the title
16367 </p>
16368 !! end
16369
16370 !! test
16371 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16372 !! options
16373 showtitle
16374 title=[[Screen]]
16375 !! config
16376 wgAllowDisplayTitle=true
16377 wgRestrictDisplayTitle=false
16378 !! wikitext
16379 this is not the the title
16380 {{DISPLAYTITLE:whatever}}
16381 !! html
16382 whatever
16383 <p>this is not the the title
16384 </p>
16385 !! end
16386
16387 !! test
16388 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16389 !! options
16390 showtitle
16391 title=[[Screen]]
16392 !! config
16393 wgAllowDisplayTitle=true
16394 wgRestrictDisplayTitle=true
16395 !! wikitext
16396 this is not the the title
16397 {{DISPLAYTITLE:whatever}}
16398 !! html
16399 Screen
16400 <p>this is not the the title
16401 </p>
16402 !! end
16403
16404 !! test
16405 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16406 !! options
16407 showtitle
16408 title=[[Screen]]
16409 !! config
16410 wgAllowDisplayTitle=true
16411 wgRestrictDisplayTitle=true
16412 !! wikitext
16413 this is not the the title
16414 {{DISPLAYTITLE:screen}}
16415 !! html
16416 screen
16417 <p>this is not the the title
16418 </p>
16419 !! end
16420
16421 !! test
16422 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16423 !! options
16424 showtitle
16425 title=[[Screen]]
16426 !! config
16427 wgAllowDisplayTitle=false
16428 !! wikitext
16429 this is not the the title
16430 {{DISPLAYTITLE:screen}}
16431 !! html
16432 Screen
16433 <p>this is not the the title
16434 <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>
16435 </p>
16436 !! end
16437
16438 !! test
16439 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16440 !! options
16441 showtitle
16442 title=[[Screen]]
16443 !! config
16444 wgAllowDisplayTitle=false
16445 !! wikitext
16446 this is not the the title
16447 !! html
16448 Screen
16449 <p>this is not the the title
16450 </p>
16451 !! end
16452
16453 !! test
16454 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16455 !! options
16456 showtitle
16457 title=[[Screen]]
16458 !! config
16459 wgAllowDisplayTitle=true
16460 wgRestrictDisplayTitle=true
16461 !! wikitext
16462 this is not the the title
16463 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16464 !! html
16465 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16466 <p>this is not the the title
16467 </p>
16468 !! end
16469
16470 !! test
16471 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16472 !! options
16473 showtitle
16474 title=[[Screen]]
16475 !! config
16476 wgAllowDisplayTitle=true
16477 wgRestrictDisplayTitle=true
16478 !! wikitext
16479 this is not the the title
16480 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16481 !! html
16482 <span style="color: red;">s</span>creen
16483 <p>this is not the the title
16484 </p>
16485 !! end
16486
16487 !! test
16488 preload: check <noinclude> and <includeonly>
16489 !! options
16490 preload
16491 !! wikitext
16492 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16493 !! html
16494 Hello kind world.
16495 !! end
16496
16497 !! test
16498 preload: check <onlyinclude>
16499 !! options
16500 preload
16501 !! wikitext
16502 Goodbye <onlyinclude>Hello world</onlyinclude>
16503 !! html
16504 Hello world
16505 !! end
16506
16507 !! test
16508 preload: can pass tags through if we want to
16509 !! options
16510 preload
16511 !! wikitext
16512 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16513 !! html
16514 <includeonly>Hello world</includeonly>
16515 !! end
16516
16517 !! test
16518 preload: check that it doesn't try to do tricks
16519 !! options
16520 preload
16521 !! wikitext
16522 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16523 !! html
16524 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16525 !! end
16526
16527 !! test
16528 Play a bit with r67090 and bug 3158
16529 !! options
16530 disabled
16531 !! wikitext
16532 <div style="width:50% !important">&nbsp;</div>
16533 <div style="width:50%&nbsp;!important">&nbsp;</div>
16534 <div style="width:50%&#160;!important">&nbsp;</div>
16535 <div style="border : solid;">&nbsp;</div>
16536 !! html
16537 <div style="width:50% !important">&nbsp;</div>
16538 <div style="width:50% !important">&nbsp;</div>
16539 <div style="width:50% !important">&nbsp;</div>
16540 <div style="border&#160;: solid;">&nbsp;</div>
16541
16542 !! end
16543
16544 !! test
16545 HTML5 data attributes
16546 !! wikitext
16547 <span data-foo="bar">Baz</span>
16548 <p data-abc-def_hij="">Quuz</p>
16549 !! html
16550 <p><span data-foo="bar">Baz</span>
16551 </p>
16552 <p data-abc-def_hij="">Quuz</p>
16553
16554 !! end
16555
16556 !! test
16557 percent-encoding and + signs in internal links (Bug 26410)
16558 !! wikitext
16559 [[User:+%]] [[Page+title%]]
16560 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16561 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16562 [[%33%45]] [[%33%45+]]
16563 !! html
16564 <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>
16565 <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>
16566 <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>
16567 <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>
16568 </p>
16569 !! end
16570
16571 !! test
16572 Special characters in embedded file links (bug 27679)
16573 !! wikitext
16574 [[File:Contains & ampersand.jpg]]
16575 [[File:Does not exist.jpg|Title with & ampersand]]
16576 !! html
16577 <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>
16578 <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>
16579 </p>
16580 !! end
16581
16582
16583 !! test
16584 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16585 !! wikitext
16586 Text&apos;s been normalized?
16587 !! html
16588 <p>Text&#39;s been normalized?
16589 </p>
16590 !! end
16591
16592 !! test
16593 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16594 !! wikitext
16595 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16596 !! html
16597 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16598 </p>
16599 !! end
16600
16601 !! test
16602 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16603 !! wikitext
16604 [http://www.example.org/ ideograms]
16605 !! html
16606 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16607 </p>
16608 !! end
16609
16610 !! test
16611 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16612 !! wikitext
16613 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16614 !! html
16615 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16616 </p>
16617 !! end
16618
16619 !! article
16620 Mediawiki:loop1
16621 !! text
16622 {{Identical|A}}
16623 !! endarticle
16624
16625 !! article
16626 Mediawiki:loop2
16627 !! text
16628 {{Identical|B}}
16629 !! endarticle
16630
16631 !! article
16632 Template:Identical
16633 !! text
16634 {{int:loop1}}
16635 {{int:loop2}}
16636 !! endarticle
16637
16638 !! test
16639 Bug 31098 Template which includes system messages which includes the template
16640 !! wikitext
16641 {{Identical}}
16642 !! html
16643 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16644 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16645 </p>
16646 !! end
16647
16648 !! test
16649 Bug31490 Turkish: ucfirst 'blah'
16650 !! options
16651 language=tr
16652 !! wikitext
16653 {{ucfirst:blah}}
16654 !! html
16655 <p>Blah
16656 </p>
16657 !! end
16658
16659 !! test
16660 Bug31490 Turkish: ucfirst 'ix'
16661 !! options
16662 language=tr
16663 !! wikitext
16664 {{ucfirst:ix}}
16665 !! html
16666 <p>İx
16667 </p>
16668 !! end
16669
16670 !! test
16671 Bug31490 Turkish: lcfirst 'BLAH'
16672 !! options
16673 language=tr
16674 !! wikitext
16675 {{lcfirst:BLAH}}
16676 !! html
16677 <p>bLAH
16678 </p>
16679 !! end
16680
16681 !! test
16682 Bug31490 Turkish: ucfırst (with a dotless i)
16683 !! options
16684 language=tr
16685 !! wikitext
16686 {{ucfırst:blah}}
16687 !! html
16688 <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>
16689 </p>
16690 !! end
16691
16692 !! test
16693 Bug31490 ucfırst (with a dotless i) with English language
16694 !! options
16695 language=en
16696 !! wikitext
16697 {{ucfırst:blah}}
16698 !! html
16699 <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>
16700 </p>
16701 !! end
16702
16703 !! test
16704 Bug 26375: TOC with italics
16705 !! options
16706 title=[[Main Page]]
16707 !! wikitext
16708 __TOC__
16709 == ''Lost'' episodes ==
16710 !! html
16711 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16712 <ul>
16713 <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>
16714 </ul>
16715 </div>
16716
16717 <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>
16718
16719 !! end
16720
16721 !! test
16722 Bug 26375: TOC with bold
16723 !! options
16724 title=[[Main Page]]
16725 !! wikitext
16726 __TOC__
16727 == '''should be bold''' then normal text ==
16728 !! html
16729 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16730 <ul>
16731 <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>
16732 </ul>
16733 </div>
16734
16735 <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>
16736
16737 !! end
16738
16739 !! test
16740 Bug 33845: Headings become cursive in TOC when they contain an image
16741 !! options
16742 title=[[Main Page]]
16743 !! wikitext
16744 __TOC__
16745 == Image [[Image:foobar.jpg]] ==
16746 !! html
16747 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16748 <ul>
16749 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16750 </ul>
16751 </div>
16752
16753 <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>
16754
16755 !! end
16756
16757 !! test
16758 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16759 !! options
16760 title=[[Main Page]]
16761 !! wikitext
16762 __TOC__
16763 == <blockquote>Quote</blockquote> ==
16764 !! html
16765 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16766 <ul>
16767 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16768 </ul>
16769 </div>
16770
16771 <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>
16772
16773 !! end
16774
16775 !! test
16776 Unclosed tags in TOC
16777 !! options
16778 title=[[Main Page]]
16779 !! wikitext
16780 __TOC__
16781 == Proof: 2 < 3 ==
16782 <small>Hanc marginis exiguitas non caperet.</small>
16783 QED
16784 !! html
16785 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16786 <ul>
16787 <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>
16788 </ul>
16789 </div>
16790
16791 <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>
16792 <p><small>Hanc marginis exiguitas non caperet.</small>
16793 QED
16794 </p>
16795 !! end
16796
16797 !! test
16798 Multiple tags in TOC
16799 !! wikitext
16800 __TOC__
16801 == <i>Foo</i> <b>Bar</b> ==
16802
16803 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16804 !! html
16805 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16806 <ul>
16807 <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>
16808 <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>
16809 </ul>
16810 </div>
16811
16812 <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>
16813 <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>
16814
16815 !! end
16816
16817 !! test
16818 Tags with parameters in TOC
16819 !! wikitext
16820 __TOC__
16821 == <sup class="in-h2">Hello</sup> ==
16822
16823 == <sup class="a > b">Evilbye</sup> ==
16824 !! html
16825 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16826 <ul>
16827 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16828 <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>
16829 </ul>
16830 </div>
16831
16832 <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>
16833 <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>
16834
16835 !! end
16836
16837 !! test
16838 span tags with directionality in TOC
16839 !! wikitext
16840 __TOC__
16841 == <span dir="ltr">C++</span> ==
16842
16843 == <span dir="rtl">זבנג!</span> ==
16844
16845 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16846
16847 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16848
16849 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16850 !! html
16851 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16852 <ul>
16853 <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>
16854 <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>
16855 <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>
16856 <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>
16857 <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>
16858 </ul>
16859 </div>
16860
16861 <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>
16862 <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>
16863 <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>
16864 <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>
16865 <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>
16866
16867 !! end
16868
16869 !! article
16870 MediaWiki:Bug32057
16871 !! text
16872 == {{int:headline_sample}} ==
16873 !! endarticle
16874
16875 !! test
16876 Bug 32057: Title needed when expanding <h> nodes.
16877 !! options
16878 title=[[Main Page]]
16879 !! wikitext
16880 {{int:Bug32057}}
16881 !! html
16882 <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>
16883
16884 !! end
16885
16886 !! test
16887 Strip marker in urlencode
16888 !! wikitext
16889 {{urlencode:x<nowiki/>y}}
16890 {{urlencode:x<nowiki/>y|wiki}}
16891 {{urlencode:x<nowiki/>y|path}}
16892 !! html
16893 <p>xy
16894 xy
16895 xy
16896 </p>
16897 !! end
16898
16899 !! test
16900 Strip marker in lc
16901 !! wikitext
16902 {{lc:x<nowiki/>y}}
16903 !! html
16904 <p>xy
16905 </p>
16906 !! end
16907
16908 !! test
16909 Strip marker in uc
16910 !! wikitext
16911 {{uc:x<nowiki/>y}}
16912 !! html
16913 <p>XY
16914 </p>
16915 !! end
16916
16917 !! test
16918 Strip marker in formatNum
16919 !! wikitext
16920 {{formatnum:1<nowiki/>2}}
16921 {{formatnum:1<nowiki/>2|R}}
16922 !! html
16923 <p>12
16924 12
16925 </p>
16926 !! end
16927
16928 !! test
16929 Check noCommafy in formatNum
16930 !! options
16931 language=be-tarask
16932 !! wikitext
16933 {{formatnum:123456.78}}
16934 {{formatnum:123456.78|NOSEP}}
16935 !! html
16936 <p>123 456,78
16937 123456.78
16938 </p>
16939 !! end
16940
16941 !! test
16942 Wrong option for formatNum (bug 56199)
16943 !! wikitext
16944 {{formatnum:1,234.56|Random}}
16945 {{formatnum:1,234.56|EVERYTHING}}
16946 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
16947 !! html
16948 <p>1,234.56
16949 1,234.56
16950 1,234.56
16951 </p>
16952 !! end
16953
16954 !! test
16955 Strip marker in grammar
16956 !! options
16957 language=fi
16958 !! wikitext
16959 {{grammar:elative|foo<nowiki/>bar}}
16960 !! html
16961 <p>foobarista
16962 </p>
16963 !! end
16964
16965 !! test
16966 Strip marker in padleft
16967 !! wikitext
16968 {{padleft:|2|x<nowiki/>y}}
16969 !! html
16970 <p>xy
16971 </p>
16972 !! end
16973
16974 !! test
16975 Strip marker in padright
16976 !! wikitext
16977 {{padright:|2|x<nowiki/>y}}
16978 !! html
16979 <p>xy
16980 </p>
16981 !! end
16982
16983 !! test
16984 Strip marker in anchorencode
16985 !! wikitext
16986 {{anchorencode:x<nowiki/>y}}
16987 !! html
16988 <p>xy
16989 </p>
16990 !! end
16991
16992 !! test
16993 nowiki inside link inside heading (bug 18295)
16994 !! wikitext
16995 ==[[foo|x<nowiki>y</nowiki>z]]==
16996 !! html
16997 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">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>
16998
16999 !! end
17000
17001 !! test
17002 new support for bdi element (bug 31817)
17003 !! wikitext
17004 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17005 !! html
17006 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17007
17008 !!end
17009
17010 !! test
17011 Ignore pipe between table row attributes
17012 !! wikitext
17013 {|
17014 | quux
17015 |- id=foo | style='color: red'
17016 | bar
17017 |}
17018 !! html
17019 <table>
17020 <tr>
17021 <td> quux
17022 </td></tr>
17023 <tr id="foo" style="color: red">
17024 <td> bar
17025 </td></tr></table>
17026
17027 !! end
17028
17029 !!test
17030 Gallery override link with WikiLink (bug 34852)
17031 !! wikitext
17032 <gallery>
17033 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17034 </gallery>
17035 !! html
17036 <ul class="gallery mw-gallery-traditional">
17037 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17038 <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" /></a></div></div>
17039 <div class="gallerytext">
17040 <p>caption
17041 </p>
17042 </div>
17043 </div></li>
17044 </ul>
17045
17046 !! end
17047
17048 !!test
17049 Gallery override link with absolute external link (bug 34852)
17050 !! wikitext
17051 <gallery>
17052 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17053 </gallery>
17054 !! html
17055 <ul class="gallery mw-gallery-traditional">
17056 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17057 <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" /></a></div></div>
17058 <div class="gallerytext">
17059 <p>caption
17060 </p>
17061 </div>
17062 </div></li>
17063 </ul>
17064
17065 !! end
17066
17067 !!test
17068 Gallery override link with malicious javascript (bug 34852)
17069 !! wikitext
17070 <gallery>
17071 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17072 </gallery>
17073 !! html
17074 <ul class="gallery mw-gallery-traditional">
17075 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17076 <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" /></a></div></div>
17077 <div class="gallerytext">
17078 <p>caption
17079 </p>
17080 </div>
17081 </div></li>
17082 </ul>
17083
17084 !! end
17085
17086 !!test
17087 Gallery with invalid title as link (bug 43964)
17088 !! wikitext
17089 <gallery>
17090 File:foobar.jpg|link=<
17091 </gallery>
17092 !! html
17093 <ul class="gallery mw-gallery-traditional">
17094 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17095 <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" /></a></div></div>
17096 <div class="gallerytext">
17097 </div>
17098 </div></li>
17099 </ul>
17100
17101 !! end
17102
17103 !!test
17104 Language parser function
17105 !! wikitext
17106 {{#language:ar}}
17107 !! html
17108 <p>العربية
17109 </p>
17110 !! end
17111
17112 !!test
17113 Padleft and padright as substr
17114 !! wikitext
17115 {{padleft:|3|abcde}}
17116 {{padright:|3|abcde}}
17117 !! html
17118 <p>abc
17119 abc
17120 </p>
17121 !! end
17122
17123 !!test
17124 Special parser function
17125 !! wikitext
17126 {{#special:RandomPage}}
17127 {{#special:BaDtItLe}}
17128 {{#special:Foobar}}
17129 !! html
17130 <p>Special:Random
17131 Special:Badtitle
17132 Special:Foobar
17133 </p>
17134 !! end
17135
17136 !!test
17137 Bug 34939 - Case insensitive link parsing ([HttP://])
17138 !! wikitext
17139 [HttP://MediaWiki.Org/]
17140 !! html
17141 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17142 </p>
17143 !! end
17144
17145 !!test
17146 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17147 !! wikitext
17148 [HttP://MediaWiki.Org/ MediaWiki]
17149 !! html
17150 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17151 </p>
17152 !! end
17153
17154 !!test
17155 Bug 34939 - Case insensitive link parsing (HttP://)
17156 !! wikitext
17157 HttP://MediaWiki.Org/
17158 !! html
17159 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17160 </p>
17161 !! end
17162
17163 !!test
17164 Disable TOC
17165 !! options
17166 notoc
17167 !! wikitext
17168 Lead
17169 == Section 1 ==
17170 == Section 2 ==
17171 == Section 3 ==
17172 == Section 4 ==
17173 == Section 5 ==
17174 !! html
17175 <p>Lead
17176 </p>
17177
17178 <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>
17179 <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>
17180 <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>
17181 <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>
17182 <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>
17183
17184 !! end
17185
17186
17187 ###
17188 ### Parsoids-specific tests
17189 ### Parsoid-PHP parser incompatibilities
17190 ###
17191 !!test
17192 1. SOL-sensitive wikitext tokens as template-args
17193 !!options
17194 parsoid=wt2html,wt2wt
17195 !! wikitext
17196 {{echo|*a}}
17197 {{echo|#a}}
17198 {{echo|:a}}
17199 !! html
17200 <span about="#mwt1" typeof="mw:Transclusion">
17201 </span><ul about="#mwt1"><li>a</li>
17202 </ul>
17203 <span about="#mwt2" typeof="mw:Transclusion">
17204 </span><ol about="#mwt2"><li>a</li>
17205 </ol>
17206 <span about="#mwt3" typeof="mw:Transclusion">
17207 </span><dl about="#mwt3"><dd>a</dd>
17208 </dl>
17209 !!end
17210
17211 #### ----------------------------------------------------------------
17212 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17213 #### tags. Parsoid's output for these tags differs from that of the
17214 #### PHP parser.
17215 #### ----------------------------------------------------------------
17216
17217 !!test
17218 Ref: 1. ref-location should be replaced with an index span
17219 !!options
17220 parsoid
17221 !! wikitext
17222 A <ref>foo</ref>
17223 B <ref name="x">foo</ref>
17224 C <ref name="y" />
17225 !! html
17226 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
17227 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span>
17228 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p>
17229 !!end
17230
17231 !!test
17232 Ref: 2. ref-tags with identical names should all get the same index
17233 !!options
17234 parsoid
17235 !! wikitext
17236 A <ref name="x">foo</ref>
17237 B <ref name="x" />
17238 !! html
17239 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
17240 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
17241 !!end
17242
17243 !!test
17244 Ref: 3. spaces in ref-names should be ignored
17245 !!options
17246 parsoid
17247 !! wikitext
17248 A <ref name="x">foo</ref>
17249 B <ref name=" x " />
17250 C <ref name= x />
17251 !! html
17252 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
17253 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
17254 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
17255 !!end
17256
17257 !!test
17258 Ref: 4. 'constructor' should be accepted as a valid ref-name
17259 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17260 !!options
17261 parsoid
17262 !! wikitext
17263 A <ref name="constructor">foo</ref>
17264 !! html
17265 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p>
17266 !!end
17267
17268 !!test
17269 Ref: 5. body should accept generic wikitext
17270 !!options
17271 parsoid
17272 !! wikitext
17273 A <ref>
17274 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17275 </ref>
17276
17277 <references />
17278 !! html
17279 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39; data-parsoid=&#39;{\"dsr\":[55,76,null,null],\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17280
17281 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17282 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./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>
17283 </li>
17284 </ol>
17285 !!end
17286
17287 !!test
17288 Ref: 6. indent-pres should not be output in ref-body
17289 !!options
17290 parsoid
17291 !! wikitext
17292 A <ref>
17293 foo
17294 bar
17295 baz
17296 </ref>
17297
17298 <references />
17299 !! html
17300 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17301
17302 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17303 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17304 bar
17305 baz
17306 </li>
17307 </ol>
17308 !!end
17309
17310 !!test
17311 Ref: 7. No p-wrapping in ref-body
17312 !!options
17313 parsoid
17314 !! wikitext
17315 A <ref>
17316 foo
17317
17318 bar
17319
17320
17321 baz
17322
17323
17324
17325 booz
17326 </ref>
17327
17328 <references />
17329 !! html
17330 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17331
17332 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17333 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17334
17335 bar
17336
17337
17338 baz
17339
17340
17341
17342 booz
17343 </li>
17344 </ol>
17345 !!end
17346
17347 !!test
17348 Ref: 8. transclusion wikitext has lower precedence
17349 !!options
17350 parsoid
17351 !! wikitext
17352 A <ref> foo {{echo|</ref> B C}}
17353
17354 <references />
17355 !! html
17356 <p>A <span class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo <span typeof=\&quot;mw:Nowiki\&quot; data-parsoid='{\&quot;src\&quot;:\&quot;{{\&quot;,\&quot;dsr\&quot;:[12,14,0,0]}'>{{</span>echo|&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
17357 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17358 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
17359 </ol>
17360 !!end
17361
17362 !!test
17363 Ref: 9. unclosed comments should not leak out of ref-body
17364 !!options
17365 parsoid
17366 !! wikitext
17367 A <ref> foo <!--</ref> B C
17368 <references />
17369 !! html
17370 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
17371 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17372 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17373 </ol>
17374 !!end
17375
17376 !!test
17377 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17378 !!options
17379 parsoid
17380 !! wikitext
17381 A <ref> <b> foo </ref> B C
17382
17383 <references />
17384 !! html
17385 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;b data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[8,16,3,0]}&#39;> foo &lt;/b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref> &lt;b> foo &lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B C</p>
17386
17387
17388 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17389 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
17390 </ol>
17391 !!end
17392
17393 !!test
17394 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17395 !!options
17396 parsoid
17397 !! wikitext
17398 A <ref>foo</ref> B
17399 C <ref>bar</ref> D
17400 !! html
17401 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B
17402 C <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>bar&lt;/ref>"}'><a href="#cite_note-2">[2]</a></span> D</p>
17403 !!end
17404
17405 !!test
17406 Ref: 12. ref-tags act as trailing newline migration barrier
17407 !!options
17408 parsoid
17409 !! wikitext
17410 <!--the newline at the end of this line moves out of the p-tag-->a
17411
17412 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17413 <ref />
17414
17415 c
17416 !! html
17417 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17418
17419
17420 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
17421 <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
17422
17423
17424 <p>c</p>
17425 !!end
17426
17427 !!test
17428 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17429 !!options
17430 parsoid
17431 !! wikitext
17432 <ref>foo</ref> A
17433 <ref>bar
17434 </ref> B
17435 !! html
17436 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> A
17437 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p>
17438 !!end
17439
17440 !!test
17441 Ref: 14. A nested ref-tag should be emitted as plain text
17442 !!options
17443 parsoid
17444 !! wikitext
17445 <ref>foo <ref>bar</ref> baz</ref>
17446
17447 <references />
17448 !! html
17449 <p><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo &lt;ref>bar&lt;/ref> baz&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span></p>
17450
17451 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17452 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
17453 </ol>
17454 !!end
17455
17456 !!test
17457 Ref: 15. ref-tags with identical names should get identical indexes
17458 !!options
17459 parsoid
17460 !! wikitext
17461 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17462 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17463
17464 <references />
17465 !! html
17466 <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
17467 B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
17468
17469 <ol about="#mwt10" class="references" typeof="mw:Extension/references" 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> foo</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> bar</li>
17470 </ol>
17471 !!end
17472
17473 ## We don't bother wt2wt-ing non-standard whitespace
17474 !!test
17475 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17476 !!options
17477 parsoid=wt2html
17478 !! wikitext
17479 A <ref >foo</ref >
17480
17481 <references />
17482 !! html
17483 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17484
17485 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17486 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17487 !!end
17488
17489 !!test
17490 References: 1. references tag without any refs should be handled properly
17491 !!options
17492 parsoid
17493 !! wikitext
17494 <references />
17495 !! html
17496 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17497 !!end
17498
17499 !!test
17500 References: 2. references tag with group only outputs references from that group
17501 !!options
17502 parsoid
17503 !! wikitext
17504 A <ref group="a">foo</ref>
17505 B <ref group="b">bar</ref>
17506
17507 <references group="a" />
17508 !! html
17509 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
17510 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[b 1]</a></span></p>
17511
17512 <ol about="#mwt6" class="references" typeof="mw:Extension/references" 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-0">↑</a></span> foo</li>
17513 </ol>
17514 !!end
17515
17516 !!test
17517 References: 3. ref list should be cleared after processing references
17518 !!options
17519 parsoid
17520 !! wikitext
17521 A <ref>foo</ref>
17522
17523 <references />
17524
17525 B <ref>bar</ref>
17526
17527 <references />
17528 !! html
17529 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17530
17531 <ol about="#mwt4" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
17532 </ol>
17533
17534 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[1]</a></span></p>
17535
17536 <ol about="#mwt8" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bar</li>
17537 </ol>
17538 !!end
17539
17540 !!test
17541 References: 4. only referenced group should be cleared after processing references
17542 !!options
17543 parsoid
17544 !! wikitext
17545 A <ref group="a">afoo</ref>
17546 B <ref>bfoo</ref>
17547
17548 <references group="a" />
17549
17550 C <ref>cfoo</ref>
17551
17552 <references />
17553 !! html
17554 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
17555 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>"}'><a href="#cite_note-2">[1]</a></span></p>
17556
17557 <ol about="#mwt6" class="references" typeof="mw:Extension/references" 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-0">↑</a></span> afoo</li>
17558 </ol>
17559
17560 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-3">[2]</a></span></p>
17561
17562 <ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3-0">↑</a></span> cfoo</li>
17563 </ol>
17564 !!end
17565
17566 !!test
17567 References: 5. ref tags in references should be processed while ignoring all other content
17568 !!options
17569 parsoid
17570 !! wikitext
17571 A <ref name="a" />
17572 B <ref name="b">bar</ref>
17573
17574 <references>
17575 <ref name="a">foo</ref>
17576 This should just get lost.
17577 </references>
17578 !! html
17579 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"a\" />"}'><a href="#cite_note-a-1">[1]</a></span>
17580 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\">bar&lt;/ref>"}'><a href="#cite_note-b-2">[2]</a></span></p>
17581
17582
17583 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references>\n&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.\n&lt;/references>"}' 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\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'>
17584 <li about="#cite_note-a-1" id="cite_note-a-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li>
17585 <li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li>
17586 </ol>
17587 !!end
17588
17589 !!test
17590 References: 6. <references /> from a transclusion
17591 !!options
17592 parsoid
17593 !! wikitext
17594 <ref>Foo</ref> {{echo|<references />}}
17595 !! html
17596 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> <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-0">↑</a></span> Foo</li></ol>
17597 !!end
17598
17599 !! test
17600 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17601 !! options
17602 parsoid
17603 !! wikitext
17604 A <ref>foo bar for a</ref>
17605 B <ref group="X" name="b" />
17606
17607 <references />
17608
17609 <references group="X">
17610 <ref name="b">foo</ref>
17611 </references>
17612 !! html
17613 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-2" data-parsoid="{}">[2]</a></span>
17614 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-3-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\" group=\"X\" />"}'><a href="#cite_note-b-3" data-parsoid="{}">[X 1]</a></span></p>
17615
17616 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}">↑</span> foo</li><li about="#cite_note-2" id="cite_note-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-2-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
17617
17618 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"&lt;references group=\"X\">\n&lt;ref name=\"b\">foo&lt;/ref>\n&lt;/references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-b-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-3" id="cite_note-b-3" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-3-0" data-parsoid="{}">↑</a></span> </li></ol>
17619 !! end
17620
17621 # This test is wt2html only because we're permitting the serializer to produce
17622 # dirty diffs, normalizing the unclosed references to the self-closed version.
17623 !! test
17624 Generate references for unclosed references tag
17625 !! options
17626 parsoid=wt2html
17627 !! wikitext
17628 a<ref>foo</ref>
17629
17630 <references>
17631 !! html
17632 <p data-parsoid='{}'>a<span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span></p>
17633
17634
17635 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17636 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo</li></ol>
17637 !! end
17638
17639 !! test
17640 New reference serializes on its own line
17641 !! options
17642 parsoid=wt2wt,html2wt
17643 !! wikitext
17644 foo
17645 <references />
17646 !! html
17647 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17648 !! end
17649
17650 #### ----------------------------------------------------------------
17651 #### The following section of tests are primarily to test
17652 #### wikitext escaping capabilities of Parsoid. Given that
17653 #### escaping can be done any number of ways, the wikitext (input)
17654 #### is always adjusted to reflect how Parsoid adds nowiki
17655 #### escape tags.
17656 ####
17657 #### We are marking several tests as parsoid-only since the
17658 #### HTML in the result section is different from what the
17659 #### PHP parser generates for it.
17660 #### ----------------------------------------------------------------
17661
17662
17663 #### --------------- Headings ---------------
17664 #### 0. Unnested
17665 #### 1. Nested inside html <h1>=foo=</h1>
17666 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17667 #### 3. Nested inside html with wikitext split by html tags
17668 #### 4. No escape needed
17669 #### 5. Empty headings <h1></h1>
17670 #### 6. Heading chars in SOL context
17671 #### ----------------------------------------
17672 !! test
17673 Headings: 0. Unnested
17674 !! options
17675 parsoid
17676 !! wikitext
17677 <nowiki>=foo=</nowiki>
17678
17679 <nowiki> =foo= </nowiki>
17680 <!--cmt-->
17681 <nowiki>=foo=</nowiki>
17682
17683 =foo''a''<nowiki>=</nowiki>
17684 !! html
17685 <p><span typeof="mw:Nowiki">=foo=</span></p>
17686
17687 <p><span typeof="mw:Nowiki"> =foo= </span>
17688 <!--cmt-->
17689 <span typeof="mw:Nowiki">=foo=</span></p>
17690
17691 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17692 !!end
17693
17694 !! test
17695 Headings: 1. Nested inside html
17696 (New headings and existing headings are handled differently)
17697 !! options
17698 parsoid=html2wt
17699 !! wikitext
17700 = =foo= =
17701
17702 == =foo= ==
17703
17704 === =foo= ===
17705
17706 =<nowiki>=foo=</nowiki>=
17707 ==<nowiki>=foo=</nowiki>==
17708 ===<nowiki>=foo=</nowiki>===
17709 ====<nowiki>=foo=</nowiki>====
17710 =====<nowiki>=foo=</nowiki>=====
17711 ======<nowiki>=foo=</nowiki>======
17712
17713 !! html
17714 <h1>=foo=</h1>
17715 <h2>=foo=</h2>
17716 <h3>=foo=</h3>
17717
17718 <h1 data-parsoid='{}'>=foo=</h1>
17719 <h2 data-parsoid='{}'>=foo=</h2>
17720 <h3 data-parsoid='{}'>=foo=</h3>
17721 <h4 data-parsoid='{}'>=foo=</h4>
17722 <h5 data-parsoid='{}'>=foo=</h5>
17723 <h6 data-parsoid='{}'>=foo=</h6>
17724 !!end
17725
17726 !! test
17727 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17728 !! options
17729 parsoid=html2wt
17730 !! wikitext
17731 = foo =
17732 <nowiki>*</nowiki>bar
17733
17734 = foo =
17735 =bar
17736
17737 = foo =
17738 <nowiki>=bar=</nowiki>
17739 !! html
17740 <h1>foo</h1>*bar
17741 <h1>foo</h1>=bar
17742 <h1>foo</h1>=bar=
17743 !!end
17744
17745 !! test
17746 Headings: 3. Nested inside html with wikitext split by html tags
17747 !! options
17748 parsoid=html2wt
17749 !! wikitext
17750 = ='''bold'''<nowiki>foo=</nowiki> =
17751 !! html
17752 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17753 !!end
17754
17755 !! test
17756 Headings: 4a. No escaping needed (testing just h1 and h2)
17757 !! options
17758 parsoid=html2wt
17759 !! wikitext
17760 = =foo =
17761
17762 = foo= =
17763
17764 = =foo= =
17765
17766 = =foo= bar =
17767
17768 == =foo ==
17769
17770 == foo= ==
17771
17772 = ''=''foo= =
17773
17774 = <nowiki>=</nowiki> =
17775 !! html
17776 <h1>=foo</h1>
17777 <h1>foo=</h1>
17778 <h1> =foo= </h1>
17779 <h1>=foo= bar</h1>
17780 <h2>=foo</h2>
17781 <h2>foo=</h2>
17782 <h1><i>=</i>foo=</h1>
17783 <h1><span typeof="mw:Nowiki">=</span></h1>
17784 !!end
17785
17786 !! test
17787 Headings: 4b. No escaping needed (inside p-tags)
17788 !! options
17789 parsoid=html2wt
17790 !! wikitext
17791 ===
17792 =foo= x
17793 =foo= <s></s>
17794 !! html
17795 <p>===
17796 =foo= x
17797 =foo= <s></s>
17798 </p>
17799 !!end
17800
17801 !! test
17802 Headings: 5. Empty headings
17803 !! options
17804 parsoid
17805 !! wikitext
17806 =<nowiki/>=
17807
17808 ==<nowiki/>==
17809
17810 ===<nowiki/>===
17811
17812 ====<nowiki/>====
17813
17814 =====<nowiki/>=====
17815
17816 ======<nowiki/>======
17817 !! html
17818 <h1></h1>
17819 <h2></h2>
17820 <h3></h3>
17821 <h4></h4>
17822 <h5></h5>
17823 <h6></h6>
17824 !!end
17825
17826 !! test
17827 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17828 !! options
17829 parsoid
17830 !! wikitext
17831 <nowiki>=a=</nowiki>
17832
17833 <nowiki>=a=</nowiki>
17834
17835 <nowiki>=a=</nowiki>
17836
17837 <nowiki>=a=</nowiki>
17838 !! html
17839 <p>=a=</p>
17840 <p>=a= </p>
17841 <p>=a= </p>
17842 <p>=a= </p>
17843 !!end
17844
17845 !! test
17846 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17847 !! options
17848 parsoid
17849 !! wikitext
17850 <nowiki>=a=
17851 b</nowiki>
17852
17853 <nowiki>=a=
17854 b</nowiki>
17855
17856 <nowiki>=a=
17857 b</nowiki>
17858
17859 <nowiki>=a=
17860 b</nowiki>
17861 !! html
17862 <p>=a=
17863 b</p>
17864 <p>=a=
17865 b</p>
17866 <p>=a=
17867 b</p>
17868 <p>=a=
17869 b</p>
17870 </p>
17871 !!end
17872
17873 !! test
17874 Headings: 6c. Heading chars in SOL context (leading newline break)
17875 !! options
17876 parsoid
17877 !! wikitext
17878 a
17879 <nowiki>=b=</nowiki>
17880 !! html
17881 <p>a
17882 =b=</p>
17883 !!end
17884
17885 !! test
17886 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17887 !! options
17888 parsoid
17889 !! wikitext
17890 <!--c0--><nowiki>=a=</nowiki>
17891
17892 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17893 !! html
17894 <p><!--c0-->=a=</p>
17895 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17896 !!end
17897
17898 !! test
17899 Headings: 6d. Heading chars in SOL context (No escaping needed)
17900 !! options
17901 parsoid=html2wt
17902 !! wikitext
17903 =a=<div>b</div>
17904 !! html
17905 =a=<div>b</div>
17906 !!end
17907
17908 #### --------------- Lists ---------------
17909 #### 0. Outside nests (*foo, etc.)
17910 #### 1. Nested inside html <ul><li>*foo</li></ul>
17911 #### 2. Inside definition lists
17912 #### 3. Only bullets at start should be escaped
17913 #### 4. No escapes needed
17914 #### 5. No unnecessary escapes
17915 #### 6. Escape bullets in SOL position
17916 #### 7. Escape bullets in a multi-line context
17917 #### ----------------------------------------
17918
17919 !! test
17920 Lists: 0. Outside nests
17921 !! wikitext
17922 <nowiki>*</nowiki>foo
17923
17924 <nowiki>#</nowiki>foo
17925 !! html
17926 <p>*foo
17927 </p><p>#foo
17928 </p>
17929 !!end
17930
17931 !! test
17932 Lists: 1. Nested inside html
17933 !! wikitext
17934 *<nowiki>*foo</nowiki>
17935
17936 *<nowiki>#foo</nowiki>
17937
17938 *<nowiki>:foo</nowiki>
17939
17940 *<nowiki>;foo</nowiki>
17941
17942 #<nowiki>*foo</nowiki>
17943
17944 #<nowiki>#foo</nowiki>
17945
17946 #<nowiki>:foo</nowiki>
17947
17948 #<nowiki>;foo</nowiki>
17949 !! html
17950 <ul>
17951 <li>*foo
17952 </li>
17953 </ul>
17954 <ul>
17955 <li>#foo
17956 </li>
17957 </ul>
17958 <ul>
17959 <li>:foo
17960 </li>
17961 </ul>
17962 <ul>
17963 <li>;foo
17964 </li>
17965 </ul>
17966 <ol>
17967 <li>*foo
17968 </li>
17969 </ol>
17970 <ol>
17971 <li>#foo
17972 </li>
17973 </ol>
17974 <ol>
17975 <li>:foo
17976 </li>
17977 </ol>
17978 <ol>
17979 <li>;foo
17980 </li>
17981 </ol>
17982
17983 !!end
17984
17985 !! test
17986 Lists: 2. Inside definition lists
17987 !! wikitext
17988 ;<nowiki>;foo</nowiki>
17989
17990 ;<nowiki>:foo</nowiki>
17991
17992 ;<nowiki>:foo</nowiki>
17993 :bar
17994
17995 :<nowiki>:foo</nowiki>
17996 !! html
17997 <dl>
17998 <dt>;foo
17999 </dt>
18000 </dl>
18001 <dl>
18002 <dt>:foo
18003 </dt>
18004 </dl>
18005 <dl>
18006 <dt>:foo
18007 </dt>
18008 <dd>bar
18009 </dd>
18010 </dl>
18011 <dl>
18012 <dd>:foo
18013 </dd>
18014 </dl>
18015
18016 !!end
18017
18018 !! test
18019 Lists: 3. Only bullets at start of text should be escaped
18020 !! wikitext
18021 *<nowiki>*foo*bar</nowiki>
18022
18023 *<nowiki>*foo</nowiki>''it''*bar
18024 !! html
18025 <ul>
18026 <li>*foo*bar
18027 </li>
18028 </ul>
18029 <ul>
18030 <li>*foo<i>it</i>*bar
18031 </li>
18032 </ul>
18033
18034 !!end
18035
18036 !! test
18037 Lists: 4. No escapes needed
18038 !! options
18039 parsoid
18040 !! wikitext
18041 *foo*bar
18042
18043 *''foo''*bar
18044
18045 *[[Foo]]: bar
18046
18047 *[[Foo]]*bar
18048 !! html
18049 <ul>
18050 <li>foo*bar
18051 </li>
18052 </ul>
18053 <ul>
18054 <li><i>foo</i>*bar
18055 </li>
18056 </ul>
18057 <ul>
18058 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18059 </li>
18060 </ul>
18061 <ul>
18062 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18063 </li>
18064 </ul>
18065 !!end
18066
18067 !! test
18068 Lists: 5. No unnecessary escapes
18069 !! wikitext
18070 * bar <span><nowiki>[[foo]]</nowiki></span>
18071
18072 *=bar <span><nowiki>[[foo]]</nowiki></span>
18073
18074 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18075
18076 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18077
18078 *=bar <span>foo]]</span>=
18079
18080 * <s></s>: a
18081 !! html
18082 <ul>
18083 <li> bar <span>[[foo]]</span>
18084 </li>
18085 </ul>
18086 <ul>
18087 <li>=bar <span>[[foo]]</span>
18088 </li>
18089 </ul>
18090 <ul>
18091 <li>[[bar <span>[[foo]]</span>
18092 </li>
18093 </ul>
18094 <ul>
18095 <li>]]bar <span>[[foo]]</span>
18096 </li>
18097 </ul>
18098 <ul>
18099 <li>=bar <span>foo]]</span>=
18100 </li>
18101 </ul>
18102 <ul>
18103 <li> <s></s>: a
18104 </li>
18105 </ul>
18106
18107 !!end
18108
18109 !! test
18110 Lists: 6. Escape bullets in SOL position
18111 !! options
18112 parsoid
18113 !! wikitext
18114 <!--cmt--><nowiki>*foo</nowiki>
18115 !! html
18116 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18117 !!end
18118
18119 !! test
18120 Lists: 7. Escape bullets in a multi-line context
18121 !! wikitext
18122 a
18123 <nowiki>*</nowiki>b
18124 !! html
18125 <p>a
18126 *b
18127 </p>
18128 !!end
18129
18130 #### --------------- HRs ---------------
18131 #### 1. Single line
18132 #### -----------------------------------
18133
18134 !! test
18135 HRs: 1. Single line
18136 !! options
18137 parsoid
18138 !! wikitext
18139 ----<nowiki>----</nowiki>
18140 ----=foo=
18141 ----*foo
18142 !! html
18143 <hr><span typeof="mw:Nowiki">----</span>
18144 <hr>=foo=
18145 <hr>*foo
18146 !! end
18147
18148 #### --------------- Tables ---------------
18149 #### 1a. Simple example
18150 #### 1b. No escaping needed (!foo)
18151 #### 1c. No escaping needed (|foo)
18152 #### 1d. No escaping needed (|}foo)
18153 ####
18154 #### 2a. Nested in td (<td>foo|bar</td>)
18155 #### 2b. Nested in td (<td>foo||bar</td>)
18156 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18157 ####
18158 #### 3a. Nested in th (<th>foo!bar</th>)
18159 #### 3b. Nested in th (<th>foo!!bar</th>)
18160 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18161 ####
18162 #### 4a. Escape -
18163 #### 4b. Escape +
18164 #### 4c. No escaping needed
18165 #### --------------------------------------
18166
18167 !! test
18168 Tables: 1a. Simple example
18169 !! wikitext
18170 <nowiki>{|
18171 |}</nowiki>
18172 !! html
18173 <p>{|
18174 |}
18175 </p>
18176 !! end
18177
18178 !! test
18179 Tables: 1b. No escaping needed
18180 !! wikitext
18181 !foo
18182 !! html
18183 <p>!foo
18184 </p>
18185 !! end
18186
18187 !! test
18188 Tables: 1c. No escaping needed
18189 !! wikitext
18190 |foo
18191 !! html
18192 <p>|foo
18193 </p>
18194 !! end
18195
18196 !! test
18197 Tables: 1d. No escaping needed
18198 !! wikitext
18199 |}foo
18200 !! html
18201 <p>|}foo
18202 </p>
18203 !! end
18204
18205 !! test
18206 Tables: 2a. Nested in td
18207 !! options
18208 parsoid=html2wt
18209 !! wikitext
18210 {|
18211 |<nowiki>foo|bar</nowiki>
18212 |-
18213 |x<div><nowiki>a|b</nowiki></div>
18214 |}
18215 !! html
18216 <table><tbody><tr>
18217 <td>foo|bar</td></tr>
18218 <tr><td>x<div>a|b</div></td>
18219 </tbody></table>
18220 !! end
18221
18222 !! test
18223 Tables: 2b. Nested in td
18224 !! options
18225 parsoid
18226 !! wikitext
18227 {|
18228 |<nowiki>foo||bar</nowiki>
18229 |''it''<nowiki>foo||bar</nowiki>
18230 |}
18231 !! html
18232 <table><tbody><tr>
18233 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18234 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18235 !! end
18236
18237 !! test
18238 Tables: 2c. Nested in td -- no escaping needed
18239 !! options
18240 parsoid
18241 !! wikitext
18242 {|
18243 |foo!!bar
18244 |}
18245 !! html
18246 <table><tbody><tr><td>foo!!bar
18247 </td></tr></tbody></table>
18248
18249 !! end
18250
18251 !! test
18252 Tables: 3a. Nested in th
18253 !! options
18254 parsoid
18255 !! wikitext
18256 {|
18257 !foo!bar
18258 |}
18259 !! html
18260 <table><tbody><tr><th>foo!bar
18261 </th></tr></tbody></table>
18262
18263 !! end
18264
18265 !! test
18266 Tables: 3b. Nested in th
18267 !! options
18268 parsoid
18269 !! wikitext
18270 {|
18271 !<nowiki>foo!!bar</nowiki>
18272 |}
18273 !! html
18274 <table>
18275 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18276 </tbody></table>
18277 !! end
18278
18279 !! test
18280 Tables: 3c. Nested in th -- no escaping needed
18281 !! options
18282 parsoid
18283 !! wikitext
18284 {|
18285 !<nowiki>foo||bar</nowiki>
18286 |}
18287 !! html
18288 <table><tbody><tr>
18289 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18290 !! end
18291
18292 !! test
18293 Tables: 4a. Escape -
18294 !! options
18295 parsoid
18296 !! wikitext
18297 {|
18298 !-bar
18299 |-
18300 |<nowiki>-bar</nowiki>
18301 |}
18302 !! html
18303 <table><tbody>
18304 <tr><th>-bar</th></tr>
18305 <tr>
18306 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18307 !! end
18308
18309 !! test
18310 Tables: 4b. Escape +
18311 !! options
18312 parsoid
18313 !! wikitext
18314 {|
18315 !+bar
18316 |-
18317 |<nowiki>+bar</nowiki>
18318 |}
18319 !! html
18320 <table><tbody>
18321 <tr><th>+bar</th></tr>
18322 <tr>
18323 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18324 !! end
18325
18326 !! test
18327 Tables: 4c. No escaping needed
18328 !! options
18329 parsoid
18330 !! wikitext
18331 {|
18332 |foo-bar
18333 |foo+bar
18334 |-
18335 |''foo''-bar
18336 |''foo''+bar
18337 |-
18338 |foo
18339 bar|baz
18340 +bar
18341 -bar
18342 |-
18343 |x
18344 <div>a|b</div>
18345 |}
18346 !! html
18347 <table><tbody>
18348 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18349 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18350 <tr><td>foo
18351 <p>bar|baz
18352 +bar
18353 -bar</p></td></tr>
18354 <tr><td>x
18355 <div>a|b</div></td>
18356 </tbody></table>
18357 !! end
18358
18359 !! test
18360 Tables: 4d. No escaping needed
18361 !! options
18362 parsoid
18363 !! wikitext
18364 {|
18365 |[[Foo]]-bar
18366 ||+1
18367 ||-2
18368 |}
18369 !! html
18370 <table>
18371 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18372 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18373 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18374 </tbody></table>
18375 !! end
18376
18377 !! test
18378 Tables: Digest broken attributes on table and tr tag
18379 !! options
18380 parsoid=wt2html
18381 !! wikitext
18382 {| || |} ++
18383 |- || || ++ --
18384 |- > [
18385 |}
18386 !! html
18387 <table>
18388 <tbody>
18389 <tr></tr>
18390 <tr></tr>
18391 </tbody></table>
18392 !! end
18393
18394 #### --------------- Links ----------------
18395 #### 1. Quote marks in link text
18396 #### 2. Wikilinks: Escapes needed
18397 #### 3. Wikilinks: No escapes needed
18398 #### 4. Extlinks: Escapes needed
18399 #### 5. Extlinks: No escapes needed
18400 #### --------------------------------------
18401 !! test
18402 Links 1. Quote marks in link text
18403 !! options
18404 parsoid
18405 !! wikitext
18406 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18407 !! html
18408 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18409 !! end
18410
18411 !! test
18412 Links 2. WikiLinks: Escapes needed
18413 !! options
18414 parsoid
18415 !! wikitext
18416 [[Foo|[Foobar]]]
18417 [[Foo|<nowiki>Foobar]</nowiki>]]
18418 [[Foo|x [Foobar] x]]
18419 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18420 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18421 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18422 [[Foo|<nowiki>|Bar</nowiki>]]
18423 [[Foo|<nowiki>]]bar</nowiki>]]
18424 [[Foo|<nowiki>[[bar</nowiki>]]
18425 [[Foo|<nowiki>x [[ y</nowiki>]]
18426 [[Foo|<nowiki>x ]] y</nowiki>]]
18427 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18428 !! html
18429 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18430 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18431 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18432 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18433 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18434 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18435 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18436 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18437 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18438 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18439 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18440 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18441 !! end
18442
18443 !! test
18444 Links 3. WikiLinks: No escapes needed
18445 !! options
18446 parsoid
18447 !! wikitext
18448 [[Foo|[Foobar]]
18449 [[Foo|foo|bar]]
18450 !! html
18451 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18452 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18453 !! end
18454
18455 !! test
18456 Links 4. ExtLinks: Escapes needed
18457 !! options
18458 parsoid
18459 !! wikitext
18460 [http://google.com <nowiki>[google]</nowiki>]
18461 [http://google.com <nowiki>google]</nowiki>]
18462
18463 <nowiki>[http://google.com]</nowiki>
18464
18465 <nowiki>[http://google.com google]</nowiki>
18466
18467 !! html
18468 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18469 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18470 <p>[http://google.com]</p>
18471 <p>[http://google.com google]</p>
18472 !! end
18473
18474 !! test
18475 Links 5. ExtLinks: No escapes needed
18476 !! options
18477 parsoid
18478 !! wikitext
18479 [http://google.com [google]
18480 !! html
18481 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18482 !! end
18483
18484 #### --------------- Quotes ---------------
18485 #### 1. Quotes inside <b> and <i>
18486 #### 2. Link fragments separated by <i> and <b> tags
18487 #### 3. Link fragments inside <i> and <b>
18488 #### 4. No escaping needed
18489 #### --------------------------------------
18490 !! test
18491 1. Quotes inside <b> and <i>
18492 !! options
18493 parsoid=html2wt,wt2wt
18494 !! wikitext
18495 ''<nowiki>'foo'</nowiki>''
18496 ''<nowiki>''foo''</nowiki>''
18497 ''<nowiki>'''foo'''</nowiki>''
18498 ''foo''<nowiki/>'s
18499 '''<nowiki>'foo'</nowiki>'''
18500 '''<nowiki>''foo''</nowiki>'''
18501 '''<nowiki>'''foo'''</nowiki>'''
18502 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18503 '''foo'''<nowiki/>'s
18504 '''foo''
18505 ''foo''<nowiki/>'
18506 '<nowiki/>''foo''<nowiki/>'
18507 ''''foo'''
18508 '''foo'''<nowiki/>'
18509 '<nowiki/>'''foo'''<nowiki/>'
18510 ''fools'<span> errand</span>''
18511 ''<span>fool</span>'s errand''
18512 !! html
18513 <p><i>'foo'</i>
18514 <i>''foo''</i>
18515 <i>'''foo'''</i>
18516 <i>foo</i>'s
18517 <b>'foo'</b>
18518 <b>''foo''</b>
18519 <b>'''foo'''</b>
18520 <b>foo'<i>bar'</i>baz</b>
18521 <b>foo</b>'s
18522 '<i>foo</i>
18523 <i>foo</i>'
18524 '<i>foo</i>'
18525 '<b>foo</b>
18526 <b>foo</b>'
18527 '<b>foo</b>'</p>
18528 <i>fools'<span> errand</span></i>
18529 <i><span>fool</span>'s errand</i>
18530 !! end
18531
18532 !! test
18533 2. Link fragments separated by <i> and <b> tags
18534 !! wikitext
18535 [[''foo''<nowiki>hello]]</nowiki>
18536
18537 [['''foo'''<nowiki>hello]]</nowiki>
18538 !! html
18539 <p>[[<i>foo</i>hello]]
18540 </p><p>[[<b>foo</b>hello]]
18541 </p>
18542 !! end
18543
18544 !! test
18545 3. Link fragments inside <i> and <b>
18546 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18547 this is one of the shortcomings of this format)
18548 !! wikitext
18549 ''[[foo''<nowiki>]]</nowiki>
18550
18551 '''[[foo'''<nowiki>]]</nowiki>
18552 !! html
18553 <p><i>[[foo</i>]]
18554 </p><p><b>[[foo</b>]]
18555 </p>
18556 !! end
18557
18558 !! test
18559 4. No escaping needed
18560 !! wikitext
18561 '<span>''bar''</span>'
18562 '<span>'''bar'''</span>'
18563 !! html
18564 <p>'<span><i>bar</i></span>'
18565 '<span><b>bar</b></span>'
18566 </p>
18567 !! end
18568
18569 #### ----------- Paragraphs ---------------
18570 #### 1. No unnecessary escapes
18571 #### --------------------------------------
18572
18573 !! test
18574 1. No unnecessary escapes
18575 !! wikitext
18576 bar <span><nowiki>[[foo]]</nowiki></span>
18577
18578 =bar <span><nowiki>[[foo]]</nowiki></span>
18579
18580 [[bar <span><nowiki>[[foo]]</nowiki></span>
18581
18582 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18583
18584 =bar <span>foo]]</span><nowiki>=</nowiki>
18585 !! html
18586 <p>bar <span>[[foo]]</span>
18587 </p><p>=bar <span>[[foo]]</span>
18588 </p><p>[[bar <span>[[foo]]</span>
18589 </p><p>]]bar <span>[[foo]]</span>
18590 </p><p>=bar <span>foo]]</span>=
18591 </p>
18592 !!end
18593
18594 #### ----------------------- PRE --------------------------
18595 #### 1. Leading whitespace in SOL context should be escaped
18596 #### ------------------------------------------------------
18597 !! test
18598 1. Leading whitespace in SOL context should be escaped
18599 !! options
18600 parsoid
18601 !! wikitext
18602 <nowiki> </nowiki>a
18603
18604 <nowiki> </nowiki> a
18605
18606 <nowiki> </nowiki>a(tab)
18607
18608 <nowiki> </nowiki> a
18609 <!--cmt-->
18610 <nowiki> </nowiki> a
18611
18612 a
18613 <nowiki> </nowiki>b
18614
18615 a
18616 <nowiki> </nowiki>b
18617
18618 a
18619 <nowiki> </nowiki> b
18620 !! html
18621 <p> a</p>
18622 <p> a</p>
18623 <p> a(tab)</p>
18624 <p> a</p>
18625 <p><!--cmt--> a</p>
18626 <p>a
18627 b</p>
18628 <p>a
18629 b</p>
18630 <p>a
18631 b</p>
18632 !! end
18633
18634 #### --------------- Behavior Switches --------------------
18635 !! test
18636 1. Valid behavior switches should be escaped
18637 !! options
18638 parsoid=html2wt
18639 !! wikitext
18640 <nowiki>__TOC__</nowiki>
18641 !! html
18642 __TOC__
18643 !! end
18644
18645 !! test
18646 2. Invalid behavior switches should not be escaped
18647 !! options
18648 parsoid=html2wt
18649 !! wikitext
18650 __TOO__
18651 __|__
18652 !! html
18653 __TOO__
18654 __|__
18655 !! end
18656
18657 #### --------------- HTML tags ---------------
18658 #### 1. a tags
18659 #### 2. other tags
18660 #### 3. multi-line html tag
18661 #### 4. extension tags
18662 #### -----------------------------------------
18663 !! test
18664 1. a tags
18665 !! options
18666 parsoid
18667 !! wikitext
18668 <a href="http://google.com">google</a>
18669 !! html
18670 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18671 !! end
18672
18673 !! test
18674 2. other tags
18675 !! wikitext
18676 <nowiki><div>foo</div>
18677 <div style="color:red">foo</div></nowiki>
18678 !! html
18679 <p>&lt;div&gt;foo&lt;/div&gt;
18680 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18681 </p>
18682 !! end
18683
18684 !! test
18685 3. multi-line html tag
18686 !! wikitext
18687 <nowiki><div
18688 >foo</div
18689 ></nowiki>
18690 !! html
18691 <p>&lt;div
18692 &gt;foo&lt;/div
18693 &gt;
18694 </p>
18695 !! end
18696
18697 !! test
18698 4. extension tags
18699 !! wikitext
18700 <nowiki><ref>foo</ref></nowiki>
18701
18702 <nowiki><ref>bar</nowiki>
18703
18704 baz<nowiki></ref></nowiki>
18705 !! html
18706 <p>&lt;ref&gt;foo&lt;/ref&gt;
18707 </p><p>&lt;ref&gt;bar
18708 </p><p>baz&lt;/ref&gt;
18709 </p>
18710 !! end
18711
18712 #### --------------- Others ---------------
18713 !! test
18714 Escaping nowikis
18715 !! wikitext
18716 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18717 !! html
18718 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18719 </p>
18720 !! end
18721
18722 ## The quote-char in the input is necessary for triggering the bug
18723 !! test
18724 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18725 !! options
18726 parsoid=wt2wt,html2wt
18727 !! wikitext
18728 foo's bar :
18729 !! html
18730 <p>foo's bar :</p>
18731 !! end
18732
18733 !! test
18734
18735 Tag-like HTML structures are passed through as text
18736 !! wikitext
18737 <x y>
18738
18739 <x.y>
18740
18741 <x-y>
18742
18743 1>2
18744
18745 x<y
18746
18747 a>b
18748
18749 1<d e>f
18750 !! html
18751 <p>&lt;x y&gt;
18752 </p><p>&lt;x.y&gt;
18753 </p><p>&lt;x-y&gt;
18754 </p><p>1&gt;2
18755 </p><p>x&lt;y
18756 </p><p>a&gt;b
18757 </p><p>1&lt;d e&gt;f
18758 </p>
18759 !! end
18760
18761
18762 # This was a bug in the PHP parser (see bug 17663 and its dups,
18763 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18764 !! test
18765 Tag names followed by punctuation should not be recognized as tags
18766 !! wikitext
18767 <s.ome> text
18768 !! html
18769 <p>&lt;s.ome&gt; text
18770 </p>
18771 !! end
18772
18773 !! test
18774 HTML tag with necessary entities in attributes
18775 !! wikitext
18776 <span title="&amp;amp;">foo</span>
18777 !! html
18778 <p><span title="&amp;amp;">foo</span>
18779 </p>
18780 !! end
18781
18782 !! test
18783 HTML tag with 'unnecessary' entity encoding in attributes
18784 !! wikitext
18785 <span title="&amp;">foo</span>
18786 !! html
18787 <p><span title="&amp;">foo</span>
18788 </p>
18789 !! end
18790
18791 !! test
18792 HTML tag with broken attribute value quoting
18793 !! wikitext
18794 <span title="Hello world>Foo</span>
18795 !! html
18796 <p><span>Foo</span>
18797 </p>
18798 !! end
18799
18800 !! test
18801 Parsoid-only: HTML tag with broken attribute value quoting
18802 !! options
18803 parsoid
18804 !! wikitext
18805 <span title="Hello world>Foo</span>
18806 !! html
18807 <p><span title="Hello world">Foo</span>
18808 </p>
18809 !! end
18810
18811 !! test
18812 Table with broken attribute value quoting
18813 !! wikitext
18814 {|
18815 | title="Hello world|Foo
18816 |}
18817 !! html
18818 <table>
18819 <tr>
18820 <td>Foo
18821 </td></tr></table>
18822
18823 !! end
18824
18825 !! test
18826 Table with broken attribute value quoting on consecutive lines
18827 !! wikitext
18828 {|
18829 | title="Hello world|Foo
18830 | style="color:red|Bar
18831 |}
18832 !! html
18833 <table>
18834 <tr>
18835 <td>Foo
18836 </td>
18837 <td>Bar
18838 </td></tr></table>
18839
18840 !! end
18841
18842 !! test
18843 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18844 !! options
18845 parsoid
18846 !! wikitext
18847 {|
18848 | title="Hello world|Foo
18849 | style="color:red|Bar
18850 |}
18851 !! html
18852 <table><tbody>
18853 <tr>
18854 <td title="Hello world">Foo
18855 </td><td style="color: red">Bar
18856 </td></tr></tbody></table>
18857
18858 !! end
18859
18860 !! test
18861 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18862 !! options
18863 parsoid
18864 !! wikitext
18865 {{}}
18866 !! html
18867 {{}}
18868 !! end
18869
18870 !! test
18871 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18872 !! options
18873 parsoid
18874 !! wikitext
18875 }}{{
18876 !! html
18877 }}{{
18878 !! end
18879
18880 !!test
18881 Accept empty td cell attribute
18882 !! wikitext
18883 {|
18884 | align="center" | foo || |
18885 |}
18886 !! html
18887 <table>
18888 <tr>
18889 <td align="center"> foo </td>
18890 <td>
18891 </td></tr></table>
18892
18893 !!end
18894
18895 !!test
18896 Non-empty attributes in th-cells
18897 !! wikitext
18898 {|
18899 ! Foo !! style="color: red" | Bar
18900 |}
18901 !! html
18902 <table>
18903 <tr>
18904 <th> Foo </th>
18905 <th style="color: red"> Bar
18906 </th></tr></table>
18907
18908 !!end
18909
18910 !!test
18911 Accept empty attributes in th-cells
18912 !! wikitext
18913 {|
18914 !| foo !!| bar
18915 |}
18916 !! html
18917 <table>
18918 <tr>
18919 <th> foo </th>
18920 <th> bar
18921 </th></tr></table>
18922
18923 !!end
18924
18925 !!test
18926 Empty table rows go away
18927 !! wikitext
18928 {|
18929 | Hello
18930 | there
18931 |- class="foo"
18932 |-
18933 |}
18934 !! html
18935 <table>
18936 <tr>
18937 <td> Hello
18938 </td>
18939 <td> there
18940 </td></tr>
18941
18942 </table>
18943
18944 !! end
18945
18946 ###
18947 ### Parsoid-centric tests for testing RTing of inter-element separators
18948 ### Edge cases not tested by existing parser tests and specific to
18949 ### Parsoid-specific serialization strategies.
18950 ###
18951
18952 !!test
18953 RT-ed inter-element separators should be valid separators
18954 !! wikitext
18955 {|
18956 |- [[foo]]
18957 |}
18958 !! html
18959 <table>
18960
18961 </table>
18962
18963 !!end
18964
18965 !!test
18966 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
18967 (Parsoid-only since PHP parser relies on Tidy for correct output)
18968 !!options
18969 parsoid
18970 !! wikitext
18971 {|
18972 |<small>foo
18973 bar
18974 |}
18975
18976 {|
18977 |<small>foo<small>
18978 |}
18979 !! html
18980 !!end
18981
18982 !!test
18983 Empty TD followed by TD with tpl-generated attribute
18984 !! wikitext
18985 {|
18986 |-
18987 |
18988 |{{echo|style='color:red'}}|foo
18989 |}
18990 !! html
18991 <table>
18992
18993 <tr>
18994 <td>
18995 </td>
18996 <td>foo
18997 </td></tr></table>
18998
18999 !!end
19000
19001 !!test
19002 Indented table with an empty td
19003 !! wikitext
19004 {|
19005 |-
19006 |
19007 |foo
19008 |}
19009 !! html
19010 <table>
19011
19012 <tr>
19013 <td>
19014 </td>
19015 <td>foo
19016 </td></tr></table>
19017
19018 !!end
19019
19020 !!test
19021 Empty TR followed by a template-generated TR
19022 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19023 !!options
19024 parsoid
19025 !! wikitext
19026 {|
19027 |-
19028 {{echo|<tr><td>foo</td></tr>}}
19029 |}
19030 !! html
19031 <table>
19032 <tbody>
19033 <tr></tr>
19034 <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}}]}'>
19035 <td>foo</td></tr>
19036 </tbody></table>
19037 !!end
19038
19039 ## PHP and parsoid output differ for this, and since this is primarily
19040 ## for testing Parsoid's serializer, marking this Parsoid only
19041 !!test
19042 Empty TR followed by mixed-ws-comment line should RT correctly
19043 !!options
19044 parsoid
19045 !! wikitext
19046 {|
19047 |-
19048 <!--c-->
19049 |-
19050 <!--c--> <!--d-->
19051 |}
19052 !! html
19053 <table>
19054 <tbody>
19055 <tr></tr>
19056 <!--c-->
19057 <tr>
19058 <!--c--> </tr><!--d-->
19059 </tbody></table>
19060
19061 !!end
19062
19063 !!test
19064 Multi-line image caption generated by templates with/without trailing newlines
19065 !!options
19066 parsoid
19067 !! wikitext
19068 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19069 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19070 !! html
19071 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
19072 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
19073
19074 !!end
19075
19076 ## PHP emits broken html for this, and since this is primarily
19077 ## a Parsoid serializer test, marking this Parsoid only
19078 !!test
19079 Improperly nested inline or quotes tags with whitespace in between
19080 !!options
19081 parsoid
19082 !! wikitext
19083 <span> <s>x</span> </s>
19084 ''' ''x''' ''
19085 !! html
19086 <p><span> <s>x</s></span><s> </s>
19087 <b> <i>x</i></b><i> </i>
19088 </p>
19089 !!end
19090
19091 !!test
19092 Encapsulate protected attributes from wt
19093 !!options
19094 parsoid
19095 !! wikitext
19096 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19097 !! html
19098 <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>
19099 </body>
19100 !!end
19101
19102 ## Currently the p-wrapper is fragile in how adds / removes transformations.
19103 ## Having nested or stray pre tags results in the attempt to add duplicates,
19104 ## causing an assertion fail. This test tries to prevent that situation.
19105 !!test
19106 Ensure ParagraphWrapper can deal with stray closing pre tags
19107 !!options
19108 parsoid=wt2html
19109 !! wikitext
19110 plain text</pre>
19111 !! html
19112 plain text
19113 !!end
19114
19115 !!test
19116 1. Ensure fostered text content is wrapped in spans
19117 !!options
19118 parsoid=wt2html
19119 !! wikitext
19120 <table>hi</table><table>ho</table>
19121 !! html
19122 <span>hi</span>
19123 <table></table>
19124 <span>ho</span>
19125 <table></table>
19126 !!end
19127
19128 !!test
19129 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19130 !!options
19131 parsoid=wt2html,wt2wt
19132 !! wikitext
19133 <table>
19134 <tr> || ||
19135 <td> a
19136 </table>
19137 !! html
19138 <span> || ||</span>
19139 <table>
19140 <tbody>
19141 <tr>
19142 <td> a</td></tr>
19143 </tbody></table>
19144 !!end
19145
19146 !!test
19147 Encapsulation properly handles null DSR information from foster box
19148 !!options
19149 parsoid=wt2html,wt2wt
19150 !! wikitext
19151 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19152 !! html
19153 <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;
19154 <table>foo
19155 <tr>
19156 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19157 <table>
19158 <tbody>
19159 <tr>
19160 <td>bar</td></tr></tbody></table>
19161 !!end
19162
19163 !!test
19164 1. Encapsulate foster-parented transclusion content
19165 !!options
19166 parsoid=wt2wt,wt2html
19167 !! wikitext
19168 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19169 !! html
19170 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19171 <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
19172 <tr>
19173 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19174 <table>
19175 <tbody>
19176 <tr>
19177 <td>bar</td></tr></tbody></table>
19178 !!end
19179
19180 !!test
19181 2. Encapsulate foster-parented transclusion content
19182 !!options
19183 parsoid=wt2wt,wt2html
19184 !! wikitext
19185 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19186 !! html
19187 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19188 <table>
19189 <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>
19190 <tr>
19191 <td>bar</td></tr></table>&quot;]}">foo</div>
19192 <table>
19193 <tbody>
19194 <tr>
19195 <td>bar</td></tr></tbody></table>
19196 !!end
19197
19198 !!test
19199 3. Encapsulate foster-parented transclusion content
19200 !!options
19201 parsoid=wt2wt,wt2html
19202 !! wikitext
19203 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19204 !! html
19205 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19206 <table>
19207 <div>
19208 <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>
19209 <tr>
19210 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19211 <p>foo</p></div>
19212 <table>
19213 <tbody>
19214 <tr>
19215 <td>bar</td></tr></tbody></table>
19216 !!end
19217
19218 !!test
19219 4. Encapsulate foster-parented transclusion content
19220 !!options
19221 parsoid=wt2wt,wt2html
19222 !! wikitext
19223 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19224 !! html
19225 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19226 <table>
19227 <div>
19228 <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>
19229 <tr>
19230 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19231 <p>foo</p></div>
19232 <table>
19233 <tbody>
19234 <tr>
19235 <td>bar</td></tr></tbody></table>
19236 !!end
19237
19238 !!test
19239 5. Encapsulate foster-parented transclusion content
19240 !!options
19241 parsoid=wt2wt,wt2html
19242 !! wikitext
19243 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19244 !! html
19245 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19246 <table>
19247 <tr>
19248 <td>
19249 <div>
19250 <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</span>
19251 <table>
19252 <tbody>
19253 <tr>
19254 <td>
19255 <div>
19256 <p>foo</p></div></td></tr></tbody></table>
19257 !!end
19258
19259 !!test
19260 6. Encapsulate foster-parented transclusion content
19261 !!options
19262 parsoid=wt2wt,wt2html
19263 !! wikitext
19264 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19265 !! html
19266 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19267 <table>
19268 <tr>
19269 <td>
19270 <div>
19271 <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</span>
19272 <table>
19273 <tbody>
19274 <tr>
19275 <td>
19276 <div>
19277 <p>foo</p></div></td></tr></tbody></table>
19278 <p>ok</p>
19279 !!end
19280
19281 !!test
19282 7. Encapsulate foster-parented transclusion content
19283 !!options
19284 parsoid=wt2wt,wt2html
19285 !! wikitext
19286 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19287 !! html
19288 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19289 <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;
19290 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19291 <td>bar</td></table>&quot;]}">foo</p>
19292 <table>
19293 <tbody>
19294 <tr>
19295 <td>bar</td></tr></tbody></table>
19296 !!end
19297
19298 !!test
19299 8. Encapsulate foster-parented transclusion content
19300 !!options
19301 parsoid=wt2wt,wt2html
19302 !! wikitext
19303 {{echo|a
19304 }}{|{{echo|style='color:red'}}
19305 |-
19306 |b
19307 |}
19308 !! html
19309 <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><span 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}}}</span>
19310 <table>
19311 <tbody>
19312 <tr>
19313 <td>b</td></tr></tbody></table>
19314 !!end
19315
19316 !!test
19317 Table in fosterable position
19318 !!options
19319 parsoid=wt2html,wt2wt
19320 !! wikitext
19321 {{OpenTable}}
19322 <div>
19323 {|
19324 |}
19325 </div>
19326 |}
19327 !! html
19328 <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" data-parsoid="{}">
19329 </span>
19330 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19331
19332 <table>
19333 </table>
19334 !!end
19335
19336 !!test
19337 Support <object> element with .data attribute
19338 !!options
19339 parsoid=html2wt
19340 !! wikitext
19341 <object data="test.swf"></object>
19342 !! html
19343 <object data="test.swf"></object>
19344 !!end
19345
19346 # -----------------------------------------------------------------
19347 # The following section of tests are primarily to spec requirements
19348 # around serialization of new/edited content.
19349 #
19350 # All these tests are marked Parsoid html2wt and html2html only
19351 # ----------------------------------------------------------------
19352
19353 !! test
19354 Image: Modifying size of an image (1)
19355 !! options
19356 parsoid=html2wt
19357 !! wikitext
19358 [[Image:Foobar.jpg|200x200px]]
19359 !! html
19360 <p><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"230x230px"}]}'><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/230px-Foobar.jpg" height="22" width="200" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"26","width":"230"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
19361 !!end
19362
19363 !! test
19364 Image: Modifying size of an image (2)
19365 !! options
19366 parsoid=html2wt
19367 !! wikitext
19368 [[Image:Foobar.jpg|500x500px]]
19369 !! html
19370 <p><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"230x230px"}]}'><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/230px-Foobar.jpg" height="100" width="500" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"26","width":"230"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
19371 !!end
19372
19373 # note that the data-parsoid value conflicts with the figure's class
19374 !! test
19375 Image: Modifying alignment of an image (bug 48665)
19376 !! options
19377 parsoid=html2wt
19378 !! wikitext
19379 [[Image:Foobar.jpg|thumb|caption|left]]
19380 !! html
19381 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"caption"},{"ck":"right","ak":"right"}]}'><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="20" width="180" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"20","width":"180"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
19382 !! end
19383
19384 !! test
19385 Image: Modifying valign of an image (bug 49221)
19386 !! options
19387 parsoid=html2wt
19388 !! wikitext
19389 [[File:Foobar.jpg|20px|text-top]]
19390 !! html
19391 <p><span class="mw-valign-text-top" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"20px"},{"ck":"text_top","ak":"text-top"}]}'><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/20px-Foobar.jpg" height="2" width="20" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"2","width":"20"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
19392 !! end
19393
19394 !! test
19395 Image: Modifying alt attribute of an image (bug 56400)
19396 !! options
19397 parsoid=html2wt
19398 !! wikitext
19399 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19400 !! html
19401 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"some caption"},{"ck":"alt","ak":"alt=some alternate text"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="some alternate edited text" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="20" width="180" data-parsoid='{"a":{"alt":"some alternate edited text","resource":"./File:Foobar.jpg","height":"20","width":"180"},"sa":{"alt":"alt=some alternate edited text","resource":"File:Foobar.jpg"}}'/></a><figcaption>some caption</figcaption></figure>
19402 !!end
19403
19404 !! test
19405 Image: Modifying caption of an image
19406 !! options
19407 parsoid=html2wt
19408 !! wikitext
19409 [[Image:Foobar.jpg|thumb|new caption]]
19410 !! html
19411 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"original 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/180px-Foobar.jpg" height="20" width="180" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"20","width":"180"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a><figcaption>new caption</figcaption></figure>
19412 !!end
19413
19414 !! test
19415 Image: empty alt attribute (bug 48924)
19416 !! options
19417 parsoid
19418 !! wikitext
19419 [[File:Foobar.jpg|thumb|alt=|bar]]
19420 !! html
19421 <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>
19422 !! end
19423
19424 #!! test
19425 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19426 #!! options
19427 #parsoid=html2wt
19428 #language=ar
19429 #!! input
19430 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19431 #!! result
19432 #<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>
19433 #!! end
19434
19435 !! test
19436 Image: Block level image should have \n before and after
19437 !! options
19438 parsoid
19439 !! wikitext
19440 123
19441 [[File:Foobar.jpg|right|thumb|150x150px]]
19442 456
19443 !! html
19444 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Foobar.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Foobar.png/131px-Foobar.png" width="131" height="150" resource="./File:Foobar.png" data-parsoid='{"a":{"resource":"./File:Foobar.png","width":"131"},"sa":{"resource":"File:Foobar.png","width":"150"}}'></a></figure><p>456</p>
19445 !!end
19446
19447 !! test
19448 Image: New block level image should have \n before and after (existing
19449 content)
19450 !! options
19451 parsoid
19452 !! wikitext
19453 123
19454 [[File:Foobar.jpg|right|thumb|150x150px]]
19455 456
19456 !! html
19457 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19458 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}],"dsr":[4,45,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[6,43,null,null]}'><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>
19459 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19460 !!end
19461
19462 !! test
19463 Images: upright option (parsoid)
19464 !! options
19465 parsoid
19466 !! wikitext
19467 [[File:Foobar.jpg|thumb|upright|caption]]
19468 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19469 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19470 !! html
19471 <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><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><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>
19472 !!end
19473
19474 !! test
19475 Images: upright option is ignored on inline and frame images (parsoid)
19476 !! options
19477 parsoid
19478 !! wikitext
19479 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19480 !! html
19481 <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>
19482 !!end
19483
19484 !! test
19485 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19486 !! options
19487 parsoid=html2wt
19488 !! wikitext
19489 * foo
19490 !! html
19491 <ul>
19492 <li><p>foo</p></li>
19493 </ul>
19494 !! end
19495
19496 !! test
19497 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19498 !! options
19499 parsoid=html2wt
19500 !! wikitext
19501 * foo
19502 !! html
19503 <ul> <li>foo</li></ul>
19504 !! end
19505
19506 !! test
19507 Don't strip leading whitespace when handling indent-pre suppressing tags
19508 !! options
19509 parsoid=html2wt
19510 !! wikitext
19511 {|
19512 | indented row
19513 |}
19514 <blockquote>
19515 '''This is very bold of you!'''
19516
19517 {|
19518 |
19519 indented cell (no pre-wrapping!)
19520 |}
19521 </blockquote>
19522 foo
19523 <div>bar</div>
19524 !! html
19525 <table>
19526 <tr><td> indented row</td></tr>
19527 </table>
19528 <blockquote><p>
19529 <b>This is very bold of you!</b>
19530 </p>
19531 <table><tr><td>
19532 indented cell (no pre-wrapping!)
19533 </td></tr></table>
19534 </blockquote>
19535 <p>foo</p>
19536 <div>bar</div>
19537 !! end
19538
19539 !! test
19540 Strip leading whitespace when handling indent-pre inducing tags
19541 !! options
19542 parsoid=html2wt
19543 !! wikitext
19544 foo
19545 <span>bar</span>
19546
19547 <span>foo2
19548 </span>bar2
19549
19550 <div>foo</div>
19551 <span>bar</span>
19552
19553 <div>
19554 <span>foo</span>
19555 </div>
19556 !! html
19557 <p>foo</p>
19558 <span>bar</span>
19559
19560 <span>foo2
19561 </span>bar2
19562
19563 <div>foo</div>
19564 <span>bar</span>
19565
19566 <div>
19567 <span>foo</span>
19568 </div>
19569 !! end
19570
19571 !! test
19572 Lists: Add space after bullets
19573 !! options
19574 parsoid=html2wt
19575 !! wikitext
19576 * foo
19577 * bar
19578 * <span> baz</span>
19579 !! html
19580 <ul>
19581 <li>foo</li>
19582 <li> bar</li>
19583 <li><span> baz</span></li>
19584 </ul>
19585 !! end
19586
19587 !! test
19588 Lists: Dont insert newlines in a serialized list item.
19589 !! options
19590 parsoid=html2wt
19591 !! wikitext
19592 * a<br>b
19593 * c
19594 !! html
19595 <ul><li>a<br>b</li><li>c</li></ul>
19596 !! end
19597
19598 !! test
19599 Headings: Add space before/after == (Bug 51744)
19600 !! options
19601 parsoid=html2wt
19602 !! wikitext
19603 == foo ==
19604
19605 == bar ==
19606
19607 == baz ==
19608
19609 == <span> baz</span> ==
19610 !! html
19611 <h2>foo</h2>
19612 <h2> bar</h2>
19613 <h2>baz </h2>
19614 <h2><span> baz</span></h2>
19615 !! end
19616
19617 !! test
19618 Parsoid: Serialize positional parameters with = in them as named parameter
19619 !! options
19620 parsoid=html2wt
19621 !! wikitext
19622 {{echo|1 = f=oo}}
19623
19624 {{echo|1 = f=oo|2 = bar}}
19625
19626 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19627 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19628 {{echo|<nowiki>f=oo</nowiki>|bar}}
19629 !! html
19630 <p about="#mwt1" typeof="mw:Transclusion"
19631 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19632
19633 <p about="#mwt1" typeof="mw:Transclusion"
19634 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19635
19636 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19637 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19638 <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>
19639 !! end
19640
19641 !! test
19642 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19643 !! options
19644 parsoid=html2wt
19645 !! wikitext
19646 <div>a
19647 b
19648 </div>
19649 <div>a
19650 b
19651 </div>
19652 <div>
19653 a
19654
19655 b
19656 </div>
19657 !! html
19658 <div>a<p>b</p></div>
19659 <div>a
19660 <p>b</p></div>
19661 <div>
19662 a
19663 <p>b</p></div>
19664 !! end
19665
19666 #-----------------------------
19667 # I/B quote minimization tests
19668 #-----------------------------
19669
19670 !! test
19671 1. I/B quote minimization: wikitext-only tags should be combined
19672 !! options
19673 parsoid=html2wt
19674 !! wikitext
19675 ''AB''
19676
19677 '''AB'''
19678
19679 ''A'''B'''''
19680
19681 '''A''B'''''
19682
19683 '''A''BC''D'''
19684
19685 '''''AB'''''
19686
19687 '''''AB'''''
19688
19689 '''''AB'''''
19690 !! html
19691 <p><i>A</i><i>B</i></p>
19692 <p><b>A</b><b>B</b></p>
19693 <p><i>A</i><b><i>B</i></b></p>
19694 <p><b>A</b><i><b>B</b></i></p>
19695 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19696 <p><i><b>A</b></i><i><b>B</b></i></p>
19697 <p><i><b>A</b></i><b><i>B</i></b></p>
19698 <p><b><i>A</i></b><i><b>B</b></i></p>
19699 !! end
19700
19701 !! test
19702 2. I/B quote minimization: wikitext and html tags should not be combined
19703 !! options
19704 parsoid=html2wt
19705 !! wikitext
19706 ''A''<i>B</i>
19707
19708 ''A'''''<i>B</i>'''
19709 !! html
19710 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19711 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19712 !! end
19713
19714 !! test
19715 3. I/B quote minimization: templated content stops minimization
19716 !! options
19717 parsoid=html2wt
19718 !! wikitext
19719 ''A''{{echo|''B''}}
19720
19721 ''A''{{echo|'''''B'''''}}
19722 !! html
19723 <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>
19724 <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>
19725 !! end
19726
19727 !! test
19728 4. I/B quote minimization: new content should be mimimized with adjacent old content
19729 !! options
19730 parsoid=html2wt
19731 !! wikitext
19732 ''AB''
19733
19734 '''AB'''
19735
19736 ''A'''B'''''
19737 !! html
19738 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19739 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19740 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19741 !! end
19742
19743 #------------------------------------
19744 # End of I/B quote minimization tests
19745 #------------------------------------
19746
19747 !!test
19748 Bug 54262: New entities
19749 !! options
19750 parsoid=html2wt
19751 !! wikitext
19752 foo
19753 !! html
19754 <span typeof="mw:Entity">foo</span>
19755 !! end
19756
19757 ## Note that there is no wikitext output for 'unknownproperty' ##
19758 ## Unknown magic words are silently dropped ##
19759
19760 !! test
19761 Magic words
19762 !! options
19763 parsoid=html2wt
19764 !! wikitext
19765 __TOC__
19766 __NOTOC__
19767 __FORCETOC__
19768 __INDEX__
19769 __NOINDEX__
19770 __NOGALLERY__
19771 __NOEDITSECTION__
19772 __NOTITLECONVERT__
19773 __NOCONTENTCONVERT__
19774 !! html
19775 <meta property='mw:PageProp/toc' />
19776 <meta property='mw:PageProp/notoc' />
19777 <meta property='mw:PageProp/forcetoc' />
19778 <meta property='mw:PageProp/index' />
19779 <meta property='mw:PageProp/noindex' />
19780 <meta property='mw:PageProp/nogallery' />
19781 <meta property='mw:PageProp/noeditsection' />
19782 <meta property='mw:PageProp/notitleconvert' />
19783 <meta property='mw:PageProp/nocontentconvert' />
19784 <meta property='mw:PageProp/unknownproperty' />
19785 !! end
19786
19787 !! test
19788 Consecutive <pre>s should not get merged
19789 !! options
19790 parsoid=html2wt,html2html
19791 !! wikitext
19792 a
19793
19794 b
19795
19796 c
19797
19798 d
19799
19800 e
19801
19802
19803
19804 f
19805 !! html
19806 <pre>a</pre><pre>b</pre>
19807
19808 <pre>c
19809 </pre><pre>
19810 d</pre>
19811
19812 <pre>e
19813
19814 </pre><pre>
19815
19816 f</pre>
19817 !! end
19818
19819 !! test
19820 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
19821 !! options
19822 parsoid=html2wt
19823 !! wikitext
19824 [[Special:BookSources/1234567890|ISBN 1234567895]]
19825 !! html
19826 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
19827 !! end
19828
19829 !! test
19830 Edited RFC links not serializable as RFC links should serialize as extlinks
19831 !! options
19832 parsoid=html2wt
19833 !! wikitext
19834 [//tools.ietf.org/html/rfc123 New RFC]
19835 !! html
19836 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
19837 !! end
19838
19839 !! test
19840 Edited PMID links not serializable as PMID links should serialize as extlinks
19841 !! options
19842 parsoid=html2wt
19843 !! wikitext
19844 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
19845 !! html
19846 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
19847 !! end
19848
19849 !! test
19850 Edited Redirect link should emit a non-piped wikitext link
19851 !! options
19852 parsoid=html2wt
19853 !! wikitext
19854 #REDIRECT [[Bar]]
19855 !! html
19856 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
19857 !! end
19858
19859 # -----------------------------------------------------------------
19860 # End of section for Parsoid-only html2wt tests for serialization
19861 # of new content
19862 # -----------------------------------------------------------------
19863
19864 TODO:
19865 more images
19866 more tables
19867 character entities
19868 and much more
19869 Try for 100% code coverage