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