Handle conflicting image format options in predictable way.
[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-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 # notoc disable table of contents
30 #
31 # You can also set the following parser properties via test options:
32 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
33 # wgLinkHolderBatchSize, wgRawHtml
34 #
35 # For testing purposes, temporary articles can created:
36 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
37 # where '/' denotes a newline.
38
39 # This is the standard article assumed to exist.
40 !! article
41 Main Page
42 !! text
43 blah blah
44 !! endarticle
45
46 !!article
47 Template:Foo
48 !!text
49 FOO
50 !!endarticle
51
52 !! article
53 Template:Blank
54 !! text
55 !! endarticle
56
57 !! article
58 Template:pipe
59 !! text
60 |
61 !! endarticle
62
63 !!article
64 MediaWiki:bad image list
65 !!text
66 * [[File:Bad.jpg]] except [[Nasty page]]
67 !!endarticle
68
69 !! article
70 Template:inner list
71 !! text
72 * item 1
73 !! endarticle
74
75 !! article
76 Template:tbl-start
77 !! text
78 {|
79 !! endarticle
80
81 !! article
82 Template:tbl-end
83 !! text
84 |}
85 !! endarticle
86
87 !! article
88 Template:!
89 !! text
90 |
91 !! endarticle
92
93 !! article
94 Template:echo
95 !! text
96 {{{1}}}
97 !! endarticle
98
99 !! article
100 Template:echo_with_span
101 !! text
102 <span>{{{1}}}</span>
103 !! endarticle
104
105 !! article
106 Template:echo_with_div
107 !! text
108 <div>{{{1}}}</div>
109 !! endarticle
110
111 !! article
112 Template:attr_str
113 !! text
114 {{{1}}}="{{{2}}}"
115 !! endarticle
116
117 !! article
118 Template:table_attribs
119 !! text
120 <noinclude>
121 |</noinclude>style="color: red"| Foo
122 !! endarticle
123
124 !! article
125 Template:table_cells
126 !! text
127 {{table_attribs}} || Bar || Baz
128 !! endarticle
129
130 !! article
131 Template:image_attribs
132 !! text
133 <noinclude>
134 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
135 !! endarticle
136
137 !! article
138 A?b
139 !! text
140 Weirdo titles!
141 !! endarticle
142
143 !!article
144 Template:Bullet
145 !!text
146 * Bar
147 !!endarticle
148
149 !!article
150 Template:OpenTable
151 !!text
152 {|
153 !!endarticle
154
155 ###
156 ### Basic tests
157 ###
158 !! test
159 Blank input
160 !! wikitext
161 !! html
162 !! end
163
164
165 !! test
166 Simple paragraph
167 !! wikitext
168 This is a simple paragraph.
169 !! html
170 <p>This is a simple paragraph.
171 </p>
172 !! end
173
174 !! test
175 Paragraphs with extra newline spacing
176 !! wikitext
177 foo
178
179 bar
180
181
182 baz
183
184
185
186 booz
187 !! html
188 <p>foo
189 </p><p>bar
190 </p><p><br />
191 baz
192 </p><p><br />
193 </p><p>booz
194 </p>
195 !! end
196
197 !! test
198 Paragraphs with newline spacing with comment lines in between
199 !! wikitext
200 ----
201 a
202 <!--foo-->
203 b
204 ----
205 a
206 <!--foo--><!--More than 1 comment, still stripped-->
207 b
208 ----
209 a
210 <!--foo--> <!----> <!-- bar -->
211 b
212 ----
213 a
214 <!--foo-->
215
216 b
217 ----
218 a
219
220 <!--foo-->
221 b
222 ----
223 a
224 <!--foo-->
225
226
227 b
228 ----
229 a
230
231
232 <!--foo-->
233 b
234 ----
235 !! html
236 <hr />
237 <p>a
238 b
239 </p>
240 <hr />
241 <p>a
242 b
243 </p>
244 <hr />
245 <p>a
246 b
247 </p>
248 <hr />
249 <p>a
250 </p><p>b
251 </p>
252 <hr />
253 <p>a
254 </p><p>b
255 </p>
256 <hr />
257 <p>a
258 </p><p><br />
259 b
260 </p>
261 <hr />
262 <p>a
263 </p><p><br />
264 b
265 </p>
266 <hr />
267
268 !! end
269
270 !! test
271 Paragraphs with newline spacing with non-empty white-space lines in between
272 !! wikitext
273 ----
274 a
275
276 b
277 ----
278 a
279
280
281 b
282 ----
283 !! html
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p><br />
291 b
292 </p>
293 <hr />
294
295 !! end
296
297 !! test
298 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
299 !! wikitext
300 ----
301 a
302 <!--foo-->
303 b
304 ----
305 a
306 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
307 b
308 ----
309 a
310
311 <!--foo-->
312 <!--bar-->
313 b
314 ----
315 a
316
317 <!--foo-->
318 <!--bar-->
319
320 b
321 ----
322 !! html
323 <hr />
324 <p>a
325 b
326 </p>
327 <hr />
328 <p>a
329 b
330 </p>
331 <hr />
332 <p>a
333 </p><p>b
334 </p>
335 <hr />
336 <p>a
337 </p><p><br />
338 b
339 </p>
340 <hr />
341
342 !! end
343
344 !! test
345 Extra newlines: More paragraphs with indented comment
346 !! wikitext
347 a
348
349 <!--boo-->
350
351 b
352 !! html
353 <p>a
354 </p><p><br />
355 b
356 </p>
357 !!end
358
359 !! test
360 Extra newlines followed by heading
361 !! wikitext
362 a
363
364
365
366 =b=
367 [[a]]
368
369
370 =b=
371 !! html
372 <p>a
373 </p><p><br />
374 </p>
375 <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>
376 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
377 </p><p><br />
378 </p>
379 <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>
380
381 !! end
382
383 !! test
384 Extra newlines between heading and content are swallowed
385 !! wikitext
386 =b=
387
388
389
390 [[a]]
391 !! html
392 <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>
393 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
394 </p>
395 !! end
396
397 !! test
398 Parsing an URL
399 !! wikitext
400 http://fr.wikipedia.org/wiki/🍺
401 <!-- EasterEgg we love beer, better be able be able to link to it -->
402 !! html
403 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
404 </p>
405 !! end
406
407 !! test
408 Simple list
409 !! wikitext
410 * Item 1
411 * Item 2
412 !! html
413 <ul>
414 <li> Item 1
415 </li>
416 <li> Item 2
417 </li>
418 </ul>
419
420 !! end
421
422 !! test
423 Italics and bold
424 !! wikitext
425 * plain
426 * plain''italic''plain
427 * plain''italic''plain''italic''plain
428 * plain'''bold'''plain
429 * plain'''bold'''plain'''bold'''plain
430 * plain''italic''plain'''bold'''plain
431 * plain'''bold'''plain''italic''plain
432 * plain''italic'''bold-italic'''italic''plain
433 * plain'''bold''bold-italic''bold'''plain
434 * plain'''''bold-italic'''italic''plain
435 * plain'''''bold-italic''bold'''plain
436 * plain''italic'''bold-italic'''''plain
437 * plain'''bold''bold-italic'''''plain
438 * plain l'''italic''plain
439 * plain l''''bold''' plain
440 !! html
441 <ul>
442 <li> plain
443 </li>
444 <li> plain<i>italic</i>plain
445 </li>
446 <li> plain<i>italic</i>plain<i>italic</i>plain
447 </li>
448 <li> plain<b>bold</b>plain
449 </li>
450 <li> plain<b>bold</b>plain<b>bold</b>plain
451 </li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain
453 </li>
454 <li> plain<b>bold</b>plain<i>italic</i>plain
455 </li>
456 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
457 </li>
458 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
459 </li>
460 <li> plain<i><b>bold-italic</b>italic</i>plain
461 </li>
462 <li> plain<b><i>bold-italic</i>bold</b>plain
463 </li>
464 <li> plain<i>italic<b>bold-italic</b></i>plain
465 </li>
466 <li> plain<b>bold<i>bold-italic</i></b>plain
467 </li>
468 <li> plain l'<i>italic</i>plain
469 </li>
470 <li> plain l'<b>bold</b> plain
471 </li>
472 </ul>
473
474 !! end
475
476 # this example taken from the [[simple:Moon]] article (bug 47326)
477 !! test
478 Italics and possessives (1)
479 !! wikitext
480 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
481 !! html
482 <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
483 </p>
484 !! end
485
486 # this example taken from [[en:Flaming Pie]] (bug 49926)
487 !! test
488 Italics and possessives (2)
489 !! wikitext
490 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
491 !! html
492 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
493 </p>
494 !! end
495
496 # this example taken from [[en:Dictionary]] (bug 49926)
497 !! test
498 Italics and possessives (3)
499 !! wikitext
500 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''.
501 !! html
502 <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>.
503 </p>
504 !! end
505
506
507 ###
508 ### 2-quote opening sequence tests
509 ###
510 !! test
511 Italics and bold: 2-quote opening sequence: (2,2)
512 !! wikitext
513 ''foo''
514 !! html
515 <p><i>foo</i>
516 </p>
517 !!end
518
519
520 !! test
521 Italics and bold: 2-quote opening sequence: (2,3)
522 !! wikitext
523 ''foo'''
524 !! html
525 <p><i>foo'</i>
526 </p>
527 !!end
528
529
530 !! test
531 Italics and bold: 2-quote opening sequence: (2,4)
532 !! wikitext
533 ''foo''''
534 !! html
535 <p><i>foo''</i>
536 </p>
537 !!end
538
539
540 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
541 !! test
542 Italics and bold: 2-quote opening sequence: (2,5)
543 !! wikitext
544 ''foo'''''
545 !! html/php
546 <p><i>foo</i>
547 </p>
548 !! html/parsoid
549 <p><i>foo</i><b></b>
550 </p>
551 !!end
552
553
554 ###
555 ### 3-quote opening sequence tests
556 ###
557
558 !! test
559 Italics and bold: 3-quote opening sequence: (3,2)
560 !! wikitext
561 '''foo''
562 !! html
563 <p>'<i>foo</i>
564 </p>
565 !!end
566
567
568 !! test
569 Italics and bold: 3-quote opening sequence: (3,3)
570 !! wikitext
571 '''foo'''
572 !! html
573 <p><b>foo</b>
574 </p>
575 !!end
576
577
578 !! test
579 Italics and bold: 3-quote opening sequence: (3,4)
580 !! wikitext
581 '''foo''''
582 !! html
583 <p><b>foo'</b>
584 </p>
585 !!end
586
587
588 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
589 !! test
590 Italics and bold: 3-quote opening sequence: (3,5)
591 !! wikitext
592 '''foo'''''
593 !! html/php
594 <p><b>foo</b>
595 </p>
596 !! html/parsoid
597 <p><b>foo</b><i></i>
598 </p>
599 !!end
600
601
602 ###
603 ### 4-quote opening sequence tests
604 ###
605
606 !! test
607 Italics and bold: 4-quote opening sequence: (4,2)
608 !! wikitext
609 ''''foo''
610 !! html
611 <p>''<i>foo</i>
612 </p>
613 !!end
614
615
616 !! test
617 Italics and bold: 4-quote opening sequence: (4,3)
618 !! wikitext
619 ''''foo'''
620 !! html
621 <p>'<b>foo</b>
622 </p>
623 !!end
624
625
626 !! test
627 Italics and bold: 4-quote opening sequence: (4,4)
628 !! wikitext
629 ''''foo''''
630 !! html
631 <p>'<b>foo'</b>
632 </p>
633 !!end
634
635
636 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
637 !! test
638 Italics and bold: 4-quote opening sequence: (4,5)
639 !! wikitext
640 ''''foo'''''
641 !! html/php
642 <p>'<b>foo</b>
643 </p>
644 !! html/parsoid
645 <p>'<b>foo</b><i></i>
646 </p>
647 !!end
648
649
650 ###
651 ### 5-quote opening sequence tests
652 ###
653
654 !! test
655 Italics and bold: 5-quote opening sequence: (5,2)
656 !! options
657 !! wikitext
658 '''''foo''
659 !! html
660 <p><b><i>foo</i></b>
661 </p>
662 !!end
663
664
665 !! test
666 Italics and bold: 5-quote opening sequence: (5,3)
667 !! wikitext
668 '''''foo'''
669 !! html
670 <p><i><b>foo</b></i>
671 </p>
672 !!end
673
674
675 !! test
676 Italics and bold: 5-quote opening sequence: (5,4)
677 !! wikitext
678 '''''foo''''
679 !! html
680 <p><i><b>foo'</b></i>
681 </p>
682 !!end
683
684
685 !! test
686 Italics and bold: 5-quote opening sequence: (5,5)
687 !! wikitext
688 '''''foo'''''
689 !! html
690 <p><i><b>foo</b></i>
691 </p>
692 !!end
693
694 ###
695 ### multiple quote sequences in a line
696 ###
697 !! test
698 Italics and bold: multiple quote sequences: (2,4,2)
699 !! wikitext
700 ''foo''''bar''
701 !! html
702 <p><i>foo'<b>bar</b></i>
703 </p>
704 !!end
705
706
707 !! test
708 Italics and bold: multiple quote sequences: (2,4,3)
709 !! wikitext
710 ''foo''''bar'''
711 !! html
712 <p><i>foo'<b>bar</b></i>
713 </p>
714 !!end
715
716
717 !! test
718 Italics and bold: multiple quote sequences: (2,4,4)
719 !! wikitext
720 ''foo''''bar''''
721 !! html
722 <p><i>foo'<b>bar'</b></i>
723 </p>
724 !!end
725
726
727 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,2)
730 !! wikitext
731 '''foo''''bar''
732 !! html/php
733 <p><b>foo'</b>bar
734 </p>
735 !! html/parsoid
736 <p><b>foo'</b>bar<i></i>
737 </p>
738 !!end
739
740
741 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
742 !! test
743 Italics and bold: multiple quote sequences: (3,4,3)
744 !! wikitext
745 '''foo''''bar'''
746 !! html/php
747 <p><b>foo'</b>bar
748 </p>
749 !! html/parsoid
750 <p><b>foo'</b>bar<b></b>
751 </p>
752 !!end
753
754 ###
755 ### other quote tests
756 ###
757 !! test
758 Italics and bold: other quote tests: (2,3,5)
759 !! wikitext
760 ''this is about '''foo's family'''''
761 !! html
762 <p><i>this is about <b>foo's family</b></i>
763 </p>
764 !!end
765
766
767 !! test
768 Italics and bold: other quote tests: (2,(3,3),2)
769 !! wikitext
770 ''this is about '''foo's''' family''
771 !! html
772 <p><i>this is about <b>foo's</b> family</i>
773 </p>
774 !!end
775
776
777 !! test
778 Italics and bold: other quote tests: (3,2,3,2)
779 !! wikitext
780 '''this is about ''foo'''s family''
781 !! html
782 <p><b>this is about <i>foo</i></b><i>s family</i>
783 </p>
784 !!end
785
786
787 !! test
788 Italics and bold: other quote tests: (3,2,3,3)
789 !! options
790 !! wikitext
791 '''this is about ''foo'''s family'''
792 !! html
793 <p>'<i>this is about </i>foo<b>s family</b>
794 </p>
795 !!end
796
797
798 !! test
799 Italics and bold: other quote tests: (3,(2,2),3)
800 !! wikitext
801 '''this is about ''foo's'' family'''
802 !! html
803 <p><b>this is about <i>foo's</i> family</b>
804 </p>
805 !!end
806
807
808 !! test
809 Italicized possessive
810 !! wikitext
811 The ''[[Main Page]]'''s talk page.
812 !! html
813 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
814 </p>
815 !! end
816
817 !! test
818 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
819 (Requires tidy for PHP parser output to be fixed up)
820 !! options
821 parsoid=wt2html,wt2wt
822 !! wikitext
823 {|
824 !''a!!''b
825 |''a||''b
826 |}
827 !! html
828 <table>
829 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
830 <td><i>a</i></td><td><i>b</i></td></tr>
831 </tbody></table>
832 !! end
833
834 ###
835 ### Non-html5 tags
836 ###
837
838 !! test
839 Non-html5 tags should be accepted
840 !! wikitext
841 <center>''foo''</center>
842 <big>''foo''</big>
843 <font>''foo''</font>
844 <strike>''foo''</strike>
845 <tt>''foo''</tt>
846 !! html
847 <center><i>foo</i></center>
848 <p><big><i>foo</i></big>
849 <font><i>foo</i></font>
850 <strike><i>foo</i></strike>
851 <tt><i>foo</i></tt>
852 </p>
853 !! end
854
855 !! test
856 <wbr> is valid wikitext (bug 52468)
857 !! wikitext
858 <wbr>
859 !! html
860 <p><wbr />
861 </p>
862 !! end
863
864 # <strike> is HTML4, <s> is HTML4/5.
865 !! test
866 <s> or <strike> for strikethrough
867 !! wikitext
868 <strike>strike</strike>
869
870 <s>s</s>
871 !! html
872 <p><strike>strike</strike>
873 </p><p><s>s</s>
874 </p>
875 !! end
876
877 !! test
878 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
879 !! wikitext
880 <b→> doesn't work! </b→>
881
882 <bä> doesn't work! </bä>
883
884 <boo> works fine </boo>
885
886 <s.foo>s.foo</s.foo>
887
888 <sub-ID#1>
889 !! html
890 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
891 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
892 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
893 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
894 </p><p>&lt;sub-ID#1&gt;
895 </p>
896 !! end
897
898 !! test
899 Isolated close tags should be treated as literal text (bug 52760)
900 !! wikitext
901 </b>
902
903 <s.foo>s</s>
904 !! html
905 <p>&lt;/b&gt;
906 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
907 </p>
908 !! end
909
910 ###
911 ### Special characters
912 ###
913
914 !! test
915 Bare pipe character (bug 52363)
916 !! wikitext
917 |
918 !! html
919 <p>|
920 </p>
921 !! end
922
923 !! test
924 Bare pipe character from a template (bug 52363)
925 !! wikitext
926 {{pipe}}
927 !! html
928 <p>|
929 </p>
930 !! end
931
932 ###
933 ### <nowiki> test cases
934 ###
935
936 !! test
937 <nowiki> unordered list
938 !! wikitext
939 <nowiki>* This is not an unordered list item.</nowiki>
940 !! html
941 <p>* This is not an unordered list item.
942 </p>
943 !! end
944
945 !! test
946 <nowiki> spacing
947 !! wikitext
948 <nowiki>Lorem ipsum dolor
949
950 sed abit.
951 sed nullum.
952
953 :and a colon
954 </nowiki>
955 !! html
956 <p>Lorem ipsum dolor
957
958 sed abit.
959 sed nullum.
960
961 :and a colon
962
963 </p>
964 !! end
965
966 !! test
967 nowiki 3
968 !! wikitext
969 :There is not nowiki.
970 :There is <nowiki>nowiki</nowiki>.
971
972 #There is not nowiki.
973 #There is <nowiki>nowiki</nowiki>.
974
975 *There is not nowiki.
976 *There is <nowiki>nowiki</nowiki>.
977 !! html
978 <dl>
979 <dd>There is not nowiki.
980 </dd>
981 <dd>There is nowiki.
982 </dd>
983 </dl>
984 <ol>
985 <li>There is not nowiki.
986 </li>
987 <li>There is nowiki.
988 </li>
989 </ol>
990 <ul>
991 <li>There is not nowiki.
992 </li>
993 <li>There is nowiki.
994 </li>
995 </ul>
996
997 !! end
998
999 !! test
1000 Entities inside <nowiki>
1001 !! wikitext
1002 <nowiki>&lt;</nowiki>
1003 !! html
1004 <p>&lt;
1005 </p>
1006 !! end
1007
1008 !! test
1009 Entities inside template parameters
1010 !! options
1011 parsoid
1012 !! wikitext
1013 {{echo|&ndash;}}
1014 !! html
1015 <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>
1016 </p>
1017 !! end
1018
1019 ###
1020 ### Comments
1021 ###
1022 !! test
1023 Comments and Indent-Pre
1024 !! wikitext
1025 <!-- comment 1 --> asdf
1026
1027 <!-- comment 1 --> asdf
1028 <!-- comment 2 -->
1029
1030 <!-- comment 1 --> asdf
1031 <!-- comment 2 -->xyz
1032
1033 <!-- comment 1 --> asdf
1034 <!-- comment 2 --> xyz
1035 !! html
1036 <pre>asdf
1037 </pre>
1038 <pre>asdf
1039 </pre>
1040 <pre>asdf
1041 </pre>
1042 <p>xyz
1043 </p>
1044 <pre>asdf
1045 xyz
1046 </pre>
1047 !! end
1048
1049 !! test
1050 Comment test 2a
1051 !! wikitext
1052 asdf
1053 <!-- comment 1 -->
1054 jkl
1055 !! html
1056 <p>asdf
1057 jkl
1058 </p>
1059 !! end
1060
1061 !! test
1062 Comment test 2b
1063 !! wikitext
1064 asdf
1065 <!-- comment 1 -->
1066
1067 jkl
1068 !! html
1069 <p>asdf
1070 </p><p>jkl
1071 </p>
1072 !! end
1073
1074 !! test
1075 Comment test 3
1076 !! wikitext
1077 asdf
1078 <!-- comment 1 -->
1079 <!-- comment 2 -->
1080 jkl
1081 !! html
1082 <p>asdf
1083 jkl
1084 </p>
1085 !! end
1086
1087 !! test
1088 Comment test 4
1089 !! wikitext
1090 asdf<!-- comment 1 -->jkl
1091 !! html
1092 <p>asdfjkl
1093 </p>
1094 !! end
1095
1096 !! test
1097 Comment spacing
1098 !! wikitext
1099 a
1100 <!-- foo --> b <!-- bar -->
1101 c
1102 !! html
1103 <p>a
1104 </p>
1105 <pre> b
1106 </pre>
1107 <p>c
1108 </p>
1109 !! end
1110
1111 !! test
1112 Comment whitespace
1113 !! wikitext
1114 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1115 !! html
1116
1117 !! end
1118
1119 !! test
1120 Comment semantics and delimiters
1121 !! wikitext
1122 <!-- --><!----><!-----><!------>
1123 !! html
1124
1125 !! end
1126
1127 !! test
1128 Comment semantics and delimiters, redux
1129 !! wikitext
1130 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1131 -- foo -- funky huh? ... -->
1132 !! html
1133
1134 !! end
1135
1136 !! test
1137 Comment semantics and delimiters: directors cut
1138 !! wikitext
1139 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1140 everything starting with < followed by !-- until the first -- and > we see,
1141 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1142 -->-->
1143 !! html
1144 <p>--&gt;
1145 </p>
1146 !! end
1147
1148 !! test
1149 Comment semantics: nesting
1150 !! wikitext
1151 <!--<!-- no, we're not going to do anything fancy here -->-->
1152 !! html
1153 <p>--&gt;
1154 </p>
1155 !! end
1156
1157 !! test
1158 Comment semantics: unclosed comment at end
1159 !! wikitext
1160 <!--This comment will run out to the end of the document
1161 !! html
1162
1163 !! end
1164
1165 !! test
1166 Comment in template title
1167 !! wikitext
1168 {{f<!---->oo}}
1169 !! html
1170 <p>FOO
1171 </p>
1172 !! end
1173
1174 !! test
1175 Comment on its own line post-expand
1176 !! wikitext
1177 a
1178 {{blank}}<!---->
1179 b
1180 !! html
1181 <p>a
1182 </p><p>b
1183 </p>
1184 !! end
1185
1186 !! test
1187 Comment on its own line post-expand with non-significant whitespace
1188 !! wikitext
1189 a
1190 {{blank}} <!---->
1191 b
1192 !! html
1193 <p>a
1194 </p><p>b
1195 </p>
1196 !! end
1197
1198 ###
1199 ### paragraph wrapping tests
1200 ###
1201 !! test
1202 No block tags
1203 !! wikitext
1204 a
1205
1206 b
1207 !! html
1208 <p>a
1209 </p><p>b
1210 </p>
1211 !! end
1212
1213 !! test
1214 Block tag on one line (<div>)
1215 !! wikitext
1216 a <div>foo</div>
1217
1218 b
1219 !! html
1220 a <div>foo</div>
1221 <p>b
1222 </p>
1223 !! end
1224
1225 !! test
1226 Block tag on one line (<blockquote>)
1227 !! wikitext
1228 a <blockquote>foo</blockquote>
1229
1230 b
1231 !! html
1232 a <blockquote>foo</blockquote>
1233 <p>b
1234 </p>
1235 !! end
1236
1237 !! test
1238 Block tag on both lines (<div>)
1239 !! wikitext
1240 a <div>foo</div>
1241
1242 b <div>foo</div>
1243 !! html
1244 a <div>foo</div>
1245 b <div>foo</div>
1246
1247 !! end
1248
1249 !! test
1250 Block tag on both lines (<blockquote>)
1251 !! wikitext
1252 a <blockquote>foo</blockquote>
1253
1254 b <blockquote>foo</blockquote>
1255 !! html
1256 a <blockquote>foo</blockquote>
1257 b <blockquote>foo</blockquote>
1258
1259 !! end
1260
1261 !! test
1262 Multiple lines without block tags
1263 !! wikitext
1264 <div>foo</div> a
1265 b
1266 c
1267 d<!--foo--> e
1268 x <div>foo</div> z
1269 !! html
1270 <div>foo</div> a
1271 <p>b
1272 c
1273 d e
1274 </p>
1275 x <div>foo</div> z
1276
1277 !! end
1278
1279 !! test
1280 Empty lines between lines with block tags
1281 !! wikitext
1282 <div></div>
1283
1284
1285 <div></div>a
1286
1287 b
1288 <div>a</div>b
1289
1290 <div>b</div>d
1291
1292
1293 <div>e</div>
1294 !! html
1295 <div></div>
1296 <p><br />
1297 </p>
1298 <div></div>a
1299 <p>b
1300 </p>
1301 <div>a</div>b
1302 <div>b</div>d
1303 <p><br />
1304 </p>
1305 <div>e</div>
1306
1307 !! end
1308
1309 ## PHP parser emits output which is broken
1310 !! test
1311 Unclosed HTML p-tags should be handled properly
1312 !! wikitext
1313 <div><p>foo</div>
1314 a
1315
1316 b
1317 !! html/parsoid
1318 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1319 <p>a</p>
1320 <p>b</p>
1321 !! end
1322
1323 ###
1324 ### Preformatted text
1325 ###
1326 !! test
1327 Preformatted text
1328 !! wikitext
1329 This is some
1330 Preformatted text
1331 With ''italic''
1332 And '''bold'''
1333 And a [[Main Page|link]]
1334 !! html
1335 <pre>This is some
1336 Preformatted text
1337 With <i>italic</i>
1338 And <b>bold</b>
1339 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1340 </pre>
1341 !! end
1342
1343 !! test
1344 Tabs don't trigger preformatted text
1345 !! wikitext
1346 This is not
1347 preformatted text.
1348 This is preformatted text.
1349 So is this.
1350 !! html
1351 <p> This is not
1352 preformatted text.
1353 </p>
1354 <pre>This is preformatted text.
1355 So is this.
1356 </pre>
1357 !! end
1358
1359 !! test
1360 Ident preformatting with inline content
1361 !! wikitext
1362 a
1363 ''b''
1364 !! html
1365 <pre>a
1366 <i>b</i>
1367 </pre>
1368 !! end
1369
1370 !! test
1371 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1372 !! wikitext
1373 <pre><nowiki>
1374 <b>
1375 <cite>
1376 <em>
1377 </nowiki></pre>
1378 !! html
1379 <pre>
1380 &lt;b&gt;
1381 &lt;cite&gt;
1382 &lt;em&gt;
1383 </pre>
1384
1385 !! end
1386
1387 !! test
1388 Regression with preformatted in <center>
1389 !! wikitext
1390 <center>
1391 Blah
1392 </center>
1393 !! html
1394 <center>
1395 <pre>Blah
1396 </pre>
1397 </center>
1398
1399 !! end
1400
1401 !! test
1402 Bug 52763: Preformatted in <blockquote>
1403 !! wikitext
1404 <blockquote>
1405 Blah
1406 {|
1407 |
1408 indented cell (no pre-wrapping!)
1409 |}
1410 </blockquote>
1411 !! html
1412 <blockquote>
1413 <p> Blah
1414 </p>
1415 <table>
1416 <tr>
1417 <td>
1418 <p> indented cell (no pre-wrapping!)
1419 </p>
1420 </td></tr></table>
1421 </blockquote>
1422
1423 !! end
1424
1425 !! test
1426 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1427 !! wikitext
1428 <blockquote>
1429 Foo
1430
1431 Bar
1432 </blockquote>
1433 !! html
1434 <blockquote>
1435 <p>Foo
1436 </p><p>Bar
1437 </p>
1438 </blockquote>
1439
1440 !! end
1441
1442 !! test
1443 Bug 15491: <ins>/<del> in blockquote
1444 !! wikitext
1445 <blockquote>
1446 Foo <del>bar</del> <ins>baz</ins> quux
1447 </blockquote>
1448 !! html
1449 <blockquote>
1450 <p>Foo <del>bar</del> <ins>baz</ins> quux
1451 </p>
1452 </blockquote>
1453
1454 !! end
1455
1456 # Note that the p-wrapping is newline sensitive, which could be
1457 # considered a bug: tidy will wrap only the 'Foo' in the example
1458 # below in a <p> tag. (see comment 23-25 of bug #6200)
1459 !! test
1460 Bug 15491: <ins>/<del> in blockquote (2)
1461 !! wikitext
1462 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1463 </blockquote>
1464 !! html
1465 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1466 </blockquote>
1467
1468 !! end
1469
1470 !! test
1471 <pre> with attributes (bug 3202)
1472 !! wikitext
1473 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1474 !! html
1475 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1476
1477 !! end
1478
1479 !! test
1480 <pre> with width attribute (bug 3202)
1481 !! wikitext
1482 <pre width="8">Narrow screen goodies</pre>
1483 !! html
1484 <pre width="8">Narrow screen goodies</pre>
1485
1486 !! end
1487
1488 !! test
1489 <pre> with forbidden attribute (bug 3202)
1490 !! wikitext
1491 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1492 !! html
1493 <pre width="8">Narrow screen goodies</pre>
1494
1495 !! end
1496
1497 !! test
1498 Entities inside <pre>
1499 !! wikitext
1500 <pre>&lt;</pre>
1501 !! html
1502 <pre>&lt;</pre>
1503
1504 !! end
1505
1506 !! test
1507 <pre> with forbidden attribute values (bug 3202)
1508 !! wikitext
1509 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1510 !! html
1511 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1512
1513 !! end
1514
1515 !! test
1516 <nowiki> inside <pre> (bug 13238)
1517 !! wikitext
1518 <pre>
1519 <nowiki>
1520 </pre>
1521 <pre>
1522 <nowiki></nowiki>
1523 </pre>
1524 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1525 !! html
1526 <pre>
1527 &lt;nowiki&gt;
1528 </pre>
1529 <pre>
1530
1531 </pre>
1532 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1533
1534 !! end
1535
1536 !! test
1537 <nowiki> and <pre> preference (first one wins)
1538 !! wikitext
1539 <pre>
1540 <nowiki>
1541 </pre>
1542 </nowiki>
1543 </pre>
1544
1545 <nowiki>
1546 <pre>
1547 <nowiki>
1548 </pre>
1549 </nowiki>
1550 </pre>
1551
1552 !! html
1553 <pre>
1554 &lt;nowiki&gt;
1555 </pre>
1556 <p>&lt;/nowiki&gt;
1557 &lt;/pre&gt;
1558 </p><p>
1559 &lt;pre&gt;
1560 &lt;nowiki&gt;
1561 &lt;/pre&gt;
1562
1563 &lt;/pre&gt;
1564 </p>
1565 !! end
1566
1567 !! test
1568 </pre> inside nowiki
1569 !! wikitext
1570 <nowiki></pre></nowiki>
1571 !! html
1572 <p>&lt;/pre&gt;
1573 </p>
1574 !! end
1575
1576 !! test
1577 Empty pre; pre inside other HTML tags (bug 54946)
1578 !! wikitext
1579 a
1580
1581 <div><pre>
1582 foo
1583 </pre></div>
1584 <pre></pre>
1585 !! html
1586 <p>a
1587 </p>
1588 <div><pre>
1589 foo
1590 </pre></div>
1591 <pre></pre>
1592
1593 !! end
1594
1595 !! test
1596 HTML pre followed by indent-pre
1597 !! wikitext
1598 <pre>foo</pre>
1599 bar
1600 !! html
1601 <pre>foo</pre>
1602 <pre>bar
1603 </pre>
1604 !! end
1605
1606 !!test
1607 Block tag pre
1608 !!options
1609 parsoid
1610 !! wikitext
1611 <p><pre>foo</pre></p>
1612 !! html
1613 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1614 !!end
1615
1616 !!test
1617 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1618 !! wikitext
1619 {{echo|}}
1620 !! html
1621
1622 !!end
1623
1624 !!test
1625 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1626 !! wikitext
1627 {{echo|
1628 foo}}
1629 !! html
1630 <p>foo
1631 </p>
1632 !!end
1633
1634 !! test
1635 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1636 !! wikitext
1637 {{echo|a
1638 b}}
1639 !! html
1640 <pre>a
1641 </pre>
1642 <p>b
1643 </p>
1644 !!end
1645
1646 !! test
1647 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1648 !! wikitext
1649 {{echo|a
1650 b
1651 c
1652 d
1653 e
1654 }}
1655 !! html
1656 <pre>a
1657 </pre>
1658 <p>b
1659 c
1660 </p>
1661 <pre>d
1662 </pre>
1663 <p>e
1664 </p>
1665 !!end
1666
1667 !!test
1668 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1669 !! wikitext
1670 {{echo| foo}}
1671
1672 {{echo| foo}}{{echo| bar}}
1673
1674 {{echo| foo}}
1675 {{echo| bar}}
1676
1677 {{echo|<!--cmt--> foo}}
1678
1679 <!--cmt-->{{echo| foo}}
1680
1681 {{echo|{{echo| }}bar}}
1682 !! html
1683 <pre>foo
1684 </pre>
1685 <pre>foo bar
1686 </pre>
1687 <pre>foo
1688 bar
1689 </pre>
1690 <pre>foo
1691 </pre>
1692 <pre>foo
1693 </pre>
1694 <pre>bar
1695 </pre>
1696 !!end
1697
1698 !! test
1699 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1700 !! wikitext
1701 {{echo| }}a
1702
1703 {{echo|
1704 }}a
1705
1706 {{echo|
1707 b}}
1708
1709 {{echo|a
1710 }}b
1711
1712 {{echo|a
1713 }} b
1714 !! html
1715 <pre>a
1716 </pre>
1717 <p><br />
1718 </p>
1719 <pre>a
1720 </pre>
1721 <p><br />
1722 </p>
1723 <pre>b
1724 </pre>
1725 <p>a
1726 </p>
1727 <pre>b
1728 </pre>
1729 <p>a
1730 </p>
1731 <pre>b
1732 </pre>
1733 !!end
1734
1735 !! test
1736 Things that look like <pre> tags aren't treated as such
1737 !! wikitext
1738 Barack Obama <President> of the United States
1739 !! html
1740 <p>Barack Obama &lt;President&gt; of the United States
1741 </p>
1742 !! end
1743
1744 !! test
1745 Parsoid: handle pre with space after attribute
1746 !! options
1747 parsoid=wt2html
1748 !! wikitext
1749 <pre style="width:50%;" >{{echo|foo}}</pre>
1750 !! html
1751 <pre style="width:50%;">{{echo|foo}}</pre>
1752 !! end
1753
1754 # TODO / maybe: fix wt2wt for this
1755 !! test
1756 Parsoid: Don't paragraph-wrap fosterable content
1757 !! options
1758 parsoid=wt2html
1759 !! wikitext
1760 {|
1761 <td></td>
1762 <td></td>
1763
1764
1765
1766 |}
1767 !! html
1768 <table>
1769
1770 <tbody>
1771 <tr>
1772 <td></td>
1773
1774 <td></td></tr>
1775
1776
1777
1778 </tbody></table>
1779 !! end
1780
1781 !! test
1782 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1783 !! options
1784 parsoid=wt2html
1785 !! wikitext
1786 {|
1787 <td>
1788 <td>
1789 </td>
1790
1791
1792
1793 |}
1794 !! html
1795 <table>
1796
1797 <tbody>
1798 <tr>
1799 <td></td>
1800
1801 <td>
1802 </td></tr>
1803
1804
1805
1806 </tbody></table>
1807 !! end
1808
1809
1810 #--------------------------------------------------------------------
1811 # Transclusion parameter whitespace stripping tests
1812 # Behavior is different for positional and named parameters
1813 #--------------------------------------------------------------------
1814 !! test
1815 Templates: Strip leading and trailing whitespace from named-param values
1816 !! wikitext
1817 {{echo|1= a }}
1818
1819 {{echo|1= {{echo|b}} }}
1820
1821 {{echo| 1 =
1822 c }}
1823
1824 {{echo| 1 =
1825 * d
1826 }}
1827 !! html
1828 <p>a
1829 </p><p>b
1830 </p><p>c
1831 </p>
1832 <ul>
1833 <li> d
1834 </li>
1835 </ul>
1836
1837 !! end
1838
1839 !! test
1840 Templates: Don't strip whitespace from positional-param values
1841 !! wikitext
1842 {{echo|a }}
1843
1844 {{echo|{{echo|b}} }}
1845
1846 {{echo| c
1847 }}
1848
1849 {{echo| {{echo|d}}
1850 }}
1851
1852 {{echo|
1853 e}}
1854
1855 {{echo|
1856 * f}}
1857
1858 {{echo|
1859 }}g
1860 !! html
1861 <p>a
1862 </p><p>b
1863 </p>
1864 <pre>c
1865 </pre>
1866 <p><br />
1867 </p>
1868 <pre>d
1869 </pre>
1870 <p><br />
1871 </p>
1872 <pre>e
1873 </pre>
1874 <p><br />
1875 </p>
1876 <ul>
1877 <li> f
1878 </li>
1879 </ul>
1880 <p><br />
1881 </p>
1882 <pre>g
1883 </pre>
1884 !! end
1885
1886 !! test
1887 Templates: Handle empty comment-and-ws-only lines correctly
1888 !! wikitext
1889 {{echo|foo
1890 <!--should be ignored-->
1891 <!--should be ignored as well-->
1892 bar}}
1893 !! html
1894 <p>foo
1895 bar
1896 </p>
1897 !! end
1898
1899 #--------------------------------------------------------------------
1900 # Transclusion parameter escaping tests
1901 #--------------------------------------------------------------------
1902 !! test
1903 Templates: Parsoid parameter escaping test 1
1904 !! options
1905 parsoid
1906 !! wikitext
1907 {{echo|[foo]|{{echo|[bar]}}}}
1908 !! html
1909 <p about="#mwt1" typeof="mw:Transclusion"
1910 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1911 !! end
1912
1913 !! test
1914 Parsoid: Pipes in external links in template parameter
1915 !! options
1916 parsoid
1917 !! wikitext
1918 {{echo|[{{echo|http://example.com}} link]}}
1919 !! html
1920 <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>
1921 !! end
1922
1923 !! test
1924 Parsoid: pipe in transclusion parameter
1925 !! options
1926 parsoid
1927 !! wikitext
1928 {{echo|http://foo.com/a&#124;b}}
1929 !! html
1930 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1931 typeof="mw:Transclusion"
1932 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>
1933 !! end
1934
1935 !! test
1936 Parsoid: Pipe in external link target and content in template parameter
1937 !! options
1938 parsoid=html2wt,wt2wt
1939 !! wikitext
1940 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1941 !! html
1942 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1943 typeof="mw:Transclusion"
1944 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1945 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1946 !! end
1947
1948 !! test
1949 Templates: Don't escape already nowiki-escaped text in template parameters
1950 !! options
1951 parsoid=html2wt,wt2wt
1952 !! wikitext
1953 {{echo|foo<nowiki>|</nowiki>bar}}
1954 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1955 {{echo|<nowiki></nowiki>}}
1956 !! html
1957 <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>
1958 <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>
1959 <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>
1960 </p>
1961 !! end
1962
1963 ## Bug 52824
1964 !! test
1965 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1966 !! options
1967 parsoid=html2wt,wt2wt
1968 !! wikitext
1969 {{echo|{{echo|1=bar}}}}
1970 !! html
1971 <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>
1972 !! end
1973
1974 ## Bug 56733
1975 !! test
1976 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
1977 !! options
1978 parsoid
1979 !! wikitext
1980 {{echo|a : b}}
1981 !! html
1982 <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>
1983 !! end
1984
1985 ###
1986 ### Parsoid-centric tests for testing RT edge cases for pre
1987 ###
1988
1989 !!test
1990 1a. Indent-Pre and Comments
1991 !! wikitext
1992 a
1993 <!--a-->
1994 c
1995 !! html
1996 <pre>a
1997 </pre>
1998 <p>c
1999 </p>
2000 !!end
2001
2002 !!test
2003 1b. Indent-Pre and Comments
2004 !! wikitext
2005 a
2006 <!--a-->
2007 c
2008 !! html
2009 <pre>a
2010 </pre>
2011 <p>c
2012 </p>
2013 !!end
2014
2015 !!test
2016 1c. Indent-Pre and Comments
2017 !! wikitext
2018 <!--a--> a
2019
2020 <!--a--> a
2021 !! html
2022 <pre> a
2023 </pre>
2024 <pre> a
2025 </pre>
2026 !!end
2027
2028 !!test
2029 1d. Indent-Pre and Comments
2030 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2031 !! wikitext
2032 <!--a--> a
2033
2034 <!--b-->b
2035 !! html
2036 <pre>a
2037 </pre>
2038 <pre>b
2039 </pre>
2040 !!end
2041
2042 !!test
2043 2a. Indent-Pre and tables
2044 !! wikitext
2045 {|
2046 |-
2047 !h1!!h2
2048 |foo||bar
2049 |}
2050 !! html
2051 <table>
2052
2053 <tr>
2054 <th>h1</th>
2055 <th>h2
2056 </th>
2057 <td>foo</td>
2058 <td>bar
2059 </td></tr></table>
2060
2061 !!end
2062
2063 !!test
2064 2b. Indent-Pre and tables
2065 !! wikitext
2066 {|
2067 |-
2068 |foo
2069 |}
2070 !! html
2071 <table>
2072
2073 <tr>
2074 <td>foo
2075 </td></tr></table>
2076
2077 !!end
2078
2079 !!test
2080 2c. Indent-Pre and tables (bug 42252)
2081 !! wikitext
2082 {|
2083 |+ foo
2084 ! | bar
2085 |}
2086 !! html
2087 <table>
2088 <caption> foo
2089 </caption>
2090 <tr>
2091 <th> bar
2092 </th></tr></table>
2093
2094 !!end
2095
2096 !!test
2097 3a. Indent-Pre and block tags (single-line html)
2098 !! wikitext
2099 a <p> foo </p>
2100 b <div> foo </div>
2101 c <blockquote> foo </blockquote>
2102 <span> foo </span>
2103 !! html
2104 a <p> foo </p>
2105 b <div> foo </div>
2106 c <blockquote> foo </blockquote>
2107 <pre><span> foo </span>
2108 </pre>
2109 !!end
2110
2111 !!test
2112 3b. Indent-Pre and block tags (multi-line html)
2113 !! wikitext
2114 a <span>foo</span>
2115 b <div> foo </div>
2116 !! html
2117 <pre>a <span>foo</span>
2118 </pre>
2119 b <div> foo </div>
2120
2121 !!end
2122
2123 !!test
2124 3c. Indent-Pre and block tags (pre-content on separate line)
2125 !! wikitext
2126 <p>
2127 foo
2128 </p>
2129
2130 <div>
2131 foo
2132 </div>
2133
2134 <center>
2135 foo
2136 </center>
2137
2138 <blockquote>
2139 foo
2140 </blockquote>
2141
2142 <blockquote>
2143 <pre>
2144 foo
2145 </pre>
2146 </blockquote>
2147
2148 <table><tr><td>
2149 foo
2150 </td></tr></table>
2151
2152 <ul><li>
2153 foo
2154 </li></ul>
2155
2156 !! html
2157 <p>
2158 foo
2159 </p>
2160 <div>
2161 <pre>foo
2162 </pre>
2163 </div>
2164 <center>
2165 <pre>foo
2166 </pre>
2167 </center>
2168 <blockquote>
2169 <p> foo
2170 </p>
2171 </blockquote>
2172 <blockquote>
2173 <pre>
2174 foo
2175 </pre>
2176 </blockquote>
2177 <table><tr><td>
2178 <pre>foo
2179 </pre>
2180 </td></tr></table>
2181 <ul><li>
2182 foo
2183 </li></ul>
2184
2185 !!end
2186
2187 !!test
2188 4. Indent-Pre and extension tags
2189 !! wikitext
2190 a <gallery>
2191 File:foobar.jpg
2192 </gallery>
2193 !! html
2194 a <ul class="gallery mw-gallery-traditional">
2195 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2196 <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>
2197 <div class="gallerytext">
2198 </div>
2199 </div></li>
2200 </ul>
2201
2202 !!end
2203
2204 !! test
2205 Leading pipes outside of tables
2206 !! options
2207 parsoid
2208 !! wikitext
2209 | foo
2210 !! html
2211 <p>| foo</p>
2212 !! end
2213
2214 !! test
2215 Leading pipes outside of tables 2
2216 !! options
2217 parsoid
2218 !! wikitext
2219 a
2220 | foo
2221 b
2222 !! html
2223 <p>a
2224 | foo
2225 b</p>
2226 !! end
2227
2228 !! test
2229 Leading pipes outside of tables 3
2230 !! options
2231 parsoid
2232 !! wikitext
2233 a
2234 | class="foo bar" | baz
2235 b
2236 !! html
2237 <p>a
2238 | class="foo bar" | baz
2239 b</p>
2240 !! end
2241
2242 !!test
2243 Render paragraphs when indent-pre is suppressed in blocklevels
2244 !! wikitext
2245 <blockquote>
2246 foo
2247
2248 bar
2249 </blockquote>
2250 !! html
2251 <blockquote>
2252 <p> foo
2253 </p><p> bar
2254 </p>
2255 </blockquote>
2256
2257 !!end
2258
2259 !!test
2260 4. Multiple spaces at start-of-line
2261 !! wikitext
2262 <p> foo </p>
2263 foo
2264 {|
2265 |foo
2266 |}
2267 !! html
2268 <p> foo </p>
2269 <pre> foo
2270 </pre>
2271 <table>
2272 <tr>
2273 <td>foo
2274 </td></tr></table>
2275
2276 !!end
2277
2278 ## NOTE: the leading white-space chars on empty line are significant
2279 !! test
2280 5a. White-space in indent-pre
2281 !! wikitext
2282 a<br />
2283
2284 b
2285 !! html
2286 <pre>a<br />
2287
2288 b
2289 </pre>
2290 !! end
2291
2292 ## NOTE: the leading white-space chars on empty line are significant
2293 !! test
2294 5b. White-space in indent-pre
2295 !! wikitext
2296 a
2297
2298 b
2299
2300
2301 c
2302 !! html
2303 <pre>a
2304
2305 b
2306
2307
2308 c
2309 </pre>
2310 !! end
2311
2312 !! test
2313 5c. White-space in indent-pre
2314 !! wikitext
2315 ''a''
2316 ''b''
2317 ''c''
2318 !! html
2319 <pre><i>a</i>
2320 <i>b</i>
2321 <i>c</i>
2322 </pre>
2323 !! end
2324
2325 !! test
2326 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2327 !! wikitext
2328 a
2329
2330 <!-- continue -->
2331 b
2332
2333 c
2334
2335 d
2336 !! html
2337 <pre>a
2338
2339 b
2340 </pre>
2341 <pre>c
2342
2343 </pre>
2344 <p>d
2345 </p>
2346 !! end
2347
2348 !! test
2349 7a. Indent-pre and category links
2350 !! options
2351 parsoid=wt2html,wt2wt
2352 !! wikitext
2353 [[Category:foo]] <!-- No pre-wrapping -->
2354 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2355 !! html
2356 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2357 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2358 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2359 !! end
2360
2361 !! test
2362 7b. Indent-pre and category links
2363 !! options
2364 parsoid=wt2html,wt2wt
2365 !! wikitext
2366 [[Category:foo]] a
2367 [[Category:foo]] {{echo|b}}
2368 !! html
2369 <pre>
2370 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2371
2372 <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>
2373 !! end
2374
2375 ###
2376 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2377 ###
2378
2379 !!test
2380 HTML-pre: 1. embedded newlines
2381 !! wikitext
2382 <pre>foo</pre>
2383
2384 <pre>
2385 foo
2386 </pre>
2387
2388 <pre>
2389
2390 foo
2391 </pre>
2392
2393 <pre>
2394
2395
2396 foo
2397 </pre>
2398 !! html
2399 <pre>foo</pre>
2400 <pre>
2401 foo
2402 </pre>
2403 <pre>
2404
2405 foo
2406 </pre>
2407 <pre>
2408
2409
2410 foo
2411 </pre>
2412
2413 !!end
2414
2415 !!test
2416 HTML-pre: 2: indented text
2417 !! wikitext
2418 <pre>
2419 foo
2420 </pre>
2421 !! html
2422 <pre>
2423 foo
2424 </pre>
2425
2426 !!end
2427
2428 !!test
2429 HTML-pre: 3: other wikitext
2430 !! wikitext
2431 <pre>
2432 * foo
2433 # bar
2434 = no-h =
2435 '' no-italic ''
2436 [[ NoLink ]]
2437 </pre>
2438 !! html
2439 <pre>
2440 * foo
2441 # bar
2442 = no-h =
2443 '' no-italic ''
2444 [[ NoLink ]]
2445 </pre>
2446
2447 !!end
2448
2449 ###
2450 ### Definition lists
2451 ###
2452 !! test
2453 Simple definition
2454 !! wikitext
2455 ; name : Definition
2456 !! html
2457 <dl>
2458 <dt> name&#160;</dt>
2459 <dd> Definition
2460 </dd>
2461 </dl>
2462
2463 !! end
2464
2465 !! test
2466 Definition list for indentation only
2467 !! wikitext
2468 : Indented text
2469 !! html
2470 <dl>
2471 <dd> Indented text
2472 </dd>
2473 </dl>
2474
2475 !! end
2476
2477 !! test
2478 Definition list with no space
2479 !! wikitext
2480 ;name:Definition
2481 !! html
2482 <dl>
2483 <dt>name</dt>
2484 <dd>Definition
2485 </dd>
2486 </dl>
2487
2488 !!end
2489
2490 !! test
2491 Definition list with URL link
2492 !! wikitext
2493 ; http://example.com/ : definition
2494 !! html
2495 <dl>
2496 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2497 <dd> definition
2498 </dd>
2499 </dl>
2500
2501 !! end
2502
2503 !! test
2504 Definition list with bracketed URL link
2505 !! wikitext
2506 ;[http://www.example.com/ Example]:Something about it
2507 !! html
2508 <dl>
2509 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2510 <dd>Something about it
2511 </dd>
2512 </dl>
2513
2514 !! end
2515
2516 !! test
2517 Definition list with wikilink containing colon
2518 !! wikitext
2519 ; [[Help:FAQ]]: The least-read page on Wikipedia
2520 !! html
2521 <dl>
2522 <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>
2523 <dd> The least-read page on Wikipedia
2524 </dd>
2525 </dl>
2526
2527 !! end
2528
2529 # At Brion's and JeLuF's insistence... :)
2530 !! test
2531 Definition list with news link containing colon
2532 !! wikitext
2533 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2534 !! html
2535 <dl>
2536 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2537 <dd> This isn't even a real newsgroup!
2538 </dd>
2539 </dl>
2540
2541 !! end
2542
2543 !! test
2544 Malformed definition list with colon
2545 !! wikitext
2546 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2547 !! html
2548 <dl>
2549 <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
2550 </dt>
2551 </dl>
2552
2553 !! end
2554
2555 !! test
2556 Definition lists: colon in external link text
2557 !! wikitext
2558 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2559 !! html
2560 <dl>
2561 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2562 <dd> OK, I made that up
2563 </dd>
2564 </dl>
2565
2566 !! end
2567
2568 !! test
2569 Definition lists: colon in HTML attribute
2570 !! wikitext
2571 ;<b style="display: inline">bold</b>
2572 !! html
2573 <dl>
2574 <dt><b style="display: inline">bold</b>
2575 </dt>
2576 </dl>
2577
2578 !! end
2579
2580 !! test
2581 Definition lists: self-closed tag
2582 !! wikitext
2583 ;one<br/>two : two-line fun
2584 !! html
2585 <dl>
2586 <dt>one<br />two&#160;</dt>
2587 <dd> two-line fun
2588 </dd>
2589 </dl>
2590
2591 !! end
2592
2593 !! test
2594 Bug 11748: Literal closing tags
2595 !! wikitext
2596 <dl>
2597 <dt>test 1</dt>
2598 <dd>test test test test test</dd>
2599 <dt>test 2</dt>
2600 <dd>test test test test test</dd>
2601 </dl>
2602 !! html
2603 <dl>
2604 <dt>test 1</dt>
2605 <dd>test test test test test</dd>
2606 <dt>test 2</dt>
2607 <dd>test test test test test</dd>
2608 </dl>
2609
2610 !! end
2611
2612 !! test
2613 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2614 !! wikitext
2615 <ul><li>
2616 ; term : description
2617 * unordered
2618 </li></ul>
2619 !! html
2620 <ul><li>
2621 <dl>
2622 <dt> term&#160;</dt>
2623 <dd> description
2624 </dd>
2625 </dl>
2626 <ul>
2627 <li> unordered
2628 </li>
2629 </ul>
2630 </li></ul>
2631
2632 !! end
2633
2634 !! test
2635
2636 Definition list with empty definition and following paragraph
2637 !! wikitext
2638 ; term:
2639 Paragraph text
2640 !! html
2641 <dl>
2642 <dt> term</dt>
2643 <dd>
2644 </dd>
2645 </dl>
2646 <p>Paragraph text
2647 </p>
2648 !! end
2649
2650 !! test
2651 Nested definition lists using html syntax
2652 !! wikitext
2653 <dl><dd>
2654 <dl>
2655 <dd>Foo</dd>
2656 </dl>
2657 </dd></dl>
2658 !! html
2659 <dl><dd>
2660 <dl>
2661 <dd>Foo</dd>
2662 </dl>
2663 </dd></dl>
2664
2665 !! end
2666
2667 !! test
2668 Definition Lists: No nesting: Multiple dd's
2669 !! wikitext
2670 ;x
2671 :a
2672 :b
2673 !! html
2674 <dl>
2675 <dt>x
2676 </dt>
2677 <dd>a
2678 </dd>
2679 <dd>b
2680 </dd>
2681 </dl>
2682
2683 !! end
2684
2685 !! test
2686 Definition Lists: Indentation: Regular
2687 !! wikitext
2688 :i1
2689 ::i2
2690 :::i3
2691 !! html
2692 <dl>
2693 <dd>i1
2694 <dl>
2695 <dd>i2
2696 <dl>
2697 <dd>i3
2698 </dd>
2699 </dl>
2700 </dd>
2701 </dl>
2702 </dd>
2703 </dl>
2704
2705 !! end
2706
2707 !! test
2708 Definition Lists: Indentation: Missing 1st level
2709 !! wikitext
2710 ::i2
2711 :::i3
2712 !! html
2713 <dl>
2714 <dd><dl>
2715 <dd>i2
2716 <dl>
2717 <dd>i3
2718 </dd>
2719 </dl>
2720 </dd>
2721 </dl>
2722 </dd>
2723 </dl>
2724
2725 !! end
2726
2727 !! test
2728 Definition Lists: Indentation: Multi-level indent
2729 !! wikitext
2730 :::i3
2731 !! html
2732 <dl>
2733 <dd><dl>
2734 <dd><dl>
2735 <dd>i3
2736 </dd>
2737 </dl>
2738 </dd>
2739 </dl>
2740 </dd>
2741 </dl>
2742
2743 !! end
2744
2745 !! test
2746 Definition Lists: Hacky use to indent tables
2747 !! wikitext
2748 ::{|
2749 |foo
2750 |bar
2751 |}
2752 this text
2753 should be left alone
2754 !! html
2755 <dl><dd><dl><dd><table>
2756 <tr>
2757 <td>foo
2758 </td>
2759 <td>bar
2760 </td></tr></table></dd></dl></dd></dl>
2761 <p>this text
2762 should be left alone
2763 </p>
2764 !! end
2765
2766 # Bug 52473
2767 !! test
2768 Definition Lists: Hacky use to indent tables (WS-insensitive)
2769 !! options
2770 parsoid
2771 !! wikitext
2772 : {|
2773 |a
2774 |}
2775 !! html
2776 <dl>
2777 <dd> <table><tr><td>a</td></tr></table> </dd>
2778 </dl>
2779 !! end
2780 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2781 ## as an empty dt item. It also ignores all but the last ";" when followed
2782 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2783 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2784 ## ";"s.
2785 ##
2786 ## Ex: ";;t2 ::d2" is transformed into:
2787 ##
2788 ## <dl>
2789 ## <dt>t2 </dt>
2790 ## <dd>
2791 ## <dl>
2792 ## <dt></dt>
2793 ## <dd>d2</dd>
2794 ## </dl>
2795 ## </dd>
2796 ## </dl>
2797 ##
2798 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2799 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2800 ##
2801 ## <dl>
2802 ## <dt>
2803 ## <dl>
2804 ## <dt>t2 </dt>
2805 ## <dd>:d2</dd>
2806 ## </dl>
2807 ## </dt>
2808 ## </dl>
2809 ##
2810 ## All Parsoid only definition list tests have this difference.
2811 ##
2812 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2813 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2814
2815 !! test
2816 Table / list interaction: indented table with lists in table contents
2817 !! wikitext
2818 :{|
2819 |-
2820 | a
2821 * b
2822 |-
2823 | c
2824 * d
2825 |}
2826 !! html
2827 <dl><dd><table>
2828
2829 <tr>
2830 <td> a
2831 <ul>
2832 <li> b
2833 </li>
2834 </ul>
2835 </td></tr>
2836 <tr>
2837 <td> c
2838 <ul>
2839 <li> d
2840 </li>
2841 </ul>
2842 </td></tr></table></dd></dl>
2843
2844 !! end
2845
2846 !!test
2847 Table / list interaction: lists nested in tables nested in indented lists
2848 !! wikitext
2849 :{|
2850 |
2851 :a
2852 :b
2853 |
2854 *c
2855 *d
2856 |}
2857
2858 *e
2859 *f
2860 !! html
2861 <dl><dd><table>
2862 <tr>
2863 <td>
2864 <dl>
2865 <dd>a
2866 </dd>
2867 <dd>b
2868 </dd>
2869 </dl>
2870 </td>
2871 <td>
2872 <ul>
2873 <li>c
2874 </li>
2875 <li>d
2876 </li>
2877 </ul>
2878 </td></tr></table></dd></dl>
2879 <ul>
2880 <li>e
2881 </li>
2882 <li>f
2883 </li>
2884 </ul>
2885
2886 !!end
2887
2888 !! test
2889 Definition Lists: Nesting: Multi-level (Parsoid only)
2890 !! options
2891 parsoid
2892 !! wikitext
2893 ;t1 :d1
2894 ;;t2 ::d2
2895 ;;;t3 :::d3
2896 !! html
2897 <dl>
2898 <dt>t1 </dt>
2899 <dd>d1</dd>
2900 <dt>
2901 <dl>
2902 <dt>t2 </dt>
2903 <dd>:d2</dd>
2904 <dt>
2905 <dl>
2906 <dt>t3 </dt>
2907 <dd>::d3</dd>
2908 </dl>
2909 </dt>
2910 </dl>
2911 </dt>
2912 </dl>
2913
2914
2915 !! end
2916
2917
2918 !! test
2919 Definition Lists: Nesting: Test 2 (Parsoid only)
2920 !! options
2921 parsoid
2922 !! wikitext
2923 ;t1
2924 ::d2
2925 !! html
2926 <dl>
2927 <dt>t1</dt>
2928 <dd>
2929 <dl>
2930 <dd>d2</dd>
2931 </dl>
2932 </dd>
2933 </dl>
2934
2935 !! end
2936
2937
2938 !! test
2939 Definition Lists: Nesting: Test 3 (Parsoid only)
2940 !! options
2941 parsoid
2942 !! wikitext
2943 :;t1
2944 ::::d2
2945 !! html
2946 <dl>
2947 <dd>
2948 <dl>
2949 <dt>t1</dt>
2950 <dd>
2951 <dl>
2952 <dd>
2953 <dl>
2954 <dd>d2</dd>
2955 </dl>
2956 </dd>
2957 </dl>
2958 </dd>
2959 </dl>
2960 </dd>
2961 </dl>
2962
2963 !! end
2964
2965
2966 !! test
2967 Definition Lists: Nesting: Test 4
2968 !! wikitext
2969 ::;t3
2970 :::d3
2971 !! html
2972 <dl>
2973 <dd><dl>
2974 <dd><dl>
2975 <dt>t3
2976 </dt>
2977 <dd>d3
2978 </dd>
2979 </dl>
2980 </dd>
2981 </dl>
2982 </dd>
2983 </dl>
2984
2985 !! end
2986
2987
2988 ## The Parsoid team believes the following three test exposes a
2989 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2990 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2991 !! test
2992 Definition Lists: Mixed Lists: Test 1
2993 !! wikitext
2994 :;* foo
2995 ::* bar
2996 :; baz
2997 !! html/php
2998 <dl>
2999 <dd><dl>
3000 <dt><ul>
3001 <li> foo
3002 </li>
3003 <li> bar
3004 </li>
3005 </ul>
3006 </dt>
3007 </dl>
3008 <dl>
3009 <dt> baz
3010 </dt>
3011 </dl>
3012 </dd>
3013 </dl>
3014
3015 !! html/parsoid
3016 <dl>
3017 <dd><dl>
3018 <dt><ul>
3019 <li> foo
3020 </li>
3021 </ul></dt>
3022 <dd><ul>
3023 <li> bar
3024 </li>
3025 </ul></dd>
3026 <dt> baz</dt>
3027 </dl></dd>
3028 </dl>
3029 !! end
3030
3031 !! test
3032 Definition Lists: Mixed Lists: Test 2
3033 !! wikitext
3034 *: d1
3035 *: d2
3036 !! html
3037 <ul>
3038 <li><dl>
3039 <dd> d1
3040 </dd>
3041 <dd> d2
3042 </dd>
3043 </dl>
3044 </li>
3045 </ul>
3046
3047 !! end
3048
3049
3050 !! test
3051 Definition Lists: Mixed Lists: Test 3
3052 !! wikitext
3053 *::: d1
3054 *::: d2
3055 !! html
3056 <ul>
3057 <li><dl>
3058 <dd><dl>
3059 <dd><dl>
3060 <dd> d1
3061 </dd>
3062 <dd> d2
3063 </dd>
3064 </dl>
3065 </dd>
3066 </dl>
3067 </dd>
3068 </dl>
3069 </li>
3070 </ul>
3071
3072 !! end
3073
3074
3075 !! test
3076 Definition Lists: Mixed Lists: Test 4
3077 !! wikitext
3078 *;d1 :d2
3079 *;d3 :d4
3080 !! html
3081 <ul>
3082 <li><dl>
3083 <dt>d1&#160;</dt>
3084 <dd>d2
3085 </dd>
3086 <dt>d3&#160;</dt>
3087 <dd>d4
3088 </dd>
3089 </dl>
3090 </li>
3091 </ul>
3092
3093 !! end
3094
3095
3096 !! test
3097 Definition Lists: Mixed Lists: Test 5
3098 !! wikitext
3099 *:d1
3100 *:: d2
3101 !! html
3102 <ul>
3103 <li><dl>
3104 <dd>d1
3105 <dl>
3106 <dd> d2
3107 </dd>
3108 </dl>
3109 </dd>
3110 </dl>
3111 </li>
3112 </ul>
3113
3114 !! end
3115
3116
3117 !! test
3118 Definition Lists: Mixed Lists: Test 6
3119 !! wikitext
3120 #*:d1
3121 #*::: d3
3122 !! html
3123 <ol>
3124 <li><ul>
3125 <li><dl>
3126 <dd>d1
3127 <dl>
3128 <dd><dl>
3129 <dd> d3
3130 </dd>
3131 </dl>
3132 </dd>
3133 </dl>
3134 </dd>
3135 </dl>
3136 </li>
3137 </ul>
3138 </li>
3139 </ol>
3140
3141 !! end
3142
3143
3144 !! test
3145 Definition Lists: Mixed Lists: Test 7
3146 !! wikitext
3147 :* d1
3148 :* d2
3149 !! html
3150 <dl>
3151 <dd><ul>
3152 <li> d1
3153 </li>
3154 <li> d2
3155 </li>
3156 </ul>
3157 </dd>
3158 </dl>
3159
3160 !! end
3161
3162
3163 !! test
3164 Definition Lists: Mixed Lists: Test 8
3165 !! wikitext
3166 :* d1
3167 ::* d2
3168 !! html
3169 <dl>
3170 <dd><ul>
3171 <li> d1
3172 </li>
3173 </ul>
3174 <dl>
3175 <dd><ul>
3176 <li> d2
3177 </li>
3178 </ul>
3179 </dd>
3180 </dl>
3181 </dd>
3182 </dl>
3183
3184 !! end
3185
3186
3187 !! test
3188 Definition Lists: Mixed Lists: Test 9
3189 !! wikitext
3190 *;foo :bar
3191 !! html
3192 <ul>
3193 <li><dl>
3194 <dt>foo&#160;</dt>
3195 <dd>bar
3196 </dd>
3197 </dl>
3198 </li>
3199 </ul>
3200
3201 !! end
3202
3203
3204 !! test
3205 Definition Lists: Mixed Lists: Test 10
3206 !! wikitext
3207 *#;foo :bar
3208 !! html
3209 <ul>
3210 <li><ol>
3211 <li><dl>
3212 <dt>foo&#160;</dt>
3213 <dd>bar
3214 </dd>
3215 </dl>
3216 </li>
3217 </ol>
3218 </li>
3219 </ul>
3220
3221 !! end
3222
3223 # The Parsoid team disagrees with the PHP parser's seemingly-random
3224 # rules regarding dd/dt on the next two tests. Parsoid is more
3225 # consistent, and recognizes the shared nesting and keeps the
3226 # still-open tags around until the nesting is complete.
3227
3228 !! test
3229 Definition Lists: Mixed Lists: Test 11
3230 !! wikitext
3231 *#*#;*;;foo :bar
3232 *#*#;boo :baz
3233 !! html/php
3234 <ul>
3235 <li><ol>
3236 <li><ul>
3237 <li><ol>
3238 <li><dl>
3239 <dt>foo&#160;</dt>
3240 <dd><ul>
3241 <li><dl>
3242 <dt><dl>
3243 <dt>bar
3244 </dt>
3245 </dl>
3246 </dd>
3247 </dl>
3248 </li>
3249 </ul>
3250 </dd>
3251 </dl>
3252 <dl>
3253 <dt>boo&#160;</dt>
3254 <dd>baz
3255 </dd>
3256 </dl>
3257 </li>
3258 </ol>
3259 </li>
3260 </ul>
3261 </li>
3262 </ol>
3263 </li>
3264 </ul>
3265
3266 !! html/parsoid
3267 <ul>
3268 <li>
3269 <ol>
3270 <li>
3271 <ul>
3272 <li>
3273 <ol>
3274 <li>
3275 <dl>
3276 <dt>
3277 <ul>
3278 <li>
3279 <dl>
3280 <dt>
3281 <dl>
3282 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3283 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3284 </dl></dt>
3285 </dl></li>
3286 </ul></dt>
3287 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3288 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3289 </dl></li>
3290 </ol></li>
3291 </ul></li>
3292 </ol></li>
3293 </ul>
3294 !! end
3295
3296
3297 !! test
3298 Definition Lists: Weird Ones: Test 1
3299 !! wikitext
3300 *#;*::;; foo : bar (who uses this?)
3301 !! html/php
3302 <ul>
3303 <li><ol>
3304 <li><dl>
3305 <dt> foo&#160;</dt>
3306 <dd><ul>
3307 <li><dl>
3308 <dd><dl>
3309 <dd><dl>
3310 <dt><dl>
3311 <dt> bar (who uses this?)
3312 </dt>
3313 </dl>
3314 </dd>
3315 </dl>
3316 </dd>
3317 </dl>
3318 </dd>
3319 </dl>
3320 </li>
3321 </ul>
3322 </dd>
3323 </dl>
3324 </li>
3325 </ol>
3326 </li>
3327 </ul>
3328
3329 !! html/parsoid
3330 <ul>
3331 <li>
3332 <ol>
3333 <li>
3334 <dl>
3335 <dt>
3336 <ul>
3337 <li>
3338 <dl>
3339 <dd>
3340 <dl>
3341 <dd>
3342 <dl>
3343 <dt>
3344 <dl>
3345 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3346 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3347 </dl></dt>
3348 </dl></dd>
3349 </dl></dd>
3350 </dl></li>
3351 </ul></dt>
3352 </dl></li>
3353 </ol></li>
3354 </ul>
3355 !! end
3356
3357 ###
3358 ### External links
3359 ###
3360 !! test
3361 External links: non-bracketed
3362 !! wikitext
3363 Non-bracketed: http://example.com
3364 !! html
3365 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3366 </p>
3367 !! end
3368
3369 !! test
3370 External links: numbered
3371 !! wikitext
3372 Numbered: [http://example.com]
3373 Numbered: [http://example.net]
3374 Numbered: [http://example.com]
3375 !! html
3376 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3377 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3378 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3379 </p>
3380 !!end
3381
3382 !! test
3383 External links: specified text
3384 !! wikitext
3385 Specified text: [http://example.com link]
3386 !! html
3387 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3388 </p>
3389 !!end
3390
3391 !! test
3392 External links: trail
3393 !! wikitext
3394 Linktrails should not work for external links: [http://example.com link]s
3395 !! html
3396 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3397 </p>
3398 !! end
3399
3400 !! test
3401 External links: dollar sign in URL
3402 !! wikitext
3403 http://example.com/1$2345
3404 !! html
3405 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3406 </p>
3407 !! end
3408
3409 !! test
3410 External links: dollar sign in URL (named)
3411 !! wikitext
3412 [http://example.com/1$2345]
3413 !! html
3414 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3415 </p>
3416 !!end
3417
3418 !! test
3419 External links: open square bracket forbidden in URL (bug 4377)
3420 !! wikitext
3421 http://example.com/1[2345
3422 !! html
3423 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3424 </p>
3425 !! end
3426
3427 !! test
3428 External links: open square bracket forbidden in URL (named) (bug 4377)
3429 !! wikitext
3430 [http://example.com/1[2345]
3431 !! html
3432 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3433 </p>
3434 !!end
3435
3436 !! test
3437 External links: nowiki in URL link text (bug 6230)
3438 !! wikitext
3439 [http://example.com/ <nowiki>''example site''</nowiki>]
3440 !! html
3441 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3442 </p>
3443 !! end
3444
3445 !! test
3446 External links: newline forbidden in text (bug 6230 regression check)
3447 !! wikitext
3448 [http://example.com/ first
3449 second]
3450 !! html
3451 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3452 second]
3453 </p>
3454 !!end
3455
3456 !! test
3457 External links: Pipe char between url and text
3458 !! wikitext
3459 [http://example.com | link]
3460 !! html
3461 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3462 </p>
3463 !!end
3464
3465 !! test
3466 External links: protocol-relative URL in brackets
3467 !! wikitext
3468 [//example.com/ Test]
3469 !! html
3470 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3471 </p>
3472 !! end
3473
3474 !! test
3475 External links: protocol-relative URL in brackets without text
3476 !! wikitext
3477 [//example.com]
3478 !! html
3479 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3480 </p>
3481 !! end
3482
3483 !! test
3484 External links: protocol-relative URL in free text is left alone
3485 !! wikitext
3486 //example.com/Foo
3487 !! html
3488 <p>//example.com/Foo
3489 </p>
3490 !!end
3491
3492 !! test
3493 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3494 !! wikitext
3495 foo//example.com/Foo
3496 !! html
3497 <p>foo//example.com/Foo
3498 </p>
3499 !! end
3500
3501 !! test
3502 External image
3503 !! wikitext
3504 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3505 !! html
3506 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3507 </p>
3508 !! end
3509
3510 !! test
3511 External image from https
3512 !! wikitext
3513 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3514 !! html
3515 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3516 </p>
3517 !! end
3518
3519 !! test
3520 External image (when not allowed)
3521 !! options
3522 wgAllowExternalImages=0
3523 !! wikitext
3524 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3525 !! html
3526 <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>
3527 </p>
3528 !! end
3529
3530 !! test
3531 Link to non-http image, no img tag
3532 !! wikitext
3533 Link to non-http image, no img tag: ftp://example.com/test.jpg
3534 !! html
3535 <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>
3536 </p>
3537 !! end
3538
3539 !! test
3540 External links: terminating separator
3541 !! wikitext
3542 Terminating separator: http://example.com/thing,
3543 !! html
3544 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3545 </p>
3546 !! end
3547
3548 !! test
3549 External links: intervening separator
3550 !! wikitext
3551 Intervening separator: http://example.com/1,2,3
3552 !! html
3553 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3554 </p>
3555 !! end
3556
3557 !! test
3558 External links: old bug with URL in query
3559 !! wikitext
3560 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3561 !! html
3562 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3563 </p>
3564 !! end
3565
3566 !! test
3567 External links: old URL-in-URL bug, mixed protocols
3568 !! wikitext
3569 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3570 !! html
3571 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3572 </p>
3573 !!end
3574
3575 !! test
3576 External links: URL in text
3577 !! wikitext
3578 URL in text: [http://example.com http://example.com]
3579 !! html
3580 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3581 </p>
3582 !! end
3583
3584 !! test
3585 External links: Clickable images
3586 !! wikitext
3587 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3588 !! html
3589 <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>
3590 </p>
3591 !!end
3592
3593 !! test
3594 External links: raw ampersand
3595 !! wikitext
3596 Old &amp; use: http://x&y
3597 !! html
3598 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3599 </p>
3600 !! end
3601
3602 !! test
3603 External links: encoded ampersand
3604 !! wikitext
3605 Old &amp; use: http://x&amp;y
3606 !! html
3607 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3608 </p>
3609 !! end
3610
3611 !! test
3612 External links: encoded equals (bug 6102)
3613 !! wikitext
3614 http://example.com/?foo&#61;bar
3615 !! html
3616 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3617 </p>
3618 !! end
3619
3620 !! test
3621 External links: [raw ampersand]
3622 !! wikitext
3623 Old &amp; use: [http://x&y]
3624 !! html
3625 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3626 </p>
3627 !! end
3628
3629 !! test
3630 External links: [encoded ampersand]
3631 !! wikitext
3632 Old &amp; use: [http://x&amp;y]
3633 !! html
3634 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3635 </p>
3636 !! end
3637
3638 !! test
3639 External links: [encoded equals] (bug 6102)
3640 !! wikitext
3641 [http://example.com/?foo&#61;bar]
3642 !! html
3643 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3644 </p>
3645 !! end
3646
3647 !! test
3648 External links: [IDN ignored character reference in hostname; strip it right off]
3649 !! wikitext
3650 [http://e&zwnj;xample.com/]
3651 !! html
3652 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3653 </p>
3654 !! end
3655
3656 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3657 # Where an external link could easily circumvent the sanitization of the text of
3658 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3659 # test demands a higher standard. That's a bit strange.
3660 #
3661 # Example:
3662 #
3663 # http://e‌xample.com -> [http://example.com|http://example.com]
3664 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3665 #
3666 # The first example is sanitized, but the second is not. Any security benefits
3667 # from this production are trivial to circumvent. Either remove this test and
3668 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3669 # the test accordingly.
3670 #
3671 # All our love,
3672 # The Parsoid team.
3673 !! test
3674 External links: IDN ignored character reference in hostname; strip it right off
3675 !! wikitext
3676 http://e&zwnj;xample.com/
3677 !! html
3678 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3679 </p>
3680 !! end
3681
3682 !! test
3683 External links: www.jpeg.org (bug 554)
3684 !! wikitext
3685 http://www.jpeg.org
3686 !! html
3687 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3688 </p>
3689 !! end
3690
3691 !! test
3692 External links: URL within URL (original bug 2)
3693 !! wikitext
3694 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3695 !! html
3696 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3697 </p>
3698 !! end
3699
3700 !! test
3701 BUG 361: URL inside bracketed URL
3702 !! wikitext
3703 [http://www.example.com/foo http://www.example.com/bar]
3704 !! html
3705 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3706 </p>
3707 !! end
3708
3709 !! test
3710 BUG 361: URL within URL, not bracketed
3711 !! wikitext
3712 http://www.example.com/foo?=http://www.example.com/bar
3713 !! html
3714 <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>
3715 </p>
3716 !! end
3717
3718 !! test
3719 BUG 289: ">"-token in URL-tail
3720 !! wikitext
3721 http://www.example.com/<hello>
3722 !! html
3723 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3724 </p>
3725 !!end
3726
3727 !! test
3728 BUG 289: literal ">"-token in URL-tail
3729 !! wikitext
3730 http://www.example.com/<b>html</b>
3731 !! html
3732 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3733 </p>
3734 !!end
3735
3736 !! test
3737 BUG 289: ">"-token in bracketed URL
3738 !! wikitext
3739 [http://www.example.com/<hello> stuff]
3740 !! html
3741 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3742 </p>
3743 !!end
3744
3745 !! test
3746 BUG 289: literal ">"-token in bracketed URL
3747 !! wikitext
3748 [http://www.example.com/<b>html</b> stuff]
3749 !! html
3750 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3751 </p>
3752 !!end
3753
3754 !! test
3755 BUG 289: literal double quote at end of URL
3756 !! wikitext
3757 http://www.example.com/"hello"
3758 !! html
3759 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3760 </p>
3761 !!end
3762
3763 !! test
3764 BUG 289: literal double quote in bracketed URL
3765 !! wikitext
3766 [http://www.example.com/"hello" stuff]
3767 !! html
3768 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3769 </p>
3770 !!end
3771
3772 !! test
3773 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3774 !! wikitext
3775 [http://www.example.com test]
3776 !! html
3777 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3778 </p>
3779 !! end
3780
3781 !! test
3782 External links: link text with spaces
3783 !! wikitext
3784 [http://www.example.com a b c]
3785 [http://www.example.com ''a'' ''b'']
3786 !! html
3787 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3788 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3789 </p>
3790 !! end
3791
3792 !! test
3793 External links: wiki links within external link (Bug 3695)
3794 !! wikitext
3795 [http://example.com [[wikilink]] embedded in ext link]
3796 !! html/php
3797 <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>
3798 </p>
3799 !! html/parsoid
3800 <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>
3801 !! end
3802
3803 !! test
3804 BUG 787: Links with one slash after the url protocol are invalid
3805 !! wikitext
3806 http:/example.com
3807
3808 [http:/example.com title]
3809 !! html
3810 <p>http:/example.com
3811 </p><p>[http:/example.com title]
3812 </p>
3813 !! end
3814
3815 !! test
3816 Bracketed external links with template-generated invalid target
3817 !! wikitext
3818 [{{echo|http:/example.com}} title]
3819 !! html
3820 <p>[http:/example.com title]
3821 </p>
3822 !! end
3823
3824 !! test
3825 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3826 !! wikitext
3827 ''[http://example.com text'']
3828 [http://example.com '''text]'''
3829 ''Something [http://example.com in italic'']
3830 ''Something [http://example.com mixed''''', even bold]'''
3831 '''''Now [http://example.com both''''']
3832 !! html
3833 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3834 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3835 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3836 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3837 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3838 </p>
3839 !! end
3840
3841
3842 !! test
3843 Bug 4781: %26 in URL
3844 !! wikitext
3845 http://www.example.com/?title=AT%26T
3846 !! html
3847 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3848 </p>
3849 !! end
3850
3851 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3852 # % is actually legal in HTML5. Any change in output would need testing though.
3853 !! test
3854 Bug 4781, 5267: %25 in URL
3855 !! wikitext
3856 http://www.example.com/?title=100%25_Bran
3857 !! html
3858 <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>
3859 </p>
3860 !! end
3861
3862 !! test
3863 Bug 4781, 5267: %28, %29 in URL
3864 !! wikitext
3865 http://www.example.com/?title=Ben-Hur_%281959_film%29
3866 !! html
3867 <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>
3868 </p>
3869 !! end
3870
3871
3872 !! test
3873 Bug 4781: %26 in autonumber URL
3874 !! wikitext
3875 [http://www.example.com/?title=AT%26T]
3876 !! html
3877 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3878 </p>
3879 !! end
3880
3881 !! test
3882 Bug 4781, 5267: %26 in autonumber URL
3883 !! wikitext
3884 [http://www.example.com/?title=100%25_Bran]
3885 !! html
3886 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3887 </p>
3888 !! end
3889
3890 !! test
3891 Bug 4781, 5267: %28, %29 in autonumber URL
3892 !! wikitext
3893 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3894 !! html
3895 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3896 </p>
3897 !! end
3898
3899
3900 !! test
3901 Bug 4781: %26 in bracketed URL
3902 !! wikitext
3903 [http://www.example.com/?title=AT%26T link]
3904 !! html
3905 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3906 </p>
3907 !! end
3908
3909 !! test
3910 Bug 4781, 5267: %26 in bracketed URL
3911 !! wikitext
3912 [http://www.example.com/?title=100%25_Bran link]
3913 !! html
3914 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3915 </p>
3916 !! end
3917
3918 !! test
3919 Bug 4781, 5267: %28, %29 in bracketed URL
3920 !! wikitext
3921 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3922 !! html
3923 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3924 </p>
3925 !! end
3926
3927 !! test
3928 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3929 !! wikitext
3930 Some [http://example.com/ pretty ''italics'' and stuff]!
3931 !! html
3932 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3933 </p>
3934 !! end
3935
3936 !! test
3937 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3938 !! wikitext
3939 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3940 !! html
3941 <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>
3942 </p>
3943 !! end
3944
3945 !! test
3946 External link containing double-single-quotes with no space separating the url from text in italics
3947 !! wikitext
3948 [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]].]
3949 !! html/php
3950 <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>
3951 </p>
3952 !! html/parsoid
3953 <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>
3954 !! end
3955
3956 !! test
3957 External link with comments in link text
3958 !! wikitext
3959 [http://www.google.com Google <!-- comment -->]
3960 !! html
3961 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3962 </p>
3963 !! end
3964
3965 !! test
3966 URL-encoding in URL functions (single parameter)
3967 !! wikitext
3968 {{localurl:Some page|amp=&}}
3969 !! html
3970 <p>/index.php?title=Some_page&amp;amp=&amp;
3971 </p>
3972 !! end
3973
3974 !! test
3975 URL-encoding in URL functions (multiple parameters)
3976 !! wikitext
3977 {{localurl:Some page|q=?&amp=&}}
3978 !! html
3979 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3980 </p>
3981 !! end
3982
3983 !! test
3984 Brackets in urls
3985 !! wikitext
3986 http://example.com/index.php?foozoid%5B%5D=bar
3987
3988 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3989 !! html
3990 <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>
3991 </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>
3992 </p>
3993 !! end
3994
3995 !! test
3996 IPv6 urls (bug 21261)
3997 !! options
3998 disabled
3999 !! wikitext
4000 http://[2404:130:0:1000::187:2]/index.php
4001 !! html
4002 <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>
4003 </p>
4004 !! end
4005
4006 !! test
4007 Non-extlinks in brackets
4008 !! wikitext
4009 [foo]
4010 [foo bar]
4011 [foo ''bar'']
4012 [fool's] errand
4013 [fool's errand]
4014 [{{echo|foo}}]
4015 [{{echo|foo}} bar]
4016 [{{echo|foo}} ''bar'']
4017 [{{echo|foo}}l's] errand
4018 [{{echo|foo}}l's errand]
4019 [url={{echo|foo}}]
4020 [url=http://example.com]
4021 !! html
4022 <p>[foo]
4023 [foo bar]
4024 [foo <i>bar</i>]
4025 [fool's] errand
4026 [fool's errand]
4027 [foo]
4028 [foo bar]
4029 [foo <i>bar</i>]
4030 [fool's] errand
4031 [fool's errand]
4032 [url=foo]
4033 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4034 </p>
4035 !! end
4036
4037 !! test
4038 Percent encoding in external links
4039 !! wikitext
4040 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4041 !! html/php
4042 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4043 </p>
4044 !! html/parsoid
4045 <p><a rel="mw:ExtLink"
4046 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4047 !! end
4048
4049 !! test
4050 Use url link syntax for links where the content is equal the link target
4051 !! wikitext
4052 http://example.com
4053 !! html/php
4054 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4055 </p>
4056 !! html/parsoid
4057 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4058 !! end
4059
4060 !! test
4061 Parenthesis in external links, especially URL links
4062 !! wikitext
4063 http://example.com)
4064
4065 http://example.com/test)
4066
4067 http://example.com/(test)
4068
4069 http://example.com/((test)
4070
4071 (http://example.com/(test))
4072
4073 (http://example.com/(test)))))
4074
4075 http://example.com/a)b
4076
4077 [http://example.com) foo]
4078 !! html/php
4079 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4080 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4081 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4082 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4083 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4084 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4085 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4086 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4087 </p>
4088 !! html/parsoid
4089 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4090 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4091 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4092 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4093 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4094 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4095 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4096 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4097 !! end
4098
4099 !! test
4100 Parenthesis in external links, w/ transclusion or comment
4101 !! wikitext
4102 (http://example.com/{{echo|hi}})
4103
4104 (http://example.com<!-- hi -->)
4105 !! html/php
4106 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4107 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4108 </p>
4109 !! html/parsoid
4110 <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>
4111
4112 <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>
4113 !! end
4114
4115 ###
4116 ### Quotes
4117 ###
4118
4119 !! test
4120 Quotes
4121 !! wikitext
4122 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4123
4124 Normal text. '''''Bold italic text.''''' Normal text.
4125 !! html
4126 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4127 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4128 </p>
4129 !! end
4130
4131
4132 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4133 # parser strips. The wikitext contains just the first half of the bold
4134 # quote pair.
4135 !! test
4136 Unclosed and unmatched quotes
4137 !! wikitext
4138 '''''Bold italic text '''with bold deactivated''' in between.'''''
4139
4140 '''''Bold italic text ''with italic deactivated'' in between.'''''
4141
4142 '''Bold text..
4143
4144 ..spanning two paragraphs (should not work).'''
4145
4146 '''Bold tag left open
4147
4148 ''Italic tag left open
4149
4150 Normal text.
4151
4152 <!-- Unmatching number of opening, closing tags: -->
4153 '''This year''''s election ''should'' beat '''last year''''s.
4154
4155 ''Tom'''s car is bigger than ''Susan'''s.
4156
4157 Plain ''italic'''s plain
4158 !! html/php
4159 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4160 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4161 </p><p><b>Bold text..</b>
4162 </p><p>..spanning two paragraphs (should not work).
4163 </p><p><b>Bold tag left open</b>
4164 </p><p><i>Italic tag left open</i>
4165 </p><p>Normal text.
4166 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4167 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4168 </p><p>Plain <i>italic'</i>s plain
4169 </p>
4170 !! html/parsoid
4171 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4172 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4173 </p><p><b>Bold text..</b>
4174 </p><p>..spanning two paragraphs (should not work).<b></b>
4175 </p><p><b>Bold tag left open</b>
4176 </p><p><i>Italic tag left open</i>
4177 </p><p>Normal text.
4178 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4179 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4180 </p><p>Plain <i>italic'</i>s plain
4181 </p>
4182 !! end
4183
4184 ###
4185 ### Tables
4186 ###
4187 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4188 ###
4189
4190 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4191 # is the bare minimum required by the spec, see:
4192 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4193 # Parsoid team replies: empty table tags are legal in HTML5
4194 !! test
4195 A table with no data.
4196 !! options
4197 parsoid=wt2html
4198 !! wikitext
4199 {||}
4200 !! html/php
4201
4202 !! html/parsoid
4203 <table></table>
4204
4205 !! end
4206
4207 !! test
4208 A table with stray table end tags on start tag line (wt2html)
4209 !! options
4210 parsoid=wt2html
4211 !! wikitext
4212 {|style="color: red;"|}
4213
4214 {|style="color: red;" |}
4215 |foo
4216 |}
4217
4218 {|style="color: red;"|} id="foo"
4219 |foo
4220 |}
4221
4222 {|style="color: red;" |} id="foo"
4223 |foo
4224 |}
4225 !! html
4226 <table style="color: red;"></table>
4227
4228 <table style="color: red;">
4229 <tbody><tr>
4230 <td>foo</td>
4231 </tr></tbody>
4232 </table>
4233
4234 <table style="color: red;" id="foo">
4235 <tbody><tr>
4236 <td>foo</td>
4237 </tr></tbody>
4238 </table>
4239
4240 <table style="color: red;" id="foo">
4241 <tbody><tr>
4242 <td>foo</td>
4243 </tr></tbody>
4244 </table>
4245
4246 !! end
4247
4248 !! test
4249 A table with no data (take 2)
4250 !! wikitext
4251 {|
4252 |}
4253 !! html/parsoid
4254 <table></table>
4255 !! end
4256
4257 # A table with nothing but a caption is invalid XHTML, we might want to render
4258 # this as <p>caption</p>
4259 # Parsoid team replies: table with only a caption is legal in HTML5
4260 !! test
4261 A table with nothing but a caption
4262 !! wikitext
4263 {|
4264 |+ caption
4265 |}
4266 !! html/php
4267 <table>
4268 <caption> caption
4269 </caption><tr><td></td></tr></table>
4270
4271 !! html/parsoid
4272 <table><caption> caption</caption></table>
4273 !! end
4274
4275 !! test
4276 A table with caption with default-spaced attributes and a table row
4277 !! wikitext
4278 {|
4279 |+ style="color: red;" | caption1
4280 |-
4281 | foo
4282 |}
4283 !! html
4284 <table>
4285 <caption style="color: red;"> caption1
4286 </caption>
4287 <tr>
4288 <td> foo
4289 </td></tr></table>
4290
4291 !! end
4292
4293 !! test
4294 A table with captions with non-default spaced attributes and a table row
4295 !! wikitext
4296 {|
4297 |+style="color: red;"|caption2
4298 |+ style="color: red;"| caption3
4299 |-
4300 | foo
4301 |}
4302 !! html
4303 <table>
4304 <caption style="color: red;">caption2
4305 </caption>
4306 <caption style="color: red;"> caption3
4307 </caption>
4308 <tr>
4309 <td> foo
4310 </td></tr></table>
4311
4312 !! end
4313
4314 !! test
4315 Table td-cell syntax variations
4316 !! wikitext
4317 {|
4318 | foo bar foo | baz
4319 | foo bar foo || baz
4320 | style='color:red;' | baz
4321 | style='color:red;' || baz
4322 |}
4323 !! html
4324 <table>
4325 <tr>
4326 <td> baz
4327 </td>
4328 <td> foo bar foo </td>
4329 <td> baz
4330 </td>
4331 <td style="color:red;"> baz
4332 </td>
4333 <td> style='color:red;' </td>
4334 <td> baz
4335 </td></tr></table>
4336
4337 !! end
4338
4339 !! test
4340 Simple table
4341 !! wikitext
4342 {|
4343 | 1 || 2
4344 |-
4345 | 3 || 4
4346 |}
4347 !! html
4348 <table>
4349 <tr>
4350 <td> 1 </td>
4351 <td> 2
4352 </td></tr>
4353 <tr>
4354 <td> 3 </td>
4355 <td> 4
4356 </td></tr></table>
4357
4358 !! end
4359
4360 !! test
4361 Simple table but with multiple dashes for row wikitext
4362 !! wikitext
4363 {|
4364 | foo
4365 |-----
4366 | bar
4367 |}
4368 !! html
4369 <table>
4370 <tr>
4371 <td> foo
4372 </td></tr>
4373 <tr>
4374 <td> bar
4375 </td></tr></table>
4376
4377 !! end
4378 !! test
4379 Multiplication table
4380 !! wikitext
4381 {| border="1" cellpadding="2"
4382 |+Multiplication table
4383 |-
4384 ! &times; !! 1 !! 2 !! 3
4385 |-
4386 ! 1
4387 | 1 || 2 || 3
4388 |-
4389 ! 2
4390 | 2 || 4 || 6
4391 |-
4392 ! 3
4393 | 3 || 6 || 9
4394 |-
4395 ! 4
4396 | 4 || 8 || 12
4397 |-
4398 ! 5
4399 | 5 || 10 || 15
4400 |}
4401 !! html
4402 <table border="1" cellpadding="2">
4403 <caption>Multiplication table
4404 </caption>
4405 <tr>
4406 <th> &#215; </th>
4407 <th> 1 </th>
4408 <th> 2 </th>
4409 <th> 3
4410 </th></tr>
4411 <tr>
4412 <th> 1
4413 </th>
4414 <td> 1 </td>
4415 <td> 2 </td>
4416 <td> 3
4417 </td></tr>
4418 <tr>
4419 <th> 2
4420 </th>
4421 <td> 2 </td>
4422 <td> 4 </td>
4423 <td> 6
4424 </td></tr>
4425 <tr>
4426 <th> 3
4427 </th>
4428 <td> 3 </td>
4429 <td> 6 </td>
4430 <td> 9
4431 </td></tr>
4432 <tr>
4433 <th> 4
4434 </th>
4435 <td> 4 </td>
4436 <td> 8 </td>
4437 <td> 12
4438 </td></tr>
4439 <tr>
4440 <th> 5
4441 </th>
4442 <td> 5 </td>
4443 <td> 10 </td>
4444 <td> 15
4445 </td></tr></table>
4446
4447 !! end
4448
4449 !! test
4450 Accept "||" in table headings
4451 !! wikitext
4452 {|
4453 !h1 || h2
4454 |}
4455 !! html
4456 <table>
4457 <tr>
4458 <th>h1 </th>
4459 <th> h2
4460 </th></tr></table>
4461
4462 !! end
4463
4464 !! test
4465 Accept "||" in indented table headings
4466 !! wikitext
4467 :{|
4468 !h1 || h2
4469 |}
4470 !! html
4471 <dl><dd><table>
4472 <tr>
4473 <th>h1 </th>
4474 <th> h2
4475 </th></tr></table></dd></dl>
4476
4477 !! end
4478
4479 !! test
4480 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4481 !! wikitext
4482 {|
4483 !| h1
4484 || a
4485 |}
4486 !! html
4487 <table>
4488 <tr>
4489 <th> h1
4490 </th>
4491 <td> a
4492 </td></tr></table>
4493
4494 !! end
4495
4496 !!test
4497 Accept "| !" at start of line in tables (ignore !-attribute)
4498 !! wikitext
4499 {|
4500 |-
4501 | !style="color:red" | bar
4502 |}
4503 !! html
4504 <table>
4505
4506 <tr>
4507 <td> bar
4508 </td></tr></table>
4509
4510 !!end
4511
4512 !!test
4513 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 +/-
4514 !! wikitext
4515 {|
4516 |-
4517 |style='color:red;'|+1
4518 |style='color:blue;'|-1
4519 |-
4520 | 1 || 2 || 3
4521 | 1 ||+2 ||-3
4522 |-
4523 | +1
4524 | -1
4525 |}
4526 !! html
4527 <table>
4528
4529 <tr>
4530 <td style="color:red;">+1
4531 </td>
4532 <td style="color:blue;">-1
4533 </td></tr>
4534 <tr>
4535 <td> 1 </td>
4536 <td> 2 </td>
4537 <td> 3
4538 </td>
4539 <td> 1 </td>
4540 <td>+2 </td>
4541 <td>-3
4542 </td></tr>
4543 <tr>
4544 <td> +1
4545 </td>
4546 <td> -1
4547 </td></tr></table>
4548
4549 !!end
4550
4551 !! test
4552 Table rowspan
4553 !! wikitext
4554 {| border=1
4555 | Cell 1, row 1
4556 |rowspan=2| Cell 2, row 1 (and 2)
4557 | Cell 3, row 1
4558 |-
4559 | Cell 1, row 2
4560 | Cell 3, row 2
4561 |}
4562 !! html
4563 <table border="1">
4564 <tr>
4565 <td> Cell 1, row 1
4566 </td>
4567 <td rowspan="2"> Cell 2, row 1 (and 2)
4568 </td>
4569 <td> Cell 3, row 1
4570 </td></tr>
4571 <tr>
4572 <td> Cell 1, row 2
4573 </td>
4574 <td> Cell 3, row 2
4575 </td></tr></table>
4576
4577 !! end
4578
4579 !! test
4580 Nested table
4581 !! wikitext
4582 {| border=1
4583 | &alpha;
4584 |
4585 {| bgcolor=#ABCDEF border=2
4586 |nested
4587 |-
4588 |table
4589 |}
4590 |the original table again
4591 |}
4592 !! html
4593 <table border="1">
4594 <tr>
4595 <td> &#945;
4596 </td>
4597 <td>
4598 <table bgcolor="#ABCDEF" border="2">
4599 <tr>
4600 <td>nested
4601 </td></tr>
4602 <tr>
4603 <td>table
4604 </td></tr></table>
4605 </td>
4606 <td>the original table again
4607 </td></tr></table>
4608
4609 !! end
4610
4611 !! test
4612 Invalid attributes in table cell (bug 1830)
4613 !! wikitext
4614 {|
4615 |Cell:|broken
4616 |}
4617 !! html
4618 <table>
4619 <tr>
4620 <td>broken
4621 </td></tr></table>
4622
4623 !! end
4624
4625
4626 !! test
4627 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4628 !! wikitext
4629 {|
4630 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4631 !! html
4632 <table>
4633 <tr>
4634 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4635 <td>]" onmouseover="alert(document.cookie)"&gt;test
4636 </td>
4637 </tr>
4638 </table>
4639
4640 !! end
4641
4642
4643 !! test
4644 Indented table markup mixed with indented pre content (proposed in bug 6200)
4645 !! wikitext
4646 <table>
4647 <tr>
4648 <td>
4649 Text that should be rendered preformatted
4650 </td>
4651 </tr>
4652 </table>
4653 !! html
4654 <table>
4655 <tr>
4656 <td>
4657 <pre>Text that should be rendered preformatted
4658 </pre>
4659 </td>
4660 </tr>
4661 </table>
4662
4663 !! end
4664
4665 !! test
4666 Template-generated table cell attributes and cell content
4667 !! wikitext
4668 {|
4669 |{{table_attribs}}
4670 | {{table_attribs}}
4671 |}
4672 !! html
4673 <table>
4674 <tr>
4675 <td style="color: red"> Foo
4676 </td>
4677 <td style="color: red"> Foo
4678 </td></tr></table>
4679
4680 !! end
4681
4682 !! test
4683 Template-generated table cell attributes and cell content (2)
4684 !! wikitext
4685 {|
4686 |align=center {{table_attribs}}
4687 |}
4688 !! html
4689 <table>
4690 <tr>
4691 <td align="center" style="color: red"> Foo
4692 </td></tr></table>
4693
4694 !! end
4695
4696 !! test
4697 Template-generated table cell attributes and cell content (3)
4698 !! wikitext
4699 {|
4700 |align=center {{table_cells}}
4701 |}
4702 !! html
4703 <table>
4704 <tr>
4705 <td align="center" style="color: red"> Foo </td>
4706 <td> Bar </td>
4707 <td> Baz
4708 </td></tr></table>
4709
4710 !! end
4711
4712 !! test
4713 Table with row followed by newlines and table heading
4714 !! wikitext
4715 {|
4716 |-
4717
4718 ! foo
4719 |}
4720 !! html
4721 <table>
4722
4723
4724 <tr>
4725 <th> foo
4726 </th></tr></table>
4727
4728 !! end
4729
4730 !! test
4731 Table with empty line following the start tag
4732 !! wikitext
4733 {|
4734
4735 |-
4736 | foo
4737 |}
4738 !! html
4739 <table>
4740
4741
4742 <tr>
4743 <td> foo
4744 </td></tr></table>
4745
4746 !! end
4747
4748 # FIXME: Preserve the attribute properly (with an empty string as value) in
4749 # the PHP parser. Parsoid implements the behavior below.
4750 !! test
4751 Table attributes with empty value
4752 !! wikitext
4753 {|
4754 | style=| hello
4755 |}
4756 !! html/parsoid
4757 <table>
4758 <tbody>
4759 <tr>
4760 <td style=""> hello
4761 </td></tr></tbody></table>
4762
4763 !! end
4764
4765 !! test
4766 Wikitext table with a lot of comments
4767 !! wikitext
4768 {|
4769 <!-- c0 -->
4770 | foo
4771 <!-- c1 -->
4772 |- <!-- c2 -->
4773 <!-- c3 -->
4774 |<!-- c4 -->
4775 <!-- c5 -->
4776 |}
4777 !! html
4778 <table>
4779 <tr>
4780 <td> foo
4781 </td></tr>
4782 <tr>
4783 <td>
4784 </td></tr></table>
4785
4786 !! end
4787
4788 !! test
4789 Wikitext table with double-line table cell
4790 !! wikitext
4791 {|
4792 |a
4793 b
4794 |}
4795 !! html
4796 <table>
4797 <tr>
4798 <td>a
4799 <p>b
4800 </p>
4801 </td></tr></table>
4802
4803 !! end
4804
4805 !! test
4806 Table cell with a single comment
4807 !! wikitext
4808 {|
4809 | <!-- c1 -->
4810 | a
4811 |}
4812 !! html
4813 <table>
4814 <tr>
4815 <td>
4816 </td>
4817 <td> a
4818 </td></tr></table>
4819
4820 !! end
4821
4822 # The expected HTML structure in this test is debatable. The PHP parser does
4823 # not parse this kind of table at all. The main focus for Parsoid is on
4824 # round-tripping, so this output is ok for now. TODO: revisit!
4825 !! test
4826 Wikitext table with html-syntax row
4827 !! wikitext
4828 {|
4829 |-
4830 <td>foo</td>
4831 |}
4832 !! html/parsoid
4833 <table>
4834 <tbody>
4835 <tr>
4836 <td>foo</td></tr></tbody></table>
4837 !! end
4838
4839 !! test
4840 Implicit <td> after a |-
4841 (PHP parser relies on Tidy to add the missing <td> tags)
4842 !! options
4843 parsoid=wt2html,wt2wt
4844 !! wikitext
4845 {|
4846 |-
4847 a
4848 |}
4849 !! html
4850 <table>
4851 <tr><td>a</td></tr>
4852 </table>
4853 !! end
4854
4855 !! test
4856 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4857 (PHP parser relies on Tidy to add the missing <td> tags)
4858 !! options
4859 parsoid=wt2html,wt2wt
4860 !! wikitext
4861 {|
4862 |-
4863 |
4864 a
4865 |-
4866 b
4867 |}
4868 !! html
4869 <table>
4870 <tbody>
4871 <tr><td><pre>a</pre></td></tr>
4872 <tr><td> b</td></tr>
4873 </tbody>
4874 </table>
4875 !! end
4876
4877 !! test
4878 Lists should be recognized in an implicit <td> context
4879 (PHP parser relies on Tidy to add the missing <td> tags)
4880 !! options
4881 parsoid=wt2html,wt2wt
4882 !! wikitext
4883 {|
4884 |-
4885 *a
4886 |}
4887 !! html
4888 <table>
4889 <tr>
4890 <td><ul>
4891 <li>a</li>
4892 </ul></td>
4893 </tr>
4894 </table>
4895 !! end
4896
4897 !! test
4898 Parsoid: Round-trip tables directly followed by content (bug 51219)
4899 !! options
4900 parsoid=wt2html,wt2wt
4901 !! wikitext
4902 {|
4903 |foo
4904 |} bar
4905
4906 {|
4907 |baz
4908 |}<b>quux</b>
4909 !! html
4910 <table><tbody>
4911 <tr>
4912 <td>foo</td></tr></tbody></table> bar
4913 <table>
4914 <tbody>
4915 <tr>
4916 <td>baz</td></tr></tbody></table><b>quux</b>
4917 !! end
4918
4919 !! test
4920 Parsoid: Default to a newline after tables in new content (bug 51219)
4921 !! options
4922 parsoid=html2wt
4923 !! wikitext
4924 {|
4925 |foo
4926 |}
4927 <nowiki> </nowiki>bar
4928 {|
4929 |baz
4930 |}
4931 '''quux'''
4932 !! html
4933 <table><tbody>
4934 <tr><td>foo</td></tr></tbody></table> bar
4935 <table><tbody>
4936 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4937 !! end
4938
4939 !! test
4940 Parsoid: newline inducing block nodes don't suppress <nowiki>
4941 !! options
4942 parsoid=html2wt
4943 !! wikitext
4944 <nowiki> </nowiki>a
4945
4946 = foo =
4947 !! html
4948 a<h1>foo</h1>
4949 !! end
4950
4951 ###
4952 ### Internal links
4953 ###
4954 !! test
4955 Plain link, capitalized
4956 !! wikitext
4957 [[Main Page]]
4958 !! html
4959 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4960 </p>
4961 !! end
4962
4963 !! test
4964 Plain link, uncapitalized
4965 !! wikitext
4966 [[main Page]]
4967 !! html
4968 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4969 </p>
4970 !! end
4971
4972 !! test
4973 Piped link
4974 !! wikitext
4975 [[Main Page|The Main Page]]
4976 !! html
4977 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4978 </p>
4979 !! end
4980
4981 !! test
4982 Piped link with comment in link text
4983 !! wikitext
4984 [[Main Page|The Main<!--front--> Page]]
4985 !! html
4986 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4987 </p>
4988 !! end
4989
4990 !! test
4991 Broken link
4992 !! wikitext
4993 [[Zigzagzogzagzig]]
4994 !! html
4995 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4996 </p>
4997 !! end
4998
4999 !! test
5000 Broken link with fragment
5001 !! wikitext
5002 [[Zigzagzogzagzig#zug]]
5003 !! html
5004 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5005 </p>
5006 !! end
5007
5008 !! test
5009 Special page link with fragment
5010 !! wikitext
5011 [[Special:Version#anchor]]
5012 !! html
5013 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5014 </p>
5015 !! end
5016
5017 !! test
5018 Nonexistent special page link with fragment
5019 !! wikitext
5020 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5021 !! html
5022 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5023 </p>
5024 !! end
5025
5026 !! test
5027 Link with prefix
5028 !! wikitext
5029 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5030 !! html
5031 <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>
5032 </p>
5033 !! end
5034
5035 !! test
5036 Link with suffix
5037 !! wikitext
5038 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5039 !! html
5040 <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>!!!
5041 </p>
5042 !! end
5043
5044 !! article
5045 prefixed article
5046 !! text
5047 Some text
5048 !! endarticle
5049
5050 !! test
5051 Bug 43661: Piped links with identical prefixes
5052 !! wikitext
5053 [[prefixed article|prefixed articles with spaces]]
5054
5055 [[prefixed article|prefixed articlesaoeu]]
5056
5057 [[Main Page|Main Page test]]
5058 !! html
5059 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5060 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5061 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5062 </p>
5063 !! end
5064
5065
5066 !! test
5067 Link with HTML entity in suffix / tail
5068 !! wikitext
5069 [[Main Page]]&quot;, [[Main Page]]&#97;
5070 !! html
5071 <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;
5072 </p>
5073 !! end
5074
5075 !! test
5076 Link with 3 brackets
5077 !! wikitext
5078 [[[Main Page]]]
5079 !! html
5080 <p>[[[Main Page]]]
5081 </p>
5082 !! end
5083
5084 !! test
5085 Link with 4 brackets
5086 !! wikitext
5087 [[[[Main Page]]]]
5088 !! html
5089 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5090 </p>
5091 !! end
5092
5093 !! test
5094 Piped link with 3 brackets
5095 !! wikitext
5096 [[[main page|the main page]]]
5097 !! html
5098 <p>[[[main page|the main page]]]
5099 </p>
5100 !! end
5101
5102 !! test
5103 Piped link with extlink-like text
5104 !! wikitext
5105 [[Main Page|[bar]]]
5106 [[Main Page|This is a [bar]]]
5107 !! html
5108 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5109 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5110 </p>
5111 !! end
5112
5113 !! test
5114 Link with multiple pipes
5115 !! wikitext
5116 [[Main Page|The|Main|Page]]
5117 !! html
5118 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5119 </p>
5120 !! end
5121
5122 !! test
5123 Link to namespaces
5124 !! wikitext
5125 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5126 !! html
5127 <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>
5128 </p>
5129 !! end
5130
5131 !! article
5132 MemoryAlpha:AlphaTest
5133 !! text
5134 This is an article in the MemoryAlpha namespace
5135 (which shadows the memoryalpha interwiki link).
5136 !! endarticle
5137
5138 !! test
5139 Namespace takes precedence over interwiki link (bug 51680)
5140 !! wikitext
5141 [[MemoryAlpha:AlphaTest]]
5142 !! html
5143 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5144 </p>
5145 !! end
5146
5147 # The previous test doesn't work correctly in html2*, due to not recognizing the
5148 # link as an internal one. This one checks for the correct behavior.
5149 !! test
5150 Link to namespace preferred over interwiki with correct rel attribute
5151 !! options
5152 parsoid=html2wt,html2html
5153 !! wikitext
5154 [[MemoryAlpha:AlphaTest]]
5155 !! html
5156 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5157 </p>
5158 !! end
5159
5160 !! test
5161 Piped link to namespace
5162 !! wikitext
5163 [[Meta:Disclaimers|The disclaimers]]
5164 !! html
5165 <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>
5166 </p>
5167 !! end
5168
5169 !! test
5170 Link containing }
5171 !! wikitext
5172 [[Usually caused by a typo (oops}]]
5173 !! html
5174 <p>[[Usually caused by a typo (oops}]]
5175 </p>
5176 !! end
5177
5178 !! test
5179 Link containing % (not as a hex sequence)
5180 !! wikitext
5181 [[7% Solution]]
5182 !! html
5183 <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>
5184 </p>
5185 !! end
5186
5187 !! test
5188 Link containing % as a single hex sequence interpreted to char
5189 !! wikitext
5190 [[7%25 Solution]]
5191 !! html
5192 <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>
5193 </p>
5194 !!end
5195
5196 !! test
5197 Link containing % as a double hex sequence interpreted to hex sequence
5198 !! wikitext
5199 [[7%2525 Solution]]
5200 !! html
5201 <p>[[7%2525 Solution]]
5202 </p>
5203 !!end
5204
5205 !! test
5206 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5207 Example for such a section: == < ==
5208 !! wikitext
5209 [[%23%3c]][[%23%3e]]
5210 !! html
5211 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5212 </p>
5213 !! end
5214
5215 !! test
5216 Link containing "<#" and ">#" as a hex sequences
5217 !! wikitext
5218 [[%3c%23]][[%3e%23]]
5219 !! html
5220 <p>[[%3c%23]][[%3e%23]]
5221 </p>
5222 !! end
5223
5224 !! test
5225 Link containing an equals sign
5226 !! wikitext
5227 [[Special:BookSources/isbn=4-00-026157-6]]
5228 !! html
5229 <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>
5230 </p>
5231 !! end
5232
5233 !! article
5234 Foo~bar
5235 !! text
5236 Just a test of an article title containing a tilde.
5237 !! endarticle
5238
5239 # note that links containing signatures, like [[Foo~~~~]], are
5240 # massaged by the pre-save transform (PST) and so the tildes are never
5241 # seen by the parser.
5242 !! test
5243 Link containing a tilde
5244 !! wikitext
5245 [[Foo~bar]]
5246 !! html
5247 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5248 </p>
5249 !! end
5250
5251 !! test
5252 Link containing double-single-quotes '' (bug 4598)
5253 !! wikitext
5254 [[Lista d''e paise d''o munno]]
5255 !! html
5256 <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>
5257 </p>
5258 !! end
5259
5260 !! test
5261 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5262 !! wikitext
5263 Some [[Link|pretty ''italics'' and stuff]]!
5264 !! html
5265 <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>!
5266 </p>
5267 !! end
5268
5269 !! test
5270 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5271 !! wikitext
5272 ''Some [[Link|pretty ''italics'' and stuff]]!
5273 !! html
5274 <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>
5275 </p>
5276 !! end
5277
5278 !! test
5279 Link with double quotes in title part (literal) and alternate part (interpreted)
5280 !! wikitext
5281 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5282
5283 [[''Pentecoste'']]
5284
5285 [[''Pentecoste''|Pentecoste]]
5286
5287 [[''Pentecoste''|''Pentecoste'']]
5288 !! html
5289 <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>
5290 </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>
5291 </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>
5292 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
5293 </p>
5294 !! end
5295
5296 !! test
5297 Broken image links with HTML captions (bug 39700)
5298 !! wikitext
5299 [[File:Nonexistent|<script></script>]]
5300 [[File:Nonexistent|100px|<script></script>]]
5301 [[File:Nonexistent|&lt;]]
5302 [[File:Nonexistent|a<i>b</i>c]]
5303 !! html
5304 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5305 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5306 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5307 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5308 </p>
5309 !! end
5310
5311 !! test
5312 Plain link to URL
5313 !! wikitext
5314 [[http://www.example.com]]
5315 !! html
5316 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5317 </p>
5318 !! end
5319
5320 !! test
5321 Plain link to URL with link text
5322 !! wikitext
5323 [[http://www.example.com Link text]]
5324 !! html
5325 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5326 </p>
5327 !! end
5328
5329 !! test
5330 Plain link to protocol-relative URL
5331 !! wikitext
5332 [[//www.example.com]]
5333 !! html
5334 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5335 </p>
5336 !! end
5337
5338 !! test
5339 Plain link to protocol-relative URL with link text
5340 !! wikitext
5341 [[//www.example.com Link text]]
5342 !! html
5343 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5344 </p>
5345 !! end
5346
5347 !! test
5348 Plain link to page with question mark in title
5349 !! wikitext
5350 [[A?b]]
5351
5352 [[A?b|Baz]]
5353 !! html
5354 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5355 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5356 </p>
5357 !! end
5358
5359
5360 # I'm fairly sure the expected result here is wrong.
5361 # We want these to be URL links, not pseudo-pages with URLs for titles....
5362 # However the current output is also pretty screwy.
5363 #
5364 # ----
5365 # I'm changing it to match the current output--it arguably makes more
5366 # sense in the light of the test above. Old expected result was:
5367 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5368 #</p>
5369 # But I think this test is bordering on "garbage in, garbage out" anyway.
5370 # -- wtm
5371 !! test
5372 Piped link to URL
5373 !! wikitext
5374 Piped link to URL: [[http://www.example.com|an example URL]]
5375 !! html
5376 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5377 </p>
5378 !! end
5379
5380 !! test
5381 BUG 2: [[page|http://url/]] should link to page, not http://url/
5382 !! wikitext
5383 [[Main Page|http://url/]]
5384 !! html
5385 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5386 </p>
5387 !! end
5388
5389 !! test
5390 BUG 337: Escaped self-links should be bold
5391 !! options
5392 title=[[Bug462]]
5393 !! wikitext
5394 [[Bu&#103;462]] [[Bug462]]
5395 !! html
5396 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5397 </p>
5398 !! end
5399
5400 !! test
5401 Self-link to section should not be bold
5402 !! options
5403 title=[[Main Page]]
5404 !! wikitext
5405 [[Main Page#section]]
5406 !! html
5407 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5408 </p>
5409 !! end
5410
5411 !! article
5412 00
5413 !! text
5414 This is 00.
5415 !! endarticle
5416
5417 !!test
5418 Self-link to numeric title
5419 !!options
5420 title=[[0]]
5421 !! wikitext
5422 [[0]]
5423 !! html
5424 <p><strong class="selflink">0</strong>
5425 </p>
5426 !!end
5427
5428 !!test
5429 Link to numeric-equivalent title
5430 !!options
5431 title=[[0]]
5432 !! wikitext
5433 [[00]]
5434 !! html
5435 <p><a href="/wiki/00" title="00">00</a>
5436 </p>
5437 !!end
5438
5439 !! test
5440 <nowiki> inside a link
5441 !! wikitext
5442 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5443 !! html
5444 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5445 </p>
5446 !! end
5447
5448 !! test
5449 Non-breaking spaces in title
5450 !! wikitext
5451 [[&nbsp; Main &nbsp; Page &nbsp;]]
5452 !! html
5453 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5454 </p>
5455 !!end
5456
5457 !! test
5458 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5459 !! options
5460 language=ca
5461 !! wikitext
5462 '''[[Main Page]]'''
5463 !! html
5464 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5465 </p>
5466 !! end
5467
5468 !! test
5469 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5470 !! options
5471 language=ca
5472 !! wikitext
5473 ''[[Main Page]]''
5474 !! html
5475 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5476 </p>
5477 !! end
5478
5479 !! test
5480 Internal link with en linktrail: no apostrophes (bug 27473)
5481 !! options
5482 language=en
5483 !! wikitext
5484 [[Something]]'nice
5485 !! html
5486 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5487 </p>
5488 !! end
5489
5490 !! test
5491 Internal link with ca linktrail with apostrophes (bug 27473)
5492 !! options
5493 language=ca
5494 !! wikitext
5495 [[Something]]'nice
5496 !! html
5497 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5498 </p>
5499 !! end
5500
5501 !! test
5502 Internal link with kaa linktrail with apostrophes (bug 27473)
5503 !! options
5504 language=kaa
5505 !! wikitext
5506 [[Something]]'nice
5507 !! html
5508 <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>
5509 </p>
5510 !! end
5511
5512 !! test
5513 1. Interaction of linktrail and template encapsulation
5514 !! options
5515 parsoid
5516 !! wikitext
5517 {{echo|[[Foo]]}}l
5518 !! html
5519 <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>
5520 !! end
5521
5522 !! test
5523 2. Interaction of linktrail and template encapsulation
5524 !! options
5525 parsoid
5526 !! wikitext
5527 {{echo|Some [[Fool]]}}s
5528 !! html
5529 <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>
5530 !! end
5531
5532 !! test
5533 3. Interaction of linktrail and template encapsulation
5534 !! options
5535 parsoid
5536 !! wikitext
5537 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5538 !! html
5539 <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>
5540 !! end
5541
5542 !! article
5543 Söfnuður
5544 !! text
5545 Test.
5546 !! endarticle
5547
5548 !! test
5549 Internal link with is link prefix
5550 !! options
5551 language=is
5552 !! wikitext
5553 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5554 !! html
5555 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5556 </p>
5557 !! end
5558
5559 !! article
5560 Mótmælendatrú
5561 !! text
5562 Test.
5563 !! endarticle
5564
5565 !! test
5566 Internal link with is link trail and link prefix
5567 !! options
5568 language=is
5569 !! wikitext
5570 [[mótmælendatrú|xxx]]ar
5571 [[mótmælendatrú]]ar
5572 mótmælenda[[söfnuður]]
5573 mótmælenda[[söfnuður|söfnuðir]]
5574 mótmælenda[[söfnuður|söfnuðir]]xxx
5575 !! html
5576 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5577 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5578 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5579 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5580 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5581 </p>
5582 !! end
5583
5584 !! test
5585 Parsoid link trail escaping
5586 !! options
5587 parsoid=html2wt,html2html
5588 !! wikitext
5589 [[apple]]<nowiki/>s
5590 !! html
5591 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5592 !! end
5593
5594 !! test
5595 Parsoid link prefix escaping
5596 !! options
5597 language=is
5598 parsoid=html2wt,html2html
5599 !! wikitext
5600 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5601 !! html
5602 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5603 !! end
5604
5605 !! test
5606 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5607 !! wikitext
5608 [[Foo| bar]]
5609
5610 [[Foo| ''bar'']]
5611
5612 [http://wp.org foo]
5613
5614 [http://wp.org ''foo'']
5615 !! html
5616 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5617 </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>
5618 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5619 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5620 </p>
5621 !! end
5622
5623 !! test
5624 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5625 !! options
5626 parsoid
5627 !! wikitext
5628 [[Foo|{{echo|a}} b {{echo|c}}]]
5629 !! html
5630 <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>
5631 !! end
5632
5633 ###
5634 ### Interwiki links (see maintenance/interwiki.sql)
5635 ###
5636
5637 !! test
5638 Inline interwiki link
5639 !! wikitext
5640 [[MeatBall:SoftSecurity]]
5641 !! html
5642 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5643 </p>
5644 !! end
5645
5646 !! test
5647 Inline interwiki link with empty title (bug 2372)
5648 !! wikitext
5649 [[MeatBall:]]
5650 !! html
5651 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5652 </p>
5653 !! end
5654
5655 !! test
5656 Interwiki link encoding conversion (bug 1636)
5657 !! wikitext
5658 *[[Wikipedia:ro:Olteni&#0355;a]]
5659 *[[Wikipedia:ro:Olteni&#355;a]]
5660 !! html
5661 <ul>
5662 <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>
5663 </li>
5664 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
5665 </li>
5666 </ul>
5667
5668 !! end
5669
5670 !! test
5671 Interwiki link with fragment (bug 2130)
5672 !! wikitext
5673 [[MeatBall:SoftSecurity#foo]]
5674 !! html
5675 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5676 </p>
5677 !! end
5678
5679 # Ideally the wikipedia: prefix here should be proto-relative too
5680 !! test
5681 Different interwiki prefixes mapping to the same URL
5682 !! options
5683 parsoid
5684 !! wikitext
5685 [[wikipedia:Foo]]
5686
5687 [[:en:Foo]]
5688 !! html
5689 <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>
5690
5691 <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>
5692 !! end
5693
5694 !! test
5695 Interwiki links that cannot be represented in wiki syntax
5696 !! options
5697 parsoid
5698 !! wikitext
5699 [[meatball:ok]]
5700 [[meatball:ok#foo|ok with fragment]]
5701 [[meatball:ok_as_well?|ok ending with ? mark]]
5702 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5703 [http://de.wikipedia.org/wiki/#foo is just fragment]
5704
5705 !! html
5706 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5707 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5708 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
5709 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5710 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5711 !! end
5712
5713 !! test
5714 Interwiki links: trail
5715 !! options
5716 parsoid
5717 !! wikitext
5718 [[wikipedia:Foo|Ba]]r
5719 !! html
5720 <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>
5721 !! end
5722
5723 ###
5724 ### Interlanguage links
5725 ### Language links (so that searching for '### language' matches..)
5726 ###
5727
5728 !! test
5729 Interlanguage link
5730 !! wikitext
5731 Blah blah blah
5732 [[zh:Chinese]]
5733 !! html
5734 <p>Blah blah blah
5735 </p>
5736 !! end
5737
5738 !! test
5739 Double interlanguage link
5740 !! wikitext
5741 Blah blah blah
5742 [[es:Spanish]]
5743 [[zh:Chinese]]
5744 !! html
5745 <p>Blah blah blah
5746 </p>
5747 !! end
5748
5749 !! test
5750 Interlanguage link, with prefix links
5751 !! options
5752 language=ln
5753 !! wikitext
5754 Blah blah blah
5755 [[zh:Chinese]]
5756 !! html
5757 <p>Blah blah blah
5758 </p>
5759 !! end
5760
5761 !! test
5762 Double interlanguage link, with prefix links (bug 8897)
5763 !! options
5764 language=ln
5765 !! wikitext
5766 Blah blah blah
5767 [[es:Spanish]]
5768 [[zh:Chinese]]
5769 !! html
5770 <p>Blah blah blah
5771 </p>
5772 !! end
5773
5774 !! test
5775 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5776 !! options
5777 language=ln
5778 !! wikitext
5779 [[WW&nbsp;II]]
5780 !! html
5781 <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>
5782 </p>
5783 !! end
5784
5785 !! test
5786 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5787 !! options
5788 parsoid=html2wt
5789 !! wikitext
5790 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5791
5792 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5793 !! html
5794 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5795 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5796 !! end
5797
5798 !! test
5799 Parsoid: handle constructor well
5800 !! options
5801 parsoid
5802 !! wikitext
5803 [[constructor]]
5804
5805 [[constructor:foo]]
5806 !! html
5807 <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>
5808
5809 <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>
5810 !! end
5811
5812 !! test
5813 Parsoid: recognize interlanguage links without a target page
5814 !! options
5815 parsoid
5816 !! wikitext
5817 [[ko:]]
5818 !! html
5819 <p>
5820 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5821 !! end
5822
5823 !! test
5824 Parsoid: recognize interwiki links without a target page
5825 !! options
5826 parsoid
5827 !! wikitext
5828 [[:ko:]]
5829 !! html
5830 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
5831 !! end
5832
5833 !! test
5834 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
5835 !! options
5836 parsoid
5837 !! wikitext
5838 [[en:Foo]]
5839 !! html
5840 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
5841 !! end
5842
5843 ###
5844 ### Redirects, Parsoid-only
5845 ###
5846 !! test
5847 1. Simple redirect to page
5848 !! options
5849 parsoid
5850 !! wikitext
5851 #REDIRECT [[Main Page]]
5852 !! html
5853 <link rel="mw:PageProp/redirect" href="./Main_Page">
5854 !! end
5855
5856 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
5857 !! test
5858 2. Other redirect variants
5859 !! options
5860 parsoid=wt2html,wt2wt
5861 !! wikitext
5862 #REDIRECT [[Main_Page]]
5863 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
5864 !! html
5865 <link rel="mw:PageProp/redirect" href="./Main_Page">
5866 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
5867 !! end
5868
5869 !! test
5870 Optional colon in #REDIRECT
5871 !! options
5872 # the colon is archaic syntax. we support it for wt2html, but we
5873 # don't care that it roundtrips back to the modern syntax.
5874 parsoid=wt2html,html2html
5875 !! wikitext
5876 #REDIRECT:[[Main Page]]
5877 !! html
5878 <link rel="mw:PageProp/redirect" href="./Main_Page">
5879 !! end
5880
5881 !! test
5882 Whitespace in #REDIRECT with optional colon
5883 !! options
5884 # the colon and gratuitous whitespace is archaic syntax. we support
5885 # it for wt2html, but we don't care that it roundtrips back to the
5886 # modern syntax (without extra whitespace)
5887 parsoid=wt2html,html2html
5888 !! wikitext
5889
5890 #REDIRECT
5891 :
5892 [[Main Page]]
5893 !! html
5894 <link rel="mw:PageProp/redirect" href="./Main_Page">
5895 !! end
5896
5897 !! test
5898 Piped link in #REDIRECT
5899 !! options
5900 # content after piped link is ignored. we support this syntax,
5901 # but don't care that the piped link is lost when we roundtrip this.
5902 parsoid=wt2html
5903 !! wikitext
5904 #REDIRECT [[Main Page|bar]]
5905 !! html
5906 <link rel="mw:PageProp/redirect" href="./Main_Page">
5907 !! end
5908
5909 !! test
5910 Redirect to category
5911 !! options
5912 parsoid=wt2html
5913 !! wikitext
5914 #REDIRECT [[Category:Foo]]
5915 !! html
5916 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5917 !! end
5918
5919 !! test
5920 Redirect to category with URL encoding
5921 !! options
5922 parsoid=wt2html
5923 !! wikitext
5924 #REDIRECT [[Category%3AFoo]]
5925 !! html
5926 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5927 !! end
5928
5929 !! test
5930 Redirect to category page
5931 !! options
5932 parsoid=wt2html,html2html
5933 !! wikitext
5934 #REDIRECT [[:Category:Foo]]
5935 !! html
5936 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5937 !! end
5938
5939 !! test
5940 Redirect to image page (1)
5941 !! options
5942 parsoid
5943 !! wikitext
5944 #REDIRECT [[File:Wiki.png]]
5945 !! html
5946 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5947 !! end
5948
5949 !! test
5950 Redirect to image page (2)
5951 !! options
5952 parsoid
5953 !! wikitext
5954 #REDIRECT [[Image:Wiki.png]]
5955 !! html
5956 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5957 !! end
5958
5959 !! test
5960 Redirect to language
5961 !! options
5962 parsoid
5963 !! wikitext
5964 #REDIRECT [[en:File:Wiki.png]]
5965 !! html
5966 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5967 !! end
5968
5969 !! test
5970 Redirect to interwiki
5971 !! options
5972 parsoid
5973 !! wikitext
5974 #REDIRECT [[meatball:File:Wiki.png]]
5975 !! html
5976 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5977 !! end
5978
5979 !! test
5980 Non-English #REDIRECT
5981 !! options
5982 parsoid
5983 language=is
5984 !! wikitext
5985 #TILVÍSUN [[Main Page]]
5986 !! html
5987 <link rel="mw:PageProp/redirect" href="./Main_Page">
5988 !! end
5989
5990 !! test
5991 New redirect
5992 !! options
5993 parsoid=html2wt
5994 !! wikitext
5995 Foo
5996 #REDIRECT [[Foo]]
5997 !! html
5998 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
5999 !! end
6000
6001 ##
6002 ## XHTML tidiness
6003 ###
6004
6005 !! test
6006 <br> to <br />
6007 !! wikitext
6008 1<br>2<br />3
6009 !! html
6010 <p>1<br />2<br />3
6011 </p>
6012 !! end
6013
6014 !! test
6015 Broken br tag sanitization
6016 !! wikitext
6017 </br>
6018 !! html/php
6019 <p>&lt;/br&gt;
6020 </p>
6021 !! end
6022
6023 # TODO: Fix html2html mode (bug 51055)!
6024 !! test
6025 Parsoid: Broken br tag recognition
6026 !! options
6027 parsoid=wt2html
6028 !! wikitext
6029 </br>
6030 !! html/parsoid
6031 <p><br></p>
6032 !! end
6033
6034 !! test
6035 Incorrecly removing closing slashes from correctly formed XHTML
6036 !! wikitext
6037 <br style="clear:both;" />
6038 !! html
6039 <p><br style="clear:both;" />
6040 </p>
6041 !! end
6042
6043 !! test
6044 Failing to transform badly formed HTML into correct XHTML
6045 !! wikitext
6046 <br style="clear: left;">
6047 <br style="clear: right;">
6048 <br style="clear: both;">
6049 !! html
6050 <p><br style="clear: left;" />
6051 <br style="clear: right;" />
6052 <br style="clear: both;" />
6053 </p>
6054 !!end
6055
6056 !! test
6057 Handling html with a div self-closing tag
6058 !! wikitext
6059 <div title />
6060 <div title/>
6061 <div title/ >
6062 <div title=bar />
6063 <div title=bar/>
6064 <div title=bar/ >
6065 !! html
6066 <p>&lt;div title /&gt;
6067 &lt;div title/&gt;
6068 </p>
6069 <div>
6070 <p>&lt;div title=bar /&gt;
6071 &lt;div title=bar/&gt;
6072 </p>
6073 <div title="bar/"></div>
6074 </div>
6075
6076 !! end
6077
6078 !! test
6079 Handling html with a br self-closing tag
6080 !! wikitext
6081 <br title />
6082 <br title/>
6083 <br title/ >
6084 <br title=bar />
6085 <br title=bar/>
6086 <br title=bar/ >
6087 !! html
6088 <p><br title="title" />
6089 <br title="title" />
6090 <br />
6091 <br title="bar" />
6092 <br title="bar" />
6093 <br title="bar/" />
6094 </p>
6095 !! end
6096
6097 !! test
6098 Horizontal ruler (should it add that extra space?)
6099 !! wikitext
6100 <hr>
6101 <hr >
6102 foo <hr
6103 > bar
6104 !! html
6105 <hr />
6106 <hr />
6107 foo <hr /> bar
6108
6109 !! end
6110
6111 !! test
6112 Horizontal ruler -- 4+ dashes render hr
6113 !! wikitext
6114 ----
6115 !! html
6116 <hr />
6117
6118 !! end
6119
6120 !! test
6121 Horizontal ruler -- eats additional dashes on the same line
6122 !! wikitext
6123 ---------
6124 !! html
6125 <hr />
6126
6127 !! end
6128
6129 !! test
6130 Horizontal ruler -- does not collapse dashes on consecutive lines
6131 !! wikitext
6132 ----
6133 ----
6134 !! html
6135 <hr />
6136 <hr />
6137
6138 !! end
6139
6140 !! test
6141 Horizontal ruler -- <4 dashes render as plain text
6142 !! wikitext
6143 ---
6144 !! html
6145 <p>---
6146 </p>
6147 !! end
6148
6149 !! test
6150 Horizontal ruler -- Supports content following dashes on same line
6151 !! wikitext
6152 ---- Foo
6153 !! html
6154 <hr /> Foo
6155
6156 !! end
6157
6158 ###
6159 ### Block-level elements
6160 ###
6161 !! test
6162 Common list
6163 !! wikitext
6164 *Common list
6165 * item 2
6166 *item 3
6167 !! html
6168 <ul>
6169 <li>Common list
6170 </li>
6171 <li> item 2
6172 </li>
6173 <li>item 3
6174 </li>
6175 </ul>
6176
6177 !! end
6178
6179 !! test
6180 Numbered list
6181 !! wikitext
6182 #Numbered list
6183 #item 2
6184 # item 3
6185 !! html
6186 <ol>
6187 <li>Numbered list
6188 </li>
6189 <li>item 2
6190 </li>
6191 <li> item 3
6192 </li>
6193 </ol>
6194
6195 !! end
6196
6197 !! test
6198 Mixed list
6199 !! wikitext
6200 *Mixed list
6201 *# with numbers
6202 ** and bullets
6203 *# and numbers
6204 *bullets again
6205 **bullet level 2
6206 ***bullet level 3
6207 ***#Number on level 4
6208 **bullet level 2
6209 **#Number on level 3
6210 **#Number on level 3
6211 *#number level 2
6212 *Level 1
6213 *** Level 3
6214 #** Level 3, but ordered
6215 !! html
6216 <ul>
6217 <li>Mixed list
6218 <ol>
6219 <li> with numbers
6220 </li>
6221 </ol>
6222 <ul>
6223 <li> and bullets
6224 </li>
6225 </ul>
6226 <ol>
6227 <li> and numbers
6228 </li>
6229 </ol>
6230 </li>
6231 <li>bullets again
6232 <ul>
6233 <li>bullet level 2
6234 <ul>
6235 <li>bullet level 3
6236 <ol>
6237 <li>Number on level 4
6238 </li>
6239 </ol>
6240 </li>
6241 </ul>
6242 </li>
6243 <li>bullet level 2
6244 <ol>
6245 <li>Number on level 3
6246 </li>
6247 <li>Number on level 3
6248 </li>
6249 </ol>
6250 </li>
6251 </ul>
6252 <ol>
6253 <li>number level 2
6254 </li>
6255 </ol>
6256 </li>
6257 <li>Level 1
6258 <ul>
6259 <li><ul>
6260 <li> Level 3
6261 </li>
6262 </ul>
6263 </li>
6264 </ul>
6265 </li>
6266 </ul>
6267 <ol>
6268 <li><ul>
6269 <li><ul>
6270 <li> Level 3, but ordered
6271 </li>
6272 </ul>
6273 </li>
6274 </ul>
6275 </li>
6276 </ol>
6277
6278 !! end
6279
6280 !! test
6281 Nested lists 1
6282 !! wikitext
6283 *foo
6284 **bar
6285 !! html
6286 <ul>
6287 <li>foo
6288 <ul>
6289 <li>bar
6290 </li>
6291 </ul>
6292 </li>
6293 </ul>
6294
6295 !! end
6296
6297 !! test
6298 Nested lists 2
6299 !! wikitext
6300 **foo
6301 *bar
6302 !! html
6303 <ul>
6304 <li><ul>
6305 <li>foo
6306 </li>
6307 </ul>
6308 </li>
6309 <li>bar
6310 </li>
6311 </ul>
6312
6313 !! end
6314
6315 !! test
6316 Nested lists 3 (first element empty)
6317 !! wikitext
6318 *
6319 **bar
6320 !! html
6321 <ul>
6322 <li>
6323 <ul>
6324 <li>bar
6325 </li>
6326 </ul>
6327 </li>
6328 </ul>
6329
6330 !! end
6331
6332 !! test
6333 Nested lists 4 (first element empty)
6334 !! wikitext
6335 **
6336 *bar
6337 !! html
6338 <ul>
6339 <li><ul>
6340 <li>
6341 </li>
6342 </ul>
6343 </li>
6344 <li>bar
6345 </li>
6346 </ul>
6347
6348 !! end
6349
6350 !! test
6351 Nested lists 5 (both elements empty)
6352 !! wikitext
6353 **
6354 *
6355 !! html
6356 <ul>
6357 <li><ul>
6358 <li>
6359 </li>
6360 </ul>
6361 </li>
6362 <li>
6363 </li>
6364 </ul>
6365
6366 !! end
6367
6368 !! test
6369 Nested lists 6 (both elements empty)
6370 !! wikitext
6371 *
6372 **
6373 !! html
6374 <ul>
6375 <li>
6376 <ul>
6377 <li>
6378 </li>
6379 </ul>
6380 </li>
6381 </ul>
6382
6383 !! end
6384
6385 !! test
6386 Nested lists 7 (skip initial nesting levels)
6387 !! wikitext
6388 *** foo
6389 !! html
6390 <ul>
6391 <li><ul>
6392 <li><ul>
6393 <li> foo
6394 </li>
6395 </ul>
6396 </li>
6397 </ul>
6398 </li>
6399 </ul>
6400
6401 !! end
6402
6403 !! test
6404 Nested lists 8 (multiple nesting transitions)
6405 !! wikitext
6406 * foo
6407 *** bar
6408 ** baz
6409 * boo
6410 !! html
6411 <ul>
6412 <li> foo
6413 <ul>
6414 <li><ul>
6415 <li> bar
6416 </li>
6417 </ul>
6418 </li>
6419 <li> baz
6420 </li>
6421 </ul>
6422 </li>
6423 <li> boo
6424 </li>
6425 </ul>
6426
6427 !! end
6428
6429 !! test
6430 1. Lists with start-of-line-transparent tokens before bullets: Comments
6431 !! wikitext
6432 *foo
6433 *<!--cmt-->bar
6434 <!--cmt-->*baz
6435 !! html
6436 <ul>
6437 <li>foo
6438 </li>
6439 <li>bar
6440 </li>
6441 <li>baz
6442 </li>
6443 </ul>
6444
6445 !! end
6446
6447 !! test
6448 2. Lists with start-of-line-transparent tokens before bullets: Template close
6449 !! wikitext
6450 *foo {{echo|bar
6451 }}*baz
6452 !! html
6453 <ul>
6454 <li>foo bar
6455 </li>
6456 <li>baz
6457 </li>
6458 </ul>
6459
6460 !! end
6461
6462 !! test
6463 List items are not parsed correctly following a <pre> block (bug 785)
6464 !! wikitext
6465 * <pre>foo</pre>
6466 * <pre>bar</pre>
6467 * zar
6468 !! html
6469 <ul>
6470 <li> <pre>foo</pre>
6471 </li>
6472 <li> <pre>bar</pre>
6473 </li>
6474 <li> zar
6475 </li>
6476 </ul>
6477
6478 !! end
6479
6480 !! test
6481 List items from template
6482 !! wikitext
6483
6484 {{inner list}}
6485 * item 2
6486
6487 * item 0
6488 {{inner list}}
6489 * item 2
6490
6491 * item 0
6492 * notSOL{{inner list}}
6493 * item 2
6494 !! html
6495 <ul>
6496 <li> item 1
6497 </li>
6498 <li> item 2
6499 </li>
6500 </ul>
6501 <ul>
6502 <li> item 0
6503 </li>
6504 <li> item 1
6505 </li>
6506 <li> item 2
6507 </li>
6508 </ul>
6509 <ul>
6510 <li> item 0
6511 </li>
6512 <li> notSOL
6513 </li>
6514 <li> item 1
6515 </li>
6516 <li> item 2
6517 </li>
6518 </ul>
6519
6520 !! end
6521
6522 !! test
6523 List interrupted by empty line or heading
6524 !! wikitext
6525 * foo
6526
6527 ** bar
6528 == A heading ==
6529 * Another list item
6530 !! html
6531 <ul>
6532 <li> foo
6533 </li>
6534 </ul>
6535 <ul>
6536 <li><ul>
6537 <li> bar
6538 </li>
6539 </ul>
6540 </li>
6541 </ul>
6542 <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>
6543 <ul>
6544 <li> Another list item
6545 </li>
6546 </ul>
6547
6548 !!end
6549
6550 !!test
6551 Multiple list tags generated by templates
6552 !! wikitext
6553 {{echo|<li>}}a
6554 {{echo|<li>}}b
6555 {{echo|<li>}}c
6556 !! html
6557 <li>a
6558 <li>b
6559 <li>c</li>
6560 </li>
6561 </li>
6562
6563 !!end
6564
6565 !!test
6566 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6567 !! wikitext
6568 *a
6569 <!--This line will NOT split the list-->
6570 *b
6571 <!--This line will NOT split the list either-->
6572 *c
6573 <!--foo--> <!----> <!--This line NOT split the list either-->
6574 *d
6575 !! html
6576 <ul>
6577 <li>a
6578 </li>
6579 <li>b
6580 </li>
6581 <li>c
6582 </li>
6583 <li>d
6584 </li>
6585 </ul>
6586
6587 !!end
6588
6589 !!test
6590 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6591 !! wikitext
6592 *a
6593 <!--This line will NOT split the list-->
6594 *b
6595 <!--This line will NOT split the list either-->
6596 *c
6597 <!--foo--> <!----> <!--This line NOT split the list
6598 either-->
6599 *d
6600 !! html
6601 <ul>
6602 <li>a
6603 </li>
6604 <li>b
6605 </li>
6606 <li>c
6607 </li>
6608 <li>d
6609 </li>
6610 </ul>
6611
6612 !!end
6613
6614 !!test
6615 Test the li-hack
6616 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6617 !!options
6618 parsoid=wt2html,wt2wt
6619 !! wikitext
6620 * foo
6621 * <li>li-hack
6622 * {{echo|<li>templated li-hack}}
6623 * <!--foo--> <li> unsupported li-hack with preceding comments
6624
6625 <ul>
6626 <li><li>not a li-hack
6627 </li>
6628 </ul>
6629 !! html
6630 <ul>
6631 <li> foo</li>
6632 <li>li-hack</li>
6633 <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>
6634 <li> <!--foo--> </li>
6635 <li> li-hack with preceding comments</li>
6636 </ul>
6637
6638 <ul>
6639 <li></li>
6640 <li>not a li-hack
6641 </li>
6642 </ul>
6643 !!end
6644
6645 !! test
6646 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6647 !! options
6648 parsoid
6649 !! wikitext
6650 # foo
6651 ## bar
6652 * foo
6653 ** bar
6654 : foo
6655 :: bar
6656 !! html
6657 <ol>
6658 <li> foo<ol>
6659 <li> bar</li>
6660 </ol></li>
6661 </ol><ul>
6662 <li> foo<ul>
6663 <li> bar</li>
6664 </ul></li>
6665 </ul><dl>
6666 <dd> foo<dl>
6667 <dd> bar</dd>
6668 </dl></dd>
6669 </dl>
6670 !! end
6671
6672 !! test
6673 Parsoid: Test of whitespace serialization with Templated bullets
6674 !! options
6675 parsoid
6676 !! wikitext
6677 * {{bullet}}
6678 !! html
6679 <ul>
6680 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6681 </ul>
6682 !! end
6683
6684 # ------------------------------------------------------------------------
6685 # The next set of tests are about Parsoid's ability to handle badly nested
6686 # tags (parse, minimize scope of fixup, and roundtrip back)
6687 # ------------------------------------------------------------------------
6688
6689 !! test
6690 Unbalanced closing block tags break a list
6691 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6692 !! wikitext
6693 <div>
6694 *a</div><div>
6695 *b</div>
6696 !! html/parsoid
6697 <div>
6698 <ul>
6699 <li>a
6700 </li>
6701 </ul></div><div>
6702 <ul>
6703 <li>b
6704 </li>
6705 </ul></div>
6706 !! end
6707
6708 !! test
6709 Unbalanced closing non-block tags don't break a list
6710 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6711 !! wikitext
6712 <span>
6713 *a</span><span>
6714 *b</span>
6715 !! html/parsoid
6716 <p><span></span>
6717 </p>
6718 <ul>
6719 <li>a<span></span>
6720 </li>
6721 <li>b
6722 </li>
6723 </ul>
6724 !! end
6725
6726 !! test
6727 Unclosed formatting tags that straddle lists are closed and reopened
6728 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6729 !! wikitext
6730 # <s> a
6731 # b </s>
6732 !! html/parsoid
6733 <ol>
6734 <li> <s> a </s>
6735 </li>
6736 <li> <s> b </s>
6737 </li>
6738 </ol>
6739 !! end
6740
6741 !!test
6742 List embedded in a non-block tag
6743 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6744 !! wikitext
6745 <small>
6746 * foo
6747 </small>
6748 !! html/parsoid
6749 <p><small></small></p>
6750 <small>
6751 <ul>
6752 <li> foo</li>
6753 </ul>
6754 </small>
6755 <p><small></small></p>
6756 !!end
6757
6758 !! test
6759 Table with missing opening <tr> tag
6760 !! options
6761 parsoid=wt2html,wt2wt
6762 !! wikitext
6763 <table>
6764 <td>foo</td>
6765 </tr>
6766 </table>
6767 !! html/parsoid
6768 <table>
6769 <tr>
6770 <td>foo</td>
6771 </tr>
6772 </table>
6773 !! end
6774
6775 ###
6776 ### Magic Words
6777 ###
6778
6779 # Note that the current date is hard-coded as
6780 # 1970-01-01T00:02:03Z (a Thursday)
6781 # when running parser tests. The timezone is also fixed to GMT, so
6782 # local date will be identical to current date.
6783
6784 !! test
6785 Magic Word: {{CURRENTDAY}}
6786 !! wikitext
6787 {{CURRENTDAY}}
6788 !! html
6789 <p>1
6790 </p>
6791 !! end
6792
6793 !! test
6794 Magic Word: {{CURRENTDAY2}}
6795 !! wikitext
6796 {{CURRENTDAY2}}
6797 !! html
6798 <p>01
6799 </p>
6800 !! end
6801
6802 !! test
6803 Magic Word: {{CURRENTDAYNAME}}
6804 !! wikitext
6805 {{CURRENTDAYNAME}}
6806 !! html
6807 <p>Thursday
6808 </p>
6809 !! end
6810
6811 !! test
6812 Magic Word: {{CURRENTDOW}}
6813 !! wikitext
6814 {{CURRENTDOW}}
6815 !! html
6816 <p>4
6817 </p>
6818 !! end
6819
6820 !! test
6821 Magic Word: {{CURRENTMONTH}}
6822 !! wikitext
6823 {{CURRENTMONTH}}
6824 !! html
6825 <p>01
6826 </p>
6827 !! end
6828
6829 !! test
6830 Magic Word: {{CURRENTMONTH1}}
6831 !! wikitext
6832 {{CURRENTMONTH1}}
6833 !! html
6834 <p>1
6835 </p>
6836 !! end
6837
6838 !! test
6839 Magic Word: {{CURRENTMONTHABBREV}}
6840 !! wikitext
6841 {{CURRENTMONTHABBREV}}
6842 !! html
6843 <p>Jan
6844 </p>
6845 !! end
6846
6847 !! test
6848 Magic Word: {{CURRENTMONTHNAME}}
6849 !! wikitext
6850 {{CURRENTMONTHNAME}}
6851 !! html
6852 <p>January
6853 </p>
6854 !! end
6855
6856 !! test
6857 Magic Word: {{CURRENTMONTHNAMEGEN}}
6858 !! wikitext
6859 {{CURRENTMONTHNAMEGEN}}
6860 !! html
6861 <p>January
6862 </p>
6863 !! end
6864
6865 !! test
6866 Magic Word: {{CURRENTTIME}}
6867 !! wikitext
6868 {{CURRENTTIME}}
6869 !! html
6870 <p>00:02
6871 </p>
6872 !! end
6873
6874 !! test
6875 Magic Word: {{CURRENTHOUR}}
6876 !! wikitext
6877 {{CURRENTHOUR}}
6878 !! html
6879 <p>00
6880 </p>
6881 !! end
6882
6883 !! test
6884 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6885 !! wikitext
6886 {{CURRENTWEEK}}
6887 !! html
6888 <p>1
6889 </p>
6890 !! end
6891
6892 !! test
6893 Magic Word: {{CURRENTYEAR}}
6894 !! wikitext
6895 {{CURRENTYEAR}}
6896 !! html
6897 <p>1970
6898 </p>
6899 !! end
6900
6901 !! test
6902 Magic Word: {{CURRENTTIMESTAMP}}
6903 !! wikitext
6904 {{CURRENTTIMESTAMP}}
6905 !! html
6906 <p>19700101000203
6907 </p>
6908 !! end
6909
6910 !! test
6911 Magic Words LOCAL (UTC)
6912 !! wikitext
6913 * {{LOCALMONTH}}
6914 * {{LOCALMONTH1}}
6915 * {{LOCALMONTHNAME}}
6916 * {{LOCALMONTHNAMEGEN}}
6917 * {{LOCALMONTHABBREV}}
6918 * {{LOCALDAY}}
6919 * {{LOCALDAY2}}
6920 * {{LOCALDAYNAME}}
6921 * {{LOCALYEAR}}
6922 * {{LOCALTIME}}
6923 * {{LOCALHOUR}}
6924 * {{LOCALWEEK}}
6925 * {{LOCALDOW}}
6926 * {{LOCALTIMESTAMP}}
6927 !! html
6928 <ul>
6929 <li> 01
6930 </li>
6931 <li> 1
6932 </li>
6933 <li> January
6934 </li>
6935 <li> January
6936 </li>
6937 <li> Jan
6938 </li>
6939 <li> 1
6940 </li>
6941 <li> 01
6942 </li>
6943 <li> Thursday
6944 </li>
6945 <li> 1970
6946 </li>
6947 <li> 00:02
6948 </li>
6949 <li> 00
6950 </li>
6951 <li> 1
6952 </li>
6953 <li> 4
6954 </li>
6955 <li> 19700101000203
6956 </li>
6957 </ul>
6958
6959 !! end
6960
6961 !! test
6962 Magic Word: {{FULLPAGENAME}}
6963 !! options
6964 title=[[User:Ævar Arnfjörð Bjarmason]]
6965 !! wikitext
6966 {{FULLPAGENAME}}
6967 !! html
6968 <p>User:Ævar Arnfjörð Bjarmason
6969 </p>
6970 !! end
6971
6972 !! test
6973 Magic Word: {{FULLPAGENAMEE}}
6974 !! options
6975 title=[[User:Ævar Arnfjörð Bjarmason]]
6976 !! wikitext
6977 {{FULLPAGENAMEE}}
6978 !! html
6979 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6980 </p>
6981 !! end
6982
6983 !! test
6984 Magic Word: {{TALKSPACE}}
6985 !! options
6986 title=[[User:Ævar Arnfjörð Bjarmason]]
6987 !! wikitext
6988 {{TALKSPACE}}
6989 !! html
6990 <p>User talk
6991 </p>
6992 !! end
6993
6994 !! test
6995 Magic Word: {{TALKSPACE}}, same namespace
6996 !! options
6997 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6998 !! wikitext
6999 {{TALKSPACE}}
7000 !! html
7001 <p>User talk
7002 </p>
7003 !! end
7004
7005 !! test
7006 Magic Word: {{TALKSPACE}}, main namespace
7007 !! options
7008 title=[[Parser Test]]
7009 !! wikitext
7010 {{TALKSPACE}}
7011 !! html
7012 <p>Talk
7013 </p>
7014 !! end
7015
7016 !! test
7017 Magic Word: {{TALKSPACEE}}
7018 !! options
7019 title=[[User:Ævar Arnfjörð Bjarmason]]
7020 !! wikitext
7021 {{TALKSPACEE}}
7022 !! html
7023 <p>User_talk
7024 </p>
7025 !! end
7026
7027 !! test
7028 Magic Word: {{SUBJECTSPACE}}
7029 !! options
7030 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7031 !! wikitext
7032 {{SUBJECTSPACE}}
7033 !! html
7034 <p>User
7035 </p>
7036 !! end
7037
7038 !! test
7039 Magic Word: {{SUBJECTSPACE}}, same namespace
7040 !! options
7041 title=[[User:Ævar Arnfjörð Bjarmason]]
7042 !! wikitext
7043 {{SUBJECTSPACE}}
7044 !! html
7045 <p>User
7046 </p>
7047 !! end
7048
7049 !! test
7050 Magic Word: {{SUBJECTSPACE}}, main namespace
7051 !! options
7052 title=[[Parser Test]]
7053 !! wikitext
7054 {{SUBJECTSPACE}}
7055 !! html
7056
7057 !! end
7058
7059 !! test
7060 Magic Word: {{SUBJECTSPACEE}}
7061 !! options
7062 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7063 !! wikitext
7064 {{SUBJECTSPACEE}}
7065 !! html
7066 <p>User
7067 </p>
7068 !! end
7069
7070 !! test
7071 Magic Word: {{NAMESPACE}}
7072 !! options
7073 title=[[User:Ævar Arnfjörð Bjarmason]]
7074 !! wikitext
7075 {{NAMESPACE}}
7076 !! html
7077 <p>User
7078 </p>
7079 !! end
7080
7081 !! test
7082 Magic Word: {{NAMESPACEE}}
7083 !! options
7084 title=[[User:Ævar Arnfjörð Bjarmason]]
7085 !! wikitext
7086 {{NAMESPACEE}}
7087 !! html
7088 <p>User
7089 </p>
7090 !! end
7091
7092 !! test
7093 Magic Word: {{NAMESPACENUMBER}}
7094 !! options
7095 title=[[User:Ævar Arnfjörð Bjarmason]]
7096 !! wikitext
7097 {{NAMESPACENUMBER}}
7098 !! html
7099 <p>2
7100 </p>
7101 !! end
7102
7103 !! test
7104 Magic Word: {{SUBPAGENAME}}
7105 !! options
7106 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7107 !! wikitext
7108 {{SUBPAGENAME}}
7109 !! html
7110 <p>sub ö
7111 </p>
7112 !! end
7113
7114 !! test
7115 Magic Word: {{SUBPAGENAMEE}}
7116 !! options
7117 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7118 !! wikitext
7119 {{SUBPAGENAMEE}}
7120 !! html
7121 <p>sub_%C3%B6
7122 </p>
7123 !! end
7124
7125 !! test
7126 Magic Word: {{ROOTPAGENAME}}
7127 !! options
7128 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7129 !! wikitext
7130 {{ROOTPAGENAME}}
7131 !! html
7132 <p>Ævar Arnfjörð Bjarmason
7133 </p>
7134 !! end
7135
7136 !! test
7137 Magic Word: {{ROOTPAGENAMEE}}
7138 !! options
7139 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7140 !! wikitext
7141 {{ROOTPAGENAMEE}}
7142 !! html
7143 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7144 </p>
7145 !! end
7146
7147 !! test
7148 Magic Word: {{BASEPAGENAME}}
7149 !! options
7150 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7151 !! wikitext
7152 {{BASEPAGENAME}}
7153 !! html
7154 <p>Ævar Arnfjörð Bjarmason
7155 </p>
7156 !! end
7157
7158 !! test
7159 Magic Word: {{BASEPAGENAMEE}}
7160 !! options
7161 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7162 !! wikitext
7163 {{BASEPAGENAMEE}}
7164 !! html
7165 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7166 </p>
7167 !! end
7168
7169 !! test
7170 Magic Word: {{TALKPAGENAME}}
7171 !! options
7172 title=[[User:Ævar Arnfjörð Bjarmason]]
7173 !! wikitext
7174 {{TALKPAGENAME}}
7175 !! html
7176 <p>User talk:Ævar Arnfjörð Bjarmason
7177 </p>
7178 !! end
7179
7180 !! test
7181 Magic Word: {{TALKPAGENAMEE}}
7182 !! options
7183 title=[[User:Ævar Arnfjörð Bjarmason]]
7184 !! wikitext
7185 {{TALKPAGENAMEE}}
7186 !! html
7187 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7188 </p>
7189 !! end
7190
7191 !! test
7192 Magic Word: {{SUBJECTPAGENAME}}
7193 !! options
7194 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7195 !! wikitext
7196 {{SUBJECTPAGENAME}}
7197 !! html
7198 <p>User:Ævar Arnfjörð Bjarmason
7199 </p>
7200 !! end
7201
7202 !! test
7203 Magic Word: {{SUBJECTPAGENAMEE}}
7204 !! options
7205 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7206 !! wikitext
7207 {{SUBJECTPAGENAMEE}}
7208 !! html
7209 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7210 </p>
7211 !! end
7212
7213 !! test
7214 Magic Word: {{NUMBEROFFILES}}
7215 !! wikitext
7216 {{NUMBEROFFILES}}
7217 !! html
7218 <p>4
7219 </p>
7220 !! end
7221
7222 !! test
7223 Magic Word: {{PAGENAME}}
7224 !! options
7225 title=[[User:Ævar Arnfjörð Bjarmason]]
7226 !! wikitext
7227 {{PAGENAME}}
7228 !! html
7229 <p>Ævar Arnfjörð Bjarmason
7230 </p>
7231 !! end
7232
7233 !! test
7234 Magic Word: {{PAGENAME}} with metacharacters
7235 !! options
7236 title=[['foo & bar = baz']]
7237 !! wikitext
7238 ''{{PAGENAME}}''
7239 !! html
7240 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7241 </p>
7242 !! end
7243
7244 !! test
7245 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7246 !! options
7247 title=[[*RFC 1234 http://example.com/]]
7248 !! wikitext
7249 {{PAGENAME}}
7250 !! html
7251 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7252 </p>
7253 !! end
7254
7255 !! test
7256 Magic Word: {{PAGENAMEE}}
7257 !! options
7258 title=[[User:Ævar Arnfjörð Bjarmason]]
7259 !! wikitext
7260 {{PAGENAMEE}}
7261 !! html
7262 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7263 </p>
7264 !! end
7265
7266 !! test
7267 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7268 !! options
7269 title=[[*RFC 1234 http://example.com/]]
7270 !! wikitext
7271 {{PAGENAMEE}}
7272 !! html
7273 <p>&#42;RFC_1234_http&#58;//example.com/
7274 </p>
7275 !! end
7276
7277 !! test
7278 Magic Word: {{REVISIONID}}
7279 !! wikitext
7280 {{REVISIONID}}
7281 !! html
7282 <p>1337
7283 </p>
7284 !! end
7285
7286 !! test
7287 Magic Word: {{SCRIPTPATH}}
7288 !! wikitext
7289 {{SCRIPTPATH}}
7290 !! html
7291 <p>/
7292 </p>
7293 !! end
7294
7295 !! test
7296 Magic Word: {{STYLEPATH}}
7297 !! wikitext
7298 {{STYLEPATH}}
7299 !! html
7300 <p>/skins
7301 </p>
7302 !! end
7303
7304 !! test
7305 Magic Word: {{SERVER}}
7306 !! wikitext
7307 {{SERVER}}
7308 !! html
7309 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7310 </p>
7311 !! end
7312
7313 !! test
7314 Magic Word: {{SERVERNAME}}
7315 !! wikitext
7316 {{SERVERNAME}}
7317 !! html
7318 <p>example.org
7319 </p>
7320 !! end
7321
7322 !! test
7323 Magic Word: {{SITENAME}}
7324 !! wikitext
7325 {{SITENAME}}
7326 !! html
7327 <p>MediaWiki
7328 </p>
7329 !! end
7330
7331 !! test
7332 Case-sensitive magic words, when cased differently, should just be template transclusions
7333 !! wikitext
7334 {{CurrentMonth}}
7335 {{currentday}}
7336 {{cURreNTweEK}}
7337 {{currentHour}}
7338 !! html
7339 <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>
7340 <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>
7341 <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>
7342 <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>
7343 </p>
7344 !! end
7345
7346 !! test
7347 Case-insensitive magic words should still work with weird casing.
7348 !! wikitext
7349 {{sErVeRNaMe}}
7350 {{LCFirst:AOEU}}
7351 {{ucFIRST:aoeu}}
7352 {{SERver}}
7353 !! html
7354 <p>example.org
7355 aOEU
7356 Aoeu
7357 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7358 </p>
7359 !! end
7360
7361 !! test
7362 Namespace 1 {{ns:1}}
7363 !! wikitext
7364 {{ns:1}}
7365 !! html
7366 <p>Talk
7367 </p>
7368 !! end
7369
7370 !! test
7371 Namespace 1 {{ns:01}}
7372 !! wikitext
7373 {{ns:01}}
7374 !! html
7375 <p>Talk
7376 </p>
7377 !! end
7378
7379 !! test
7380 Namespace 0 {{ns:0}} (bug 4783)
7381 !! wikitext
7382 {{ns:0}}
7383 !! html
7384
7385 !! end
7386
7387 !! test
7388 Namespace 0 {{ns:00}} (bug 4783)
7389 !! wikitext
7390 {{ns:00}}
7391 !! html
7392
7393 !! end
7394
7395 !! test
7396 Namespace -1 {{ns:-1}}
7397 !! wikitext
7398 {{ns:-1}}
7399 !! html
7400 <p>Special
7401 </p>
7402 !! end
7403
7404 !! test
7405 Namespace User {{ns:User}}
7406 !! wikitext
7407 {{ns:User}}
7408 !! html
7409 <p>User
7410 </p>
7411 !! end
7412
7413 !! test
7414 Namespace User talk {{ns:User_talk}}
7415 !! wikitext
7416 {{ns:User_talk}}
7417 !! html
7418 <p>User talk
7419 </p>
7420 !! end
7421
7422 !! test
7423 Namespace User talk {{ns:uSeR tAlK}}
7424 !! wikitext
7425 {{ns:uSeR tAlK}}
7426 !! html
7427 <p>User talk
7428 </p>
7429 !! end
7430
7431 !! test
7432 Namespace File {{ns:File}}
7433 !! wikitext
7434 {{ns:File}}
7435 !! html
7436 <p>File
7437 </p>
7438 !! end
7439
7440 !! test
7441 Namespace File {{ns:Image}}
7442 !! wikitext
7443 {{ns:Image}}
7444 !! html
7445 <p>File
7446 </p>
7447 !! end
7448
7449 !! test
7450 Namespace (lang=de) Benutzer {{ns:User}}
7451 !! options
7452 language=de
7453 !! wikitext
7454 {{ns:User}}
7455 !! html
7456 <p>Benutzer
7457 </p>
7458 !! end
7459
7460 !! test
7461 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7462 !! options
7463 language=de
7464 !! wikitext
7465 {{ns:3}}
7466 !! html
7467 <p>Benutzer Diskussion
7468 </p>
7469 !! end
7470
7471
7472 !! test
7473 Urlencode
7474 !! wikitext
7475 {{urlencode:hi world?!}}
7476 {{urlencode:hi world?!|WIKI}}
7477 {{urlencode:hi world?!|PATH}}
7478 {{urlencode:hi world?!|QUERY}}
7479 !! html
7480 <p>hi+world%3F%21
7481 hi_world%3F!
7482 hi%20world%3F%21
7483 hi+world%3F%21
7484 </p>
7485 !! end
7486
7487 !! test
7488 Magic Word: prioritize type info over data-parsoid
7489 !! options
7490 parsoid=html2wt
7491 !! wikitext
7492 __FORCETOC__
7493 !! html
7494 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7495 !! end
7496
7497 !! test
7498 Magic Word: serialize on separate line (parsoid)
7499 !! options
7500 parsoid=wt2wt,html2wt
7501 !! wikitext
7502 foo
7503 __NOTOC__
7504 bar
7505 !! html
7506 foo<meta property="mw:PageProp/notoc"/>bar
7507 !! end
7508
7509 !! test
7510 Magic Word: rt non-english wikis
7511 !! options
7512 parsoid=wt2wt
7513 language=de
7514 !! wikitext
7515 __NOEDITSECTION__
7516 !! html
7517 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7518 !! end
7519
7520 ###
7521 ### Magic links
7522 ###
7523 !! test
7524 Magic links: internal link to RFC (bug 479)
7525 !! wikitext
7526 [[RFC 123]]
7527 !! html
7528 <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>
7529 </p>
7530 !! end
7531
7532 !! test
7533 Magic links: RFC (bug 479)
7534 !! wikitext
7535 RFC 822
7536 !! html
7537 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7538 </p>
7539 !! end
7540
7541 !! test
7542 Magic links: ISBN (bug 1937)
7543 !! wikitext
7544 ISBN 0-306-40615-2
7545 !! html
7546 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7547 </p>
7548 !! end
7549
7550 !! test
7551 Magic links: PMID incorrectly converts space to underscore
7552 !! wikitext
7553 PMID 1234
7554 !! html
7555 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7556 </p>
7557 !! end
7558
7559 ###
7560 ### Templates
7561 ####
7562
7563 !! test
7564 Nonexistent template
7565 !! wikitext
7566 {{thistemplatedoesnotexist}}
7567 !! html
7568 <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>
7569 </p>
7570 !! end
7571
7572 !! test
7573 Template with invalid target containing tags
7574 !! wikitext
7575 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7576 !! html
7577 <p>{{a<b>b</b>|foo|a=b|a = b}}
7578 </p>
7579 !! end
7580
7581 !! test
7582 Template with invalid target containing unclosed tag
7583 !! wikitext
7584 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7585 !! html
7586 <p>{{a<b>|foo|a=b|a = b}}</b>
7587 </p>
7588 !! end
7589
7590 !! test
7591 Template with invalid target containing wikilink
7592 !! wikitext
7593 {{[[Main Page]]}}
7594 !! html/php
7595 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7596 </p>
7597 !! html/parsoid
7598 <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>
7599 !! end
7600
7601 !! article
7602 Template:test
7603 !! text
7604 This is a test template
7605 !! endarticle
7606
7607 !! test
7608 Simple template
7609 !! wikitext
7610 {{test}}
7611 !! html
7612 <p>This is a test template
7613 </p>
7614 !! end
7615
7616 !! test
7617 Template with explicit namespace
7618 !! wikitext
7619 {{Template:test}}
7620 !! html
7621 <p>This is a test template
7622 </p>
7623 !! end
7624
7625
7626 !! article
7627 Template:paramtest
7628 !! text
7629 This is a test template with parameter {{{param}}}
7630 !! endarticle
7631
7632 !! test
7633 Template parameter
7634 !! wikitext
7635 {{paramtest|param=foo}}
7636 !! html
7637 <p>This is a test template with parameter foo
7638 </p>
7639 !! end
7640
7641 !! article
7642 Template:paramtestnum
7643 !! text
7644 [[{{{1}}}|{{{2}}}]]
7645 !! endarticle
7646
7647 !! test
7648 Template unnamed parameter
7649 !! wikitext
7650 {{paramtestnum|Main Page|the main page}}
7651 !! html
7652 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7653 </p>
7654 !! end
7655
7656 !! article
7657 Template:templatesimple
7658 !! text
7659 (test)
7660 !! endarticle
7661
7662 !! article
7663 Template:templateredirect
7664 !! text
7665 #redirect [[Template:templatesimple]]
7666 !! endarticle
7667
7668 !! article
7669 Template:templateasargtestnum
7670 !! text
7671 {{{{{1}}}}}
7672 !! endarticle
7673
7674 !! article
7675 Template:templateasargtest
7676 !! text
7677 {{template{{{templ}}}}}
7678 !! endarticle
7679
7680 !! article
7681 Template:templateasargtest2
7682 !! text
7683 {{{{{templ}}}}}
7684 !! endarticle
7685
7686 !! test
7687 Template with template name as unnamed argument
7688 !! wikitext
7689 {{templateasargtestnum|templatesimple}}
7690 !! html
7691 <p>(test)
7692 </p>
7693 !! end
7694
7695 !! test
7696 Template with template name as argument
7697 !! wikitext
7698 {{templateasargtest|templ=simple}}
7699 !! html
7700 <p>(test)
7701 </p>
7702 !! end
7703
7704 !! test
7705 Template with template name as argument (2)
7706 !! wikitext
7707 {{templateasargtest2|templ=templatesimple}}
7708 !! html
7709 <p>(test)
7710 </p>
7711 !! end
7712
7713 !! article
7714 Template:templateasargtestdefault
7715 !! text
7716 {{{{{templ|templatesimple}}}}}
7717 !! endarticle
7718
7719 !! article
7720 Template:templa
7721 !! text
7722 '''templ'''
7723 !! endarticle
7724
7725 !! test
7726 Template with default value
7727 !! wikitext
7728 {{templateasargtestdefault}}
7729 !! html
7730 <p>(test)
7731 </p>
7732 !! end
7733
7734 !! test
7735 Template with default value (value set)
7736 !! wikitext
7737 {{templateasargtestdefault|templ=templa}}
7738 !! html
7739 <p><b>templ</b>
7740 </p>
7741 !! end
7742
7743 !! test
7744 Template redirect
7745 !! wikitext
7746 {{templateredirect}}
7747 !! html
7748 <p>(test)
7749 </p>
7750 !! end
7751
7752 !! test
7753 Template with argument in separate line
7754 !! wikitext
7755 {{ templateasargtest |
7756 templ = simple }}
7757 !! html
7758 <p>(test)
7759 </p>
7760 !! end
7761
7762 !! test
7763 Template with complex template as argument
7764 !! wikitext
7765 {{paramtest|
7766 param ={{ templateasargtest |
7767 templ = simple }}}}
7768 !! html
7769 <p>This is a test template with parameter (test)
7770 </p>
7771 !! end
7772
7773 !! test
7774 Template with thumb image (with link in description)
7775 !! wikitext
7776 {{paramtest|
7777 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7778 !! html
7779 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>
7780
7781 !! end
7782
7783 !! article
7784 Template:complextemplate
7785 !! text
7786 {{{1}}} {{paramtest|
7787 param ={{{param}}}}}
7788 !! endarticle
7789
7790 !! test
7791 Template with complex arguments
7792 !! wikitext
7793 {{complextemplate|
7794 param ={{ templateasargtest |
7795 templ = simple }}|[[Template:complextemplate|link]]}}
7796 !! html
7797 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7798 </p>
7799 !! end
7800
7801 !! test
7802 BUG 553: link with two variables in a piped link
7803 !! wikitext
7804 {|
7805 |[[{{{1}}}|{{{2}}}]]
7806 |}
7807 !! html
7808 <table>
7809 <tr>
7810 <td>[[{{{1}}}|{{{2}}}]]
7811 </td></tr></table>
7812
7813 !! end
7814
7815 !! test
7816 Magic variable as template parameter
7817 !! wikitext
7818 {{paramtest|param={{SITENAME}}}}
7819 !! html
7820 <p>This is a test template with parameter MediaWiki
7821 </p>
7822 !! end
7823
7824 !! article
7825 Template:linktest
7826 !! text
7827 [[{{{param}}}|link]]
7828 !! endarticle
7829
7830 !! test
7831 Template parameter as link source
7832 !! wikitext
7833 {{linktest|param=Main Page}}
7834 !! html
7835 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7836 </p>
7837 !! end
7838
7839 !!test
7840 Template-generated attribute string (k='v')
7841 !! wikitext
7842 <span {{attr_str|id|v1}}>bar</span>
7843 !! html
7844 <p><span id="v1">bar</span>
7845 </p>
7846 !!end
7847
7848 !!article
7849 Template:paramtest2
7850 !! text
7851 including another template, {{paramtest|param={{{arg}}}}}
7852 !! endarticle
7853
7854 !! test
7855 Template passing argument to another template
7856 !! wikitext
7857 {{paramtest2|arg='hmm'}}
7858 !! html
7859 <p>including another template, This is a test template with parameter 'hmm'
7860 </p>
7861 !! end
7862
7863 !! article
7864 Template:Linktest2
7865 !! text
7866 Main Page
7867 !! endarticle
7868
7869 !! test
7870 Template as link source
7871 !! wikitext
7872 [[{{linktest2}}]]
7873
7874 [[{{linktest2}}|Main Page]]
7875
7876 [[{{linktest2}}]]Page
7877 !! html
7878 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7879 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7880 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7881 </p>
7882 !! end
7883
7884
7885 !! article
7886 Template:loop1
7887 !! text
7888 {{loop2}}
7889 !! endarticle
7890
7891 !! article
7892 Template:loop2
7893 !! text
7894 {{loop1}}
7895 !! endarticle
7896
7897 !! test
7898 Template infinite loop
7899 !! wikitext
7900 {{loop1}}
7901 !! html
7902 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7903 </p>
7904 !! end
7905
7906 !! test
7907 Template from main namespace
7908 !! wikitext
7909 {{:Main Page}}
7910 !! html
7911 <p>blah blah
7912 </p>
7913 !! end
7914
7915 !! article
7916 Template:table
7917 !! text
7918 {|
7919 | 1 || 2
7920 |-
7921 | 3 || 4
7922 |}
7923 !! endarticle
7924
7925 !! test
7926 BUG 529: Template with table, not included at beginning of line
7927 !! wikitext
7928 foo {{table}}
7929 !! html
7930 <p>foo
7931 </p>
7932 <table>
7933 <tr>
7934 <td> 1 </td>
7935 <td> 2
7936 </td></tr>
7937 <tr>
7938 <td> 3 </td>
7939 <td> 4
7940 </td></tr></table>
7941
7942 !! end
7943
7944 !! test
7945 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7946 !! wikitext
7947 foo
7948 {{table}}
7949 !! html
7950 <p>foo
7951 </p>
7952 <table>
7953 <tr>
7954 <td> 1 </td>
7955 <td> 2
7956 </td></tr>
7957 <tr>
7958 <td> 3 </td>
7959 <td> 4
7960 </td></tr></table>
7961
7962 !! end
7963
7964 !! test
7965 BUG 41: Template parameters shown as broken links
7966 !! wikitext
7967 {{{parameter}}}
7968 !! html
7969 <p>{{{parameter}}}
7970 </p>
7971 !! end
7972
7973 !! test
7974 Template with targets containing wikilinks
7975 !! wikitext
7976 {{[[foo]]}}
7977
7978 {{[[{{echo|foo}}]]}}
7979
7980 {{{{echo|[[foo}}]]}}
7981 !! html
7982 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7983 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7984 </p><p>{{[[foo}}]]
7985 </p>
7986 !! end
7987
7988 !! article
7989 Template:MSGNW test
7990 !! text
7991 ''None'' of '''this''' should be
7992 * interpreted
7993 but rather passed unmodified
7994 {{test}}
7995 !! endarticle
7996
7997 # hmm, fix this or just deprecate msgnw and document its behavior?
7998 !! test
7999 msgnw keyword
8000 !! options
8001 disabled
8002 !! wikitext
8003 {{msgnw:MSGNW test}}
8004 !! html
8005 <p>''None'' of '''this''' should be
8006 * interpreted
8007 but rather passed unmodified
8008 {{test}}
8009 </p>
8010 !! end
8011
8012 !! test
8013 int keyword
8014 !! wikitext
8015 {{int:youhavenewmessages|lots of money|not!}}
8016 !! html
8017 <p>You have lots of money (not!).
8018 </p>
8019 !! end
8020
8021 !! article
8022 Template:Includes
8023 !! text
8024 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8025 !! endarticle
8026
8027 !! test
8028 <includeonly> and <noinclude> being included
8029 !! wikitext
8030 {{Includes}}
8031 !! html
8032 <p>Foobar
8033 </p>
8034 !! end
8035
8036 !! article
8037 Template:Includes2
8038 !! text
8039 <onlyinclude>Foo</onlyinclude>bar
8040 !! endarticle
8041
8042 !! test
8043 <onlyinclude> being included
8044 !! wikitext
8045 {{Includes2}}
8046 !! html
8047 <p>Foo
8048 </p>
8049 !! end
8050
8051
8052 !! article
8053 Template:Includes3
8054 !! text
8055 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8056 !! endarticle
8057
8058 !! test
8059 <onlyinclude> and <includeonly> being included
8060 !! wikitext
8061 {{Includes3}}
8062 !! html
8063 <p>Foo
8064 </p>
8065 !! end
8066
8067 !! test
8068 <includeonly> and <noinclude> on a page
8069 !! wikitext
8070 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8071 !! html
8072 <p>Foozar
8073 </p>
8074 !! end
8075
8076 !! test
8077 Un-closed <noinclude>
8078 !! wikitext
8079 <noinclude>
8080 !! html
8081 !! end
8082
8083 !! test
8084 <onlyinclude> on a page
8085 !! wikitext
8086 <onlyinclude>Foo</onlyinclude>bar
8087 !! html
8088 <p>Foobar
8089 </p>
8090 !! end
8091
8092 !! test
8093 Un-closed <onlyinclude>
8094 !! wikitext
8095 <onlyinclude>
8096 !! html
8097 !! end
8098
8099 !!test
8100 Self-closed noinclude, includeonly, onlyinclude tags
8101 !! wikitext
8102 <noinclude />
8103 <includeonly />
8104 <onlyinclude />
8105 !! html
8106 <p><br />
8107 </p>
8108 !!end
8109
8110 !!test
8111 Unbalanced includeonly and noinclude tags
8112 !! wikitext
8113 {|
8114 |a</noinclude>
8115 |b</noinclude></noinclude>
8116 |c</noinclude></includeonly>
8117 |d</includeonly></includeonly>
8118 |}
8119 !! html
8120 <table>
8121 <tr>
8122 <td>a
8123 </td>
8124 <td>b
8125 </td>
8126 <td>c&lt;/includeonly&gt;
8127 </td>
8128 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8129 </td></tr></table>
8130
8131 !!end
8132
8133 !! article
8134 Template:Includeonly section
8135 !! text
8136 <includeonly>
8137 ==Includeonly section==
8138 </includeonly>
8139 ==Section T-1==
8140 !!endarticle
8141
8142 !! test
8143 Bug 6563: Edit link generation for section shown by <includeonly>
8144 !! wikitext
8145 {{includeonly section}}
8146 !! html
8147 <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>
8148 <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>
8149
8150 !! end
8151
8152 # Uses same input as the contents of [[Template:Includeonly section]]
8153 !! test
8154 Bug 6563: Section extraction for section shown by <includeonly>
8155 !! options
8156 section=T-2
8157 !! wikitext
8158 <includeonly>
8159 ==Includeonly section==
8160 </includeonly>
8161 ==Section T-2==
8162 !! html
8163 ==Section T-2==
8164 !! end
8165
8166 !! test
8167 Bug 6563: Edit link generation for section suppressed by <includeonly>
8168 !! wikitext
8169 <includeonly>
8170 ==Includeonly section==
8171 </includeonly>
8172 ==Section 1==
8173 !! html
8174 <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>
8175
8176 !! end
8177
8178 !! test
8179 Bug 6563: Section extraction for section suppressed by <includeonly>
8180 !! options
8181 section=1
8182 !! wikitext
8183 <includeonly>
8184 ==Includeonly section==
8185 </includeonly>
8186 ==Section 1==
8187 !! html
8188 ==Section 1==
8189 !! end
8190
8191 !! test
8192 Un-closed <includeonly>
8193 !! wikitext
8194 <includeonly>
8195 !! html
8196 !! end
8197
8198 # TODO: test with DOM fragment reuse!
8199 !! test
8200 Parsoid: DOM fragment reuse
8201 !! options
8202 parsoid=wt2wt,wt2html
8203 !! wikitext
8204 a{{echo|b<table></table>c}}d
8205
8206 a{{echo|b
8207 <table></table>
8208 c}}d
8209
8210 {{echo|a
8211
8212 <table></table>
8213
8214 b}}
8215 !! html
8216 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8217 <table></table>c"}},"i":0}}]}'>b</span>
8218 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8219
8220
8221 <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">
8222 </span>
8223 <table about="#mwt2"></table><span about="#mwt2">
8224 </span>
8225 <p about="#mwt2">cd</p>
8226
8227
8228 <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">
8229
8230 </span>
8231 <table about="#mwt3"></table><span about="#mwt3">
8232
8233 </span>
8234 <p about="#mwt3">b</p>
8235 !! end
8236
8237 !! test
8238 Parsoid: Merge double tds (bug 50603)
8239 !! options
8240 parsoid
8241 !! wikitext
8242 {|
8243 |{{echo|{{!}} foo}}
8244 |}
8245 !! html
8246 <table><tbody>
8247 <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>
8248 </tbody></table>
8249 !! end
8250
8251 !! test
8252 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8253 !! options
8254 parsoid
8255 !! wikitext
8256 {{echo|<div>}}
8257 {|
8258 |{{echo|{{!}} foo}}
8259 |}
8260 {{echo|</div>}}
8261 !! html
8262 <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}}]}'>
8263 <table><tbody>
8264 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8265 </tbody></table>
8266 </div>
8267 !! end
8268
8269 ###
8270 ### <includeonly> and <noinclude> in attributes
8271 ###
8272 !!test
8273 0. includeonly around the entire attribute
8274 !! wikitext
8275 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8276 !! html
8277 <p><span id="v2">bar</span>
8278 </p>
8279 !!end
8280
8281 !!test
8282 1. includeonly in html attr key
8283 !! wikitext
8284 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8285 !! html
8286 <p><span id="foo">bar</span>
8287 </p>
8288 !!end
8289
8290 !!test
8291 2. includeonly in html attr value
8292 !! wikitext
8293 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8294 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8295 !! html
8296 <p><span id="v1">bar</span>
8297 <span id="v1">bar</span>
8298 </p>
8299 !!end
8300
8301 !!test
8302 3. includeonly in part of an attr value
8303 !! wikitext
8304 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8305 !! html
8306 <p><span style="color:red;">bar</span>
8307 </p>
8308 !!end
8309
8310 !!test
8311 4. includeonly in table attributes
8312 !! wikitext
8313 {|
8314 |- <noinclude>
8315 |-
8316 |a
8317 </noinclude>
8318 |- <includeonly>
8319 |-
8320 |b
8321 </includeonly>
8322 |}
8323 !! html
8324 <table>
8325
8326
8327 <tr>
8328 <td>a
8329 </td></tr>
8330 </table>
8331
8332 !!end
8333
8334 ###
8335 ### Testing parsing of templates where a template arg
8336 ### has the same name as the template itself.
8337 ###
8338
8339 !! article
8340 Template:quote
8341 !! text
8342 {{{quote|{{{1}}}}}}
8343 !! endarticle
8344
8345 !!test
8346 Templates: Template Name/Arg clash: 1. Use of positional param
8347 !! wikitext
8348 {{quote|foo}}
8349 !! html
8350 <p>foo
8351 </p>
8352 !!end
8353
8354 !!test
8355 Templates: Template Name/Arg clash: 2. Use of named param
8356 !! wikitext
8357 {{quote|quote=foo}}
8358 !! html
8359 <p>foo
8360 </p>
8361 !!end
8362
8363 !!test
8364 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8365 !! wikitext
8366 {{quote|quote}}
8367 !! html
8368 <p>quote
8369 </p>
8370 !!end
8371
8372 ###
8373 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8374 ###
8375
8376 !!test
8377 Templates: 1. Simple use
8378 !! wikitext
8379 {{echo|Foo}}
8380 !! html
8381 <p>Foo
8382 </p>
8383 !!end
8384
8385 !!test
8386 Templates: 2. Inside a block tag
8387 !! wikitext
8388 <div>{{echo|Foo}}</div>
8389 <blockquote>{{echo|Foo}}</blockquote>
8390 !! html
8391 <div>Foo</div>
8392 <blockquote>Foo</blockquote>
8393
8394 !!end
8395
8396 !!test
8397 Templates: P-wrapping: 1a. Templates on consecutive lines
8398 !! wikitext
8399 {{echo|Foo}}
8400 {{echo|bar}}
8401 !! html
8402 <p>Foo
8403 bar
8404 </p>
8405 !!end
8406
8407 !!test
8408 Templates: P-wrapping: 1b. Templates on consecutive lines
8409 !! wikitext
8410 Foo
8411
8412 {{echo|bar}}
8413 {{echo|baz}}
8414 !! html
8415 <p>Foo
8416 </p><p>bar
8417 baz
8418 </p>
8419 !!end
8420
8421 !!test
8422 Templates: P-wrapping: 1c. Templates on consecutive lines
8423 !! wikitext
8424 {{echo|Foo}}
8425 {{echo|bar}} <div>baz</div>
8426 !! html
8427 <p>Foo
8428 </p>
8429 bar <div>baz</div>
8430
8431 !!end
8432
8433 !!test
8434 Templates: P-wrapping: 1d. Template preceded by comment-only line
8435 !!options
8436 parsoid
8437 !! wikitext
8438 <!-- foo -->
8439 {{echo|Bar}}
8440 !! html
8441 <!-- foo -->
8442
8443 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8444 !!end
8445
8446 !!test
8447 Templates: Inline Text: 1. Multiple tmeplate uses
8448 !! wikitext
8449 {{echo|Foo}}bar{{echo|baz}}
8450 !! html
8451 <p>Foobarbaz
8452 </p>
8453 !!end
8454
8455 !!test
8456 Templates: Inline Text: 2. Back-to-back template uses
8457 !! wikitext
8458 {{echo|Foo}}{{echo|bar}}
8459 !! html
8460 <p>Foobar
8461 </p>
8462 !!end
8463
8464 !!test
8465 Templates: Block Tags: 1. Multiple template uses
8466 !! wikitext
8467 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8468 !! html
8469 <div>Foo</div><div>bar</div><div>baz</div>
8470
8471 !!end
8472
8473 !!test
8474 Templates: Block Tags: 2. Back-to-back template uses
8475 !! wikitext
8476 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8477 !! html
8478 <div>Foo</div><div>bar</div>
8479
8480 !!end
8481
8482 !!test
8483 Templates: Links: 1. Simple example
8484 !! wikitext
8485 {{echo|[[Foo|bar]]}}
8486 !! html
8487 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8488 </p>
8489 !!end
8490
8491 !!test
8492 Templates: Links: 2. Generation of link href
8493 !! wikitext
8494 [[{{echo|Foo}}|bar]]
8495 !! html
8496 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8497 </p>
8498 !!end
8499
8500 !!test
8501 Templates: Links: 3. Generation of part of a link href
8502 !! wikitext
8503 [[Fo{{echo|o}}|bar]]
8504
8505 [[Foo{{echo|bar}}]]
8506
8507 [[Foo{{echo|bar}}baz]]
8508
8509 [[Foo{{echo|bar}}|bar]]
8510
8511 [[:Foo{{echo|bar}}]]
8512
8513 [[:Foo{{echo|bar}}|bar]]
8514 !! html
8515 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8516 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8517 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8518 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (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=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8521 </p>
8522 !!end
8523
8524 !!test
8525 Templates: Links: 4. Multiple templates generating link href
8526 !! wikitext
8527 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8528 !! html
8529 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8530 </p>
8531 !!end
8532
8533 !!test
8534 Templates: Links: 5. Generation of link text
8535 !! wikitext
8536 [[Foo|{{echo|bar}}]]
8537 !! html
8538 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8539 </p>
8540 !!end
8541
8542 !!test
8543 Templates: Links: 5. Nested templates (only outermost template should be marked)
8544 !! wikitext
8545 {{echo|[[{{echo|Foo}}|bar]]}}
8546 !! html
8547 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8548 </p>
8549 !!end
8550
8551 !!test
8552 Templates: HTML Tag: 1. Generation of HTML attr. key
8553 !! wikitext
8554 <div {{echo|style}}="color:red;">foo</div>
8555 !! html
8556 <div style="color:red;">foo</div>
8557
8558 !!end
8559
8560 !!test
8561 Templates: HTML Tag: 2. Generation of HTML attr. value
8562 !! wikitext
8563 <div style={{echo|'color:red;'}}>foo</div>
8564 !! html
8565 <div style="color:red;">foo</div>
8566
8567 !!end
8568
8569 !!test
8570 Templates: HTML Tag: 3. Generation of HTML attr key and value
8571 !! wikitext
8572 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8573 !! html
8574 <div style="color:red;">foo</div>
8575
8576 !!end
8577
8578 !!test
8579 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8580 !! wikitext
8581 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8582 !! html
8583 <div title="This is a long title with just one piece templated">foo</div>
8584
8585 !!end
8586
8587 !!test
8588 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8589 !! wikitext
8590 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8591 !! html
8592 <div title="This is a long title with just one piece templated">foo</div>
8593
8594 !!end
8595
8596 !!test
8597 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8598 !! wikitext
8599 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8600 !! html
8601 <div title="This is a long title with just one piece templated">foo</div>
8602
8603 !!end
8604
8605 !!test
8606 Templates: HTML Tag: 7. Generation of partial attribute key string
8607 !! wikitext
8608 <div st{{echo|yle}}="color:red;">foo</div>
8609 !! html
8610 <div style="color:red;">foo</div>
8611
8612 !!end
8613
8614 !!test
8615 Templates: HTML Tables: 1. Generating start of a HTML table
8616 !! wikitext
8617 {{echo|<table><tr><td>foo</td>}}</tr></table>
8618 !! html
8619 <table><tr><td>foo</td></tr></table>
8620
8621 !!end
8622
8623 !!test
8624 Templates: HTML Tables: 2a. Generating middle of a HTML table
8625 !! wikitext
8626 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8627 !! html
8628 <table><tr><td>foo</td></tr></table>
8629
8630 !!end
8631
8632 !!test
8633 Templates: HTML Tables: 2b. Generating middle of a HTML table
8634 !! wikitext
8635 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8636 !! html
8637 <table><tr><td>foo</td></tr></table>
8638
8639 !!end
8640
8641 !!test
8642 Templates: HTML Tables: 3. Generating end of a HTML table
8643 !! wikitext
8644 <table><tr>{{echo|<td>foo</td></tr></table>}}
8645 !! html
8646 <table><tr><td>foo</td></tr></table>
8647
8648 !!end
8649
8650 !!test
8651 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8652 !! wikitext
8653 {{echo|<table>}}<tr><td>foo</td></tr></table>
8654 !! html
8655 <table><tr><td>foo</td></tr></table>
8656
8657 !!end
8658
8659 !!test
8660 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8661 !! wikitext
8662 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8663 !! html
8664 <table><tr><td>foo</td></tr></table>
8665
8666 !!end
8667
8668 !!test
8669 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8670 !! wikitext
8671 <table><tr>{{echo|<td>}}foo</td></tr></table>
8672 !! html
8673 <table><tr><td>foo</td></tr></table>
8674
8675 !!end
8676
8677 !!test
8678 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8679 !! wikitext
8680 <table><tr><td>foo{{echo|</td>}}</tr></table>
8681 !! html
8682 <table><tr><td>foo</td></tr></table>
8683
8684 !!end
8685
8686 !!test
8687 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8688 !! wikitext
8689 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8690 !! html
8691 <table><tr><td>foo</td></tr></table>
8692
8693 !!end
8694
8695 !!test
8696 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8697 !! wikitext
8698 <table><tr><td>foo</td></tr>{{echo|</table>}}
8699 !! html
8700 <table><tr><td>foo</td></tr></table>
8701
8702 !!end
8703
8704 !!test
8705 Templates: HTML Tables: 5. Proper fostering of categories from inside
8706 !!options
8707 parsoid=wt2html,wt2wt
8708 !! wikitext
8709 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8710 <!--Two categories (Bug 50330)-->
8711 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8712 !! html
8713 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8714 <!--Two categories (Bug 50330)-->
8715 <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>
8716 !!end
8717
8718 !!test
8719 Templates: Wiki Tables: 1a. Fostering of entire template content
8720 !! wikitext
8721 {|
8722 {{echo|a}}
8723 |}
8724 !! html
8725 <table>
8726 a
8727 <tr><td></td></tr></table>
8728
8729 !!end
8730
8731 !!test
8732 Templates: Wiki Tables: 1b. Fostering of entire template content
8733 !! wikitext
8734 {|
8735 {{echo|<div>}}
8736 foo
8737 {{echo|</div>}}
8738 |}
8739 !! html
8740 <table>
8741 <div>
8742 <p>foo
8743 </p>
8744 </div>
8745 <tr><td></td></tr></table>
8746
8747 !!end
8748
8749 !!test
8750 Templates: Wiki Tables: 2. Fostering of partial template content
8751 !! wikitext
8752 {|
8753 {{echo|a
8754 <div>b</div>}}
8755 |}
8756 !! html
8757 <table>
8758 a
8759 <div>b</div>
8760 <tr><td></td></tr></table>
8761
8762 !!end
8763
8764 !!test
8765 Templates: Wiki Tables: 3. td-content via multiple templates
8766 !! wikitext
8767 {|
8768 {{echo|{{pipe}}a}}{{echo|b}}
8769 |}
8770 !! html
8771 <table>
8772 <tr>
8773 <td>ab
8774 </td></tr></table>
8775
8776 !!end
8777
8778 !!test
8779 Templates: Wiki Tables: 4. Templated tags, no content
8780 !! wikitext
8781 {{tbl-start}}
8782 {{tbl-end}}
8783 !! html
8784 <table>
8785 <tr><td></td></tr></table>
8786
8787 !!end
8788
8789 !!test
8790 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8791 !! wikitext
8792 {{tbl-start}}
8793 |foo
8794 {{tbl-end}}
8795 !! html
8796 <table>
8797 <tr>
8798 <td>foo
8799 </td></tr></table>
8800
8801 !!end
8802
8803 !!test
8804 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8805 !! wikitext
8806 {{tbl-start}}
8807 {{!}}foo
8808 {{tbl-end}}
8809 !! html
8810 <table>
8811 <tr>
8812 <td>foo
8813 </td></tr></table>
8814
8815 !!end
8816
8817 !!test
8818 Templates: Lists: Multi-line list-items via templates
8819 !! wikitext
8820 *{{echo|a {{nonexistent|
8821 unused}}}}
8822 *{{echo|b {{nonexistent|
8823 unused}}}}
8824 !! html
8825 <ul>
8826 <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>
8827 </li>
8828 <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>
8829 </li>
8830 </ul>
8831
8832 !!end
8833
8834 !!test
8835 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8836 !! wikitext
8837 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8838 !! html
8839 <p><i>ab</i>c<i>d</i>e
8840 </p>
8841 !!end
8842
8843 !!test
8844 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8845 (PHP parser generates misnested html)
8846 !! wikitext
8847 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8848 !! html/parsoid
8849 <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>
8850 !!end
8851
8852 !!test
8853 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8854 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8855 !! options
8856 parsoid=wt2html,wt2wt
8857 !! wikitext
8858 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8859 !! html
8860 <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>
8861 <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>
8862 <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>
8863 !!end
8864
8865 !!test
8866 Templates: Ugly nesting: 4. Divs opened/closed across templates
8867 !! wikitext
8868 a<div>b{{echo|c</div>d}}e
8869 !! html
8870 a<div>bc</div>de
8871
8872 !!end
8873
8874 !!test
8875 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8876 (Parsoid-centric)
8877 !! options
8878 parsoid
8879 !! wikitext
8880 {|
8881 |{{echo|foo</table>}}
8882 |bar
8883 |}
8884 !! html
8885 <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|}"]}'>
8886
8887 <tbody>
8888 <tr>
8889 <td>foo</td></tr></tbody></table><span about="#mwt1">
8890 </span><span about="#mwt1">|bar</span><span about="#mwt1">
8891 |}</span>
8892 !!end
8893
8894 !!test
8895 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8896 (Parsoid-centric)
8897 !! options
8898 parsoid
8899 !! wikitext
8900 <table>
8901 <tr>
8902 <td>
8903 <table>
8904 <tr>
8905 <td>1. {{echo|foo </table>}}</td>
8906 <td> bar </td>
8907 <td>2. {{echo|baz </table>}}</td>
8908 </tr>
8909 <tr>
8910 <td>abc</td>
8911 </tr>
8912 </table>
8913 </td>
8914 </tr>
8915 <tr>
8916 <td>xyz</td>
8917 </tr>
8918 </table>
8919 !! html
8920 <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>"]}'>
8921 <tbody><tr>
8922 <td>
8923 <table>
8924 <tbody><tr>
8925 <td>1. foo </td></tr></tbody></table></td>
8926 <td> bar </td>
8927 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8928 </span><span about="#mwt2">
8929 </span><span about="#mwt2">
8930 </span><span about="#mwt2">abc</span><span about="#mwt2">
8931 </span><span about="#mwt2">
8932 </span><span about="#mwt2">
8933 </span><span about="#mwt2">
8934 </span><span about="#mwt2">
8935 </span><span about="#mwt2">
8936 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8937 </span><span about="#mwt2">
8938 </span>
8939 !!end
8940
8941 !! test
8942 Templates: Ugly templates: 3. newline-only template parameter
8943 !! wikitext
8944 foo {{echo|
8945 }}
8946 !! html
8947 <p>foo
8948 </p>
8949 !! end
8950
8951 # This looks like a bug: a single newline triggers p/br for some reason.
8952 !! test
8953 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8954 !! wikitext
8955 {{echo|
8956 }}
8957 !! html
8958 <p><br />
8959 </p>
8960 !! end
8961
8962
8963 !!test
8964 Parser Functions: 1. Simple example
8965 !! wikitext
8966 {{uc:foo}}
8967 !! html
8968 <p>FOO
8969 </p>
8970 !!end
8971
8972 !!test
8973 Parser Functions: 2. Nested use (only outermost should be marked up)
8974 !! wikitext
8975 {{uc:{{lc:FOO}}}}
8976 !! html
8977 <p>FOO
8978 </p>
8979 !!end
8980
8981 ###
8982 ### Pre-save transform tests
8983 ###
8984 !! test
8985 pre-save transform: subst:
8986 !! options
8987 PST
8988 !! wikitext
8989 {{subst:test}}
8990 !! html
8991 This is a test template
8992 !! end
8993
8994 !! test
8995 pre-save transform: normal template
8996 !! options
8997 PST
8998 !! wikitext
8999 {{test}}
9000 !! html
9001 {{test}}
9002 !! end
9003
9004 !! test
9005 pre-save transform: nonexistent template
9006 !! options
9007 PST
9008 !! wikitext
9009 {{thistemplatedoesnotexist}}
9010 !! html
9011 {{thistemplatedoesnotexist}}
9012 !! end
9013
9014
9015 !! test
9016 pre-save transform: subst magic variables
9017 !! options
9018 PST
9019 !! wikitext
9020 {{subst:SITENAME}}
9021 !! html
9022 MediaWiki
9023 !! end
9024
9025 # This is bug 89, which I fixed. -- wtm
9026 !! test
9027 pre-save transform: subst: templates with parameters
9028 !! options
9029 pst
9030 !! wikitext
9031 {{subst:paramtest|param="something else"}}
9032 !! html
9033 This is a test template with parameter "something else"
9034 !! end
9035
9036 !! article
9037 Template:nowikitest
9038 !! text
9039 <nowiki>'''not wiki'''</nowiki>
9040 !! endarticle
9041
9042 !! test
9043 pre-save transform: nowiki in subst (bug 1188)
9044 !! options
9045 pst
9046 !! wikitext
9047 {{subst:nowikitest}}
9048 !! html
9049 <nowiki>'''not wiki'''</nowiki>
9050 !! end
9051
9052
9053 !! article
9054 Template:commenttest
9055 !! text
9056 This template has <!-- a comment --> in it.
9057 !! endarticle
9058
9059 !! test
9060 pre-save transform: comment in subst (bug 1936)
9061 !! options
9062 pst
9063 !! wikitext
9064 {{subst:commenttest}}
9065 !! html
9066 This template has <!-- a comment --> in it.
9067 !! end
9068
9069 !! test
9070 pre-save transform: unclosed tag
9071 !! options
9072 pst noxml
9073 !! wikitext
9074 <nowiki>'''not wiki'''
9075 !! html
9076 <nowiki>'''not wiki'''
9077 !! end
9078
9079 !! test
9080 pre-save transform: mixed tag case
9081 !! options
9082 pst noxml
9083 !! wikitext
9084 <NOwiki>'''not wiki'''</noWIKI>
9085 !! html
9086 <NOwiki>'''not wiki'''</noWIKI>
9087 !! end
9088
9089 !! test
9090 pre-save transform: unclosed comment in <nowiki>
9091 !! options
9092 pst noxml
9093 !! wikitext
9094 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9095 !! html
9096 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9097 !!end
9098
9099 # Leading @ in this template definition works around a limitation
9100 # in parsoid's parserTests which otherwise strips the <span> from the
9101 # result (confusing it for a template wrapper)
9102 !! article
9103 Template:dangerous
9104 !!text
9105 @<span onmouseover="alert('crap')">Oh no</span>
9106 !!endarticle
9107
9108 !!test
9109 (confirming safety of fix for subst bug 1936)
9110 !! wikitext
9111 {{Template:dangerous}}
9112 !! html
9113 <p>@<span>Oh no</span>
9114 </p>
9115 !! end
9116
9117 !! test
9118 pre-save transform: comment containing gallery (bug 5024)
9119 !! options
9120 pst
9121 !! wikitext
9122 <!-- <gallery>data</gallery> -->
9123 !! html
9124 <!-- <gallery>data</gallery> -->
9125 !!end
9126
9127 !! test
9128 pre-save transform: comment containing extension
9129 !! options
9130 pst
9131 !! wikitext
9132 <!-- <tag>data</tag> -->
9133 !! html
9134 <!-- <tag>data</tag> -->
9135 !!end
9136
9137 !! test
9138 pre-save transform: comment containing nowiki
9139 !! options
9140 pst
9141 !! wikitext
9142 <!-- <nowiki>data</nowiki> -->
9143 !! html
9144 <!-- <nowiki>data</nowiki> -->
9145 !!end
9146
9147 !! test
9148 pre-save transform: <noinclude> in subst (bug 3298)
9149 !! options
9150 pst
9151 !! wikitext
9152 {{subst:Includes}}
9153 !! html
9154 Foobar
9155 !! end
9156
9157 !! test
9158 pre-save transform: <onlyinclude> in subst (bug 3298)
9159 !! options
9160 pst
9161 !! wikitext
9162 {{subst:Includes2}}
9163 !! html
9164 Foo
9165 !! end
9166
9167 !! article
9168 Template:SubstTest
9169 !!text
9170 {{<includeonly>subst:</includeonly>Includes}}
9171 !! endarticle
9172
9173 !! article
9174 Template:SafeSubstTest
9175 !! text
9176 {{<includeonly>safesubst:</includeonly>Includes}}
9177 !! endarticle
9178
9179 !! test
9180 bug 22297: safesubst: works during PST
9181 !! options
9182 pst
9183 !! wikitext
9184 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9185 !! html
9186 FoobarFoobar
9187 !! end
9188
9189 !! test
9190 bug 22297: safesubst: works during normal parse
9191 !! wikitext
9192 {{SafeSubstTest}}
9193 !! html
9194 <p>Foobar
9195 </p>
9196 !! end
9197
9198 !! test
9199 subst: does not work during normal parse
9200 !! wikitext
9201 {{SubstTest}}
9202 !! html
9203 <p>{{subst:Includes}}
9204 </p>
9205 !! end
9206
9207 !! test
9208 pre-save transform: context links ("pipe trick")
9209 !! options
9210 pst
9211 !! wikitext
9212 [[Article (context)|]]
9213 [[Bar:Article|]]
9214 [[:Bar:Article|]]
9215 [[Bar:Article (context)|]]
9216 [[:Bar:Article (context)|]]
9217 [[|Article]]
9218 [[|Article (context)]]
9219 [[Bar:X (Y) Z|]]
9220 [[:Bar:X (Y) Z|]]
9221 !! html
9222 [[Article (context)|Article]]
9223 [[Bar:Article|Article]]
9224 [[:Bar:Article|Article]]
9225 [[Bar:Article (context)|Article]]
9226 [[:Bar:Article (context)|Article]]
9227 [[Article]]
9228 [[Article (context)]]
9229 [[Bar:X (Y) Z|X (Y) Z]]
9230 [[:Bar:X (Y) Z|X (Y) Z]]
9231 !! end
9232
9233 !! test
9234 pre-save transform: context links ("pipe trick") with interwiki prefix
9235 !! options
9236 pst
9237 !! wikitext
9238 [[interwiki:Article|]]
9239 [[:interwiki:Article|]]
9240 [[interwiki:Bar:Article|]]
9241 [[:interwiki:Bar:Article|]]
9242 !! html
9243 [[interwiki:Article|Article]]
9244 [[:interwiki:Article|Article]]
9245 [[interwiki:Bar:Article|Bar:Article]]
9246 [[:interwiki:Bar:Article|Bar:Article]]
9247 !! end
9248
9249 !! test
9250 pre-save transform: context links ("pipe trick") with parens in title
9251 !! options
9252 pst title=[[Somearticle (context)]]
9253 !! wikitext
9254 [[|Article]]
9255 !! html
9256 [[Article (context)|Article]]
9257 !! end
9258
9259 !! test
9260 pre-save transform: context links ("pipe trick") with comma in title
9261 !! options
9262 pst title=[[Someplace, Somewhere]]
9263 !! wikitext
9264 [[|Otherplace]]
9265 [[Otherplace, Elsewhere|]]
9266 [[Otherplace, Elsewhere, Anywhere|]]
9267 !! html
9268 [[Otherplace, Somewhere|Otherplace]]
9269 [[Otherplace, Elsewhere|Otherplace]]
9270 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9271 !! end
9272
9273 !! test
9274 pre-save transform: context links ("pipe trick") with parens and comma
9275 !! options
9276 pst title=[[Someplace (IGNORED), Somewhere]]
9277 !! wikitext
9278 [[|Otherplace]]
9279 [[Otherplace (place), Elsewhere|]]
9280 !! html
9281 [[Otherplace, Somewhere|Otherplace]]
9282 [[Otherplace (place), Elsewhere|Otherplace]]
9283 !! end
9284
9285 !! test
9286 pre-save transform: context links ("pipe trick") with comma and parens
9287 !! options
9288 pst title=[[Who, me? (context)]]
9289 !! wikitext
9290 [[|Yes, you.]]
9291 [[Me, Myself, and I (1937 song)|]]
9292 !! html
9293 [[Yes, you. (context)|Yes, you.]]
9294 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9295 !! end
9296
9297 !! test
9298 pre-save transform: context links ("pipe trick") with namespace
9299 !! options
9300 pst title=[[Ns:Somearticle]]
9301 !! wikitext
9302 [[|Article]]
9303 !! html
9304 [[Ns:Article|Article]]
9305 !! end
9306
9307 !! test
9308 pre-save transform: context links ("pipe trick") with namespace and parens
9309 !! options
9310 pst title=[[Ns:Somearticle (context)]]
9311 !! wikitext
9312 [[|Article]]
9313 !! html
9314 [[Ns:Article (context)|Article]]
9315 !! end
9316
9317 !! test
9318 pre-save transform: context links ("pipe trick") with namespace and comma
9319 !! options
9320 pst title=[[Ns:Somearticle, Context, Whatever]]
9321 !! wikitext
9322 [[|Article]]
9323 !! html
9324 [[Ns:Article, Context, Whatever|Article]]
9325 !! end
9326
9327 !! test
9328 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9329 !! options
9330 pst title=[[Ns:Somearticle, Context (context)]]
9331 !! wikitext
9332 [[|Article]]
9333 !! html
9334 [[Ns:Article (context)|Article]]
9335 !! end
9336
9337 !! test
9338 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9339 !! options
9340 pst title=[[Ns:Somearticle (IGNORED), Context]]
9341 !! wikitext
9342 [[|Article]]
9343 !! html
9344 [[Ns:Article, Context|Article]]
9345 !! end
9346
9347 !! test
9348 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9349 !! options
9350 pst
9351 !! wikitext
9352 [[Article(context)|]]
9353 [[Bar:Article(context)|]]
9354 [[:Bar:Article(context)|]]
9355 [[|Article(context)]]
9356 [[Bar:X(Y)Z|]]
9357 [[:Bar:X(Y)Z|]]
9358 !! html
9359 [[Article(context)|Article]]
9360 [[Bar:Article(context)|Article]]
9361 [[:Bar:Article(context)|Article]]
9362 [[Article(context)]]
9363 [[Bar:X(Y)Z|X(Y)Z]]
9364 [[:Bar:X(Y)Z|X(Y)Z]]
9365 !! end
9366
9367 !! test
9368 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9369 !! options
9370 pst
9371 !! wikitext
9372 [[Article (context)|]]
9373 [[Bar:Article (context)|]]
9374 [[:Bar:Article (context)|]]
9375 [[|Article (context)]]
9376 [[Bar:X (Y) Z|]]
9377 [[:Bar:X (Y) Z|]]
9378 !! html
9379 [[Article (context)|Article]]
9380 [[Bar:Article (context)|Article]]
9381 [[:Bar:Article (context)|Article]]
9382 [[Article (context)]]
9383 [[Bar:X (Y) Z|X (Y) Z]]
9384 [[:Bar:X (Y) Z|X (Y) Z]]
9385 !! end
9386
9387 !! test
9388 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9389 !! options
9390 pst
9391 !! wikitext
9392 [[Article(context)|]]
9393 [[Bar:Article(context)|]]
9394 [[:Bar:Article(context)|]]
9395 [[|Article(context)]]
9396 [[Bar:X(Y)Z|]]
9397 [[:Bar:X(Y)Z|]]
9398 !! html
9399 [[Article(context)|Article]]
9400 [[Bar:Article(context)|Article]]
9401 [[:Bar:Article(context)|Article]]
9402 [[Article(context)]]
9403 [[Bar:X(Y)Z|X(Y)Z]]
9404 [[:Bar:X(Y)Z|X(Y)Z]]
9405 !! end
9406
9407 !! test
9408 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9409 !! options
9410 pst
9411 !! wikitext
9412 [[Article (context), context|]]
9413 [[Article (context),context|]]
9414 [[Bar:Article (context), context|]]
9415 [[Bar:Article (context),context|]]
9416 [[:Bar:Article (context), context|]]
9417 [[:Bar:Article (context),context|]]
9418 !! html
9419 [[Article (context), context|Article]]
9420 [[Article (context),context|Article]]
9421 [[Bar:Article (context), context|Article]]
9422 [[Bar:Article (context),context|Article]]
9423 [[:Bar:Article (context), context|Article]]
9424 [[:Bar:Article (context),context|Article]]
9425 !! end
9426
9427 !! test
9428 pre-save transform: trim trailing empty lines
9429 !! options
9430 pst
9431 !! wikitext
9432 Empty lines are trimmed
9433
9434
9435
9436
9437 !! html
9438 Empty lines are trimmed
9439 !! end
9440
9441 !! test
9442 pre-save transform: Signature expansion
9443 !! options
9444 pst
9445 !! wikitext
9446 * ~~~
9447 * <noinclude>~~~</noinclude>
9448 * <includeonly>~~~</includeonly>
9449 * <onlyinclude>~~~</onlyinclude>
9450 !! html
9451 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9452 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9453 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9454 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9455 !! end
9456
9457
9458 !! test
9459 pre-save transform: Signature expansion in nowiki tags (bug 93)
9460 !! options
9461 pst disabled
9462 !! wikitext
9463 Shall not expand:
9464
9465 <nowiki>~~~~</nowiki>
9466
9467 <includeonly><nowiki>~~~~</nowiki></includeonly>
9468
9469 <noinclude><nowiki>~~~~</nowiki></noinclude>
9470
9471 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9472
9473 {{subst:Foo}} shall be converted to FOO
9474
9475 As well as inside noinclude/onlyinclude
9476 <noinclude>{{subst:Foo}}</noinclude>
9477 <onlyinclude>{{subst:Foo}}</onlyinclude>
9478
9479 But not inside includeonly
9480 <includeonly>{{subst:Foo}}</includeonly>
9481 !! html
9482 Shall not expand:
9483
9484 <nowiki>~~~~</nowiki>
9485
9486 <includeonly><nowiki>~~~~</nowiki></includeonly>
9487
9488 <noinclude><nowiki>~~~~</nowiki></noinclude>
9489
9490 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9491
9492 FOO shall be converted to FOO
9493
9494 As well as inside noinclude/onlyinclude
9495 <noinclude>FOO</noinclude>
9496 <onlyinclude>FOO</onlyinclude>
9497
9498 But not inside includeonly
9499 <includeonly>{{subst:Foo}}</includeonly>
9500 !! end
9501
9502 !! test
9503 Parsoid: Recognize nowiki with trailing space in tags
9504 !! options
9505 parsoid=wt2html
9506 !! wikitext
9507 <nowiki ><div>[[foo]]</nowiki >
9508
9509 a<nowiki / >b
9510
9511 c<nowiki />d
9512
9513 e<nowiki/ >f
9514 !! html
9515 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9516 <p>ab</p>
9517 <p>cd</p>
9518 <p>ef</p>
9519 !! end
9520
9521 !! test
9522 Parsoid: Recognize nowiki with odd capitalization
9523 !! options
9524 parsoid=wt2html
9525 !! wikitext
9526 <noWikI ><div>[[foo]]</Nowiki >
9527 !! html
9528 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9529 !! end
9530
9531
9532 !! test
9533 Parsoid: Escape nowiki with trailing space in tags
9534 !! options
9535 parsoid=html2wt
9536 !! wikitext
9537 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9538
9539 a&lt;nowiki /&gt;b
9540
9541 c&lt;nowiki/ &gt;d
9542 !! html
9543 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9544 <p>a&lt;nowiki /&gt;b</p>
9545 <p>c&lt;nowiki/ &gt;d</p>
9546 !! end
9547
9548 !! test
9549 Parsoid: Escape weird noWikI capitalizations
9550 !! options
9551 parsoid=html2wt
9552 !! wikitext
9553 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9554 !! html
9555 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9556 !! end
9557
9558 ###
9559 ### Message transform tests
9560 ###
9561 !! test
9562 message transform: magic variables
9563 !! options
9564 msg
9565 !! wikitext
9566 {{SITENAME}}
9567 !! html
9568 MediaWiki
9569 !! end
9570
9571 !! test
9572 message transform: should not transform wiki markup
9573 !! options
9574 msg
9575 !! wikitext
9576 ''test''
9577 !! html
9578 ''test''
9579 !! end
9580
9581 !! test
9582 message transform: <noinclude> in transcluded template (bug 4926)
9583 !! options
9584 msg
9585 !! wikitext
9586 {{Includes}}
9587 !! html
9588 Foobar
9589 !! end
9590
9591 !! test
9592 message transform: <onlyinclude> in transcluded template (bug 4926)
9593 !! options
9594 msg
9595 !! wikitext
9596 {{Includes2}}
9597 !! html
9598 Foo
9599 !! end
9600
9601 !! test
9602 {{#special:}} page name, known
9603 !! options
9604 msg
9605 !! wikitext
9606 {{#special:Recentchanges}}
9607 !! html
9608 Special:RecentChanges
9609 !! end
9610
9611 !! test
9612 {{#special:}} page name with subpage, known
9613 !! options
9614 msg
9615 !! wikitext
9616 {{#special:Recentchanges/param}}
9617 !! html
9618 Special:RecentChanges/param
9619 !! end
9620
9621 !! test
9622 {{#special:}} page name, unknown
9623 !! options
9624 msg
9625 !! wikitext
9626 {{#special:foobar nonexistent}}
9627 !! html
9628 Special:Foobar nonexistent
9629 !! end
9630
9631 !! test
9632 {{#speciale:}} page name, known
9633 !! options
9634 msg
9635 !! wikitext
9636 {{#speciale:Recentchanges}}
9637 !! html
9638 Special:RecentChanges
9639 !! end
9640
9641 !! test
9642 {{#speciale:}} page name with subpage, known
9643 !! options
9644 msg
9645 !! wikitext
9646 {{#speciale:Recentchanges/param}}
9647 !! html
9648 Special:RecentChanges/param
9649 !! end
9650
9651 !! test
9652 {{#speciale:}} page name, unknown
9653 !! options
9654 msg
9655 !! wikitext
9656 {{#speciale:foobar nonexistent}}
9657 !! html
9658 Special:Foobar_nonexistent
9659 !! end
9660
9661 ###
9662 ### Images
9663 ###
9664 ### For Parsoid-specific tests, see
9665 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9666
9667 !! test
9668 Simple image
9669 !! options
9670 parsoid=wt2html,wt2wt,html2html
9671 !! wikitext
9672 [[Image:foobar.jpg]]
9673 !! html/php
9674 <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>
9675 </p>
9676 !! html/parsoid
9677 <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>
9678 </p>
9679 !! end
9680
9681 !! test
9682 Simple image (using File: namespace, now canonical)
9683 !! wikitext
9684 [[File:Foobar.jpg]]
9685 !! html/php
9686 <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>
9687 </p>
9688 !! html/parsoid
9689 <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>
9690 </p>
9691 !! end
9692
9693 !! test
9694 Right-aligned image
9695 !! wikitext
9696 [[File:Foobar.jpg|right]]
9697 !! html/php
9698 <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>
9699
9700 !! html/parsoid
9701 <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>
9702 !! end
9703
9704 !! test
9705 Image with caption
9706 !! wikitext
9707 [[File:Foobar.jpg|right|Caption text]]
9708 !! html/php
9709 <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>
9710
9711 !! html/parsoid
9712 <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>
9713 !! end
9714
9715 !! test
9716 Image with caption, bug 53312 #1
9717 !! wikitext
9718 [[File:Foobar.jpg|right|Caption page stuff]]
9719 !! html/php
9720 <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>
9721
9722 !! html/parsoid
9723 <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>
9724 !! end
9725
9726 !! test
9727 Image with caption, bug 53312 #2
9728 !! wikitext
9729 [[File:Foobar.jpg|right|Caption page=]]
9730 !! html/php
9731 <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>
9732
9733 !! html/parsoid
9734 <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>
9735 !! end
9736
9737 !! test
9738 Image with caption, bug 53312 #3
9739 !! wikitext
9740 [[File:Foobar.jpg|right|Caption page=stuff]]
9741 !! html/php
9742 <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>
9743
9744 !! html/parsoid
9745 <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>
9746 !! end
9747
9748 !! test
9749 Allow empty links in image captions (Bug 60753)
9750 !! wikitext
9751 [[File:Foobar.jpg|thumb|Caption [[Link1]]
9752 [[]]
9753 [[Link2]]
9754 ]]
9755 !! html/php
9756 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
9757
9758 !! html/parsoid
9759 <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>
9760 [[]]
9761 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
9762 </figcaption></figure>
9763 !! end
9764
9765 !! test
9766 Link with empty target
9767 !! wikitext
9768 [[]]
9769 !! html
9770 <p>[[]]
9771 </p>
9772 !! end
9773
9774 !! test
9775 Image with empty attribute
9776 !! options
9777 parsoid=wt2html,wt2wt,html2html
9778 !! wikitext
9779 [[File:Foobar.jpg|right||Caption text]]
9780 !! html/php
9781 <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>
9782
9783 !! html/parsoid
9784 <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>
9785 !! end
9786
9787 !! test
9788 1. Block image with individual attributes from templates
9789 !! wikitext
9790 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
9791 !! html/php
9792 <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>
9793
9794 !! html/parsoid
9795 <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>
9796 !! end
9797
9798 !! test
9799 2. Block Image with individual attributes from templates
9800 !! wikitext
9801 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
9802 !! html/php
9803 <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>
9804
9805 !! html/parsoid
9806 <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>
9807 !! end
9808
9809 !! test
9810 3. Inline image with individual attributes from templates
9811 !! wikitext
9812 [[File:Foobar.jpg|{{echo|50px}}]]
9813 !! html/php
9814 <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>
9815 </p>
9816 !! html/parsoid
9817 <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>
9818 !! end
9819
9820 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
9821 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
9822 !! test
9823 Image with multiple attributes from the same template
9824 !! wikitext
9825 [[File:Foobar.jpg|{{image_attribs}}]]
9826 !! html/php
9827 <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>
9828
9829 !! html/parsoid
9830 <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>
9831 !! end
9832
9833 !! test
9834 Image with link tails
9835 !! wikitext
9836 123[[File:Foobar.jpg]]456
9837 123[[File:Foobar.jpg|right]]456
9838 123[[File:Foobar.jpg|thumb]]456
9839 !! html/php
9840 <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
9841 </p>
9842 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
9843 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
9844
9845 !! html/parsoid
9846 <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>
9847 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
9848 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
9849 !! end
9850
9851 !! test
9852 Image with multiple captions -- only last one is accepted
9853 !! wikitext
9854 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9855 !! html/php
9856 <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>
9857
9858 !! html/parsoid
9859 <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>
9860 !! end
9861
9862 !! test
9863 Image with multiple widths -- use last
9864 !! wikitext
9865 [[File:Foobar.jpg|200px|300px|caption]]
9866 !! html/php
9867 <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>
9868 </p>
9869 !! html/parsoid
9870 <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>
9871 !! end
9872
9873 !! test
9874 Image with multiple alignments -- use first (bug 48664)
9875 !! wikitext
9876 [[File:Foobar.jpg|thumb|left|right|center|caption]]
9877
9878 [[File:Foobar.jpg|middle|text-top|caption]]
9879 !! html/php
9880 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
9881 <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>
9882 </p>
9883 !! html/parsoid
9884 <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>
9885 <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>
9886 !! end
9887
9888 !! test
9889 Image with width attribute at different positions
9890 !! wikitext
9891 [[File:Foobar.jpg|200px|right|Caption]]
9892 [[File:Foobar.jpg|right|200px|Caption]]
9893 [[File:Foobar.jpg|right|Caption|200px]]
9894 !! html/php
9895 <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>
9896 <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>
9897 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
9898
9899 !! html/parsoid
9900 <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>
9901 <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>
9902 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9903 !! end
9904
9905 # a sad bit of backward-compatibility
9906 !! test
9907 Image with size specified with pxpx (bug 13500, 51628)
9908 !! options
9909 parsoid=wt2html,wt2wt,html2html
9910 !! wikitext
9911 [[File:Foobar.jpg|20pxpx]]
9912 [[File:Foobar.jpg|200x20pxpx]]
9913 !! html/php
9914 <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>
9915 <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>
9916 </p>
9917 !! html/parsoid
9918 <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>
9919 !! end
9920
9921 !! test
9922 Image with link parameter, wiki target
9923 !! wikitext
9924 [[File:Foobar.jpg|link=Main Page]]
9925 !! html/php
9926 <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>
9927 </p>
9928 !! html/parsoid
9929 <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>
9930 !! end
9931
9932 # parsoid bug 49293 (part 1)
9933 !! test
9934 Image with link parameter, URL target
9935 !! wikitext
9936 [[File:Foobar.jpg|link=http://example.com/]]
9937 !! html/php
9938 <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>
9939 </p>
9940 !! html/parsoid
9941 <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>
9942 !! end
9943
9944 # parsoid bug 49293 (part 2)
9945 !! test
9946 Image with link parameter, protocol-less URL target
9947 !! wikitext
9948 [[File:Foobar.jpg|link=//example.com/]]
9949 !! html/php
9950 <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>
9951 </p>
9952 !! html/parsoid
9953 <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>
9954 !! end
9955
9956 !! test
9957 Image with link parameter, wgExternalLinkTarget
9958 !! wikitext
9959 [[Image:foobar.jpg|link=http://example.com/]]
9960 !! config
9961 wgExternalLinkTarget='foobar'
9962 !! html
9963 <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>
9964 </p>
9965 !! end
9966
9967 !! test
9968 Image with link parameter, wgNoFollowLinks set to false
9969 !! wikitext
9970 [[Image:foobar.jpg|link=http://example.com/]]
9971 !! config
9972 wgNoFollowLinks=false
9973 !! html
9974 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9975 </p>
9976 !! end
9977
9978 !! test
9979 Image with link parameter, wgNoFollowDomainExceptions
9980 !! wikitext
9981 [[Image:foobar.jpg|link=http://example.com/]]
9982 !! config
9983 wgNoFollowDomainExceptions='example.com'
9984 !! html
9985 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9986 </p>
9987 !! end
9988
9989 !! test
9990 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9991 !! wikitext
9992 [[Image:foobar.jpg|link=http://example.com/|Title]]
9993 !! config
9994 wgExternalLinkTarget='foobar'
9995 !! html
9996 <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>
9997 </p>
9998 !! end
9999
10000 !! test
10001 Image with empty link parameter
10002 !! wikitext
10003 [[File:Foobar.jpg|link=]]
10004 !! html/php
10005 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10006 </p>
10007 !! html/parsoid
10008 <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>
10009 !! end
10010
10011 !! test
10012 Image with link parameter (wiki target) and unnamed parameter
10013 !! wikitext
10014 [[File:Foobar.jpg|link=Main_Page|Title]]
10015 !! html/php
10016 <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>
10017 </p>
10018 !! html/parsoid
10019 <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>
10020 !! end
10021
10022 !! test
10023 Image with link parameter (URL target) and unnamed parameter
10024 !! wikitext
10025 [[File:Foobar.jpg|link=http://example.com/|Title]]
10026 !! html/php
10027 <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>
10028 </p>
10029 !! html/parsoid
10030 <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>
10031 !! end
10032
10033 !! test
10034 Thumbnail image with link parameter
10035 !! options
10036 parsoid=wt2html,wt2wt,html2html
10037 !! wikitext
10038 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10039 !! html/php
10040 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10041
10042 !! html/parsoid
10043 <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>
10044 !! end
10045
10046 !! test
10047 Manually-specified thumbnail image
10048 !! wikitext
10049 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
10050 !! html/php
10051 <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>
10052
10053 !! html/parsoid
10054 XXX NOT IMPLEMENTED XXX
10055 !! end
10056
10057 !! test
10058 Manually-specified thumbnail image with explicit link to wiki page
10059 !! wikitext
10060 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
10061 !! html/php
10062 <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>
10063
10064 !! html/parsoid
10065 XXX NOT IMPLEMENTED XXX
10066 !! end
10067
10068 !! test
10069 Manually-specified thumbnail image with explicit link to url
10070 !! wikitext
10071 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10072 !! html/php
10073 <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>
10074
10075 !! html/parsoid
10076 XXX NOT IMPLEMENTED XXX
10077 !! end
10078
10079 !! test
10080 Manually-specified thumbnail image with explicit no link
10081 !! wikitext
10082 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10083 !! html/php
10084 <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>
10085
10086 !! html/parsoid
10087 XXX NOT IMPLEMENTED XXX
10088 !! end
10089
10090 !! test
10091 Manually-specified thumbnail image with explicit link and alt text
10092 !! wikitext
10093 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
10094 !! html/php
10095 <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>
10096
10097 !! html/parsoid
10098 XXX NOT IMPLEMENTED XXX
10099 !! end
10100
10101 !! test
10102 Image with frame and link
10103 !! options
10104 parsoid=wt2html,wt2wt,html2html
10105 !! wikitext
10106 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10107 !! html/php
10108 <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>
10109
10110 !! html/parsoid
10111 <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>
10112 !! end
10113
10114 !! test
10115 Image with frame and link and explicit alt
10116 !! options
10117 parsoid=wt2html,wt2wt,html2html
10118 !! wikitext
10119 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10120 !! html/php
10121 <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>
10122
10123 !! html/parsoid
10124 <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>
10125 !! end
10126
10127 !! test
10128 Image with wiki markup in implicit alt
10129 !! options
10130 parsoid=wt2html,wt2wt,html2html
10131 !! wikitext
10132 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10133
10134 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10135 !! html/php
10136 <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>
10137 </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>
10138 </p>
10139 !! html/parsoid
10140 <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>
10141 <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>
10142 !! end
10143
10144 ###################
10145 # Conflicting image format options.
10146 # First option specified should 'win'.
10147 # All three cases in each test should be identical.
10148
10149 !! test
10150 Image with 'frameless' first.
10151 !! wikitext
10152 [[File:Foobar.jpg|frameless|caption]]
10153
10154 [[File:Foobar.jpg|frameless|frame|caption]]
10155
10156 [[File:Foobar.jpg|frameless|thumb|caption]]
10157 !! html/php
10158 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
10159 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
10160 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
10161 </p>
10162 !! end
10163
10164 !! test
10165 Image with 'frame' first.
10166 !! wikitext
10167 [[File:Foobar.jpg|frame|caption]]
10168 [[File:Foobar.jpg|frame|frameless|caption]]
10169 [[File:Foobar.jpg|frame|thumb|caption]]
10170 !! html/php
10171 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
10172 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
10173 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
10174
10175 !! end
10176
10177 !! test
10178 Image with 'thumb' first.
10179 !! wikitext
10180 [[File:Foobar.jpg|thumb|caption]]
10181 [[File:Foobar.jpg|thumb|frameless|caption]]
10182 [[File:Foobar.jpg|thumb|frame|caption]]
10183 !! html/php
10184 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10185 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10186 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10187
10188 !! end
10189
10190 ###################
10191 # Image sizing.
10192 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10193 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10194 # Foobar has actual size of 1941x220
10195 # 1. Thumbs & frameless always reduce, can't be enlarged
10196 # 2. Framed images ignore width; always render at default size.
10197 # If given a height, they respect height but continue to ignore width.
10198 # 3. "Unspecified format" and border are the only types which can be
10199 # enlarged.
10200
10201 !! test
10202 Image: "unspecified format" and border enlarge
10203 !! options
10204 parsoid=wt2html,wt2wt,html2html
10205 !! wikitext
10206 [[File:Foobar.jpg|2000px]]
10207
10208 [[File:Foobar.jpg|border|2000px]]
10209 !! html/php
10210 <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>
10211 </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>
10212 </p>
10213 !! html/parsoid
10214 <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>
10215 <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>
10216 !! end
10217
10218 !! test
10219 Image: "unspecified format" and border reduce
10220 !! options
10221 parsoid=wt2html,wt2wt,html2html
10222 !! wikitext
10223 [[File:Foobar.jpg|1000px]]
10224
10225 [[File:Foobar.jpg|border|1000px]]
10226 !! html/php
10227 <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>
10228 </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>
10229 </p>
10230 !! html/parsoid
10231 <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>
10232 <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>
10233 !! end
10234
10235 !! test
10236 Image: thumbs reduce
10237 !! options
10238 parsoid=wt2html,wt2wt,html2html
10239 !! wikitext
10240 [[File:Foobar.jpg|thumb|50px]]
10241 !! html/php
10242 <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>
10243
10244 !! html/parsoid
10245 <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>
10246 !! end
10247
10248 !! test
10249 Image: thumbs can't be enlarged past original size
10250 !! options
10251 parsoid=wt2html,wt2wt,html2html
10252 !! wikitext
10253 [[File:Foobar.jpg|thumb|2000px]]
10254 !! html/php
10255 <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>
10256
10257 !! html/parsoid
10258 <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>
10259 !! end
10260
10261 !! test
10262 Image: frameless can reduce in size
10263 !! options
10264 parsoid=wt2html,wt2wt,html2html
10265 !! wikitext
10266 [[File:Foobar.jpg|frameless|50px]]
10267 !! html/php
10268 <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>
10269 </p>
10270 !! html/parsoid
10271 <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>
10272 !! end
10273
10274 !! test
10275 Image: frameless can't be enlarged past original size
10276 !! options
10277 parsoid=wt2html,wt2wt,html2html
10278 !! wikitext
10279 [[File:Foobar.jpg|frameless|2000px]]
10280 !! html/php
10281 <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>
10282 </p>
10283 !! html/parsoid
10284 <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>
10285 !! end
10286
10287 !! test
10288 Image: framed images ignore size if only width is given
10289 !! options
10290 parsoid=wt2html,wt2wt,html2html
10291 !! wikitext
10292 [[File:Foobar.jpg|frame]]
10293
10294 [[File:Foobar.jpg|frame|50px]]
10295
10296 [[File:Foobar.jpg|frame|2000px]]
10297 !! html/php
10298 <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>
10299 <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>
10300 <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>
10301
10302 !! html/parsoid
10303 <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>
10304 !! end
10305
10306 !! test
10307 Image: framed images respect size if given a height, but ignore width.
10308 !! wikitext
10309 [[File:Foobar.jpg|frame|50x50px]]
10310 !! html/php
10311 <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>
10312
10313 !! html/parsoid
10314 <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>
10315 !! end
10316
10317 ###################
10318
10319 !! test
10320 Link to image page- image page normally doesn't exists, hence edit link
10321 Add test with existing image page
10322 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10323 !! wikitext
10324 [[:Image:test]]
10325 !! html
10326 <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>
10327 </p>
10328 !! end
10329
10330 !! test
10331 bug 18784 Link to non-existent image page with caption should use caption as link text
10332 !! wikitext
10333 [[:Image:test|caption]]
10334 !! html
10335 <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>
10336 </p>
10337 !! end
10338
10339 !! test
10340 Frameless image caption with a free URL
10341 !! wikitext
10342 [[File:Foobar.jpg|http://example.com]]
10343 !! html/php
10344 <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>
10345 </p>
10346 !! html/parsoid
10347 <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>
10348 !! end
10349
10350 !! test
10351 Thumbnail image caption with a free URL
10352 !! wikitext
10353 [[File:Foobar.jpg|thumb|http://example.com]]
10354 !! html/php
10355 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10356
10357 !! html/parsoid
10358 <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>
10359 !! end
10360
10361 !! test
10362 Thumbnail image caption with a free URL and explicit alt
10363 !! options
10364 parsoid=wt2html,wt2wt,html2html
10365 !! wikitext
10366 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10367 !! html/php
10368 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10369
10370 !! html/parsoid
10371 <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>
10372 !! end
10373
10374 !! test
10375 SVG thumbnails with no language set
10376 !! options
10377 !! wikitext
10378 [[File:Foobar.svg|thumb|caption]]
10379 !! html
10380 <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>
10381
10382 !! end
10383
10384 !! test
10385 SVG thumbnails with language de
10386 !! options
10387 !! wikitext
10388 [[File:Foobar.svg|thumb|caption|lang=de]]
10389 !! html
10390 <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>
10391
10392 !! end
10393
10394 !! test
10395 SVG thumbnails with invalid language code
10396 !! options
10397 !! wikitext
10398 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10399 !! html
10400 <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>
10401
10402 !! end
10403
10404 !! test
10405 BUG 1887: A ISBN with a thumbnail
10406 !! wikitext
10407 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
10408 !! html
10409 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
10410
10411 !! end
10412
10413 !! test
10414 BUG 1887: A RFC with a thumbnail
10415 !! wikitext
10416 [[Image:foobar.jpg|thumb|This is RFC 12354]]
10417 !! html
10418 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
10419
10420 !! end
10421
10422 !! test
10423 BUG 1887: A mailto link with a thumbnail
10424 !! wikitext
10425 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
10426 !! html
10427 <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>
10428
10429 !! end
10430
10431 # Pending resolution to bug 368
10432 !! test
10433 BUG 648: Frameless image caption with a link
10434 !! wikitext
10435 [[Image:foobar.jpg|text with a [[link]] in it]]
10436 !! html
10437 <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>
10438 </p>
10439 !! end
10440
10441 !! test
10442 BUG 648: Frameless image caption with a link (suffix)
10443 !! wikitext
10444 [[Image:foobar.jpg|text with a [[link]]foo in it]]
10445 !! html
10446 <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>
10447 </p>
10448 !! end
10449
10450 !! test
10451 BUG 648: Frameless image caption with an interwiki link
10452 !! wikitext
10453 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
10454 !! html
10455 <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>
10456 </p>
10457 !! end
10458
10459 !! test
10460 BUG 648: Frameless image caption with a piped interwiki link
10461 !! wikitext
10462 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10463 !! html
10464 <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>
10465 </p>
10466 !! end
10467
10468 !! test
10469 Escape HTML special chars in image alt text
10470 !! wikitext
10471 [[Image:foobar.jpg|& < > "]]
10472 !! html
10473 <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>
10474 </p>
10475 !! end
10476
10477 !! test
10478 BUG 499: Alt text should have &#1234;, not &amp;1234;
10479 !! wikitext
10480 [[Image:foobar.jpg|&#9792;]]
10481 !! html
10482 <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>
10483 </p>
10484 !! end
10485
10486 !! test
10487 Broken image caption with link
10488 !! wikitext
10489 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10490 !! html
10491 <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.
10492 </p>
10493 !! end
10494
10495 !! test
10496 Image caption containing another image
10497 !! wikitext
10498 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
10499 !! html
10500 <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>
10501
10502 !! end
10503
10504 !! test
10505 Image caption containing a newline
10506 !! wikitext
10507 [[Image:Foobar.jpg|This
10508 *is some text]]
10509 !! html
10510 <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>
10511 </p>
10512 !!end
10513
10514 !!test
10515 Parsoid: Image caption containing leading space
10516 (The leading space should not trigger nowiki escaping in wt2wt mode)
10517 !! wikitext
10518 [[Image:Foobar.jpg|thumb| bar]]
10519 !! html
10520 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
10521
10522 !!end
10523
10524 !! test
10525 Images: caption containing a table
10526 !! wikitext
10527 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10528 {|
10529 ! Foo !! Bar
10530 |-
10531 | Foo1 || Bar1
10532 |}
10533 and some more text.]]
10534 !! html/php
10535 <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>
10536
10537 !! html/parsoid
10538 <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
10539 <table>
10540 <tbody>
10541 <tr><th>Foo </th><th>Bar</th></tr>
10542 <tr>
10543 <td>Foo1 </td>
10544 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10545 !! end
10546
10547 !! test
10548 Bug 3090: External links other than http: in image captions
10549 !! wikitext
10550 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10551 !! html/php
10552 <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>
10553
10554 !! html/parsoid
10555 <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>
10556 !! end
10557
10558 !! test
10559 Custom class
10560 !! options
10561 parsoid=wt2html,wt2wt,html2html
10562 !! wikitext
10563 [[Image:foobar.jpg|a|class=b]]
10564 !! html/php
10565 <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>
10566 </p>
10567 !! html/parsoid
10568 <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>
10569 !! end
10570
10571 !! test
10572 Localized image handling (1).
10573 !! options
10574 parsoid=wt2html,wt2wt,html2html
10575 language=es
10576 !! wikitext
10577 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10578 !! html/php
10579 <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>
10580
10581 !! html/parsoid
10582 <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>
10583 !! end
10584
10585 !! test
10586 Localized image handling (2).
10587 !! options
10588 parsoid=wt2html,wt2wt,html2html
10589 language=es
10590 !! wikitext
10591 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10592 !! html/php
10593 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10594
10595 !! html/parsoid
10596 <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>
10597 !! end
10598
10599 !! test
10600 "border", "frameless" and "class" attributes on an image.
10601 !! options
10602 parsoid=wt2html,wt2wt,html2html
10603 !! wikitext
10604 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10605 !! html/php
10606 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
10607 </p>
10608 !! html/parsoid
10609 <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>
10610 !! end
10611
10612 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10613 !! test
10614 Invalid image attributes (bug 62500)
10615 !! options
10616 parsoid=wt2html,wt2wt,html2html
10617 !! wikitext
10618 [[File:Foobar.jpg|thumb|float|left|caption]]
10619
10620 [[File:Foobar.jpg|thumb|righ|caption]]
10621
10622 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10623 !! html/php
10624 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10625 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10626 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10627
10628 !! html/parsoid
10629 <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>
10630 !! end
10631
10632 !! article
10633 File:Barfoo.jpg
10634 !! text
10635 #REDIRECT [[File:Barfoo.jpg]]
10636 !! endarticle
10637
10638 !! test
10639 Redirected image
10640 !! wikitext
10641 [[Image:Barfoo.jpg]]
10642 !! html
10643 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10644 </p>
10645 !! end
10646
10647 !! test
10648 Missing image with uploads disabled
10649 !! options
10650 wgEnableUploads=0
10651 !! wikitext
10652 [[Image:Foobaz.jpg]]
10653 !! html
10654 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10655 </p>
10656 !! end
10657
10658 # Parsoid-specific testing for images
10659 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10660 # Currently imperfect due to a flaw in the Parsoid testrunner
10661 # Work in progress
10662 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10663 # image tests.
10664
10665 !! test
10666 Parsoid-specific image handling - simple image with size and middle alignment
10667 !! wikitext
10668 [[File: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, middle alignment,
10680 non-standard namespace alias
10681 !! options
10682 parsoid=wt2wt,wt2html,html2html
10683 !! wikitext
10684 [[Image:Foobar.jpg|middle|50px]]
10685 !! html/parsoid
10686 <p><span class="mw-valign-middle" typeof="mw:Image">
10687 <a href="File:Foobar.jpg">
10688 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10689 </a>
10690 </span>
10691 </p>
10692 !! end
10693
10694 !! test
10695 Parsoid-specific image handling - simple image with size and middle alignment
10696 (existing content)
10697 !! wikitext
10698 [[File:Foobar.jpg|50px|middle]]
10699 !! html/parsoid
10700 <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>
10701 !! end
10702
10703 !! test
10704 Parsoid-specific image handling - simple image with size and middle alignment
10705 and non-standard namespace name
10706 !! options
10707 parsoid=wt2html,wt2wt,html2html
10708 !! wikitext
10709 [[Image:Foobar.jpg|50px|middle]]
10710 !! html/parsoid
10711 <p><span class="mw-valign-middle" typeof="mw:Image">
10712 <a href="File:Foobar.jpg">
10713 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10714 </a>
10715 </span>
10716 </p>
10717 !! end
10718
10719 !! test
10720 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10721 !! wikitext
10722 [[File:Foobar.jpg|500x10px|baseline|caption]]
10723 !! html/parsoid
10724 <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>
10725 !! end
10726
10727 !! test
10728 Parsoid-specific image handling - simple image with border and size spec
10729 !! wikitext
10730 [[File:Foobar.jpg|50px|border|caption]]
10731 !! html/parsoid
10732 <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>
10733 !! end
10734
10735 !! test
10736 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10737 !! wikitext
10738 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10739 !! html/parsoid
10740 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10741 <a href="File:Foobar.jpg">
10742 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10743 </a>
10744 <figcaption>caption content</figcaption>
10745 </figure>
10746 !! end
10747
10748 !! test
10749 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10750 (existing content)
10751 !! wikitext
10752 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10753 !! html/parsoid
10754 <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>
10755 !! end
10756
10757 !! test
10758 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10759 !! wikitext
10760 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10761 !! html/parsoid
10762 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10763 <a href="File:Foobar.jpg">
10764 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10765 </a>
10766 <figcaption>caption</figcaption>
10767 </figure>
10768 !! end
10769
10770 !! test
10771 Parsoid-specific image handling - thumbnail with specific size, halign,
10772 valign, and caption (existing content)
10773 !! wikitext
10774 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10775 !! html/parsoid
10776 <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>
10777 !! end
10778
10779 !! test
10780 Parsoid-specific image handling - framed image with specific size and caption
10781 !! wikitext
10782 [[Image:Foobar.jpg|frame|500x50px|caption]]
10783 !! html/parsoid
10784 <figure typeof="mw:Image/Frame">
10785 <a href="File:Foobar.jpg">
10786 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10787 </a>
10788 <figcaption>caption</figcaption>
10789 </figure>
10790 !! end
10791
10792 !! test
10793 Parsoid-specific image handling - framed image with specific size and caption
10794 (existing content)
10795 !! wikitext
10796 [[File:Foobar.jpg|442x50px|frame|caption]]
10797 !! html/parsoid
10798 <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>
10799 !! end
10800
10801 !! test
10802 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10803 !! wikitext
10804 [[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10805 !! html/parsoid
10806 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10807 <a href="File:Foobar.jpg">
10808 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10809 </a>
10810 <figcaption>caption</figcaption>
10811 </figure>
10812 !! end
10813
10814 !! test
10815 Parsoid-specific image handling - framed image with specific size, halign,
10816 valign, and caption (existing content)
10817 !! wikitext
10818 [[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
10819 !! html/parsoid
10820 <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>
10821 !! end
10822
10823 !! test
10824 Parsoid-specific image handling - frameless image with specific size, border, and caption
10825 !! wikitext
10826 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
10827 !! html/parsoid
10828 <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>
10829 !! end
10830
10831 !! test
10832 Parsoid-specific image handling - simple image with a formatted caption
10833 !! wikitext
10834 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10835 !! html/parsoid
10836 <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>"}'>
10837 <a href="File:Foobar.jpg">
10838 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10839 </a></span></p>
10840 !! end
10841
10842 !! test
10843 Parsoid-specific image handling - caption with a template in it
10844 !! wikitext
10845 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
10846 !! html/parsoid
10847 <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>
10848 !! end
10849
10850 !! test
10851 Parsoid-specific image handling - caption with unbalanced tags in it
10852 !! options
10853 parsoid=wt2html,wt2wt,html2html
10854 !! wikitext
10855 foo
10856 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
10857 bar
10858 !! html/parsoid
10859 <p>foo</p>
10860 <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>
10861 <p>bar</p>
10862 !! end
10863
10864 !! test
10865 Parsoid-specific image handling - empty caption
10866 !! wikitext
10867 [[File:Foobar.jpg|thumb|]]
10868 !! html/parsoid
10869 <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>
10870 !! end
10871
10872 !! test
10873 Parsoid-specific image handling - whitespace caption
10874 !! wikitext
10875 [[File:Foobar.jpg|thumb| ]]
10876 !! html/parsoid
10877 <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>
10878 !! end
10879
10880 !! test
10881 Parsoid-specific image handling - lang option
10882 !! wikitext
10883 foo
10884 [[File:Foobar.svg|lang=de|caption]]
10885 bar
10886 !! html/parsoid
10887 <p>foo
10888 <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>
10889 bar</p>
10890 !! end
10891
10892
10893 ###
10894 ### Subpages
10895 ###
10896 !! article
10897 Subpage test/subpage
10898 !! text
10899 foo
10900 !! endarticle
10901
10902 !! test
10903 Subpage link
10904 !! options
10905 subpage title=[[Subpage test]]
10906 !! wikitext
10907 [[/subpage]]
10908 !! html
10909 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10910 </p>
10911 !! end
10912
10913 !! test
10914 Subpage noslash link
10915 !! options
10916 subpage title=[[Subpage test]]
10917 !! wikitext
10918 [[/subpage/]]
10919 !! html
10920 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10921 </p>
10922 !! end
10923
10924 # TODO: make this PHP-parser compatible!
10925 !! test
10926 Relative subpage noslash link
10927 !! options
10928 parsoid=wt2wt,wt2html,html2html
10929 subpage title=[[Subpage test/1/2/3/4]]
10930 !! wikitext
10931 [[../../subpage/]]
10932
10933 [[../../subpage]]
10934 !! html
10935 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10936 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10937 !! end
10938
10939 # TODO: make this PHP-parser compatible!
10940 !! test
10941 Parsoid: dot-slash prefixed wikilinks
10942 !! options
10943 parsoid=wt2wt,wt2html,html2html
10944 !! wikitext
10945 [[./foo]]
10946
10947 [[././bar]]
10948
10949 [[././baz/]]
10950 !! html
10951 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10952 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10953 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10954 !! end
10955
10956 !! test
10957 Disabled subpages
10958 !! wikitext
10959 [[/subpage]]
10960 !! html
10961 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10962 </p>
10963 !! end
10964
10965 !! test
10966 BUG 561: {{/Subpage}}
10967 !! options
10968 subpage title=[[Page]]
10969 !! wikitext
10970 {{/Subpage}}
10971 !! html
10972 <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>
10973 </p>
10974 !! end
10975
10976 ###
10977 ### Categories
10978 ###
10979 !! article
10980 Category:MediaWiki User's Guide
10981 !! text
10982 blah
10983 !! endarticle
10984
10985 !! test
10986 Link to category
10987 !! wikitext
10988 [[:Category:MediaWiki User's Guide]]
10989 !! html
10990 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10991 </p>
10992 !! end
10993
10994 !! test
10995 Simple category
10996 !! options
10997 cat
10998 !! wikitext
10999 [[Category:MediaWiki User's Guide]]
11000 !! html
11001 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11002 !! end
11003
11004 !! test
11005 PAGESINCATEGORY invalid title fatal (r33546 fix)
11006 !! wikitext
11007 {{PAGESINCATEGORY:<bogus>}}
11008 !! html
11009 <p>0
11010 </p>
11011 !! end
11012
11013 !! test
11014 Category with different sort key
11015 !! options
11016 cat
11017 !! wikitext
11018 [[Category:MediaWiki User's Guide|Foo]]
11019 !! html
11020 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11021 !! end
11022
11023 !! test
11024 Category with identical sort key
11025 !! options
11026 cat
11027 !! wikitext
11028 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11029 !! html
11030 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11031 !! end
11032
11033 !! test
11034 Category with empty sort key
11035 !! options
11036 cat
11037 pst
11038 !! wikitext
11039 [[Category:MediaWiki User's Guide|]]
11040 !! html
11041 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11042 !! end
11043
11044 !! test
11045 Category with empty sort key and parentheses
11046 !! options
11047 cat
11048 pst
11049 !! wikitext
11050 [[Category:Foo (bar)|]]
11051 !! html
11052 [[Category:Foo (bar)|Foo]]
11053 !! end
11054
11055 !! test
11056 Category with link tail
11057 !! options
11058 cat
11059 pst
11060 !! wikitext
11061 123[[Category:Foo]]456
11062 !! html
11063 123[[Category:Foo]]456
11064 !! end
11065
11066 !! test
11067 Category with template
11068 !! options
11069 cat
11070 pst
11071 !! wikitext
11072 [[Category:{{echo|Foo}}]]
11073 !! html
11074 [[Category:{{echo|Foo}}]]
11075 !! end
11076
11077 !! test
11078 Category with template in sort key
11079 !! options
11080 cat
11081 pst
11082 !! wikitext
11083 [[Category:Foo|{{echo|Bar}}]]
11084 !! html
11085 [[Category:Foo|{{echo|Bar}}]]
11086 !! end
11087
11088 !! test
11089 Category with template in sort key and title
11090 !! options
11091 cat
11092 pst
11093 !! wikitext
11094 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11095 !! html
11096 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11097 !! end
11098
11099 !! test
11100 Category / paragraph interactions
11101 !! wikitext
11102 Foo [[Category:Baz]] Bar
11103
11104 Foo [[Category:Baz]]
11105 Bar
11106
11107 Foo
11108 [[Category:Baz]]
11109 Bar
11110
11111 Foo
11112 [[Category:Baz]] Bar
11113
11114 Foo
11115 [[Category:Baz]]
11116 [[Category:Baz]]
11117 [[Category:Baz]]
11118 Bar
11119
11120 [[Category:Baz]]
11121 [[Category:Baz]]
11122 [[Category:Baz]]
11123
11124 [[Category:Baz]]
11125 {{echo|[[Category:Baz]]}}
11126 [[Category:Baz]]
11127 !! html
11128 <p>Foo Bar
11129 </p><p>Foo
11130 Bar
11131 </p><p>Foo
11132 Bar
11133 </p><p>Foo Bar
11134 </p><p>Foo
11135 Bar
11136 </p>
11137 !! end
11138
11139 !! test
11140 Parsoid: Serialize link to category page with colon escape
11141 !! options
11142 parsoid
11143 !! wikitext
11144
11145 [[:Category:Foo]]
11146 [[:Category:Foo|Bar]]
11147 !! html
11148 <p>
11149 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11150 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11151 </p>
11152 !! end
11153
11154 !! test
11155 Parsoid: Link prefix/suffixes aren't applied to category links
11156 !! options
11157 parsoid=wt2html,wt2wt,html2html
11158 language=is
11159 !! wikitext
11160 x[[Category:Foo]]y
11161 !! html
11162 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11163 !! end
11164
11165 !! test
11166 Parsoid: Serialize link to file page with colon escape
11167 !! options
11168 parsoid
11169 !! wikitext
11170
11171 [[:File:Foo.png]]
11172 [[:File:Foo.png|Bar]]
11173 !! html
11174 <p>
11175 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11176 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11177 </p>
11178 !! end
11179
11180 !! test
11181 Parsoid: Serialize a genuine category link without colon escape
11182 !! options
11183 parsoid
11184 !! wikitext
11185 [[Category:Foo]]
11186 [[Category:Foo|Bar]]
11187 !! html
11188 <link rel="mw:PageProp/Category" href="Category:Foo">
11189 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11190 !! end
11191
11192 !! test
11193 Parsoid: Defaultsort
11194 !! options
11195 parsoid
11196 !! wikitext
11197 {{DEFAULTSORT:Foo}}
11198 !! html
11199 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11200 !! end
11201
11202 ###
11203 ### Inter-language links
11204 ###
11205 !! test
11206 Inter-language links
11207 !! options
11208 ill
11209 !! wikitext
11210 [[es:Alimento]]
11211 [[fr:Nourriture]]
11212 [[zh:&#39135;&#21697;]]
11213 !! html
11214 es:Alimento fr:Nourriture zh:食品
11215 !! end
11216
11217 !! test
11218 Duplicate interlanguage links (bug 24502)
11219 !! options
11220 ill
11221 !! wikitext
11222 [[es:1]]
11223 [[es:2]]
11224 [[fr:1]]
11225 [[fr:2]]
11226 !! html
11227 es:1 fr:1
11228 !! end
11229
11230 ###
11231 ### Sections
11232 ###
11233 !! test
11234 Basic section headings
11235 !! wikitext
11236 == Headline 1 ==
11237 Some text
11238
11239 ==Headline 2==
11240 More
11241 ===Smaller headline===
11242 Blah blah
11243 !! html
11244 <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>
11245 <p>Some text
11246 </p>
11247 <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>
11248 <p>More
11249 </p>
11250 <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>
11251 <p>Blah blah
11252 </p>
11253 !! end
11254
11255 !! test
11256 Section headings with TOC
11257 !! wikitext
11258 == Headline 1 ==
11259 === Subheadline 1 ===
11260 ===== Skipping a level =====
11261 ====== Skipping a level ======
11262
11263 == Headline 2 ==
11264 Some text
11265 ===Another headline===
11266 !! html
11267 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11268 <ul>
11269 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11270 <ul>
11271 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11272 <ul>
11273 <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>
11274 <ul>
11275 <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>
11276 </ul>
11277 </li>
11278 </ul>
11279 </li>
11280 </ul>
11281 </li>
11282 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11283 <ul>
11284 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11285 </ul>
11286 </li>
11287 </ul>
11288 </div>
11289
11290 <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>
11291 <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>
11292 <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>
11293 <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>
11294 <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>
11295 <p>Some text
11296 </p>
11297 <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>
11298
11299 !! end
11300
11301 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11302 !! test
11303 Handling of sections up to level 6 and beyond
11304 !! wikitext
11305 = Level 1 Heading=
11306 == Level 2 Heading==
11307 === Level 3 Heading===
11308 ==== Level 4 Heading====
11309 ===== Level 5 Heading=====
11310 ====== Level 6 Heading======
11311 ======= Level 7 Heading=======
11312 ======== Level 8 Heading========
11313 ========= Level 9 Heading=========
11314 ========== Level 10 Heading==========
11315 !! html
11316 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11317 <ul>
11318 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11319 <ul>
11320 <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>
11321 <ul>
11322 <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>
11323 <ul>
11324 <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>
11325 <ul>
11326 <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>
11327 <ul>
11328 <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>
11329 <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>
11330 <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>
11331 <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>
11332 <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>
11333 </ul>
11334 </li>
11335 </ul>
11336 </li>
11337 </ul>
11338 </li>
11339 </ul>
11340 </li>
11341 </ul>
11342 </li>
11343 </ul>
11344 </div>
11345
11346 <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>
11347 <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>
11348 <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>
11349 <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>
11350 <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>
11351 <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>
11352 <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>
11353 <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>
11354 <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>
11355 <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>
11356
11357 !! end
11358
11359 !! test
11360 TOC regression (bug 9764)
11361 !! wikitext
11362 == title 1 ==
11363 === title 1.1 ===
11364 ==== title 1.1.1 ====
11365 === title 1.2 ===
11366 == title 2 ==
11367 === title 2.1 ===
11368 !! html
11369 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11370 <ul>
11371 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11372 <ul>
11373 <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>
11374 <ul>
11375 <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>
11376 </ul>
11377 </li>
11378 <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>
11379 </ul>
11380 </li>
11381 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11382 <ul>
11383 <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>
11384 </ul>
11385 </li>
11386 </ul>
11387 </div>
11388
11389 <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>
11390 <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>
11391 <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>
11392 <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>
11393 <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>
11394 <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>
11395
11396 !! end
11397
11398 !! test
11399 TOC with wgMaxTocLevel=3 (bug 6204)
11400 !! options
11401 wgMaxTocLevel=3
11402 !! wikitext
11403 == title 1 ==
11404 === title 1.1 ===
11405 ==== title 1.1.1 ====
11406 === title 1.2 ===
11407 == title 2 ==
11408 === title 2.1 ===
11409 !! html
11410 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11411 <ul>
11412 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11413 <ul>
11414 <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>
11415 <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>
11416 </ul>
11417 </li>
11418 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11419 <ul>
11420 <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>
11421 </ul>
11422 </li>
11423 </ul>
11424 </div>
11425
11426 <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>
11427 <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>
11428 <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>
11429 <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>
11430 <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>
11431 <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>
11432
11433 !! end
11434
11435 !! test
11436 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11437 !! options
11438 wgMaxTocLevel=3
11439 !! wikitext
11440 ==Section 1==
11441 ===Section 1.1===
11442 ====Section 1.1.1====
11443 ====Section 1.1.1.1====
11444 ==Section 2==
11445 !! html
11446 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11447 <ul>
11448 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11449 <ul>
11450 <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>
11451 </ul>
11452 </li>
11453 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11454 </ul>
11455 </div>
11456
11457 <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>
11458 <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>
11459 <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>
11460 <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>
11461 <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>
11462
11463 !! end
11464
11465
11466 !! test
11467 Resolving duplicate section names
11468 !! wikitext
11469 == Foo bar ==
11470 == Foo bar ==
11471 !! html
11472 <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>
11473 <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>
11474
11475 !! end
11476
11477 !! test
11478 Resolving duplicate section names with differing case (bug 10721)
11479 !! wikitext
11480 == Foo bar ==
11481 == Foo Bar ==
11482 !! html
11483 <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>
11484 <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>
11485
11486 !! end
11487
11488 !! article
11489 Template:sections
11490 !! text
11491 ===Section 1===
11492 ==Section 2==
11493 !! endarticle
11494
11495 !! test
11496 Template with sections, __NOTOC__
11497 !! wikitext
11498 __NOTOC__
11499 ==Section 0==
11500 {{sections}}
11501 ==Section 4==
11502 !! html
11503 <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>
11504 <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>
11505 <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>
11506 <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>
11507
11508 !! end
11509
11510 !! test
11511 __NOEDITSECTION__ keyword
11512 !! wikitext
11513 __NOEDITSECTION__
11514 ==Section 1==
11515 ==Section 2==
11516 !! html
11517 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11518 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11519
11520 !! end
11521
11522 !! test
11523 Link inside a section heading
11524 !! wikitext
11525 ==Section with a [[Main Page|link]] in it==
11526 !! html
11527 <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>
11528
11529 !! end
11530
11531 !! test
11532 TOC regression (bug 12077)
11533 !! wikitext
11534 __TOC__
11535 == title 1 ==
11536 === title 1.1 ===
11537 == title 2 ==
11538 !! html
11539 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11540 <ul>
11541 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11542 <ul>
11543 <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>
11544 </ul>
11545 </li>
11546 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11547 </ul>
11548 </div>
11549
11550 <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>
11551 <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>
11552 <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>
11553
11554 !! end
11555
11556 !! test
11557 BUG 1219 URL next to image (good)
11558 !! wikitext
11559 http://example.com [[Image:foobar.jpg]]
11560 !! html
11561 <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>
11562 </p>
11563 !!end
11564
11565 !! test
11566 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11567 !! wikitext
11568 ===
11569 The line above must have a trailing space!
11570 === <!--
11571 --> <!-- -->
11572 But just in case it doesn't...
11573 !! html
11574 <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>
11575 <p>The line above must have a trailing space!
11576 </p>
11577 <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>
11578 <p>But just in case it doesn't...
11579 </p>
11580 !! end
11581
11582 !! test
11583 Header with special characters (bug 25462)
11584 !! wikitext
11585 The tooltips shall not show entities to the user (ie. be double escaped)
11586
11587 == text > text ==
11588 section 1
11589
11590 == text < text ==
11591 section 2
11592
11593 == text & text ==
11594 section 3
11595
11596 == text ' text ==
11597 section 4
11598
11599 == text " text ==
11600 section 5
11601 !! html
11602 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11603 </p>
11604 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11605 <ul>
11606 <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>
11607 <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>
11608 <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>
11609 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11610 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11611 </ul>
11612 </div>
11613
11614 <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>
11615 <p>section 1
11616 </p>
11617 <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>
11618 <p>section 2
11619 </p>
11620 <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>
11621 <p>section 3
11622 </p>
11623 <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>
11624 <p>section 4
11625 </p>
11626 <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>
11627 <p>section 5
11628 </p>
11629 !! end
11630
11631 !! test
11632 Headers with excess '=' characters
11633 (Are similar tests necessary beyond the 1st level?)
11634 !! wikitext
11635 =foo==
11636 ==foo=
11637 =''italic'' heading==
11638 ==''italic'' heading=
11639 !! html
11640 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11641 <ul>
11642 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11643 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11644 <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>
11645 <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>
11646 </ul>
11647 </div>
11648
11649 <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>
11650 <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>
11651 <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>
11652 <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>
11653
11654 !! end
11655
11656 !! test
11657 HTML headers vs TOC (bug 23393)
11658 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11659 !! wikitext
11660 <h1>Header 1</h1>
11661 == Header 1.1 ==
11662 == Header 1.2 ==
11663
11664 <h1>Header 2
11665 </h1>
11666 == Header 2.1 ==
11667 == Header 2.2 ==
11668 __NOEDITSECTION__
11669 !! html
11670 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11671 <ul>
11672 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11673 <ul>
11674 <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>
11675 <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>
11676 </ul>
11677 </li>
11678 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11679 <ul>
11680 <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>
11681 <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>
11682 </ul>
11683 </li>
11684 </ul>
11685 </div>
11686
11687 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11688 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11689 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11690 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11691 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11692 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11693
11694 !! end
11695
11696 !! test
11697 BUG 1219 URL next to image (broken)
11698 !! wikitext
11699 http://example.com[[Image:foobar.jpg]]
11700 !! html
11701 <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>
11702 </p>
11703 !!end
11704
11705 !! test
11706 Bug 1186 news: in the middle of text
11707 !! wikitext
11708 http://en.wikinews.org/wiki/Wikinews:Workplace
11709 !! html
11710 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11711 </p>
11712 !!end
11713
11714
11715 !! test
11716 Namespaced link must have a title
11717 !! wikitext
11718 [[Project:]]
11719 !! html
11720 <p>[[Project:]]
11721 </p>
11722 !!end
11723
11724 !! test
11725 Namespaced link must have a title (bad fragment version)
11726 !! wikitext
11727 [[Project:#fragment]]
11728 !! html
11729 <p>[[Project:#fragment]]
11730 </p>
11731 !!end
11732
11733
11734 ###
11735 ### HTML tags and HTML attributes
11736 ###
11737
11738 !! test
11739 div with no attributes
11740 !! wikitext
11741 <div>HTML rocks</div>
11742 !! html
11743 <div>HTML rocks</div>
11744
11745 !! end
11746
11747 !! test
11748 div with double-quoted attribute
11749 !! wikitext
11750 <div id="rock">HTML rocks</div>
11751 !! html
11752 <div id="rock">HTML rocks</div>
11753
11754 !! end
11755
11756 !! test
11757 div with single-quoted attribute
11758 !! wikitext
11759 <div id='rock'>HTML rocks</div>
11760 !! html
11761 <div id="rock">HTML rocks</div>
11762
11763 !! end
11764
11765 !! test
11766 div with unquoted attribute
11767 !! wikitext
11768 <div id=rock>HTML rocks</div>
11769 !! html
11770 <div id="rock">HTML rocks</div>
11771
11772 !! end
11773
11774 !! test
11775 div with illegal double attributes
11776 !! wikitext
11777 <div id="a" id="b">HTML rocks</div>
11778 !! html
11779 <div id="b">HTML rocks</div>
11780
11781 !!end
11782
11783 # FIXME: produce empty string instead of "class" in the PHP parser, following
11784 # the HTML5 spec.
11785 !! test
11786 div with empty attribute value, space before equals
11787 !! options
11788 parsoid
11789 !! wikitext
11790 <div class =>HTML rocks</div>
11791 !! html
11792 <div class="">HTML rocks</div>
11793
11794 !! end
11795
11796 # The PHP parser escapes the opening brace to &#123; for some reason, so
11797 # disabled this test for it.
11798 !! test
11799 div with braces in attribute value
11800 !! options
11801 parsoid
11802 !! wikitext
11803 <div title="{}">Foo</div>
11804 !! html
11805 <div title="{}">Foo</div>
11806 !! end
11807
11808 # This it very inconsistent in the PHP parser: it returns
11809 # class="class" if there is a space between the name and the equal sign (see
11810 # 'div with empty attribute value, space before equals'), but strips the
11811 # attribute completely if the space is missing. We hope that not much content
11812 # depends on this, so are implementing the behavior below in Parsoid for
11813 # consistencies' sake. Disabled for the PHP parser.
11814 # FIXME: fix this behavior in the PHP parser?
11815 !! test
11816 div with empty attribute value, no space before equals
11817 !! options
11818 parsoid
11819 !! wikitext
11820 <div class=>HTML rocks</div>
11821 !! html
11822 <div class="">HTML rocks</div>
11823
11824 !! end
11825
11826 !! test
11827 HTML multiple attributes correction
11828 !! wikitext
11829 <p class="error" class="awesome">Awesome!</p>
11830 !! html
11831 <p class="awesome">Awesome!</p>
11832
11833 !!end
11834
11835 !! test
11836 Table multiple attributes correction
11837 !! wikitext
11838 {|
11839 !+ class="error" class="awesome"| status
11840 |}
11841 !! html
11842 <table>
11843 <tr>
11844 <th class="awesome"> status
11845 </th></tr></table>
11846
11847 !!end
11848
11849 !! test
11850 DIV IN UPPERCASE
11851 !! wikitext
11852 <DIV ID="x">HTML ROCKS</DIV>
11853 !! html
11854 <div id="x">HTML ROCKS</div>
11855
11856 !!end
11857
11858 !! test
11859 Non-ASCII pseudo-tags are rendered as text
11860 !! wikitext
11861 <khyô>
11862 !! html
11863 <p>&lt;khyô&gt;
11864 </p>
11865 !! end
11866
11867 !! test
11868 Pseudo-tag with URL 'name' renders as url link
11869 !! wikitext
11870 <http://example.com/>
11871 !! html
11872 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11873 </p>
11874 !! end
11875
11876 !! test
11877 text with amp in the middle of nowhere
11878 !! wikitext
11879 Remember AT&T?
11880 !! html
11881 <p>Remember AT&amp;T?
11882 </p>
11883 !! end
11884
11885 !! test
11886 text with character entity: eacute
11887 !! wikitext
11888 I always thought &eacute; was a cute letter.
11889 !! html
11890 <p>I always thought &#233; was a cute letter.
11891 </p>
11892 !! end
11893
11894 !! test
11895 text with entity-escaped character entity-like string: eacute
11896 !! wikitext
11897 I always thought &amp;eacute; was a cute letter.
11898 !! html
11899 <p>I always thought &amp;eacute; was a cute letter.
11900 </p>
11901 !! end
11902
11903 !! test
11904 text with undefined character entity: xacute
11905 !! wikitext
11906 I always thought &xacute; was a cute letter.
11907 !! html
11908 <p>I always thought &amp;xacute; was a cute letter.
11909 </p>
11910 !! end
11911
11912 # TODO: generalize to PHP parser?
11913 !! test
11914 HTML5 tags
11915 !! options
11916 parsoid
11917 !! wikitext
11918 <data value="5">five</data>
11919 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11920 <mark>This highlighted text</mark>
11921 !! html
11922 <p><data value="5">five</data>
11923 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11924 <mark>This highlighted text</mark></p>
11925 !! end
11926
11927 !! test
11928 HTML tag with leading space is parsed as text
11929 !! wikitext
11930 < div>foo< /div>
11931 !! html
11932 <p>&lt; div&gt;foo&lt; /div&gt;
11933 </p>
11934 !! end
11935
11936 ###
11937 ### Nesting tests (see bug 41545, 50604, 51081)
11938 ###
11939
11940 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11941 # Note that html2wt is considerably more difficult if we use <b> in
11942 # the test case, instead of <big>
11943 !! test
11944 Ensure that HTML adoption agency algorithm is properly implemented.
11945 !! wikitext
11946 <big>X<big>Y</big>Z</big>
11947 !! html
11948 <p><big>X<big>Y</big>Z</big>
11949 </p>
11950 !! end
11951
11952 # This was bug 41545 in the PHP parser.
11953 !! test
11954 Nesting of <kbd>
11955 !! wikitext
11956 <kbd>X<kbd>Y</kbd>Z</kbd>
11957 !! html
11958 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11959 </p>
11960 !! end
11961
11962 # The following cases were bug 51081 in the PHP parser.
11963 # Note that there are some other nestable tags (b, i, etc) which are
11964 # not covered; see bug 51081 for discussion.
11965 !! test
11966 Nesting of <em>
11967 !! wikitext
11968 <em>X<em>Y</em>Z</em>
11969 !! html
11970 <p><em>X<em>Y</em>Z</em>
11971 </p>
11972 !! end
11973
11974 !! test
11975 Nesting of <strong>
11976 !! wikitext
11977 <strong>X<strong>Y</strong>Z</strong>
11978 !! html
11979 <p><strong>X<strong>Y</strong>Z</strong>
11980 </p>
11981 !! end
11982
11983 !! test
11984 Nesting of <q>
11985 !! wikitext
11986 <q>X<q>Y</q>Z</q>
11987 !! html
11988 <p><q>X<q>Y</q>Z</q>
11989 </p>
11990 !! end
11991
11992 !! test
11993 Nesting of <ruby>
11994 !! wikitext
11995 <ruby>X<ruby>Y</ruby>Z</ruby>
11996 !! html
11997 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11998 </p>
11999 !! end
12000
12001 !! test
12002 Nesting of <bdo>
12003 !! wikitext
12004 <bdo>X<bdo>Y</bdo>Z</bdo>
12005 !! html
12006 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12007 </p>
12008 !! end
12009
12010
12011 ###
12012 ### Media links
12013 ###
12014
12015 !! test
12016 Media link
12017 !! wikitext
12018 [[Media:Foobar.jpg]]
12019 !! html
12020 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12021 </p>
12022 !! end
12023
12024 !! test
12025 Media link with text
12026 !! wikitext
12027 [[Media:Foobar.jpg|A neat file to look at]]
12028 !! html
12029 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12030 </p>
12031 !! end
12032
12033 # FIXME: this is still bad HTML tag nesting
12034 !! test
12035 Media link with nasty text
12036 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12037 !! wikitext
12038 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12039 !! html
12040 <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>
12041
12042 !! end
12043
12044 !! test
12045 Media link to nonexistent file (bug 1702)
12046 !! wikitext
12047 [[Media:No such.jpg]]
12048 !! html
12049 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12050 </p>
12051 !! end
12052
12053 !! test
12054 Image link to nonexistent file (bug 1850 - good)
12055 !! wikitext
12056 [[Image:No such.jpg]]
12057 !! html
12058 <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>
12059 </p>
12060 !! end
12061
12062 !! test
12063 :Image link to nonexistent file (bug 1850 - bad)
12064 !! wikitext
12065 [[:Image:No such.jpg]]
12066 !! html
12067 <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>
12068 </p>
12069 !! end
12070
12071
12072
12073 !! test
12074 Character reference normalization in link text (bug 1938)
12075 !! wikitext
12076 [[Main Page|this&that]]
12077 !! html
12078 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12079 </p>
12080 !!end
12081
12082 !! article
12083 אַ
12084 !! text
12085 Test for unicode normalization
12086
12087 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12088 !! endarticle
12089
12090 !! test
12091 (bug 19451) Links should refer to the normalized form.
12092 !! wikitext
12093 [[&#xFB2E;]]
12094 [[&#x5d0;&#x5b7;]]
12095 [[&#x5d0;ַ]]
12096 [[א&#x5b7;]]
12097 [[אַ]]
12098 !! html
12099 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12100 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12101 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12102 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12103 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12104 </p>
12105 !! end
12106
12107 !! test
12108 Empty attribute crash test (bug 2067)
12109 !! wikitext
12110 <font color="">foo</font>
12111 !! html
12112 <p><font color="">foo</font>
12113 </p>
12114 !! end
12115
12116 !! test
12117 Empty attribute crash test single-quotes (bug 2067)
12118 !! wikitext
12119 <font color=''>foo</font>
12120 !! html
12121 <p><font color="">foo</font>
12122 </p>
12123 !! end
12124
12125 !! test
12126 Attribute test: equals, then nothing
12127 !! wikitext
12128 <font color=>foo</font>
12129 !! html
12130 <p><font>foo</font>
12131 </p>
12132 !! end
12133
12134 !! test
12135 Attribute test: unquoted value
12136 !! wikitext
12137 <font color=x>foo</font>
12138 !! html
12139 <p><font color="x">foo</font>
12140 </p>
12141 !! end
12142
12143 !! test
12144 Attribute test: unquoted but illegal value (hash)
12145 !! wikitext
12146 <font color=#x>foo</font>
12147 !! html
12148 <p><font color="#x">foo</font>
12149 </p>
12150 !! end
12151
12152 !! test
12153 Attribute test: no value
12154 !! wikitext
12155 <font color>foo</font>
12156 !! html
12157 <p><font color="color">foo</font>
12158 </p>
12159 !! end
12160
12161 !! test
12162 Bug 2095: link with three closing brackets
12163 !! wikitext
12164 [[Main Page]]]
12165 !! html
12166 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12167 </p>
12168 !! end
12169
12170 !! test
12171 Bug 2095: link with pipe and three closing brackets
12172 !! wikitext
12173 [[Main Page|link]]]
12174 !! html
12175 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12176 </p>
12177 !! end
12178
12179 !! test
12180 Bug 2095: link with pipe and three closing brackets, version 2
12181 !! wikitext
12182 [[Main Page|[http://example.com/]]]
12183 !! html
12184 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12185 </p>
12186 !! end
12187
12188
12189 ###
12190 ### Safety
12191 ###
12192
12193 !! article
12194 Template:Dangerous attribute
12195 !! text
12196 " onmouseover="alert(document.cookie)
12197 !! endarticle
12198
12199 !! article
12200 Template:Dangerous style attribute
12201 !! text
12202 border-size: expression(alert(document.cookie))
12203 !! endarticle
12204
12205 !! article
12206 Template:Div style
12207 !! text
12208 <div style="float: right; {{{1}}}">Magic div</div>
12209 !! endarticle
12210
12211 !! test
12212 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12213 !! wikitext
12214 <div title="{{test}}"></div>
12215 !! html
12216 <div title="This is a test template"></div>
12217
12218 !! end
12219
12220 !! test
12221 Bug 2304: HTML attribute safety (dangerous template; 2309)
12222 !! wikitext
12223 <div title="{{dangerous attribute}}"></div>
12224 !! html
12225 <div title=""></div>
12226
12227 !! end
12228
12229 !! test
12230 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12231 !! wikitext
12232 <div style="{{dangerous style attribute}}"></div>
12233 !! html
12234 <div style="/* insecure input */"></div>
12235
12236 !! end
12237
12238 !! test
12239 Bug 2304: HTML attribute safety (safe parameter; 2309)
12240 !! wikitext
12241 {{div style|width: 200px}}
12242 !! html
12243 <div style="float: right; width: 200px">Magic div</div>
12244
12245 !! end
12246
12247 !! test
12248 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12249 !! wikitext
12250 {{div style|width: expression(alert(document.cookie))}}
12251 !! html
12252 <div style="/* insecure input */">Magic div</div>
12253
12254 !! end
12255
12256 !! test
12257 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12258 !! wikitext
12259 {{div style|"><script>alert(document.cookie)</script>}}
12260 !! html
12261 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12262
12263 !! end
12264
12265 !! test
12266 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12267 !! wikitext
12268 {{div style|" ><script>alert(document.cookie)</script>}}
12269 !! html
12270 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12271
12272 !! end
12273
12274 !! test
12275 Bug 2304: HTML attribute safety (link)
12276 !! wikitext
12277 <div title="[[Main Page]]"></div>
12278 !! html
12279 <div title="&#91;&#91;Main Page]]"></div>
12280
12281 !! end
12282
12283 !! test
12284 Bug 2304: HTML attribute safety (italics)
12285 !! wikitext
12286 <div title="''foobar''"></div>
12287 !! html
12288 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12289
12290 !! end
12291
12292 !! test
12293 Bug 2304: HTML attribute safety (bold)
12294 !! wikitext
12295 <div title="'''foobar'''"></div>
12296 !! html
12297 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12298
12299 !! end
12300
12301
12302 !! test
12303 Bug 2304: HTML attribute safety (ISBN)
12304 !! wikitext
12305 <div title="ISBN 1234567890"></div>
12306 !! html
12307 <div title="&#73;SBN 1234567890"></div>
12308
12309 !! end
12310
12311 !! test
12312 Bug 2304: HTML attribute safety (RFC)
12313 !! wikitext
12314 <div title="RFC 1234"></div>
12315 !! html
12316 <div title="&#82;FC 1234"></div>
12317
12318 !! end
12319
12320 !! test
12321 Bug 2304: HTML attribute safety (PMID)
12322 !! wikitext
12323 <div title="PMID 1234567890"></div>
12324 !! html
12325 <div title="&#80;MID 1234567890"></div>
12326
12327 !! end
12328
12329 !! test
12330 Bug 2304: HTML attribute safety (web link)
12331 !! wikitext
12332 <div title="http://example.com/"></div>
12333 !! html
12334 <div title="http&#58;//example.com/"></div>
12335
12336 !! end
12337
12338 !! test
12339 Bug 2304: HTML attribute safety (named web link)
12340 !! wikitext
12341 <div title="[http://example.com/ link]"></div>
12342 !! html
12343 <div title="&#91;http&#58;//example.com/ link]"></div>
12344
12345 !! end
12346
12347 !! test
12348 Bug 3244: HTML attribute safety (extension; safe)
12349 !! wikitext
12350 <div style="<nowiki>background:blue</nowiki>"></div>
12351 !! html
12352 <div style="background:blue"></div>
12353
12354 !! end
12355
12356 !! test
12357 Bug 3244: HTML attribute safety (extension; unsafe)
12358 !! wikitext
12359 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12360 !! html
12361 <div style="/* insecure input */"></div>
12362
12363 !! end
12364
12365 # More MSIE fun discovered by Tom Gilder
12366
12367 !! test
12368 MSIE CSS safety test: spurious slash
12369 !! wikitext
12370 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12371 !! html
12372 <div style="/* insecure input */">evil</div>
12373
12374 !! end
12375
12376 !! test
12377 MSIE CSS safety test: hex code
12378 !! wikitext
12379 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12380 !! html
12381 <div style="/* insecure input */">evil</div>
12382
12383 !! end
12384
12385 !! test
12386 MSIE CSS safety test: comment in url
12387 !! wikitext
12388 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12389 !! html
12390 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12391
12392 !! end
12393
12394 !! test
12395 MSIE CSS safety test: comment in expression
12396 !! wikitext
12397 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12398 !! html
12399 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12400
12401 !! end
12402
12403 !! test
12404 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12405 !! wikitext
12406 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12407 !! html
12408 <p style="/* invalid control char */">A</p>
12409
12410 !! end
12411
12412 !! test
12413 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12414 !! wikitext
12415 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12416 <div style="top:EXPRESSION(alert())">B</div>
12417 !! html
12418 <p style="/* insecure input */">A</p>
12419 <div style="/* insecure input */">B</div>
12420
12421 !! end
12422
12423 !! test
12424 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12425 !! wikitext
12426 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12427 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12428 !! html
12429 <div style="/* insecure input */">A</div>
12430 <p style="/* insecure input */">B</p>
12431
12432 !! end
12433
12434 !! test
12435 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12436 !! wikitext
12437 <div style="background-image:url⁽javascript:alert())">A</div>
12438 <div style="background-image:url₍javascript:alert())">B</div>
12439 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12440 !! html
12441 <div style="/* insecure input */">A</div>
12442 <div style="/* insecure input */">B</div>
12443 <p style="/* insecure input */">C</p>
12444
12445 !! end
12446
12447 !! test
12448 Opera -o-link CSS
12449 !! wikitext
12450 <div
12451 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;"
12452 style="-o-link:attr(title);-o-link-source:current">X</div>
12453 !! html
12454 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12455
12456 !! end
12457
12458 !! test
12459 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12460 !! wikitext
12461 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12462 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12463 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12464 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12465 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12466 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12467 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12468 !! html
12469 <p style="/* insecure input */">A</p>
12470 <p style="/* insecure input */">B</p>
12471 <p style="/* insecure input */">C</p>
12472 <p style="/* insecure input */">D</p>
12473 <p style="/* insecure input */">E</p>
12474 <p style="/* insecure input */">F</p>
12475 <p style="/* insecure input */">G</p>
12476
12477 !! end
12478
12479 !! test
12480 Table attribute legitimate extension
12481 !! wikitext
12482 {|
12483 !+ style="<nowiki>color:blue</nowiki>"| status
12484 |}
12485 !! html
12486 <table>
12487 <tr>
12488 <th style="color:blue"> status
12489 </th></tr></table>
12490
12491 !!end
12492
12493 !! test
12494 Table attribute safety
12495 !! wikitext
12496 {|
12497 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12498 |}
12499 !! html
12500 <table>
12501 <tr>
12502 <th style="/* insecure input */"> status
12503 </th></tr></table>
12504
12505 !! end
12506
12507 !! test
12508 CSS line continuation 1
12509 !! wikitext
12510 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12511 !! html
12512 <div style="/* insecure input */"></div>
12513
12514 !! end
12515
12516 !! test
12517 CSS line continuation 2
12518 !! wikitext
12519 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12520 !! html
12521 <div style="/* insecure input */"></div>
12522
12523 !! end
12524
12525 !! article
12526 Template:Identity
12527 !! text
12528 {{{1}}}
12529 !! endarticle
12530
12531 !! test
12532 Expansion of multi-line templates in attribute values (bug 6255)
12533 !! wikitext
12534 <div style="background: {{identity|#00FF00}}">-</div>
12535 !! html
12536 <div style="background: #00FF00">-</div>
12537
12538 !! end
12539
12540
12541 !! test
12542 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12543 !! wikitext
12544 <div style="background:
12545 #00FF00">-</div>
12546 !! html
12547 <div style="background: #00FF00">-</div>
12548
12549 !! end
12550
12551 !! test
12552 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12553 !! wikitext
12554 <div style="background: &#10;#00FF00">-</div>
12555 !! html
12556 <div style="background: &#10;#00FF00">-</div>
12557
12558 !! end
12559
12560 ###
12561 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12562 ###
12563 !! test
12564 Parser hook: empty input
12565 !! wikitext
12566 <tag></tag>
12567 !! html
12568 <pre>
12569 ''
12570 array (
12571 )
12572 </pre>
12573
12574 !! end
12575
12576 !! test
12577 Parser hook: empty input using terminated empty elements
12578 !! wikitext
12579 <tag/>
12580 !! html
12581 <pre>
12582 NULL
12583 array (
12584 )
12585 </pre>
12586
12587 !! end
12588
12589 !! test
12590 Parser hook: empty input using terminated empty elements (space before)
12591 !! wikitext
12592 <tag />
12593 !! html
12594 <pre>
12595 NULL
12596 array (
12597 )
12598 </pre>
12599
12600 !! end
12601
12602 !! test
12603 Parser hook: basic input
12604 !! wikitext
12605 <tag>input</tag>
12606 !! html
12607 <pre>
12608 'input'
12609 array (
12610 )
12611 </pre>
12612
12613 !! end
12614
12615
12616 !! test
12617 Parser hook: case insensitive
12618 !! wikitext
12619 <TAG>input</TAG>
12620 !! html
12621 <pre>
12622 'input'
12623 array (
12624 )
12625 </pre>
12626
12627 !! end
12628
12629
12630 !! test
12631 Parser hook: case insensitive, redux
12632 !! wikitext
12633 <TaG>input</TAg>
12634 !! html
12635 <pre>
12636 'input'
12637 array (
12638 )
12639 </pre>
12640
12641 !! end
12642
12643 !! test
12644 Parser hook: nested tags
12645 !! options
12646 noxml
12647 !! wikitext
12648 <tag><tag></tag></tag>
12649 !! html
12650 <pre>
12651 '<tag>'
12652 array (
12653 )
12654 </pre>&lt;/tag&gt;
12655
12656 !! end
12657
12658 !! test
12659 Parser hook: basic arguments
12660 !! wikitext
12661 <tag width=200 height = "100" depth = '50' square></tag>
12662 !! html
12663 <pre>
12664 ''
12665 array (
12666 'width' => '200',
12667 'height' => '100',
12668 'depth' => '50',
12669 'square' => 'square',
12670 )
12671 </pre>
12672
12673 !! end
12674
12675 !! test
12676 Parser hook: argument containing a forward slash (bug 5344)
12677 !! wikitext
12678 <tag filename='/tmp/bla'></tag>
12679 !! html
12680 <pre>
12681 ''
12682 array (
12683 'filename' => '/tmp/bla',
12684 )
12685 </pre>
12686
12687 !! end
12688
12689 !! test
12690 Parser hook: empty input using terminated empty elements (bug 2374)
12691 !! wikitext
12692 <tag foo=bar/>text
12693 !! html
12694 <pre>
12695 NULL
12696 array (
12697 'foo' => 'bar',
12698 )
12699 </pre>text
12700
12701 !! end
12702
12703 # </tag> should be output literally since there is no matching tag that begins it
12704 !! test
12705 Parser hook: basic arguments using terminated empty elements (bug 2374)
12706 !! wikitext
12707 <tag width=200 height = "100" depth = '50' square/>
12708 other stuff
12709 </tag>
12710 !! html
12711 <pre>
12712 NULL
12713 array (
12714 'width' => '200',
12715 'height' => '100',
12716 'depth' => '50',
12717 'square' => 'square',
12718 )
12719 </pre>
12720 <p>other stuff
12721 &lt;/tag&gt;
12722 </p>
12723 !! end
12724
12725 ###
12726 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12727 ###
12728
12729 !! test
12730 Parser hook: static parser hook not inside a comment
12731 !! wikitext
12732 <statictag>hello, world</statictag>
12733 <statictag action=flush/>
12734 !! html
12735 <p>hello, world
12736 </p>
12737 !! end
12738
12739
12740 !! test
12741 Parser hook: static parser hook inside a comment
12742 !! wikitext
12743 <!-- <statictag>hello, world</statictag> -->
12744 <statictag action=flush/>
12745 !! html
12746 <p><br />
12747 </p>
12748 !! end
12749
12750 # Nested template calls; this case was broken by Parser.php rev 1.506,
12751 # since reverted.
12752
12753 !! article
12754 Template:One-parameter
12755 !! text
12756 (My parameter is: {{{1}}})
12757 !! endarticle
12758
12759 !! article
12760 Template:Map-one-parameter
12761 !! text
12762 {{{{{1}}}|{{{2}}}}}
12763 !! endarticle
12764
12765 !! test
12766 Nested template calls
12767 !! wikitext
12768 {{Map-one-parameter|One-parameter|param}}
12769 !! html
12770 <p>(My parameter is: param)
12771 </p>
12772 !! end
12773
12774
12775 ###
12776 ### Sanitizer
12777 ###
12778 !! test
12779 Sanitizer: Closing of open tags
12780 !! wikitext
12781 <s></s><table></table>
12782 !! html
12783 <s></s><table></table>
12784
12785 !! end
12786
12787 !! test
12788 Sanitizer: Closing of open but not closed tags
12789 !! wikitext
12790 <s>foo
12791 !! html
12792 <p><s>foo</s>
12793 </p>
12794 !! end
12795
12796 !! test
12797 Sanitizer: Closing of closed but not open tags
12798 !! wikitext
12799 </s>
12800 !! html
12801 <p>&lt;/s&gt;
12802 </p>
12803 !! end
12804
12805 !! test
12806 Sanitizer: Closing of closed but not open table tags
12807 !! wikitext
12808 Table not started</td></tr></table>
12809 !! html
12810 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12811 </p>
12812 !! end
12813
12814 !! test
12815 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12816 !! wikitext
12817 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12818 !! html
12819 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12820 </p>
12821 !! end
12822
12823 !! test
12824 Sanitizer: Validating the contents of the id attribute (bug 4515)
12825 !! options
12826 disabled
12827 !! wikitext
12828 <br id=9 />
12829 !! html
12830 Something, but definitely not <br id="9" />...
12831 !! end
12832
12833 !! test
12834 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12835 !! options
12836 disabled
12837 !! wikitext
12838 <br id="foo" /><br id="foo" />
12839 !! html
12840 Something need to be done. foo-2 ?
12841 !! end
12842
12843 !! test
12844 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12845 !! wikitext
12846 <div itemscope>
12847 <meta itemprop="hello" content="world">
12848 <meta http-equiv="refresh" content="5">
12849 <meta itemprop="hello" http-equiv="refresh" content="5">
12850 <link itemprop="hello" href="{{SERVER}}">
12851 <link rel="stylesheet" href="{{SERVER}}">
12852 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12853 </div>
12854 !! html
12855 <div itemscope="itemscope">
12856 <p> <meta itemprop="hello" content="world" />
12857 &lt;meta http-equiv="refresh" content="5"&gt;
12858 <meta itemprop="hello" content="5" />
12859 </p>
12860 <link itemprop="hello" href="http&#58;//example.org" />
12861 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12862 <link itemprop="hello" href="http&#58;//example.org" />
12863 </div>
12864
12865 !! end
12866
12867 !! test
12868 Language converter: output gets cut off unexpectedly (bug 5757)
12869 !! options
12870 language=zh
12871 !! wikitext
12872 this bit is safe: }-
12873
12874 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12875
12876 then we get cut off here: }-
12877
12878 all additional text is vanished
12879 !! html
12880 <p>this bit is safe: }-
12881 </p><p>but if we add a conversion instance: xxx
12882 </p><p>then we get cut off here: }-
12883 </p><p>all additional text is vanished
12884 </p>
12885 !! end
12886
12887 !! test
12888 Self closed html pairs (bug 5487)
12889 !! options
12890 !! wikitext
12891 <center><font id="bug" />Centered text</center>
12892 <div><font id="bug2" />In div text</div>
12893 !! html
12894 <center>&lt;font id="bug" /&gt;Centered text</center>
12895 <div>&lt;font id="bug2" /&gt;In div text</div>
12896
12897 !! end
12898
12899 #
12900 #
12901 #
12902
12903 !! test
12904 Punctuation: nbsp before exclamation
12905 !! wikitext
12906 C'est grave !
12907 !! html
12908 <p>C'est grave&#160;!
12909 </p>
12910 !! end
12911
12912 !! test
12913 Punctuation: CSS !important (bug 11874)
12914 !! wikitext
12915 <div style="width:50% !important">important</div>
12916 !! html
12917 <div style="width:50% !important">important</div>
12918
12919 !!end
12920
12921 !! test
12922 Punctuation: CSS ! important (bug 11874; with space after)
12923 !! wikitext
12924 <div style="width:50% ! important">important</div>
12925 !! html
12926 <div style="width:50% ! important">important</div>
12927
12928 !!end
12929
12930
12931 !! test
12932 HTML bullet list, closed tags (bug 5497)
12933 !! wikitext
12934 <ul>
12935 <li>One</li>
12936 <li>Two</li>
12937 </ul>
12938 !! html
12939 <ul>
12940 <li>One</li>
12941 <li>Two</li>
12942 </ul>
12943
12944 !! end
12945
12946 !! test
12947 HTML bullet list, unclosed tags (bug 5497)
12948 !! options
12949 disabled
12950 !! wikitext
12951 <ul>
12952 <li>One
12953 <li>Two
12954 </ul>
12955 !! html
12956 <ul>
12957 <li>One
12958 </li>
12959 <li>Two
12960 </li>
12961 </ul>
12962
12963 !! end
12964
12965 !! test
12966 HTML ordered list, closed tags (bug 5497)
12967 !! wikitext
12968 <ol>
12969 <li>One</li>
12970 <li>Two</li>
12971 </ol>
12972 !! html
12973 <ol>
12974 <li>One</li>
12975 <li>Two</li>
12976 </ol>
12977
12978 !! end
12979
12980 !! test
12981 HTML ordered list, unclosed tags (bug 5497)
12982 !! options
12983 disabled
12984 !! wikitext
12985 <ol>
12986 <li>One
12987 <li>Two
12988 </ol>
12989 !! html
12990 <ol>
12991 <li>One
12992 </li>
12993 <li>Two
12994 </li>
12995 </ol>
12996
12997 !! end
12998
12999 !! test
13000 HTML nested bullet list, closed tags (bug 5497)
13001 !! wikitext
13002 <ul>
13003 <li>One</li>
13004 <li>Two:
13005 <ul>
13006 <li>Sub-one</li>
13007 <li>Sub-two</li>
13008 </ul>
13009 </li>
13010 </ul>
13011 !! html
13012 <ul>
13013 <li>One</li>
13014 <li>Two:
13015 <ul>
13016 <li>Sub-one</li>
13017 <li>Sub-two</li>
13018 </ul>
13019 </li>
13020 </ul>
13021
13022 !! end
13023
13024 !! test
13025 HTML nested bullet list, open tags (bug 5497)
13026 !! options
13027 disabled
13028 !! wikitext
13029 <ul>
13030 <li>One
13031 <li>Two:
13032 <ul>
13033 <li>Sub-one
13034 <li>Sub-two
13035 </ul>
13036 </ul>
13037 !! html
13038 <ul>
13039 <li>One
13040 </li>
13041 <li>Two:
13042 <ul>
13043 <li>Sub-one
13044 </li>
13045 <li>Sub-two
13046 </li>
13047 </ul>
13048 </li>
13049 </ul>
13050
13051 !! end
13052
13053 !! test
13054 HTML nested ordered list, closed tags (bug 5497)
13055 !! wikitext
13056 <ol>
13057 <li>One</li>
13058 <li>Two:
13059 <ol>
13060 <li>Sub-one</li>
13061 <li>Sub-two</li>
13062 </ol>
13063 </li>
13064 </ol>
13065 !! html
13066 <ol>
13067 <li>One</li>
13068 <li>Two:
13069 <ol>
13070 <li>Sub-one</li>
13071 <li>Sub-two</li>
13072 </ol>
13073 </li>
13074 </ol>
13075
13076 !! end
13077
13078 !! test
13079 HTML nested ordered list, open tags (bug 5497)
13080 !! options
13081 disabled
13082 !! wikitext
13083 <ol>
13084 <li>One
13085 <li>Two:
13086 <ol>
13087 <li>Sub-one
13088 <li>Sub-two
13089 </ol>
13090 </ol>
13091 !! html
13092 <ol>
13093 <li>One
13094 </li>
13095 <li>Two:
13096 <ol>
13097 <li>Sub-one
13098 </li>
13099 <li>Sub-two
13100 </li>
13101 </ol>
13102 </li>
13103 </ol>
13104
13105 !! end
13106
13107 !! test
13108 HTML ordered list item with parameters oddity
13109 !! wikitext
13110 <ol><li id="fragment">One</li>
13111 </ol>
13112 !! html
13113 <ol><li id="fragment">One</li>
13114 </ol>
13115
13116 !! end
13117
13118 !!test
13119 bug 5918: autonumbering
13120 !! wikitext
13121 [http://first/] [http://second] [ftp://ftp]
13122
13123 ftp://inlineftp
13124
13125 [mailto:enclosed@mail.tld With target]
13126
13127 [mailto:enclosed@mail.tld]
13128
13129 mailto:inline@mail.tld
13130 !! html
13131 <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>
13132 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13133 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13134 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13135 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13136 </p>
13137 !! end
13138
13139
13140 #
13141 # Security and HTML correctness
13142 # From Nick Jenkins' fuzz testing
13143 #
13144
13145 !! test
13146 Fuzz testing: Parser13
13147 !! wikitext
13148 {|
13149 | http://a|
13150 !! html
13151 <table>
13152 <tr>
13153 <td>
13154 </td>
13155 </tr>
13156 </table>
13157
13158 !! end
13159
13160 !! test
13161 Fuzz testing: Parser14
13162 !! wikitext
13163 == onmouseover= ==
13164 http://__TOC__
13165 !! html
13166 <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>
13167 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13168 <ul>
13169 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13170 </ul>
13171 </div>
13172
13173
13174 !! end
13175
13176 !! test
13177 Fuzz testing: Parser14-table
13178 !! wikitext
13179 ==a==
13180 {| STYLE=__TOC__
13181 !! html
13182 <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>
13183 <table style="&#95;_TOC&#95;_">
13184 <tr><td></td></tr>
13185 </table>
13186
13187 !! end
13188
13189 # Known to produce bogus xml (extra </td>)
13190 !! test
13191 Fuzz testing: Parser16
13192 !! options
13193 noxml
13194 !! wikitext
13195 {|
13196 !https://||||||
13197 !! html
13198 <table>
13199 <tr>
13200 <th>https://</th>
13201 <th></th>
13202 <th></th>
13203 <th>
13204 </td>
13205 </tr>
13206 </table>
13207
13208 !! end
13209
13210 !! test
13211 Fuzz testing: Parser21
13212 !! wikitext
13213 {|
13214 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13215 |
13216 !! html
13217 <table>
13218 <tr>
13219 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13220 </th>
13221 <td>
13222 </td>
13223 </tr>
13224 </table>
13225
13226 !! end
13227
13228 !! test
13229 Fuzz testing: Parser22
13230 !! wikitext
13231 http://===r:::https://b
13232
13233 {|
13234 !! html
13235 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13236 </p>
13237 <table>
13238 <tr><td></td></tr>
13239 </table>
13240
13241 !! end
13242
13243 # Known to produce bad XML for now
13244 !! test
13245 Fuzz testing: Parser24
13246 !! options
13247 noxml
13248 !! wikitext
13249 {|
13250 {{{|
13251 <u CLASS=
13252 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13253 <br style="onmouseover='alert(document.cookie);' " />
13254
13255 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13256 |
13257 !! html
13258 <table>
13259 {{{|
13260 <u class="&#124;">}}}} &gt;
13261 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13262
13263 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13264 <tr>
13265 <td></u>
13266 </td>
13267 </tr>
13268 </table>
13269
13270 !! end
13271
13272 # Note: the current result listed for this is not what the original one was,
13273 # but the original bug was JavaScript injection, which is fixed in any case.
13274 # It's not clear that the original result listed was any more correct than the
13275 # current one. Original result:
13276 # <p>{{{|
13277 # </p>
13278 # <li class="&#124;&#124;">
13279 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13280 !!test
13281 Fuzz testing: Parser25 (bug 6055)
13282 !! wikitext
13283 {{{
13284 |
13285 <LI CLASS=||
13286 >
13287 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13288 !! html
13289 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13290 </p>
13291 !! end
13292
13293 !!test
13294 Fuzz testing: URL adjacent extension (with space, clean)
13295 !! options
13296 !! wikitext
13297 http://example.com <nowiki>junk</nowiki>
13298 !! html
13299 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13300 </p>
13301 !!end
13302
13303 !!test
13304 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13305 !! options
13306 !! wikitext
13307 http://example.com<nowiki>junk</nowiki>
13308 !! html
13309 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13310 </p>
13311 !!end
13312
13313 !!test
13314 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13315 !! options
13316 !! wikitext
13317 http://example.com<pre>junk</pre>
13318 !! html
13319 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13320
13321 !!end
13322
13323 !!test
13324 Fuzz testing: image with bogus manual thumbnail
13325 !! wikitext
13326 [[Image:foobar.jpg|thumbnail= ]]
13327 !! html
13328 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13329
13330 !!end
13331
13332 !! test
13333 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13334 !! wikitext
13335 <pre dir="&#10;"></pre>
13336 !! html
13337 <pre dir="&#10;"></pre>
13338
13339 !! end
13340
13341 !! test
13342 Parsing optional HTML elements (Bug 6171)
13343 !! options
13344 !! wikitext
13345 <table>
13346 <tr>
13347 <td> Some tabular data</td>
13348 <td> More tabular data ...
13349 <td> And yet som tabular data</td>
13350 </tr>
13351 </table>
13352 !! html
13353 <table>
13354 <tr>
13355 <td> Some tabular data</td>
13356 <td> More tabular data ...
13357 </td><td> And yet som tabular data</td>
13358 </tr>
13359 </table>
13360
13361 !! end
13362
13363 !! test
13364 Correct handling of <td>, <tr> (Bug 6171)
13365 !! options
13366 !! wikitext
13367 <table>
13368 <tr>
13369 <td> Some tabular data</td>
13370 <td> More tabular data ...</td>
13371 <td> And yet som tabular data</td>
13372 </tr>
13373 </table>
13374 !! html
13375 <table>
13376 <tr>
13377 <td> Some tabular data</td>
13378 <td> More tabular data ...</td>
13379 <td> And yet som tabular data</td>
13380 </tr>
13381 </table>
13382
13383 !! end
13384
13385
13386 !! test
13387 Parsing crashing regression (fr:JavaScript)
13388 !! wikitext
13389 </body></x>
13390 !! html
13391 <p>&lt;/body&gt;&lt;/x&gt;
13392 </p>
13393 !! end
13394
13395 !! test
13396 Inline wiki vs wiki block nesting
13397 !! wikitext
13398 '''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 !! test
13408 Inline HTML vs wiki block nesting
13409 !! options
13410 disabled
13411 !! wikitext
13412 <b>Bold paragraph
13413
13414 New wiki paragraph
13415 !! html
13416 <p><b>Bold paragraph</b>
13417 </p><p>New wiki paragraph
13418 </p>
13419 !! end
13420
13421 # Original result was this:
13422 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13423 # </p>
13424 # While that might be marginally more intuitive, maybe, the six-apostrophe
13425 # construct is clearly pathological and the result stated here (which is what
13426 # the parser actually does) is about as reasonable as anything.
13427 !!test
13428 Mixing markup for italics and bold
13429 !! options
13430 !! wikitext
13431 '''bold''''''bold''bolditalics'''''
13432 !! html
13433 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13434 </p>
13435 !! end
13436
13437
13438 !! article
13439 Xyzzyx
13440 !! text
13441 Article for special page transclusion test
13442 !! endarticle
13443
13444 !! test
13445 Special page transclusion
13446 !! options
13447 !! wikitext
13448 {{Special:Prefixindex/Xyzzyx}}
13449 !! html
13450 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13451
13452 !! end
13453
13454 !! test
13455 Special page transclusion twice (bug 5021)
13456 !! options
13457 !! wikitext
13458 {{Special:Prefixindex/Xyzzyx}}
13459 {{Special:Prefixindex/Xyzzyx}}
13460 !! html
13461 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13462 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13463
13464 !! end
13465
13466 !! test
13467 Transclusion of default MediaWiki message
13468 !! wikitext
13469 {{MediaWiki:Mainpage}}
13470 !! html
13471 <p>Main Page
13472 </p>
13473 !! end
13474
13475 !! test
13476 Transclusion of nonexistent MediaWiki message
13477 !! wikitext
13478 {{MediaWiki:Mainpagexxx}}
13479 !! html
13480 <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>
13481 </p>
13482 !! end
13483
13484 !! test
13485 Transclusion of MediaWiki message with underscore
13486 !! wikitext
13487 {{MediaWiki:history_short}}
13488 !! html
13489 <p>History
13490 </p>
13491 !! end
13492
13493 !! test
13494 Transclusion of MediaWiki message with space
13495 !! wikitext
13496 {{MediaWiki:history short}}
13497 !! html
13498 <p>History
13499 </p>
13500 !! end
13501
13502 !! test
13503 Invalid header with following text
13504 !! wikitext
13505 = x = y
13506 !! html
13507 <p>= x = y
13508 </p>
13509 !! end
13510
13511
13512 !! test
13513 Section extraction test (section 0)
13514 !! options
13515 section=0
13516 !! wikitext
13517 start
13518 ==a==
13519 ===aa===
13520 ====aaa====
13521 ==b==
13522 ===ba===
13523 ===bb===
13524 ====bba====
13525 ===bc===
13526 ==c==
13527 ===ca===
13528 !! html
13529 start
13530 !! end
13531
13532 !! test
13533 Section extraction test (section 1)
13534 !! options
13535 section=1
13536 !! wikitext
13537 start
13538 ==a==
13539 ===aa===
13540 ====aaa====
13541 ==b==
13542 ===ba===
13543 ===bb===
13544 ====bba====
13545 ===bc===
13546 ==c==
13547 ===ca===
13548 !! html
13549 ==a==
13550 ===aa===
13551 ====aaa====
13552 !! end
13553
13554 !! test
13555 Section extraction test (section 2)
13556 !! options
13557 section=2
13558 !! wikitext
13559 start
13560 ==a==
13561 ===aa===
13562 ====aaa====
13563 ==b==
13564 ===ba===
13565 ===bb===
13566 ====bba====
13567 ===bc===
13568 ==c==
13569 ===ca===
13570 !! html
13571 ===aa===
13572 ====aaa====
13573 !! end
13574
13575 !! test
13576 Section extraction test (section 3)
13577 !! options
13578 section=3
13579 !! wikitext
13580 start
13581 ==a==
13582 ===aa===
13583 ====aaa====
13584 ==b==
13585 ===ba===
13586 ===bb===
13587 ====bba====
13588 ===bc===
13589 ==c==
13590 ===ca===
13591 !! html
13592 ====aaa====
13593 !! end
13594
13595 !! test
13596 Section extraction test (section 4)
13597 !! options
13598 section=4
13599 !! wikitext
13600 start
13601 ==a==
13602 ===aa===
13603 ====aaa====
13604 ==b==
13605 ===ba===
13606 ===bb===
13607 ====bba====
13608 ===bc===
13609 ==c==
13610 ===ca===
13611 !! html
13612 ==b==
13613 ===ba===
13614 ===bb===
13615 ====bba====
13616 ===bc===
13617 !! end
13618
13619 !! test
13620 Section extraction test (section 5)
13621 !! options
13622 section=5
13623 !! wikitext
13624 start
13625 ==a==
13626 ===aa===
13627 ====aaa====
13628 ==b==
13629 ===ba===
13630 ===bb===
13631 ====bba====
13632 ===bc===
13633 ==c==
13634 ===ca===
13635 !! html
13636 ===ba===
13637 !! end
13638
13639 !! test
13640 Section extraction test (section 6)
13641 !! options
13642 section=6
13643 !! wikitext
13644 start
13645 ==a==
13646 ===aa===
13647 ====aaa====
13648 ==b==
13649 ===ba===
13650 ===bb===
13651 ====bba====
13652 ===bc===
13653 ==c==
13654 ===ca===
13655 !! html
13656 ===bb===
13657 ====bba====
13658 !! end
13659
13660 !! test
13661 Section extraction test (section 7)
13662 !! options
13663 section=7
13664 !! wikitext
13665 start
13666 ==a==
13667 ===aa===
13668 ====aaa====
13669 ==b==
13670 ===ba===
13671 ===bb===
13672 ====bba====
13673 ===bc===
13674 ==c==
13675 ===ca===
13676 !! html
13677 ====bba====
13678 !! end
13679
13680 !! test
13681 Section extraction test (section 8)
13682 !! options
13683 section=8
13684 !! wikitext
13685 start
13686 ==a==
13687 ===aa===
13688 ====aaa====
13689 ==b==
13690 ===ba===
13691 ===bb===
13692 ====bba====
13693 ===bc===
13694 ==c==
13695 ===ca===
13696 !! html
13697 ===bc===
13698 !! end
13699
13700 !! test
13701 Section extraction test (section 9)
13702 !! options
13703 section=9
13704 !! wikitext
13705 start
13706 ==a==
13707 ===aa===
13708 ====aaa====
13709 ==b==
13710 ===ba===
13711 ===bb===
13712 ====bba====
13713 ===bc===
13714 ==c==
13715 ===ca===
13716 !! html
13717 ==c==
13718 ===ca===
13719 !! end
13720
13721 !! test
13722 Section extraction test (section 10)
13723 !! options
13724 section=10
13725 !! wikitext
13726 start
13727 ==a==
13728 ===aa===
13729 ====aaa====
13730 ==b==
13731 ===ba===
13732 ===bb===
13733 ====bba====
13734 ===bc===
13735 ==c==
13736 ===ca===
13737 !! html
13738 ===ca===
13739 !! end
13740
13741 !! test
13742 Section extraction test (nonexistent section 11)
13743 !! options
13744 section=11
13745 !! wikitext
13746 start
13747 ==a==
13748 ===aa===
13749 ====aaa====
13750 ==b==
13751 ===ba===
13752 ===bb===
13753 ====bba====
13754 ===bc===
13755 ==c==
13756 ===ca===
13757 !! html
13758 !! end
13759
13760 !! test
13761 Section extraction test with bogus heading (section 1)
13762 !! options
13763 section=1
13764 !! wikitext
13765 ==a==
13766 ==bogus== not a legal section
13767 ==b==
13768 !! html
13769 ==a==
13770 ==bogus== not a legal section
13771 !! end
13772
13773 !! test
13774 Section extraction test with bogus heading (section 2)
13775 !! options
13776 section=2
13777 !! wikitext
13778 ==a==
13779 ==bogus== not a legal section
13780 ==b==
13781 !! html
13782 ==b==
13783 !! end
13784
13785 !! test
13786 Section extraction test with comment after heading (section 1)
13787 !! options
13788 section=1
13789 !! wikitext
13790 ==a==
13791 ==b== <!-- -->
13792 ==c==
13793 !! html
13794 ==a==
13795 !! end
13796
13797 !! test
13798 Section extraction test with comment after heading (section 2)
13799 !! options
13800 section=2
13801 !! wikitext
13802 ==a==
13803 ==b== <!-- -->
13804 ==c==
13805 !! html
13806 ==b== <!-- -->
13807 !! end
13808
13809 !! test
13810 Section extraction test with bogus <nowiki> heading (section 1)
13811 !! options
13812 section=1
13813 !! wikitext
13814 ==a==
13815 ==bogus== <nowiki>not a legal section</nowiki>
13816 ==b==
13817 !! html
13818 ==a==
13819 ==bogus== <nowiki>not a legal section</nowiki>
13820 !! end
13821
13822 !! test
13823 Section extraction test with bogus <nowiki> heading (section 2)
13824 !! options
13825 section=2
13826 !! wikitext
13827 ==a==
13828 ==bogus== <nowiki>not a legal section</nowiki>
13829 ==b==
13830 !! html
13831 ==b==
13832 !! end
13833
13834
13835 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13836 # instead of respecting commented sections
13837 !! test
13838 Section extraction prefixed by comment (section 1)
13839 !! options
13840 section=1
13841 !! wikitext
13842 <!-- -->==sec1==
13843 ==sec2==
13844 !! html
13845 ==sec2==
13846 !!end
13847
13848 !! test
13849 Section extraction prefixed by comment (section 2)
13850 !! options
13851 section=2
13852 !! wikitext
13853 <!-- -->==sec1==
13854 ==sec2==
13855 !! html
13856
13857 !!end
13858
13859
13860 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13861 # instead of respecting HTML-style headings
13862 !! test
13863 Section extraction, mixed wiki and html (section 1)
13864 !! options
13865 section=1
13866 !! wikitext
13867 <h2>unmarked</h2>
13868 unmarked
13869 ==1==
13870 one
13871 ==2==
13872 two
13873 !! html
13874 ==1==
13875 one
13876 !! end
13877
13878 !! test
13879 Section extraction, mixed wiki and html (section 2)
13880 !! options
13881 section=2
13882 !! wikitext
13883 <h2>unmarked</h2>
13884 unmarked
13885 ==1==
13886 one
13887 ==2==
13888 two
13889 !! html
13890 ==2==
13891 two
13892 !! end
13893
13894
13895 # Formerly testing for bug 3342
13896 !! test
13897 Section extraction, heading surrounded by <noinclude>
13898 !! options
13899 section=1
13900 !! wikitext
13901 <noinclude>==unmarked==</noinclude>
13902 ==marked==
13903 !! html
13904 ==marked==
13905 !!end
13906
13907 # Test behavior of bug 19910
13908 !! test
13909 Sectiion with all-equals
13910 !! options
13911 section=2
13912 !! wikitext
13913 ===
13914 The line above must have a trailing space
13915 === <!--
13916 --> <!-- -->
13917 But just in case it doesn't...
13918 !! html
13919 === <!--
13920 --> <!-- -->
13921 But just in case it doesn't...
13922 !! end
13923
13924 !! test
13925 Section replacement test (section 0)
13926 !! options
13927 replace=0,"xxx"
13928 !! wikitext
13929 start
13930 ==a==
13931 ===aa===
13932 ====aaa====
13933 ==b==
13934 ===ba===
13935 ===bb===
13936 ====bba====
13937 ===bc===
13938 ==c==
13939 ===ca===
13940 !! html
13941 xxx
13942
13943 ==a==
13944 ===aa===
13945 ====aaa====
13946 ==b==
13947 ===ba===
13948 ===bb===
13949 ====bba====
13950 ===bc===
13951 ==c==
13952 ===ca===
13953 !! end
13954
13955 !! test
13956 Section replacement test (section 1)
13957 !! options
13958 replace=1,"xxx"
13959 !! wikitext
13960 start
13961 ==a==
13962 ===aa===
13963 ====aaa====
13964 ==b==
13965 ===ba===
13966 ===bb===
13967 ====bba====
13968 ===bc===
13969 ==c==
13970 ===ca===
13971 !! html
13972 start
13973 xxx
13974
13975 ==b==
13976 ===ba===
13977 ===bb===
13978 ====bba====
13979 ===bc===
13980 ==c==
13981 ===ca===
13982 !! end
13983
13984 !! test
13985 Section replacement test (section 2)
13986 !! options
13987 replace=2,"xxx"
13988 !! wikitext
13989 start
13990 ==a==
13991 ===aa===
13992 ====aaa====
13993 ==b==
13994 ===ba===
13995 ===bb===
13996 ====bba====
13997 ===bc===
13998 ==c==
13999 ===ca===
14000 !! html
14001 start
14002 ==a==
14003 xxx
14004
14005 ==b==
14006 ===ba===
14007 ===bb===
14008 ====bba====
14009 ===bc===
14010 ==c==
14011 ===ca===
14012 !! end
14013
14014 !! test
14015 Section replacement test (section 3)
14016 !! options
14017 replace=3,"xxx"
14018 !! wikitext
14019 start
14020 ==a==
14021 ===aa===
14022 ====aaa====
14023 ==b==
14024 ===ba===
14025 ===bb===
14026 ====bba====
14027 ===bc===
14028 ==c==
14029 ===ca===
14030 !! html
14031 start
14032 ==a==
14033 ===aa===
14034 xxx
14035
14036 ==b==
14037 ===ba===
14038 ===bb===
14039 ====bba====
14040 ===bc===
14041 ==c==
14042 ===ca===
14043 !! end
14044
14045 !! test
14046 Section replacement test (section 4)
14047 !! options
14048 replace=4,"xxx"
14049 !! wikitext
14050 start
14051 ==a==
14052 ===aa===
14053 ====aaa====
14054 ==b==
14055 ===ba===
14056 ===bb===
14057 ====bba====
14058 ===bc===
14059 ==c==
14060 ===ca===
14061 !! html
14062 start
14063 ==a==
14064 ===aa===
14065 ====aaa====
14066 xxx
14067
14068 ==c==
14069 ===ca===
14070 !! end
14071
14072 !! test
14073 Section replacement test (section 5)
14074 !! options
14075 replace=5,"xxx"
14076 !! wikitext
14077 start
14078 ==a==
14079 ===aa===
14080 ====aaa====
14081 ==b==
14082 ===ba===
14083 ===bb===
14084 ====bba====
14085 ===bc===
14086 ==c==
14087 ===ca===
14088 !! html
14089 start
14090 ==a==
14091 ===aa===
14092 ====aaa====
14093 ==b==
14094 xxx
14095
14096 ===bb===
14097 ====bba====
14098 ===bc===
14099 ==c==
14100 ===ca===
14101 !! end
14102
14103 !! test
14104 Section replacement test (section 6)
14105 !! options
14106 replace=6,"xxx"
14107 !! wikitext
14108 start
14109 ==a==
14110 ===aa===
14111 ====aaa====
14112 ==b==
14113 ===ba===
14114 ===bb===
14115 ====bba====
14116 ===bc===
14117 ==c==
14118 ===ca===
14119 !! html
14120 start
14121 ==a==
14122 ===aa===
14123 ====aaa====
14124 ==b==
14125 ===ba===
14126 xxx
14127
14128 ===bc===
14129 ==c==
14130 ===ca===
14131 !! end
14132
14133 !! test
14134 Section replacement test (section 7)
14135 !! options
14136 replace=7,"xxx"
14137 !! wikitext
14138 start
14139 ==a==
14140 ===aa===
14141 ====aaa====
14142 ==b==
14143 ===ba===
14144 ===bb===
14145 ====bba====
14146 ===bc===
14147 ==c==
14148 ===ca===
14149 !! html
14150 start
14151 ==a==
14152 ===aa===
14153 ====aaa====
14154 ==b==
14155 ===ba===
14156 ===bb===
14157 xxx
14158
14159 ===bc===
14160 ==c==
14161 ===ca===
14162 !! end
14163
14164 !! test
14165 Section replacement test (section 8)
14166 !! options
14167 replace=8,"xxx"
14168 !! wikitext
14169 start
14170 ==a==
14171 ===aa===
14172 ====aaa====
14173 ==b==
14174 ===ba===
14175 ===bb===
14176 ====bba====
14177 ===bc===
14178 ==c==
14179 ===ca===
14180 !! html
14181 start
14182 ==a==
14183 ===aa===
14184 ====aaa====
14185 ==b==
14186 ===ba===
14187 ===bb===
14188 ====bba====
14189 xxx
14190
14191 ==c==
14192 ===ca===
14193 !!end
14194
14195 !! test
14196 Section replacement test (section 9)
14197 !! options
14198 replace=9,"xxx"
14199 !! wikitext
14200 start
14201 ==a==
14202 ===aa===
14203 ====aaa====
14204 ==b==
14205 ===ba===
14206 ===bb===
14207 ====bba====
14208 ===bc===
14209 ==c==
14210 ===ca===
14211 !! html
14212 start
14213 ==a==
14214 ===aa===
14215 ====aaa====
14216 ==b==
14217 ===ba===
14218 ===bb===
14219 ====bba====
14220 ===bc===
14221 xxx
14222 !! end
14223
14224 !! test
14225 Section replacement test (section 10)
14226 !! options
14227 replace=10,"xxx"
14228 !! wikitext
14229 start
14230 ==a==
14231 ===aa===
14232 ====aaa====
14233 ==b==
14234 ===ba===
14235 ===bb===
14236 ====bba====
14237 ===bc===
14238 ==c==
14239 ===ca===
14240 !! html
14241 start
14242 ==a==
14243 ===aa===
14244 ====aaa====
14245 ==b==
14246 ===ba===
14247 ===bb===
14248 ====bba====
14249 ===bc===
14250 ==c==
14251 xxx
14252 !! end
14253
14254 !! test
14255 Section replacement test with initial whitespace (bug 13728)
14256 !! options
14257 replace=2,"xxx"
14258 !! wikitext
14259 Preformatted initial line
14260 ==a==
14261 ===a===
14262 !! html
14263 Preformatted initial line
14264 ==a==
14265 xxx
14266 !! end
14267
14268
14269 !! test
14270 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14271 !! options
14272 section=1
14273 !! wikitext
14274 ==a==
14275 a
14276 !! html
14277 ==a==
14278 a
14279 !! end
14280
14281 !! test
14282 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14283 !! options
14284 section=1
14285 !! wikitext
14286 ==a==
14287 a
14288 !! html
14289 ==a==
14290 a
14291 !! end
14292
14293
14294 !! test
14295 Section extraction, <pre> around bogus header (bug 10309)
14296 !! options
14297 noxml section=2
14298 !! wikitext
14299 == Section One ==
14300 <pre>
14301 =======
14302 </pre>
14303
14304 == Section Two ==
14305 stuff
14306 !! html
14307 == Section Two ==
14308 stuff
14309 !! end
14310
14311 !! test
14312 Section replacement, <pre> around bogus header (bug 10309)
14313 !! options
14314 noxml replace=2,"xxx"
14315 !! wikitext
14316 == Section One ==
14317 <pre>
14318 =======
14319 </pre>
14320
14321 == Section Two ==
14322 stuff
14323 !! html
14324 == Section One ==
14325 <pre>
14326 =======
14327 </pre>
14328
14329 xxx
14330 !! end
14331
14332
14333
14334 !! test
14335 Handling of &#x0A; in URLs
14336 !! wikitext
14337 **irc://&#x0A;a
14338 !! html
14339 <ul>
14340 <li><ul>
14341 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14342 </li>
14343 </ul>
14344 </li>
14345 </ul>
14346
14347 !!end
14348
14349 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14350 !! test
14351 5 quotes, code coverage +1 line
14352 !! wikitext
14353 '''''
14354 !! html/php
14355 !! html/parsoid
14356 <p><b><i></i></b></p>
14357 !! end
14358
14359 !! test
14360 Special:Search page linking.
14361 !! wikitext
14362 {{Special:search}}
14363 !! html
14364 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14365 </p>
14366 !! end
14367
14368 !! test
14369 Say the magic word
14370 !! options
14371 title=[[Parser test]]
14372 !! wikitext
14373 * {{PAGENAME}}
14374 * {{PAGENAMEE}}
14375 * {{FULLPAGENAME}}
14376 * {{FULLPAGENAMEE}}
14377 * {{BASEPAGENAME}}
14378 * {{BASEPAGENAMEE}}
14379 * {{SUBPAGENAME}}
14380 * {{SUBPAGENAMEE}}
14381 * {{ROOTPAGENAME}}
14382 * {{ROOTPAGENAMEE}}
14383 * {{TALKPAGENAME}}
14384 * {{TALKPAGENAMEE}}
14385 * {{SUBJECTPAGENAME}}
14386 * {{SUBJECTPAGENAMEE}}
14387 * {{NAMESPACEE}}
14388 * {{NAMESPACE}}
14389 * {{NAMESPACENUMBER}}
14390 * {{TALKSPACE}}
14391 * {{TALKSPACEE}}
14392 * {{SUBJECTSPACE}}
14393 * {{SUBJECTSPACEE}}
14394 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14395 !! html
14396 <ul>
14397 <li> Parser test
14398 </li>
14399 <li> Parser_test
14400 </li>
14401 <li> Parser test
14402 </li>
14403 <li> Parser_test
14404 </li>
14405 <li> Parser test
14406 </li>
14407 <li> Parser_test
14408 </li>
14409 <li> Parser test
14410 </li>
14411 <li> Parser_test
14412 </li>
14413 <li> Parser test
14414 </li>
14415 <li> Parser_test
14416 </li>
14417 <li> Talk:Parser test
14418 </li>
14419 <li> Talk:Parser_test
14420 </li>
14421 <li> Parser test
14422 </li>
14423 <li> Parser_test
14424 </li>
14425 <li>
14426 </li>
14427 <li>
14428 </li>
14429 <li> 0
14430 </li>
14431 <li> Talk
14432 </li>
14433 <li> Talk
14434 </li>
14435 <li>
14436 </li>
14437 <li>
14438 </li>
14439 <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>
14440 </li>
14441 </ul>
14442
14443 !! end
14444 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14445
14446 !! test
14447 Gallery
14448 !! wikitext
14449 <gallery>
14450 image1.png |
14451 image2.gif|||||
14452
14453 image3|
14454 image4 |300px| centre
14455 image5.svg| http://///////
14456 [[x|xx]]]]
14457 * image6
14458 </gallery>
14459 !! html
14460 <ul class="gallery mw-gallery-traditional">
14461 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14462 <div class="thumb" style="height: 150px;">Image1.png</div>
14463 <div class="gallerytext">
14464 </div>
14465 </div></li>
14466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14467 <div class="thumb" style="height: 150px;">Image2.gif</div>
14468 <div class="gallerytext">
14469 <p>||||
14470 </p>
14471 </div>
14472 </div></li>
14473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14474 <div class="thumb" style="height: 150px;">Image3</div>
14475 <div class="gallerytext">
14476 </div>
14477 </div></li>
14478 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14479 <div class="thumb" style="height: 150px;">Image4</div>
14480 <div class="gallerytext">
14481 <p>300px| centre
14482 </p>
14483 </div>
14484 </div></li>
14485 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14486 <div class="thumb" style="height: 150px;">Image5.svg</div>
14487 <div class="gallerytext">
14488 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14489 </p>
14490 </div>
14491 </div></li>
14492 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14493 <div class="thumb" style="height: 150px;">* image6</div>
14494 <div class="gallerytext">
14495 </div>
14496 </div></li>
14497 </ul>
14498
14499 !! end
14500
14501 !! test
14502 Gallery (with options)
14503 !! wikitext
14504 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14505 File:Nonexistant.jpg|caption
14506 File:Nonexistant.jpg
14507 image:foobar.jpg|some '''caption''' [[Main Page]]
14508 image:foobar.jpg
14509 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14510 </gallery>
14511 !! html
14512 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14513 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14514 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14515 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14516 <div class="gallerytext">
14517 <p>caption
14518 </p>
14519 </div>
14520 </div></li>
14521 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14522 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14523 <div class="gallerytext">
14524 </div>
14525 </div></li>
14526 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14527 <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>
14528 <div class="gallerytext">
14529 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14530 </p>
14531 </div>
14532 </div></li>
14533 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14534 <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>
14535 <div class="gallerytext">
14536 </div>
14537 </div></li>
14538 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14539 <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>
14540 <div class="gallerytext">
14541 <p>Blabla|blabla.
14542 </p>
14543 </div>
14544 </div></li>
14545 </ul>
14546
14547 !! end
14548
14549 !! test
14550 Gallery with wikitext inside caption
14551 !! wikitext
14552 <gallery>
14553 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14554 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14555 </gallery>
14556 !! html
14557 <ul class="gallery mw-gallery-traditional">
14558 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14559 <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>
14560 <div class="gallerytext">
14561 <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>
14562 </p>
14563 </div>
14564 </div></li>
14565 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14566 <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>
14567 <div class="gallerytext">
14568 <p>This is a test template
14569 </p>
14570 </div>
14571 </div></li>
14572 </ul>
14573
14574 !! end
14575
14576 !! test
14577 gallery (with showfilename option)
14578 !! wikitext
14579 <gallery showfilename>
14580 File:Nonexistant.jpg|caption
14581 File:Nonexistant.jpg
14582 image:foobar.jpg|some '''caption''' [[Main Page]]
14583 File:Foobar.jpg
14584 </gallery>
14585 !! html
14586 <ul class="gallery mw-gallery-traditional">
14587 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14588 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14589 <div class="gallerytext">
14590 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14591 caption
14592 </p>
14593 </div>
14594 </div></li>
14595 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14596 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14597 <div class="gallerytext">
14598 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14599 </p>
14600 </div>
14601 </div></li>
14602 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14603 <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>
14604 <div class="gallerytext">
14605 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14606 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14607 </p>
14608 </div>
14609 </div></li>
14610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14611 <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>
14612 <div class="gallerytext">
14613 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14614 </p>
14615 </div>
14616 </div></li>
14617 </ul>
14618
14619 !! end
14620
14621 !! test
14622 Gallery (with namespace-less filenames)
14623 !! wikitext
14624 <gallery>
14625 File:Nonexistant.jpg
14626 Nonexistant.jpg
14627 image:foobar.jpg
14628 foobar.jpg
14629 </gallery>
14630 !! html
14631 <ul class="gallery mw-gallery-traditional">
14632 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14633 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14634 <div class="gallerytext">
14635 </div>
14636 </div></li>
14637 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14638 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14639 <div class="gallerytext">
14640 </div>
14641 </div></li>
14642 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14643 <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>
14644 <div class="gallerytext">
14645 </div>
14646 </div></li>
14647 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14648 <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>
14649 <div class="gallerytext">
14650 </div>
14651 </div></li>
14652 </ul>
14653
14654 !! end
14655
14656 !! test
14657 HTML Hex character encoding (spells the word "JavaScript")
14658 !! wikitext
14659 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14660 !! html
14661 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14662 </p>
14663 !! end
14664
14665 !! test
14666 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14667 !! wikitext
14668 &#xsee;&#XSEE;
14669 !! html
14670 <p>&amp;#xsee;&amp;#XSEE;
14671 </p>
14672 !! end
14673
14674 !! test
14675 HTML Hex character encoding mixed case
14676 !! wikitext
14677 &#xEE;&#Xee;
14678 !! html
14679 <p>&#xee;&#xee;
14680 </p>
14681 !! end
14682
14683 !! test
14684 __FORCETOC__ override
14685 !! wikitext
14686 __NEWSECTIONLINK__
14687 __FORCETOC__
14688 !! html
14689 <p><br />
14690 </p>
14691 !! end
14692
14693 !! test
14694 ISBN code coverage
14695 !! wikitext
14696 ISBN 978-0-1234-56&#x20;789
14697 !! html
14698 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14699 </p>
14700 !! end
14701
14702 !! test
14703 ISBN followed by 5 spaces
14704 !! wikitext
14705 ISBN
14706 !! html
14707 <p>ISBN
14708 </p>
14709 !! end
14710
14711 !! test
14712 Double ISBN
14713 !! wikitext
14714 ISBN ISBN 1234567890
14715 !! html
14716 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14717 </p>
14718 !! end
14719
14720 !! test
14721 ISBN with an X
14722 !! wikitext
14723 ISBN 3-462-04561-X
14724 !! html
14725 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
14726 </p>
14727 !! end
14728
14729 !! test
14730 Bug 22905: <abbr> followed by ISBN followed by </a>
14731 !! wikitext
14732 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14733 !! html
14734 <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>
14735 </p>
14736 !! end
14737
14738 !! test
14739 Double RFC
14740 !! wikitext
14741 RFC RFC 1234
14742 !! html
14743 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14744 </p>
14745 !! end
14746
14747 !! test
14748 Double RFC with a wiki link
14749 !! wikitext
14750 RFC [[RFC 1234]]
14751 !! html
14752 <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>
14753 </p>
14754 !! end
14755
14756 !! test
14757 RFC code coverage
14758 !! wikitext
14759 RFC 983&#x20;987
14760 !! html
14761 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14762 </p>
14763 !! end
14764
14765 !! test
14766 Centre-aligned image
14767 !! wikitext
14768 [[Image:foobar.jpg|centre]]
14769 !! html
14770 <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>
14771
14772 !!end
14773
14774 !! test
14775 None-aligned image
14776 !! wikitext
14777 [[Image:foobar.jpg|none]]
14778 !! html
14779 <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>
14780
14781 !!end
14782
14783 !! test
14784 Width + Height sized image (using px) (height is ignored)
14785 !! wikitext
14786 [[Image:foobar.jpg|640x480px]]
14787 !! html
14788 <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>
14789 </p>
14790 !!end
14791
14792 !! test
14793 Width-sized image (using px, no following whitespace)
14794 !! wikitext
14795 [[Image:foobar.jpg|640px]]
14796 !! html
14797 <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>
14798 </p>
14799 !!end
14800
14801 !! test
14802 Width-sized image (using px, with following whitespace - test regression from r39467)
14803 !! wikitext
14804 [[Image:foobar.jpg|640px ]]
14805 !! html
14806 <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>
14807 </p>
14808 !!end
14809
14810 !! test
14811 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14812 !! wikitext
14813 [[Image:foobar.jpg| 640px]]
14814 !! html
14815 <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>
14816 </p>
14817 !!end
14818
14819 !! test
14820 Another italics / bold test
14821 !! wikitext
14822 ''' ''x'
14823 !! html
14824 <pre>'<i> </i>x'
14825 </pre>
14826 !!end
14827
14828 # Note the results may be incorrect, as parserTest output included this:
14829 # XML error: Mismatched tag at byte 6120:
14830 # ...<dd> </dt></dl> </dd...
14831 !! test
14832 dt/dd/dl test
14833 !! options
14834 disabled
14835 !! wikitext
14836 :;;;::
14837 !! html
14838 <dl>
14839 <dd><dl>
14840 <dt><dl>
14841 <dt><dl>
14842 <dt><dl>
14843 <dd><dl>
14844 <dd>
14845 </dd>
14846 </dl>
14847 </dd>
14848 </dl>
14849 </dt>
14850 </dl>
14851 </dt>
14852 </dl>
14853 </dt>
14854 </dl>
14855 </dd>
14856 </dl>
14857
14858 !!end
14859
14860
14861 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14862 !! test
14863 Images with the "|" character in the comment
14864 !! wikitext
14865 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14866 !! html
14867 <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>
14868
14869 !!end
14870
14871 !! test
14872 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14873 !! wikitext
14874 <html><script>alert(1);</script></html>
14875 !! html
14876 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14877 </p>
14878 !! end
14879
14880 !! test
14881 HTML with raw HTML ($wgRawHtml==true)
14882 !! options
14883 wgRawHtml=1
14884 !! wikitext
14885 <html><script>alert(1);</script></html>
14886 !! html
14887 <p><script>alert(1);</script>
14888 </p>
14889 !! end
14890
14891 !! test
14892 Parents of subpages, one level up
14893 !! options
14894 subpage title=[[Subpage test/L1/L2/L3]]
14895 !! wikitext
14896 [[../|L2]]
14897 !! html
14898 <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>
14899 </p>
14900 !! end
14901
14902
14903 !! test
14904 Parents of subpages, one level up, not named
14905 !! options
14906 subpage title=[[Subpage test/L1/L2/L3]]
14907 !! wikitext
14908 [[../]]
14909 !! html
14910 <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>
14911 </p>
14912 !! end
14913
14914
14915
14916 !! test
14917 Parents of subpages, two levels up
14918 !! options
14919 subpage title=[[Subpage test/L1/L2/L3]]
14920 !! wikitext
14921 [[../../|L1]]2
14922
14923 [[../../|L1]]l
14924 !! html
14925 <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
14926 </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>
14927 </p>
14928 !! end
14929
14930 !! test
14931 Parents of subpages, two levels up, without trailing slash or name.
14932 !! options
14933 subpage title=[[Subpage test/L1/L2/L3]]
14934 !! wikitext
14935 [[../..]]
14936 !! html
14937 <p>[[../..]]
14938 </p>
14939 !! end
14940
14941 !! test
14942 Parents of subpages, two levels up, with lots of extra trailing slashes.
14943 !! options
14944 subpage title=[[Subpage test/L1/L2/L3]]
14945 !! wikitext
14946 [[../../////]]
14947 !! html
14948 <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>
14949 </p>
14950 !! end
14951
14952 !! article
14953 Subpage test/L1/L2/L3Sibling
14954 !! text
14955 Sibling article
14956 !! endarticle
14957
14958 !! test
14959 Transclusion of a sibling page (one level up)
14960 !! options
14961 subpage title=[[Subpage test/L1/L2/L3]]
14962 !! wikitext
14963 {{../L3Sibling}}
14964 !! html
14965 <p>Sibling article
14966 </p>
14967 !! end
14968
14969 !! test
14970 Transclusion of a child page
14971 !! options
14972 subpage title=[[Subpage test/L1/L2]]
14973 !! wikitext
14974 {{/L3Sibling}}
14975 !! html
14976 <p>Sibling article
14977 </p>
14978 !! end
14979
14980 !! test
14981 Non-transclusion because of too many up levels
14982 !! options
14983 subpage title=[[Subpage test/L1/L2/L3]]
14984 !! wikitext
14985 {{../../../../More than parent}}
14986 !! html
14987 <p>{{../../../../More than parent}}
14988 </p>
14989 !! end
14990
14991 !! test
14992 Definition list code coverage
14993 !! wikitext
14994 ; title : def
14995 ; title : def
14996 ;title: def
14997 !! html
14998 <dl>
14999 <dt> title &#160;</dt>
15000 <dd> def
15001 </dd>
15002 <dt> title&#160;</dt>
15003 <dd> def
15004 </dd>
15005 <dt>title</dt>
15006 <dd> def
15007 </dd>
15008 </dl>
15009
15010 !! end
15011
15012 !! test
15013 Don't fall for the self-closing div
15014 !! wikitext
15015 <div>hello world</div/>
15016 !! html
15017 <div>hello world</div>
15018
15019 !! end
15020
15021 !! test
15022 MSGNW magic word
15023 !! wikitext
15024 {{MSGNW:msg}}
15025 !! html
15026 <p>&#91;&#91;:Template:Msg&#93;&#93;
15027 </p>
15028 !! end
15029
15030 !! test
15031 RAW magic word
15032 !! wikitext
15033 {{RAW:QUERTY}}
15034 !! html
15035 <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>
15036 </p>
15037 !! end
15038
15039 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15040 !! test
15041 Always escape literal '>' in output, not just after '<'
15042 !! wikitext
15043 ><>
15044 !! html
15045 <p>&gt;&lt;&gt;
15046 </p>
15047 !! end
15048
15049 !! test
15050 Template caching
15051 !! wikitext
15052 {{Test}}
15053 {{Test}}
15054 !! html
15055 <p>This is a test template
15056 This is a test template
15057 </p>
15058 !! end
15059
15060
15061 !! article
15062 MediaWiki:Fake
15063 !! text
15064 ==header==
15065 !! endarticle
15066
15067 !! test
15068 Inclusion of !userCanEdit() content
15069 !! wikitext
15070 {{MediaWiki:Fake}}
15071 !! html
15072 <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>
15073
15074 !! end
15075
15076
15077 !! test
15078 Out-of-order TOC heading levels
15079 !! wikitext
15080 ==2==
15081 ======6======
15082 ===3===
15083 =1=
15084 =====5=====
15085 ==2==
15086 !! html
15087 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15088 <ul>
15089 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15090 <ul>
15091 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15092 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15093 </ul>
15094 </li>
15095 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15096 <ul>
15097 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15098 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15099 </ul>
15100 </li>
15101 </ul>
15102 </div>
15103
15104 <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>
15105 <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>
15106 <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>
15107 <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>
15108 <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>
15109 <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>
15110
15111 !! end
15112
15113
15114 !! test
15115 ISBN with a dummy number
15116 !! wikitext
15117 ISBN ---
15118 !! html
15119 <p>ISBN ---
15120 </p>
15121 !! end
15122
15123
15124 !! test
15125 ISBN with space-delimited number
15126 !! wikitext
15127 ISBN 92 9017 032 8
15128 !! html
15129 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15130 </p>
15131 !! end
15132
15133
15134 !! test
15135 ISBN with multiple spaces, no number
15136 !! wikitext
15137 ISBN foo
15138 !! html
15139 <p>ISBN foo
15140 </p>
15141 !! end
15142
15143
15144 !! test
15145 ISBN length
15146 !! wikitext
15147 ISBN 123456789
15148
15149 ISBN 1234567890
15150
15151 ISBN 12345678901
15152 !! html
15153 <p>ISBN 123456789
15154 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15155 </p><p>ISBN 12345678901
15156 </p>
15157 !! end
15158
15159
15160 !! test
15161 ISBN with trailing year (bug 8110)
15162 !! wikitext
15163 ISBN 1-234-56789-0 - 2006
15164
15165 ISBN 1 234 56789 0 - 2006
15166 !! html
15167 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15168 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15169 </p>
15170 !! end
15171
15172
15173 !! test
15174 anchorencode
15175 !! wikitext
15176 {{anchorencode:foo bar©#%n}}
15177 !! html
15178 <p>foo_bar.C2.A9.23.25n
15179 </p>
15180 !! end
15181
15182 !! test
15183 anchorencode trims spaces
15184 !! wikitext
15185 {{anchorencode: __pretty__please__}}
15186 !! html
15187 <p>pretty_please
15188 </p>
15189 !! end
15190
15191 !! test
15192 anchorencode deals with links
15193 !! wikitext
15194 {{anchorencode: [[hello|world]] [[hi]]}}
15195 !! html
15196 <p>world_hi
15197 </p>
15198 !! end
15199
15200 !! test
15201 anchorencode deals with templates
15202 !! wikitext
15203 {{anchorencode: {{Foo}} }}
15204 !! html
15205 <p>FOO
15206 </p>
15207 !! end
15208
15209 !! test
15210 anchorencode encodes like the TOC generator: (bug 18431)
15211 !! wikitext
15212 === _ +:.3A%3A&&amp;]] ===
15213 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15214 __NOEDITSECTION__
15215 !! html
15216 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15217 <p>.2B:.3A.253A.26.26.5D.5D
15218 </p>
15219 !! end
15220
15221 !! test
15222 Bug 6200: blockquotes and paragraph formatting
15223 !! wikitext
15224 <blockquote>
15225 foo
15226 </blockquote>
15227
15228 bar
15229
15230 baz
15231 !! html
15232 <blockquote>
15233 <p>foo
15234 </p>
15235 </blockquote>
15236 <p>bar
15237 </p>
15238 <pre>baz
15239 </pre>
15240 !! end
15241
15242 !! test
15243 Bug 8293: Use of center tag ruins paragraph formatting
15244 !! wikitext
15245 <center>
15246 foo
15247 </center>
15248
15249 bar
15250
15251 baz
15252 !! html
15253 <center>
15254 <p>foo
15255 </p>
15256 </center>
15257 <p>bar
15258 </p>
15259 <pre>baz
15260 </pre>
15261 !! end
15262
15263 !!test
15264 Parsing of overlapping (improperly nested) inline html tags
15265 !! wikitext
15266 <span><s>x</span></s>
15267 !! html/php
15268 <p><span><s>x&lt;/span&gt;</s></span>
15269 </p>
15270 !! html/parsoid
15271 <p><span><s>x</s></span>
15272 </p>
15273 !!end
15274
15275 ###
15276 ### Language variants related tests
15277 ###
15278 !! test
15279 Self-link in language variants
15280 !! options
15281 title=[[Dunav]] language=sr
15282 !! wikitext
15283 Both [[Dunav]] and [[Дунав]] are names for this river.
15284 !! html
15285 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15286 </p>
15287 !!end
15288
15289 !! article
15290 Дуна
15291 !! text
15292 content
15293 !! endarticle
15294
15295 !! test
15296 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15297 !! options
15298 title=[[Duna]] language=sr
15299 !! wikitext
15300 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15301 !! html
15302 <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.
15303 </p>
15304 !! end
15305
15306 !! test
15307 Link to a section of a variant of this title shouldn't be parsed as self-link
15308 !! options
15309 title=[[Duna]] language=sr
15310 !! wikitext
15311 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15312 !! html
15313 <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.
15314 </p>
15315 !! end
15316
15317 !! test
15318 Link to pages in language variants
15319 !! options
15320 language=sr
15321 !! wikitext
15322 Main Page can be written as [[Маин Паге]]
15323 !! html
15324 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15325 </p>
15326 !!end
15327
15328
15329 !! test
15330 Multiple links to pages in language variants
15331 !! options
15332 language=sr
15333 !! wikitext
15334 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15335 !! html
15336 <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>.
15337 </p>
15338 !!end
15339
15340
15341 !! test
15342 Simple template in language variants
15343 !! options
15344 language=sr
15345 !! wikitext
15346 {{тест}}
15347 !! html
15348 <p>This is a test template
15349 </p>
15350 !! end
15351
15352
15353 !! test
15354 Template with explicit namespace in language variants
15355 !! options
15356 language=sr
15357 !! wikitext
15358 {{Template:тест}}
15359 !! html
15360 <p>This is a test template
15361 </p>
15362 !! end
15363
15364
15365 !! test
15366 Basic test for template parameter in language variants
15367 !! options
15368 language=sr
15369 !! wikitext
15370 {{парамтест|param=foo}}
15371 !! html
15372 <p>This is a test template with parameter foo
15373 </p>
15374 !! end
15375
15376
15377 !! test
15378 Simple category in language variants
15379 !! options
15380 language=sr cat
15381 !! wikitext
15382 [[Category:МедиаWики Усер'с Гуиде]]
15383 !! html
15384 <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>
15385 !! end
15386
15387
15388 !! article
15389 Category:分类
15390 !! text
15391 blah
15392 !! endarticle
15393
15394 !! article
15395 Category:分類
15396 !! text
15397 blah
15398 !! endarticle
15399
15400 !! test
15401 Don't convert blue categorylinks to another variant (bug 33210)
15402 !! options
15403 language=zh cat
15404 !! wikitext
15405 [[A]][[Category:分类]]
15406 !! html
15407 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15408 !! end
15409
15410
15411 !! test
15412 Stripping -{}- tags (language variants)
15413 !! options
15414 language=sr
15415 !! wikitext
15416 Latin proverb: -{Ne nuntium necare}-
15417 !! html
15418 <p>Latin proverb: Ne nuntium necare
15419 </p>
15420 !! end
15421
15422
15423 !! test
15424 Prevent conversion with -{}- tags (language variants)
15425 !! options
15426 language=sr variant=sr-ec
15427 !! wikitext
15428 Latinski: -{Ne nuntium necare}-
15429 !! html
15430 <p>Латински: Ne nuntium necare
15431 </p>
15432 !! end
15433
15434
15435 !! test
15436 Prevent conversion of text with -{}- tags (language variants)
15437 !! options
15438 language=sr variant=sr-ec
15439 !! wikitext
15440 Latinski: -{Ne nuntium necare}-
15441 !! html
15442 <p>Латински: Ne nuntium necare
15443 </p>
15444 !! end
15445
15446
15447 !! test
15448 Prevent conversion of links with -{}- tags (language variants)
15449 !! options
15450 language=sr variant=sr-ec
15451 !! wikitext
15452 -{[[Main Page]]}-
15453 !! html
15454 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15455 </p>
15456 !! end
15457
15458
15459 !! test
15460 -{}- tags within headlines (within html for parserConvert())
15461 !! options
15462 language=sr variant=sr-ec
15463 !! wikitext
15464 == -{Naslov}- ==
15465 !! html
15466 <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>
15467
15468 !! end
15469
15470
15471 !! test
15472 Explicit definition of language variant alternatives
15473 !! options
15474 language=zh variant=zh-tw
15475 !! wikitext
15476 -{zh:China;zh-tw:Taiwan}-, not China
15477 !! html
15478 <p>Taiwan, not China
15479 </p>
15480 !! end
15481
15482
15483 !! test
15484 Conversion around HTML tags
15485 !! options
15486 language=sr variant=sr-ec
15487 !! wikitext
15488 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15489 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15490 !! html
15491 <p>
15492 <span title="ЛаCтин">ски</span>
15493 </p>
15494 !! end
15495
15496
15497 !! test
15498 Explicit session-wise language variant mapping (A flag and - flag)
15499 !! options
15500 language=zh variant=zh-tw
15501 !! wikitext
15502 Taiwan is not China.
15503 But -{A|zh:China;zh-tw:Taiwan}- is China,
15504 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15505 and -{China}- is China.
15506 !! html
15507 <p>Taiwan is not China.
15508 But Taiwan is Taiwan,
15509 (This should be stripped!)
15510 and China is China.
15511 </p>
15512 !! end
15513
15514 !! test
15515 Explicit session-wise language variant mapping (H flag for hide)
15516 !! options
15517 language=zh variant=zh-tw
15518 !! wikitext
15519 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15520 Taiwan is China.
15521 !! html
15522 <p>(This should be stripped!)
15523 Taiwan is Taiwan.
15524 </p>
15525 !! end
15526
15527 !! test
15528 Adding explicit conversion rule for title (T flag)
15529 !! options
15530 language=zh variant=zh-tw showtitle
15531 !! wikitext
15532 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15533 !! html
15534 Taiwan
15535 <p>Should be stripped!
15536 </p>
15537 !! end
15538
15539 !! test
15540 Testing that changing the language variant here in the tests actually works
15541 !! options
15542 language=zh variant=zh showtitle
15543 !! wikitext
15544 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15545 !! html
15546 China
15547 <p>Should be stripped!
15548 </p>
15549 !! end
15550
15551 !! test
15552 Recursive conversion of alt and title attrs shouldn't clear converter state
15553 !! options
15554 language=zh variant=zh-cn showtitle
15555 !! wikitext
15556 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15557 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15558 !! html
15559 China
15560 <p>
15561 Should be stripped<span title="Exclamation">!</span>
15562 </p>
15563 !! end
15564
15565 !! test
15566 Bug 24072: more test on conversion rule for title
15567 !! options
15568 language=zh variant=zh-tw showtitle
15569 !! wikitext
15570 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15571 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15572 !! html
15573 Taiwan
15574 <p>This should be stripped!
15575 This won't take interferes with the title rule.
15576 </p>
15577 !! end
15578
15579 !! test
15580 Partly disable title conversion if variant == main language code
15581 !! options
15582 language=zh variant=zh title=[[ZH]] showtitle
15583 !! wikitext
15584 -{T|zh-cn:CN;zh-tw:TW}-
15585 !! html
15586 ZH
15587 <p>
15588 </p>
15589 !! end
15590
15591 !! test
15592 Partly disable title conversion if variant == main language code, more
15593 !! options
15594 language=zh variant=zh title=[[ZH]] showtitle
15595 !! wikitext
15596 -{T|TW}-
15597 !! html
15598 ZH
15599 <p>
15600 </p>
15601 !! end
15602
15603 !! test
15604 Raw output of variant escape tags (R flag)
15605 !! options
15606 language=zh variant=zh-tw
15607 !! wikitext
15608 Raw: -{R|zh:China;zh-tw:Taiwan}-
15609 !! html
15610 <p>Raw: zh:China;zh-tw:Taiwan
15611 </p>
15612 !! end
15613
15614 !! test
15615 Nested using of manual convert syntax
15616 !! options
15617 language=zh variant=zh-hk
15618 !! wikitext
15619 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15620 !! html
15621 <p>Nested: Hello Hong Kong!
15622 </p>
15623 !! end
15624
15625 !! test
15626 Proper conversion of text in external links
15627 !! options
15628 language=sr variant=sr-ec
15629 !! wikitext
15630 http://www.google.com
15631 gopher://www.google.com
15632 [http://www.google.com http://www.google.com]
15633 [gopher://www.google.com gopher://www.google.com]
15634 [https://www.google.com irc://www.google.com]
15635 [ftp://www.google.com www.google.com/ftp://dir]
15636 [//www.google.com www.google.com]
15637 !! html
15638 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15639 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15640 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15641 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15642 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15643 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15644 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15645 </p>
15646 !! end
15647
15648 !! test
15649 Do not convert roman numbers to language variants
15650 !! options
15651 language=sr variant=sr-ec
15652 !! wikitext
15653 Fridrih IV je car.
15654 !! html
15655 <p>Фридрих IV је цар.
15656 </p>
15657 !! end
15658
15659 !! test
15660 Unclosed language converter markup "-{"
15661 !! options
15662 language=sr
15663 !! wikitext
15664 -{T|hello
15665 !! html
15666 <p>-{T|hello
15667 </p>
15668 !! end
15669
15670 !! test
15671 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15672 !! options
15673 language=sr
15674 !! wikitext
15675 -{R|=&gt;}-
15676 !! html
15677 <p>=&gt;
15678 </p>
15679 !!end
15680
15681 !! test
15682 Don't break link parsing if language converter markup is in the caption.
15683 !! options
15684 language=sr variant=sr-ec
15685 !! wikitext
15686 [[Main Page|-{R|main page}-]]
15687 !! html
15688 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15689 </p>
15690 !! end
15691
15692 # This test is currently broken in the PHP parser (bug 52661)
15693 !! test
15694 Don't break image parsing if language converter markup is in the caption.
15695 !! options
15696 language=sr
15697 disabled
15698 !! wikitext
15699 [[File:Foobar.jpg|-{R|caption}-]]
15700 !! html
15701 <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>
15702 </p>
15703 !! end
15704
15705 # This test is currently broken in the PHP parser (bug 52661)
15706 !! test
15707 Don't break list handling if language converter markup is in the item.
15708 !! options
15709 language=zh variant=zh-cn
15710 disabled
15711 !! wikitext
15712 ;-{zh-cn:AAA;zh-tw:BBB}-
15713 !! html
15714 <dl><dt>AAA
15715 </dt></dl>
15716
15717 !! end
15718
15719 # This test is currently broken in the PHP parser (bug 52661)
15720 !! test
15721 Don't break table handling if language converter markup is in the cell.
15722 !! options
15723 language=sr variant=sr-ec
15724 disabled
15725 !! wikitext
15726 {|
15727 |-
15728 | -{R|B}-
15729 |}
15730 !! html
15731 <table>
15732
15733 <tr>
15734 <td> B
15735 </td></tr></table>
15736
15737 !! end
15738
15739 !! test
15740 Bug 529: Uncovered bullet
15741 !! wikitext
15742 * Foo {{bullet}}
15743 !! html
15744 <ul>
15745 <li> Foo
15746 </li>
15747 <li> Bar
15748 </li>
15749 </ul>
15750
15751 !! end
15752
15753 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15754 # Templates in Wikipedia rely on this behavior, as tidy has always been
15755 # enabled there. These tests are normally run *without* tidy, so specify the
15756 # full output here.
15757 # To test realistic parsing behavior, apply a tidy-like transformation to both
15758 # the expected output and your parser's output.
15759 !! test
15760 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15761 !! wikitext
15762 ******* Foo {{bullet}}
15763 !! html
15764 <ul>
15765 <li><ul>
15766 <li><ul>
15767 <li><ul>
15768 <li><ul>
15769 <li><ul>
15770 <li><ul>
15771 <li> Foo
15772 </li>
15773 </ul>
15774 </li>
15775 </ul>
15776 </li>
15777 </ul>
15778 </li>
15779 </ul>
15780 </li>
15781 </ul>
15782 </li>
15783 </ul>
15784 </li>
15785 <li> Bar
15786 </li>
15787 </ul>
15788
15789 !! end
15790
15791 !! test
15792 Bug 529: Uncovered table already at line-start
15793 !! wikitext
15794 x
15795
15796 {{table}}
15797 y
15798 !! html
15799 <p>x
15800 </p>
15801 <table>
15802 <tr>
15803 <td> 1 </td>
15804 <td> 2
15805 </td></tr>
15806 <tr>
15807 <td> 3 </td>
15808 <td> 4
15809 </td></tr></table>
15810 <p>y
15811 </p>
15812 !! end
15813
15814 !! test
15815 Bug 529: Uncovered bullet in parser function result
15816 !! wikitext
15817 * Foo {{lc:{{bullet}} }}
15818 !! html
15819 <ul>
15820 <li> Foo
15821 </li>
15822 <li> bar
15823 </li>
15824 </ul>
15825
15826 !! end
15827
15828 !! test
15829 Bug 5678: Double-parsed template argument
15830 !! wikitext
15831 {{lc:{{{1}}}|hello}}
15832 !! html
15833 <p>{{{1}}}
15834 </p>
15835 !! end
15836
15837 !! test
15838 Bug 5678: Double-parsed template invocation
15839 !! wikitext
15840 {{lc:{{paramtest {{!}} param = hello }} }}
15841 !! html
15842 <p>{{paramtest | param = hello }}
15843 </p>
15844 !! end
15845
15846 !! test
15847 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15848 !! options
15849 language=cs
15850 title=[[Main Page]]
15851 !! wikitext
15852 {{PRVNÍVELKÉ:ěščř}}
15853 {{prvnívelké:ěščř}}
15854 {{PRVNÍMALÉ:ěščř}}
15855 {{prvnímalé:ěščř}}
15856 {{MALÁ:ěščř}}
15857 {{malá:ěščř}}
15858 {{VELKÁ:ěščř}}
15859 {{velká:ěščř}}
15860 !! html
15861 <p>Ěščř
15862 Ěščř
15863 ěščř
15864 ěščř
15865 ěščř
15866 ěščř
15867 ĚŠČŘ
15868 ĚŠČŘ
15869 </p>
15870 !! end
15871
15872 !! test
15873 Morwen/13: Unclosed link followed by heading
15874 !! wikitext
15875 [[link
15876 ==heading==
15877 !! html
15878 <p>[[link
15879 </p>
15880 <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>
15881
15882 !! end
15883
15884 !! test
15885 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15886 !! wikitext
15887 {{foo|
15888 =heading=
15889 !! html
15890 <p>{{foo|
15891 </p>
15892 <h1><span class="mw-headline" id="heading">heading</span></h1>
15893
15894 !! end
15895
15896 !! test
15897 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15898 !! wikitext
15899 {{foo|
15900 ==heading==
15901 !! html
15902 <p>{{foo|
15903 </p>
15904 <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>
15905
15906 !! end
15907
15908 !! test
15909 Tildes in comments
15910 !! options
15911 pst
15912 !! wikitext
15913 <!-- ~~~~ -->
15914 !! html
15915 <!-- ~~~~ -->
15916 !! end
15917
15918 !! test
15919 Paragraphs inside divs (no extra line breaks)
15920 !! wikitext
15921 <div>Line one
15922
15923 Line two</div>
15924 !! html
15925 <div>Line one
15926 Line two</div>
15927
15928 !! end
15929
15930 !! test
15931 Paragraphs inside divs (extra line break on open)
15932 !! wikitext
15933 <div>
15934 Line one
15935
15936 Line two</div>
15937 !! html
15938 <div>
15939 <p>Line one
15940 </p>
15941 Line two</div>
15942
15943 !! end
15944
15945 !! test
15946 Paragraphs inside divs (extra line break on close)
15947 !! wikitext
15948 <div>Line one
15949
15950 Line two
15951 </div>
15952 !! html
15953 <div>Line one
15954 <p>Line two
15955 </p>
15956 </div>
15957
15958 !! end
15959
15960 !! test
15961 Paragraphs inside divs (extra line break on open and close)
15962 !! wikitext
15963 <div>
15964 Line one
15965
15966 Line two
15967 </div>
15968 !! html
15969 <div>
15970 <p>Line one
15971 </p><p>Line two
15972 </p>
15973 </div>
15974
15975 !! end
15976
15977 !! test
15978 Nesting tags, paragraphs on lines which begin with <div>
15979 !! options
15980 disabled
15981 !! wikitext
15982 <div></div><strong>A
15983 B</strong>
15984 !! html
15985 <div></div>
15986 <p><strong>A
15987 B</strong>
15988 </p>
15989 !! end
15990
15991 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15992 !! test
15993 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15994 !! wikitext
15995 <blockquote>Line one
15996
15997 Line two</blockquote>
15998 !! html
15999 <blockquote>Line one
16000 Line two</blockquote>
16001
16002 !! end
16003
16004 !! test
16005 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16006 !! wikitext
16007 <blockquote>
16008 Line one
16009
16010 Line two</blockquote>
16011 !! html
16012 <blockquote>
16013 <p>Line one
16014 </p>
16015 Line two</blockquote>
16016
16017 !! end
16018
16019 !! test
16020 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16021 !! wikitext
16022 <blockquote>Line one
16023
16024 Line two
16025 </blockquote>
16026 !! html
16027 <blockquote>Line one
16028 <p>Line two
16029 </p>
16030 </blockquote>
16031
16032 !! end
16033
16034 !! test
16035 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16036 !! wikitext
16037 <blockquote>
16038 Line one
16039
16040 Line two
16041 </blockquote>
16042 !! html
16043 <blockquote>
16044 <p>Line one
16045 </p><p>Line two
16046 </p>
16047 </blockquote>
16048
16049 !! end
16050
16051 !! test
16052 Paragraphs inside blockquotes/divs (no extra line breaks)
16053 !! wikitext
16054 <blockquote><div>Line one
16055
16056 Line two</div></blockquote>
16057 !! html
16058 <blockquote><div>Line one
16059 Line two</div></blockquote>
16060
16061 !! end
16062
16063 !! test
16064 Paragraphs inside blockquotes/divs (extra line break on open)
16065 !! wikitext
16066 <blockquote><div>
16067 Line one
16068
16069 Line two</div></blockquote>
16070 !! html
16071 <blockquote><div>
16072 <p>Line one
16073 </p>
16074 Line two</div></blockquote>
16075
16076 !! end
16077
16078 !! test
16079 Paragraphs inside blockquotes/divs (extra line break on close)
16080 !! wikitext
16081 <blockquote><div>Line one
16082
16083 Line two
16084 </div></blockquote>
16085 !! html
16086 <blockquote><div>Line one
16087 <p>Line two
16088 </p>
16089 </div></blockquote>
16090
16091 !! end
16092
16093 !! test
16094 Paragraphs inside blockquotes/divs (extra line break on open and close)
16095 !! wikitext
16096 <blockquote><div>
16097 Line one
16098
16099 Line two
16100 </div></blockquote>
16101 !! html
16102 <blockquote><div>
16103 <p>Line one
16104 </p><p>Line two
16105 </p>
16106 </div></blockquote>
16107
16108 !! end
16109
16110 !! test
16111 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16112 !! options
16113 wgLinkHolderBatchSize=0
16114 !! wikitext
16115 [[meatball:1]]
16116 [[meatball:2]]
16117 [[meatball:3]]
16118 !! html
16119 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16120 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16121 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16122 </p>
16123 !! end
16124
16125 !! test
16126 Free external link invading image caption
16127 !! wikitext
16128 [[Image:Foobar.jpg|thumb|http://x|hello]]
16129 !! html
16130 <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>
16131
16132 !! end
16133
16134 !! test
16135 Bug 15196: localised external link numbers
16136 !! options
16137 language=fa
16138 !! wikitext
16139 [http://en.wikipedia.org/]
16140 !! html
16141 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16142 </p>
16143 !! end
16144
16145 !! test
16146 Multibyte character in padleft
16147 !! wikitext
16148 {{padleft:-Hello|7|Æ}}
16149 !! html
16150 <p>Æ-Hello
16151 </p>
16152 !! end
16153
16154 !! test
16155 Multibyte character in padright
16156 !! wikitext
16157 {{padright:Hello-|7|Æ}}
16158 !! html
16159 <p>Hello-Æ
16160 </p>
16161 !! end
16162
16163 !!test
16164 formatdate parser function
16165 !! wikitext
16166 {{#formatdate:2009-03-24}}
16167 !! html
16168 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16169 </p>
16170 !! end
16171
16172 !!test
16173 formatdate parser function, with default format
16174 !! wikitext
16175 {{#formatdate:2009-03-24|mdy}}
16176 !! html
16177 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16178 </p>
16179 !! end
16180
16181 !! test
16182 Spacing of numbers in formatted dates
16183 !! wikitext
16184 {{#formatdate:January 15}}
16185 !! html
16186 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16187 </p>
16188 !! end
16189
16190 !! test
16191 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
16192 !! options
16193 language=nl title=[[MediaWiki:Common.css]]
16194 !! wikitext
16195 {{#formatdate:2009-03-24|dmy}}
16196 !! html
16197 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16198 </p>
16199 !! end
16200
16201 #
16202 #
16203 #
16204
16205 #
16206 # Edit comments
16207 #
16208
16209 !! test
16210 Edit comment with link
16211 !! options
16212 comment
16213 !! wikitext
16214 I like the [[Main Page]] a lot
16215 !! html
16216 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16217 !!end
16218
16219 !! test
16220 Edit comment with link and link text
16221 !! options
16222 comment
16223 !! wikitext
16224 I like the [[Main Page|best pages]] a lot
16225 !! html
16226 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16227 !!end
16228
16229 !! test
16230 Edit comment with link and link text with suffix
16231 !! options
16232 comment
16233 !! wikitext
16234 I like the [[Main Page|best page]]s a lot
16235 !! html
16236 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16237 !!end
16238
16239 !! test
16240 Edit comment with section link (non-local, eg in history list)
16241 !! options
16242 comment title=[[Main Page]]
16243 !! wikitext
16244 /* External links */ removed bogus entries
16245 !! html
16246 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16247 !!end
16248
16249 !! test
16250 Edit comment with section link and text before it (non-local, eg in history list)
16251 !! options
16252 comment title=[[Main Page]]
16253 !! wikitext
16254 pre-comment text /* External links */ removed bogus entries
16255 !! html
16256 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>
16257 !!end
16258
16259 !! test
16260 Edit comment with section link (local, eg in diff view)
16261 !! options
16262 comment local title=[[Main Page]]
16263 !! wikitext
16264 /* External links */ removed bogus entries
16265 !! html
16266 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16267 !!end
16268
16269 !! test
16270 Edit comment with subpage link (bug 14080)
16271 !! options
16272 comment
16273 subpage
16274 title=[[Subpage test]]
16275 !! wikitext
16276 Poked at a [[/subpage]] here...
16277 !! html
16278 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16279 !!end
16280
16281 !! test
16282 Edit comment with subpage link and link text (bug 14080)
16283 !! options
16284 comment
16285 subpage
16286 title=[[Subpage test]]
16287 !! wikitext
16288 Poked at a [[/subpage|neat little page]] here...
16289 !! html
16290 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16291 !!end
16292
16293 !! test
16294 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16295 !! options
16296 comment
16297 title=[[Subpage test]]
16298 !! wikitext
16299 Poked at a [[/subpage]] here...
16300 !! html
16301 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...
16302 !!end
16303
16304 !! test
16305 Edit comment with bare anchor link (local, as on diff)
16306 !! options
16307 comment
16308 local
16309 title=[[Main Page]]
16310 !! wikitext
16311 [[#section]]
16312 !! html
16313 <a href="#section">#section</a>
16314 !! end
16315
16316 !! test
16317 Edit comment with bare anchor link (non-local, as on history)
16318 !! options
16319 comment
16320 title=[[Main Page]]
16321 !! wikitext
16322 [[#section]]
16323 !! html
16324 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16325 !! end
16326
16327 !! test
16328 Anchor starting with underscore
16329 !! wikitext
16330 [[#_ref|One]]
16331 !! html
16332 <p><a href="#_ref">One</a>
16333 </p>
16334 !! end
16335
16336 !! test
16337 Id starting with underscore
16338 !! wikitext
16339 <div id="_ref"></div>
16340 !! html
16341 <div id="_ref"></div>
16342
16343 !! end
16344
16345 !! test
16346 Space normalisation on autocomment (bug 22784)
16347 !! options
16348 comment
16349 title=[[Main Page]]
16350 !! wikitext
16351 /* __hello__world__ */
16352 !! html
16353 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16354 !! end
16355
16356 !! test
16357 percent-encoding and + signs in comments (Bug 26410)
16358 !! options
16359 comment
16360 !! wikitext
16361 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16362 !! html
16363 <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>
16364 !! end
16365
16366 !! test
16367 Bad images - basic functionality
16368 !! options
16369 disabled
16370 !! wikitext
16371 [[File:Bad.jpg]]
16372 !! html
16373 !! end
16374
16375 !! test
16376 Bad images - bug 16039: text after bad image disappears
16377 !! options
16378 disabled
16379 !! wikitext
16380 Foo bar
16381 [[File:Bad.jpg]]
16382 Bar foo
16383 !! html
16384 <p>Foo bar
16385 </p><p>Bar foo
16386 </p>
16387 !! end
16388
16389 !! test
16390 Verify that displaytitle works (bug #22501) no displaytitle
16391 !! options
16392 showtitle
16393 !! config
16394 wgAllowDisplayTitle=true
16395 wgRestrictDisplayTitle=false
16396 !! wikitext
16397 this is not the the title
16398 !! html
16399 Parser test
16400 <p>this is not the the title
16401 </p>
16402 !! end
16403
16404 !! test
16405 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16406 !! options
16407 showtitle
16408 title=[[Screen]]
16409 !! config
16410 wgAllowDisplayTitle=true
16411 wgRestrictDisplayTitle=false
16412 !! wikitext
16413 this is not the the title
16414 {{DISPLAYTITLE:whatever}}
16415 !! html
16416 whatever
16417 <p>this is not the the title
16418 </p>
16419 !! end
16420
16421 !! test
16422 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16423 !! options
16424 showtitle
16425 title=[[Screen]]
16426 !! config
16427 wgAllowDisplayTitle=true
16428 wgRestrictDisplayTitle=true
16429 !! wikitext
16430 this is not the the title
16431 {{DISPLAYTITLE:whatever}}
16432 !! html
16433 Screen
16434 <p>this is not the the title
16435 </p>
16436 !! end
16437
16438 !! test
16439 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16440 !! options
16441 showtitle
16442 title=[[Screen]]
16443 !! config
16444 wgAllowDisplayTitle=true
16445 wgRestrictDisplayTitle=true
16446 !! wikitext
16447 this is not the the title
16448 {{DISPLAYTITLE:screen}}
16449 !! html
16450 screen
16451 <p>this is not the the title
16452 </p>
16453 !! end
16454
16455 !! test
16456 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16457 !! options
16458 showtitle
16459 title=[[Screen]]
16460 !! config
16461 wgAllowDisplayTitle=false
16462 !! wikitext
16463 this is not the the title
16464 {{DISPLAYTITLE:screen}}
16465 !! html
16466 Screen
16467 <p>this is not the the title
16468 <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>
16469 </p>
16470 !! end
16471
16472 !! test
16473 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16474 !! options
16475 showtitle
16476 title=[[Screen]]
16477 !! config
16478 wgAllowDisplayTitle=false
16479 !! wikitext
16480 this is not the the title
16481 !! html
16482 Screen
16483 <p>this is not the the title
16484 </p>
16485 !! end
16486
16487 !! test
16488 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16489 !! options
16490 showtitle
16491 title=[[Screen]]
16492 !! config
16493 wgAllowDisplayTitle=true
16494 wgRestrictDisplayTitle=true
16495 !! wikitext
16496 this is not the the title
16497 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16498 !! html
16499 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16500 <p>this is not the the title
16501 </p>
16502 !! end
16503
16504 !! test
16505 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16506 !! options
16507 showtitle
16508 title=[[Screen]]
16509 !! config
16510 wgAllowDisplayTitle=true
16511 wgRestrictDisplayTitle=true
16512 !! wikitext
16513 this is not the the title
16514 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16515 !! html
16516 <span style="color: red;">s</span>creen
16517 <p>this is not the the title
16518 </p>
16519 !! end
16520
16521 !! test
16522 preload: check <noinclude> and <includeonly>
16523 !! options
16524 preload
16525 !! wikitext
16526 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16527 !! html
16528 Hello kind world.
16529 !! end
16530
16531 !! test
16532 preload: check <onlyinclude>
16533 !! options
16534 preload
16535 !! wikitext
16536 Goodbye <onlyinclude>Hello world</onlyinclude>
16537 !! html
16538 Hello world
16539 !! end
16540
16541 !! test
16542 preload: can pass tags through if we want to
16543 !! options
16544 preload
16545 !! wikitext
16546 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16547 !! html
16548 <includeonly>Hello world</includeonly>
16549 !! end
16550
16551 !! test
16552 preload: check that it doesn't try to do tricks
16553 !! options
16554 preload
16555 !! wikitext
16556 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16557 !! html
16558 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16559 !! end
16560
16561 !! test
16562 Play a bit with r67090 and bug 3158
16563 !! options
16564 disabled
16565 !! wikitext
16566 <div style="width:50% !important">&nbsp;</div>
16567 <div style="width:50%&nbsp;!important">&nbsp;</div>
16568 <div style="width:50%&#160;!important">&nbsp;</div>
16569 <div style="border : solid;">&nbsp;</div>
16570 !! html
16571 <div style="width:50% !important">&nbsp;</div>
16572 <div style="width:50% !important">&nbsp;</div>
16573 <div style="width:50% !important">&nbsp;</div>
16574 <div style="border&#160;: solid;">&nbsp;</div>
16575
16576 !! end
16577
16578 !! test
16579 HTML5 data attributes
16580 !! wikitext
16581 <span data-foo="bar">Baz</span>
16582 <p data-abc-def_hij="">Quuz</p>
16583 !! html
16584 <p><span data-foo="bar">Baz</span>
16585 </p>
16586 <p data-abc-def_hij="">Quuz</p>
16587
16588 !! end
16589
16590 !! test
16591 percent-encoding and + signs in internal links (Bug 26410)
16592 !! wikitext
16593 [[User:+%]] [[Page+title%]]
16594 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16595 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16596 [[%33%45]] [[%33%45+]]
16597 !! html
16598 <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>
16599 <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>
16600 <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>
16601 <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>
16602 </p>
16603 !! end
16604
16605 !! test
16606 Special characters in embedded file links (bug 27679)
16607 !! wikitext
16608 [[File:Contains & ampersand.jpg]]
16609 [[File:Does not exist.jpg|Title with & ampersand]]
16610 !! html
16611 <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>
16612 <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>
16613 </p>
16614 !! end
16615
16616
16617 !! test
16618 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16619 !! wikitext
16620 Text&apos;s been normalized?
16621 !! html
16622 <p>Text&#39;s been normalized?
16623 </p>
16624 !! end
16625
16626 !! test
16627 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16628 !! wikitext
16629 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16630 !! html
16631 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16632 </p>
16633 !! end
16634
16635 !! test
16636 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16637 !! wikitext
16638 [http://www.example.org/ ideograms]
16639 !! html
16640 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16641 </p>
16642 !! end
16643
16644 !! test
16645 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16646 !! wikitext
16647 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16648 !! html
16649 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16650 </p>
16651 !! end
16652
16653 !! article
16654 Mediawiki:loop1
16655 !! text
16656 {{Identical|A}}
16657 !! endarticle
16658
16659 !! article
16660 Mediawiki:loop2
16661 !! text
16662 {{Identical|B}}
16663 !! endarticle
16664
16665 !! article
16666 Template:Identical
16667 !! text
16668 {{int:loop1}}
16669 {{int:loop2}}
16670 !! endarticle
16671
16672 !! test
16673 Bug 31098 Template which includes system messages which includes the template
16674 !! wikitext
16675 {{Identical}}
16676 !! html
16677 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16678 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16679 </p>
16680 !! end
16681
16682 !! test
16683 Bug31490 Turkish: ucfirst 'blah'
16684 !! options
16685 language=tr
16686 !! wikitext
16687 {{ucfirst:blah}}
16688 !! html
16689 <p>Blah
16690 </p>
16691 !! end
16692
16693 !! test
16694 Bug31490 Turkish: ucfirst 'ix'
16695 !! options
16696 language=tr
16697 !! wikitext
16698 {{ucfirst:ix}}
16699 !! html
16700 <p>İx
16701 </p>
16702 !! end
16703
16704 !! test
16705 Bug31490 Turkish: lcfirst 'BLAH'
16706 !! options
16707 language=tr
16708 !! wikitext
16709 {{lcfirst:BLAH}}
16710 !! html
16711 <p>bLAH
16712 </p>
16713 !! end
16714
16715 !! test
16716 Bug31490 Turkish: ucfırst (with a dotless i)
16717 !! options
16718 language=tr
16719 !! wikitext
16720 {{ucfırst:blah}}
16721 !! html
16722 <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>
16723 </p>
16724 !! end
16725
16726 !! test
16727 Bug31490 ucfırst (with a dotless i) with English language
16728 !! options
16729 language=en
16730 !! wikitext
16731 {{ucfırst:blah}}
16732 !! html
16733 <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>
16734 </p>
16735 !! end
16736
16737 !! test
16738 Bug 26375: TOC with italics
16739 !! options
16740 title=[[Main Page]]
16741 !! wikitext
16742 __TOC__
16743 == ''Lost'' episodes ==
16744 !! html
16745 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16746 <ul>
16747 <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>
16748 </ul>
16749 </div>
16750
16751 <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>
16752
16753 !! end
16754
16755 !! test
16756 Bug 26375: TOC with bold
16757 !! options
16758 title=[[Main Page]]
16759 !! wikitext
16760 __TOC__
16761 == '''should be bold''' then normal text ==
16762 !! html
16763 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16764 <ul>
16765 <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>
16766 </ul>
16767 </div>
16768
16769 <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>
16770
16771 !! end
16772
16773 !! test
16774 Bug 33845: Headings become cursive in TOC when they contain an image
16775 !! options
16776 title=[[Main Page]]
16777 !! wikitext
16778 __TOC__
16779 == Image [[Image:foobar.jpg]] ==
16780 !! html
16781 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16782 <ul>
16783 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16784 </ul>
16785 </div>
16786
16787 <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>
16788
16789 !! end
16790
16791 !! test
16792 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16793 !! options
16794 title=[[Main Page]]
16795 !! wikitext
16796 __TOC__
16797 == <blockquote>Quote</blockquote> ==
16798 !! html
16799 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16800 <ul>
16801 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16802 </ul>
16803 </div>
16804
16805 <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>
16806
16807 !! end
16808
16809 !! test
16810 Unclosed tags in TOC
16811 !! options
16812 title=[[Main Page]]
16813 !! wikitext
16814 __TOC__
16815 == Proof: 2 < 3 ==
16816 <small>Hanc marginis exiguitas non caperet.</small>
16817 QED
16818 !! html
16819 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16820 <ul>
16821 <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>
16822 </ul>
16823 </div>
16824
16825 <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>
16826 <p><small>Hanc marginis exiguitas non caperet.</small>
16827 QED
16828 </p>
16829 !! end
16830
16831 !! test
16832 Multiple tags in TOC
16833 !! wikitext
16834 __TOC__
16835 == <i>Foo</i> <b>Bar</b> ==
16836
16837 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16838 !! html
16839 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16840 <ul>
16841 <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>
16842 <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>
16843 </ul>
16844 </div>
16845
16846 <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>
16847 <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>
16848
16849 !! end
16850
16851 !! test
16852 Tags with parameters in TOC
16853 !! wikitext
16854 __TOC__
16855 == <sup class="in-h2">Hello</sup> ==
16856
16857 == <sup class="a > b">Evilbye</sup> ==
16858 !! html
16859 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16860 <ul>
16861 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16862 <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>
16863 </ul>
16864 </div>
16865
16866 <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>
16867 <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>
16868
16869 !! end
16870
16871 !! test
16872 span tags with directionality in TOC
16873 !! wikitext
16874 __TOC__
16875 == <span dir="ltr">C++</span> ==
16876
16877 == <span dir="rtl">זבנג!</span> ==
16878
16879 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16880
16881 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16882
16883 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16884 !! html
16885 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16886 <ul>
16887 <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>
16888 <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>
16889 <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>
16890 <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>
16891 <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>
16892 </ul>
16893 </div>
16894
16895 <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>
16896 <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>
16897 <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>
16898 <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>
16899 <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>
16900
16901 !! end
16902
16903 !! article
16904 MediaWiki:Bug32057
16905 !! text
16906 == {{int:headline_sample}} ==
16907 !! endarticle
16908
16909 !! test
16910 Bug 32057: Title needed when expanding <h> nodes.
16911 !! options
16912 title=[[Main Page]]
16913 !! wikitext
16914 {{int:Bug32057}}
16915 !! html
16916 <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>
16917
16918 !! end
16919
16920 !! test
16921 Strip marker in urlencode
16922 !! wikitext
16923 {{urlencode:x<nowiki/>y}}
16924 {{urlencode:x<nowiki/>y|wiki}}
16925 {{urlencode:x<nowiki/>y|path}}
16926 !! html
16927 <p>xy
16928 xy
16929 xy
16930 </p>
16931 !! end
16932
16933 !! test
16934 Strip marker in lc
16935 !! wikitext
16936 {{lc:x<nowiki/>y}}
16937 !! html
16938 <p>xy
16939 </p>
16940 !! end
16941
16942 !! test
16943 Strip marker in uc
16944 !! wikitext
16945 {{uc:x<nowiki/>y}}
16946 !! html
16947 <p>XY
16948 </p>
16949 !! end
16950
16951 !! test
16952 Strip marker in formatNum
16953 !! wikitext
16954 {{formatnum:1<nowiki/>2}}
16955 {{formatnum:1<nowiki/>2|R}}
16956 !! html
16957 <p>12
16958 12
16959 </p>
16960 !! end
16961
16962 !! test
16963 Check noCommafy in formatNum
16964 !! options
16965 language=be-tarask
16966 !! wikitext
16967 {{formatnum:123456.78}}
16968 {{formatnum:123456.78|NOSEP}}
16969 !! html
16970 <p>123 456,78
16971 123456.78
16972 </p>
16973 !! end
16974
16975 !! test
16976 Wrong option for formatNum (bug 56199)
16977 !! wikitext
16978 {{formatnum:1,234.56|Random}}
16979 {{formatnum:1,234.56|EVERYTHING}}
16980 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
16981 !! html
16982 <p>1,234.56
16983 1,234.56
16984 1,234.56
16985 </p>
16986 !! end
16987
16988 !! test
16989 Strip marker in grammar
16990 !! options
16991 language=fi
16992 !! wikitext
16993 {{grammar:elative|foo<nowiki/>bar}}
16994 !! html
16995 <p>foobarista
16996 </p>
16997 !! end
16998
16999 !! test
17000 Strip marker in padleft
17001 !! wikitext
17002 {{padleft:|2|x<nowiki/>y}}
17003 !! html
17004 <p>xy
17005 </p>
17006 !! end
17007
17008 !! test
17009 Strip marker in padright
17010 !! wikitext
17011 {{padright:|2|x<nowiki/>y}}
17012 !! html
17013 <p>xy
17014 </p>
17015 !! end
17016
17017 !! test
17018 Strip marker in anchorencode
17019 !! wikitext
17020 {{anchorencode:x<nowiki/>y}}
17021 !! html
17022 <p>xy
17023 </p>
17024 !! end
17025
17026 !! test
17027 nowiki inside link inside heading (bug 18295)
17028 !! wikitext
17029 ==[[foo|x<nowiki>y</nowiki>z]]==
17030 !! html
17031 <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>
17032
17033 !! end
17034
17035 !! test
17036 new support for bdi element (bug 31817)
17037 !! wikitext
17038 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17039 !! html
17040 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17041
17042 !!end
17043
17044 !! test
17045 Ignore pipe between table row attributes
17046 !! wikitext
17047 {|
17048 | quux
17049 |- id=foo | style='color: red'
17050 | bar
17051 |}
17052 !! html
17053 <table>
17054 <tr>
17055 <td> quux
17056 </td></tr>
17057 <tr id="foo" style="color: red">
17058 <td> bar
17059 </td></tr></table>
17060
17061 !! end
17062
17063 !!test
17064 Gallery override link with WikiLink (bug 34852)
17065 !! wikitext
17066 <gallery>
17067 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17068 </gallery>
17069 !! html
17070 <ul class="gallery mw-gallery-traditional">
17071 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17072 <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>
17073 <div class="gallerytext">
17074 <p>caption
17075 </p>
17076 </div>
17077 </div></li>
17078 </ul>
17079
17080 !! end
17081
17082 !!test
17083 Gallery override link with absolute external link (bug 34852)
17084 !! wikitext
17085 <gallery>
17086 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17087 </gallery>
17088 !! html
17089 <ul class="gallery mw-gallery-traditional">
17090 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17091 <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>
17092 <div class="gallerytext">
17093 <p>caption
17094 </p>
17095 </div>
17096 </div></li>
17097 </ul>
17098
17099 !! end
17100
17101 !!test
17102 Gallery override link with malicious javascript (bug 34852)
17103 !! wikitext
17104 <gallery>
17105 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17106 </gallery>
17107 !! html
17108 <ul class="gallery mw-gallery-traditional">
17109 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17110 <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>
17111 <div class="gallerytext">
17112 <p>caption
17113 </p>
17114 </div>
17115 </div></li>
17116 </ul>
17117
17118 !! end
17119
17120 !!test
17121 Gallery with invalid title as link (bug 43964)
17122 !! wikitext
17123 <gallery>
17124 File:foobar.jpg|link=<
17125 </gallery>
17126 !! html
17127 <ul class="gallery mw-gallery-traditional">
17128 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17129 <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>
17130 <div class="gallerytext">
17131 </div>
17132 </div></li>
17133 </ul>
17134
17135 !! end
17136
17137 !!test
17138 Language parser function
17139 !! wikitext
17140 {{#language:ar}}
17141 !! html
17142 <p>العربية
17143 </p>
17144 !! end
17145
17146 !!test
17147 Padleft and padright as substr
17148 !! wikitext
17149 {{padleft:|3|abcde}}
17150 {{padright:|3|abcde}}
17151 !! html
17152 <p>abc
17153 abc
17154 </p>
17155 !! end
17156
17157 !!test
17158 Special parser function
17159 !! wikitext
17160 {{#special:RandomPage}}
17161 {{#special:BaDtItLe}}
17162 {{#special:Foobar}}
17163 !! html
17164 <p>Special:Random
17165 Special:Badtitle
17166 Special:Foobar
17167 </p>
17168 !! end
17169
17170 !!test
17171 Bug 34939 - Case insensitive link parsing ([HttP://])
17172 !! wikitext
17173 [HttP://MediaWiki.Org/]
17174 !! html
17175 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17176 </p>
17177 !! end
17178
17179 !!test
17180 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17181 !! wikitext
17182 [HttP://MediaWiki.Org/ MediaWiki]
17183 !! html
17184 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17185 </p>
17186 !! end
17187
17188 !!test
17189 Bug 34939 - Case insensitive link parsing (HttP://)
17190 !! wikitext
17191 HttP://MediaWiki.Org/
17192 !! html
17193 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17194 </p>
17195 !! end
17196
17197 !!test
17198 Disable TOC
17199 !! options
17200 notoc
17201 !! wikitext
17202 Lead
17203 == Section 1 ==
17204 == Section 2 ==
17205 == Section 3 ==
17206 == Section 4 ==
17207 == Section 5 ==
17208 !! html
17209 <p>Lead
17210 </p>
17211
17212 <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>
17213 <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>
17214 <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>
17215 <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>
17216 <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>
17217
17218 !! end
17219
17220
17221 ###
17222 ### Parsoids-specific tests
17223 ### Parsoid-PHP parser incompatibilities
17224 ###
17225 !!test
17226 1. SOL-sensitive wikitext tokens as template-args
17227 !!options
17228 parsoid=wt2html,wt2wt
17229 !! wikitext
17230 {{echo|*a}}
17231 {{echo|#a}}
17232 {{echo|:a}}
17233 !! html
17234 <span about="#mwt1" typeof="mw:Transclusion">
17235 </span><ul about="#mwt1"><li>a</li>
17236 </ul>
17237 <span about="#mwt2" typeof="mw:Transclusion">
17238 </span><ol about="#mwt2"><li>a</li>
17239 </ol>
17240 <span about="#mwt3" typeof="mw:Transclusion">
17241 </span><dl about="#mwt3"><dd>a</dd>
17242 </dl>
17243 !!end
17244
17245 #### ----------------------------------------------------------------
17246 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17247 #### tags. Parsoid's output for these tags differs from that of the
17248 #### PHP parser.
17249 #### ----------------------------------------------------------------
17250
17251 !!test
17252 Ref: 1. ref-location should be replaced with an index span
17253 !!options
17254 parsoid
17255 !! wikitext
17256 A <ref>foo</ref>
17257 B <ref name="x">foo</ref>
17258 C <ref name="y" />
17259 !! html
17260 <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>
17261 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>
17262 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>
17263 !!end
17264
17265 !!test
17266 Ref: 2. ref-tags with identical names should all get the same index
17267 !!options
17268 parsoid
17269 !! wikitext
17270 A <ref name="x">foo</ref>
17271 B <ref name="x" />
17272 !! html
17273 <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>
17274 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>
17275 !!end
17276
17277 !!test
17278 Ref: 3. spaces in ref-names should be ignored
17279 !!options
17280 parsoid
17281 !! wikitext
17282 A <ref name="x">foo</ref>
17283 B <ref name=" x " />
17284 C <ref name= x />
17285 !! html
17286 <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>
17287 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>
17288 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>
17289 !!end
17290
17291 !!test
17292 Ref: 4. 'constructor' should be accepted as a valid ref-name
17293 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17294 !!options
17295 parsoid
17296 !! wikitext
17297 A <ref name="constructor">foo</ref>
17298 !! html
17299 <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>
17300 !!end
17301
17302 !!test
17303 Ref: 5. body should accept generic wikitext
17304 !!options
17305 parsoid
17306 !! wikitext
17307 A <ref>
17308 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17309 </ref>
17310
17311 <references />
17312 !! html
17313 <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>
17314
17315 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17316 <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>
17317 </li>
17318 </ol>
17319 !!end
17320
17321 !!test
17322 Ref: 6. indent-pres should not be output in ref-body
17323 !!options
17324 parsoid
17325 !! wikitext
17326 A <ref>
17327 foo
17328 bar
17329 baz
17330 </ref>
17331
17332 <references />
17333 !! html
17334 <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>
17335
17336 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17337 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17338 bar
17339 baz
17340 </li>
17341 </ol>
17342 !!end
17343
17344 !!test
17345 Ref: 7. No p-wrapping in ref-body
17346 !!options
17347 parsoid
17348 !! wikitext
17349 A <ref>
17350 foo
17351
17352 bar
17353
17354
17355 baz
17356
17357
17358
17359 booz
17360 </ref>
17361
17362 <references />
17363 !! html
17364 <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>
17365
17366 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17367 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17368
17369 bar
17370
17371
17372 baz
17373
17374
17375
17376 booz
17377 </li>
17378 </ol>
17379 !!end
17380
17381 !!test
17382 Ref: 8. transclusion wikitext has lower precedence
17383 !!options
17384 parsoid
17385 !! wikitext
17386 A <ref> foo {{echo|</ref> B C}}
17387
17388 <references />
17389 !! html
17390 <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>
17391 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17392 <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>
17393 </ol>
17394 !!end
17395
17396 !!test
17397 Ref: 9. unclosed comments should not leak out of ref-body
17398 !!options
17399 parsoid
17400 !! wikitext
17401 A <ref> foo <!--</ref> B C
17402 <references />
17403 !! html
17404 <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>
17405 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17406 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17407 </ol>
17408 !!end
17409
17410 !!test
17411 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17412 !!options
17413 parsoid
17414 !! wikitext
17415 A <ref> <b> foo </ref> B C
17416
17417 <references />
17418 !! html
17419 <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>
17420
17421
17422 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17423 <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>
17424 </ol>
17425 !!end
17426
17427 !!test
17428 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17429 !!options
17430 parsoid
17431 !! wikitext
17432 A <ref>foo</ref> B
17433 C <ref>bar</ref> D
17434 !! html
17435 <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
17436 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>
17437 !!end
17438
17439 !!test
17440 Ref: 12. ref-tags act as trailing newline migration barrier
17441 !!options
17442 parsoid
17443 !! wikitext
17444 <!--the newline at the end of this line moves out of the p-tag-->a
17445
17446 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17447 <ref />
17448
17449 c
17450 !! html
17451 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17452
17453
17454 <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>
17455 <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>
17456
17457
17458 <p>c</p>
17459 !!end
17460
17461 !!test
17462 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17463 !!options
17464 parsoid
17465 !! wikitext
17466 <ref>foo</ref> A
17467 <ref>bar
17468 </ref> B
17469 !! html
17470 <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
17471 <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>
17472 !!end
17473
17474 !!test
17475 Ref: 14. A nested ref-tag should be emitted as plain text
17476 !!options
17477 parsoid
17478 !! wikitext
17479 <ref>foo <ref>bar</ref> baz</ref>
17480
17481 <references />
17482 !! html
17483 <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>
17484
17485 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17486 <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>
17487 </ol>
17488 !!end
17489
17490 !!test
17491 Ref: 15. ref-tags with identical names should get identical indexes
17492 !!options
17493 parsoid
17494 !! wikitext
17495 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17496 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17497
17498 <references />
17499 !! html
17500 <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>
17501 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>
17502
17503 <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>
17504 </ol>
17505 !!end
17506
17507 ## We don't bother wt2wt-ing non-standard whitespace
17508 !!test
17509 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17510 !!options
17511 parsoid=wt2html
17512 !! wikitext
17513 A <ref >foo</ref >
17514
17515 <references />
17516 !! html
17517 <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>
17518
17519 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17520 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17521 !!end
17522
17523 !!test
17524 References: 1. references tag without any refs should be handled properly
17525 !!options
17526 parsoid
17527 !! wikitext
17528 <references />
17529 !! html
17530 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17531 !!end
17532
17533 !!test
17534 References: 2. references tag with group only outputs references from that group
17535 !!options
17536 parsoid
17537 !! wikitext
17538 A <ref group="a">foo</ref>
17539 B <ref group="b">bar</ref>
17540
17541 <references group="a" />
17542 !! html
17543 <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>
17544 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>
17545
17546 <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>
17547 </ol>
17548 !!end
17549
17550 !!test
17551 References: 3. ref list should be cleared after processing references
17552 !!options
17553 parsoid
17554 !! wikitext
17555 A <ref>foo</ref>
17556
17557 <references />
17558
17559 B <ref>bar</ref>
17560
17561 <references />
17562 !! html
17563 <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>
17564
17565 <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>
17566 </ol>
17567
17568 <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>
17569
17570 <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>
17571 </ol>
17572 !!end
17573
17574 !!test
17575 References: 4. only referenced group should be cleared after processing references
17576 !!options
17577 parsoid
17578 !! wikitext
17579 A <ref group="a">afoo</ref>
17580 B <ref>bfoo</ref>
17581
17582 <references group="a" />
17583
17584 C <ref>cfoo</ref>
17585
17586 <references />
17587 !! html
17588 <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>
17589 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>
17590
17591 <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>
17592 </ol>
17593
17594 <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>
17595
17596 <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>
17597 </ol>
17598 !!end
17599
17600 !!test
17601 References: 5. ref tags in references should be processed while ignoring all other content
17602 !!options
17603 parsoid
17604 !! wikitext
17605 A <ref name="a" />
17606 B <ref name="b">bar</ref>
17607
17608 <references>
17609 <ref name="a">foo</ref>
17610 This should just get lost.
17611 </references>
17612 !! html
17613 <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>
17614 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>
17615
17616
17617 <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":{}}'>
17618 <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>
17619 <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>
17620 </ol>
17621 !!end
17622
17623 !!test
17624 References: 6. <references /> from a transclusion
17625 !!options
17626 parsoid
17627 !! wikitext
17628 <ref>Foo</ref> {{echo|<references />}}
17629 !! html
17630 <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>
17631 !!end
17632
17633 !! test
17634 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17635 !! options
17636 parsoid
17637 !! wikitext
17638 A <ref>foo bar for a</ref>
17639 B <ref group="X" name="b" />
17640
17641 <references />
17642
17643 <references group="X">
17644 <ref name="b">foo</ref>
17645 </references>
17646 !! html
17647 <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>
17648 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>
17649
17650 <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>
17651
17652 <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>
17653 !! end
17654
17655 # This test is wt2html only because we're permitting the serializer to produce
17656 # dirty diffs, normalizing the unclosed references to the self-closed version.
17657 !! test
17658 Generate references for unclosed references tag
17659 !! options
17660 parsoid=wt2html
17661 !! wikitext
17662 a<ref>foo</ref>
17663
17664 <references>
17665 !! html
17666 <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>
17667
17668
17669 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17670 <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>
17671 !! end
17672
17673 !! test
17674 New reference serializes on its own line
17675 !! options
17676 parsoid=wt2wt,html2wt
17677 !! wikitext
17678 foo
17679 <references />
17680 !! html
17681 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17682 !! end
17683
17684 #### ----------------------------------------------------------------
17685 #### The following section of tests are primarily to test
17686 #### wikitext escaping capabilities of Parsoid. Given that
17687 #### escaping can be done any number of ways, the wikitext (input)
17688 #### is always adjusted to reflect how Parsoid adds nowiki
17689 #### escape tags.
17690 ####
17691 #### We are marking several tests as parsoid-only since the
17692 #### HTML in the result section is different from what the
17693 #### PHP parser generates for it.
17694 #### ----------------------------------------------------------------
17695
17696
17697 #### --------------- Headings ---------------
17698 #### 0. Unnested
17699 #### 1. Nested inside html <h1>=foo=</h1>
17700 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17701 #### 3. Nested inside html with wikitext split by html tags
17702 #### 4. No escape needed
17703 #### 5. Empty headings <h1></h1>
17704 #### 6. Heading chars in SOL context
17705 #### ----------------------------------------
17706 !! test
17707 Headings: 0. Unnested
17708 !! options
17709 parsoid
17710 !! wikitext
17711 <nowiki>=foo=</nowiki>
17712
17713 <nowiki> =foo= </nowiki>
17714 <!--cmt-->
17715 <nowiki>=foo=</nowiki>
17716
17717 =foo''a''<nowiki>=</nowiki>
17718 !! html
17719 <p><span typeof="mw:Nowiki">=foo=</span></p>
17720
17721 <p><span typeof="mw:Nowiki"> =foo= </span>
17722 <!--cmt-->
17723 <span typeof="mw:Nowiki">=foo=</span></p>
17724
17725 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17726 !!end
17727
17728 !! test
17729 Headings: 1. Nested inside html
17730 (New headings and existing headings are handled differently)
17731 !! options
17732 parsoid=html2wt
17733 !! wikitext
17734 = =foo= =
17735
17736 == =foo= ==
17737
17738 === =foo= ===
17739
17740 =<nowiki>=foo=</nowiki>=
17741 ==<nowiki>=foo=</nowiki>==
17742 ===<nowiki>=foo=</nowiki>===
17743 ====<nowiki>=foo=</nowiki>====
17744 =====<nowiki>=foo=</nowiki>=====
17745 ======<nowiki>=foo=</nowiki>======
17746
17747 !! html
17748 <h1>=foo=</h1>
17749 <h2>=foo=</h2>
17750 <h3>=foo=</h3>
17751
17752 <h1 data-parsoid='{}'>=foo=</h1>
17753 <h2 data-parsoid='{}'>=foo=</h2>
17754 <h3 data-parsoid='{}'>=foo=</h3>
17755 <h4 data-parsoid='{}'>=foo=</h4>
17756 <h5 data-parsoid='{}'>=foo=</h5>
17757 <h6 data-parsoid='{}'>=foo=</h6>
17758 !!end
17759
17760 !! test
17761 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17762 !! options
17763 parsoid=html2wt
17764 !! wikitext
17765 = foo =
17766 <nowiki>*</nowiki>bar
17767
17768 = foo =
17769 =bar
17770
17771 = foo =
17772 <nowiki>=bar=</nowiki>
17773 !! html
17774 <h1>foo</h1>*bar
17775 <h1>foo</h1>=bar
17776 <h1>foo</h1>=bar=
17777 !!end
17778
17779 !! test
17780 Headings: 3. Nested inside html with wikitext split by html tags
17781 !! options
17782 parsoid=html2wt
17783 !! wikitext
17784 = ='''bold'''<nowiki>foo=</nowiki> =
17785 !! html
17786 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17787 !!end
17788
17789 !! test
17790 Headings: 4a. No escaping needed (testing just h1 and h2)
17791 !! options
17792 parsoid=html2wt
17793 !! wikitext
17794 = =foo =
17795
17796 = foo= =
17797
17798 = =foo= =
17799
17800 = =foo= bar =
17801
17802 == =foo ==
17803
17804 == foo= ==
17805
17806 = ''=''foo= =
17807
17808 = <nowiki>=</nowiki> =
17809 !! html
17810 <h1>=foo</h1>
17811 <h1>foo=</h1>
17812 <h1> =foo= </h1>
17813 <h1>=foo= bar</h1>
17814 <h2>=foo</h2>
17815 <h2>foo=</h2>
17816 <h1><i>=</i>foo=</h1>
17817 <h1><span typeof="mw:Nowiki">=</span></h1>
17818 !!end
17819
17820 !! test
17821 Headings: 4b. No escaping needed (inside p-tags)
17822 !! options
17823 parsoid=html2wt
17824 !! wikitext
17825 ===
17826 =foo= x
17827 =foo= <s></s>
17828 !! html
17829 <p>===
17830 =foo= x
17831 =foo= <s></s>
17832 </p>
17833 !!end
17834
17835 !! test
17836 Headings: 5. Empty headings
17837 !! options
17838 parsoid
17839 !! wikitext
17840 =<nowiki/>=
17841
17842 ==<nowiki/>==
17843
17844 ===<nowiki/>===
17845
17846 ====<nowiki/>====
17847
17848 =====<nowiki/>=====
17849
17850 ======<nowiki/>======
17851 !! html
17852 <h1></h1>
17853 <h2></h2>
17854 <h3></h3>
17855 <h4></h4>
17856 <h5></h5>
17857 <h6></h6>
17858 !!end
17859
17860 !! test
17861 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17862 !! options
17863 parsoid
17864 !! wikitext
17865 <nowiki>=a=</nowiki>
17866
17867 <nowiki>=a=</nowiki>
17868
17869 <nowiki>=a=</nowiki>
17870
17871 <nowiki>=a=</nowiki>
17872 !! html
17873 <p>=a=</p>
17874 <p>=a= </p>
17875 <p>=a= </p>
17876 <p>=a= </p>
17877 !!end
17878
17879 !! test
17880 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17881 !! options
17882 parsoid
17883 !! wikitext
17884 <nowiki>=a=
17885 b</nowiki>
17886
17887 <nowiki>=a=
17888 b</nowiki>
17889
17890 <nowiki>=a=
17891 b</nowiki>
17892
17893 <nowiki>=a=
17894 b</nowiki>
17895 !! html
17896 <p>=a=
17897 b</p>
17898 <p>=a=
17899 b</p>
17900 <p>=a=
17901 b</p>
17902 <p>=a=
17903 b</p>
17904 </p>
17905 !!end
17906
17907 !! test
17908 Headings: 6c. Heading chars in SOL context (leading newline break)
17909 !! options
17910 parsoid
17911 !! wikitext
17912 a
17913 <nowiki>=b=</nowiki>
17914 !! html
17915 <p>a
17916 =b=</p>
17917 !!end
17918
17919 !! test
17920 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17921 !! options
17922 parsoid
17923 !! wikitext
17924 <!--c0--><nowiki>=a=</nowiki>
17925
17926 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17927 !! html
17928 <p><!--c0-->=a=</p>
17929 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17930 !!end
17931
17932 !! test
17933 Headings: 6d. Heading chars in SOL context (No escaping needed)
17934 !! options
17935 parsoid=html2wt
17936 !! wikitext
17937 =a=<div>b</div>
17938 !! html
17939 =a=<div>b</div>
17940 !!end
17941
17942 #### --------------- Lists ---------------
17943 #### 0. Outside nests (*foo, etc.)
17944 #### 1. Nested inside html <ul><li>*foo</li></ul>
17945 #### 2. Inside definition lists
17946 #### 3. Only bullets at start should be escaped
17947 #### 4. No escapes needed
17948 #### 5. No unnecessary escapes
17949 #### 6. Escape bullets in SOL position
17950 #### 7. Escape bullets in a multi-line context
17951 #### ----------------------------------------
17952
17953 !! test
17954 Lists: 0. Outside nests
17955 !! wikitext
17956 <nowiki>*</nowiki>foo
17957
17958 <nowiki>#</nowiki>foo
17959 !! html
17960 <p>*foo
17961 </p><p>#foo
17962 </p>
17963 !!end
17964
17965 !! test
17966 Lists: 1. Nested inside html
17967 !! wikitext
17968 *<nowiki>*foo</nowiki>
17969
17970 *<nowiki>#foo</nowiki>
17971
17972 *<nowiki>:foo</nowiki>
17973
17974 *<nowiki>;foo</nowiki>
17975
17976 #<nowiki>*foo</nowiki>
17977
17978 #<nowiki>#foo</nowiki>
17979
17980 #<nowiki>:foo</nowiki>
17981
17982 #<nowiki>;foo</nowiki>
17983 !! html
17984 <ul>
17985 <li>*foo
17986 </li>
17987 </ul>
17988 <ul>
17989 <li>#foo
17990 </li>
17991 </ul>
17992 <ul>
17993 <li>:foo
17994 </li>
17995 </ul>
17996 <ul>
17997 <li>;foo
17998 </li>
17999 </ul>
18000 <ol>
18001 <li>*foo
18002 </li>
18003 </ol>
18004 <ol>
18005 <li>#foo
18006 </li>
18007 </ol>
18008 <ol>
18009 <li>:foo
18010 </li>
18011 </ol>
18012 <ol>
18013 <li>;foo
18014 </li>
18015 </ol>
18016
18017 !!end
18018
18019 !! test
18020 Lists: 2. Inside definition lists
18021 !! wikitext
18022 ;<nowiki>;foo</nowiki>
18023
18024 ;<nowiki>:foo</nowiki>
18025
18026 ;<nowiki>:foo</nowiki>
18027 :bar
18028
18029 :<nowiki>:foo</nowiki>
18030 !! html
18031 <dl>
18032 <dt>;foo
18033 </dt>
18034 </dl>
18035 <dl>
18036 <dt>:foo
18037 </dt>
18038 </dl>
18039 <dl>
18040 <dt>:foo
18041 </dt>
18042 <dd>bar
18043 </dd>
18044 </dl>
18045 <dl>
18046 <dd>:foo
18047 </dd>
18048 </dl>
18049
18050 !!end
18051
18052 !! test
18053 Lists: 3. Only bullets at start of text should be escaped
18054 !! wikitext
18055 *<nowiki>*foo*bar</nowiki>
18056
18057 *<nowiki>*foo</nowiki>''it''*bar
18058 !! html
18059 <ul>
18060 <li>*foo*bar
18061 </li>
18062 </ul>
18063 <ul>
18064 <li>*foo<i>it</i>*bar
18065 </li>
18066 </ul>
18067
18068 !!end
18069
18070 !! test
18071 Lists: 4. No escapes needed
18072 !! options
18073 parsoid
18074 !! wikitext
18075 *foo*bar
18076
18077 *''foo''*bar
18078
18079 *[[Foo]]: bar
18080
18081 *[[Foo]]*bar
18082 !! html
18083 <ul>
18084 <li>foo*bar
18085 </li>
18086 </ul>
18087 <ul>
18088 <li><i>foo</i>*bar
18089 </li>
18090 </ul>
18091 <ul>
18092 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18093 </li>
18094 </ul>
18095 <ul>
18096 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18097 </li>
18098 </ul>
18099 !!end
18100
18101 !! test
18102 Lists: 5. No unnecessary escapes
18103 !! wikitext
18104 * bar <span><nowiki>[[foo]]</nowiki></span>
18105
18106 *=bar <span><nowiki>[[foo]]</nowiki></span>
18107
18108 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18109
18110 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18111
18112 *=bar <span>foo]]</span>=
18113
18114 * <s></s>: a
18115 !! html
18116 <ul>
18117 <li> bar <span>[[foo]]</span>
18118 </li>
18119 </ul>
18120 <ul>
18121 <li>=bar <span>[[foo]]</span>
18122 </li>
18123 </ul>
18124 <ul>
18125 <li>[[bar <span>[[foo]]</span>
18126 </li>
18127 </ul>
18128 <ul>
18129 <li>]]bar <span>[[foo]]</span>
18130 </li>
18131 </ul>
18132 <ul>
18133 <li>=bar <span>foo]]</span>=
18134 </li>
18135 </ul>
18136 <ul>
18137 <li> <s></s>: a
18138 </li>
18139 </ul>
18140
18141 !!end
18142
18143 !! test
18144 Lists: 6. Escape bullets in SOL position
18145 !! options
18146 parsoid
18147 !! wikitext
18148 <!--cmt--><nowiki>*foo</nowiki>
18149 !! html
18150 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18151 !!end
18152
18153 !! test
18154 Lists: 7. Escape bullets in a multi-line context
18155 !! wikitext
18156 a
18157 <nowiki>*</nowiki>b
18158 !! html
18159 <p>a
18160 *b
18161 </p>
18162 !!end
18163
18164 #### --------------- HRs ---------------
18165 #### 1. Single line
18166 #### -----------------------------------
18167
18168 !! test
18169 HRs: 1. Single line
18170 !! options
18171 parsoid
18172 !! wikitext
18173 ----<nowiki>----</nowiki>
18174 ----=foo=
18175 ----*foo
18176 !! html
18177 <hr><span typeof="mw:Nowiki">----</span>
18178 <hr>=foo=
18179 <hr>*foo
18180 !! end
18181
18182 #### --------------- Tables ---------------
18183 #### 1a. Simple example
18184 #### 1b. No escaping needed (!foo)
18185 #### 1c. No escaping needed (|foo)
18186 #### 1d. No escaping needed (|}foo)
18187 ####
18188 #### 2a. Nested in td (<td>foo|bar</td>)
18189 #### 2b. Nested in td (<td>foo||bar</td>)
18190 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18191 ####
18192 #### 3a. Nested in th (<th>foo!bar</th>)
18193 #### 3b. Nested in th (<th>foo!!bar</th>)
18194 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18195 ####
18196 #### 4a. Escape -
18197 #### 4b. Escape +
18198 #### 4c. No escaping needed
18199 #### --------------------------------------
18200
18201 !! test
18202 Tables: 1a. Simple example
18203 !! wikitext
18204 <nowiki>{|
18205 |}</nowiki>
18206 !! html
18207 <p>{|
18208 |}
18209 </p>
18210 !! end
18211
18212 !! test
18213 Tables: 1b. No escaping needed
18214 !! wikitext
18215 !foo
18216 !! html
18217 <p>!foo
18218 </p>
18219 !! end
18220
18221 !! test
18222 Tables: 1c. No escaping needed
18223 !! wikitext
18224 |foo
18225 !! html
18226 <p>|foo
18227 </p>
18228 !! end
18229
18230 !! test
18231 Tables: 1d. No escaping needed
18232 !! wikitext
18233 |}foo
18234 !! html
18235 <p>|}foo
18236 </p>
18237 !! end
18238
18239 !! test
18240 Tables: 2a. Nested in td
18241 !! options
18242 parsoid=html2wt
18243 !! wikitext
18244 {|
18245 |<nowiki>foo|bar</nowiki>
18246 |-
18247 |x<div><nowiki>a|b</nowiki></div>
18248 |}
18249 !! html
18250 <table><tbody><tr>
18251 <td>foo|bar</td></tr>
18252 <tr><td>x<div>a|b</div></td>
18253 </tbody></table>
18254 !! end
18255
18256 !! test
18257 Tables: 2b. Nested in td
18258 !! options
18259 parsoid
18260 !! wikitext
18261 {|
18262 |<nowiki>foo||bar</nowiki>
18263 |''it''<nowiki>foo||bar</nowiki>
18264 |}
18265 !! html
18266 <table><tbody><tr>
18267 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18268 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18269 !! end
18270
18271 !! test
18272 Tables: 2c. Nested in td -- no escaping needed
18273 !! options
18274 parsoid
18275 !! wikitext
18276 {|
18277 |foo!!bar
18278 |}
18279 !! html
18280 <table><tbody><tr><td>foo!!bar
18281 </td></tr></tbody></table>
18282
18283 !! end
18284
18285 !! test
18286 Tables: 3a. Nested in th
18287 !! options
18288 parsoid
18289 !! wikitext
18290 {|
18291 !foo!bar
18292 |}
18293 !! html
18294 <table><tbody><tr><th>foo!bar
18295 </th></tr></tbody></table>
18296
18297 !! end
18298
18299 !! test
18300 Tables: 3b. Nested in th
18301 !! options
18302 parsoid
18303 !! wikitext
18304 {|
18305 !<nowiki>foo!!bar</nowiki>
18306 |}
18307 !! html
18308 <table>
18309 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18310 </tbody></table>
18311 !! end
18312
18313 !! test
18314 Tables: 3c. Nested in th -- no escaping needed
18315 !! options
18316 parsoid
18317 !! wikitext
18318 {|
18319 !<nowiki>foo||bar</nowiki>
18320 |}
18321 !! html
18322 <table><tbody><tr>
18323 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18324 !! end
18325
18326 !! test
18327 Tables: 4a. Escape -
18328 !! options
18329 parsoid
18330 !! wikitext
18331 {|
18332 !-bar
18333 |-
18334 |<nowiki>-bar</nowiki>
18335 |}
18336 !! html
18337 <table><tbody>
18338 <tr><th>-bar</th></tr>
18339 <tr>
18340 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18341 !! end
18342
18343 !! test
18344 Tables: 4b. Escape +
18345 !! options
18346 parsoid
18347 !! wikitext
18348 {|
18349 !+bar
18350 |-
18351 |<nowiki>+bar</nowiki>
18352 |}
18353 !! html
18354 <table><tbody>
18355 <tr><th>+bar</th></tr>
18356 <tr>
18357 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18358 !! end
18359
18360 !! test
18361 Tables: 4c. No escaping needed
18362 !! options
18363 parsoid
18364 !! wikitext
18365 {|
18366 |foo-bar
18367 |foo+bar
18368 |-
18369 |''foo''-bar
18370 |''foo''+bar
18371 |-
18372 |foo
18373 bar|baz
18374 +bar
18375 -bar
18376 |-
18377 |x
18378 <div>a|b</div>
18379 |}
18380 !! html
18381 <table><tbody>
18382 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18383 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18384 <tr><td>foo
18385 <p>bar|baz
18386 +bar
18387 -bar</p></td></tr>
18388 <tr><td>x
18389 <div>a|b</div></td>
18390 </tbody></table>
18391 !! end
18392
18393 !! test
18394 Tables: 4d. No escaping needed
18395 !! options
18396 parsoid
18397 !! wikitext
18398 {|
18399 |[[Foo]]-bar
18400 ||+1
18401 ||-2
18402 |}
18403 !! html
18404 <table>
18405 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18406 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18407 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18408 </tbody></table>
18409 !! end
18410
18411 !! test
18412 Tables: Digest broken attributes on table and tr tag
18413 !! options
18414 parsoid=wt2html
18415 !! wikitext
18416 {| || |} ++
18417 |- || || ++ --
18418 |- > [
18419 |}
18420 !! html
18421 <table>
18422 <tbody>
18423 <tr></tr>
18424 <tr></tr>
18425 </tbody></table>
18426 !! end
18427
18428 #### --------------- Links ----------------
18429 #### 1. Quote marks in link text
18430 #### 2. Wikilinks: Escapes needed
18431 #### 3. Wikilinks: No escapes needed
18432 #### 4. Extlinks: Escapes needed
18433 #### 5. Extlinks: No escapes needed
18434 #### --------------------------------------
18435 !! test
18436 Links 1. Quote marks in link text
18437 !! options
18438 parsoid
18439 !! wikitext
18440 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18441 !! html
18442 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18443 !! end
18444
18445 !! test
18446 Links 2. WikiLinks: Escapes needed
18447 !! options
18448 parsoid
18449 !! wikitext
18450 [[Foo|[Foobar]]]
18451 [[Foo|<nowiki>Foobar]</nowiki>]]
18452 [[Foo|x [Foobar] x]]
18453 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18454 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18455 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18456 [[Foo|<nowiki>|Bar</nowiki>]]
18457 [[Foo|<nowiki>]]bar</nowiki>]]
18458 [[Foo|<nowiki>[[bar</nowiki>]]
18459 [[Foo|<nowiki>x [[ y</nowiki>]]
18460 [[Foo|<nowiki>x ]] y</nowiki>]]
18461 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18462 !! html
18463 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18464 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18465 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18466 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18467 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18468 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18469 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18470 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18471 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18472 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18473 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18474 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18475 !! end
18476
18477 !! test
18478 Links 3. WikiLinks: No escapes needed
18479 !! options
18480 parsoid
18481 !! wikitext
18482 [[Foo|[Foobar]]
18483 [[Foo|foo|bar]]
18484 !! html
18485 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18486 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18487 !! end
18488
18489 !! test
18490 Links 4. ExtLinks: Escapes needed
18491 !! options
18492 parsoid
18493 !! wikitext
18494 [http://google.com <nowiki>[google]</nowiki>]
18495 [http://google.com <nowiki>google]</nowiki>]
18496
18497 <nowiki>[http://google.com]</nowiki>
18498
18499 <nowiki>[http://google.com google]</nowiki>
18500
18501 !! html
18502 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18503 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18504 <p>[http://google.com]</p>
18505 <p>[http://google.com google]</p>
18506 !! end
18507
18508 !! test
18509 Links 5. ExtLinks: No escapes needed
18510 !! options
18511 parsoid
18512 !! wikitext
18513 [http://google.com [google]
18514 !! html
18515 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18516 !! end
18517
18518 #### --------------- Quotes ---------------
18519 #### 1. Quotes inside <b> and <i>
18520 #### 2. Link fragments separated by <i> and <b> tags
18521 #### 3. Link fragments inside <i> and <b>
18522 #### 4. No escaping needed
18523 #### --------------------------------------
18524 !! test
18525 1. Quotes inside <b> and <i>
18526 !! options
18527 parsoid=html2wt,wt2wt
18528 !! wikitext
18529 ''<nowiki>'foo'</nowiki>''
18530 ''<nowiki>''foo''</nowiki>''
18531 ''<nowiki>'''foo'''</nowiki>''
18532 ''foo''<nowiki/>'s
18533 '''<nowiki>'foo'</nowiki>'''
18534 '''<nowiki>''foo''</nowiki>'''
18535 '''<nowiki>'''foo'''</nowiki>'''
18536 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18537 '''foo'''<nowiki/>'s
18538 '''foo''
18539 ''foo''<nowiki/>'
18540 '<nowiki/>''foo''<nowiki/>'
18541 ''''foo'''
18542 '''foo'''<nowiki/>'
18543 '<nowiki/>'''foo'''<nowiki/>'
18544 ''fools'<span> errand</span>''
18545 ''<span>fool</span>'s errand''
18546 !! html
18547 <p><i>'foo'</i>
18548 <i>''foo''</i>
18549 <i>'''foo'''</i>
18550 <i>foo</i>'s
18551 <b>'foo'</b>
18552 <b>''foo''</b>
18553 <b>'''foo'''</b>
18554 <b>foo'<i>bar'</i>baz</b>
18555 <b>foo</b>'s
18556 '<i>foo</i>
18557 <i>foo</i>'
18558 '<i>foo</i>'
18559 '<b>foo</b>
18560 <b>foo</b>'
18561 '<b>foo</b>'</p>
18562 <i>fools'<span> errand</span></i>
18563 <i><span>fool</span>'s errand</i>
18564 !! end
18565
18566 !! test
18567 2. Link fragments separated by <i> and <b> tags
18568 !! wikitext
18569 [[''foo''<nowiki>hello]]</nowiki>
18570
18571 [['''foo'''<nowiki>hello]]</nowiki>
18572 !! html
18573 <p>[[<i>foo</i>hello]]
18574 </p><p>[[<b>foo</b>hello]]
18575 </p>
18576 !! end
18577
18578 !! test
18579 3. Link fragments inside <i> and <b>
18580 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18581 this is one of the shortcomings of this format)
18582 !! wikitext
18583 ''[[foo''<nowiki>]]</nowiki>
18584
18585 '''[[foo'''<nowiki>]]</nowiki>
18586 !! html
18587 <p><i>[[foo</i>]]
18588 </p><p><b>[[foo</b>]]
18589 </p>
18590 !! end
18591
18592 !! test
18593 4. No escaping needed
18594 !! wikitext
18595 '<span>''bar''</span>'
18596 '<span>'''bar'''</span>'
18597 !! html
18598 <p>'<span><i>bar</i></span>'
18599 '<span><b>bar</b></span>'
18600 </p>
18601 !! end
18602
18603 #### ----------- Paragraphs ---------------
18604 #### 1. No unnecessary escapes
18605 #### --------------------------------------
18606
18607 !! test
18608 1. No unnecessary escapes
18609 !! wikitext
18610 bar <span><nowiki>[[foo]]</nowiki></span>
18611
18612 =bar <span><nowiki>[[foo]]</nowiki></span>
18613
18614 [[bar <span><nowiki>[[foo]]</nowiki></span>
18615
18616 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18617
18618 =bar <span>foo]]</span><nowiki>=</nowiki>
18619 !! html
18620 <p>bar <span>[[foo]]</span>
18621 </p><p>=bar <span>[[foo]]</span>
18622 </p><p>[[bar <span>[[foo]]</span>
18623 </p><p>]]bar <span>[[foo]]</span>
18624 </p><p>=bar <span>foo]]</span>=
18625 </p>
18626 !!end
18627
18628 #### ----------------------- PRE --------------------------
18629 #### 1. Leading whitespace in SOL context should be escaped
18630 #### ------------------------------------------------------
18631 !! test
18632 1. Leading whitespace in SOL context should be escaped
18633 !! options
18634 parsoid
18635 !! wikitext
18636 <nowiki> </nowiki>a
18637
18638 <nowiki> </nowiki> a
18639
18640 <nowiki> </nowiki>a(tab)
18641
18642 <nowiki> </nowiki> a
18643 <!--cmt-->
18644 <nowiki> </nowiki> a
18645
18646 a
18647 <nowiki> </nowiki>b
18648
18649 a
18650 <nowiki> </nowiki>b
18651
18652 a
18653 <nowiki> </nowiki> b
18654 !! html
18655 <p> a</p>
18656 <p> a</p>
18657 <p> a(tab)</p>
18658 <p> a</p>
18659 <p><!--cmt--> a</p>
18660 <p>a
18661 b</p>
18662 <p>a
18663 b</p>
18664 <p>a
18665 b</p>
18666 !! end
18667
18668 #### --------------- Behavior Switches --------------------
18669 !! test
18670 1. Valid behavior switches should be escaped
18671 !! options
18672 parsoid=html2wt
18673 !! wikitext
18674 <nowiki>__TOC__</nowiki>
18675 !! html
18676 __TOC__
18677 !! end
18678
18679 !! test
18680 2. Invalid behavior switches should not be escaped
18681 !! options
18682 parsoid=html2wt
18683 !! wikitext
18684 __TOO__
18685 __|__
18686 !! html
18687 __TOO__
18688 __|__
18689 !! end
18690
18691 #### --------------- HTML tags ---------------
18692 #### 1. a tags
18693 #### 2. other tags
18694 #### 3. multi-line html tag
18695 #### 4. extension tags
18696 #### -----------------------------------------
18697 !! test
18698 1. a tags
18699 !! options
18700 parsoid
18701 !! wikitext
18702 <a href="http://google.com">google</a>
18703 !! html
18704 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18705 !! end
18706
18707 !! test
18708 2. other tags
18709 !! wikitext
18710 <nowiki><div>foo</div>
18711 <div style="color:red">foo</div></nowiki>
18712 !! html
18713 <p>&lt;div&gt;foo&lt;/div&gt;
18714 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18715 </p>
18716 !! end
18717
18718 !! test
18719 3. multi-line html tag
18720 !! wikitext
18721 <nowiki><div
18722 >foo</div
18723 ></nowiki>
18724 !! html
18725 <p>&lt;div
18726 &gt;foo&lt;/div
18727 &gt;
18728 </p>
18729 !! end
18730
18731 !! test
18732 4. extension tags
18733 !! wikitext
18734 <nowiki><ref>foo</ref></nowiki>
18735
18736 <nowiki><ref>bar</nowiki>
18737
18738 baz<nowiki></ref></nowiki>
18739 !! html
18740 <p>&lt;ref&gt;foo&lt;/ref&gt;
18741 </p><p>&lt;ref&gt;bar
18742 </p><p>baz&lt;/ref&gt;
18743 </p>
18744 !! end
18745
18746 #### --------------- Others ---------------
18747 !! test
18748 Escaping nowikis
18749 !! wikitext
18750 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18751 !! html
18752 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18753 </p>
18754 !! end
18755
18756 ## The quote-char in the input is necessary for triggering the bug
18757 !! test
18758 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18759 !! options
18760 parsoid=wt2wt,html2wt
18761 !! wikitext
18762 foo's bar :
18763 !! html
18764 <p>foo's bar :</p>
18765 !! end
18766
18767 !! test
18768
18769 Tag-like HTML structures are passed through as text
18770 !! wikitext
18771 <x y>
18772
18773 <x.y>
18774
18775 <x-y>
18776
18777 1>2
18778
18779 x<y
18780
18781 a>b
18782
18783 1<d e>f
18784 !! html
18785 <p>&lt;x y&gt;
18786 </p><p>&lt;x.y&gt;
18787 </p><p>&lt;x-y&gt;
18788 </p><p>1&gt;2
18789 </p><p>x&lt;y
18790 </p><p>a&gt;b
18791 </p><p>1&lt;d e&gt;f
18792 </p>
18793 !! end
18794
18795
18796 # This was a bug in the PHP parser (see bug 17663 and its dups,
18797 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18798 !! test
18799 Tag names followed by punctuation should not be recognized as tags
18800 !! wikitext
18801 <s.ome> text
18802 !! html
18803 <p>&lt;s.ome&gt; text
18804 </p>
18805 !! end
18806
18807 !! test
18808 HTML tag with necessary entities in attributes
18809 !! wikitext
18810 <span title="&amp;amp;">foo</span>
18811 !! html
18812 <p><span title="&amp;amp;">foo</span>
18813 </p>
18814 !! end
18815
18816 !! test
18817 HTML tag with 'unnecessary' entity encoding in attributes
18818 !! wikitext
18819 <span title="&amp;">foo</span>
18820 !! html
18821 <p><span title="&amp;">foo</span>
18822 </p>
18823 !! end
18824
18825 !! test
18826 HTML tag with broken attribute value quoting
18827 !! wikitext
18828 <span title="Hello world>Foo</span>
18829 !! html
18830 <p><span>Foo</span>
18831 </p>
18832 !! end
18833
18834 !! test
18835 Parsoid-only: HTML tag with broken attribute value quoting
18836 !! options
18837 parsoid
18838 !! wikitext
18839 <span title="Hello world>Foo</span>
18840 !! html
18841 <p><span title="Hello world">Foo</span>
18842 </p>
18843 !! end
18844
18845 !! test
18846 Table with broken attribute value quoting
18847 !! wikitext
18848 {|
18849 | title="Hello world|Foo
18850 |}
18851 !! html
18852 <table>
18853 <tr>
18854 <td>Foo
18855 </td></tr></table>
18856
18857 !! end
18858
18859 !! test
18860 Table with broken attribute value quoting on consecutive lines
18861 !! wikitext
18862 {|
18863 | title="Hello world|Foo
18864 | style="color:red|Bar
18865 |}
18866 !! html
18867 <table>
18868 <tr>
18869 <td>Foo
18870 </td>
18871 <td>Bar
18872 </td></tr></table>
18873
18874 !! end
18875
18876 !! test
18877 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18878 !! options
18879 parsoid
18880 !! wikitext
18881 {|
18882 | title="Hello world|Foo
18883 | style="color:red|Bar
18884 |}
18885 !! html
18886 <table><tbody>
18887 <tr>
18888 <td title="Hello world">Foo
18889 </td><td style="color: red">Bar
18890 </td></tr></tbody></table>
18891
18892 !! end
18893
18894 !! test
18895 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18896 !! options
18897 parsoid
18898 !! wikitext
18899 {{}}
18900 !! html
18901 {{}}
18902 !! end
18903
18904 !! test
18905 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18906 !! options
18907 parsoid
18908 !! wikitext
18909 }}{{
18910 !! html
18911 }}{{
18912 !! end
18913
18914 !!test
18915 Accept empty td cell attribute
18916 !! wikitext
18917 {|
18918 | align="center" | foo || |
18919 |}
18920 !! html
18921 <table>
18922 <tr>
18923 <td align="center"> foo </td>
18924 <td>
18925 </td></tr></table>
18926
18927 !!end
18928
18929 !!test
18930 Non-empty attributes in th-cells
18931 !! wikitext
18932 {|
18933 ! Foo !! style="color: red" | Bar
18934 |}
18935 !! html
18936 <table>
18937 <tr>
18938 <th> Foo </th>
18939 <th style="color: red"> Bar
18940 </th></tr></table>
18941
18942 !!end
18943
18944 !!test
18945 Accept empty attributes in th-cells
18946 !! wikitext
18947 {|
18948 !| foo !!| bar
18949 |}
18950 !! html
18951 <table>
18952 <tr>
18953 <th> foo </th>
18954 <th> bar
18955 </th></tr></table>
18956
18957 !!end
18958
18959 !!test
18960 Empty table rows go away
18961 !! wikitext
18962 {|
18963 | Hello
18964 | there
18965 |- class="foo"
18966 |-
18967 |}
18968 !! html
18969 <table>
18970 <tr>
18971 <td> Hello
18972 </td>
18973 <td> there
18974 </td></tr>
18975
18976 </table>
18977
18978 !! end
18979
18980 ###
18981 ### Parsoid-centric tests for testing RTing of inter-element separators
18982 ### Edge cases not tested by existing parser tests and specific to
18983 ### Parsoid-specific serialization strategies.
18984 ###
18985
18986 !!test
18987 RT-ed inter-element separators should be valid separators
18988 !! wikitext
18989 {|
18990 |- [[foo]]
18991 |}
18992 !! html
18993 <table>
18994
18995 </table>
18996
18997 !!end
18998
18999 !!test
19000 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19001 (Parsoid-only since PHP parser relies on Tidy for correct output)
19002 !!options
19003 parsoid
19004 !! wikitext
19005 {|
19006 |<small>foo
19007 bar
19008 |}
19009
19010 {|
19011 |<small>foo<small>
19012 |}
19013 !! html
19014 !!end
19015
19016 !!test
19017 Empty TD followed by TD with tpl-generated attribute
19018 !! wikitext
19019 {|
19020 |-
19021 |
19022 |{{echo|style='color:red'}}|foo
19023 |}
19024 !! html
19025 <table>
19026
19027 <tr>
19028 <td>
19029 </td>
19030 <td>foo
19031 </td></tr></table>
19032
19033 !!end
19034
19035 !!test
19036 Indented table with an empty td
19037 !! wikitext
19038 {|
19039 |-
19040 |
19041 |foo
19042 |}
19043 !! html
19044 <table>
19045
19046 <tr>
19047 <td>
19048 </td>
19049 <td>foo
19050 </td></tr></table>
19051
19052 !!end
19053
19054 !!test
19055 Empty TR followed by a template-generated TR
19056 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19057 !!options
19058 parsoid
19059 !! wikitext
19060 {|
19061 |-
19062 {{echo|<tr><td>foo</td></tr>}}
19063 |}
19064 !! html
19065 <table>
19066 <tbody>
19067 <tr></tr>
19068 <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}}]}'>
19069 <td>foo</td></tr>
19070 </tbody></table>
19071 !!end
19072
19073 ## PHP and parsoid output differ for this, and since this is primarily
19074 ## for testing Parsoid's serializer, marking this Parsoid only
19075 !!test
19076 Empty TR followed by mixed-ws-comment line should RT correctly
19077 !!options
19078 parsoid
19079 !! wikitext
19080 {|
19081 |-
19082 <!--c-->
19083 |-
19084 <!--c--> <!--d-->
19085 |}
19086 !! html
19087 <table>
19088 <tbody>
19089 <tr></tr>
19090 <!--c-->
19091 <tr>
19092 <!--c--> </tr><!--d-->
19093 </tbody></table>
19094
19095 !!end
19096
19097 !!test
19098 Multi-line image caption generated by templates with/without trailing newlines
19099 !!options
19100 parsoid
19101 !! wikitext
19102 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19103 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19104 !! html
19105 <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>
19106 <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>
19107
19108 !!end
19109
19110 ## PHP emits broken html for this, and since this is primarily
19111 ## a Parsoid serializer test, marking this Parsoid only
19112 !!test
19113 Improperly nested inline or quotes tags with whitespace in between
19114 !!options
19115 parsoid
19116 !! wikitext
19117 <span> <s>x</span> </s>
19118 ''' ''x''' ''
19119 !! html
19120 <p><span> <s>x</s></span><s> </s>
19121 <b> <i>x</i></b><i> </i>
19122 </p>
19123 !!end
19124
19125 !!test
19126 Encapsulate protected attributes from wt
19127 !!options
19128 parsoid
19129 !! wikitext
19130 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19131 !! html
19132 <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>
19133 </body>
19134 !!end
19135
19136 ## Currently the p-wrapper is fragile in how adds / removes transformations.
19137 ## Having nested or stray pre tags results in the attempt to add duplicates,
19138 ## causing an assertion fail. This test tries to prevent that situation.
19139 !!test
19140 Ensure ParagraphWrapper can deal with stray closing pre tags
19141 !!options
19142 parsoid=wt2html
19143 !! wikitext
19144 plain text</pre>
19145 !! html
19146 plain text
19147 !!end
19148
19149 !!test
19150 1. Ensure fostered text content is wrapped in spans
19151 !!options
19152 parsoid=wt2html
19153 !! wikitext
19154 <table>hi</table><table>ho</table>
19155 !! html
19156 <span>hi</span>
19157 <table></table>
19158 <span>ho</span>
19159 <table></table>
19160 !!end
19161
19162 !!test
19163 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19164 !!options
19165 parsoid=wt2html,wt2wt
19166 !! wikitext
19167 <table>
19168 <tr> || ||
19169 <td> a
19170 </table>
19171 !! html
19172 <span> || ||</span>
19173 <table>
19174 <tbody>
19175 <tr>
19176 <td> a</td></tr>
19177 </tbody></table>
19178 !!end
19179
19180 !!test
19181 Encapsulation properly handles null DSR information from foster box
19182 !!options
19183 parsoid=wt2html,wt2wt
19184 !! wikitext
19185 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19186 !! html
19187 <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;
19188 <table>foo
19189 <tr>
19190 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19191 <table>
19192 <tbody>
19193 <tr>
19194 <td>bar</td></tr></tbody></table>
19195 !!end
19196
19197 !!test
19198 1. Encapsulate foster-parented transclusion content
19199 !!options
19200 parsoid=wt2wt,wt2html
19201 !! wikitext
19202 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19203 !! html
19204 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19205 <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
19206 <tr>
19207 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19208 <table>
19209 <tbody>
19210 <tr>
19211 <td>bar</td></tr></tbody></table>
19212 !!end
19213
19214 !!test
19215 2. Encapsulate foster-parented transclusion content
19216 !!options
19217 parsoid=wt2wt,wt2html
19218 !! wikitext
19219 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19220 !! html
19221 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19222 <table>
19223 <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>
19224 <tr>
19225 <td>bar</td></tr></table>&quot;]}">foo</div>
19226 <table>
19227 <tbody>
19228 <tr>
19229 <td>bar</td></tr></tbody></table>
19230 !!end
19231
19232 !!test
19233 3. Encapsulate foster-parented transclusion content
19234 !!options
19235 parsoid=wt2wt,wt2html
19236 !! wikitext
19237 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19238 !! html
19239 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19240 <table>
19241 <div>
19242 <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>
19243 <tr>
19244 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19245 <p>foo</p></div>
19246 <table>
19247 <tbody>
19248 <tr>
19249 <td>bar</td></tr></tbody></table>
19250 !!end
19251
19252 !!test
19253 4. Encapsulate foster-parented transclusion content
19254 !!options
19255 parsoid=wt2wt,wt2html
19256 !! wikitext
19257 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19258 !! html
19259 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19260 <table>
19261 <div>
19262 <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>
19263 <tr>
19264 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19265 <p>foo</p></div>
19266 <table>
19267 <tbody>
19268 <tr>
19269 <td>bar</td></tr></tbody></table>
19270 !!end
19271
19272 !!test
19273 5. Encapsulate foster-parented transclusion content
19274 !!options
19275 parsoid=wt2wt,wt2html
19276 !! wikitext
19277 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19278 !! html
19279 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19280 <table>
19281 <tr>
19282 <td>
19283 <div>
19284 <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>
19285 <table>
19286 <tbody>
19287 <tr>
19288 <td>
19289 <div>
19290 <p>foo</p></div></td></tr></tbody></table>
19291 !!end
19292
19293 !!test
19294 6. Encapsulate foster-parented transclusion content
19295 !!options
19296 parsoid=wt2wt,wt2html
19297 !! wikitext
19298 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19299 !! html
19300 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19301 <table>
19302 <tr>
19303 <td>
19304 <div>
19305 <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>
19306 <table>
19307 <tbody>
19308 <tr>
19309 <td>
19310 <div>
19311 <p>foo</p></div></td></tr></tbody></table>
19312 <p>ok</p>
19313 !!end
19314
19315 !!test
19316 7. Encapsulate foster-parented transclusion content
19317 !!options
19318 parsoid=wt2wt,wt2html
19319 !! wikitext
19320 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19321 !! html
19322 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19323 <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;
19324 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19325 <td>bar</td></table>&quot;]}">foo</p>
19326 <table>
19327 <tbody>
19328 <tr>
19329 <td>bar</td></tr></tbody></table>
19330 !!end
19331
19332 !!test
19333 8. Encapsulate foster-parented transclusion content
19334 !!options
19335 parsoid=wt2wt,wt2html
19336 !! wikitext
19337 {{echo|a
19338 }}{|{{echo|style='color:red'}}
19339 |-
19340 |b
19341 |}
19342 !! html
19343 <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>
19344 <table>
19345 <tbody>
19346 <tr>
19347 <td>b</td></tr></tbody></table>
19348 !!end
19349
19350 !!test
19351 Table in fosterable position
19352 !!options
19353 parsoid=wt2html,wt2wt
19354 !! wikitext
19355 {{OpenTable}}
19356 <div>
19357 {|
19358 |}
19359 </div>
19360 |}
19361 !! html
19362 <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="{}">
19363 </span>
19364 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19365
19366 <table>
19367 </table>
19368 !!end
19369
19370 !!test
19371 Support <object> element with .data attribute
19372 !!options
19373 parsoid=html2wt
19374 !! wikitext
19375 <object data="test.swf"></object>
19376 !! html
19377 <object data="test.swf"></object>
19378 !!end
19379
19380 # -----------------------------------------------------------------
19381 # The following section of tests are primarily to spec requirements
19382 # around serialization of new/edited content.
19383 #
19384 # All these tests are marked Parsoid html2wt and html2html only
19385 # ----------------------------------------------------------------
19386
19387 !! test
19388 Image: Modifying size of an image (1)
19389 !! options
19390 parsoid=html2wt
19391 !! wikitext
19392 [[Image:Foobar.jpg|200x200px]]
19393 !! html
19394 <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>
19395 !!end
19396
19397 !! test
19398 Image: Modifying size of an image (2)
19399 !! options
19400 parsoid=html2wt
19401 !! wikitext
19402 [[Image:Foobar.jpg|500x500px]]
19403 !! html
19404 <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>
19405 !!end
19406
19407 # note that the data-parsoid value conflicts with the figure's class
19408 !! test
19409 Image: Modifying alignment of an image (bug 48665)
19410 !! options
19411 parsoid=html2wt
19412 !! wikitext
19413 [[Image:Foobar.jpg|thumb|caption|left]]
19414 !! html
19415 <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>
19416 !! end
19417
19418 !! test
19419 Image: Modifying valign of an image (bug 49221)
19420 !! options
19421 parsoid=html2wt
19422 !! wikitext
19423 [[File:Foobar.jpg|20px|text-top]]
19424 !! html
19425 <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>
19426 !! end
19427
19428 !! test
19429 Image: Modifying alt attribute of an image (bug 56400)
19430 !! options
19431 parsoid=html2wt
19432 !! wikitext
19433 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19434 !! html
19435 <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>
19436 !!end
19437
19438 !! test
19439 Image: Modifying caption of an image
19440 !! options
19441 parsoid=html2wt
19442 !! wikitext
19443 [[Image:Foobar.jpg|thumb|new caption]]
19444 !! html
19445 <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>
19446 !!end
19447
19448 !! test
19449 Image: empty alt attribute (bug 48924)
19450 !! options
19451 parsoid
19452 !! wikitext
19453 [[File:Foobar.jpg|thumb|alt=|bar]]
19454 !! html
19455 <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>
19456 !! end
19457
19458 #!! test
19459 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19460 #!! options
19461 #parsoid=html2wt
19462 #language=ar
19463 #!! input
19464 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19465 #!! result
19466 #<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>
19467 #!! end
19468
19469 !! test
19470 Image: Block level image should have \n before and after
19471 !! options
19472 parsoid
19473 !! wikitext
19474 123
19475 [[File:Foobar.jpg|right|thumb|150x150px]]
19476 456
19477 !! html
19478 <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>
19479 !!end
19480
19481 !! test
19482 Image: New block level image should have \n before and after (existing
19483 content)
19484 !! options
19485 parsoid
19486 !! wikitext
19487 123
19488 [[File:Foobar.jpg|right|thumb|150x150px]]
19489 456
19490 !! html
19491 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19492 <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>
19493 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19494 !!end
19495
19496 !! test
19497 Images: upright option (parsoid)
19498 !! options
19499 parsoid
19500 !! wikitext
19501 [[File:Foobar.jpg|thumb|upright|caption]]
19502 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19503 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19504 !! html
19505 <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>
19506 !!end
19507
19508 !! test
19509 Images: upright option is ignored on inline and frame images (parsoid)
19510 !! options
19511 parsoid
19512 !! wikitext
19513 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19514 !! html
19515 <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>
19516 !!end
19517
19518 !! test
19519 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19520 !! options
19521 parsoid=html2wt
19522 !! wikitext
19523 * foo
19524 !! html
19525 <ul>
19526 <li><p>foo</p></li>
19527 </ul>
19528 !! end
19529
19530 !! test
19531 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19532 !! options
19533 parsoid=html2wt
19534 !! wikitext
19535 * foo
19536 !! html
19537 <ul> <li>foo</li></ul>
19538 !! end
19539
19540 !! test
19541 Don't strip leading whitespace when handling indent-pre suppressing tags
19542 !! options
19543 parsoid=html2wt
19544 !! wikitext
19545 {|
19546 | indented row
19547 |}
19548 <blockquote>
19549 '''This is very bold of you!'''
19550
19551 {|
19552 |
19553 indented cell (no pre-wrapping!)
19554 |}
19555 </blockquote>
19556 foo
19557 <div>bar</div>
19558 !! html
19559 <table>
19560 <tr><td> indented row</td></tr>
19561 </table>
19562 <blockquote><p>
19563 <b>This is very bold of you!</b>
19564 </p>
19565 <table><tr><td>
19566 indented cell (no pre-wrapping!)
19567 </td></tr></table>
19568 </blockquote>
19569 <p>foo</p>
19570 <div>bar</div>
19571 !! end
19572
19573 !! test
19574 Strip leading whitespace when handling indent-pre inducing tags
19575 !! options
19576 parsoid=html2wt
19577 !! wikitext
19578 foo
19579 <span>bar</span>
19580
19581 <span>foo2
19582 </span>bar2
19583
19584 <div>foo</div>
19585 <span>bar</span>
19586
19587 <div>
19588 <span>foo</span>
19589 </div>
19590 !! html
19591 <p>foo</p>
19592 <span>bar</span>
19593
19594 <span>foo2
19595 </span>bar2
19596
19597 <div>foo</div>
19598 <span>bar</span>
19599
19600 <div>
19601 <span>foo</span>
19602 </div>
19603 !! end
19604
19605 !! test
19606 Lists: Add space after bullets
19607 !! options
19608 parsoid=html2wt
19609 !! wikitext
19610 * foo
19611 * bar
19612 * <span> baz</span>
19613 !! html
19614 <ul>
19615 <li>foo</li>
19616 <li> bar</li>
19617 <li><span> baz</span></li>
19618 </ul>
19619 !! end
19620
19621 !! test
19622 Lists: Dont insert newlines in a serialized list item.
19623 !! options
19624 parsoid=html2wt
19625 !! wikitext
19626 * a<br>b
19627 * c
19628 !! html
19629 <ul><li>a<br>b</li><li>c</li></ul>
19630 !! end
19631
19632 !! test
19633 Headings: Add space before/after == (Bug 51744)
19634 !! options
19635 parsoid=html2wt
19636 !! wikitext
19637 == foo ==
19638
19639 == bar ==
19640
19641 == baz ==
19642
19643 == <span> baz</span> ==
19644 !! html
19645 <h2>foo</h2>
19646 <h2> bar</h2>
19647 <h2>baz </h2>
19648 <h2><span> baz</span></h2>
19649 !! end
19650
19651 !! test
19652 Parsoid: Serialize positional parameters with = in them as named parameter
19653 !! options
19654 parsoid=html2wt
19655 !! wikitext
19656 {{echo|1 = f=oo}}
19657
19658 {{echo|1 = f=oo|2 = bar}}
19659
19660 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19661 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19662 {{echo|<nowiki>f=oo</nowiki>|bar}}
19663 !! html
19664 <p about="#mwt1" typeof="mw:Transclusion"
19665 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19666
19667 <p about="#mwt1" typeof="mw:Transclusion"
19668 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19669
19670 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19671 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19672 <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>
19673 !! end
19674
19675 !! test
19676 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19677 !! options
19678 parsoid=html2wt
19679 !! wikitext
19680 <div>a
19681 b
19682 </div>
19683 <div>a
19684 b
19685 </div>
19686 <div>
19687 a
19688
19689 b
19690 </div>
19691 !! html
19692 <div>a<p>b</p></div>
19693 <div>a
19694 <p>b</p></div>
19695 <div>
19696 a
19697 <p>b</p></div>
19698 !! end
19699
19700 #-----------------------------
19701 # I/B quote minimization tests
19702 #-----------------------------
19703
19704 !! test
19705 1. I/B quote minimization: wikitext-only tags should be combined
19706 !! options
19707 parsoid=html2wt
19708 !! wikitext
19709 ''AB''
19710
19711 '''AB'''
19712
19713 ''A'''B'''''
19714
19715 '''A''B'''''
19716
19717 '''A''BC''D'''
19718
19719 '''''AB'''''
19720
19721 '''''AB'''''
19722
19723 '''''AB'''''
19724 !! html
19725 <p><i>A</i><i>B</i></p>
19726 <p><b>A</b><b>B</b></p>
19727 <p><i>A</i><b><i>B</i></b></p>
19728 <p><b>A</b><i><b>B</b></i></p>
19729 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19730 <p><i><b>A</b></i><i><b>B</b></i></p>
19731 <p><i><b>A</b></i><b><i>B</i></b></p>
19732 <p><b><i>A</i></b><i><b>B</b></i></p>
19733 !! end
19734
19735 !! test
19736 2. I/B quote minimization: wikitext and html tags should not be combined
19737 !! options
19738 parsoid=html2wt
19739 !! wikitext
19740 ''A''<i>B</i>
19741
19742 ''A'''''<i>B</i>'''
19743 !! html
19744 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19745 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19746 !! end
19747
19748 !! test
19749 3. I/B quote minimization: templated content stops minimization
19750 !! options
19751 parsoid=html2wt
19752 !! wikitext
19753 ''A''{{echo|''B''}}
19754
19755 ''A''{{echo|'''''B'''''}}
19756 !! html
19757 <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>
19758 <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>
19759 !! end
19760
19761 !! test
19762 4. I/B quote minimization: new content should be mimimized with adjacent old content
19763 !! options
19764 parsoid=html2wt
19765 !! wikitext
19766 ''AB''
19767
19768 '''AB'''
19769
19770 ''A'''B'''''
19771 !! html
19772 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19773 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19774 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19775 !! end
19776
19777 #------------------------------------
19778 # End of I/B quote minimization tests
19779 #------------------------------------
19780
19781 !!test
19782 Bug 54262: New entities
19783 !! options
19784 parsoid=html2wt
19785 !! wikitext
19786 foo
19787 !! html
19788 <span typeof="mw:Entity">foo</span>
19789 !! end
19790
19791 ## Note that there is no wikitext output for 'unknownproperty' ##
19792 ## Unknown magic words are silently dropped ##
19793
19794 !! test
19795 Magic words
19796 !! options
19797 parsoid=html2wt
19798 !! wikitext
19799 __TOC__
19800 __NOTOC__
19801 __FORCETOC__
19802 __INDEX__
19803 __NOINDEX__
19804 __NOGALLERY__
19805 __NOEDITSECTION__
19806 __NOTITLECONVERT__
19807 __NOCONTENTCONVERT__
19808 !! html
19809 <meta property='mw:PageProp/toc' />
19810 <meta property='mw:PageProp/notoc' />
19811 <meta property='mw:PageProp/forcetoc' />
19812 <meta property='mw:PageProp/index' />
19813 <meta property='mw:PageProp/noindex' />
19814 <meta property='mw:PageProp/nogallery' />
19815 <meta property='mw:PageProp/noeditsection' />
19816 <meta property='mw:PageProp/notitleconvert' />
19817 <meta property='mw:PageProp/nocontentconvert' />
19818 <meta property='mw:PageProp/unknownproperty' />
19819 !! end
19820
19821 !! test
19822 Consecutive <pre>s should not get merged
19823 !! options
19824 parsoid=html2wt,html2html
19825 !! wikitext
19826 a
19827
19828 b
19829
19830 c
19831
19832 d
19833
19834 e
19835
19836
19837
19838 f
19839 !! html
19840 <pre>a</pre><pre>b</pre>
19841
19842 <pre>c
19843 </pre><pre>
19844 d</pre>
19845
19846 <pre>e
19847
19848 </pre><pre>
19849
19850 f</pre>
19851 !! end
19852
19853 !! test
19854 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
19855 !! options
19856 parsoid=html2wt
19857 !! wikitext
19858 [[Special:BookSources/1234567890|ISBN 1234567895]]
19859 !! html
19860 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
19861 !! end
19862
19863 !! test
19864 Edited RFC links not serializable as RFC links should serialize as extlinks
19865 !! options
19866 parsoid=html2wt
19867 !! wikitext
19868 [//tools.ietf.org/html/rfc123 New RFC]
19869 !! html
19870 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
19871 !! end
19872
19873 !! test
19874 Edited PMID links not serializable as PMID links should serialize as extlinks
19875 !! options
19876 parsoid=html2wt
19877 !! wikitext
19878 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
19879 !! html
19880 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
19881 !! end
19882
19883 !! test
19884 Edited Redirect link should emit a non-piped wikitext link
19885 !! options
19886 parsoid=html2wt
19887 !! wikitext
19888 #REDIRECT [[Bar]]
19889 !! html
19890 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
19891 !! end
19892
19893 # -----------------------------------------------------------------
19894 # End of section for Parsoid-only html2wt tests for serialization
19895 # of new content
19896 # -----------------------------------------------------------------
19897
19898 TODO:
19899 more images
19900 more tables
19901 character entities
19902 and much more
19903 Try for 100% code coverage