Ignore height as well as width for framed images.
[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 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Template:Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !! article
56 Template:Blank
57 !! text
58 !! endarticle
59
60 !! article
61 Template:pipe
62 !! text
63 |
64 !! endarticle
65
66 !!article
67 MediaWiki:bad image list
68 !!text
69 * [[File:Bad.jpg]] except [[Nasty page]]
70 !!endarticle
71
72 !! article
73 Template:inner list
74 !! text
75 * item 1
76 !! endarticle
77
78 !! article
79 Template:tbl-start
80 !! text
81 {|
82 !! endarticle
83
84 !! article
85 Template:tbl-end
86 !! text
87 |}
88 !! endarticle
89
90 !! article
91 Template:!
92 !! text
93 |
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
126
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
132
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
139
140 !! article
141 A?b
142 !! text
143 Weirdo titles!
144 !! endarticle
145
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
151
152 !!article
153 Template:OpenTable
154 !!text
155 {|
156 !!endarticle
157
158 ###
159 ### Basic tests
160 ###
161 !! test
162 Blank input
163 !! wikitext
164 !! html
165 !! end
166
167
168 !! test
169 Simple paragraph
170 !! wikitext
171 This is a simple paragraph.
172 !! html
173 <p>This is a simple paragraph.
174 </p>
175 !! end
176
177 !! test
178 Paragraphs with extra newline spacing
179 !! wikitext
180 foo
181
182 bar
183
184
185 baz
186
187
188
189 booz
190 !! html
191 <p>foo
192 </p><p>bar
193 </p><p><br />
194 baz
195 </p><p><br />
196 </p><p>booz
197 </p>
198 !! end
199
200 !! test
201 Paragraphs with newline spacing with comment lines in between
202 !! wikitext
203 ----
204 a
205 <!--foo-->
206 b
207 ----
208 a
209 <!--foo--><!--More than 1 comment, still stripped-->
210 b
211 ----
212 a
213 <!--foo--> <!----> <!-- bar -->
214 b
215 ----
216 a
217 <!--foo-->
218
219 b
220 ----
221 a
222
223 <!--foo-->
224 b
225 ----
226 a
227 <!--foo-->
228
229
230 b
231 ----
232 a
233
234
235 <!--foo-->
236 b
237 ----
238 !! html
239 <hr />
240 <p>a
241 b
242 </p>
243 <hr />
244 <p>a
245 b
246 </p>
247 <hr />
248 <p>a
249 b
250 </p>
251 <hr />
252 <p>a
253 </p><p>b
254 </p>
255 <hr />
256 <p>a
257 </p><p>b
258 </p>
259 <hr />
260 <p>a
261 </p><p><br />
262 b
263 </p>
264 <hr />
265 <p>a
266 </p><p><br />
267 b
268 </p>
269 <hr />
270
271 !! end
272
273 !! test
274 Paragraphs with newline spacing with non-empty white-space lines in between
275 !! wikitext
276 ----
277 a
278
279 b
280 ----
281 a
282
283
284 b
285 ----
286 !! html
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p><br />
294 b
295 </p>
296 <hr />
297
298 !! end
299
300 !! test
301 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
302 !! wikitext
303 ----
304 a
305 <!--foo-->
306 b
307 ----
308 a
309 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316 b
317 ----
318 a
319
320 <!--foo-->
321 <!--bar-->
322
323 b
324 ----
325 !! html
326 <hr />
327 <p>a
328 b
329 </p>
330 <hr />
331 <p>a
332 b
333 </p>
334 <hr />
335 <p>a
336 </p><p>b
337 </p>
338 <hr />
339 <p>a
340 </p><p><br />
341 b
342 </p>
343 <hr />
344
345 !! end
346
347 !! test
348 Extra newlines: More paragraphs with indented comment
349 !! wikitext
350 a
351
352 <!--boo-->
353
354 b
355 !! html
356 <p>a
357 </p><p><br />
358 b
359 </p>
360 !!end
361
362 !! test
363 Extra newlines followed by heading
364 !! wikitext
365 a
366
367
368
369 =b=
370 [[a]]
371
372
373 =b=
374 !! html
375 <p>a
376 </p><p><br />
377 </p>
378 <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>
379 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
380 </p><p><br />
381 </p>
382 <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>
383
384 !! end
385
386 !! test
387 Extra newlines between heading and content are swallowed
388 !! wikitext
389 =b=
390
391
392
393 [[a]]
394 !! html
395 <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>
396 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
397 </p>
398 !! end
399
400 !! test
401 Parsing an URL
402 !! wikitext
403 http://fr.wikipedia.org/wiki/🍺
404 <!-- EasterEgg we love beer, better be able be able to link to it -->
405 !! html
406 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
407 </p>
408 !! end
409
410 !! test
411 Simple list
412 !! wikitext
413 * Item 1
414 * Item 2
415 !! html
416 <ul>
417 <li> Item 1
418 </li>
419 <li> Item 2
420 </li>
421 </ul>
422
423 !! end
424
425 !! test
426 Italics and bold
427 !! wikitext
428 * plain
429 * plain''italic''plain
430 * plain''italic''plain''italic''plain
431 * plain'''bold'''plain
432 * plain'''bold'''plain'''bold'''plain
433 * plain''italic''plain'''bold'''plain
434 * plain'''bold'''plain''italic''plain
435 * plain''italic'''bold-italic'''italic''plain
436 * plain'''bold''bold-italic''bold'''plain
437 * plain'''''bold-italic'''italic''plain
438 * plain'''''bold-italic''bold'''plain
439 * plain''italic'''bold-italic'''''plain
440 * plain'''bold''bold-italic'''''plain
441 * plain l'''italic''plain
442 * plain l''''bold''' plain
443 !! html
444 <ul>
445 <li> plain
446 </li>
447 <li> plain<i>italic</i>plain
448 </li>
449 <li> plain<i>italic</i>plain<i>italic</i>plain
450 </li>
451 <li> plain<b>bold</b>plain
452 </li>
453 <li> plain<b>bold</b>plain<b>bold</b>plain
454 </li>
455 <li> plain<i>italic</i>plain<b>bold</b>plain
456 </li>
457 <li> plain<b>bold</b>plain<i>italic</i>plain
458 </li>
459 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
460 </li>
461 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
462 </li>
463 <li> plain<i><b>bold-italic</b>italic</i>plain
464 </li>
465 <li> plain<b><i>bold-italic</i>bold</b>plain
466 </li>
467 <li> plain<i>italic<b>bold-italic</b></i>plain
468 </li>
469 <li> plain<b>bold<i>bold-italic</i></b>plain
470 </li>
471 <li> plain l'<i>italic</i>plain
472 </li>
473 <li> plain l'<b>bold</b> plain
474 </li>
475 </ul>
476
477 !! end
478
479 # this example taken from the [[simple:Moon]] article (bug 47326)
480 !! test
481 Italics and possessives (1)
482 !! wikitext
483 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
484 !! html
485 <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
486 </p>
487 !! end
488
489 # this example taken from [[en:Flaming Pie]] (bug 49926)
490 !! test
491 Italics and possessives (2)
492 !! wikitext
493 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
494 !! html
495 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
496 </p>
497 !! end
498
499 # this example taken from [[en:Dictionary]] (bug 49926)
500 !! test
501 Italics and possessives (3)
502 !! wikitext
503 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''.
504 !! html
505 <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>.
506 </p>
507 !! end
508
509
510 ###
511 ### 2-quote opening sequence tests
512 ###
513 !! test
514 Italics and bold: 2-quote opening sequence: (2,2)
515 !! wikitext
516 ''foo''
517 !! html
518 <p><i>foo</i>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 2-quote opening sequence: (2,3)
525 !! wikitext
526 ''foo'''
527 !! html
528 <p><i>foo'</i>
529 </p>
530 !!end
531
532
533 !! test
534 Italics and bold: 2-quote opening sequence: (2,4)
535 !! wikitext
536 ''foo''''
537 !! html
538 <p><i>foo''</i>
539 </p>
540 !!end
541
542
543 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
544 !! test
545 Italics and bold: 2-quote opening sequence: (2,5)
546 !! wikitext
547 ''foo'''''
548 !! html/php
549 <p><i>foo</i>
550 </p>
551 !! html/parsoid
552 <p><i>foo</i><b></b>
553 </p>
554 !!end
555
556
557 ###
558 ### 3-quote opening sequence tests
559 ###
560
561 !! test
562 Italics and bold: 3-quote opening sequence: (3,2)
563 !! wikitext
564 '''foo''
565 !! html
566 <p>'<i>foo</i>
567 </p>
568 !!end
569
570
571 !! test
572 Italics and bold: 3-quote opening sequence: (3,3)
573 !! wikitext
574 '''foo'''
575 !! html
576 <p><b>foo</b>
577 </p>
578 !!end
579
580
581 !! test
582 Italics and bold: 3-quote opening sequence: (3,4)
583 !! wikitext
584 '''foo''''
585 !! html
586 <p><b>foo'</b>
587 </p>
588 !!end
589
590
591 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
592 !! test
593 Italics and bold: 3-quote opening sequence: (3,5)
594 !! wikitext
595 '''foo'''''
596 !! html/php
597 <p><b>foo</b>
598 </p>
599 !! html/parsoid
600 <p><b>foo</b><i></i>
601 </p>
602 !!end
603
604
605 ###
606 ### 4-quote opening sequence tests
607 ###
608
609 !! test
610 Italics and bold: 4-quote opening sequence: (4,2)
611 !! wikitext
612 ''''foo''
613 !! html
614 <p>''<i>foo</i>
615 </p>
616 !!end
617
618
619 !! test
620 Italics and bold: 4-quote opening sequence: (4,3)
621 !! wikitext
622 ''''foo'''
623 !! html
624 <p>'<b>foo</b>
625 </p>
626 !!end
627
628
629 !! test
630 Italics and bold: 4-quote opening sequence: (4,4)
631 !! wikitext
632 ''''foo''''
633 !! html
634 <p>'<b>foo'</b>
635 </p>
636 !!end
637
638
639 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
640 !! test
641 Italics and bold: 4-quote opening sequence: (4,5)
642 !! wikitext
643 ''''foo'''''
644 !! html/php
645 <p>'<b>foo</b>
646 </p>
647 !! html/parsoid
648 <p>'<b>foo</b><i></i>
649 </p>
650 !!end
651
652
653 ###
654 ### 5-quote opening sequence tests
655 ###
656
657 !! test
658 Italics and bold: 5-quote opening sequence: (5,2)
659 !! options
660 !! wikitext
661 '''''foo''
662 !! html
663 <p><b><i>foo</i></b>
664 </p>
665 !!end
666
667
668 !! test
669 Italics and bold: 5-quote opening sequence: (5,3)
670 !! wikitext
671 '''''foo'''
672 !! html
673 <p><i><b>foo</b></i>
674 </p>
675 !!end
676
677
678 !! test
679 Italics and bold: 5-quote opening sequence: (5,4)
680 !! wikitext
681 '''''foo''''
682 !! html
683 <p><i><b>foo'</b></i>
684 </p>
685 !!end
686
687
688 !! test
689 Italics and bold: 5-quote opening sequence: (5,5)
690 !! wikitext
691 '''''foo'''''
692 !! html
693 <p><i><b>foo</b></i>
694 </p>
695 !!end
696
697 ###
698 ### multiple quote sequences in a line
699 ###
700 !! test
701 Italics and bold: multiple quote sequences: (2,4,2)
702 !! wikitext
703 ''foo''''bar''
704 !! html
705 <p><i>foo'<b>bar</b></i>
706 </p>
707 !!end
708
709
710 !! test
711 Italics and bold: multiple quote sequences: (2,4,3)
712 !! wikitext
713 ''foo''''bar'''
714 !! html
715 <p><i>foo'<b>bar</b></i>
716 </p>
717 !!end
718
719
720 !! test
721 Italics and bold: multiple quote sequences: (2,4,4)
722 !! wikitext
723 ''foo''''bar''''
724 !! html
725 <p><i>foo'<b>bar'</b></i>
726 </p>
727 !!end
728
729
730 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
731 !! test
732 Italics and bold: multiple quote sequences: (3,4,2)
733 !! wikitext
734 '''foo''''bar''
735 !! html/php
736 <p><b>foo'</b>bar
737 </p>
738 !! html/parsoid
739 <p><b>foo'</b>bar<i></i>
740 </p>
741 !!end
742
743
744 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
745 !! test
746 Italics and bold: multiple quote sequences: (3,4,3)
747 !! wikitext
748 '''foo''''bar'''
749 !! html/php
750 <p><b>foo'</b>bar
751 </p>
752 !! html/parsoid
753 <p><b>foo'</b>bar<b></b>
754 </p>
755 !!end
756
757 ###
758 ### other quote tests
759 ###
760 !! test
761 Italics and bold: other quote tests: (2,3,5)
762 !! wikitext
763 ''this is about '''foo's family'''''
764 !! html
765 <p><i>this is about <b>foo's family</b></i>
766 </p>
767 !!end
768
769
770 !! test
771 Italics and bold: other quote tests: (2,(3,3),2)
772 !! wikitext
773 ''this is about '''foo's''' family''
774 !! html
775 <p><i>this is about <b>foo's</b> family</i>
776 </p>
777 !!end
778
779
780 !! test
781 Italics and bold: other quote tests: (3,2,3,2)
782 !! wikitext
783 '''this is about ''foo'''s family''
784 !! html
785 <p><b>this is about <i>foo</i></b><i>s family</i>
786 </p>
787 !!end
788
789
790 !! test
791 Italics and bold: other quote tests: (3,2,3,3)
792 !! options
793 !! wikitext
794 '''this is about ''foo'''s family'''
795 !! html
796 <p>'<i>this is about </i>foo<b>s family</b>
797 </p>
798 !!end
799
800
801 !! test
802 Italics and bold: other quote tests: (3,(2,2),3)
803 !! wikitext
804 '''this is about ''foo's'' family'''
805 !! html
806 <p><b>this is about <i>foo's</i> family</b>
807 </p>
808 !!end
809
810
811 !! test
812 Italicized possessive
813 !! wikitext
814 The ''[[Main Page]]'''s talk page.
815 !! html
816 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
817 </p>
818 !! end
819
820 !! test
821 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
822 (Requires tidy for PHP parser output to be fixed up)
823 !! options
824 parsoid=wt2html,wt2wt
825 !! wikitext
826 {|
827 !''a!!''b
828 |''a||''b
829 |}
830 !! html
831 <table>
832 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
833 <td><i>a</i></td><td><i>b</i></td></tr>
834 </tbody></table>
835 !! end
836
837 ###
838 ### Non-html5 tags
839 ###
840
841 !! test
842 Non-html5 tags should be accepted
843 !! wikitext
844 <center>''foo''</center>
845 <big>''foo''</big>
846 <font>''foo''</font>
847 <strike>''foo''</strike>
848 <tt>''foo''</tt>
849 !! html
850 <center><i>foo</i></center>
851 <p><big><i>foo</i></big>
852 <font><i>foo</i></font>
853 <strike><i>foo</i></strike>
854 <tt><i>foo</i></tt>
855 </p>
856 !! end
857
858 !! test
859 <wbr> is valid wikitext (bug 52468)
860 !! wikitext
861 <wbr>
862 !! html
863 <p><wbr />
864 </p>
865 !! end
866
867 # <strike> is HTML4, <s> is HTML4/5.
868 !! test
869 <s> or <strike> for strikethrough
870 !! wikitext
871 <strike>strike</strike>
872
873 <s>s</s>
874 !! html
875 <p><strike>strike</strike>
876 </p><p><s>s</s>
877 </p>
878 !! end
879
880 !! test
881 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
882 !! wikitext
883 <b→> doesn't work! </b→>
884
885 <bä> doesn't work! </bä>
886
887 <boo> works fine </boo>
888
889 <s.foo>s.foo</s.foo>
890
891 <sub-ID#1>
892 !! html
893 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
894 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
895 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
896 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
897 </p><p>&lt;sub-ID#1&gt;
898 </p>
899 !! end
900
901 !! test
902 Isolated close tags should be treated as literal text (bug 52760)
903 !! wikitext
904 </b>
905
906 <s.foo>s</s>
907 !! html
908 <p>&lt;/b&gt;
909 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
910 </p>
911 !! end
912
913 ###
914 ### Special characters
915 ###
916
917 !! test
918 Bare pipe character (bug 52363)
919 !! wikitext
920 |
921 !! html
922 <p>|
923 </p>
924 !! end
925
926 !! test
927 Bare pipe character from a template (bug 52363)
928 !! wikitext
929 {{pipe}}
930 !! html
931 <p>|
932 </p>
933 !! end
934
935 ###
936 ### <nowiki> test cases
937 ###
938
939 !! test
940 <nowiki> unordered list
941 !! wikitext
942 <nowiki>* This is not an unordered list item.</nowiki>
943 !! html
944 <p>* This is not an unordered list item.
945 </p>
946 !! end
947
948 !! test
949 <nowiki> spacing
950 !! wikitext
951 <nowiki>Lorem ipsum dolor
952
953 sed abit.
954 sed nullum.
955
956 :and a colon
957 </nowiki>
958 !! html
959 <p>Lorem ipsum dolor
960
961 sed abit.
962 sed nullum.
963
964 :and a colon
965
966 </p>
967 !! end
968
969 !! test
970 nowiki 3
971 !! wikitext
972 :There is not nowiki.
973 :There is <nowiki>nowiki</nowiki>.
974
975 #There is not nowiki.
976 #There is <nowiki>nowiki</nowiki>.
977
978 *There is not nowiki.
979 *There is <nowiki>nowiki</nowiki>.
980 !! html
981 <dl>
982 <dd>There is not nowiki.
983 </dd>
984 <dd>There is nowiki.
985 </dd>
986 </dl>
987 <ol>
988 <li>There is not nowiki.
989 </li>
990 <li>There is nowiki.
991 </li>
992 </ol>
993 <ul>
994 <li>There is not nowiki.
995 </li>
996 <li>There is nowiki.
997 </li>
998 </ul>
999
1000 !! end
1001
1002 !! test
1003 Entities inside <nowiki>
1004 !! wikitext
1005 <nowiki>&lt;</nowiki>
1006 !! html
1007 <p>&lt;
1008 </p>
1009 !! end
1010
1011 !! test
1012 Entities inside template parameters
1013 !! options
1014 parsoid
1015 !! wikitext
1016 {{echo|&ndash;}}
1017 !! html
1018 <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>
1019 </p>
1020 !! end
1021
1022 ###
1023 ### Comments
1024 ###
1025 !! test
1026 Comments and Indent-Pre
1027 !! wikitext
1028 <!-- comment 1 --> asdf
1029
1030 <!-- comment 1 --> asdf
1031 <!-- comment 2 -->
1032
1033 <!-- comment 1 --> asdf
1034 <!-- comment 2 -->xyz
1035
1036 <!-- comment 1 --> asdf
1037 <!-- comment 2 --> xyz
1038 !! html
1039 <pre>asdf
1040 </pre>
1041 <pre>asdf
1042 </pre>
1043 <pre>asdf
1044 </pre>
1045 <p>xyz
1046 </p>
1047 <pre>asdf
1048 xyz
1049 </pre>
1050 !! end
1051
1052 !! test
1053 Comment test 2a
1054 !! wikitext
1055 asdf
1056 <!-- comment 1 -->
1057 jkl
1058 !! html
1059 <p>asdf
1060 jkl
1061 </p>
1062 !! end
1063
1064 !! test
1065 Comment test 2b
1066 !! wikitext
1067 asdf
1068 <!-- comment 1 -->
1069
1070 jkl
1071 !! html
1072 <p>asdf
1073 </p><p>jkl
1074 </p>
1075 !! end
1076
1077 !! test
1078 Comment test 3
1079 !! wikitext
1080 asdf
1081 <!-- comment 1 -->
1082 <!-- comment 2 -->
1083 jkl
1084 !! html
1085 <p>asdf
1086 jkl
1087 </p>
1088 !! end
1089
1090 !! test
1091 Comment test 4
1092 !! wikitext
1093 asdf<!-- comment 1 -->jkl
1094 !! html
1095 <p>asdfjkl
1096 </p>
1097 !! end
1098
1099 !! test
1100 Comment spacing
1101 !! wikitext
1102 a
1103 <!-- foo --> b <!-- bar -->
1104 c
1105 !! html
1106 <p>a
1107 </p>
1108 <pre> b
1109 </pre>
1110 <p>c
1111 </p>
1112 !! end
1113
1114 !! test
1115 Comment whitespace
1116 !! wikitext
1117 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1118 !! html
1119
1120 !! end
1121
1122 !! test
1123 Comment semantics and delimiters
1124 !! wikitext
1125 <!-- --><!----><!-----><!------>
1126 !! html
1127
1128 !! end
1129
1130 !! test
1131 Comment semantics and delimiters, redux
1132 !! wikitext
1133 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1134 -- foo -- funky huh? ... -->
1135 !! html
1136
1137 !! end
1138
1139 !! test
1140 Comment semantics and delimiters: directors cut
1141 !! wikitext
1142 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1143 everything starting with < followed by !-- until the first -- and > we see,
1144 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1145 -->-->
1146 !! html
1147 <p>--&gt;
1148 </p>
1149 !! end
1150
1151 !! test
1152 Comment semantics: nesting
1153 !! wikitext
1154 <!--<!-- no, we're not going to do anything fancy here -->-->
1155 !! html
1156 <p>--&gt;
1157 </p>
1158 !! end
1159
1160 !! test
1161 Comment semantics: unclosed comment at end
1162 !! wikitext
1163 <!--This comment will run out to the end of the document
1164 !! html
1165
1166 !! end
1167
1168 !! test
1169 Comment in template title
1170 !! wikitext
1171 {{f<!---->oo}}
1172 !! html
1173 <p>FOO
1174 </p>
1175 !! end
1176
1177 !! test
1178 Comment on its own line post-expand
1179 !! wikitext
1180 a
1181 {{blank}}<!---->
1182 b
1183 !! html
1184 <p>a
1185 </p><p>b
1186 </p>
1187 !! end
1188
1189 !! test
1190 Comment on its own line post-expand with non-significant whitespace
1191 !! wikitext
1192 a
1193 {{blank}} <!---->
1194 b
1195 !! html
1196 <p>a
1197 </p><p>b
1198 </p>
1199 !! end
1200
1201 ###
1202 ### paragraph wrapping tests
1203 ###
1204 !! test
1205 No block tags
1206 !! wikitext
1207 a
1208
1209 b
1210 !! html
1211 <p>a
1212 </p><p>b
1213 </p>
1214 !! end
1215
1216 !! test
1217 Block tag on one line (<div>)
1218 !! wikitext
1219 a <div>foo</div>
1220
1221 b
1222 !! html
1223 a <div>foo</div>
1224 <p>b
1225 </p>
1226 !! end
1227
1228 !! test
1229 Block tag on one line (<blockquote>)
1230 !! wikitext
1231 a <blockquote>foo</blockquote>
1232
1233 b
1234 !! html
1235 a <blockquote>foo</blockquote>
1236 <p>b
1237 </p>
1238 !! end
1239
1240 !! test
1241 Block tag on both lines (<div>)
1242 !! wikitext
1243 a <div>foo</div>
1244
1245 b <div>foo</div>
1246 !! html
1247 a <div>foo</div>
1248 b <div>foo</div>
1249
1250 !! end
1251
1252 !! test
1253 Block tag on both lines (<blockquote>)
1254 !! wikitext
1255 a <blockquote>foo</blockquote>
1256
1257 b <blockquote>foo</blockquote>
1258 !! html
1259 a <blockquote>foo</blockquote>
1260 b <blockquote>foo</blockquote>
1261
1262 !! end
1263
1264 !! test
1265 Multiple lines without block tags
1266 !! wikitext
1267 <div>foo</div> a
1268 b
1269 c
1270 d<!--foo--> e
1271 x <div>foo</div> z
1272 !! html
1273 <div>foo</div> a
1274 <p>b
1275 c
1276 d e
1277 </p>
1278 x <div>foo</div> z
1279
1280 !! end
1281
1282 !! test
1283 Empty lines between lines with block tags
1284 !! wikitext
1285 <div></div>
1286
1287
1288 <div></div>a
1289
1290 b
1291 <div>a</div>b
1292
1293 <div>b</div>d
1294
1295
1296 <div>e</div>
1297 !! html
1298 <div></div>
1299 <p><br />
1300 </p>
1301 <div></div>a
1302 <p>b
1303 </p>
1304 <div>a</div>b
1305 <div>b</div>d
1306 <p><br />
1307 </p>
1308 <div>e</div>
1309
1310 !! end
1311
1312 ## PHP parser emits output which is broken
1313 !! test
1314 Unclosed HTML p-tags should be handled properly
1315 !! wikitext
1316 <div><p>foo</div>
1317 a
1318
1319 b
1320 !! html/parsoid
1321 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1322 <p>a</p>
1323 <p>b</p>
1324 !! end
1325
1326 ###
1327 ### Preformatted text
1328 ###
1329 !! test
1330 Preformatted text
1331 !! wikitext
1332 This is some
1333 Preformatted text
1334 With ''italic''
1335 And '''bold'''
1336 And a [[Main Page|link]]
1337 !! html
1338 <pre>This is some
1339 Preformatted text
1340 With <i>italic</i>
1341 And <b>bold</b>
1342 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1343 </pre>
1344 !! end
1345
1346 !! test
1347 Tabs don't trigger preformatted text
1348 !! wikitext
1349 This is not
1350 preformatted text.
1351 This is preformatted text.
1352 So is this.
1353 !! html
1354 <p> This is not
1355 preformatted text.
1356 </p>
1357 <pre>This is preformatted text.
1358 So is this.
1359 </pre>
1360 !! end
1361
1362 !! test
1363 Ident preformatting with inline content
1364 !! wikitext
1365 a
1366 ''b''
1367 !! html
1368 <pre>a
1369 <i>b</i>
1370 </pre>
1371 !! end
1372
1373 !! test
1374 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1375 !! wikitext
1376 <pre><nowiki>
1377 <b>
1378 <cite>
1379 <em>
1380 </nowiki></pre>
1381 !! html
1382 <pre>
1383 &lt;b&gt;
1384 &lt;cite&gt;
1385 &lt;em&gt;
1386 </pre>
1387
1388 !! end
1389
1390 !! test
1391 Regression with preformatted in <center>
1392 !! wikitext
1393 <center>
1394 Blah
1395 </center>
1396 !! html
1397 <center>
1398 <pre>Blah
1399 </pre>
1400 </center>
1401
1402 !! end
1403
1404 !! test
1405 Bug 52763: Preformatted in <blockquote>
1406 !! wikitext
1407 <blockquote>
1408 Blah
1409 {|
1410 |
1411 indented cell (no pre-wrapping!)
1412 |}
1413 </blockquote>
1414 !! html
1415 <blockquote>
1416 <p> Blah
1417 </p>
1418 <table>
1419 <tr>
1420 <td>
1421 <p> indented cell (no pre-wrapping!)
1422 </p>
1423 </td></tr></table>
1424 </blockquote>
1425
1426 !! end
1427
1428 !! test
1429 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1430 !! wikitext
1431 <blockquote>
1432 Foo
1433
1434 Bar
1435 </blockquote>
1436 !! html
1437 <blockquote>
1438 <p>Foo
1439 </p><p>Bar
1440 </p>
1441 </blockquote>
1442
1443 !! end
1444
1445 !! test
1446 Bug 15491: <ins>/<del> in blockquote
1447 !! wikitext
1448 <blockquote>
1449 Foo <del>bar</del> <ins>baz</ins> quux
1450 </blockquote>
1451 !! html
1452 <blockquote>
1453 <p>Foo <del>bar</del> <ins>baz</ins> quux
1454 </p>
1455 </blockquote>
1456
1457 !! end
1458
1459 # Note that the p-wrapping is newline sensitive, which could be
1460 # considered a bug: tidy will wrap only the 'Foo' in the example
1461 # below in a <p> tag. (see comment 23-25 of bug #6200)
1462 !! test
1463 Bug 15491: <ins>/<del> in blockquote (2)
1464 !! wikitext
1465 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1466 </blockquote>
1467 !! html
1468 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1469 </blockquote>
1470
1471 !! end
1472
1473 !! test
1474 <pre> with attributes (bug 3202)
1475 !! wikitext
1476 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1477 !! html
1478 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1479
1480 !! end
1481
1482 !! test
1483 <pre> with width attribute (bug 3202)
1484 !! wikitext
1485 <pre width="8">Narrow screen goodies</pre>
1486 !! html
1487 <pre width="8">Narrow screen goodies</pre>
1488
1489 !! end
1490
1491 !! test
1492 <pre> with forbidden attribute (bug 3202)
1493 !! wikitext
1494 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1495 !! html
1496 <pre width="8">Narrow screen goodies</pre>
1497
1498 !! end
1499
1500 !! test
1501 Entities inside <pre>
1502 !! wikitext
1503 <pre>&lt;</pre>
1504 !! html
1505 <pre>&lt;</pre>
1506
1507 !! end
1508
1509 !! test
1510 <pre> with forbidden attribute values (bug 3202)
1511 !! wikitext
1512 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1513 !! html
1514 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1515
1516 !! end
1517
1518 !! test
1519 <nowiki> inside <pre> (bug 13238)
1520 !! wikitext
1521 <pre>
1522 <nowiki>
1523 </pre>
1524 <pre>
1525 <nowiki></nowiki>
1526 </pre>
1527 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1528 !! html
1529 <pre>
1530 &lt;nowiki&gt;
1531 </pre>
1532 <pre>
1533
1534 </pre>
1535 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1536
1537 !! end
1538
1539 !! test
1540 <nowiki> and <pre> preference (first one wins)
1541 !! wikitext
1542 <pre>
1543 <nowiki>
1544 </pre>
1545 </nowiki>
1546 </pre>
1547
1548 <nowiki>
1549 <pre>
1550 <nowiki>
1551 </pre>
1552 </nowiki>
1553 </pre>
1554
1555 !! html
1556 <pre>
1557 &lt;nowiki&gt;
1558 </pre>
1559 <p>&lt;/nowiki&gt;
1560 &lt;/pre&gt;
1561 </p><p>
1562 &lt;pre&gt;
1563 &lt;nowiki&gt;
1564 &lt;/pre&gt;
1565
1566 &lt;/pre&gt;
1567 </p>
1568 !! end
1569
1570 !! test
1571 </pre> inside nowiki
1572 !! wikitext
1573 <nowiki></pre></nowiki>
1574 !! html
1575 <p>&lt;/pre&gt;
1576 </p>
1577 !! end
1578
1579 !! test
1580 Empty pre; pre inside other HTML tags (bug 54946)
1581 !! wikitext
1582 a
1583
1584 <div><pre>
1585 foo
1586 </pre></div>
1587 <pre></pre>
1588 !! html
1589 <p>a
1590 </p>
1591 <div><pre>
1592 foo
1593 </pre></div>
1594 <pre></pre>
1595
1596 !! end
1597
1598 !! test
1599 HTML pre followed by indent-pre
1600 !! wikitext
1601 <pre>foo</pre>
1602 bar
1603 !! html
1604 <pre>foo</pre>
1605 <pre>bar
1606 </pre>
1607 !! end
1608
1609 !!test
1610 Block tag pre
1611 !!options
1612 parsoid
1613 !! wikitext
1614 <p><pre>foo</pre></p>
1615 !! html
1616 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1617 !!end
1618
1619 !!test
1620 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1621 !! wikitext
1622 {{echo|}}
1623 !! html
1624
1625 !!end
1626
1627 !!test
1628 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1629 !! wikitext
1630 {{echo|
1631 foo}}
1632 !! html
1633 <p>foo
1634 </p>
1635 !!end
1636
1637 !! test
1638 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1639 !! wikitext
1640 {{echo|a
1641 b}}
1642 !! html
1643 <pre>a
1644 </pre>
1645 <p>b
1646 </p>
1647 !!end
1648
1649 !! test
1650 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1651 !! wikitext
1652 {{echo|a
1653 b
1654 c
1655 d
1656 e
1657 }}
1658 !! html
1659 <pre>a
1660 </pre>
1661 <p>b
1662 c
1663 </p>
1664 <pre>d
1665 </pre>
1666 <p>e
1667 </p>
1668 !!end
1669
1670 !!test
1671 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1672 !! wikitext
1673 {{echo| foo}}
1674
1675 {{echo| foo}}{{echo| bar}}
1676
1677 {{echo| foo}}
1678 {{echo| bar}}
1679
1680 {{echo|<!--cmt--> foo}}
1681
1682 <!--cmt-->{{echo| foo}}
1683
1684 {{echo|{{echo| }}bar}}
1685 !! html
1686 <pre>foo
1687 </pre>
1688 <pre>foo bar
1689 </pre>
1690 <pre>foo
1691 bar
1692 </pre>
1693 <pre>foo
1694 </pre>
1695 <pre>foo
1696 </pre>
1697 <pre>bar
1698 </pre>
1699 !!end
1700
1701 !! test
1702 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1703 !! wikitext
1704 {{echo| }}a
1705
1706 {{echo|
1707 }}a
1708
1709 {{echo|
1710 b}}
1711
1712 {{echo|a
1713 }}b
1714
1715 {{echo|a
1716 }} b
1717 !! html
1718 <pre>a
1719 </pre>
1720 <p><br />
1721 </p>
1722 <pre>a
1723 </pre>
1724 <p><br />
1725 </p>
1726 <pre>b
1727 </pre>
1728 <p>a
1729 </p>
1730 <pre>b
1731 </pre>
1732 <p>a
1733 </p>
1734 <pre>b
1735 </pre>
1736 !!end
1737
1738 !! test
1739 Things that look like <pre> tags aren't treated as such
1740 !! wikitext
1741 Barack Obama <President> of the United States
1742 !! html
1743 <p>Barack Obama &lt;President&gt; of the United States
1744 </p>
1745 !! end
1746
1747 !! test
1748 Parsoid: handle pre with space after attribute
1749 !! options
1750 parsoid=wt2html
1751 !! wikitext
1752 <pre style="width:50%;" >{{echo|foo}}</pre>
1753 !! html
1754 <pre style="width:50%;">{{echo|foo}}</pre>
1755 !! end
1756
1757 # TODO / maybe: fix wt2wt for this
1758 !! test
1759 Parsoid: Don't paragraph-wrap fosterable content
1760 !! options
1761 parsoid=wt2html
1762 !! wikitext
1763 {|
1764 <td></td>
1765 <td></td>
1766
1767
1768
1769 |}
1770 !! html
1771 <table>
1772
1773 <tbody>
1774 <tr>
1775 <td></td>
1776
1777 <td></td></tr>
1778
1779
1780
1781 </tbody></table>
1782 !! end
1783
1784 !! test
1785 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1786 !! options
1787 parsoid=wt2html
1788 !! wikitext
1789 {|
1790 <td>
1791 <td>
1792 </td>
1793
1794
1795
1796 |}
1797 !! html
1798 <table>
1799
1800 <tbody>
1801 <tr>
1802 <td></td>
1803
1804 <td>
1805 </td></tr>
1806
1807
1808
1809 </tbody></table>
1810 !! end
1811
1812
1813 #--------------------------------------------------------------------
1814 # Transclusion parameter whitespace stripping tests
1815 # Behavior is different for positional and named parameters
1816 #--------------------------------------------------------------------
1817 !! test
1818 Templates: Strip leading and trailing whitespace from named-param values
1819 !! wikitext
1820 {{echo|1= a }}
1821
1822 {{echo|1= {{echo|b}} }}
1823
1824 {{echo| 1 =
1825 c }}
1826
1827 {{echo| 1 =
1828 * d
1829 }}
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p><p>c
1834 </p>
1835 <ul>
1836 <li> d
1837 </li>
1838 </ul>
1839
1840 !! end
1841
1842 !! test
1843 Templates: Don't strip whitespace from positional-param values
1844 !! wikitext
1845 {{echo|a }}
1846
1847 {{echo|{{echo|b}} }}
1848
1849 {{echo| c
1850 }}
1851
1852 {{echo| {{echo|d}}
1853 }}
1854
1855 {{echo|
1856 e}}
1857
1858 {{echo|
1859 * f}}
1860
1861 {{echo|
1862 }}g
1863 !! html
1864 <p>a
1865 </p><p>b
1866 </p>
1867 <pre>c
1868 </pre>
1869 <p><br />
1870 </p>
1871 <pre>d
1872 </pre>
1873 <p><br />
1874 </p>
1875 <pre>e
1876 </pre>
1877 <p><br />
1878 </p>
1879 <ul>
1880 <li> f
1881 </li>
1882 </ul>
1883 <p><br />
1884 </p>
1885 <pre>g
1886 </pre>
1887 !! end
1888
1889 !! test
1890 Templates: Handle empty comment-and-ws-only lines correctly
1891 !! wikitext
1892 {{echo|foo
1893 <!--should be ignored-->
1894 <!--should be ignored as well-->
1895 bar}}
1896 !! html
1897 <p>foo
1898 bar
1899 </p>
1900 !! end
1901
1902 #--------------------------------------------------------------------
1903 # Transclusion parameter escaping tests
1904 #--------------------------------------------------------------------
1905 !! test
1906 Templates: Parsoid parameter escaping test 1
1907 !! options
1908 parsoid
1909 !! wikitext
1910 {{echo|[foo]|{{echo|[bar]}}}}
1911 !! html
1912 <p about="#mwt1" typeof="mw:Transclusion"
1913 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1914 !! end
1915
1916 !! test
1917 Parsoid: Pipes in external links in template parameter
1918 !! options
1919 parsoid
1920 !! wikitext
1921 {{echo|[{{echo|http://example.com}} link]}}
1922 !! html
1923 <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>
1924 !! end
1925
1926 !! test
1927 Parsoid: pipe in transclusion parameter
1928 !! options
1929 parsoid
1930 !! wikitext
1931 {{echo|http://foo.com/a&#124;b}}
1932 !! html
1933 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1934 typeof="mw:Transclusion"
1935 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>
1936 !! end
1937
1938 !! test
1939 Parsoid: Pipe in external link target and content in template parameter
1940 !! options
1941 parsoid=html2wt,wt2wt
1942 !! wikitext
1943 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1944 !! html
1945 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1946 typeof="mw:Transclusion"
1947 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1948 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1949 !! end
1950
1951 !! test
1952 Templates: Don't escape already nowiki-escaped text in template parameters
1953 !! options
1954 parsoid=html2wt,wt2wt
1955 !! wikitext
1956 {{echo|foo<nowiki>|</nowiki>bar}}
1957 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1958 {{echo|<nowiki></nowiki>}}
1959 !! html
1960 <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>
1961 <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>
1962 <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>
1963 </p>
1964 !! end
1965
1966 ## Bug 52824
1967 !! test
1968 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1969 !! options
1970 parsoid=html2wt,wt2wt
1971 !! wikitext
1972 {{echo|{{echo|1=bar}}}}
1973 !! html
1974 <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>
1975 !! end
1976
1977 ## Bug 56733
1978 !! test
1979 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
1980 !! options
1981 parsoid
1982 !! wikitext
1983 {{echo|a : b}}
1984 !! html
1985 <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>
1986 !! end
1987
1988 ###
1989 ### Parsoid-centric tests for testing RT edge cases for pre
1990 ###
1991
1992 !!test
1993 1a. Indent-Pre and Comments
1994 !! wikitext
1995 a
1996 <!--a-->
1997 c
1998 !! html
1999 <pre>a
2000 </pre>
2001 <p>c
2002 </p>
2003 !!end
2004
2005 !!test
2006 1b. Indent-Pre and Comments
2007 !! wikitext
2008 a
2009 <!--a-->
2010 c
2011 !! html
2012 <pre>a
2013 </pre>
2014 <p>c
2015 </p>
2016 !!end
2017
2018 !!test
2019 1c. Indent-Pre and Comments
2020 !! wikitext
2021 <!--a--> a
2022
2023 <!--a--> a
2024 !! html
2025 <pre> a
2026 </pre>
2027 <pre> a
2028 </pre>
2029 !!end
2030
2031 !!test
2032 1d. Indent-Pre and Comments
2033 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2034 !! wikitext
2035 <!--a--> a
2036
2037 <!--b-->b
2038 !! html
2039 <pre>a
2040 </pre>
2041 <pre>b
2042 </pre>
2043 !!end
2044
2045 !!test
2046 2a. Indent-Pre and tables
2047 !! wikitext
2048 {|
2049 |-
2050 !h1!!h2
2051 |foo||bar
2052 |}
2053 !! html
2054 <table>
2055
2056 <tr>
2057 <th>h1</th>
2058 <th>h2
2059 </th>
2060 <td>foo</td>
2061 <td>bar
2062 </td></tr></table>
2063
2064 !!end
2065
2066 !!test
2067 2b. Indent-Pre and tables
2068 !! wikitext
2069 {|
2070 |-
2071 |foo
2072 |}
2073 !! html
2074 <table>
2075
2076 <tr>
2077 <td>foo
2078 </td></tr></table>
2079
2080 !!end
2081
2082 !!test
2083 2c. Indent-Pre and tables (bug 42252)
2084 !! wikitext
2085 {|
2086 |+ foo
2087 ! | bar
2088 |}
2089 !! html
2090 <table>
2091 <caption> foo
2092 </caption>
2093 <tr>
2094 <th> bar
2095 </th></tr></table>
2096
2097 !!end
2098
2099 !!test
2100 3a. Indent-Pre and block tags (single-line html)
2101 !! wikitext
2102 a <p> foo </p>
2103 b <div> foo </div>
2104 c <blockquote> foo </blockquote>
2105 <span> foo </span>
2106 !! html
2107 a <p> foo </p>
2108 b <div> foo </div>
2109 c <blockquote> foo </blockquote>
2110 <pre><span> foo </span>
2111 </pre>
2112 !!end
2113
2114 !!test
2115 3b. Indent-Pre and block tags (multi-line html)
2116 !! wikitext
2117 a <span>foo</span>
2118 b <div> foo </div>
2119 !! html
2120 <pre>a <span>foo</span>
2121 </pre>
2122 b <div> foo </div>
2123
2124 !!end
2125
2126 !!test
2127 3c. Indent-Pre and block tags (pre-content on separate line)
2128 !! wikitext
2129 <p>
2130 foo
2131 </p>
2132
2133 <div>
2134 foo
2135 </div>
2136
2137 <center>
2138 foo
2139 </center>
2140
2141 <blockquote>
2142 foo
2143 </blockquote>
2144
2145 <blockquote>
2146 <pre>
2147 foo
2148 </pre>
2149 </blockquote>
2150
2151 <table><tr><td>
2152 foo
2153 </td></tr></table>
2154
2155 <ul><li>
2156 foo
2157 </li></ul>
2158
2159 !! html
2160 <p>
2161 foo
2162 </p>
2163 <div>
2164 <pre>foo
2165 </pre>
2166 </div>
2167 <center>
2168 <pre>foo
2169 </pre>
2170 </center>
2171 <blockquote>
2172 <p> foo
2173 </p>
2174 </blockquote>
2175 <blockquote>
2176 <pre>
2177 foo
2178 </pre>
2179 </blockquote>
2180 <table><tr><td>
2181 <pre>foo
2182 </pre>
2183 </td></tr></table>
2184 <ul><li>
2185 foo
2186 </li></ul>
2187
2188 !!end
2189
2190 !!test
2191 4. Indent-Pre and extension tags
2192 !! wikitext
2193 a <gallery>
2194 File:foobar.jpg
2195 </gallery>
2196 !! html
2197 a <ul class="gallery mw-gallery-traditional">
2198 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2199 <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>
2200 <div class="gallerytext">
2201 </div>
2202 </div></li>
2203 </ul>
2204
2205 !!end
2206
2207 !! test
2208 Leading pipes outside of tables
2209 !! options
2210 parsoid
2211 !! wikitext
2212 | foo
2213 !! html
2214 <p>| foo</p>
2215 !! end
2216
2217 !! test
2218 Leading pipes outside of tables 2
2219 !! options
2220 parsoid
2221 !! wikitext
2222 a
2223 | foo
2224 b
2225 !! html
2226 <p>a
2227 | foo
2228 b</p>
2229 !! end
2230
2231 !! test
2232 Leading pipes outside of tables 3
2233 !! options
2234 parsoid
2235 !! wikitext
2236 a
2237 | class="foo bar" | baz
2238 b
2239 !! html
2240 <p>a
2241 | class="foo bar" | baz
2242 b</p>
2243 !! end
2244
2245 !!test
2246 Render paragraphs when indent-pre is suppressed in blocklevels
2247 !! wikitext
2248 <blockquote>
2249 foo
2250
2251 bar
2252 </blockquote>
2253 !! html
2254 <blockquote>
2255 <p> foo
2256 </p><p> bar
2257 </p>
2258 </blockquote>
2259
2260 !!end
2261
2262 !!test
2263 4. Multiple spaces at start-of-line
2264 !! wikitext
2265 <p> foo </p>
2266 foo
2267 {|
2268 |foo
2269 |}
2270 !! html
2271 <p> foo </p>
2272 <pre> foo
2273 </pre>
2274 <table>
2275 <tr>
2276 <td>foo
2277 </td></tr></table>
2278
2279 !!end
2280
2281 ## NOTE: the leading white-space chars on empty line are significant
2282 !! test
2283 5a. White-space in indent-pre
2284 !! wikitext
2285 a<br />
2286
2287 b
2288 !! html
2289 <pre>a<br />
2290
2291 b
2292 </pre>
2293 !! end
2294
2295 ## NOTE: the leading white-space chars on empty line are significant
2296 !! test
2297 5b. White-space in indent-pre
2298 !! wikitext
2299 a
2300
2301 b
2302
2303
2304 c
2305 !! html
2306 <pre>a
2307
2308 b
2309
2310
2311 c
2312 </pre>
2313 !! end
2314
2315 !! test
2316 5c. White-space in indent-pre
2317 !! wikitext
2318 ''a''
2319 ''b''
2320 ''c''
2321 !! html
2322 <pre><i>a</i>
2323 <i>b</i>
2324 <i>c</i>
2325 </pre>
2326 !! end
2327
2328 !! test
2329 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2330 !! wikitext
2331 a
2332
2333 <!-- continue -->
2334 b
2335
2336 c
2337
2338 d
2339 !! html
2340 <pre>a
2341
2342 b
2343 </pre>
2344 <pre>c
2345
2346 </pre>
2347 <p>d
2348 </p>
2349 !! end
2350
2351 !! test
2352 7a. Indent-pre and category links
2353 !! options
2354 parsoid=wt2html,wt2wt
2355 !! wikitext
2356 [[Category:foo]] <!-- No pre-wrapping -->
2357 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2358 !! html
2359 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2360 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2361 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2362 !! end
2363
2364 !! test
2365 7b. Indent-pre and category links
2366 !! options
2367 parsoid=wt2html,wt2wt
2368 !! wikitext
2369 [[Category:foo]] a
2370 [[Category:foo]] {{echo|b}}
2371 !! html
2372 <pre>
2373 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2374
2375 <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>
2376 !! end
2377
2378 ###
2379 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2380 ###
2381
2382 !!test
2383 HTML-pre: 1. embedded newlines
2384 !! wikitext
2385 <pre>foo</pre>
2386
2387 <pre>
2388 foo
2389 </pre>
2390
2391 <pre>
2392
2393 foo
2394 </pre>
2395
2396 <pre>
2397
2398
2399 foo
2400 </pre>
2401 !! html
2402 <pre>foo</pre>
2403 <pre>
2404 foo
2405 </pre>
2406 <pre>
2407
2408 foo
2409 </pre>
2410 <pre>
2411
2412
2413 foo
2414 </pre>
2415
2416 !!end
2417
2418 !!test
2419 HTML-pre: 2: indented text
2420 !! wikitext
2421 <pre>
2422 foo
2423 </pre>
2424 !! html
2425 <pre>
2426 foo
2427 </pre>
2428
2429 !!end
2430
2431 !!test
2432 HTML-pre: 3: other wikitext
2433 !! wikitext
2434 <pre>
2435 * foo
2436 # bar
2437 = no-h =
2438 '' no-italic ''
2439 [[ NoLink ]]
2440 </pre>
2441 !! html
2442 <pre>
2443 * foo
2444 # bar
2445 = no-h =
2446 '' no-italic ''
2447 [[ NoLink ]]
2448 </pre>
2449
2450 !!end
2451
2452 ###
2453 ### Definition lists
2454 ###
2455 !! test
2456 Simple definition
2457 !! wikitext
2458 ; name : Definition
2459 !! html
2460 <dl>
2461 <dt> name&#160;</dt>
2462 <dd> Definition
2463 </dd>
2464 </dl>
2465
2466 !! end
2467
2468 !! test
2469 Definition list for indentation only
2470 !! wikitext
2471 : Indented text
2472 !! html
2473 <dl>
2474 <dd> Indented text
2475 </dd>
2476 </dl>
2477
2478 !! end
2479
2480 !! test
2481 Definition list with no space
2482 !! wikitext
2483 ;name:Definition
2484 !! html
2485 <dl>
2486 <dt>name</dt>
2487 <dd>Definition
2488 </dd>
2489 </dl>
2490
2491 !!end
2492
2493 !! test
2494 Definition list with URL link
2495 !! wikitext
2496 ; http://example.com/ : definition
2497 !! html
2498 <dl>
2499 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2500 <dd> definition
2501 </dd>
2502 </dl>
2503
2504 !! end
2505
2506 !! test
2507 Definition list with bracketed URL link
2508 !! wikitext
2509 ;[http://www.example.com/ Example]:Something about it
2510 !! html
2511 <dl>
2512 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2513 <dd>Something about it
2514 </dd>
2515 </dl>
2516
2517 !! end
2518
2519 !! test
2520 Definition list with wikilink containing colon
2521 !! wikitext
2522 ; [[Help:FAQ]]: The least-read page on Wikipedia
2523 !! html
2524 <dl>
2525 <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>
2526 <dd> The least-read page on Wikipedia
2527 </dd>
2528 </dl>
2529
2530 !! end
2531
2532 # At Brion's and JeLuF's insistence... :)
2533 !! test
2534 Definition list with news link containing colon
2535 !! wikitext
2536 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2537 !! html
2538 <dl>
2539 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2540 <dd> This isn't even a real newsgroup!
2541 </dd>
2542 </dl>
2543
2544 !! end
2545
2546 !! test
2547 Malformed definition list with colon
2548 !! wikitext
2549 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2550 !! html
2551 <dl>
2552 <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
2553 </dt>
2554 </dl>
2555
2556 !! end
2557
2558 !! test
2559 Definition lists: colon in external link text
2560 !! wikitext
2561 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2562 !! html
2563 <dl>
2564 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2565 <dd> OK, I made that up
2566 </dd>
2567 </dl>
2568
2569 !! end
2570
2571 !! test
2572 Definition lists: colon in HTML attribute
2573 !! wikitext
2574 ;<b style="display: inline">bold</b>
2575 !! html
2576 <dl>
2577 <dt><b style="display: inline">bold</b>
2578 </dt>
2579 </dl>
2580
2581 !! end
2582
2583 !! test
2584 Definition lists: self-closed tag
2585 !! wikitext
2586 ;one<br/>two : two-line fun
2587 !! html
2588 <dl>
2589 <dt>one<br />two&#160;</dt>
2590 <dd> two-line fun
2591 </dd>
2592 </dl>
2593
2594 !! end
2595
2596 !! test
2597 Bug 11748: Literal closing tags
2598 !! wikitext
2599 <dl>
2600 <dt>test 1</dt>
2601 <dd>test test test test test</dd>
2602 <dt>test 2</dt>
2603 <dd>test test test test test</dd>
2604 </dl>
2605 !! html
2606 <dl>
2607 <dt>test 1</dt>
2608 <dd>test test test test test</dd>
2609 <dt>test 2</dt>
2610 <dd>test test test test test</dd>
2611 </dl>
2612
2613 !! end
2614
2615 !! test
2616 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2617 !! wikitext
2618 <ul><li>
2619 ; term : description
2620 * unordered
2621 </li></ul>
2622 !! html
2623 <ul><li>
2624 <dl>
2625 <dt> term&#160;</dt>
2626 <dd> description
2627 </dd>
2628 </dl>
2629 <ul>
2630 <li> unordered
2631 </li>
2632 </ul>
2633 </li></ul>
2634
2635 !! end
2636
2637 !! test
2638
2639 Definition list with empty definition and following paragraph
2640 !! wikitext
2641 ; term:
2642 Paragraph text
2643 !! html
2644 <dl>
2645 <dt> term</dt>
2646 <dd>
2647 </dd>
2648 </dl>
2649 <p>Paragraph text
2650 </p>
2651 !! end
2652
2653 !! test
2654 Nested definition lists using html syntax
2655 !! wikitext
2656 <dl><dd>
2657 <dl>
2658 <dd>Foo</dd>
2659 </dl>
2660 </dd></dl>
2661 !! html
2662 <dl><dd>
2663 <dl>
2664 <dd>Foo</dd>
2665 </dl>
2666 </dd></dl>
2667
2668 !! end
2669
2670 !! test
2671 Definition Lists: No nesting: Multiple dd's
2672 !! wikitext
2673 ;x
2674 :a
2675 :b
2676 !! html
2677 <dl>
2678 <dt>x
2679 </dt>
2680 <dd>a
2681 </dd>
2682 <dd>b
2683 </dd>
2684 </dl>
2685
2686 !! end
2687
2688 !! test
2689 Definition Lists: Indentation: Regular
2690 !! wikitext
2691 :i1
2692 ::i2
2693 :::i3
2694 !! html
2695 <dl>
2696 <dd>i1
2697 <dl>
2698 <dd>i2
2699 <dl>
2700 <dd>i3
2701 </dd>
2702 </dl>
2703 </dd>
2704 </dl>
2705 </dd>
2706 </dl>
2707
2708 !! end
2709
2710 !! test
2711 Definition Lists: Indentation: Missing 1st level
2712 !! wikitext
2713 ::i2
2714 :::i3
2715 !! html
2716 <dl>
2717 <dd><dl>
2718 <dd>i2
2719 <dl>
2720 <dd>i3
2721 </dd>
2722 </dl>
2723 </dd>
2724 </dl>
2725 </dd>
2726 </dl>
2727
2728 !! end
2729
2730 !! test
2731 Definition Lists: Indentation: Multi-level indent
2732 !! wikitext
2733 :::i3
2734 !! html
2735 <dl>
2736 <dd><dl>
2737 <dd><dl>
2738 <dd>i3
2739 </dd>
2740 </dl>
2741 </dd>
2742 </dl>
2743 </dd>
2744 </dl>
2745
2746 !! end
2747
2748 !! test
2749 Definition Lists: Hacky use to indent tables
2750 !! wikitext
2751 ::{|
2752 |foo
2753 |bar
2754 |}
2755 this text
2756 should be left alone
2757 !! html
2758 <dl><dd><dl><dd><table>
2759 <tr>
2760 <td>foo
2761 </td>
2762 <td>bar
2763 </td></tr></table></dd></dl></dd></dl>
2764 <p>this text
2765 should be left alone
2766 </p>
2767 !! end
2768
2769 # Bug 52473
2770 !! test
2771 Definition Lists: Hacky use to indent tables (WS-insensitive)
2772 !! options
2773 parsoid
2774 !! wikitext
2775 : {|
2776 |a
2777 |}
2778 !! html
2779 <dl>
2780 <dd> <table><tr><td>a</td></tr></table> </dd>
2781 </dl>
2782 !! end
2783 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2784 ## as an empty dt item. It also ignores all but the last ";" when followed
2785 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2786 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2787 ## ";"s.
2788 ##
2789 ## Ex: ";;t2 ::d2" is transformed into:
2790 ##
2791 ## <dl>
2792 ## <dt>t2 </dt>
2793 ## <dd>
2794 ## <dl>
2795 ## <dt></dt>
2796 ## <dd>d2</dd>
2797 ## </dl>
2798 ## </dd>
2799 ## </dl>
2800 ##
2801 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2802 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2803 ##
2804 ## <dl>
2805 ## <dt>
2806 ## <dl>
2807 ## <dt>t2 </dt>
2808 ## <dd>:d2</dd>
2809 ## </dl>
2810 ## </dt>
2811 ## </dl>
2812 ##
2813 ## All Parsoid only definition list tests have this difference.
2814 ##
2815 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2816 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2817
2818 !! test
2819 Table / list interaction: indented table with lists in table contents
2820 !! wikitext
2821 :{|
2822 |-
2823 | a
2824 * b
2825 |-
2826 | c
2827 * d
2828 |}
2829 !! html
2830 <dl><dd><table>
2831
2832 <tr>
2833 <td> a
2834 <ul>
2835 <li> b
2836 </li>
2837 </ul>
2838 </td></tr>
2839 <tr>
2840 <td> c
2841 <ul>
2842 <li> d
2843 </li>
2844 </ul>
2845 </td></tr></table></dd></dl>
2846
2847 !! end
2848
2849 !!test
2850 Table / list interaction: lists nested in tables nested in indented lists
2851 !! wikitext
2852 :{|
2853 |
2854 :a
2855 :b
2856 |
2857 *c
2858 *d
2859 |}
2860
2861 *e
2862 *f
2863 !! html
2864 <dl><dd><table>
2865 <tr>
2866 <td>
2867 <dl>
2868 <dd>a
2869 </dd>
2870 <dd>b
2871 </dd>
2872 </dl>
2873 </td>
2874 <td>
2875 <ul>
2876 <li>c
2877 </li>
2878 <li>d
2879 </li>
2880 </ul>
2881 </td></tr></table></dd></dl>
2882 <ul>
2883 <li>e
2884 </li>
2885 <li>f
2886 </li>
2887 </ul>
2888
2889 !!end
2890
2891 !! test
2892 Definition Lists: Nesting: Multi-level (Parsoid only)
2893 !! options
2894 parsoid
2895 !! wikitext
2896 ;t1 :d1
2897 ;;t2 ::d2
2898 ;;;t3 :::d3
2899 !! html
2900 <dl>
2901 <dt>t1 </dt>
2902 <dd>d1</dd>
2903 <dt>
2904 <dl>
2905 <dt>t2 </dt>
2906 <dd>:d2</dd>
2907 <dt>
2908 <dl>
2909 <dt>t3 </dt>
2910 <dd>::d3</dd>
2911 </dl>
2912 </dt>
2913 </dl>
2914 </dt>
2915 </dl>
2916
2917
2918 !! end
2919
2920
2921 !! test
2922 Definition Lists: Nesting: Test 2 (Parsoid only)
2923 !! options
2924 parsoid
2925 !! wikitext
2926 ;t1
2927 ::d2
2928 !! html
2929 <dl>
2930 <dt>t1</dt>
2931 <dd>
2932 <dl>
2933 <dd>d2</dd>
2934 </dl>
2935 </dd>
2936 </dl>
2937
2938 !! end
2939
2940
2941 !! test
2942 Definition Lists: Nesting: Test 3 (Parsoid only)
2943 !! options
2944 parsoid
2945 !! wikitext
2946 :;t1
2947 ::::d2
2948 !! html
2949 <dl>
2950 <dd>
2951 <dl>
2952 <dt>t1</dt>
2953 <dd>
2954 <dl>
2955 <dd>
2956 <dl>
2957 <dd>d2</dd>
2958 </dl>
2959 </dd>
2960 </dl>
2961 </dd>
2962 </dl>
2963 </dd>
2964 </dl>
2965
2966 !! end
2967
2968
2969 !! test
2970 Definition Lists: Nesting: Test 4
2971 !! wikitext
2972 ::;t3
2973 :::d3
2974 !! html
2975 <dl>
2976 <dd><dl>
2977 <dd><dl>
2978 <dt>t3
2979 </dt>
2980 <dd>d3
2981 </dd>
2982 </dl>
2983 </dd>
2984 </dl>
2985 </dd>
2986 </dl>
2987
2988 !! end
2989
2990
2991 ## The Parsoid team believes the following three test exposes a
2992 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2993 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2994 !! test
2995 Definition Lists: Mixed Lists: Test 1
2996 !! wikitext
2997 :;* foo
2998 ::* bar
2999 :; baz
3000 !! html/php
3001 <dl>
3002 <dd><dl>
3003 <dt><ul>
3004 <li> foo
3005 </li>
3006 <li> bar
3007 </li>
3008 </ul>
3009 </dt>
3010 </dl>
3011 <dl>
3012 <dt> baz
3013 </dt>
3014 </dl>
3015 </dd>
3016 </dl>
3017
3018 !! html/parsoid
3019 <dl>
3020 <dd><dl>
3021 <dt><ul>
3022 <li> foo
3023 </li>
3024 </ul></dt>
3025 <dd><ul>
3026 <li> bar
3027 </li>
3028 </ul></dd>
3029 <dt> baz</dt>
3030 </dl></dd>
3031 </dl>
3032 !! end
3033
3034 !! test
3035 Definition Lists: Mixed Lists: Test 2
3036 !! wikitext
3037 *: d1
3038 *: d2
3039 !! html
3040 <ul>
3041 <li><dl>
3042 <dd> d1
3043 </dd>
3044 <dd> d2
3045 </dd>
3046 </dl>
3047 </li>
3048 </ul>
3049
3050 !! end
3051
3052
3053 !! test
3054 Definition Lists: Mixed Lists: Test 3
3055 !! wikitext
3056 *::: d1
3057 *::: d2
3058 !! html
3059 <ul>
3060 <li><dl>
3061 <dd><dl>
3062 <dd><dl>
3063 <dd> d1
3064 </dd>
3065 <dd> d2
3066 </dd>
3067 </dl>
3068 </dd>
3069 </dl>
3070 </dd>
3071 </dl>
3072 </li>
3073 </ul>
3074
3075 !! end
3076
3077
3078 !! test
3079 Definition Lists: Mixed Lists: Test 4
3080 !! wikitext
3081 *;d1 :d2
3082 *;d3 :d4
3083 !! html
3084 <ul>
3085 <li><dl>
3086 <dt>d1&#160;</dt>
3087 <dd>d2
3088 </dd>
3089 <dt>d3&#160;</dt>
3090 <dd>d4
3091 </dd>
3092 </dl>
3093 </li>
3094 </ul>
3095
3096 !! end
3097
3098
3099 !! test
3100 Definition Lists: Mixed Lists: Test 5
3101 !! wikitext
3102 *:d1
3103 *:: d2
3104 !! html
3105 <ul>
3106 <li><dl>
3107 <dd>d1
3108 <dl>
3109 <dd> d2
3110 </dd>
3111 </dl>
3112 </dd>
3113 </dl>
3114 </li>
3115 </ul>
3116
3117 !! end
3118
3119
3120 !! test
3121 Definition Lists: Mixed Lists: Test 6
3122 !! wikitext
3123 #*:d1
3124 #*::: d3
3125 !! html
3126 <ol>
3127 <li><ul>
3128 <li><dl>
3129 <dd>d1
3130 <dl>
3131 <dd><dl>
3132 <dd> d3
3133 </dd>
3134 </dl>
3135 </dd>
3136 </dl>
3137 </dd>
3138 </dl>
3139 </li>
3140 </ul>
3141 </li>
3142 </ol>
3143
3144 !! end
3145
3146
3147 !! test
3148 Definition Lists: Mixed Lists: Test 7
3149 !! wikitext
3150 :* d1
3151 :* d2
3152 !! html
3153 <dl>
3154 <dd><ul>
3155 <li> d1
3156 </li>
3157 <li> d2
3158 </li>
3159 </ul>
3160 </dd>
3161 </dl>
3162
3163 !! end
3164
3165
3166 !! test
3167 Definition Lists: Mixed Lists: Test 8
3168 !! wikitext
3169 :* d1
3170 ::* d2
3171 !! html
3172 <dl>
3173 <dd><ul>
3174 <li> d1
3175 </li>
3176 </ul>
3177 <dl>
3178 <dd><ul>
3179 <li> d2
3180 </li>
3181 </ul>
3182 </dd>
3183 </dl>
3184 </dd>
3185 </dl>
3186
3187 !! end
3188
3189
3190 !! test
3191 Definition Lists: Mixed Lists: Test 9
3192 !! wikitext
3193 *;foo :bar
3194 !! html
3195 <ul>
3196 <li><dl>
3197 <dt>foo&#160;</dt>
3198 <dd>bar
3199 </dd>
3200 </dl>
3201 </li>
3202 </ul>
3203
3204 !! end
3205
3206
3207 !! test
3208 Definition Lists: Mixed Lists: Test 10
3209 !! wikitext
3210 *#;foo :bar
3211 !! html
3212 <ul>
3213 <li><ol>
3214 <li><dl>
3215 <dt>foo&#160;</dt>
3216 <dd>bar
3217 </dd>
3218 </dl>
3219 </li>
3220 </ol>
3221 </li>
3222 </ul>
3223
3224 !! end
3225
3226 # The Parsoid team disagrees with the PHP parser's seemingly-random
3227 # rules regarding dd/dt on the next two tests. Parsoid is more
3228 # consistent, and recognizes the shared nesting and keeps the
3229 # still-open tags around until the nesting is complete.
3230
3231 !! test
3232 Definition Lists: Mixed Lists: Test 11
3233 !! wikitext
3234 *#*#;*;;foo :bar
3235 *#*#;boo :baz
3236 !! html/php
3237 <ul>
3238 <li><ol>
3239 <li><ul>
3240 <li><ol>
3241 <li><dl>
3242 <dt>foo&#160;</dt>
3243 <dd><ul>
3244 <li><dl>
3245 <dt><dl>
3246 <dt>bar
3247 </dt>
3248 </dl>
3249 </dd>
3250 </dl>
3251 </li>
3252 </ul>
3253 </dd>
3254 </dl>
3255 <dl>
3256 <dt>boo&#160;</dt>
3257 <dd>baz
3258 </dd>
3259 </dl>
3260 </li>
3261 </ol>
3262 </li>
3263 </ul>
3264 </li>
3265 </ol>
3266 </li>
3267 </ul>
3268
3269 !! html/parsoid
3270 <ul>
3271 <li>
3272 <ol>
3273 <li>
3274 <ul>
3275 <li>
3276 <ol>
3277 <li>
3278 <dl>
3279 <dt>
3280 <ul>
3281 <li>
3282 <dl>
3283 <dt>
3284 <dl>
3285 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3286 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3287 </dl></dt>
3288 </dl></li>
3289 </ul></dt>
3290 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3291 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3292 </dl></li>
3293 </ol></li>
3294 </ul></li>
3295 </ol></li>
3296 </ul>
3297 !! end
3298
3299
3300 !! test
3301 Definition Lists: Weird Ones: Test 1
3302 !! wikitext
3303 *#;*::;; foo : bar (who uses this?)
3304 !! html/php
3305 <ul>
3306 <li><ol>
3307 <li><dl>
3308 <dt> foo&#160;</dt>
3309 <dd><ul>
3310 <li><dl>
3311 <dd><dl>
3312 <dd><dl>
3313 <dt><dl>
3314 <dt> bar (who uses this?)
3315 </dt>
3316 </dl>
3317 </dd>
3318 </dl>
3319 </dd>
3320 </dl>
3321 </dd>
3322 </dl>
3323 </li>
3324 </ul>
3325 </dd>
3326 </dl>
3327 </li>
3328 </ol>
3329 </li>
3330 </ul>
3331
3332 !! html/parsoid
3333 <ul>
3334 <li>
3335 <ol>
3336 <li>
3337 <dl>
3338 <dt>
3339 <ul>
3340 <li>
3341 <dl>
3342 <dd>
3343 <dl>
3344 <dd>
3345 <dl>
3346 <dt>
3347 <dl>
3348 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3349 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3350 </dl></dt>
3351 </dl></dd>
3352 </dl></dd>
3353 </dl></li>
3354 </ul></dt>
3355 </dl></li>
3356 </ol></li>
3357 </ul>
3358 !! end
3359
3360 ###
3361 ### External links
3362 ###
3363 !! test
3364 External links: non-bracketed
3365 !! wikitext
3366 Non-bracketed: http://example.com
3367 !! html
3368 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3369 </p>
3370 !! end
3371
3372 !! test
3373 External links: numbered
3374 !! wikitext
3375 Numbered: [http://example.com]
3376 Numbered: [http://example.net]
3377 Numbered: [http://example.com]
3378 !! html
3379 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3380 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3381 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3382 </p>
3383 !!end
3384
3385 !! test
3386 External links: specified text
3387 !! wikitext
3388 Specified text: [http://example.com link]
3389 !! html
3390 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3391 </p>
3392 !!end
3393
3394 !! test
3395 External links: trail
3396 !! wikitext
3397 Linktrails should not work for external links: [http://example.com link]s
3398 !! html
3399 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3400 </p>
3401 !! end
3402
3403 !! test
3404 External links: dollar sign in URL
3405 !! wikitext
3406 http://example.com/1$2345
3407 !! html
3408 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3409 </p>
3410 !! end
3411
3412 !! test
3413 External links: dollar sign in URL (named)
3414 !! wikitext
3415 [http://example.com/1$2345]
3416 !! html
3417 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3418 </p>
3419 !!end
3420
3421 !! test
3422 External links: open square bracket forbidden in URL (bug 4377)
3423 !! wikitext
3424 http://example.com/1[2345
3425 !! html
3426 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3427 </p>
3428 !! end
3429
3430 !! test
3431 External links: open square bracket forbidden in URL (named) (bug 4377)
3432 !! wikitext
3433 [http://example.com/1[2345]
3434 !! html
3435 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3436 </p>
3437 !!end
3438
3439 !! test
3440 External links: nowiki in URL link text (bug 6230)
3441 !! wikitext
3442 [http://example.com/ <nowiki>''example site''</nowiki>]
3443 !! html
3444 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3445 </p>
3446 !! end
3447
3448 !! test
3449 External links: newline forbidden in text (bug 6230 regression check)
3450 !! wikitext
3451 [http://example.com/ first
3452 second]
3453 !! html
3454 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3455 second]
3456 </p>
3457 !!end
3458
3459 !! test
3460 External links: Pipe char between url and text
3461 !! wikitext
3462 [http://example.com | link]
3463 !! html
3464 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3465 </p>
3466 !!end
3467
3468 !! test
3469 External links: protocol-relative URL in brackets
3470 !! wikitext
3471 [//example.com/ Test]
3472 !! html
3473 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3474 </p>
3475 !! end
3476
3477 !! test
3478 External links: protocol-relative URL in brackets without text
3479 !! wikitext
3480 [//example.com]
3481 !! html
3482 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3483 </p>
3484 !! end
3485
3486 !! test
3487 External links: protocol-relative URL in free text is left alone
3488 !! wikitext
3489 //example.com/Foo
3490 !! html
3491 <p>//example.com/Foo
3492 </p>
3493 !!end
3494
3495 !! test
3496 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3497 !! wikitext
3498 foo//example.com/Foo
3499 !! html
3500 <p>foo//example.com/Foo
3501 </p>
3502 !! end
3503
3504 !! test
3505 External image
3506 !! wikitext
3507 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3508 !! html
3509 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3510 </p>
3511 !! end
3512
3513 !! test
3514 External image from https
3515 !! wikitext
3516 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3517 !! html
3518 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3519 </p>
3520 !! end
3521
3522 !! test
3523 External image (when not allowed)
3524 !! options
3525 wgAllowExternalImages=0
3526 !! wikitext
3527 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3528 !! html
3529 <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>
3530 </p>
3531 !! end
3532
3533 !! test
3534 Link to non-http image, no img tag
3535 !! wikitext
3536 Link to non-http image, no img tag: ftp://example.com/test.jpg
3537 !! html
3538 <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>
3539 </p>
3540 !! end
3541
3542 !! test
3543 External links: terminating separator
3544 !! wikitext
3545 Terminating separator: http://example.com/thing,
3546 !! html
3547 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3548 </p>
3549 !! end
3550
3551 !! test
3552 External links: intervening separator
3553 !! wikitext
3554 Intervening separator: http://example.com/1,2,3
3555 !! html
3556 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3557 </p>
3558 !! end
3559
3560 !! test
3561 External links: old bug with URL in query
3562 !! wikitext
3563 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3564 !! html
3565 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3566 </p>
3567 !! end
3568
3569 !! test
3570 External links: old URL-in-URL bug, mixed protocols
3571 !! wikitext
3572 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3573 !! html
3574 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3575 </p>
3576 !!end
3577
3578 !! test
3579 External links: URL in text
3580 !! wikitext
3581 URL in text: [http://example.com http://example.com]
3582 !! html
3583 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3584 </p>
3585 !! end
3586
3587 !! test
3588 External links: Clickable images
3589 !! wikitext
3590 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3591 !! html
3592 <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>
3593 </p>
3594 !!end
3595
3596 !! test
3597 External links: raw ampersand
3598 !! wikitext
3599 Old &amp; use: http://x&y
3600 !! html
3601 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3602 </p>
3603 !! end
3604
3605 !! test
3606 External links: encoded ampersand
3607 !! wikitext
3608 Old &amp; use: http://x&amp;y
3609 !! html
3610 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3611 </p>
3612 !! end
3613
3614 !! test
3615 External links: encoded equals (bug 6102)
3616 !! wikitext
3617 http://example.com/?foo&#61;bar
3618 !! html
3619 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3620 </p>
3621 !! end
3622
3623 !! test
3624 External links: [raw ampersand]
3625 !! wikitext
3626 Old &amp; use: [http://x&y]
3627 !! html
3628 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3629 </p>
3630 !! end
3631
3632 !! test
3633 External links: [encoded ampersand]
3634 !! wikitext
3635 Old &amp; use: [http://x&amp;y]
3636 !! html
3637 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3638 </p>
3639 !! end
3640
3641 !! test
3642 External links: [encoded equals] (bug 6102)
3643 !! wikitext
3644 [http://example.com/?foo&#61;bar]
3645 !! html
3646 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3647 </p>
3648 !! end
3649
3650 !! test
3651 External links: [IDN ignored character reference in hostname; strip it right off]
3652 !! wikitext
3653 [http://e&zwnj;xample.com/]
3654 !! html
3655 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3656 </p>
3657 !! end
3658
3659 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3660 # Where an external link could easily circumvent the sanitization of the text of
3661 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3662 # test demands a higher standard. That's a bit strange.
3663 #
3664 # Example:
3665 #
3666 # http://e‌xample.com -> [http://example.com|http://example.com]
3667 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3668 #
3669 # The first example is sanitized, but the second is not. Any security benefits
3670 # from this production are trivial to circumvent. Either remove this test and
3671 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3672 # the test accordingly.
3673 #
3674 # All our love,
3675 # The Parsoid team.
3676 !! test
3677 External links: IDN ignored character reference in hostname; strip it right off
3678 !! wikitext
3679 http://e&zwnj;xample.com/
3680 !! html
3681 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3682 </p>
3683 !! end
3684
3685 !! test
3686 External links: www.jpeg.org (bug 554)
3687 !! wikitext
3688 http://www.jpeg.org
3689 !! html
3690 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3691 </p>
3692 !! end
3693
3694 !! test
3695 External links: URL within URL (original bug 2)
3696 !! wikitext
3697 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3698 !! html
3699 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3700 </p>
3701 !! end
3702
3703 !! test
3704 BUG 361: URL inside bracketed URL
3705 !! wikitext
3706 [http://www.example.com/foo http://www.example.com/bar]
3707 !! html
3708 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3709 </p>
3710 !! end
3711
3712 !! test
3713 BUG 361: URL within URL, not bracketed
3714 !! wikitext
3715 http://www.example.com/foo?=http://www.example.com/bar
3716 !! html
3717 <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>
3718 </p>
3719 !! end
3720
3721 !! test
3722 BUG 289: ">"-token in URL-tail
3723 !! wikitext
3724 http://www.example.com/<hello>
3725 !! html
3726 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3727 </p>
3728 !!end
3729
3730 !! test
3731 BUG 289: literal ">"-token in URL-tail
3732 !! wikitext
3733 http://www.example.com/<b>html</b>
3734 !! html
3735 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3736 </p>
3737 !!end
3738
3739 !! test
3740 BUG 289: ">"-token in bracketed URL
3741 !! wikitext
3742 [http://www.example.com/<hello> stuff]
3743 !! html
3744 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3745 </p>
3746 !!end
3747
3748 !! test
3749 BUG 289: literal ">"-token in bracketed URL
3750 !! wikitext
3751 [http://www.example.com/<b>html</b> stuff]
3752 !! html
3753 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3754 </p>
3755 !!end
3756
3757 !! test
3758 BUG 289: literal double quote at end of URL
3759 !! wikitext
3760 http://www.example.com/"hello"
3761 !! html
3762 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3763 </p>
3764 !!end
3765
3766 !! test
3767 BUG 289: literal double quote in bracketed URL
3768 !! wikitext
3769 [http://www.example.com/"hello" stuff]
3770 !! html
3771 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3772 </p>
3773 !!end
3774
3775 !! test
3776 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3777 !! wikitext
3778 [http://www.example.com test]
3779 !! html
3780 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3781 </p>
3782 !! end
3783
3784 !! test
3785 External links: link text with spaces
3786 !! wikitext
3787 [http://www.example.com a b c]
3788 [http://www.example.com ''a'' ''b'']
3789 !! html
3790 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3791 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3792 </p>
3793 !! end
3794
3795 !! test
3796 External links: wiki links within external link (Bug 3695)
3797 !! wikitext
3798 [http://example.com [[wikilink]] embedded in ext link]
3799 !! html/php
3800 <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>
3801 </p>
3802 !! html/parsoid
3803 <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>
3804 !! end
3805
3806 !! test
3807 BUG 787: Links with one slash after the url protocol are invalid
3808 !! wikitext
3809 http:/example.com
3810
3811 [http:/example.com title]
3812 !! html
3813 <p>http:/example.com
3814 </p><p>[http:/example.com title]
3815 </p>
3816 !! end
3817
3818 !! test
3819 Bracketed external links with template-generated invalid target
3820 !! wikitext
3821 [{{echo|http:/example.com}} title]
3822 !! html
3823 <p>[http:/example.com title]
3824 </p>
3825 !! end
3826
3827 !! test
3828 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3829 !! wikitext
3830 ''[http://example.com text'']
3831 [http://example.com '''text]'''
3832 ''Something [http://example.com in italic'']
3833 ''Something [http://example.com mixed''''', even bold]'''
3834 '''''Now [http://example.com both''''']
3835 !! html
3836 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3837 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3838 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3839 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3840 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3841 </p>
3842 !! end
3843
3844
3845 !! test
3846 Bug 4781: %26 in URL
3847 !! wikitext
3848 http://www.example.com/?title=AT%26T
3849 !! html
3850 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3851 </p>
3852 !! end
3853
3854 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3855 # % is actually legal in HTML5. Any change in output would need testing though.
3856 !! test
3857 Bug 4781, 5267: %25 in URL
3858 !! wikitext
3859 http://www.example.com/?title=100%25_Bran
3860 !! html
3861 <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>
3862 </p>
3863 !! end
3864
3865 !! test
3866 Bug 4781, 5267: %28, %29 in URL
3867 !! wikitext
3868 http://www.example.com/?title=Ben-Hur_%281959_film%29
3869 !! html
3870 <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>
3871 </p>
3872 !! end
3873
3874
3875 !! test
3876 Bug 4781: %26 in autonumber URL
3877 !! wikitext
3878 [http://www.example.com/?title=AT%26T]
3879 !! html
3880 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3881 </p>
3882 !! end
3883
3884 !! test
3885 Bug 4781, 5267: %26 in autonumber URL
3886 !! wikitext
3887 [http://www.example.com/?title=100%25_Bran]
3888 !! html
3889 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3890 </p>
3891 !! end
3892
3893 !! test
3894 Bug 4781, 5267: %28, %29 in autonumber URL
3895 !! wikitext
3896 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3897 !! html
3898 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3899 </p>
3900 !! end
3901
3902
3903 !! test
3904 Bug 4781: %26 in bracketed URL
3905 !! wikitext
3906 [http://www.example.com/?title=AT%26T link]
3907 !! html
3908 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3909 </p>
3910 !! end
3911
3912 !! test
3913 Bug 4781, 5267: %26 in bracketed URL
3914 !! wikitext
3915 [http://www.example.com/?title=100%25_Bran link]
3916 !! html
3917 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3918 </p>
3919 !! end
3920
3921 !! test
3922 Bug 4781, 5267: %28, %29 in bracketed URL
3923 !! wikitext
3924 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3925 !! html
3926 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3927 </p>
3928 !! end
3929
3930 !! test
3931 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3932 !! wikitext
3933 Some [http://example.com/ pretty ''italics'' and stuff]!
3934 !! html
3935 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3936 </p>
3937 !! end
3938
3939 !! test
3940 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3941 !! wikitext
3942 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3943 !! html
3944 <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>
3945 </p>
3946 !! end
3947
3948 !! test
3949 External link containing double-single-quotes with no space separating the url from text in italics
3950 !! wikitext
3951 [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]].]
3952 !! html/php
3953 <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>
3954 </p>
3955 !! html/parsoid
3956 <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>
3957 !! end
3958
3959 !! test
3960 External link with comments in link text
3961 !! wikitext
3962 [http://www.google.com Google <!-- comment -->]
3963 !! html
3964 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3965 </p>
3966 !! end
3967
3968 !! test
3969 URL-encoding in URL functions (single parameter)
3970 !! wikitext
3971 {{localurl:Some page|amp=&}}
3972 !! html
3973 <p>/index.php?title=Some_page&amp;amp=&amp;
3974 </p>
3975 !! end
3976
3977 !! test
3978 URL-encoding in URL functions (multiple parameters)
3979 !! wikitext
3980 {{localurl:Some page|q=?&amp=&}}
3981 !! html
3982 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3983 </p>
3984 !! end
3985
3986 !! test
3987 Brackets in urls
3988 !! wikitext
3989 http://example.com/index.php?foozoid%5B%5D=bar
3990
3991 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3992 !! html
3993 <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><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>
3995 </p>
3996 !! end
3997
3998 !! test
3999 IPv6 urls (bug 21261)
4000 !! options
4001 disabled
4002 !! wikitext
4003 http://[2404:130:0:1000::187:2]/index.php
4004 !! html
4005 <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>
4006 </p>
4007 !! end
4008
4009 !! test
4010 Non-extlinks in brackets
4011 !! wikitext
4012 [foo]
4013 [foo bar]
4014 [foo ''bar'']
4015 [fool's] errand
4016 [fool's errand]
4017 [{{echo|foo}}]
4018 [{{echo|foo}} bar]
4019 [{{echo|foo}} ''bar'']
4020 [{{echo|foo}}l's] errand
4021 [{{echo|foo}}l's errand]
4022 [url={{echo|foo}}]
4023 [url=http://example.com]
4024 !! html
4025 <p>[foo]
4026 [foo bar]
4027 [foo <i>bar</i>]
4028 [fool's] errand
4029 [fool's errand]
4030 [foo]
4031 [foo bar]
4032 [foo <i>bar</i>]
4033 [fool's] errand
4034 [fool's errand]
4035 [url=foo]
4036 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4037 </p>
4038 !! end
4039
4040 !! test
4041 Percent encoding in external links
4042 !! wikitext
4043 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4044 !! html/php
4045 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4046 </p>
4047 !! html/parsoid
4048 <p><a rel="mw:ExtLink"
4049 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4050 !! end
4051
4052 !! test
4053 Use url link syntax for links where the content is equal the link target
4054 !! wikitext
4055 http://example.com
4056 !! html/php
4057 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4058 </p>
4059 !! html/parsoid
4060 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4061 !! end
4062
4063 !! test
4064 Parenthesis in external links, especially URL links
4065 !! wikitext
4066 http://example.com)
4067
4068 http://example.com/test)
4069
4070 http://example.com/(test)
4071
4072 http://example.com/((test)
4073
4074 (http://example.com/(test))
4075
4076 (http://example.com/(test)))))
4077
4078 http://example.com/a)b
4079
4080 [http://example.com) foo]
4081 !! html/php
4082 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</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/(test)))))">http://example.com/(test)))))</a>
4088 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4089 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4090 </p>
4091 !! html/parsoid
4092 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</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/(test)))))">http://example.com/(test)))))</a></p>
4098 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4099 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4100 !! end
4101
4102 !! test
4103 Parenthesis in external links, w/ transclusion or comment
4104 !! wikitext
4105 (http://example.com/{{echo|hi}})
4106
4107 (http://example.com<!-- hi -->)
4108 !! html/php
4109 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4110 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4111 </p>
4112 !! html/parsoid
4113 <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>
4114
4115 <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>
4116 !! end
4117
4118 ###
4119 ### Quotes
4120 ###
4121
4122 !! test
4123 Quotes
4124 !! wikitext
4125 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4126
4127 Normal text. '''''Bold italic text.''''' Normal text.
4128 !! html
4129 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4130 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4131 </p>
4132 !! end
4133
4134
4135 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4136 # parser strips. The wikitext contains just the first half of the bold
4137 # quote pair.
4138 !! test
4139 Unclosed and unmatched quotes
4140 !! wikitext
4141 '''''Bold italic text '''with bold deactivated''' in between.'''''
4142
4143 '''''Bold italic text ''with italic deactivated'' in between.'''''
4144
4145 '''Bold text..
4146
4147 ..spanning two paragraphs (should not work).'''
4148
4149 '''Bold tag left open
4150
4151 ''Italic tag left open
4152
4153 Normal text.
4154
4155 <!-- Unmatching number of opening, closing tags: -->
4156 '''This year''''s election ''should'' beat '''last year''''s.
4157
4158 ''Tom'''s car is bigger than ''Susan'''s.
4159
4160 Plain ''italic'''s plain
4161 !! html/php
4162 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4163 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4164 </p><p><b>Bold text..</b>
4165 </p><p>..spanning two paragraphs (should not work).
4166 </p><p><b>Bold tag left open</b>
4167 </p><p><i>Italic tag left open</i>
4168 </p><p>Normal text.
4169 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4170 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4171 </p><p>Plain <i>italic'</i>s plain
4172 </p>
4173 !! html/parsoid
4174 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4175 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4176 </p><p><b>Bold text..</b>
4177 </p><p>..spanning two paragraphs (should not work).<b></b>
4178 </p><p><b>Bold tag left open</b>
4179 </p><p><i>Italic tag left open</i>
4180 </p><p>Normal text.
4181 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4182 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4183 </p><p>Plain <i>italic'</i>s plain
4184 </p>
4185 !! end
4186
4187 ###
4188 ### Tables
4189 ###
4190 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4191 ###
4192
4193 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4194 # is the bare minimum required by the spec, see:
4195 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4196 # Parsoid team replies: empty table tags are legal in HTML5
4197 !! test
4198 A table with no data.
4199 !! options
4200 parsoid=wt2html
4201 !! wikitext
4202 {||}
4203 !! html/php
4204
4205 !! html/parsoid
4206 <table></table>
4207
4208 !! end
4209
4210 !! test
4211 A table with stray table end tags on start tag line (wt2html)
4212 !! options
4213 parsoid=wt2html
4214 !! wikitext
4215 {|style="color: red;"|}
4216
4217 {|style="color: red;" |}
4218 |foo
4219 |}
4220
4221 {|style="color: red;"|} id="foo"
4222 |foo
4223 |}
4224
4225 {|style="color: red;" |} id="foo"
4226 |foo
4227 |}
4228 !! html
4229 <table style="color: red;"></table>
4230
4231 <table style="color: red;">
4232 <tbody><tr>
4233 <td>foo</td>
4234 </tr></tbody>
4235 </table>
4236
4237 <table style="color: red;" id="foo">
4238 <tbody><tr>
4239 <td>foo</td>
4240 </tr></tbody>
4241 </table>
4242
4243 <table style="color: red;" id="foo">
4244 <tbody><tr>
4245 <td>foo</td>
4246 </tr></tbody>
4247 </table>
4248
4249 !! end
4250
4251 !! test
4252 A table with no data (take 2)
4253 !! wikitext
4254 {|
4255 |}
4256 !! html/parsoid
4257 <table></table>
4258 !! end
4259
4260 # A table with nothing but a caption is invalid XHTML, we might want to render
4261 # this as <p>caption</p>
4262 # Parsoid team replies: table with only a caption is legal in HTML5
4263 !! test
4264 A table with nothing but a caption
4265 !! wikitext
4266 {|
4267 |+ caption
4268 |}
4269 !! html/php
4270 <table>
4271 <caption> caption
4272 </caption><tr><td></td></tr></table>
4273
4274 !! html/parsoid
4275 <table><caption> caption</caption></table>
4276 !! end
4277
4278 !! test
4279 A table with caption with default-spaced attributes and a table row
4280 !! wikitext
4281 {|
4282 |+ style="color: red;" | caption1
4283 |-
4284 | foo
4285 |}
4286 !! html
4287 <table>
4288 <caption style="color: red;"> caption1
4289 </caption>
4290 <tr>
4291 <td> foo
4292 </td></tr></table>
4293
4294 !! end
4295
4296 !! test
4297 A table with captions with non-default spaced attributes and a table row
4298 !! wikitext
4299 {|
4300 |+style="color: red;"|caption2
4301 |+ style="color: red;"| caption3
4302 |-
4303 | foo
4304 |}
4305 !! html
4306 <table>
4307 <caption style="color: red;">caption2
4308 </caption>
4309 <caption style="color: red;"> caption3
4310 </caption>
4311 <tr>
4312 <td> foo
4313 </td></tr></table>
4314
4315 !! end
4316
4317 !! test
4318 Table td-cell syntax variations
4319 !! wikitext
4320 {|
4321 | foo bar foo | baz
4322 | foo bar foo || baz
4323 | style='color:red;' | baz
4324 | style='color:red;' || baz
4325 |}
4326 !! html
4327 <table>
4328 <tr>
4329 <td> baz
4330 </td>
4331 <td> foo bar foo </td>
4332 <td> baz
4333 </td>
4334 <td style="color:red;"> baz
4335 </td>
4336 <td> style='color:red;' </td>
4337 <td> baz
4338 </td></tr></table>
4339
4340 !! end
4341
4342 !! test
4343 Simple table
4344 !! wikitext
4345 {|
4346 | 1 || 2
4347 |-
4348 | 3 || 4
4349 |}
4350 !! html
4351 <table>
4352 <tr>
4353 <td> 1 </td>
4354 <td> 2
4355 </td></tr>
4356 <tr>
4357 <td> 3 </td>
4358 <td> 4
4359 </td></tr></table>
4360
4361 !! end
4362
4363 !! test
4364 Simple table but with multiple dashes for row wikitext
4365 !! wikitext
4366 {|
4367 | foo
4368 |-----
4369 | bar
4370 |}
4371 !! html
4372 <table>
4373 <tr>
4374 <td> foo
4375 </td></tr>
4376 <tr>
4377 <td> bar
4378 </td></tr></table>
4379
4380 !! end
4381 !! test
4382 Multiplication table
4383 !! wikitext
4384 {| border="1" cellpadding="2"
4385 |+Multiplication table
4386 |-
4387 ! &times; !! 1 !! 2 !! 3
4388 |-
4389 ! 1
4390 | 1 || 2 || 3
4391 |-
4392 ! 2
4393 | 2 || 4 || 6
4394 |-
4395 ! 3
4396 | 3 || 6 || 9
4397 |-
4398 ! 4
4399 | 4 || 8 || 12
4400 |-
4401 ! 5
4402 | 5 || 10 || 15
4403 |}
4404 !! html
4405 <table border="1" cellpadding="2">
4406 <caption>Multiplication table
4407 </caption>
4408 <tr>
4409 <th> &#215; </th>
4410 <th> 1 </th>
4411 <th> 2 </th>
4412 <th> 3
4413 </th></tr>
4414 <tr>
4415 <th> 1
4416 </th>
4417 <td> 1 </td>
4418 <td> 2 </td>
4419 <td> 3
4420 </td></tr>
4421 <tr>
4422 <th> 2
4423 </th>
4424 <td> 2 </td>
4425 <td> 4 </td>
4426 <td> 6
4427 </td></tr>
4428 <tr>
4429 <th> 3
4430 </th>
4431 <td> 3 </td>
4432 <td> 6 </td>
4433 <td> 9
4434 </td></tr>
4435 <tr>
4436 <th> 4
4437 </th>
4438 <td> 4 </td>
4439 <td> 8 </td>
4440 <td> 12
4441 </td></tr>
4442 <tr>
4443 <th> 5
4444 </th>
4445 <td> 5 </td>
4446 <td> 10 </td>
4447 <td> 15
4448 </td></tr></table>
4449
4450 !! end
4451
4452 !! test
4453 Accept "||" in table headings
4454 !! wikitext
4455 {|
4456 !h1 || h2
4457 |}
4458 !! html
4459 <table>
4460 <tr>
4461 <th>h1 </th>
4462 <th> h2
4463 </th></tr></table>
4464
4465 !! end
4466
4467 !! test
4468 Accept "||" in indented table headings
4469 !! wikitext
4470 :{|
4471 !h1 || h2
4472 |}
4473 !! html
4474 <dl><dd><table>
4475 <tr>
4476 <th>h1 </th>
4477 <th> h2
4478 </th></tr></table></dd></dl>
4479
4480 !! end
4481
4482 !! test
4483 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4484 !! wikitext
4485 {|
4486 !| h1
4487 || a
4488 |}
4489 !! html
4490 <table>
4491 <tr>
4492 <th> h1
4493 </th>
4494 <td> a
4495 </td></tr></table>
4496
4497 !! end
4498
4499 !!test
4500 Accept "| !" at start of line in tables (ignore !-attribute)
4501 !! wikitext
4502 {|
4503 |-
4504 | !style="color:red" | bar
4505 |}
4506 !! html
4507 <table>
4508
4509 <tr>
4510 <td> bar
4511 </td></tr></table>
4512
4513 !!end
4514
4515 !!test
4516 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 +/-
4517 !! wikitext
4518 {|
4519 |-
4520 |style='color:red;'|+1
4521 |style='color:blue;'|-1
4522 |-
4523 | 1 || 2 || 3
4524 | 1 ||+2 ||-3
4525 |-
4526 | +1
4527 | -1
4528 |}
4529 !! html
4530 <table>
4531
4532 <tr>
4533 <td style="color:red;">+1
4534 </td>
4535 <td style="color:blue;">-1
4536 </td></tr>
4537 <tr>
4538 <td> 1 </td>
4539 <td> 2 </td>
4540 <td> 3
4541 </td>
4542 <td> 1 </td>
4543 <td>+2 </td>
4544 <td>-3
4545 </td></tr>
4546 <tr>
4547 <td> +1
4548 </td>
4549 <td> -1
4550 </td></tr></table>
4551
4552 !!end
4553
4554 !! test
4555 Table rowspan
4556 !! wikitext
4557 {| border=1
4558 | Cell 1, row 1
4559 |rowspan=2| Cell 2, row 1 (and 2)
4560 | Cell 3, row 1
4561 |-
4562 | Cell 1, row 2
4563 | Cell 3, row 2
4564 |}
4565 !! html
4566 <table border="1">
4567 <tr>
4568 <td> Cell 1, row 1
4569 </td>
4570 <td rowspan="2"> Cell 2, row 1 (and 2)
4571 </td>
4572 <td> Cell 3, row 1
4573 </td></tr>
4574 <tr>
4575 <td> Cell 1, row 2
4576 </td>
4577 <td> Cell 3, row 2
4578 </td></tr></table>
4579
4580 !! end
4581
4582 !! test
4583 Nested table
4584 !! wikitext
4585 {| border=1
4586 | &alpha;
4587 |
4588 {| bgcolor=#ABCDEF border=2
4589 |nested
4590 |-
4591 |table
4592 |}
4593 |the original table again
4594 |}
4595 !! html
4596 <table border="1">
4597 <tr>
4598 <td> &#945;
4599 </td>
4600 <td>
4601 <table bgcolor="#ABCDEF" border="2">
4602 <tr>
4603 <td>nested
4604 </td></tr>
4605 <tr>
4606 <td>table
4607 </td></tr></table>
4608 </td>
4609 <td>the original table again
4610 </td></tr></table>
4611
4612 !! end
4613
4614 !! test
4615 Invalid attributes in table cell (bug 1830)
4616 !! wikitext
4617 {|
4618 |Cell:|broken
4619 |}
4620 !! html
4621 <table>
4622 <tr>
4623 <td>broken
4624 </td></tr></table>
4625
4626 !! end
4627
4628
4629 !! test
4630 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4631 !! wikitext
4632 {|
4633 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4634 !! html
4635 <table>
4636 <tr>
4637 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4638 <td>]" onmouseover="alert(document.cookie)"&gt;test
4639 </td>
4640 </tr>
4641 </table>
4642
4643 !! end
4644
4645
4646 !! test
4647 Indented table markup mixed with indented pre content (proposed in bug 6200)
4648 !! wikitext
4649 <table>
4650 <tr>
4651 <td>
4652 Text that should be rendered preformatted
4653 </td>
4654 </tr>
4655 </table>
4656 !! html
4657 <table>
4658 <tr>
4659 <td>
4660 <pre>Text that should be rendered preformatted
4661 </pre>
4662 </td>
4663 </tr>
4664 </table>
4665
4666 !! end
4667
4668 !! test
4669 Template-generated table cell attributes and cell content
4670 !! wikitext
4671 {|
4672 |{{table_attribs}}
4673 | {{table_attribs}}
4674 |}
4675 !! html
4676 <table>
4677 <tr>
4678 <td style="color: red"> Foo
4679 </td>
4680 <td style="color: red"> Foo
4681 </td></tr></table>
4682
4683 !! end
4684
4685 !! test
4686 Template-generated table cell attributes and cell content (2)
4687 !! wikitext
4688 {|
4689 |align=center {{table_attribs}}
4690 |}
4691 !! html
4692 <table>
4693 <tr>
4694 <td align="center" style="color: red"> Foo
4695 </td></tr></table>
4696
4697 !! end
4698
4699 !! test
4700 Template-generated table cell attributes and cell content (3)
4701 !! wikitext
4702 {|
4703 |align=center {{table_cells}}
4704 |}
4705 !! html
4706 <table>
4707 <tr>
4708 <td align="center" style="color: red"> Foo </td>
4709 <td> Bar </td>
4710 <td> Baz
4711 </td></tr></table>
4712
4713 !! end
4714
4715 !! test
4716 Table with row followed by newlines and table heading
4717 !! wikitext
4718 {|
4719 |-
4720
4721 ! foo
4722 |}
4723 !! html
4724 <table>
4725
4726
4727 <tr>
4728 <th> foo
4729 </th></tr></table>
4730
4731 !! end
4732
4733 !! test
4734 Table with empty line following the start tag
4735 !! wikitext
4736 {|
4737
4738 |-
4739 | foo
4740 |}
4741 !! html
4742 <table>
4743
4744
4745 <tr>
4746 <td> foo
4747 </td></tr></table>
4748
4749 !! end
4750
4751 # FIXME: Preserve the attribute properly (with an empty string as value) in
4752 # the PHP parser. Parsoid implements the behavior below.
4753 !! test
4754 Table attributes with empty value
4755 !! wikitext
4756 {|
4757 | style=| hello
4758 |}
4759 !! html/parsoid
4760 <table>
4761 <tbody>
4762 <tr>
4763 <td style=""> hello
4764 </td></tr></tbody></table>
4765
4766 !! end
4767
4768 !! test
4769 Wikitext table with a lot of comments
4770 !! wikitext
4771 {|
4772 <!-- c0 -->
4773 | foo
4774 <!-- c1 -->
4775 |- <!-- c2 -->
4776 <!-- c3 -->
4777 |<!-- c4 -->
4778 <!-- c5 -->
4779 |}
4780 !! html
4781 <table>
4782 <tr>
4783 <td> foo
4784 </td></tr>
4785 <tr>
4786 <td>
4787 </td></tr></table>
4788
4789 !! end
4790
4791 !! test
4792 Wikitext table with double-line table cell
4793 !! wikitext
4794 {|
4795 |a
4796 b
4797 |}
4798 !! html
4799 <table>
4800 <tr>
4801 <td>a
4802 <p>b
4803 </p>
4804 </td></tr></table>
4805
4806 !! end
4807
4808 !! test
4809 Table cell with a single comment
4810 !! wikitext
4811 {|
4812 | <!-- c1 -->
4813 | a
4814 |}
4815 !! html
4816 <table>
4817 <tr>
4818 <td>
4819 </td>
4820 <td> a
4821 </td></tr></table>
4822
4823 !! end
4824
4825 # The expected HTML structure in this test is debatable. The PHP parser does
4826 # not parse this kind of table at all. The main focus for Parsoid is on
4827 # round-tripping, so this output is ok for now. TODO: revisit!
4828 !! test
4829 Wikitext table with html-syntax row
4830 !! wikitext
4831 {|
4832 |-
4833 <td>foo</td>
4834 |}
4835 !! html/parsoid
4836 <table>
4837 <tbody>
4838 <tr>
4839 <td>foo</td></tr></tbody></table>
4840 !! end
4841
4842 !! test
4843 Implicit <td> after a |-
4844 (PHP parser relies on Tidy to add the missing <td> tags)
4845 !! options
4846 parsoid=wt2html,wt2wt
4847 !! wikitext
4848 {|
4849 |-
4850 a
4851 |}
4852 !! html
4853 <table>
4854 <tr><td>a</td></tr>
4855 </table>
4856 !! end
4857
4858 !! test
4859 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4860 (PHP parser relies on Tidy to add the missing <td> tags)
4861 !! options
4862 parsoid=wt2html,wt2wt
4863 !! wikitext
4864 {|
4865 |-
4866 |
4867 a
4868 |-
4869 b
4870 |}
4871 !! html
4872 <table>
4873 <tbody>
4874 <tr><td><pre>a</pre></td></tr>
4875 <tr><td> b</td></tr>
4876 </tbody>
4877 </table>
4878 !! end
4879
4880 !! test
4881 Lists should be recognized in an implicit <td> context
4882 (PHP parser relies on Tidy to add the missing <td> tags)
4883 !! options
4884 parsoid=wt2html,wt2wt
4885 !! wikitext
4886 {|
4887 |-
4888 *a
4889 |}
4890 !! html
4891 <table>
4892 <tr>
4893 <td><ul>
4894 <li>a</li>
4895 </ul></td>
4896 </tr>
4897 </table>
4898 !! end
4899
4900 !! test
4901 Parsoid: Round-trip tables directly followed by content (bug 51219)
4902 !! options
4903 parsoid=wt2html,wt2wt
4904 !! wikitext
4905 {|
4906 |foo
4907 |} bar
4908
4909 {|
4910 |baz
4911 |}<b>quux</b>
4912 !! html
4913 <table><tbody>
4914 <tr>
4915 <td>foo</td></tr></tbody></table> bar
4916 <table>
4917 <tbody>
4918 <tr>
4919 <td>baz</td></tr></tbody></table><b>quux</b>
4920 !! end
4921
4922 !! test
4923 Parsoid: Default to a newline after tables in new content (bug 51219)
4924 !! options
4925 parsoid=html2wt
4926 !! wikitext
4927 {|
4928 |foo
4929 |}
4930 <nowiki> </nowiki>bar
4931 {|
4932 |baz
4933 |}
4934 '''quux'''
4935 !! html
4936 <table><tbody>
4937 <tr><td>foo</td></tr></tbody></table> bar
4938 <table><tbody>
4939 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4940 !! end
4941
4942 !! test
4943 Parsoid: newline inducing block nodes don't suppress <nowiki>
4944 !! options
4945 parsoid=html2wt
4946 !! wikitext
4947 <nowiki> </nowiki>a
4948
4949 = foo =
4950 !! html
4951 a<h1>foo</h1>
4952 !! end
4953
4954 ###
4955 ### Internal links
4956 ###
4957 !! test
4958 Plain link, capitalized
4959 !! wikitext
4960 [[Main Page]]
4961 !! html
4962 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4963 </p>
4964 !! end
4965
4966 !! test
4967 Plain link, uncapitalized
4968 !! wikitext
4969 [[main Page]]
4970 !! html
4971 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4972 </p>
4973 !! end
4974
4975 !! test
4976 Piped link
4977 !! wikitext
4978 [[Main Page|The Main Page]]
4979 !! html
4980 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4981 </p>
4982 !! end
4983
4984 !! test
4985 Piped link with comment in link text
4986 !! wikitext
4987 [[Main Page|The Main<!--front--> Page]]
4988 !! html
4989 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4990 </p>
4991 !! end
4992
4993 !! test
4994 Broken link
4995 !! wikitext
4996 [[Zigzagzogzagzig]]
4997 !! html
4998 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4999 </p>
5000 !! end
5001
5002 !! test
5003 Broken link with fragment
5004 !! wikitext
5005 [[Zigzagzogzagzig#zug]]
5006 !! html
5007 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5008 </p>
5009 !! end
5010
5011 !! test
5012 Special page link with fragment
5013 !! wikitext
5014 [[Special:Version#anchor]]
5015 !! html
5016 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5017 </p>
5018 !! end
5019
5020 !! test
5021 Nonexistent special page link with fragment
5022 !! wikitext
5023 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5024 !! html
5025 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5026 </p>
5027 !! end
5028
5029 !! test
5030 Link with prefix
5031 !! wikitext
5032 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5033 !! html
5034 <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>
5035 </p>
5036 !! end
5037
5038 !! test
5039 Link with suffix
5040 !! wikitext
5041 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5042 !! html
5043 <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>!!!
5044 </p>
5045 !! end
5046
5047 !! article
5048 prefixed article
5049 !! text
5050 Some text
5051 !! endarticle
5052
5053 !! test
5054 Bug 43661: Piped links with identical prefixes
5055 !! wikitext
5056 [[prefixed article|prefixed articles with spaces]]
5057
5058 [[prefixed article|prefixed articlesaoeu]]
5059
5060 [[Main Page|Main Page test]]
5061 !! html
5062 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5063 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5064 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5065 </p>
5066 !! end
5067
5068
5069 !! test
5070 Link with HTML entity in suffix / tail
5071 !! wikitext
5072 [[Main Page]]&quot;, [[Main Page]]&#97;
5073 !! html
5074 <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;
5075 </p>
5076 !! end
5077
5078 !! test
5079 Link with 3 brackets
5080 !! wikitext
5081 [[[Main Page]]]
5082 !! html
5083 <p>[[[Main Page]]]
5084 </p>
5085 !! end
5086
5087 !! test
5088 Link with 4 brackets
5089 !! wikitext
5090 [[[[Main Page]]]]
5091 !! html
5092 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5093 </p>
5094 !! end
5095
5096 !! test
5097 Piped link with 3 brackets
5098 !! wikitext
5099 [[[main page|the main page]]]
5100 !! html
5101 <p>[[[main page|the main page]]]
5102 </p>
5103 !! end
5104
5105 !! test
5106 Piped link with extlink-like text
5107 !! wikitext
5108 [[Main Page|[bar]]]
5109 [[Main Page|This is a [bar]]]
5110 !! html
5111 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5112 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5113 </p>
5114 !! end
5115
5116 !! test
5117 Link with multiple pipes
5118 !! wikitext
5119 [[Main Page|The|Main|Page]]
5120 !! html
5121 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5122 </p>
5123 !! end
5124
5125 !! test
5126 Link to namespaces
5127 !! wikitext
5128 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5129 !! html
5130 <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>
5131 </p>
5132 !! end
5133
5134 !! article
5135 MemoryAlpha:AlphaTest
5136 !! text
5137 This is an article in the MemoryAlpha namespace
5138 (which shadows the memoryalpha interwiki link).
5139 !! endarticle
5140
5141 !! test
5142 Namespace takes precedence over interwiki link (bug 51680)
5143 !! wikitext
5144 [[MemoryAlpha:AlphaTest]]
5145 !! html
5146 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5147 </p>
5148 !! end
5149
5150 # The previous test doesn't work correctly in html2*, due to not recognizing the
5151 # link as an internal one. This one checks for the correct behavior.
5152 !! test
5153 Link to namespace preferred over interwiki with correct rel attribute
5154 !! options
5155 parsoid=html2wt,html2html
5156 !! wikitext
5157 [[MemoryAlpha:AlphaTest]]
5158 !! html
5159 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5160 </p>
5161 !! end
5162
5163 !! test
5164 Piped link to namespace
5165 !! wikitext
5166 [[Meta:Disclaimers|The disclaimers]]
5167 !! html
5168 <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>
5169 </p>
5170 !! end
5171
5172 !! test
5173 Link containing }
5174 !! wikitext
5175 [[Usually caused by a typo (oops}]]
5176 !! html
5177 <p>[[Usually caused by a typo (oops}]]
5178 </p>
5179 !! end
5180
5181 !! test
5182 Link containing % (not as a hex sequence)
5183 !! wikitext
5184 [[7% Solution]]
5185 !! html
5186 <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>
5187 </p>
5188 !! end
5189
5190 !! test
5191 Link containing % as a single hex sequence interpreted to char
5192 !! wikitext
5193 [[7%25 Solution]]
5194 !! html
5195 <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>
5196 </p>
5197 !!end
5198
5199 !! test
5200 Link containing % as a double hex sequence interpreted to hex sequence
5201 !! wikitext
5202 [[7%2525 Solution]]
5203 !! html
5204 <p>[[7%2525 Solution]]
5205 </p>
5206 !!end
5207
5208 !! test
5209 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5210 Example for such a section: == < ==
5211 !! wikitext
5212 [[%23%3c]][[%23%3e]]
5213 !! html
5214 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5215 </p>
5216 !! end
5217
5218 !! test
5219 Link containing "<#" and ">#" as a hex sequences
5220 !! wikitext
5221 [[%3c%23]][[%3e%23]]
5222 !! html
5223 <p>[[%3c%23]][[%3e%23]]
5224 </p>
5225 !! end
5226
5227 !! test
5228 Link containing an equals sign
5229 !! wikitext
5230 [[Special:BookSources/isbn=4-00-026157-6]]
5231 !! html
5232 <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>
5233 </p>
5234 !! end
5235
5236 !! article
5237 Foo~bar
5238 !! text
5239 Just a test of an article title containing a tilde.
5240 !! endarticle
5241
5242 # note that links containing signatures, like [[Foo~~~~]], are
5243 # massaged by the pre-save transform (PST) and so the tildes are never
5244 # seen by the parser.
5245 !! test
5246 Link containing a tilde
5247 !! wikitext
5248 [[Foo~bar]]
5249 !! html
5250 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5251 </p>
5252 !! end
5253
5254 !! test
5255 Link containing double-single-quotes '' (bug 4598)
5256 !! wikitext
5257 [[Lista d''e paise d''o munno]]
5258 !! html
5259 <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>
5260 </p>
5261 !! end
5262
5263 !! test
5264 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5265 !! wikitext
5266 Some [[Link|pretty ''italics'' and stuff]]!
5267 !! html
5268 <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>!
5269 </p>
5270 !! end
5271
5272 !! test
5273 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5274 !! wikitext
5275 ''Some [[Link|pretty ''italics'' and stuff]]!
5276 !! html
5277 <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>
5278 </p>
5279 !! end
5280
5281 !! test
5282 Link with double quotes in title part (literal) and alternate part (interpreted)
5283 !! wikitext
5284 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5285
5286 [[''Pentecoste'']]
5287
5288 [[''Pentecoste''|Pentecoste]]
5289
5290 [[''Pentecoste''|''Pentecoste'']]
5291 !! html
5292 <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>
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)">Pentecoste</a>
5295 </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>
5296 </p>
5297 !! end
5298
5299 !! test
5300 Broken image links with HTML captions (bug 39700)
5301 !! wikitext
5302 [[File:Nonexistent|<script></script>]]
5303 [[File:Nonexistent|100px|<script></script>]]
5304 [[File:Nonexistent|&lt;]]
5305 [[File:Nonexistent|a<i>b</i>c]]
5306 !! html
5307 <p><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;script&gt;&lt;/script&gt;</a>
5309 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5310 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5311 </p>
5312 !! end
5313
5314 !! test
5315 Plain link to URL
5316 !! wikitext
5317 [[http://www.example.com]]
5318 !! html
5319 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5320 </p>
5321 !! end
5322
5323 !! test
5324 Plain link to URL with link text
5325 !! wikitext
5326 [[http://www.example.com Link text]]
5327 !! html
5328 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5329 </p>
5330 !! end
5331
5332 !! test
5333 Plain link to protocol-relative URL
5334 !! wikitext
5335 [[//www.example.com]]
5336 !! html
5337 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5338 </p>
5339 !! end
5340
5341 !! test
5342 Plain link to protocol-relative URL with link text
5343 !! wikitext
5344 [[//www.example.com Link text]]
5345 !! html
5346 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5347 </p>
5348 !! end
5349
5350 !! test
5351 Plain link to page with question mark in title
5352 !! wikitext
5353 [[A?b]]
5354
5355 [[A?b|Baz]]
5356 !! html
5357 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5358 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5359 </p>
5360 !! end
5361
5362
5363 # I'm fairly sure the expected result here is wrong.
5364 # We want these to be URL links, not pseudo-pages with URLs for titles....
5365 # However the current output is also pretty screwy.
5366 #
5367 # ----
5368 # I'm changing it to match the current output--it arguably makes more
5369 # sense in the light of the test above. Old expected result was:
5370 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5371 #</p>
5372 # But I think this test is bordering on "garbage in, garbage out" anyway.
5373 # -- wtm
5374 !! test
5375 Piped link to URL
5376 !! wikitext
5377 Piped link to URL: [[http://www.example.com|an example URL]]
5378 !! html
5379 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5380 </p>
5381 !! end
5382
5383 !! test
5384 BUG 2: [[page|http://url/]] should link to page, not http://url/
5385 !! wikitext
5386 [[Main Page|http://url/]]
5387 !! html
5388 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5389 </p>
5390 !! end
5391
5392 !! test
5393 BUG 337: Escaped self-links should be bold
5394 !! options
5395 title=[[Bug462]]
5396 !! wikitext
5397 [[Bu&#103;462]] [[Bug462]]
5398 !! html
5399 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5400 </p>
5401 !! end
5402
5403 !! test
5404 Self-link to section should not be bold
5405 !! options
5406 title=[[Main Page]]
5407 !! wikitext
5408 [[Main Page#section]]
5409 !! html
5410 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5411 </p>
5412 !! end
5413
5414 !! article
5415 00
5416 !! text
5417 This is 00.
5418 !! endarticle
5419
5420 !!test
5421 Self-link to numeric title
5422 !!options
5423 title=[[0]]
5424 !! wikitext
5425 [[0]]
5426 !! html
5427 <p><strong class="selflink">0</strong>
5428 </p>
5429 !!end
5430
5431 !!test
5432 Link to numeric-equivalent title
5433 !!options
5434 title=[[0]]
5435 !! wikitext
5436 [[00]]
5437 !! html
5438 <p><a href="/wiki/00" title="00">00</a>
5439 </p>
5440 !!end
5441
5442 !! test
5443 <nowiki> inside a link
5444 !! wikitext
5445 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5446 !! html
5447 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5448 </p>
5449 !! end
5450
5451 !! test
5452 Non-breaking spaces in title
5453 !! wikitext
5454 [[&nbsp; Main &nbsp; Page &nbsp;]]
5455 !! html
5456 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5457 </p>
5458 !!end
5459
5460 !! test
5461 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5462 !! options
5463 language=ca
5464 !! wikitext
5465 '''[[Main Page]]'''
5466 !! html
5467 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5468 </p>
5469 !! end
5470
5471 !! test
5472 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5473 !! options
5474 language=ca
5475 !! wikitext
5476 ''[[Main Page]]''
5477 !! html
5478 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5479 </p>
5480 !! end
5481
5482 !! test
5483 Internal link with en linktrail: no apostrophes (bug 27473)
5484 !! options
5485 language=en
5486 !! wikitext
5487 [[Something]]'nice
5488 !! html
5489 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5490 </p>
5491 !! end
5492
5493 !! test
5494 Internal link with ca linktrail with apostrophes (bug 27473)
5495 !! options
5496 language=ca
5497 !! wikitext
5498 [[Something]]'nice
5499 !! html
5500 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5501 </p>
5502 !! end
5503
5504 !! test
5505 Internal link with kaa linktrail with apostrophes (bug 27473)
5506 !! options
5507 language=kaa
5508 !! wikitext
5509 [[Something]]'nice
5510 !! html
5511 <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>
5512 </p>
5513 !! end
5514
5515 !! test
5516 1. Interaction of linktrail and template encapsulation
5517 !! options
5518 parsoid
5519 !! wikitext
5520 {{echo|[[Foo]]}}l
5521 !! html
5522 <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>
5523 !! end
5524
5525 !! test
5526 2. Interaction of linktrail and template encapsulation
5527 !! options
5528 parsoid
5529 !! wikitext
5530 {{echo|Some [[Fool]]}}s
5531 !! html
5532 <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>
5533 !! end
5534
5535 !! test
5536 3. Interaction of linktrail and template encapsulation
5537 !! options
5538 parsoid
5539 !! wikitext
5540 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5541 !! html
5542 <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>
5543 !! end
5544
5545 !! article
5546 Söfnuður
5547 !! text
5548 Test.
5549 !! endarticle
5550
5551 !! test
5552 Internal link with is link prefix
5553 !! options
5554 language=is
5555 !! wikitext
5556 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5557 !! html
5558 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5559 </p>
5560 !! end
5561
5562 !! article
5563 Mótmælendatrú
5564 !! text
5565 Test.
5566 !! endarticle
5567
5568 !! test
5569 Internal link with is link trail and link prefix
5570 !! options
5571 language=is
5572 !! wikitext
5573 [[mótmælendatrú|xxx]]ar
5574 [[mótmælendatrú]]ar
5575 mótmælenda[[söfnuður]]
5576 mótmælenda[[söfnuður|söfnuðir]]
5577 mótmælenda[[söfnuður|söfnuðir]]xxx
5578 !! html
5579 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5580 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5581 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5582 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5583 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5584 </p>
5585 !! end
5586
5587 !! test
5588 Parsoid link trail escaping
5589 !! options
5590 parsoid=html2wt,html2html
5591 !! wikitext
5592 [[apple]]<nowiki/>s
5593 !! html
5594 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5595 !! end
5596
5597 !! test
5598 Parsoid link prefix escaping
5599 !! options
5600 language=is
5601 parsoid=html2wt,html2html
5602 !! wikitext
5603 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5604 !! html
5605 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5606 !! end
5607
5608 !! test
5609 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5610 !! wikitext
5611 [[Foo| bar]]
5612
5613 [[Foo| ''bar'']]
5614
5615 [http://wp.org foo]
5616
5617 [http://wp.org ''foo'']
5618 !! html
5619 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5620 </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>
5621 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5622 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5623 </p>
5624 !! end
5625
5626 !! test
5627 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5628 !! options
5629 parsoid
5630 !! wikitext
5631 [[Foo|{{echo|a}} b {{echo|c}}]]
5632 !! html
5633 <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>
5634 !! end
5635
5636 ###
5637 ### Interwiki links (see maintenance/interwiki.sql)
5638 ###
5639
5640 !! test
5641 Inline interwiki link
5642 !! wikitext
5643 [[MeatBall:SoftSecurity]]
5644 !! html
5645 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5646 </p>
5647 !! end
5648
5649 !! test
5650 Inline interwiki link with empty title (bug 2372)
5651 !! wikitext
5652 [[MeatBall:]]
5653 !! html
5654 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5655 </p>
5656 !! end
5657
5658 !! test
5659 Interwiki link encoding conversion (bug 1636)
5660 !! wikitext
5661 *[[Wikipedia:ro:Olteni&#0355;a]]
5662 *[[Wikipedia:ro:Olteni&#355;a]]
5663 !! html
5664 <ul>
5665 <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>
5666 </li>
5667 <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>
5668 </li>
5669 </ul>
5670
5671 !! end
5672
5673 !! test
5674 Interwiki link with fragment (bug 2130)
5675 !! wikitext
5676 [[MeatBall:SoftSecurity#foo]]
5677 !! html
5678 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5679 </p>
5680 !! end
5681
5682 # Ideally the wikipedia: prefix here should be proto-relative too
5683 !! test
5684 Different interwiki prefixes mapping to the same URL
5685 !! options
5686 parsoid
5687 !! wikitext
5688 [[wikipedia:Foo]]
5689
5690 [[:en:Foo]]
5691 !! html
5692 <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>
5693
5694 <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>
5695 !! end
5696
5697 !! test
5698 Interwiki links that cannot be represented in wiki syntax
5699 !! options
5700 parsoid
5701 !! wikitext
5702 [[meatball:ok]]
5703 [[meatball:ok#foo|ok with fragment]]
5704 [[meatball:ok_as_well?|ok ending with ? mark]]
5705 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5706 [http://de.wikipedia.org/wiki/#foo is just fragment]
5707
5708 !! html
5709 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5710 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5711 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
5712 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5713 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5714 !! end
5715
5716 !! test
5717 Interwiki links: trail
5718 !! options
5719 parsoid
5720 !! wikitext
5721 [[wikipedia:Foo|Ba]]r
5722 !! html
5723 <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>
5724 !! end
5725
5726 ###
5727 ### Interlanguage links
5728 ### Language links (so that searching for '### language' matches..)
5729 ###
5730
5731 !! test
5732 Interlanguage link
5733 !! wikitext
5734 Blah blah blah
5735 [[zh:Chinese]]
5736 !! html
5737 <p>Blah blah blah
5738 </p>
5739 !! end
5740
5741 !! test
5742 Double interlanguage link
5743 !! wikitext
5744 Blah blah blah
5745 [[es:Spanish]]
5746 [[zh:Chinese]]
5747 !! html
5748 <p>Blah blah blah
5749 </p>
5750 !! end
5751
5752 !! test
5753 Interlanguage link, with prefix links
5754 !! options
5755 language=ln
5756 !! wikitext
5757 Blah blah blah
5758 [[zh:Chinese]]
5759 !! html
5760 <p>Blah blah blah
5761 </p>
5762 !! end
5763
5764 !! test
5765 Double interlanguage link, with prefix links (bug 8897)
5766 !! options
5767 language=ln
5768 !! wikitext
5769 Blah blah blah
5770 [[es:Spanish]]
5771 [[zh:Chinese]]
5772 !! html
5773 <p>Blah blah blah
5774 </p>
5775 !! end
5776
5777 !! test
5778 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5779 !! options
5780 language=ln
5781 !! wikitext
5782 [[WW&nbsp;II]]
5783 !! html
5784 <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>
5785 </p>
5786 !! end
5787
5788 !! test
5789 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5790 !! options
5791 parsoid=html2wt
5792 !! wikitext
5793 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5794
5795 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5796 !! html
5797 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5798 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5799 !! end
5800
5801 !! test
5802 Parsoid: handle constructor well
5803 !! options
5804 parsoid
5805 !! wikitext
5806 [[constructor]]
5807
5808 [[constructor:foo]]
5809 !! html
5810 <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>
5811
5812 <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>
5813 !! end
5814
5815 !! test
5816 Parsoid: recognize interlanguage links without a target page
5817 !! options
5818 parsoid
5819 !! wikitext
5820 [[ko:]]
5821 !! html
5822 <p>
5823 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5824 !! end
5825
5826 !! test
5827 Parsoid: recognize interwiki links without a target page
5828 !! options
5829 parsoid
5830 !! wikitext
5831 [[:ko:]]
5832 !! html
5833 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
5834 !! end
5835
5836 !! test
5837 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
5838 !! options
5839 parsoid
5840 !! wikitext
5841 [[en:Foo]]
5842 !! html
5843 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
5844 !! end
5845
5846 ###
5847 ### Redirects, Parsoid-only
5848 ###
5849 !! test
5850 1. Simple redirect to page
5851 !! options
5852 parsoid
5853 !! wikitext
5854 #REDIRECT [[Main Page]]
5855 !! html
5856 <link rel="mw:PageProp/redirect" href="./Main_Page">
5857 !! end
5858
5859 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
5860 !! test
5861 2. Other redirect variants
5862 !! options
5863 parsoid=wt2html,wt2wt
5864 !! wikitext
5865 #REDIRECT [[Main_Page]]
5866 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
5867 !! html
5868 <link rel="mw:PageProp/redirect" href="./Main_Page">
5869 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
5870 !! end
5871
5872 !! test
5873 Optional colon in #REDIRECT
5874 !! options
5875 # the colon is archaic syntax. we support it for wt2html, but we
5876 # don't care that it roundtrips back to the modern syntax.
5877 parsoid=wt2html,html2html
5878 !! wikitext
5879 #REDIRECT:[[Main Page]]
5880 !! html
5881 <link rel="mw:PageProp/redirect" href="./Main_Page">
5882 !! end
5883
5884 !! test
5885 Whitespace in #REDIRECT with optional colon
5886 !! options
5887 # the colon and gratuitous whitespace is archaic syntax. we support
5888 # it for wt2html, but we don't care that it roundtrips back to the
5889 # modern syntax (without extra whitespace)
5890 parsoid=wt2html,html2html
5891 !! wikitext
5892
5893 #REDIRECT
5894 :
5895 [[Main Page]]
5896 !! html
5897 <link rel="mw:PageProp/redirect" href="./Main_Page">
5898 !! end
5899
5900 !! test
5901 Piped link in #REDIRECT
5902 !! options
5903 # content after piped link is ignored. we support this syntax,
5904 # but don't care that the piped link is lost when we roundtrip this.
5905 parsoid=wt2html
5906 !! wikitext
5907 #REDIRECT [[Main Page|bar]]
5908 !! html
5909 <link rel="mw:PageProp/redirect" href="./Main_Page">
5910 !! end
5911
5912 !! test
5913 Redirect to category
5914 !! options
5915 parsoid=wt2html
5916 !! wikitext
5917 #REDIRECT [[Category:Foo]]
5918 !! html
5919 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5920 !! end
5921
5922 !! test
5923 Redirect to category with URL encoding
5924 !! options
5925 parsoid=wt2html
5926 !! wikitext
5927 #REDIRECT [[Category%3AFoo]]
5928 !! html
5929 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5930 !! end
5931
5932 !! test
5933 Redirect to category page
5934 !! options
5935 parsoid=wt2html,html2html
5936 !! wikitext
5937 #REDIRECT [[:Category:Foo]]
5938 !! html
5939 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5940 !! end
5941
5942 !! test
5943 Redirect to image page (1)
5944 !! options
5945 parsoid
5946 !! wikitext
5947 #REDIRECT [[File:Wiki.png]]
5948 !! html
5949 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5950 !! end
5951
5952 !! test
5953 Redirect to image page (2)
5954 !! options
5955 parsoid
5956 !! wikitext
5957 #REDIRECT [[Image:Wiki.png]]
5958 !! html
5959 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5960 !! end
5961
5962 !! test
5963 Redirect to language
5964 !! options
5965 parsoid
5966 !! wikitext
5967 #REDIRECT [[en:File:Wiki.png]]
5968 !! html
5969 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5970 !! end
5971
5972 !! test
5973 Redirect to interwiki
5974 !! options
5975 parsoid
5976 !! wikitext
5977 #REDIRECT [[meatball:File:Wiki.png]]
5978 !! html
5979 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5980 !! end
5981
5982 !! test
5983 Non-English #REDIRECT
5984 !! options
5985 parsoid
5986 language=is
5987 !! wikitext
5988 #TILVÍSUN [[Main Page]]
5989 !! html
5990 <link rel="mw:PageProp/redirect" href="./Main_Page">
5991 !! end
5992
5993 !! test
5994 New redirect
5995 !! options
5996 parsoid=html2wt
5997 !! wikitext
5998 Foo
5999 #REDIRECT [[Foo]]
6000 !! html
6001 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6002 !! end
6003
6004 ##
6005 ## XHTML tidiness
6006 ###
6007
6008 !! test
6009 <br> to <br />
6010 !! wikitext
6011 1<br>2<br />3
6012 !! html
6013 <p>1<br />2<br />3
6014 </p>
6015 !! end
6016
6017 !! test
6018 Broken br tag sanitization
6019 !! wikitext
6020 </br>
6021 !! html/php
6022 <p>&lt;/br&gt;
6023 </p>
6024 !! end
6025
6026 # TODO: Fix html2html mode (bug 51055)!
6027 !! test
6028 Parsoid: Broken br tag recognition
6029 !! options
6030 parsoid=wt2html
6031 !! wikitext
6032 </br>
6033 !! html/parsoid
6034 <p><br></p>
6035 !! end
6036
6037 !! test
6038 Incorrecly removing closing slashes from correctly formed XHTML
6039 !! wikitext
6040 <br style="clear:both;" />
6041 !! html
6042 <p><br style="clear:both;" />
6043 </p>
6044 !! end
6045
6046 !! test
6047 Failing to transform badly formed HTML into correct XHTML
6048 !! wikitext
6049 <br style="clear: left;">
6050 <br style="clear: right;">
6051 <br style="clear: both;">
6052 !! html
6053 <p><br style="clear: left;" />
6054 <br style="clear: right;" />
6055 <br style="clear: both;" />
6056 </p>
6057 !!end
6058
6059 !! test
6060 Handling html with a div self-closing tag
6061 !! wikitext
6062 <div title />
6063 <div title/>
6064 <div title/ >
6065 <div title=bar />
6066 <div title=bar/>
6067 <div title=bar/ >
6068 !! html
6069 <p>&lt;div title /&gt;
6070 &lt;div title/&gt;
6071 </p>
6072 <div>
6073 <p>&lt;div title=bar /&gt;
6074 &lt;div title=bar/&gt;
6075 </p>
6076 <div title="bar/"></div>
6077 </div>
6078
6079 !! end
6080
6081 !! test
6082 Handling html with a br self-closing tag
6083 !! wikitext
6084 <br title />
6085 <br title/>
6086 <br title/ >
6087 <br title=bar />
6088 <br title=bar/>
6089 <br title=bar/ >
6090 !! html
6091 <p><br title="title" />
6092 <br title="title" />
6093 <br />
6094 <br title="bar" />
6095 <br title="bar" />
6096 <br title="bar/" />
6097 </p>
6098 !! end
6099
6100 !! test
6101 Horizontal ruler (should it add that extra space?)
6102 !! wikitext
6103 <hr>
6104 <hr >
6105 foo <hr
6106 > bar
6107 !! html
6108 <hr />
6109 <hr />
6110 foo <hr /> bar
6111
6112 !! end
6113
6114 !! test
6115 Horizontal ruler -- 4+ dashes render hr
6116 !! wikitext
6117 ----
6118 !! html
6119 <hr />
6120
6121 !! end
6122
6123 !! test
6124 Horizontal ruler -- eats additional dashes on the same line
6125 !! wikitext
6126 ---------
6127 !! html
6128 <hr />
6129
6130 !! end
6131
6132 !! test
6133 Horizontal ruler -- does not collapse dashes on consecutive lines
6134 !! wikitext
6135 ----
6136 ----
6137 !! html
6138 <hr />
6139 <hr />
6140
6141 !! end
6142
6143 !! test
6144 Horizontal ruler -- <4 dashes render as plain text
6145 !! wikitext
6146 ---
6147 !! html
6148 <p>---
6149 </p>
6150 !! end
6151
6152 !! test
6153 Horizontal ruler -- Supports content following dashes on same line
6154 !! wikitext
6155 ---- Foo
6156 !! html
6157 <hr /> Foo
6158
6159 !! end
6160
6161 ###
6162 ### Block-level elements
6163 ###
6164 !! test
6165 Common list
6166 !! wikitext
6167 *Common list
6168 * item 2
6169 *item 3
6170 !! html
6171 <ul>
6172 <li>Common list
6173 </li>
6174 <li> item 2
6175 </li>
6176 <li>item 3
6177 </li>
6178 </ul>
6179
6180 !! end
6181
6182 !! test
6183 Numbered list
6184 !! wikitext
6185 #Numbered list
6186 #item 2
6187 # item 3
6188 !! html
6189 <ol>
6190 <li>Numbered list
6191 </li>
6192 <li>item 2
6193 </li>
6194 <li> item 3
6195 </li>
6196 </ol>
6197
6198 !! end
6199
6200 !! test
6201 Mixed list
6202 !! wikitext
6203 *Mixed list
6204 *# with numbers
6205 ** and bullets
6206 *# and numbers
6207 *bullets again
6208 **bullet level 2
6209 ***bullet level 3
6210 ***#Number on level 4
6211 **bullet level 2
6212 **#Number on level 3
6213 **#Number on level 3
6214 *#number level 2
6215 *Level 1
6216 *** Level 3
6217 #** Level 3, but ordered
6218 !! html
6219 <ul>
6220 <li>Mixed list
6221 <ol>
6222 <li> with numbers
6223 </li>
6224 </ol>
6225 <ul>
6226 <li> and bullets
6227 </li>
6228 </ul>
6229 <ol>
6230 <li> and numbers
6231 </li>
6232 </ol>
6233 </li>
6234 <li>bullets again
6235 <ul>
6236 <li>bullet level 2
6237 <ul>
6238 <li>bullet level 3
6239 <ol>
6240 <li>Number on level 4
6241 </li>
6242 </ol>
6243 </li>
6244 </ul>
6245 </li>
6246 <li>bullet level 2
6247 <ol>
6248 <li>Number on level 3
6249 </li>
6250 <li>Number on level 3
6251 </li>
6252 </ol>
6253 </li>
6254 </ul>
6255 <ol>
6256 <li>number level 2
6257 </li>
6258 </ol>
6259 </li>
6260 <li>Level 1
6261 <ul>
6262 <li><ul>
6263 <li> Level 3
6264 </li>
6265 </ul>
6266 </li>
6267 </ul>
6268 </li>
6269 </ul>
6270 <ol>
6271 <li><ul>
6272 <li><ul>
6273 <li> Level 3, but ordered
6274 </li>
6275 </ul>
6276 </li>
6277 </ul>
6278 </li>
6279 </ol>
6280
6281 !! end
6282
6283 !! test
6284 Nested lists 1
6285 !! wikitext
6286 *foo
6287 **bar
6288 !! html
6289 <ul>
6290 <li>foo
6291 <ul>
6292 <li>bar
6293 </li>
6294 </ul>
6295 </li>
6296 </ul>
6297
6298 !! end
6299
6300 !! test
6301 Nested lists 2
6302 !! wikitext
6303 **foo
6304 *bar
6305 !! html
6306 <ul>
6307 <li><ul>
6308 <li>foo
6309 </li>
6310 </ul>
6311 </li>
6312 <li>bar
6313 </li>
6314 </ul>
6315
6316 !! end
6317
6318 !! test
6319 Nested lists 3 (first element empty)
6320 !! wikitext
6321 *
6322 **bar
6323 !! html
6324 <ul>
6325 <li>
6326 <ul>
6327 <li>bar
6328 </li>
6329 </ul>
6330 </li>
6331 </ul>
6332
6333 !! end
6334
6335 !! test
6336 Nested lists 4 (first element empty)
6337 !! wikitext
6338 **
6339 *bar
6340 !! html
6341 <ul>
6342 <li><ul>
6343 <li>
6344 </li>
6345 </ul>
6346 </li>
6347 <li>bar
6348 </li>
6349 </ul>
6350
6351 !! end
6352
6353 !! test
6354 Nested lists 5 (both elements empty)
6355 !! wikitext
6356 **
6357 *
6358 !! html
6359 <ul>
6360 <li><ul>
6361 <li>
6362 </li>
6363 </ul>
6364 </li>
6365 <li>
6366 </li>
6367 </ul>
6368
6369 !! end
6370
6371 !! test
6372 Nested lists 6 (both elements empty)
6373 !! wikitext
6374 *
6375 **
6376 !! html
6377 <ul>
6378 <li>
6379 <ul>
6380 <li>
6381 </li>
6382 </ul>
6383 </li>
6384 </ul>
6385
6386 !! end
6387
6388 !! test
6389 Nested lists 7 (skip initial nesting levels)
6390 !! wikitext
6391 *** foo
6392 !! html
6393 <ul>
6394 <li><ul>
6395 <li><ul>
6396 <li> foo
6397 </li>
6398 </ul>
6399 </li>
6400 </ul>
6401 </li>
6402 </ul>
6403
6404 !! end
6405
6406 !! test
6407 Nested lists 8 (multiple nesting transitions)
6408 !! wikitext
6409 * foo
6410 *** bar
6411 ** baz
6412 * boo
6413 !! html
6414 <ul>
6415 <li> foo
6416 <ul>
6417 <li><ul>
6418 <li> bar
6419 </li>
6420 </ul>
6421 </li>
6422 <li> baz
6423 </li>
6424 </ul>
6425 </li>
6426 <li> boo
6427 </li>
6428 </ul>
6429
6430 !! end
6431
6432 !! test
6433 1. Lists with start-of-line-transparent tokens before bullets: Comments
6434 !! wikitext
6435 *foo
6436 *<!--cmt-->bar
6437 <!--cmt-->*baz
6438 !! html
6439 <ul>
6440 <li>foo
6441 </li>
6442 <li>bar
6443 </li>
6444 <li>baz
6445 </li>
6446 </ul>
6447
6448 !! end
6449
6450 !! test
6451 2. Lists with start-of-line-transparent tokens before bullets: Template close
6452 !! wikitext
6453 *foo {{echo|bar
6454 }}*baz
6455 !! html
6456 <ul>
6457 <li>foo bar
6458 </li>
6459 <li>baz
6460 </li>
6461 </ul>
6462
6463 !! end
6464
6465 !! test
6466 List items are not parsed correctly following a <pre> block (bug 785)
6467 !! wikitext
6468 * <pre>foo</pre>
6469 * <pre>bar</pre>
6470 * zar
6471 !! html
6472 <ul>
6473 <li> <pre>foo</pre>
6474 </li>
6475 <li> <pre>bar</pre>
6476 </li>
6477 <li> zar
6478 </li>
6479 </ul>
6480
6481 !! end
6482
6483 !! test
6484 List items from template
6485 !! wikitext
6486
6487 {{inner list}}
6488 * item 2
6489
6490 * item 0
6491 {{inner list}}
6492 * item 2
6493
6494 * item 0
6495 * notSOL{{inner list}}
6496 * item 2
6497 !! html
6498 <ul>
6499 <li> item 1
6500 </li>
6501 <li> item 2
6502 </li>
6503 </ul>
6504 <ul>
6505 <li> item 0
6506 </li>
6507 <li> item 1
6508 </li>
6509 <li> item 2
6510 </li>
6511 </ul>
6512 <ul>
6513 <li> item 0
6514 </li>
6515 <li> notSOL
6516 </li>
6517 <li> item 1
6518 </li>
6519 <li> item 2
6520 </li>
6521 </ul>
6522
6523 !! end
6524
6525 !! test
6526 List interrupted by empty line or heading
6527 !! wikitext
6528 * foo
6529
6530 ** bar
6531 == A heading ==
6532 * Another list item
6533 !! html
6534 <ul>
6535 <li> foo
6536 </li>
6537 </ul>
6538 <ul>
6539 <li><ul>
6540 <li> bar
6541 </li>
6542 </ul>
6543 </li>
6544 </ul>
6545 <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>
6546 <ul>
6547 <li> Another list item
6548 </li>
6549 </ul>
6550
6551 !!end
6552
6553 !!test
6554 Multiple list tags generated by templates
6555 !! wikitext
6556 {{echo|<li>}}a
6557 {{echo|<li>}}b
6558 {{echo|<li>}}c
6559 !! html
6560 <li>a
6561 <li>b
6562 <li>c</li>
6563 </li>
6564 </li>
6565
6566 !!end
6567
6568 !!test
6569 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6570 !! wikitext
6571 *a
6572 <!--This line will NOT split the list-->
6573 *b
6574 <!--This line will NOT split the list either-->
6575 *c
6576 <!--foo--> <!----> <!--This line NOT split the list either-->
6577 *d
6578 !! html
6579 <ul>
6580 <li>a
6581 </li>
6582 <li>b
6583 </li>
6584 <li>c
6585 </li>
6586 <li>d
6587 </li>
6588 </ul>
6589
6590 !!end
6591
6592 !!test
6593 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6594 !! wikitext
6595 *a
6596 <!--This line will NOT split the list-->
6597 *b
6598 <!--This line will NOT split the list either-->
6599 *c
6600 <!--foo--> <!----> <!--This line NOT split the list
6601 either-->
6602 *d
6603 !! html
6604 <ul>
6605 <li>a
6606 </li>
6607 <li>b
6608 </li>
6609 <li>c
6610 </li>
6611 <li>d
6612 </li>
6613 </ul>
6614
6615 !!end
6616
6617 !!test
6618 Test the li-hack
6619 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6620 !!options
6621 parsoid=wt2html,wt2wt
6622 !! wikitext
6623 * foo
6624 * <li>li-hack
6625 * {{echo|<li>templated li-hack}}
6626 * <!--foo--> <li> unsupported li-hack with preceding comments
6627
6628 <ul>
6629 <li><li>not a li-hack
6630 </li>
6631 </ul>
6632 !! html
6633 <ul>
6634 <li> foo</li>
6635 <li>li-hack</li>
6636 <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>
6637 <li> <!--foo--> </li>
6638 <li> li-hack with preceding comments</li>
6639 </ul>
6640
6641 <ul>
6642 <li></li>
6643 <li>not a li-hack
6644 </li>
6645 </ul>
6646 !!end
6647
6648 !! test
6649 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6650 !! options
6651 parsoid
6652 !! wikitext
6653 # foo
6654 ## bar
6655 * foo
6656 ** bar
6657 : foo
6658 :: bar
6659 !! html
6660 <ol>
6661 <li> foo<ol>
6662 <li> bar</li>
6663 </ol></li>
6664 </ol><ul>
6665 <li> foo<ul>
6666 <li> bar</li>
6667 </ul></li>
6668 </ul><dl>
6669 <dd> foo<dl>
6670 <dd> bar</dd>
6671 </dl></dd>
6672 </dl>
6673 !! end
6674
6675 !! test
6676 Parsoid: Test of whitespace serialization with Templated bullets
6677 !! options
6678 parsoid
6679 !! wikitext
6680 * {{bullet}}
6681 !! html
6682 <ul>
6683 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6684 </ul>
6685 !! end
6686
6687 # ------------------------------------------------------------------------
6688 # The next set of tests are about Parsoid's ability to handle badly nested
6689 # tags (parse, minimize scope of fixup, and roundtrip back)
6690 # ------------------------------------------------------------------------
6691
6692 !! test
6693 Unbalanced closing block tags break a list
6694 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6695 !! wikitext
6696 <div>
6697 *a</div><div>
6698 *b</div>
6699 !! html/parsoid
6700 <div>
6701 <ul>
6702 <li>a
6703 </li>
6704 </ul></div><div>
6705 <ul>
6706 <li>b
6707 </li>
6708 </ul></div>
6709 !! end
6710
6711 !! test
6712 Unbalanced closing non-block tags don't break a list
6713 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6714 !! wikitext
6715 <span>
6716 *a</span><span>
6717 *b</span>
6718 !! html/parsoid
6719 <p><span></span>
6720 </p>
6721 <ul>
6722 <li>a<span></span>
6723 </li>
6724 <li>b
6725 </li>
6726 </ul>
6727 !! end
6728
6729 !! test
6730 Unclosed formatting tags that straddle lists are closed and reopened
6731 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6732 !! wikitext
6733 # <s> a
6734 # b </s>
6735 !! html/parsoid
6736 <ol>
6737 <li> <s> a </s>
6738 </li>
6739 <li> <s> b </s>
6740 </li>
6741 </ol>
6742 !! end
6743
6744 !!test
6745 List embedded in a non-block tag
6746 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6747 !! wikitext
6748 <small>
6749 * foo
6750 </small>
6751 !! html/parsoid
6752 <p><small></small></p>
6753 <small>
6754 <ul>
6755 <li> foo</li>
6756 </ul>
6757 </small>
6758 <p><small></small></p>
6759 !!end
6760
6761 !! test
6762 Table with missing opening <tr> tag
6763 !! options
6764 parsoid=wt2html,wt2wt
6765 !! wikitext
6766 <table>
6767 <td>foo</td>
6768 </tr>
6769 </table>
6770 !! html/parsoid
6771 <table>
6772 <tr>
6773 <td>foo</td>
6774 </tr>
6775 </table>
6776 !! end
6777
6778 ###
6779 ### Magic Words
6780 ###
6781
6782 # Note that the current date is hard-coded as
6783 # 1970-01-01T00:02:03Z (a Thursday)
6784 # when running parser tests. The timezone is also fixed to GMT, so
6785 # local date will be identical to current date.
6786
6787 !! test
6788 Magic Word: {{CURRENTDAY}}
6789 !! wikitext
6790 {{CURRENTDAY}}
6791 !! html
6792 <p>1
6793 </p>
6794 !! end
6795
6796 !! test
6797 Magic Word: {{CURRENTDAY2}}
6798 !! wikitext
6799 {{CURRENTDAY2}}
6800 !! html
6801 <p>01
6802 </p>
6803 !! end
6804
6805 !! test
6806 Magic Word: {{CURRENTDAYNAME}}
6807 !! wikitext
6808 {{CURRENTDAYNAME}}
6809 !! html
6810 <p>Thursday
6811 </p>
6812 !! end
6813
6814 !! test
6815 Magic Word: {{CURRENTDOW}}
6816 !! wikitext
6817 {{CURRENTDOW}}
6818 !! html
6819 <p>4
6820 </p>
6821 !! end
6822
6823 !! test
6824 Magic Word: {{CURRENTMONTH}}
6825 !! wikitext
6826 {{CURRENTMONTH}}
6827 !! html
6828 <p>01
6829 </p>
6830 !! end
6831
6832 !! test
6833 Magic Word: {{CURRENTMONTH1}}
6834 !! wikitext
6835 {{CURRENTMONTH1}}
6836 !! html
6837 <p>1
6838 </p>
6839 !! end
6840
6841 !! test
6842 Magic Word: {{CURRENTMONTHABBREV}}
6843 !! wikitext
6844 {{CURRENTMONTHABBREV}}
6845 !! html
6846 <p>Jan
6847 </p>
6848 !! end
6849
6850 !! test
6851 Magic Word: {{CURRENTMONTHNAME}}
6852 !! wikitext
6853 {{CURRENTMONTHNAME}}
6854 !! html
6855 <p>January
6856 </p>
6857 !! end
6858
6859 !! test
6860 Magic Word: {{CURRENTMONTHNAMEGEN}}
6861 !! wikitext
6862 {{CURRENTMONTHNAMEGEN}}
6863 !! html
6864 <p>January
6865 </p>
6866 !! end
6867
6868 !! test
6869 Magic Word: {{CURRENTTIME}}
6870 !! wikitext
6871 {{CURRENTTIME}}
6872 !! html
6873 <p>00:02
6874 </p>
6875 !! end
6876
6877 !! test
6878 Magic Word: {{CURRENTHOUR}}
6879 !! wikitext
6880 {{CURRENTHOUR}}
6881 !! html
6882 <p>00
6883 </p>
6884 !! end
6885
6886 !! test
6887 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6888 !! wikitext
6889 {{CURRENTWEEK}}
6890 !! html
6891 <p>1
6892 </p>
6893 !! end
6894
6895 !! test
6896 Magic Word: {{CURRENTYEAR}}
6897 !! wikitext
6898 {{CURRENTYEAR}}
6899 !! html
6900 <p>1970
6901 </p>
6902 !! end
6903
6904 !! test
6905 Magic Word: {{CURRENTTIMESTAMP}}
6906 !! wikitext
6907 {{CURRENTTIMESTAMP}}
6908 !! html
6909 <p>19700101000203
6910 </p>
6911 !! end
6912
6913 !! test
6914 Magic Words LOCAL (UTC)
6915 !! wikitext
6916 * {{LOCALMONTH}}
6917 * {{LOCALMONTH1}}
6918 * {{LOCALMONTHNAME}}
6919 * {{LOCALMONTHNAMEGEN}}
6920 * {{LOCALMONTHABBREV}}
6921 * {{LOCALDAY}}
6922 * {{LOCALDAY2}}
6923 * {{LOCALDAYNAME}}
6924 * {{LOCALYEAR}}
6925 * {{LOCALTIME}}
6926 * {{LOCALHOUR}}
6927 * {{LOCALWEEK}}
6928 * {{LOCALDOW}}
6929 * {{LOCALTIMESTAMP}}
6930 !! html
6931 <ul>
6932 <li> 01
6933 </li>
6934 <li> 1
6935 </li>
6936 <li> January
6937 </li>
6938 <li> January
6939 </li>
6940 <li> Jan
6941 </li>
6942 <li> 1
6943 </li>
6944 <li> 01
6945 </li>
6946 <li> Thursday
6947 </li>
6948 <li> 1970
6949 </li>
6950 <li> 00:02
6951 </li>
6952 <li> 00
6953 </li>
6954 <li> 1
6955 </li>
6956 <li> 4
6957 </li>
6958 <li> 19700101000203
6959 </li>
6960 </ul>
6961
6962 !! end
6963
6964 !! test
6965 Magic Word: {{FULLPAGENAME}}
6966 !! options
6967 title=[[User:Ævar Arnfjörð Bjarmason]]
6968 !! wikitext
6969 {{FULLPAGENAME}}
6970 !! html
6971 <p>User:Ævar Arnfjörð Bjarmason
6972 </p>
6973 !! end
6974
6975 !! test
6976 Magic Word: {{FULLPAGENAMEE}}
6977 !! options
6978 title=[[User:Ævar Arnfjörð Bjarmason]]
6979 !! wikitext
6980 {{FULLPAGENAMEE}}
6981 !! html
6982 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6983 </p>
6984 !! end
6985
6986 !! test
6987 Magic Word: {{TALKSPACE}}
6988 !! options
6989 title=[[User:Ævar Arnfjörð Bjarmason]]
6990 !! wikitext
6991 {{TALKSPACE}}
6992 !! html
6993 <p>User talk
6994 </p>
6995 !! end
6996
6997 !! test
6998 Magic Word: {{TALKSPACE}}, same namespace
6999 !! options
7000 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7001 !! wikitext
7002 {{TALKSPACE}}
7003 !! html
7004 <p>User talk
7005 </p>
7006 !! end
7007
7008 !! test
7009 Magic Word: {{TALKSPACE}}, main namespace
7010 !! options
7011 title=[[Parser Test]]
7012 !! wikitext
7013 {{TALKSPACE}}
7014 !! html
7015 <p>Talk
7016 </p>
7017 !! end
7018
7019 !! test
7020 Magic Word: {{TALKSPACEE}}
7021 !! options
7022 title=[[User:Ævar Arnfjörð Bjarmason]]
7023 !! wikitext
7024 {{TALKSPACEE}}
7025 !! html
7026 <p>User_talk
7027 </p>
7028 !! end
7029
7030 !! test
7031 Magic Word: {{SUBJECTSPACE}}
7032 !! options
7033 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7034 !! wikitext
7035 {{SUBJECTSPACE}}
7036 !! html
7037 <p>User
7038 </p>
7039 !! end
7040
7041 !! test
7042 Magic Word: {{SUBJECTSPACE}}, same namespace
7043 !! options
7044 title=[[User:Ævar Arnfjörð Bjarmason]]
7045 !! wikitext
7046 {{SUBJECTSPACE}}
7047 !! html
7048 <p>User
7049 </p>
7050 !! end
7051
7052 !! test
7053 Magic Word: {{SUBJECTSPACE}}, main namespace
7054 !! options
7055 title=[[Parser Test]]
7056 !! wikitext
7057 {{SUBJECTSPACE}}
7058 !! html
7059
7060 !! end
7061
7062 !! test
7063 Magic Word: {{SUBJECTSPACEE}}
7064 !! options
7065 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7066 !! wikitext
7067 {{SUBJECTSPACEE}}
7068 !! html
7069 <p>User
7070 </p>
7071 !! end
7072
7073 !! test
7074 Magic Word: {{NAMESPACE}}
7075 !! options
7076 title=[[User:Ævar Arnfjörð Bjarmason]]
7077 !! wikitext
7078 {{NAMESPACE}}
7079 !! html
7080 <p>User
7081 </p>
7082 !! end
7083
7084 !! test
7085 Magic Word: {{NAMESPACEE}}
7086 !! options
7087 title=[[User:Ævar Arnfjörð Bjarmason]]
7088 !! wikitext
7089 {{NAMESPACEE}}
7090 !! html
7091 <p>User
7092 </p>
7093 !! end
7094
7095 !! test
7096 Magic Word: {{NAMESPACENUMBER}}
7097 !! options
7098 title=[[User:Ævar Arnfjörð Bjarmason]]
7099 !! wikitext
7100 {{NAMESPACENUMBER}}
7101 !! html
7102 <p>2
7103 </p>
7104 !! end
7105
7106 !! test
7107 Magic Word: {{SUBPAGENAME}}
7108 !! options
7109 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7110 !! wikitext
7111 {{SUBPAGENAME}}
7112 !! html
7113 <p>sub ö
7114 </p>
7115 !! end
7116
7117 !! test
7118 Magic Word: {{SUBPAGENAMEE}}
7119 !! options
7120 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7121 !! wikitext
7122 {{SUBPAGENAMEE}}
7123 !! html
7124 <p>sub_%C3%B6
7125 </p>
7126 !! end
7127
7128 !! test
7129 Magic Word: {{ROOTPAGENAME}}
7130 !! options
7131 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7132 !! wikitext
7133 {{ROOTPAGENAME}}
7134 !! html
7135 <p>Ævar Arnfjörð Bjarmason
7136 </p>
7137 !! end
7138
7139 !! test
7140 Magic Word: {{ROOTPAGENAMEE}}
7141 !! options
7142 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7143 !! wikitext
7144 {{ROOTPAGENAMEE}}
7145 !! html
7146 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7147 </p>
7148 !! end
7149
7150 !! test
7151 Magic Word: {{BASEPAGENAME}}
7152 !! options
7153 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7154 !! wikitext
7155 {{BASEPAGENAME}}
7156 !! html
7157 <p>Ævar Arnfjörð Bjarmason
7158 </p>
7159 !! end
7160
7161 !! test
7162 Magic Word: {{BASEPAGENAMEE}}
7163 !! options
7164 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7165 !! wikitext
7166 {{BASEPAGENAMEE}}
7167 !! html
7168 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7169 </p>
7170 !! end
7171
7172 !! test
7173 Magic Word: {{TALKPAGENAME}}
7174 !! options
7175 title=[[User:Ævar Arnfjörð Bjarmason]]
7176 !! wikitext
7177 {{TALKPAGENAME}}
7178 !! html
7179 <p>User talk:Ævar Arnfjörð Bjarmason
7180 </p>
7181 !! end
7182
7183 !! test
7184 Magic Word: {{TALKPAGENAMEE}}
7185 !! options
7186 title=[[User:Ævar Arnfjörð Bjarmason]]
7187 !! wikitext
7188 {{TALKPAGENAMEE}}
7189 !! html
7190 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7191 </p>
7192 !! end
7193
7194 !! test
7195 Magic Word: {{SUBJECTPAGENAME}}
7196 !! options
7197 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7198 !! wikitext
7199 {{SUBJECTPAGENAME}}
7200 !! html
7201 <p>User:Ævar Arnfjörð Bjarmason
7202 </p>
7203 !! end
7204
7205 !! test
7206 Magic Word: {{SUBJECTPAGENAMEE}}
7207 !! options
7208 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7209 !! wikitext
7210 {{SUBJECTPAGENAMEE}}
7211 !! html
7212 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7213 </p>
7214 !! end
7215
7216 !! test
7217 Magic Word: {{NUMBEROFFILES}}
7218 !! wikitext
7219 {{NUMBEROFFILES}}
7220 !! html
7221 <p>4
7222 </p>
7223 !! end
7224
7225 !! test
7226 Magic Word: {{PAGENAME}}
7227 !! options
7228 title=[[User:Ævar Arnfjörð Bjarmason]]
7229 !! wikitext
7230 {{PAGENAME}}
7231 !! html
7232 <p>Ævar Arnfjörð Bjarmason
7233 </p>
7234 !! end
7235
7236 !! test
7237 Magic Word: {{PAGENAME}} with metacharacters
7238 !! options
7239 title=[['foo & bar = baz']]
7240 !! wikitext
7241 ''{{PAGENAME}}''
7242 !! html
7243 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7244 </p>
7245 !! end
7246
7247 !! test
7248 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7249 !! options
7250 title=[[*RFC 1234 http://example.com/]]
7251 !! wikitext
7252 {{PAGENAME}}
7253 !! html
7254 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7255 </p>
7256 !! end
7257
7258 !! test
7259 Magic Word: {{PAGENAMEE}}
7260 !! options
7261 title=[[User:Ævar Arnfjörð Bjarmason]]
7262 !! wikitext
7263 {{PAGENAMEE}}
7264 !! html
7265 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7266 </p>
7267 !! end
7268
7269 !! test
7270 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7271 !! options
7272 title=[[*RFC 1234 http://example.com/]]
7273 !! wikitext
7274 {{PAGENAMEE}}
7275 !! html
7276 <p>&#42;RFC_1234_http&#58;//example.com/
7277 </p>
7278 !! end
7279
7280 !! test
7281 Magic Word: {{REVISIONID}}
7282 !! wikitext
7283 {{REVISIONID}}
7284 !! html
7285 <p>1337
7286 </p>
7287 !! end
7288
7289 !! test
7290 Magic Word: {{SCRIPTPATH}}
7291 !! wikitext
7292 {{SCRIPTPATH}}
7293 !! html
7294 <p>/
7295 </p>
7296 !! end
7297
7298 !! test
7299 Magic Word: {{STYLEPATH}}
7300 !! wikitext
7301 {{STYLEPATH}}
7302 !! html
7303 <p>/skins
7304 </p>
7305 !! end
7306
7307 !! test
7308 Magic Word: {{SERVER}}
7309 !! wikitext
7310 {{SERVER}}
7311 !! html
7312 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7313 </p>
7314 !! end
7315
7316 !! test
7317 Magic Word: {{SERVERNAME}}
7318 !! wikitext
7319 {{SERVERNAME}}
7320 !! html
7321 <p>example.org
7322 </p>
7323 !! end
7324
7325 !! test
7326 Magic Word: {{SITENAME}}
7327 !! wikitext
7328 {{SITENAME}}
7329 !! html
7330 <p>MediaWiki
7331 </p>
7332 !! end
7333
7334 !! test
7335 Case-sensitive magic words, when cased differently, should just be template transclusions
7336 !! wikitext
7337 {{CurrentMonth}}
7338 {{currentday}}
7339 {{cURreNTweEK}}
7340 {{currentHour}}
7341 !! html
7342 <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>
7343 <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>
7344 <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>
7345 <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>
7346 </p>
7347 !! end
7348
7349 !! test
7350 Case-insensitive magic words should still work with weird casing.
7351 !! wikitext
7352 {{sErVeRNaMe}}
7353 {{LCFirst:AOEU}}
7354 {{ucFIRST:aoeu}}
7355 {{SERver}}
7356 !! html
7357 <p>example.org
7358 aOEU
7359 Aoeu
7360 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7361 </p>
7362 !! end
7363
7364 !! test
7365 Namespace 1 {{ns:1}}
7366 !! wikitext
7367 {{ns:1}}
7368 !! html
7369 <p>Talk
7370 </p>
7371 !! end
7372
7373 !! test
7374 Namespace 1 {{ns:01}}
7375 !! wikitext
7376 {{ns:01}}
7377 !! html
7378 <p>Talk
7379 </p>
7380 !! end
7381
7382 !! test
7383 Namespace 0 {{ns:0}} (bug 4783)
7384 !! wikitext
7385 {{ns:0}}
7386 !! html
7387
7388 !! end
7389
7390 !! test
7391 Namespace 0 {{ns:00}} (bug 4783)
7392 !! wikitext
7393 {{ns:00}}
7394 !! html
7395
7396 !! end
7397
7398 !! test
7399 Namespace -1 {{ns:-1}}
7400 !! wikitext
7401 {{ns:-1}}
7402 !! html
7403 <p>Special
7404 </p>
7405 !! end
7406
7407 !! test
7408 Namespace User {{ns:User}}
7409 !! wikitext
7410 {{ns:User}}
7411 !! html
7412 <p>User
7413 </p>
7414 !! end
7415
7416 !! test
7417 Namespace User talk {{ns:User_talk}}
7418 !! wikitext
7419 {{ns:User_talk}}
7420 !! html
7421 <p>User talk
7422 </p>
7423 !! end
7424
7425 !! test
7426 Namespace User talk {{ns:uSeR tAlK}}
7427 !! wikitext
7428 {{ns:uSeR tAlK}}
7429 !! html
7430 <p>User talk
7431 </p>
7432 !! end
7433
7434 !! test
7435 Namespace File {{ns:File}}
7436 !! wikitext
7437 {{ns:File}}
7438 !! html
7439 <p>File
7440 </p>
7441 !! end
7442
7443 !! test
7444 Namespace File {{ns:Image}}
7445 !! wikitext
7446 {{ns:Image}}
7447 !! html
7448 <p>File
7449 </p>
7450 !! end
7451
7452 !! test
7453 Namespace (lang=de) Benutzer {{ns:User}}
7454 !! options
7455 language=de
7456 !! wikitext
7457 {{ns:User}}
7458 !! html
7459 <p>Benutzer
7460 </p>
7461 !! end
7462
7463 !! test
7464 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7465 !! options
7466 language=de
7467 !! wikitext
7468 {{ns:3}}
7469 !! html
7470 <p>Benutzer Diskussion
7471 </p>
7472 !! end
7473
7474
7475 !! test
7476 Urlencode
7477 !! wikitext
7478 {{urlencode:hi world?!}}
7479 {{urlencode:hi world?!|WIKI}}
7480 {{urlencode:hi world?!|PATH}}
7481 {{urlencode:hi world?!|QUERY}}
7482 !! html
7483 <p>hi+world%3F%21
7484 hi_world%3F!
7485 hi%20world%3F%21
7486 hi+world%3F%21
7487 </p>
7488 !! end
7489
7490 !! test
7491 Magic Word: prioritize type info over data-parsoid
7492 !! options
7493 parsoid=html2wt
7494 !! wikitext
7495 __FORCETOC__
7496 !! html
7497 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7498 !! end
7499
7500 !! test
7501 Magic Word: serialize on separate line (parsoid)
7502 !! options
7503 parsoid=wt2wt,html2wt
7504 !! wikitext
7505 foo
7506 __NOTOC__
7507 bar
7508 !! html
7509 foo<meta property="mw:PageProp/notoc"/>bar
7510 !! end
7511
7512 !! test
7513 Magic Word: rt non-english wikis
7514 !! options
7515 parsoid=wt2wt
7516 language=de
7517 !! wikitext
7518 __NOEDITSECTION__
7519 !! html
7520 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7521 !! end
7522
7523 ###
7524 ### Magic links
7525 ###
7526 !! test
7527 Magic links: internal link to RFC (bug 479)
7528 !! wikitext
7529 [[RFC 123]]
7530 !! html
7531 <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>
7532 </p>
7533 !! end
7534
7535 !! test
7536 Magic links: RFC (bug 479)
7537 !! wikitext
7538 RFC 822
7539 !! html
7540 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7541 </p>
7542 !! end
7543
7544 !! test
7545 Magic links: ISBN (bug 1937)
7546 !! wikitext
7547 ISBN 0-306-40615-2
7548 !! html
7549 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7550 </p>
7551 !! end
7552
7553 !! test
7554 Magic links: PMID incorrectly converts space to underscore
7555 !! wikitext
7556 PMID 1234
7557 !! html
7558 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7559 </p>
7560 !! end
7561
7562 ###
7563 ### Templates
7564 ####
7565
7566 !! test
7567 Nonexistent template
7568 !! wikitext
7569 {{thistemplatedoesnotexist}}
7570 !! html
7571 <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>
7572 </p>
7573 !! end
7574
7575 !! test
7576 Template with invalid target containing tags
7577 !! wikitext
7578 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7579 !! html
7580 <p>{{a<b>b</b>|foo|a=b|a = b}}
7581 </p>
7582 !! end
7583
7584 !! test
7585 Template with invalid target containing unclosed tag
7586 !! wikitext
7587 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7588 !! html
7589 <p>{{a<b>|foo|a=b|a = b}}</b>
7590 </p>
7591 !! end
7592
7593 !! test
7594 Template with invalid target containing wikilink
7595 !! wikitext
7596 {{[[Main Page]]}}
7597 !! html/php
7598 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7599 </p>
7600 !! html/parsoid
7601 <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>
7602 !! end
7603
7604 !! article
7605 Template:test
7606 !! text
7607 This is a test template
7608 !! endarticle
7609
7610 !! test
7611 Simple template
7612 !! wikitext
7613 {{test}}
7614 !! html
7615 <p>This is a test template
7616 </p>
7617 !! end
7618
7619 !! test
7620 Template with explicit namespace
7621 !! wikitext
7622 {{Template:test}}
7623 !! html
7624 <p>This is a test template
7625 </p>
7626 !! end
7627
7628
7629 !! article
7630 Template:paramtest
7631 !! text
7632 This is a test template with parameter {{{param}}}
7633 !! endarticle
7634
7635 !! test
7636 Template parameter
7637 !! wikitext
7638 {{paramtest|param=foo}}
7639 !! html
7640 <p>This is a test template with parameter foo
7641 </p>
7642 !! end
7643
7644 !! article
7645 Template:paramtestnum
7646 !! text
7647 [[{{{1}}}|{{{2}}}]]
7648 !! endarticle
7649
7650 !! test
7651 Template unnamed parameter
7652 !! wikitext
7653 {{paramtestnum|Main Page|the main page}}
7654 !! html
7655 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7656 </p>
7657 !! end
7658
7659 !! article
7660 Template:templatesimple
7661 !! text
7662 (test)
7663 !! endarticle
7664
7665 !! article
7666 Template:templateredirect
7667 !! text
7668 #redirect [[Template:templatesimple]]
7669 !! endarticle
7670
7671 !! article
7672 Template:templateasargtestnum
7673 !! text
7674 {{{{{1}}}}}
7675 !! endarticle
7676
7677 !! article
7678 Template:templateasargtest
7679 !! text
7680 {{template{{{templ}}}}}
7681 !! endarticle
7682
7683 !! article
7684 Template:templateasargtest2
7685 !! text
7686 {{{{{templ}}}}}
7687 !! endarticle
7688
7689 !! test
7690 Template with template name as unnamed argument
7691 !! wikitext
7692 {{templateasargtestnum|templatesimple}}
7693 !! html
7694 <p>(test)
7695 </p>
7696 !! end
7697
7698 !! test
7699 Template with template name as argument
7700 !! wikitext
7701 {{templateasargtest|templ=simple}}
7702 !! html
7703 <p>(test)
7704 </p>
7705 !! end
7706
7707 !! test
7708 Template with template name as argument (2)
7709 !! wikitext
7710 {{templateasargtest2|templ=templatesimple}}
7711 !! html
7712 <p>(test)
7713 </p>
7714 !! end
7715
7716 !! article
7717 Template:templateasargtestdefault
7718 !! text
7719 {{{{{templ|templatesimple}}}}}
7720 !! endarticle
7721
7722 !! article
7723 Template:templa
7724 !! text
7725 '''templ'''
7726 !! endarticle
7727
7728 !! test
7729 Template with default value
7730 !! wikitext
7731 {{templateasargtestdefault}}
7732 !! html
7733 <p>(test)
7734 </p>
7735 !! end
7736
7737 !! test
7738 Template with default value (value set)
7739 !! wikitext
7740 {{templateasargtestdefault|templ=templa}}
7741 !! html
7742 <p><b>templ</b>
7743 </p>
7744 !! end
7745
7746 !! test
7747 Template redirect
7748 !! wikitext
7749 {{templateredirect}}
7750 !! html
7751 <p>(test)
7752 </p>
7753 !! end
7754
7755 !! test
7756 Template with argument in separate line
7757 !! wikitext
7758 {{ templateasargtest |
7759 templ = simple }}
7760 !! html
7761 <p>(test)
7762 </p>
7763 !! end
7764
7765 !! test
7766 Template with complex template as argument
7767 !! wikitext
7768 {{paramtest|
7769 param ={{ templateasargtest |
7770 templ = simple }}}}
7771 !! html
7772 <p>This is a test template with parameter (test)
7773 </p>
7774 !! end
7775
7776 !! test
7777 Template with thumb image (with link in description)
7778 !! wikitext
7779 {{paramtest|
7780 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7781 !! html
7782 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>
7783
7784 !! end
7785
7786 !! article
7787 Template:complextemplate
7788 !! text
7789 {{{1}}} {{paramtest|
7790 param ={{{param}}}}}
7791 !! endarticle
7792
7793 !! test
7794 Template with complex arguments
7795 !! wikitext
7796 {{complextemplate|
7797 param ={{ templateasargtest |
7798 templ = simple }}|[[Template:complextemplate|link]]}}
7799 !! html
7800 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7801 </p>
7802 !! end
7803
7804 !! test
7805 BUG 553: link with two variables in a piped link
7806 !! wikitext
7807 {|
7808 |[[{{{1}}}|{{{2}}}]]
7809 |}
7810 !! html
7811 <table>
7812 <tr>
7813 <td>[[{{{1}}}|{{{2}}}]]
7814 </td></tr></table>
7815
7816 !! end
7817
7818 !! test
7819 Magic variable as template parameter
7820 !! wikitext
7821 {{paramtest|param={{SITENAME}}}}
7822 !! html
7823 <p>This is a test template with parameter MediaWiki
7824 </p>
7825 !! end
7826
7827 !! article
7828 Template:linktest
7829 !! text
7830 [[{{{param}}}|link]]
7831 !! endarticle
7832
7833 !! test
7834 Template parameter as link source
7835 !! wikitext
7836 {{linktest|param=Main Page}}
7837 !! html
7838 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7839 </p>
7840 !! end
7841
7842 !!test
7843 Template-generated attribute string (k='v')
7844 !! wikitext
7845 <span {{attr_str|id|v1}}>bar</span>
7846 !! html
7847 <p><span id="v1">bar</span>
7848 </p>
7849 !!end
7850
7851 !!article
7852 Template:paramtest2
7853 !! text
7854 including another template, {{paramtest|param={{{arg}}}}}
7855 !! endarticle
7856
7857 !! test
7858 Template passing argument to another template
7859 !! wikitext
7860 {{paramtest2|arg='hmm'}}
7861 !! html
7862 <p>including another template, This is a test template with parameter 'hmm'
7863 </p>
7864 !! end
7865
7866 !! article
7867 Template:Linktest2
7868 !! text
7869 Main Page
7870 !! endarticle
7871
7872 !! test
7873 Template as link source
7874 !! wikitext
7875 [[{{linktest2}}]]
7876
7877 [[{{linktest2}}|Main Page]]
7878
7879 [[{{linktest2}}]]Page
7880 !! html
7881 <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>
7883 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7884 </p>
7885 !! end
7886
7887
7888 !! article
7889 Template:loop1
7890 !! text
7891 {{loop2}}
7892 !! endarticle
7893
7894 !! article
7895 Template:loop2
7896 !! text
7897 {{loop1}}
7898 !! endarticle
7899
7900 !! test
7901 Template infinite loop
7902 !! wikitext
7903 {{loop1}}
7904 !! html
7905 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7906 </p>
7907 !! end
7908
7909 !! test
7910 Template from main namespace
7911 !! wikitext
7912 {{:Main Page}}
7913 !! html
7914 <p>blah blah
7915 </p>
7916 !! end
7917
7918 !! article
7919 Template:table
7920 !! text
7921 {|
7922 | 1 || 2
7923 |-
7924 | 3 || 4
7925 |}
7926 !! endarticle
7927
7928 !! test
7929 BUG 529: Template with table, not included at beginning of line
7930 !! wikitext
7931 foo {{table}}
7932 !! html
7933 <p>foo
7934 </p>
7935 <table>
7936 <tr>
7937 <td> 1 </td>
7938 <td> 2
7939 </td></tr>
7940 <tr>
7941 <td> 3 </td>
7942 <td> 4
7943 </td></tr></table>
7944
7945 !! end
7946
7947 !! test
7948 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7949 !! wikitext
7950 foo
7951 {{table}}
7952 !! html
7953 <p>foo
7954 </p>
7955 <table>
7956 <tr>
7957 <td> 1 </td>
7958 <td> 2
7959 </td></tr>
7960 <tr>
7961 <td> 3 </td>
7962 <td> 4
7963 </td></tr></table>
7964
7965 !! end
7966
7967 !! test
7968 BUG 41: Template parameters shown as broken links
7969 !! wikitext
7970 {{{parameter}}}
7971 !! html
7972 <p>{{{parameter}}}
7973 </p>
7974 !! end
7975
7976 !! test
7977 Template with targets containing wikilinks
7978 !! wikitext
7979 {{[[foo]]}}
7980
7981 {{[[{{echo|foo}}]]}}
7982
7983 {{{{echo|[[foo}}]]}}
7984 !! html
7985 <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>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7987 </p><p>{{[[foo}}]]
7988 </p>
7989 !! end
7990
7991 !! article
7992 Template:MSGNW test
7993 !! text
7994 ''None'' of '''this''' should be
7995 * interpreted
7996 but rather passed unmodified
7997 {{test}}
7998 !! endarticle
7999
8000 # hmm, fix this or just deprecate msgnw and document its behavior?
8001 !! test
8002 msgnw keyword
8003 !! options
8004 disabled
8005 !! wikitext
8006 {{msgnw:MSGNW test}}
8007 !! html
8008 <p>''None'' of '''this''' should be
8009 * interpreted
8010 but rather passed unmodified
8011 {{test}}
8012 </p>
8013 !! end
8014
8015 !! test
8016 int keyword
8017 !! wikitext
8018 {{int:youhavenewmessages|lots of money|not!}}
8019 !! html
8020 <p>You have lots of money (not!).
8021 </p>
8022 !! end
8023
8024 !! article
8025 Template:Includes
8026 !! text
8027 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8028 !! endarticle
8029
8030 !! test
8031 <includeonly> and <noinclude> being included
8032 !! wikitext
8033 {{Includes}}
8034 !! html
8035 <p>Foobar
8036 </p>
8037 !! end
8038
8039 !! article
8040 Template:Includes2
8041 !! text
8042 <onlyinclude>Foo</onlyinclude>bar
8043 !! endarticle
8044
8045 !! test
8046 <onlyinclude> being included
8047 !! wikitext
8048 {{Includes2}}
8049 !! html
8050 <p>Foo
8051 </p>
8052 !! end
8053
8054
8055 !! article
8056 Template:Includes3
8057 !! text
8058 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8059 !! endarticle
8060
8061 !! test
8062 <onlyinclude> and <includeonly> being included
8063 !! wikitext
8064 {{Includes3}}
8065 !! html
8066 <p>Foo
8067 </p>
8068 !! end
8069
8070 !! test
8071 <includeonly> and <noinclude> on a page
8072 !! wikitext
8073 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8074 !! html
8075 <p>Foozar
8076 </p>
8077 !! end
8078
8079 !! test
8080 Un-closed <noinclude>
8081 !! wikitext
8082 <noinclude>
8083 !! html
8084 !! end
8085
8086 !! test
8087 <onlyinclude> on a page
8088 !! wikitext
8089 <onlyinclude>Foo</onlyinclude>bar
8090 !! html
8091 <p>Foobar
8092 </p>
8093 !! end
8094
8095 !! test
8096 Un-closed <onlyinclude>
8097 !! wikitext
8098 <onlyinclude>
8099 !! html
8100 !! end
8101
8102 !!test
8103 Self-closed noinclude, includeonly, onlyinclude tags
8104 !! wikitext
8105 <noinclude />
8106 <includeonly />
8107 <onlyinclude />
8108 !! html
8109 <p><br />
8110 </p>
8111 !!end
8112
8113 !!test
8114 Unbalanced includeonly and noinclude tags
8115 !! wikitext
8116 {|
8117 |a</noinclude>
8118 |b</noinclude></noinclude>
8119 |c</noinclude></includeonly>
8120 |d</includeonly></includeonly>
8121 |}
8122 !! html
8123 <table>
8124 <tr>
8125 <td>a
8126 </td>
8127 <td>b
8128 </td>
8129 <td>c&lt;/includeonly&gt;
8130 </td>
8131 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8132 </td></tr></table>
8133
8134 !!end
8135
8136 !! article
8137 Template:Includeonly section
8138 !! text
8139 <includeonly>
8140 ==Includeonly section==
8141 </includeonly>
8142 ==Section T-1==
8143 !!endarticle
8144
8145 !! test
8146 Bug 6563: Edit link generation for section shown by <includeonly>
8147 !! wikitext
8148 {{includeonly section}}
8149 !! html
8150 <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>
8151 <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>
8152
8153 !! end
8154
8155 # Uses same input as the contents of [[Template:Includeonly section]]
8156 !! test
8157 Bug 6563: Section extraction for section shown by <includeonly>
8158 !! options
8159 section=T-2
8160 !! wikitext
8161 <includeonly>
8162 ==Includeonly section==
8163 </includeonly>
8164 ==Section T-2==
8165 !! html
8166 ==Section T-2==
8167 !! end
8168
8169 !! test
8170 Bug 6563: Edit link generation for section suppressed by <includeonly>
8171 !! wikitext
8172 <includeonly>
8173 ==Includeonly section==
8174 </includeonly>
8175 ==Section 1==
8176 !! html
8177 <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>
8178
8179 !! end
8180
8181 !! test
8182 Bug 6563: Section extraction for section suppressed by <includeonly>
8183 !! options
8184 section=1
8185 !! wikitext
8186 <includeonly>
8187 ==Includeonly section==
8188 </includeonly>
8189 ==Section 1==
8190 !! html
8191 ==Section 1==
8192 !! end
8193
8194 !! test
8195 Un-closed <includeonly>
8196 !! wikitext
8197 <includeonly>
8198 !! html
8199 !! end
8200
8201 # TODO: test with DOM fragment reuse!
8202 !! test
8203 Parsoid: DOM fragment reuse
8204 !! options
8205 parsoid=wt2wt,wt2html
8206 !! wikitext
8207 a{{echo|b<table></table>c}}d
8208
8209 a{{echo|b
8210 <table></table>
8211 c}}d
8212
8213 {{echo|a
8214
8215 <table></table>
8216
8217 b}}
8218 !! html
8219 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8220 <table></table>c"}},"i":0}}]}'>b</span>
8221 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8222
8223
8224 <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">
8225 </span>
8226 <table about="#mwt2"></table><span about="#mwt2">
8227 </span>
8228 <p about="#mwt2">cd</p>
8229
8230
8231 <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">
8232
8233 </span>
8234 <table about="#mwt3"></table><span about="#mwt3">
8235
8236 </span>
8237 <p about="#mwt3">b</p>
8238 !! end
8239
8240 !! test
8241 Parsoid: Merge double tds (bug 50603)
8242 !! options
8243 parsoid
8244 !! wikitext
8245 {|
8246 |{{echo|{{!}} foo}}
8247 |}
8248 !! html
8249 <table><tbody>
8250 <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>
8251 </tbody></table>
8252 !! end
8253
8254 !! test
8255 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8256 !! options
8257 parsoid
8258 !! wikitext
8259 {{echo|<div>}}
8260 {|
8261 |{{echo|{{!}} foo}}
8262 |}
8263 {{echo|</div>}}
8264 !! html
8265 <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}}]}'>
8266 <table><tbody>
8267 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8268 </tbody></table>
8269 </div>
8270 !! end
8271
8272 ###
8273 ### <includeonly> and <noinclude> in attributes
8274 ###
8275 !!test
8276 0. includeonly around the entire attribute
8277 !! wikitext
8278 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8279 !! html
8280 <p><span id="v2">bar</span>
8281 </p>
8282 !!end
8283
8284 !!test
8285 1. includeonly in html attr key
8286 !! wikitext
8287 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8288 !! html
8289 <p><span id="foo">bar</span>
8290 </p>
8291 !!end
8292
8293 !!test
8294 2. includeonly in html attr value
8295 !! wikitext
8296 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8297 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8298 !! html
8299 <p><span id="v1">bar</span>
8300 <span id="v1">bar</span>
8301 </p>
8302 !!end
8303
8304 !!test
8305 3. includeonly in part of an attr value
8306 !! wikitext
8307 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8308 !! html
8309 <p><span style="color:red;">bar</span>
8310 </p>
8311 !!end
8312
8313 !!test
8314 4. includeonly in table attributes
8315 !! wikitext
8316 {|
8317 |- <noinclude>
8318 |-
8319 |a
8320 </noinclude>
8321 |- <includeonly>
8322 |-
8323 |b
8324 </includeonly>
8325 |}
8326 !! html
8327 <table>
8328
8329
8330 <tr>
8331 <td>a
8332 </td></tr>
8333 </table>
8334
8335 !!end
8336
8337 ###
8338 ### Testing parsing of templates where a template arg
8339 ### has the same name as the template itself.
8340 ###
8341
8342 !! article
8343 Template:quote
8344 !! text
8345 {{{quote|{{{1}}}}}}
8346 !! endarticle
8347
8348 !!test
8349 Templates: Template Name/Arg clash: 1. Use of positional param
8350 !! wikitext
8351 {{quote|foo}}
8352 !! html
8353 <p>foo
8354 </p>
8355 !!end
8356
8357 !!test
8358 Templates: Template Name/Arg clash: 2. Use of named param
8359 !! wikitext
8360 {{quote|quote=foo}}
8361 !! html
8362 <p>foo
8363 </p>
8364 !!end
8365
8366 !!test
8367 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8368 !! wikitext
8369 {{quote|quote}}
8370 !! html
8371 <p>quote
8372 </p>
8373 !!end
8374
8375 ###
8376 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8377 ###
8378
8379 !!test
8380 Templates: 1. Simple use
8381 !! wikitext
8382 {{echo|Foo}}
8383 !! html
8384 <p>Foo
8385 </p>
8386 !!end
8387
8388 !!test
8389 Templates: 2. Inside a block tag
8390 !! wikitext
8391 <div>{{echo|Foo}}</div>
8392 <blockquote>{{echo|Foo}}</blockquote>
8393 !! html
8394 <div>Foo</div>
8395 <blockquote>Foo</blockquote>
8396
8397 !!end
8398
8399 !!test
8400 Templates: P-wrapping: 1a. Templates on consecutive lines
8401 !! wikitext
8402 {{echo|Foo}}
8403 {{echo|bar}}
8404 !! html
8405 <p>Foo
8406 bar
8407 </p>
8408 !!end
8409
8410 !!test
8411 Templates: P-wrapping: 1b. Templates on consecutive lines
8412 !! wikitext
8413 Foo
8414
8415 {{echo|bar}}
8416 {{echo|baz}}
8417 !! html
8418 <p>Foo
8419 </p><p>bar
8420 baz
8421 </p>
8422 !!end
8423
8424 !!test
8425 Templates: P-wrapping: 1c. Templates on consecutive lines
8426 !! wikitext
8427 {{echo|Foo}}
8428 {{echo|bar}} <div>baz</div>
8429 !! html
8430 <p>Foo
8431 </p>
8432 bar <div>baz</div>
8433
8434 !!end
8435
8436 !!test
8437 Templates: P-wrapping: 1d. Template preceded by comment-only line
8438 !!options
8439 parsoid
8440 !! wikitext
8441 <!-- foo -->
8442 {{echo|Bar}}
8443 !! html
8444 <!-- foo -->
8445
8446 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8447 !!end
8448
8449 !!test
8450 Templates: Inline Text: 1. Multiple tmeplate uses
8451 !! wikitext
8452 {{echo|Foo}}bar{{echo|baz}}
8453 !! html
8454 <p>Foobarbaz
8455 </p>
8456 !!end
8457
8458 !!test
8459 Templates: Inline Text: 2. Back-to-back template uses
8460 !! wikitext
8461 {{echo|Foo}}{{echo|bar}}
8462 !! html
8463 <p>Foobar
8464 </p>
8465 !!end
8466
8467 !!test
8468 Templates: Block Tags: 1. Multiple template uses
8469 !! wikitext
8470 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8471 !! html
8472 <div>Foo</div><div>bar</div><div>baz</div>
8473
8474 !!end
8475
8476 !!test
8477 Templates: Block Tags: 2. Back-to-back template uses
8478 !! wikitext
8479 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8480 !! html
8481 <div>Foo</div><div>bar</div>
8482
8483 !!end
8484
8485 !!test
8486 Templates: Links: 1. Simple example
8487 !! wikitext
8488 {{echo|[[Foo|bar]]}}
8489 !! html
8490 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8491 </p>
8492 !!end
8493
8494 !!test
8495 Templates: Links: 2. Generation of link href
8496 !! wikitext
8497 [[{{echo|Foo}}|bar]]
8498 !! html
8499 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8500 </p>
8501 !!end
8502
8503 !!test
8504 Templates: Links: 3. Generation of part of a link href
8505 !! wikitext
8506 [[Fo{{echo|o}}|bar]]
8507
8508 [[Foo{{echo|bar}}]]
8509
8510 [[Foo{{echo|bar}}baz]]
8511
8512 [[Foo{{echo|bar}}|bar]]
8513
8514 [[:Foo{{echo|bar}}]]
8515
8516 [[:Foo{{echo|bar}}|bar]]
8517 !! html
8518 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8519 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8520 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8521 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8522 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8523 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8524 </p>
8525 !!end
8526
8527 !!test
8528 Templates: Links: 4. Multiple templates generating link href
8529 !! wikitext
8530 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8531 !! html
8532 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8533 </p>
8534 !!end
8535
8536 !!test
8537 Templates: Links: 5. Generation of link text
8538 !! wikitext
8539 [[Foo|{{echo|bar}}]]
8540 !! html
8541 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8542 </p>
8543 !!end
8544
8545 !!test
8546 Templates: Links: 5. Nested templates (only outermost template should be marked)
8547 !! wikitext
8548 {{echo|[[{{echo|Foo}}|bar]]}}
8549 !! html
8550 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8551 </p>
8552 !!end
8553
8554 !!test
8555 Templates: HTML Tag: 1. Generation of HTML attr. key
8556 !! wikitext
8557 <div {{echo|style}}="color:red;">foo</div>
8558 !! html
8559 <div style="color:red;">foo</div>
8560
8561 !!end
8562
8563 !!test
8564 Templates: HTML Tag: 2. Generation of HTML attr. value
8565 !! wikitext
8566 <div style={{echo|'color:red;'}}>foo</div>
8567 !! html
8568 <div style="color:red;">foo</div>
8569
8570 !!end
8571
8572 !!test
8573 Templates: HTML Tag: 3. Generation of HTML attr key and value
8574 !! wikitext
8575 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8576 !! html
8577 <div style="color:red;">foo</div>
8578
8579 !!end
8580
8581 !!test
8582 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8583 !! wikitext
8584 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8585 !! html
8586 <div title="This is a long title with just one piece templated">foo</div>
8587
8588 !!end
8589
8590 !!test
8591 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8592 !! wikitext
8593 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8594 !! html
8595 <div title="This is a long title with just one piece templated">foo</div>
8596
8597 !!end
8598
8599 !!test
8600 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8601 !! wikitext
8602 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8603 !! html
8604 <div title="This is a long title with just one piece templated">foo</div>
8605
8606 !!end
8607
8608 !!test
8609 Templates: HTML Tag: 7. Generation of partial attribute key string
8610 !! wikitext
8611 <div st{{echo|yle}}="color:red;">foo</div>
8612 !! html
8613 <div style="color:red;">foo</div>
8614
8615 !!end
8616
8617 !!test
8618 Templates: HTML Tables: 1. Generating start of a HTML table
8619 !! wikitext
8620 {{echo|<table><tr><td>foo</td>}}</tr></table>
8621 !! html
8622 <table><tr><td>foo</td></tr></table>
8623
8624 !!end
8625
8626 !!test
8627 Templates: HTML Tables: 2a. Generating middle of a HTML table
8628 !! wikitext
8629 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8630 !! html
8631 <table><tr><td>foo</td></tr></table>
8632
8633 !!end
8634
8635 !!test
8636 Templates: HTML Tables: 2b. Generating middle of a HTML table
8637 !! wikitext
8638 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8639 !! html
8640 <table><tr><td>foo</td></tr></table>
8641
8642 !!end
8643
8644 !!test
8645 Templates: HTML Tables: 3. Generating end of a HTML table
8646 !! wikitext
8647 <table><tr>{{echo|<td>foo</td></tr></table>}}
8648 !! html
8649 <table><tr><td>foo</td></tr></table>
8650
8651 !!end
8652
8653 !!test
8654 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8655 !! wikitext
8656 {{echo|<table>}}<tr><td>foo</td></tr></table>
8657 !! html
8658 <table><tr><td>foo</td></tr></table>
8659
8660 !!end
8661
8662 !!test
8663 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8664 !! wikitext
8665 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8666 !! html
8667 <table><tr><td>foo</td></tr></table>
8668
8669 !!end
8670
8671 !!test
8672 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8673 !! wikitext
8674 <table><tr>{{echo|<td>}}foo</td></tr></table>
8675 !! html
8676 <table><tr><td>foo</td></tr></table>
8677
8678 !!end
8679
8680 !!test
8681 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8682 !! wikitext
8683 <table><tr><td>foo{{echo|</td>}}</tr></table>
8684 !! html
8685 <table><tr><td>foo</td></tr></table>
8686
8687 !!end
8688
8689 !!test
8690 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8691 !! wikitext
8692 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8693 !! html
8694 <table><tr><td>foo</td></tr></table>
8695
8696 !!end
8697
8698 !!test
8699 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8700 !! wikitext
8701 <table><tr><td>foo</td></tr>{{echo|</table>}}
8702 !! html
8703 <table><tr><td>foo</td></tr></table>
8704
8705 !!end
8706
8707 !!test
8708 Templates: HTML Tables: 5. Proper fostering of categories from inside
8709 !!options
8710 parsoid=wt2html,wt2wt
8711 !! wikitext
8712 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8713 <!--Two categories (Bug 50330)-->
8714 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8715 !! html
8716 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8717 <!--Two categories (Bug 50330)-->
8718 <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>
8719 !!end
8720
8721 !!test
8722 Templates: Wiki Tables: 1a. Fostering of entire template content
8723 !! wikitext
8724 {|
8725 {{echo|a}}
8726 |}
8727 !! html
8728 <table>
8729 a
8730 <tr><td></td></tr></table>
8731
8732 !!end
8733
8734 !!test
8735 Templates: Wiki Tables: 1b. Fostering of entire template content
8736 !! wikitext
8737 {|
8738 {{echo|<div>}}
8739 foo
8740 {{echo|</div>}}
8741 |}
8742 !! html
8743 <table>
8744 <div>
8745 <p>foo
8746 </p>
8747 </div>
8748 <tr><td></td></tr></table>
8749
8750 !!end
8751
8752 !!test
8753 Templates: Wiki Tables: 2. Fostering of partial template content
8754 !! wikitext
8755 {|
8756 {{echo|a
8757 <div>b</div>}}
8758 |}
8759 !! html
8760 <table>
8761 a
8762 <div>b</div>
8763 <tr><td></td></tr></table>
8764
8765 !!end
8766
8767 !!test
8768 Templates: Wiki Tables: 3. td-content via multiple templates
8769 !! wikitext
8770 {|
8771 {{echo|{{pipe}}a}}{{echo|b}}
8772 |}
8773 !! html
8774 <table>
8775 <tr>
8776 <td>ab
8777 </td></tr></table>
8778
8779 !!end
8780
8781 !!test
8782 Templates: Wiki Tables: 4. Templated tags, no content
8783 !! wikitext
8784 {{tbl-start}}
8785 {{tbl-end}}
8786 !! html
8787 <table>
8788 <tr><td></td></tr></table>
8789
8790 !!end
8791
8792 !!test
8793 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8794 !! wikitext
8795 {{tbl-start}}
8796 |foo
8797 {{tbl-end}}
8798 !! html
8799 <table>
8800 <tr>
8801 <td>foo
8802 </td></tr></table>
8803
8804 !!end
8805
8806 !!test
8807 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8808 !! wikitext
8809 {{tbl-start}}
8810 {{!}}foo
8811 {{tbl-end}}
8812 !! html
8813 <table>
8814 <tr>
8815 <td>foo
8816 </td></tr></table>
8817
8818 !!end
8819
8820 !!test
8821 Templates: Lists: Multi-line list-items via templates
8822 !! wikitext
8823 *{{echo|a {{nonexistent|
8824 unused}}}}
8825 *{{echo|b {{nonexistent|
8826 unused}}}}
8827 !! html
8828 <ul>
8829 <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>
8830 </li>
8831 <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>
8832 </li>
8833 </ul>
8834
8835 !!end
8836
8837 !!test
8838 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8839 !! wikitext
8840 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8841 !! html
8842 <p><i>ab</i>c<i>d</i>e
8843 </p>
8844 !!end
8845
8846 !!test
8847 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8848 (PHP parser generates misnested html)
8849 !! wikitext
8850 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8851 !! html/parsoid
8852 <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>
8853 !!end
8854
8855 !!test
8856 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8857 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8858 !! options
8859 parsoid=wt2html,wt2wt
8860 !! wikitext
8861 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8862 !! html
8863 <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>
8864 <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>
8865 <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>
8866 !!end
8867
8868 !!test
8869 Templates: Ugly nesting: 4. Divs opened/closed across templates
8870 !! wikitext
8871 a<div>b{{echo|c</div>d}}e
8872 !! html
8873 a<div>bc</div>de
8874
8875 !!end
8876
8877 !!test
8878 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8879 (Parsoid-centric)
8880 !! options
8881 parsoid
8882 !! wikitext
8883 {|
8884 |{{echo|foo</table>}}
8885 |bar
8886 |}
8887 !! html
8888 <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|}"]}'>
8889
8890 <tbody>
8891 <tr>
8892 <td>foo</td></tr></tbody></table><span about="#mwt1">
8893 </span><span about="#mwt1">|bar</span><span about="#mwt1">
8894 |}</span>
8895 !!end
8896
8897 !!test
8898 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8899 (Parsoid-centric)
8900 !! options
8901 parsoid
8902 !! wikitext
8903 <table>
8904 <tr>
8905 <td>
8906 <table>
8907 <tr>
8908 <td>1. {{echo|foo </table>}}</td>
8909 <td> bar </td>
8910 <td>2. {{echo|baz </table>}}</td>
8911 </tr>
8912 <tr>
8913 <td>abc</td>
8914 </tr>
8915 </table>
8916 </td>
8917 </tr>
8918 <tr>
8919 <td>xyz</td>
8920 </tr>
8921 </table>
8922 !! html
8923 <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>"]}'>
8924 <tbody><tr>
8925 <td>
8926 <table>
8927 <tbody><tr>
8928 <td>1. foo </td></tr></tbody></table></td>
8929 <td> bar </td>
8930 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8931 </span><span about="#mwt2">
8932 </span><span about="#mwt2">
8933 </span><span about="#mwt2">abc</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">
8939 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8940 </span><span about="#mwt2">
8941 </span>
8942 !!end
8943
8944 !! test
8945 Templates: Ugly templates: 3. newline-only template parameter
8946 !! wikitext
8947 foo {{echo|
8948 }}
8949 !! html
8950 <p>foo
8951 </p>
8952 !! end
8953
8954 # This looks like a bug: a single newline triggers p/br for some reason.
8955 !! test
8956 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8957 !! wikitext
8958 {{echo|
8959 }}
8960 !! html
8961 <p><br />
8962 </p>
8963 !! end
8964
8965
8966 !!test
8967 Parser Functions: 1. Simple example
8968 !! wikitext
8969 {{uc:foo}}
8970 !! html
8971 <p>FOO
8972 </p>
8973 !!end
8974
8975 !!test
8976 Parser Functions: 2. Nested use (only outermost should be marked up)
8977 !! wikitext
8978 {{uc:{{lc:FOO}}}}
8979 !! html
8980 <p>FOO
8981 </p>
8982 !!end
8983
8984 ###
8985 ### Pre-save transform tests
8986 ###
8987 !! test
8988 pre-save transform: subst:
8989 !! options
8990 PST
8991 !! wikitext
8992 {{subst:test}}
8993 !! html
8994 This is a test template
8995 !! end
8996
8997 !! test
8998 pre-save transform: normal template
8999 !! options
9000 PST
9001 !! wikitext
9002 {{test}}
9003 !! html
9004 {{test}}
9005 !! end
9006
9007 !! test
9008 pre-save transform: nonexistent template
9009 !! options
9010 PST
9011 !! wikitext
9012 {{thistemplatedoesnotexist}}
9013 !! html
9014 {{thistemplatedoesnotexist}}
9015 !! end
9016
9017
9018 !! test
9019 pre-save transform: subst magic variables
9020 !! options
9021 PST
9022 !! wikitext
9023 {{subst:SITENAME}}
9024 !! html
9025 MediaWiki
9026 !! end
9027
9028 # This is bug 89, which I fixed. -- wtm
9029 !! test
9030 pre-save transform: subst: templates with parameters
9031 !! options
9032 pst
9033 !! wikitext
9034 {{subst:paramtest|param="something else"}}
9035 !! html
9036 This is a test template with parameter "something else"
9037 !! end
9038
9039 !! article
9040 Template:nowikitest
9041 !! text
9042 <nowiki>'''not wiki'''</nowiki>
9043 !! endarticle
9044
9045 !! test
9046 pre-save transform: nowiki in subst (bug 1188)
9047 !! options
9048 pst
9049 !! wikitext
9050 {{subst:nowikitest}}
9051 !! html
9052 <nowiki>'''not wiki'''</nowiki>
9053 !! end
9054
9055
9056 !! article
9057 Template:commenttest
9058 !! text
9059 This template has <!-- a comment --> in it.
9060 !! endarticle
9061
9062 !! test
9063 pre-save transform: comment in subst (bug 1936)
9064 !! options
9065 pst
9066 !! wikitext
9067 {{subst:commenttest}}
9068 !! html
9069 This template has <!-- a comment --> in it.
9070 !! end
9071
9072 !! test
9073 pre-save transform: unclosed tag
9074 !! options
9075 pst noxml
9076 !! wikitext
9077 <nowiki>'''not wiki'''
9078 !! html
9079 <nowiki>'''not wiki'''
9080 !! end
9081
9082 !! test
9083 pre-save transform: mixed tag case
9084 !! options
9085 pst noxml
9086 !! wikitext
9087 <NOwiki>'''not wiki'''</noWIKI>
9088 !! html
9089 <NOwiki>'''not wiki'''</noWIKI>
9090 !! end
9091
9092 !! test
9093 pre-save transform: unclosed comment in <nowiki>
9094 !! options
9095 pst noxml
9096 !! wikitext
9097 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9098 !! html
9099 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9100 !!end
9101
9102 # Leading @ in this template definition works around a limitation
9103 # in parsoid's parserTests which otherwise strips the <span> from the
9104 # result (confusing it for a template wrapper)
9105 !! article
9106 Template:dangerous
9107 !!text
9108 @<span onmouseover="alert('crap')">Oh no</span>
9109 !!endarticle
9110
9111 !!test
9112 (confirming safety of fix for subst bug 1936)
9113 !! wikitext
9114 {{Template:dangerous}}
9115 !! html
9116 <p>@<span>Oh no</span>
9117 </p>
9118 !! end
9119
9120 !! test
9121 pre-save transform: comment containing gallery (bug 5024)
9122 !! options
9123 pst
9124 !! wikitext
9125 <!-- <gallery>data</gallery> -->
9126 !! html
9127 <!-- <gallery>data</gallery> -->
9128 !!end
9129
9130 !! test
9131 pre-save transform: comment containing extension
9132 !! options
9133 pst
9134 !! wikitext
9135 <!-- <tag>data</tag> -->
9136 !! html
9137 <!-- <tag>data</tag> -->
9138 !!end
9139
9140 !! test
9141 pre-save transform: comment containing nowiki
9142 !! options
9143 pst
9144 !! wikitext
9145 <!-- <nowiki>data</nowiki> -->
9146 !! html
9147 <!-- <nowiki>data</nowiki> -->
9148 !!end
9149
9150 !! test
9151 pre-save transform: <noinclude> in subst (bug 3298)
9152 !! options
9153 pst
9154 !! wikitext
9155 {{subst:Includes}}
9156 !! html
9157 Foobar
9158 !! end
9159
9160 !! test
9161 pre-save transform: <onlyinclude> in subst (bug 3298)
9162 !! options
9163 pst
9164 !! wikitext
9165 {{subst:Includes2}}
9166 !! html
9167 Foo
9168 !! end
9169
9170 !! article
9171 Template:SubstTest
9172 !!text
9173 {{<includeonly>subst:</includeonly>Includes}}
9174 !! endarticle
9175
9176 !! article
9177 Template:SafeSubstTest
9178 !! text
9179 {{<includeonly>safesubst:</includeonly>Includes}}
9180 !! endarticle
9181
9182 !! test
9183 bug 22297: safesubst: works during PST
9184 !! options
9185 pst
9186 !! wikitext
9187 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9188 !! html
9189 FoobarFoobar
9190 !! end
9191
9192 !! test
9193 bug 22297: safesubst: works during normal parse
9194 !! wikitext
9195 {{SafeSubstTest}}
9196 !! html
9197 <p>Foobar
9198 </p>
9199 !! end
9200
9201 !! test
9202 subst: does not work during normal parse
9203 !! wikitext
9204 {{SubstTest}}
9205 !! html
9206 <p>{{subst:Includes}}
9207 </p>
9208 !! end
9209
9210 !! test
9211 pre-save transform: context links ("pipe trick")
9212 !! options
9213 pst
9214 !! wikitext
9215 [[Article (context)|]]
9216 [[Bar:Article|]]
9217 [[:Bar:Article|]]
9218 [[Bar:Article (context)|]]
9219 [[:Bar:Article (context)|]]
9220 [[|Article]]
9221 [[|Article (context)]]
9222 [[Bar:X (Y) Z|]]
9223 [[:Bar:X (Y) Z|]]
9224 !! html
9225 [[Article (context)|Article]]
9226 [[Bar:Article|Article]]
9227 [[:Bar:Article|Article]]
9228 [[Bar:Article (context)|Article]]
9229 [[:Bar:Article (context)|Article]]
9230 [[Article]]
9231 [[Article (context)]]
9232 [[Bar:X (Y) Z|X (Y) Z]]
9233 [[:Bar:X (Y) Z|X (Y) Z]]
9234 !! end
9235
9236 !! test
9237 pre-save transform: context links ("pipe trick") with interwiki prefix
9238 !! options
9239 pst
9240 !! wikitext
9241 [[interwiki:Article|]]
9242 [[:interwiki:Article|]]
9243 [[interwiki:Bar:Article|]]
9244 [[:interwiki:Bar:Article|]]
9245 !! html
9246 [[interwiki:Article|Article]]
9247 [[:interwiki:Article|Article]]
9248 [[interwiki:Bar:Article|Bar:Article]]
9249 [[:interwiki:Bar:Article|Bar:Article]]
9250 !! end
9251
9252 !! test
9253 pre-save transform: context links ("pipe trick") with parens in title
9254 !! options
9255 pst title=[[Somearticle (context)]]
9256 !! wikitext
9257 [[|Article]]
9258 !! html
9259 [[Article (context)|Article]]
9260 !! end
9261
9262 !! test
9263 pre-save transform: context links ("pipe trick") with comma in title
9264 !! options
9265 pst title=[[Someplace, Somewhere]]
9266 !! wikitext
9267 [[|Otherplace]]
9268 [[Otherplace, Elsewhere|]]
9269 [[Otherplace, Elsewhere, Anywhere|]]
9270 !! html
9271 [[Otherplace, Somewhere|Otherplace]]
9272 [[Otherplace, Elsewhere|Otherplace]]
9273 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9274 !! end
9275
9276 !! test
9277 pre-save transform: context links ("pipe trick") with parens and comma
9278 !! options
9279 pst title=[[Someplace (IGNORED), Somewhere]]
9280 !! wikitext
9281 [[|Otherplace]]
9282 [[Otherplace (place), Elsewhere|]]
9283 !! html
9284 [[Otherplace, Somewhere|Otherplace]]
9285 [[Otherplace (place), Elsewhere|Otherplace]]
9286 !! end
9287
9288 !! test
9289 pre-save transform: context links ("pipe trick") with comma and parens
9290 !! options
9291 pst title=[[Who, me? (context)]]
9292 !! wikitext
9293 [[|Yes, you.]]
9294 [[Me, Myself, and I (1937 song)|]]
9295 !! html
9296 [[Yes, you. (context)|Yes, you.]]
9297 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9298 !! end
9299
9300 !! test
9301 pre-save transform: context links ("pipe trick") with namespace
9302 !! options
9303 pst title=[[Ns:Somearticle]]
9304 !! wikitext
9305 [[|Article]]
9306 !! html
9307 [[Ns:Article|Article]]
9308 !! end
9309
9310 !! test
9311 pre-save transform: context links ("pipe trick") with namespace and parens
9312 !! options
9313 pst title=[[Ns:Somearticle (context)]]
9314 !! wikitext
9315 [[|Article]]
9316 !! html
9317 [[Ns:Article (context)|Article]]
9318 !! end
9319
9320 !! test
9321 pre-save transform: context links ("pipe trick") with namespace and comma
9322 !! options
9323 pst title=[[Ns:Somearticle, Context, Whatever]]
9324 !! wikitext
9325 [[|Article]]
9326 !! html
9327 [[Ns:Article, Context, Whatever|Article]]
9328 !! end
9329
9330 !! test
9331 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9332 !! options
9333 pst title=[[Ns:Somearticle, Context (context)]]
9334 !! wikitext
9335 [[|Article]]
9336 !! html
9337 [[Ns:Article (context)|Article]]
9338 !! end
9339
9340 !! test
9341 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9342 !! options
9343 pst title=[[Ns:Somearticle (IGNORED), Context]]
9344 !! wikitext
9345 [[|Article]]
9346 !! html
9347 [[Ns:Article, Context|Article]]
9348 !! end
9349
9350 !! test
9351 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9352 !! options
9353 pst
9354 !! wikitext
9355 [[Article(context)|]]
9356 [[Bar:Article(context)|]]
9357 [[:Bar:Article(context)|]]
9358 [[|Article(context)]]
9359 [[Bar:X(Y)Z|]]
9360 [[:Bar:X(Y)Z|]]
9361 !! html
9362 [[Article(context)|Article]]
9363 [[Bar:Article(context)|Article]]
9364 [[:Bar:Article(context)|Article]]
9365 [[Article(context)]]
9366 [[Bar:X(Y)Z|X(Y)Z]]
9367 [[:Bar:X(Y)Z|X(Y)Z]]
9368 !! end
9369
9370 !! test
9371 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9372 !! options
9373 pst
9374 !! wikitext
9375 [[Article (context)|]]
9376 [[Bar:Article (context)|]]
9377 [[:Bar:Article (context)|]]
9378 [[|Article (context)]]
9379 [[Bar:X (Y) Z|]]
9380 [[:Bar:X (Y) Z|]]
9381 !! html
9382 [[Article (context)|Article]]
9383 [[Bar:Article (context)|Article]]
9384 [[:Bar:Article (context)|Article]]
9385 [[Article (context)]]
9386 [[Bar:X (Y) Z|X (Y) Z]]
9387 [[:Bar:X (Y) Z|X (Y) Z]]
9388 !! end
9389
9390 !! test
9391 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9392 !! options
9393 pst
9394 !! wikitext
9395 [[Article(context)|]]
9396 [[Bar:Article(context)|]]
9397 [[:Bar:Article(context)|]]
9398 [[|Article(context)]]
9399 [[Bar:X(Y)Z|]]
9400 [[:Bar:X(Y)Z|]]
9401 !! html
9402 [[Article(context)|Article]]
9403 [[Bar:Article(context)|Article]]
9404 [[:Bar:Article(context)|Article]]
9405 [[Article(context)]]
9406 [[Bar:X(Y)Z|X(Y)Z]]
9407 [[:Bar:X(Y)Z|X(Y)Z]]
9408 !! end
9409
9410 !! test
9411 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9412 !! options
9413 pst
9414 !! wikitext
9415 [[Article (context), context|]]
9416 [[Article (context),context|]]
9417 [[Bar:Article (context), context|]]
9418 [[Bar:Article (context),context|]]
9419 [[:Bar:Article (context), context|]]
9420 [[:Bar:Article (context),context|]]
9421 !! html
9422 [[Article (context), context|Article]]
9423 [[Article (context),context|Article]]
9424 [[Bar:Article (context), context|Article]]
9425 [[Bar:Article (context),context|Article]]
9426 [[:Bar:Article (context), context|Article]]
9427 [[:Bar:Article (context),context|Article]]
9428 !! end
9429
9430 !! test
9431 pre-save transform: trim trailing empty lines
9432 !! options
9433 pst
9434 !! wikitext
9435 Empty lines are trimmed
9436
9437
9438
9439
9440 !! html
9441 Empty lines are trimmed
9442 !! end
9443
9444 !! test
9445 pre-save transform: Signature expansion
9446 !! options
9447 pst
9448 !! wikitext
9449 * ~~~
9450 * <noinclude>~~~</noinclude>
9451 * <includeonly>~~~</includeonly>
9452 * <onlyinclude>~~~</onlyinclude>
9453 !! html
9454 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9455 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9456 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9457 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9458 !! end
9459
9460
9461 !! test
9462 pre-save transform: Signature expansion in nowiki tags (bug 93)
9463 !! options
9464 pst disabled
9465 !! wikitext
9466 Shall not expand:
9467
9468 <nowiki>~~~~</nowiki>
9469
9470 <includeonly><nowiki>~~~~</nowiki></includeonly>
9471
9472 <noinclude><nowiki>~~~~</nowiki></noinclude>
9473
9474 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9475
9476 {{subst:Foo}} shall be converted to FOO
9477
9478 As well as inside noinclude/onlyinclude
9479 <noinclude>{{subst:Foo}}</noinclude>
9480 <onlyinclude>{{subst:Foo}}</onlyinclude>
9481
9482 But not inside includeonly
9483 <includeonly>{{subst:Foo}}</includeonly>
9484 !! html
9485 Shall not expand:
9486
9487 <nowiki>~~~~</nowiki>
9488
9489 <includeonly><nowiki>~~~~</nowiki></includeonly>
9490
9491 <noinclude><nowiki>~~~~</nowiki></noinclude>
9492
9493 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9494
9495 FOO shall be converted to FOO
9496
9497 As well as inside noinclude/onlyinclude
9498 <noinclude>FOO</noinclude>
9499 <onlyinclude>FOO</onlyinclude>
9500
9501 But not inside includeonly
9502 <includeonly>{{subst:Foo}}</includeonly>
9503 !! end
9504
9505 !! test
9506 Parsoid: Recognize nowiki with trailing space in tags
9507 !! options
9508 parsoid=wt2html
9509 !! wikitext
9510 <nowiki ><div>[[foo]]</nowiki >
9511
9512 a<nowiki / >b
9513
9514 c<nowiki />d
9515
9516 e<nowiki/ >f
9517 !! html
9518 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9519 <p>ab</p>
9520 <p>cd</p>
9521 <p>ef</p>
9522 !! end
9523
9524 !! test
9525 Parsoid: Recognize nowiki with odd capitalization
9526 !! options
9527 parsoid=wt2html
9528 !! wikitext
9529 <noWikI ><div>[[foo]]</Nowiki >
9530 !! html
9531 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9532 !! end
9533
9534
9535 !! test
9536 Parsoid: Escape nowiki with trailing space in tags
9537 !! options
9538 parsoid=html2wt
9539 !! wikitext
9540 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9541
9542 a&lt;nowiki /&gt;b
9543
9544 c&lt;nowiki/ &gt;d
9545 !! html
9546 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9547 <p>a&lt;nowiki /&gt;b</p>
9548 <p>c&lt;nowiki/ &gt;d</p>
9549 !! end
9550
9551 !! test
9552 Parsoid: Escape weird noWikI capitalizations
9553 !! options
9554 parsoid=html2wt
9555 !! wikitext
9556 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9557 !! html
9558 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9559 !! end
9560
9561 ###
9562 ### Message transform tests
9563 ###
9564 !! test
9565 message transform: magic variables
9566 !! options
9567 msg
9568 !! wikitext
9569 {{SITENAME}}
9570 !! html
9571 MediaWiki
9572 !! end
9573
9574 !! test
9575 message transform: should not transform wiki markup
9576 !! options
9577 msg
9578 !! wikitext
9579 ''test''
9580 !! html
9581 ''test''
9582 !! end
9583
9584 !! test
9585 message transform: <noinclude> in transcluded template (bug 4926)
9586 !! options
9587 msg
9588 !! wikitext
9589 {{Includes}}
9590 !! html
9591 Foobar
9592 !! end
9593
9594 !! test
9595 message transform: <onlyinclude> in transcluded template (bug 4926)
9596 !! options
9597 msg
9598 !! wikitext
9599 {{Includes2}}
9600 !! html
9601 Foo
9602 !! end
9603
9604 !! test
9605 {{#special:}} page name, known
9606 !! options
9607 msg
9608 !! wikitext
9609 {{#special:Recentchanges}}
9610 !! html
9611 Special:RecentChanges
9612 !! end
9613
9614 !! test
9615 {{#special:}} page name with subpage, known
9616 !! options
9617 msg
9618 !! wikitext
9619 {{#special:Recentchanges/param}}
9620 !! html
9621 Special:RecentChanges/param
9622 !! end
9623
9624 !! test
9625 {{#special:}} page name, unknown
9626 !! options
9627 msg
9628 !! wikitext
9629 {{#special:foobar nonexistent}}
9630 !! html
9631 Special:Foobar nonexistent
9632 !! end
9633
9634 !! test
9635 {{#speciale:}} page name, known
9636 !! options
9637 msg
9638 !! wikitext
9639 {{#speciale:Recentchanges}}
9640 !! html
9641 Special:RecentChanges
9642 !! end
9643
9644 !! test
9645 {{#speciale:}} page name with subpage, known
9646 !! options
9647 msg
9648 !! wikitext
9649 {{#speciale:Recentchanges/param}}
9650 !! html
9651 Special:RecentChanges/param
9652 !! end
9653
9654 !! test
9655 {{#speciale:}} page name, unknown
9656 !! options
9657 msg
9658 !! wikitext
9659 {{#speciale:foobar nonexistent}}
9660 !! html
9661 Special:Foobar_nonexistent
9662 !! end
9663
9664 ###
9665 ### Images
9666 ###
9667 ### For Parsoid-specific tests, see
9668 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9669
9670 !! test
9671 Simple image
9672 !! options
9673 parsoid=wt2html,wt2wt,html2html
9674 !! wikitext
9675 [[Image:foobar.jpg]]
9676 !! html/php
9677 <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>
9678 </p>
9679 !! html/parsoid
9680 <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>
9681 </p>
9682 !! end
9683
9684 !! test
9685 Simple image (using File: namespace, now canonical)
9686 !! wikitext
9687 [[File:Foobar.jpg]]
9688 !! html/php
9689 <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>
9690 </p>
9691 !! html/parsoid
9692 <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>
9693 </p>
9694 !! end
9695
9696 !! test
9697 Right-aligned image
9698 !! wikitext
9699 [[File:Foobar.jpg|right]]
9700 !! html/php
9701 <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>
9702
9703 !! html/parsoid
9704 <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>
9705 !! end
9706
9707 !! test
9708 Image with caption
9709 !! wikitext
9710 [[File:Foobar.jpg|right|Caption text]]
9711 !! html/php
9712 <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>
9713
9714 !! html/parsoid
9715 <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>
9716 !! end
9717
9718 !! test
9719 Image with caption, bug 53312 #1
9720 !! wikitext
9721 [[File:Foobar.jpg|right|Caption page stuff]]
9722 !! html/php
9723 <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>
9724
9725 !! html/parsoid
9726 <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>
9727 !! end
9728
9729 !! test
9730 Image with caption, bug 53312 #2
9731 !! wikitext
9732 [[File:Foobar.jpg|right|Caption page=]]
9733 !! html/php
9734 <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>
9735
9736 !! html/parsoid
9737 <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>
9738 !! end
9739
9740 !! test
9741 Image with caption, bug 53312 #3
9742 !! wikitext
9743 [[File:Foobar.jpg|right|Caption page=stuff]]
9744 !! html/php
9745 <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>
9746
9747 !! html/parsoid
9748 <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>
9749 !! end
9750
9751 !! test
9752 Allow empty links in image captions (Bug 60753)
9753 !! options
9754 thumbsize=220
9755 !! wikitext
9756 [[File:Foobar.jpg|thumb|Caption [[Link1]]
9757 [[]]
9758 [[Link2]]
9759 ]]
9760 !! html/php
9761 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><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>
9762
9763 !! html/parsoid
9764 <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>
9765 [[]]
9766 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
9767 </figcaption></figure>
9768 !! end
9769
9770 !! test
9771 Link with empty target
9772 !! wikitext
9773 [[]]
9774 !! html
9775 <p>[[]]
9776 </p>
9777 !! end
9778
9779 !! test
9780 Image with empty attribute
9781 !! options
9782 parsoid=wt2html,wt2wt,html2html
9783 !! wikitext
9784 [[File:Foobar.jpg|right||Caption text]]
9785 !! html/php
9786 <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>
9787
9788 !! html/parsoid
9789 <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>
9790 !! end
9791
9792 !! test
9793 1. Block image with individual attributes from templates
9794 !! wikitext
9795 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
9796 !! html/php
9797 <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>
9798
9799 !! html/parsoid
9800 <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>
9801 !! end
9802
9803 !! test
9804 2. Block Image with individual attributes from templates
9805 !! wikitext
9806 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
9807 !! html/php
9808 <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>
9809
9810 !! html/parsoid
9811 <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>
9812 !! end
9813
9814 !! test
9815 3. Inline image with individual attributes from templates
9816 !! wikitext
9817 [[File:Foobar.jpg|{{echo|50px}}]]
9818 !! html/php
9819 <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>
9820 </p>
9821 !! html/parsoid
9822 <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>
9823 !! end
9824
9825 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
9826 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
9827 !! test
9828 Image with multiple attributes from the same template
9829 !! wikitext
9830 [[File:Foobar.jpg|{{image_attribs}}]]
9831 !! html/php
9832 <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>
9833
9834 !! html/parsoid
9835 <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>
9836 !! end
9837
9838 !! test
9839 Image with link tails
9840 !! options
9841 thumbsize=220
9842 !! wikitext
9843 123[[File:Foobar.jpg]]456
9844 123[[File:Foobar.jpg|right]]456
9845 123[[File:Foobar.jpg|thumb]]456
9846 !! html/php
9847 <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
9848 </p>
9849 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
9850 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
9851
9852 !! html/parsoid
9853 <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>
9854 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
9855 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
9856 !! end
9857
9858 !! test
9859 Image with multiple captions -- only last one is accepted
9860 !! wikitext
9861 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9862 !! html/php
9863 <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>
9864
9865 !! html/parsoid
9866 <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>
9867 !! end
9868
9869 !! test
9870 Image with multiple widths -- use last
9871 !! wikitext
9872 [[File:Foobar.jpg|200px|300px|caption]]
9873 !! html/php
9874 <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>
9875 </p>
9876 !! html/parsoid
9877 <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>
9878 !! end
9879
9880 !! test
9881 Image with multiple alignments -- use first (bug 48664)
9882 !! options
9883 thumbsize=220
9884 !! wikitext
9885 [[File:Foobar.jpg|thumb|left|right|center|caption]]
9886
9887 [[File:Foobar.jpg|middle|text-top|caption]]
9888 !! html/php
9889 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
9890 <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>
9891 </p>
9892 !! html/parsoid
9893 <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>
9894 <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>
9895 !! end
9896
9897 !! test
9898 Image with width attribute at different positions
9899 !! wikitext
9900 [[File:Foobar.jpg|200px|right|Caption]]
9901 [[File:Foobar.jpg|right|200px|Caption]]
9902 [[File:Foobar.jpg|right|Caption|200px]]
9903 !! html/php
9904 <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>
9905 <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>
9906 <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>
9907
9908 !! html/parsoid
9909 <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>
9910 <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>
9911 <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>
9912 !! end
9913
9914 # a sad bit of backward-compatibility
9915 !! test
9916 Image with size specified with pxpx (bug 13500, 51628)
9917 !! options
9918 parsoid=wt2html,wt2wt,html2html
9919 !! wikitext
9920 [[File:Foobar.jpg|20pxpx]]
9921 [[File:Foobar.jpg|200x20pxpx]]
9922 !! html/php
9923 <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>
9924 <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>
9925 </p>
9926 !! html/parsoid
9927 <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>
9928 !! end
9929
9930 !! test
9931 Image with link parameter, wiki target
9932 !! wikitext
9933 [[File:Foobar.jpg|link=Main Page]]
9934 !! html/php
9935 <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>
9936 </p>
9937 !! html/parsoid
9938 <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>
9939 !! end
9940
9941 # parsoid bug 49293 (part 1)
9942 !! test
9943 Image with link parameter, URL target
9944 !! wikitext
9945 [[File:Foobar.jpg|link=http://example.com/]]
9946 !! html/php
9947 <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>
9948 </p>
9949 !! html/parsoid
9950 <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>
9951 !! end
9952
9953 # parsoid bug 49293 (part 2)
9954 !! test
9955 Image with link parameter, protocol-less URL target
9956 !! wikitext
9957 [[File:Foobar.jpg|link=//example.com/]]
9958 !! html/php
9959 <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>
9960 </p>
9961 !! html/parsoid
9962 <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>
9963 !! end
9964
9965 !! test
9966 Image with link parameter, wgExternalLinkTarget
9967 !! wikitext
9968 [[Image:foobar.jpg|link=http://example.com/]]
9969 !! config
9970 wgExternalLinkTarget='foobar'
9971 !! html
9972 <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>
9973 </p>
9974 !! end
9975
9976 !! test
9977 Image with link parameter, wgNoFollowLinks set to false
9978 !! wikitext
9979 [[Image:foobar.jpg|link=http://example.com/]]
9980 !! config
9981 wgNoFollowLinks=false
9982 !! html
9983 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9984 </p>
9985 !! end
9986
9987 !! test
9988 Image with link parameter, wgNoFollowDomainExceptions
9989 !! wikitext
9990 [[Image:foobar.jpg|link=http://example.com/]]
9991 !! config
9992 wgNoFollowDomainExceptions='example.com'
9993 !! html
9994 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9995 </p>
9996 !! end
9997
9998 !! test
9999 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10000 !! wikitext
10001 [[Image:foobar.jpg|link=http://example.com/|Title]]
10002 !! config
10003 wgExternalLinkTarget='foobar'
10004 !! html
10005 <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>
10006 </p>
10007 !! end
10008
10009 !! test
10010 Image with empty link parameter
10011 !! wikitext
10012 [[File:Foobar.jpg|link=]]
10013 !! html/php
10014 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10015 </p>
10016 !! html/parsoid
10017 <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>
10018 !! end
10019
10020 !! test
10021 Image with link parameter (wiki target) and unnamed parameter
10022 !! wikitext
10023 [[File:Foobar.jpg|link=Main_Page|Title]]
10024 !! html/php
10025 <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>
10026 </p>
10027 !! html/parsoid
10028 <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>
10029 !! end
10030
10031 !! test
10032 Image with link parameter (URL target) and unnamed parameter
10033 !! wikitext
10034 [[File:Foobar.jpg|link=http://example.com/|Title]]
10035 !! html/php
10036 <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>
10037 </p>
10038 !! html/parsoid
10039 <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>
10040 !! end
10041
10042 !! test
10043 Thumbnail image with link parameter
10044 !! options
10045 thumbsize=220
10046 parsoid=wt2html,wt2wt,html2html
10047 !! wikitext
10048 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10049 !! html/php
10050 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10051
10052 !! html/parsoid
10053 <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>
10054 !! end
10055
10056 !! test
10057 Manually-specified thumbnail image
10058 !! options
10059 thumbsize=220
10060 !! wikitext
10061 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10062 !! html/php
10063 <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>
10064
10065 !! html/parsoid
10066 <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>
10067 !! end
10068
10069 !! test
10070 Manually-specified thumbnail image with explicit link to wiki page
10071 !! options
10072 thumbsize=220
10073 parsoid=wt2html,wt2wt,html2html
10074 !! wikitext
10075 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10076 !! html/php
10077 <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>
10078
10079 !! html/parsoid
10080 <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>
10081 !! end
10082
10083 !! test
10084 Manually-specified thumbnail image with explicit link to url
10085 !! options
10086 thumbsize=220
10087 parsoid=wt2html,wt2wt,html2html
10088 !! wikitext
10089 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10090 !! html/php
10091 <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>
10092
10093 !! html/parsoid
10094 <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>
10095 !! end
10096
10097 !! test
10098 Manually-specified thumbnail image with explicit no link
10099 !! options
10100 thumbsize=220
10101 parsoid=wt2html,wt2wt,html2html
10102 !! wikitext
10103 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10104 !! html/php
10105 <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>
10106
10107 !! html/parsoid
10108 <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>
10109 !! end
10110
10111 !! test
10112 Manually-specified thumbnail image with explicit link and alt text
10113 !! options
10114 thumbsize=220
10115 parsoid=wt2html,wt2wt,html2html
10116 !! wikitext
10117 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10118 !! html/php
10119 <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>
10120
10121 !! html/parsoid
10122 <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>
10123 !! end
10124
10125 !! test
10126 Image with frame and link
10127 !! options
10128 parsoid=wt2html,wt2wt,html2html
10129 !! wikitext
10130 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10131 !! html/php
10132 <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>
10133
10134 !! html/parsoid
10135 <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>
10136 !! end
10137
10138 !! test
10139 Image with frame and link and explicit alt
10140 !! options
10141 parsoid=wt2html,wt2wt,html2html
10142 !! wikitext
10143 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10144 !! html/php
10145 <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>
10146
10147 !! html/parsoid
10148 <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>
10149 !! end
10150
10151 !! test
10152 Image with wiki markup in implicit alt
10153 !! options
10154 parsoid=wt2html,wt2wt,html2html
10155 !! wikitext
10156 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10157
10158 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10159 !! html/php
10160 <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>
10161 </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>
10162 </p>
10163 !! html/parsoid
10164 <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>
10165 <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>
10166 !! end
10167
10168 ###################
10169 # Image sizing.
10170 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10171 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10172 # Foobar has actual size of 1941x220
10173 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10174 # a scalable format.
10175 # 2. Framed images always ignore size options; always render at default size.
10176 # 3. "Unspecified format" and border are the only types which can be
10177 # enlarged.
10178
10179 !! test
10180 Image: "unspecified format" and border enlarge
10181 !! options
10182 parsoid=wt2html,wt2wt,html2html
10183 !! wikitext
10184 [[File:Foobar.jpg|2000px]]
10185
10186 [[File:Foobar.jpg|border|2000px]]
10187 !! html/php
10188 <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>
10189 </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>
10190 </p>
10191 !! html/parsoid
10192 <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>
10193 <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>
10194 !! end
10195
10196 !! test
10197 Image: "unspecified format" and border reduce
10198 !! options
10199 parsoid=wt2html,wt2wt,html2html
10200 !! wikitext
10201 [[File:Foobar.jpg|1000px]]
10202
10203 [[File:Foobar.jpg|border|1000px]]
10204 !! html/php
10205 <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>
10206 </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>
10207 </p>
10208 !! html/parsoid
10209 <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>
10210 <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>
10211 !! end
10212
10213 !! test
10214 Image: thumbs reduce
10215 !! options
10216 parsoid=wt2html,wt2wt,html2html
10217 !! wikitext
10218 [[File:Foobar.jpg|thumb|50px]]
10219 !! html/php
10220 <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>
10221
10222 !! html/parsoid
10223 <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>
10224 !! end
10225
10226 !! test
10227 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10228 !! options
10229 parsoid=wt2html,wt2wt,html2html
10230 !! wikitext
10231 [[File:Foobar.jpg|thumb|2000px]]
10232
10233 [[File:Foobar.svg|thumb|2000px]]
10234 !! html/php
10235 <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>
10236 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10237
10238 !! html/parsoid
10239 <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>
10240 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></figure>
10241 !! end
10242
10243 !! test
10244 Image: frameless can reduce in size
10245 !! options
10246 parsoid=wt2html,wt2wt,html2html
10247 !! wikitext
10248 [[File:Foobar.jpg|frameless|50px]]
10249 !! html/php
10250 <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>
10251 </p>
10252 !! html/parsoid
10253 <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>
10254 !! end
10255
10256 !! test
10257 Image: bitmap frameless can't be enlarged past original size, but vector can
10258 !! options
10259 parsoid=wt2html,wt2wt,html2html
10260 !! wikitext
10261 [[File:Foobar.jpg|frameless|2000px]]
10262
10263 [[File:Foobar.svg|frameless|2000px]]
10264 !! html/php
10265 <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>
10266 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
10267 </p>
10268 !! html/parsoid
10269 <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>
10270 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></span></p>
10271 !! end
10272
10273 !! test
10274 Image: framed images are always unscaled.
10275 !! options
10276 parsoid=wt2html,wt2wt,html2html
10277 !! wikitext
10278 [[File:Foobar.jpg|frame]]
10279
10280 [[File:Foobar.jpg|frame|50px]]
10281
10282 [[File:Foobar.jpg|frame|50x50px]]
10283
10284 [[File:Foobar.jpg|frame|2000px]]
10285 !! html/php
10286 <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>
10287 <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>
10288 <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>
10289 <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>
10290
10291 !! html/parsoid
10292 <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><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>
10293 !! end
10294
10295 ###################
10296
10297 !! test
10298 Link to image page- image page normally doesn't exists, hence edit link
10299 Add test with existing image page
10300 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10301 !! wikitext
10302 [[:Image:test]]
10303 !! html
10304 <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>
10305 </p>
10306 !! end
10307
10308 !! test
10309 bug 18784 Link to non-existent image page with caption should use caption as link text
10310 !! wikitext
10311 [[:Image:test|caption]]
10312 !! html
10313 <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>
10314 </p>
10315 !! end
10316
10317 !! test
10318 Frameless image caption with a free URL
10319 !! wikitext
10320 [[File:Foobar.jpg|http://example.com]]
10321 !! html/php
10322 <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>
10323 </p>
10324 !! html/parsoid
10325 <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>
10326 !! end
10327
10328 !! test
10329 Thumbnail image caption with a free URL
10330 !! options
10331 thumbsize=220
10332 !! wikitext
10333 [[File:Foobar.jpg|thumb|http://example.com]]
10334 !! html/php
10335 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><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>
10336
10337 !! html/parsoid
10338 <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>
10339 !! end
10340
10341 !! test
10342 Thumbnail image caption with a free URL and explicit alt
10343 !! options
10344 thumbsize=220
10345 parsoid=wt2html,wt2wt,html2html
10346 !! wikitext
10347 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10348 !! html/php
10349 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><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>
10350
10351 !! html/parsoid
10352 <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>
10353 !! end
10354
10355 !! test
10356 SVG thumbnails with no language set
10357 !! options
10358 !! wikitext
10359 [[File:Foobar.svg|thumb|caption]]
10360 !! html/php
10361 <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>
10362
10363 !! html/parsoid
10364 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
10365 !! end
10366
10367 !! test
10368 SVG thumbnails with language de
10369 !! options
10370 parsoid=wt2html,wt2wt,html2html
10371 !! wikitext
10372 [[File:Foobar.svg|thumb|caption|lang=de]]
10373 !! html/php
10374 <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>
10375
10376 !! html/parsoid
10377 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
10378 !! end
10379
10380 !! test
10381 SVG thumbnails with invalid language code
10382 !! options
10383 parsoid=wt2html,wt2wt,html2html
10384 !! wikitext
10385 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10386 !! html/php
10387 <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>
10388
10389 !! html/parsoid
10390 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
10391 !! end
10392
10393 !! test
10394 BUG 1887: A ISBN with a thumbnail
10395 !! wikitext
10396 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10397 !! html/php
10398 <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>
10399
10400 !! html/parsoid
10401 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
10402 !! end
10403
10404 !! test
10405 BUG 1887: A RFC with a thumbnail
10406 !! wikitext
10407 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10408 !! html/php
10409 <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>
10410
10411 !! html/parsoid
10412 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
10413 !! end
10414
10415 !! test
10416 BUG 1887: A mailto link with a thumbnail
10417 !! wikitext
10418 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
10419 !! html/php
10420 <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>
10421
10422 !! html/parsoid
10423 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
10424 !! end
10425
10426 # Pending resolution to bug 368
10427 !! test
10428 BUG 648: Frameless image caption with a link
10429 !! wikitext
10430 [[File:Foobar.jpg|text with a [[link]] in it]]
10431 !! html/php
10432 <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>
10433 </p>
10434 !! html/parsoid
10435 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10436 !! end
10437
10438 !! test
10439 BUG 648: Frameless image caption with a link (suffix)
10440 !! wikitext
10441 [[File:Foobar.jpg|text with a [[link]]foo in it]]
10442 !! html/php
10443 <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>
10444 </p>
10445 !! html/parsoid
10446 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10447 !! end
10448
10449 !! test
10450 BUG 648: Frameless image caption with an interwiki link
10451 !! wikitext
10452 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
10453 !! html/php
10454 <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>
10455 </p>
10456 !! html/parsoid
10457 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10458 !! end
10459
10460 !! test
10461 BUG 648: Frameless image caption with a piped interwiki link
10462 !! wikitext
10463 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10464 !! html/php
10465 <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>
10466 </p>
10467 !! html/parsoid
10468 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10469 !! end
10470
10471 !! test
10472 Escape HTML special chars in image alt text
10473 !! wikitext
10474 [[File:Foobar.jpg|& < > "]]
10475 !! html/php
10476 <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>
10477 </p>
10478 !! html/parsoid
10479 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp; &lt; > \""}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10480 !! end
10481
10482 !! test
10483 BUG 499: Alt text should have &#1234;, not &amp;1234;
10484 !! wikitext
10485 [[File:Foobar.jpg|&#9792;]]
10486 !! html/php
10487 <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>
10488 </p>
10489 !! html/parsoid
10490 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;#9792;"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10491 !! end
10492
10493 !! test
10494 Broken image caption with link
10495 !! options
10496 parsoid=wt2html,wt2wt,html2html
10497 !! wikitext
10498 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10499 !! html/php
10500 <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.
10501 </p>
10502 !! html/parsoid
10503 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page">this</a> is just an ordinary link.</p>
10504 !! end
10505
10506 !! test
10507 Image caption containing another image
10508 !! wikitext
10509 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
10510 !! html/php
10511 <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="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
10512
10513 !! html/parsoid
10514 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a></span> inside it!</figcaption></figure>
10515 !! end
10516
10517 !! test
10518 Image: caption containing a newline
10519 !! wikitext
10520 [[File:Foobar.jpg|This
10521 *is some text]]
10522 !! html/php
10523 <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>
10524 </p>
10525 !! html/parsoid
10526 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10527 !!end
10528
10529 !!test
10530 Image: caption containing leading space
10531 (The leading space should not trigger nowiki escaping in wt2wt mode)
10532 !! wikitext
10533 [[File:Foobar.jpg|thumb| bar]]
10534 !! html/php
10535 <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>
10536
10537 !! html/parsoid
10538 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
10539 !!end
10540
10541 !! test
10542 Image: caption containing a table
10543 !! options
10544 parsoid=wt2html,wt2wt,html2html
10545 !! wikitext
10546 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10547 {|
10548 ! Foo !! Bar
10549 |-
10550 | Foo1 || Bar1
10551 |}
10552 and some more text.]]
10553 !! html/php
10554 <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>
10555
10556 !! html/parsoid
10557 <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
10558 <table>
10559 <tbody>
10560 <tr><th>Foo </th><th>Bar</th></tr>
10561 <tr>
10562 <td>Foo1 </td>
10563 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10564 !! end
10565
10566 !! test
10567 Bug 3090: External links other than http: in image captions
10568 !! wikitext
10569 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10570 !! html/php
10571 <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>
10572
10573 !! html/parsoid
10574 <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>
10575 !! end
10576
10577 !! test
10578 Custom class
10579 !! options
10580 parsoid=wt2html,wt2wt,html2html
10581 !! wikitext
10582 [[Image:foobar.jpg|a|class=b]]
10583 !! html/php
10584 <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>
10585 </p>
10586 !! html/parsoid
10587 <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>
10588 !! end
10589
10590 !! test
10591 Localized image handling (1).
10592 !! options
10593 parsoid=wt2html,wt2wt,html2html
10594 language=es
10595 !! wikitext
10596 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10597 !! html/php
10598 <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>
10599
10600 !! html/parsoid
10601 <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>
10602 !! end
10603
10604 !! test
10605 Localized image handling (2).
10606 !! options
10607 thumbsize=220
10608 parsoid=wt2html,wt2wt,html2html
10609 language=es
10610 !! wikitext
10611 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10612 !! html/php
10613 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10614
10615 !! html/parsoid
10616 <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>
10617 !! end
10618
10619 !! test
10620 "border", "frameless" and "class" attributes on an image.
10621 !! options
10622 thumbsize=220
10623 parsoid=wt2html,wt2wt,html2html
10624 !! wikitext
10625 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10626 !! html/php
10627 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
10628 </p>
10629 !! html/parsoid
10630 <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>
10631 !! end
10632
10633 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10634 !! test
10635 Invalid image attributes (bug 62500)
10636 !! options
10637 thumbsize=220
10638 parsoid=wt2html,wt2wt,html2html
10639 !! wikitext
10640 [[File:Foobar.jpg|thumb|float|left|caption]]
10641
10642 [[File:Foobar.jpg|thumb|righ|caption]]
10643
10644 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10645 !! html/php
10646 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10647 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10648 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10649
10650 !! html/parsoid
10651 <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>
10652 !! end
10653
10654 !! article
10655 File:Barfoo.jpg
10656 !! text
10657 #REDIRECT [[File:Barfoo.jpg]]
10658 !! endarticle
10659
10660 !! test
10661 Redirected image
10662 !! wikitext
10663 [[Image:Barfoo.jpg]]
10664 !! html
10665 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10666 </p>
10667 !! end
10668
10669 !! test
10670 Missing image with uploads disabled
10671 !! options
10672 wgEnableUploads=0
10673 !! wikitext
10674 [[Image:Foobaz.jpg]]
10675 !! html
10676 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10677 </p>
10678 !! end
10679
10680 # Parsoid-specific testing for images
10681 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10682 # Currently imperfect due to a flaw in the Parsoid testrunner
10683 # Work in progress
10684 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10685 # image tests.
10686
10687 !! test
10688 Parsoid-specific image handling - simple image with size and middle alignment
10689 !! wikitext
10690 [[File:Foobar.jpg|middle|50px]]
10691 !! html/parsoid
10692 <p><span class="mw-valign-middle" typeof="mw:Image">
10693 <a href="File:Foobar.jpg">
10694 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10695 </a>
10696 </span>
10697 </p>
10698 !! end
10699
10700 !! test
10701 Parsoid-specific image handling - simple image with size, middle alignment,
10702 non-standard namespace alias
10703 !! options
10704 parsoid=wt2wt,wt2html,html2html
10705 !! wikitext
10706 [[Image:Foobar.jpg|middle|50px]]
10707 !! html/parsoid
10708 <p><span class="mw-valign-middle" typeof="mw:Image">
10709 <a href="File:Foobar.jpg">
10710 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10711 </a>
10712 </span>
10713 </p>
10714 !! end
10715
10716 !! test
10717 Parsoid-specific image handling - simple image with size and middle alignment
10718 (existing content)
10719 !! wikitext
10720 [[File:Foobar.jpg|50px|middle]]
10721 !! html/parsoid
10722 <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>
10723 !! end
10724
10725 !! test
10726 Parsoid-specific image handling - simple image with size and middle alignment
10727 and non-standard namespace name
10728 !! options
10729 parsoid=wt2html,wt2wt,html2html
10730 !! wikitext
10731 [[Image:Foobar.jpg|50px|middle]]
10732 !! html/parsoid
10733 <p><span class="mw-valign-middle" typeof="mw:Image">
10734 <a href="File:Foobar.jpg">
10735 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10736 </a>
10737 </span>
10738 </p>
10739 !! end
10740
10741 !! test
10742 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10743 !! wikitext
10744 [[File:Foobar.jpg|500x10px|baseline|caption]]
10745 !! html/parsoid
10746 <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>
10747 !! end
10748
10749 !! test
10750 Parsoid-specific image handling - simple image with border and size spec
10751 !! wikitext
10752 [[File:Foobar.jpg|50px|border|caption]]
10753 !! html/parsoid
10754 <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>
10755 !! end
10756
10757 !! test
10758 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10759 !! wikitext
10760 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10761 !! html/parsoid
10762 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10763 <a href="File:Foobar.jpg">
10764 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10765 </a>
10766 <figcaption>caption content</figcaption>
10767 </figure>
10768 !! end
10769
10770 !! test
10771 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10772 (existing content)
10773 !! wikitext
10774 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10775 !! html/parsoid
10776 <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>
10777 !! end
10778
10779 !! test
10780 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10781 !! wikitext
10782 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10783 !! html/parsoid
10784 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10785 <a href="File:Foobar.jpg">
10786 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10787 </a>
10788 <figcaption>caption</figcaption>
10789 </figure>
10790 !! end
10791
10792 !! test
10793 Parsoid-specific image handling - thumbnail with specific size, halign,
10794 valign, and caption (existing content)
10795 !! wikitext
10796 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10797 !! html/parsoid
10798 <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>
10799 !! end
10800
10801 !! test
10802 Parsoid-specific image handling - framed image with specific size and caption
10803 !! wikitext
10804 [[Image:Foobar.jpg|frame|500x50px|caption]]
10805 !! html/parsoid
10806 <figure typeof="mw:Image/Frame">
10807 <a href="File:Foobar.jpg">
10808 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10809 </a>
10810 <figcaption>caption</figcaption>
10811 </figure>
10812 !! end
10813
10814 !! test
10815 Parsoid-specific image handling - framed image with specific size and caption
10816 (existing content)
10817 !! wikitext
10818 [[File:Foobar.jpg|442x50px|frame|caption]]
10819 !! html/parsoid
10820 <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>
10821 !! end
10822
10823 !! test
10824 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10825 !! wikitext
10826 [[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10827 !! html/parsoid
10828 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10829 <a href="File:Foobar.jpg">
10830 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10831 </a>
10832 <figcaption>caption</figcaption>
10833 </figure>
10834 !! end
10835
10836 !! test
10837 Parsoid-specific image handling - framed image with specific size, halign,
10838 valign, and caption (existing content)
10839 !! wikitext
10840 [[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
10841 !! html/parsoid
10842 <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>
10843 !! end
10844
10845 !! test
10846 Parsoid-specific image handling - frameless image with specific size, border, and caption
10847 !! wikitext
10848 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
10849 !! html/parsoid
10850 <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>
10851 !! end
10852
10853 !! test
10854 Parsoid-specific image handling - simple image with a formatted caption
10855 !! wikitext
10856 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10857 !! html/parsoid
10858 <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>"}'>
10859 <a href="File:Foobar.jpg">
10860 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10861 </a></span></p>
10862 !! end
10863
10864 !! test
10865 Parsoid-specific image handling - caption with a template in it
10866 !! wikitext
10867 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
10868 !! html/parsoid
10869 <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>
10870 !! end
10871
10872 !! test
10873 Parsoid-specific image handling - caption with unbalanced tags in it
10874 !! options
10875 parsoid=wt2html,wt2wt,html2html
10876 !! wikitext
10877 foo
10878 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
10879 bar
10880 !! html/parsoid
10881 <p>foo</p>
10882 <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>
10883 <p>bar</p>
10884 !! end
10885
10886 !! test
10887 Parsoid-specific image handling - empty caption
10888 !! wikitext
10889 [[File:Foobar.jpg|thumb|]]
10890 !! html/parsoid
10891 <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>
10892 !! end
10893
10894 !! test
10895 Parsoid-specific image handling - whitespace caption
10896 !! wikitext
10897 [[File:Foobar.jpg|thumb| ]]
10898 !! html/parsoid
10899 <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>
10900 !! end
10901
10902 !! test
10903 Parsoid-specific image handling - lang option
10904 !! wikitext
10905 foo
10906 [[File:Foobar.svg|lang=de|caption]]
10907 bar
10908 !! html/parsoid
10909 <p>foo
10910 <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>
10911 bar</p>
10912 !! end
10913
10914
10915 ###
10916 ### Subpages
10917 ###
10918 !! article
10919 Subpage test/subpage
10920 !! text
10921 foo
10922 !! endarticle
10923
10924 !! test
10925 Subpage link
10926 !! options
10927 subpage title=[[Subpage test]]
10928 !! wikitext
10929 [[/subpage]]
10930 !! html
10931 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10932 </p>
10933 !! end
10934
10935 !! test
10936 Subpage noslash link
10937 !! options
10938 subpage title=[[Subpage test]]
10939 !! wikitext
10940 [[/subpage/]]
10941 !! html
10942 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10943 </p>
10944 !! end
10945
10946 # TODO: make this PHP-parser compatible!
10947 !! test
10948 Relative subpage noslash link
10949 !! options
10950 parsoid=wt2wt,wt2html,html2html
10951 subpage title=[[Subpage test/1/2/3/4]]
10952 !! wikitext
10953 [[../../subpage/]]
10954
10955 [[../../subpage]]
10956 !! html
10957 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10958 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10959 !! end
10960
10961 # TODO: make this PHP-parser compatible!
10962 !! test
10963 Parsoid: dot-slash prefixed wikilinks
10964 !! options
10965 parsoid=wt2wt,wt2html,html2html
10966 !! wikitext
10967 [[./foo]]
10968
10969 [[././bar]]
10970
10971 [[././baz/]]
10972 !! html
10973 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10974 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10975 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10976 !! end
10977
10978 !! test
10979 Disabled subpages
10980 !! wikitext
10981 [[/subpage]]
10982 !! html
10983 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10984 </p>
10985 !! end
10986
10987 !! test
10988 BUG 561: {{/Subpage}}
10989 !! options
10990 subpage title=[[Page]]
10991 !! wikitext
10992 {{/Subpage}}
10993 !! html
10994 <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>
10995 </p>
10996 !! end
10997
10998 ###
10999 ### Categories
11000 ###
11001 !! article
11002 Category:MediaWiki User's Guide
11003 !! text
11004 blah
11005 !! endarticle
11006
11007 !! test
11008 Link to category
11009 !! wikitext
11010 [[:Category:MediaWiki User's Guide]]
11011 !! html
11012 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11013 </p>
11014 !! end
11015
11016 !! test
11017 Simple category
11018 !! options
11019 cat
11020 !! wikitext
11021 [[Category:MediaWiki User's Guide]]
11022 !! html
11023 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11024 !! end
11025
11026 !! test
11027 PAGESINCATEGORY invalid title fatal (r33546 fix)
11028 !! wikitext
11029 {{PAGESINCATEGORY:<bogus>}}
11030 !! html
11031 <p>0
11032 </p>
11033 !! end
11034
11035 !! test
11036 Category with different sort key
11037 !! options
11038 cat
11039 !! wikitext
11040 [[Category:MediaWiki User's Guide|Foo]]
11041 !! html
11042 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11043 !! end
11044
11045 !! test
11046 Category with identical sort key
11047 !! options
11048 cat
11049 !! wikitext
11050 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11051 !! html
11052 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11053 !! end
11054
11055 !! test
11056 Category with empty sort key
11057 !! options
11058 cat
11059 pst
11060 !! wikitext
11061 [[Category:MediaWiki User's Guide|]]
11062 !! html
11063 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11064 !! end
11065
11066 !! test
11067 Category with empty sort key and parentheses
11068 !! options
11069 cat
11070 pst
11071 !! wikitext
11072 [[Category:Foo (bar)|]]
11073 !! html
11074 [[Category:Foo (bar)|Foo]]
11075 !! end
11076
11077 !! test
11078 Category with link tail
11079 !! options
11080 cat
11081 pst
11082 !! wikitext
11083 123[[Category:Foo]]456
11084 !! html
11085 123[[Category:Foo]]456
11086 !! end
11087
11088 !! test
11089 Category with template
11090 !! options
11091 cat
11092 pst
11093 !! wikitext
11094 [[Category:{{echo|Foo}}]]
11095 !! html
11096 [[Category:{{echo|Foo}}]]
11097 !! end
11098
11099 !! test
11100 Category with template in sort key
11101 !! options
11102 cat
11103 pst
11104 !! wikitext
11105 [[Category:Foo|{{echo|Bar}}]]
11106 !! html
11107 [[Category:Foo|{{echo|Bar}}]]
11108 !! end
11109
11110 !! test
11111 Category with template in sort key and title
11112 !! options
11113 cat
11114 pst
11115 !! wikitext
11116 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11117 !! html
11118 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11119 !! end
11120
11121 !! test
11122 Category / paragraph interactions
11123 !! wikitext
11124 Foo [[Category:Baz]] Bar
11125
11126 Foo [[Category:Baz]]
11127 Bar
11128
11129 Foo
11130 [[Category:Baz]]
11131 Bar
11132
11133 Foo
11134 [[Category:Baz]] Bar
11135
11136 Foo
11137 [[Category:Baz]]
11138 [[Category:Baz]]
11139 [[Category:Baz]]
11140 Bar
11141
11142 [[Category:Baz]]
11143 [[Category:Baz]]
11144 [[Category:Baz]]
11145
11146 [[Category:Baz]]
11147 {{echo|[[Category:Baz]]}}
11148 [[Category:Baz]]
11149 !! html
11150 <p>Foo Bar
11151 </p><p>Foo
11152 Bar
11153 </p><p>Foo
11154 Bar
11155 </p><p>Foo Bar
11156 </p><p>Foo
11157 Bar
11158 </p>
11159 !! end
11160
11161 !! test
11162 Parsoid: Serialize link to category page with colon escape
11163 !! options
11164 parsoid
11165 !! wikitext
11166
11167 [[:Category:Foo]]
11168 [[:Category:Foo|Bar]]
11169 !! html
11170 <p>
11171 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11172 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11173 </p>
11174 !! end
11175
11176 !! test
11177 Parsoid: Link prefix/suffixes aren't applied to category links
11178 !! options
11179 parsoid=wt2html,wt2wt,html2html
11180 language=is
11181 !! wikitext
11182 x[[Category:Foo]]y
11183 !! html
11184 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11185 !! end
11186
11187 !! test
11188 Parsoid: Serialize link to file page with colon escape
11189 !! options
11190 parsoid
11191 !! wikitext
11192
11193 [[:File:Foo.png]]
11194 [[:File:Foo.png|Bar]]
11195 !! html
11196 <p>
11197 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11198 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11199 </p>
11200 !! end
11201
11202 !! test
11203 Parsoid: Serialize a genuine category link without colon escape
11204 !! options
11205 parsoid
11206 !! wikitext
11207 [[Category:Foo]]
11208 [[Category:Foo|Bar]]
11209 !! html
11210 <link rel="mw:PageProp/Category" href="Category:Foo">
11211 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11212 !! end
11213
11214 !! test
11215 Parsoid: Defaultsort
11216 !! options
11217 parsoid
11218 !! wikitext
11219 {{DEFAULTSORT:Foo}}
11220 !! html
11221 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11222 !! end
11223
11224 ###
11225 ### Inter-language links
11226 ###
11227 !! test
11228 Inter-language links
11229 !! options
11230 ill
11231 !! wikitext
11232 [[es:Alimento]]
11233 [[fr:Nourriture]]
11234 [[zh:&#39135;&#21697;]]
11235 !! html
11236 es:Alimento fr:Nourriture zh:食品
11237 !! end
11238
11239 !! test
11240 Duplicate interlanguage links (bug 24502)
11241 !! options
11242 ill
11243 !! wikitext
11244 [[es:1]]
11245 [[es:2]]
11246 [[fr:1]]
11247 [[fr:2]]
11248 !! html
11249 es:1 fr:1
11250 !! end
11251
11252 ###
11253 ### Sections
11254 ###
11255 !! test
11256 Basic section headings
11257 !! wikitext
11258 == Headline 1 ==
11259 Some text
11260
11261 ==Headline 2==
11262 More
11263 ===Smaller headline===
11264 Blah blah
11265 !! html
11266 <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>
11267 <p>Some text
11268 </p>
11269 <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>
11270 <p>More
11271 </p>
11272 <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>
11273 <p>Blah blah
11274 </p>
11275 !! end
11276
11277 !! test
11278 Section headings with TOC
11279 !! wikitext
11280 == Headline 1 ==
11281 === Subheadline 1 ===
11282 ===== Skipping a level =====
11283 ====== Skipping a level ======
11284
11285 == Headline 2 ==
11286 Some text
11287 ===Another headline===
11288 !! html
11289 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11290 <ul>
11291 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11292 <ul>
11293 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11294 <ul>
11295 <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>
11296 <ul>
11297 <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>
11298 </ul>
11299 </li>
11300 </ul>
11301 </li>
11302 </ul>
11303 </li>
11304 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11305 <ul>
11306 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11307 </ul>
11308 </li>
11309 </ul>
11310 </div>
11311
11312 <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>
11313 <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>
11314 <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>
11315 <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>
11316 <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>
11317 <p>Some text
11318 </p>
11319 <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>
11320
11321 !! end
11322
11323 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11324 !! test
11325 Handling of sections up to level 6 and beyond
11326 !! wikitext
11327 = Level 1 Heading=
11328 == Level 2 Heading==
11329 === Level 3 Heading===
11330 ==== Level 4 Heading====
11331 ===== Level 5 Heading=====
11332 ====== Level 6 Heading======
11333 ======= Level 7 Heading=======
11334 ======== Level 8 Heading========
11335 ========= Level 9 Heading=========
11336 ========== Level 10 Heading==========
11337 !! html
11338 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11339 <ul>
11340 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11341 <ul>
11342 <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>
11343 <ul>
11344 <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>
11345 <ul>
11346 <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>
11347 <ul>
11348 <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>
11349 <ul>
11350 <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>
11351 <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>
11352 <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>
11353 <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>
11354 <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>
11355 </ul>
11356 </li>
11357 </ul>
11358 </li>
11359 </ul>
11360 </li>
11361 </ul>
11362 </li>
11363 </ul>
11364 </li>
11365 </ul>
11366 </div>
11367
11368 <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>
11369 <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>
11370 <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>
11371 <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>
11372 <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>
11373 <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>
11374 <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>
11375 <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>
11376 <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>
11377 <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>
11378
11379 !! end
11380
11381 !! test
11382 TOC regression (bug 9764)
11383 !! wikitext
11384 == title 1 ==
11385 === title 1.1 ===
11386 ==== title 1.1.1 ====
11387 === title 1.2 ===
11388 == title 2 ==
11389 === title 2.1 ===
11390 !! html
11391 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11392 <ul>
11393 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11394 <ul>
11395 <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>
11396 <ul>
11397 <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>
11398 </ul>
11399 </li>
11400 <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>
11401 </ul>
11402 </li>
11403 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11404 <ul>
11405 <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>
11406 </ul>
11407 </li>
11408 </ul>
11409 </div>
11410
11411 <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>
11412 <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>
11413 <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>
11414 <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>
11415 <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>
11416 <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>
11417
11418 !! end
11419
11420 !! test
11421 TOC with wgMaxTocLevel=3 (bug 6204)
11422 !! options
11423 wgMaxTocLevel=3
11424 !! wikitext
11425 == title 1 ==
11426 === title 1.1 ===
11427 ==== title 1.1.1 ====
11428 === title 1.2 ===
11429 == title 2 ==
11430 === title 2.1 ===
11431 !! html
11432 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11433 <ul>
11434 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11435 <ul>
11436 <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>
11437 <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>
11438 </ul>
11439 </li>
11440 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11441 <ul>
11442 <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>
11443 </ul>
11444 </li>
11445 </ul>
11446 </div>
11447
11448 <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>
11449 <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>
11450 <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>
11451 <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>
11452 <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>
11453 <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>
11454
11455 !! end
11456
11457 !! test
11458 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11459 !! options
11460 wgMaxTocLevel=3
11461 !! wikitext
11462 ==Section 1==
11463 ===Section 1.1===
11464 ====Section 1.1.1====
11465 ====Section 1.1.1.1====
11466 ==Section 2==
11467 !! html
11468 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11469 <ul>
11470 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11471 <ul>
11472 <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>
11473 </ul>
11474 </li>
11475 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11476 </ul>
11477 </div>
11478
11479 <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>
11480 <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>
11481 <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>
11482 <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>
11483 <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>
11484
11485 !! end
11486
11487
11488 !! test
11489 Resolving duplicate section names
11490 !! wikitext
11491 == Foo bar ==
11492 == Foo bar ==
11493 !! html
11494 <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>
11495 <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>
11496
11497 !! end
11498
11499 !! test
11500 Resolving duplicate section names with differing case (bug 10721)
11501 !! wikitext
11502 == Foo bar ==
11503 == Foo Bar ==
11504 !! html
11505 <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>
11506 <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>
11507
11508 !! end
11509
11510 !! article
11511 Template:sections
11512 !! text
11513 ===Section 1===
11514 ==Section 2==
11515 !! endarticle
11516
11517 !! test
11518 Template with sections, __NOTOC__
11519 !! wikitext
11520 __NOTOC__
11521 ==Section 0==
11522 {{sections}}
11523 ==Section 4==
11524 !! html
11525 <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>
11526 <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>
11527 <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>
11528 <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>
11529
11530 !! end
11531
11532 !! test
11533 __NOEDITSECTION__ keyword
11534 !! wikitext
11535 __NOEDITSECTION__
11536 ==Section 1==
11537 ==Section 2==
11538 !! html
11539 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11540 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11541
11542 !! end
11543
11544 !! test
11545 Link inside a section heading
11546 !! wikitext
11547 ==Section with a [[Main Page|link]] in it==
11548 !! html
11549 <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>
11550
11551 !! end
11552
11553 !! test
11554 TOC regression (bug 12077)
11555 !! wikitext
11556 __TOC__
11557 == title 1 ==
11558 === title 1.1 ===
11559 == title 2 ==
11560 !! html
11561 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11562 <ul>
11563 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11564 <ul>
11565 <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>
11566 </ul>
11567 </li>
11568 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11569 </ul>
11570 </div>
11571
11572 <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>
11573 <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>
11574 <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>
11575
11576 !! end
11577
11578 !! test
11579 BUG 1219 URL next to image (good)
11580 !! wikitext
11581 http://example.com [[Image:foobar.jpg]]
11582 !! html
11583 <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>
11584 </p>
11585 !!end
11586
11587 !! test
11588 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11589 !! wikitext
11590 ===
11591 The line above must have a trailing space!
11592 === <!--
11593 --> <!-- -->
11594 But just in case it doesn't...
11595 !! html
11596 <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>
11597 <p>The line above must have a trailing space!
11598 </p>
11599 <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>
11600 <p>But just in case it doesn't...
11601 </p>
11602 !! end
11603
11604 !! test
11605 Header with special characters (bug 25462)
11606 !! wikitext
11607 The tooltips shall not show entities to the user (ie. be double escaped)
11608
11609 == text > text ==
11610 section 1
11611
11612 == text < text ==
11613 section 2
11614
11615 == text & text ==
11616 section 3
11617
11618 == text ' text ==
11619 section 4
11620
11621 == text " text ==
11622 section 5
11623 !! html
11624 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11625 </p>
11626 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11627 <ul>
11628 <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>
11629 <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>
11630 <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>
11631 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11632 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11633 </ul>
11634 </div>
11635
11636 <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>
11637 <p>section 1
11638 </p>
11639 <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>
11640 <p>section 2
11641 </p>
11642 <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>
11643 <p>section 3
11644 </p>
11645 <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>
11646 <p>section 4
11647 </p>
11648 <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>
11649 <p>section 5
11650 </p>
11651 !! end
11652
11653 !! test
11654 Headers with excess '=' characters
11655 (Are similar tests necessary beyond the 1st level?)
11656 !! wikitext
11657 =foo==
11658 ==foo=
11659 =''italic'' heading==
11660 ==''italic'' heading=
11661 !! html
11662 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11663 <ul>
11664 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11665 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11666 <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>
11667 <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>
11668 </ul>
11669 </div>
11670
11671 <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>
11672 <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>
11673 <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>
11674 <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>
11675
11676 !! end
11677
11678 !! test
11679 HTML headers vs TOC (bug 23393)
11680 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11681 !! wikitext
11682 <h1>Header 1</h1>
11683 == Header 1.1 ==
11684 == Header 1.2 ==
11685
11686 <h1>Header 2
11687 </h1>
11688 == Header 2.1 ==
11689 == Header 2.2 ==
11690 __NOEDITSECTION__
11691 !! html
11692 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11693 <ul>
11694 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11695 <ul>
11696 <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>
11697 <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>
11698 </ul>
11699 </li>
11700 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11701 <ul>
11702 <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>
11703 <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>
11704 </ul>
11705 </li>
11706 </ul>
11707 </div>
11708
11709 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11710 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11711 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11712 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11713 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11714 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11715
11716 !! end
11717
11718 !! test
11719 BUG 1219 URL next to image (broken)
11720 !! wikitext
11721 http://example.com[[Image:foobar.jpg]]
11722 !! html
11723 <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>
11724 </p>
11725 !!end
11726
11727 !! test
11728 Bug 1186 news: in the middle of text
11729 !! wikitext
11730 http://en.wikinews.org/wiki/Wikinews:Workplace
11731 !! html
11732 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11733 </p>
11734 !!end
11735
11736
11737 !! test
11738 Namespaced link must have a title
11739 !! wikitext
11740 [[Project:]]
11741 !! html
11742 <p>[[Project:]]
11743 </p>
11744 !!end
11745
11746 !! test
11747 Namespaced link must have a title (bad fragment version)
11748 !! wikitext
11749 [[Project:#fragment]]
11750 !! html
11751 <p>[[Project:#fragment]]
11752 </p>
11753 !!end
11754
11755
11756 ###
11757 ### HTML tags and HTML attributes
11758 ###
11759
11760 !! test
11761 div with no attributes
11762 !! wikitext
11763 <div>HTML rocks</div>
11764 !! html
11765 <div>HTML rocks</div>
11766
11767 !! end
11768
11769 !! test
11770 div with double-quoted attribute
11771 !! wikitext
11772 <div id="rock">HTML rocks</div>
11773 !! html
11774 <div id="rock">HTML rocks</div>
11775
11776 !! end
11777
11778 !! test
11779 div with single-quoted attribute
11780 !! wikitext
11781 <div id='rock'>HTML rocks</div>
11782 !! html
11783 <div id="rock">HTML rocks</div>
11784
11785 !! end
11786
11787 !! test
11788 div with unquoted attribute
11789 !! wikitext
11790 <div id=rock>HTML rocks</div>
11791 !! html
11792 <div id="rock">HTML rocks</div>
11793
11794 !! end
11795
11796 !! test
11797 div with illegal double attributes
11798 !! wikitext
11799 <div id="a" id="b">HTML rocks</div>
11800 !! html
11801 <div id="b">HTML rocks</div>
11802
11803 !!end
11804
11805 # FIXME: produce empty string instead of "class" in the PHP parser, following
11806 # the HTML5 spec.
11807 !! test
11808 div with empty attribute value, space before equals
11809 !! options
11810 parsoid
11811 !! wikitext
11812 <div class =>HTML rocks</div>
11813 !! html
11814 <div class="">HTML rocks</div>
11815
11816 !! end
11817
11818 # The PHP parser escapes the opening brace to &#123; for some reason, so
11819 # disabled this test for it.
11820 !! test
11821 div with braces in attribute value
11822 !! options
11823 parsoid
11824 !! wikitext
11825 <div title="{}">Foo</div>
11826 !! html
11827 <div title="{}">Foo</div>
11828 !! end
11829
11830 # This it very inconsistent in the PHP parser: it returns
11831 # class="class" if there is a space between the name and the equal sign (see
11832 # 'div with empty attribute value, space before equals'), but strips the
11833 # attribute completely if the space is missing. We hope that not much content
11834 # depends on this, so are implementing the behavior below in Parsoid for
11835 # consistencies' sake. Disabled for the PHP parser.
11836 # FIXME: fix this behavior in the PHP parser?
11837 !! test
11838 div with empty attribute value, no space before equals
11839 !! options
11840 parsoid
11841 !! wikitext
11842 <div class=>HTML rocks</div>
11843 !! html
11844 <div class="">HTML rocks</div>
11845
11846 !! end
11847
11848 !! test
11849 HTML multiple attributes correction
11850 !! wikitext
11851 <p class="error" class="awesome">Awesome!</p>
11852 !! html
11853 <p class="awesome">Awesome!</p>
11854
11855 !!end
11856
11857 !! test
11858 Table multiple attributes correction
11859 !! wikitext
11860 {|
11861 !+ class="error" class="awesome"| status
11862 |}
11863 !! html
11864 <table>
11865 <tr>
11866 <th class="awesome"> status
11867 </th></tr></table>
11868
11869 !!end
11870
11871 !! test
11872 DIV IN UPPERCASE
11873 !! wikitext
11874 <DIV ID="x">HTML ROCKS</DIV>
11875 !! html
11876 <div id="x">HTML ROCKS</div>
11877
11878 !!end
11879
11880 !! test
11881 Non-ASCII pseudo-tags are rendered as text
11882 !! wikitext
11883 <khyô>
11884 !! html
11885 <p>&lt;khyô&gt;
11886 </p>
11887 !! end
11888
11889 !! test
11890 Pseudo-tag with URL 'name' renders as url link
11891 !! wikitext
11892 <http://example.com/>
11893 !! html
11894 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11895 </p>
11896 !! end
11897
11898 !! test
11899 text with amp in the middle of nowhere
11900 !! wikitext
11901 Remember AT&T?
11902 !! html
11903 <p>Remember AT&amp;T?
11904 </p>
11905 !! end
11906
11907 !! test
11908 text with character entity: eacute
11909 !! wikitext
11910 I always thought &eacute; was a cute letter.
11911 !! html
11912 <p>I always thought &#233; was a cute letter.
11913 </p>
11914 !! end
11915
11916 !! test
11917 text with entity-escaped character entity-like string: eacute
11918 !! wikitext
11919 I always thought &amp;eacute; was a cute letter.
11920 !! html
11921 <p>I always thought &amp;eacute; was a cute letter.
11922 </p>
11923 !! end
11924
11925 !! test
11926 text with undefined character entity: xacute
11927 !! wikitext
11928 I always thought &xacute; was a cute letter.
11929 !! html
11930 <p>I always thought &amp;xacute; was a cute letter.
11931 </p>
11932 !! end
11933
11934 # TODO: generalize to PHP parser?
11935 !! test
11936 HTML5 tags
11937 !! options
11938 parsoid
11939 !! wikitext
11940 <data value="5">five</data>
11941 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11942 <mark>This highlighted text</mark>
11943 !! html
11944 <p><data value="5">five</data>
11945 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11946 <mark>This highlighted text</mark></p>
11947 !! end
11948
11949 !! test
11950 HTML tag with leading space is parsed as text
11951 !! wikitext
11952 < div>foo< /div>
11953 !! html
11954 <p>&lt; div&gt;foo&lt; /div&gt;
11955 </p>
11956 !! end
11957
11958 ###
11959 ### Nesting tests (see bug 41545, 50604, 51081)
11960 ###
11961
11962 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11963 # Note that html2wt is considerably more difficult if we use <b> in
11964 # the test case, instead of <big>
11965 !! test
11966 Ensure that HTML adoption agency algorithm is properly implemented.
11967 !! wikitext
11968 <big>X<big>Y</big>Z</big>
11969 !! html
11970 <p><big>X<big>Y</big>Z</big>
11971 </p>
11972 !! end
11973
11974 # This was bug 41545 in the PHP parser.
11975 !! test
11976 Nesting of <kbd>
11977 !! wikitext
11978 <kbd>X<kbd>Y</kbd>Z</kbd>
11979 !! html
11980 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11981 </p>
11982 !! end
11983
11984 # The following cases were bug 51081 in the PHP parser.
11985 # Note that there are some other nestable tags (b, i, etc) which are
11986 # not covered; see bug 51081 for discussion.
11987 !! test
11988 Nesting of <em>
11989 !! wikitext
11990 <em>X<em>Y</em>Z</em>
11991 !! html
11992 <p><em>X<em>Y</em>Z</em>
11993 </p>
11994 !! end
11995
11996 !! test
11997 Nesting of <strong>
11998 !! wikitext
11999 <strong>X<strong>Y</strong>Z</strong>
12000 !! html
12001 <p><strong>X<strong>Y</strong>Z</strong>
12002 </p>
12003 !! end
12004
12005 !! test
12006 Nesting of <q>
12007 !! wikitext
12008 <q>X<q>Y</q>Z</q>
12009 !! html
12010 <p><q>X<q>Y</q>Z</q>
12011 </p>
12012 !! end
12013
12014 !! test
12015 Nesting of <ruby>
12016 !! wikitext
12017 <ruby>X<ruby>Y</ruby>Z</ruby>
12018 !! html
12019 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12020 </p>
12021 !! end
12022
12023 !! test
12024 Nesting of <bdo>
12025 !! wikitext
12026 <bdo>X<bdo>Y</bdo>Z</bdo>
12027 !! html
12028 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12029 </p>
12030 !! end
12031
12032
12033 ###
12034 ### Media links
12035 ###
12036
12037 !! test
12038 Media link
12039 !! wikitext
12040 [[Media:Foobar.jpg]]
12041 !! html
12042 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12043 </p>
12044 !! end
12045
12046 !! test
12047 Media link with text
12048 !! wikitext
12049 [[Media:Foobar.jpg|A neat file to look at]]
12050 !! html
12051 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12052 </p>
12053 !! end
12054
12055 # FIXME: this is still bad HTML tag nesting
12056 !! test
12057 Media link with nasty text
12058 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12059 !! wikitext
12060 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12061 !! html
12062 <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>
12063
12064 !! end
12065
12066 !! test
12067 Media link to nonexistent file (bug 1702)
12068 !! wikitext
12069 [[Media:No such.jpg]]
12070 !! html
12071 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12072 </p>
12073 !! end
12074
12075 !! test
12076 Image link to nonexistent file (bug 1850 - good)
12077 !! wikitext
12078 [[Image:No such.jpg]]
12079 !! html
12080 <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>
12081 </p>
12082 !! end
12083
12084 !! test
12085 :Image link to nonexistent file (bug 1850 - bad)
12086 !! wikitext
12087 [[:Image:No such.jpg]]
12088 !! html
12089 <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>
12090 </p>
12091 !! end
12092
12093
12094
12095 !! test
12096 Character reference normalization in link text (bug 1938)
12097 !! wikitext
12098 [[Main Page|this&that]]
12099 !! html
12100 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12101 </p>
12102 !!end
12103
12104 !! article
12105 אַ
12106 !! text
12107 Test for unicode normalization
12108
12109 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12110 !! endarticle
12111
12112 !! test
12113 (bug 19451) Links should refer to the normalized form.
12114 !! wikitext
12115 [[&#xFB2E;]]
12116 [[&#x5d0;&#x5b7;]]
12117 [[&#x5d0;ַ]]
12118 [[א&#x5b7;]]
12119 [[אַ]]
12120 !! html
12121 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12122 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12123 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12124 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12125 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12126 </p>
12127 !! end
12128
12129 !! test
12130 Empty attribute crash test (bug 2067)
12131 !! wikitext
12132 <font color="">foo</font>
12133 !! html
12134 <p><font color="">foo</font>
12135 </p>
12136 !! end
12137
12138 !! test
12139 Empty attribute crash test single-quotes (bug 2067)
12140 !! wikitext
12141 <font color=''>foo</font>
12142 !! html
12143 <p><font color="">foo</font>
12144 </p>
12145 !! end
12146
12147 !! test
12148 Attribute test: equals, then nothing
12149 !! wikitext
12150 <font color=>foo</font>
12151 !! html
12152 <p><font>foo</font>
12153 </p>
12154 !! end
12155
12156 !! test
12157 Attribute test: unquoted value
12158 !! wikitext
12159 <font color=x>foo</font>
12160 !! html
12161 <p><font color="x">foo</font>
12162 </p>
12163 !! end
12164
12165 !! test
12166 Attribute test: unquoted but illegal value (hash)
12167 !! wikitext
12168 <font color=#x>foo</font>
12169 !! html
12170 <p><font color="#x">foo</font>
12171 </p>
12172 !! end
12173
12174 !! test
12175 Attribute test: no value
12176 !! wikitext
12177 <font color>foo</font>
12178 !! html
12179 <p><font color="color">foo</font>
12180 </p>
12181 !! end
12182
12183 !! test
12184 Bug 2095: link with three closing brackets
12185 !! wikitext
12186 [[Main Page]]]
12187 !! html
12188 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12189 </p>
12190 !! end
12191
12192 !! test
12193 Bug 2095: link with pipe and three closing brackets
12194 !! wikitext
12195 [[Main Page|link]]]
12196 !! html
12197 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12198 </p>
12199 !! end
12200
12201 !! test
12202 Bug 2095: link with pipe and three closing brackets, version 2
12203 !! wikitext
12204 [[Main Page|[http://example.com/]]]
12205 !! html
12206 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12207 </p>
12208 !! end
12209
12210
12211 ###
12212 ### Safety
12213 ###
12214
12215 !! article
12216 Template:Dangerous attribute
12217 !! text
12218 " onmouseover="alert(document.cookie)
12219 !! endarticle
12220
12221 !! article
12222 Template:Dangerous style attribute
12223 !! text
12224 border-size: expression(alert(document.cookie))
12225 !! endarticle
12226
12227 !! article
12228 Template:Div style
12229 !! text
12230 <div style="float: right; {{{1}}}">Magic div</div>
12231 !! endarticle
12232
12233 !! test
12234 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12235 !! wikitext
12236 <div title="{{test}}"></div>
12237 !! html
12238 <div title="This is a test template"></div>
12239
12240 !! end
12241
12242 !! test
12243 Bug 2304: HTML attribute safety (dangerous template; 2309)
12244 !! wikitext
12245 <div title="{{dangerous attribute}}"></div>
12246 !! html
12247 <div title=""></div>
12248
12249 !! end
12250
12251 !! test
12252 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12253 !! wikitext
12254 <div style="{{dangerous style attribute}}"></div>
12255 !! html
12256 <div style="/* insecure input */"></div>
12257
12258 !! end
12259
12260 !! test
12261 Bug 2304: HTML attribute safety (safe parameter; 2309)
12262 !! wikitext
12263 {{div style|width: 200px}}
12264 !! html
12265 <div style="float: right; width: 200px">Magic div</div>
12266
12267 !! end
12268
12269 !! test
12270 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12271 !! wikitext
12272 {{div style|width: expression(alert(document.cookie))}}
12273 !! html
12274 <div style="/* insecure input */">Magic div</div>
12275
12276 !! end
12277
12278 !! test
12279 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12280 !! wikitext
12281 {{div style|"><script>alert(document.cookie)</script>}}
12282 !! html
12283 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12284
12285 !! end
12286
12287 !! test
12288 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12289 !! wikitext
12290 {{div style|" ><script>alert(document.cookie)</script>}}
12291 !! html
12292 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12293
12294 !! end
12295
12296 !! test
12297 Bug 2304: HTML attribute safety (link)
12298 !! wikitext
12299 <div title="[[Main Page]]"></div>
12300 !! html
12301 <div title="&#91;&#91;Main Page]]"></div>
12302
12303 !! end
12304
12305 !! test
12306 Bug 2304: HTML attribute safety (italics)
12307 !! wikitext
12308 <div title="''foobar''"></div>
12309 !! html
12310 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12311
12312 !! end
12313
12314 !! test
12315 Bug 2304: HTML attribute safety (bold)
12316 !! wikitext
12317 <div title="'''foobar'''"></div>
12318 !! html
12319 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12320
12321 !! end
12322
12323
12324 !! test
12325 Bug 2304: HTML attribute safety (ISBN)
12326 !! wikitext
12327 <div title="ISBN 1234567890"></div>
12328 !! html
12329 <div title="&#73;SBN 1234567890"></div>
12330
12331 !! end
12332
12333 !! test
12334 Bug 2304: HTML attribute safety (RFC)
12335 !! wikitext
12336 <div title="RFC 1234"></div>
12337 !! html
12338 <div title="&#82;FC 1234"></div>
12339
12340 !! end
12341
12342 !! test
12343 Bug 2304: HTML attribute safety (PMID)
12344 !! wikitext
12345 <div title="PMID 1234567890"></div>
12346 !! html
12347 <div title="&#80;MID 1234567890"></div>
12348
12349 !! end
12350
12351 !! test
12352 Bug 2304: HTML attribute safety (web link)
12353 !! wikitext
12354 <div title="http://example.com/"></div>
12355 !! html
12356 <div title="http&#58;//example.com/"></div>
12357
12358 !! end
12359
12360 !! test
12361 Bug 2304: HTML attribute safety (named web link)
12362 !! wikitext
12363 <div title="[http://example.com/ link]"></div>
12364 !! html
12365 <div title="&#91;http&#58;//example.com/ link]"></div>
12366
12367 !! end
12368
12369 !! test
12370 Bug 3244: HTML attribute safety (extension; safe)
12371 !! wikitext
12372 <div style="<nowiki>background:blue</nowiki>"></div>
12373 !! html
12374 <div style="background:blue"></div>
12375
12376 !! end
12377
12378 !! test
12379 Bug 3244: HTML attribute safety (extension; unsafe)
12380 !! wikitext
12381 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12382 !! html
12383 <div style="/* insecure input */"></div>
12384
12385 !! end
12386
12387 # More MSIE fun discovered by Tom Gilder
12388
12389 !! test
12390 MSIE CSS safety test: spurious slash
12391 !! wikitext
12392 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12393 !! html
12394 <div style="/* insecure input */">evil</div>
12395
12396 !! end
12397
12398 !! test
12399 MSIE CSS safety test: hex code
12400 !! wikitext
12401 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12402 !! html
12403 <div style="/* insecure input */">evil</div>
12404
12405 !! end
12406
12407 !! test
12408 MSIE CSS safety test: comment in url
12409 !! wikitext
12410 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12411 !! html
12412 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12413
12414 !! end
12415
12416 !! test
12417 MSIE CSS safety test: comment in expression
12418 !! wikitext
12419 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12420 !! html
12421 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12422
12423 !! end
12424
12425 !! test
12426 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12427 !! wikitext
12428 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12429 !! html
12430 <p style="/* invalid control char */">A</p>
12431
12432 !! end
12433
12434 !! test
12435 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12436 !! wikitext
12437 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12438 <div style="top:EXPRESSION(alert())">B</div>
12439 !! html
12440 <p style="/* insecure input */">A</p>
12441 <div style="/* insecure input */">B</div>
12442
12443 !! end
12444
12445 !! test
12446 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12447 !! wikitext
12448 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12449 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12450 !! html
12451 <div style="/* insecure input */">A</div>
12452 <p style="/* insecure input */">B</p>
12453
12454 !! end
12455
12456 !! test
12457 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12458 !! wikitext
12459 <div style="background-image:url⁽javascript:alert())">A</div>
12460 <div style="background-image:url₍javascript:alert())">B</div>
12461 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12462 !! html
12463 <div style="/* insecure input */">A</div>
12464 <div style="/* insecure input */">B</div>
12465 <p style="/* insecure input */">C</p>
12466
12467 !! end
12468
12469 !! test
12470 Opera -o-link CSS
12471 !! wikitext
12472 <div
12473 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;"
12474 style="-o-link:attr(title);-o-link-source:current">X</div>
12475 !! html
12476 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12477
12478 !! end
12479
12480 !! test
12481 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12482 !! wikitext
12483 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12484 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12485 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12486 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12487 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12488 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12489 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12490 !! html
12491 <p style="/* insecure input */">A</p>
12492 <p style="/* insecure input */">B</p>
12493 <p style="/* insecure input */">C</p>
12494 <p style="/* insecure input */">D</p>
12495 <p style="/* insecure input */">E</p>
12496 <p style="/* insecure input */">F</p>
12497 <p style="/* insecure input */">G</p>
12498
12499 !! end
12500
12501 !! test
12502 Table attribute legitimate extension
12503 !! wikitext
12504 {|
12505 !+ style="<nowiki>color:blue</nowiki>"| status
12506 |}
12507 !! html
12508 <table>
12509 <tr>
12510 <th style="color:blue"> status
12511 </th></tr></table>
12512
12513 !!end
12514
12515 !! test
12516 Table attribute safety
12517 !! wikitext
12518 {|
12519 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12520 |}
12521 !! html
12522 <table>
12523 <tr>
12524 <th style="/* insecure input */"> status
12525 </th></tr></table>
12526
12527 !! end
12528
12529 !! test
12530 CSS line continuation 1
12531 !! wikitext
12532 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12533 !! html
12534 <div style="/* insecure input */"></div>
12535
12536 !! end
12537
12538 !! test
12539 CSS line continuation 2
12540 !! wikitext
12541 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12542 !! html
12543 <div style="/* insecure input */"></div>
12544
12545 !! end
12546
12547 !! article
12548 Template:Identity
12549 !! text
12550 {{{1}}}
12551 !! endarticle
12552
12553 !! test
12554 Expansion of multi-line templates in attribute values (bug 6255)
12555 !! wikitext
12556 <div style="background: {{identity|#00FF00}}">-</div>
12557 !! html
12558 <div style="background: #00FF00">-</div>
12559
12560 !! end
12561
12562
12563 !! test
12564 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12565 !! wikitext
12566 <div style="background:
12567 #00FF00">-</div>
12568 !! html
12569 <div style="background: #00FF00">-</div>
12570
12571 !! end
12572
12573 !! test
12574 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12575 !! wikitext
12576 <div style="background: &#10;#00FF00">-</div>
12577 !! html
12578 <div style="background: &#10;#00FF00">-</div>
12579
12580 !! end
12581
12582 ###
12583 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12584 ###
12585 !! test
12586 Parser hook: empty input
12587 !! wikitext
12588 <tag></tag>
12589 !! html
12590 <pre>
12591 ''
12592 array (
12593 )
12594 </pre>
12595
12596 !! end
12597
12598 !! test
12599 Parser hook: empty input using terminated empty elements
12600 !! wikitext
12601 <tag/>
12602 !! html
12603 <pre>
12604 NULL
12605 array (
12606 )
12607 </pre>
12608
12609 !! end
12610
12611 !! test
12612 Parser hook: empty input using terminated empty elements (space before)
12613 !! wikitext
12614 <tag />
12615 !! html
12616 <pre>
12617 NULL
12618 array (
12619 )
12620 </pre>
12621
12622 !! end
12623
12624 !! test
12625 Parser hook: basic input
12626 !! wikitext
12627 <tag>input</tag>
12628 !! html
12629 <pre>
12630 'input'
12631 array (
12632 )
12633 </pre>
12634
12635 !! end
12636
12637
12638 !! test
12639 Parser hook: case insensitive
12640 !! wikitext
12641 <TAG>input</TAG>
12642 !! html
12643 <pre>
12644 'input'
12645 array (
12646 )
12647 </pre>
12648
12649 !! end
12650
12651
12652 !! test
12653 Parser hook: case insensitive, redux
12654 !! wikitext
12655 <TaG>input</TAg>
12656 !! html
12657 <pre>
12658 'input'
12659 array (
12660 )
12661 </pre>
12662
12663 !! end
12664
12665 !! test
12666 Parser hook: nested tags
12667 !! options
12668 noxml
12669 !! wikitext
12670 <tag><tag></tag></tag>
12671 !! html
12672 <pre>
12673 '<tag>'
12674 array (
12675 )
12676 </pre>&lt;/tag&gt;
12677
12678 !! end
12679
12680 !! test
12681 Parser hook: basic arguments
12682 !! wikitext
12683 <tag width=200 height = "100" depth = '50' square></tag>
12684 !! html
12685 <pre>
12686 ''
12687 array (
12688 'width' => '200',
12689 'height' => '100',
12690 'depth' => '50',
12691 'square' => 'square',
12692 )
12693 </pre>
12694
12695 !! end
12696
12697 !! test
12698 Parser hook: argument containing a forward slash (bug 5344)
12699 !! wikitext
12700 <tag filename='/tmp/bla'></tag>
12701 !! html
12702 <pre>
12703 ''
12704 array (
12705 'filename' => '/tmp/bla',
12706 )
12707 </pre>
12708
12709 !! end
12710
12711 !! test
12712 Parser hook: empty input using terminated empty elements (bug 2374)
12713 !! wikitext
12714 <tag foo=bar/>text
12715 !! html
12716 <pre>
12717 NULL
12718 array (
12719 'foo' => 'bar',
12720 )
12721 </pre>text
12722
12723 !! end
12724
12725 # </tag> should be output literally since there is no matching tag that begins it
12726 !! test
12727 Parser hook: basic arguments using terminated empty elements (bug 2374)
12728 !! wikitext
12729 <tag width=200 height = "100" depth = '50' square/>
12730 other stuff
12731 </tag>
12732 !! html
12733 <pre>
12734 NULL
12735 array (
12736 'width' => '200',
12737 'height' => '100',
12738 'depth' => '50',
12739 'square' => 'square',
12740 )
12741 </pre>
12742 <p>other stuff
12743 &lt;/tag&gt;
12744 </p>
12745 !! end
12746
12747 ###
12748 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12749 ###
12750
12751 !! test
12752 Parser hook: static parser hook not inside a comment
12753 !! wikitext
12754 <statictag>hello, world</statictag>
12755 <statictag action=flush/>
12756 !! html
12757 <p>hello, world
12758 </p>
12759 !! end
12760
12761
12762 !! test
12763 Parser hook: static parser hook inside a comment
12764 !! wikitext
12765 <!-- <statictag>hello, world</statictag> -->
12766 <statictag action=flush/>
12767 !! html
12768 <p><br />
12769 </p>
12770 !! end
12771
12772 # Nested template calls; this case was broken by Parser.php rev 1.506,
12773 # since reverted.
12774
12775 !! article
12776 Template:One-parameter
12777 !! text
12778 (My parameter is: {{{1}}})
12779 !! endarticle
12780
12781 !! article
12782 Template:Map-one-parameter
12783 !! text
12784 {{{{{1}}}|{{{2}}}}}
12785 !! endarticle
12786
12787 !! test
12788 Nested template calls
12789 !! wikitext
12790 {{Map-one-parameter|One-parameter|param}}
12791 !! html
12792 <p>(My parameter is: param)
12793 </p>
12794 !! end
12795
12796
12797 ###
12798 ### Sanitizer
12799 ###
12800 !! test
12801 Sanitizer: Closing of open tags
12802 !! wikitext
12803 <s></s><table></table>
12804 !! html
12805 <s></s><table></table>
12806
12807 !! end
12808
12809 !! test
12810 Sanitizer: Closing of open but not closed tags
12811 !! wikitext
12812 <s>foo
12813 !! html
12814 <p><s>foo</s>
12815 </p>
12816 !! end
12817
12818 !! test
12819 Sanitizer: Closing of closed but not open tags
12820 !! wikitext
12821 </s>
12822 !! html
12823 <p>&lt;/s&gt;
12824 </p>
12825 !! end
12826
12827 !! test
12828 Sanitizer: Closing of closed but not open table tags
12829 !! wikitext
12830 Table not started</td></tr></table>
12831 !! html
12832 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12833 </p>
12834 !! end
12835
12836 !! test
12837 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12838 !! wikitext
12839 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12840 !! html
12841 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12842 </p>
12843 !! end
12844
12845 !! test
12846 Sanitizer: Validating the contents of the id attribute (bug 4515)
12847 !! options
12848 disabled
12849 !! wikitext
12850 <br id=9 />
12851 !! html
12852 Something, but definitely not <br id="9" />...
12853 !! end
12854
12855 !! test
12856 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12857 !! options
12858 disabled
12859 !! wikitext
12860 <br id="foo" /><br id="foo" />
12861 !! html
12862 Something need to be done. foo-2 ?
12863 !! end
12864
12865 !! test
12866 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12867 !! wikitext
12868 <div itemscope>
12869 <meta itemprop="hello" content="world">
12870 <meta http-equiv="refresh" content="5">
12871 <meta itemprop="hello" http-equiv="refresh" content="5">
12872 <link itemprop="hello" href="{{SERVER}}">
12873 <link rel="stylesheet" href="{{SERVER}}">
12874 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12875 </div>
12876 !! html
12877 <div itemscope="itemscope">
12878 <p> <meta itemprop="hello" content="world" />
12879 &lt;meta http-equiv="refresh" content="5"&gt;
12880 <meta itemprop="hello" content="5" />
12881 </p>
12882 <link itemprop="hello" href="http&#58;//example.org" />
12883 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12884 <link itemprop="hello" href="http&#58;//example.org" />
12885 </div>
12886
12887 !! end
12888
12889 !! test
12890 Language converter: output gets cut off unexpectedly (bug 5757)
12891 !! options
12892 language=zh
12893 !! wikitext
12894 this bit is safe: }-
12895
12896 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12897
12898 then we get cut off here: }-
12899
12900 all additional text is vanished
12901 !! html
12902 <p>this bit is safe: }-
12903 </p><p>but if we add a conversion instance: xxx
12904 </p><p>then we get cut off here: }-
12905 </p><p>all additional text is vanished
12906 </p>
12907 !! end
12908
12909 !! test
12910 Self closed html pairs (bug 5487)
12911 !! options
12912 !! wikitext
12913 <center><font id="bug" />Centered text</center>
12914 <div><font id="bug2" />In div text</div>
12915 !! html
12916 <center>&lt;font id="bug" /&gt;Centered text</center>
12917 <div>&lt;font id="bug2" /&gt;In div text</div>
12918
12919 !! end
12920
12921 #
12922 #
12923 #
12924
12925 !! test
12926 Punctuation: nbsp before exclamation
12927 !! wikitext
12928 C'est grave !
12929 !! html
12930 <p>C'est grave&#160;!
12931 </p>
12932 !! end
12933
12934 !! test
12935 Punctuation: CSS !important (bug 11874)
12936 !! wikitext
12937 <div style="width:50% !important">important</div>
12938 !! html
12939 <div style="width:50% !important">important</div>
12940
12941 !!end
12942
12943 !! test
12944 Punctuation: CSS ! important (bug 11874; with space after)
12945 !! wikitext
12946 <div style="width:50% ! important">important</div>
12947 !! html
12948 <div style="width:50% ! important">important</div>
12949
12950 !!end
12951
12952
12953 !! test
12954 HTML bullet list, closed tags (bug 5497)
12955 !! wikitext
12956 <ul>
12957 <li>One</li>
12958 <li>Two</li>
12959 </ul>
12960 !! html
12961 <ul>
12962 <li>One</li>
12963 <li>Two</li>
12964 </ul>
12965
12966 !! end
12967
12968 !! test
12969 HTML bullet list, unclosed tags (bug 5497)
12970 !! options
12971 disabled
12972 !! wikitext
12973 <ul>
12974 <li>One
12975 <li>Two
12976 </ul>
12977 !! html
12978 <ul>
12979 <li>One
12980 </li>
12981 <li>Two
12982 </li>
12983 </ul>
12984
12985 !! end
12986
12987 !! test
12988 HTML ordered list, closed tags (bug 5497)
12989 !! wikitext
12990 <ol>
12991 <li>One</li>
12992 <li>Two</li>
12993 </ol>
12994 !! html
12995 <ol>
12996 <li>One</li>
12997 <li>Two</li>
12998 </ol>
12999
13000 !! end
13001
13002 !! test
13003 HTML ordered list, unclosed tags (bug 5497)
13004 !! options
13005 disabled
13006 !! wikitext
13007 <ol>
13008 <li>One
13009 <li>Two
13010 </ol>
13011 !! html
13012 <ol>
13013 <li>One
13014 </li>
13015 <li>Two
13016 </li>
13017 </ol>
13018
13019 !! end
13020
13021 !! test
13022 HTML nested bullet list, closed tags (bug 5497)
13023 !! wikitext
13024 <ul>
13025 <li>One</li>
13026 <li>Two:
13027 <ul>
13028 <li>Sub-one</li>
13029 <li>Sub-two</li>
13030 </ul>
13031 </li>
13032 </ul>
13033 !! html
13034 <ul>
13035 <li>One</li>
13036 <li>Two:
13037 <ul>
13038 <li>Sub-one</li>
13039 <li>Sub-two</li>
13040 </ul>
13041 </li>
13042 </ul>
13043
13044 !! end
13045
13046 !! test
13047 HTML nested bullet list, open tags (bug 5497)
13048 !! options
13049 disabled
13050 !! wikitext
13051 <ul>
13052 <li>One
13053 <li>Two:
13054 <ul>
13055 <li>Sub-one
13056 <li>Sub-two
13057 </ul>
13058 </ul>
13059 !! html
13060 <ul>
13061 <li>One
13062 </li>
13063 <li>Two:
13064 <ul>
13065 <li>Sub-one
13066 </li>
13067 <li>Sub-two
13068 </li>
13069 </ul>
13070 </li>
13071 </ul>
13072
13073 !! end
13074
13075 !! test
13076 HTML nested ordered list, closed tags (bug 5497)
13077 !! wikitext
13078 <ol>
13079 <li>One</li>
13080 <li>Two:
13081 <ol>
13082 <li>Sub-one</li>
13083 <li>Sub-two</li>
13084 </ol>
13085 </li>
13086 </ol>
13087 !! html
13088 <ol>
13089 <li>One</li>
13090 <li>Two:
13091 <ol>
13092 <li>Sub-one</li>
13093 <li>Sub-two</li>
13094 </ol>
13095 </li>
13096 </ol>
13097
13098 !! end
13099
13100 !! test
13101 HTML nested ordered list, open tags (bug 5497)
13102 !! options
13103 disabled
13104 !! wikitext
13105 <ol>
13106 <li>One
13107 <li>Two:
13108 <ol>
13109 <li>Sub-one
13110 <li>Sub-two
13111 </ol>
13112 </ol>
13113 !! html
13114 <ol>
13115 <li>One
13116 </li>
13117 <li>Two:
13118 <ol>
13119 <li>Sub-one
13120 </li>
13121 <li>Sub-two
13122 </li>
13123 </ol>
13124 </li>
13125 </ol>
13126
13127 !! end
13128
13129 !! test
13130 HTML ordered list item with parameters oddity
13131 !! wikitext
13132 <ol><li id="fragment">One</li>
13133 </ol>
13134 !! html
13135 <ol><li id="fragment">One</li>
13136 </ol>
13137
13138 !! end
13139
13140 !!test
13141 bug 5918: autonumbering
13142 !! wikitext
13143 [http://first/] [http://second] [ftp://ftp]
13144
13145 ftp://inlineftp
13146
13147 [mailto:enclosed@mail.tld With target]
13148
13149 [mailto:enclosed@mail.tld]
13150
13151 mailto:inline@mail.tld
13152 !! html
13153 <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>
13154 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13155 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13156 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13157 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13158 </p>
13159 !! end
13160
13161
13162 #
13163 # Security and HTML correctness
13164 # From Nick Jenkins' fuzz testing
13165 #
13166
13167 !! test
13168 Fuzz testing: Parser13
13169 !! wikitext
13170 {|
13171 | http://a|
13172 !! html
13173 <table>
13174 <tr>
13175 <td>
13176 </td>
13177 </tr>
13178 </table>
13179
13180 !! end
13181
13182 !! test
13183 Fuzz testing: Parser14
13184 !! wikitext
13185 == onmouseover= ==
13186 http://__TOC__
13187 !! html
13188 <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>
13189 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13190 <ul>
13191 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13192 </ul>
13193 </div>
13194
13195
13196 !! end
13197
13198 !! test
13199 Fuzz testing: Parser14-table
13200 !! wikitext
13201 ==a==
13202 {| STYLE=__TOC__
13203 !! html
13204 <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>
13205 <table style="&#95;_TOC&#95;_">
13206 <tr><td></td></tr>
13207 </table>
13208
13209 !! end
13210
13211 # Known to produce bogus xml (extra </td>)
13212 !! test
13213 Fuzz testing: Parser16
13214 !! options
13215 noxml
13216 !! wikitext
13217 {|
13218 !https://||||||
13219 !! html
13220 <table>
13221 <tr>
13222 <th>https://</th>
13223 <th></th>
13224 <th></th>
13225 <th>
13226 </td>
13227 </tr>
13228 </table>
13229
13230 !! end
13231
13232 !! test
13233 Fuzz testing: Parser21
13234 !! wikitext
13235 {|
13236 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13237 |
13238 !! html
13239 <table>
13240 <tr>
13241 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13242 </th>
13243 <td>
13244 </td>
13245 </tr>
13246 </table>
13247
13248 !! end
13249
13250 !! test
13251 Fuzz testing: Parser22
13252 !! wikitext
13253 http://===r:::https://b
13254
13255 {|
13256 !! html
13257 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13258 </p>
13259 <table>
13260 <tr><td></td></tr>
13261 </table>
13262
13263 !! end
13264
13265 # Known to produce bad XML for now
13266 !! test
13267 Fuzz testing: Parser24
13268 !! options
13269 noxml
13270 !! wikitext
13271 {|
13272 {{{|
13273 <u CLASS=
13274 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13275 <br style="onmouseover='alert(document.cookie);' " />
13276
13277 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13278 |
13279 !! html
13280 <table>
13281 {{{|
13282 <u class="&#124;">}}}} &gt;
13283 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13284
13285 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13286 <tr>
13287 <td></u>
13288 </td>
13289 </tr>
13290 </table>
13291
13292 !! end
13293
13294 # Note: the current result listed for this is not what the original one was,
13295 # but the original bug was JavaScript injection, which is fixed in any case.
13296 # It's not clear that the original result listed was any more correct than the
13297 # current one. Original result:
13298 # <p>{{{|
13299 # </p>
13300 # <li class="&#124;&#124;">
13301 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13302 !!test
13303 Fuzz testing: Parser25 (bug 6055)
13304 !! wikitext
13305 {{{
13306 |
13307 <LI CLASS=||
13308 >
13309 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13310 !! html
13311 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13312 </p>
13313 !! end
13314
13315 !!test
13316 Fuzz testing: URL adjacent extension (with space, clean)
13317 !! options
13318 !! wikitext
13319 http://example.com <nowiki>junk</nowiki>
13320 !! html
13321 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13322 </p>
13323 !!end
13324
13325 !!test
13326 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13327 !! options
13328 !! wikitext
13329 http://example.com<nowiki>junk</nowiki>
13330 !! html
13331 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13332 </p>
13333 !!end
13334
13335 !!test
13336 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13337 !! options
13338 !! wikitext
13339 http://example.com<pre>junk</pre>
13340 !! html
13341 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13342
13343 !!end
13344
13345 !!test
13346 Fuzz testing: image with bogus manual thumbnail
13347 !! wikitext
13348 [[Image:foobar.jpg|thumbnail= ]]
13349 !! html/php
13350 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13351
13352 !! html/parsoid
13353 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13354 !!end
13355
13356 !! test
13357 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13358 !! wikitext
13359 <pre dir="&#10;"></pre>
13360 !! html
13361 <pre dir="&#10;"></pre>
13362
13363 !! end
13364
13365 !! test
13366 Parsing optional HTML elements (Bug 6171)
13367 !! options
13368 !! wikitext
13369 <table>
13370 <tr>
13371 <td> Some tabular data</td>
13372 <td> More tabular data ...
13373 <td> And yet som tabular data</td>
13374 </tr>
13375 </table>
13376 !! html
13377 <table>
13378 <tr>
13379 <td> Some tabular data</td>
13380 <td> More tabular data ...
13381 </td><td> And yet som tabular data</td>
13382 </tr>
13383 </table>
13384
13385 !! end
13386
13387 !! test
13388 Correct handling of <td>, <tr> (Bug 6171)
13389 !! options
13390 !! wikitext
13391 <table>
13392 <tr>
13393 <td> Some tabular data</td>
13394 <td> More tabular data ...</td>
13395 <td> And yet som tabular data</td>
13396 </tr>
13397 </table>
13398 !! html
13399 <table>
13400 <tr>
13401 <td> Some tabular data</td>
13402 <td> More tabular data ...</td>
13403 <td> And yet som tabular data</td>
13404 </tr>
13405 </table>
13406
13407 !! end
13408
13409
13410 !! test
13411 Parsing crashing regression (fr:JavaScript)
13412 !! wikitext
13413 </body></x>
13414 !! html
13415 <p>&lt;/body&gt;&lt;/x&gt;
13416 </p>
13417 !! end
13418
13419 !! test
13420 Inline wiki vs wiki block nesting
13421 !! wikitext
13422 '''Bold paragraph
13423
13424 New wiki paragraph
13425 !! html
13426 <p><b>Bold paragraph</b>
13427 </p><p>New wiki paragraph
13428 </p>
13429 !! end
13430
13431 !! test
13432 Inline HTML vs wiki block nesting
13433 !! options
13434 disabled
13435 !! wikitext
13436 <b>Bold paragraph
13437
13438 New wiki paragraph
13439 !! html
13440 <p><b>Bold paragraph</b>
13441 </p><p>New wiki paragraph
13442 </p>
13443 !! end
13444
13445 # Original result was this:
13446 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13447 # </p>
13448 # While that might be marginally more intuitive, maybe, the six-apostrophe
13449 # construct is clearly pathological and the result stated here (which is what
13450 # the parser actually does) is about as reasonable as anything.
13451 !!test
13452 Mixing markup for italics and bold
13453 !! options
13454 !! wikitext
13455 '''bold''''''bold''bolditalics'''''
13456 !! html
13457 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13458 </p>
13459 !! end
13460
13461
13462 !! article
13463 Xyzzyx
13464 !! text
13465 Article for special page transclusion test
13466 !! endarticle
13467
13468 !! test
13469 Special page transclusion
13470 !! options
13471 !! wikitext
13472 {{Special:Prefixindex/Xyzzyx}}
13473 !! html
13474 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13475
13476 !! end
13477
13478 !! test
13479 Special page transclusion twice (bug 5021)
13480 !! options
13481 !! wikitext
13482 {{Special:Prefixindex/Xyzzyx}}
13483 {{Special:Prefixindex/Xyzzyx}}
13484 !! html
13485 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13486 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13487
13488 !! end
13489
13490 !! test
13491 Transclusion of default MediaWiki message
13492 !! wikitext
13493 {{MediaWiki:Mainpage}}
13494 !! html
13495 <p>Main Page
13496 </p>
13497 !! end
13498
13499 !! test
13500 Transclusion of nonexistent MediaWiki message
13501 !! wikitext
13502 {{MediaWiki:Mainpagexxx}}
13503 !! html
13504 <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>
13505 </p>
13506 !! end
13507
13508 !! test
13509 Transclusion of MediaWiki message with underscore
13510 !! wikitext
13511 {{MediaWiki:history_short}}
13512 !! html
13513 <p>History
13514 </p>
13515 !! end
13516
13517 !! test
13518 Transclusion of MediaWiki message with space
13519 !! wikitext
13520 {{MediaWiki:history short}}
13521 !! html
13522 <p>History
13523 </p>
13524 !! end
13525
13526 !! test
13527 Invalid header with following text
13528 !! wikitext
13529 = x = y
13530 !! html
13531 <p>= x = y
13532 </p>
13533 !! end
13534
13535
13536 !! test
13537 Section extraction test (section 0)
13538 !! options
13539 section=0
13540 !! wikitext
13541 start
13542 ==a==
13543 ===aa===
13544 ====aaa====
13545 ==b==
13546 ===ba===
13547 ===bb===
13548 ====bba====
13549 ===bc===
13550 ==c==
13551 ===ca===
13552 !! html
13553 start
13554 !! end
13555
13556 !! test
13557 Section extraction test (section 1)
13558 !! options
13559 section=1
13560 !! wikitext
13561 start
13562 ==a==
13563 ===aa===
13564 ====aaa====
13565 ==b==
13566 ===ba===
13567 ===bb===
13568 ====bba====
13569 ===bc===
13570 ==c==
13571 ===ca===
13572 !! html
13573 ==a==
13574 ===aa===
13575 ====aaa====
13576 !! end
13577
13578 !! test
13579 Section extraction test (section 2)
13580 !! options
13581 section=2
13582 !! wikitext
13583 start
13584 ==a==
13585 ===aa===
13586 ====aaa====
13587 ==b==
13588 ===ba===
13589 ===bb===
13590 ====bba====
13591 ===bc===
13592 ==c==
13593 ===ca===
13594 !! html
13595 ===aa===
13596 ====aaa====
13597 !! end
13598
13599 !! test
13600 Section extraction test (section 3)
13601 !! options
13602 section=3
13603 !! wikitext
13604 start
13605 ==a==
13606 ===aa===
13607 ====aaa====
13608 ==b==
13609 ===ba===
13610 ===bb===
13611 ====bba====
13612 ===bc===
13613 ==c==
13614 ===ca===
13615 !! html
13616 ====aaa====
13617 !! end
13618
13619 !! test
13620 Section extraction test (section 4)
13621 !! options
13622 section=4
13623 !! wikitext
13624 start
13625 ==a==
13626 ===aa===
13627 ====aaa====
13628 ==b==
13629 ===ba===
13630 ===bb===
13631 ====bba====
13632 ===bc===
13633 ==c==
13634 ===ca===
13635 !! html
13636 ==b==
13637 ===ba===
13638 ===bb===
13639 ====bba====
13640 ===bc===
13641 !! end
13642
13643 !! test
13644 Section extraction test (section 5)
13645 !! options
13646 section=5
13647 !! wikitext
13648 start
13649 ==a==
13650 ===aa===
13651 ====aaa====
13652 ==b==
13653 ===ba===
13654 ===bb===
13655 ====bba====
13656 ===bc===
13657 ==c==
13658 ===ca===
13659 !! html
13660 ===ba===
13661 !! end
13662
13663 !! test
13664 Section extraction test (section 6)
13665 !! options
13666 section=6
13667 !! wikitext
13668 start
13669 ==a==
13670 ===aa===
13671 ====aaa====
13672 ==b==
13673 ===ba===
13674 ===bb===
13675 ====bba====
13676 ===bc===
13677 ==c==
13678 ===ca===
13679 !! html
13680 ===bb===
13681 ====bba====
13682 !! end
13683
13684 !! test
13685 Section extraction test (section 7)
13686 !! options
13687 section=7
13688 !! wikitext
13689 start
13690 ==a==
13691 ===aa===
13692 ====aaa====
13693 ==b==
13694 ===ba===
13695 ===bb===
13696 ====bba====
13697 ===bc===
13698 ==c==
13699 ===ca===
13700 !! html
13701 ====bba====
13702 !! end
13703
13704 !! test
13705 Section extraction test (section 8)
13706 !! options
13707 section=8
13708 !! wikitext
13709 start
13710 ==a==
13711 ===aa===
13712 ====aaa====
13713 ==b==
13714 ===ba===
13715 ===bb===
13716 ====bba====
13717 ===bc===
13718 ==c==
13719 ===ca===
13720 !! html
13721 ===bc===
13722 !! end
13723
13724 !! test
13725 Section extraction test (section 9)
13726 !! options
13727 section=9
13728 !! wikitext
13729 start
13730 ==a==
13731 ===aa===
13732 ====aaa====
13733 ==b==
13734 ===ba===
13735 ===bb===
13736 ====bba====
13737 ===bc===
13738 ==c==
13739 ===ca===
13740 !! html
13741 ==c==
13742 ===ca===
13743 !! end
13744
13745 !! test
13746 Section extraction test (section 10)
13747 !! options
13748 section=10
13749 !! wikitext
13750 start
13751 ==a==
13752 ===aa===
13753 ====aaa====
13754 ==b==
13755 ===ba===
13756 ===bb===
13757 ====bba====
13758 ===bc===
13759 ==c==
13760 ===ca===
13761 !! html
13762 ===ca===
13763 !! end
13764
13765 !! test
13766 Section extraction test (nonexistent section 11)
13767 !! options
13768 section=11
13769 !! wikitext
13770 start
13771 ==a==
13772 ===aa===
13773 ====aaa====
13774 ==b==
13775 ===ba===
13776 ===bb===
13777 ====bba====
13778 ===bc===
13779 ==c==
13780 ===ca===
13781 !! html
13782 !! end
13783
13784 !! test
13785 Section extraction test with bogus heading (section 1)
13786 !! options
13787 section=1
13788 !! wikitext
13789 ==a==
13790 ==bogus== not a legal section
13791 ==b==
13792 !! html
13793 ==a==
13794 ==bogus== not a legal section
13795 !! end
13796
13797 !! test
13798 Section extraction test with bogus heading (section 2)
13799 !! options
13800 section=2
13801 !! wikitext
13802 ==a==
13803 ==bogus== not a legal section
13804 ==b==
13805 !! html
13806 ==b==
13807 !! end
13808
13809 !! test
13810 Section extraction test with comment after heading (section 1)
13811 !! options
13812 section=1
13813 !! wikitext
13814 ==a==
13815 ==b== <!-- -->
13816 ==c==
13817 !! html
13818 ==a==
13819 !! end
13820
13821 !! test
13822 Section extraction test with comment after heading (section 2)
13823 !! options
13824 section=2
13825 !! wikitext
13826 ==a==
13827 ==b== <!-- -->
13828 ==c==
13829 !! html
13830 ==b== <!-- -->
13831 !! end
13832
13833 !! test
13834 Section extraction test with bogus <nowiki> heading (section 1)
13835 !! options
13836 section=1
13837 !! wikitext
13838 ==a==
13839 ==bogus== <nowiki>not a legal section</nowiki>
13840 ==b==
13841 !! html
13842 ==a==
13843 ==bogus== <nowiki>not a legal section</nowiki>
13844 !! end
13845
13846 !! test
13847 Section extraction test with bogus <nowiki> heading (section 2)
13848 !! options
13849 section=2
13850 !! wikitext
13851 ==a==
13852 ==bogus== <nowiki>not a legal section</nowiki>
13853 ==b==
13854 !! html
13855 ==b==
13856 !! end
13857
13858
13859 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13860 # instead of respecting commented sections
13861 !! test
13862 Section extraction prefixed by comment (section 1)
13863 !! options
13864 section=1
13865 !! wikitext
13866 <!-- -->==sec1==
13867 ==sec2==
13868 !! html
13869 ==sec2==
13870 !!end
13871
13872 !! test
13873 Section extraction prefixed by comment (section 2)
13874 !! options
13875 section=2
13876 !! wikitext
13877 <!-- -->==sec1==
13878 ==sec2==
13879 !! html
13880
13881 !!end
13882
13883
13884 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13885 # instead of respecting HTML-style headings
13886 !! test
13887 Section extraction, mixed wiki and html (section 1)
13888 !! options
13889 section=1
13890 !! wikitext
13891 <h2>unmarked</h2>
13892 unmarked
13893 ==1==
13894 one
13895 ==2==
13896 two
13897 !! html
13898 ==1==
13899 one
13900 !! end
13901
13902 !! test
13903 Section extraction, mixed wiki and html (section 2)
13904 !! options
13905 section=2
13906 !! wikitext
13907 <h2>unmarked</h2>
13908 unmarked
13909 ==1==
13910 one
13911 ==2==
13912 two
13913 !! html
13914 ==2==
13915 two
13916 !! end
13917
13918
13919 # Formerly testing for bug 3342
13920 !! test
13921 Section extraction, heading surrounded by <noinclude>
13922 !! options
13923 section=1
13924 !! wikitext
13925 <noinclude>==unmarked==</noinclude>
13926 ==marked==
13927 !! html
13928 ==marked==
13929 !!end
13930
13931 # Test behavior of bug 19910
13932 !! test
13933 Sectiion with all-equals
13934 !! options
13935 section=2
13936 !! wikitext
13937 ===
13938 The line above must have a trailing space
13939 === <!--
13940 --> <!-- -->
13941 But just in case it doesn't...
13942 !! html
13943 === <!--
13944 --> <!-- -->
13945 But just in case it doesn't...
13946 !! end
13947
13948 !! test
13949 Section replacement test (section 0)
13950 !! options
13951 replace=0,"xxx"
13952 !! wikitext
13953 start
13954 ==a==
13955 ===aa===
13956 ====aaa====
13957 ==b==
13958 ===ba===
13959 ===bb===
13960 ====bba====
13961 ===bc===
13962 ==c==
13963 ===ca===
13964 !! html
13965 xxx
13966
13967 ==a==
13968 ===aa===
13969 ====aaa====
13970 ==b==
13971 ===ba===
13972 ===bb===
13973 ====bba====
13974 ===bc===
13975 ==c==
13976 ===ca===
13977 !! end
13978
13979 !! test
13980 Section replacement test (section 1)
13981 !! options
13982 replace=1,"xxx"
13983 !! wikitext
13984 start
13985 ==a==
13986 ===aa===
13987 ====aaa====
13988 ==b==
13989 ===ba===
13990 ===bb===
13991 ====bba====
13992 ===bc===
13993 ==c==
13994 ===ca===
13995 !! html
13996 start
13997 xxx
13998
13999 ==b==
14000 ===ba===
14001 ===bb===
14002 ====bba====
14003 ===bc===
14004 ==c==
14005 ===ca===
14006 !! end
14007
14008 !! test
14009 Section replacement test (section 2)
14010 !! options
14011 replace=2,"xxx"
14012 !! wikitext
14013 start
14014 ==a==
14015 ===aa===
14016 ====aaa====
14017 ==b==
14018 ===ba===
14019 ===bb===
14020 ====bba====
14021 ===bc===
14022 ==c==
14023 ===ca===
14024 !! html
14025 start
14026 ==a==
14027 xxx
14028
14029 ==b==
14030 ===ba===
14031 ===bb===
14032 ====bba====
14033 ===bc===
14034 ==c==
14035 ===ca===
14036 !! end
14037
14038 !! test
14039 Section replacement test (section 3)
14040 !! options
14041 replace=3,"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 xxx
14059
14060 ==b==
14061 ===ba===
14062 ===bb===
14063 ====bba====
14064 ===bc===
14065 ==c==
14066 ===ca===
14067 !! end
14068
14069 !! test
14070 Section replacement test (section 4)
14071 !! options
14072 replace=4,"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 xxx
14091
14092 ==c==
14093 ===ca===
14094 !! end
14095
14096 !! test
14097 Section replacement test (section 5)
14098 !! options
14099 replace=5,"xxx"
14100 !! wikitext
14101 start
14102 ==a==
14103 ===aa===
14104 ====aaa====
14105 ==b==
14106 ===ba===
14107 ===bb===
14108 ====bba====
14109 ===bc===
14110 ==c==
14111 ===ca===
14112 !! html
14113 start
14114 ==a==
14115 ===aa===
14116 ====aaa====
14117 ==b==
14118 xxx
14119
14120 ===bb===
14121 ====bba====
14122 ===bc===
14123 ==c==
14124 ===ca===
14125 !! end
14126
14127 !! test
14128 Section replacement test (section 6)
14129 !! options
14130 replace=6,"xxx"
14131 !! wikitext
14132 start
14133 ==a==
14134 ===aa===
14135 ====aaa====
14136 ==b==
14137 ===ba===
14138 ===bb===
14139 ====bba====
14140 ===bc===
14141 ==c==
14142 ===ca===
14143 !! html
14144 start
14145 ==a==
14146 ===aa===
14147 ====aaa====
14148 ==b==
14149 ===ba===
14150 xxx
14151
14152 ===bc===
14153 ==c==
14154 ===ca===
14155 !! end
14156
14157 !! test
14158 Section replacement test (section 7)
14159 !! options
14160 replace=7,"xxx"
14161 !! wikitext
14162 start
14163 ==a==
14164 ===aa===
14165 ====aaa====
14166 ==b==
14167 ===ba===
14168 ===bb===
14169 ====bba====
14170 ===bc===
14171 ==c==
14172 ===ca===
14173 !! html
14174 start
14175 ==a==
14176 ===aa===
14177 ====aaa====
14178 ==b==
14179 ===ba===
14180 ===bb===
14181 xxx
14182
14183 ===bc===
14184 ==c==
14185 ===ca===
14186 !! end
14187
14188 !! test
14189 Section replacement test (section 8)
14190 !! options
14191 replace=8,"xxx"
14192 !! wikitext
14193 start
14194 ==a==
14195 ===aa===
14196 ====aaa====
14197 ==b==
14198 ===ba===
14199 ===bb===
14200 ====bba====
14201 ===bc===
14202 ==c==
14203 ===ca===
14204 !! html
14205 start
14206 ==a==
14207 ===aa===
14208 ====aaa====
14209 ==b==
14210 ===ba===
14211 ===bb===
14212 ====bba====
14213 xxx
14214
14215 ==c==
14216 ===ca===
14217 !!end
14218
14219 !! test
14220 Section replacement test (section 9)
14221 !! options
14222 replace=9,"xxx"
14223 !! wikitext
14224 start
14225 ==a==
14226 ===aa===
14227 ====aaa====
14228 ==b==
14229 ===ba===
14230 ===bb===
14231 ====bba====
14232 ===bc===
14233 ==c==
14234 ===ca===
14235 !! html
14236 start
14237 ==a==
14238 ===aa===
14239 ====aaa====
14240 ==b==
14241 ===ba===
14242 ===bb===
14243 ====bba====
14244 ===bc===
14245 xxx
14246 !! end
14247
14248 !! test
14249 Section replacement test (section 10)
14250 !! options
14251 replace=10,"xxx"
14252 !! wikitext
14253 start
14254 ==a==
14255 ===aa===
14256 ====aaa====
14257 ==b==
14258 ===ba===
14259 ===bb===
14260 ====bba====
14261 ===bc===
14262 ==c==
14263 ===ca===
14264 !! html
14265 start
14266 ==a==
14267 ===aa===
14268 ====aaa====
14269 ==b==
14270 ===ba===
14271 ===bb===
14272 ====bba====
14273 ===bc===
14274 ==c==
14275 xxx
14276 !! end
14277
14278 !! test
14279 Section replacement test with initial whitespace (bug 13728)
14280 !! options
14281 replace=2,"xxx"
14282 !! wikitext
14283 Preformatted initial line
14284 ==a==
14285 ===a===
14286 !! html
14287 Preformatted initial line
14288 ==a==
14289 xxx
14290 !! end
14291
14292
14293 !! test
14294 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14295 !! options
14296 section=1
14297 !! wikitext
14298 ==a==
14299 a
14300 !! html
14301 ==a==
14302 a
14303 !! end
14304
14305 !! test
14306 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14307 !! options
14308 section=1
14309 !! wikitext
14310 ==a==
14311 a
14312 !! html
14313 ==a==
14314 a
14315 !! end
14316
14317
14318 !! test
14319 Section extraction, <pre> around bogus header (bug 10309)
14320 !! options
14321 noxml section=2
14322 !! wikitext
14323 == Section One ==
14324 <pre>
14325 =======
14326 </pre>
14327
14328 == Section Two ==
14329 stuff
14330 !! html
14331 == Section Two ==
14332 stuff
14333 !! end
14334
14335 !! test
14336 Section replacement, <pre> around bogus header (bug 10309)
14337 !! options
14338 noxml replace=2,"xxx"
14339 !! wikitext
14340 == Section One ==
14341 <pre>
14342 =======
14343 </pre>
14344
14345 == Section Two ==
14346 stuff
14347 !! html
14348 == Section One ==
14349 <pre>
14350 =======
14351 </pre>
14352
14353 xxx
14354 !! end
14355
14356
14357
14358 !! test
14359 Handling of &#x0A; in URLs
14360 !! wikitext
14361 **irc://&#x0A;a
14362 !! html
14363 <ul>
14364 <li><ul>
14365 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14366 </li>
14367 </ul>
14368 </li>
14369 </ul>
14370
14371 !!end
14372
14373 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14374 !! test
14375 5 quotes, code coverage +1 line
14376 !! wikitext
14377 '''''
14378 !! html/php
14379 !! html/parsoid
14380 <p><b><i></i></b></p>
14381 !! end
14382
14383 !! test
14384 Special:Search page linking.
14385 !! wikitext
14386 {{Special:search}}
14387 !! html
14388 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14389 </p>
14390 !! end
14391
14392 !! test
14393 Say the magic word
14394 !! options
14395 title=[[Parser test]]
14396 !! wikitext
14397 * {{PAGENAME}}
14398 * {{PAGENAMEE}}
14399 * {{FULLPAGENAME}}
14400 * {{FULLPAGENAMEE}}
14401 * {{BASEPAGENAME}}
14402 * {{BASEPAGENAMEE}}
14403 * {{SUBPAGENAME}}
14404 * {{SUBPAGENAMEE}}
14405 * {{ROOTPAGENAME}}
14406 * {{ROOTPAGENAMEE}}
14407 * {{TALKPAGENAME}}
14408 * {{TALKPAGENAMEE}}
14409 * {{SUBJECTPAGENAME}}
14410 * {{SUBJECTPAGENAMEE}}
14411 * {{NAMESPACEE}}
14412 * {{NAMESPACE}}
14413 * {{NAMESPACENUMBER}}
14414 * {{TALKSPACE}}
14415 * {{TALKSPACEE}}
14416 * {{SUBJECTSPACE}}
14417 * {{SUBJECTSPACEE}}
14418 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14419 !! html
14420 <ul>
14421 <li> Parser test
14422 </li>
14423 <li> Parser_test
14424 </li>
14425 <li> Parser test
14426 </li>
14427 <li> Parser_test
14428 </li>
14429 <li> Parser test
14430 </li>
14431 <li> Parser_test
14432 </li>
14433 <li> Parser test
14434 </li>
14435 <li> Parser_test
14436 </li>
14437 <li> Parser test
14438 </li>
14439 <li> Parser_test
14440 </li>
14441 <li> Talk:Parser test
14442 </li>
14443 <li> Talk:Parser_test
14444 </li>
14445 <li> Parser test
14446 </li>
14447 <li> Parser_test
14448 </li>
14449 <li>
14450 </li>
14451 <li>
14452 </li>
14453 <li> 0
14454 </li>
14455 <li> Talk
14456 </li>
14457 <li> Talk
14458 </li>
14459 <li>
14460 </li>
14461 <li>
14462 </li>
14463 <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>
14464 </li>
14465 </ul>
14466
14467 !! end
14468 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14469
14470 !! test
14471 Gallery
14472 !! wikitext
14473 <gallery>
14474 image1.png |
14475 image2.gif|||||
14476
14477 image3|
14478 image4 |300px| centre
14479 image5.svg| http://///////
14480 [[x|xx]]]]
14481 * image6
14482 </gallery>
14483 !! html
14484 <ul class="gallery mw-gallery-traditional">
14485 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14486 <div class="thumb" style="height: 150px;">Image1.png</div>
14487 <div class="gallerytext">
14488 </div>
14489 </div></li>
14490 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14491 <div class="thumb" style="height: 150px;">Image2.gif</div>
14492 <div class="gallerytext">
14493 <p>||||
14494 </p>
14495 </div>
14496 </div></li>
14497 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14498 <div class="thumb" style="height: 150px;">Image3</div>
14499 <div class="gallerytext">
14500 </div>
14501 </div></li>
14502 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14503 <div class="thumb" style="height: 150px;">Image4</div>
14504 <div class="gallerytext">
14505 <p>300px| centre
14506 </p>
14507 </div>
14508 </div></li>
14509 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14510 <div class="thumb" style="height: 150px;">Image5.svg</div>
14511 <div class="gallerytext">
14512 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14513 </p>
14514 </div>
14515 </div></li>
14516 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14517 <div class="thumb" style="height: 150px;">* image6</div>
14518 <div class="gallerytext">
14519 </div>
14520 </div></li>
14521 </ul>
14522
14523 !! end
14524
14525 !! test
14526 Gallery (with options)
14527 !! wikitext
14528 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14529 File:Nonexistant.jpg|caption
14530 File:Nonexistant.jpg
14531 image:foobar.jpg|some '''caption''' [[Main Page]]
14532 image:foobar.jpg
14533 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14534 </gallery>
14535 !! html
14536 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14537 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14538 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14539 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14540 <div class="gallerytext">
14541 <p>caption
14542 </p>
14543 </div>
14544 </div></li>
14545 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14546 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14547 <div class="gallerytext">
14548 </div>
14549 </div></li>
14550 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14551 <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>
14552 <div class="gallerytext">
14553 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14554 </p>
14555 </div>
14556 </div></li>
14557 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14558 <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>
14559 <div class="gallerytext">
14560 </div>
14561 </div></li>
14562 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14563 <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>
14564 <div class="gallerytext">
14565 <p>Blabla|blabla.
14566 </p>
14567 </div>
14568 </div></li>
14569 </ul>
14570
14571 !! end
14572
14573 !! test
14574 Gallery with wikitext inside caption
14575 !! wikitext
14576 <gallery>
14577 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14578 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14579 </gallery>
14580 !! html
14581 <ul class="gallery mw-gallery-traditional">
14582 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14583 <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>
14584 <div class="gallerytext">
14585 <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>
14586 </p>
14587 </div>
14588 </div></li>
14589 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14590 <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>
14591 <div class="gallerytext">
14592 <p>This is a test template
14593 </p>
14594 </div>
14595 </div></li>
14596 </ul>
14597
14598 !! end
14599
14600 !! test
14601 gallery (with showfilename option)
14602 !! wikitext
14603 <gallery showfilename>
14604 File:Nonexistant.jpg|caption
14605 File:Nonexistant.jpg
14606 image:foobar.jpg|some '''caption''' [[Main Page]]
14607 File:Foobar.jpg
14608 </gallery>
14609 !! html
14610 <ul class="gallery mw-gallery-traditional">
14611 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14612 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14613 <div class="gallerytext">
14614 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14615 caption
14616 </p>
14617 </div>
14618 </div></li>
14619 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14620 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14621 <div class="gallerytext">
14622 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14623 </p>
14624 </div>
14625 </div></li>
14626 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14627 <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>
14628 <div class="gallerytext">
14629 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14630 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14631 </p>
14632 </div>
14633 </div></li>
14634 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14635 <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>
14636 <div class="gallerytext">
14637 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14638 </p>
14639 </div>
14640 </div></li>
14641 </ul>
14642
14643 !! end
14644
14645 !! test
14646 Gallery (with namespace-less filenames)
14647 !! wikitext
14648 <gallery>
14649 File:Nonexistant.jpg
14650 Nonexistant.jpg
14651 image:foobar.jpg
14652 foobar.jpg
14653 </gallery>
14654 !! html
14655 <ul class="gallery mw-gallery-traditional">
14656 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14657 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14658 <div class="gallerytext">
14659 </div>
14660 </div></li>
14661 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14662 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14663 <div class="gallerytext">
14664 </div>
14665 </div></li>
14666 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14667 <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>
14668 <div class="gallerytext">
14669 </div>
14670 </div></li>
14671 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14672 <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>
14673 <div class="gallerytext">
14674 </div>
14675 </div></li>
14676 </ul>
14677
14678 !! end
14679
14680 !! test
14681 HTML Hex character encoding (spells the word "JavaScript")
14682 !! wikitext
14683 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14684 !! html
14685 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14686 </p>
14687 !! end
14688
14689 !! test
14690 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14691 !! wikitext
14692 &#xsee;&#XSEE;
14693 !! html
14694 <p>&amp;#xsee;&amp;#XSEE;
14695 </p>
14696 !! end
14697
14698 !! test
14699 HTML Hex character encoding mixed case
14700 !! wikitext
14701 &#xEE;&#Xee;
14702 !! html
14703 <p>&#xee;&#xee;
14704 </p>
14705 !! end
14706
14707 !! test
14708 __FORCETOC__ override
14709 !! wikitext
14710 __NEWSECTIONLINK__
14711 __FORCETOC__
14712 !! html
14713 <p><br />
14714 </p>
14715 !! end
14716
14717 !! test
14718 ISBN code coverage
14719 !! wikitext
14720 ISBN 978-0-1234-56&#x20;789
14721 !! html
14722 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14723 </p>
14724 !! end
14725
14726 !! test
14727 ISBN followed by 5 spaces
14728 !! wikitext
14729 ISBN
14730 !! html
14731 <p>ISBN
14732 </p>
14733 !! end
14734
14735 !! test
14736 Double ISBN
14737 !! wikitext
14738 ISBN ISBN 1234567890
14739 !! html
14740 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14741 </p>
14742 !! end
14743
14744 !! test
14745 ISBN with an X
14746 !! wikitext
14747 ISBN 3-462-04561-X
14748 !! html
14749 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
14750 </p>
14751 !! end
14752
14753 !! test
14754 ISBN with empty prefix (parsoid test)
14755 !! wikitext
14756 ISBN 1234567890
14757 !! html/parsoid
14758 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
14759 !! end
14760
14761 !! test
14762 Bug 22905: <abbr> followed by ISBN followed by </a>
14763 !! wikitext
14764 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14765 !! html
14766 <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>
14767 </p>
14768 !! end
14769
14770 !! test
14771 Double RFC
14772 !! wikitext
14773 RFC RFC 1234
14774 !! html
14775 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14776 </p>
14777 !! end
14778
14779 !! test
14780 Double RFC with a wiki link
14781 !! wikitext
14782 RFC [[RFC 1234]]
14783 !! html
14784 <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>
14785 </p>
14786 !! end
14787
14788 !! test
14789 RFC code coverage
14790 !! wikitext
14791 RFC 983&#x20;987
14792 !! html
14793 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14794 </p>
14795 !! end
14796
14797 !! test
14798 Centre-aligned image
14799 !! wikitext
14800 [[Image:foobar.jpg|centre]]
14801 !! html
14802 <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>
14803
14804 !!end
14805
14806 !! test
14807 None-aligned image
14808 !! wikitext
14809 [[Image:foobar.jpg|none]]
14810 !! html
14811 <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>
14812
14813 !!end
14814
14815 !! test
14816 Width + Height sized image (using px) (height is ignored)
14817 !! wikitext
14818 [[Image:foobar.jpg|640x480px]]
14819 !! html
14820 <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>
14821 </p>
14822 !!end
14823
14824 !! test
14825 Width-sized image (using px, no following whitespace)
14826 !! wikitext
14827 [[Image:foobar.jpg|640px]]
14828 !! html
14829 <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>
14830 </p>
14831 !!end
14832
14833 !! test
14834 Width-sized image (using px, with following whitespace - test regression from r39467)
14835 !! wikitext
14836 [[Image:foobar.jpg|640px ]]
14837 !! html
14838 <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>
14839 </p>
14840 !!end
14841
14842 !! test
14843 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14844 !! wikitext
14845 [[Image:foobar.jpg| 640px]]
14846 !! html
14847 <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>
14848 </p>
14849 !!end
14850
14851 !! test
14852 Another italics / bold test
14853 !! wikitext
14854 ''' ''x'
14855 !! html
14856 <pre>'<i> </i>x'
14857 </pre>
14858 !!end
14859
14860 # Note the results may be incorrect, as parserTest output included this:
14861 # XML error: Mismatched tag at byte 6120:
14862 # ...<dd> </dt></dl> </dd...
14863 !! test
14864 dt/dd/dl test
14865 !! options
14866 disabled
14867 !! wikitext
14868 :;;;::
14869 !! html
14870 <dl>
14871 <dd><dl>
14872 <dt><dl>
14873 <dt><dl>
14874 <dt><dl>
14875 <dd><dl>
14876 <dd>
14877 </dd>
14878 </dl>
14879 </dd>
14880 </dl>
14881 </dt>
14882 </dl>
14883 </dt>
14884 </dl>
14885 </dt>
14886 </dl>
14887 </dd>
14888 </dl>
14889
14890 !!end
14891
14892
14893 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14894 !! test
14895 Images with the "|" character in the comment
14896 !! wikitext
14897 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14898 !! html
14899 <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>
14900
14901 !!end
14902
14903 !! test
14904 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14905 !! wikitext
14906 <html><script>alert(1);</script></html>
14907 !! html
14908 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14909 </p>
14910 !! end
14911
14912 !! test
14913 HTML with raw HTML ($wgRawHtml==true)
14914 !! options
14915 wgRawHtml=1
14916 !! wikitext
14917 <html><script>alert(1);</script></html>
14918 !! html
14919 <p><script>alert(1);</script>
14920 </p>
14921 !! end
14922
14923 !! test
14924 Parents of subpages, one level up
14925 !! options
14926 subpage title=[[Subpage test/L1/L2/L3]]
14927 !! wikitext
14928 [[../|L2]]
14929 !! html
14930 <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>
14931 </p>
14932 !! end
14933
14934
14935 !! test
14936 Parents of subpages, one level up, not named
14937 !! options
14938 subpage title=[[Subpage test/L1/L2/L3]]
14939 !! wikitext
14940 [[../]]
14941 !! html
14942 <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>
14943 </p>
14944 !! end
14945
14946
14947
14948 !! test
14949 Parents of subpages, two levels up
14950 !! options
14951 subpage title=[[Subpage test/L1/L2/L3]]
14952 !! wikitext
14953 [[../../|L1]]2
14954
14955 [[../../|L1]]l
14956 !! html
14957 <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
14958 </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>
14959 </p>
14960 !! end
14961
14962 !! test
14963 Parents of subpages, two levels up, without trailing slash or name.
14964 !! options
14965 subpage title=[[Subpage test/L1/L2/L3]]
14966 !! wikitext
14967 [[../..]]
14968 !! html
14969 <p>[[../..]]
14970 </p>
14971 !! end
14972
14973 !! test
14974 Parents of subpages, two levels up, with lots of extra trailing slashes.
14975 !! options
14976 subpage title=[[Subpage test/L1/L2/L3]]
14977 !! wikitext
14978 [[../../////]]
14979 !! html
14980 <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>
14981 </p>
14982 !! end
14983
14984 !! article
14985 Subpage test/L1/L2/L3Sibling
14986 !! text
14987 Sibling article
14988 !! endarticle
14989
14990 !! test
14991 Transclusion of a sibling page (one level up)
14992 !! options
14993 subpage title=[[Subpage test/L1/L2/L3]]
14994 !! wikitext
14995 {{../L3Sibling}}
14996 !! html
14997 <p>Sibling article
14998 </p>
14999 !! end
15000
15001 !! test
15002 Transclusion of a child page
15003 !! options
15004 subpage title=[[Subpage test/L1/L2]]
15005 !! wikitext
15006 {{/L3Sibling}}
15007 !! html
15008 <p>Sibling article
15009 </p>
15010 !! end
15011
15012 !! test
15013 Non-transclusion because of too many up levels
15014 !! options
15015 subpage title=[[Subpage test/L1/L2/L3]]
15016 !! wikitext
15017 {{../../../../More than parent}}
15018 !! html
15019 <p>{{../../../../More than parent}}
15020 </p>
15021 !! end
15022
15023 !! test
15024 Definition list code coverage
15025 !! wikitext
15026 ; title : def
15027 ; title : def
15028 ;title: def
15029 !! html
15030 <dl>
15031 <dt> title &#160;</dt>
15032 <dd> def
15033 </dd>
15034 <dt> title&#160;</dt>
15035 <dd> def
15036 </dd>
15037 <dt>title</dt>
15038 <dd> def
15039 </dd>
15040 </dl>
15041
15042 !! end
15043
15044 !! test
15045 Don't fall for the self-closing div
15046 !! wikitext
15047 <div>hello world</div/>
15048 !! html
15049 <div>hello world</div>
15050
15051 !! end
15052
15053 !! test
15054 MSGNW magic word
15055 !! wikitext
15056 {{MSGNW:msg}}
15057 !! html
15058 <p>&#91;&#91;:Template:Msg&#93;&#93;
15059 </p>
15060 !! end
15061
15062 !! test
15063 RAW magic word
15064 !! wikitext
15065 {{RAW:QUERTY}}
15066 !! html
15067 <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>
15068 </p>
15069 !! end
15070
15071 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15072 !! test
15073 Always escape literal '>' in output, not just after '<'
15074 !! wikitext
15075 ><>
15076 !! html
15077 <p>&gt;&lt;&gt;
15078 </p>
15079 !! end
15080
15081 !! test
15082 Template caching
15083 !! wikitext
15084 {{Test}}
15085 {{Test}}
15086 !! html
15087 <p>This is a test template
15088 This is a test template
15089 </p>
15090 !! end
15091
15092
15093 !! article
15094 MediaWiki:Fake
15095 !! text
15096 ==header==
15097 !! endarticle
15098
15099 !! test
15100 Inclusion of !userCanEdit() content
15101 !! wikitext
15102 {{MediaWiki:Fake}}
15103 !! html
15104 <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>
15105
15106 !! end
15107
15108
15109 !! test
15110 Out-of-order TOC heading levels
15111 !! wikitext
15112 ==2==
15113 ======6======
15114 ===3===
15115 =1=
15116 =====5=====
15117 ==2==
15118 !! html
15119 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15120 <ul>
15121 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15122 <ul>
15123 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15124 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15125 </ul>
15126 </li>
15127 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15128 <ul>
15129 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15130 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15131 </ul>
15132 </li>
15133 </ul>
15134 </div>
15135
15136 <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>
15137 <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>
15138 <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>
15139 <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>
15140 <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>
15141 <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>
15142
15143 !! end
15144
15145
15146 !! test
15147 ISBN with a dummy number
15148 !! wikitext
15149 ISBN ---
15150 !! html
15151 <p>ISBN ---
15152 </p>
15153 !! end
15154
15155
15156 !! test
15157 ISBN with space-delimited number
15158 !! wikitext
15159 ISBN 92 9017 032 8
15160 !! html
15161 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15162 </p>
15163 !! end
15164
15165
15166 !! test
15167 ISBN with multiple spaces, no number
15168 !! wikitext
15169 ISBN foo
15170 !! html
15171 <p>ISBN foo
15172 </p>
15173 !! end
15174
15175
15176 !! test
15177 ISBN length
15178 !! wikitext
15179 ISBN 123456789
15180
15181 ISBN 1234567890
15182
15183 ISBN 12345678901
15184 !! html
15185 <p>ISBN 123456789
15186 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15187 </p><p>ISBN 12345678901
15188 </p>
15189 !! end
15190
15191
15192 !! test
15193 ISBN with trailing year (bug 8110)
15194 !! wikitext
15195 ISBN 1-234-56789-0 - 2006
15196
15197 ISBN 1 234 56789 0 - 2006
15198 !! html
15199 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15200 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15201 </p>
15202 !! end
15203
15204
15205 !! test
15206 anchorencode
15207 !! wikitext
15208 {{anchorencode:foo bar©#%n}}
15209 !! html
15210 <p>foo_bar.C2.A9.23.25n
15211 </p>
15212 !! end
15213
15214 !! test
15215 anchorencode trims spaces
15216 !! wikitext
15217 {{anchorencode: __pretty__please__}}
15218 !! html
15219 <p>pretty_please
15220 </p>
15221 !! end
15222
15223 !! test
15224 anchorencode deals with links
15225 !! wikitext
15226 {{anchorencode: [[hello|world]] [[hi]]}}
15227 !! html
15228 <p>world_hi
15229 </p>
15230 !! end
15231
15232 !! test
15233 anchorencode deals with templates
15234 !! wikitext
15235 {{anchorencode: {{Foo}} }}
15236 !! html
15237 <p>FOO
15238 </p>
15239 !! end
15240
15241 !! test
15242 anchorencode encodes like the TOC generator: (bug 18431)
15243 !! wikitext
15244 === _ +:.3A%3A&&amp;]] ===
15245 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15246 __NOEDITSECTION__
15247 !! html
15248 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15249 <p>.2B:.3A.253A.26.26.5D.5D
15250 </p>
15251 !! end
15252
15253 !! test
15254 Bug 6200: blockquotes and paragraph formatting
15255 !! wikitext
15256 <blockquote>
15257 foo
15258 </blockquote>
15259
15260 bar
15261
15262 baz
15263 !! html
15264 <blockquote>
15265 <p>foo
15266 </p>
15267 </blockquote>
15268 <p>bar
15269 </p>
15270 <pre>baz
15271 </pre>
15272 !! end
15273
15274 !! test
15275 Bug 8293: Use of center tag ruins paragraph formatting
15276 !! wikitext
15277 <center>
15278 foo
15279 </center>
15280
15281 bar
15282
15283 baz
15284 !! html
15285 <center>
15286 <p>foo
15287 </p>
15288 </center>
15289 <p>bar
15290 </p>
15291 <pre>baz
15292 </pre>
15293 !! end
15294
15295 !!test
15296 Parsing of overlapping (improperly nested) inline html tags
15297 !! wikitext
15298 <span><s>x</span></s>
15299 !! html/php
15300 <p><span><s>x&lt;/span&gt;</s></span>
15301 </p>
15302 !! html/parsoid
15303 <p><span><s>x</s></span>
15304 </p>
15305 !!end
15306
15307 ###
15308 ### Language variants related tests
15309 ###
15310 !! test
15311 Self-link in language variants
15312 !! options
15313 title=[[Dunav]] language=sr
15314 !! wikitext
15315 Both [[Dunav]] and [[Дунав]] are names for this river.
15316 !! html
15317 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15318 </p>
15319 !!end
15320
15321 !! article
15322 Дуна
15323 !! text
15324 content
15325 !! endarticle
15326
15327 !! test
15328 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15329 !! options
15330 title=[[Duna]] language=sr
15331 !! wikitext
15332 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15333 !! html
15334 <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.
15335 </p>
15336 !! end
15337
15338 !! test
15339 Link to a section of a variant of this title shouldn't be parsed as self-link
15340 !! options
15341 title=[[Duna]] language=sr
15342 !! wikitext
15343 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15344 !! html
15345 <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.
15346 </p>
15347 !! end
15348
15349 !! test
15350 Link to pages in language variants
15351 !! options
15352 language=sr
15353 !! wikitext
15354 Main Page can be written as [[Маин Паге]]
15355 !! html
15356 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15357 </p>
15358 !!end
15359
15360
15361 !! test
15362 Multiple links to pages in language variants
15363 !! options
15364 language=sr
15365 !! wikitext
15366 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15367 !! html
15368 <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>.
15369 </p>
15370 !!end
15371
15372
15373 !! test
15374 Simple template in language variants
15375 !! options
15376 language=sr
15377 !! wikitext
15378 {{тест}}
15379 !! html
15380 <p>This is a test template
15381 </p>
15382 !! end
15383
15384
15385 !! test
15386 Template with explicit namespace in language variants
15387 !! options
15388 language=sr
15389 !! wikitext
15390 {{Template:тест}}
15391 !! html
15392 <p>This is a test template
15393 </p>
15394 !! end
15395
15396
15397 !! test
15398 Basic test for template parameter in language variants
15399 !! options
15400 language=sr
15401 !! wikitext
15402 {{парамтест|param=foo}}
15403 !! html
15404 <p>This is a test template with parameter foo
15405 </p>
15406 !! end
15407
15408
15409 !! test
15410 Simple category in language variants
15411 !! options
15412 language=sr cat
15413 !! wikitext
15414 [[Category:МедиаWики Усер'с Гуиде]]
15415 !! html
15416 <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>
15417 !! end
15418
15419
15420 !! article
15421 Category:分类
15422 !! text
15423 blah
15424 !! endarticle
15425
15426 !! article
15427 Category:分類
15428 !! text
15429 blah
15430 !! endarticle
15431
15432 !! test
15433 Don't convert blue categorylinks to another variant (bug 33210)
15434 !! options
15435 language=zh cat
15436 !! wikitext
15437 [[A]][[Category:分类]]
15438 !! html
15439 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15440 !! end
15441
15442
15443 !! test
15444 Stripping -{}- tags (language variants)
15445 !! options
15446 language=sr
15447 !! wikitext
15448 Latin proverb: -{Ne nuntium necare}-
15449 !! html
15450 <p>Latin proverb: Ne nuntium necare
15451 </p>
15452 !! end
15453
15454
15455 !! test
15456 Prevent conversion with -{}- tags (language variants)
15457 !! options
15458 language=sr variant=sr-ec
15459 !! wikitext
15460 Latinski: -{Ne nuntium necare}-
15461 !! html
15462 <p>Латински: Ne nuntium necare
15463 </p>
15464 !! end
15465
15466
15467 !! test
15468 Prevent conversion of text with -{}- tags (language variants)
15469 !! options
15470 language=sr variant=sr-ec
15471 !! wikitext
15472 Latinski: -{Ne nuntium necare}-
15473 !! html
15474 <p>Латински: Ne nuntium necare
15475 </p>
15476 !! end
15477
15478
15479 !! test
15480 Prevent conversion of links with -{}- tags (language variants)
15481 !! options
15482 language=sr variant=sr-ec
15483 !! wikitext
15484 -{[[Main Page]]}-
15485 !! html
15486 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15487 </p>
15488 !! end
15489
15490
15491 !! test
15492 -{}- tags within headlines (within html for parserConvert())
15493 !! options
15494 language=sr variant=sr-ec
15495 !! wikitext
15496 == -{Naslov}- ==
15497 !! html
15498 <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>
15499
15500 !! end
15501
15502
15503 !! test
15504 Explicit definition of language variant alternatives
15505 !! options
15506 language=zh variant=zh-tw
15507 !! wikitext
15508 -{zh:China;zh-tw:Taiwan}-, not China
15509 !! html
15510 <p>Taiwan, not China
15511 </p>
15512 !! end
15513
15514
15515 !! test
15516 Conversion around HTML tags
15517 !! options
15518 language=sr variant=sr-ec
15519 !! wikitext
15520 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15521 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15522 !! html
15523 <p>
15524 <span title="ЛаCтин">ски</span>
15525 </p>
15526 !! end
15527
15528
15529 !! test
15530 Explicit session-wise language variant mapping (A flag and - flag)
15531 !! options
15532 language=zh variant=zh-tw
15533 !! wikitext
15534 Taiwan is not China.
15535 But -{A|zh:China;zh-tw:Taiwan}- is China,
15536 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15537 and -{China}- is China.
15538 !! html
15539 <p>Taiwan is not China.
15540 But Taiwan is Taiwan,
15541 (This should be stripped!)
15542 and China is China.
15543 </p>
15544 !! end
15545
15546 !! test
15547 Explicit session-wise language variant mapping (H flag for hide)
15548 !! options
15549 language=zh variant=zh-tw
15550 !! wikitext
15551 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15552 Taiwan is China.
15553 !! html
15554 <p>(This should be stripped!)
15555 Taiwan is Taiwan.
15556 </p>
15557 !! end
15558
15559 !! test
15560 Adding explicit conversion rule for title (T flag)
15561 !! options
15562 language=zh variant=zh-tw showtitle
15563 !! wikitext
15564 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15565 !! html
15566 Taiwan
15567 <p>Should be stripped!
15568 </p>
15569 !! end
15570
15571 !! test
15572 Testing that changing the language variant here in the tests actually works
15573 !! options
15574 language=zh variant=zh showtitle
15575 !! wikitext
15576 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15577 !! html
15578 China
15579 <p>Should be stripped!
15580 </p>
15581 !! end
15582
15583 !! test
15584 Recursive conversion of alt and title attrs shouldn't clear converter state
15585 !! options
15586 language=zh variant=zh-cn showtitle
15587 !! wikitext
15588 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15589 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15590 !! html
15591 China
15592 <p>
15593 Should be stripped<span title="Exclamation">!</span>
15594 </p>
15595 !! end
15596
15597 !! test
15598 Bug 24072: more test on conversion rule for title
15599 !! options
15600 language=zh variant=zh-tw showtitle
15601 !! wikitext
15602 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15603 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15604 !! html
15605 Taiwan
15606 <p>This should be stripped!
15607 This won't take interferes with the title rule.
15608 </p>
15609 !! end
15610
15611 !! test
15612 Partly disable title conversion if variant == main language code
15613 !! options
15614 language=zh variant=zh title=[[ZH]] showtitle
15615 !! wikitext
15616 -{T|zh-cn:CN;zh-tw:TW}-
15617 !! html
15618 ZH
15619 <p>
15620 </p>
15621 !! end
15622
15623 !! test
15624 Partly disable title conversion if variant == main language code, more
15625 !! options
15626 language=zh variant=zh title=[[ZH]] showtitle
15627 !! wikitext
15628 -{T|TW}-
15629 !! html
15630 ZH
15631 <p>
15632 </p>
15633 !! end
15634
15635 !! test
15636 Raw output of variant escape tags (R flag)
15637 !! options
15638 language=zh variant=zh-tw
15639 !! wikitext
15640 Raw: -{R|zh:China;zh-tw:Taiwan}-
15641 !! html
15642 <p>Raw: zh:China;zh-tw:Taiwan
15643 </p>
15644 !! end
15645
15646 !! test
15647 Nested using of manual convert syntax
15648 !! options
15649 language=zh variant=zh-hk
15650 !! wikitext
15651 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15652 !! html
15653 <p>Nested: Hello Hong Kong!
15654 </p>
15655 !! end
15656
15657 !! test
15658 Proper conversion of text in external links
15659 !! options
15660 language=sr variant=sr-ec
15661 !! wikitext
15662 http://www.google.com
15663 gopher://www.google.com
15664 [http://www.google.com http://www.google.com]
15665 [gopher://www.google.com gopher://www.google.com]
15666 [https://www.google.com irc://www.google.com]
15667 [ftp://www.google.com www.google.com/ftp://dir]
15668 [//www.google.com www.google.com]
15669 !! html
15670 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15671 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15672 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15673 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15674 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15675 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15676 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15677 </p>
15678 !! end
15679
15680 !! test
15681 Do not convert roman numbers to language variants
15682 !! options
15683 language=sr variant=sr-ec
15684 !! wikitext
15685 Fridrih IV je car.
15686 !! html
15687 <p>Фридрих IV је цар.
15688 </p>
15689 !! end
15690
15691 !! test
15692 Unclosed language converter markup "-{"
15693 !! options
15694 language=sr
15695 !! wikitext
15696 -{T|hello
15697 !! html
15698 <p>-{T|hello
15699 </p>
15700 !! end
15701
15702 !! test
15703 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15704 !! options
15705 language=sr
15706 !! wikitext
15707 -{R|=&gt;}-
15708 !! html
15709 <p>=&gt;
15710 </p>
15711 !!end
15712
15713 !! test
15714 Don't break link parsing if language converter markup is in the caption.
15715 !! options
15716 language=sr variant=sr-ec
15717 !! wikitext
15718 [[Main Page|-{R|main page}-]]
15719 !! html
15720 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15721 </p>
15722 !! end
15723
15724 # This test is currently broken in the PHP parser (bug 52661)
15725 !! test
15726 Don't break image parsing if language converter markup is in the caption.
15727 !! options
15728 language=sr
15729 disabled
15730 !! wikitext
15731 [[File:Foobar.jpg|-{R|caption}-]]
15732 !! html
15733 <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>
15734 </p>
15735 !! end
15736
15737 # This test is currently broken in the PHP parser (bug 52661)
15738 !! test
15739 Don't break list handling if language converter markup is in the item.
15740 !! options
15741 language=zh variant=zh-cn
15742 disabled
15743 !! wikitext
15744 ;-{zh-cn:AAA;zh-tw:BBB}-
15745 !! html
15746 <dl><dt>AAA
15747 </dt></dl>
15748
15749 !! end
15750
15751 # This test is currently broken in the PHP parser (bug 52661)
15752 !! test
15753 Don't break table handling if language converter markup is in the cell.
15754 !! options
15755 language=sr variant=sr-ec
15756 disabled
15757 !! wikitext
15758 {|
15759 |-
15760 | -{R|B}-
15761 |}
15762 !! html
15763 <table>
15764
15765 <tr>
15766 <td> B
15767 </td></tr></table>
15768
15769 !! end
15770
15771 !! test
15772 Bug 529: Uncovered bullet
15773 !! wikitext
15774 * Foo {{bullet}}
15775 !! html
15776 <ul>
15777 <li> Foo
15778 </li>
15779 <li> Bar
15780 </li>
15781 </ul>
15782
15783 !! end
15784
15785 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15786 # Templates in Wikipedia rely on this behavior, as tidy has always been
15787 # enabled there. These tests are normally run *without* tidy, so specify the
15788 # full output here.
15789 # To test realistic parsing behavior, apply a tidy-like transformation to both
15790 # the expected output and your parser's output.
15791 !! test
15792 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15793 !! wikitext
15794 ******* Foo {{bullet}}
15795 !! html
15796 <ul>
15797 <li><ul>
15798 <li><ul>
15799 <li><ul>
15800 <li><ul>
15801 <li><ul>
15802 <li><ul>
15803 <li> Foo
15804 </li>
15805 </ul>
15806 </li>
15807 </ul>
15808 </li>
15809 </ul>
15810 </li>
15811 </ul>
15812 </li>
15813 </ul>
15814 </li>
15815 </ul>
15816 </li>
15817 <li> Bar
15818 </li>
15819 </ul>
15820
15821 !! end
15822
15823 !! test
15824 Bug 529: Uncovered table already at line-start
15825 !! wikitext
15826 x
15827
15828 {{table}}
15829 y
15830 !! html
15831 <p>x
15832 </p>
15833 <table>
15834 <tr>
15835 <td> 1 </td>
15836 <td> 2
15837 </td></tr>
15838 <tr>
15839 <td> 3 </td>
15840 <td> 4
15841 </td></tr></table>
15842 <p>y
15843 </p>
15844 !! end
15845
15846 !! test
15847 Bug 529: Uncovered bullet in parser function result
15848 !! wikitext
15849 * Foo {{lc:{{bullet}} }}
15850 !! html
15851 <ul>
15852 <li> Foo
15853 </li>
15854 <li> bar
15855 </li>
15856 </ul>
15857
15858 !! end
15859
15860 !! test
15861 Bug 5678: Double-parsed template argument
15862 !! wikitext
15863 {{lc:{{{1}}}|hello}}
15864 !! html
15865 <p>{{{1}}}
15866 </p>
15867 !! end
15868
15869 !! test
15870 Bug 5678: Double-parsed template invocation
15871 !! wikitext
15872 {{lc:{{paramtest {{!}} param = hello }} }}
15873 !! html
15874 <p>{{paramtest | param = hello }}
15875 </p>
15876 !! end
15877
15878 !! test
15879 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15880 !! options
15881 language=cs
15882 title=[[Main Page]]
15883 !! wikitext
15884 {{PRVNÍVELKÉ:ěščř}}
15885 {{prvnívelké:ěščř}}
15886 {{PRVNÍMALÉ:ěščř}}
15887 {{prvnímalé:ěščř}}
15888 {{MALÁ:ěščř}}
15889 {{malá:ěščř}}
15890 {{VELKÁ:ěščř}}
15891 {{velká:ěščř}}
15892 !! html
15893 <p>Ěščř
15894 Ěščř
15895 ěščř
15896 ěščř
15897 ěščř
15898 ěščř
15899 ĚŠČŘ
15900 ĚŠČŘ
15901 </p>
15902 !! end
15903
15904 !! test
15905 Morwen/13: Unclosed link followed by heading
15906 !! wikitext
15907 [[link
15908 ==heading==
15909 !! html
15910 <p>[[link
15911 </p>
15912 <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>
15913
15914 !! end
15915
15916 !! test
15917 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15918 !! wikitext
15919 {{foo|
15920 =heading=
15921 !! html
15922 <p>{{foo|
15923 </p>
15924 <h1><span class="mw-headline" id="heading">heading</span></h1>
15925
15926 !! end
15927
15928 !! test
15929 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15930 !! wikitext
15931 {{foo|
15932 ==heading==
15933 !! html
15934 <p>{{foo|
15935 </p>
15936 <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>
15937
15938 !! end
15939
15940 !! test
15941 Tildes in comments
15942 !! options
15943 pst
15944 !! wikitext
15945 <!-- ~~~~ -->
15946 !! html
15947 <!-- ~~~~ -->
15948 !! end
15949
15950 !! test
15951 Paragraphs inside divs (no extra line breaks)
15952 !! wikitext
15953 <div>Line one
15954
15955 Line two</div>
15956 !! html
15957 <div>Line one
15958 Line two</div>
15959
15960 !! end
15961
15962 !! test
15963 Paragraphs inside divs (extra line break on open)
15964 !! wikitext
15965 <div>
15966 Line one
15967
15968 Line two</div>
15969 !! html
15970 <div>
15971 <p>Line one
15972 </p>
15973 Line two</div>
15974
15975 !! end
15976
15977 !! test
15978 Paragraphs inside divs (extra line break on close)
15979 !! wikitext
15980 <div>Line one
15981
15982 Line two
15983 </div>
15984 !! html
15985 <div>Line one
15986 <p>Line two
15987 </p>
15988 </div>
15989
15990 !! end
15991
15992 !! test
15993 Paragraphs inside divs (extra line break on open and close)
15994 !! wikitext
15995 <div>
15996 Line one
15997
15998 Line two
15999 </div>
16000 !! html
16001 <div>
16002 <p>Line one
16003 </p><p>Line two
16004 </p>
16005 </div>
16006
16007 !! end
16008
16009 !! test
16010 Nesting tags, paragraphs on lines which begin with <div>
16011 !! options
16012 disabled
16013 !! wikitext
16014 <div></div><strong>A
16015 B</strong>
16016 !! html
16017 <div></div>
16018 <p><strong>A
16019 B</strong>
16020 </p>
16021 !! end
16022
16023 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16024 !! test
16025 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16026 !! wikitext
16027 <blockquote>Line one
16028
16029 Line two</blockquote>
16030 !! html
16031 <blockquote>Line one
16032 Line two</blockquote>
16033
16034 !! end
16035
16036 !! test
16037 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16038 !! wikitext
16039 <blockquote>
16040 Line one
16041
16042 Line two</blockquote>
16043 !! html
16044 <blockquote>
16045 <p>Line one
16046 </p>
16047 Line two</blockquote>
16048
16049 !! end
16050
16051 !! test
16052 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16053 !! wikitext
16054 <blockquote>Line one
16055
16056 Line two
16057 </blockquote>
16058 !! html
16059 <blockquote>Line one
16060 <p>Line two
16061 </p>
16062 </blockquote>
16063
16064 !! end
16065
16066 !! test
16067 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16068 !! wikitext
16069 <blockquote>
16070 Line one
16071
16072 Line two
16073 </blockquote>
16074 !! html
16075 <blockquote>
16076 <p>Line one
16077 </p><p>Line two
16078 </p>
16079 </blockquote>
16080
16081 !! end
16082
16083 !! test
16084 Paragraphs inside blockquotes/divs (no extra line breaks)
16085 !! wikitext
16086 <blockquote><div>Line one
16087
16088 Line two</div></blockquote>
16089 !! html
16090 <blockquote><div>Line one
16091 Line two</div></blockquote>
16092
16093 !! end
16094
16095 !! test
16096 Paragraphs inside blockquotes/divs (extra line break on open)
16097 !! wikitext
16098 <blockquote><div>
16099 Line one
16100
16101 Line two</div></blockquote>
16102 !! html
16103 <blockquote><div>
16104 <p>Line one
16105 </p>
16106 Line two</div></blockquote>
16107
16108 !! end
16109
16110 !! test
16111 Paragraphs inside blockquotes/divs (extra line break on close)
16112 !! wikitext
16113 <blockquote><div>Line one
16114
16115 Line two
16116 </div></blockquote>
16117 !! html
16118 <blockquote><div>Line one
16119 <p>Line two
16120 </p>
16121 </div></blockquote>
16122
16123 !! end
16124
16125 !! test
16126 Paragraphs inside blockquotes/divs (extra line break on open and close)
16127 !! wikitext
16128 <blockquote><div>
16129 Line one
16130
16131 Line two
16132 </div></blockquote>
16133 !! html
16134 <blockquote><div>
16135 <p>Line one
16136 </p><p>Line two
16137 </p>
16138 </div></blockquote>
16139
16140 !! end
16141
16142 !! test
16143 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16144 !! options
16145 wgLinkHolderBatchSize=0
16146 !! wikitext
16147 [[meatball:1]]
16148 [[meatball:2]]
16149 [[meatball:3]]
16150 !! html
16151 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16152 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16153 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16154 </p>
16155 !! end
16156
16157 !! test
16158 Free external link invading image caption
16159 !! wikitext
16160 [[Image:Foobar.jpg|thumb|http://x|hello]]
16161 !! html
16162 <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>
16163
16164 !! end
16165
16166 !! test
16167 Bug 15196: localised external link numbers
16168 !! options
16169 language=fa
16170 !! wikitext
16171 [http://en.wikipedia.org/]
16172 !! html
16173 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16174 </p>
16175 !! end
16176
16177 !! test
16178 Multibyte character in padleft
16179 !! wikitext
16180 {{padleft:-Hello|7|Æ}}
16181 !! html
16182 <p>Æ-Hello
16183 </p>
16184 !! end
16185
16186 !! test
16187 Multibyte character in padright
16188 !! wikitext
16189 {{padright:Hello-|7|Æ}}
16190 !! html
16191 <p>Hello-Æ
16192 </p>
16193 !! end
16194
16195 !!test
16196 formatdate parser function
16197 !! wikitext
16198 {{#formatdate:2009-03-24}}
16199 !! html
16200 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16201 </p>
16202 !! end
16203
16204 !!test
16205 formatdate parser function, with default format
16206 !! wikitext
16207 {{#formatdate:2009-03-24|mdy}}
16208 !! html
16209 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16210 </p>
16211 !! end
16212
16213 !! test
16214 Spacing of numbers in formatted dates
16215 !! wikitext
16216 {{#formatdate:January 15}}
16217 !! html
16218 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16219 </p>
16220 !! end
16221
16222 !! test
16223 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
16224 !! options
16225 language=nl title=[[MediaWiki:Common.css]]
16226 !! wikitext
16227 {{#formatdate:2009-03-24|dmy}}
16228 !! html
16229 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16230 </p>
16231 !! end
16232
16233 #
16234 #
16235 #
16236
16237 #
16238 # Edit comments
16239 #
16240
16241 !! test
16242 Edit comment with link
16243 !! options
16244 comment
16245 !! wikitext
16246 I like the [[Main Page]] a lot
16247 !! html
16248 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16249 !!end
16250
16251 !! test
16252 Edit comment with link and link text
16253 !! options
16254 comment
16255 !! wikitext
16256 I like the [[Main Page|best pages]] a lot
16257 !! html
16258 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16259 !!end
16260
16261 !! test
16262 Edit comment with link and link text with suffix
16263 !! options
16264 comment
16265 !! wikitext
16266 I like the [[Main Page|best page]]s a lot
16267 !! html
16268 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16269 !!end
16270
16271 !! test
16272 Edit comment with section link (non-local, eg in history list)
16273 !! options
16274 comment title=[[Main Page]]
16275 !! wikitext
16276 /* External links */ removed bogus entries
16277 !! html
16278 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16279 !!end
16280
16281 !! test
16282 Edit comment with section link and text before it (non-local, eg in history list)
16283 !! options
16284 comment title=[[Main Page]]
16285 !! wikitext
16286 pre-comment text /* External links */ removed bogus entries
16287 !! html
16288 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>
16289 !!end
16290
16291 !! test
16292 Edit comment with section link (local, eg in diff view)
16293 !! options
16294 comment local title=[[Main Page]]
16295 !! wikitext
16296 /* External links */ removed bogus entries
16297 !! html
16298 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16299 !!end
16300
16301 !! test
16302 Edit comment with subpage link (bug 14080)
16303 !! options
16304 comment
16305 subpage
16306 title=[[Subpage test]]
16307 !! wikitext
16308 Poked at a [[/subpage]] here...
16309 !! html
16310 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16311 !!end
16312
16313 !! test
16314 Edit comment with subpage link and link text (bug 14080)
16315 !! options
16316 comment
16317 subpage
16318 title=[[Subpage test]]
16319 !! wikitext
16320 Poked at a [[/subpage|neat little page]] here...
16321 !! html
16322 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16323 !!end
16324
16325 !! test
16326 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16327 !! options
16328 comment
16329 title=[[Subpage test]]
16330 !! wikitext
16331 Poked at a [[/subpage]] here...
16332 !! html
16333 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...
16334 !!end
16335
16336 !! test
16337 Edit comment with bare anchor link (local, as on diff)
16338 !! options
16339 comment
16340 local
16341 title=[[Main Page]]
16342 !! wikitext
16343 [[#section]]
16344 !! html
16345 <a href="#section">#section</a>
16346 !! end
16347
16348 !! test
16349 Edit comment with bare anchor link (non-local, as on history)
16350 !! options
16351 comment
16352 title=[[Main Page]]
16353 !! wikitext
16354 [[#section]]
16355 !! html
16356 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16357 !! end
16358
16359 !! test
16360 Anchor starting with underscore
16361 !! wikitext
16362 [[#_ref|One]]
16363 !! html
16364 <p><a href="#_ref">One</a>
16365 </p>
16366 !! end
16367
16368 !! test
16369 Id starting with underscore
16370 !! wikitext
16371 <div id="_ref"></div>
16372 !! html
16373 <div id="_ref"></div>
16374
16375 !! end
16376
16377 !! test
16378 Space normalisation on autocomment (bug 22784)
16379 !! options
16380 comment
16381 title=[[Main Page]]
16382 !! wikitext
16383 /* __hello__world__ */
16384 !! html
16385 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16386 !! end
16387
16388 !! test
16389 percent-encoding and + signs in comments (Bug 26410)
16390 !! options
16391 comment
16392 !! wikitext
16393 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16394 !! html
16395 <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>
16396 !! end
16397
16398 !! test
16399 Bad images - basic functionality
16400 !! options
16401 disabled
16402 !! wikitext
16403 [[File:Bad.jpg]]
16404 !! html
16405 !! end
16406
16407 !! test
16408 Bad images - bug 16039: text after bad image disappears
16409 !! options
16410 disabled
16411 !! wikitext
16412 Foo bar
16413 [[File:Bad.jpg]]
16414 Bar foo
16415 !! html
16416 <p>Foo bar
16417 </p><p>Bar foo
16418 </p>
16419 !! end
16420
16421 !! test
16422 Verify that displaytitle works (bug #22501) no displaytitle
16423 !! options
16424 showtitle
16425 !! config
16426 wgAllowDisplayTitle=true
16427 wgRestrictDisplayTitle=false
16428 !! wikitext
16429 this is not the the title
16430 !! html
16431 Parser test
16432 <p>this is not the the title
16433 </p>
16434 !! end
16435
16436 !! test
16437 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16438 !! options
16439 showtitle
16440 title=[[Screen]]
16441 !! config
16442 wgAllowDisplayTitle=true
16443 wgRestrictDisplayTitle=false
16444 !! wikitext
16445 this is not the the title
16446 {{DISPLAYTITLE:whatever}}
16447 !! html
16448 whatever
16449 <p>this is not the the title
16450 </p>
16451 !! end
16452
16453 !! test
16454 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
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:whatever}}
16464 !! html
16465 Screen
16466 <p>this is not the the title
16467 </p>
16468 !! end
16469
16470 !! test
16471 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
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:screen}}
16481 !! html
16482 screen
16483 <p>this is not the the title
16484 </p>
16485 !! end
16486
16487 !! test
16488 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16489 !! options
16490 showtitle
16491 title=[[Screen]]
16492 !! config
16493 wgAllowDisplayTitle=false
16494 !! wikitext
16495 this is not the the title
16496 {{DISPLAYTITLE:screen}}
16497 !! html
16498 Screen
16499 <p>this is not the the title
16500 <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>
16501 </p>
16502 !! end
16503
16504 !! test
16505 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16506 !! options
16507 showtitle
16508 title=[[Screen]]
16509 !! config
16510 wgAllowDisplayTitle=false
16511 !! wikitext
16512 this is not the the title
16513 !! html
16514 Screen
16515 <p>this is not the the title
16516 </p>
16517 !! end
16518
16519 !! test
16520 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16521 !! options
16522 showtitle
16523 title=[[Screen]]
16524 !! config
16525 wgAllowDisplayTitle=true
16526 wgRestrictDisplayTitle=true
16527 !! wikitext
16528 this is not the the title
16529 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16530 !! html
16531 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16532 <p>this is not the the title
16533 </p>
16534 !! end
16535
16536 !! test
16537 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16538 !! options
16539 showtitle
16540 title=[[Screen]]
16541 !! config
16542 wgAllowDisplayTitle=true
16543 wgRestrictDisplayTitle=true
16544 !! wikitext
16545 this is not the the title
16546 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16547 !! html
16548 <span style="color: red;">s</span>creen
16549 <p>this is not the the title
16550 </p>
16551 !! end
16552
16553 !! test
16554 preload: check <noinclude> and <includeonly>
16555 !! options
16556 preload
16557 !! wikitext
16558 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16559 !! html
16560 Hello kind world.
16561 !! end
16562
16563 !! test
16564 preload: check <onlyinclude>
16565 !! options
16566 preload
16567 !! wikitext
16568 Goodbye <onlyinclude>Hello world</onlyinclude>
16569 !! html
16570 Hello world
16571 !! end
16572
16573 !! test
16574 preload: can pass tags through if we want to
16575 !! options
16576 preload
16577 !! wikitext
16578 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16579 !! html
16580 <includeonly>Hello world</includeonly>
16581 !! end
16582
16583 !! test
16584 preload: check that it doesn't try to do tricks
16585 !! options
16586 preload
16587 !! wikitext
16588 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16589 !! html
16590 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16591 !! end
16592
16593 !! test
16594 Play a bit with r67090 and bug 3158
16595 !! options
16596 disabled
16597 !! wikitext
16598 <div style="width:50% !important">&nbsp;</div>
16599 <div style="width:50%&nbsp;!important">&nbsp;</div>
16600 <div style="width:50%&#160;!important">&nbsp;</div>
16601 <div style="border : solid;">&nbsp;</div>
16602 !! html
16603 <div style="width:50% !important">&nbsp;</div>
16604 <div style="width:50% !important">&nbsp;</div>
16605 <div style="width:50% !important">&nbsp;</div>
16606 <div style="border&#160;: solid;">&nbsp;</div>
16607
16608 !! end
16609
16610 !! test
16611 HTML5 data attributes
16612 !! wikitext
16613 <span data-foo="bar">Baz</span>
16614 <p data-abc-def_hij="">Quuz</p>
16615 !! html
16616 <p><span data-foo="bar">Baz</span>
16617 </p>
16618 <p data-abc-def_hij="">Quuz</p>
16619
16620 !! end
16621
16622 !! test
16623 percent-encoding and + signs in internal links (Bug 26410)
16624 !! wikitext
16625 [[User:+%]] [[Page+title%]]
16626 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16627 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16628 [[%33%45]] [[%33%45+]]
16629 !! html
16630 <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>
16631 <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>
16632 <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>
16633 <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>
16634 </p>
16635 !! end
16636
16637 !! test
16638 Special characters in embedded file links (bug 27679)
16639 !! wikitext
16640 [[File:Contains & ampersand.jpg]]
16641 [[File:Does not exist.jpg|Title with & ampersand]]
16642 !! html
16643 <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>
16644 <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>
16645 </p>
16646 !! end
16647
16648
16649 !! test
16650 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16651 !! wikitext
16652 Text&apos;s been normalized?
16653 !! html
16654 <p>Text&#39;s been normalized?
16655 </p>
16656 !! end
16657
16658 !! test
16659 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16660 !! wikitext
16661 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16662 !! html
16663 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16664 </p>
16665 !! end
16666
16667 !! test
16668 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16669 !! wikitext
16670 [http://www.example.org/ ideograms]
16671 !! html
16672 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16673 </p>
16674 !! end
16675
16676 !! test
16677 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16678 !! wikitext
16679 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16680 !! html
16681 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16682 </p>
16683 !! end
16684
16685 !! article
16686 Mediawiki:loop1
16687 !! text
16688 {{Identical|A}}
16689 !! endarticle
16690
16691 !! article
16692 Mediawiki:loop2
16693 !! text
16694 {{Identical|B}}
16695 !! endarticle
16696
16697 !! article
16698 Template:Identical
16699 !! text
16700 {{int:loop1}}
16701 {{int:loop2}}
16702 !! endarticle
16703
16704 !! test
16705 Bug 31098 Template which includes system messages which includes the template
16706 !! wikitext
16707 {{Identical}}
16708 !! html
16709 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16710 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16711 </p>
16712 !! end
16713
16714 !! test
16715 Bug31490 Turkish: ucfirst 'blah'
16716 !! options
16717 language=tr
16718 !! wikitext
16719 {{ucfirst:blah}}
16720 !! html
16721 <p>Blah
16722 </p>
16723 !! end
16724
16725 !! test
16726 Bug31490 Turkish: ucfirst 'ix'
16727 !! options
16728 language=tr
16729 !! wikitext
16730 {{ucfirst:ix}}
16731 !! html
16732 <p>İx
16733 </p>
16734 !! end
16735
16736 !! test
16737 Bug31490 Turkish: lcfirst 'BLAH'
16738 !! options
16739 language=tr
16740 !! wikitext
16741 {{lcfirst:BLAH}}
16742 !! html
16743 <p>bLAH
16744 </p>
16745 !! end
16746
16747 !! test
16748 Bug31490 Turkish: ucfırst (with a dotless i)
16749 !! options
16750 language=tr
16751 !! wikitext
16752 {{ucfırst:blah}}
16753 !! html
16754 <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>
16755 </p>
16756 !! end
16757
16758 !! test
16759 Bug31490 ucfırst (with a dotless i) with English language
16760 !! options
16761 language=en
16762 !! wikitext
16763 {{ucfırst:blah}}
16764 !! html
16765 <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>
16766 </p>
16767 !! end
16768
16769 !! test
16770 Bug 26375: TOC with italics
16771 !! options
16772 title=[[Main Page]]
16773 !! wikitext
16774 __TOC__
16775 == ''Lost'' episodes ==
16776 !! html
16777 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16778 <ul>
16779 <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>
16780 </ul>
16781 </div>
16782
16783 <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>
16784
16785 !! end
16786
16787 !! test
16788 Bug 26375: TOC with bold
16789 !! options
16790 title=[[Main Page]]
16791 !! wikitext
16792 __TOC__
16793 == '''should be bold''' then normal text ==
16794 !! html
16795 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16796 <ul>
16797 <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>
16798 </ul>
16799 </div>
16800
16801 <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>
16802
16803 !! end
16804
16805 !! test
16806 Bug 33845: Headings become cursive in TOC when they contain an image
16807 !! options
16808 title=[[Main Page]]
16809 !! wikitext
16810 __TOC__
16811 == Image [[Image:foobar.jpg]] ==
16812 !! html
16813 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16814 <ul>
16815 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16816 </ul>
16817 </div>
16818
16819 <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>
16820
16821 !! end
16822
16823 !! test
16824 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16825 !! options
16826 title=[[Main Page]]
16827 !! wikitext
16828 __TOC__
16829 == <blockquote>Quote</blockquote> ==
16830 !! html
16831 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16832 <ul>
16833 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16834 </ul>
16835 </div>
16836
16837 <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>
16838
16839 !! end
16840
16841 !! test
16842 Unclosed tags in TOC
16843 !! options
16844 title=[[Main Page]]
16845 !! wikitext
16846 __TOC__
16847 == Proof: 2 < 3 ==
16848 <small>Hanc marginis exiguitas non caperet.</small>
16849 QED
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="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
16854 </ul>
16855 </div>
16856
16857 <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>
16858 <p><small>Hanc marginis exiguitas non caperet.</small>
16859 QED
16860 </p>
16861 !! end
16862
16863 !! test
16864 Multiple tags in TOC
16865 !! wikitext
16866 __TOC__
16867 == <i>Foo</i> <b>Bar</b> ==
16868
16869 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16870 !! html
16871 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16872 <ul>
16873 <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>
16874 <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>
16875 </ul>
16876 </div>
16877
16878 <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>
16879 <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>
16880
16881 !! end
16882
16883 !! test
16884 Tags with parameters in TOC
16885 !! wikitext
16886 __TOC__
16887 == <sup class="in-h2">Hello</sup> ==
16888
16889 == <sup class="a > b">Evilbye</sup> ==
16890 !! html
16891 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16892 <ul>
16893 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16894 <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>
16895 </ul>
16896 </div>
16897
16898 <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>
16899 <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>
16900
16901 !! end
16902
16903 !! test
16904 span tags with directionality in TOC
16905 !! wikitext
16906 __TOC__
16907 == <span dir="ltr">C++</span> ==
16908
16909 == <span dir="rtl">זבנג!</span> ==
16910
16911 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16912
16913 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16914
16915 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16916 !! html
16917 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16918 <ul>
16919 <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>
16920 <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>
16921 <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>
16922 <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>
16923 <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>
16924 </ul>
16925 </div>
16926
16927 <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>
16928 <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>
16929 <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>
16930 <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>
16931 <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>
16932
16933 !! end
16934
16935 !! article
16936 MediaWiki:Bug32057
16937 !! text
16938 == {{int:headline_sample}} ==
16939 !! endarticle
16940
16941 !! test
16942 Bug 32057: Title needed when expanding <h> nodes.
16943 !! options
16944 title=[[Main Page]]
16945 !! wikitext
16946 {{int:Bug32057}}
16947 !! html
16948 <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>
16949
16950 !! end
16951
16952 !! test
16953 Strip marker in urlencode
16954 !! wikitext
16955 {{urlencode:x<nowiki/>y}}
16956 {{urlencode:x<nowiki/>y|wiki}}
16957 {{urlencode:x<nowiki/>y|path}}
16958 !! html
16959 <p>xy
16960 xy
16961 xy
16962 </p>
16963 !! end
16964
16965 !! test
16966 Strip marker in lc
16967 !! wikitext
16968 {{lc:x<nowiki/>y}}
16969 !! html
16970 <p>xy
16971 </p>
16972 !! end
16973
16974 !! test
16975 Strip marker in uc
16976 !! wikitext
16977 {{uc:x<nowiki/>y}}
16978 !! html
16979 <p>XY
16980 </p>
16981 !! end
16982
16983 !! test
16984 Strip marker in formatNum
16985 !! wikitext
16986 {{formatnum:1<nowiki/>2}}
16987 {{formatnum:1<nowiki/>2|R}}
16988 !! html
16989 <p>12
16990 12
16991 </p>
16992 !! end
16993
16994 !! test
16995 Check noCommafy in formatNum
16996 !! options
16997 language=be-tarask
16998 !! wikitext
16999 {{formatnum:123456.78}}
17000 {{formatnum:123456.78|NOSEP}}
17001 !! html
17002 <p>123 456,78
17003 123456.78
17004 </p>
17005 !! end
17006
17007 !! test
17008 Wrong option for formatNum (bug 56199)
17009 !! wikitext
17010 {{formatnum:1,234.56|Random}}
17011 {{formatnum:1,234.56|EVERYTHING}}
17012 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17013 !! html
17014 <p>1,234.56
17015 1,234.56
17016 1,234.56
17017 </p>
17018 !! end
17019
17020 !! test
17021 Strip marker in grammar
17022 !! options
17023 language=fi
17024 !! wikitext
17025 {{grammar:elative|foo<nowiki/>bar}}
17026 !! html
17027 <p>foobarista
17028 </p>
17029 !! end
17030
17031 !! test
17032 Strip marker in padleft
17033 !! wikitext
17034 {{padleft:|2|x<nowiki/>y}}
17035 !! html
17036 <p>xy
17037 </p>
17038 !! end
17039
17040 !! test
17041 Strip marker in padright
17042 !! wikitext
17043 {{padright:|2|x<nowiki/>y}}
17044 !! html
17045 <p>xy
17046 </p>
17047 !! end
17048
17049 !! test
17050 Strip marker in anchorencode
17051 !! wikitext
17052 {{anchorencode:x<nowiki/>y}}
17053 !! html
17054 <p>xy
17055 </p>
17056 !! end
17057
17058 !! test
17059 nowiki inside link inside heading (bug 18295)
17060 !! wikitext
17061 ==[[foo|x<nowiki>y</nowiki>z]]==
17062 !! html
17063 <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>
17064
17065 !! end
17066
17067 !! test
17068 new support for bdi element (bug 31817)
17069 !! wikitext
17070 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17071 !! html
17072 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17073
17074 !!end
17075
17076 !! test
17077 Ignore pipe between table row attributes
17078 !! wikitext
17079 {|
17080 | quux
17081 |- id=foo | style='color: red'
17082 | bar
17083 |}
17084 !! html
17085 <table>
17086 <tr>
17087 <td> quux
17088 </td></tr>
17089 <tr id="foo" style="color: red">
17090 <td> bar
17091 </td></tr></table>
17092
17093 !! end
17094
17095 !!test
17096 Gallery override link with WikiLink (bug 34852)
17097 !! wikitext
17098 <gallery>
17099 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17100 </gallery>
17101 !! html
17102 <ul class="gallery mw-gallery-traditional">
17103 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17104 <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>
17105 <div class="gallerytext">
17106 <p>caption
17107 </p>
17108 </div>
17109 </div></li>
17110 </ul>
17111
17112 !! end
17113
17114 !!test
17115 Gallery override link with absolute external link (bug 34852)
17116 !! wikitext
17117 <gallery>
17118 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17119 </gallery>
17120 !! html
17121 <ul class="gallery mw-gallery-traditional">
17122 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17123 <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>
17124 <div class="gallerytext">
17125 <p>caption
17126 </p>
17127 </div>
17128 </div></li>
17129 </ul>
17130
17131 !! end
17132
17133 !!test
17134 Gallery override link with malicious javascript (bug 34852)
17135 !! wikitext
17136 <gallery>
17137 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17138 </gallery>
17139 !! html
17140 <ul class="gallery mw-gallery-traditional">
17141 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17142 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%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>
17143 <div class="gallerytext">
17144 <p>caption
17145 </p>
17146 </div>
17147 </div></li>
17148 </ul>
17149
17150 !! end
17151
17152 !!test
17153 Gallery with invalid title as link (bug 43964)
17154 !! wikitext
17155 <gallery>
17156 File:foobar.jpg|link=<
17157 </gallery>
17158 !! html
17159 <ul class="gallery mw-gallery-traditional">
17160 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17161 <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>
17162 <div class="gallerytext">
17163 </div>
17164 </div></li>
17165 </ul>
17166
17167 !! end
17168
17169 !!test
17170 Language parser function
17171 !! wikitext
17172 {{#language:ar}}
17173 !! html
17174 <p>العربية
17175 </p>
17176 !! end
17177
17178 !!test
17179 Padleft and padright as substr
17180 !! wikitext
17181 {{padleft:|3|abcde}}
17182 {{padright:|3|abcde}}
17183 !! html
17184 <p>abc
17185 abc
17186 </p>
17187 !! end
17188
17189 !!test
17190 Special parser function
17191 !! wikitext
17192 {{#special:RandomPage}}
17193 {{#special:BaDtItLe}}
17194 {{#special:Foobar}}
17195 !! html
17196 <p>Special:Random
17197 Special:Badtitle
17198 Special:Foobar
17199 </p>
17200 !! end
17201
17202 !!test
17203 Bug 34939 - Case insensitive link parsing ([HttP://])
17204 !! wikitext
17205 [HttP://MediaWiki.Org/]
17206 !! html
17207 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17208 </p>
17209 !! end
17210
17211 !!test
17212 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17213 !! wikitext
17214 [HttP://MediaWiki.Org/ MediaWiki]
17215 !! html
17216 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17217 </p>
17218 !! end
17219
17220 !!test
17221 Bug 34939 - Case insensitive link parsing (HttP://)
17222 !! wikitext
17223 HttP://MediaWiki.Org/
17224 !! html
17225 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17226 </p>
17227 !! end
17228
17229 !!test
17230 Disable TOC
17231 !! options
17232 notoc
17233 !! wikitext
17234 Lead
17235 == Section 1 ==
17236 == Section 2 ==
17237 == Section 3 ==
17238 == Section 4 ==
17239 == Section 5 ==
17240 !! html
17241 <p>Lead
17242 </p>
17243
17244 <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>
17245 <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>
17246 <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>
17247 <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>
17248 <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>
17249
17250 !! end
17251
17252
17253 ###
17254 ### Parsoids-specific tests
17255 ### Parsoid-PHP parser incompatibilities
17256 ###
17257 !!test
17258 1. SOL-sensitive wikitext tokens as template-args
17259 !!options
17260 parsoid=wt2html,wt2wt
17261 !! wikitext
17262 {{echo|*a}}
17263 {{echo|#a}}
17264 {{echo|:a}}
17265 !! html
17266 <span about="#mwt1" typeof="mw:Transclusion">
17267 </span><ul about="#mwt1"><li>a</li>
17268 </ul>
17269 <span about="#mwt2" typeof="mw:Transclusion">
17270 </span><ol about="#mwt2"><li>a</li>
17271 </ol>
17272 <span about="#mwt3" typeof="mw:Transclusion">
17273 </span><dl about="#mwt3"><dd>a</dd>
17274 </dl>
17275 !!end
17276
17277 #### ----------------------------------------------------------------
17278 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17279 #### tags. Parsoid's output for these tags differs from that of the
17280 #### PHP parser.
17281 #### ----------------------------------------------------------------
17282
17283 !!test
17284 Ref: 1. ref-location should be replaced with an index span
17285 !!options
17286 parsoid
17287 !! wikitext
17288 A <ref>foo</ref>
17289 B <ref name="x">foo</ref>
17290 C <ref name="y" />
17291 !! html
17292 <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>
17293 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>
17294 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>
17295 !!end
17296
17297 !!test
17298 Ref: 2. ref-tags with identical names should all get the same index
17299 !!options
17300 parsoid
17301 !! wikitext
17302 A <ref name="x">foo</ref>
17303 B <ref name="x" />
17304 !! html
17305 <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>
17306 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>
17307 !!end
17308
17309 !!test
17310 Ref: 3. spaces in ref-names should be ignored
17311 !!options
17312 parsoid
17313 !! wikitext
17314 A <ref name="x">foo</ref>
17315 B <ref name=" x " />
17316 C <ref name= x />
17317 !! html
17318 <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>
17319 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>
17320 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>
17321 !!end
17322
17323 !!test
17324 Ref: 4. 'constructor' should be accepted as a valid ref-name
17325 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17326 !!options
17327 parsoid
17328 !! wikitext
17329 A <ref name="constructor">foo</ref>
17330 !! html
17331 <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>
17332 !!end
17333
17334 !!test
17335 Ref: 5. body should accept generic wikitext
17336 !!options
17337 parsoid
17338 !! wikitext
17339 A <ref>
17340 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17341 </ref>
17342
17343 <references />
17344 !! html
17345 <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>
17346
17347 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17348 <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>
17349 </li>
17350 </ol>
17351 !!end
17352
17353 !!test
17354 Ref: 6. indent-pres should not be output in ref-body
17355 !!options
17356 parsoid
17357 !! wikitext
17358 A <ref>
17359 foo
17360 bar
17361 baz
17362 </ref>
17363
17364 <references />
17365 !! html
17366 <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>
17367
17368 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17369 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17370 bar
17371 baz
17372 </li>
17373 </ol>
17374 !!end
17375
17376 !!test
17377 Ref: 7. No p-wrapping in ref-body
17378 !!options
17379 parsoid
17380 !! wikitext
17381 A <ref>
17382 foo
17383
17384 bar
17385
17386
17387 baz
17388
17389
17390
17391 booz
17392 </ref>
17393
17394 <references />
17395 !! html
17396 <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>
17397
17398 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17399 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17400
17401 bar
17402
17403
17404 baz
17405
17406
17407
17408 booz
17409 </li>
17410 </ol>
17411 !!end
17412
17413 !!test
17414 Ref: 8. transclusion wikitext has lower precedence
17415 !!options
17416 parsoid
17417 !! wikitext
17418 A <ref> foo {{echo|</ref> B C}}
17419
17420 <references />
17421 !! html
17422 <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>
17423 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17424 <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>
17425 </ol>
17426 !!end
17427
17428 !!test
17429 Ref: 9. unclosed comments should not leak out of ref-body
17430 !!options
17431 parsoid
17432 !! wikitext
17433 A <ref> foo <!--</ref> B C
17434 <references />
17435 !! html
17436 <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>
17437 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17438 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17439 </ol>
17440 !!end
17441
17442 !!test
17443 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17444 !!options
17445 parsoid
17446 !! wikitext
17447 A <ref> <b> foo </ref> B C
17448
17449 <references />
17450 !! html
17451 <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>
17452
17453
17454 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17455 <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>
17456 </ol>
17457 !!end
17458
17459 !!test
17460 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17461 !!options
17462 parsoid
17463 !! wikitext
17464 A <ref>foo</ref> B
17465 C <ref>bar</ref> D
17466 !! html
17467 <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
17468 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>
17469 !!end
17470
17471 !!test
17472 Ref: 12. ref-tags act as trailing newline migration barrier
17473 !!options
17474 parsoid
17475 !! wikitext
17476 <!--the newline at the end of this line moves out of the p-tag-->a
17477
17478 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17479 <ref />
17480
17481 c
17482 !! html
17483 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17484
17485
17486 <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>
17487 <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>
17488
17489
17490 <p>c</p>
17491 !!end
17492
17493 !!test
17494 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17495 !!options
17496 parsoid
17497 !! wikitext
17498 <ref>foo</ref> A
17499 <ref>bar
17500 </ref> B
17501 !! html
17502 <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
17503 <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>
17504 !!end
17505
17506 !!test
17507 Ref: 14. A nested ref-tag should be emitted as plain text
17508 !!options
17509 parsoid
17510 !! wikitext
17511 <ref>foo <ref>bar</ref> baz</ref>
17512
17513 <references />
17514 !! html
17515 <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>
17516
17517 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17518 <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>
17519 </ol>
17520 !!end
17521
17522 !!test
17523 Ref: 15. ref-tags with identical names should get identical indexes
17524 !!options
17525 parsoid
17526 !! wikitext
17527 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17528 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17529
17530 <references />
17531 !! html
17532 <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>
17533 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>
17534
17535 <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>
17536 </ol>
17537 !!end
17538
17539 ## We don't bother wt2wt-ing non-standard whitespace
17540 !!test
17541 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17542 !!options
17543 parsoid=wt2html
17544 !! wikitext
17545 A <ref >foo</ref >
17546
17547 <references />
17548 !! html
17549 <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>
17550
17551 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17552 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17553 !!end
17554
17555 !!test
17556 References: 1. references tag without any refs should be handled properly
17557 !!options
17558 parsoid
17559 !! wikitext
17560 <references />
17561 !! html
17562 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17563 !!end
17564
17565 !!test
17566 References: 2. references tag with group only outputs references from that group
17567 !!options
17568 parsoid
17569 !! wikitext
17570 A <ref group="a">foo</ref>
17571 B <ref group="b">bar</ref>
17572
17573 <references group="a" />
17574 !! html
17575 <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>
17576 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>
17577
17578 <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>
17579 </ol>
17580 !!end
17581
17582 !!test
17583 References: 3. ref list should be cleared after processing references
17584 !!options
17585 parsoid
17586 !! wikitext
17587 A <ref>foo</ref>
17588
17589 <references />
17590
17591 B <ref>bar</ref>
17592
17593 <references />
17594 !! html
17595 <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>
17596
17597 <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>
17598 </ol>
17599
17600 <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>
17601
17602 <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>
17603 </ol>
17604 !!end
17605
17606 !!test
17607 References: 4. only referenced group should be cleared after processing references
17608 !!options
17609 parsoid
17610 !! wikitext
17611 A <ref group="a">afoo</ref>
17612 B <ref>bfoo</ref>
17613
17614 <references group="a" />
17615
17616 C <ref>cfoo</ref>
17617
17618 <references />
17619 !! html
17620 <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>
17621 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>
17622
17623 <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>
17624 </ol>
17625
17626 <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>
17627
17628 <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>
17629 </ol>
17630 !!end
17631
17632 !!test
17633 References: 5. ref tags in references should be processed while ignoring all other content
17634 !!options
17635 parsoid
17636 !! wikitext
17637 A <ref name="a" />
17638 B <ref name="b">bar</ref>
17639
17640 <references>
17641 <ref name="a">foo</ref>
17642 This should just get lost.
17643 </references>
17644 !! html
17645 <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>
17646 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>
17647
17648
17649 <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":{}}'>
17650 <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>
17651 <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>
17652 </ol>
17653 !!end
17654
17655 !!test
17656 References: 6. <references /> from a transclusion
17657 !!options
17658 parsoid
17659 !! wikitext
17660 <ref>Foo</ref> {{echo|<references />}}
17661 !! html
17662 <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>
17663 !!end
17664
17665 !! test
17666 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17667 !! options
17668 parsoid
17669 !! wikitext
17670 A <ref>foo bar for a</ref>
17671 B <ref group="X" name="b" />
17672
17673 <references />
17674
17675 <references group="X">
17676 <ref name="b">foo</ref>
17677 </references>
17678 !! html
17679 <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>
17680 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>
17681
17682 <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>
17683
17684 <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>
17685 !! end
17686
17687 # This test is wt2html only because we're permitting the serializer to produce
17688 # dirty diffs, normalizing the unclosed references to the self-closed version.
17689 !! test
17690 Generate references for unclosed references tag
17691 !! options
17692 parsoid=wt2html
17693 !! wikitext
17694 a<ref>foo</ref>
17695
17696 <references>
17697 !! html
17698 <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>
17699
17700
17701 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17702 <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>
17703 !! end
17704
17705 !! test
17706 New reference serializes on its own line
17707 !! options
17708 parsoid=wt2wt,html2wt
17709 !! wikitext
17710 foo
17711 <references />
17712 !! html
17713 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17714 !! end
17715
17716 #### ----------------------------------------------------------------
17717 #### The following section of tests are primarily to test
17718 #### wikitext escaping capabilities of Parsoid. Given that
17719 #### escaping can be done any number of ways, the wikitext (input)
17720 #### is always adjusted to reflect how Parsoid adds nowiki
17721 #### escape tags.
17722 ####
17723 #### We are marking several tests as parsoid-only since the
17724 #### HTML in the result section is different from what the
17725 #### PHP parser generates for it.
17726 #### ----------------------------------------------------------------
17727
17728
17729 #### --------------- Headings ---------------
17730 #### 0. Unnested
17731 #### 1. Nested inside html <h1>=foo=</h1>
17732 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17733 #### 3. Nested inside html with wikitext split by html tags
17734 #### 4. No escape needed
17735 #### 5. Empty headings <h1></h1>
17736 #### 6. Heading chars in SOL context
17737 #### ----------------------------------------
17738 !! test
17739 Headings: 0. Unnested
17740 !! options
17741 parsoid
17742 !! wikitext
17743 <nowiki>=foo=</nowiki>
17744
17745 <nowiki> =foo= </nowiki>
17746 <!--cmt-->
17747 <nowiki>=foo=</nowiki>
17748
17749 =foo''a''<nowiki>=</nowiki>
17750 !! html
17751 <p><span typeof="mw:Nowiki">=foo=</span></p>
17752
17753 <p><span typeof="mw:Nowiki"> =foo= </span>
17754 <!--cmt-->
17755 <span typeof="mw:Nowiki">=foo=</span></p>
17756
17757 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17758 !!end
17759
17760 !! test
17761 Headings: 1. Nested inside html
17762 (New headings and existing headings are handled differently)
17763 !! options
17764 parsoid=html2wt
17765 !! wikitext
17766 = =foo= =
17767
17768 == =foo= ==
17769
17770 === =foo= ===
17771
17772 =<nowiki>=foo=</nowiki>=
17773 ==<nowiki>=foo=</nowiki>==
17774 ===<nowiki>=foo=</nowiki>===
17775 ====<nowiki>=foo=</nowiki>====
17776 =====<nowiki>=foo=</nowiki>=====
17777 ======<nowiki>=foo=</nowiki>======
17778
17779 !! html
17780 <h1>=foo=</h1>
17781 <h2>=foo=</h2>
17782 <h3>=foo=</h3>
17783
17784 <h1 data-parsoid='{}'>=foo=</h1>
17785 <h2 data-parsoid='{}'>=foo=</h2>
17786 <h3 data-parsoid='{}'>=foo=</h3>
17787 <h4 data-parsoid='{}'>=foo=</h4>
17788 <h5 data-parsoid='{}'>=foo=</h5>
17789 <h6 data-parsoid='{}'>=foo=</h6>
17790 !!end
17791
17792 !! test
17793 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17794 !! options
17795 parsoid=html2wt
17796 !! wikitext
17797 = foo =
17798 <nowiki>*</nowiki>bar
17799
17800 = foo =
17801 =bar
17802
17803 = foo =
17804 <nowiki>=bar=</nowiki>
17805 !! html
17806 <h1>foo</h1>*bar
17807 <h1>foo</h1>=bar
17808 <h1>foo</h1>=bar=
17809 !!end
17810
17811 !! test
17812 Headings: 3. Nested inside html with wikitext split by html tags
17813 !! options
17814 parsoid=html2wt
17815 !! wikitext
17816 = ='''bold'''<nowiki>foo=</nowiki> =
17817 !! html
17818 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17819 !!end
17820
17821 !! test
17822 Headings: 4a. No escaping needed (testing just h1 and h2)
17823 !! options
17824 parsoid=html2wt
17825 !! wikitext
17826 = =foo =
17827
17828 = foo= =
17829
17830 = =foo= =
17831
17832 = =foo= bar =
17833
17834 == =foo ==
17835
17836 == foo= ==
17837
17838 = ''=''foo= =
17839
17840 = <nowiki>=</nowiki> =
17841 !! html
17842 <h1>=foo</h1>
17843 <h1>foo=</h1>
17844 <h1> =foo= </h1>
17845 <h1>=foo= bar</h1>
17846 <h2>=foo</h2>
17847 <h2>foo=</h2>
17848 <h1><i>=</i>foo=</h1>
17849 <h1><span typeof="mw:Nowiki">=</span></h1>
17850 !!end
17851
17852 !! test
17853 Headings: 4b. No escaping needed (inside p-tags)
17854 !! options
17855 parsoid=html2wt
17856 !! wikitext
17857 ===
17858 =foo= x
17859 =foo= <s></s>
17860 !! html
17861 <p>===
17862 =foo= x
17863 =foo= <s></s>
17864 </p>
17865 !!end
17866
17867 !! test
17868 Headings: 5. Empty headings
17869 !! options
17870 parsoid
17871 !! wikitext
17872 =<nowiki/>=
17873
17874 ==<nowiki/>==
17875
17876 ===<nowiki/>===
17877
17878 ====<nowiki/>====
17879
17880 =====<nowiki/>=====
17881
17882 ======<nowiki/>======
17883 !! html
17884 <h1></h1>
17885 <h2></h2>
17886 <h3></h3>
17887 <h4></h4>
17888 <h5></h5>
17889 <h6></h6>
17890 !!end
17891
17892 !! test
17893 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17894 !! options
17895 parsoid
17896 !! wikitext
17897 <nowiki>=a=</nowiki>
17898
17899 <nowiki>=a=</nowiki>
17900
17901 <nowiki>=a=</nowiki>
17902
17903 <nowiki>=a=</nowiki>
17904 !! html
17905 <p>=a=</p>
17906 <p>=a= </p>
17907 <p>=a= </p>
17908 <p>=a= </p>
17909 !!end
17910
17911 !! test
17912 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17913 !! options
17914 parsoid
17915 !! wikitext
17916 <nowiki>=a=
17917 b</nowiki>
17918
17919 <nowiki>=a=
17920 b</nowiki>
17921
17922 <nowiki>=a=
17923 b</nowiki>
17924
17925 <nowiki>=a=
17926 b</nowiki>
17927 !! html
17928 <p>=a=
17929 b</p>
17930 <p>=a=
17931 b</p>
17932 <p>=a=
17933 b</p>
17934 <p>=a=
17935 b</p>
17936 </p>
17937 !!end
17938
17939 !! test
17940 Headings: 6c. Heading chars in SOL context (leading newline break)
17941 !! options
17942 parsoid
17943 !! wikitext
17944 a
17945 <nowiki>=b=</nowiki>
17946 !! html
17947 <p>a
17948 =b=</p>
17949 !!end
17950
17951 !! test
17952 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17953 !! options
17954 parsoid
17955 !! wikitext
17956 <!--c0--><nowiki>=a=</nowiki>
17957
17958 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17959 !! html
17960 <p><!--c0-->=a=</p>
17961 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17962 !!end
17963
17964 !! test
17965 Headings: 6d. Heading chars in SOL context (No escaping needed)
17966 !! options
17967 parsoid=html2wt
17968 !! wikitext
17969 =a=<div>b</div>
17970 !! html
17971 =a=<div>b</div>
17972 !!end
17973
17974 #### --------------- Lists ---------------
17975 #### 0. Outside nests (*foo, etc.)
17976 #### 1. Nested inside html <ul><li>*foo</li></ul>
17977 #### 2. Inside definition lists
17978 #### 3. Only bullets at start should be escaped
17979 #### 4. No escapes needed
17980 #### 5. No unnecessary escapes
17981 #### 6. Escape bullets in SOL position
17982 #### 7. Escape bullets in a multi-line context
17983 #### ----------------------------------------
17984
17985 !! test
17986 Lists: 0. Outside nests
17987 !! wikitext
17988 <nowiki>*</nowiki>foo
17989
17990 <nowiki>#</nowiki>foo
17991 !! html
17992 <p>*foo
17993 </p><p>#foo
17994 </p>
17995 !!end
17996
17997 !! test
17998 Lists: 1. Nested inside html
17999 !! wikitext
18000 *<nowiki>*foo</nowiki>
18001
18002 *<nowiki>#foo</nowiki>
18003
18004 *<nowiki>:foo</nowiki>
18005
18006 *<nowiki>;foo</nowiki>
18007
18008 #<nowiki>*foo</nowiki>
18009
18010 #<nowiki>#foo</nowiki>
18011
18012 #<nowiki>:foo</nowiki>
18013
18014 #<nowiki>;foo</nowiki>
18015 !! html
18016 <ul>
18017 <li>*foo
18018 </li>
18019 </ul>
18020 <ul>
18021 <li>#foo
18022 </li>
18023 </ul>
18024 <ul>
18025 <li>:foo
18026 </li>
18027 </ul>
18028 <ul>
18029 <li>;foo
18030 </li>
18031 </ul>
18032 <ol>
18033 <li>*foo
18034 </li>
18035 </ol>
18036 <ol>
18037 <li>#foo
18038 </li>
18039 </ol>
18040 <ol>
18041 <li>:foo
18042 </li>
18043 </ol>
18044 <ol>
18045 <li>;foo
18046 </li>
18047 </ol>
18048
18049 !!end
18050
18051 !! test
18052 Lists: 2. Inside definition lists
18053 !! wikitext
18054 ;<nowiki>;foo</nowiki>
18055
18056 ;<nowiki>:foo</nowiki>
18057
18058 ;<nowiki>:foo</nowiki>
18059 :bar
18060
18061 :<nowiki>:foo</nowiki>
18062 !! html
18063 <dl>
18064 <dt>;foo
18065 </dt>
18066 </dl>
18067 <dl>
18068 <dt>:foo
18069 </dt>
18070 </dl>
18071 <dl>
18072 <dt>:foo
18073 </dt>
18074 <dd>bar
18075 </dd>
18076 </dl>
18077 <dl>
18078 <dd>:foo
18079 </dd>
18080 </dl>
18081
18082 !!end
18083
18084 !! test
18085 Lists: 3. Only bullets at start of text should be escaped
18086 !! wikitext
18087 *<nowiki>*foo*bar</nowiki>
18088
18089 *<nowiki>*foo</nowiki>''it''*bar
18090 !! html
18091 <ul>
18092 <li>*foo*bar
18093 </li>
18094 </ul>
18095 <ul>
18096 <li>*foo<i>it</i>*bar
18097 </li>
18098 </ul>
18099
18100 !!end
18101
18102 !! test
18103 Lists: 4. No escapes needed
18104 !! options
18105 parsoid
18106 !! wikitext
18107 *foo*bar
18108
18109 *''foo''*bar
18110
18111 *[[Foo]]: bar
18112
18113 *[[Foo]]*bar
18114 !! html
18115 <ul>
18116 <li>foo*bar
18117 </li>
18118 </ul>
18119 <ul>
18120 <li><i>foo</i>*bar
18121 </li>
18122 </ul>
18123 <ul>
18124 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18125 </li>
18126 </ul>
18127 <ul>
18128 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18129 </li>
18130 </ul>
18131 !!end
18132
18133 !! test
18134 Lists: 5. No unnecessary escapes
18135 !! wikitext
18136 * bar <span><nowiki>[[foo]]</nowiki></span>
18137
18138 *=bar <span><nowiki>[[foo]]</nowiki></span>
18139
18140 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18141
18142 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18143
18144 *=bar <span>foo]]</span>=
18145
18146 * <s></s>: a
18147 !! html
18148 <ul>
18149 <li> bar <span>[[foo]]</span>
18150 </li>
18151 </ul>
18152 <ul>
18153 <li>=bar <span>[[foo]]</span>
18154 </li>
18155 </ul>
18156 <ul>
18157 <li>[[bar <span>[[foo]]</span>
18158 </li>
18159 </ul>
18160 <ul>
18161 <li>]]bar <span>[[foo]]</span>
18162 </li>
18163 </ul>
18164 <ul>
18165 <li>=bar <span>foo]]</span>=
18166 </li>
18167 </ul>
18168 <ul>
18169 <li> <s></s>: a
18170 </li>
18171 </ul>
18172
18173 !!end
18174
18175 !! test
18176 Lists: 6. Escape bullets in SOL position
18177 !! options
18178 parsoid
18179 !! wikitext
18180 <!--cmt--><nowiki>*foo</nowiki>
18181 !! html
18182 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18183 !!end
18184
18185 !! test
18186 Lists: 7. Escape bullets in a multi-line context
18187 !! wikitext
18188 a
18189 <nowiki>*</nowiki>b
18190 !! html
18191 <p>a
18192 *b
18193 </p>
18194 !!end
18195
18196 #### --------------- HRs ---------------
18197 #### 1. Single line
18198 #### -----------------------------------
18199
18200 !! test
18201 HRs: 1. Single line
18202 !! options
18203 parsoid
18204 !! wikitext
18205 ----<nowiki>----</nowiki>
18206 ----=foo=
18207 ----*foo
18208 !! html
18209 <hr><span typeof="mw:Nowiki">----</span>
18210 <hr>=foo=
18211 <hr>*foo
18212 !! end
18213
18214 #### --------------- Tables ---------------
18215 #### 1a. Simple example
18216 #### 1b. No escaping needed (!foo)
18217 #### 1c. No escaping needed (|foo)
18218 #### 1d. No escaping needed (|}foo)
18219 ####
18220 #### 2a. Nested in td (<td>foo|bar</td>)
18221 #### 2b. Nested in td (<td>foo||bar</td>)
18222 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18223 ####
18224 #### 3a. Nested in th (<th>foo!bar</th>)
18225 #### 3b. Nested in th (<th>foo!!bar</th>)
18226 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18227 ####
18228 #### 4a. Escape -
18229 #### 4b. Escape +
18230 #### 4c. No escaping needed
18231 #### --------------------------------------
18232
18233 !! test
18234 Tables: 1a. Simple example
18235 !! wikitext
18236 <nowiki>{|
18237 |}</nowiki>
18238 !! html
18239 <p>{|
18240 |}
18241 </p>
18242 !! end
18243
18244 !! test
18245 Tables: 1b. No escaping needed
18246 !! wikitext
18247 !foo
18248 !! html
18249 <p>!foo
18250 </p>
18251 !! end
18252
18253 !! test
18254 Tables: 1c. No escaping needed
18255 !! wikitext
18256 |foo
18257 !! html
18258 <p>|foo
18259 </p>
18260 !! end
18261
18262 !! test
18263 Tables: 1d. No escaping needed
18264 !! wikitext
18265 |}foo
18266 !! html
18267 <p>|}foo
18268 </p>
18269 !! end
18270
18271 !! test
18272 Tables: 2a. Nested in td
18273 !! options
18274 parsoid=html2wt
18275 !! wikitext
18276 {|
18277 |<nowiki>foo|bar</nowiki>
18278 |-
18279 |x<div><nowiki>a|b</nowiki></div>
18280 |}
18281 !! html
18282 <table><tbody><tr>
18283 <td>foo|bar</td></tr>
18284 <tr><td>x<div>a|b</div></td>
18285 </tbody></table>
18286 !! end
18287
18288 !! test
18289 Tables: 2b. Nested in td
18290 !! options
18291 parsoid
18292 !! wikitext
18293 {|
18294 |<nowiki>foo||bar</nowiki>
18295 |''it''<nowiki>foo||bar</nowiki>
18296 |}
18297 !! html
18298 <table><tbody><tr>
18299 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18300 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18301 !! end
18302
18303 !! test
18304 Tables: 2c. Nested in td -- no escaping needed
18305 !! options
18306 parsoid
18307 !! wikitext
18308 {|
18309 |foo!!bar
18310 |}
18311 !! html
18312 <table><tbody><tr><td>foo!!bar
18313 </td></tr></tbody></table>
18314
18315 !! end
18316
18317 !! test
18318 Tables: 3a. Nested in th
18319 !! options
18320 parsoid
18321 !! wikitext
18322 {|
18323 !foo!bar
18324 |}
18325 !! html
18326 <table><tbody><tr><th>foo!bar
18327 </th></tr></tbody></table>
18328
18329 !! end
18330
18331 !! test
18332 Tables: 3b. Nested in th
18333 !! options
18334 parsoid
18335 !! wikitext
18336 {|
18337 !<nowiki>foo!!bar</nowiki>
18338 |}
18339 !! html
18340 <table>
18341 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18342 </tbody></table>
18343 !! end
18344
18345 !! test
18346 Tables: 3c. Nested in th -- no escaping needed
18347 !! options
18348 parsoid
18349 !! wikitext
18350 {|
18351 !<nowiki>foo||bar</nowiki>
18352 |}
18353 !! html
18354 <table><tbody><tr>
18355 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18356 !! end
18357
18358 !! test
18359 Tables: 4a. Escape -
18360 !! options
18361 parsoid
18362 !! wikitext
18363 {|
18364 !-bar
18365 |-
18366 |<nowiki>-bar</nowiki>
18367 |}
18368 !! html
18369 <table><tbody>
18370 <tr><th>-bar</th></tr>
18371 <tr>
18372 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18373 !! end
18374
18375 !! test
18376 Tables: 4b. Escape +
18377 !! options
18378 parsoid
18379 !! wikitext
18380 {|
18381 !+bar
18382 |-
18383 |<nowiki>+bar</nowiki>
18384 |}
18385 !! html
18386 <table><tbody>
18387 <tr><th>+bar</th></tr>
18388 <tr>
18389 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18390 !! end
18391
18392 !! test
18393 Tables: 4c. No escaping needed
18394 !! options
18395 parsoid
18396 !! wikitext
18397 {|
18398 |foo-bar
18399 |foo+bar
18400 |-
18401 |''foo''-bar
18402 |''foo''+bar
18403 |-
18404 |foo
18405 bar|baz
18406 +bar
18407 -bar
18408 |-
18409 |x
18410 <div>a|b</div>
18411 |}
18412 !! html
18413 <table><tbody>
18414 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18415 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18416 <tr><td>foo
18417 <p>bar|baz
18418 +bar
18419 -bar</p></td></tr>
18420 <tr><td>x
18421 <div>a|b</div></td>
18422 </tbody></table>
18423 !! end
18424
18425 !! test
18426 Tables: 4d. No escaping needed
18427 !! options
18428 parsoid
18429 !! wikitext
18430 {|
18431 |[[Foo]]-bar
18432 ||+1
18433 ||-2
18434 |}
18435 !! html
18436 <table>
18437 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18438 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18439 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18440 </tbody></table>
18441 !! end
18442
18443 !! test
18444 Tables: Digest broken attributes on table and tr tag
18445 !! options
18446 parsoid=wt2html
18447 !! wikitext
18448 {| || |} ++
18449 |- || || ++ --
18450 |- > [
18451 |}
18452 !! html
18453 <table>
18454 <tbody>
18455 <tr></tr>
18456 <tr></tr>
18457 </tbody></table>
18458 !! end
18459
18460 #### --------------- Links ----------------
18461 #### 1. Quote marks in link text
18462 #### 2. Wikilinks: Escapes needed
18463 #### 3. Wikilinks: No escapes needed
18464 #### 4. Extlinks: Escapes needed
18465 #### 5. Extlinks: No escapes needed
18466 #### --------------------------------------
18467 !! test
18468 Links 1. Quote marks in link text
18469 !! options
18470 parsoid
18471 !! wikitext
18472 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18473 !! html
18474 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18475 !! end
18476
18477 !! test
18478 Links 2. WikiLinks: Escapes needed
18479 !! options
18480 parsoid
18481 !! wikitext
18482 [[Foo|[Foobar]]]
18483 [[Foo|<nowiki>Foobar]</nowiki>]]
18484 [[Foo|x [Foobar] x]]
18485 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18486 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18487 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18488 [[Foo|<nowiki>|Bar</nowiki>]]
18489 [[Foo|<nowiki>]]bar</nowiki>]]
18490 [[Foo|<nowiki>[[bar</nowiki>]]
18491 [[Foo|<nowiki>x [[ y</nowiki>]]
18492 [[Foo|<nowiki>x ]] y</nowiki>]]
18493 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18494 !! html
18495 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18496 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18497 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18498 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18499 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18500 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18501 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18502 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18503 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18504 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18505 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18506 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18507 !! end
18508
18509 !! test
18510 Links 3. WikiLinks: No escapes needed
18511 !! options
18512 parsoid
18513 !! wikitext
18514 [[Foo|[Foobar]]
18515 [[Foo|foo|bar]]
18516 !! html
18517 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18518 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18519 !! end
18520
18521 !! test
18522 Links 4. ExtLinks: Escapes needed
18523 !! options
18524 parsoid
18525 !! wikitext
18526 [http://google.com <nowiki>[google]</nowiki>]
18527 [http://google.com <nowiki>google]</nowiki>]
18528
18529 <nowiki>[http://google.com]</nowiki>
18530
18531 <nowiki>[http://google.com google]</nowiki>
18532
18533 !! html
18534 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18535 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18536 <p>[http://google.com]</p>
18537 <p>[http://google.com google]</p>
18538 !! end
18539
18540 !! test
18541 Links 5. ExtLinks: No escapes needed
18542 !! options
18543 parsoid
18544 !! wikitext
18545 [http://google.com [google]
18546 !! html
18547 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18548 !! end
18549
18550 #### --------------- Quotes ---------------
18551 #### 1. Quotes inside <b> and <i>
18552 #### 2. Link fragments separated by <i> and <b> tags
18553 #### 3. Link fragments inside <i> and <b>
18554 #### 4. No escaping needed
18555 #### --------------------------------------
18556 !! test
18557 1. Quotes inside <b> and <i>
18558 !! options
18559 parsoid=html2wt,wt2wt
18560 !! wikitext
18561 ''<nowiki>'foo'</nowiki>''
18562 ''<nowiki>''foo''</nowiki>''
18563 ''<nowiki>'''foo'''</nowiki>''
18564 ''foo''<nowiki/>'s
18565 '''<nowiki>'foo'</nowiki>'''
18566 '''<nowiki>''foo''</nowiki>'''
18567 '''<nowiki>'''foo'''</nowiki>'''
18568 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18569 '''foo'''<nowiki/>'s
18570 '''foo''
18571 ''foo''<nowiki/>'
18572 '<nowiki/>''foo''<nowiki/>'
18573 ''''foo'''
18574 '''foo'''<nowiki/>'
18575 '<nowiki/>'''foo'''<nowiki/>'
18576 ''fools'<span> errand</span>''
18577 ''<span>fool</span>'s errand''
18578 !! html
18579 <p><i>'foo'</i>
18580 <i>''foo''</i>
18581 <i>'''foo'''</i>
18582 <i>foo</i>'s
18583 <b>'foo'</b>
18584 <b>''foo''</b>
18585 <b>'''foo'''</b>
18586 <b>foo'<i>bar'</i>baz</b>
18587 <b>foo</b>'s
18588 '<i>foo</i>
18589 <i>foo</i>'
18590 '<i>foo</i>'
18591 '<b>foo</b>
18592 <b>foo</b>'
18593 '<b>foo</b>'</p>
18594 <i>fools'<span> errand</span></i>
18595 <i><span>fool</span>'s errand</i>
18596 !! end
18597
18598 !! test
18599 2. Link fragments separated by <i> and <b> tags
18600 !! wikitext
18601 [[''foo''<nowiki>hello]]</nowiki>
18602
18603 [['''foo'''<nowiki>hello]]</nowiki>
18604 !! html
18605 <p>[[<i>foo</i>hello]]
18606 </p><p>[[<b>foo</b>hello]]
18607 </p>
18608 !! end
18609
18610 !! test
18611 3. Link fragments inside <i> and <b>
18612 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18613 this is one of the shortcomings of this format)
18614 !! wikitext
18615 ''[[foo''<nowiki>]]</nowiki>
18616
18617 '''[[foo'''<nowiki>]]</nowiki>
18618 !! html
18619 <p><i>[[foo</i>]]
18620 </p><p><b>[[foo</b>]]
18621 </p>
18622 !! end
18623
18624 !! test
18625 4. No escaping needed
18626 !! wikitext
18627 '<span>''bar''</span>'
18628 '<span>'''bar'''</span>'
18629 !! html
18630 <p>'<span><i>bar</i></span>'
18631 '<span><b>bar</b></span>'
18632 </p>
18633 !! end
18634
18635 #### ----------- Paragraphs ---------------
18636 #### 1. No unnecessary escapes
18637 #### --------------------------------------
18638
18639 !! test
18640 1. No unnecessary escapes
18641 !! wikitext
18642 bar <span><nowiki>[[foo]]</nowiki></span>
18643
18644 =bar <span><nowiki>[[foo]]</nowiki></span>
18645
18646 [[bar <span><nowiki>[[foo]]</nowiki></span>
18647
18648 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18649
18650 =bar <span>foo]]</span><nowiki>=</nowiki>
18651 !! html
18652 <p>bar <span>[[foo]]</span>
18653 </p><p>=bar <span>[[foo]]</span>
18654 </p><p>[[bar <span>[[foo]]</span>
18655 </p><p>]]bar <span>[[foo]]</span>
18656 </p><p>=bar <span>foo]]</span>=
18657 </p>
18658 !!end
18659
18660 #### ----------------------- PRE --------------------------
18661 #### 1. Leading whitespace in SOL context should be escaped
18662 #### ------------------------------------------------------
18663 !! test
18664 1. Leading whitespace in SOL context should be escaped
18665 !! options
18666 parsoid
18667 !! wikitext
18668 <nowiki> </nowiki>a
18669
18670 <nowiki> </nowiki> a
18671
18672 <nowiki> </nowiki>a(tab)
18673
18674 <nowiki> </nowiki> a
18675 <!--cmt-->
18676 <nowiki> </nowiki> a
18677
18678 a
18679 <nowiki> </nowiki>b
18680
18681 a
18682 <nowiki> </nowiki>b
18683
18684 a
18685 <nowiki> </nowiki> b
18686 !! html
18687 <p> a</p>
18688 <p> a</p>
18689 <p> a(tab)</p>
18690 <p> a</p>
18691 <p><!--cmt--> a</p>
18692 <p>a
18693 b</p>
18694 <p>a
18695 b</p>
18696 <p>a
18697 b</p>
18698 !! end
18699
18700 #### --------------- Behavior Switches --------------------
18701 !! test
18702 1. Valid behavior switches should be escaped
18703 !! options
18704 parsoid=html2wt
18705 !! wikitext
18706 <nowiki>__TOC__</nowiki>
18707 !! html
18708 __TOC__
18709 !! end
18710
18711 !! test
18712 2. Invalid behavior switches should not be escaped
18713 !! options
18714 parsoid=html2wt
18715 !! wikitext
18716 __TOO__
18717 __|__
18718 !! html
18719 __TOO__
18720 __|__
18721 !! end
18722
18723 #### --------------- HTML tags ---------------
18724 #### 1. a tags
18725 #### 2. other tags
18726 #### 3. multi-line html tag
18727 #### 4. extension tags
18728 #### -----------------------------------------
18729 !! test
18730 1. a tags
18731 !! options
18732 parsoid
18733 !! wikitext
18734 <a href="http://google.com">google</a>
18735 !! html
18736 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18737 !! end
18738
18739 !! test
18740 2. other tags
18741 !! wikitext
18742 <nowiki><div>foo</div>
18743 <div style="color:red">foo</div></nowiki>
18744 !! html
18745 <p>&lt;div&gt;foo&lt;/div&gt;
18746 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18747 </p>
18748 !! end
18749
18750 !! test
18751 3. multi-line html tag
18752 !! wikitext
18753 <nowiki><div
18754 >foo</div
18755 ></nowiki>
18756 !! html
18757 <p>&lt;div
18758 &gt;foo&lt;/div
18759 &gt;
18760 </p>
18761 !! end
18762
18763 !! test
18764 4. extension tags
18765 !! wikitext
18766 <nowiki><ref>foo</ref></nowiki>
18767
18768 <nowiki><ref>bar</nowiki>
18769
18770 baz<nowiki></ref></nowiki>
18771 !! html
18772 <p>&lt;ref&gt;foo&lt;/ref&gt;
18773 </p><p>&lt;ref&gt;bar
18774 </p><p>baz&lt;/ref&gt;
18775 </p>
18776 !! end
18777
18778 #### --------------- Others ---------------
18779 !! test
18780 Escaping nowikis
18781 !! wikitext
18782 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18783 !! html
18784 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18785 </p>
18786 !! end
18787
18788 ## The quote-char in the input is necessary for triggering the bug
18789 !! test
18790 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18791 !! options
18792 parsoid=wt2wt,html2wt
18793 !! wikitext
18794 foo's bar :
18795 !! html
18796 <p>foo's bar :</p>
18797 !! end
18798
18799 !! test
18800
18801 Tag-like HTML structures are passed through as text
18802 !! wikitext
18803 <x y>
18804
18805 <x.y>
18806
18807 <x-y>
18808
18809 1>2
18810
18811 x<y
18812
18813 a>b
18814
18815 1<d e>f
18816 !! html
18817 <p>&lt;x y&gt;
18818 </p><p>&lt;x.y&gt;
18819 </p><p>&lt;x-y&gt;
18820 </p><p>1&gt;2
18821 </p><p>x&lt;y
18822 </p><p>a&gt;b
18823 </p><p>1&lt;d e&gt;f
18824 </p>
18825 !! end
18826
18827
18828 # This was a bug in the PHP parser (see bug 17663 and its dups,
18829 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18830 !! test
18831 Tag names followed by punctuation should not be recognized as tags
18832 !! wikitext
18833 <s.ome> text
18834 !! html
18835 <p>&lt;s.ome&gt; text
18836 </p>
18837 !! end
18838
18839 !! test
18840 HTML tag with necessary entities in attributes
18841 !! wikitext
18842 <span title="&amp;amp;">foo</span>
18843 !! html
18844 <p><span title="&amp;amp;">foo</span>
18845 </p>
18846 !! end
18847
18848 !! test
18849 HTML tag with 'unnecessary' entity encoding in attributes
18850 !! wikitext
18851 <span title="&amp;">foo</span>
18852 !! html
18853 <p><span title="&amp;">foo</span>
18854 </p>
18855 !! end
18856
18857 !! test
18858 HTML tag with broken attribute value quoting
18859 !! wikitext
18860 <span title="Hello world>Foo</span>
18861 !! html
18862 <p><span>Foo</span>
18863 </p>
18864 !! end
18865
18866 !! test
18867 Parsoid-only: HTML tag with broken attribute value quoting
18868 !! options
18869 parsoid
18870 !! wikitext
18871 <span title="Hello world>Foo</span>
18872 !! html
18873 <p><span title="Hello world">Foo</span>
18874 </p>
18875 !! end
18876
18877 !! test
18878 Table with broken attribute value quoting
18879 !! wikitext
18880 {|
18881 | title="Hello world|Foo
18882 |}
18883 !! html
18884 <table>
18885 <tr>
18886 <td>Foo
18887 </td></tr></table>
18888
18889 !! end
18890
18891 !! test
18892 Table with broken attribute value quoting on consecutive lines
18893 !! wikitext
18894 {|
18895 | title="Hello world|Foo
18896 | style="color:red|Bar
18897 |}
18898 !! html
18899 <table>
18900 <tr>
18901 <td>Foo
18902 </td>
18903 <td>Bar
18904 </td></tr></table>
18905
18906 !! end
18907
18908 !! test
18909 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18910 !! options
18911 parsoid
18912 !! wikitext
18913 {|
18914 | title="Hello world|Foo
18915 | style="color:red|Bar
18916 |}
18917 !! html
18918 <table><tbody>
18919 <tr>
18920 <td title="Hello world">Foo
18921 </td><td style="color: red">Bar
18922 </td></tr></tbody></table>
18923
18924 !! end
18925
18926 !! test
18927 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18928 !! options
18929 parsoid
18930 !! wikitext
18931 {{}}
18932 !! html
18933 {{}}
18934 !! end
18935
18936 !! test
18937 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18938 !! options
18939 parsoid
18940 !! wikitext
18941 }}{{
18942 !! html
18943 }}{{
18944 !! end
18945
18946 !!test
18947 Accept empty td cell attribute
18948 !! wikitext
18949 {|
18950 | align="center" | foo || |
18951 |}
18952 !! html
18953 <table>
18954 <tr>
18955 <td align="center"> foo </td>
18956 <td>
18957 </td></tr></table>
18958
18959 !!end
18960
18961 !!test
18962 Non-empty attributes in th-cells
18963 !! wikitext
18964 {|
18965 ! Foo !! style="color: red" | Bar
18966 |}
18967 !! html
18968 <table>
18969 <tr>
18970 <th> Foo </th>
18971 <th style="color: red"> Bar
18972 </th></tr></table>
18973
18974 !!end
18975
18976 !!test
18977 Accept empty attributes in th-cells
18978 !! wikitext
18979 {|
18980 !| foo !!| bar
18981 |}
18982 !! html
18983 <table>
18984 <tr>
18985 <th> foo </th>
18986 <th> bar
18987 </th></tr></table>
18988
18989 !!end
18990
18991 !!test
18992 Empty table rows go away
18993 !! wikitext
18994 {|
18995 | Hello
18996 | there
18997 |- class="foo"
18998 |-
18999 |}
19000 !! html
19001 <table>
19002 <tr>
19003 <td> Hello
19004 </td>
19005 <td> there
19006 </td></tr>
19007
19008 </table>
19009
19010 !! end
19011
19012 ###
19013 ### Parsoid-centric tests for testing RTing of inter-element separators
19014 ### Edge cases not tested by existing parser tests and specific to
19015 ### Parsoid-specific serialization strategies.
19016 ###
19017
19018 !!test
19019 RT-ed inter-element separators should be valid separators
19020 !! wikitext
19021 {|
19022 |- [[foo]]
19023 |}
19024 !! html
19025 <table>
19026
19027 </table>
19028
19029 !!end
19030
19031 !!test
19032 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19033 (Parsoid-only since PHP parser relies on Tidy for correct output)
19034 !!options
19035 parsoid
19036 !! wikitext
19037 {|
19038 |<small>foo
19039 bar
19040 |}
19041
19042 {|
19043 |<small>foo<small>
19044 |}
19045 !! html
19046 !!end
19047
19048 !!test
19049 Empty TD followed by TD with tpl-generated attribute
19050 !! wikitext
19051 {|
19052 |-
19053 |
19054 |{{echo|style='color:red'}}|foo
19055 |}
19056 !! html
19057 <table>
19058
19059 <tr>
19060 <td>
19061 </td>
19062 <td>foo
19063 </td></tr></table>
19064
19065 !!end
19066
19067 !!test
19068 Indented table with an empty td
19069 !! wikitext
19070 {|
19071 |-
19072 |
19073 |foo
19074 |}
19075 !! html
19076 <table>
19077
19078 <tr>
19079 <td>
19080 </td>
19081 <td>foo
19082 </td></tr></table>
19083
19084 !!end
19085
19086 !!test
19087 Empty TR followed by a template-generated TR
19088 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19089 !!options
19090 parsoid
19091 !! wikitext
19092 {|
19093 |-
19094 {{echo|<tr><td>foo</td></tr>}}
19095 |}
19096 !! html
19097 <table>
19098 <tbody>
19099 <tr></tr>
19100 <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}}]}'>
19101 <td>foo</td></tr>
19102 </tbody></table>
19103 !!end
19104
19105 ## PHP and parsoid output differ for this, and since this is primarily
19106 ## for testing Parsoid's serializer, marking this Parsoid only
19107 !!test
19108 Empty TR followed by mixed-ws-comment line should RT correctly
19109 !!options
19110 parsoid
19111 !! wikitext
19112 {|
19113 |-
19114 <!--c-->
19115 |-
19116 <!--c--> <!--d-->
19117 |}
19118 !! html
19119 <table>
19120 <tbody>
19121 <tr></tr>
19122 <!--c-->
19123 <tr>
19124 <!--c--> </tr><!--d-->
19125 </tbody></table>
19126
19127 !!end
19128
19129 !!test
19130 Multi-line image caption generated by templates with/without trailing newlines
19131 !!options
19132 parsoid
19133 !! wikitext
19134 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19135 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19136 !! html
19137 <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>
19138 <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>
19139
19140 !!end
19141
19142 ## PHP emits broken html for this, and since this is primarily
19143 ## a Parsoid serializer test, marking this Parsoid only
19144 !!test
19145 Improperly nested inline or quotes tags with whitespace in between
19146 !!options
19147 parsoid
19148 !! wikitext
19149 <span> <s>x</span> </s>
19150 ''' ''x''' ''
19151 !! html
19152 <p><span> <s>x</s></span><s> </s>
19153 <b> <i>x</i></b><i> </i>
19154 </p>
19155 !!end
19156
19157 !!test
19158 Encapsulate protected attributes from wt
19159 !!options
19160 parsoid
19161 !! wikitext
19162 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19163 !! html
19164 <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>
19165 </body>
19166 !!end
19167
19168 ## Currently the p-wrapper is fragile in how adds / removes transformations.
19169 ## Having nested or stray pre tags results in the attempt to add duplicates,
19170 ## causing an assertion fail. This test tries to prevent that situation.
19171 !!test
19172 Ensure ParagraphWrapper can deal with stray closing pre tags
19173 !!options
19174 parsoid=wt2html
19175 !! wikitext
19176 plain text</pre>
19177 !! html
19178 plain text
19179 !!end
19180
19181 !!test
19182 1. Ensure fostered text content is wrapped in spans
19183 !!options
19184 parsoid=wt2html
19185 !! wikitext
19186 <table>hi</table><table>ho</table>
19187 !! html
19188 <span>hi</span>
19189 <table></table>
19190 <span>ho</span>
19191 <table></table>
19192 !!end
19193
19194 !!test
19195 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19196 !!options
19197 parsoid=wt2html,wt2wt
19198 !! wikitext
19199 <table>
19200 <tr> || ||
19201 <td> a
19202 </table>
19203 !! html
19204 <span> || ||</span>
19205 <table>
19206 <tbody>
19207 <tr>
19208 <td> a</td></tr>
19209 </tbody></table>
19210 !!end
19211
19212 !!test
19213 Encapsulation properly handles null DSR information from foster box
19214 !!options
19215 parsoid=wt2html,wt2wt
19216 !! wikitext
19217 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19218 !! html
19219 <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;
19220 <table>foo
19221 <tr>
19222 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19223 <table>
19224 <tbody>
19225 <tr>
19226 <td>bar</td></tr></tbody></table>
19227 !!end
19228
19229 !!test
19230 1. Encapsulate foster-parented transclusion content
19231 !!options
19232 parsoid=wt2wt,wt2html
19233 !! wikitext
19234 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19235 !! html
19236 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19237 <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
19238 <tr>
19239 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19240 <table>
19241 <tbody>
19242 <tr>
19243 <td>bar</td></tr></tbody></table>
19244 !!end
19245
19246 !!test
19247 2. Encapsulate foster-parented transclusion content
19248 !!options
19249 parsoid=wt2wt,wt2html
19250 !! wikitext
19251 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19252 !! html
19253 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19254 <table>
19255 <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>
19256 <tr>
19257 <td>bar</td></tr></table>&quot;]}">foo</div>
19258 <table>
19259 <tbody>
19260 <tr>
19261 <td>bar</td></tr></tbody></table>
19262 !!end
19263
19264 !!test
19265 3. Encapsulate foster-parented transclusion content
19266 !!options
19267 parsoid=wt2wt,wt2html
19268 !! wikitext
19269 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19270 !! html
19271 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19272 <table>
19273 <div>
19274 <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>
19275 <tr>
19276 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19277 <p>foo</p></div>
19278 <table>
19279 <tbody>
19280 <tr>
19281 <td>bar</td></tr></tbody></table>
19282 !!end
19283
19284 !!test
19285 4. Encapsulate foster-parented transclusion content
19286 !!options
19287 parsoid=wt2wt,wt2html
19288 !! wikitext
19289 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19290 !! html
19291 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19292 <table>
19293 <div>
19294 <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>
19295 <tr>
19296 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19297 <p>foo</p></div>
19298 <table>
19299 <tbody>
19300 <tr>
19301 <td>bar</td></tr></tbody></table>
19302 !!end
19303
19304 !!test
19305 5. Encapsulate foster-parented transclusion content
19306 !!options
19307 parsoid=wt2wt,wt2html
19308 !! wikitext
19309 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19310 !! html
19311 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19312 <table>
19313 <tr>
19314 <td>
19315 <div>
19316 <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>
19317 <table>
19318 <tbody>
19319 <tr>
19320 <td>
19321 <div>
19322 <p>foo</p></div></td></tr></tbody></table>
19323 !!end
19324
19325 !!test
19326 6. Encapsulate foster-parented transclusion content
19327 !!options
19328 parsoid=wt2wt,wt2html
19329 !! wikitext
19330 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19331 !! html
19332 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19333 <table>
19334 <tr>
19335 <td>
19336 <div>
19337 <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>
19338 <table>
19339 <tbody>
19340 <tr>
19341 <td>
19342 <div>
19343 <p>foo</p></div></td></tr></tbody></table>
19344 <p>ok</p>
19345 !!end
19346
19347 !!test
19348 7. Encapsulate foster-parented transclusion content
19349 !!options
19350 parsoid=wt2wt,wt2html
19351 !! wikitext
19352 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19353 !! html
19354 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19355 <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;
19356 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19357 <td>bar</td></table>&quot;]}">foo</p>
19358 <table>
19359 <tbody>
19360 <tr>
19361 <td>bar</td></tr></tbody></table>
19362 !!end
19363
19364 !!test
19365 8. Encapsulate foster-parented transclusion content
19366 !!options
19367 parsoid=wt2wt,wt2html
19368 !! wikitext
19369 {{echo|a
19370 }}{|{{echo|style='color:red'}}
19371 |-
19372 |b
19373 |}
19374 !! html
19375 <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>
19376 <table>
19377 <tbody>
19378 <tr>
19379 <td>b</td></tr></tbody></table>
19380 !!end
19381
19382 !!test
19383 Table in fosterable position
19384 !!options
19385 parsoid=wt2html,wt2wt
19386 !! wikitext
19387 {{OpenTable}}
19388 <div>
19389 {|
19390 |}
19391 </div>
19392 |}
19393 !! html
19394 <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="{}">
19395 </span>
19396 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19397
19398 <table>
19399 </table>
19400 !!end
19401
19402 !!test
19403 Support <object> element with .data attribute
19404 !!options
19405 parsoid=html2wt
19406 !! wikitext
19407 <object data="test.swf"></object>
19408 !! html
19409 <object data="test.swf"></object>
19410 !!end
19411
19412 # -----------------------------------------------------------------
19413 # The following section of tests are primarily to spec requirements
19414 # around serialization of new/edited content.
19415 #
19416 # All these tests are marked Parsoid html2wt and html2html only
19417 # ----------------------------------------------------------------
19418
19419 !! test
19420 Image: Modifying size of an image (1)
19421 !! options
19422 parsoid={
19423 "modes": ["wt2wt"],
19424 "changes": [
19425 ["img[height]", "attr", "height", "22"],
19426 ["img[width]", "attr", "width", "200"]
19427 ]
19428 }
19429 !! wikitext
19430 [[Image:Foobar.jpg|230x230px]]
19431 !! wikitext/edited
19432 [[Image:Foobar.jpg|200x200px]]
19433 !!end
19434
19435 !! test
19436 Image: Modifying size of an image (2)
19437 !! options
19438 parsoid={
19439 "modes": ["wt2wt"],
19440 "changes": [
19441 ["img[height]", "attr", "height", "100"],
19442 ["img[width]", "attr", "width", "500"]
19443 ]
19444 }
19445 !! wikitext
19446 [[Image:Foobar.jpg|230x230px]]
19447 !! wikitext/edited
19448 [[Image:Foobar.jpg|500x500px]]
19449 !!end
19450
19451 # Change in size is ignored so long as class='mw-default-size'
19452 !! test
19453 Image: Modifying size of an image (3)
19454 !! options
19455 parsoid={
19456 "modes": ["wt2wt"],
19457 "changes": [
19458 ["figure[class]", "removeClass", "mw-default-size"],
19459 ["figure img", "attr", "height", "19"],
19460 ["figure img", "attr", "width", "170"]
19461 ]
19462 }
19463 !! wikitext
19464 [[Image:Foobar.jpg|thumb]]
19465 !! wikitext/edited
19466 [[Image:Foobar.jpg|thumb|170x170px]]
19467 !!end
19468
19469 !! test
19470 Image: Modifying alignment of an image (bug 48665)
19471 !! options
19472 parsoid={
19473 "modes": ["wt2wt"],
19474 "changes": [
19475 ["figure[class]", "removeClass", "mw-halign-right"],
19476 ["figure[class]", "addClass", "mw-halign-left"]
19477 ]
19478 }
19479 !! wikitext
19480 [[Image:Foobar.jpg|thumb|caption|right]]
19481 !! wikitext/edited
19482 [[Image:Foobar.jpg|thumb|caption|left]]
19483 !! end
19484
19485 !! test
19486 Image: Modifying mw-default-size of an frameless image (bug 62805)
19487 !! options
19488 parsoid={
19489 "modes": ["wt2wt"],
19490 "changes": [
19491 ["figure.mw-default-size", "removeClass", "mw-default-size"]
19492 ]
19493 }
19494 !! wikitext
19495 [[Image:Foobar.jpg|frameless|right]]
19496 !! wikitext/edited
19497 [[Image:Foobar.jpg|frameless|right|220x220px]]
19498 !! end
19499
19500 !! test
19501 Image: Modifying valign of an image (bug 49221)
19502 !! options
19503 parsoid={
19504 "modes": ["wt2wt"],
19505 "changes": [
19506 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
19507 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
19508 ]
19509 }
19510 !! wikitext
19511 [[File:Foobar.jpg|20px|middle]]
19512 !! wikitext/edited
19513 [[File:Foobar.jpg|20px|text-top]]
19514 !! end
19515
19516 !! test
19517 Image: Modifying alt attribute of an image (bug 56400)
19518 !! options
19519 parsoid={
19520 "modes": ["wt2wt"],
19521 "changes": [
19522 ["img[alt]", "attr", "alt", "some alternate edited text"]
19523 ]
19524 }
19525 !! wikitext
19526 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
19527 !! wikitext/edited
19528 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19529 !!end
19530
19531 !! test
19532 Image: Modifying caption of an image
19533 !! options
19534 parsoid={
19535 "modes": ["wt2wt"],
19536 "changes": [
19537 ["figcaption", "text", "new caption"]
19538 ]
19539 }
19540 !! wikitext
19541 [[Image:Foobar.jpg|thumb|original caption]]
19542 !! wikitext/edited
19543 [[Image:Foobar.jpg|thumb|new caption]]
19544 !!end
19545
19546 !! test
19547 Image: empty alt attribute (bug 48924)
19548 !! options
19549 parsoid
19550 !! wikitext
19551 [[File:Foobar.jpg|thumb|alt=|bar]]
19552 !! html
19553 <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>
19554 !! end
19555
19556 #!! test
19557 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19558 #!! options
19559 #parsoid=html2wt
19560 #language=ar
19561 #!! input
19562 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19563 #!! result
19564 #<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>
19565 #!! end
19566
19567 !! test
19568 Image: Block level image should have \n before and after
19569 !! options
19570 parsoid
19571 !! wikitext
19572 123
19573 [[File:Foobar.jpg|right|thumb|150x150px]]
19574 456
19575 !! html
19576 <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>
19577 !!end
19578
19579 !! test
19580 Image: New block level image should have \n before and after (existing
19581 content)
19582 !! options
19583 parsoid
19584 !! wikitext
19585 123
19586 [[File:Foobar.jpg|right|thumb|150x150px]]
19587 456
19588 !! html
19589 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19590 <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>
19591 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19592 !!end
19593
19594 !! test
19595 Image: upright option (parsoid)
19596 !! options
19597 parsoid
19598 !! wikitext
19599 [[File:Foobar.jpg|thumb|upright|caption]]
19600 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19601 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19602 !! html
19603 <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>
19604 !!end
19605
19606 !! test
19607 Image: upright option is ignored on inline and frame images (parsoid)
19608 !! options
19609 parsoid
19610 !! wikitext
19611 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19612 !! html
19613 <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>
19614 !!end
19615
19616 !! test
19617 Image: from basic HTML (1)
19618 !! options
19619 parsoid=html2wt
19620 !! html/parsoid
19621 <span typeof="mw:Image">
19622 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
19623 </span>
19624 !! wikitext
19625 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
19626 !! end
19627
19628 !! test
19629 Image: from basic HTML (2)
19630 !! options
19631 parsoid=html2wt
19632 !! html/parsoid
19633 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
19634 !! wikitext
19635 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
19636 !! end
19637
19638 !! test
19639 Image: from basic HTML (3)
19640 !! options
19641 parsoid=html2wt
19642 !! html/parsoid
19643 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
19644 !! wikitext
19645 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
19646 !! end
19647
19648 !! test
19649 Image: from basic HTML (4)
19650 !! options
19651 parsoid=html2wt
19652 !! html/parsoid
19653 <img src="File:Foobar.jpg">
19654 !! wikitext
19655 [[File:Foobar.jpg|link=]]
19656 !! end
19657
19658 !! test
19659 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19660 !! options
19661 parsoid=html2wt
19662 !! wikitext
19663 * foo
19664 !! html
19665 <ul>
19666 <li><p>foo</p></li>
19667 </ul>
19668 !! end
19669
19670 !! test
19671 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19672 !! options
19673 parsoid=html2wt
19674 !! wikitext
19675 * foo
19676 !! html
19677 <ul> <li>foo</li></ul>
19678 !! end
19679
19680 !! test
19681 Don't strip leading whitespace when handling indent-pre suppressing tags
19682 !! options
19683 parsoid=html2wt
19684 !! wikitext
19685 {|
19686 | indented row
19687 |}
19688 <blockquote>
19689 '''This is very bold of you!'''
19690
19691 {|
19692 |
19693 indented cell (no pre-wrapping!)
19694 |}
19695 </blockquote>
19696 foo
19697 <div>bar</div>
19698 !! html
19699 <table>
19700 <tr><td> indented row</td></tr>
19701 </table>
19702 <blockquote><p>
19703 <b>This is very bold of you!</b>
19704 </p>
19705 <table><tr><td>
19706 indented cell (no pre-wrapping!)
19707 </td></tr></table>
19708 </blockquote>
19709 <p>foo</p>
19710 <div>bar</div>
19711 !! end
19712
19713 !! test
19714 Strip leading whitespace when handling indent-pre inducing tags
19715 !! options
19716 parsoid=html2wt
19717 !! wikitext
19718 foo
19719 <span>bar</span>
19720
19721 <span>foo2
19722 </span>bar2
19723
19724 <div>foo</div>
19725 <span>bar</span>
19726
19727 <div>
19728 <span>foo</span>
19729 </div>
19730 !! html
19731 <p>foo</p>
19732 <span>bar</span>
19733
19734 <span>foo2
19735 </span>bar2
19736
19737 <div>foo</div>
19738 <span>bar</span>
19739
19740 <div>
19741 <span>foo</span>
19742 </div>
19743 !! end
19744
19745 !! test
19746 Lists: Add space after bullets
19747 !! options
19748 parsoid=html2wt
19749 !! wikitext
19750 * foo
19751 * bar
19752 * <span> baz</span>
19753 !! html
19754 <ul>
19755 <li>foo</li>
19756 <li> bar</li>
19757 <li><span> baz</span></li>
19758 </ul>
19759 !! end
19760
19761 !! test
19762 Lists: Dont insert newlines in a serialized list item.
19763 !! options
19764 parsoid=html2wt
19765 !! wikitext
19766 * a<br>b
19767 * c
19768 !! html
19769 <ul><li>a<br>b</li><li>c</li></ul>
19770 !! end
19771
19772 !! test
19773 Headings: Add space before/after == (Bug 51744)
19774 !! options
19775 parsoid=html2wt
19776 !! wikitext
19777 == foo ==
19778
19779 == bar ==
19780
19781 == baz ==
19782
19783 == <span> baz</span> ==
19784 !! html
19785 <h2>foo</h2>
19786 <h2> bar</h2>
19787 <h2>baz </h2>
19788 <h2><span> baz</span></h2>
19789 !! end
19790
19791 !! test
19792 Parsoid: Serialize positional parameters with = in them as named parameter
19793 !! options
19794 parsoid=html2wt
19795 !! wikitext
19796 {{echo|1 = f=oo}}
19797
19798 {{echo|1 = f=oo|2 = bar}}
19799
19800 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19801 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19802 {{echo|<nowiki>f=oo</nowiki>|bar}}
19803 !! html
19804 <p about="#mwt1" typeof="mw:Transclusion"
19805 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19806
19807 <p about="#mwt1" typeof="mw:Transclusion"
19808 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19809
19810 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19811 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19812 <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>
19813 !! end
19814
19815 !! test
19816 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19817 !! options
19818 parsoid=html2wt
19819 !! wikitext
19820 <div>a
19821 b
19822 </div>
19823 <div>a
19824 b
19825 </div>
19826 <div>
19827 a
19828
19829 b
19830 </div>
19831 !! html
19832 <div>a<p>b</p></div>
19833 <div>a
19834 <p>b</p></div>
19835 <div>
19836 a
19837 <p>b</p></div>
19838 !! end
19839
19840 #-----------------------------
19841 # I/B quote minimization tests
19842 #-----------------------------
19843
19844 !! test
19845 1. I/B quote minimization: wikitext-only tags should be combined
19846 !! options
19847 parsoid=html2wt
19848 !! wikitext
19849 ''AB''
19850
19851 '''AB'''
19852
19853 ''A'''B'''''
19854
19855 '''A''B'''''
19856
19857 '''A''BC''D'''
19858
19859 '''''AB'''''
19860
19861 '''''AB'''''
19862
19863 '''''AB'''''
19864 !! html
19865 <p><i>A</i><i>B</i></p>
19866 <p><b>A</b><b>B</b></p>
19867 <p><i>A</i><b><i>B</i></b></p>
19868 <p><b>A</b><i><b>B</b></i></p>
19869 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19870 <p><i><b>A</b></i><i><b>B</b></i></p>
19871 <p><i><b>A</b></i><b><i>B</i></b></p>
19872 <p><b><i>A</i></b><i><b>B</b></i></p>
19873 !! end
19874
19875 !! test
19876 2. I/B quote minimization: wikitext and html tags should not be combined
19877 !! options
19878 parsoid=html2wt
19879 !! wikitext
19880 ''A''<i>B</i>
19881
19882 ''A'''''<i>B</i>'''
19883 !! html
19884 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19885 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19886 !! end
19887
19888 !! test
19889 3. I/B quote minimization: templated content stops minimization
19890 !! options
19891 parsoid=html2wt
19892 !! wikitext
19893 ''A''{{echo|''B''}}
19894
19895 ''A''{{echo|'''''B'''''}}
19896 !! html
19897 <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>
19898 <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>
19899 !! end
19900
19901 !! test
19902 4. I/B quote minimization: new content should be mimimized with adjacent old content
19903 !! options
19904 parsoid=html2wt
19905 !! wikitext
19906 ''AB''
19907
19908 '''AB'''
19909
19910 ''A'''B'''''
19911 !! html
19912 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19913 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19914 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19915 !! end
19916
19917 #------------------------------------
19918 # End of I/B quote minimization tests
19919 #------------------------------------
19920
19921 !!test
19922 Bug 54262: New entities
19923 !! options
19924 parsoid=html2wt
19925 !! wikitext
19926 foo
19927 !! html
19928 <span typeof="mw:Entity">foo</span>
19929 !! end
19930
19931 ## Note that there is no wikitext output for 'unknownproperty' ##
19932 ## Unknown magic words are silently dropped ##
19933
19934 !! test
19935 Magic words
19936 !! options
19937 parsoid=html2wt
19938 !! wikitext
19939 __TOC__
19940 __NOTOC__
19941 __FORCETOC__
19942 __INDEX__
19943 __NOINDEX__
19944 __NOGALLERY__
19945 __NOEDITSECTION__
19946 __NOTITLECONVERT__
19947 __NOCONTENTCONVERT__
19948 !! html
19949 <meta property='mw:PageProp/toc' />
19950 <meta property='mw:PageProp/notoc' />
19951 <meta property='mw:PageProp/forcetoc' />
19952 <meta property='mw:PageProp/index' />
19953 <meta property='mw:PageProp/noindex' />
19954 <meta property='mw:PageProp/nogallery' />
19955 <meta property='mw:PageProp/noeditsection' />
19956 <meta property='mw:PageProp/notitleconvert' />
19957 <meta property='mw:PageProp/nocontentconvert' />
19958 <meta property='mw:PageProp/unknownproperty' />
19959 !! end
19960
19961 !! test
19962 Consecutive <pre>s should not get merged
19963 !! options
19964 parsoid=html2wt,html2html
19965 !! wikitext
19966 a
19967
19968 b
19969
19970 c
19971
19972 d
19973
19974 e
19975
19976
19977
19978 f
19979 !! html
19980 <pre>a</pre><pre>b</pre>
19981
19982 <pre>c
19983 </pre><pre>
19984 d</pre>
19985
19986 <pre>e
19987
19988 </pre><pre>
19989
19990 f</pre>
19991 !! end
19992
19993 !! test
19994 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
19995 !! options
19996 parsoid=html2wt
19997 !! wikitext
19998 [[Special:BookSources/1234567890|ISBN 1234567895]]
19999 !! html
20000 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20001 !! end
20002
20003 !! test
20004 Edited RFC links not serializable as RFC links should serialize as extlinks
20005 !! options
20006 parsoid=html2wt
20007 !! wikitext
20008 [//tools.ietf.org/html/rfc123 New RFC]
20009 !! html
20010 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20011 !! end
20012
20013 !! test
20014 Edited PMID links not serializable as PMID links should serialize as extlinks
20015 !! options
20016 parsoid=html2wt
20017 !! wikitext
20018 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20019 !! html
20020 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20021 !! end
20022
20023 !! test
20024 Edited Redirect link should emit a non-piped wikitext link
20025 !! options
20026 parsoid=html2wt
20027 !! wikitext
20028 #REDIRECT [[Bar]]
20029 !! html
20030 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20031 !! end
20032
20033 # -----------------------------------------------------------------
20034 # End of section for Parsoid-only html2wt tests for serialization
20035 # of new content
20036 # -----------------------------------------------------------------
20037
20038 TODO:
20039 more images
20040 more tables
20041 character entities
20042 and much more
20043 Try for 100% code coverage