Merge "Remove "include redirects" option from search"
[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 ignore width; always render at default size.
10176 # If given a height, they respect height but continue to ignore width.
10177 # 3. "Unspecified format" and border are the only types which can be
10178 # enlarged.
10179
10180 !! test
10181 Image: "unspecified format" and border enlarge
10182 !! options
10183 parsoid=wt2html,wt2wt,html2html
10184 !! wikitext
10185 [[File:Foobar.jpg|2000px]]
10186
10187 [[File:Foobar.jpg|border|2000px]]
10188 !! html/php
10189 <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>
10190 </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>
10191 </p>
10192 !! html/parsoid
10193 <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>
10194 <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>
10195 !! end
10196
10197 !! test
10198 Image: "unspecified format" and border reduce
10199 !! options
10200 parsoid=wt2html,wt2wt,html2html
10201 !! wikitext
10202 [[File:Foobar.jpg|1000px]]
10203
10204 [[File:Foobar.jpg|border|1000px]]
10205 !! html/php
10206 <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>
10207 </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>
10208 </p>
10209 !! html/parsoid
10210 <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>
10211 <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>
10212 !! end
10213
10214 !! test
10215 Image: thumbs reduce
10216 !! options
10217 parsoid=wt2html,wt2wt,html2html
10218 !! wikitext
10219 [[File:Foobar.jpg|thumb|50px]]
10220 !! html/php
10221 <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>
10222
10223 !! html/parsoid
10224 <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>
10225 !! end
10226
10227 !! test
10228 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10229 !! options
10230 parsoid=wt2html,wt2wt,html2html
10231 !! wikitext
10232 [[File:Foobar.jpg|thumb|2000px]]
10233
10234 [[File:Foobar.svg|thumb|2000px]]
10235 !! html/php
10236 <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>
10237 <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>
10238
10239 !! html/parsoid
10240 <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>
10241 <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>
10242 !! end
10243
10244 !! test
10245 Image: frameless can reduce in size
10246 !! options
10247 parsoid=wt2html,wt2wt,html2html
10248 !! wikitext
10249 [[File:Foobar.jpg|frameless|50px]]
10250 !! html/php
10251 <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>
10252 </p>
10253 !! html/parsoid
10254 <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>
10255 !! end
10256
10257 !! test
10258 Image: bitmap frameless can't be enlarged past original size, but vector can
10259 !! options
10260 parsoid=wt2html,wt2wt,html2html
10261 !! wikitext
10262 [[File:Foobar.jpg|frameless|2000px]]
10263
10264 [[File:Foobar.svg|frameless|2000px]]
10265 !! html/php
10266 <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>
10267 </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>
10268 </p>
10269 !! html/parsoid
10270 <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>
10271 <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>
10272 !! end
10273
10274 !! test
10275 Image: framed images ignore size if only width is given
10276 !! options
10277 parsoid=wt2html,wt2wt,html2html
10278 !! wikitext
10279 [[File:Foobar.jpg|frame]]
10280
10281 [[File:Foobar.jpg|frame|50px]]
10282
10283 [[File:Foobar.jpg|frame|2000px]]
10284 !! html/php
10285 <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>
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
10289 !! html/parsoid
10290 <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>
10291 !! end
10292
10293 !! test
10294 Image: framed images respect size if given a height, but ignore width.
10295 !! wikitext
10296 [[File:Foobar.jpg|frame|50x50px]]
10297 !! html/php
10298 <div class="thumb tright"><div class="thumbinner" style="width:444px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" width="442" height="50" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
10299
10300 !! html/parsoid
10301 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="50" width="442"/></a></figure>
10302 !! end
10303
10304 ###################
10305
10306 !! test
10307 Link to image page- image page normally doesn't exists, hence edit link
10308 Add test with existing image page
10309 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10310 !! wikitext
10311 [[:Image:test]]
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)">Image:test</a>
10314 </p>
10315 !! end
10316
10317 !! test
10318 bug 18784 Link to non-existent image page with caption should use caption as link text
10319 !! wikitext
10320 [[:Image:test|caption]]
10321 !! html
10322 <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>
10323 </p>
10324 !! end
10325
10326 !! test
10327 Frameless image caption with a free URL
10328 !! wikitext
10329 [[File:Foobar.jpg|http://example.com]]
10330 !! html/php
10331 <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>
10332 </p>
10333 !! html/parsoid
10334 <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>
10335 !! end
10336
10337 !! test
10338 Thumbnail image caption with a free URL
10339 !! options
10340 thumbsize=220
10341 !! wikitext
10342 [[File:Foobar.jpg|thumb|http://example.com]]
10343 !! html/php
10344 <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>
10345
10346 !! html/parsoid
10347 <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>
10348 !! end
10349
10350 !! test
10351 Thumbnail image caption with a free URL and explicit alt
10352 !! options
10353 thumbsize=220
10354 parsoid=wt2html,wt2wt,html2html
10355 !! wikitext
10356 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10357 !! html/php
10358 <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>
10359
10360 !! html/parsoid
10361 <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>
10362 !! end
10363
10364 !! test
10365 SVG thumbnails with no language set
10366 !! options
10367 !! wikitext
10368 [[File:Foobar.svg|thumb|caption]]
10369 !! html/php
10370 <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>
10371
10372 !! html/parsoid
10373 <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>
10374 !! end
10375
10376 !! test
10377 SVG thumbnails with language de
10378 !! options
10379 parsoid=wt2html,wt2wt,html2html
10380 !! wikitext
10381 [[File:Foobar.svg|thumb|caption|lang=de]]
10382 !! html/php
10383 <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>
10384
10385 !! html/parsoid
10386 <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>
10387 !! end
10388
10389 !! test
10390 SVG thumbnails with invalid language code
10391 !! options
10392 parsoid=wt2html,wt2wt,html2html
10393 !! wikitext
10394 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10395 !! html/php
10396 <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>
10397
10398 !! html/parsoid
10399 <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>
10400 !! end
10401
10402 !! test
10403 BUG 1887: A ISBN with a thumbnail
10404 !! wikitext
10405 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10406 !! html/php
10407 <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>
10408
10409 !! html/parsoid
10410 <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>
10411 !! end
10412
10413 !! test
10414 BUG 1887: A RFC with a thumbnail
10415 !! wikitext
10416 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10417 !! html/php
10418 <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>
10419
10420 !! html/parsoid
10421 <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>
10422 !! end
10423
10424 !! test
10425 BUG 1887: A mailto link with a thumbnail
10426 !! wikitext
10427 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
10428 !! html/php
10429 <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>
10430
10431 !! html/parsoid
10432 <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>
10433 !! end
10434
10435 # Pending resolution to bug 368
10436 !! test
10437 BUG 648: Frameless image caption with a link
10438 !! wikitext
10439 [[File:Foobar.jpg|text with a [[link]] in it]]
10440 !! html/php
10441 <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>
10442 </p>
10443 !! html/parsoid
10444 <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>
10445 !! end
10446
10447 !! test
10448 BUG 648: Frameless image caption with a link (suffix)
10449 !! wikitext
10450 [[File:Foobar.jpg|text with a [[link]]foo in it]]
10451 !! html/php
10452 <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>
10453 </p>
10454 !! html/parsoid
10455 <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>
10456 !! end
10457
10458 !! test
10459 BUG 648: Frameless image caption with an interwiki link
10460 !! wikitext
10461 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
10462 !! html/php
10463 <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>
10464 </p>
10465 !! html/parsoid
10466 <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>
10467 !! end
10468
10469 !! test
10470 BUG 648: Frameless image caption with a piped interwiki link
10471 !! wikitext
10472 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10473 !! html/php
10474 <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>
10475 </p>
10476 !! html/parsoid
10477 <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>
10478 !! end
10479
10480 !! test
10481 Escape HTML special chars in image alt text
10482 !! wikitext
10483 [[File:Foobar.jpg|& < > "]]
10484 !! html/php
10485 <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>
10486 </p>
10487 !! html/parsoid
10488 <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>
10489 !! end
10490
10491 !! test
10492 BUG 499: Alt text should have &#1234;, not &amp;1234;
10493 !! wikitext
10494 [[File:Foobar.jpg|&#9792;]]
10495 !! html/php
10496 <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>
10497 </p>
10498 !! html/parsoid
10499 <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>
10500 !! end
10501
10502 !! test
10503 Broken image caption with link
10504 !! options
10505 parsoid=wt2html,wt2wt,html2html
10506 !! wikitext
10507 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10508 !! html/php
10509 <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.
10510 </p>
10511 !! html/parsoid
10512 <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>
10513 !! end
10514
10515 !! test
10516 Image caption containing another image
10517 !! wikitext
10518 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
10519 !! html/php
10520 <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>
10521
10522 !! html/parsoid
10523 <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>
10524 !! end
10525
10526 !! test
10527 Image: caption containing a newline
10528 !! wikitext
10529 [[File:Foobar.jpg|This
10530 *is some text]]
10531 !! html/php
10532 <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>
10533 </p>
10534 !! html/parsoid
10535 <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>
10536 !!end
10537
10538 !!test
10539 Image: caption containing leading space
10540 (The leading space should not trigger nowiki escaping in wt2wt mode)
10541 !! wikitext
10542 [[File:Foobar.jpg|thumb| bar]]
10543 !! html/php
10544 <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>
10545
10546 !! html/parsoid
10547 <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>
10548 !!end
10549
10550 !! test
10551 Image: caption containing a table
10552 !! options
10553 parsoid=wt2html,wt2wt,html2html
10554 !! wikitext
10555 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10556 {|
10557 ! Foo !! Bar
10558 |-
10559 | Foo1 || Bar1
10560 |}
10561 and some more text.]]
10562 !! html/php
10563 <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>
10564
10565 !! html/parsoid
10566 <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
10567 <table>
10568 <tbody>
10569 <tr><th>Foo </th><th>Bar</th></tr>
10570 <tr>
10571 <td>Foo1 </td>
10572 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10573 !! end
10574
10575 !! test
10576 Bug 3090: External links other than http: in image captions
10577 !! wikitext
10578 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10579 !! html/php
10580 <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>
10581
10582 !! html/parsoid
10583 <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>
10584 !! end
10585
10586 !! test
10587 Custom class
10588 !! options
10589 parsoid=wt2html,wt2wt,html2html
10590 !! wikitext
10591 [[Image:foobar.jpg|a|class=b]]
10592 !! html/php
10593 <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>
10594 </p>
10595 !! html/parsoid
10596 <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>
10597 !! end
10598
10599 !! test
10600 Localized image handling (1).
10601 !! options
10602 parsoid=wt2html,wt2wt,html2html
10603 language=es
10604 !! wikitext
10605 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10606 !! html/php
10607 <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>
10608
10609 !! html/parsoid
10610 <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>
10611 !! end
10612
10613 !! test
10614 Localized image handling (2).
10615 !! options
10616 thumbsize=220
10617 parsoid=wt2html,wt2wt,html2html
10618 language=es
10619 !! wikitext
10620 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10621 !! html/php
10622 <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>
10623
10624 !! html/parsoid
10625 <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>
10626 !! end
10627
10628 !! test
10629 "border", "frameless" and "class" attributes on an image.
10630 !! options
10631 thumbsize=220
10632 parsoid=wt2html,wt2wt,html2html
10633 !! wikitext
10634 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10635 !! html/php
10636 <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>
10637 </p>
10638 !! html/parsoid
10639 <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>
10640 !! end
10641
10642 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10643 !! test
10644 Invalid image attributes (bug 62500)
10645 !! options
10646 thumbsize=220
10647 parsoid=wt2html,wt2wt,html2html
10648 !! wikitext
10649 [[File:Foobar.jpg|thumb|float|left|caption]]
10650
10651 [[File:Foobar.jpg|thumb|righ|caption]]
10652
10653 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10654 !! html/php
10655 <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>
10656 <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>
10657 <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>
10658
10659 !! html/parsoid
10660 <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>
10661 !! end
10662
10663 !! article
10664 File:Barfoo.jpg
10665 !! text
10666 #REDIRECT [[File:Barfoo.jpg]]
10667 !! endarticle
10668
10669 !! test
10670 Redirected image
10671 !! wikitext
10672 [[Image:Barfoo.jpg]]
10673 !! html
10674 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10675 </p>
10676 !! end
10677
10678 !! test
10679 Missing image with uploads disabled
10680 !! options
10681 wgEnableUploads=0
10682 !! wikitext
10683 [[Image:Foobaz.jpg]]
10684 !! html
10685 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10686 </p>
10687 !! end
10688
10689 # Parsoid-specific testing for images
10690 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10691 # Currently imperfect due to a flaw in the Parsoid testrunner
10692 # Work in progress
10693 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10694 # image tests.
10695
10696 !! test
10697 Parsoid-specific image handling - simple image with size and middle alignment
10698 !! wikitext
10699 [[File:Foobar.jpg|middle|50px]]
10700 !! html/parsoid
10701 <p><span class="mw-valign-middle" typeof="mw:Image">
10702 <a href="File:Foobar.jpg">
10703 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10704 </a>
10705 </span>
10706 </p>
10707 !! end
10708
10709 !! test
10710 Parsoid-specific image handling - simple image with size, middle alignment,
10711 non-standard namespace alias
10712 !! options
10713 parsoid=wt2wt,wt2html,html2html
10714 !! wikitext
10715 [[Image:Foobar.jpg|middle|50px]]
10716 !! html/parsoid
10717 <p><span class="mw-valign-middle" typeof="mw:Image">
10718 <a href="File:Foobar.jpg">
10719 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10720 </a>
10721 </span>
10722 </p>
10723 !! end
10724
10725 !! test
10726 Parsoid-specific image handling - simple image with size and middle alignment
10727 (existing content)
10728 !! wikitext
10729 [[File:Foobar.jpg|50px|middle]]
10730 !! html/parsoid
10731 <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>
10732 !! end
10733
10734 !! test
10735 Parsoid-specific image handling - simple image with size and middle alignment
10736 and non-standard namespace name
10737 !! options
10738 parsoid=wt2html,wt2wt,html2html
10739 !! wikitext
10740 [[Image:Foobar.jpg|50px|middle]]
10741 !! html/parsoid
10742 <p><span class="mw-valign-middle" typeof="mw:Image">
10743 <a href="File:Foobar.jpg">
10744 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10745 </a>
10746 </span>
10747 </p>
10748 !! end
10749
10750 !! test
10751 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10752 !! wikitext
10753 [[File:Foobar.jpg|500x10px|baseline|caption]]
10754 !! html/parsoid
10755 <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>
10756 !! end
10757
10758 !! test
10759 Parsoid-specific image handling - simple image with border and size spec
10760 !! wikitext
10761 [[File:Foobar.jpg|50px|border|caption]]
10762 !! html/parsoid
10763 <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>
10764 !! end
10765
10766 !! test
10767 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10768 !! wikitext
10769 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10770 !! html/parsoid
10771 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10772 <a href="File:Foobar.jpg">
10773 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10774 </a>
10775 <figcaption>caption content</figcaption>
10776 </figure>
10777 !! end
10778
10779 !! test
10780 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10781 (existing content)
10782 !! wikitext
10783 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10784 !! html/parsoid
10785 <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>
10786 !! end
10787
10788 !! test
10789 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10790 !! wikitext
10791 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10792 !! html/parsoid
10793 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10794 <a href="File:Foobar.jpg">
10795 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10796 </a>
10797 <figcaption>caption</figcaption>
10798 </figure>
10799 !! end
10800
10801 !! test
10802 Parsoid-specific image handling - thumbnail with specific size, halign,
10803 valign, and caption (existing content)
10804 !! wikitext
10805 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10806 !! html/parsoid
10807 <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>
10808 !! end
10809
10810 !! test
10811 Parsoid-specific image handling - framed image with specific size and caption
10812 !! wikitext
10813 [[Image:Foobar.jpg|frame|500x50px|caption]]
10814 !! html/parsoid
10815 <figure typeof="mw:Image/Frame">
10816 <a href="File:Foobar.jpg">
10817 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10818 </a>
10819 <figcaption>caption</figcaption>
10820 </figure>
10821 !! end
10822
10823 !! test
10824 Parsoid-specific image handling - framed image with specific size and caption
10825 (existing content)
10826 !! wikitext
10827 [[File:Foobar.jpg|442x50px|frame|caption]]
10828 !! html/parsoid
10829 <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>
10830 !! end
10831
10832 !! test
10833 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10834 !! wikitext
10835 [[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10836 !! html/parsoid
10837 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10838 <a href="File:Foobar.jpg">
10839 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10840 </a>
10841 <figcaption>caption</figcaption>
10842 </figure>
10843 !! end
10844
10845 !! test
10846 Parsoid-specific image handling - framed image with specific size, halign,
10847 valign, and caption (existing content)
10848 !! wikitext
10849 [[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
10850 !! html/parsoid
10851 <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>
10852 !! end
10853
10854 !! test
10855 Parsoid-specific image handling - frameless image with specific size, border, and caption
10856 !! wikitext
10857 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
10858 !! html/parsoid
10859 <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>
10860 !! end
10861
10862 !! test
10863 Parsoid-specific image handling - simple image with a formatted caption
10864 !! wikitext
10865 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10866 !! html/parsoid
10867 <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>"}'>
10868 <a href="File:Foobar.jpg">
10869 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10870 </a></span></p>
10871 !! end
10872
10873 !! test
10874 Parsoid-specific image handling - caption with a template in it
10875 !! wikitext
10876 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
10877 !! html/parsoid
10878 <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>
10879 !! end
10880
10881 !! test
10882 Parsoid-specific image handling - caption with unbalanced tags in it
10883 !! options
10884 parsoid=wt2html,wt2wt,html2html
10885 !! wikitext
10886 foo
10887 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
10888 bar
10889 !! html/parsoid
10890 <p>foo</p>
10891 <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>
10892 <p>bar</p>
10893 !! end
10894
10895 !! test
10896 Parsoid-specific image handling - empty caption
10897 !! wikitext
10898 [[File:Foobar.jpg|thumb|]]
10899 !! html/parsoid
10900 <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>
10901 !! end
10902
10903 !! test
10904 Parsoid-specific image handling - whitespace caption
10905 !! wikitext
10906 [[File:Foobar.jpg|thumb| ]]
10907 !! html/parsoid
10908 <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>
10909 !! end
10910
10911 !! test
10912 Parsoid-specific image handling - lang option
10913 !! wikitext
10914 foo
10915 [[File:Foobar.svg|lang=de|caption]]
10916 bar
10917 !! html/parsoid
10918 <p>foo
10919 <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>
10920 bar</p>
10921 !! end
10922
10923
10924 ###
10925 ### Subpages
10926 ###
10927 !! article
10928 Subpage test/subpage
10929 !! text
10930 foo
10931 !! endarticle
10932
10933 !! test
10934 Subpage link
10935 !! options
10936 subpage title=[[Subpage test]]
10937 !! wikitext
10938 [[/subpage]]
10939 !! html
10940 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10941 </p>
10942 !! end
10943
10944 !! test
10945 Subpage noslash link
10946 !! options
10947 subpage title=[[Subpage test]]
10948 !! wikitext
10949 [[/subpage/]]
10950 !! html
10951 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10952 </p>
10953 !! end
10954
10955 # TODO: make this PHP-parser compatible!
10956 !! test
10957 Relative subpage noslash link
10958 !! options
10959 parsoid=wt2wt,wt2html,html2html
10960 subpage title=[[Subpage test/1/2/3/4]]
10961 !! wikitext
10962 [[../../subpage/]]
10963
10964 [[../../subpage]]
10965 !! html
10966 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10967 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10968 !! end
10969
10970 # TODO: make this PHP-parser compatible!
10971 !! test
10972 Parsoid: dot-slash prefixed wikilinks
10973 !! options
10974 parsoid=wt2wt,wt2html,html2html
10975 !! wikitext
10976 [[./foo]]
10977
10978 [[././bar]]
10979
10980 [[././baz/]]
10981 !! html
10982 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10983 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10984 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10985 !! end
10986
10987 !! test
10988 Disabled subpages
10989 !! wikitext
10990 [[/subpage]]
10991 !! html
10992 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10993 </p>
10994 !! end
10995
10996 !! test
10997 BUG 561: {{/Subpage}}
10998 !! options
10999 subpage title=[[Page]]
11000 !! wikitext
11001 {{/Subpage}}
11002 !! html
11003 <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>
11004 </p>
11005 !! end
11006
11007 ###
11008 ### Categories
11009 ###
11010 !! article
11011 Category:MediaWiki User's Guide
11012 !! text
11013 blah
11014 !! endarticle
11015
11016 !! test
11017 Link to category
11018 !! wikitext
11019 [[:Category:MediaWiki User's Guide]]
11020 !! html
11021 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11022 </p>
11023 !! end
11024
11025 !! test
11026 Simple category
11027 !! options
11028 cat
11029 !! wikitext
11030 [[Category:MediaWiki User's Guide]]
11031 !! html
11032 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11033 !! end
11034
11035 !! test
11036 PAGESINCATEGORY invalid title fatal (r33546 fix)
11037 !! wikitext
11038 {{PAGESINCATEGORY:<bogus>}}
11039 !! html
11040 <p>0
11041 </p>
11042 !! end
11043
11044 !! test
11045 Category with different sort key
11046 !! options
11047 cat
11048 !! wikitext
11049 [[Category:MediaWiki User's Guide|Foo]]
11050 !! html
11051 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11052 !! end
11053
11054 !! test
11055 Category with identical sort key
11056 !! options
11057 cat
11058 !! wikitext
11059 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11060 !! html
11061 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11062 !! end
11063
11064 !! test
11065 Category with empty sort key
11066 !! options
11067 cat
11068 pst
11069 !! wikitext
11070 [[Category:MediaWiki User's Guide|]]
11071 !! html
11072 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11073 !! end
11074
11075 !! test
11076 Category with empty sort key and parentheses
11077 !! options
11078 cat
11079 pst
11080 !! wikitext
11081 [[Category:Foo (bar)|]]
11082 !! html
11083 [[Category:Foo (bar)|Foo]]
11084 !! end
11085
11086 !! test
11087 Category with link tail
11088 !! options
11089 cat
11090 pst
11091 !! wikitext
11092 123[[Category:Foo]]456
11093 !! html
11094 123[[Category:Foo]]456
11095 !! end
11096
11097 !! test
11098 Category with template
11099 !! options
11100 cat
11101 pst
11102 !! wikitext
11103 [[Category:{{echo|Foo}}]]
11104 !! html
11105 [[Category:{{echo|Foo}}]]
11106 !! end
11107
11108 !! test
11109 Category with template in sort key
11110 !! options
11111 cat
11112 pst
11113 !! wikitext
11114 [[Category:Foo|{{echo|Bar}}]]
11115 !! html
11116 [[Category:Foo|{{echo|Bar}}]]
11117 !! end
11118
11119 !! test
11120 Category with template in sort key and title
11121 !! options
11122 cat
11123 pst
11124 !! wikitext
11125 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11126 !! html
11127 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11128 !! end
11129
11130 !! test
11131 Category / paragraph interactions
11132 !! wikitext
11133 Foo [[Category:Baz]] Bar
11134
11135 Foo [[Category:Baz]]
11136 Bar
11137
11138 Foo
11139 [[Category:Baz]]
11140 Bar
11141
11142 Foo
11143 [[Category:Baz]] Bar
11144
11145 Foo
11146 [[Category:Baz]]
11147 [[Category:Baz]]
11148 [[Category:Baz]]
11149 Bar
11150
11151 [[Category:Baz]]
11152 [[Category:Baz]]
11153 [[Category:Baz]]
11154
11155 [[Category:Baz]]
11156 {{echo|[[Category:Baz]]}}
11157 [[Category:Baz]]
11158 !! html
11159 <p>Foo Bar
11160 </p><p>Foo
11161 Bar
11162 </p><p>Foo
11163 Bar
11164 </p><p>Foo Bar
11165 </p><p>Foo
11166 Bar
11167 </p>
11168 !! end
11169
11170 !! test
11171 Parsoid: Serialize link to category page with colon escape
11172 !! options
11173 parsoid
11174 !! wikitext
11175
11176 [[:Category:Foo]]
11177 [[:Category:Foo|Bar]]
11178 !! html
11179 <p>
11180 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11181 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11182 </p>
11183 !! end
11184
11185 !! test
11186 Parsoid: Link prefix/suffixes aren't applied to category links
11187 !! options
11188 parsoid=wt2html,wt2wt,html2html
11189 language=is
11190 !! wikitext
11191 x[[Category:Foo]]y
11192 !! html
11193 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11194 !! end
11195
11196 !! test
11197 Parsoid: Serialize link to file page with colon escape
11198 !! options
11199 parsoid
11200 !! wikitext
11201
11202 [[:File:Foo.png]]
11203 [[:File:Foo.png|Bar]]
11204 !! html
11205 <p>
11206 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11207 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11208 </p>
11209 !! end
11210
11211 !! test
11212 Parsoid: Serialize a genuine category link without colon escape
11213 !! options
11214 parsoid
11215 !! wikitext
11216 [[Category:Foo]]
11217 [[Category:Foo|Bar]]
11218 !! html
11219 <link rel="mw:PageProp/Category" href="Category:Foo">
11220 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11221 !! end
11222
11223 !! test
11224 Parsoid: Defaultsort
11225 !! options
11226 parsoid
11227 !! wikitext
11228 {{DEFAULTSORT:Foo}}
11229 !! html
11230 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11231 !! end
11232
11233 ###
11234 ### Inter-language links
11235 ###
11236 !! test
11237 Inter-language links
11238 !! options
11239 ill
11240 !! wikitext
11241 [[es:Alimento]]
11242 [[fr:Nourriture]]
11243 [[zh:&#39135;&#21697;]]
11244 !! html
11245 es:Alimento fr:Nourriture zh:食品
11246 !! end
11247
11248 !! test
11249 Duplicate interlanguage links (bug 24502)
11250 !! options
11251 ill
11252 !! wikitext
11253 [[es:1]]
11254 [[es:2]]
11255 [[fr:1]]
11256 [[fr:2]]
11257 !! html
11258 es:1 fr:1
11259 !! end
11260
11261 ###
11262 ### Sections
11263 ###
11264 !! test
11265 Basic section headings
11266 !! wikitext
11267 == Headline 1 ==
11268 Some text
11269
11270 ==Headline 2==
11271 More
11272 ===Smaller headline===
11273 Blah blah
11274 !! html
11275 <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>
11276 <p>Some text
11277 </p>
11278 <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>
11279 <p>More
11280 </p>
11281 <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>
11282 <p>Blah blah
11283 </p>
11284 !! end
11285
11286 !! test
11287 Section headings with TOC
11288 !! wikitext
11289 == Headline 1 ==
11290 === Subheadline 1 ===
11291 ===== Skipping a level =====
11292 ====== Skipping a level ======
11293
11294 == Headline 2 ==
11295 Some text
11296 ===Another headline===
11297 !! html
11298 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11299 <ul>
11300 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11301 <ul>
11302 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11303 <ul>
11304 <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>
11305 <ul>
11306 <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>
11307 </ul>
11308 </li>
11309 </ul>
11310 </li>
11311 </ul>
11312 </li>
11313 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11314 <ul>
11315 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11316 </ul>
11317 </li>
11318 </ul>
11319 </div>
11320
11321 <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>
11322 <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>
11323 <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>
11324 <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>
11325 <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>
11326 <p>Some text
11327 </p>
11328 <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>
11329
11330 !! end
11331
11332 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11333 !! test
11334 Handling of sections up to level 6 and beyond
11335 !! wikitext
11336 = Level 1 Heading=
11337 == Level 2 Heading==
11338 === Level 3 Heading===
11339 ==== Level 4 Heading====
11340 ===== Level 5 Heading=====
11341 ====== Level 6 Heading======
11342 ======= Level 7 Heading=======
11343 ======== Level 8 Heading========
11344 ========= Level 9 Heading=========
11345 ========== Level 10 Heading==========
11346 !! html
11347 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11348 <ul>
11349 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11350 <ul>
11351 <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>
11352 <ul>
11353 <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>
11354 <ul>
11355 <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>
11356 <ul>
11357 <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>
11358 <ul>
11359 <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>
11360 <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>
11361 <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>
11362 <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>
11363 <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>
11364 </ul>
11365 </li>
11366 </ul>
11367 </li>
11368 </ul>
11369 </li>
11370 </ul>
11371 </li>
11372 </ul>
11373 </li>
11374 </ul>
11375 </div>
11376
11377 <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>
11378 <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>
11379 <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>
11380 <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>
11381 <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>
11382 <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>
11383 <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>
11384 <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>
11385 <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>
11386 <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>
11387
11388 !! end
11389
11390 !! test
11391 TOC regression (bug 9764)
11392 !! wikitext
11393 == title 1 ==
11394 === title 1.1 ===
11395 ==== title 1.1.1 ====
11396 === title 1.2 ===
11397 == title 2 ==
11398 === title 2.1 ===
11399 !! html
11400 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11401 <ul>
11402 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11403 <ul>
11404 <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>
11405 <ul>
11406 <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>
11407 </ul>
11408 </li>
11409 <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>
11410 </ul>
11411 </li>
11412 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11413 <ul>
11414 <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>
11415 </ul>
11416 </li>
11417 </ul>
11418 </div>
11419
11420 <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>
11421 <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>
11422 <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>
11423 <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>
11424 <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>
11425 <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>
11426
11427 !! end
11428
11429 !! test
11430 TOC with wgMaxTocLevel=3 (bug 6204)
11431 !! options
11432 wgMaxTocLevel=3
11433 !! wikitext
11434 == title 1 ==
11435 === title 1.1 ===
11436 ==== title 1.1.1 ====
11437 === title 1.2 ===
11438 == title 2 ==
11439 === title 2.1 ===
11440 !! html
11441 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11442 <ul>
11443 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11444 <ul>
11445 <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>
11446 <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>
11447 </ul>
11448 </li>
11449 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11450 <ul>
11451 <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>
11452 </ul>
11453 </li>
11454 </ul>
11455 </div>
11456
11457 <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>
11458 <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>
11459 <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>
11460 <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>
11461 <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>
11462 <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>
11463
11464 !! end
11465
11466 !! test
11467 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11468 !! options
11469 wgMaxTocLevel=3
11470 !! wikitext
11471 ==Section 1==
11472 ===Section 1.1===
11473 ====Section 1.1.1====
11474 ====Section 1.1.1.1====
11475 ==Section 2==
11476 !! html
11477 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11478 <ul>
11479 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11480 <ul>
11481 <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>
11482 </ul>
11483 </li>
11484 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11485 </ul>
11486 </div>
11487
11488 <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>
11489 <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>
11490 <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>
11491 <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>
11492 <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>
11493
11494 !! end
11495
11496
11497 !! test
11498 Resolving duplicate section names
11499 !! wikitext
11500 == Foo bar ==
11501 == Foo bar ==
11502 !! html
11503 <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>
11504 <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>
11505
11506 !! end
11507
11508 !! test
11509 Resolving duplicate section names with differing case (bug 10721)
11510 !! wikitext
11511 == Foo bar ==
11512 == Foo Bar ==
11513 !! html
11514 <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>
11515 <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>
11516
11517 !! end
11518
11519 !! article
11520 Template:sections
11521 !! text
11522 ===Section 1===
11523 ==Section 2==
11524 !! endarticle
11525
11526 !! test
11527 Template with sections, __NOTOC__
11528 !! wikitext
11529 __NOTOC__
11530 ==Section 0==
11531 {{sections}}
11532 ==Section 4==
11533 !! html
11534 <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>
11535 <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>
11536 <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>
11537 <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>
11538
11539 !! end
11540
11541 !! test
11542 __NOEDITSECTION__ keyword
11543 !! wikitext
11544 __NOEDITSECTION__
11545 ==Section 1==
11546 ==Section 2==
11547 !! html
11548 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11549 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11550
11551 !! end
11552
11553 !! test
11554 Link inside a section heading
11555 !! wikitext
11556 ==Section with a [[Main Page|link]] in it==
11557 !! html
11558 <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>
11559
11560 !! end
11561
11562 !! test
11563 TOC regression (bug 12077)
11564 !! wikitext
11565 __TOC__
11566 == title 1 ==
11567 === title 1.1 ===
11568 == title 2 ==
11569 !! html
11570 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11571 <ul>
11572 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11573 <ul>
11574 <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>
11575 </ul>
11576 </li>
11577 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11578 </ul>
11579 </div>
11580
11581 <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>
11582 <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>
11583 <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>
11584
11585 !! end
11586
11587 !! test
11588 BUG 1219 URL next to image (good)
11589 !! wikitext
11590 http://example.com [[Image:foobar.jpg]]
11591 !! html
11592 <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>
11593 </p>
11594 !!end
11595
11596 !! test
11597 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11598 !! wikitext
11599 ===
11600 The line above must have a trailing space!
11601 === <!--
11602 --> <!-- -->
11603 But just in case it doesn't...
11604 !! html
11605 <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>
11606 <p>The line above must have a trailing space!
11607 </p>
11608 <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>
11609 <p>But just in case it doesn't...
11610 </p>
11611 !! end
11612
11613 !! test
11614 Header with special characters (bug 25462)
11615 !! wikitext
11616 The tooltips shall not show entities to the user (ie. be double escaped)
11617
11618 == text > text ==
11619 section 1
11620
11621 == text < text ==
11622 section 2
11623
11624 == text & text ==
11625 section 3
11626
11627 == text ' text ==
11628 section 4
11629
11630 == text " text ==
11631 section 5
11632 !! html
11633 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11634 </p>
11635 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11636 <ul>
11637 <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>
11638 <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>
11639 <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>
11640 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11641 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11642 </ul>
11643 </div>
11644
11645 <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>
11646 <p>section 1
11647 </p>
11648 <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>
11649 <p>section 2
11650 </p>
11651 <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>
11652 <p>section 3
11653 </p>
11654 <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>
11655 <p>section 4
11656 </p>
11657 <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>
11658 <p>section 5
11659 </p>
11660 !! end
11661
11662 !! test
11663 Headers with excess '=' characters
11664 (Are similar tests necessary beyond the 1st level?)
11665 !! wikitext
11666 =foo==
11667 ==foo=
11668 =''italic'' heading==
11669 ==''italic'' heading=
11670 !! html
11671 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11672 <ul>
11673 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11674 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11675 <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>
11676 <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>
11677 </ul>
11678 </div>
11679
11680 <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>
11681 <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>
11682 <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>
11683 <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>
11684
11685 !! end
11686
11687 !! test
11688 HTML headers vs TOC (bug 23393)
11689 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11690 !! wikitext
11691 <h1>Header 1</h1>
11692 == Header 1.1 ==
11693 == Header 1.2 ==
11694
11695 <h1>Header 2
11696 </h1>
11697 == Header 2.1 ==
11698 == Header 2.2 ==
11699 __NOEDITSECTION__
11700 !! html
11701 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11702 <ul>
11703 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11704 <ul>
11705 <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>
11706 <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>
11707 </ul>
11708 </li>
11709 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11710 <ul>
11711 <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>
11712 <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>
11713 </ul>
11714 </li>
11715 </ul>
11716 </div>
11717
11718 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11719 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11720 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11721 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11722 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11723 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11724
11725 !! end
11726
11727 !! test
11728 BUG 1219 URL next to image (broken)
11729 !! wikitext
11730 http://example.com[[Image:foobar.jpg]]
11731 !! html
11732 <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>
11733 </p>
11734 !!end
11735
11736 !! test
11737 Bug 1186 news: in the middle of text
11738 !! wikitext
11739 http://en.wikinews.org/wiki/Wikinews:Workplace
11740 !! html
11741 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11742 </p>
11743 !!end
11744
11745
11746 !! test
11747 Namespaced link must have a title
11748 !! wikitext
11749 [[Project:]]
11750 !! html
11751 <p>[[Project:]]
11752 </p>
11753 !!end
11754
11755 !! test
11756 Namespaced link must have a title (bad fragment version)
11757 !! wikitext
11758 [[Project:#fragment]]
11759 !! html
11760 <p>[[Project:#fragment]]
11761 </p>
11762 !!end
11763
11764
11765 ###
11766 ### HTML tags and HTML attributes
11767 ###
11768
11769 !! test
11770 div with no attributes
11771 !! wikitext
11772 <div>HTML rocks</div>
11773 !! html
11774 <div>HTML rocks</div>
11775
11776 !! end
11777
11778 !! test
11779 div with double-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 single-quoted 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 unquoted attribute
11798 !! wikitext
11799 <div id=rock>HTML rocks</div>
11800 !! html
11801 <div id="rock">HTML rocks</div>
11802
11803 !! end
11804
11805 !! test
11806 div with illegal double attributes
11807 !! wikitext
11808 <div id="a" id="b">HTML rocks</div>
11809 !! html
11810 <div id="b">HTML rocks</div>
11811
11812 !!end
11813
11814 # FIXME: produce empty string instead of "class" in the PHP parser, following
11815 # the HTML5 spec.
11816 !! test
11817 div with empty attribute value, space before equals
11818 !! options
11819 parsoid
11820 !! wikitext
11821 <div class =>HTML rocks</div>
11822 !! html
11823 <div class="">HTML rocks</div>
11824
11825 !! end
11826
11827 # The PHP parser escapes the opening brace to &#123; for some reason, so
11828 # disabled this test for it.
11829 !! test
11830 div with braces in attribute value
11831 !! options
11832 parsoid
11833 !! wikitext
11834 <div title="{}">Foo</div>
11835 !! html
11836 <div title="{}">Foo</div>
11837 !! end
11838
11839 # This it very inconsistent in the PHP parser: it returns
11840 # class="class" if there is a space between the name and the equal sign (see
11841 # 'div with empty attribute value, space before equals'), but strips the
11842 # attribute completely if the space is missing. We hope that not much content
11843 # depends on this, so are implementing the behavior below in Parsoid for
11844 # consistencies' sake. Disabled for the PHP parser.
11845 # FIXME: fix this behavior in the PHP parser?
11846 !! test
11847 div with empty attribute value, no space before equals
11848 !! options
11849 parsoid
11850 !! wikitext
11851 <div class=>HTML rocks</div>
11852 !! html
11853 <div class="">HTML rocks</div>
11854
11855 !! end
11856
11857 !! test
11858 HTML multiple attributes correction
11859 !! wikitext
11860 <p class="error" class="awesome">Awesome!</p>
11861 !! html
11862 <p class="awesome">Awesome!</p>
11863
11864 !!end
11865
11866 !! test
11867 Table multiple attributes correction
11868 !! wikitext
11869 {|
11870 !+ class="error" class="awesome"| status
11871 |}
11872 !! html
11873 <table>
11874 <tr>
11875 <th class="awesome"> status
11876 </th></tr></table>
11877
11878 !!end
11879
11880 !! test
11881 DIV IN UPPERCASE
11882 !! wikitext
11883 <DIV ID="x">HTML ROCKS</DIV>
11884 !! html
11885 <div id="x">HTML ROCKS</div>
11886
11887 !!end
11888
11889 !! test
11890 Non-ASCII pseudo-tags are rendered as text
11891 !! wikitext
11892 <khyô>
11893 !! html
11894 <p>&lt;khyô&gt;
11895 </p>
11896 !! end
11897
11898 !! test
11899 Pseudo-tag with URL 'name' renders as url link
11900 !! wikitext
11901 <http://example.com/>
11902 !! html
11903 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11904 </p>
11905 !! end
11906
11907 !! test
11908 text with amp in the middle of nowhere
11909 !! wikitext
11910 Remember AT&T?
11911 !! html
11912 <p>Remember AT&amp;T?
11913 </p>
11914 !! end
11915
11916 !! test
11917 text with character entity: eacute
11918 !! wikitext
11919 I always thought &eacute; was a cute letter.
11920 !! html
11921 <p>I always thought &#233; was a cute letter.
11922 </p>
11923 !! end
11924
11925 !! test
11926 text with entity-escaped character entity-like string: eacute
11927 !! wikitext
11928 I always thought &amp;eacute; was a cute letter.
11929 !! html
11930 <p>I always thought &amp;eacute; was a cute letter.
11931 </p>
11932 !! end
11933
11934 !! test
11935 text with undefined character entity: xacute
11936 !! wikitext
11937 I always thought &xacute; was a cute letter.
11938 !! html
11939 <p>I always thought &amp;xacute; was a cute letter.
11940 </p>
11941 !! end
11942
11943 # TODO: generalize to PHP parser?
11944 !! test
11945 HTML5 tags
11946 !! options
11947 parsoid
11948 !! wikitext
11949 <data value="5">five</data>
11950 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11951 <mark>This highlighted text</mark>
11952 !! html
11953 <p><data value="5">five</data>
11954 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11955 <mark>This highlighted text</mark></p>
11956 !! end
11957
11958 !! test
11959 HTML tag with leading space is parsed as text
11960 !! wikitext
11961 < div>foo< /div>
11962 !! html
11963 <p>&lt; div&gt;foo&lt; /div&gt;
11964 </p>
11965 !! end
11966
11967 ###
11968 ### Nesting tests (see bug 41545, 50604, 51081)
11969 ###
11970
11971 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11972 # Note that html2wt is considerably more difficult if we use <b> in
11973 # the test case, instead of <big>
11974 !! test
11975 Ensure that HTML adoption agency algorithm is properly implemented.
11976 !! wikitext
11977 <big>X<big>Y</big>Z</big>
11978 !! html
11979 <p><big>X<big>Y</big>Z</big>
11980 </p>
11981 !! end
11982
11983 # This was bug 41545 in the PHP parser.
11984 !! test
11985 Nesting of <kbd>
11986 !! wikitext
11987 <kbd>X<kbd>Y</kbd>Z</kbd>
11988 !! html
11989 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11990 </p>
11991 !! end
11992
11993 # The following cases were bug 51081 in the PHP parser.
11994 # Note that there are some other nestable tags (b, i, etc) which are
11995 # not covered; see bug 51081 for discussion.
11996 !! test
11997 Nesting of <em>
11998 !! wikitext
11999 <em>X<em>Y</em>Z</em>
12000 !! html
12001 <p><em>X<em>Y</em>Z</em>
12002 </p>
12003 !! end
12004
12005 !! test
12006 Nesting of <strong>
12007 !! wikitext
12008 <strong>X<strong>Y</strong>Z</strong>
12009 !! html
12010 <p><strong>X<strong>Y</strong>Z</strong>
12011 </p>
12012 !! end
12013
12014 !! test
12015 Nesting of <q>
12016 !! wikitext
12017 <q>X<q>Y</q>Z</q>
12018 !! html
12019 <p><q>X<q>Y</q>Z</q>
12020 </p>
12021 !! end
12022
12023 !! test
12024 Nesting of <ruby>
12025 !! wikitext
12026 <ruby>X<ruby>Y</ruby>Z</ruby>
12027 !! html
12028 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12029 </p>
12030 !! end
12031
12032 !! test
12033 Nesting of <bdo>
12034 !! wikitext
12035 <bdo>X<bdo>Y</bdo>Z</bdo>
12036 !! html
12037 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12038 </p>
12039 !! end
12040
12041
12042 ###
12043 ### Media links
12044 ###
12045
12046 !! test
12047 Media link
12048 !! wikitext
12049 [[Media:Foobar.jpg]]
12050 !! html
12051 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12052 </p>
12053 !! end
12054
12055 !! test
12056 Media link with text
12057 !! wikitext
12058 [[Media:Foobar.jpg|A neat file to look at]]
12059 !! html
12060 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12061 </p>
12062 !! end
12063
12064 # FIXME: this is still bad HTML tag nesting
12065 !! test
12066 Media link with nasty text
12067 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12068 !! wikitext
12069 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12070 !! html
12071 <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>
12072
12073 !! end
12074
12075 !! test
12076 Media link to nonexistent file (bug 1702)
12077 !! wikitext
12078 [[Media:No such.jpg]]
12079 !! html
12080 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12081 </p>
12082 !! end
12083
12084 !! test
12085 Image link to nonexistent file (bug 1850 - good)
12086 !! wikitext
12087 [[Image:No such.jpg]]
12088 !! html
12089 <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>
12090 </p>
12091 !! end
12092
12093 !! test
12094 :Image link to nonexistent file (bug 1850 - bad)
12095 !! wikitext
12096 [[:Image:No such.jpg]]
12097 !! html
12098 <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>
12099 </p>
12100 !! end
12101
12102
12103
12104 !! test
12105 Character reference normalization in link text (bug 1938)
12106 !! wikitext
12107 [[Main Page|this&that]]
12108 !! html
12109 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12110 </p>
12111 !!end
12112
12113 !! article
12114 אַ
12115 !! text
12116 Test for unicode normalization
12117
12118 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12119 !! endarticle
12120
12121 !! test
12122 (bug 19451) Links should refer to the normalized form.
12123 !! wikitext
12124 [[&#xFB2E;]]
12125 [[&#x5d0;&#x5b7;]]
12126 [[&#x5d0;ַ]]
12127 [[א&#x5b7;]]
12128 [[אַ]]
12129 !! html
12130 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12131 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12132 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12133 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12134 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12135 </p>
12136 !! end
12137
12138 !! test
12139 Empty attribute crash test (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 Empty attribute crash test single-quotes (bug 2067)
12149 !! wikitext
12150 <font color=''>foo</font>
12151 !! html
12152 <p><font color="">foo</font>
12153 </p>
12154 !! end
12155
12156 !! test
12157 Attribute test: equals, then nothing
12158 !! wikitext
12159 <font color=>foo</font>
12160 !! html
12161 <p><font>foo</font>
12162 </p>
12163 !! end
12164
12165 !! test
12166 Attribute test: unquoted value
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: unquoted but illegal value (hash)
12176 !! wikitext
12177 <font color=#x>foo</font>
12178 !! html
12179 <p><font color="#x">foo</font>
12180 </p>
12181 !! end
12182
12183 !! test
12184 Attribute test: no value
12185 !! wikitext
12186 <font color>foo</font>
12187 !! html
12188 <p><font color="color">foo</font>
12189 </p>
12190 !! end
12191
12192 !! test
12193 Bug 2095: link with three closing brackets
12194 !! wikitext
12195 [[Main Page]]]
12196 !! html
12197 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12198 </p>
12199 !! end
12200
12201 !! test
12202 Bug 2095: link with pipe and three closing brackets
12203 !! wikitext
12204 [[Main Page|link]]]
12205 !! html
12206 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12207 </p>
12208 !! end
12209
12210 !! test
12211 Bug 2095: link with pipe and three closing brackets, version 2
12212 !! wikitext
12213 [[Main Page|[http://example.com/]]]
12214 !! html
12215 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12216 </p>
12217 !! end
12218
12219
12220 ###
12221 ### Safety
12222 ###
12223
12224 !! article
12225 Template:Dangerous attribute
12226 !! text
12227 " onmouseover="alert(document.cookie)
12228 !! endarticle
12229
12230 !! article
12231 Template:Dangerous style attribute
12232 !! text
12233 border-size: expression(alert(document.cookie))
12234 !! endarticle
12235
12236 !! article
12237 Template:Div style
12238 !! text
12239 <div style="float: right; {{{1}}}">Magic div</div>
12240 !! endarticle
12241
12242 !! test
12243 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12244 !! wikitext
12245 <div title="{{test}}"></div>
12246 !! html
12247 <div title="This is a test template"></div>
12248
12249 !! end
12250
12251 !! test
12252 Bug 2304: HTML attribute safety (dangerous template; 2309)
12253 !! wikitext
12254 <div title="{{dangerous attribute}}"></div>
12255 !! html
12256 <div title=""></div>
12257
12258 !! end
12259
12260 !! test
12261 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12262 !! wikitext
12263 <div style="{{dangerous style attribute}}"></div>
12264 !! html
12265 <div style="/* insecure input */"></div>
12266
12267 !! end
12268
12269 !! test
12270 Bug 2304: HTML attribute safety (safe parameter; 2309)
12271 !! wikitext
12272 {{div style|width: 200px}}
12273 !! html
12274 <div style="float: right; width: 200px">Magic div</div>
12275
12276 !! end
12277
12278 !! test
12279 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12280 !! wikitext
12281 {{div style|width: expression(alert(document.cookie))}}
12282 !! html
12283 <div style="/* insecure input */">Magic div</div>
12284
12285 !! end
12286
12287 !! test
12288 Bug 2304: HTML attribute safety (unsafe breakout parameter; 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 (unsafe breakout parameter 2; 2309)
12298 !! wikitext
12299 {{div style|" ><script>alert(document.cookie)</script>}}
12300 !! html
12301 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12302
12303 !! end
12304
12305 !! test
12306 Bug 2304: HTML attribute safety (link)
12307 !! wikitext
12308 <div title="[[Main Page]]"></div>
12309 !! html
12310 <div title="&#91;&#91;Main Page]]"></div>
12311
12312 !! end
12313
12314 !! test
12315 Bug 2304: HTML attribute safety (italics)
12316 !! wikitext
12317 <div title="''foobar''"></div>
12318 !! html
12319 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12320
12321 !! end
12322
12323 !! test
12324 Bug 2304: HTML attribute safety (bold)
12325 !! wikitext
12326 <div title="'''foobar'''"></div>
12327 !! html
12328 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12329
12330 !! end
12331
12332
12333 !! test
12334 Bug 2304: HTML attribute safety (ISBN)
12335 !! wikitext
12336 <div title="ISBN 1234567890"></div>
12337 !! html
12338 <div title="&#73;SBN 1234567890"></div>
12339
12340 !! end
12341
12342 !! test
12343 Bug 2304: HTML attribute safety (RFC)
12344 !! wikitext
12345 <div title="RFC 1234"></div>
12346 !! html
12347 <div title="&#82;FC 1234"></div>
12348
12349 !! end
12350
12351 !! test
12352 Bug 2304: HTML attribute safety (PMID)
12353 !! wikitext
12354 <div title="PMID 1234567890"></div>
12355 !! html
12356 <div title="&#80;MID 1234567890"></div>
12357
12358 !! end
12359
12360 !! test
12361 Bug 2304: HTML attribute safety (web link)
12362 !! wikitext
12363 <div title="http://example.com/"></div>
12364 !! html
12365 <div title="http&#58;//example.com/"></div>
12366
12367 !! end
12368
12369 !! test
12370 Bug 2304: HTML attribute safety (named web link)
12371 !! wikitext
12372 <div title="[http://example.com/ link]"></div>
12373 !! html
12374 <div title="&#91;http&#58;//example.com/ link]"></div>
12375
12376 !! end
12377
12378 !! test
12379 Bug 3244: HTML attribute safety (extension; safe)
12380 !! wikitext
12381 <div style="<nowiki>background:blue</nowiki>"></div>
12382 !! html
12383 <div style="background:blue"></div>
12384
12385 !! end
12386
12387 !! test
12388 Bug 3244: HTML attribute safety (extension; unsafe)
12389 !! wikitext
12390 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12391 !! html
12392 <div style="/* insecure input */"></div>
12393
12394 !! end
12395
12396 # More MSIE fun discovered by Tom Gilder
12397
12398 !! test
12399 MSIE CSS safety test: spurious slash
12400 !! wikitext
12401 <div style="background-image:u\rl(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: hex code
12409 !! wikitext
12410 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12411 !! html
12412 <div style="/* insecure input */">evil</div>
12413
12414 !! end
12415
12416 !! test
12417 MSIE CSS safety test: comment in url
12418 !! wikitext
12419 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12420 !! html
12421 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12422
12423 !! end
12424
12425 !! test
12426 MSIE CSS safety test: comment in expression
12427 !! wikitext
12428 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12429 !! html
12430 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12431
12432 !! end
12433
12434 !! test
12435 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12436 !! wikitext
12437 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12438 !! html
12439 <p style="/* invalid control char */">A</p>
12440
12441 !! end
12442
12443 !! test
12444 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12445 !! wikitext
12446 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12447 <div style="top:EXPRESSION(alert())">B</div>
12448 !! html
12449 <p style="/* insecure input */">A</p>
12450 <div style="/* insecure input */">B</div>
12451
12452 !! end
12453
12454 !! test
12455 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12456 !! wikitext
12457 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12458 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12459 !! html
12460 <div style="/* insecure input */">A</div>
12461 <p style="/* insecure input */">B</p>
12462
12463 !! end
12464
12465 !! test
12466 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12467 !! wikitext
12468 <div style="background-image:url⁽javascript:alert())">A</div>
12469 <div style="background-image:url₍javascript:alert())">B</div>
12470 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12471 !! html
12472 <div style="/* insecure input */">A</div>
12473 <div style="/* insecure input */">B</div>
12474 <p style="/* insecure input */">C</p>
12475
12476 !! end
12477
12478 !! test
12479 Opera -o-link CSS
12480 !! wikitext
12481 <div
12482 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;"
12483 style="-o-link:attr(title);-o-link-source:current">X</div>
12484 !! html
12485 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12486
12487 !! end
12488
12489 !! test
12490 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12491 !! wikitext
12492 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12493 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12494 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12495 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12496 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12497 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12498 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12499 !! html
12500 <p style="/* insecure input */">A</p>
12501 <p style="/* insecure input */">B</p>
12502 <p style="/* insecure input */">C</p>
12503 <p style="/* insecure input */">D</p>
12504 <p style="/* insecure input */">E</p>
12505 <p style="/* insecure input */">F</p>
12506 <p style="/* insecure input */">G</p>
12507
12508 !! end
12509
12510 !! test
12511 Table attribute legitimate extension
12512 !! wikitext
12513 {|
12514 !+ style="<nowiki>color:blue</nowiki>"| status
12515 |}
12516 !! html
12517 <table>
12518 <tr>
12519 <th style="color:blue"> status
12520 </th></tr></table>
12521
12522 !!end
12523
12524 !! test
12525 Table attribute safety
12526 !! wikitext
12527 {|
12528 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12529 |}
12530 !! html
12531 <table>
12532 <tr>
12533 <th style="/* insecure input */"> status
12534 </th></tr></table>
12535
12536 !! end
12537
12538 !! test
12539 CSS line continuation 1
12540 !! wikitext
12541 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12542 !! html
12543 <div style="/* insecure input */"></div>
12544
12545 !! end
12546
12547 !! test
12548 CSS line continuation 2
12549 !! wikitext
12550 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12551 !! html
12552 <div style="/* insecure input */"></div>
12553
12554 !! end
12555
12556 !! article
12557 Template:Identity
12558 !! text
12559 {{{1}}}
12560 !! endarticle
12561
12562 !! test
12563 Expansion of multi-line templates in attribute values (bug 6255)
12564 !! wikitext
12565 <div style="background: {{identity|#00FF00}}">-</div>
12566 !! html
12567 <div style="background: #00FF00">-</div>
12568
12569 !! end
12570
12571
12572 !! test
12573 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12574 !! wikitext
12575 <div style="background:
12576 #00FF00">-</div>
12577 !! html
12578 <div style="background: #00FF00">-</div>
12579
12580 !! end
12581
12582 !! test
12583 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12584 !! wikitext
12585 <div style="background: &#10;#00FF00">-</div>
12586 !! html
12587 <div style="background: &#10;#00FF00">-</div>
12588
12589 !! end
12590
12591 ###
12592 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12593 ###
12594 !! test
12595 Parser hook: empty input
12596 !! wikitext
12597 <tag></tag>
12598 !! html
12599 <pre>
12600 ''
12601 array (
12602 )
12603 </pre>
12604
12605 !! end
12606
12607 !! test
12608 Parser hook: empty input using terminated empty elements
12609 !! wikitext
12610 <tag/>
12611 !! html
12612 <pre>
12613 NULL
12614 array (
12615 )
12616 </pre>
12617
12618 !! end
12619
12620 !! test
12621 Parser hook: empty input using terminated empty elements (space before)
12622 !! wikitext
12623 <tag />
12624 !! html
12625 <pre>
12626 NULL
12627 array (
12628 )
12629 </pre>
12630
12631 !! end
12632
12633 !! test
12634 Parser hook: basic input
12635 !! wikitext
12636 <tag>input</tag>
12637 !! html
12638 <pre>
12639 'input'
12640 array (
12641 )
12642 </pre>
12643
12644 !! end
12645
12646
12647 !! test
12648 Parser hook: case insensitive
12649 !! wikitext
12650 <TAG>input</TAG>
12651 !! html
12652 <pre>
12653 'input'
12654 array (
12655 )
12656 </pre>
12657
12658 !! end
12659
12660
12661 !! test
12662 Parser hook: case insensitive, redux
12663 !! wikitext
12664 <TaG>input</TAg>
12665 !! html
12666 <pre>
12667 'input'
12668 array (
12669 )
12670 </pre>
12671
12672 !! end
12673
12674 !! test
12675 Parser hook: nested tags
12676 !! options
12677 noxml
12678 !! wikitext
12679 <tag><tag></tag></tag>
12680 !! html
12681 <pre>
12682 '<tag>'
12683 array (
12684 )
12685 </pre>&lt;/tag&gt;
12686
12687 !! end
12688
12689 !! test
12690 Parser hook: basic arguments
12691 !! wikitext
12692 <tag width=200 height = "100" depth = '50' square></tag>
12693 !! html
12694 <pre>
12695 ''
12696 array (
12697 'width' => '200',
12698 'height' => '100',
12699 'depth' => '50',
12700 'square' => 'square',
12701 )
12702 </pre>
12703
12704 !! end
12705
12706 !! test
12707 Parser hook: argument containing a forward slash (bug 5344)
12708 !! wikitext
12709 <tag filename='/tmp/bla'></tag>
12710 !! html
12711 <pre>
12712 ''
12713 array (
12714 'filename' => '/tmp/bla',
12715 )
12716 </pre>
12717
12718 !! end
12719
12720 !! test
12721 Parser hook: empty input using terminated empty elements (bug 2374)
12722 !! wikitext
12723 <tag foo=bar/>text
12724 !! html
12725 <pre>
12726 NULL
12727 array (
12728 'foo' => 'bar',
12729 )
12730 </pre>text
12731
12732 !! end
12733
12734 # </tag> should be output literally since there is no matching tag that begins it
12735 !! test
12736 Parser hook: basic arguments using terminated empty elements (bug 2374)
12737 !! wikitext
12738 <tag width=200 height = "100" depth = '50' square/>
12739 other stuff
12740 </tag>
12741 !! html
12742 <pre>
12743 NULL
12744 array (
12745 'width' => '200',
12746 'height' => '100',
12747 'depth' => '50',
12748 'square' => 'square',
12749 )
12750 </pre>
12751 <p>other stuff
12752 &lt;/tag&gt;
12753 </p>
12754 !! end
12755
12756 ###
12757 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12758 ###
12759
12760 !! test
12761 Parser hook: static parser hook not inside a comment
12762 !! wikitext
12763 <statictag>hello, world</statictag>
12764 <statictag action=flush/>
12765 !! html
12766 <p>hello, world
12767 </p>
12768 !! end
12769
12770
12771 !! test
12772 Parser hook: static parser hook inside a comment
12773 !! wikitext
12774 <!-- <statictag>hello, world</statictag> -->
12775 <statictag action=flush/>
12776 !! html
12777 <p><br />
12778 </p>
12779 !! end
12780
12781 # Nested template calls; this case was broken by Parser.php rev 1.506,
12782 # since reverted.
12783
12784 !! article
12785 Template:One-parameter
12786 !! text
12787 (My parameter is: {{{1}}})
12788 !! endarticle
12789
12790 !! article
12791 Template:Map-one-parameter
12792 !! text
12793 {{{{{1}}}|{{{2}}}}}
12794 !! endarticle
12795
12796 !! test
12797 Nested template calls
12798 !! wikitext
12799 {{Map-one-parameter|One-parameter|param}}
12800 !! html
12801 <p>(My parameter is: param)
12802 </p>
12803 !! end
12804
12805
12806 ###
12807 ### Sanitizer
12808 ###
12809 !! test
12810 Sanitizer: Closing of open tags
12811 !! wikitext
12812 <s></s><table></table>
12813 !! html
12814 <s></s><table></table>
12815
12816 !! end
12817
12818 !! test
12819 Sanitizer: Closing of open but not closed tags
12820 !! wikitext
12821 <s>foo
12822 !! html
12823 <p><s>foo</s>
12824 </p>
12825 !! end
12826
12827 !! test
12828 Sanitizer: Closing of closed but not open tags
12829 !! wikitext
12830 </s>
12831 !! html
12832 <p>&lt;/s&gt;
12833 </p>
12834 !! end
12835
12836 !! test
12837 Sanitizer: Closing of closed but not open table tags
12838 !! wikitext
12839 Table not started</td></tr></table>
12840 !! html
12841 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12842 </p>
12843 !! end
12844
12845 !! test
12846 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12847 !! wikitext
12848 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12849 !! html
12850 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12851 </p>
12852 !! end
12853
12854 !! test
12855 Sanitizer: Validating the contents of the id attribute (bug 4515)
12856 !! options
12857 disabled
12858 !! wikitext
12859 <br id=9 />
12860 !! html
12861 Something, but definitely not <br id="9" />...
12862 !! end
12863
12864 !! test
12865 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12866 !! options
12867 disabled
12868 !! wikitext
12869 <br id="foo" /><br id="foo" />
12870 !! html
12871 Something need to be done. foo-2 ?
12872 !! end
12873
12874 !! test
12875 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12876 !! wikitext
12877 <div itemscope>
12878 <meta itemprop="hello" content="world">
12879 <meta http-equiv="refresh" content="5">
12880 <meta itemprop="hello" http-equiv="refresh" content="5">
12881 <link itemprop="hello" href="{{SERVER}}">
12882 <link rel="stylesheet" href="{{SERVER}}">
12883 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12884 </div>
12885 !! html
12886 <div itemscope="itemscope">
12887 <p> <meta itemprop="hello" content="world" />
12888 &lt;meta http-equiv="refresh" content="5"&gt;
12889 <meta itemprop="hello" content="5" />
12890 </p>
12891 <link itemprop="hello" href="http&#58;//example.org" />
12892 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12893 <link itemprop="hello" href="http&#58;//example.org" />
12894 </div>
12895
12896 !! end
12897
12898 !! test
12899 Language converter: output gets cut off unexpectedly (bug 5757)
12900 !! options
12901 language=zh
12902 !! wikitext
12903 this bit is safe: }-
12904
12905 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12906
12907 then we get cut off here: }-
12908
12909 all additional text is vanished
12910 !! html
12911 <p>this bit is safe: }-
12912 </p><p>but if we add a conversion instance: xxx
12913 </p><p>then we get cut off here: }-
12914 </p><p>all additional text is vanished
12915 </p>
12916 !! end
12917
12918 !! test
12919 Self closed html pairs (bug 5487)
12920 !! options
12921 !! wikitext
12922 <center><font id="bug" />Centered text</center>
12923 <div><font id="bug2" />In div text</div>
12924 !! html
12925 <center>&lt;font id="bug" /&gt;Centered text</center>
12926 <div>&lt;font id="bug2" /&gt;In div text</div>
12927
12928 !! end
12929
12930 #
12931 #
12932 #
12933
12934 !! test
12935 Punctuation: nbsp before exclamation
12936 !! wikitext
12937 C'est grave !
12938 !! html
12939 <p>C'est grave&#160;!
12940 </p>
12941 !! end
12942
12943 !! test
12944 Punctuation: CSS !important (bug 11874)
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 !! test
12953 Punctuation: CSS ! important (bug 11874; with space after)
12954 !! wikitext
12955 <div style="width:50% ! important">important</div>
12956 !! html
12957 <div style="width:50% ! important">important</div>
12958
12959 !!end
12960
12961
12962 !! test
12963 HTML bullet list, closed tags (bug 5497)
12964 !! wikitext
12965 <ul>
12966 <li>One</li>
12967 <li>Two</li>
12968 </ul>
12969 !! html
12970 <ul>
12971 <li>One</li>
12972 <li>Two</li>
12973 </ul>
12974
12975 !! end
12976
12977 !! test
12978 HTML bullet list, unclosed tags (bug 5497)
12979 !! options
12980 disabled
12981 !! wikitext
12982 <ul>
12983 <li>One
12984 <li>Two
12985 </ul>
12986 !! html
12987 <ul>
12988 <li>One
12989 </li>
12990 <li>Two
12991 </li>
12992 </ul>
12993
12994 !! end
12995
12996 !! test
12997 HTML ordered list, closed tags (bug 5497)
12998 !! wikitext
12999 <ol>
13000 <li>One</li>
13001 <li>Two</li>
13002 </ol>
13003 !! html
13004 <ol>
13005 <li>One</li>
13006 <li>Two</li>
13007 </ol>
13008
13009 !! end
13010
13011 !! test
13012 HTML ordered list, unclosed tags (bug 5497)
13013 !! options
13014 disabled
13015 !! wikitext
13016 <ol>
13017 <li>One
13018 <li>Two
13019 </ol>
13020 !! html
13021 <ol>
13022 <li>One
13023 </li>
13024 <li>Two
13025 </li>
13026 </ol>
13027
13028 !! end
13029
13030 !! test
13031 HTML nested bullet list, closed tags (bug 5497)
13032 !! wikitext
13033 <ul>
13034 <li>One</li>
13035 <li>Two:
13036 <ul>
13037 <li>Sub-one</li>
13038 <li>Sub-two</li>
13039 </ul>
13040 </li>
13041 </ul>
13042 !! html
13043 <ul>
13044 <li>One</li>
13045 <li>Two:
13046 <ul>
13047 <li>Sub-one</li>
13048 <li>Sub-two</li>
13049 </ul>
13050 </li>
13051 </ul>
13052
13053 !! end
13054
13055 !! test
13056 HTML nested bullet list, open tags (bug 5497)
13057 !! options
13058 disabled
13059 !! wikitext
13060 <ul>
13061 <li>One
13062 <li>Two:
13063 <ul>
13064 <li>Sub-one
13065 <li>Sub-two
13066 </ul>
13067 </ul>
13068 !! html
13069 <ul>
13070 <li>One
13071 </li>
13072 <li>Two:
13073 <ul>
13074 <li>Sub-one
13075 </li>
13076 <li>Sub-two
13077 </li>
13078 </ul>
13079 </li>
13080 </ul>
13081
13082 !! end
13083
13084 !! test
13085 HTML nested ordered list, closed tags (bug 5497)
13086 !! wikitext
13087 <ol>
13088 <li>One</li>
13089 <li>Two:
13090 <ol>
13091 <li>Sub-one</li>
13092 <li>Sub-two</li>
13093 </ol>
13094 </li>
13095 </ol>
13096 !! html
13097 <ol>
13098 <li>One</li>
13099 <li>Two:
13100 <ol>
13101 <li>Sub-one</li>
13102 <li>Sub-two</li>
13103 </ol>
13104 </li>
13105 </ol>
13106
13107 !! end
13108
13109 !! test
13110 HTML nested ordered list, open tags (bug 5497)
13111 !! options
13112 disabled
13113 !! wikitext
13114 <ol>
13115 <li>One
13116 <li>Two:
13117 <ol>
13118 <li>Sub-one
13119 <li>Sub-two
13120 </ol>
13121 </ol>
13122 !! html
13123 <ol>
13124 <li>One
13125 </li>
13126 <li>Two:
13127 <ol>
13128 <li>Sub-one
13129 </li>
13130 <li>Sub-two
13131 </li>
13132 </ol>
13133 </li>
13134 </ol>
13135
13136 !! end
13137
13138 !! test
13139 HTML ordered list item with parameters oddity
13140 !! wikitext
13141 <ol><li id="fragment">One</li>
13142 </ol>
13143 !! html
13144 <ol><li id="fragment">One</li>
13145 </ol>
13146
13147 !! end
13148
13149 !!test
13150 bug 5918: autonumbering
13151 !! wikitext
13152 [http://first/] [http://second] [ftp://ftp]
13153
13154 ftp://inlineftp
13155
13156 [mailto:enclosed@mail.tld With target]
13157
13158 [mailto:enclosed@mail.tld]
13159
13160 mailto:inline@mail.tld
13161 !! html
13162 <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>
13163 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13164 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13165 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13166 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13167 </p>
13168 !! end
13169
13170
13171 #
13172 # Security and HTML correctness
13173 # From Nick Jenkins' fuzz testing
13174 #
13175
13176 !! test
13177 Fuzz testing: Parser13
13178 !! wikitext
13179 {|
13180 | http://a|
13181 !! html
13182 <table>
13183 <tr>
13184 <td>
13185 </td>
13186 </tr>
13187 </table>
13188
13189 !! end
13190
13191 !! test
13192 Fuzz testing: Parser14
13193 !! wikitext
13194 == onmouseover= ==
13195 http://__TOC__
13196 !! html
13197 <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>
13198 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13199 <ul>
13200 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13201 </ul>
13202 </div>
13203
13204
13205 !! end
13206
13207 !! test
13208 Fuzz testing: Parser14-table
13209 !! wikitext
13210 ==a==
13211 {| STYLE=__TOC__
13212 !! html
13213 <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>
13214 <table style="&#95;_TOC&#95;_">
13215 <tr><td></td></tr>
13216 </table>
13217
13218 !! end
13219
13220 # Known to produce bogus xml (extra </td>)
13221 !! test
13222 Fuzz testing: Parser16
13223 !! options
13224 noxml
13225 !! wikitext
13226 {|
13227 !https://||||||
13228 !! html
13229 <table>
13230 <tr>
13231 <th>https://</th>
13232 <th></th>
13233 <th></th>
13234 <th>
13235 </td>
13236 </tr>
13237 </table>
13238
13239 !! end
13240
13241 !! test
13242 Fuzz testing: Parser21
13243 !! wikitext
13244 {|
13245 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13246 |
13247 !! html
13248 <table>
13249 <tr>
13250 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13251 </th>
13252 <td>
13253 </td>
13254 </tr>
13255 </table>
13256
13257 !! end
13258
13259 !! test
13260 Fuzz testing: Parser22
13261 !! wikitext
13262 http://===r:::https://b
13263
13264 {|
13265 !! html
13266 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13267 </p>
13268 <table>
13269 <tr><td></td></tr>
13270 </table>
13271
13272 !! end
13273
13274 # Known to produce bad XML for now
13275 !! test
13276 Fuzz testing: Parser24
13277 !! options
13278 noxml
13279 !! wikitext
13280 {|
13281 {{{|
13282 <u CLASS=
13283 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13284 <br style="onmouseover='alert(document.cookie);' " />
13285
13286 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13287 |
13288 !! html
13289 <table>
13290 {{{|
13291 <u class="&#124;">}}}} &gt;
13292 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13293
13294 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13295 <tr>
13296 <td></u>
13297 </td>
13298 </tr>
13299 </table>
13300
13301 !! end
13302
13303 # Note: the current result listed for this is not what the original one was,
13304 # but the original bug was JavaScript injection, which is fixed in any case.
13305 # It's not clear that the original result listed was any more correct than the
13306 # current one. Original result:
13307 # <p>{{{|
13308 # </p>
13309 # <li class="&#124;&#124;">
13310 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13311 !!test
13312 Fuzz testing: Parser25 (bug 6055)
13313 !! wikitext
13314 {{{
13315 |
13316 <LI CLASS=||
13317 >
13318 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13319 !! html
13320 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13321 </p>
13322 !! end
13323
13324 !!test
13325 Fuzz testing: URL adjacent extension (with space, clean)
13326 !! options
13327 !! wikitext
13328 http://example.com <nowiki>junk</nowiki>
13329 !! html
13330 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13331 </p>
13332 !!end
13333
13334 !!test
13335 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13336 !! options
13337 !! wikitext
13338 http://example.com<nowiki>junk</nowiki>
13339 !! html
13340 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13341 </p>
13342 !!end
13343
13344 !!test
13345 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13346 !! options
13347 !! wikitext
13348 http://example.com<pre>junk</pre>
13349 !! html
13350 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13351
13352 !!end
13353
13354 !!test
13355 Fuzz testing: image with bogus manual thumbnail
13356 !! wikitext
13357 [[Image:foobar.jpg|thumbnail= ]]
13358 !! html/php
13359 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13360
13361 !! html/parsoid
13362 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13363 !!end
13364
13365 !! test
13366 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13367 !! wikitext
13368 <pre dir="&#10;"></pre>
13369 !! html
13370 <pre dir="&#10;"></pre>
13371
13372 !! end
13373
13374 !! test
13375 Parsing optional HTML elements (Bug 6171)
13376 !! options
13377 !! wikitext
13378 <table>
13379 <tr>
13380 <td> Some tabular data</td>
13381 <td> More tabular data ...
13382 <td> And yet som tabular data</td>
13383 </tr>
13384 </table>
13385 !! html
13386 <table>
13387 <tr>
13388 <td> Some tabular data</td>
13389 <td> More tabular data ...
13390 </td><td> And yet som tabular data</td>
13391 </tr>
13392 </table>
13393
13394 !! end
13395
13396 !! test
13397 Correct handling of <td>, <tr> (Bug 6171)
13398 !! options
13399 !! wikitext
13400 <table>
13401 <tr>
13402 <td> Some tabular data</td>
13403 <td> More tabular data ...</td>
13404 <td> And yet som tabular data</td>
13405 </tr>
13406 </table>
13407 !! html
13408 <table>
13409 <tr>
13410 <td> Some tabular data</td>
13411 <td> More tabular data ...</td>
13412 <td> And yet som tabular data</td>
13413 </tr>
13414 </table>
13415
13416 !! end
13417
13418
13419 !! test
13420 Parsing crashing regression (fr:JavaScript)
13421 !! wikitext
13422 </body></x>
13423 !! html
13424 <p>&lt;/body&gt;&lt;/x&gt;
13425 </p>
13426 !! end
13427
13428 !! test
13429 Inline wiki vs wiki block nesting
13430 !! wikitext
13431 '''Bold paragraph
13432
13433 New wiki paragraph
13434 !! html
13435 <p><b>Bold paragraph</b>
13436 </p><p>New wiki paragraph
13437 </p>
13438 !! end
13439
13440 !! test
13441 Inline HTML vs wiki block nesting
13442 !! options
13443 disabled
13444 !! wikitext
13445 <b>Bold paragraph
13446
13447 New wiki paragraph
13448 !! html
13449 <p><b>Bold paragraph</b>
13450 </p><p>New wiki paragraph
13451 </p>
13452 !! end
13453
13454 # Original result was this:
13455 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13456 # </p>
13457 # While that might be marginally more intuitive, maybe, the six-apostrophe
13458 # construct is clearly pathological and the result stated here (which is what
13459 # the parser actually does) is about as reasonable as anything.
13460 !!test
13461 Mixing markup for italics and bold
13462 !! options
13463 !! wikitext
13464 '''bold''''''bold''bolditalics'''''
13465 !! html
13466 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13467 </p>
13468 !! end
13469
13470
13471 !! article
13472 Xyzzyx
13473 !! text
13474 Article for special page transclusion test
13475 !! endarticle
13476
13477 !! test
13478 Special page transclusion
13479 !! options
13480 !! wikitext
13481 {{Special:Prefixindex/Xyzzyx}}
13482 !! html
13483 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13484
13485 !! end
13486
13487 !! test
13488 Special page transclusion twice (bug 5021)
13489 !! options
13490 !! wikitext
13491 {{Special:Prefixindex/Xyzzyx}}
13492 {{Special:Prefixindex/Xyzzyx}}
13493 !! html
13494 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13495 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13496
13497 !! end
13498
13499 !! test
13500 Transclusion of default MediaWiki message
13501 !! wikitext
13502 {{MediaWiki:Mainpage}}
13503 !! html
13504 <p>Main Page
13505 </p>
13506 !! end
13507
13508 !! test
13509 Transclusion of nonexistent MediaWiki message
13510 !! wikitext
13511 {{MediaWiki:Mainpagexxx}}
13512 !! html
13513 <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>
13514 </p>
13515 !! end
13516
13517 !! test
13518 Transclusion of MediaWiki message with underscore
13519 !! wikitext
13520 {{MediaWiki:history_short}}
13521 !! html
13522 <p>History
13523 </p>
13524 !! end
13525
13526 !! test
13527 Transclusion of MediaWiki message with space
13528 !! wikitext
13529 {{MediaWiki:history short}}
13530 !! html
13531 <p>History
13532 </p>
13533 !! end
13534
13535 !! test
13536 Invalid header with following text
13537 !! wikitext
13538 = x = y
13539 !! html
13540 <p>= x = y
13541 </p>
13542 !! end
13543
13544
13545 !! test
13546 Section extraction test (section 0)
13547 !! options
13548 section=0
13549 !! wikitext
13550 start
13551 ==a==
13552 ===aa===
13553 ====aaa====
13554 ==b==
13555 ===ba===
13556 ===bb===
13557 ====bba====
13558 ===bc===
13559 ==c==
13560 ===ca===
13561 !! html
13562 start
13563 !! end
13564
13565 !! test
13566 Section extraction test (section 1)
13567 !! options
13568 section=1
13569 !! wikitext
13570 start
13571 ==a==
13572 ===aa===
13573 ====aaa====
13574 ==b==
13575 ===ba===
13576 ===bb===
13577 ====bba====
13578 ===bc===
13579 ==c==
13580 ===ca===
13581 !! html
13582 ==a==
13583 ===aa===
13584 ====aaa====
13585 !! end
13586
13587 !! test
13588 Section extraction test (section 2)
13589 !! options
13590 section=2
13591 !! wikitext
13592 start
13593 ==a==
13594 ===aa===
13595 ====aaa====
13596 ==b==
13597 ===ba===
13598 ===bb===
13599 ====bba====
13600 ===bc===
13601 ==c==
13602 ===ca===
13603 !! html
13604 ===aa===
13605 ====aaa====
13606 !! end
13607
13608 !! test
13609 Section extraction test (section 3)
13610 !! options
13611 section=3
13612 !! wikitext
13613 start
13614 ==a==
13615 ===aa===
13616 ====aaa====
13617 ==b==
13618 ===ba===
13619 ===bb===
13620 ====bba====
13621 ===bc===
13622 ==c==
13623 ===ca===
13624 !! html
13625 ====aaa====
13626 !! end
13627
13628 !! test
13629 Section extraction test (section 4)
13630 !! options
13631 section=4
13632 !! wikitext
13633 start
13634 ==a==
13635 ===aa===
13636 ====aaa====
13637 ==b==
13638 ===ba===
13639 ===bb===
13640 ====bba====
13641 ===bc===
13642 ==c==
13643 ===ca===
13644 !! html
13645 ==b==
13646 ===ba===
13647 ===bb===
13648 ====bba====
13649 ===bc===
13650 !! end
13651
13652 !! test
13653 Section extraction test (section 5)
13654 !! options
13655 section=5
13656 !! wikitext
13657 start
13658 ==a==
13659 ===aa===
13660 ====aaa====
13661 ==b==
13662 ===ba===
13663 ===bb===
13664 ====bba====
13665 ===bc===
13666 ==c==
13667 ===ca===
13668 !! html
13669 ===ba===
13670 !! end
13671
13672 !! test
13673 Section extraction test (section 6)
13674 !! options
13675 section=6
13676 !! wikitext
13677 start
13678 ==a==
13679 ===aa===
13680 ====aaa====
13681 ==b==
13682 ===ba===
13683 ===bb===
13684 ====bba====
13685 ===bc===
13686 ==c==
13687 ===ca===
13688 !! html
13689 ===bb===
13690 ====bba====
13691 !! end
13692
13693 !! test
13694 Section extraction test (section 7)
13695 !! options
13696 section=7
13697 !! wikitext
13698 start
13699 ==a==
13700 ===aa===
13701 ====aaa====
13702 ==b==
13703 ===ba===
13704 ===bb===
13705 ====bba====
13706 ===bc===
13707 ==c==
13708 ===ca===
13709 !! html
13710 ====bba====
13711 !! end
13712
13713 !! test
13714 Section extraction test (section 8)
13715 !! options
13716 section=8
13717 !! wikitext
13718 start
13719 ==a==
13720 ===aa===
13721 ====aaa====
13722 ==b==
13723 ===ba===
13724 ===bb===
13725 ====bba====
13726 ===bc===
13727 ==c==
13728 ===ca===
13729 !! html
13730 ===bc===
13731 !! end
13732
13733 !! test
13734 Section extraction test (section 9)
13735 !! options
13736 section=9
13737 !! wikitext
13738 start
13739 ==a==
13740 ===aa===
13741 ====aaa====
13742 ==b==
13743 ===ba===
13744 ===bb===
13745 ====bba====
13746 ===bc===
13747 ==c==
13748 ===ca===
13749 !! html
13750 ==c==
13751 ===ca===
13752 !! end
13753
13754 !! test
13755 Section extraction test (section 10)
13756 !! options
13757 section=10
13758 !! wikitext
13759 start
13760 ==a==
13761 ===aa===
13762 ====aaa====
13763 ==b==
13764 ===ba===
13765 ===bb===
13766 ====bba====
13767 ===bc===
13768 ==c==
13769 ===ca===
13770 !! html
13771 ===ca===
13772 !! end
13773
13774 !! test
13775 Section extraction test (nonexistent section 11)
13776 !! options
13777 section=11
13778 !! wikitext
13779 start
13780 ==a==
13781 ===aa===
13782 ====aaa====
13783 ==b==
13784 ===ba===
13785 ===bb===
13786 ====bba====
13787 ===bc===
13788 ==c==
13789 ===ca===
13790 !! html
13791 !! end
13792
13793 !! test
13794 Section extraction test with bogus heading (section 1)
13795 !! options
13796 section=1
13797 !! wikitext
13798 ==a==
13799 ==bogus== not a legal section
13800 ==b==
13801 !! html
13802 ==a==
13803 ==bogus== not a legal section
13804 !! end
13805
13806 !! test
13807 Section extraction test with bogus heading (section 2)
13808 !! options
13809 section=2
13810 !! wikitext
13811 ==a==
13812 ==bogus== not a legal section
13813 ==b==
13814 !! html
13815 ==b==
13816 !! end
13817
13818 !! test
13819 Section extraction test with comment after heading (section 1)
13820 !! options
13821 section=1
13822 !! wikitext
13823 ==a==
13824 ==b== <!-- -->
13825 ==c==
13826 !! html
13827 ==a==
13828 !! end
13829
13830 !! test
13831 Section extraction test with comment after heading (section 2)
13832 !! options
13833 section=2
13834 !! wikitext
13835 ==a==
13836 ==b== <!-- -->
13837 ==c==
13838 !! html
13839 ==b== <!-- -->
13840 !! end
13841
13842 !! test
13843 Section extraction test with bogus <nowiki> heading (section 1)
13844 !! options
13845 section=1
13846 !! wikitext
13847 ==a==
13848 ==bogus== <nowiki>not a legal section</nowiki>
13849 ==b==
13850 !! html
13851 ==a==
13852 ==bogus== <nowiki>not a legal section</nowiki>
13853 !! end
13854
13855 !! test
13856 Section extraction test with bogus <nowiki> heading (section 2)
13857 !! options
13858 section=2
13859 !! wikitext
13860 ==a==
13861 ==bogus== <nowiki>not a legal section</nowiki>
13862 ==b==
13863 !! html
13864 ==b==
13865 !! end
13866
13867
13868 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13869 # instead of respecting commented sections
13870 !! test
13871 Section extraction prefixed by comment (section 1)
13872 !! options
13873 section=1
13874 !! wikitext
13875 <!-- -->==sec1==
13876 ==sec2==
13877 !! html
13878 ==sec2==
13879 !!end
13880
13881 !! test
13882 Section extraction prefixed by comment (section 2)
13883 !! options
13884 section=2
13885 !! wikitext
13886 <!-- -->==sec1==
13887 ==sec2==
13888 !! html
13889
13890 !!end
13891
13892
13893 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13894 # instead of respecting HTML-style headings
13895 !! test
13896 Section extraction, mixed wiki and html (section 1)
13897 !! options
13898 section=1
13899 !! wikitext
13900 <h2>unmarked</h2>
13901 unmarked
13902 ==1==
13903 one
13904 ==2==
13905 two
13906 !! html
13907 ==1==
13908 one
13909 !! end
13910
13911 !! test
13912 Section extraction, mixed wiki and html (section 2)
13913 !! options
13914 section=2
13915 !! wikitext
13916 <h2>unmarked</h2>
13917 unmarked
13918 ==1==
13919 one
13920 ==2==
13921 two
13922 !! html
13923 ==2==
13924 two
13925 !! end
13926
13927
13928 # Formerly testing for bug 3342
13929 !! test
13930 Section extraction, heading surrounded by <noinclude>
13931 !! options
13932 section=1
13933 !! wikitext
13934 <noinclude>==unmarked==</noinclude>
13935 ==marked==
13936 !! html
13937 ==marked==
13938 !!end
13939
13940 # Test behavior of bug 19910
13941 !! test
13942 Sectiion with all-equals
13943 !! options
13944 section=2
13945 !! wikitext
13946 ===
13947 The line above must have a trailing space
13948 === <!--
13949 --> <!-- -->
13950 But just in case it doesn't...
13951 !! html
13952 === <!--
13953 --> <!-- -->
13954 But just in case it doesn't...
13955 !! end
13956
13957 !! test
13958 Section replacement test (section 0)
13959 !! options
13960 replace=0,"xxx"
13961 !! wikitext
13962 start
13963 ==a==
13964 ===aa===
13965 ====aaa====
13966 ==b==
13967 ===ba===
13968 ===bb===
13969 ====bba====
13970 ===bc===
13971 ==c==
13972 ===ca===
13973 !! html
13974 xxx
13975
13976 ==a==
13977 ===aa===
13978 ====aaa====
13979 ==b==
13980 ===ba===
13981 ===bb===
13982 ====bba====
13983 ===bc===
13984 ==c==
13985 ===ca===
13986 !! end
13987
13988 !! test
13989 Section replacement test (section 1)
13990 !! options
13991 replace=1,"xxx"
13992 !! wikitext
13993 start
13994 ==a==
13995 ===aa===
13996 ====aaa====
13997 ==b==
13998 ===ba===
13999 ===bb===
14000 ====bba====
14001 ===bc===
14002 ==c==
14003 ===ca===
14004 !! html
14005 start
14006 xxx
14007
14008 ==b==
14009 ===ba===
14010 ===bb===
14011 ====bba====
14012 ===bc===
14013 ==c==
14014 ===ca===
14015 !! end
14016
14017 !! test
14018 Section replacement test (section 2)
14019 !! options
14020 replace=2,"xxx"
14021 !! wikitext
14022 start
14023 ==a==
14024 ===aa===
14025 ====aaa====
14026 ==b==
14027 ===ba===
14028 ===bb===
14029 ====bba====
14030 ===bc===
14031 ==c==
14032 ===ca===
14033 !! html
14034 start
14035 ==a==
14036 xxx
14037
14038 ==b==
14039 ===ba===
14040 ===bb===
14041 ====bba====
14042 ===bc===
14043 ==c==
14044 ===ca===
14045 !! end
14046
14047 !! test
14048 Section replacement test (section 3)
14049 !! options
14050 replace=3,"xxx"
14051 !! wikitext
14052 start
14053 ==a==
14054 ===aa===
14055 ====aaa====
14056 ==b==
14057 ===ba===
14058 ===bb===
14059 ====bba====
14060 ===bc===
14061 ==c==
14062 ===ca===
14063 !! html
14064 start
14065 ==a==
14066 ===aa===
14067 xxx
14068
14069 ==b==
14070 ===ba===
14071 ===bb===
14072 ====bba====
14073 ===bc===
14074 ==c==
14075 ===ca===
14076 !! end
14077
14078 !! test
14079 Section replacement test (section 4)
14080 !! options
14081 replace=4,"xxx"
14082 !! wikitext
14083 start
14084 ==a==
14085 ===aa===
14086 ====aaa====
14087 ==b==
14088 ===ba===
14089 ===bb===
14090 ====bba====
14091 ===bc===
14092 ==c==
14093 ===ca===
14094 !! html
14095 start
14096 ==a==
14097 ===aa===
14098 ====aaa====
14099 xxx
14100
14101 ==c==
14102 ===ca===
14103 !! end
14104
14105 !! test
14106 Section replacement test (section 5)
14107 !! options
14108 replace=5,"xxx"
14109 !! wikitext
14110 start
14111 ==a==
14112 ===aa===
14113 ====aaa====
14114 ==b==
14115 ===ba===
14116 ===bb===
14117 ====bba====
14118 ===bc===
14119 ==c==
14120 ===ca===
14121 !! html
14122 start
14123 ==a==
14124 ===aa===
14125 ====aaa====
14126 ==b==
14127 xxx
14128
14129 ===bb===
14130 ====bba====
14131 ===bc===
14132 ==c==
14133 ===ca===
14134 !! end
14135
14136 !! test
14137 Section replacement test (section 6)
14138 !! options
14139 replace=6,"xxx"
14140 !! wikitext
14141 start
14142 ==a==
14143 ===aa===
14144 ====aaa====
14145 ==b==
14146 ===ba===
14147 ===bb===
14148 ====bba====
14149 ===bc===
14150 ==c==
14151 ===ca===
14152 !! html
14153 start
14154 ==a==
14155 ===aa===
14156 ====aaa====
14157 ==b==
14158 ===ba===
14159 xxx
14160
14161 ===bc===
14162 ==c==
14163 ===ca===
14164 !! end
14165
14166 !! test
14167 Section replacement test (section 7)
14168 !! options
14169 replace=7,"xxx"
14170 !! wikitext
14171 start
14172 ==a==
14173 ===aa===
14174 ====aaa====
14175 ==b==
14176 ===ba===
14177 ===bb===
14178 ====bba====
14179 ===bc===
14180 ==c==
14181 ===ca===
14182 !! html
14183 start
14184 ==a==
14185 ===aa===
14186 ====aaa====
14187 ==b==
14188 ===ba===
14189 ===bb===
14190 xxx
14191
14192 ===bc===
14193 ==c==
14194 ===ca===
14195 !! end
14196
14197 !! test
14198 Section replacement test (section 8)
14199 !! options
14200 replace=8,"xxx"
14201 !! wikitext
14202 start
14203 ==a==
14204 ===aa===
14205 ====aaa====
14206 ==b==
14207 ===ba===
14208 ===bb===
14209 ====bba====
14210 ===bc===
14211 ==c==
14212 ===ca===
14213 !! html
14214 start
14215 ==a==
14216 ===aa===
14217 ====aaa====
14218 ==b==
14219 ===ba===
14220 ===bb===
14221 ====bba====
14222 xxx
14223
14224 ==c==
14225 ===ca===
14226 !!end
14227
14228 !! test
14229 Section replacement test (section 9)
14230 !! options
14231 replace=9,"xxx"
14232 !! wikitext
14233 start
14234 ==a==
14235 ===aa===
14236 ====aaa====
14237 ==b==
14238 ===ba===
14239 ===bb===
14240 ====bba====
14241 ===bc===
14242 ==c==
14243 ===ca===
14244 !! html
14245 start
14246 ==a==
14247 ===aa===
14248 ====aaa====
14249 ==b==
14250 ===ba===
14251 ===bb===
14252 ====bba====
14253 ===bc===
14254 xxx
14255 !! end
14256
14257 !! test
14258 Section replacement test (section 10)
14259 !! options
14260 replace=10,"xxx"
14261 !! wikitext
14262 start
14263 ==a==
14264 ===aa===
14265 ====aaa====
14266 ==b==
14267 ===ba===
14268 ===bb===
14269 ====bba====
14270 ===bc===
14271 ==c==
14272 ===ca===
14273 !! html
14274 start
14275 ==a==
14276 ===aa===
14277 ====aaa====
14278 ==b==
14279 ===ba===
14280 ===bb===
14281 ====bba====
14282 ===bc===
14283 ==c==
14284 xxx
14285 !! end
14286
14287 !! test
14288 Section replacement test with initial whitespace (bug 13728)
14289 !! options
14290 replace=2,"xxx"
14291 !! wikitext
14292 Preformatted initial line
14293 ==a==
14294 ===a===
14295 !! html
14296 Preformatted initial line
14297 ==a==
14298 xxx
14299 !! end
14300
14301
14302 !! test
14303 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14304 !! options
14305 section=1
14306 !! wikitext
14307 ==a==
14308 a
14309 !! html
14310 ==a==
14311 a
14312 !! end
14313
14314 !! test
14315 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14316 !! options
14317 section=1
14318 !! wikitext
14319 ==a==
14320 a
14321 !! html
14322 ==a==
14323 a
14324 !! end
14325
14326
14327 !! test
14328 Section extraction, <pre> around bogus header (bug 10309)
14329 !! options
14330 noxml section=2
14331 !! wikitext
14332 == Section One ==
14333 <pre>
14334 =======
14335 </pre>
14336
14337 == Section Two ==
14338 stuff
14339 !! html
14340 == Section Two ==
14341 stuff
14342 !! end
14343
14344 !! test
14345 Section replacement, <pre> around bogus header (bug 10309)
14346 !! options
14347 noxml replace=2,"xxx"
14348 !! wikitext
14349 == Section One ==
14350 <pre>
14351 =======
14352 </pre>
14353
14354 == Section Two ==
14355 stuff
14356 !! html
14357 == Section One ==
14358 <pre>
14359 =======
14360 </pre>
14361
14362 xxx
14363 !! end
14364
14365
14366
14367 !! test
14368 Handling of &#x0A; in URLs
14369 !! wikitext
14370 **irc://&#x0A;a
14371 !! html
14372 <ul>
14373 <li><ul>
14374 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14375 </li>
14376 </ul>
14377 </li>
14378 </ul>
14379
14380 !!end
14381
14382 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14383 !! test
14384 5 quotes, code coverage +1 line
14385 !! wikitext
14386 '''''
14387 !! html/php
14388 !! html/parsoid
14389 <p><b><i></i></b></p>
14390 !! end
14391
14392 !! test
14393 Special:Search page linking.
14394 !! wikitext
14395 {{Special:search}}
14396 !! html
14397 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14398 </p>
14399 !! end
14400
14401 !! test
14402 Say the magic word
14403 !! options
14404 title=[[Parser test]]
14405 !! wikitext
14406 * {{PAGENAME}}
14407 * {{PAGENAMEE}}
14408 * {{FULLPAGENAME}}
14409 * {{FULLPAGENAMEE}}
14410 * {{BASEPAGENAME}}
14411 * {{BASEPAGENAMEE}}
14412 * {{SUBPAGENAME}}
14413 * {{SUBPAGENAMEE}}
14414 * {{ROOTPAGENAME}}
14415 * {{ROOTPAGENAMEE}}
14416 * {{TALKPAGENAME}}
14417 * {{TALKPAGENAMEE}}
14418 * {{SUBJECTPAGENAME}}
14419 * {{SUBJECTPAGENAMEE}}
14420 * {{NAMESPACEE}}
14421 * {{NAMESPACE}}
14422 * {{NAMESPACENUMBER}}
14423 * {{TALKSPACE}}
14424 * {{TALKSPACEE}}
14425 * {{SUBJECTSPACE}}
14426 * {{SUBJECTSPACEE}}
14427 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14428 !! html
14429 <ul>
14430 <li> Parser test
14431 </li>
14432 <li> Parser_test
14433 </li>
14434 <li> Parser test
14435 </li>
14436 <li> Parser_test
14437 </li>
14438 <li> Parser test
14439 </li>
14440 <li> Parser_test
14441 </li>
14442 <li> Parser test
14443 </li>
14444 <li> Parser_test
14445 </li>
14446 <li> Parser test
14447 </li>
14448 <li> Parser_test
14449 </li>
14450 <li> Talk:Parser test
14451 </li>
14452 <li> Talk:Parser_test
14453 </li>
14454 <li> Parser test
14455 </li>
14456 <li> Parser_test
14457 </li>
14458 <li>
14459 </li>
14460 <li>
14461 </li>
14462 <li> 0
14463 </li>
14464 <li> Talk
14465 </li>
14466 <li> Talk
14467 </li>
14468 <li>
14469 </li>
14470 <li>
14471 </li>
14472 <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>
14473 </li>
14474 </ul>
14475
14476 !! end
14477 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14478
14479 !! test
14480 Gallery
14481 !! wikitext
14482 <gallery>
14483 image1.png |
14484 image2.gif|||||
14485
14486 image3|
14487 image4 |300px| centre
14488 image5.svg| http://///////
14489 [[x|xx]]]]
14490 * image6
14491 </gallery>
14492 !! html
14493 <ul class="gallery mw-gallery-traditional">
14494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14495 <div class="thumb" style="height: 150px;">Image1.png</div>
14496 <div class="gallerytext">
14497 </div>
14498 </div></li>
14499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14500 <div class="thumb" style="height: 150px;">Image2.gif</div>
14501 <div class="gallerytext">
14502 <p>||||
14503 </p>
14504 </div>
14505 </div></li>
14506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14507 <div class="thumb" style="height: 150px;">Image3</div>
14508 <div class="gallerytext">
14509 </div>
14510 </div></li>
14511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14512 <div class="thumb" style="height: 150px;">Image4</div>
14513 <div class="gallerytext">
14514 <p>300px| centre
14515 </p>
14516 </div>
14517 </div></li>
14518 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14519 <div class="thumb" style="height: 150px;">Image5.svg</div>
14520 <div class="gallerytext">
14521 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14522 </p>
14523 </div>
14524 </div></li>
14525 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14526 <div class="thumb" style="height: 150px;">* image6</div>
14527 <div class="gallerytext">
14528 </div>
14529 </div></li>
14530 </ul>
14531
14532 !! end
14533
14534 !! test
14535 Gallery (with options)
14536 !! wikitext
14537 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14538 File:Nonexistant.jpg|caption
14539 File:Nonexistant.jpg
14540 image:foobar.jpg|some '''caption''' [[Main Page]]
14541 image:foobar.jpg
14542 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14543 </gallery>
14544 !! html
14545 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14546 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14547 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14548 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14549 <div class="gallerytext">
14550 <p>caption
14551 </p>
14552 </div>
14553 </div></li>
14554 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14555 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14556 <div class="gallerytext">
14557 </div>
14558 </div></li>
14559 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14560 <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>
14561 <div class="gallerytext">
14562 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14563 </p>
14564 </div>
14565 </div></li>
14566 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14567 <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>
14568 <div class="gallerytext">
14569 </div>
14570 </div></li>
14571 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14572 <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>
14573 <div class="gallerytext">
14574 <p>Blabla|blabla.
14575 </p>
14576 </div>
14577 </div></li>
14578 </ul>
14579
14580 !! end
14581
14582 !! test
14583 Gallery with wikitext inside caption
14584 !! wikitext
14585 <gallery>
14586 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14587 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14588 </gallery>
14589 !! html
14590 <ul class="gallery mw-gallery-traditional">
14591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14592 <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>
14593 <div class="gallerytext">
14594 <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>
14595 </p>
14596 </div>
14597 </div></li>
14598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14599 <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>
14600 <div class="gallerytext">
14601 <p>This is a test template
14602 </p>
14603 </div>
14604 </div></li>
14605 </ul>
14606
14607 !! end
14608
14609 !! test
14610 gallery (with showfilename option)
14611 !! wikitext
14612 <gallery showfilename>
14613 File:Nonexistant.jpg|caption
14614 File:Nonexistant.jpg
14615 image:foobar.jpg|some '''caption''' [[Main Page]]
14616 File:Foobar.jpg
14617 </gallery>
14618 !! html
14619 <ul class="gallery mw-gallery-traditional">
14620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14621 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14622 <div class="gallerytext">
14623 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14624 caption
14625 </p>
14626 </div>
14627 </div></li>
14628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14629 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14630 <div class="gallerytext">
14631 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14632 </p>
14633 </div>
14634 </div></li>
14635 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14636 <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>
14637 <div class="gallerytext">
14638 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14639 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14640 </p>
14641 </div>
14642 </div></li>
14643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14644 <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>
14645 <div class="gallerytext">
14646 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14647 </p>
14648 </div>
14649 </div></li>
14650 </ul>
14651
14652 !! end
14653
14654 !! test
14655 Gallery (with namespace-less filenames)
14656 !! wikitext
14657 <gallery>
14658 File:Nonexistant.jpg
14659 Nonexistant.jpg
14660 image:foobar.jpg
14661 foobar.jpg
14662 </gallery>
14663 !! html
14664 <ul class="gallery mw-gallery-traditional">
14665 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14666 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14667 <div class="gallerytext">
14668 </div>
14669 </div></li>
14670 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14671 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14672 <div class="gallerytext">
14673 </div>
14674 </div></li>
14675 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14676 <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>
14677 <div class="gallerytext">
14678 </div>
14679 </div></li>
14680 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14681 <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>
14682 <div class="gallerytext">
14683 </div>
14684 </div></li>
14685 </ul>
14686
14687 !! end
14688
14689 !! test
14690 HTML Hex character encoding (spells the word "JavaScript")
14691 !! wikitext
14692 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14693 !! html
14694 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14695 </p>
14696 !! end
14697
14698 !! test
14699 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14700 !! wikitext
14701 &#xsee;&#XSEE;
14702 !! html
14703 <p>&amp;#xsee;&amp;#XSEE;
14704 </p>
14705 !! end
14706
14707 !! test
14708 HTML Hex character encoding mixed case
14709 !! wikitext
14710 &#xEE;&#Xee;
14711 !! html
14712 <p>&#xee;&#xee;
14713 </p>
14714 !! end
14715
14716 !! test
14717 __FORCETOC__ override
14718 !! wikitext
14719 __NEWSECTIONLINK__
14720 __FORCETOC__
14721 !! html
14722 <p><br />
14723 </p>
14724 !! end
14725
14726 !! test
14727 ISBN code coverage
14728 !! wikitext
14729 ISBN 978-0-1234-56&#x20;789
14730 !! html
14731 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14732 </p>
14733 !! end
14734
14735 !! test
14736 ISBN followed by 5 spaces
14737 !! wikitext
14738 ISBN
14739 !! html
14740 <p>ISBN
14741 </p>
14742 !! end
14743
14744 !! test
14745 Double ISBN
14746 !! wikitext
14747 ISBN ISBN 1234567890
14748 !! html
14749 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14750 </p>
14751 !! end
14752
14753 !! test
14754 ISBN with an X
14755 !! wikitext
14756 ISBN 3-462-04561-X
14757 !! html
14758 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
14759 </p>
14760 !! end
14761
14762 !! test
14763 ISBN with empty prefix (parsoid test)
14764 !! wikitext
14765 ISBN 1234567890
14766 !! html/parsoid
14767 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
14768 !! end
14769
14770 !! test
14771 Bug 22905: <abbr> followed by ISBN followed by </a>
14772 !! wikitext
14773 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14774 !! html
14775 <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>
14776 </p>
14777 !! end
14778
14779 !! test
14780 Double RFC
14781 !! wikitext
14782 RFC RFC 1234
14783 !! html
14784 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14785 </p>
14786 !! end
14787
14788 !! test
14789 Double RFC with a wiki link
14790 !! wikitext
14791 RFC [[RFC 1234]]
14792 !! html
14793 <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>
14794 </p>
14795 !! end
14796
14797 !! test
14798 RFC code coverage
14799 !! wikitext
14800 RFC 983&#x20;987
14801 !! html
14802 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14803 </p>
14804 !! end
14805
14806 !! test
14807 Centre-aligned image
14808 !! wikitext
14809 [[Image:foobar.jpg|centre]]
14810 !! html
14811 <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>
14812
14813 !!end
14814
14815 !! test
14816 None-aligned image
14817 !! wikitext
14818 [[Image:foobar.jpg|none]]
14819 !! html
14820 <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>
14821
14822 !!end
14823
14824 !! test
14825 Width + Height sized image (using px) (height is ignored)
14826 !! wikitext
14827 [[Image:foobar.jpg|640x480px]]
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, no following whitespace)
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 following 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 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14853 !! wikitext
14854 [[Image:foobar.jpg| 640px]]
14855 !! html
14856 <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>
14857 </p>
14858 !!end
14859
14860 !! test
14861 Another italics / bold test
14862 !! wikitext
14863 ''' ''x'
14864 !! html
14865 <pre>'<i> </i>x'
14866 </pre>
14867 !!end
14868
14869 # Note the results may be incorrect, as parserTest output included this:
14870 # XML error: Mismatched tag at byte 6120:
14871 # ...<dd> </dt></dl> </dd...
14872 !! test
14873 dt/dd/dl test
14874 !! options
14875 disabled
14876 !! wikitext
14877 :;;;::
14878 !! html
14879 <dl>
14880 <dd><dl>
14881 <dt><dl>
14882 <dt><dl>
14883 <dt><dl>
14884 <dd><dl>
14885 <dd>
14886 </dd>
14887 </dl>
14888 </dd>
14889 </dl>
14890 </dt>
14891 </dl>
14892 </dt>
14893 </dl>
14894 </dt>
14895 </dl>
14896 </dd>
14897 </dl>
14898
14899 !!end
14900
14901
14902 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14903 !! test
14904 Images with the "|" character in the comment
14905 !! wikitext
14906 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14907 !! html
14908 <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>
14909
14910 !!end
14911
14912 !! test
14913 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14914 !! wikitext
14915 <html><script>alert(1);</script></html>
14916 !! html
14917 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14918 </p>
14919 !! end
14920
14921 !! test
14922 HTML with raw HTML ($wgRawHtml==true)
14923 !! options
14924 wgRawHtml=1
14925 !! wikitext
14926 <html><script>alert(1);</script></html>
14927 !! html
14928 <p><script>alert(1);</script>
14929 </p>
14930 !! end
14931
14932 !! test
14933 Parents of subpages, one level up
14934 !! options
14935 subpage title=[[Subpage test/L1/L2/L3]]
14936 !! wikitext
14937 [[../|L2]]
14938 !! html
14939 <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>
14940 </p>
14941 !! end
14942
14943
14944 !! test
14945 Parents of subpages, one level up, not named
14946 !! options
14947 subpage title=[[Subpage test/L1/L2/L3]]
14948 !! wikitext
14949 [[../]]
14950 !! html
14951 <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>
14952 </p>
14953 !! end
14954
14955
14956
14957 !! test
14958 Parents of subpages, two levels up
14959 !! options
14960 subpage title=[[Subpage test/L1/L2/L3]]
14961 !! wikitext
14962 [[../../|L1]]2
14963
14964 [[../../|L1]]l
14965 !! html
14966 <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
14967 </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>
14968 </p>
14969 !! end
14970
14971 !! test
14972 Parents of subpages, two levels up, without trailing slash or name.
14973 !! options
14974 subpage title=[[Subpage test/L1/L2/L3]]
14975 !! wikitext
14976 [[../..]]
14977 !! html
14978 <p>[[../..]]
14979 </p>
14980 !! end
14981
14982 !! test
14983 Parents of subpages, two levels up, with lots of extra trailing slashes.
14984 !! options
14985 subpage title=[[Subpage test/L1/L2/L3]]
14986 !! wikitext
14987 [[../../////]]
14988 !! html
14989 <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>
14990 </p>
14991 !! end
14992
14993 !! article
14994 Subpage test/L1/L2/L3Sibling
14995 !! text
14996 Sibling article
14997 !! endarticle
14998
14999 !! test
15000 Transclusion of a sibling page (one level up)
15001 !! options
15002 subpage title=[[Subpage test/L1/L2/L3]]
15003 !! wikitext
15004 {{../L3Sibling}}
15005 !! html
15006 <p>Sibling article
15007 </p>
15008 !! end
15009
15010 !! test
15011 Transclusion of a child page
15012 !! options
15013 subpage title=[[Subpage test/L1/L2]]
15014 !! wikitext
15015 {{/L3Sibling}}
15016 !! html
15017 <p>Sibling article
15018 </p>
15019 !! end
15020
15021 !! test
15022 Non-transclusion because of too many up levels
15023 !! options
15024 subpage title=[[Subpage test/L1/L2/L3]]
15025 !! wikitext
15026 {{../../../../More than parent}}
15027 !! html
15028 <p>{{../../../../More than parent}}
15029 </p>
15030 !! end
15031
15032 !! test
15033 Definition list code coverage
15034 !! wikitext
15035 ; title : def
15036 ; title : def
15037 ;title: def
15038 !! html
15039 <dl>
15040 <dt> title &#160;</dt>
15041 <dd> def
15042 </dd>
15043 <dt> title&#160;</dt>
15044 <dd> def
15045 </dd>
15046 <dt>title</dt>
15047 <dd> def
15048 </dd>
15049 </dl>
15050
15051 !! end
15052
15053 !! test
15054 Don't fall for the self-closing div
15055 !! wikitext
15056 <div>hello world</div/>
15057 !! html
15058 <div>hello world</div>
15059
15060 !! end
15061
15062 !! test
15063 MSGNW magic word
15064 !! wikitext
15065 {{MSGNW:msg}}
15066 !! html
15067 <p>&#91;&#91;:Template:Msg&#93;&#93;
15068 </p>
15069 !! end
15070
15071 !! test
15072 RAW magic word
15073 !! wikitext
15074 {{RAW:QUERTY}}
15075 !! html
15076 <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>
15077 </p>
15078 !! end
15079
15080 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15081 !! test
15082 Always escape literal '>' in output, not just after '<'
15083 !! wikitext
15084 ><>
15085 !! html
15086 <p>&gt;&lt;&gt;
15087 </p>
15088 !! end
15089
15090 !! test
15091 Template caching
15092 !! wikitext
15093 {{Test}}
15094 {{Test}}
15095 !! html
15096 <p>This is a test template
15097 This is a test template
15098 </p>
15099 !! end
15100
15101
15102 !! article
15103 MediaWiki:Fake
15104 !! text
15105 ==header==
15106 !! endarticle
15107
15108 !! test
15109 Inclusion of !userCanEdit() content
15110 !! wikitext
15111 {{MediaWiki:Fake}}
15112 !! html
15113 <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>
15114
15115 !! end
15116
15117
15118 !! test
15119 Out-of-order TOC heading levels
15120 !! wikitext
15121 ==2==
15122 ======6======
15123 ===3===
15124 =1=
15125 =====5=====
15126 ==2==
15127 !! html
15128 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15129 <ul>
15130 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15131 <ul>
15132 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15133 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15134 </ul>
15135 </li>
15136 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15137 <ul>
15138 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15139 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15140 </ul>
15141 </li>
15142 </ul>
15143 </div>
15144
15145 <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>
15146 <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>
15147 <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>
15148 <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>
15149 <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>
15150 <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>
15151
15152 !! end
15153
15154
15155 !! test
15156 ISBN with a dummy number
15157 !! wikitext
15158 ISBN ---
15159 !! html
15160 <p>ISBN ---
15161 </p>
15162 !! end
15163
15164
15165 !! test
15166 ISBN with space-delimited number
15167 !! wikitext
15168 ISBN 92 9017 032 8
15169 !! html
15170 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15171 </p>
15172 !! end
15173
15174
15175 !! test
15176 ISBN with multiple spaces, no number
15177 !! wikitext
15178 ISBN foo
15179 !! html
15180 <p>ISBN foo
15181 </p>
15182 !! end
15183
15184
15185 !! test
15186 ISBN length
15187 !! wikitext
15188 ISBN 123456789
15189
15190 ISBN 1234567890
15191
15192 ISBN 12345678901
15193 !! html
15194 <p>ISBN 123456789
15195 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15196 </p><p>ISBN 12345678901
15197 </p>
15198 !! end
15199
15200
15201 !! test
15202 ISBN with trailing year (bug 8110)
15203 !! wikitext
15204 ISBN 1-234-56789-0 - 2006
15205
15206 ISBN 1 234 56789 0 - 2006
15207 !! html
15208 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15209 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15210 </p>
15211 !! end
15212
15213
15214 !! test
15215 anchorencode
15216 !! wikitext
15217 {{anchorencode:foo bar©#%n}}
15218 !! html
15219 <p>foo_bar.C2.A9.23.25n
15220 </p>
15221 !! end
15222
15223 !! test
15224 anchorencode trims spaces
15225 !! wikitext
15226 {{anchorencode: __pretty__please__}}
15227 !! html
15228 <p>pretty_please
15229 </p>
15230 !! end
15231
15232 !! test
15233 anchorencode deals with links
15234 !! wikitext
15235 {{anchorencode: [[hello|world]] [[hi]]}}
15236 !! html
15237 <p>world_hi
15238 </p>
15239 !! end
15240
15241 !! test
15242 anchorencode deals with templates
15243 !! wikitext
15244 {{anchorencode: {{Foo}} }}
15245 !! html
15246 <p>FOO
15247 </p>
15248 !! end
15249
15250 !! test
15251 anchorencode encodes like the TOC generator: (bug 18431)
15252 !! wikitext
15253 === _ +:.3A%3A&&amp;]] ===
15254 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15255 __NOEDITSECTION__
15256 !! html
15257 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15258 <p>.2B:.3A.253A.26.26.5D.5D
15259 </p>
15260 !! end
15261
15262 !! test
15263 Bug 6200: blockquotes and paragraph formatting
15264 !! wikitext
15265 <blockquote>
15266 foo
15267 </blockquote>
15268
15269 bar
15270
15271 baz
15272 !! html
15273 <blockquote>
15274 <p>foo
15275 </p>
15276 </blockquote>
15277 <p>bar
15278 </p>
15279 <pre>baz
15280 </pre>
15281 !! end
15282
15283 !! test
15284 Bug 8293: Use of center tag ruins paragraph formatting
15285 !! wikitext
15286 <center>
15287 foo
15288 </center>
15289
15290 bar
15291
15292 baz
15293 !! html
15294 <center>
15295 <p>foo
15296 </p>
15297 </center>
15298 <p>bar
15299 </p>
15300 <pre>baz
15301 </pre>
15302 !! end
15303
15304 !!test
15305 Parsing of overlapping (improperly nested) inline html tags
15306 !! wikitext
15307 <span><s>x</span></s>
15308 !! html/php
15309 <p><span><s>x&lt;/span&gt;</s></span>
15310 </p>
15311 !! html/parsoid
15312 <p><span><s>x</s></span>
15313 </p>
15314 !!end
15315
15316 ###
15317 ### Language variants related tests
15318 ###
15319 !! test
15320 Self-link in language variants
15321 !! options
15322 title=[[Dunav]] language=sr
15323 !! wikitext
15324 Both [[Dunav]] and [[Дунав]] are names for this river.
15325 !! html
15326 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15327 </p>
15328 !!end
15329
15330 !! article
15331 Дуна
15332 !! text
15333 content
15334 !! endarticle
15335
15336 !! test
15337 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15338 !! options
15339 title=[[Duna]] language=sr
15340 !! wikitext
15341 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15342 !! html
15343 <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.
15344 </p>
15345 !! end
15346
15347 !! test
15348 Link to a section of a variant of this title shouldn't be parsed as self-link
15349 !! options
15350 title=[[Duna]] language=sr
15351 !! wikitext
15352 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15353 !! html
15354 <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.
15355 </p>
15356 !! end
15357
15358 !! test
15359 Link to pages in language variants
15360 !! options
15361 language=sr
15362 !! wikitext
15363 Main Page can be written as [[Маин Паге]]
15364 !! html
15365 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15366 </p>
15367 !!end
15368
15369
15370 !! test
15371 Multiple links to pages in language variants
15372 !! options
15373 language=sr
15374 !! wikitext
15375 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15376 !! html
15377 <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>.
15378 </p>
15379 !!end
15380
15381
15382 !! test
15383 Simple template in language variants
15384 !! options
15385 language=sr
15386 !! wikitext
15387 {{тест}}
15388 !! html
15389 <p>This is a test template
15390 </p>
15391 !! end
15392
15393
15394 !! test
15395 Template with explicit namespace in language variants
15396 !! options
15397 language=sr
15398 !! wikitext
15399 {{Template:тест}}
15400 !! html
15401 <p>This is a test template
15402 </p>
15403 !! end
15404
15405
15406 !! test
15407 Basic test for template parameter in language variants
15408 !! options
15409 language=sr
15410 !! wikitext
15411 {{парамтест|param=foo}}
15412 !! html
15413 <p>This is a test template with parameter foo
15414 </p>
15415 !! end
15416
15417
15418 !! test
15419 Simple category in language variants
15420 !! options
15421 language=sr cat
15422 !! wikitext
15423 [[Category:МедиаWики Усер'с Гуиде]]
15424 !! html
15425 <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>
15426 !! end
15427
15428
15429 !! article
15430 Category:分类
15431 !! text
15432 blah
15433 !! endarticle
15434
15435 !! article
15436 Category:分類
15437 !! text
15438 blah
15439 !! endarticle
15440
15441 !! test
15442 Don't convert blue categorylinks to another variant (bug 33210)
15443 !! options
15444 language=zh cat
15445 !! wikitext
15446 [[A]][[Category:分类]]
15447 !! html
15448 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15449 !! end
15450
15451
15452 !! test
15453 Stripping -{}- tags (language variants)
15454 !! options
15455 language=sr
15456 !! wikitext
15457 Latin proverb: -{Ne nuntium necare}-
15458 !! html
15459 <p>Latin proverb: Ne nuntium necare
15460 </p>
15461 !! end
15462
15463
15464 !! test
15465 Prevent conversion with -{}- tags (language variants)
15466 !! options
15467 language=sr variant=sr-ec
15468 !! wikitext
15469 Latinski: -{Ne nuntium necare}-
15470 !! html
15471 <p>Латински: Ne nuntium necare
15472 </p>
15473 !! end
15474
15475
15476 !! test
15477 Prevent conversion of text with -{}- tags (language variants)
15478 !! options
15479 language=sr variant=sr-ec
15480 !! wikitext
15481 Latinski: -{Ne nuntium necare}-
15482 !! html
15483 <p>Латински: Ne nuntium necare
15484 </p>
15485 !! end
15486
15487
15488 !! test
15489 Prevent conversion of links with -{}- tags (language variants)
15490 !! options
15491 language=sr variant=sr-ec
15492 !! wikitext
15493 -{[[Main Page]]}-
15494 !! html
15495 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15496 </p>
15497 !! end
15498
15499
15500 !! test
15501 -{}- tags within headlines (within html for parserConvert())
15502 !! options
15503 language=sr variant=sr-ec
15504 !! wikitext
15505 == -{Naslov}- ==
15506 !! html
15507 <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>
15508
15509 !! end
15510
15511
15512 !! test
15513 Explicit definition of language variant alternatives
15514 !! options
15515 language=zh variant=zh-tw
15516 !! wikitext
15517 -{zh:China;zh-tw:Taiwan}-, not China
15518 !! html
15519 <p>Taiwan, not China
15520 </p>
15521 !! end
15522
15523
15524 !! test
15525 Conversion around HTML tags
15526 !! options
15527 language=sr variant=sr-ec
15528 !! wikitext
15529 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15530 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15531 !! html
15532 <p>
15533 <span title="ЛаCтин">ски</span>
15534 </p>
15535 !! end
15536
15537
15538 !! test
15539 Explicit session-wise language variant mapping (A flag and - flag)
15540 !! options
15541 language=zh variant=zh-tw
15542 !! wikitext
15543 Taiwan is not China.
15544 But -{A|zh:China;zh-tw:Taiwan}- is China,
15545 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15546 and -{China}- is China.
15547 !! html
15548 <p>Taiwan is not China.
15549 But Taiwan is Taiwan,
15550 (This should be stripped!)
15551 and China is China.
15552 </p>
15553 !! end
15554
15555 !! test
15556 Explicit session-wise language variant mapping (H flag for hide)
15557 !! options
15558 language=zh variant=zh-tw
15559 !! wikitext
15560 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15561 Taiwan is China.
15562 !! html
15563 <p>(This should be stripped!)
15564 Taiwan is Taiwan.
15565 </p>
15566 !! end
15567
15568 !! test
15569 Adding explicit conversion rule for title (T flag)
15570 !! options
15571 language=zh variant=zh-tw showtitle
15572 !! wikitext
15573 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15574 !! html
15575 Taiwan
15576 <p>Should be stripped!
15577 </p>
15578 !! end
15579
15580 !! test
15581 Testing that changing the language variant here in the tests actually works
15582 !! options
15583 language=zh variant=zh showtitle
15584 !! wikitext
15585 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15586 !! html
15587 China
15588 <p>Should be stripped!
15589 </p>
15590 !! end
15591
15592 !! test
15593 Recursive conversion of alt and title attrs shouldn't clear converter state
15594 !! options
15595 language=zh variant=zh-cn showtitle
15596 !! wikitext
15597 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15598 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15599 !! html
15600 China
15601 <p>
15602 Should be stripped<span title="Exclamation">!</span>
15603 </p>
15604 !! end
15605
15606 !! test
15607 Bug 24072: more test on conversion rule for title
15608 !! options
15609 language=zh variant=zh-tw showtitle
15610 !! wikitext
15611 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15612 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15613 !! html
15614 Taiwan
15615 <p>This should be stripped!
15616 This won't take interferes with the title rule.
15617 </p>
15618 !! end
15619
15620 !! test
15621 Partly disable title conversion if variant == main language code
15622 !! options
15623 language=zh variant=zh title=[[ZH]] showtitle
15624 !! wikitext
15625 -{T|zh-cn:CN;zh-tw:TW}-
15626 !! html
15627 ZH
15628 <p>
15629 </p>
15630 !! end
15631
15632 !! test
15633 Partly disable title conversion if variant == main language code, more
15634 !! options
15635 language=zh variant=zh title=[[ZH]] showtitle
15636 !! wikitext
15637 -{T|TW}-
15638 !! html
15639 ZH
15640 <p>
15641 </p>
15642 !! end
15643
15644 !! test
15645 Raw output of variant escape tags (R flag)
15646 !! options
15647 language=zh variant=zh-tw
15648 !! wikitext
15649 Raw: -{R|zh:China;zh-tw:Taiwan}-
15650 !! html
15651 <p>Raw: zh:China;zh-tw:Taiwan
15652 </p>
15653 !! end
15654
15655 !! test
15656 Nested using of manual convert syntax
15657 !! options
15658 language=zh variant=zh-hk
15659 !! wikitext
15660 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15661 !! html
15662 <p>Nested: Hello Hong Kong!
15663 </p>
15664 !! end
15665
15666 !! test
15667 Proper conversion of text in external links
15668 !! options
15669 language=sr variant=sr-ec
15670 !! wikitext
15671 http://www.google.com
15672 gopher://www.google.com
15673 [http://www.google.com http://www.google.com]
15674 [gopher://www.google.com gopher://www.google.com]
15675 [https://www.google.com irc://www.google.com]
15676 [ftp://www.google.com www.google.com/ftp://dir]
15677 [//www.google.com www.google.com]
15678 !! html
15679 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15680 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15681 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15682 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15683 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15684 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15685 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15686 </p>
15687 !! end
15688
15689 !! test
15690 Do not convert roman numbers to language variants
15691 !! options
15692 language=sr variant=sr-ec
15693 !! wikitext
15694 Fridrih IV je car.
15695 !! html
15696 <p>Фридрих IV је цар.
15697 </p>
15698 !! end
15699
15700 !! test
15701 Unclosed language converter markup "-{"
15702 !! options
15703 language=sr
15704 !! wikitext
15705 -{T|hello
15706 !! html
15707 <p>-{T|hello
15708 </p>
15709 !! end
15710
15711 !! test
15712 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15713 !! options
15714 language=sr
15715 !! wikitext
15716 -{R|=&gt;}-
15717 !! html
15718 <p>=&gt;
15719 </p>
15720 !!end
15721
15722 !! test
15723 Don't break link parsing if language converter markup is in the caption.
15724 !! options
15725 language=sr variant=sr-ec
15726 !! wikitext
15727 [[Main Page|-{R|main page}-]]
15728 !! html
15729 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15730 </p>
15731 !! end
15732
15733 # This test is currently broken in the PHP parser (bug 52661)
15734 !! test
15735 Don't break image parsing if language converter markup is in the caption.
15736 !! options
15737 language=sr
15738 disabled
15739 !! wikitext
15740 [[File:Foobar.jpg|-{R|caption}-]]
15741 !! html
15742 <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>
15743 </p>
15744 !! end
15745
15746 # This test is currently broken in the PHP parser (bug 52661)
15747 !! test
15748 Don't break list handling if language converter markup is in the item.
15749 !! options
15750 language=zh variant=zh-cn
15751 disabled
15752 !! wikitext
15753 ;-{zh-cn:AAA;zh-tw:BBB}-
15754 !! html
15755 <dl><dt>AAA
15756 </dt></dl>
15757
15758 !! end
15759
15760 # This test is currently broken in the PHP parser (bug 52661)
15761 !! test
15762 Don't break table handling if language converter markup is in the cell.
15763 !! options
15764 language=sr variant=sr-ec
15765 disabled
15766 !! wikitext
15767 {|
15768 |-
15769 | -{R|B}-
15770 |}
15771 !! html
15772 <table>
15773
15774 <tr>
15775 <td> B
15776 </td></tr></table>
15777
15778 !! end
15779
15780 !! test
15781 Bug 529: Uncovered bullet
15782 !! wikitext
15783 * Foo {{bullet}}
15784 !! html
15785 <ul>
15786 <li> Foo
15787 </li>
15788 <li> Bar
15789 </li>
15790 </ul>
15791
15792 !! end
15793
15794 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15795 # Templates in Wikipedia rely on this behavior, as tidy has always been
15796 # enabled there. These tests are normally run *without* tidy, so specify the
15797 # full output here.
15798 # To test realistic parsing behavior, apply a tidy-like transformation to both
15799 # the expected output and your parser's output.
15800 !! test
15801 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15802 !! wikitext
15803 ******* Foo {{bullet}}
15804 !! html
15805 <ul>
15806 <li><ul>
15807 <li><ul>
15808 <li><ul>
15809 <li><ul>
15810 <li><ul>
15811 <li><ul>
15812 <li> Foo
15813 </li>
15814 </ul>
15815 </li>
15816 </ul>
15817 </li>
15818 </ul>
15819 </li>
15820 </ul>
15821 </li>
15822 </ul>
15823 </li>
15824 </ul>
15825 </li>
15826 <li> Bar
15827 </li>
15828 </ul>
15829
15830 !! end
15831
15832 !! test
15833 Bug 529: Uncovered table already at line-start
15834 !! wikitext
15835 x
15836
15837 {{table}}
15838 y
15839 !! html
15840 <p>x
15841 </p>
15842 <table>
15843 <tr>
15844 <td> 1 </td>
15845 <td> 2
15846 </td></tr>
15847 <tr>
15848 <td> 3 </td>
15849 <td> 4
15850 </td></tr></table>
15851 <p>y
15852 </p>
15853 !! end
15854
15855 !! test
15856 Bug 529: Uncovered bullet in parser function result
15857 !! wikitext
15858 * Foo {{lc:{{bullet}} }}
15859 !! html
15860 <ul>
15861 <li> Foo
15862 </li>
15863 <li> bar
15864 </li>
15865 </ul>
15866
15867 !! end
15868
15869 !! test
15870 Bug 5678: Double-parsed template argument
15871 !! wikitext
15872 {{lc:{{{1}}}|hello}}
15873 !! html
15874 <p>{{{1}}}
15875 </p>
15876 !! end
15877
15878 !! test
15879 Bug 5678: Double-parsed template invocation
15880 !! wikitext
15881 {{lc:{{paramtest {{!}} param = hello }} }}
15882 !! html
15883 <p>{{paramtest | param = hello }}
15884 </p>
15885 !! end
15886
15887 !! test
15888 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15889 !! options
15890 language=cs
15891 title=[[Main Page]]
15892 !! wikitext
15893 {{PRVNÍVELKÉ:ěščř}}
15894 {{prvnívelké:ěščř}}
15895 {{PRVNÍMALÉ:ěščř}}
15896 {{prvnímalé:ěščř}}
15897 {{MALÁ:ěščř}}
15898 {{malá:ěščř}}
15899 {{VELKÁ:ěščř}}
15900 {{velká:ěščř}}
15901 !! html
15902 <p>Ěščř
15903 Ěščř
15904 ěščř
15905 ěščř
15906 ěščř
15907 ěščř
15908 ĚŠČŘ
15909 ĚŠČŘ
15910 </p>
15911 !! end
15912
15913 !! test
15914 Morwen/13: Unclosed link followed by heading
15915 !! wikitext
15916 [[link
15917 ==heading==
15918 !! html
15919 <p>[[link
15920 </p>
15921 <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>
15922
15923 !! end
15924
15925 !! test
15926 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15927 !! wikitext
15928 {{foo|
15929 =heading=
15930 !! html
15931 <p>{{foo|
15932 </p>
15933 <h1><span class="mw-headline" id="heading">heading</span></h1>
15934
15935 !! end
15936
15937 !! test
15938 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15939 !! wikitext
15940 {{foo|
15941 ==heading==
15942 !! html
15943 <p>{{foo|
15944 </p>
15945 <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>
15946
15947 !! end
15948
15949 !! test
15950 Tildes in comments
15951 !! options
15952 pst
15953 !! wikitext
15954 <!-- ~~~~ -->
15955 !! html
15956 <!-- ~~~~ -->
15957 !! end
15958
15959 !! test
15960 Paragraphs inside divs (no extra line breaks)
15961 !! wikitext
15962 <div>Line one
15963
15964 Line two</div>
15965 !! html
15966 <div>Line one
15967 Line two</div>
15968
15969 !! end
15970
15971 !! test
15972 Paragraphs inside divs (extra line break on open)
15973 !! wikitext
15974 <div>
15975 Line one
15976
15977 Line two</div>
15978 !! html
15979 <div>
15980 <p>Line one
15981 </p>
15982 Line two</div>
15983
15984 !! end
15985
15986 !! test
15987 Paragraphs inside divs (extra line break on close)
15988 !! wikitext
15989 <div>Line one
15990
15991 Line two
15992 </div>
15993 !! html
15994 <div>Line one
15995 <p>Line two
15996 </p>
15997 </div>
15998
15999 !! end
16000
16001 !! test
16002 Paragraphs inside divs (extra line break on open and close)
16003 !! wikitext
16004 <div>
16005 Line one
16006
16007 Line two
16008 </div>
16009 !! html
16010 <div>
16011 <p>Line one
16012 </p><p>Line two
16013 </p>
16014 </div>
16015
16016 !! end
16017
16018 !! test
16019 Nesting tags, paragraphs on lines which begin with <div>
16020 !! options
16021 disabled
16022 !! wikitext
16023 <div></div><strong>A
16024 B</strong>
16025 !! html
16026 <div></div>
16027 <p><strong>A
16028 B</strong>
16029 </p>
16030 !! end
16031
16032 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16033 !! test
16034 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16035 !! wikitext
16036 <blockquote>Line one
16037
16038 Line two</blockquote>
16039 !! html
16040 <blockquote>Line one
16041 Line two</blockquote>
16042
16043 !! end
16044
16045 !! test
16046 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16047 !! wikitext
16048 <blockquote>
16049 Line one
16050
16051 Line two</blockquote>
16052 !! html
16053 <blockquote>
16054 <p>Line one
16055 </p>
16056 Line two</blockquote>
16057
16058 !! end
16059
16060 !! test
16061 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16062 !! wikitext
16063 <blockquote>Line one
16064
16065 Line two
16066 </blockquote>
16067 !! html
16068 <blockquote>Line one
16069 <p>Line two
16070 </p>
16071 </blockquote>
16072
16073 !! end
16074
16075 !! test
16076 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16077 !! wikitext
16078 <blockquote>
16079 Line one
16080
16081 Line two
16082 </blockquote>
16083 !! html
16084 <blockquote>
16085 <p>Line one
16086 </p><p>Line two
16087 </p>
16088 </blockquote>
16089
16090 !! end
16091
16092 !! test
16093 Paragraphs inside blockquotes/divs (no extra line breaks)
16094 !! wikitext
16095 <blockquote><div>Line one
16096
16097 Line two</div></blockquote>
16098 !! html
16099 <blockquote><div>Line one
16100 Line two</div></blockquote>
16101
16102 !! end
16103
16104 !! test
16105 Paragraphs inside blockquotes/divs (extra line break on open)
16106 !! wikitext
16107 <blockquote><div>
16108 Line one
16109
16110 Line two</div></blockquote>
16111 !! html
16112 <blockquote><div>
16113 <p>Line one
16114 </p>
16115 Line two</div></blockquote>
16116
16117 !! end
16118
16119 !! test
16120 Paragraphs inside blockquotes/divs (extra line break on close)
16121 !! wikitext
16122 <blockquote><div>Line one
16123
16124 Line two
16125 </div></blockquote>
16126 !! html
16127 <blockquote><div>Line one
16128 <p>Line two
16129 </p>
16130 </div></blockquote>
16131
16132 !! end
16133
16134 !! test
16135 Paragraphs inside blockquotes/divs (extra line break on open and close)
16136 !! wikitext
16137 <blockquote><div>
16138 Line one
16139
16140 Line two
16141 </div></blockquote>
16142 !! html
16143 <blockquote><div>
16144 <p>Line one
16145 </p><p>Line two
16146 </p>
16147 </div></blockquote>
16148
16149 !! end
16150
16151 !! test
16152 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16153 !! options
16154 wgLinkHolderBatchSize=0
16155 !! wikitext
16156 [[meatball:1]]
16157 [[meatball:2]]
16158 [[meatball:3]]
16159 !! html
16160 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16161 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16162 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16163 </p>
16164 !! end
16165
16166 !! test
16167 Free external link invading image caption
16168 !! wikitext
16169 [[Image:Foobar.jpg|thumb|http://x|hello]]
16170 !! html
16171 <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>
16172
16173 !! end
16174
16175 !! test
16176 Bug 15196: localised external link numbers
16177 !! options
16178 language=fa
16179 !! wikitext
16180 [http://en.wikipedia.org/]
16181 !! html
16182 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16183 </p>
16184 !! end
16185
16186 !! test
16187 Multibyte character in padleft
16188 !! wikitext
16189 {{padleft:-Hello|7|Æ}}
16190 !! html
16191 <p>Æ-Hello
16192 </p>
16193 !! end
16194
16195 !! test
16196 Multibyte character in padright
16197 !! wikitext
16198 {{padright:Hello-|7|Æ}}
16199 !! html
16200 <p>Hello-Æ
16201 </p>
16202 !! end
16203
16204 !!test
16205 formatdate parser function
16206 !! wikitext
16207 {{#formatdate:2009-03-24}}
16208 !! html
16209 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16210 </p>
16211 !! end
16212
16213 !!test
16214 formatdate parser function, with default format
16215 !! wikitext
16216 {{#formatdate:2009-03-24|mdy}}
16217 !! html
16218 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16219 </p>
16220 !! end
16221
16222 !! test
16223 Spacing of numbers in formatted dates
16224 !! wikitext
16225 {{#formatdate:January 15}}
16226 !! html
16227 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16228 </p>
16229 !! end
16230
16231 !! test
16232 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
16233 !! options
16234 language=nl title=[[MediaWiki:Common.css]]
16235 !! wikitext
16236 {{#formatdate:2009-03-24|dmy}}
16237 !! html
16238 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16239 </p>
16240 !! end
16241
16242 #
16243 #
16244 #
16245
16246 #
16247 # Edit comments
16248 #
16249
16250 !! test
16251 Edit comment with link
16252 !! options
16253 comment
16254 !! wikitext
16255 I like the [[Main Page]] a lot
16256 !! html
16257 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16258 !!end
16259
16260 !! test
16261 Edit comment with link and link text
16262 !! options
16263 comment
16264 !! wikitext
16265 I like the [[Main Page|best pages]] a lot
16266 !! html
16267 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16268 !!end
16269
16270 !! test
16271 Edit comment with link and link text with suffix
16272 !! options
16273 comment
16274 !! wikitext
16275 I like the [[Main Page|best page]]s a lot
16276 !! html
16277 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16278 !!end
16279
16280 !! test
16281 Edit comment with section link (non-local, eg in history list)
16282 !! options
16283 comment title=[[Main Page]]
16284 !! wikitext
16285 /* External links */ removed bogus entries
16286 !! html
16287 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16288 !!end
16289
16290 !! test
16291 Edit comment with section link and text before it (non-local, eg in history list)
16292 !! options
16293 comment title=[[Main Page]]
16294 !! wikitext
16295 pre-comment text /* External links */ removed bogus entries
16296 !! html
16297 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>
16298 !!end
16299
16300 !! test
16301 Edit comment with section link (local, eg in diff view)
16302 !! options
16303 comment local title=[[Main Page]]
16304 !! wikitext
16305 /* External links */ removed bogus entries
16306 !! html
16307 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16308 !!end
16309
16310 !! test
16311 Edit comment with subpage link (bug 14080)
16312 !! options
16313 comment
16314 subpage
16315 title=[[Subpage test]]
16316 !! wikitext
16317 Poked at a [[/subpage]] here...
16318 !! html
16319 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16320 !!end
16321
16322 !! test
16323 Edit comment with subpage link and link text (bug 14080)
16324 !! options
16325 comment
16326 subpage
16327 title=[[Subpage test]]
16328 !! wikitext
16329 Poked at a [[/subpage|neat little page]] here...
16330 !! html
16331 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16332 !!end
16333
16334 !! test
16335 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16336 !! options
16337 comment
16338 title=[[Subpage test]]
16339 !! wikitext
16340 Poked at a [[/subpage]] here...
16341 !! html
16342 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...
16343 !!end
16344
16345 !! test
16346 Edit comment with bare anchor link (local, as on diff)
16347 !! options
16348 comment
16349 local
16350 title=[[Main Page]]
16351 !! wikitext
16352 [[#section]]
16353 !! html
16354 <a href="#section">#section</a>
16355 !! end
16356
16357 !! test
16358 Edit comment with bare anchor link (non-local, as on history)
16359 !! options
16360 comment
16361 title=[[Main Page]]
16362 !! wikitext
16363 [[#section]]
16364 !! html
16365 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16366 !! end
16367
16368 !! test
16369 Anchor starting with underscore
16370 !! wikitext
16371 [[#_ref|One]]
16372 !! html
16373 <p><a href="#_ref">One</a>
16374 </p>
16375 !! end
16376
16377 !! test
16378 Id starting with underscore
16379 !! wikitext
16380 <div id="_ref"></div>
16381 !! html
16382 <div id="_ref"></div>
16383
16384 !! end
16385
16386 !! test
16387 Space normalisation on autocomment (bug 22784)
16388 !! options
16389 comment
16390 title=[[Main Page]]
16391 !! wikitext
16392 /* __hello__world__ */
16393 !! html
16394 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16395 !! end
16396
16397 !! test
16398 percent-encoding and + signs in comments (Bug 26410)
16399 !! options
16400 comment
16401 !! wikitext
16402 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16403 !! html
16404 <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>
16405 !! end
16406
16407 !! test
16408 Bad images - basic functionality
16409 !! options
16410 disabled
16411 !! wikitext
16412 [[File:Bad.jpg]]
16413 !! html
16414 !! end
16415
16416 !! test
16417 Bad images - bug 16039: text after bad image disappears
16418 !! options
16419 disabled
16420 !! wikitext
16421 Foo bar
16422 [[File:Bad.jpg]]
16423 Bar foo
16424 !! html
16425 <p>Foo bar
16426 </p><p>Bar foo
16427 </p>
16428 !! end
16429
16430 !! test
16431 Verify that displaytitle works (bug #22501) no displaytitle
16432 !! options
16433 showtitle
16434 !! config
16435 wgAllowDisplayTitle=true
16436 wgRestrictDisplayTitle=false
16437 !! wikitext
16438 this is not the the title
16439 !! html
16440 Parser test
16441 <p>this is not the the title
16442 </p>
16443 !! end
16444
16445 !! test
16446 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16447 !! options
16448 showtitle
16449 title=[[Screen]]
16450 !! config
16451 wgAllowDisplayTitle=true
16452 wgRestrictDisplayTitle=false
16453 !! wikitext
16454 this is not the the title
16455 {{DISPLAYTITLE:whatever}}
16456 !! html
16457 whatever
16458 <p>this is not the the title
16459 </p>
16460 !! end
16461
16462 !! test
16463 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16464 !! options
16465 showtitle
16466 title=[[Screen]]
16467 !! config
16468 wgAllowDisplayTitle=true
16469 wgRestrictDisplayTitle=true
16470 !! wikitext
16471 this is not the the title
16472 {{DISPLAYTITLE:whatever}}
16473 !! html
16474 Screen
16475 <p>this is not the the title
16476 </p>
16477 !! end
16478
16479 !! test
16480 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16481 !! options
16482 showtitle
16483 title=[[Screen]]
16484 !! config
16485 wgAllowDisplayTitle=true
16486 wgRestrictDisplayTitle=true
16487 !! wikitext
16488 this is not the the title
16489 {{DISPLAYTITLE:screen}}
16490 !! html
16491 screen
16492 <p>this is not the the title
16493 </p>
16494 !! end
16495
16496 !! test
16497 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16498 !! options
16499 showtitle
16500 title=[[Screen]]
16501 !! config
16502 wgAllowDisplayTitle=false
16503 !! wikitext
16504 this is not the the title
16505 {{DISPLAYTITLE:screen}}
16506 !! html
16507 Screen
16508 <p>this is not the the title
16509 <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>
16510 </p>
16511 !! end
16512
16513 !! test
16514 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16515 !! options
16516 showtitle
16517 title=[[Screen]]
16518 !! config
16519 wgAllowDisplayTitle=false
16520 !! wikitext
16521 this is not the the title
16522 !! html
16523 Screen
16524 <p>this is not the the title
16525 </p>
16526 !! end
16527
16528 !! test
16529 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16530 !! options
16531 showtitle
16532 title=[[Screen]]
16533 !! config
16534 wgAllowDisplayTitle=true
16535 wgRestrictDisplayTitle=true
16536 !! wikitext
16537 this is not the the title
16538 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16539 !! html
16540 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16541 <p>this is not the the title
16542 </p>
16543 !! end
16544
16545 !! test
16546 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16547 !! options
16548 showtitle
16549 title=[[Screen]]
16550 !! config
16551 wgAllowDisplayTitle=true
16552 wgRestrictDisplayTitle=true
16553 !! wikitext
16554 this is not the the title
16555 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16556 !! html
16557 <span style="color: red;">s</span>creen
16558 <p>this is not the the title
16559 </p>
16560 !! end
16561
16562 !! test
16563 preload: check <noinclude> and <includeonly>
16564 !! options
16565 preload
16566 !! wikitext
16567 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16568 !! html
16569 Hello kind world.
16570 !! end
16571
16572 !! test
16573 preload: check <onlyinclude>
16574 !! options
16575 preload
16576 !! wikitext
16577 Goodbye <onlyinclude>Hello world</onlyinclude>
16578 !! html
16579 Hello world
16580 !! end
16581
16582 !! test
16583 preload: can pass tags through if we want to
16584 !! options
16585 preload
16586 !! wikitext
16587 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16588 !! html
16589 <includeonly>Hello world</includeonly>
16590 !! end
16591
16592 !! test
16593 preload: check that it doesn't try to do tricks
16594 !! options
16595 preload
16596 !! wikitext
16597 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16598 !! html
16599 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16600 !! end
16601
16602 !! test
16603 Play a bit with r67090 and bug 3158
16604 !! options
16605 disabled
16606 !! wikitext
16607 <div style="width:50% !important">&nbsp;</div>
16608 <div style="width:50%&nbsp;!important">&nbsp;</div>
16609 <div style="width:50%&#160;!important">&nbsp;</div>
16610 <div style="border : solid;">&nbsp;</div>
16611 !! html
16612 <div style="width:50% !important">&nbsp;</div>
16613 <div style="width:50% !important">&nbsp;</div>
16614 <div style="width:50% !important">&nbsp;</div>
16615 <div style="border&#160;: solid;">&nbsp;</div>
16616
16617 !! end
16618
16619 !! test
16620 HTML5 data attributes
16621 !! wikitext
16622 <span data-foo="bar">Baz</span>
16623 <p data-abc-def_hij="">Quuz</p>
16624 !! html
16625 <p><span data-foo="bar">Baz</span>
16626 </p>
16627 <p data-abc-def_hij="">Quuz</p>
16628
16629 !! end
16630
16631 !! test
16632 percent-encoding and + signs in internal links (Bug 26410)
16633 !! wikitext
16634 [[User:+%]] [[Page+title%]]
16635 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16636 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16637 [[%33%45]] [[%33%45+]]
16638 !! html
16639 <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>
16640 <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>
16641 <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>
16642 <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>
16643 </p>
16644 !! end
16645
16646 !! test
16647 Special characters in embedded file links (bug 27679)
16648 !! wikitext
16649 [[File:Contains & ampersand.jpg]]
16650 [[File:Does not exist.jpg|Title with & ampersand]]
16651 !! html
16652 <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>
16653 <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>
16654 </p>
16655 !! end
16656
16657
16658 !! test
16659 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16660 !! wikitext
16661 Text&apos;s been normalized?
16662 !! html
16663 <p>Text&#39;s been normalized?
16664 </p>
16665 !! end
16666
16667 !! test
16668 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16669 !! wikitext
16670 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16671 !! html
16672 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16673 </p>
16674 !! end
16675
16676 !! test
16677 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16678 !! wikitext
16679 [http://www.example.org/ ideograms]
16680 !! html
16681 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16682 </p>
16683 !! end
16684
16685 !! test
16686 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16687 !! wikitext
16688 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16689 !! html
16690 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16691 </p>
16692 !! end
16693
16694 !! article
16695 Mediawiki:loop1
16696 !! text
16697 {{Identical|A}}
16698 !! endarticle
16699
16700 !! article
16701 Mediawiki:loop2
16702 !! text
16703 {{Identical|B}}
16704 !! endarticle
16705
16706 !! article
16707 Template:Identical
16708 !! text
16709 {{int:loop1}}
16710 {{int:loop2}}
16711 !! endarticle
16712
16713 !! test
16714 Bug 31098 Template which includes system messages which includes the template
16715 !! wikitext
16716 {{Identical}}
16717 !! html
16718 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16719 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16720 </p>
16721 !! end
16722
16723 !! test
16724 Bug31490 Turkish: ucfirst 'blah'
16725 !! options
16726 language=tr
16727 !! wikitext
16728 {{ucfirst:blah}}
16729 !! html
16730 <p>Blah
16731 </p>
16732 !! end
16733
16734 !! test
16735 Bug31490 Turkish: ucfirst 'ix'
16736 !! options
16737 language=tr
16738 !! wikitext
16739 {{ucfirst:ix}}
16740 !! html
16741 <p>İx
16742 </p>
16743 !! end
16744
16745 !! test
16746 Bug31490 Turkish: lcfirst 'BLAH'
16747 !! options
16748 language=tr
16749 !! wikitext
16750 {{lcfirst:BLAH}}
16751 !! html
16752 <p>bLAH
16753 </p>
16754 !! end
16755
16756 !! test
16757 Bug31490 Turkish: ucfırst (with a dotless i)
16758 !! options
16759 language=tr
16760 !! wikitext
16761 {{ucfırst:blah}}
16762 !! html
16763 <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>
16764 </p>
16765 !! end
16766
16767 !! test
16768 Bug31490 ucfırst (with a dotless i) with English language
16769 !! options
16770 language=en
16771 !! wikitext
16772 {{ucfırst:blah}}
16773 !! html
16774 <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>
16775 </p>
16776 !! end
16777
16778 !! test
16779 Bug 26375: TOC with italics
16780 !! options
16781 title=[[Main Page]]
16782 !! wikitext
16783 __TOC__
16784 == ''Lost'' episodes ==
16785 !! html
16786 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16787 <ul>
16788 <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>
16789 </ul>
16790 </div>
16791
16792 <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>
16793
16794 !! end
16795
16796 !! test
16797 Bug 26375: TOC with bold
16798 !! options
16799 title=[[Main Page]]
16800 !! wikitext
16801 __TOC__
16802 == '''should be bold''' then normal text ==
16803 !! html
16804 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16805 <ul>
16806 <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>
16807 </ul>
16808 </div>
16809
16810 <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>
16811
16812 !! end
16813
16814 !! test
16815 Bug 33845: Headings become cursive in TOC when they contain an image
16816 !! options
16817 title=[[Main Page]]
16818 !! wikitext
16819 __TOC__
16820 == Image [[Image:foobar.jpg]] ==
16821 !! html
16822 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16823 <ul>
16824 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16825 </ul>
16826 </div>
16827
16828 <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>
16829
16830 !! end
16831
16832 !! test
16833 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16834 !! options
16835 title=[[Main Page]]
16836 !! wikitext
16837 __TOC__
16838 == <blockquote>Quote</blockquote> ==
16839 !! html
16840 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16841 <ul>
16842 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16843 </ul>
16844 </div>
16845
16846 <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>
16847
16848 !! end
16849
16850 !! test
16851 Unclosed tags in TOC
16852 !! options
16853 title=[[Main Page]]
16854 !! wikitext
16855 __TOC__
16856 == Proof: 2 < 3 ==
16857 <small>Hanc marginis exiguitas non caperet.</small>
16858 QED
16859 !! html
16860 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16861 <ul>
16862 <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>
16863 </ul>
16864 </div>
16865
16866 <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>
16867 <p><small>Hanc marginis exiguitas non caperet.</small>
16868 QED
16869 </p>
16870 !! end
16871
16872 !! test
16873 Multiple tags in TOC
16874 !! wikitext
16875 __TOC__
16876 == <i>Foo</i> <b>Bar</b> ==
16877
16878 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16879 !! html
16880 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16881 <ul>
16882 <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>
16883 <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>
16884 </ul>
16885 </div>
16886
16887 <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>
16888 <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>
16889
16890 !! end
16891
16892 !! test
16893 Tags with parameters in TOC
16894 !! wikitext
16895 __TOC__
16896 == <sup class="in-h2">Hello</sup> ==
16897
16898 == <sup class="a > b">Evilbye</sup> ==
16899 !! html
16900 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16901 <ul>
16902 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16903 <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>
16904 </ul>
16905 </div>
16906
16907 <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>
16908 <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>
16909
16910 !! end
16911
16912 !! test
16913 span tags with directionality in TOC
16914 !! wikitext
16915 __TOC__
16916 == <span dir="ltr">C++</span> ==
16917
16918 == <span dir="rtl">זבנג!</span> ==
16919
16920 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16921
16922 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16923
16924 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16925 !! html
16926 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16927 <ul>
16928 <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>
16929 <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>
16930 <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>
16931 <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>
16932 <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>
16933 </ul>
16934 </div>
16935
16936 <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>
16937 <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>
16938 <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>
16939 <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>
16940 <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>
16941
16942 !! end
16943
16944 !! article
16945 MediaWiki:Bug32057
16946 !! text
16947 == {{int:headline_sample}} ==
16948 !! endarticle
16949
16950 !! test
16951 Bug 32057: Title needed when expanding <h> nodes.
16952 !! options
16953 title=[[Main Page]]
16954 !! wikitext
16955 {{int:Bug32057}}
16956 !! html
16957 <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>
16958
16959 !! end
16960
16961 !! test
16962 Strip marker in urlencode
16963 !! wikitext
16964 {{urlencode:x<nowiki/>y}}
16965 {{urlencode:x<nowiki/>y|wiki}}
16966 {{urlencode:x<nowiki/>y|path}}
16967 !! html
16968 <p>xy
16969 xy
16970 xy
16971 </p>
16972 !! end
16973
16974 !! test
16975 Strip marker in lc
16976 !! wikitext
16977 {{lc:x<nowiki/>y}}
16978 !! html
16979 <p>xy
16980 </p>
16981 !! end
16982
16983 !! test
16984 Strip marker in uc
16985 !! wikitext
16986 {{uc:x<nowiki/>y}}
16987 !! html
16988 <p>XY
16989 </p>
16990 !! end
16991
16992 !! test
16993 Strip marker in formatNum
16994 !! wikitext
16995 {{formatnum:1<nowiki/>2}}
16996 {{formatnum:1<nowiki/>2|R}}
16997 !! html
16998 <p>12
16999 12
17000 </p>
17001 !! end
17002
17003 !! test
17004 Check noCommafy in formatNum
17005 !! options
17006 language=be-tarask
17007 !! wikitext
17008 {{formatnum:123456.78}}
17009 {{formatnum:123456.78|NOSEP}}
17010 !! html
17011 <p>123 456,78
17012 123456.78
17013 </p>
17014 !! end
17015
17016 !! test
17017 Wrong option for formatNum (bug 56199)
17018 !! wikitext
17019 {{formatnum:1,234.56|Random}}
17020 {{formatnum:1,234.56|EVERYTHING}}
17021 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17022 !! html
17023 <p>1,234.56
17024 1,234.56
17025 1,234.56
17026 </p>
17027 !! end
17028
17029 !! test
17030 Strip marker in grammar
17031 !! options
17032 language=fi
17033 !! wikitext
17034 {{grammar:elative|foo<nowiki/>bar}}
17035 !! html
17036 <p>foobarista
17037 </p>
17038 !! end
17039
17040 !! test
17041 Strip marker in padleft
17042 !! wikitext
17043 {{padleft:|2|x<nowiki/>y}}
17044 !! html
17045 <p>xy
17046 </p>
17047 !! end
17048
17049 !! test
17050 Strip marker in padright
17051 !! wikitext
17052 {{padright:|2|x<nowiki/>y}}
17053 !! html
17054 <p>xy
17055 </p>
17056 !! end
17057
17058 !! test
17059 Strip marker in anchorencode
17060 !! wikitext
17061 {{anchorencode:x<nowiki/>y}}
17062 !! html
17063 <p>xy
17064 </p>
17065 !! end
17066
17067 !! test
17068 nowiki inside link inside heading (bug 18295)
17069 !! wikitext
17070 ==[[foo|x<nowiki>y</nowiki>z]]==
17071 !! html
17072 <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>
17073
17074 !! end
17075
17076 !! test
17077 new support for bdi element (bug 31817)
17078 !! wikitext
17079 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17080 !! html
17081 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17082
17083 !!end
17084
17085 !! test
17086 Ignore pipe between table row attributes
17087 !! wikitext
17088 {|
17089 | quux
17090 |- id=foo | style='color: red'
17091 | bar
17092 |}
17093 !! html
17094 <table>
17095 <tr>
17096 <td> quux
17097 </td></tr>
17098 <tr id="foo" style="color: red">
17099 <td> bar
17100 </td></tr></table>
17101
17102 !! end
17103
17104 !!test
17105 Gallery override link with WikiLink (bug 34852)
17106 !! wikitext
17107 <gallery>
17108 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17109 </gallery>
17110 !! html
17111 <ul class="gallery mw-gallery-traditional">
17112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17113 <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>
17114 <div class="gallerytext">
17115 <p>caption
17116 </p>
17117 </div>
17118 </div></li>
17119 </ul>
17120
17121 !! end
17122
17123 !!test
17124 Gallery override link with absolute external link (bug 34852)
17125 !! wikitext
17126 <gallery>
17127 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17128 </gallery>
17129 !! html
17130 <ul class="gallery mw-gallery-traditional">
17131 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17132 <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>
17133 <div class="gallerytext">
17134 <p>caption
17135 </p>
17136 </div>
17137 </div></li>
17138 </ul>
17139
17140 !! end
17141
17142 !!test
17143 Gallery override link with malicious javascript (bug 34852)
17144 !! wikitext
17145 <gallery>
17146 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17147 </gallery>
17148 !! html
17149 <ul class="gallery mw-gallery-traditional">
17150 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17151 <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>
17152 <div class="gallerytext">
17153 <p>caption
17154 </p>
17155 </div>
17156 </div></li>
17157 </ul>
17158
17159 !! end
17160
17161 !!test
17162 Gallery with invalid title as link (bug 43964)
17163 !! wikitext
17164 <gallery>
17165 File:foobar.jpg|link=<
17166 </gallery>
17167 !! html
17168 <ul class="gallery mw-gallery-traditional">
17169 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17170 <div class="thumb" style="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>
17171 <div class="gallerytext">
17172 </div>
17173 </div></li>
17174 </ul>
17175
17176 !! end
17177
17178 !!test
17179 Language parser function
17180 !! wikitext
17181 {{#language:ar}}
17182 !! html
17183 <p>العربية
17184 </p>
17185 !! end
17186
17187 !!test
17188 Padleft and padright as substr
17189 !! wikitext
17190 {{padleft:|3|abcde}}
17191 {{padright:|3|abcde}}
17192 !! html
17193 <p>abc
17194 abc
17195 </p>
17196 !! end
17197
17198 !!test
17199 Special parser function
17200 !! wikitext
17201 {{#special:RandomPage}}
17202 {{#special:BaDtItLe}}
17203 {{#special:Foobar}}
17204 !! html
17205 <p>Special:Random
17206 Special:Badtitle
17207 Special:Foobar
17208 </p>
17209 !! end
17210
17211 !!test
17212 Bug 34939 - Case insensitive link parsing ([HttP://])
17213 !! wikitext
17214 [HttP://MediaWiki.Org/]
17215 !! html
17216 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17217 </p>
17218 !! end
17219
17220 !!test
17221 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17222 !! wikitext
17223 [HttP://MediaWiki.Org/ MediaWiki]
17224 !! html
17225 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17226 </p>
17227 !! end
17228
17229 !!test
17230 Bug 34939 - Case insensitive link parsing (HttP://)
17231 !! wikitext
17232 HttP://MediaWiki.Org/
17233 !! html
17234 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17235 </p>
17236 !! end
17237
17238 !!test
17239 Disable TOC
17240 !! options
17241 notoc
17242 !! wikitext
17243 Lead
17244 == Section 1 ==
17245 == Section 2 ==
17246 == Section 3 ==
17247 == Section 4 ==
17248 == Section 5 ==
17249 !! html
17250 <p>Lead
17251 </p>
17252
17253 <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>
17254 <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>
17255 <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>
17256 <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>
17257 <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>
17258
17259 !! end
17260
17261
17262 ###
17263 ### Parsoids-specific tests
17264 ### Parsoid-PHP parser incompatibilities
17265 ###
17266 !!test
17267 1. SOL-sensitive wikitext tokens as template-args
17268 !!options
17269 parsoid=wt2html,wt2wt
17270 !! wikitext
17271 {{echo|*a}}
17272 {{echo|#a}}
17273 {{echo|:a}}
17274 !! html
17275 <span about="#mwt1" typeof="mw:Transclusion">
17276 </span><ul about="#mwt1"><li>a</li>
17277 </ul>
17278 <span about="#mwt2" typeof="mw:Transclusion">
17279 </span><ol about="#mwt2"><li>a</li>
17280 </ol>
17281 <span about="#mwt3" typeof="mw:Transclusion">
17282 </span><dl about="#mwt3"><dd>a</dd>
17283 </dl>
17284 !!end
17285
17286 #### ----------------------------------------------------------------
17287 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17288 #### tags. Parsoid's output for these tags differs from that of the
17289 #### PHP parser.
17290 #### ----------------------------------------------------------------
17291
17292 !!test
17293 Ref: 1. ref-location should be replaced with an index span
17294 !!options
17295 parsoid
17296 !! wikitext
17297 A <ref>foo</ref>
17298 B <ref name="x">foo</ref>
17299 C <ref name="y" />
17300 !! html
17301 <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>
17302 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>
17303 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>
17304 !!end
17305
17306 !!test
17307 Ref: 2. ref-tags with identical names should all get the same index
17308 !!options
17309 parsoid
17310 !! wikitext
17311 A <ref name="x">foo</ref>
17312 B <ref name="x" />
17313 !! html
17314 <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>
17315 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>
17316 !!end
17317
17318 !!test
17319 Ref: 3. spaces in ref-names should be ignored
17320 !!options
17321 parsoid
17322 !! wikitext
17323 A <ref name="x">foo</ref>
17324 B <ref name=" x " />
17325 C <ref name= x />
17326 !! html
17327 <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>
17328 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>
17329 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>
17330 !!end
17331
17332 !!test
17333 Ref: 4. 'constructor' should be accepted as a valid ref-name
17334 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17335 !!options
17336 parsoid
17337 !! wikitext
17338 A <ref name="constructor">foo</ref>
17339 !! html
17340 <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>
17341 !!end
17342
17343 !!test
17344 Ref: 5. body should accept generic wikitext
17345 !!options
17346 parsoid
17347 !! wikitext
17348 A <ref>
17349 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17350 </ref>
17351
17352 <references />
17353 !! html
17354 <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>
17355
17356 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17357 <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>
17358 </li>
17359 </ol>
17360 !!end
17361
17362 !!test
17363 Ref: 6. indent-pres should not be output in ref-body
17364 !!options
17365 parsoid
17366 !! wikitext
17367 A <ref>
17368 foo
17369 bar
17370 baz
17371 </ref>
17372
17373 <references />
17374 !! html
17375 <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>
17376
17377 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17378 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17379 bar
17380 baz
17381 </li>
17382 </ol>
17383 !!end
17384
17385 !!test
17386 Ref: 7. No p-wrapping in ref-body
17387 !!options
17388 parsoid
17389 !! wikitext
17390 A <ref>
17391 foo
17392
17393 bar
17394
17395
17396 baz
17397
17398
17399
17400 booz
17401 </ref>
17402
17403 <references />
17404 !! html
17405 <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>
17406
17407 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17408 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17409
17410 bar
17411
17412
17413 baz
17414
17415
17416
17417 booz
17418 </li>
17419 </ol>
17420 !!end
17421
17422 !!test
17423 Ref: 8. transclusion wikitext has lower precedence
17424 !!options
17425 parsoid
17426 !! wikitext
17427 A <ref> foo {{echo|</ref> B C}}
17428
17429 <references />
17430 !! html
17431 <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>
17432 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17433 <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>
17434 </ol>
17435 !!end
17436
17437 !!test
17438 Ref: 9. unclosed comments should not leak out of ref-body
17439 !!options
17440 parsoid
17441 !! wikitext
17442 A <ref> foo <!--</ref> B C
17443 <references />
17444 !! html
17445 <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>
17446 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17447 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17448 </ol>
17449 !!end
17450
17451 !!test
17452 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17453 !!options
17454 parsoid
17455 !! wikitext
17456 A <ref> <b> foo </ref> B C
17457
17458 <references />
17459 !! html
17460 <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>
17461
17462
17463 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17464 <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>
17465 </ol>
17466 !!end
17467
17468 !!test
17469 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17470 !!options
17471 parsoid
17472 !! wikitext
17473 A <ref>foo</ref> B
17474 C <ref>bar</ref> D
17475 !! html
17476 <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
17477 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>
17478 !!end
17479
17480 !!test
17481 Ref: 12. ref-tags act as trailing newline migration barrier
17482 !!options
17483 parsoid
17484 !! wikitext
17485 <!--the newline at the end of this line moves out of the p-tag-->a
17486
17487 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17488 <ref />
17489
17490 c
17491 !! html
17492 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17493
17494
17495 <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>
17496 <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>
17497
17498
17499 <p>c</p>
17500 !!end
17501
17502 !!test
17503 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17504 !!options
17505 parsoid
17506 !! wikitext
17507 <ref>foo</ref> A
17508 <ref>bar
17509 </ref> B
17510 !! html
17511 <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
17512 <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>
17513 !!end
17514
17515 !!test
17516 Ref: 14. A nested ref-tag should be emitted as plain text
17517 !!options
17518 parsoid
17519 !! wikitext
17520 <ref>foo <ref>bar</ref> baz</ref>
17521
17522 <references />
17523 !! html
17524 <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>
17525
17526 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17527 <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>
17528 </ol>
17529 !!end
17530
17531 !!test
17532 Ref: 15. ref-tags with identical names should get identical indexes
17533 !!options
17534 parsoid
17535 !! wikitext
17536 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17537 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17538
17539 <references />
17540 !! html
17541 <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>
17542 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>
17543
17544 <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>
17545 </ol>
17546 !!end
17547
17548 ## We don't bother wt2wt-ing non-standard whitespace
17549 !!test
17550 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17551 !!options
17552 parsoid=wt2html
17553 !! wikitext
17554 A <ref >foo</ref >
17555
17556 <references />
17557 !! html
17558 <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>
17559
17560 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17561 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17562 !!end
17563
17564 !!test
17565 References: 1. references tag without any refs should be handled properly
17566 !!options
17567 parsoid
17568 !! wikitext
17569 <references />
17570 !! html
17571 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17572 !!end
17573
17574 !!test
17575 References: 2. references tag with group only outputs references from that group
17576 !!options
17577 parsoid
17578 !! wikitext
17579 A <ref group="a">foo</ref>
17580 B <ref group="b">bar</ref>
17581
17582 <references group="a" />
17583 !! html
17584 <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>
17585 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>
17586
17587 <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>
17588 </ol>
17589 !!end
17590
17591 !!test
17592 References: 3. ref list should be cleared after processing references
17593 !!options
17594 parsoid
17595 !! wikitext
17596 A <ref>foo</ref>
17597
17598 <references />
17599
17600 B <ref>bar</ref>
17601
17602 <references />
17603 !! html
17604 <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>
17605
17606 <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>
17607 </ol>
17608
17609 <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>
17610
17611 <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>
17612 </ol>
17613 !!end
17614
17615 !!test
17616 References: 4. only referenced group should be cleared after processing references
17617 !!options
17618 parsoid
17619 !! wikitext
17620 A <ref group="a">afoo</ref>
17621 B <ref>bfoo</ref>
17622
17623 <references group="a" />
17624
17625 C <ref>cfoo</ref>
17626
17627 <references />
17628 !! html
17629 <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>
17630 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>
17631
17632 <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>
17633 </ol>
17634
17635 <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>
17636
17637 <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>
17638 </ol>
17639 !!end
17640
17641 !!test
17642 References: 5. ref tags in references should be processed while ignoring all other content
17643 !!options
17644 parsoid
17645 !! wikitext
17646 A <ref name="a" />
17647 B <ref name="b">bar</ref>
17648
17649 <references>
17650 <ref name="a">foo</ref>
17651 This should just get lost.
17652 </references>
17653 !! html
17654 <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>
17655 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>
17656
17657
17658 <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":{}}'>
17659 <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>
17660 <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>
17661 </ol>
17662 !!end
17663
17664 !!test
17665 References: 6. <references /> from a transclusion
17666 !!options
17667 parsoid
17668 !! wikitext
17669 <ref>Foo</ref> {{echo|<references />}}
17670 !! html
17671 <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>
17672 !!end
17673
17674 !! test
17675 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17676 !! options
17677 parsoid
17678 !! wikitext
17679 A <ref>foo bar for a</ref>
17680 B <ref group="X" name="b" />
17681
17682 <references />
17683
17684 <references group="X">
17685 <ref name="b">foo</ref>
17686 </references>
17687 !! html
17688 <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>
17689 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>
17690
17691 <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>
17692
17693 <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>
17694 !! end
17695
17696 # This test is wt2html only because we're permitting the serializer to produce
17697 # dirty diffs, normalizing the unclosed references to the self-closed version.
17698 !! test
17699 Generate references for unclosed references tag
17700 !! options
17701 parsoid=wt2html
17702 !! wikitext
17703 a<ref>foo</ref>
17704
17705 <references>
17706 !! html
17707 <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>
17708
17709
17710 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17711 <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>
17712 !! end
17713
17714 !! test
17715 New reference serializes on its own line
17716 !! options
17717 parsoid=wt2wt,html2wt
17718 !! wikitext
17719 foo
17720 <references />
17721 !! html
17722 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17723 !! end
17724
17725 #### ----------------------------------------------------------------
17726 #### The following section of tests are primarily to test
17727 #### wikitext escaping capabilities of Parsoid. Given that
17728 #### escaping can be done any number of ways, the wikitext (input)
17729 #### is always adjusted to reflect how Parsoid adds nowiki
17730 #### escape tags.
17731 ####
17732 #### We are marking several tests as parsoid-only since the
17733 #### HTML in the result section is different from what the
17734 #### PHP parser generates for it.
17735 #### ----------------------------------------------------------------
17736
17737
17738 #### --------------- Headings ---------------
17739 #### 0. Unnested
17740 #### 1. Nested inside html <h1>=foo=</h1>
17741 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17742 #### 3. Nested inside html with wikitext split by html tags
17743 #### 4. No escape needed
17744 #### 5. Empty headings <h1></h1>
17745 #### 6. Heading chars in SOL context
17746 #### ----------------------------------------
17747 !! test
17748 Headings: 0. Unnested
17749 !! options
17750 parsoid
17751 !! wikitext
17752 <nowiki>=foo=</nowiki>
17753
17754 <nowiki> =foo= </nowiki>
17755 <!--cmt-->
17756 <nowiki>=foo=</nowiki>
17757
17758 =foo''a''<nowiki>=</nowiki>
17759 !! html
17760 <p><span typeof="mw:Nowiki">=foo=</span></p>
17761
17762 <p><span typeof="mw:Nowiki"> =foo= </span>
17763 <!--cmt-->
17764 <span typeof="mw:Nowiki">=foo=</span></p>
17765
17766 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17767 !!end
17768
17769 !! test
17770 Headings: 1. Nested inside html
17771 (New headings and existing headings are handled differently)
17772 !! options
17773 parsoid=html2wt
17774 !! wikitext
17775 = =foo= =
17776
17777 == =foo= ==
17778
17779 === =foo= ===
17780
17781 =<nowiki>=foo=</nowiki>=
17782 ==<nowiki>=foo=</nowiki>==
17783 ===<nowiki>=foo=</nowiki>===
17784 ====<nowiki>=foo=</nowiki>====
17785 =====<nowiki>=foo=</nowiki>=====
17786 ======<nowiki>=foo=</nowiki>======
17787
17788 !! html
17789 <h1>=foo=</h1>
17790 <h2>=foo=</h2>
17791 <h3>=foo=</h3>
17792
17793 <h1 data-parsoid='{}'>=foo=</h1>
17794 <h2 data-parsoid='{}'>=foo=</h2>
17795 <h3 data-parsoid='{}'>=foo=</h3>
17796 <h4 data-parsoid='{}'>=foo=</h4>
17797 <h5 data-parsoid='{}'>=foo=</h5>
17798 <h6 data-parsoid='{}'>=foo=</h6>
17799 !!end
17800
17801 !! test
17802 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17803 !! options
17804 parsoid=html2wt
17805 !! wikitext
17806 = foo =
17807 <nowiki>*</nowiki>bar
17808
17809 = foo =
17810 =bar
17811
17812 = foo =
17813 <nowiki>=bar=</nowiki>
17814 !! html
17815 <h1>foo</h1>*bar
17816 <h1>foo</h1>=bar
17817 <h1>foo</h1>=bar=
17818 !!end
17819
17820 !! test
17821 Headings: 3. Nested inside html with wikitext split by html tags
17822 !! options
17823 parsoid=html2wt
17824 !! wikitext
17825 = ='''bold'''<nowiki>foo=</nowiki> =
17826 !! html
17827 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17828 !!end
17829
17830 !! test
17831 Headings: 4a. No escaping needed (testing just h1 and h2)
17832 !! options
17833 parsoid=html2wt
17834 !! wikitext
17835 = =foo =
17836
17837 = foo= =
17838
17839 = =foo= =
17840
17841 = =foo= bar =
17842
17843 == =foo ==
17844
17845 == foo= ==
17846
17847 = ''=''foo= =
17848
17849 = <nowiki>=</nowiki> =
17850 !! html
17851 <h1>=foo</h1>
17852 <h1>foo=</h1>
17853 <h1> =foo= </h1>
17854 <h1>=foo= bar</h1>
17855 <h2>=foo</h2>
17856 <h2>foo=</h2>
17857 <h1><i>=</i>foo=</h1>
17858 <h1><span typeof="mw:Nowiki">=</span></h1>
17859 !!end
17860
17861 !! test
17862 Headings: 4b. No escaping needed (inside p-tags)
17863 !! options
17864 parsoid=html2wt
17865 !! wikitext
17866 ===
17867 =foo= x
17868 =foo= <s></s>
17869 !! html
17870 <p>===
17871 =foo= x
17872 =foo= <s></s>
17873 </p>
17874 !!end
17875
17876 !! test
17877 Headings: 5. Empty headings
17878 !! options
17879 parsoid
17880 !! wikitext
17881 =<nowiki/>=
17882
17883 ==<nowiki/>==
17884
17885 ===<nowiki/>===
17886
17887 ====<nowiki/>====
17888
17889 =====<nowiki/>=====
17890
17891 ======<nowiki/>======
17892 !! html
17893 <h1></h1>
17894 <h2></h2>
17895 <h3></h3>
17896 <h4></h4>
17897 <h5></h5>
17898 <h6></h6>
17899 !!end
17900
17901 !! test
17902 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17903 !! options
17904 parsoid
17905 !! wikitext
17906 <nowiki>=a=</nowiki>
17907
17908 <nowiki>=a=</nowiki>
17909
17910 <nowiki>=a=</nowiki>
17911
17912 <nowiki>=a=</nowiki>
17913 !! html
17914 <p>=a=</p>
17915 <p>=a= </p>
17916 <p>=a= </p>
17917 <p>=a= </p>
17918 !!end
17919
17920 !! test
17921 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17922 !! options
17923 parsoid
17924 !! wikitext
17925 <nowiki>=a=
17926 b</nowiki>
17927
17928 <nowiki>=a=
17929 b</nowiki>
17930
17931 <nowiki>=a=
17932 b</nowiki>
17933
17934 <nowiki>=a=
17935 b</nowiki>
17936 !! html
17937 <p>=a=
17938 b</p>
17939 <p>=a=
17940 b</p>
17941 <p>=a=
17942 b</p>
17943 <p>=a=
17944 b</p>
17945 </p>
17946 !!end
17947
17948 !! test
17949 Headings: 6c. Heading chars in SOL context (leading newline break)
17950 !! options
17951 parsoid
17952 !! wikitext
17953 a
17954 <nowiki>=b=</nowiki>
17955 !! html
17956 <p>a
17957 =b=</p>
17958 !!end
17959
17960 !! test
17961 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17962 !! options
17963 parsoid
17964 !! wikitext
17965 <!--c0--><nowiki>=a=</nowiki>
17966
17967 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17968 !! html
17969 <p><!--c0-->=a=</p>
17970 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17971 !!end
17972
17973 !! test
17974 Headings: 6d. Heading chars in SOL context (No escaping needed)
17975 !! options
17976 parsoid=html2wt
17977 !! wikitext
17978 =a=<div>b</div>
17979 !! html
17980 =a=<div>b</div>
17981 !!end
17982
17983 #### --------------- Lists ---------------
17984 #### 0. Outside nests (*foo, etc.)
17985 #### 1. Nested inside html <ul><li>*foo</li></ul>
17986 #### 2. Inside definition lists
17987 #### 3. Only bullets at start should be escaped
17988 #### 4. No escapes needed
17989 #### 5. No unnecessary escapes
17990 #### 6. Escape bullets in SOL position
17991 #### 7. Escape bullets in a multi-line context
17992 #### ----------------------------------------
17993
17994 !! test
17995 Lists: 0. Outside nests
17996 !! wikitext
17997 <nowiki>*</nowiki>foo
17998
17999 <nowiki>#</nowiki>foo
18000 !! html
18001 <p>*foo
18002 </p><p>#foo
18003 </p>
18004 !!end
18005
18006 !! test
18007 Lists: 1. Nested inside html
18008 !! wikitext
18009 *<nowiki>*foo</nowiki>
18010
18011 *<nowiki>#foo</nowiki>
18012
18013 *<nowiki>:foo</nowiki>
18014
18015 *<nowiki>;foo</nowiki>
18016
18017 #<nowiki>*foo</nowiki>
18018
18019 #<nowiki>#foo</nowiki>
18020
18021 #<nowiki>:foo</nowiki>
18022
18023 #<nowiki>;foo</nowiki>
18024 !! html
18025 <ul>
18026 <li>*foo
18027 </li>
18028 </ul>
18029 <ul>
18030 <li>#foo
18031 </li>
18032 </ul>
18033 <ul>
18034 <li>:foo
18035 </li>
18036 </ul>
18037 <ul>
18038 <li>;foo
18039 </li>
18040 </ul>
18041 <ol>
18042 <li>*foo
18043 </li>
18044 </ol>
18045 <ol>
18046 <li>#foo
18047 </li>
18048 </ol>
18049 <ol>
18050 <li>:foo
18051 </li>
18052 </ol>
18053 <ol>
18054 <li>;foo
18055 </li>
18056 </ol>
18057
18058 !!end
18059
18060 !! test
18061 Lists: 2. Inside definition lists
18062 !! wikitext
18063 ;<nowiki>;foo</nowiki>
18064
18065 ;<nowiki>:foo</nowiki>
18066
18067 ;<nowiki>:foo</nowiki>
18068 :bar
18069
18070 :<nowiki>:foo</nowiki>
18071 !! html
18072 <dl>
18073 <dt>;foo
18074 </dt>
18075 </dl>
18076 <dl>
18077 <dt>:foo
18078 </dt>
18079 </dl>
18080 <dl>
18081 <dt>:foo
18082 </dt>
18083 <dd>bar
18084 </dd>
18085 </dl>
18086 <dl>
18087 <dd>:foo
18088 </dd>
18089 </dl>
18090
18091 !!end
18092
18093 !! test
18094 Lists: 3. Only bullets at start of text should be escaped
18095 !! wikitext
18096 *<nowiki>*foo*bar</nowiki>
18097
18098 *<nowiki>*foo</nowiki>''it''*bar
18099 !! html
18100 <ul>
18101 <li>*foo*bar
18102 </li>
18103 </ul>
18104 <ul>
18105 <li>*foo<i>it</i>*bar
18106 </li>
18107 </ul>
18108
18109 !!end
18110
18111 !! test
18112 Lists: 4. No escapes needed
18113 !! options
18114 parsoid
18115 !! wikitext
18116 *foo*bar
18117
18118 *''foo''*bar
18119
18120 *[[Foo]]: bar
18121
18122 *[[Foo]]*bar
18123 !! html
18124 <ul>
18125 <li>foo*bar
18126 </li>
18127 </ul>
18128 <ul>
18129 <li><i>foo</i>*bar
18130 </li>
18131 </ul>
18132 <ul>
18133 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18134 </li>
18135 </ul>
18136 <ul>
18137 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18138 </li>
18139 </ul>
18140 !!end
18141
18142 !! test
18143 Lists: 5. No unnecessary escapes
18144 !! wikitext
18145 * bar <span><nowiki>[[foo]]</nowiki></span>
18146
18147 *=bar <span><nowiki>[[foo]]</nowiki></span>
18148
18149 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18150
18151 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18152
18153 *=bar <span>foo]]</span>=
18154
18155 * <s></s>: a
18156 !! html
18157 <ul>
18158 <li> bar <span>[[foo]]</span>
18159 </li>
18160 </ul>
18161 <ul>
18162 <li>=bar <span>[[foo]]</span>
18163 </li>
18164 </ul>
18165 <ul>
18166 <li>[[bar <span>[[foo]]</span>
18167 </li>
18168 </ul>
18169 <ul>
18170 <li>]]bar <span>[[foo]]</span>
18171 </li>
18172 </ul>
18173 <ul>
18174 <li>=bar <span>foo]]</span>=
18175 </li>
18176 </ul>
18177 <ul>
18178 <li> <s></s>: a
18179 </li>
18180 </ul>
18181
18182 !!end
18183
18184 !! test
18185 Lists: 6. Escape bullets in SOL position
18186 !! options
18187 parsoid
18188 !! wikitext
18189 <!--cmt--><nowiki>*foo</nowiki>
18190 !! html
18191 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18192 !!end
18193
18194 !! test
18195 Lists: 7. Escape bullets in a multi-line context
18196 !! wikitext
18197 a
18198 <nowiki>*</nowiki>b
18199 !! html
18200 <p>a
18201 *b
18202 </p>
18203 !!end
18204
18205 #### --------------- HRs ---------------
18206 #### 1. Single line
18207 #### -----------------------------------
18208
18209 !! test
18210 HRs: 1. Single line
18211 !! options
18212 parsoid
18213 !! wikitext
18214 ----<nowiki>----</nowiki>
18215 ----=foo=
18216 ----*foo
18217 !! html
18218 <hr><span typeof="mw:Nowiki">----</span>
18219 <hr>=foo=
18220 <hr>*foo
18221 !! end
18222
18223 #### --------------- Tables ---------------
18224 #### 1a. Simple example
18225 #### 1b. No escaping needed (!foo)
18226 #### 1c. No escaping needed (|foo)
18227 #### 1d. No escaping needed (|}foo)
18228 ####
18229 #### 2a. Nested in td (<td>foo|bar</td>)
18230 #### 2b. Nested in td (<td>foo||bar</td>)
18231 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18232 ####
18233 #### 3a. Nested in th (<th>foo!bar</th>)
18234 #### 3b. Nested in th (<th>foo!!bar</th>)
18235 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18236 ####
18237 #### 4a. Escape -
18238 #### 4b. Escape +
18239 #### 4c. No escaping needed
18240 #### --------------------------------------
18241
18242 !! test
18243 Tables: 1a. Simple example
18244 !! wikitext
18245 <nowiki>{|
18246 |}</nowiki>
18247 !! html
18248 <p>{|
18249 |}
18250 </p>
18251 !! end
18252
18253 !! test
18254 Tables: 1b. No escaping needed
18255 !! wikitext
18256 !foo
18257 !! html
18258 <p>!foo
18259 </p>
18260 !! end
18261
18262 !! test
18263 Tables: 1c. No escaping needed
18264 !! wikitext
18265 |foo
18266 !! html
18267 <p>|foo
18268 </p>
18269 !! end
18270
18271 !! test
18272 Tables: 1d. No escaping needed
18273 !! wikitext
18274 |}foo
18275 !! html
18276 <p>|}foo
18277 </p>
18278 !! end
18279
18280 !! test
18281 Tables: 2a. Nested in td
18282 !! options
18283 parsoid=html2wt
18284 !! wikitext
18285 {|
18286 |<nowiki>foo|bar</nowiki>
18287 |-
18288 |x<div><nowiki>a|b</nowiki></div>
18289 |}
18290 !! html
18291 <table><tbody><tr>
18292 <td>foo|bar</td></tr>
18293 <tr><td>x<div>a|b</div></td>
18294 </tbody></table>
18295 !! end
18296
18297 !! test
18298 Tables: 2b. Nested in td
18299 !! options
18300 parsoid
18301 !! wikitext
18302 {|
18303 |<nowiki>foo||bar</nowiki>
18304 |''it''<nowiki>foo||bar</nowiki>
18305 |}
18306 !! html
18307 <table><tbody><tr>
18308 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18309 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18310 !! end
18311
18312 !! test
18313 Tables: 2c. Nested in td -- no escaping needed
18314 !! options
18315 parsoid
18316 !! wikitext
18317 {|
18318 |foo!!bar
18319 |}
18320 !! html
18321 <table><tbody><tr><td>foo!!bar
18322 </td></tr></tbody></table>
18323
18324 !! end
18325
18326 !! test
18327 Tables: 3a. Nested in th
18328 !! options
18329 parsoid
18330 !! wikitext
18331 {|
18332 !foo!bar
18333 |}
18334 !! html
18335 <table><tbody><tr><th>foo!bar
18336 </th></tr></tbody></table>
18337
18338 !! end
18339
18340 !! test
18341 Tables: 3b. Nested in th
18342 !! options
18343 parsoid
18344 !! wikitext
18345 {|
18346 !<nowiki>foo!!bar</nowiki>
18347 |}
18348 !! html
18349 <table>
18350 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18351 </tbody></table>
18352 !! end
18353
18354 !! test
18355 Tables: 3c. Nested in th -- no escaping needed
18356 !! options
18357 parsoid
18358 !! wikitext
18359 {|
18360 !<nowiki>foo||bar</nowiki>
18361 |}
18362 !! html
18363 <table><tbody><tr>
18364 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18365 !! end
18366
18367 !! test
18368 Tables: 4a. Escape -
18369 !! options
18370 parsoid
18371 !! wikitext
18372 {|
18373 !-bar
18374 |-
18375 |<nowiki>-bar</nowiki>
18376 |}
18377 !! html
18378 <table><tbody>
18379 <tr><th>-bar</th></tr>
18380 <tr>
18381 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18382 !! end
18383
18384 !! test
18385 Tables: 4b. Escape +
18386 !! options
18387 parsoid
18388 !! wikitext
18389 {|
18390 !+bar
18391 |-
18392 |<nowiki>+bar</nowiki>
18393 |}
18394 !! html
18395 <table><tbody>
18396 <tr><th>+bar</th></tr>
18397 <tr>
18398 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18399 !! end
18400
18401 !! test
18402 Tables: 4c. No escaping needed
18403 !! options
18404 parsoid
18405 !! wikitext
18406 {|
18407 |foo-bar
18408 |foo+bar
18409 |-
18410 |''foo''-bar
18411 |''foo''+bar
18412 |-
18413 |foo
18414 bar|baz
18415 +bar
18416 -bar
18417 |-
18418 |x
18419 <div>a|b</div>
18420 |}
18421 !! html
18422 <table><tbody>
18423 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18424 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18425 <tr><td>foo
18426 <p>bar|baz
18427 +bar
18428 -bar</p></td></tr>
18429 <tr><td>x
18430 <div>a|b</div></td>
18431 </tbody></table>
18432 !! end
18433
18434 !! test
18435 Tables: 4d. No escaping needed
18436 !! options
18437 parsoid
18438 !! wikitext
18439 {|
18440 |[[Foo]]-bar
18441 ||+1
18442 ||-2
18443 |}
18444 !! html
18445 <table>
18446 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18447 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18448 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18449 </tbody></table>
18450 !! end
18451
18452 !! test
18453 Tables: Digest broken attributes on table and tr tag
18454 !! options
18455 parsoid=wt2html
18456 !! wikitext
18457 {| || |} ++
18458 |- || || ++ --
18459 |- > [
18460 |}
18461 !! html
18462 <table>
18463 <tbody>
18464 <tr></tr>
18465 <tr></tr>
18466 </tbody></table>
18467 !! end
18468
18469 #### --------------- Links ----------------
18470 #### 1. Quote marks in link text
18471 #### 2. Wikilinks: Escapes needed
18472 #### 3. Wikilinks: No escapes needed
18473 #### 4. Extlinks: Escapes needed
18474 #### 5. Extlinks: No escapes needed
18475 #### --------------------------------------
18476 !! test
18477 Links 1. Quote marks in link text
18478 !! options
18479 parsoid
18480 !! wikitext
18481 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18482 !! html
18483 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18484 !! end
18485
18486 !! test
18487 Links 2. WikiLinks: Escapes needed
18488 !! options
18489 parsoid
18490 !! wikitext
18491 [[Foo|[Foobar]]]
18492 [[Foo|<nowiki>Foobar]</nowiki>]]
18493 [[Foo|x [Foobar] x]]
18494 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18495 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18496 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18497 [[Foo|<nowiki>|Bar</nowiki>]]
18498 [[Foo|<nowiki>]]bar</nowiki>]]
18499 [[Foo|<nowiki>[[bar</nowiki>]]
18500 [[Foo|<nowiki>x [[ y</nowiki>]]
18501 [[Foo|<nowiki>x ]] y</nowiki>]]
18502 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18503 !! html
18504 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18505 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18506 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18507 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18508 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18509 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18510 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18511 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18512 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18513 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18514 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18515 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18516 !! end
18517
18518 !! test
18519 Links 3. WikiLinks: No escapes needed
18520 !! options
18521 parsoid
18522 !! wikitext
18523 [[Foo|[Foobar]]
18524 [[Foo|foo|bar]]
18525 !! html
18526 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18527 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18528 !! end
18529
18530 !! test
18531 Links 4. ExtLinks: Escapes needed
18532 !! options
18533 parsoid
18534 !! wikitext
18535 [http://google.com <nowiki>[google]</nowiki>]
18536 [http://google.com <nowiki>google]</nowiki>]
18537
18538 <nowiki>[http://google.com]</nowiki>
18539
18540 <nowiki>[http://google.com google]</nowiki>
18541
18542 !! html
18543 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18544 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18545 <p>[http://google.com]</p>
18546 <p>[http://google.com google]</p>
18547 !! end
18548
18549 !! test
18550 Links 5. ExtLinks: No escapes needed
18551 !! options
18552 parsoid
18553 !! wikitext
18554 [http://google.com [google]
18555 !! html
18556 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18557 !! end
18558
18559 #### --------------- Quotes ---------------
18560 #### 1. Quotes inside <b> and <i>
18561 #### 2. Link fragments separated by <i> and <b> tags
18562 #### 3. Link fragments inside <i> and <b>
18563 #### 4. No escaping needed
18564 #### --------------------------------------
18565 !! test
18566 1. Quotes inside <b> and <i>
18567 !! options
18568 parsoid=html2wt,wt2wt
18569 !! wikitext
18570 ''<nowiki>'foo'</nowiki>''
18571 ''<nowiki>''foo''</nowiki>''
18572 ''<nowiki>'''foo'''</nowiki>''
18573 ''foo''<nowiki/>'s
18574 '''<nowiki>'foo'</nowiki>'''
18575 '''<nowiki>''foo''</nowiki>'''
18576 '''<nowiki>'''foo'''</nowiki>'''
18577 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18578 '''foo'''<nowiki/>'s
18579 '''foo''
18580 ''foo''<nowiki/>'
18581 '<nowiki/>''foo''<nowiki/>'
18582 ''''foo'''
18583 '''foo'''<nowiki/>'
18584 '<nowiki/>'''foo'''<nowiki/>'
18585 ''fools'<span> errand</span>''
18586 ''<span>fool</span>'s errand''
18587 !! html
18588 <p><i>'foo'</i>
18589 <i>''foo''</i>
18590 <i>'''foo'''</i>
18591 <i>foo</i>'s
18592 <b>'foo'</b>
18593 <b>''foo''</b>
18594 <b>'''foo'''</b>
18595 <b>foo'<i>bar'</i>baz</b>
18596 <b>foo</b>'s
18597 '<i>foo</i>
18598 <i>foo</i>'
18599 '<i>foo</i>'
18600 '<b>foo</b>
18601 <b>foo</b>'
18602 '<b>foo</b>'</p>
18603 <i>fools'<span> errand</span></i>
18604 <i><span>fool</span>'s errand</i>
18605 !! end
18606
18607 !! test
18608 2. Link fragments separated by <i> and <b> tags
18609 !! wikitext
18610 [[''foo''<nowiki>hello]]</nowiki>
18611
18612 [['''foo'''<nowiki>hello]]</nowiki>
18613 !! html
18614 <p>[[<i>foo</i>hello]]
18615 </p><p>[[<b>foo</b>hello]]
18616 </p>
18617 !! end
18618
18619 !! test
18620 3. Link fragments inside <i> and <b>
18621 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18622 this is one of the shortcomings of this format)
18623 !! wikitext
18624 ''[[foo''<nowiki>]]</nowiki>
18625
18626 '''[[foo'''<nowiki>]]</nowiki>
18627 !! html
18628 <p><i>[[foo</i>]]
18629 </p><p><b>[[foo</b>]]
18630 </p>
18631 !! end
18632
18633 !! test
18634 4. No escaping needed
18635 !! wikitext
18636 '<span>''bar''</span>'
18637 '<span>'''bar'''</span>'
18638 !! html
18639 <p>'<span><i>bar</i></span>'
18640 '<span><b>bar</b></span>'
18641 </p>
18642 !! end
18643
18644 #### ----------- Paragraphs ---------------
18645 #### 1. No unnecessary escapes
18646 #### --------------------------------------
18647
18648 !! test
18649 1. No unnecessary escapes
18650 !! wikitext
18651 bar <span><nowiki>[[foo]]</nowiki></span>
18652
18653 =bar <span><nowiki>[[foo]]</nowiki></span>
18654
18655 [[bar <span><nowiki>[[foo]]</nowiki></span>
18656
18657 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18658
18659 =bar <span>foo]]</span><nowiki>=</nowiki>
18660 !! html
18661 <p>bar <span>[[foo]]</span>
18662 </p><p>=bar <span>[[foo]]</span>
18663 </p><p>[[bar <span>[[foo]]</span>
18664 </p><p>]]bar <span>[[foo]]</span>
18665 </p><p>=bar <span>foo]]</span>=
18666 </p>
18667 !!end
18668
18669 #### ----------------------- PRE --------------------------
18670 #### 1. Leading whitespace in SOL context should be escaped
18671 #### ------------------------------------------------------
18672 !! test
18673 1. Leading whitespace in SOL context should be escaped
18674 !! options
18675 parsoid
18676 !! wikitext
18677 <nowiki> </nowiki>a
18678
18679 <nowiki> </nowiki> a
18680
18681 <nowiki> </nowiki>a(tab)
18682
18683 <nowiki> </nowiki> a
18684 <!--cmt-->
18685 <nowiki> </nowiki> a
18686
18687 a
18688 <nowiki> </nowiki>b
18689
18690 a
18691 <nowiki> </nowiki>b
18692
18693 a
18694 <nowiki> </nowiki> b
18695 !! html
18696 <p> a</p>
18697 <p> a</p>
18698 <p> a(tab)</p>
18699 <p> a</p>
18700 <p><!--cmt--> a</p>
18701 <p>a
18702 b</p>
18703 <p>a
18704 b</p>
18705 <p>a
18706 b</p>
18707 !! end
18708
18709 #### --------------- Behavior Switches --------------------
18710 !! test
18711 1. Valid behavior switches should be escaped
18712 !! options
18713 parsoid=html2wt
18714 !! wikitext
18715 <nowiki>__TOC__</nowiki>
18716 !! html
18717 __TOC__
18718 !! end
18719
18720 !! test
18721 2. Invalid behavior switches should not be escaped
18722 !! options
18723 parsoid=html2wt
18724 !! wikitext
18725 __TOO__
18726 __|__
18727 !! html
18728 __TOO__
18729 __|__
18730 !! end
18731
18732 #### --------------- HTML tags ---------------
18733 #### 1. a tags
18734 #### 2. other tags
18735 #### 3. multi-line html tag
18736 #### 4. extension tags
18737 #### -----------------------------------------
18738 !! test
18739 1. a tags
18740 !! options
18741 parsoid
18742 !! wikitext
18743 <a href="http://google.com">google</a>
18744 !! html
18745 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18746 !! end
18747
18748 !! test
18749 2. other tags
18750 !! wikitext
18751 <nowiki><div>foo</div>
18752 <div style="color:red">foo</div></nowiki>
18753 !! html
18754 <p>&lt;div&gt;foo&lt;/div&gt;
18755 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18756 </p>
18757 !! end
18758
18759 !! test
18760 3. multi-line html tag
18761 !! wikitext
18762 <nowiki><div
18763 >foo</div
18764 ></nowiki>
18765 !! html
18766 <p>&lt;div
18767 &gt;foo&lt;/div
18768 &gt;
18769 </p>
18770 !! end
18771
18772 !! test
18773 4. extension tags
18774 !! wikitext
18775 <nowiki><ref>foo</ref></nowiki>
18776
18777 <nowiki><ref>bar</nowiki>
18778
18779 baz<nowiki></ref></nowiki>
18780 !! html
18781 <p>&lt;ref&gt;foo&lt;/ref&gt;
18782 </p><p>&lt;ref&gt;bar
18783 </p><p>baz&lt;/ref&gt;
18784 </p>
18785 !! end
18786
18787 #### --------------- Others ---------------
18788 !! test
18789 Escaping nowikis
18790 !! wikitext
18791 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18792 !! html
18793 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18794 </p>
18795 !! end
18796
18797 ## The quote-char in the input is necessary for triggering the bug
18798 !! test
18799 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18800 !! options
18801 parsoid=wt2wt,html2wt
18802 !! wikitext
18803 foo's bar :
18804 !! html
18805 <p>foo's bar :</p>
18806 !! end
18807
18808 !! test
18809
18810 Tag-like HTML structures are passed through as text
18811 !! wikitext
18812 <x y>
18813
18814 <x.y>
18815
18816 <x-y>
18817
18818 1>2
18819
18820 x<y
18821
18822 a>b
18823
18824 1<d e>f
18825 !! html
18826 <p>&lt;x y&gt;
18827 </p><p>&lt;x.y&gt;
18828 </p><p>&lt;x-y&gt;
18829 </p><p>1&gt;2
18830 </p><p>x&lt;y
18831 </p><p>a&gt;b
18832 </p><p>1&lt;d e&gt;f
18833 </p>
18834 !! end
18835
18836
18837 # This was a bug in the PHP parser (see bug 17663 and its dups,
18838 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18839 !! test
18840 Tag names followed by punctuation should not be recognized as tags
18841 !! wikitext
18842 <s.ome> text
18843 !! html
18844 <p>&lt;s.ome&gt; text
18845 </p>
18846 !! end
18847
18848 !! test
18849 HTML tag with necessary entities in attributes
18850 !! wikitext
18851 <span title="&amp;amp;">foo</span>
18852 !! html
18853 <p><span title="&amp;amp;">foo</span>
18854 </p>
18855 !! end
18856
18857 !! test
18858 HTML tag with 'unnecessary' entity encoding in attributes
18859 !! wikitext
18860 <span title="&amp;">foo</span>
18861 !! html
18862 <p><span title="&amp;">foo</span>
18863 </p>
18864 !! end
18865
18866 !! test
18867 HTML tag with broken attribute value quoting
18868 !! wikitext
18869 <span title="Hello world>Foo</span>
18870 !! html
18871 <p><span>Foo</span>
18872 </p>
18873 !! end
18874
18875 !! test
18876 Parsoid-only: HTML tag with broken attribute value quoting
18877 !! options
18878 parsoid
18879 !! wikitext
18880 <span title="Hello world>Foo</span>
18881 !! html
18882 <p><span title="Hello world">Foo</span>
18883 </p>
18884 !! end
18885
18886 !! test
18887 Table with broken attribute value quoting
18888 !! wikitext
18889 {|
18890 | title="Hello world|Foo
18891 |}
18892 !! html
18893 <table>
18894 <tr>
18895 <td>Foo
18896 </td></tr></table>
18897
18898 !! end
18899
18900 !! test
18901 Table with broken attribute value quoting on consecutive lines
18902 !! wikitext
18903 {|
18904 | title="Hello world|Foo
18905 | style="color:red|Bar
18906 |}
18907 !! html
18908 <table>
18909 <tr>
18910 <td>Foo
18911 </td>
18912 <td>Bar
18913 </td></tr></table>
18914
18915 !! end
18916
18917 !! test
18918 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18919 !! options
18920 parsoid
18921 !! wikitext
18922 {|
18923 | title="Hello world|Foo
18924 | style="color:red|Bar
18925 |}
18926 !! html
18927 <table><tbody>
18928 <tr>
18929 <td title="Hello world">Foo
18930 </td><td style="color: red">Bar
18931 </td></tr></tbody></table>
18932
18933 !! end
18934
18935 !! test
18936 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18937 !! options
18938 parsoid
18939 !! wikitext
18940 {{}}
18941 !! html
18942 {{}}
18943 !! end
18944
18945 !! test
18946 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18947 !! options
18948 parsoid
18949 !! wikitext
18950 }}{{
18951 !! html
18952 }}{{
18953 !! end
18954
18955 !!test
18956 Accept empty td cell attribute
18957 !! wikitext
18958 {|
18959 | align="center" | foo || |
18960 |}
18961 !! html
18962 <table>
18963 <tr>
18964 <td align="center"> foo </td>
18965 <td>
18966 </td></tr></table>
18967
18968 !!end
18969
18970 !!test
18971 Non-empty attributes in th-cells
18972 !! wikitext
18973 {|
18974 ! Foo !! style="color: red" | Bar
18975 |}
18976 !! html
18977 <table>
18978 <tr>
18979 <th> Foo </th>
18980 <th style="color: red"> Bar
18981 </th></tr></table>
18982
18983 !!end
18984
18985 !!test
18986 Accept empty attributes in th-cells
18987 !! wikitext
18988 {|
18989 !| foo !!| bar
18990 |}
18991 !! html
18992 <table>
18993 <tr>
18994 <th> foo </th>
18995 <th> bar
18996 </th></tr></table>
18997
18998 !!end
18999
19000 !!test
19001 Empty table rows go away
19002 !! wikitext
19003 {|
19004 | Hello
19005 | there
19006 |- class="foo"
19007 |-
19008 |}
19009 !! html
19010 <table>
19011 <tr>
19012 <td> Hello
19013 </td>
19014 <td> there
19015 </td></tr>
19016
19017 </table>
19018
19019 !! end
19020
19021 ###
19022 ### Parsoid-centric tests for testing RTing of inter-element separators
19023 ### Edge cases not tested by existing parser tests and specific to
19024 ### Parsoid-specific serialization strategies.
19025 ###
19026
19027 !!test
19028 RT-ed inter-element separators should be valid separators
19029 !! wikitext
19030 {|
19031 |- [[foo]]
19032 |}
19033 !! html
19034 <table>
19035
19036 </table>
19037
19038 !!end
19039
19040 !!test
19041 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19042 (Parsoid-only since PHP parser relies on Tidy for correct output)
19043 !!options
19044 parsoid
19045 !! wikitext
19046 {|
19047 |<small>foo
19048 bar
19049 |}
19050
19051 {|
19052 |<small>foo<small>
19053 |}
19054 !! html
19055 !!end
19056
19057 !!test
19058 Empty TD followed by TD with tpl-generated attribute
19059 !! wikitext
19060 {|
19061 |-
19062 |
19063 |{{echo|style='color:red'}}|foo
19064 |}
19065 !! html
19066 <table>
19067
19068 <tr>
19069 <td>
19070 </td>
19071 <td>foo
19072 </td></tr></table>
19073
19074 !!end
19075
19076 !!test
19077 Indented table with an empty td
19078 !! wikitext
19079 {|
19080 |-
19081 |
19082 |foo
19083 |}
19084 !! html
19085 <table>
19086
19087 <tr>
19088 <td>
19089 </td>
19090 <td>foo
19091 </td></tr></table>
19092
19093 !!end
19094
19095 !!test
19096 Empty TR followed by a template-generated TR
19097 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19098 !!options
19099 parsoid
19100 !! wikitext
19101 {|
19102 |-
19103 {{echo|<tr><td>foo</td></tr>}}
19104 |}
19105 !! html
19106 <table>
19107 <tbody>
19108 <tr></tr>
19109 <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}}]}'>
19110 <td>foo</td></tr>
19111 </tbody></table>
19112 !!end
19113
19114 ## PHP and parsoid output differ for this, and since this is primarily
19115 ## for testing Parsoid's serializer, marking this Parsoid only
19116 !!test
19117 Empty TR followed by mixed-ws-comment line should RT correctly
19118 !!options
19119 parsoid
19120 !! wikitext
19121 {|
19122 |-
19123 <!--c-->
19124 |-
19125 <!--c--> <!--d-->
19126 |}
19127 !! html
19128 <table>
19129 <tbody>
19130 <tr></tr>
19131 <!--c-->
19132 <tr>
19133 <!--c--> </tr><!--d-->
19134 </tbody></table>
19135
19136 !!end
19137
19138 !!test
19139 Multi-line image caption generated by templates with/without trailing newlines
19140 !!options
19141 parsoid
19142 !! wikitext
19143 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19144 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19145 !! html
19146 <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>
19147 <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>
19148
19149 !!end
19150
19151 ## PHP emits broken html for this, and since this is primarily
19152 ## a Parsoid serializer test, marking this Parsoid only
19153 !!test
19154 Improperly nested inline or quotes tags with whitespace in between
19155 !!options
19156 parsoid
19157 !! wikitext
19158 <span> <s>x</span> </s>
19159 ''' ''x''' ''
19160 !! html
19161 <p><span> <s>x</s></span><s> </s>
19162 <b> <i>x</i></b><i> </i>
19163 </p>
19164 !!end
19165
19166 !!test
19167 Encapsulate protected attributes from wt
19168 !!options
19169 parsoid
19170 !! wikitext
19171 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19172 !! html
19173 <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>
19174 </body>
19175 !!end
19176
19177 ## Currently the p-wrapper is fragile in how adds / removes transformations.
19178 ## Having nested or stray pre tags results in the attempt to add duplicates,
19179 ## causing an assertion fail. This test tries to prevent that situation.
19180 !!test
19181 Ensure ParagraphWrapper can deal with stray closing pre tags
19182 !!options
19183 parsoid=wt2html
19184 !! wikitext
19185 plain text</pre>
19186 !! html
19187 plain text
19188 !!end
19189
19190 !!test
19191 1. Ensure fostered text content is wrapped in spans
19192 !!options
19193 parsoid=wt2html
19194 !! wikitext
19195 <table>hi</table><table>ho</table>
19196 !! html
19197 <span>hi</span>
19198 <table></table>
19199 <span>ho</span>
19200 <table></table>
19201 !!end
19202
19203 !!test
19204 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19205 !!options
19206 parsoid=wt2html,wt2wt
19207 !! wikitext
19208 <table>
19209 <tr> || ||
19210 <td> a
19211 </table>
19212 !! html
19213 <span> || ||</span>
19214 <table>
19215 <tbody>
19216 <tr>
19217 <td> a</td></tr>
19218 </tbody></table>
19219 !!end
19220
19221 !!test
19222 Encapsulation properly handles null DSR information from foster box
19223 !!options
19224 parsoid=wt2html,wt2wt
19225 !! wikitext
19226 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19227 !! html
19228 <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;
19229 <table>foo
19230 <tr>
19231 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19232 <table>
19233 <tbody>
19234 <tr>
19235 <td>bar</td></tr></tbody></table>
19236 !!end
19237
19238 !!test
19239 1. Encapsulate foster-parented transclusion content
19240 !!options
19241 parsoid=wt2wt,wt2html
19242 !! wikitext
19243 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19244 !! html
19245 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19246 <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
19247 <tr>
19248 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19249 <table>
19250 <tbody>
19251 <tr>
19252 <td>bar</td></tr></tbody></table>
19253 !!end
19254
19255 !!test
19256 2. Encapsulate foster-parented transclusion content
19257 !!options
19258 parsoid=wt2wt,wt2html
19259 !! wikitext
19260 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19261 !! html
19262 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19263 <table>
19264 <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>
19265 <tr>
19266 <td>bar</td></tr></table>&quot;]}">foo</div>
19267 <table>
19268 <tbody>
19269 <tr>
19270 <td>bar</td></tr></tbody></table>
19271 !!end
19272
19273 !!test
19274 3. Encapsulate foster-parented transclusion content
19275 !!options
19276 parsoid=wt2wt,wt2html
19277 !! wikitext
19278 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19279 !! html
19280 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19281 <table>
19282 <div>
19283 <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>
19284 <tr>
19285 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19286 <p>foo</p></div>
19287 <table>
19288 <tbody>
19289 <tr>
19290 <td>bar</td></tr></tbody></table>
19291 !!end
19292
19293 !!test
19294 4. Encapsulate foster-parented transclusion content
19295 !!options
19296 parsoid=wt2wt,wt2html
19297 !! wikitext
19298 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19299 !! html
19300 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19301 <table>
19302 <div>
19303 <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>
19304 <tr>
19305 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19306 <p>foo</p></div>
19307 <table>
19308 <tbody>
19309 <tr>
19310 <td>bar</td></tr></tbody></table>
19311 !!end
19312
19313 !!test
19314 5. Encapsulate foster-parented transclusion content
19315 !!options
19316 parsoid=wt2wt,wt2html
19317 !! wikitext
19318 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19319 !! html
19320 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19321 <table>
19322 <tr>
19323 <td>
19324 <div>
19325 <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>
19326 <table>
19327 <tbody>
19328 <tr>
19329 <td>
19330 <div>
19331 <p>foo</p></div></td></tr></tbody></table>
19332 !!end
19333
19334 !!test
19335 6. Encapsulate foster-parented transclusion content
19336 !!options
19337 parsoid=wt2wt,wt2html
19338 !! wikitext
19339 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19340 !! html
19341 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19342 <table>
19343 <tr>
19344 <td>
19345 <div>
19346 <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>
19347 <table>
19348 <tbody>
19349 <tr>
19350 <td>
19351 <div>
19352 <p>foo</p></div></td></tr></tbody></table>
19353 <p>ok</p>
19354 !!end
19355
19356 !!test
19357 7. Encapsulate foster-parented transclusion content
19358 !!options
19359 parsoid=wt2wt,wt2html
19360 !! wikitext
19361 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19362 !! html
19363 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19364 <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;
19365 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19366 <td>bar</td></table>&quot;]}">foo</p>
19367 <table>
19368 <tbody>
19369 <tr>
19370 <td>bar</td></tr></tbody></table>
19371 !!end
19372
19373 !!test
19374 8. Encapsulate foster-parented transclusion content
19375 !!options
19376 parsoid=wt2wt,wt2html
19377 !! wikitext
19378 {{echo|a
19379 }}{|{{echo|style='color:red'}}
19380 |-
19381 |b
19382 |}
19383 !! html
19384 <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>
19385 <table>
19386 <tbody>
19387 <tr>
19388 <td>b</td></tr></tbody></table>
19389 !!end
19390
19391 !!test
19392 Table in fosterable position
19393 !!options
19394 parsoid=wt2html,wt2wt
19395 !! wikitext
19396 {{OpenTable}}
19397 <div>
19398 {|
19399 |}
19400 </div>
19401 |}
19402 !! html
19403 <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="{}">
19404 </span>
19405 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19406
19407 <table>
19408 </table>
19409 !!end
19410
19411 !!test
19412 Support <object> element with .data attribute
19413 !!options
19414 parsoid=html2wt
19415 !! wikitext
19416 <object data="test.swf"></object>
19417 !! html
19418 <object data="test.swf"></object>
19419 !!end
19420
19421 # -----------------------------------------------------------------
19422 # The following section of tests are primarily to spec requirements
19423 # around serialization of new/edited content.
19424 #
19425 # All these tests are marked Parsoid html2wt and html2html only
19426 # ----------------------------------------------------------------
19427
19428 !! test
19429 Image: Modifying size of an image (1)
19430 !! options
19431 parsoid={
19432 "modes": ["wt2wt"],
19433 "changes": [
19434 ["img[height]", "attr", "height", "22"],
19435 ["img[width]", "attr", "width", "200"]
19436 ]
19437 }
19438 !! wikitext
19439 [[Image:Foobar.jpg|230x230px]]
19440 !! wikitext/edited
19441 [[Image:Foobar.jpg|200x200px]]
19442 !!end
19443
19444 !! test
19445 Image: Modifying size of an image (2)
19446 !! options
19447 parsoid={
19448 "modes": ["wt2wt"],
19449 "changes": [
19450 ["img[height]", "attr", "height", "100"],
19451 ["img[width]", "attr", "width", "500"]
19452 ]
19453 }
19454 !! wikitext
19455 [[Image:Foobar.jpg|230x230px]]
19456 !! wikitext/edited
19457 [[Image:Foobar.jpg|500x500px]]
19458 !!end
19459
19460 # Change in size is ignored so long as class='mw-default-size'
19461 !! test
19462 Image: Modifying size of an image (3)
19463 !! options
19464 parsoid={
19465 "modes": ["wt2wt"],
19466 "changes": [
19467 ["figure[class]", "removeClass", "mw-default-size"],
19468 ["figure img", "attr", "height", "19"],
19469 ["figure img", "attr", "width", "170"]
19470 ]
19471 }
19472 !! wikitext
19473 [[Image:Foobar.jpg|thumb]]
19474 !! wikitext/edited
19475 [[Image:Foobar.jpg|thumb|170x170px]]
19476 !!end
19477
19478 !! test
19479 Image: Modifying alignment of an image (bug 48665)
19480 !! options
19481 parsoid={
19482 "modes": ["wt2wt"],
19483 "changes": [
19484 ["figure[class]", "removeClass", "mw-halign-right"],
19485 ["figure[class]", "addClass", "mw-halign-left"]
19486 ]
19487 }
19488 !! wikitext
19489 [[Image:Foobar.jpg|thumb|caption|right]]
19490 !! wikitext/edited
19491 [[Image:Foobar.jpg|thumb|caption|left]]
19492 !! end
19493
19494 !! test
19495 Image: Modifying mw-default-size of an frameless image (bug 62805)
19496 !! options
19497 parsoid={
19498 "modes": ["wt2wt"],
19499 "changes": [
19500 ["figure.mw-default-size", "removeClass", "mw-default-size"]
19501 ]
19502 }
19503 !! wikitext
19504 [[Image:Foobar.jpg|frameless|right]]
19505 !! wikitext/edited
19506 [[Image:Foobar.jpg|frameless|right|220x220px]]
19507 !! end
19508
19509 !! test
19510 Image: Modifying valign of an image (bug 49221)
19511 !! options
19512 parsoid={
19513 "modes": ["wt2wt"],
19514 "changes": [
19515 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
19516 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
19517 ]
19518 }
19519 !! wikitext
19520 [[File:Foobar.jpg|20px|middle]]
19521 !! wikitext/edited
19522 [[File:Foobar.jpg|20px|text-top]]
19523 !! end
19524
19525 !! test
19526 Image: Modifying alt attribute of an image (bug 56400)
19527 !! options
19528 parsoid={
19529 "modes": ["wt2wt"],
19530 "changes": [
19531 ["img[alt]", "attr", "alt", "some alternate edited text"]
19532 ]
19533 }
19534 !! wikitext
19535 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
19536 !! wikitext/edited
19537 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19538 !!end
19539
19540 !! test
19541 Image: Modifying caption of an image
19542 !! options
19543 parsoid={
19544 "modes": ["wt2wt"],
19545 "changes": [
19546 ["figcaption", "text", "new caption"]
19547 ]
19548 }
19549 !! wikitext
19550 [[Image:Foobar.jpg|thumb|original caption]]
19551 !! wikitext/edited
19552 [[Image:Foobar.jpg|thumb|new caption]]
19553 !!end
19554
19555 !! test
19556 Image: empty alt attribute (bug 48924)
19557 !! options
19558 parsoid
19559 !! wikitext
19560 [[File:Foobar.jpg|thumb|alt=|bar]]
19561 !! html
19562 <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>
19563 !! end
19564
19565 #!! test
19566 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19567 #!! options
19568 #parsoid=html2wt
19569 #language=ar
19570 #!! input
19571 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19572 #!! result
19573 #<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>
19574 #!! end
19575
19576 !! test
19577 Image: Block level image should have \n before and after
19578 !! options
19579 parsoid
19580 !! wikitext
19581 123
19582 [[File:Foobar.jpg|right|thumb|150x150px]]
19583 456
19584 !! html
19585 <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>
19586 !!end
19587
19588 !! test
19589 Image: New block level image should have \n before and after (existing
19590 content)
19591 !! options
19592 parsoid
19593 !! wikitext
19594 123
19595 [[File:Foobar.jpg|right|thumb|150x150px]]
19596 456
19597 !! html
19598 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19599 <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>
19600 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19601 !!end
19602
19603 !! test
19604 Image: upright option (parsoid)
19605 !! options
19606 parsoid
19607 !! wikitext
19608 [[File:Foobar.jpg|thumb|upright|caption]]
19609 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19610 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19611 !! html
19612 <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>
19613 !!end
19614
19615 !! test
19616 Image: upright option is ignored on inline and frame images (parsoid)
19617 !! options
19618 parsoid
19619 !! wikitext
19620 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19621 !! html
19622 <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>
19623 !!end
19624
19625 !! test
19626 Image: from basic HTML (1)
19627 !! options
19628 parsoid=html2wt
19629 !! html/parsoid
19630 <span typeof="mw:Image">
19631 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
19632 </span>
19633 !! wikitext
19634 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
19635 !! end
19636
19637 !! test
19638 Image: from basic HTML (2)
19639 !! options
19640 parsoid=html2wt
19641 !! html/parsoid
19642 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
19643 !! wikitext
19644 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
19645 !! end
19646
19647 !! test
19648 Image: from basic HTML (3)
19649 !! options
19650 parsoid=html2wt
19651 !! html/parsoid
19652 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
19653 !! wikitext
19654 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
19655 !! end
19656
19657 !! test
19658 Image: from basic HTML (4)
19659 !! options
19660 parsoid=html2wt
19661 !! html/parsoid
19662 <img src="File:Foobar.jpg">
19663 !! wikitext
19664 [[File:Foobar.jpg|link=]]
19665 !! end
19666
19667 !! test
19668 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19669 !! options
19670 parsoid=html2wt
19671 !! wikitext
19672 * foo
19673 !! html
19674 <ul>
19675 <li><p>foo</p></li>
19676 </ul>
19677 !! end
19678
19679 !! test
19680 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19681 !! options
19682 parsoid=html2wt
19683 !! wikitext
19684 * foo
19685 !! html
19686 <ul> <li>foo</li></ul>
19687 !! end
19688
19689 !! test
19690 Don't strip leading whitespace when handling indent-pre suppressing tags
19691 !! options
19692 parsoid=html2wt
19693 !! wikitext
19694 {|
19695 | indented row
19696 |}
19697 <blockquote>
19698 '''This is very bold of you!'''
19699
19700 {|
19701 |
19702 indented cell (no pre-wrapping!)
19703 |}
19704 </blockquote>
19705 foo
19706 <div>bar</div>
19707 !! html
19708 <table>
19709 <tr><td> indented row</td></tr>
19710 </table>
19711 <blockquote><p>
19712 <b>This is very bold of you!</b>
19713 </p>
19714 <table><tr><td>
19715 indented cell (no pre-wrapping!)
19716 </td></tr></table>
19717 </blockquote>
19718 <p>foo</p>
19719 <div>bar</div>
19720 !! end
19721
19722 !! test
19723 Strip leading whitespace when handling indent-pre inducing tags
19724 !! options
19725 parsoid=html2wt
19726 !! wikitext
19727 foo
19728 <span>bar</span>
19729
19730 <span>foo2
19731 </span>bar2
19732
19733 <div>foo</div>
19734 <span>bar</span>
19735
19736 <div>
19737 <span>foo</span>
19738 </div>
19739 !! html
19740 <p>foo</p>
19741 <span>bar</span>
19742
19743 <span>foo2
19744 </span>bar2
19745
19746 <div>foo</div>
19747 <span>bar</span>
19748
19749 <div>
19750 <span>foo</span>
19751 </div>
19752 !! end
19753
19754 !! test
19755 Lists: Add space after bullets
19756 !! options
19757 parsoid=html2wt
19758 !! wikitext
19759 * foo
19760 * bar
19761 * <span> baz</span>
19762 !! html
19763 <ul>
19764 <li>foo</li>
19765 <li> bar</li>
19766 <li><span> baz</span></li>
19767 </ul>
19768 !! end
19769
19770 !! test
19771 Lists: Dont insert newlines in a serialized list item.
19772 !! options
19773 parsoid=html2wt
19774 !! wikitext
19775 * a<br>b
19776 * c
19777 !! html
19778 <ul><li>a<br>b</li><li>c</li></ul>
19779 !! end
19780
19781 !! test
19782 Headings: Add space before/after == (Bug 51744)
19783 !! options
19784 parsoid=html2wt
19785 !! wikitext
19786 == foo ==
19787
19788 == bar ==
19789
19790 == baz ==
19791
19792 == <span> baz</span> ==
19793 !! html
19794 <h2>foo</h2>
19795 <h2> bar</h2>
19796 <h2>baz </h2>
19797 <h2><span> baz</span></h2>
19798 !! end
19799
19800 !! test
19801 Parsoid: Serialize positional parameters with = in them as named parameter
19802 !! options
19803 parsoid=html2wt
19804 !! wikitext
19805 {{echo|1 = f=oo}}
19806
19807 {{echo|1 = f=oo|2 = bar}}
19808
19809 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19810 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19811 {{echo|<nowiki>f=oo</nowiki>|bar}}
19812 !! html
19813 <p about="#mwt1" typeof="mw:Transclusion"
19814 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19815
19816 <p about="#mwt1" typeof="mw:Transclusion"
19817 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19818
19819 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19820 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19821 <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>
19822 !! end
19823
19824 !! test
19825 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19826 !! options
19827 parsoid=html2wt
19828 !! wikitext
19829 <div>a
19830 b
19831 </div>
19832 <div>a
19833 b
19834 </div>
19835 <div>
19836 a
19837
19838 b
19839 </div>
19840 !! html
19841 <div>a<p>b</p></div>
19842 <div>a
19843 <p>b</p></div>
19844 <div>
19845 a
19846 <p>b</p></div>
19847 !! end
19848
19849 #-----------------------------
19850 # I/B quote minimization tests
19851 #-----------------------------
19852
19853 !! test
19854 1. I/B quote minimization: wikitext-only tags should be combined
19855 !! options
19856 parsoid=html2wt
19857 !! wikitext
19858 ''AB''
19859
19860 '''AB'''
19861
19862 ''A'''B'''''
19863
19864 '''A''B'''''
19865
19866 '''A''BC''D'''
19867
19868 '''''AB'''''
19869
19870 '''''AB'''''
19871
19872 '''''AB'''''
19873 !! html
19874 <p><i>A</i><i>B</i></p>
19875 <p><b>A</b><b>B</b></p>
19876 <p><i>A</i><b><i>B</i></b></p>
19877 <p><b>A</b><i><b>B</b></i></p>
19878 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19879 <p><i><b>A</b></i><i><b>B</b></i></p>
19880 <p><i><b>A</b></i><b><i>B</i></b></p>
19881 <p><b><i>A</i></b><i><b>B</b></i></p>
19882 !! end
19883
19884 !! test
19885 2. I/B quote minimization: wikitext and html tags should not be combined
19886 !! options
19887 parsoid=html2wt
19888 !! wikitext
19889 ''A''<i>B</i>
19890
19891 ''A'''''<i>B</i>'''
19892 !! html
19893 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19894 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19895 !! end
19896
19897 !! test
19898 3. I/B quote minimization: templated content stops minimization
19899 !! options
19900 parsoid=html2wt
19901 !! wikitext
19902 ''A''{{echo|''B''}}
19903
19904 ''A''{{echo|'''''B'''''}}
19905 !! html
19906 <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>
19907 <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>
19908 !! end
19909
19910 !! test
19911 4. I/B quote minimization: new content should be mimimized with adjacent old content
19912 !! options
19913 parsoid=html2wt
19914 !! wikitext
19915 ''AB''
19916
19917 '''AB'''
19918
19919 ''A'''B'''''
19920 !! html
19921 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19922 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19923 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19924 !! end
19925
19926 #------------------------------------
19927 # End of I/B quote minimization tests
19928 #------------------------------------
19929
19930 !!test
19931 Bug 54262: New entities
19932 !! options
19933 parsoid=html2wt
19934 !! wikitext
19935 foo
19936 !! html
19937 <span typeof="mw:Entity">foo</span>
19938 !! end
19939
19940 ## Note that there is no wikitext output for 'unknownproperty' ##
19941 ## Unknown magic words are silently dropped ##
19942
19943 !! test
19944 Magic words
19945 !! options
19946 parsoid=html2wt
19947 !! wikitext
19948 __TOC__
19949 __NOTOC__
19950 __FORCETOC__
19951 __INDEX__
19952 __NOINDEX__
19953 __NOGALLERY__
19954 __NOEDITSECTION__
19955 __NOTITLECONVERT__
19956 __NOCONTENTCONVERT__
19957 !! html
19958 <meta property='mw:PageProp/toc' />
19959 <meta property='mw:PageProp/notoc' />
19960 <meta property='mw:PageProp/forcetoc' />
19961 <meta property='mw:PageProp/index' />
19962 <meta property='mw:PageProp/noindex' />
19963 <meta property='mw:PageProp/nogallery' />
19964 <meta property='mw:PageProp/noeditsection' />
19965 <meta property='mw:PageProp/notitleconvert' />
19966 <meta property='mw:PageProp/nocontentconvert' />
19967 <meta property='mw:PageProp/unknownproperty' />
19968 !! end
19969
19970 !! test
19971 Consecutive <pre>s should not get merged
19972 !! options
19973 parsoid=html2wt,html2html
19974 !! wikitext
19975 a
19976
19977 b
19978
19979 c
19980
19981 d
19982
19983 e
19984
19985
19986
19987 f
19988 !! html
19989 <pre>a</pre><pre>b</pre>
19990
19991 <pre>c
19992 </pre><pre>
19993 d</pre>
19994
19995 <pre>e
19996
19997 </pre><pre>
19998
19999 f</pre>
20000 !! end
20001
20002 !! test
20003 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20004 !! options
20005 parsoid=html2wt
20006 !! wikitext
20007 [[Special:BookSources/1234567890|ISBN 1234567895]]
20008 !! html
20009 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20010 !! end
20011
20012 !! test
20013 Edited RFC links not serializable as RFC links should serialize as extlinks
20014 !! options
20015 parsoid=html2wt
20016 !! wikitext
20017 [//tools.ietf.org/html/rfc123 New RFC]
20018 !! html
20019 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20020 !! end
20021
20022 !! test
20023 Edited PMID links not serializable as PMID links should serialize as extlinks
20024 !! options
20025 parsoid=html2wt
20026 !! wikitext
20027 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20028 !! html
20029 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20030 !! end
20031
20032 !! test
20033 Edited Redirect link should emit a non-piped wikitext link
20034 !! options
20035 parsoid=html2wt
20036 !! wikitext
20037 #REDIRECT [[Bar]]
20038 !! html
20039 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20040 !! end
20041
20042 # -----------------------------------------------------------------
20043 # End of section for Parsoid-only html2wt tests for serialization
20044 # of new content
20045 # -----------------------------------------------------------------
20046
20047 TODO:
20048 more images
20049 more tables
20050 character entities
20051 and much more
20052 Try for 100% code coverage