9a0b3fb9613ae8ab899bed3692347aa94a997ff8
[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 # thumbsize=NNN set the default thumb size to NNNpx for this test
31 #
32 # You can also set the following parser properties via test options:
33 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
34 # wgLinkHolderBatchSize, wgRawHtml
35 #
36 # For testing purposes, temporary articles can created:
37 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
38 # where '/' denotes a newline.
39
40 # This is the standard article assumed to exist.
41 !! article
42 Main Page
43 !! text
44 blah blah
45 !! endarticle
46
47 !!article
48 Template:Foo
49 !!text
50 FOO
51 !!endarticle
52
53 !! article
54 Template:Blank
55 !! text
56 !! endarticle
57
58 !! article
59 Template:pipe
60 !! text
61 |
62 !! endarticle
63
64 !!article
65 MediaWiki:bad image list
66 !!text
67 * [[File:Bad.jpg]] except [[Nasty page]]
68 !!endarticle
69
70 !! article
71 Template:inner list
72 !! text
73 * item 1
74 !! endarticle
75
76 !! article
77 Template:tbl-start
78 !! text
79 {|
80 !! endarticle
81
82 !! article
83 Template:tbl-end
84 !! text
85 |}
86 !! endarticle
87
88 !! article
89 Template:!
90 !! text
91 |
92 !! endarticle
93
94 !! article
95 Template:echo
96 !! text
97 {{{1}}}
98 !! endarticle
99
100 !! article
101 Template:echo_with_span
102 !! text
103 <span>{{{1}}}</span>
104 !! endarticle
105
106 !! article
107 Template:echo_with_div
108 !! text
109 <div>{{{1}}}</div>
110 !! endarticle
111
112 !! article
113 Template:attr_str
114 !! text
115 {{{1}}}="{{{2}}}"
116 !! endarticle
117
118 !! article
119 Template:table_attribs
120 !! text
121 <noinclude>
122 |</noinclude>style="color: red"| Foo
123 !! endarticle
124
125 !! article
126 Template:table_cells
127 !! text
128 {{table_attribs}} || Bar || Baz
129 !! endarticle
130
131 !! article
132 Template:image_attribs
133 !! text
134 <noinclude>
135 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
136 !! endarticle
137
138 !! article
139 A?b
140 !! text
141 Weirdo titles!
142 !! endarticle
143
144 !!article
145 Template:Bullet
146 !!text
147 * Bar
148 !!endarticle
149
150 !!article
151 Template:OpenTable
152 !!text
153 {|
154 !!endarticle
155
156 ###
157 ### Basic tests
158 ###
159 !! test
160 Blank input
161 !! wikitext
162 !! html
163 !! end
164
165
166 !! test
167 Simple paragraph
168 !! wikitext
169 This is a simple paragraph.
170 !! html
171 <p>This is a simple paragraph.
172 </p>
173 !! end
174
175 !! test
176 Paragraphs with extra newline spacing
177 !! wikitext
178 foo
179
180 bar
181
182
183 baz
184
185
186
187 booz
188 !! html
189 <p>foo
190 </p><p>bar
191 </p><p><br />
192 baz
193 </p><p><br />
194 </p><p>booz
195 </p>
196 !! end
197
198 !! test
199 Paragraphs with newline spacing with comment lines in between
200 !! wikitext
201 ----
202 a
203 <!--foo-->
204 b
205 ----
206 a
207 <!--foo--><!--More than 1 comment, still stripped-->
208 b
209 ----
210 a
211 <!--foo--> <!----> <!-- bar -->
212 b
213 ----
214 a
215 <!--foo-->
216
217 b
218 ----
219 a
220
221 <!--foo-->
222 b
223 ----
224 a
225 <!--foo-->
226
227
228 b
229 ----
230 a
231
232
233 <!--foo-->
234 b
235 ----
236 !! html
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 b
244 </p>
245 <hr />
246 <p>a
247 b
248 </p>
249 <hr />
250 <p>a
251 </p><p>b
252 </p>
253 <hr />
254 <p>a
255 </p><p>b
256 </p>
257 <hr />
258 <p>a
259 </p><p><br />
260 b
261 </p>
262 <hr />
263 <p>a
264 </p><p><br />
265 b
266 </p>
267 <hr />
268
269 !! end
270
271 !! test
272 Paragraphs with newline spacing with non-empty white-space lines in between
273 !! wikitext
274 ----
275 a
276
277 b
278 ----
279 a
280
281
282 b
283 ----
284 !! html
285 <hr />
286 <p>a
287 </p><p>b
288 </p>
289 <hr />
290 <p>a
291 </p><p><br />
292 b
293 </p>
294 <hr />
295
296 !! end
297
298 !! test
299 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
300 !! wikitext
301 ----
302 a
303 <!--foo-->
304 b
305 ----
306 a
307 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
308 b
309 ----
310 a
311
312 <!--foo-->
313 <!--bar-->
314 b
315 ----
316 a
317
318 <!--foo-->
319 <!--bar-->
320
321 b
322 ----
323 !! html
324 <hr />
325 <p>a
326 b
327 </p>
328 <hr />
329 <p>a
330 b
331 </p>
332 <hr />
333 <p>a
334 </p><p>b
335 </p>
336 <hr />
337 <p>a
338 </p><p><br />
339 b
340 </p>
341 <hr />
342
343 !! end
344
345 !! test
346 Extra newlines: More paragraphs with indented comment
347 !! wikitext
348 a
349
350 <!--boo-->
351
352 b
353 !! html
354 <p>a
355 </p><p><br />
356 b
357 </p>
358 !!end
359
360 !! test
361 Extra newlines followed by heading
362 !! wikitext
363 a
364
365
366
367 =b=
368 [[a]]
369
370
371 =b=
372 !! html
373 <p>a
374 </p><p><br />
375 </p>
376 <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>
377 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
378 </p><p><br />
379 </p>
380 <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>
381
382 !! end
383
384 !! test
385 Extra newlines between heading and content are swallowed
386 !! wikitext
387 =b=
388
389
390
391 [[a]]
392 !! html
393 <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>
394 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
395 </p>
396 !! end
397
398 !! test
399 Parsing an URL
400 !! wikitext
401 http://fr.wikipedia.org/wiki/🍺
402 <!-- EasterEgg we love beer, better be able be able to link to it -->
403 !! html
404 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
405 </p>
406 !! end
407
408 !! test
409 Simple list
410 !! wikitext
411 * Item 1
412 * Item 2
413 !! html
414 <ul>
415 <li> Item 1
416 </li>
417 <li> Item 2
418 </li>
419 </ul>
420
421 !! end
422
423 !! test
424 Italics and bold
425 !! wikitext
426 * plain
427 * plain''italic''plain
428 * plain''italic''plain''italic''plain
429 * plain'''bold'''plain
430 * plain'''bold'''plain'''bold'''plain
431 * plain''italic''plain'''bold'''plain
432 * plain'''bold'''plain''italic''plain
433 * plain''italic'''bold-italic'''italic''plain
434 * plain'''bold''bold-italic''bold'''plain
435 * plain'''''bold-italic'''italic''plain
436 * plain'''''bold-italic''bold'''plain
437 * plain''italic'''bold-italic'''''plain
438 * plain'''bold''bold-italic'''''plain
439 * plain l'''italic''plain
440 * plain l''''bold''' plain
441 !! html
442 <ul>
443 <li> plain
444 </li>
445 <li> plain<i>italic</i>plain
446 </li>
447 <li> plain<i>italic</i>plain<i>italic</i>plain
448 </li>
449 <li> plain<b>bold</b>plain
450 </li>
451 <li> plain<b>bold</b>plain<b>bold</b>plain
452 </li>
453 <li> plain<i>italic</i>plain<b>bold</b>plain
454 </li>
455 <li> plain<b>bold</b>plain<i>italic</i>plain
456 </li>
457 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
458 </li>
459 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
460 </li>
461 <li> plain<i><b>bold-italic</b>italic</i>plain
462 </li>
463 <li> plain<b><i>bold-italic</i>bold</b>plain
464 </li>
465 <li> plain<i>italic<b>bold-italic</b></i>plain
466 </li>
467 <li> plain<b>bold<i>bold-italic</i></b>plain
468 </li>
469 <li> plain l'<i>italic</i>plain
470 </li>
471 <li> plain l'<b>bold</b> plain
472 </li>
473 </ul>
474
475 !! end
476
477 # this example taken from the [[simple:Moon]] article (bug 47326)
478 !! test
479 Italics and possessives (1)
480 !! wikitext
481 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
482 !! html
483 <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
484 </p>
485 !! end
486
487 # this example taken from [[en:Flaming Pie]] (bug 49926)
488 !! test
489 Italics and possessives (2)
490 !! wikitext
491 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
492 !! html
493 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
494 </p>
495 !! end
496
497 # this example taken from [[en:Dictionary]] (bug 49926)
498 !! test
499 Italics and possessives (3)
500 !! wikitext
501 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''.
502 !! html
503 <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>.
504 </p>
505 !! end
506
507
508 ###
509 ### 2-quote opening sequence tests
510 ###
511 !! test
512 Italics and bold: 2-quote opening sequence: (2,2)
513 !! wikitext
514 ''foo''
515 !! html
516 <p><i>foo</i>
517 </p>
518 !!end
519
520
521 !! test
522 Italics and bold: 2-quote opening sequence: (2,3)
523 !! wikitext
524 ''foo'''
525 !! html
526 <p><i>foo'</i>
527 </p>
528 !!end
529
530
531 !! test
532 Italics and bold: 2-quote opening sequence: (2,4)
533 !! wikitext
534 ''foo''''
535 !! html
536 <p><i>foo''</i>
537 </p>
538 !!end
539
540
541 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
542 !! test
543 Italics and bold: 2-quote opening sequence: (2,5)
544 !! wikitext
545 ''foo'''''
546 !! html/php
547 <p><i>foo</i>
548 </p>
549 !! html/parsoid
550 <p><i>foo</i><b></b>
551 </p>
552 !!end
553
554
555 ###
556 ### 3-quote opening sequence tests
557 ###
558
559 !! test
560 Italics and bold: 3-quote opening sequence: (3,2)
561 !! wikitext
562 '''foo''
563 !! html
564 <p>'<i>foo</i>
565 </p>
566 !!end
567
568
569 !! test
570 Italics and bold: 3-quote opening sequence: (3,3)
571 !! wikitext
572 '''foo'''
573 !! html
574 <p><b>foo</b>
575 </p>
576 !!end
577
578
579 !! test
580 Italics and bold: 3-quote opening sequence: (3,4)
581 !! wikitext
582 '''foo''''
583 !! html
584 <p><b>foo'</b>
585 </p>
586 !!end
587
588
589 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
590 !! test
591 Italics and bold: 3-quote opening sequence: (3,5)
592 !! wikitext
593 '''foo'''''
594 !! html/php
595 <p><b>foo</b>
596 </p>
597 !! html/parsoid
598 <p><b>foo</b><i></i>
599 </p>
600 !!end
601
602
603 ###
604 ### 4-quote opening sequence tests
605 ###
606
607 !! test
608 Italics and bold: 4-quote opening sequence: (4,2)
609 !! wikitext
610 ''''foo''
611 !! html
612 <p>''<i>foo</i>
613 </p>
614 !!end
615
616
617 !! test
618 Italics and bold: 4-quote opening sequence: (4,3)
619 !! wikitext
620 ''''foo'''
621 !! html
622 <p>'<b>foo</b>
623 </p>
624 !!end
625
626
627 !! test
628 Italics and bold: 4-quote opening sequence: (4,4)
629 !! wikitext
630 ''''foo''''
631 !! html
632 <p>'<b>foo'</b>
633 </p>
634 !!end
635
636
637 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
638 !! test
639 Italics and bold: 4-quote opening sequence: (4,5)
640 !! wikitext
641 ''''foo'''''
642 !! html/php
643 <p>'<b>foo</b>
644 </p>
645 !! html/parsoid
646 <p>'<b>foo</b><i></i>
647 </p>
648 !!end
649
650
651 ###
652 ### 5-quote opening sequence tests
653 ###
654
655 !! test
656 Italics and bold: 5-quote opening sequence: (5,2)
657 !! options
658 !! wikitext
659 '''''foo''
660 !! html
661 <p><b><i>foo</i></b>
662 </p>
663 !!end
664
665
666 !! test
667 Italics and bold: 5-quote opening sequence: (5,3)
668 !! wikitext
669 '''''foo'''
670 !! html
671 <p><i><b>foo</b></i>
672 </p>
673 !!end
674
675
676 !! test
677 Italics and bold: 5-quote opening sequence: (5,4)
678 !! wikitext
679 '''''foo''''
680 !! html
681 <p><i><b>foo'</b></i>
682 </p>
683 !!end
684
685
686 !! test
687 Italics and bold: 5-quote opening sequence: (5,5)
688 !! wikitext
689 '''''foo'''''
690 !! html
691 <p><i><b>foo</b></i>
692 </p>
693 !!end
694
695 ###
696 ### multiple quote sequences in a line
697 ###
698 !! test
699 Italics and bold: multiple quote sequences: (2,4,2)
700 !! wikitext
701 ''foo''''bar''
702 !! html
703 <p><i>foo'<b>bar</b></i>
704 </p>
705 !!end
706
707
708 !! test
709 Italics and bold: multiple quote sequences: (2,4,3)
710 !! wikitext
711 ''foo''''bar'''
712 !! html
713 <p><i>foo'<b>bar</b></i>
714 </p>
715 !!end
716
717
718 !! test
719 Italics and bold: multiple quote sequences: (2,4,4)
720 !! wikitext
721 ''foo''''bar''''
722 !! html
723 <p><i>foo'<b>bar'</b></i>
724 </p>
725 !!end
726
727
728 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
729 !! test
730 Italics and bold: multiple quote sequences: (3,4,2)
731 !! wikitext
732 '''foo''''bar''
733 !! html/php
734 <p><b>foo'</b>bar
735 </p>
736 !! html/parsoid
737 <p><b>foo'</b>bar<i></i>
738 </p>
739 !!end
740
741
742 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
743 !! test
744 Italics and bold: multiple quote sequences: (3,4,3)
745 !! wikitext
746 '''foo''''bar'''
747 !! html/php
748 <p><b>foo'</b>bar
749 </p>
750 !! html/parsoid
751 <p><b>foo'</b>bar<b></b>
752 </p>
753 !!end
754
755 ###
756 ### other quote tests
757 ###
758 !! test
759 Italics and bold: other quote tests: (2,3,5)
760 !! wikitext
761 ''this is about '''foo's family'''''
762 !! html
763 <p><i>this is about <b>foo's family</b></i>
764 </p>
765 !!end
766
767
768 !! test
769 Italics and bold: other quote tests: (2,(3,3),2)
770 !! wikitext
771 ''this is about '''foo's''' family''
772 !! html
773 <p><i>this is about <b>foo's</b> family</i>
774 </p>
775 !!end
776
777
778 !! test
779 Italics and bold: other quote tests: (3,2,3,2)
780 !! wikitext
781 '''this is about ''foo'''s family''
782 !! html
783 <p><b>this is about <i>foo</i></b><i>s family</i>
784 </p>
785 !!end
786
787
788 !! test
789 Italics and bold: other quote tests: (3,2,3,3)
790 !! options
791 !! wikitext
792 '''this is about ''foo'''s family'''
793 !! html
794 <p>'<i>this is about </i>foo<b>s family</b>
795 </p>
796 !!end
797
798
799 !! test
800 Italics and bold: other quote tests: (3,(2,2),3)
801 !! wikitext
802 '''this is about ''foo's'' family'''
803 !! html
804 <p><b>this is about <i>foo's</i> family</b>
805 </p>
806 !!end
807
808
809 !! test
810 Italicized possessive
811 !! wikitext
812 The ''[[Main Page]]'''s talk page.
813 !! html
814 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
815 </p>
816 !! end
817
818 !! test
819 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
820 (Requires tidy for PHP parser output to be fixed up)
821 !! options
822 parsoid=wt2html,wt2wt
823 !! wikitext
824 {|
825 !''a!!''b
826 |''a||''b
827 |}
828 !! html
829 <table>
830 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
831 <td><i>a</i></td><td><i>b</i></td></tr>
832 </tbody></table>
833 !! end
834
835 ###
836 ### Non-html5 tags
837 ###
838
839 !! test
840 Non-html5 tags should be accepted
841 !! wikitext
842 <center>''foo''</center>
843 <big>''foo''</big>
844 <font>''foo''</font>
845 <strike>''foo''</strike>
846 <tt>''foo''</tt>
847 !! html
848 <center><i>foo</i></center>
849 <p><big><i>foo</i></big>
850 <font><i>foo</i></font>
851 <strike><i>foo</i></strike>
852 <tt><i>foo</i></tt>
853 </p>
854 !! end
855
856 !! test
857 <wbr> is valid wikitext (bug 52468)
858 !! wikitext
859 <wbr>
860 !! html
861 <p><wbr />
862 </p>
863 !! end
864
865 # <strike> is HTML4, <s> is HTML4/5.
866 !! test
867 <s> or <strike> for strikethrough
868 !! wikitext
869 <strike>strike</strike>
870
871 <s>s</s>
872 !! html
873 <p><strike>strike</strike>
874 </p><p><s>s</s>
875 </p>
876 !! end
877
878 !! test
879 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
880 !! wikitext
881 <b→> doesn't work! </b→>
882
883 <bä> doesn't work! </bä>
884
885 <boo> works fine </boo>
886
887 <s.foo>s.foo</s.foo>
888
889 <sub-ID#1>
890 !! html
891 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
892 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
893 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
894 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
895 </p><p>&lt;sub-ID#1&gt;
896 </p>
897 !! end
898
899 !! test
900 Isolated close tags should be treated as literal text (bug 52760)
901 !! wikitext
902 </b>
903
904 <s.foo>s</s>
905 !! html
906 <p>&lt;/b&gt;
907 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
908 </p>
909 !! end
910
911 ###
912 ### Special characters
913 ###
914
915 !! test
916 Bare pipe character (bug 52363)
917 !! wikitext
918 |
919 !! html
920 <p>|
921 </p>
922 !! end
923
924 !! test
925 Bare pipe character from a template (bug 52363)
926 !! wikitext
927 {{pipe}}
928 !! html
929 <p>|
930 </p>
931 !! end
932
933 ###
934 ### <nowiki> test cases
935 ###
936
937 !! test
938 <nowiki> unordered list
939 !! wikitext
940 <nowiki>* This is not an unordered list item.</nowiki>
941 !! html
942 <p>* This is not an unordered list item.
943 </p>
944 !! end
945
946 !! test
947 <nowiki> spacing
948 !! wikitext
949 <nowiki>Lorem ipsum dolor
950
951 sed abit.
952 sed nullum.
953
954 :and a colon
955 </nowiki>
956 !! html
957 <p>Lorem ipsum dolor
958
959 sed abit.
960 sed nullum.
961
962 :and a colon
963
964 </p>
965 !! end
966
967 !! test
968 nowiki 3
969 !! wikitext
970 :There is not nowiki.
971 :There is <nowiki>nowiki</nowiki>.
972
973 #There is not nowiki.
974 #There is <nowiki>nowiki</nowiki>.
975
976 *There is not nowiki.
977 *There is <nowiki>nowiki</nowiki>.
978 !! html
979 <dl>
980 <dd>There is not nowiki.
981 </dd>
982 <dd>There is nowiki.
983 </dd>
984 </dl>
985 <ol>
986 <li>There is not nowiki.
987 </li>
988 <li>There is nowiki.
989 </li>
990 </ol>
991 <ul>
992 <li>There is not nowiki.
993 </li>
994 <li>There is nowiki.
995 </li>
996 </ul>
997
998 !! end
999
1000 !! test
1001 Entities inside <nowiki>
1002 !! wikitext
1003 <nowiki>&lt;</nowiki>
1004 !! html
1005 <p>&lt;
1006 </p>
1007 !! end
1008
1009 !! test
1010 Entities inside template parameters
1011 !! options
1012 parsoid
1013 !! wikitext
1014 {{echo|&ndash;}}
1015 !! html
1016 <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>
1017 </p>
1018 !! end
1019
1020 ###
1021 ### Comments
1022 ###
1023 !! test
1024 Comments and Indent-Pre
1025 !! wikitext
1026 <!-- comment 1 --> asdf
1027
1028 <!-- comment 1 --> asdf
1029 <!-- comment 2 -->
1030
1031 <!-- comment 1 --> asdf
1032 <!-- comment 2 -->xyz
1033
1034 <!-- comment 1 --> asdf
1035 <!-- comment 2 --> xyz
1036 !! html
1037 <pre>asdf
1038 </pre>
1039 <pre>asdf
1040 </pre>
1041 <pre>asdf
1042 </pre>
1043 <p>xyz
1044 </p>
1045 <pre>asdf
1046 xyz
1047 </pre>
1048 !! end
1049
1050 !! test
1051 Comment test 2a
1052 !! wikitext
1053 asdf
1054 <!-- comment 1 -->
1055 jkl
1056 !! html
1057 <p>asdf
1058 jkl
1059 </p>
1060 !! end
1061
1062 !! test
1063 Comment test 2b
1064 !! wikitext
1065 asdf
1066 <!-- comment 1 -->
1067
1068 jkl
1069 !! html
1070 <p>asdf
1071 </p><p>jkl
1072 </p>
1073 !! end
1074
1075 !! test
1076 Comment test 3
1077 !! wikitext
1078 asdf
1079 <!-- comment 1 -->
1080 <!-- comment 2 -->
1081 jkl
1082 !! html
1083 <p>asdf
1084 jkl
1085 </p>
1086 !! end
1087
1088 !! test
1089 Comment test 4
1090 !! wikitext
1091 asdf<!-- comment 1 -->jkl
1092 !! html
1093 <p>asdfjkl
1094 </p>
1095 !! end
1096
1097 !! test
1098 Comment spacing
1099 !! wikitext
1100 a
1101 <!-- foo --> b <!-- bar -->
1102 c
1103 !! html
1104 <p>a
1105 </p>
1106 <pre> b
1107 </pre>
1108 <p>c
1109 </p>
1110 !! end
1111
1112 !! test
1113 Comment whitespace
1114 !! wikitext
1115 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1116 !! html
1117
1118 !! end
1119
1120 !! test
1121 Comment semantics and delimiters
1122 !! wikitext
1123 <!-- --><!----><!-----><!------>
1124 !! html
1125
1126 !! end
1127
1128 !! test
1129 Comment semantics and delimiters, redux
1130 !! wikitext
1131 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1132 -- foo -- funky huh? ... -->
1133 !! html
1134
1135 !! end
1136
1137 !! test
1138 Comment semantics and delimiters: directors cut
1139 !! wikitext
1140 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1141 everything starting with < followed by !-- until the first -- and > we see,
1142 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1143 -->-->
1144 !! html
1145 <p>--&gt;
1146 </p>
1147 !! end
1148
1149 !! test
1150 Comment semantics: nesting
1151 !! wikitext
1152 <!--<!-- no, we're not going to do anything fancy here -->-->
1153 !! html
1154 <p>--&gt;
1155 </p>
1156 !! end
1157
1158 !! test
1159 Comment semantics: unclosed comment at end
1160 !! wikitext
1161 <!--This comment will run out to the end of the document
1162 !! html
1163
1164 !! end
1165
1166 !! test
1167 Comment in template title
1168 !! wikitext
1169 {{f<!---->oo}}
1170 !! html
1171 <p>FOO
1172 </p>
1173 !! end
1174
1175 !! test
1176 Comment on its own line post-expand
1177 !! wikitext
1178 a
1179 {{blank}}<!---->
1180 b
1181 !! html
1182 <p>a
1183 </p><p>b
1184 </p>
1185 !! end
1186
1187 !! test
1188 Comment on its own line post-expand with non-significant whitespace
1189 !! wikitext
1190 a
1191 {{blank}} <!---->
1192 b
1193 !! html
1194 <p>a
1195 </p><p>b
1196 </p>
1197 !! end
1198
1199 ###
1200 ### paragraph wrapping tests
1201 ###
1202 !! test
1203 No block tags
1204 !! wikitext
1205 a
1206
1207 b
1208 !! html
1209 <p>a
1210 </p><p>b
1211 </p>
1212 !! end
1213
1214 !! test
1215 Block tag on one line (<div>)
1216 !! wikitext
1217 a <div>foo</div>
1218
1219 b
1220 !! html
1221 a <div>foo</div>
1222 <p>b
1223 </p>
1224 !! end
1225
1226 !! test
1227 Block tag on one line (<blockquote>)
1228 !! wikitext
1229 a <blockquote>foo</blockquote>
1230
1231 b
1232 !! html
1233 a <blockquote>foo</blockquote>
1234 <p>b
1235 </p>
1236 !! end
1237
1238 !! test
1239 Block tag on both lines (<div>)
1240 !! wikitext
1241 a <div>foo</div>
1242
1243 b <div>foo</div>
1244 !! html
1245 a <div>foo</div>
1246 b <div>foo</div>
1247
1248 !! end
1249
1250 !! test
1251 Block tag on both lines (<blockquote>)
1252 !! wikitext
1253 a <blockquote>foo</blockquote>
1254
1255 b <blockquote>foo</blockquote>
1256 !! html
1257 a <blockquote>foo</blockquote>
1258 b <blockquote>foo</blockquote>
1259
1260 !! end
1261
1262 !! test
1263 Multiple lines without block tags
1264 !! wikitext
1265 <div>foo</div> a
1266 b
1267 c
1268 d<!--foo--> e
1269 x <div>foo</div> z
1270 !! html
1271 <div>foo</div> a
1272 <p>b
1273 c
1274 d e
1275 </p>
1276 x <div>foo</div> z
1277
1278 !! end
1279
1280 !! test
1281 Empty lines between lines with block tags
1282 !! wikitext
1283 <div></div>
1284
1285
1286 <div></div>a
1287
1288 b
1289 <div>a</div>b
1290
1291 <div>b</div>d
1292
1293
1294 <div>e</div>
1295 !! html
1296 <div></div>
1297 <p><br />
1298 </p>
1299 <div></div>a
1300 <p>b
1301 </p>
1302 <div>a</div>b
1303 <div>b</div>d
1304 <p><br />
1305 </p>
1306 <div>e</div>
1307
1308 !! end
1309
1310 ## PHP parser emits output which is broken
1311 !! test
1312 Unclosed HTML p-tags should be handled properly
1313 !! wikitext
1314 <div><p>foo</div>
1315 a
1316
1317 b
1318 !! html/parsoid
1319 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1320 <p>a</p>
1321 <p>b</p>
1322 !! end
1323
1324 ###
1325 ### Preformatted text
1326 ###
1327 !! test
1328 Preformatted text
1329 !! wikitext
1330 This is some
1331 Preformatted text
1332 With ''italic''
1333 And '''bold'''
1334 And a [[Main Page|link]]
1335 !! html
1336 <pre>This is some
1337 Preformatted text
1338 With <i>italic</i>
1339 And <b>bold</b>
1340 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1341 </pre>
1342 !! end
1343
1344 !! test
1345 Tabs don't trigger preformatted text
1346 !! wikitext
1347 This is not
1348 preformatted text.
1349 This is preformatted text.
1350 So is this.
1351 !! html
1352 <p> This is not
1353 preformatted text.
1354 </p>
1355 <pre>This is preformatted text.
1356 So is this.
1357 </pre>
1358 !! end
1359
1360 !! test
1361 Ident preformatting with inline content
1362 !! wikitext
1363 a
1364 ''b''
1365 !! html
1366 <pre>a
1367 <i>b</i>
1368 </pre>
1369 !! end
1370
1371 !! test
1372 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1373 !! wikitext
1374 <pre><nowiki>
1375 <b>
1376 <cite>
1377 <em>
1378 </nowiki></pre>
1379 !! html
1380 <pre>
1381 &lt;b&gt;
1382 &lt;cite&gt;
1383 &lt;em&gt;
1384 </pre>
1385
1386 !! end
1387
1388 !! test
1389 Regression with preformatted in <center>
1390 !! wikitext
1391 <center>
1392 Blah
1393 </center>
1394 !! html
1395 <center>
1396 <pre>Blah
1397 </pre>
1398 </center>
1399
1400 !! end
1401
1402 !! test
1403 Bug 52763: Preformatted in <blockquote>
1404 !! wikitext
1405 <blockquote>
1406 Blah
1407 {|
1408 |
1409 indented cell (no pre-wrapping!)
1410 |}
1411 </blockquote>
1412 !! html
1413 <blockquote>
1414 <p> Blah
1415 </p>
1416 <table>
1417 <tr>
1418 <td>
1419 <p> indented cell (no pre-wrapping!)
1420 </p>
1421 </td></tr></table>
1422 </blockquote>
1423
1424 !! end
1425
1426 !! test
1427 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1428 !! wikitext
1429 <blockquote>
1430 Foo
1431
1432 Bar
1433 </blockquote>
1434 !! html
1435 <blockquote>
1436 <p>Foo
1437 </p><p>Bar
1438 </p>
1439 </blockquote>
1440
1441 !! end
1442
1443 !! test
1444 Bug 15491: <ins>/<del> in blockquote
1445 !! wikitext
1446 <blockquote>
1447 Foo <del>bar</del> <ins>baz</ins> quux
1448 </blockquote>
1449 !! html
1450 <blockquote>
1451 <p>Foo <del>bar</del> <ins>baz</ins> quux
1452 </p>
1453 </blockquote>
1454
1455 !! end
1456
1457 # Note that the p-wrapping is newline sensitive, which could be
1458 # considered a bug: tidy will wrap only the 'Foo' in the example
1459 # below in a <p> tag. (see comment 23-25 of bug #6200)
1460 !! test
1461 Bug 15491: <ins>/<del> in blockquote (2)
1462 !! wikitext
1463 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1464 </blockquote>
1465 !! html
1466 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1467 </blockquote>
1468
1469 !! end
1470
1471 !! test
1472 <pre> with attributes (bug 3202)
1473 !! wikitext
1474 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1475 !! html
1476 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1477
1478 !! end
1479
1480 !! test
1481 <pre> with width attribute (bug 3202)
1482 !! wikitext
1483 <pre width="8">Narrow screen goodies</pre>
1484 !! html
1485 <pre width="8">Narrow screen goodies</pre>
1486
1487 !! end
1488
1489 !! test
1490 <pre> with forbidden attribute (bug 3202)
1491 !! wikitext
1492 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1493 !! html
1494 <pre width="8">Narrow screen goodies</pre>
1495
1496 !! end
1497
1498 !! test
1499 Entities inside <pre>
1500 !! wikitext
1501 <pre>&lt;</pre>
1502 !! html
1503 <pre>&lt;</pre>
1504
1505 !! end
1506
1507 !! test
1508 <pre> with forbidden attribute values (bug 3202)
1509 !! wikitext
1510 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1511 !! html
1512 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1513
1514 !! end
1515
1516 !! test
1517 <nowiki> inside <pre> (bug 13238)
1518 !! wikitext
1519 <pre>
1520 <nowiki>
1521 </pre>
1522 <pre>
1523 <nowiki></nowiki>
1524 </pre>
1525 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1526 !! html
1527 <pre>
1528 &lt;nowiki&gt;
1529 </pre>
1530 <pre>
1531
1532 </pre>
1533 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1534
1535 !! end
1536
1537 !! test
1538 <nowiki> and <pre> preference (first one wins)
1539 !! wikitext
1540 <pre>
1541 <nowiki>
1542 </pre>
1543 </nowiki>
1544 </pre>
1545
1546 <nowiki>
1547 <pre>
1548 <nowiki>
1549 </pre>
1550 </nowiki>
1551 </pre>
1552
1553 !! html
1554 <pre>
1555 &lt;nowiki&gt;
1556 </pre>
1557 <p>&lt;/nowiki&gt;
1558 &lt;/pre&gt;
1559 </p><p>
1560 &lt;pre&gt;
1561 &lt;nowiki&gt;
1562 &lt;/pre&gt;
1563
1564 &lt;/pre&gt;
1565 </p>
1566 !! end
1567
1568 !! test
1569 </pre> inside nowiki
1570 !! wikitext
1571 <nowiki></pre></nowiki>
1572 !! html
1573 <p>&lt;/pre&gt;
1574 </p>
1575 !! end
1576
1577 !! test
1578 Empty pre; pre inside other HTML tags (bug 54946)
1579 !! wikitext
1580 a
1581
1582 <div><pre>
1583 foo
1584 </pre></div>
1585 <pre></pre>
1586 !! html
1587 <p>a
1588 </p>
1589 <div><pre>
1590 foo
1591 </pre></div>
1592 <pre></pre>
1593
1594 !! end
1595
1596 !! test
1597 HTML pre followed by indent-pre
1598 !! wikitext
1599 <pre>foo</pre>
1600 bar
1601 !! html
1602 <pre>foo</pre>
1603 <pre>bar
1604 </pre>
1605 !! end
1606
1607 !!test
1608 Block tag pre
1609 !!options
1610 parsoid
1611 !! wikitext
1612 <p><pre>foo</pre></p>
1613 !! html
1614 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1615 !!end
1616
1617 !!test
1618 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1619 !! wikitext
1620 {{echo|}}
1621 !! html
1622
1623 !!end
1624
1625 !!test
1626 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1627 !! wikitext
1628 {{echo|
1629 foo}}
1630 !! html
1631 <p>foo
1632 </p>
1633 !!end
1634
1635 !! test
1636 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1637 !! wikitext
1638 {{echo|a
1639 b}}
1640 !! html
1641 <pre>a
1642 </pre>
1643 <p>b
1644 </p>
1645 !!end
1646
1647 !! test
1648 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1649 !! wikitext
1650 {{echo|a
1651 b
1652 c
1653 d
1654 e
1655 }}
1656 !! html
1657 <pre>a
1658 </pre>
1659 <p>b
1660 c
1661 </p>
1662 <pre>d
1663 </pre>
1664 <p>e
1665 </p>
1666 !!end
1667
1668 !!test
1669 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1670 !! wikitext
1671 {{echo| foo}}
1672
1673 {{echo| foo}}{{echo| bar}}
1674
1675 {{echo| foo}}
1676 {{echo| bar}}
1677
1678 {{echo|<!--cmt--> foo}}
1679
1680 <!--cmt-->{{echo| foo}}
1681
1682 {{echo|{{echo| }}bar}}
1683 !! html
1684 <pre>foo
1685 </pre>
1686 <pre>foo bar
1687 </pre>
1688 <pre>foo
1689 bar
1690 </pre>
1691 <pre>foo
1692 </pre>
1693 <pre>foo
1694 </pre>
1695 <pre>bar
1696 </pre>
1697 !!end
1698
1699 !! test
1700 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1701 !! wikitext
1702 {{echo| }}a
1703
1704 {{echo|
1705 }}a
1706
1707 {{echo|
1708 b}}
1709
1710 {{echo|a
1711 }}b
1712
1713 {{echo|a
1714 }} b
1715 !! html
1716 <pre>a
1717 </pre>
1718 <p><br />
1719 </p>
1720 <pre>a
1721 </pre>
1722 <p><br />
1723 </p>
1724 <pre>b
1725 </pre>
1726 <p>a
1727 </p>
1728 <pre>b
1729 </pre>
1730 <p>a
1731 </p>
1732 <pre>b
1733 </pre>
1734 !!end
1735
1736 !! test
1737 Things that look like <pre> tags aren't treated as such
1738 !! wikitext
1739 Barack Obama <President> of the United States
1740 !! html
1741 <p>Barack Obama &lt;President&gt; of the United States
1742 </p>
1743 !! end
1744
1745 !! test
1746 Parsoid: handle pre with space after attribute
1747 !! options
1748 parsoid=wt2html
1749 !! wikitext
1750 <pre style="width:50%;" >{{echo|foo}}</pre>
1751 !! html
1752 <pre style="width:50%;">{{echo|foo}}</pre>
1753 !! end
1754
1755 # TODO / maybe: fix wt2wt for this
1756 !! test
1757 Parsoid: Don't paragraph-wrap fosterable content
1758 !! options
1759 parsoid=wt2html
1760 !! wikitext
1761 {|
1762 <td></td>
1763 <td></td>
1764
1765
1766
1767 |}
1768 !! html
1769 <table>
1770
1771 <tbody>
1772 <tr>
1773 <td></td>
1774
1775 <td></td></tr>
1776
1777
1778
1779 </tbody></table>
1780 !! end
1781
1782 !! test
1783 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1784 !! options
1785 parsoid=wt2html
1786 !! wikitext
1787 {|
1788 <td>
1789 <td>
1790 </td>
1791
1792
1793
1794 |}
1795 !! html
1796 <table>
1797
1798 <tbody>
1799 <tr>
1800 <td></td>
1801
1802 <td>
1803 </td></tr>
1804
1805
1806
1807 </tbody></table>
1808 !! end
1809
1810
1811 #--------------------------------------------------------------------
1812 # Transclusion parameter whitespace stripping tests
1813 # Behavior is different for positional and named parameters
1814 #--------------------------------------------------------------------
1815 !! test
1816 Templates: Strip leading and trailing whitespace from named-param values
1817 !! wikitext
1818 {{echo|1= a }}
1819
1820 {{echo|1= {{echo|b}} }}
1821
1822 {{echo| 1 =
1823 c }}
1824
1825 {{echo| 1 =
1826 * d
1827 }}
1828 !! html
1829 <p>a
1830 </p><p>b
1831 </p><p>c
1832 </p>
1833 <ul>
1834 <li> d
1835 </li>
1836 </ul>
1837
1838 !! end
1839
1840 !! test
1841 Templates: Don't strip whitespace from positional-param values
1842 !! wikitext
1843 {{echo|a }}
1844
1845 {{echo|{{echo|b}} }}
1846
1847 {{echo| c
1848 }}
1849
1850 {{echo| {{echo|d}}
1851 }}
1852
1853 {{echo|
1854 e}}
1855
1856 {{echo|
1857 * f}}
1858
1859 {{echo|
1860 }}g
1861 !! html
1862 <p>a
1863 </p><p>b
1864 </p>
1865 <pre>c
1866 </pre>
1867 <p><br />
1868 </p>
1869 <pre>d
1870 </pre>
1871 <p><br />
1872 </p>
1873 <pre>e
1874 </pre>
1875 <p><br />
1876 </p>
1877 <ul>
1878 <li> f
1879 </li>
1880 </ul>
1881 <p><br />
1882 </p>
1883 <pre>g
1884 </pre>
1885 !! end
1886
1887 !! test
1888 Templates: Handle empty comment-and-ws-only lines correctly
1889 !! wikitext
1890 {{echo|foo
1891 <!--should be ignored-->
1892 <!--should be ignored as well-->
1893 bar}}
1894 !! html
1895 <p>foo
1896 bar
1897 </p>
1898 !! end
1899
1900 #--------------------------------------------------------------------
1901 # Transclusion parameter escaping tests
1902 #--------------------------------------------------------------------
1903 !! test
1904 Templates: Parsoid parameter escaping test 1
1905 !! options
1906 parsoid
1907 !! wikitext
1908 {{echo|[foo]|{{echo|[bar]}}}}
1909 !! html
1910 <p about="#mwt1" typeof="mw:Transclusion"
1911 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1912 !! end
1913
1914 !! test
1915 Parsoid: Pipes in external links in template parameter
1916 !! options
1917 parsoid
1918 !! wikitext
1919 {{echo|[{{echo|http://example.com}} link]}}
1920 !! html
1921 <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>
1922 !! end
1923
1924 !! test
1925 Parsoid: pipe in transclusion parameter
1926 !! options
1927 parsoid
1928 !! wikitext
1929 {{echo|http://foo.com/a&#124;b}}
1930 !! html
1931 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1932 typeof="mw:Transclusion"
1933 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>
1934 !! end
1935
1936 !! test
1937 Parsoid: Pipe in external link target and content in template parameter
1938 !! options
1939 parsoid=html2wt,wt2wt
1940 !! wikitext
1941 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1942 !! html
1943 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1944 typeof="mw:Transclusion"
1945 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1946 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1947 !! end
1948
1949 !! test
1950 Templates: Don't escape already nowiki-escaped text in template parameters
1951 !! options
1952 parsoid=html2wt,wt2wt
1953 !! wikitext
1954 {{echo|foo<nowiki>|</nowiki>bar}}
1955 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1956 {{echo|<nowiki></nowiki>}}
1957 !! html
1958 <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>
1959 <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>
1960 <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>
1961 </p>
1962 !! end
1963
1964 ## Bug 52824
1965 !! test
1966 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1967 !! options
1968 parsoid=html2wt,wt2wt
1969 !! wikitext
1970 {{echo|{{echo|1=bar}}}}
1971 !! html
1972 <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>
1973 !! end
1974
1975 ## Bug 56733
1976 !! test
1977 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
1978 !! options
1979 parsoid
1980 !! wikitext
1981 {{echo|a : b}}
1982 !! html
1983 <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>
1984 !! end
1985
1986 ###
1987 ### Parsoid-centric tests for testing RT edge cases for pre
1988 ###
1989
1990 !!test
1991 1a. Indent-Pre and Comments
1992 !! wikitext
1993 a
1994 <!--a-->
1995 c
1996 !! html
1997 <pre>a
1998 </pre>
1999 <p>c
2000 </p>
2001 !!end
2002
2003 !!test
2004 1b. Indent-Pre and Comments
2005 !! wikitext
2006 a
2007 <!--a-->
2008 c
2009 !! html
2010 <pre>a
2011 </pre>
2012 <p>c
2013 </p>
2014 !!end
2015
2016 !!test
2017 1c. Indent-Pre and Comments
2018 !! wikitext
2019 <!--a--> a
2020
2021 <!--a--> a
2022 !! html
2023 <pre> a
2024 </pre>
2025 <pre> a
2026 </pre>
2027 !!end
2028
2029 !!test
2030 1d. Indent-Pre and Comments
2031 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2032 !! wikitext
2033 <!--a--> a
2034
2035 <!--b-->b
2036 !! html
2037 <pre>a
2038 </pre>
2039 <pre>b
2040 </pre>
2041 !!end
2042
2043 !!test
2044 2a. Indent-Pre and tables
2045 !! wikitext
2046 {|
2047 |-
2048 !h1!!h2
2049 |foo||bar
2050 |}
2051 !! html
2052 <table>
2053
2054 <tr>
2055 <th>h1</th>
2056 <th>h2
2057 </th>
2058 <td>foo</td>
2059 <td>bar
2060 </td></tr></table>
2061
2062 !!end
2063
2064 !!test
2065 2b. Indent-Pre and tables
2066 !! wikitext
2067 {|
2068 |-
2069 |foo
2070 |}
2071 !! html
2072 <table>
2073
2074 <tr>
2075 <td>foo
2076 </td></tr></table>
2077
2078 !!end
2079
2080 !!test
2081 2c. Indent-Pre and tables (bug 42252)
2082 !! wikitext
2083 {|
2084 |+ foo
2085 ! | bar
2086 |}
2087 !! html
2088 <table>
2089 <caption> foo
2090 </caption>
2091 <tr>
2092 <th> bar
2093 </th></tr></table>
2094
2095 !!end
2096
2097 !!test
2098 3a. Indent-Pre and block tags (single-line html)
2099 !! wikitext
2100 a <p> foo </p>
2101 b <div> foo </div>
2102 c <blockquote> foo </blockquote>
2103 <span> foo </span>
2104 !! html
2105 a <p> foo </p>
2106 b <div> foo </div>
2107 c <blockquote> foo </blockquote>
2108 <pre><span> foo </span>
2109 </pre>
2110 !!end
2111
2112 !!test
2113 3b. Indent-Pre and block tags (multi-line html)
2114 !! wikitext
2115 a <span>foo</span>
2116 b <div> foo </div>
2117 !! html
2118 <pre>a <span>foo</span>
2119 </pre>
2120 b <div> foo </div>
2121
2122 !!end
2123
2124 !!test
2125 3c. Indent-Pre and block tags (pre-content on separate line)
2126 !! wikitext
2127 <p>
2128 foo
2129 </p>
2130
2131 <div>
2132 foo
2133 </div>
2134
2135 <center>
2136 foo
2137 </center>
2138
2139 <blockquote>
2140 foo
2141 </blockquote>
2142
2143 <blockquote>
2144 <pre>
2145 foo
2146 </pre>
2147 </blockquote>
2148
2149 <table><tr><td>
2150 foo
2151 </td></tr></table>
2152
2153 <ul><li>
2154 foo
2155 </li></ul>
2156
2157 !! html
2158 <p>
2159 foo
2160 </p>
2161 <div>
2162 <pre>foo
2163 </pre>
2164 </div>
2165 <center>
2166 <pre>foo
2167 </pre>
2168 </center>
2169 <blockquote>
2170 <p> foo
2171 </p>
2172 </blockquote>
2173 <blockquote>
2174 <pre>
2175 foo
2176 </pre>
2177 </blockquote>
2178 <table><tr><td>
2179 <pre>foo
2180 </pre>
2181 </td></tr></table>
2182 <ul><li>
2183 foo
2184 </li></ul>
2185
2186 !!end
2187
2188 !!test
2189 4. Indent-Pre and extension tags
2190 !! wikitext
2191 a <gallery>
2192 File:foobar.jpg
2193 </gallery>
2194 !! html
2195 a <ul class="gallery mw-gallery-traditional">
2196 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2197 <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>
2198 <div class="gallerytext">
2199 </div>
2200 </div></li>
2201 </ul>
2202
2203 !!end
2204
2205 !! test
2206 Leading pipes outside of tables
2207 !! options
2208 parsoid
2209 !! wikitext
2210 | foo
2211 !! html
2212 <p>| foo</p>
2213 !! end
2214
2215 !! test
2216 Leading pipes outside of tables 2
2217 !! options
2218 parsoid
2219 !! wikitext
2220 a
2221 | foo
2222 b
2223 !! html
2224 <p>a
2225 | foo
2226 b</p>
2227 !! end
2228
2229 !! test
2230 Leading pipes outside of tables 3
2231 !! options
2232 parsoid
2233 !! wikitext
2234 a
2235 | class="foo bar" | baz
2236 b
2237 !! html
2238 <p>a
2239 | class="foo bar" | baz
2240 b</p>
2241 !! end
2242
2243 !!test
2244 Render paragraphs when indent-pre is suppressed in blocklevels
2245 !! wikitext
2246 <blockquote>
2247 foo
2248
2249 bar
2250 </blockquote>
2251 !! html
2252 <blockquote>
2253 <p> foo
2254 </p><p> bar
2255 </p>
2256 </blockquote>
2257
2258 !!end
2259
2260 !!test
2261 4. Multiple spaces at start-of-line
2262 !! wikitext
2263 <p> foo </p>
2264 foo
2265 {|
2266 |foo
2267 |}
2268 !! html
2269 <p> foo </p>
2270 <pre> foo
2271 </pre>
2272 <table>
2273 <tr>
2274 <td>foo
2275 </td></tr></table>
2276
2277 !!end
2278
2279 ## NOTE: the leading white-space chars on empty line are significant
2280 !! test
2281 5a. White-space in indent-pre
2282 !! wikitext
2283 a<br />
2284
2285 b
2286 !! html
2287 <pre>a<br />
2288
2289 b
2290 </pre>
2291 !! end
2292
2293 ## NOTE: the leading white-space chars on empty line are significant
2294 !! test
2295 5b. White-space in indent-pre
2296 !! wikitext
2297 a
2298
2299 b
2300
2301
2302 c
2303 !! html
2304 <pre>a
2305
2306 b
2307
2308
2309 c
2310 </pre>
2311 !! end
2312
2313 !! test
2314 5c. White-space in indent-pre
2315 !! wikitext
2316 ''a''
2317 ''b''
2318 ''c''
2319 !! html
2320 <pre><i>a</i>
2321 <i>b</i>
2322 <i>c</i>
2323 </pre>
2324 !! end
2325
2326 !! test
2327 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2328 !! wikitext
2329 a
2330
2331 <!-- continue -->
2332 b
2333
2334 c
2335
2336 d
2337 !! html
2338 <pre>a
2339
2340 b
2341 </pre>
2342 <pre>c
2343
2344 </pre>
2345 <p>d
2346 </p>
2347 !! end
2348
2349 !! test
2350 7a. Indent-pre and category links
2351 !! options
2352 parsoid=wt2html,wt2wt
2353 !! wikitext
2354 [[Category:foo]] <!-- No pre-wrapping -->
2355 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2356 !! html
2357 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2358 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2359 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2360 !! end
2361
2362 !! test
2363 7b. Indent-pre and category links
2364 !! options
2365 parsoid=wt2html,wt2wt
2366 !! wikitext
2367 [[Category:foo]] a
2368 [[Category:foo]] {{echo|b}}
2369 !! html
2370 <pre>
2371 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2372
2373 <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>
2374 !! end
2375
2376 ###
2377 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2378 ###
2379
2380 !!test
2381 HTML-pre: 1. embedded newlines
2382 !! wikitext
2383 <pre>foo</pre>
2384
2385 <pre>
2386 foo
2387 </pre>
2388
2389 <pre>
2390
2391 foo
2392 </pre>
2393
2394 <pre>
2395
2396
2397 foo
2398 </pre>
2399 !! html
2400 <pre>foo</pre>
2401 <pre>
2402 foo
2403 </pre>
2404 <pre>
2405
2406 foo
2407 </pre>
2408 <pre>
2409
2410
2411 foo
2412 </pre>
2413
2414 !!end
2415
2416 !!test
2417 HTML-pre: 2: indented text
2418 !! wikitext
2419 <pre>
2420 foo
2421 </pre>
2422 !! html
2423 <pre>
2424 foo
2425 </pre>
2426
2427 !!end
2428
2429 !!test
2430 HTML-pre: 3: other wikitext
2431 !! wikitext
2432 <pre>
2433 * foo
2434 # bar
2435 = no-h =
2436 '' no-italic ''
2437 [[ NoLink ]]
2438 </pre>
2439 !! html
2440 <pre>
2441 * foo
2442 # bar
2443 = no-h =
2444 '' no-italic ''
2445 [[ NoLink ]]
2446 </pre>
2447
2448 !!end
2449
2450 ###
2451 ### Definition lists
2452 ###
2453 !! test
2454 Simple definition
2455 !! wikitext
2456 ; name : Definition
2457 !! html
2458 <dl>
2459 <dt> name&#160;</dt>
2460 <dd> Definition
2461 </dd>
2462 </dl>
2463
2464 !! end
2465
2466 !! test
2467 Definition list for indentation only
2468 !! wikitext
2469 : Indented text
2470 !! html
2471 <dl>
2472 <dd> Indented text
2473 </dd>
2474 </dl>
2475
2476 !! end
2477
2478 !! test
2479 Definition list with no space
2480 !! wikitext
2481 ;name:Definition
2482 !! html
2483 <dl>
2484 <dt>name</dt>
2485 <dd>Definition
2486 </dd>
2487 </dl>
2488
2489 !!end
2490
2491 !! test
2492 Definition list with URL link
2493 !! wikitext
2494 ; http://example.com/ : definition
2495 !! html
2496 <dl>
2497 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2498 <dd> definition
2499 </dd>
2500 </dl>
2501
2502 !! end
2503
2504 !! test
2505 Definition list with bracketed URL link
2506 !! wikitext
2507 ;[http://www.example.com/ Example]:Something about it
2508 !! html
2509 <dl>
2510 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2511 <dd>Something about it
2512 </dd>
2513 </dl>
2514
2515 !! end
2516
2517 !! test
2518 Definition list with wikilink containing colon
2519 !! wikitext
2520 ; [[Help:FAQ]]: The least-read page on Wikipedia
2521 !! html
2522 <dl>
2523 <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>
2524 <dd> The least-read page on Wikipedia
2525 </dd>
2526 </dl>
2527
2528 !! end
2529
2530 # At Brion's and JeLuF's insistence... :)
2531 !! test
2532 Definition list with news link containing colon
2533 !! wikitext
2534 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2535 !! html
2536 <dl>
2537 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2538 <dd> This isn't even a real newsgroup!
2539 </dd>
2540 </dl>
2541
2542 !! end
2543
2544 !! test
2545 Malformed definition list with colon
2546 !! wikitext
2547 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2548 !! html
2549 <dl>
2550 <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
2551 </dt>
2552 </dl>
2553
2554 !! end
2555
2556 !! test
2557 Definition lists: colon in external link text
2558 !! wikitext
2559 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2560 !! html
2561 <dl>
2562 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2563 <dd> OK, I made that up
2564 </dd>
2565 </dl>
2566
2567 !! end
2568
2569 !! test
2570 Definition lists: colon in HTML attribute
2571 !! wikitext
2572 ;<b style="display: inline">bold</b>
2573 !! html
2574 <dl>
2575 <dt><b style="display: inline">bold</b>
2576 </dt>
2577 </dl>
2578
2579 !! end
2580
2581 !! test
2582 Definition lists: self-closed tag
2583 !! wikitext
2584 ;one<br/>two : two-line fun
2585 !! html
2586 <dl>
2587 <dt>one<br />two&#160;</dt>
2588 <dd> two-line fun
2589 </dd>
2590 </dl>
2591
2592 !! end
2593
2594 !! test
2595 Bug 11748: Literal closing tags
2596 !! wikitext
2597 <dl>
2598 <dt>test 1</dt>
2599 <dd>test test test test test</dd>
2600 <dt>test 2</dt>
2601 <dd>test test test test test</dd>
2602 </dl>
2603 !! html
2604 <dl>
2605 <dt>test 1</dt>
2606 <dd>test test test test test</dd>
2607 <dt>test 2</dt>
2608 <dd>test test test test test</dd>
2609 </dl>
2610
2611 !! end
2612
2613 !! test
2614 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2615 !! wikitext
2616 <ul><li>
2617 ; term : description
2618 * unordered
2619 </li></ul>
2620 !! html
2621 <ul><li>
2622 <dl>
2623 <dt> term&#160;</dt>
2624 <dd> description
2625 </dd>
2626 </dl>
2627 <ul>
2628 <li> unordered
2629 </li>
2630 </ul>
2631 </li></ul>
2632
2633 !! end
2634
2635 !! test
2636
2637 Definition list with empty definition and following paragraph
2638 !! wikitext
2639 ; term:
2640 Paragraph text
2641 !! html
2642 <dl>
2643 <dt> term</dt>
2644 <dd>
2645 </dd>
2646 </dl>
2647 <p>Paragraph text
2648 </p>
2649 !! end
2650
2651 !! test
2652 Nested definition lists using html syntax
2653 !! wikitext
2654 <dl><dd>
2655 <dl>
2656 <dd>Foo</dd>
2657 </dl>
2658 </dd></dl>
2659 !! html
2660 <dl><dd>
2661 <dl>
2662 <dd>Foo</dd>
2663 </dl>
2664 </dd></dl>
2665
2666 !! end
2667
2668 !! test
2669 Definition Lists: No nesting: Multiple dd's
2670 !! wikitext
2671 ;x
2672 :a
2673 :b
2674 !! html
2675 <dl>
2676 <dt>x
2677 </dt>
2678 <dd>a
2679 </dd>
2680 <dd>b
2681 </dd>
2682 </dl>
2683
2684 !! end
2685
2686 !! test
2687 Definition Lists: Indentation: Regular
2688 !! wikitext
2689 :i1
2690 ::i2
2691 :::i3
2692 !! html
2693 <dl>
2694 <dd>i1
2695 <dl>
2696 <dd>i2
2697 <dl>
2698 <dd>i3
2699 </dd>
2700 </dl>
2701 </dd>
2702 </dl>
2703 </dd>
2704 </dl>
2705
2706 !! end
2707
2708 !! test
2709 Definition Lists: Indentation: Missing 1st level
2710 !! wikitext
2711 ::i2
2712 :::i3
2713 !! html
2714 <dl>
2715 <dd><dl>
2716 <dd>i2
2717 <dl>
2718 <dd>i3
2719 </dd>
2720 </dl>
2721 </dd>
2722 </dl>
2723 </dd>
2724 </dl>
2725
2726 !! end
2727
2728 !! test
2729 Definition Lists: Indentation: Multi-level indent
2730 !! wikitext
2731 :::i3
2732 !! html
2733 <dl>
2734 <dd><dl>
2735 <dd><dl>
2736 <dd>i3
2737 </dd>
2738 </dl>
2739 </dd>
2740 </dl>
2741 </dd>
2742 </dl>
2743
2744 !! end
2745
2746 !! test
2747 Definition Lists: Hacky use to indent tables
2748 !! wikitext
2749 ::{|
2750 |foo
2751 |bar
2752 |}
2753 this text
2754 should be left alone
2755 !! html
2756 <dl><dd><dl><dd><table>
2757 <tr>
2758 <td>foo
2759 </td>
2760 <td>bar
2761 </td></tr></table></dd></dl></dd></dl>
2762 <p>this text
2763 should be left alone
2764 </p>
2765 !! end
2766
2767 # Bug 52473
2768 !! test
2769 Definition Lists: Hacky use to indent tables (WS-insensitive)
2770 !! options
2771 parsoid
2772 !! wikitext
2773 : {|
2774 |a
2775 |}
2776 !! html
2777 <dl>
2778 <dd> <table><tr><td>a</td></tr></table> </dd>
2779 </dl>
2780 !! end
2781 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2782 ## as an empty dt item. It also ignores all but the last ";" when followed
2783 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2784 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2785 ## ";"s.
2786 ##
2787 ## Ex: ";;t2 ::d2" is transformed into:
2788 ##
2789 ## <dl>
2790 ## <dt>t2 </dt>
2791 ## <dd>
2792 ## <dl>
2793 ## <dt></dt>
2794 ## <dd>d2</dd>
2795 ## </dl>
2796 ## </dd>
2797 ## </dl>
2798 ##
2799 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2800 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2801 ##
2802 ## <dl>
2803 ## <dt>
2804 ## <dl>
2805 ## <dt>t2 </dt>
2806 ## <dd>:d2</dd>
2807 ## </dl>
2808 ## </dt>
2809 ## </dl>
2810 ##
2811 ## All Parsoid only definition list tests have this difference.
2812 ##
2813 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2814 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2815
2816 !! test
2817 Table / list interaction: indented table with lists in table contents
2818 !! wikitext
2819 :{|
2820 |-
2821 | a
2822 * b
2823 |-
2824 | c
2825 * d
2826 |}
2827 !! html
2828 <dl><dd><table>
2829
2830 <tr>
2831 <td> a
2832 <ul>
2833 <li> b
2834 </li>
2835 </ul>
2836 </td></tr>
2837 <tr>
2838 <td> c
2839 <ul>
2840 <li> d
2841 </li>
2842 </ul>
2843 </td></tr></table></dd></dl>
2844
2845 !! end
2846
2847 !!test
2848 Table / list interaction: lists nested in tables nested in indented lists
2849 !! wikitext
2850 :{|
2851 |
2852 :a
2853 :b
2854 |
2855 *c
2856 *d
2857 |}
2858
2859 *e
2860 *f
2861 !! html
2862 <dl><dd><table>
2863 <tr>
2864 <td>
2865 <dl>
2866 <dd>a
2867 </dd>
2868 <dd>b
2869 </dd>
2870 </dl>
2871 </td>
2872 <td>
2873 <ul>
2874 <li>c
2875 </li>
2876 <li>d
2877 </li>
2878 </ul>
2879 </td></tr></table></dd></dl>
2880 <ul>
2881 <li>e
2882 </li>
2883 <li>f
2884 </li>
2885 </ul>
2886
2887 !!end
2888
2889 !! test
2890 Definition Lists: Nesting: Multi-level (Parsoid only)
2891 !! options
2892 parsoid
2893 !! wikitext
2894 ;t1 :d1
2895 ;;t2 ::d2
2896 ;;;t3 :::d3
2897 !! html
2898 <dl>
2899 <dt>t1 </dt>
2900 <dd>d1</dd>
2901 <dt>
2902 <dl>
2903 <dt>t2 </dt>
2904 <dd>:d2</dd>
2905 <dt>
2906 <dl>
2907 <dt>t3 </dt>
2908 <dd>::d3</dd>
2909 </dl>
2910 </dt>
2911 </dl>
2912 </dt>
2913 </dl>
2914
2915
2916 !! end
2917
2918
2919 !! test
2920 Definition Lists: Nesting: Test 2 (Parsoid only)
2921 !! options
2922 parsoid
2923 !! wikitext
2924 ;t1
2925 ::d2
2926 !! html
2927 <dl>
2928 <dt>t1</dt>
2929 <dd>
2930 <dl>
2931 <dd>d2</dd>
2932 </dl>
2933 </dd>
2934 </dl>
2935
2936 !! end
2937
2938
2939 !! test
2940 Definition Lists: Nesting: Test 3 (Parsoid only)
2941 !! options
2942 parsoid
2943 !! wikitext
2944 :;t1
2945 ::::d2
2946 !! html
2947 <dl>
2948 <dd>
2949 <dl>
2950 <dt>t1</dt>
2951 <dd>
2952 <dl>
2953 <dd>
2954 <dl>
2955 <dd>d2</dd>
2956 </dl>
2957 </dd>
2958 </dl>
2959 </dd>
2960 </dl>
2961 </dd>
2962 </dl>
2963
2964 !! end
2965
2966
2967 !! test
2968 Definition Lists: Nesting: Test 4
2969 !! wikitext
2970 ::;t3
2971 :::d3
2972 !! html
2973 <dl>
2974 <dd><dl>
2975 <dd><dl>
2976 <dt>t3
2977 </dt>
2978 <dd>d3
2979 </dd>
2980 </dl>
2981 </dd>
2982 </dl>
2983 </dd>
2984 </dl>
2985
2986 !! end
2987
2988
2989 ## The Parsoid team believes the following three test exposes a
2990 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2991 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2992 !! test
2993 Definition Lists: Mixed Lists: Test 1
2994 !! wikitext
2995 :;* foo
2996 ::* bar
2997 :; baz
2998 !! html/php
2999 <dl>
3000 <dd><dl>
3001 <dt><ul>
3002 <li> foo
3003 </li>
3004 <li> bar
3005 </li>
3006 </ul>
3007 </dt>
3008 </dl>
3009 <dl>
3010 <dt> baz
3011 </dt>
3012 </dl>
3013 </dd>
3014 </dl>
3015
3016 !! html/parsoid
3017 <dl>
3018 <dd><dl>
3019 <dt><ul>
3020 <li> foo
3021 </li>
3022 </ul></dt>
3023 <dd><ul>
3024 <li> bar
3025 </li>
3026 </ul></dd>
3027 <dt> baz</dt>
3028 </dl></dd>
3029 </dl>
3030 !! end
3031
3032 !! test
3033 Definition Lists: Mixed Lists: Test 2
3034 !! wikitext
3035 *: d1
3036 *: d2
3037 !! html
3038 <ul>
3039 <li><dl>
3040 <dd> d1
3041 </dd>
3042 <dd> d2
3043 </dd>
3044 </dl>
3045 </li>
3046 </ul>
3047
3048 !! end
3049
3050
3051 !! test
3052 Definition Lists: Mixed Lists: Test 3
3053 !! wikitext
3054 *::: d1
3055 *::: d2
3056 !! html
3057 <ul>
3058 <li><dl>
3059 <dd><dl>
3060 <dd><dl>
3061 <dd> d1
3062 </dd>
3063 <dd> d2
3064 </dd>
3065 </dl>
3066 </dd>
3067 </dl>
3068 </dd>
3069 </dl>
3070 </li>
3071 </ul>
3072
3073 !! end
3074
3075
3076 !! test
3077 Definition Lists: Mixed Lists: Test 4
3078 !! wikitext
3079 *;d1 :d2
3080 *;d3 :d4
3081 !! html
3082 <ul>
3083 <li><dl>
3084 <dt>d1&#160;</dt>
3085 <dd>d2
3086 </dd>
3087 <dt>d3&#160;</dt>
3088 <dd>d4
3089 </dd>
3090 </dl>
3091 </li>
3092 </ul>
3093
3094 !! end
3095
3096
3097 !! test
3098 Definition Lists: Mixed Lists: Test 5
3099 !! wikitext
3100 *:d1
3101 *:: d2
3102 !! html
3103 <ul>
3104 <li><dl>
3105 <dd>d1
3106 <dl>
3107 <dd> d2
3108 </dd>
3109 </dl>
3110 </dd>
3111 </dl>
3112 </li>
3113 </ul>
3114
3115 !! end
3116
3117
3118 !! test
3119 Definition Lists: Mixed Lists: Test 6
3120 !! wikitext
3121 #*:d1
3122 #*::: d3
3123 !! html
3124 <ol>
3125 <li><ul>
3126 <li><dl>
3127 <dd>d1
3128 <dl>
3129 <dd><dl>
3130 <dd> d3
3131 </dd>
3132 </dl>
3133 </dd>
3134 </dl>
3135 </dd>
3136 </dl>
3137 </li>
3138 </ul>
3139 </li>
3140 </ol>
3141
3142 !! end
3143
3144
3145 !! test
3146 Definition Lists: Mixed Lists: Test 7
3147 !! wikitext
3148 :* d1
3149 :* d2
3150 !! html
3151 <dl>
3152 <dd><ul>
3153 <li> d1
3154 </li>
3155 <li> d2
3156 </li>
3157 </ul>
3158 </dd>
3159 </dl>
3160
3161 !! end
3162
3163
3164 !! test
3165 Definition Lists: Mixed Lists: Test 8
3166 !! wikitext
3167 :* d1
3168 ::* d2
3169 !! html
3170 <dl>
3171 <dd><ul>
3172 <li> d1
3173 </li>
3174 </ul>
3175 <dl>
3176 <dd><ul>
3177 <li> d2
3178 </li>
3179 </ul>
3180 </dd>
3181 </dl>
3182 </dd>
3183 </dl>
3184
3185 !! end
3186
3187
3188 !! test
3189 Definition Lists: Mixed Lists: Test 9
3190 !! wikitext
3191 *;foo :bar
3192 !! html
3193 <ul>
3194 <li><dl>
3195 <dt>foo&#160;</dt>
3196 <dd>bar
3197 </dd>
3198 </dl>
3199 </li>
3200 </ul>
3201
3202 !! end
3203
3204
3205 !! test
3206 Definition Lists: Mixed Lists: Test 10
3207 !! wikitext
3208 *#;foo :bar
3209 !! html
3210 <ul>
3211 <li><ol>
3212 <li><dl>
3213 <dt>foo&#160;</dt>
3214 <dd>bar
3215 </dd>
3216 </dl>
3217 </li>
3218 </ol>
3219 </li>
3220 </ul>
3221
3222 !! end
3223
3224 # The Parsoid team disagrees with the PHP parser's seemingly-random
3225 # rules regarding dd/dt on the next two tests. Parsoid is more
3226 # consistent, and recognizes the shared nesting and keeps the
3227 # still-open tags around until the nesting is complete.
3228
3229 !! test
3230 Definition Lists: Mixed Lists: Test 11
3231 !! wikitext
3232 *#*#;*;;foo :bar
3233 *#*#;boo :baz
3234 !! html/php
3235 <ul>
3236 <li><ol>
3237 <li><ul>
3238 <li><ol>
3239 <li><dl>
3240 <dt>foo&#160;</dt>
3241 <dd><ul>
3242 <li><dl>
3243 <dt><dl>
3244 <dt>bar
3245 </dt>
3246 </dl>
3247 </dd>
3248 </dl>
3249 </li>
3250 </ul>
3251 </dd>
3252 </dl>
3253 <dl>
3254 <dt>boo&#160;</dt>
3255 <dd>baz
3256 </dd>
3257 </dl>
3258 </li>
3259 </ol>
3260 </li>
3261 </ul>
3262 </li>
3263 </ol>
3264 </li>
3265 </ul>
3266
3267 !! html/parsoid
3268 <ul>
3269 <li>
3270 <ol>
3271 <li>
3272 <ul>
3273 <li>
3274 <ol>
3275 <li>
3276 <dl>
3277 <dt>
3278 <ul>
3279 <li>
3280 <dl>
3281 <dt>
3282 <dl>
3283 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3284 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3285 </dl></dt>
3286 </dl></li>
3287 </ul></dt>
3288 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3289 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3290 </dl></li>
3291 </ol></li>
3292 </ul></li>
3293 </ol></li>
3294 </ul>
3295 !! end
3296
3297
3298 !! test
3299 Definition Lists: Weird Ones: Test 1
3300 !! wikitext
3301 *#;*::;; foo : bar (who uses this?)
3302 !! html/php
3303 <ul>
3304 <li><ol>
3305 <li><dl>
3306 <dt> foo&#160;</dt>
3307 <dd><ul>
3308 <li><dl>
3309 <dd><dl>
3310 <dd><dl>
3311 <dt><dl>
3312 <dt> bar (who uses this?)
3313 </dt>
3314 </dl>
3315 </dd>
3316 </dl>
3317 </dd>
3318 </dl>
3319 </dd>
3320 </dl>
3321 </li>
3322 </ul>
3323 </dd>
3324 </dl>
3325 </li>
3326 </ol>
3327 </li>
3328 </ul>
3329
3330 !! html/parsoid
3331 <ul>
3332 <li>
3333 <ol>
3334 <li>
3335 <dl>
3336 <dt>
3337 <ul>
3338 <li>
3339 <dl>
3340 <dd>
3341 <dl>
3342 <dd>
3343 <dl>
3344 <dt>
3345 <dl>
3346 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3347 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3348 </dl></dt>
3349 </dl></dd>
3350 </dl></dd>
3351 </dl></li>
3352 </ul></dt>
3353 </dl></li>
3354 </ol></li>
3355 </ul>
3356 !! end
3357
3358 ###
3359 ### External links
3360 ###
3361 !! test
3362 External links: non-bracketed
3363 !! wikitext
3364 Non-bracketed: http://example.com
3365 !! html
3366 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3367 </p>
3368 !! end
3369
3370 !! test
3371 External links: numbered
3372 !! wikitext
3373 Numbered: [http://example.com]
3374 Numbered: [http://example.net]
3375 Numbered: [http://example.com]
3376 !! html
3377 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3378 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3379 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3380 </p>
3381 !!end
3382
3383 !! test
3384 External links: specified text
3385 !! wikitext
3386 Specified text: [http://example.com link]
3387 !! html
3388 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3389 </p>
3390 !!end
3391
3392 !! test
3393 External links: trail
3394 !! wikitext
3395 Linktrails should not work for external links: [http://example.com link]s
3396 !! html
3397 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3398 </p>
3399 !! end
3400
3401 !! test
3402 External links: dollar sign in URL
3403 !! wikitext
3404 http://example.com/1$2345
3405 !! html
3406 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3407 </p>
3408 !! end
3409
3410 !! test
3411 External links: dollar sign in URL (named)
3412 !! wikitext
3413 [http://example.com/1$2345]
3414 !! html
3415 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3416 </p>
3417 !!end
3418
3419 !! test
3420 External links: open square bracket forbidden in URL (bug 4377)
3421 !! wikitext
3422 http://example.com/1[2345
3423 !! html
3424 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3425 </p>
3426 !! end
3427
3428 !! test
3429 External links: open square bracket forbidden in URL (named) (bug 4377)
3430 !! wikitext
3431 [http://example.com/1[2345]
3432 !! html
3433 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3434 </p>
3435 !!end
3436
3437 !! test
3438 External links: nowiki in URL link text (bug 6230)
3439 !! wikitext
3440 [http://example.com/ <nowiki>''example site''</nowiki>]
3441 !! html
3442 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3443 </p>
3444 !! end
3445
3446 !! test
3447 External links: newline forbidden in text (bug 6230 regression check)
3448 !! wikitext
3449 [http://example.com/ first
3450 second]
3451 !! html
3452 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3453 second]
3454 </p>
3455 !!end
3456
3457 !! test
3458 External links: Pipe char between url and text
3459 !! wikitext
3460 [http://example.com | link]
3461 !! html
3462 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3463 </p>
3464 !!end
3465
3466 !! test
3467 External links: protocol-relative URL in brackets
3468 !! wikitext
3469 [//example.com/ Test]
3470 !! html
3471 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3472 </p>
3473 !! end
3474
3475 !! test
3476 External links: protocol-relative URL in brackets without text
3477 !! wikitext
3478 [//example.com]
3479 !! html
3480 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3481 </p>
3482 !! end
3483
3484 !! test
3485 External links: protocol-relative URL in free text is left alone
3486 !! wikitext
3487 //example.com/Foo
3488 !! html
3489 <p>//example.com/Foo
3490 </p>
3491 !!end
3492
3493 !! test
3494 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3495 !! wikitext
3496 foo//example.com/Foo
3497 !! html
3498 <p>foo//example.com/Foo
3499 </p>
3500 !! end
3501
3502 !! test
3503 External image
3504 !! wikitext
3505 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3506 !! html
3507 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3508 </p>
3509 !! end
3510
3511 !! test
3512 External image from https
3513 !! wikitext
3514 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3515 !! html
3516 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3517 </p>
3518 !! end
3519
3520 !! test
3521 External image (when not allowed)
3522 !! options
3523 wgAllowExternalImages=0
3524 !! wikitext
3525 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3526 !! html
3527 <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>
3528 </p>
3529 !! end
3530
3531 !! test
3532 Link to non-http image, no img tag
3533 !! wikitext
3534 Link to non-http image, no img tag: ftp://example.com/test.jpg
3535 !! html
3536 <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>
3537 </p>
3538 !! end
3539
3540 !! test
3541 External links: terminating separator
3542 !! wikitext
3543 Terminating separator: http://example.com/thing,
3544 !! html
3545 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3546 </p>
3547 !! end
3548
3549 !! test
3550 External links: intervening separator
3551 !! wikitext
3552 Intervening separator: http://example.com/1,2,3
3553 !! html
3554 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3555 </p>
3556 !! end
3557
3558 !! test
3559 External links: old bug with URL in query
3560 !! wikitext
3561 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3562 !! html
3563 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3564 </p>
3565 !! end
3566
3567 !! test
3568 External links: old URL-in-URL bug, mixed protocols
3569 !! wikitext
3570 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3571 !! html
3572 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3573 </p>
3574 !!end
3575
3576 !! test
3577 External links: URL in text
3578 !! wikitext
3579 URL in text: [http://example.com http://example.com]
3580 !! html
3581 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3582 </p>
3583 !! end
3584
3585 !! test
3586 External links: Clickable images
3587 !! wikitext
3588 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3589 !! html
3590 <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>
3591 </p>
3592 !!end
3593
3594 !! test
3595 External links: raw ampersand
3596 !! wikitext
3597 Old &amp; use: http://x&y
3598 !! html
3599 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3600 </p>
3601 !! end
3602
3603 !! test
3604 External links: encoded ampersand
3605 !! wikitext
3606 Old &amp; use: http://x&amp;y
3607 !! html
3608 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3609 </p>
3610 !! end
3611
3612 !! test
3613 External links: encoded equals (bug 6102)
3614 !! wikitext
3615 http://example.com/?foo&#61;bar
3616 !! html
3617 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3618 </p>
3619 !! end
3620
3621 !! test
3622 External links: [raw ampersand]
3623 !! wikitext
3624 Old &amp; use: [http://x&y]
3625 !! html
3626 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3627 </p>
3628 !! end
3629
3630 !! test
3631 External links: [encoded ampersand]
3632 !! wikitext
3633 Old &amp; use: [http://x&amp;y]
3634 !! html
3635 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3636 </p>
3637 !! end
3638
3639 !! test
3640 External links: [encoded equals] (bug 6102)
3641 !! wikitext
3642 [http://example.com/?foo&#61;bar]
3643 !! html
3644 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3645 </p>
3646 !! end
3647
3648 !! test
3649 External links: [IDN ignored character reference in hostname; strip it right off]
3650 !! wikitext
3651 [http://e&zwnj;xample.com/]
3652 !! html
3653 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3654 </p>
3655 !! end
3656
3657 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3658 # Where an external link could easily circumvent the sanitization of the text of
3659 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3660 # test demands a higher standard. That's a bit strange.
3661 #
3662 # Example:
3663 #
3664 # http://e‌xample.com -> [http://example.com|http://example.com]
3665 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3666 #
3667 # The first example is sanitized, but the second is not. Any security benefits
3668 # from this production are trivial to circumvent. Either remove this test and
3669 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3670 # the test accordingly.
3671 #
3672 # All our love,
3673 # The Parsoid team.
3674 !! test
3675 External links: IDN ignored character reference in hostname; strip it right off
3676 !! wikitext
3677 http://e&zwnj;xample.com/
3678 !! html
3679 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3680 </p>
3681 !! end
3682
3683 !! test
3684 External links: www.jpeg.org (bug 554)
3685 !! wikitext
3686 http://www.jpeg.org
3687 !! html
3688 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3689 </p>
3690 !! end
3691
3692 !! test
3693 External links: URL within URL (original bug 2)
3694 !! wikitext
3695 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3696 !! html
3697 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3698 </p>
3699 !! end
3700
3701 !! test
3702 BUG 361: URL inside bracketed URL
3703 !! wikitext
3704 [http://www.example.com/foo http://www.example.com/bar]
3705 !! html
3706 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3707 </p>
3708 !! end
3709
3710 !! test
3711 BUG 361: URL within URL, not bracketed
3712 !! wikitext
3713 http://www.example.com/foo?=http://www.example.com/bar
3714 !! html
3715 <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>
3716 </p>
3717 !! end
3718
3719 !! test
3720 BUG 289: ">"-token in URL-tail
3721 !! wikitext
3722 http://www.example.com/<hello>
3723 !! html
3724 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3725 </p>
3726 !!end
3727
3728 !! test
3729 BUG 289: literal ">"-token in URL-tail
3730 !! wikitext
3731 http://www.example.com/<b>html</b>
3732 !! html
3733 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3734 </p>
3735 !!end
3736
3737 !! test
3738 BUG 289: ">"-token in bracketed URL
3739 !! wikitext
3740 [http://www.example.com/<hello> stuff]
3741 !! html
3742 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3743 </p>
3744 !!end
3745
3746 !! test
3747 BUG 289: literal ">"-token in bracketed URL
3748 !! wikitext
3749 [http://www.example.com/<b>html</b> stuff]
3750 !! html
3751 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3752 </p>
3753 !!end
3754
3755 !! test
3756 BUG 289: literal double quote at end of URL
3757 !! wikitext
3758 http://www.example.com/"hello"
3759 !! html
3760 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3761 </p>
3762 !!end
3763
3764 !! test
3765 BUG 289: literal double quote in bracketed URL
3766 !! wikitext
3767 [http://www.example.com/"hello" stuff]
3768 !! html
3769 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3770 </p>
3771 !!end
3772
3773 !! test
3774 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3775 !! wikitext
3776 [http://www.example.com test]
3777 !! html
3778 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3779 </p>
3780 !! end
3781
3782 !! test
3783 External links: link text with spaces
3784 !! wikitext
3785 [http://www.example.com a b c]
3786 [http://www.example.com ''a'' ''b'']
3787 !! html
3788 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3789 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3790 </p>
3791 !! end
3792
3793 !! test
3794 External links: wiki links within external link (Bug 3695)
3795 !! wikitext
3796 [http://example.com [[wikilink]] embedded in ext link]
3797 !! html/php
3798 <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>
3799 </p>
3800 !! html/parsoid
3801 <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>
3802 !! end
3803
3804 !! test
3805 BUG 787: Links with one slash after the url protocol are invalid
3806 !! wikitext
3807 http:/example.com
3808
3809 [http:/example.com title]
3810 !! html
3811 <p>http:/example.com
3812 </p><p>[http:/example.com title]
3813 </p>
3814 !! end
3815
3816 !! test
3817 Bracketed external links with template-generated invalid target
3818 !! wikitext
3819 [{{echo|http:/example.com}} title]
3820 !! html
3821 <p>[http:/example.com title]
3822 </p>
3823 !! end
3824
3825 !! test
3826 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3827 !! wikitext
3828 ''[http://example.com text'']
3829 [http://example.com '''text]'''
3830 ''Something [http://example.com in italic'']
3831 ''Something [http://example.com mixed''''', even bold]'''
3832 '''''Now [http://example.com both''''']
3833 !! html
3834 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3835 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3836 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3837 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3838 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3839 </p>
3840 !! end
3841
3842
3843 !! test
3844 Bug 4781: %26 in URL
3845 !! wikitext
3846 http://www.example.com/?title=AT%26T
3847 !! html
3848 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3849 </p>
3850 !! end
3851
3852 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3853 # % is actually legal in HTML5. Any change in output would need testing though.
3854 !! test
3855 Bug 4781, 5267: %25 in URL
3856 !! wikitext
3857 http://www.example.com/?title=100%25_Bran
3858 !! html
3859 <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>
3860 </p>
3861 !! end
3862
3863 !! test
3864 Bug 4781, 5267: %28, %29 in URL
3865 !! wikitext
3866 http://www.example.com/?title=Ben-Hur_%281959_film%29
3867 !! html
3868 <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>
3869 </p>
3870 !! end
3871
3872
3873 !! test
3874 Bug 4781: %26 in autonumber URL
3875 !! wikitext
3876 [http://www.example.com/?title=AT%26T]
3877 !! html
3878 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3879 </p>
3880 !! end
3881
3882 !! test
3883 Bug 4781, 5267: %26 in autonumber URL
3884 !! wikitext
3885 [http://www.example.com/?title=100%25_Bran]
3886 !! html
3887 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3888 </p>
3889 !! end
3890
3891 !! test
3892 Bug 4781, 5267: %28, %29 in autonumber URL
3893 !! wikitext
3894 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3895 !! html
3896 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3897 </p>
3898 !! end
3899
3900
3901 !! test
3902 Bug 4781: %26 in bracketed URL
3903 !! wikitext
3904 [http://www.example.com/?title=AT%26T link]
3905 !! html
3906 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3907 </p>
3908 !! end
3909
3910 !! test
3911 Bug 4781, 5267: %26 in bracketed URL
3912 !! wikitext
3913 [http://www.example.com/?title=100%25_Bran link]
3914 !! html
3915 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3916 </p>
3917 !! end
3918
3919 !! test
3920 Bug 4781, 5267: %28, %29 in bracketed URL
3921 !! wikitext
3922 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3923 !! html
3924 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3925 </p>
3926 !! end
3927
3928 !! test
3929 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3930 !! wikitext
3931 Some [http://example.com/ pretty ''italics'' and stuff]!
3932 !! html
3933 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3934 </p>
3935 !! end
3936
3937 !! test
3938 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3939 !! wikitext
3940 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3941 !! html
3942 <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>
3943 </p>
3944 !! end
3945
3946 !! test
3947 External link containing double-single-quotes with no space separating the url from text in italics
3948 !! wikitext
3949 [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]].]
3950 !! html/php
3951 <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>
3952 </p>
3953 !! html/parsoid
3954 <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>
3955 !! end
3956
3957 !! test
3958 External link with comments in link text
3959 !! wikitext
3960 [http://www.google.com Google <!-- comment -->]
3961 !! html
3962 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3963 </p>
3964 !! end
3965
3966 !! test
3967 URL-encoding in URL functions (single parameter)
3968 !! wikitext
3969 {{localurl:Some page|amp=&}}
3970 !! html
3971 <p>/index.php?title=Some_page&amp;amp=&amp;
3972 </p>
3973 !! end
3974
3975 !! test
3976 URL-encoding in URL functions (multiple parameters)
3977 !! wikitext
3978 {{localurl:Some page|q=?&amp=&}}
3979 !! html
3980 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3981 </p>
3982 !! end
3983
3984 !! test
3985 Brackets in urls
3986 !! wikitext
3987 http://example.com/index.php?foozoid%5B%5D=bar
3988
3989 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3990 !! html
3991 <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><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3993 </p>
3994 !! end
3995
3996 !! test
3997 IPv6 urls (bug 21261)
3998 !! options
3999 disabled
4000 !! wikitext
4001 http://[2404:130:0:1000::187:2]/index.php
4002 !! html
4003 <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>
4004 </p>
4005 !! end
4006
4007 !! test
4008 Non-extlinks in brackets
4009 !! wikitext
4010 [foo]
4011 [foo bar]
4012 [foo ''bar'']
4013 [fool's] errand
4014 [fool's errand]
4015 [{{echo|foo}}]
4016 [{{echo|foo}} bar]
4017 [{{echo|foo}} ''bar'']
4018 [{{echo|foo}}l's] errand
4019 [{{echo|foo}}l's errand]
4020 [url={{echo|foo}}]
4021 [url=http://example.com]
4022 !! html
4023 <p>[foo]
4024 [foo bar]
4025 [foo <i>bar</i>]
4026 [fool's] errand
4027 [fool's errand]
4028 [foo]
4029 [foo bar]
4030 [foo <i>bar</i>]
4031 [fool's] errand
4032 [fool's errand]
4033 [url=foo]
4034 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4035 </p>
4036 !! end
4037
4038 !! test
4039 Percent encoding in external links
4040 !! wikitext
4041 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4042 !! html/php
4043 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4044 </p>
4045 !! html/parsoid
4046 <p><a rel="mw:ExtLink"
4047 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4048 !! end
4049
4050 !! test
4051 Use url link syntax for links where the content is equal the link target
4052 !! wikitext
4053 http://example.com
4054 !! html/php
4055 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4056 </p>
4057 !! html/parsoid
4058 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4059 !! end
4060
4061 !! test
4062 Parenthesis in external links, especially URL links
4063 !! wikitext
4064 http://example.com)
4065
4066 http://example.com/test)
4067
4068 http://example.com/(test)
4069
4070 http://example.com/((test)
4071
4072 (http://example.com/(test))
4073
4074 (http://example.com/(test)))))
4075
4076 http://example.com/a)b
4077
4078 [http://example.com) foo]
4079 !! html/php
4080 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</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/(test)))))">http://example.com/(test)))))</a>
4086 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4087 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4088 </p>
4089 !! html/parsoid
4090 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</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/(test)))))">http://example.com/(test)))))</a></p>
4096 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4097 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4098 !! end
4099
4100 !! test
4101 Parenthesis in external links, w/ transclusion or comment
4102 !! wikitext
4103 (http://example.com/{{echo|hi}})
4104
4105 (http://example.com<!-- hi -->)
4106 !! html/php
4107 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4108 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4109 </p>
4110 !! html/parsoid
4111 <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>
4112
4113 <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>
4114 !! end
4115
4116 ###
4117 ### Quotes
4118 ###
4119
4120 !! test
4121 Quotes
4122 !! wikitext
4123 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4124
4125 Normal text. '''''Bold italic text.''''' Normal text.
4126 !! html
4127 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4128 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4129 </p>
4130 !! end
4131
4132
4133 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4134 # parser strips. The wikitext contains just the first half of the bold
4135 # quote pair.
4136 !! test
4137 Unclosed and unmatched quotes
4138 !! wikitext
4139 '''''Bold italic text '''with bold deactivated''' in between.'''''
4140
4141 '''''Bold italic text ''with italic deactivated'' in between.'''''
4142
4143 '''Bold text..
4144
4145 ..spanning two paragraphs (should not work).'''
4146
4147 '''Bold tag left open
4148
4149 ''Italic tag left open
4150
4151 Normal text.
4152
4153 <!-- Unmatching number of opening, closing tags: -->
4154 '''This year''''s election ''should'' beat '''last year''''s.
4155
4156 ''Tom'''s car is bigger than ''Susan'''s.
4157
4158 Plain ''italic'''s plain
4159 !! html/php
4160 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4161 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4162 </p><p><b>Bold text..</b>
4163 </p><p>..spanning two paragraphs (should not work).
4164 </p><p><b>Bold tag left open</b>
4165 </p><p><i>Italic tag left open</i>
4166 </p><p>Normal text.
4167 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4168 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4169 </p><p>Plain <i>italic'</i>s plain
4170 </p>
4171 !! html/parsoid
4172 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4173 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4174 </p><p><b>Bold text..</b>
4175 </p><p>..spanning two paragraphs (should not work).<b></b>
4176 </p><p><b>Bold tag left open</b>
4177 </p><p><i>Italic tag left open</i>
4178 </p><p>Normal text.
4179 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4180 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4181 </p><p>Plain <i>italic'</i>s plain
4182 </p>
4183 !! end
4184
4185 ###
4186 ### Tables
4187 ###
4188 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4189 ###
4190
4191 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4192 # is the bare minimum required by the spec, see:
4193 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4194 # Parsoid team replies: empty table tags are legal in HTML5
4195 !! test
4196 A table with no data.
4197 !! options
4198 parsoid=wt2html
4199 !! wikitext
4200 {||}
4201 !! html/php
4202
4203 !! html/parsoid
4204 <table></table>
4205
4206 !! end
4207
4208 !! test
4209 A table with stray table end tags on start tag line (wt2html)
4210 !! options
4211 parsoid=wt2html
4212 !! wikitext
4213 {|style="color: red;"|}
4214
4215 {|style="color: red;" |}
4216 |foo
4217 |}
4218
4219 {|style="color: red;"|} id="foo"
4220 |foo
4221 |}
4222
4223 {|style="color: red;" |} id="foo"
4224 |foo
4225 |}
4226 !! html
4227 <table style="color: red;"></table>
4228
4229 <table style="color: red;">
4230 <tbody><tr>
4231 <td>foo</td>
4232 </tr></tbody>
4233 </table>
4234
4235 <table style="color: red;" id="foo">
4236 <tbody><tr>
4237 <td>foo</td>
4238 </tr></tbody>
4239 </table>
4240
4241 <table style="color: red;" id="foo">
4242 <tbody><tr>
4243 <td>foo</td>
4244 </tr></tbody>
4245 </table>
4246
4247 !! end
4248
4249 !! test
4250 A table with no data (take 2)
4251 !! wikitext
4252 {|
4253 |}
4254 !! html/parsoid
4255 <table></table>
4256 !! end
4257
4258 # A table with nothing but a caption is invalid XHTML, we might want to render
4259 # this as <p>caption</p>
4260 # Parsoid team replies: table with only a caption is legal in HTML5
4261 !! test
4262 A table with nothing but a caption
4263 !! wikitext
4264 {|
4265 |+ caption
4266 |}
4267 !! html/php
4268 <table>
4269 <caption> caption
4270 </caption><tr><td></td></tr></table>
4271
4272 !! html/parsoid
4273 <table><caption> caption</caption></table>
4274 !! end
4275
4276 !! test
4277 A table with caption with default-spaced attributes and a table row
4278 !! wikitext
4279 {|
4280 |+ style="color: red;" | caption1
4281 |-
4282 | foo
4283 |}
4284 !! html
4285 <table>
4286 <caption style="color: red;"> caption1
4287 </caption>
4288 <tr>
4289 <td> foo
4290 </td></tr></table>
4291
4292 !! end
4293
4294 !! test
4295 A table with captions with non-default spaced attributes and a table row
4296 !! wikitext
4297 {|
4298 |+style="color: red;"|caption2
4299 |+ style="color: red;"| caption3
4300 |-
4301 | foo
4302 |}
4303 !! html
4304 <table>
4305 <caption style="color: red;">caption2
4306 </caption>
4307 <caption style="color: red;"> caption3
4308 </caption>
4309 <tr>
4310 <td> foo
4311 </td></tr></table>
4312
4313 !! end
4314
4315 !! test
4316 Table td-cell syntax variations
4317 !! wikitext
4318 {|
4319 | foo bar foo | baz
4320 | foo bar foo || baz
4321 | style='color:red;' | baz
4322 | style='color:red;' || baz
4323 |}
4324 !! html
4325 <table>
4326 <tr>
4327 <td> baz
4328 </td>
4329 <td> foo bar foo </td>
4330 <td> baz
4331 </td>
4332 <td style="color:red;"> baz
4333 </td>
4334 <td> style='color:red;' </td>
4335 <td> baz
4336 </td></tr></table>
4337
4338 !! end
4339
4340 !! test
4341 Simple table
4342 !! wikitext
4343 {|
4344 | 1 || 2
4345 |-
4346 | 3 || 4
4347 |}
4348 !! html
4349 <table>
4350 <tr>
4351 <td> 1 </td>
4352 <td> 2
4353 </td></tr>
4354 <tr>
4355 <td> 3 </td>
4356 <td> 4
4357 </td></tr></table>
4358
4359 !! end
4360
4361 !! test
4362 Simple table but with multiple dashes for row wikitext
4363 !! wikitext
4364 {|
4365 | foo
4366 |-----
4367 | bar
4368 |}
4369 !! html
4370 <table>
4371 <tr>
4372 <td> foo
4373 </td></tr>
4374 <tr>
4375 <td> bar
4376 </td></tr></table>
4377
4378 !! end
4379 !! test
4380 Multiplication table
4381 !! wikitext
4382 {| border="1" cellpadding="2"
4383 |+Multiplication table
4384 |-
4385 ! &times; !! 1 !! 2 !! 3
4386 |-
4387 ! 1
4388 | 1 || 2 || 3
4389 |-
4390 ! 2
4391 | 2 || 4 || 6
4392 |-
4393 ! 3
4394 | 3 || 6 || 9
4395 |-
4396 ! 4
4397 | 4 || 8 || 12
4398 |-
4399 ! 5
4400 | 5 || 10 || 15
4401 |}
4402 !! html
4403 <table border="1" cellpadding="2">
4404 <caption>Multiplication table
4405 </caption>
4406 <tr>
4407 <th> &#215; </th>
4408 <th> 1 </th>
4409 <th> 2 </th>
4410 <th> 3
4411 </th></tr>
4412 <tr>
4413 <th> 1
4414 </th>
4415 <td> 1 </td>
4416 <td> 2 </td>
4417 <td> 3
4418 </td></tr>
4419 <tr>
4420 <th> 2
4421 </th>
4422 <td> 2 </td>
4423 <td> 4 </td>
4424 <td> 6
4425 </td></tr>
4426 <tr>
4427 <th> 3
4428 </th>
4429 <td> 3 </td>
4430 <td> 6 </td>
4431 <td> 9
4432 </td></tr>
4433 <tr>
4434 <th> 4
4435 </th>
4436 <td> 4 </td>
4437 <td> 8 </td>
4438 <td> 12
4439 </td></tr>
4440 <tr>
4441 <th> 5
4442 </th>
4443 <td> 5 </td>
4444 <td> 10 </td>
4445 <td> 15
4446 </td></tr></table>
4447
4448 !! end
4449
4450 !! test
4451 Accept "||" in table headings
4452 !! wikitext
4453 {|
4454 !h1 || h2
4455 |}
4456 !! html
4457 <table>
4458 <tr>
4459 <th>h1 </th>
4460 <th> h2
4461 </th></tr></table>
4462
4463 !! end
4464
4465 !! test
4466 Accept "||" in indented table headings
4467 !! wikitext
4468 :{|
4469 !h1 || h2
4470 |}
4471 !! html
4472 <dl><dd><table>
4473 <tr>
4474 <th>h1 </th>
4475 <th> h2
4476 </th></tr></table></dd></dl>
4477
4478 !! end
4479
4480 !! test
4481 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4482 !! wikitext
4483 {|
4484 !| h1
4485 || a
4486 |}
4487 !! html
4488 <table>
4489 <tr>
4490 <th> h1
4491 </th>
4492 <td> a
4493 </td></tr></table>
4494
4495 !! end
4496
4497 !!test
4498 Accept "| !" at start of line in tables (ignore !-attribute)
4499 !! wikitext
4500 {|
4501 |-
4502 | !style="color:red" | bar
4503 |}
4504 !! html
4505 <table>
4506
4507 <tr>
4508 <td> bar
4509 </td></tr></table>
4510
4511 !!end
4512
4513 !!test
4514 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 +/-
4515 !! wikitext
4516 {|
4517 |-
4518 |style='color:red;'|+1
4519 |style='color:blue;'|-1
4520 |-
4521 | 1 || 2 || 3
4522 | 1 ||+2 ||-3
4523 |-
4524 | +1
4525 | -1
4526 |}
4527 !! html
4528 <table>
4529
4530 <tr>
4531 <td style="color:red;">+1
4532 </td>
4533 <td style="color:blue;">-1
4534 </td></tr>
4535 <tr>
4536 <td> 1 </td>
4537 <td> 2 </td>
4538 <td> 3
4539 </td>
4540 <td> 1 </td>
4541 <td>+2 </td>
4542 <td>-3
4543 </td></tr>
4544 <tr>
4545 <td> +1
4546 </td>
4547 <td> -1
4548 </td></tr></table>
4549
4550 !!end
4551
4552 !! test
4553 Table rowspan
4554 !! wikitext
4555 {| border=1
4556 | Cell 1, row 1
4557 |rowspan=2| Cell 2, row 1 (and 2)
4558 | Cell 3, row 1
4559 |-
4560 | Cell 1, row 2
4561 | Cell 3, row 2
4562 |}
4563 !! html
4564 <table border="1">
4565 <tr>
4566 <td> Cell 1, row 1
4567 </td>
4568 <td rowspan="2"> Cell 2, row 1 (and 2)
4569 </td>
4570 <td> Cell 3, row 1
4571 </td></tr>
4572 <tr>
4573 <td> Cell 1, row 2
4574 </td>
4575 <td> Cell 3, row 2
4576 </td></tr></table>
4577
4578 !! end
4579
4580 !! test
4581 Nested table
4582 !! wikitext
4583 {| border=1
4584 | &alpha;
4585 |
4586 {| bgcolor=#ABCDEF border=2
4587 |nested
4588 |-
4589 |table
4590 |}
4591 |the original table again
4592 |}
4593 !! html
4594 <table border="1">
4595 <tr>
4596 <td> &#945;
4597 </td>
4598 <td>
4599 <table bgcolor="#ABCDEF" border="2">
4600 <tr>
4601 <td>nested
4602 </td></tr>
4603 <tr>
4604 <td>table
4605 </td></tr></table>
4606 </td>
4607 <td>the original table again
4608 </td></tr></table>
4609
4610 !! end
4611
4612 !! test
4613 Invalid attributes in table cell (bug 1830)
4614 !! wikitext
4615 {|
4616 |Cell:|broken
4617 |}
4618 !! html
4619 <table>
4620 <tr>
4621 <td>broken
4622 </td></tr></table>
4623
4624 !! end
4625
4626
4627 !! test
4628 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4629 !! wikitext
4630 {|
4631 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4632 !! html
4633 <table>
4634 <tr>
4635 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4636 <td>]" onmouseover="alert(document.cookie)"&gt;test
4637 </td>
4638 </tr>
4639 </table>
4640
4641 !! end
4642
4643
4644 !! test
4645 Indented table markup mixed with indented pre content (proposed in bug 6200)
4646 !! wikitext
4647 <table>
4648 <tr>
4649 <td>
4650 Text that should be rendered preformatted
4651 </td>
4652 </tr>
4653 </table>
4654 !! html
4655 <table>
4656 <tr>
4657 <td>
4658 <pre>Text that should be rendered preformatted
4659 </pre>
4660 </td>
4661 </tr>
4662 </table>
4663
4664 !! end
4665
4666 !! test
4667 Template-generated table cell attributes and cell content
4668 !! wikitext
4669 {|
4670 |{{table_attribs}}
4671 | {{table_attribs}}
4672 |}
4673 !! html
4674 <table>
4675 <tr>
4676 <td style="color: red"> Foo
4677 </td>
4678 <td style="color: red"> Foo
4679 </td></tr></table>
4680
4681 !! end
4682
4683 !! test
4684 Template-generated table cell attributes and cell content (2)
4685 !! wikitext
4686 {|
4687 |align=center {{table_attribs}}
4688 |}
4689 !! html
4690 <table>
4691 <tr>
4692 <td align="center" style="color: red"> Foo
4693 </td></tr></table>
4694
4695 !! end
4696
4697 !! test
4698 Template-generated table cell attributes and cell content (3)
4699 !! wikitext
4700 {|
4701 |align=center {{table_cells}}
4702 |}
4703 !! html
4704 <table>
4705 <tr>
4706 <td align="center" style="color: red"> Foo </td>
4707 <td> Bar </td>
4708 <td> Baz
4709 </td></tr></table>
4710
4711 !! end
4712
4713 !! test
4714 Table with row followed by newlines and table heading
4715 !! wikitext
4716 {|
4717 |-
4718
4719 ! foo
4720 |}
4721 !! html
4722 <table>
4723
4724
4725 <tr>
4726 <th> foo
4727 </th></tr></table>
4728
4729 !! end
4730
4731 !! test
4732 Table with empty line following the start tag
4733 !! wikitext
4734 {|
4735
4736 |-
4737 | foo
4738 |}
4739 !! html
4740 <table>
4741
4742
4743 <tr>
4744 <td> foo
4745 </td></tr></table>
4746
4747 !! end
4748
4749 # FIXME: Preserve the attribute properly (with an empty string as value) in
4750 # the PHP parser. Parsoid implements the behavior below.
4751 !! test
4752 Table attributes with empty value
4753 !! wikitext
4754 {|
4755 | style=| hello
4756 |}
4757 !! html/parsoid
4758 <table>
4759 <tbody>
4760 <tr>
4761 <td style=""> hello
4762 </td></tr></tbody></table>
4763
4764 !! end
4765
4766 !! test
4767 Wikitext table with a lot of comments
4768 !! wikitext
4769 {|
4770 <!-- c0 -->
4771 | foo
4772 <!-- c1 -->
4773 |- <!-- c2 -->
4774 <!-- c3 -->
4775 |<!-- c4 -->
4776 <!-- c5 -->
4777 |}
4778 !! html
4779 <table>
4780 <tr>
4781 <td> foo
4782 </td></tr>
4783 <tr>
4784 <td>
4785 </td></tr></table>
4786
4787 !! end
4788
4789 !! test
4790 Wikitext table with double-line table cell
4791 !! wikitext
4792 {|
4793 |a
4794 b
4795 |}
4796 !! html
4797 <table>
4798 <tr>
4799 <td>a
4800 <p>b
4801 </p>
4802 </td></tr></table>
4803
4804 !! end
4805
4806 !! test
4807 Table cell with a single comment
4808 !! wikitext
4809 {|
4810 | <!-- c1 -->
4811 | a
4812 |}
4813 !! html
4814 <table>
4815 <tr>
4816 <td>
4817 </td>
4818 <td> a
4819 </td></tr></table>
4820
4821 !! end
4822
4823 # The expected HTML structure in this test is debatable. The PHP parser does
4824 # not parse this kind of table at all. The main focus for Parsoid is on
4825 # round-tripping, so this output is ok for now. TODO: revisit!
4826 !! test
4827 Wikitext table with html-syntax row
4828 !! wikitext
4829 {|
4830 |-
4831 <td>foo</td>
4832 |}
4833 !! html/parsoid
4834 <table>
4835 <tbody>
4836 <tr>
4837 <td>foo</td></tr></tbody></table>
4838 !! end
4839
4840 !! test
4841 Implicit <td> after a |-
4842 (PHP parser relies on Tidy to add the missing <td> tags)
4843 !! options
4844 parsoid=wt2html,wt2wt
4845 !! wikitext
4846 {|
4847 |-
4848 a
4849 |}
4850 !! html
4851 <table>
4852 <tr><td>a</td></tr>
4853 </table>
4854 !! end
4855
4856 !! test
4857 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4858 (PHP parser relies on Tidy to add the missing <td> tags)
4859 !! options
4860 parsoid=wt2html,wt2wt
4861 !! wikitext
4862 {|
4863 |-
4864 |
4865 a
4866 |-
4867 b
4868 |}
4869 !! html
4870 <table>
4871 <tbody>
4872 <tr><td><pre>a</pre></td></tr>
4873 <tr><td> b</td></tr>
4874 </tbody>
4875 </table>
4876 !! end
4877
4878 !! test
4879 Lists should be recognized in an implicit <td> context
4880 (PHP parser relies on Tidy to add the missing <td> tags)
4881 !! options
4882 parsoid=wt2html,wt2wt
4883 !! wikitext
4884 {|
4885 |-
4886 *a
4887 |}
4888 !! html
4889 <table>
4890 <tr>
4891 <td><ul>
4892 <li>a</li>
4893 </ul></td>
4894 </tr>
4895 </table>
4896 !! end
4897
4898 !! test
4899 Parsoid: Round-trip tables directly followed by content (bug 51219)
4900 !! options
4901 parsoid=wt2html,wt2wt
4902 !! wikitext
4903 {|
4904 |foo
4905 |} bar
4906
4907 {|
4908 |baz
4909 |}<b>quux</b>
4910 !! html
4911 <table><tbody>
4912 <tr>
4913 <td>foo</td></tr></tbody></table> bar
4914 <table>
4915 <tbody>
4916 <tr>
4917 <td>baz</td></tr></tbody></table><b>quux</b>
4918 !! end
4919
4920 !! test
4921 Parsoid: Default to a newline after tables in new content (bug 51219)
4922 !! options
4923 parsoid=html2wt
4924 !! wikitext
4925 {|
4926 |foo
4927 |}
4928 <nowiki> </nowiki>bar
4929 {|
4930 |baz
4931 |}
4932 '''quux'''
4933 !! html
4934 <table><tbody>
4935 <tr><td>foo</td></tr></tbody></table> bar
4936 <table><tbody>
4937 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4938 !! end
4939
4940 !! test
4941 Parsoid: newline inducing block nodes don't suppress <nowiki>
4942 !! options
4943 parsoid=html2wt
4944 !! wikitext
4945 <nowiki> </nowiki>a
4946
4947 = foo =
4948 !! html
4949 a<h1>foo</h1>
4950 !! end
4951
4952 ###
4953 ### Internal links
4954 ###
4955 !! test
4956 Plain link, capitalized
4957 !! wikitext
4958 [[Main Page]]
4959 !! html
4960 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4961 </p>
4962 !! end
4963
4964 !! test
4965 Plain link, uncapitalized
4966 !! wikitext
4967 [[main Page]]
4968 !! html
4969 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4970 </p>
4971 !! end
4972
4973 !! test
4974 Piped link
4975 !! wikitext
4976 [[Main Page|The Main Page]]
4977 !! html
4978 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4979 </p>
4980 !! end
4981
4982 !! test
4983 Piped link with comment in link text
4984 !! wikitext
4985 [[Main Page|The Main<!--front--> Page]]
4986 !! html
4987 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4988 </p>
4989 !! end
4990
4991 !! test
4992 Broken link
4993 !! wikitext
4994 [[Zigzagzogzagzig]]
4995 !! html
4996 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4997 </p>
4998 !! end
4999
5000 !! test
5001 Broken link with fragment
5002 !! wikitext
5003 [[Zigzagzogzagzig#zug]]
5004 !! html
5005 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5006 </p>
5007 !! end
5008
5009 !! test
5010 Special page link with fragment
5011 !! wikitext
5012 [[Special:Version#anchor]]
5013 !! html
5014 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5015 </p>
5016 !! end
5017
5018 !! test
5019 Nonexistent special page link with fragment
5020 !! wikitext
5021 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5022 !! html
5023 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5024 </p>
5025 !! end
5026
5027 !! test
5028 Link with prefix
5029 !! wikitext
5030 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5031 !! html
5032 <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>
5033 </p>
5034 !! end
5035
5036 !! test
5037 Link with suffix
5038 !! wikitext
5039 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5040 !! html
5041 <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>!!!
5042 </p>
5043 !! end
5044
5045 !! article
5046 prefixed article
5047 !! text
5048 Some text
5049 !! endarticle
5050
5051 !! test
5052 Bug 43661: Piped links with identical prefixes
5053 !! wikitext
5054 [[prefixed article|prefixed articles with spaces]]
5055
5056 [[prefixed article|prefixed articlesaoeu]]
5057
5058 [[Main Page|Main Page test]]
5059 !! html
5060 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5061 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5062 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5063 </p>
5064 !! end
5065
5066
5067 !! test
5068 Link with HTML entity in suffix / tail
5069 !! wikitext
5070 [[Main Page]]&quot;, [[Main Page]]&#97;
5071 !! html
5072 <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;
5073 </p>
5074 !! end
5075
5076 !! test
5077 Link with 3 brackets
5078 !! wikitext
5079 [[[Main Page]]]
5080 !! html
5081 <p>[[[Main Page]]]
5082 </p>
5083 !! end
5084
5085 !! test
5086 Link with 4 brackets
5087 !! wikitext
5088 [[[[Main Page]]]]
5089 !! html
5090 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5091 </p>
5092 !! end
5093
5094 !! test
5095 Piped link with 3 brackets
5096 !! wikitext
5097 [[[main page|the main page]]]
5098 !! html
5099 <p>[[[main page|the main page]]]
5100 </p>
5101 !! end
5102
5103 !! test
5104 Piped link with extlink-like text
5105 !! wikitext
5106 [[Main Page|[bar]]]
5107 [[Main Page|This is a [bar]]]
5108 !! html
5109 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5110 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5111 </p>
5112 !! end
5113
5114 !! test
5115 Link with multiple pipes
5116 !! wikitext
5117 [[Main Page|The|Main|Page]]
5118 !! html
5119 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5120 </p>
5121 !! end
5122
5123 !! test
5124 Link to namespaces
5125 !! wikitext
5126 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5127 !! html
5128 <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>
5129 </p>
5130 !! end
5131
5132 !! article
5133 MemoryAlpha:AlphaTest
5134 !! text
5135 This is an article in the MemoryAlpha namespace
5136 (which shadows the memoryalpha interwiki link).
5137 !! endarticle
5138
5139 !! test
5140 Namespace takes precedence over interwiki link (bug 51680)
5141 !! wikitext
5142 [[MemoryAlpha:AlphaTest]]
5143 !! html
5144 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5145 </p>
5146 !! end
5147
5148 # The previous test doesn't work correctly in html2*, due to not recognizing the
5149 # link as an internal one. This one checks for the correct behavior.
5150 !! test
5151 Link to namespace preferred over interwiki with correct rel attribute
5152 !! options
5153 parsoid=html2wt,html2html
5154 !! wikitext
5155 [[MemoryAlpha:AlphaTest]]
5156 !! html
5157 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5158 </p>
5159 !! end
5160
5161 !! test
5162 Piped link to namespace
5163 !! wikitext
5164 [[Meta:Disclaimers|The disclaimers]]
5165 !! html
5166 <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>
5167 </p>
5168 !! end
5169
5170 !! test
5171 Link containing }
5172 !! wikitext
5173 [[Usually caused by a typo (oops}]]
5174 !! html
5175 <p>[[Usually caused by a typo (oops}]]
5176 </p>
5177 !! end
5178
5179 !! test
5180 Link containing % (not as a hex sequence)
5181 !! wikitext
5182 [[7% Solution]]
5183 !! html
5184 <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>
5185 </p>
5186 !! end
5187
5188 !! test
5189 Link containing % as a single hex sequence interpreted to char
5190 !! wikitext
5191 [[7%25 Solution]]
5192 !! html
5193 <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>
5194 </p>
5195 !!end
5196
5197 !! test
5198 Link containing % as a double hex sequence interpreted to hex sequence
5199 !! wikitext
5200 [[7%2525 Solution]]
5201 !! html
5202 <p>[[7%2525 Solution]]
5203 </p>
5204 !!end
5205
5206 !! test
5207 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5208 Example for such a section: == < ==
5209 !! wikitext
5210 [[%23%3c]][[%23%3e]]
5211 !! html
5212 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5213 </p>
5214 !! end
5215
5216 !! test
5217 Link containing "<#" and ">#" as a hex sequences
5218 !! wikitext
5219 [[%3c%23]][[%3e%23]]
5220 !! html
5221 <p>[[%3c%23]][[%3e%23]]
5222 </p>
5223 !! end
5224
5225 !! test
5226 Link containing an equals sign
5227 !! wikitext
5228 [[Special:BookSources/isbn=4-00-026157-6]]
5229 !! html
5230 <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>
5231 </p>
5232 !! end
5233
5234 !! article
5235 Foo~bar
5236 !! text
5237 Just a test of an article title containing a tilde.
5238 !! endarticle
5239
5240 # note that links containing signatures, like [[Foo~~~~]], are
5241 # massaged by the pre-save transform (PST) and so the tildes are never
5242 # seen by the parser.
5243 !! test
5244 Link containing a tilde
5245 !! wikitext
5246 [[Foo~bar]]
5247 !! html
5248 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5249 </p>
5250 !! end
5251
5252 !! test
5253 Link containing double-single-quotes '' (bug 4598)
5254 !! wikitext
5255 [[Lista d''e paise d''o munno]]
5256 !! html
5257 <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>
5258 </p>
5259 !! end
5260
5261 !! test
5262 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5263 !! wikitext
5264 Some [[Link|pretty ''italics'' and stuff]]!
5265 !! html
5266 <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>!
5267 </p>
5268 !! end
5269
5270 !! test
5271 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5272 !! wikitext
5273 ''Some [[Link|pretty ''italics'' and stuff]]!
5274 !! html
5275 <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>
5276 </p>
5277 !! end
5278
5279 !! test
5280 Link with double quotes in title part (literal) and alternate part (interpreted)
5281 !! wikitext
5282 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5283
5284 [[''Pentecoste'']]
5285
5286 [[''Pentecoste''|Pentecoste]]
5287
5288 [[''Pentecoste''|''Pentecoste'']]
5289 !! html
5290 <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>
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)">Pentecoste</a>
5293 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
5294 </p>
5295 !! end
5296
5297 !! test
5298 Broken image links with HTML captions (bug 39700)
5299 !! wikitext
5300 [[File:Nonexistent|<script></script>]]
5301 [[File:Nonexistent|100px|<script></script>]]
5302 [[File:Nonexistent|&lt;]]
5303 [[File:Nonexistent|a<i>b</i>c]]
5304 !! html
5305 <p><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;script&gt;&lt;/script&gt;</a>
5307 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5308 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5309 </p>
5310 !! end
5311
5312 !! test
5313 Plain link to URL
5314 !! wikitext
5315 [[http://www.example.com]]
5316 !! html
5317 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5318 </p>
5319 !! end
5320
5321 !! test
5322 Plain link to URL with link text
5323 !! wikitext
5324 [[http://www.example.com Link text]]
5325 !! html
5326 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5327 </p>
5328 !! end
5329
5330 !! test
5331 Plain link to protocol-relative URL
5332 !! wikitext
5333 [[//www.example.com]]
5334 !! html
5335 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5336 </p>
5337 !! end
5338
5339 !! test
5340 Plain link to protocol-relative URL with link text
5341 !! wikitext
5342 [[//www.example.com Link text]]
5343 !! html
5344 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5345 </p>
5346 !! end
5347
5348 !! test
5349 Plain link to page with question mark in title
5350 !! wikitext
5351 [[A?b]]
5352
5353 [[A?b|Baz]]
5354 !! html
5355 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5356 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5357 </p>
5358 !! end
5359
5360
5361 # I'm fairly sure the expected result here is wrong.
5362 # We want these to be URL links, not pseudo-pages with URLs for titles....
5363 # However the current output is also pretty screwy.
5364 #
5365 # ----
5366 # I'm changing it to match the current output--it arguably makes more
5367 # sense in the light of the test above. Old expected result was:
5368 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5369 #</p>
5370 # But I think this test is bordering on "garbage in, garbage out" anyway.
5371 # -- wtm
5372 !! test
5373 Piped link to URL
5374 !! wikitext
5375 Piped link to URL: [[http://www.example.com|an example URL]]
5376 !! html
5377 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5378 </p>
5379 !! end
5380
5381 !! test
5382 BUG 2: [[page|http://url/]] should link to page, not http://url/
5383 !! wikitext
5384 [[Main Page|http://url/]]
5385 !! html
5386 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5387 </p>
5388 !! end
5389
5390 !! test
5391 BUG 337: Escaped self-links should be bold
5392 !! options
5393 title=[[Bug462]]
5394 !! wikitext
5395 [[Bu&#103;462]] [[Bug462]]
5396 !! html
5397 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5398 </p>
5399 !! end
5400
5401 !! test
5402 Self-link to section should not be bold
5403 !! options
5404 title=[[Main Page]]
5405 !! wikitext
5406 [[Main Page#section]]
5407 !! html
5408 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5409 </p>
5410 !! end
5411
5412 !! article
5413 00
5414 !! text
5415 This is 00.
5416 !! endarticle
5417
5418 !!test
5419 Self-link to numeric title
5420 !!options
5421 title=[[0]]
5422 !! wikitext
5423 [[0]]
5424 !! html
5425 <p><strong class="selflink">0</strong>
5426 </p>
5427 !!end
5428
5429 !!test
5430 Link to numeric-equivalent title
5431 !!options
5432 title=[[0]]
5433 !! wikitext
5434 [[00]]
5435 !! html
5436 <p><a href="/wiki/00" title="00">00</a>
5437 </p>
5438 !!end
5439
5440 !! test
5441 <nowiki> inside a link
5442 !! wikitext
5443 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5444 !! html
5445 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5446 </p>
5447 !! end
5448
5449 !! test
5450 Non-breaking spaces in title
5451 !! wikitext
5452 [[&nbsp; Main &nbsp; Page &nbsp;]]
5453 !! html
5454 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5455 </p>
5456 !!end
5457
5458 !! test
5459 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5460 !! options
5461 language=ca
5462 !! wikitext
5463 '''[[Main Page]]'''
5464 !! html
5465 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5466 </p>
5467 !! end
5468
5469 !! test
5470 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5471 !! options
5472 language=ca
5473 !! wikitext
5474 ''[[Main Page]]''
5475 !! html
5476 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5477 </p>
5478 !! end
5479
5480 !! test
5481 Internal link with en linktrail: no apostrophes (bug 27473)
5482 !! options
5483 language=en
5484 !! wikitext
5485 [[Something]]'nice
5486 !! html
5487 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5488 </p>
5489 !! end
5490
5491 !! test
5492 Internal link with ca linktrail with apostrophes (bug 27473)
5493 !! options
5494 language=ca
5495 !! wikitext
5496 [[Something]]'nice
5497 !! html
5498 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5499 </p>
5500 !! end
5501
5502 !! test
5503 Internal link with kaa linktrail with apostrophes (bug 27473)
5504 !! options
5505 language=kaa
5506 !! wikitext
5507 [[Something]]'nice
5508 !! html
5509 <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>
5510 </p>
5511 !! end
5512
5513 !! test
5514 1. Interaction of linktrail and template encapsulation
5515 !! options
5516 parsoid
5517 !! wikitext
5518 {{echo|[[Foo]]}}l
5519 !! html
5520 <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>
5521 !! end
5522
5523 !! test
5524 2. Interaction of linktrail and template encapsulation
5525 !! options
5526 parsoid
5527 !! wikitext
5528 {{echo|Some [[Fool]]}}s
5529 !! html
5530 <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>
5531 !! end
5532
5533 !! test
5534 3. Interaction of linktrail and template encapsulation
5535 !! options
5536 parsoid
5537 !! wikitext
5538 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5539 !! html
5540 <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>
5541 !! end
5542
5543 !! article
5544 Söfnuður
5545 !! text
5546 Test.
5547 !! endarticle
5548
5549 !! test
5550 Internal link with is link prefix
5551 !! options
5552 language=is
5553 !! wikitext
5554 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5555 !! html
5556 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5557 </p>
5558 !! end
5559
5560 !! article
5561 Mótmælendatrú
5562 !! text
5563 Test.
5564 !! endarticle
5565
5566 !! test
5567 Internal link with is link trail and link prefix
5568 !! options
5569 language=is
5570 !! wikitext
5571 [[mótmælendatrú|xxx]]ar
5572 [[mótmælendatrú]]ar
5573 mótmælenda[[söfnuður]]
5574 mótmælenda[[söfnuður|söfnuðir]]
5575 mótmælenda[[söfnuður|söfnuðir]]xxx
5576 !! html
5577 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5578 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5579 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5580 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5581 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5582 </p>
5583 !! end
5584
5585 !! test
5586 Parsoid link trail escaping
5587 !! options
5588 parsoid=html2wt,html2html
5589 !! wikitext
5590 [[apple]]<nowiki/>s
5591 !! html
5592 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5593 !! end
5594
5595 !! test
5596 Parsoid link prefix escaping
5597 !! options
5598 language=is
5599 parsoid=html2wt,html2html
5600 !! wikitext
5601 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5602 !! html
5603 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5604 !! end
5605
5606 !! test
5607 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5608 !! wikitext
5609 [[Foo| bar]]
5610
5611 [[Foo| ''bar'']]
5612
5613 [http://wp.org foo]
5614
5615 [http://wp.org ''foo'']
5616 !! html
5617 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5618 </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>
5619 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5620 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5621 </p>
5622 !! end
5623
5624 !! test
5625 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5626 !! options
5627 parsoid
5628 !! wikitext
5629 [[Foo|{{echo|a}} b {{echo|c}}]]
5630 !! html
5631 <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>
5632 !! end
5633
5634 ###
5635 ### Interwiki links (see maintenance/interwiki.sql)
5636 ###
5637
5638 !! test
5639 Inline interwiki link
5640 !! wikitext
5641 [[MeatBall:SoftSecurity]]
5642 !! html
5643 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5644 </p>
5645 !! end
5646
5647 !! test
5648 Inline interwiki link with empty title (bug 2372)
5649 !! wikitext
5650 [[MeatBall:]]
5651 !! html
5652 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5653 </p>
5654 !! end
5655
5656 !! test
5657 Interwiki link encoding conversion (bug 1636)
5658 !! wikitext
5659 *[[Wikipedia:ro:Olteni&#0355;a]]
5660 *[[Wikipedia:ro:Olteni&#355;a]]
5661 !! html
5662 <ul>
5663 <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>
5664 </li>
5665 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
5666 </li>
5667 </ul>
5668
5669 !! end
5670
5671 !! test
5672 Interwiki link with fragment (bug 2130)
5673 !! wikitext
5674 [[MeatBall:SoftSecurity#foo]]
5675 !! html
5676 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5677 </p>
5678 !! end
5679
5680 # Ideally the wikipedia: prefix here should be proto-relative too
5681 !! test
5682 Different interwiki prefixes mapping to the same URL
5683 !! options
5684 parsoid
5685 !! wikitext
5686 [[wikipedia:Foo]]
5687
5688 [[:en:Foo]]
5689 !! html
5690 <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>
5691
5692 <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>
5693 !! end
5694
5695 !! test
5696 Interwiki links that cannot be represented in wiki syntax
5697 !! options
5698 parsoid
5699 !! wikitext
5700 [[meatball:ok]]
5701 [[meatball:ok#foo|ok with fragment]]
5702 [[meatball:ok_as_well?|ok ending with ? mark]]
5703 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5704 [http://de.wikipedia.org/wiki/#foo is just fragment]
5705
5706 !! html
5707 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5708 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5709 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
5710 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5711 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5712 !! end
5713
5714 !! test
5715 Interwiki links: trail
5716 !! options
5717 parsoid
5718 !! wikitext
5719 [[wikipedia:Foo|Ba]]r
5720 !! html
5721 <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>
5722 !! end
5723
5724 ###
5725 ### Interlanguage links
5726 ### Language links (so that searching for '### language' matches..)
5727 ###
5728
5729 !! test
5730 Interlanguage link
5731 !! wikitext
5732 Blah blah blah
5733 [[zh:Chinese]]
5734 !! html
5735 <p>Blah blah blah
5736 </p>
5737 !! end
5738
5739 !! test
5740 Double interlanguage link
5741 !! wikitext
5742 Blah blah blah
5743 [[es:Spanish]]
5744 [[zh:Chinese]]
5745 !! html
5746 <p>Blah blah blah
5747 </p>
5748 !! end
5749
5750 !! test
5751 Interlanguage link, with prefix links
5752 !! options
5753 language=ln
5754 !! wikitext
5755 Blah blah blah
5756 [[zh:Chinese]]
5757 !! html
5758 <p>Blah blah blah
5759 </p>
5760 !! end
5761
5762 !! test
5763 Double interlanguage link, with prefix links (bug 8897)
5764 !! options
5765 language=ln
5766 !! wikitext
5767 Blah blah blah
5768 [[es:Spanish]]
5769 [[zh:Chinese]]
5770 !! html
5771 <p>Blah blah blah
5772 </p>
5773 !! end
5774
5775 !! test
5776 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5777 !! options
5778 language=ln
5779 !! wikitext
5780 [[WW&nbsp;II]]
5781 !! html
5782 <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>
5783 </p>
5784 !! end
5785
5786 !! test
5787 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5788 !! options
5789 parsoid=html2wt
5790 !! wikitext
5791 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5792
5793 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5794 !! html
5795 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5796 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5797 !! end
5798
5799 !! test
5800 Parsoid: handle constructor well
5801 !! options
5802 parsoid
5803 !! wikitext
5804 [[constructor]]
5805
5806 [[constructor:foo]]
5807 !! html
5808 <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>
5809
5810 <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>
5811 !! end
5812
5813 !! test
5814 Parsoid: recognize interlanguage links without a target page
5815 !! options
5816 parsoid
5817 !! wikitext
5818 [[ko:]]
5819 !! html
5820 <p>
5821 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5822 !! end
5823
5824 !! test
5825 Parsoid: recognize interwiki links without a target page
5826 !! options
5827 parsoid
5828 !! wikitext
5829 [[:ko:]]
5830 !! html
5831 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
5832 !! end
5833
5834 !! test
5835 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
5836 !! options
5837 parsoid
5838 !! wikitext
5839 [[en:Foo]]
5840 !! html
5841 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
5842 !! end
5843
5844 ###
5845 ### Redirects, Parsoid-only
5846 ###
5847 !! test
5848 1. Simple redirect to page
5849 !! options
5850 parsoid
5851 !! wikitext
5852 #REDIRECT [[Main Page]]
5853 !! html
5854 <link rel="mw:PageProp/redirect" href="./Main_Page">
5855 !! end
5856
5857 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
5858 !! test
5859 2. Other redirect variants
5860 !! options
5861 parsoid=wt2html,wt2wt
5862 !! wikitext
5863 #REDIRECT [[Main_Page]]
5864 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
5865 !! html
5866 <link rel="mw:PageProp/redirect" href="./Main_Page">
5867 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
5868 !! end
5869
5870 !! test
5871 Optional colon in #REDIRECT
5872 !! options
5873 # the colon is archaic syntax. we support it for wt2html, but we
5874 # don't care that it roundtrips back to the modern syntax.
5875 parsoid=wt2html,html2html
5876 !! wikitext
5877 #REDIRECT:[[Main Page]]
5878 !! html
5879 <link rel="mw:PageProp/redirect" href="./Main_Page">
5880 !! end
5881
5882 !! test
5883 Whitespace in #REDIRECT with optional colon
5884 !! options
5885 # the colon and gratuitous whitespace is archaic syntax. we support
5886 # it for wt2html, but we don't care that it roundtrips back to the
5887 # modern syntax (without extra whitespace)
5888 parsoid=wt2html,html2html
5889 !! wikitext
5890
5891 #REDIRECT
5892 :
5893 [[Main Page]]
5894 !! html
5895 <link rel="mw:PageProp/redirect" href="./Main_Page">
5896 !! end
5897
5898 !! test
5899 Piped link in #REDIRECT
5900 !! options
5901 # content after piped link is ignored. we support this syntax,
5902 # but don't care that the piped link is lost when we roundtrip this.
5903 parsoid=wt2html
5904 !! wikitext
5905 #REDIRECT [[Main Page|bar]]
5906 !! html
5907 <link rel="mw:PageProp/redirect" href="./Main_Page">
5908 !! end
5909
5910 !! test
5911 Redirect to category
5912 !! options
5913 parsoid=wt2html
5914 !! wikitext
5915 #REDIRECT [[Category:Foo]]
5916 !! html
5917 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5918 !! end
5919
5920 !! test
5921 Redirect to category with URL encoding
5922 !! options
5923 parsoid=wt2html
5924 !! wikitext
5925 #REDIRECT [[Category%3AFoo]]
5926 !! html
5927 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5928 !! end
5929
5930 !! test
5931 Redirect to category page
5932 !! options
5933 parsoid=wt2html,html2html
5934 !! wikitext
5935 #REDIRECT [[:Category:Foo]]
5936 !! html
5937 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5938 !! end
5939
5940 !! test
5941 Redirect to image page (1)
5942 !! options
5943 parsoid
5944 !! wikitext
5945 #REDIRECT [[File:Wiki.png]]
5946 !! html
5947 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5948 !! end
5949
5950 !! test
5951 Redirect to image page (2)
5952 !! options
5953 parsoid
5954 !! wikitext
5955 #REDIRECT [[Image:Wiki.png]]
5956 !! html
5957 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5958 !! end
5959
5960 !! test
5961 Redirect to language
5962 !! options
5963 parsoid
5964 !! wikitext
5965 #REDIRECT [[en:File:Wiki.png]]
5966 !! html
5967 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5968 !! end
5969
5970 !! test
5971 Redirect to interwiki
5972 !! options
5973 parsoid
5974 !! wikitext
5975 #REDIRECT [[meatball:File:Wiki.png]]
5976 !! html
5977 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5978 !! end
5979
5980 !! test
5981 Non-English #REDIRECT
5982 !! options
5983 parsoid
5984 language=is
5985 !! wikitext
5986 #TILVÍSUN [[Main Page]]
5987 !! html
5988 <link rel="mw:PageProp/redirect" href="./Main_Page">
5989 !! end
5990
5991 !! test
5992 New redirect
5993 !! options
5994 parsoid=html2wt
5995 !! wikitext
5996 Foo
5997 #REDIRECT [[Foo]]
5998 !! html
5999 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6000 !! end
6001
6002 ##
6003 ## XHTML tidiness
6004 ###
6005
6006 !! test
6007 <br> to <br />
6008 !! wikitext
6009 1<br>2<br />3
6010 !! html
6011 <p>1<br />2<br />3
6012 </p>
6013 !! end
6014
6015 !! test
6016 Broken br tag sanitization
6017 !! wikitext
6018 </br>
6019 !! html/php
6020 <p>&lt;/br&gt;
6021 </p>
6022 !! end
6023
6024 # TODO: Fix html2html mode (bug 51055)!
6025 !! test
6026 Parsoid: Broken br tag recognition
6027 !! options
6028 parsoid=wt2html
6029 !! wikitext
6030 </br>
6031 !! html/parsoid
6032 <p><br></p>
6033 !! end
6034
6035 !! test
6036 Incorrecly removing closing slashes from correctly formed XHTML
6037 !! wikitext
6038 <br style="clear:both;" />
6039 !! html
6040 <p><br style="clear:both;" />
6041 </p>
6042 !! end
6043
6044 !! test
6045 Failing to transform badly formed HTML into correct XHTML
6046 !! wikitext
6047 <br style="clear: left;">
6048 <br style="clear: right;">
6049 <br style="clear: both;">
6050 !! html
6051 <p><br style="clear: left;" />
6052 <br style="clear: right;" />
6053 <br style="clear: both;" />
6054 </p>
6055 !!end
6056
6057 !! test
6058 Handling html with a div self-closing tag
6059 !! wikitext
6060 <div title />
6061 <div title/>
6062 <div title/ >
6063 <div title=bar />
6064 <div title=bar/>
6065 <div title=bar/ >
6066 !! html
6067 <p>&lt;div title /&gt;
6068 &lt;div title/&gt;
6069 </p>
6070 <div>
6071 <p>&lt;div title=bar /&gt;
6072 &lt;div title=bar/&gt;
6073 </p>
6074 <div title="bar/"></div>
6075 </div>
6076
6077 !! end
6078
6079 !! test
6080 Handling html with a br self-closing tag
6081 !! wikitext
6082 <br title />
6083 <br title/>
6084 <br title/ >
6085 <br title=bar />
6086 <br title=bar/>
6087 <br title=bar/ >
6088 !! html
6089 <p><br title="title" />
6090 <br title="title" />
6091 <br />
6092 <br title="bar" />
6093 <br title="bar" />
6094 <br title="bar/" />
6095 </p>
6096 !! end
6097
6098 !! test
6099 Horizontal ruler (should it add that extra space?)
6100 !! wikitext
6101 <hr>
6102 <hr >
6103 foo <hr
6104 > bar
6105 !! html
6106 <hr />
6107 <hr />
6108 foo <hr /> bar
6109
6110 !! end
6111
6112 !! test
6113 Horizontal ruler -- 4+ dashes render hr
6114 !! wikitext
6115 ----
6116 !! html
6117 <hr />
6118
6119 !! end
6120
6121 !! test
6122 Horizontal ruler -- eats additional dashes on the same line
6123 !! wikitext
6124 ---------
6125 !! html
6126 <hr />
6127
6128 !! end
6129
6130 !! test
6131 Horizontal ruler -- does not collapse dashes on consecutive lines
6132 !! wikitext
6133 ----
6134 ----
6135 !! html
6136 <hr />
6137 <hr />
6138
6139 !! end
6140
6141 !! test
6142 Horizontal ruler -- <4 dashes render as plain text
6143 !! wikitext
6144 ---
6145 !! html
6146 <p>---
6147 </p>
6148 !! end
6149
6150 !! test
6151 Horizontal ruler -- Supports content following dashes on same line
6152 !! wikitext
6153 ---- Foo
6154 !! html
6155 <hr /> Foo
6156
6157 !! end
6158
6159 ###
6160 ### Block-level elements
6161 ###
6162 !! test
6163 Common list
6164 !! wikitext
6165 *Common list
6166 * item 2
6167 *item 3
6168 !! html
6169 <ul>
6170 <li>Common list
6171 </li>
6172 <li> item 2
6173 </li>
6174 <li>item 3
6175 </li>
6176 </ul>
6177
6178 !! end
6179
6180 !! test
6181 Numbered list
6182 !! wikitext
6183 #Numbered list
6184 #item 2
6185 # item 3
6186 !! html
6187 <ol>
6188 <li>Numbered list
6189 </li>
6190 <li>item 2
6191 </li>
6192 <li> item 3
6193 </li>
6194 </ol>
6195
6196 !! end
6197
6198 !! test
6199 Mixed list
6200 !! wikitext
6201 *Mixed list
6202 *# with numbers
6203 ** and bullets
6204 *# and numbers
6205 *bullets again
6206 **bullet level 2
6207 ***bullet level 3
6208 ***#Number on level 4
6209 **bullet level 2
6210 **#Number on level 3
6211 **#Number on level 3
6212 *#number level 2
6213 *Level 1
6214 *** Level 3
6215 #** Level 3, but ordered
6216 !! html
6217 <ul>
6218 <li>Mixed list
6219 <ol>
6220 <li> with numbers
6221 </li>
6222 </ol>
6223 <ul>
6224 <li> and bullets
6225 </li>
6226 </ul>
6227 <ol>
6228 <li> and numbers
6229 </li>
6230 </ol>
6231 </li>
6232 <li>bullets again
6233 <ul>
6234 <li>bullet level 2
6235 <ul>
6236 <li>bullet level 3
6237 <ol>
6238 <li>Number on level 4
6239 </li>
6240 </ol>
6241 </li>
6242 </ul>
6243 </li>
6244 <li>bullet level 2
6245 <ol>
6246 <li>Number on level 3
6247 </li>
6248 <li>Number on level 3
6249 </li>
6250 </ol>
6251 </li>
6252 </ul>
6253 <ol>
6254 <li>number level 2
6255 </li>
6256 </ol>
6257 </li>
6258 <li>Level 1
6259 <ul>
6260 <li><ul>
6261 <li> Level 3
6262 </li>
6263 </ul>
6264 </li>
6265 </ul>
6266 </li>
6267 </ul>
6268 <ol>
6269 <li><ul>
6270 <li><ul>
6271 <li> Level 3, but ordered
6272 </li>
6273 </ul>
6274 </li>
6275 </ul>
6276 </li>
6277 </ol>
6278
6279 !! end
6280
6281 !! test
6282 Nested lists 1
6283 !! wikitext
6284 *foo
6285 **bar
6286 !! html
6287 <ul>
6288 <li>foo
6289 <ul>
6290 <li>bar
6291 </li>
6292 </ul>
6293 </li>
6294 </ul>
6295
6296 !! end
6297
6298 !! test
6299 Nested lists 2
6300 !! wikitext
6301 **foo
6302 *bar
6303 !! html
6304 <ul>
6305 <li><ul>
6306 <li>foo
6307 </li>
6308 </ul>
6309 </li>
6310 <li>bar
6311 </li>
6312 </ul>
6313
6314 !! end
6315
6316 !! test
6317 Nested lists 3 (first element empty)
6318 !! wikitext
6319 *
6320 **bar
6321 !! html
6322 <ul>
6323 <li>
6324 <ul>
6325 <li>bar
6326 </li>
6327 </ul>
6328 </li>
6329 </ul>
6330
6331 !! end
6332
6333 !! test
6334 Nested lists 4 (first element empty)
6335 !! wikitext
6336 **
6337 *bar
6338 !! html
6339 <ul>
6340 <li><ul>
6341 <li>
6342 </li>
6343 </ul>
6344 </li>
6345 <li>bar
6346 </li>
6347 </ul>
6348
6349 !! end
6350
6351 !! test
6352 Nested lists 5 (both elements empty)
6353 !! wikitext
6354 **
6355 *
6356 !! html
6357 <ul>
6358 <li><ul>
6359 <li>
6360 </li>
6361 </ul>
6362 </li>
6363 <li>
6364 </li>
6365 </ul>
6366
6367 !! end
6368
6369 !! test
6370 Nested lists 6 (both elements empty)
6371 !! wikitext
6372 *
6373 **
6374 !! html
6375 <ul>
6376 <li>
6377 <ul>
6378 <li>
6379 </li>
6380 </ul>
6381 </li>
6382 </ul>
6383
6384 !! end
6385
6386 !! test
6387 Nested lists 7 (skip initial nesting levels)
6388 !! wikitext
6389 *** foo
6390 !! html
6391 <ul>
6392 <li><ul>
6393 <li><ul>
6394 <li> foo
6395 </li>
6396 </ul>
6397 </li>
6398 </ul>
6399 </li>
6400 </ul>
6401
6402 !! end
6403
6404 !! test
6405 Nested lists 8 (multiple nesting transitions)
6406 !! wikitext
6407 * foo
6408 *** bar
6409 ** baz
6410 * boo
6411 !! html
6412 <ul>
6413 <li> foo
6414 <ul>
6415 <li><ul>
6416 <li> bar
6417 </li>
6418 </ul>
6419 </li>
6420 <li> baz
6421 </li>
6422 </ul>
6423 </li>
6424 <li> boo
6425 </li>
6426 </ul>
6427
6428 !! end
6429
6430 !! test
6431 1. Lists with start-of-line-transparent tokens before bullets: Comments
6432 !! wikitext
6433 *foo
6434 *<!--cmt-->bar
6435 <!--cmt-->*baz
6436 !! html
6437 <ul>
6438 <li>foo
6439 </li>
6440 <li>bar
6441 </li>
6442 <li>baz
6443 </li>
6444 </ul>
6445
6446 !! end
6447
6448 !! test
6449 2. Lists with start-of-line-transparent tokens before bullets: Template close
6450 !! wikitext
6451 *foo {{echo|bar
6452 }}*baz
6453 !! html
6454 <ul>
6455 <li>foo bar
6456 </li>
6457 <li>baz
6458 </li>
6459 </ul>
6460
6461 !! end
6462
6463 !! test
6464 List items are not parsed correctly following a <pre> block (bug 785)
6465 !! wikitext
6466 * <pre>foo</pre>
6467 * <pre>bar</pre>
6468 * zar
6469 !! html
6470 <ul>
6471 <li> <pre>foo</pre>
6472 </li>
6473 <li> <pre>bar</pre>
6474 </li>
6475 <li> zar
6476 </li>
6477 </ul>
6478
6479 !! end
6480
6481 !! test
6482 List items from template
6483 !! wikitext
6484
6485 {{inner list}}
6486 * item 2
6487
6488 * item 0
6489 {{inner list}}
6490 * item 2
6491
6492 * item 0
6493 * notSOL{{inner list}}
6494 * item 2
6495 !! html
6496 <ul>
6497 <li> item 1
6498 </li>
6499 <li> item 2
6500 </li>
6501 </ul>
6502 <ul>
6503 <li> item 0
6504 </li>
6505 <li> item 1
6506 </li>
6507 <li> item 2
6508 </li>
6509 </ul>
6510 <ul>
6511 <li> item 0
6512 </li>
6513 <li> notSOL
6514 </li>
6515 <li> item 1
6516 </li>
6517 <li> item 2
6518 </li>
6519 </ul>
6520
6521 !! end
6522
6523 !! test
6524 List interrupted by empty line or heading
6525 !! wikitext
6526 * foo
6527
6528 ** bar
6529 == A heading ==
6530 * Another list item
6531 !! html
6532 <ul>
6533 <li> foo
6534 </li>
6535 </ul>
6536 <ul>
6537 <li><ul>
6538 <li> bar
6539 </li>
6540 </ul>
6541 </li>
6542 </ul>
6543 <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>
6544 <ul>
6545 <li> Another list item
6546 </li>
6547 </ul>
6548
6549 !!end
6550
6551 !!test
6552 Multiple list tags generated by templates
6553 !! wikitext
6554 {{echo|<li>}}a
6555 {{echo|<li>}}b
6556 {{echo|<li>}}c
6557 !! html
6558 <li>a
6559 <li>b
6560 <li>c</li>
6561 </li>
6562 </li>
6563
6564 !!end
6565
6566 !!test
6567 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6568 !! wikitext
6569 *a
6570 <!--This line will NOT split the list-->
6571 *b
6572 <!--This line will NOT split the list either-->
6573 *c
6574 <!--foo--> <!----> <!--This line NOT split the list either-->
6575 *d
6576 !! html
6577 <ul>
6578 <li>a
6579 </li>
6580 <li>b
6581 </li>
6582 <li>c
6583 </li>
6584 <li>d
6585 </li>
6586 </ul>
6587
6588 !!end
6589
6590 !!test
6591 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6592 !! wikitext
6593 *a
6594 <!--This line will NOT split the list-->
6595 *b
6596 <!--This line will NOT split the list either-->
6597 *c
6598 <!--foo--> <!----> <!--This line NOT split the list
6599 either-->
6600 *d
6601 !! html
6602 <ul>
6603 <li>a
6604 </li>
6605 <li>b
6606 </li>
6607 <li>c
6608 </li>
6609 <li>d
6610 </li>
6611 </ul>
6612
6613 !!end
6614
6615 !!test
6616 Test the li-hack
6617 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6618 !!options
6619 parsoid=wt2html,wt2wt
6620 !! wikitext
6621 * foo
6622 * <li>li-hack
6623 * {{echo|<li>templated li-hack}}
6624 * <!--foo--> <li> unsupported li-hack with preceding comments
6625
6626 <ul>
6627 <li><li>not a li-hack
6628 </li>
6629 </ul>
6630 !! html
6631 <ul>
6632 <li> foo</li>
6633 <li>li-hack</li>
6634 <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>
6635 <li> <!--foo--> </li>
6636 <li> li-hack with preceding comments</li>
6637 </ul>
6638
6639 <ul>
6640 <li></li>
6641 <li>not a li-hack
6642 </li>
6643 </ul>
6644 !!end
6645
6646 !! test
6647 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6648 !! options
6649 parsoid
6650 !! wikitext
6651 # foo
6652 ## bar
6653 * foo
6654 ** bar
6655 : foo
6656 :: bar
6657 !! html
6658 <ol>
6659 <li> foo<ol>
6660 <li> bar</li>
6661 </ol></li>
6662 </ol><ul>
6663 <li> foo<ul>
6664 <li> bar</li>
6665 </ul></li>
6666 </ul><dl>
6667 <dd> foo<dl>
6668 <dd> bar</dd>
6669 </dl></dd>
6670 </dl>
6671 !! end
6672
6673 !! test
6674 Parsoid: Test of whitespace serialization with Templated bullets
6675 !! options
6676 parsoid
6677 !! wikitext
6678 * {{bullet}}
6679 !! html
6680 <ul>
6681 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6682 </ul>
6683 !! end
6684
6685 # ------------------------------------------------------------------------
6686 # The next set of tests are about Parsoid's ability to handle badly nested
6687 # tags (parse, minimize scope of fixup, and roundtrip back)
6688 # ------------------------------------------------------------------------
6689
6690 !! test
6691 Unbalanced closing block tags break a list
6692 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6693 !! wikitext
6694 <div>
6695 *a</div><div>
6696 *b</div>
6697 !! html/parsoid
6698 <div>
6699 <ul>
6700 <li>a
6701 </li>
6702 </ul></div><div>
6703 <ul>
6704 <li>b
6705 </li>
6706 </ul></div>
6707 !! end
6708
6709 !! test
6710 Unbalanced closing non-block tags don't break a list
6711 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6712 !! wikitext
6713 <span>
6714 *a</span><span>
6715 *b</span>
6716 !! html/parsoid
6717 <p><span></span>
6718 </p>
6719 <ul>
6720 <li>a<span></span>
6721 </li>
6722 <li>b
6723 </li>
6724 </ul>
6725 !! end
6726
6727 !! test
6728 Unclosed formatting tags that straddle lists are closed and reopened
6729 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6730 !! wikitext
6731 # <s> a
6732 # b </s>
6733 !! html/parsoid
6734 <ol>
6735 <li> <s> a </s>
6736 </li>
6737 <li> <s> b </s>
6738 </li>
6739 </ol>
6740 !! end
6741
6742 !!test
6743 List embedded in a non-block tag
6744 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6745 !! wikitext
6746 <small>
6747 * foo
6748 </small>
6749 !! html/parsoid
6750 <p><small></small></p>
6751 <small>
6752 <ul>
6753 <li> foo</li>
6754 </ul>
6755 </small>
6756 <p><small></small></p>
6757 !!end
6758
6759 !! test
6760 Table with missing opening <tr> tag
6761 !! options
6762 parsoid=wt2html,wt2wt
6763 !! wikitext
6764 <table>
6765 <td>foo</td>
6766 </tr>
6767 </table>
6768 !! html/parsoid
6769 <table>
6770 <tr>
6771 <td>foo</td>
6772 </tr>
6773 </table>
6774 !! end
6775
6776 ###
6777 ### Magic Words
6778 ###
6779
6780 # Note that the current date is hard-coded as
6781 # 1970-01-01T00:02:03Z (a Thursday)
6782 # when running parser tests. The timezone is also fixed to GMT, so
6783 # local date will be identical to current date.
6784
6785 !! test
6786 Magic Word: {{CURRENTDAY}}
6787 !! wikitext
6788 {{CURRENTDAY}}
6789 !! html
6790 <p>1
6791 </p>
6792 !! end
6793
6794 !! test
6795 Magic Word: {{CURRENTDAY2}}
6796 !! wikitext
6797 {{CURRENTDAY2}}
6798 !! html
6799 <p>01
6800 </p>
6801 !! end
6802
6803 !! test
6804 Magic Word: {{CURRENTDAYNAME}}
6805 !! wikitext
6806 {{CURRENTDAYNAME}}
6807 !! html
6808 <p>Thursday
6809 </p>
6810 !! end
6811
6812 !! test
6813 Magic Word: {{CURRENTDOW}}
6814 !! wikitext
6815 {{CURRENTDOW}}
6816 !! html
6817 <p>4
6818 </p>
6819 !! end
6820
6821 !! test
6822 Magic Word: {{CURRENTMONTH}}
6823 !! wikitext
6824 {{CURRENTMONTH}}
6825 !! html
6826 <p>01
6827 </p>
6828 !! end
6829
6830 !! test
6831 Magic Word: {{CURRENTMONTH1}}
6832 !! wikitext
6833 {{CURRENTMONTH1}}
6834 !! html
6835 <p>1
6836 </p>
6837 !! end
6838
6839 !! test
6840 Magic Word: {{CURRENTMONTHABBREV}}
6841 !! wikitext
6842 {{CURRENTMONTHABBREV}}
6843 !! html
6844 <p>Jan
6845 </p>
6846 !! end
6847
6848 !! test
6849 Magic Word: {{CURRENTMONTHNAME}}
6850 !! wikitext
6851 {{CURRENTMONTHNAME}}
6852 !! html
6853 <p>January
6854 </p>
6855 !! end
6856
6857 !! test
6858 Magic Word: {{CURRENTMONTHNAMEGEN}}
6859 !! wikitext
6860 {{CURRENTMONTHNAMEGEN}}
6861 !! html
6862 <p>January
6863 </p>
6864 !! end
6865
6866 !! test
6867 Magic Word: {{CURRENTTIME}}
6868 !! wikitext
6869 {{CURRENTTIME}}
6870 !! html
6871 <p>00:02
6872 </p>
6873 !! end
6874
6875 !! test
6876 Magic Word: {{CURRENTHOUR}}
6877 !! wikitext
6878 {{CURRENTHOUR}}
6879 !! html
6880 <p>00
6881 </p>
6882 !! end
6883
6884 !! test
6885 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6886 !! wikitext
6887 {{CURRENTWEEK}}
6888 !! html
6889 <p>1
6890 </p>
6891 !! end
6892
6893 !! test
6894 Magic Word: {{CURRENTYEAR}}
6895 !! wikitext
6896 {{CURRENTYEAR}}
6897 !! html
6898 <p>1970
6899 </p>
6900 !! end
6901
6902 !! test
6903 Magic Word: {{CURRENTTIMESTAMP}}
6904 !! wikitext
6905 {{CURRENTTIMESTAMP}}
6906 !! html
6907 <p>19700101000203
6908 </p>
6909 !! end
6910
6911 !! test
6912 Magic Words LOCAL (UTC)
6913 !! wikitext
6914 * {{LOCALMONTH}}
6915 * {{LOCALMONTH1}}
6916 * {{LOCALMONTHNAME}}
6917 * {{LOCALMONTHNAMEGEN}}
6918 * {{LOCALMONTHABBREV}}
6919 * {{LOCALDAY}}
6920 * {{LOCALDAY2}}
6921 * {{LOCALDAYNAME}}
6922 * {{LOCALYEAR}}
6923 * {{LOCALTIME}}
6924 * {{LOCALHOUR}}
6925 * {{LOCALWEEK}}
6926 * {{LOCALDOW}}
6927 * {{LOCALTIMESTAMP}}
6928 !! html
6929 <ul>
6930 <li> 01
6931 </li>
6932 <li> 1
6933 </li>
6934 <li> January
6935 </li>
6936 <li> January
6937 </li>
6938 <li> Jan
6939 </li>
6940 <li> 1
6941 </li>
6942 <li> 01
6943 </li>
6944 <li> Thursday
6945 </li>
6946 <li> 1970
6947 </li>
6948 <li> 00:02
6949 </li>
6950 <li> 00
6951 </li>
6952 <li> 1
6953 </li>
6954 <li> 4
6955 </li>
6956 <li> 19700101000203
6957 </li>
6958 </ul>
6959
6960 !! end
6961
6962 !! test
6963 Magic Word: {{FULLPAGENAME}}
6964 !! options
6965 title=[[User:Ævar Arnfjörð Bjarmason]]
6966 !! wikitext
6967 {{FULLPAGENAME}}
6968 !! html
6969 <p>User:Ævar Arnfjörð Bjarmason
6970 </p>
6971 !! end
6972
6973 !! test
6974 Magic Word: {{FULLPAGENAMEE}}
6975 !! options
6976 title=[[User:Ævar Arnfjörð Bjarmason]]
6977 !! wikitext
6978 {{FULLPAGENAMEE}}
6979 !! html
6980 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6981 </p>
6982 !! end
6983
6984 !! test
6985 Magic Word: {{TALKSPACE}}
6986 !! options
6987 title=[[User:Ævar Arnfjörð Bjarmason]]
6988 !! wikitext
6989 {{TALKSPACE}}
6990 !! html
6991 <p>User talk
6992 </p>
6993 !! end
6994
6995 !! test
6996 Magic Word: {{TALKSPACE}}, same namespace
6997 !! options
6998 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6999 !! wikitext
7000 {{TALKSPACE}}
7001 !! html
7002 <p>User talk
7003 </p>
7004 !! end
7005
7006 !! test
7007 Magic Word: {{TALKSPACE}}, main namespace
7008 !! options
7009 title=[[Parser Test]]
7010 !! wikitext
7011 {{TALKSPACE}}
7012 !! html
7013 <p>Talk
7014 </p>
7015 !! end
7016
7017 !! test
7018 Magic Word: {{TALKSPACEE}}
7019 !! options
7020 title=[[User:Ævar Arnfjörð Bjarmason]]
7021 !! wikitext
7022 {{TALKSPACEE}}
7023 !! html
7024 <p>User_talk
7025 </p>
7026 !! end
7027
7028 !! test
7029 Magic Word: {{SUBJECTSPACE}}
7030 !! options
7031 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7032 !! wikitext
7033 {{SUBJECTSPACE}}
7034 !! html
7035 <p>User
7036 </p>
7037 !! end
7038
7039 !! test
7040 Magic Word: {{SUBJECTSPACE}}, same namespace
7041 !! options
7042 title=[[User:Ævar Arnfjörð Bjarmason]]
7043 !! wikitext
7044 {{SUBJECTSPACE}}
7045 !! html
7046 <p>User
7047 </p>
7048 !! end
7049
7050 !! test
7051 Magic Word: {{SUBJECTSPACE}}, main namespace
7052 !! options
7053 title=[[Parser Test]]
7054 !! wikitext
7055 {{SUBJECTSPACE}}
7056 !! html
7057
7058 !! end
7059
7060 !! test
7061 Magic Word: {{SUBJECTSPACEE}}
7062 !! options
7063 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7064 !! wikitext
7065 {{SUBJECTSPACEE}}
7066 !! html
7067 <p>User
7068 </p>
7069 !! end
7070
7071 !! test
7072 Magic Word: {{NAMESPACE}}
7073 !! options
7074 title=[[User:Ævar Arnfjörð Bjarmason]]
7075 !! wikitext
7076 {{NAMESPACE}}
7077 !! html
7078 <p>User
7079 </p>
7080 !! end
7081
7082 !! test
7083 Magic Word: {{NAMESPACEE}}
7084 !! options
7085 title=[[User:Ævar Arnfjörð Bjarmason]]
7086 !! wikitext
7087 {{NAMESPACEE}}
7088 !! html
7089 <p>User
7090 </p>
7091 !! end
7092
7093 !! test
7094 Magic Word: {{NAMESPACENUMBER}}
7095 !! options
7096 title=[[User:Ævar Arnfjörð Bjarmason]]
7097 !! wikitext
7098 {{NAMESPACENUMBER}}
7099 !! html
7100 <p>2
7101 </p>
7102 !! end
7103
7104 !! test
7105 Magic Word: {{SUBPAGENAME}}
7106 !! options
7107 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7108 !! wikitext
7109 {{SUBPAGENAME}}
7110 !! html
7111 <p>sub ö
7112 </p>
7113 !! end
7114
7115 !! test
7116 Magic Word: {{SUBPAGENAMEE}}
7117 !! options
7118 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7119 !! wikitext
7120 {{SUBPAGENAMEE}}
7121 !! html
7122 <p>sub_%C3%B6
7123 </p>
7124 !! end
7125
7126 !! test
7127 Magic Word: {{ROOTPAGENAME}}
7128 !! options
7129 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7130 !! wikitext
7131 {{ROOTPAGENAME}}
7132 !! html
7133 <p>Ævar Arnfjörð Bjarmason
7134 </p>
7135 !! end
7136
7137 !! test
7138 Magic Word: {{ROOTPAGENAMEE}}
7139 !! options
7140 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7141 !! wikitext
7142 {{ROOTPAGENAMEE}}
7143 !! html
7144 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7145 </p>
7146 !! end
7147
7148 !! test
7149 Magic Word: {{BASEPAGENAME}}
7150 !! options
7151 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7152 !! wikitext
7153 {{BASEPAGENAME}}
7154 !! html
7155 <p>Ævar Arnfjörð Bjarmason
7156 </p>
7157 !! end
7158
7159 !! test
7160 Magic Word: {{BASEPAGENAMEE}}
7161 !! options
7162 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7163 !! wikitext
7164 {{BASEPAGENAMEE}}
7165 !! html
7166 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7167 </p>
7168 !! end
7169
7170 !! test
7171 Magic Word: {{TALKPAGENAME}}
7172 !! options
7173 title=[[User:Ævar Arnfjörð Bjarmason]]
7174 !! wikitext
7175 {{TALKPAGENAME}}
7176 !! html
7177 <p>User talk:Ævar Arnfjörð Bjarmason
7178 </p>
7179 !! end
7180
7181 !! test
7182 Magic Word: {{TALKPAGENAMEE}}
7183 !! options
7184 title=[[User:Ævar Arnfjörð Bjarmason]]
7185 !! wikitext
7186 {{TALKPAGENAMEE}}
7187 !! html
7188 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7189 </p>
7190 !! end
7191
7192 !! test
7193 Magic Word: {{SUBJECTPAGENAME}}
7194 !! options
7195 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7196 !! wikitext
7197 {{SUBJECTPAGENAME}}
7198 !! html
7199 <p>User:Ævar Arnfjörð Bjarmason
7200 </p>
7201 !! end
7202
7203 !! test
7204 Magic Word: {{SUBJECTPAGENAMEE}}
7205 !! options
7206 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7207 !! wikitext
7208 {{SUBJECTPAGENAMEE}}
7209 !! html
7210 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7211 </p>
7212 !! end
7213
7214 !! test
7215 Magic Word: {{NUMBEROFFILES}}
7216 !! wikitext
7217 {{NUMBEROFFILES}}
7218 !! html
7219 <p>4
7220 </p>
7221 !! end
7222
7223 !! test
7224 Magic Word: {{PAGENAME}}
7225 !! options
7226 title=[[User:Ævar Arnfjörð Bjarmason]]
7227 !! wikitext
7228 {{PAGENAME}}
7229 !! html
7230 <p>Ævar Arnfjörð Bjarmason
7231 </p>
7232 !! end
7233
7234 !! test
7235 Magic Word: {{PAGENAME}} with metacharacters
7236 !! options
7237 title=[['foo & bar = baz']]
7238 !! wikitext
7239 ''{{PAGENAME}}''
7240 !! html
7241 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7242 </p>
7243 !! end
7244
7245 !! test
7246 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7247 !! options
7248 title=[[*RFC 1234 http://example.com/]]
7249 !! wikitext
7250 {{PAGENAME}}
7251 !! html
7252 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7253 </p>
7254 !! end
7255
7256 !! test
7257 Magic Word: {{PAGENAMEE}}
7258 !! options
7259 title=[[User:Ævar Arnfjörð Bjarmason]]
7260 !! wikitext
7261 {{PAGENAMEE}}
7262 !! html
7263 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7264 </p>
7265 !! end
7266
7267 !! test
7268 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7269 !! options
7270 title=[[*RFC 1234 http://example.com/]]
7271 !! wikitext
7272 {{PAGENAMEE}}
7273 !! html
7274 <p>&#42;RFC_1234_http&#58;//example.com/
7275 </p>
7276 !! end
7277
7278 !! test
7279 Magic Word: {{REVISIONID}}
7280 !! wikitext
7281 {{REVISIONID}}
7282 !! html
7283 <p>1337
7284 </p>
7285 !! end
7286
7287 !! test
7288 Magic Word: {{SCRIPTPATH}}
7289 !! wikitext
7290 {{SCRIPTPATH}}
7291 !! html
7292 <p>/
7293 </p>
7294 !! end
7295
7296 !! test
7297 Magic Word: {{STYLEPATH}}
7298 !! wikitext
7299 {{STYLEPATH}}
7300 !! html
7301 <p>/skins
7302 </p>
7303 !! end
7304
7305 !! test
7306 Magic Word: {{SERVER}}
7307 !! wikitext
7308 {{SERVER}}
7309 !! html
7310 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7311 </p>
7312 !! end
7313
7314 !! test
7315 Magic Word: {{SERVERNAME}}
7316 !! wikitext
7317 {{SERVERNAME}}
7318 !! html
7319 <p>example.org
7320 </p>
7321 !! end
7322
7323 !! test
7324 Magic Word: {{SITENAME}}
7325 !! wikitext
7326 {{SITENAME}}
7327 !! html
7328 <p>MediaWiki
7329 </p>
7330 !! end
7331
7332 !! test
7333 Case-sensitive magic words, when cased differently, should just be template transclusions
7334 !! wikitext
7335 {{CurrentMonth}}
7336 {{currentday}}
7337 {{cURreNTweEK}}
7338 {{currentHour}}
7339 !! html
7340 <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>
7341 <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>
7342 <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>
7343 <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>
7344 </p>
7345 !! end
7346
7347 !! test
7348 Case-insensitive magic words should still work with weird casing.
7349 !! wikitext
7350 {{sErVeRNaMe}}
7351 {{LCFirst:AOEU}}
7352 {{ucFIRST:aoeu}}
7353 {{SERver}}
7354 !! html
7355 <p>example.org
7356 aOEU
7357 Aoeu
7358 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7359 </p>
7360 !! end
7361
7362 !! test
7363 Namespace 1 {{ns:1}}
7364 !! wikitext
7365 {{ns:1}}
7366 !! html
7367 <p>Talk
7368 </p>
7369 !! end
7370
7371 !! test
7372 Namespace 1 {{ns:01}}
7373 !! wikitext
7374 {{ns:01}}
7375 !! html
7376 <p>Talk
7377 </p>
7378 !! end
7379
7380 !! test
7381 Namespace 0 {{ns:0}} (bug 4783)
7382 !! wikitext
7383 {{ns:0}}
7384 !! html
7385
7386 !! end
7387
7388 !! test
7389 Namespace 0 {{ns:00}} (bug 4783)
7390 !! wikitext
7391 {{ns:00}}
7392 !! html
7393
7394 !! end
7395
7396 !! test
7397 Namespace -1 {{ns:-1}}
7398 !! wikitext
7399 {{ns:-1}}
7400 !! html
7401 <p>Special
7402 </p>
7403 !! end
7404
7405 !! test
7406 Namespace User {{ns:User}}
7407 !! wikitext
7408 {{ns:User}}
7409 !! html
7410 <p>User
7411 </p>
7412 !! end
7413
7414 !! test
7415 Namespace User talk {{ns:User_talk}}
7416 !! wikitext
7417 {{ns:User_talk}}
7418 !! html
7419 <p>User talk
7420 </p>
7421 !! end
7422
7423 !! test
7424 Namespace User talk {{ns:uSeR tAlK}}
7425 !! wikitext
7426 {{ns:uSeR tAlK}}
7427 !! html
7428 <p>User talk
7429 </p>
7430 !! end
7431
7432 !! test
7433 Namespace File {{ns:File}}
7434 !! wikitext
7435 {{ns:File}}
7436 !! html
7437 <p>File
7438 </p>
7439 !! end
7440
7441 !! test
7442 Namespace File {{ns:Image}}
7443 !! wikitext
7444 {{ns:Image}}
7445 !! html
7446 <p>File
7447 </p>
7448 !! end
7449
7450 !! test
7451 Namespace (lang=de) Benutzer {{ns:User}}
7452 !! options
7453 language=de
7454 !! wikitext
7455 {{ns:User}}
7456 !! html
7457 <p>Benutzer
7458 </p>
7459 !! end
7460
7461 !! test
7462 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7463 !! options
7464 language=de
7465 !! wikitext
7466 {{ns:3}}
7467 !! html
7468 <p>Benutzer Diskussion
7469 </p>
7470 !! end
7471
7472
7473 !! test
7474 Urlencode
7475 !! wikitext
7476 {{urlencode:hi world?!}}
7477 {{urlencode:hi world?!|WIKI}}
7478 {{urlencode:hi world?!|PATH}}
7479 {{urlencode:hi world?!|QUERY}}
7480 !! html
7481 <p>hi+world%3F%21
7482 hi_world%3F!
7483 hi%20world%3F%21
7484 hi+world%3F%21
7485 </p>
7486 !! end
7487
7488 !! test
7489 Magic Word: prioritize type info over data-parsoid
7490 !! options
7491 parsoid=html2wt
7492 !! wikitext
7493 __FORCETOC__
7494 !! html
7495 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7496 !! end
7497
7498 !! test
7499 Magic Word: serialize on separate line (parsoid)
7500 !! options
7501 parsoid=wt2wt,html2wt
7502 !! wikitext
7503 foo
7504 __NOTOC__
7505 bar
7506 !! html
7507 foo<meta property="mw:PageProp/notoc"/>bar
7508 !! end
7509
7510 !! test
7511 Magic Word: rt non-english wikis
7512 !! options
7513 parsoid=wt2wt
7514 language=de
7515 !! wikitext
7516 __NOEDITSECTION__
7517 !! html
7518 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7519 !! end
7520
7521 ###
7522 ### Magic links
7523 ###
7524 !! test
7525 Magic links: internal link to RFC (bug 479)
7526 !! wikitext
7527 [[RFC 123]]
7528 !! html
7529 <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>
7530 </p>
7531 !! end
7532
7533 !! test
7534 Magic links: RFC (bug 479)
7535 !! wikitext
7536 RFC 822
7537 !! html
7538 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7539 </p>
7540 !! end
7541
7542 !! test
7543 Magic links: ISBN (bug 1937)
7544 !! wikitext
7545 ISBN 0-306-40615-2
7546 !! html
7547 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7548 </p>
7549 !! end
7550
7551 !! test
7552 Magic links: PMID incorrectly converts space to underscore
7553 !! wikitext
7554 PMID 1234
7555 !! html
7556 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7557 </p>
7558 !! end
7559
7560 ###
7561 ### Templates
7562 ####
7563
7564 !! test
7565 Nonexistent template
7566 !! wikitext
7567 {{thistemplatedoesnotexist}}
7568 !! html
7569 <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>
7570 </p>
7571 !! end
7572
7573 !! test
7574 Template with invalid target containing tags
7575 !! wikitext
7576 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7577 !! html
7578 <p>{{a<b>b</b>|foo|a=b|a = b}}
7579 </p>
7580 !! end
7581
7582 !! test
7583 Template with invalid target containing unclosed tag
7584 !! wikitext
7585 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7586 !! html
7587 <p>{{a<b>|foo|a=b|a = b}}</b>
7588 </p>
7589 !! end
7590
7591 !! test
7592 Template with invalid target containing wikilink
7593 !! wikitext
7594 {{[[Main Page]]}}
7595 !! html/php
7596 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7597 </p>
7598 !! html/parsoid
7599 <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>
7600 !! end
7601
7602 !! article
7603 Template:test
7604 !! text
7605 This is a test template
7606 !! endarticle
7607
7608 !! test
7609 Simple template
7610 !! wikitext
7611 {{test}}
7612 !! html
7613 <p>This is a test template
7614 </p>
7615 !! end
7616
7617 !! test
7618 Template with explicit namespace
7619 !! wikitext
7620 {{Template:test}}
7621 !! html
7622 <p>This is a test template
7623 </p>
7624 !! end
7625
7626
7627 !! article
7628 Template:paramtest
7629 !! text
7630 This is a test template with parameter {{{param}}}
7631 !! endarticle
7632
7633 !! test
7634 Template parameter
7635 !! wikitext
7636 {{paramtest|param=foo}}
7637 !! html
7638 <p>This is a test template with parameter foo
7639 </p>
7640 !! end
7641
7642 !! article
7643 Template:paramtestnum
7644 !! text
7645 [[{{{1}}}|{{{2}}}]]
7646 !! endarticle
7647
7648 !! test
7649 Template unnamed parameter
7650 !! wikitext
7651 {{paramtestnum|Main Page|the main page}}
7652 !! html
7653 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7654 </p>
7655 !! end
7656
7657 !! article
7658 Template:templatesimple
7659 !! text
7660 (test)
7661 !! endarticle
7662
7663 !! article
7664 Template:templateredirect
7665 !! text
7666 #redirect [[Template:templatesimple]]
7667 !! endarticle
7668
7669 !! article
7670 Template:templateasargtestnum
7671 !! text
7672 {{{{{1}}}}}
7673 !! endarticle
7674
7675 !! article
7676 Template:templateasargtest
7677 !! text
7678 {{template{{{templ}}}}}
7679 !! endarticle
7680
7681 !! article
7682 Template:templateasargtest2
7683 !! text
7684 {{{{{templ}}}}}
7685 !! endarticle
7686
7687 !! test
7688 Template with template name as unnamed argument
7689 !! wikitext
7690 {{templateasargtestnum|templatesimple}}
7691 !! html
7692 <p>(test)
7693 </p>
7694 !! end
7695
7696 !! test
7697 Template with template name as argument
7698 !! wikitext
7699 {{templateasargtest|templ=simple}}
7700 !! html
7701 <p>(test)
7702 </p>
7703 !! end
7704
7705 !! test
7706 Template with template name as argument (2)
7707 !! wikitext
7708 {{templateasargtest2|templ=templatesimple}}
7709 !! html
7710 <p>(test)
7711 </p>
7712 !! end
7713
7714 !! article
7715 Template:templateasargtestdefault
7716 !! text
7717 {{{{{templ|templatesimple}}}}}
7718 !! endarticle
7719
7720 !! article
7721 Template:templa
7722 !! text
7723 '''templ'''
7724 !! endarticle
7725
7726 !! test
7727 Template with default value
7728 !! wikitext
7729 {{templateasargtestdefault}}
7730 !! html
7731 <p>(test)
7732 </p>
7733 !! end
7734
7735 !! test
7736 Template with default value (value set)
7737 !! wikitext
7738 {{templateasargtestdefault|templ=templa}}
7739 !! html
7740 <p><b>templ</b>
7741 </p>
7742 !! end
7743
7744 !! test
7745 Template redirect
7746 !! wikitext
7747 {{templateredirect}}
7748 !! html
7749 <p>(test)
7750 </p>
7751 !! end
7752
7753 !! test
7754 Template with argument in separate line
7755 !! wikitext
7756 {{ templateasargtest |
7757 templ = simple }}
7758 !! html
7759 <p>(test)
7760 </p>
7761 !! end
7762
7763 !! test
7764 Template with complex template as argument
7765 !! wikitext
7766 {{paramtest|
7767 param ={{ templateasargtest |
7768 templ = simple }}}}
7769 !! html
7770 <p>This is a test template with parameter (test)
7771 </p>
7772 !! end
7773
7774 !! test
7775 Template with thumb image (with link in description)
7776 !! wikitext
7777 {{paramtest|
7778 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7779 !! html
7780 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>
7781
7782 !! end
7783
7784 !! article
7785 Template:complextemplate
7786 !! text
7787 {{{1}}} {{paramtest|
7788 param ={{{param}}}}}
7789 !! endarticle
7790
7791 !! test
7792 Template with complex arguments
7793 !! wikitext
7794 {{complextemplate|
7795 param ={{ templateasargtest |
7796 templ = simple }}|[[Template:complextemplate|link]]}}
7797 !! html
7798 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7799 </p>
7800 !! end
7801
7802 !! test
7803 BUG 553: link with two variables in a piped link
7804 !! wikitext
7805 {|
7806 |[[{{{1}}}|{{{2}}}]]
7807 |}
7808 !! html
7809 <table>
7810 <tr>
7811 <td>[[{{{1}}}|{{{2}}}]]
7812 </td></tr></table>
7813
7814 !! end
7815
7816 !! test
7817 Magic variable as template parameter
7818 !! wikitext
7819 {{paramtest|param={{SITENAME}}}}
7820 !! html
7821 <p>This is a test template with parameter MediaWiki
7822 </p>
7823 !! end
7824
7825 !! article
7826 Template:linktest
7827 !! text
7828 [[{{{param}}}|link]]
7829 !! endarticle
7830
7831 !! test
7832 Template parameter as link source
7833 !! wikitext
7834 {{linktest|param=Main Page}}
7835 !! html
7836 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7837 </p>
7838 !! end
7839
7840 !!test
7841 Template-generated attribute string (k='v')
7842 !! wikitext
7843 <span {{attr_str|id|v1}}>bar</span>
7844 !! html
7845 <p><span id="v1">bar</span>
7846 </p>
7847 !!end
7848
7849 !!article
7850 Template:paramtest2
7851 !! text
7852 including another template, {{paramtest|param={{{arg}}}}}
7853 !! endarticle
7854
7855 !! test
7856 Template passing argument to another template
7857 !! wikitext
7858 {{paramtest2|arg='hmm'}}
7859 !! html
7860 <p>including another template, This is a test template with parameter 'hmm'
7861 </p>
7862 !! end
7863
7864 !! article
7865 Template:Linktest2
7866 !! text
7867 Main Page
7868 !! endarticle
7869
7870 !! test
7871 Template as link source
7872 !! wikitext
7873 [[{{linktest2}}]]
7874
7875 [[{{linktest2}}|Main Page]]
7876
7877 [[{{linktest2}}]]Page
7878 !! html
7879 <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>
7881 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7882 </p>
7883 !! end
7884
7885
7886 !! article
7887 Template:loop1
7888 !! text
7889 {{loop2}}
7890 !! endarticle
7891
7892 !! article
7893 Template:loop2
7894 !! text
7895 {{loop1}}
7896 !! endarticle
7897
7898 !! test
7899 Template infinite loop
7900 !! wikitext
7901 {{loop1}}
7902 !! html
7903 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7904 </p>
7905 !! end
7906
7907 !! test
7908 Template from main namespace
7909 !! wikitext
7910 {{:Main Page}}
7911 !! html
7912 <p>blah blah
7913 </p>
7914 !! end
7915
7916 !! article
7917 Template:table
7918 !! text
7919 {|
7920 | 1 || 2
7921 |-
7922 | 3 || 4
7923 |}
7924 !! endarticle
7925
7926 !! test
7927 BUG 529: Template with table, not included at beginning of line
7928 !! wikitext
7929 foo {{table}}
7930 !! html
7931 <p>foo
7932 </p>
7933 <table>
7934 <tr>
7935 <td> 1 </td>
7936 <td> 2
7937 </td></tr>
7938 <tr>
7939 <td> 3 </td>
7940 <td> 4
7941 </td></tr></table>
7942
7943 !! end
7944
7945 !! test
7946 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7947 !! wikitext
7948 foo
7949 {{table}}
7950 !! html
7951 <p>foo
7952 </p>
7953 <table>
7954 <tr>
7955 <td> 1 </td>
7956 <td> 2
7957 </td></tr>
7958 <tr>
7959 <td> 3 </td>
7960 <td> 4
7961 </td></tr></table>
7962
7963 !! end
7964
7965 !! test
7966 BUG 41: Template parameters shown as broken links
7967 !! wikitext
7968 {{{parameter}}}
7969 !! html
7970 <p>{{{parameter}}}
7971 </p>
7972 !! end
7973
7974 !! test
7975 Template with targets containing wikilinks
7976 !! wikitext
7977 {{[[foo]]}}
7978
7979 {{[[{{echo|foo}}]]}}
7980
7981 {{{{echo|[[foo}}]]}}
7982 !! html
7983 <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>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7985 </p><p>{{[[foo}}]]
7986 </p>
7987 !! end
7988
7989 !! article
7990 Template:MSGNW test
7991 !! text
7992 ''None'' of '''this''' should be
7993 * interpreted
7994 but rather passed unmodified
7995 {{test}}
7996 !! endarticle
7997
7998 # hmm, fix this or just deprecate msgnw and document its behavior?
7999 !! test
8000 msgnw keyword
8001 !! options
8002 disabled
8003 !! wikitext
8004 {{msgnw:MSGNW test}}
8005 !! html
8006 <p>''None'' of '''this''' should be
8007 * interpreted
8008 but rather passed unmodified
8009 {{test}}
8010 </p>
8011 !! end
8012
8013 !! test
8014 int keyword
8015 !! wikitext
8016 {{int:youhavenewmessages|lots of money|not!}}
8017 !! html
8018 <p>You have lots of money (not!).
8019 </p>
8020 !! end
8021
8022 !! article
8023 Template:Includes
8024 !! text
8025 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8026 !! endarticle
8027
8028 !! test
8029 <includeonly> and <noinclude> being included
8030 !! wikitext
8031 {{Includes}}
8032 !! html
8033 <p>Foobar
8034 </p>
8035 !! end
8036
8037 !! article
8038 Template:Includes2
8039 !! text
8040 <onlyinclude>Foo</onlyinclude>bar
8041 !! endarticle
8042
8043 !! test
8044 <onlyinclude> being included
8045 !! wikitext
8046 {{Includes2}}
8047 !! html
8048 <p>Foo
8049 </p>
8050 !! end
8051
8052
8053 !! article
8054 Template:Includes3
8055 !! text
8056 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8057 !! endarticle
8058
8059 !! test
8060 <onlyinclude> and <includeonly> being included
8061 !! wikitext
8062 {{Includes3}}
8063 !! html
8064 <p>Foo
8065 </p>
8066 !! end
8067
8068 !! test
8069 <includeonly> and <noinclude> on a page
8070 !! wikitext
8071 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8072 !! html
8073 <p>Foozar
8074 </p>
8075 !! end
8076
8077 !! test
8078 Un-closed <noinclude>
8079 !! wikitext
8080 <noinclude>
8081 !! html
8082 !! end
8083
8084 !! test
8085 <onlyinclude> on a page
8086 !! wikitext
8087 <onlyinclude>Foo</onlyinclude>bar
8088 !! html
8089 <p>Foobar
8090 </p>
8091 !! end
8092
8093 !! test
8094 Un-closed <onlyinclude>
8095 !! wikitext
8096 <onlyinclude>
8097 !! html
8098 !! end
8099
8100 !!test
8101 Self-closed noinclude, includeonly, onlyinclude tags
8102 !! wikitext
8103 <noinclude />
8104 <includeonly />
8105 <onlyinclude />
8106 !! html
8107 <p><br />
8108 </p>
8109 !!end
8110
8111 !!test
8112 Unbalanced includeonly and noinclude tags
8113 !! wikitext
8114 {|
8115 |a</noinclude>
8116 |b</noinclude></noinclude>
8117 |c</noinclude></includeonly>
8118 |d</includeonly></includeonly>
8119 |}
8120 !! html
8121 <table>
8122 <tr>
8123 <td>a
8124 </td>
8125 <td>b
8126 </td>
8127 <td>c&lt;/includeonly&gt;
8128 </td>
8129 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8130 </td></tr></table>
8131
8132 !!end
8133
8134 !! article
8135 Template:Includeonly section
8136 !! text
8137 <includeonly>
8138 ==Includeonly section==
8139 </includeonly>
8140 ==Section T-1==
8141 !!endarticle
8142
8143 !! test
8144 Bug 6563: Edit link generation for section shown by <includeonly>
8145 !! wikitext
8146 {{includeonly section}}
8147 !! html
8148 <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>
8149 <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>
8150
8151 !! end
8152
8153 # Uses same input as the contents of [[Template:Includeonly section]]
8154 !! test
8155 Bug 6563: Section extraction for section shown by <includeonly>
8156 !! options
8157 section=T-2
8158 !! wikitext
8159 <includeonly>
8160 ==Includeonly section==
8161 </includeonly>
8162 ==Section T-2==
8163 !! html
8164 ==Section T-2==
8165 !! end
8166
8167 !! test
8168 Bug 6563: Edit link generation for section suppressed by <includeonly>
8169 !! wikitext
8170 <includeonly>
8171 ==Includeonly section==
8172 </includeonly>
8173 ==Section 1==
8174 !! html
8175 <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>
8176
8177 !! end
8178
8179 !! test
8180 Bug 6563: Section extraction for section suppressed by <includeonly>
8181 !! options
8182 section=1
8183 !! wikitext
8184 <includeonly>
8185 ==Includeonly section==
8186 </includeonly>
8187 ==Section 1==
8188 !! html
8189 ==Section 1==
8190 !! end
8191
8192 !! test
8193 Un-closed <includeonly>
8194 !! wikitext
8195 <includeonly>
8196 !! html
8197 !! end
8198
8199 # TODO: test with DOM fragment reuse!
8200 !! test
8201 Parsoid: DOM fragment reuse
8202 !! options
8203 parsoid=wt2wt,wt2html
8204 !! wikitext
8205 a{{echo|b<table></table>c}}d
8206
8207 a{{echo|b
8208 <table></table>
8209 c}}d
8210
8211 {{echo|a
8212
8213 <table></table>
8214
8215 b}}
8216 !! html
8217 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8218 <table></table>c"}},"i":0}}]}'>b</span>
8219 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8220
8221
8222 <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">
8223 </span>
8224 <table about="#mwt2"></table><span about="#mwt2">
8225 </span>
8226 <p about="#mwt2">cd</p>
8227
8228
8229 <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">
8230
8231 </span>
8232 <table about="#mwt3"></table><span about="#mwt3">
8233
8234 </span>
8235 <p about="#mwt3">b</p>
8236 !! end
8237
8238 !! test
8239 Parsoid: Merge double tds (bug 50603)
8240 !! options
8241 parsoid
8242 !! wikitext
8243 {|
8244 |{{echo|{{!}} foo}}
8245 |}
8246 !! html
8247 <table><tbody>
8248 <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>
8249 </tbody></table>
8250 !! end
8251
8252 !! test
8253 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8254 !! options
8255 parsoid
8256 !! wikitext
8257 {{echo|<div>}}
8258 {|
8259 |{{echo|{{!}} foo}}
8260 |}
8261 {{echo|</div>}}
8262 !! html
8263 <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}}]}'>
8264 <table><tbody>
8265 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8266 </tbody></table>
8267 </div>
8268 !! end
8269
8270 ###
8271 ### <includeonly> and <noinclude> in attributes
8272 ###
8273 !!test
8274 0. includeonly around the entire attribute
8275 !! wikitext
8276 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8277 !! html
8278 <p><span id="v2">bar</span>
8279 </p>
8280 !!end
8281
8282 !!test
8283 1. includeonly in html attr key
8284 !! wikitext
8285 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8286 !! html
8287 <p><span id="foo">bar</span>
8288 </p>
8289 !!end
8290
8291 !!test
8292 2. includeonly in html attr value
8293 !! wikitext
8294 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8295 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8296 !! html
8297 <p><span id="v1">bar</span>
8298 <span id="v1">bar</span>
8299 </p>
8300 !!end
8301
8302 !!test
8303 3. includeonly in part of an attr value
8304 !! wikitext
8305 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8306 !! html
8307 <p><span style="color:red;">bar</span>
8308 </p>
8309 !!end
8310
8311 !!test
8312 4. includeonly in table attributes
8313 !! wikitext
8314 {|
8315 |- <noinclude>
8316 |-
8317 |a
8318 </noinclude>
8319 |- <includeonly>
8320 |-
8321 |b
8322 </includeonly>
8323 |}
8324 !! html
8325 <table>
8326
8327
8328 <tr>
8329 <td>a
8330 </td></tr>
8331 </table>
8332
8333 !!end
8334
8335 ###
8336 ### Testing parsing of templates where a template arg
8337 ### has the same name as the template itself.
8338 ###
8339
8340 !! article
8341 Template:quote
8342 !! text
8343 {{{quote|{{{1}}}}}}
8344 !! endarticle
8345
8346 !!test
8347 Templates: Template Name/Arg clash: 1. Use of positional param
8348 !! wikitext
8349 {{quote|foo}}
8350 !! html
8351 <p>foo
8352 </p>
8353 !!end
8354
8355 !!test
8356 Templates: Template Name/Arg clash: 2. Use of named param
8357 !! wikitext
8358 {{quote|quote=foo}}
8359 !! html
8360 <p>foo
8361 </p>
8362 !!end
8363
8364 !!test
8365 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8366 !! wikitext
8367 {{quote|quote}}
8368 !! html
8369 <p>quote
8370 </p>
8371 !!end
8372
8373 ###
8374 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8375 ###
8376
8377 !!test
8378 Templates: 1. Simple use
8379 !! wikitext
8380 {{echo|Foo}}
8381 !! html
8382 <p>Foo
8383 </p>
8384 !!end
8385
8386 !!test
8387 Templates: 2. Inside a block tag
8388 !! wikitext
8389 <div>{{echo|Foo}}</div>
8390 <blockquote>{{echo|Foo}}</blockquote>
8391 !! html
8392 <div>Foo</div>
8393 <blockquote>Foo</blockquote>
8394
8395 !!end
8396
8397 !!test
8398 Templates: P-wrapping: 1a. Templates on consecutive lines
8399 !! wikitext
8400 {{echo|Foo}}
8401 {{echo|bar}}
8402 !! html
8403 <p>Foo
8404 bar
8405 </p>
8406 !!end
8407
8408 !!test
8409 Templates: P-wrapping: 1b. Templates on consecutive lines
8410 !! wikitext
8411 Foo
8412
8413 {{echo|bar}}
8414 {{echo|baz}}
8415 !! html
8416 <p>Foo
8417 </p><p>bar
8418 baz
8419 </p>
8420 !!end
8421
8422 !!test
8423 Templates: P-wrapping: 1c. Templates on consecutive lines
8424 !! wikitext
8425 {{echo|Foo}}
8426 {{echo|bar}} <div>baz</div>
8427 !! html
8428 <p>Foo
8429 </p>
8430 bar <div>baz</div>
8431
8432 !!end
8433
8434 !!test
8435 Templates: P-wrapping: 1d. Template preceded by comment-only line
8436 !!options
8437 parsoid
8438 !! wikitext
8439 <!-- foo -->
8440 {{echo|Bar}}
8441 !! html
8442 <!-- foo -->
8443
8444 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8445 !!end
8446
8447 !!test
8448 Templates: Inline Text: 1. Multiple tmeplate uses
8449 !! wikitext
8450 {{echo|Foo}}bar{{echo|baz}}
8451 !! html
8452 <p>Foobarbaz
8453 </p>
8454 !!end
8455
8456 !!test
8457 Templates: Inline Text: 2. Back-to-back template uses
8458 !! wikitext
8459 {{echo|Foo}}{{echo|bar}}
8460 !! html
8461 <p>Foobar
8462 </p>
8463 !!end
8464
8465 !!test
8466 Templates: Block Tags: 1. Multiple template uses
8467 !! wikitext
8468 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8469 !! html
8470 <div>Foo</div><div>bar</div><div>baz</div>
8471
8472 !!end
8473
8474 !!test
8475 Templates: Block Tags: 2. Back-to-back template uses
8476 !! wikitext
8477 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8478 !! html
8479 <div>Foo</div><div>bar</div>
8480
8481 !!end
8482
8483 !!test
8484 Templates: Links: 1. Simple example
8485 !! wikitext
8486 {{echo|[[Foo|bar]]}}
8487 !! html
8488 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8489 </p>
8490 !!end
8491
8492 !!test
8493 Templates: Links: 2. Generation of link href
8494 !! wikitext
8495 [[{{echo|Foo}}|bar]]
8496 !! html
8497 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8498 </p>
8499 !!end
8500
8501 !!test
8502 Templates: Links: 3. Generation of part of a link href
8503 !! wikitext
8504 [[Fo{{echo|o}}|bar]]
8505
8506 [[Foo{{echo|bar}}]]
8507
8508 [[Foo{{echo|bar}}baz]]
8509
8510 [[Foo{{echo|bar}}|bar]]
8511
8512 [[:Foo{{echo|bar}}]]
8513
8514 [[:Foo{{echo|bar}}|bar]]
8515 !! html
8516 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8517 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8518 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8519 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8520 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8521 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8522 </p>
8523 !!end
8524
8525 !!test
8526 Templates: Links: 4. Multiple templates generating link href
8527 !! wikitext
8528 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8529 !! html
8530 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8531 </p>
8532 !!end
8533
8534 !!test
8535 Templates: Links: 5. Generation of link text
8536 !! wikitext
8537 [[Foo|{{echo|bar}}]]
8538 !! html
8539 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8540 </p>
8541 !!end
8542
8543 !!test
8544 Templates: Links: 5. Nested templates (only outermost template should be marked)
8545 !! wikitext
8546 {{echo|[[{{echo|Foo}}|bar]]}}
8547 !! html
8548 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8549 </p>
8550 !!end
8551
8552 !!test
8553 Templates: HTML Tag: 1. Generation of HTML attr. key
8554 !! wikitext
8555 <div {{echo|style}}="color:red;">foo</div>
8556 !! html
8557 <div style="color:red;">foo</div>
8558
8559 !!end
8560
8561 !!test
8562 Templates: HTML Tag: 2. Generation of HTML attr. value
8563 !! wikitext
8564 <div style={{echo|'color:red;'}}>foo</div>
8565 !! html
8566 <div style="color:red;">foo</div>
8567
8568 !!end
8569
8570 !!test
8571 Templates: HTML Tag: 3. Generation of HTML attr key and value
8572 !! wikitext
8573 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8574 !! html
8575 <div style="color:red;">foo</div>
8576
8577 !!end
8578
8579 !!test
8580 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8581 !! wikitext
8582 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8583 !! html
8584 <div title="This is a long title with just one piece templated">foo</div>
8585
8586 !!end
8587
8588 !!test
8589 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8590 !! wikitext
8591 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8592 !! html
8593 <div title="This is a long title with just one piece templated">foo</div>
8594
8595 !!end
8596
8597 !!test
8598 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8599 !! wikitext
8600 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8601 !! html
8602 <div title="This is a long title with just one piece templated">foo</div>
8603
8604 !!end
8605
8606 !!test
8607 Templates: HTML Tag: 7. Generation of partial attribute key string
8608 !! wikitext
8609 <div st{{echo|yle}}="color:red;">foo</div>
8610 !! html
8611 <div style="color:red;">foo</div>
8612
8613 !!end
8614
8615 !!test
8616 Templates: HTML Tables: 1. Generating start of a HTML table
8617 !! wikitext
8618 {{echo|<table><tr><td>foo</td>}}</tr></table>
8619 !! html
8620 <table><tr><td>foo</td></tr></table>
8621
8622 !!end
8623
8624 !!test
8625 Templates: HTML Tables: 2a. Generating middle of a HTML table
8626 !! wikitext
8627 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8628 !! html
8629 <table><tr><td>foo</td></tr></table>
8630
8631 !!end
8632
8633 !!test
8634 Templates: HTML Tables: 2b. Generating middle of a HTML table
8635 !! wikitext
8636 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8637 !! html
8638 <table><tr><td>foo</td></tr></table>
8639
8640 !!end
8641
8642 !!test
8643 Templates: HTML Tables: 3. Generating end of a HTML table
8644 !! wikitext
8645 <table><tr>{{echo|<td>foo</td></tr></table>}}
8646 !! html
8647 <table><tr><td>foo</td></tr></table>
8648
8649 !!end
8650
8651 !!test
8652 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8653 !! wikitext
8654 {{echo|<table>}}<tr><td>foo</td></tr></table>
8655 !! html
8656 <table><tr><td>foo</td></tr></table>
8657
8658 !!end
8659
8660 !!test
8661 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8662 !! wikitext
8663 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8664 !! html
8665 <table><tr><td>foo</td></tr></table>
8666
8667 !!end
8668
8669 !!test
8670 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8671 !! wikitext
8672 <table><tr>{{echo|<td>}}foo</td></tr></table>
8673 !! html
8674 <table><tr><td>foo</td></tr></table>
8675
8676 !!end
8677
8678 !!test
8679 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8680 !! wikitext
8681 <table><tr><td>foo{{echo|</td>}}</tr></table>
8682 !! html
8683 <table><tr><td>foo</td></tr></table>
8684
8685 !!end
8686
8687 !!test
8688 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8689 !! wikitext
8690 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8691 !! html
8692 <table><tr><td>foo</td></tr></table>
8693
8694 !!end
8695
8696 !!test
8697 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8698 !! wikitext
8699 <table><tr><td>foo</td></tr>{{echo|</table>}}
8700 !! html
8701 <table><tr><td>foo</td></tr></table>
8702
8703 !!end
8704
8705 !!test
8706 Templates: HTML Tables: 5. Proper fostering of categories from inside
8707 !!options
8708 parsoid=wt2html,wt2wt
8709 !! wikitext
8710 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8711 <!--Two categories (Bug 50330)-->
8712 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8713 !! html
8714 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8715 <!--Two categories (Bug 50330)-->
8716 <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>
8717 !!end
8718
8719 !!test
8720 Templates: Wiki Tables: 1a. Fostering of entire template content
8721 !! wikitext
8722 {|
8723 {{echo|a}}
8724 |}
8725 !! html
8726 <table>
8727 a
8728 <tr><td></td></tr></table>
8729
8730 !!end
8731
8732 !!test
8733 Templates: Wiki Tables: 1b. Fostering of entire template content
8734 !! wikitext
8735 {|
8736 {{echo|<div>}}
8737 foo
8738 {{echo|</div>}}
8739 |}
8740 !! html
8741 <table>
8742 <div>
8743 <p>foo
8744 </p>
8745 </div>
8746 <tr><td></td></tr></table>
8747
8748 !!end
8749
8750 !!test
8751 Templates: Wiki Tables: 2. Fostering of partial template content
8752 !! wikitext
8753 {|
8754 {{echo|a
8755 <div>b</div>}}
8756 |}
8757 !! html
8758 <table>
8759 a
8760 <div>b</div>
8761 <tr><td></td></tr></table>
8762
8763 !!end
8764
8765 !!test
8766 Templates: Wiki Tables: 3. td-content via multiple templates
8767 !! wikitext
8768 {|
8769 {{echo|{{pipe}}a}}{{echo|b}}
8770 |}
8771 !! html
8772 <table>
8773 <tr>
8774 <td>ab
8775 </td></tr></table>
8776
8777 !!end
8778
8779 !!test
8780 Templates: Wiki Tables: 4. Templated tags, no content
8781 !! wikitext
8782 {{tbl-start}}
8783 {{tbl-end}}
8784 !! html
8785 <table>
8786 <tr><td></td></tr></table>
8787
8788 !!end
8789
8790 !!test
8791 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8792 !! wikitext
8793 {{tbl-start}}
8794 |foo
8795 {{tbl-end}}
8796 !! html
8797 <table>
8798 <tr>
8799 <td>foo
8800 </td></tr></table>
8801
8802 !!end
8803
8804 !!test
8805 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8806 !! wikitext
8807 {{tbl-start}}
8808 {{!}}foo
8809 {{tbl-end}}
8810 !! html
8811 <table>
8812 <tr>
8813 <td>foo
8814 </td></tr></table>
8815
8816 !!end
8817
8818 !!test
8819 Templates: Lists: Multi-line list-items via templates
8820 !! wikitext
8821 *{{echo|a {{nonexistent|
8822 unused}}}}
8823 *{{echo|b {{nonexistent|
8824 unused}}}}
8825 !! html
8826 <ul>
8827 <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>
8828 </li>
8829 <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>
8830 </li>
8831 </ul>
8832
8833 !!end
8834
8835 !!test
8836 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8837 !! wikitext
8838 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8839 !! html
8840 <p><i>ab</i>c<i>d</i>e
8841 </p>
8842 !!end
8843
8844 !!test
8845 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8846 (PHP parser generates misnested html)
8847 !! wikitext
8848 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8849 !! html/parsoid
8850 <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>
8851 !!end
8852
8853 !!test
8854 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8855 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8856 !! options
8857 parsoid=wt2html,wt2wt
8858 !! wikitext
8859 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8860 !! html
8861 <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>
8862 <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>
8863 <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>
8864 !!end
8865
8866 !!test
8867 Templates: Ugly nesting: 4. Divs opened/closed across templates
8868 !! wikitext
8869 a<div>b{{echo|c</div>d}}e
8870 !! html
8871 a<div>bc</div>de
8872
8873 !!end
8874
8875 !!test
8876 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8877 (Parsoid-centric)
8878 !! options
8879 parsoid
8880 !! wikitext
8881 {|
8882 |{{echo|foo</table>}}
8883 |bar
8884 |}
8885 !! html
8886 <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|}"]}'>
8887
8888 <tbody>
8889 <tr>
8890 <td>foo</td></tr></tbody></table><span about="#mwt1">
8891 </span><span about="#mwt1">|bar</span><span about="#mwt1">
8892 |}</span>
8893 !!end
8894
8895 !!test
8896 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8897 (Parsoid-centric)
8898 !! options
8899 parsoid
8900 !! wikitext
8901 <table>
8902 <tr>
8903 <td>
8904 <table>
8905 <tr>
8906 <td>1. {{echo|foo </table>}}</td>
8907 <td> bar </td>
8908 <td>2. {{echo|baz </table>}}</td>
8909 </tr>
8910 <tr>
8911 <td>abc</td>
8912 </tr>
8913 </table>
8914 </td>
8915 </tr>
8916 <tr>
8917 <td>xyz</td>
8918 </tr>
8919 </table>
8920 !! html
8921 <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>"]}'>
8922 <tbody><tr>
8923 <td>
8924 <table>
8925 <tbody><tr>
8926 <td>1. foo </td></tr></tbody></table></td>
8927 <td> bar </td>
8928 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8929 </span><span about="#mwt2">
8930 </span><span about="#mwt2">
8931 </span><span about="#mwt2">abc</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">
8937 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8938 </span><span about="#mwt2">
8939 </span>
8940 !!end
8941
8942 !! test
8943 Templates: Ugly templates: 3. newline-only template parameter
8944 !! wikitext
8945 foo {{echo|
8946 }}
8947 !! html
8948 <p>foo
8949 </p>
8950 !! end
8951
8952 # This looks like a bug: a single newline triggers p/br for some reason.
8953 !! test
8954 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8955 !! wikitext
8956 {{echo|
8957 }}
8958 !! html
8959 <p><br />
8960 </p>
8961 !! end
8962
8963
8964 !!test
8965 Parser Functions: 1. Simple example
8966 !! wikitext
8967 {{uc:foo}}
8968 !! html
8969 <p>FOO
8970 </p>
8971 !!end
8972
8973 !!test
8974 Parser Functions: 2. Nested use (only outermost should be marked up)
8975 !! wikitext
8976 {{uc:{{lc:FOO}}}}
8977 !! html
8978 <p>FOO
8979 </p>
8980 !!end
8981
8982 ###
8983 ### Pre-save transform tests
8984 ###
8985 !! test
8986 pre-save transform: subst:
8987 !! options
8988 PST
8989 !! wikitext
8990 {{subst:test}}
8991 !! html
8992 This is a test template
8993 !! end
8994
8995 !! test
8996 pre-save transform: normal template
8997 !! options
8998 PST
8999 !! wikitext
9000 {{test}}
9001 !! html
9002 {{test}}
9003 !! end
9004
9005 !! test
9006 pre-save transform: nonexistent template
9007 !! options
9008 PST
9009 !! wikitext
9010 {{thistemplatedoesnotexist}}
9011 !! html
9012 {{thistemplatedoesnotexist}}
9013 !! end
9014
9015
9016 !! test
9017 pre-save transform: subst magic variables
9018 !! options
9019 PST
9020 !! wikitext
9021 {{subst:SITENAME}}
9022 !! html
9023 MediaWiki
9024 !! end
9025
9026 # This is bug 89, which I fixed. -- wtm
9027 !! test
9028 pre-save transform: subst: templates with parameters
9029 !! options
9030 pst
9031 !! wikitext
9032 {{subst:paramtest|param="something else"}}
9033 !! html
9034 This is a test template with parameter "something else"
9035 !! end
9036
9037 !! article
9038 Template:nowikitest
9039 !! text
9040 <nowiki>'''not wiki'''</nowiki>
9041 !! endarticle
9042
9043 !! test
9044 pre-save transform: nowiki in subst (bug 1188)
9045 !! options
9046 pst
9047 !! wikitext
9048 {{subst:nowikitest}}
9049 !! html
9050 <nowiki>'''not wiki'''</nowiki>
9051 !! end
9052
9053
9054 !! article
9055 Template:commenttest
9056 !! text
9057 This template has <!-- a comment --> in it.
9058 !! endarticle
9059
9060 !! test
9061 pre-save transform: comment in subst (bug 1936)
9062 !! options
9063 pst
9064 !! wikitext
9065 {{subst:commenttest}}
9066 !! html
9067 This template has <!-- a comment --> in it.
9068 !! end
9069
9070 !! test
9071 pre-save transform: unclosed tag
9072 !! options
9073 pst noxml
9074 !! wikitext
9075 <nowiki>'''not wiki'''
9076 !! html
9077 <nowiki>'''not wiki'''
9078 !! end
9079
9080 !! test
9081 pre-save transform: mixed tag case
9082 !! options
9083 pst noxml
9084 !! wikitext
9085 <NOwiki>'''not wiki'''</noWIKI>
9086 !! html
9087 <NOwiki>'''not wiki'''</noWIKI>
9088 !! end
9089
9090 !! test
9091 pre-save transform: unclosed comment in <nowiki>
9092 !! options
9093 pst noxml
9094 !! wikitext
9095 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9096 !! html
9097 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9098 !!end
9099
9100 # Leading @ in this template definition works around a limitation
9101 # in parsoid's parserTests which otherwise strips the <span> from the
9102 # result (confusing it for a template wrapper)
9103 !! article
9104 Template:dangerous
9105 !!text
9106 @<span onmouseover="alert('crap')">Oh no</span>
9107 !!endarticle
9108
9109 !!test
9110 (confirming safety of fix for subst bug 1936)
9111 !! wikitext
9112 {{Template:dangerous}}
9113 !! html
9114 <p>@<span>Oh no</span>
9115 </p>
9116 !! end
9117
9118 !! test
9119 pre-save transform: comment containing gallery (bug 5024)
9120 !! options
9121 pst
9122 !! wikitext
9123 <!-- <gallery>data</gallery> -->
9124 !! html
9125 <!-- <gallery>data</gallery> -->
9126 !!end
9127
9128 !! test
9129 pre-save transform: comment containing extension
9130 !! options
9131 pst
9132 !! wikitext
9133 <!-- <tag>data</tag> -->
9134 !! html
9135 <!-- <tag>data</tag> -->
9136 !!end
9137
9138 !! test
9139 pre-save transform: comment containing nowiki
9140 !! options
9141 pst
9142 !! wikitext
9143 <!-- <nowiki>data</nowiki> -->
9144 !! html
9145 <!-- <nowiki>data</nowiki> -->
9146 !!end
9147
9148 !! test
9149 pre-save transform: <noinclude> in subst (bug 3298)
9150 !! options
9151 pst
9152 !! wikitext
9153 {{subst:Includes}}
9154 !! html
9155 Foobar
9156 !! end
9157
9158 !! test
9159 pre-save transform: <onlyinclude> in subst (bug 3298)
9160 !! options
9161 pst
9162 !! wikitext
9163 {{subst:Includes2}}
9164 !! html
9165 Foo
9166 !! end
9167
9168 !! article
9169 Template:SubstTest
9170 !!text
9171 {{<includeonly>subst:</includeonly>Includes}}
9172 !! endarticle
9173
9174 !! article
9175 Template:SafeSubstTest
9176 !! text
9177 {{<includeonly>safesubst:</includeonly>Includes}}
9178 !! endarticle
9179
9180 !! test
9181 bug 22297: safesubst: works during PST
9182 !! options
9183 pst
9184 !! wikitext
9185 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9186 !! html
9187 FoobarFoobar
9188 !! end
9189
9190 !! test
9191 bug 22297: safesubst: works during normal parse
9192 !! wikitext
9193 {{SafeSubstTest}}
9194 !! html
9195 <p>Foobar
9196 </p>
9197 !! end
9198
9199 !! test
9200 subst: does not work during normal parse
9201 !! wikitext
9202 {{SubstTest}}
9203 !! html
9204 <p>{{subst:Includes}}
9205 </p>
9206 !! end
9207
9208 !! test
9209 pre-save transform: context links ("pipe trick")
9210 !! options
9211 pst
9212 !! wikitext
9213 [[Article (context)|]]
9214 [[Bar:Article|]]
9215 [[:Bar:Article|]]
9216 [[Bar:Article (context)|]]
9217 [[:Bar:Article (context)|]]
9218 [[|Article]]
9219 [[|Article (context)]]
9220 [[Bar:X (Y) Z|]]
9221 [[:Bar:X (Y) Z|]]
9222 !! html
9223 [[Article (context)|Article]]
9224 [[Bar:Article|Article]]
9225 [[:Bar:Article|Article]]
9226 [[Bar:Article (context)|Article]]
9227 [[:Bar:Article (context)|Article]]
9228 [[Article]]
9229 [[Article (context)]]
9230 [[Bar:X (Y) Z|X (Y) Z]]
9231 [[:Bar:X (Y) Z|X (Y) Z]]
9232 !! end
9233
9234 !! test
9235 pre-save transform: context links ("pipe trick") with interwiki prefix
9236 !! options
9237 pst
9238 !! wikitext
9239 [[interwiki:Article|]]
9240 [[:interwiki:Article|]]
9241 [[interwiki:Bar:Article|]]
9242 [[:interwiki:Bar:Article|]]
9243 !! html
9244 [[interwiki:Article|Article]]
9245 [[:interwiki:Article|Article]]
9246 [[interwiki:Bar:Article|Bar:Article]]
9247 [[:interwiki:Bar:Article|Bar:Article]]
9248 !! end
9249
9250 !! test
9251 pre-save transform: context links ("pipe trick") with parens in title
9252 !! options
9253 pst title=[[Somearticle (context)]]
9254 !! wikitext
9255 [[|Article]]
9256 !! html
9257 [[Article (context)|Article]]
9258 !! end
9259
9260 !! test
9261 pre-save transform: context links ("pipe trick") with comma in title
9262 !! options
9263 pst title=[[Someplace, Somewhere]]
9264 !! wikitext
9265 [[|Otherplace]]
9266 [[Otherplace, Elsewhere|]]
9267 [[Otherplace, Elsewhere, Anywhere|]]
9268 !! html
9269 [[Otherplace, Somewhere|Otherplace]]
9270 [[Otherplace, Elsewhere|Otherplace]]
9271 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9272 !! end
9273
9274 !! test
9275 pre-save transform: context links ("pipe trick") with parens and comma
9276 !! options
9277 pst title=[[Someplace (IGNORED), Somewhere]]
9278 !! wikitext
9279 [[|Otherplace]]
9280 [[Otherplace (place), Elsewhere|]]
9281 !! html
9282 [[Otherplace, Somewhere|Otherplace]]
9283 [[Otherplace (place), Elsewhere|Otherplace]]
9284 !! end
9285
9286 !! test
9287 pre-save transform: context links ("pipe trick") with comma and parens
9288 !! options
9289 pst title=[[Who, me? (context)]]
9290 !! wikitext
9291 [[|Yes, you.]]
9292 [[Me, Myself, and I (1937 song)|]]
9293 !! html
9294 [[Yes, you. (context)|Yes, you.]]
9295 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9296 !! end
9297
9298 !! test
9299 pre-save transform: context links ("pipe trick") with namespace
9300 !! options
9301 pst title=[[Ns:Somearticle]]
9302 !! wikitext
9303 [[|Article]]
9304 !! html
9305 [[Ns:Article|Article]]
9306 !! end
9307
9308 !! test
9309 pre-save transform: context links ("pipe trick") with namespace and parens
9310 !! options
9311 pst title=[[Ns:Somearticle (context)]]
9312 !! wikitext
9313 [[|Article]]
9314 !! html
9315 [[Ns:Article (context)|Article]]
9316 !! end
9317
9318 !! test
9319 pre-save transform: context links ("pipe trick") with namespace and comma
9320 !! options
9321 pst title=[[Ns:Somearticle, Context, Whatever]]
9322 !! wikitext
9323 [[|Article]]
9324 !! html
9325 [[Ns:Article, Context, Whatever|Article]]
9326 !! end
9327
9328 !! test
9329 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9330 !! options
9331 pst title=[[Ns:Somearticle, Context (context)]]
9332 !! wikitext
9333 [[|Article]]
9334 !! html
9335 [[Ns:Article (context)|Article]]
9336 !! end
9337
9338 !! test
9339 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9340 !! options
9341 pst title=[[Ns:Somearticle (IGNORED), Context]]
9342 !! wikitext
9343 [[|Article]]
9344 !! html
9345 [[Ns:Article, Context|Article]]
9346 !! end
9347
9348 !! test
9349 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9350 !! options
9351 pst
9352 !! wikitext
9353 [[Article(context)|]]
9354 [[Bar:Article(context)|]]
9355 [[:Bar:Article(context)|]]
9356 [[|Article(context)]]
9357 [[Bar:X(Y)Z|]]
9358 [[:Bar:X(Y)Z|]]
9359 !! html
9360 [[Article(context)|Article]]
9361 [[Bar:Article(context)|Article]]
9362 [[:Bar:Article(context)|Article]]
9363 [[Article(context)]]
9364 [[Bar:X(Y)Z|X(Y)Z]]
9365 [[:Bar:X(Y)Z|X(Y)Z]]
9366 !! end
9367
9368 !! test
9369 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9370 !! options
9371 pst
9372 !! wikitext
9373 [[Article (context)|]]
9374 [[Bar:Article (context)|]]
9375 [[:Bar:Article (context)|]]
9376 [[|Article (context)]]
9377 [[Bar:X (Y) Z|]]
9378 [[:Bar:X (Y) Z|]]
9379 !! html
9380 [[Article (context)|Article]]
9381 [[Bar:Article (context)|Article]]
9382 [[:Bar:Article (context)|Article]]
9383 [[Article (context)]]
9384 [[Bar:X (Y) Z|X (Y) Z]]
9385 [[:Bar:X (Y) Z|X (Y) Z]]
9386 !! end
9387
9388 !! test
9389 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9390 !! options
9391 pst
9392 !! wikitext
9393 [[Article(context)|]]
9394 [[Bar:Article(context)|]]
9395 [[:Bar:Article(context)|]]
9396 [[|Article(context)]]
9397 [[Bar:X(Y)Z|]]
9398 [[:Bar:X(Y)Z|]]
9399 !! html
9400 [[Article(context)|Article]]
9401 [[Bar:Article(context)|Article]]
9402 [[:Bar:Article(context)|Article]]
9403 [[Article(context)]]
9404 [[Bar:X(Y)Z|X(Y)Z]]
9405 [[:Bar:X(Y)Z|X(Y)Z]]
9406 !! end
9407
9408 !! test
9409 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9410 !! options
9411 pst
9412 !! wikitext
9413 [[Article (context), context|]]
9414 [[Article (context),context|]]
9415 [[Bar:Article (context), context|]]
9416 [[Bar:Article (context),context|]]
9417 [[:Bar:Article (context), context|]]
9418 [[:Bar:Article (context),context|]]
9419 !! html
9420 [[Article (context), context|Article]]
9421 [[Article (context),context|Article]]
9422 [[Bar:Article (context), context|Article]]
9423 [[Bar:Article (context),context|Article]]
9424 [[:Bar:Article (context), context|Article]]
9425 [[:Bar:Article (context),context|Article]]
9426 !! end
9427
9428 !! test
9429 pre-save transform: trim trailing empty lines
9430 !! options
9431 pst
9432 !! wikitext
9433 Empty lines are trimmed
9434
9435
9436
9437
9438 !! html
9439 Empty lines are trimmed
9440 !! end
9441
9442 !! test
9443 pre-save transform: Signature expansion
9444 !! options
9445 pst
9446 !! wikitext
9447 * ~~~
9448 * <noinclude>~~~</noinclude>
9449 * <includeonly>~~~</includeonly>
9450 * <onlyinclude>~~~</onlyinclude>
9451 !! html
9452 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9453 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9454 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9455 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9456 !! end
9457
9458
9459 !! test
9460 pre-save transform: Signature expansion in nowiki tags (bug 93)
9461 !! options
9462 pst disabled
9463 !! wikitext
9464 Shall not expand:
9465
9466 <nowiki>~~~~</nowiki>
9467
9468 <includeonly><nowiki>~~~~</nowiki></includeonly>
9469
9470 <noinclude><nowiki>~~~~</nowiki></noinclude>
9471
9472 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9473
9474 {{subst:Foo}} shall be converted to FOO
9475
9476 As well as inside noinclude/onlyinclude
9477 <noinclude>{{subst:Foo}}</noinclude>
9478 <onlyinclude>{{subst:Foo}}</onlyinclude>
9479
9480 But not inside includeonly
9481 <includeonly>{{subst:Foo}}</includeonly>
9482 !! html
9483 Shall not expand:
9484
9485 <nowiki>~~~~</nowiki>
9486
9487 <includeonly><nowiki>~~~~</nowiki></includeonly>
9488
9489 <noinclude><nowiki>~~~~</nowiki></noinclude>
9490
9491 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9492
9493 FOO shall be converted to FOO
9494
9495 As well as inside noinclude/onlyinclude
9496 <noinclude>FOO</noinclude>
9497 <onlyinclude>FOO</onlyinclude>
9498
9499 But not inside includeonly
9500 <includeonly>{{subst:Foo}}</includeonly>
9501 !! end
9502
9503 !! test
9504 Parsoid: Recognize nowiki with trailing space in tags
9505 !! options
9506 parsoid=wt2html
9507 !! wikitext
9508 <nowiki ><div>[[foo]]</nowiki >
9509
9510 a<nowiki / >b
9511
9512 c<nowiki />d
9513
9514 e<nowiki/ >f
9515 !! html
9516 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9517 <p>ab</p>
9518 <p>cd</p>
9519 <p>ef</p>
9520 !! end
9521
9522 !! test
9523 Parsoid: Recognize nowiki with odd capitalization
9524 !! options
9525 parsoid=wt2html
9526 !! wikitext
9527 <noWikI ><div>[[foo]]</Nowiki >
9528 !! html
9529 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9530 !! end
9531
9532
9533 !! test
9534 Parsoid: Escape nowiki with trailing space in tags
9535 !! options
9536 parsoid=html2wt
9537 !! wikitext
9538 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9539
9540 a&lt;nowiki /&gt;b
9541
9542 c&lt;nowiki/ &gt;d
9543 !! html
9544 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9545 <p>a&lt;nowiki /&gt;b</p>
9546 <p>c&lt;nowiki/ &gt;d</p>
9547 !! end
9548
9549 !! test
9550 Parsoid: Escape weird noWikI capitalizations
9551 !! options
9552 parsoid=html2wt
9553 !! wikitext
9554 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9555 !! html
9556 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9557 !! end
9558
9559 ###
9560 ### Message transform tests
9561 ###
9562 !! test
9563 message transform: magic variables
9564 !! options
9565 msg
9566 !! wikitext
9567 {{SITENAME}}
9568 !! html
9569 MediaWiki
9570 !! end
9571
9572 !! test
9573 message transform: should not transform wiki markup
9574 !! options
9575 msg
9576 !! wikitext
9577 ''test''
9578 !! html
9579 ''test''
9580 !! end
9581
9582 !! test
9583 message transform: <noinclude> in transcluded template (bug 4926)
9584 !! options
9585 msg
9586 !! wikitext
9587 {{Includes}}
9588 !! html
9589 Foobar
9590 !! end
9591
9592 !! test
9593 message transform: <onlyinclude> in transcluded template (bug 4926)
9594 !! options
9595 msg
9596 !! wikitext
9597 {{Includes2}}
9598 !! html
9599 Foo
9600 !! end
9601
9602 !! test
9603 {{#special:}} page name, known
9604 !! options
9605 msg
9606 !! wikitext
9607 {{#special:Recentchanges}}
9608 !! html
9609 Special:RecentChanges
9610 !! end
9611
9612 !! test
9613 {{#special:}} page name with subpage, known
9614 !! options
9615 msg
9616 !! wikitext
9617 {{#special:Recentchanges/param}}
9618 !! html
9619 Special:RecentChanges/param
9620 !! end
9621
9622 !! test
9623 {{#special:}} page name, unknown
9624 !! options
9625 msg
9626 !! wikitext
9627 {{#special:foobar nonexistent}}
9628 !! html
9629 Special:Foobar nonexistent
9630 !! end
9631
9632 !! test
9633 {{#speciale:}} page name, known
9634 !! options
9635 msg
9636 !! wikitext
9637 {{#speciale:Recentchanges}}
9638 !! html
9639 Special:RecentChanges
9640 !! end
9641
9642 !! test
9643 {{#speciale:}} page name with subpage, known
9644 !! options
9645 msg
9646 !! wikitext
9647 {{#speciale:Recentchanges/param}}
9648 !! html
9649 Special:RecentChanges/param
9650 !! end
9651
9652 !! test
9653 {{#speciale:}} page name, unknown
9654 !! options
9655 msg
9656 !! wikitext
9657 {{#speciale:foobar nonexistent}}
9658 !! html
9659 Special:Foobar_nonexistent
9660 !! end
9661
9662 ###
9663 ### Images
9664 ###
9665 ### For Parsoid-specific tests, see
9666 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9667
9668 !! test
9669 Simple image
9670 !! options
9671 parsoid=wt2html,wt2wt,html2html
9672 !! wikitext
9673 [[Image:foobar.jpg]]
9674 !! html/php
9675 <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>
9676 </p>
9677 !! html/parsoid
9678 <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>
9679 </p>
9680 !! end
9681
9682 !! test
9683 Simple image (using File: namespace, now canonical)
9684 !! wikitext
9685 [[File:Foobar.jpg]]
9686 !! html/php
9687 <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>
9688 </p>
9689 !! html/parsoid
9690 <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>
9691 </p>
9692 !! end
9693
9694 !! test
9695 Right-aligned image
9696 !! wikitext
9697 [[File:Foobar.jpg|right]]
9698 !! html/php
9699 <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>
9700
9701 !! html/parsoid
9702 <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>
9703 !! end
9704
9705 !! test
9706 Image with caption
9707 !! wikitext
9708 [[File:Foobar.jpg|right|Caption text]]
9709 !! html/php
9710 <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>
9711
9712 !! html/parsoid
9713 <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>
9714 !! end
9715
9716 !! test
9717 Image with caption, bug 53312 #1
9718 !! wikitext
9719 [[File:Foobar.jpg|right|Caption page stuff]]
9720 !! html/php
9721 <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>
9722
9723 !! html/parsoid
9724 <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>
9725 !! end
9726
9727 !! test
9728 Image with caption, bug 53312 #2
9729 !! wikitext
9730 [[File:Foobar.jpg|right|Caption page=]]
9731 !! html/php
9732 <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>
9733
9734 !! html/parsoid
9735 <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>
9736 !! end
9737
9738 !! test
9739 Image with caption, bug 53312 #3
9740 !! wikitext
9741 [[File:Foobar.jpg|right|Caption page=stuff]]
9742 !! html/php
9743 <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>
9744
9745 !! html/parsoid
9746 <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>
9747 !! end
9748
9749 !! test
9750 Allow empty links in image captions (Bug 60753)
9751 !! options
9752 thumbsize=220
9753 !! wikitext
9754 [[File:Foobar.jpg|thumb|Caption [[Link1]]
9755 [[]]
9756 [[Link2]]
9757 ]]
9758 !! html/php
9759 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
9760
9761 !! html/parsoid
9762 <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>
9763 [[]]
9764 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
9765 </figcaption></figure>
9766 !! end
9767
9768 !! test
9769 Link with empty target
9770 !! wikitext
9771 [[]]
9772 !! html
9773 <p>[[]]
9774 </p>
9775 !! end
9776
9777 !! test
9778 Image with empty attribute
9779 !! options
9780 parsoid=wt2html,wt2wt,html2html
9781 !! wikitext
9782 [[File:Foobar.jpg|right||Caption text]]
9783 !! html/php
9784 <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>
9785
9786 !! html/parsoid
9787 <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>
9788 !! end
9789
9790 !! test
9791 1. Block image with individual attributes from templates
9792 !! wikitext
9793 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
9794 !! html/php
9795 <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>
9796
9797 !! html/parsoid
9798 <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>
9799 !! end
9800
9801 !! test
9802 2. Block Image with individual attributes from templates
9803 !! wikitext
9804 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
9805 !! html/php
9806 <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>
9807
9808 !! html/parsoid
9809 <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>
9810 !! end
9811
9812 !! test
9813 3. Inline image with individual attributes from templates
9814 !! wikitext
9815 [[File:Foobar.jpg|{{echo|50px}}]]
9816 !! html/php
9817 <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>
9818 </p>
9819 !! html/parsoid
9820 <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>
9821 !! end
9822
9823 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
9824 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
9825 !! test
9826 Image with multiple attributes from the same template
9827 !! wikitext
9828 [[File:Foobar.jpg|{{image_attribs}}]]
9829 !! html/php
9830 <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>
9831
9832 !! html/parsoid
9833 <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>
9834 !! end
9835
9836 !! test
9837 Image with link tails
9838 !! options
9839 thumbsize=220
9840 !! wikitext
9841 123[[File:Foobar.jpg]]456
9842 123[[File:Foobar.jpg|right]]456
9843 123[[File:Foobar.jpg|thumb]]456
9844 !! html/php
9845 <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
9846 </p>
9847 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
9848 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
9849
9850 !! html/parsoid
9851 <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>
9852 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
9853 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
9854 !! end
9855
9856 !! test
9857 Image with multiple captions -- only last one is accepted
9858 !! wikitext
9859 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9860 !! html/php
9861 <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>
9862
9863 !! html/parsoid
9864 <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>
9865 !! end
9866
9867 !! test
9868 Image with multiple widths -- use last
9869 !! wikitext
9870 [[File:Foobar.jpg|200px|300px|caption]]
9871 !! html/php
9872 <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>
9873 </p>
9874 !! html/parsoid
9875 <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>
9876 !! end
9877
9878 !! test
9879 Image with multiple alignments -- use first (bug 48664)
9880 !! options
9881 thumbsize=220
9882 !! wikitext
9883 [[File:Foobar.jpg|thumb|left|right|center|caption]]
9884
9885 [[File:Foobar.jpg|middle|text-top|caption]]
9886 !! html/php
9887 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
9888 <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>
9889 </p>
9890 !! html/parsoid
9891 <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>
9892 <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>
9893 !! end
9894
9895 !! test
9896 Image with width attribute at different positions
9897 !! wikitext
9898 [[File:Foobar.jpg|200px|right|Caption]]
9899 [[File:Foobar.jpg|right|200px|Caption]]
9900 [[File:Foobar.jpg|right|Caption|200px]]
9901 !! html/php
9902 <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>
9903 <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>
9904 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
9905
9906 !! html/parsoid
9907 <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>
9908 <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>
9909 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9910 !! end
9911
9912 # a sad bit of backward-compatibility
9913 !! test
9914 Image with size specified with pxpx (bug 13500, 51628)
9915 !! options
9916 parsoid=wt2html,wt2wt,html2html
9917 !! wikitext
9918 [[File:Foobar.jpg|20pxpx]]
9919 [[File:Foobar.jpg|200x20pxpx]]
9920 !! html/php
9921 <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>
9922 <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>
9923 </p>
9924 !! html/parsoid
9925 <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>
9926 !! end
9927
9928 !! test
9929 Image with link parameter, wiki target
9930 !! wikitext
9931 [[File:Foobar.jpg|link=Main Page]]
9932 !! html/php
9933 <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>
9934 </p>
9935 !! html/parsoid
9936 <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>
9937 !! end
9938
9939 # parsoid bug 49293 (part 1)
9940 !! test
9941 Image with link parameter, URL target
9942 !! wikitext
9943 [[File:Foobar.jpg|link=http://example.com/]]
9944 !! html/php
9945 <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>
9946 </p>
9947 !! html/parsoid
9948 <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>
9949 !! end
9950
9951 # parsoid bug 49293 (part 2)
9952 !! test
9953 Image with link parameter, protocol-less URL target
9954 !! wikitext
9955 [[File:Foobar.jpg|link=//example.com/]]
9956 !! html/php
9957 <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>
9958 </p>
9959 !! html/parsoid
9960 <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>
9961 !! end
9962
9963 !! test
9964 Image with link parameter, wgExternalLinkTarget
9965 !! wikitext
9966 [[Image:foobar.jpg|link=http://example.com/]]
9967 !! config
9968 wgExternalLinkTarget='foobar'
9969 !! html
9970 <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>
9971 </p>
9972 !! end
9973
9974 !! test
9975 Image with link parameter, wgNoFollowLinks set to false
9976 !! wikitext
9977 [[Image:foobar.jpg|link=http://example.com/]]
9978 !! config
9979 wgNoFollowLinks=false
9980 !! html
9981 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9982 </p>
9983 !! end
9984
9985 !! test
9986 Image with link parameter, wgNoFollowDomainExceptions
9987 !! wikitext
9988 [[Image:foobar.jpg|link=http://example.com/]]
9989 !! config
9990 wgNoFollowDomainExceptions='example.com'
9991 !! html
9992 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9993 </p>
9994 !! end
9995
9996 !! test
9997 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9998 !! wikitext
9999 [[Image:foobar.jpg|link=http://example.com/|Title]]
10000 !! config
10001 wgExternalLinkTarget='foobar'
10002 !! html
10003 <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>
10004 </p>
10005 !! end
10006
10007 !! test
10008 Image with empty link parameter
10009 !! wikitext
10010 [[File:Foobar.jpg|link=]]
10011 !! html/php
10012 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10013 </p>
10014 !! html/parsoid
10015 <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>
10016 !! end
10017
10018 !! test
10019 Image with link parameter (wiki target) and unnamed parameter
10020 !! wikitext
10021 [[File:Foobar.jpg|link=Main_Page|Title]]
10022 !! html/php
10023 <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>
10024 </p>
10025 !! html/parsoid
10026 <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>
10027 !! end
10028
10029 !! test
10030 Image with link parameter (URL target) and unnamed parameter
10031 !! wikitext
10032 [[File:Foobar.jpg|link=http://example.com/|Title]]
10033 !! html/php
10034 <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>
10035 </p>
10036 !! html/parsoid
10037 <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>
10038 !! end
10039
10040 !! test
10041 Thumbnail image with link parameter
10042 !! options
10043 thumbsize=220
10044 parsoid=wt2html,wt2wt,html2html
10045 !! wikitext
10046 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10047 !! html/php
10048 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10049
10050 !! html/parsoid
10051 <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>
10052 !! end
10053
10054 !! test
10055 Manually-specified thumbnail image
10056 !! options
10057 thumbsize=220
10058 !! wikitext
10059 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10060 !! html/php
10061 <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>
10062
10063 !! html/parsoid
10064 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
10065 !! end
10066
10067 !! test
10068 Manually-specified thumbnail image with explicit link to wiki page
10069 !! options
10070 thumbsize=220
10071 parsoid=wt2html,wt2wt,html2html
10072 !! wikitext
10073 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10074 !! html/php
10075 <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>
10076
10077 !! html/parsoid
10078 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
10079 !! end
10080
10081 !! test
10082 Manually-specified thumbnail image with explicit link to url
10083 !! options
10084 thumbsize=220
10085 parsoid=wt2html,wt2wt,html2html
10086 !! wikitext
10087 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10088 !! html/php
10089 <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>
10090
10091 !! html/parsoid
10092 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
10093 !! end
10094
10095 !! test
10096 Manually-specified thumbnail image with explicit no link
10097 !! options
10098 thumbsize=220
10099 parsoid=wt2html,wt2wt,html2html
10100 !! wikitext
10101 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10102 !! html/php
10103 <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>
10104
10105 !! html/parsoid
10106 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
10107 !! end
10108
10109 !! test
10110 Manually-specified thumbnail image with explicit link and alt text
10111 !! options
10112 thumbsize=220
10113 parsoid=wt2html,wt2wt,html2html
10114 !! wikitext
10115 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10116 !! html/php
10117 <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>
10118
10119 !! html/parsoid
10120 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
10121 !! end
10122
10123 !! test
10124 Image with frame and link
10125 !! options
10126 parsoid=wt2html,wt2wt,html2html
10127 !! wikitext
10128 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10129 !! html/php
10130 <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>
10131
10132 !! html/parsoid
10133 <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>
10134 !! end
10135
10136 !! test
10137 Image with frame and link and explicit alt
10138 !! options
10139 parsoid=wt2html,wt2wt,html2html
10140 !! wikitext
10141 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10142 !! html/php
10143 <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>
10144
10145 !! html/parsoid
10146 <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>
10147 !! end
10148
10149 !! test
10150 Image with wiki markup in implicit alt
10151 !! options
10152 parsoid=wt2html,wt2wt,html2html
10153 !! wikitext
10154 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10155
10156 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10157 !! html/php
10158 <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>
10159 </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>
10160 </p>
10161 !! html/parsoid
10162 <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>
10163 <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>
10164 !! end
10165
10166 ###################
10167 # Image sizing.
10168 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10169 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10170 # Foobar has actual size of 1941x220
10171 # 1. Thumbs & frameless always reduce, can't be enlarged
10172 # 2. Framed images ignore width; always render at default size.
10173 # If given a height, they respect height but continue to ignore width.
10174 # 3. "Unspecified format" and border are the only types which can be
10175 # enlarged.
10176
10177 !! test
10178 Image: "unspecified format" and border enlarge
10179 !! options
10180 parsoid=wt2html,wt2wt,html2html
10181 !! wikitext
10182 [[File:Foobar.jpg|2000px]]
10183
10184 [[File:Foobar.jpg|border|2000px]]
10185 !! html/php
10186 <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>
10187 </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>
10188 </p>
10189 !! html/parsoid
10190 <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>
10191 <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>
10192 !! end
10193
10194 !! test
10195 Image: "unspecified format" and border reduce
10196 !! options
10197 parsoid=wt2html,wt2wt,html2html
10198 !! wikitext
10199 [[File:Foobar.jpg|1000px]]
10200
10201 [[File:Foobar.jpg|border|1000px]]
10202 !! html/php
10203 <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>
10204 </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>
10205 </p>
10206 !! html/parsoid
10207 <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>
10208 <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>
10209 !! end
10210
10211 !! test
10212 Image: thumbs reduce
10213 !! options
10214 parsoid=wt2html,wt2wt,html2html
10215 !! wikitext
10216 [[File:Foobar.jpg|thumb|50px]]
10217 !! html/php
10218 <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>
10219
10220 !! html/parsoid
10221 <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>
10222 !! end
10223
10224 !! test
10225 Image: thumbs can't be enlarged past original size
10226 !! options
10227 parsoid=wt2html,wt2wt,html2html
10228 !! wikitext
10229 [[File:Foobar.jpg|thumb|2000px]]
10230 !! html/php
10231 <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>
10232
10233 !! html/parsoid
10234 <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>
10235 !! end
10236
10237 !! test
10238 Image: frameless can reduce in size
10239 !! options
10240 parsoid=wt2html,wt2wt,html2html
10241 !! wikitext
10242 [[File:Foobar.jpg|frameless|50px]]
10243 !! html/php
10244 <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>
10245 </p>
10246 !! html/parsoid
10247 <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>
10248 !! end
10249
10250 !! test
10251 Image: frameless can't be enlarged past original size
10252 !! options
10253 parsoid=wt2html,wt2wt,html2html
10254 !! wikitext
10255 [[File:Foobar.jpg|frameless|2000px]]
10256 !! html/php
10257 <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>
10258 </p>
10259 !! html/parsoid
10260 <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>
10261 !! end
10262
10263 !! test
10264 Image: framed images ignore size if only width is given
10265 !! options
10266 parsoid=wt2html,wt2wt,html2html
10267 !! wikitext
10268 [[File:Foobar.jpg|frame]]
10269
10270 [[File:Foobar.jpg|frame|50px]]
10271
10272 [[File:Foobar.jpg|frame|2000px]]
10273 !! html/php
10274 <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>
10275 <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>
10276 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
10277
10278 !! html/parsoid
10279 <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>
10280 !! end
10281
10282 !! test
10283 Image: framed images respect size if given a height, but ignore width.
10284 !! wikitext
10285 [[File:Foobar.jpg|frame|50x50px]]
10286 !! html/php
10287 <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>
10288
10289 !! html/parsoid
10290 <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>
10291 !! end
10292
10293 ###################
10294
10295 !! test
10296 Link to image page- image page normally doesn't exists, hence edit link
10297 Add test with existing image page
10298 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10299 !! wikitext
10300 [[:Image:test]]
10301 !! html
10302 <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>
10303 </p>
10304 !! end
10305
10306 !! test
10307 bug 18784 Link to non-existent image page with caption should use caption as link text
10308 !! wikitext
10309 [[:Image:test|caption]]
10310 !! html
10311 <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>
10312 </p>
10313 !! end
10314
10315 !! test
10316 Frameless image caption with a free URL
10317 !! wikitext
10318 [[File:Foobar.jpg|http://example.com]]
10319 !! html/php
10320 <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>
10321 </p>
10322 !! html/parsoid
10323 <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>
10324 !! end
10325
10326 !! test
10327 Thumbnail image caption with a free URL
10328 !! options
10329 thumbsize=220
10330 !! wikitext
10331 [[File:Foobar.jpg|thumb|http://example.com]]
10332 !! html/php
10333 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10334
10335 !! html/parsoid
10336 <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>
10337 !! end
10338
10339 !! test
10340 Thumbnail image caption with a free URL and explicit alt
10341 !! options
10342 thumbsize=220
10343 parsoid=wt2html,wt2wt,html2html
10344 !! wikitext
10345 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10346 !! html/php
10347 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10348
10349 !! html/parsoid
10350 <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>
10351 !! end
10352
10353 !! test
10354 SVG thumbnails with no language set
10355 !! options
10356 !! wikitext
10357 [[File:Foobar.svg|thumb|caption]]
10358 !! html
10359 <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>
10360
10361 !! end
10362
10363 !! test
10364 SVG thumbnails with language de
10365 !! options
10366 !! wikitext
10367 [[File:Foobar.svg|thumb|caption|lang=de]]
10368 !! html
10369 <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>
10370
10371 !! end
10372
10373 !! test
10374 SVG thumbnails with invalid language code
10375 !! options
10376 !! wikitext
10377 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10378 !! html
10379 <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>
10380
10381 !! end
10382
10383 !! test
10384 BUG 1887: A ISBN with a thumbnail
10385 !! wikitext
10386 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
10387 !! html
10388 <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>
10389
10390 !! end
10391
10392 !! test
10393 BUG 1887: A RFC with a thumbnail
10394 !! wikitext
10395 [[Image:foobar.jpg|thumb|This is RFC 12354]]
10396 !! html
10397 <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>
10398
10399 !! end
10400
10401 !! test
10402 BUG 1887: A mailto link with a thumbnail
10403 !! wikitext
10404 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
10405 !! html
10406 <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>
10407
10408 !! end
10409
10410 # Pending resolution to bug 368
10411 !! test
10412 BUG 648: Frameless image caption with a link
10413 !! wikitext
10414 [[Image:foobar.jpg|text with a [[link]] in it]]
10415 !! html
10416 <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>
10417 </p>
10418 !! end
10419
10420 !! test
10421 BUG 648: Frameless image caption with a link (suffix)
10422 !! wikitext
10423 [[Image:foobar.jpg|text with a [[link]]foo in it]]
10424 !! html
10425 <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>
10426 </p>
10427 !! end
10428
10429 !! test
10430 BUG 648: Frameless image caption with an interwiki link
10431 !! wikitext
10432 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
10433 !! html
10434 <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>
10435 </p>
10436 !! end
10437
10438 !! test
10439 BUG 648: Frameless image caption with a piped interwiki link
10440 !! wikitext
10441 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10442 !! html
10443 <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>
10444 </p>
10445 !! end
10446
10447 !! test
10448 Escape HTML special chars in image alt text
10449 !! wikitext
10450 [[Image:foobar.jpg|& < > "]]
10451 !! html
10452 <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>
10453 </p>
10454 !! end
10455
10456 !! test
10457 BUG 499: Alt text should have &#1234;, not &amp;1234;
10458 !! wikitext
10459 [[Image:foobar.jpg|&#9792;]]
10460 !! html
10461 <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>
10462 </p>
10463 !! end
10464
10465 !! test
10466 Broken image caption with link
10467 !! wikitext
10468 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10469 !! html
10470 <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.
10471 </p>
10472 !! end
10473
10474 !! test
10475 Image caption containing another image
10476 !! wikitext
10477 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
10478 !! html
10479 <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>
10480
10481 !! end
10482
10483 !! test
10484 Image caption containing a newline
10485 !! wikitext
10486 [[Image:Foobar.jpg|This
10487 *is some text]]
10488 !! html
10489 <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>
10490 </p>
10491 !!end
10492
10493 !!test
10494 Parsoid: Image caption containing leading space
10495 (The leading space should not trigger nowiki escaping in wt2wt mode)
10496 !! wikitext
10497 [[Image:Foobar.jpg|thumb| bar]]
10498 !! html
10499 <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>
10500
10501 !!end
10502
10503 !! test
10504 Images: caption containing a table
10505 !! wikitext
10506 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10507 {|
10508 ! Foo !! Bar
10509 |-
10510 | Foo1 || Bar1
10511 |}
10512 and some more text.]]
10513 !! html/php
10514 <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>
10515
10516 !! html/parsoid
10517 <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
10518 <table>
10519 <tbody>
10520 <tr><th>Foo </th><th>Bar</th></tr>
10521 <tr>
10522 <td>Foo1 </td>
10523 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10524 !! end
10525
10526 !! test
10527 Bug 3090: External links other than http: in image captions
10528 !! wikitext
10529 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10530 !! html/php
10531 <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>
10532
10533 !! html/parsoid
10534 <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>
10535 !! end
10536
10537 !! test
10538 Custom class
10539 !! options
10540 parsoid=wt2html,wt2wt,html2html
10541 !! wikitext
10542 [[Image:foobar.jpg|a|class=b]]
10543 !! html/php
10544 <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>
10545 </p>
10546 !! html/parsoid
10547 <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>
10548 !! end
10549
10550 !! test
10551 Localized image handling (1).
10552 !! options
10553 parsoid=wt2html,wt2wt,html2html
10554 language=es
10555 !! wikitext
10556 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10557 !! html/php
10558 <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>
10559
10560 !! html/parsoid
10561 <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>
10562 !! end
10563
10564 !! test
10565 Localized image handling (2).
10566 !! options
10567 thumbsize=220
10568 parsoid=wt2html,wt2wt,html2html
10569 language=es
10570 !! wikitext
10571 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10572 !! html/php
10573 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10574
10575 !! html/parsoid
10576 <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>
10577 !! end
10578
10579 !! test
10580 "border", "frameless" and "class" attributes on an image.
10581 !! options
10582 thumbsize=220
10583 parsoid=wt2html,wt2wt,html2html
10584 !! wikitext
10585 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10586 !! html/php
10587 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
10588 </p>
10589 !! html/parsoid
10590 <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>
10591 !! end
10592
10593 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10594 !! test
10595 Invalid image attributes (bug 62500)
10596 !! options
10597 thumbsize=220
10598 parsoid=wt2html,wt2wt,html2html
10599 !! wikitext
10600 [[File:Foobar.jpg|thumb|float|left|caption]]
10601
10602 [[File:Foobar.jpg|thumb|righ|caption]]
10603
10604 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10605 !! html/php
10606 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10607 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10608 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10609
10610 !! html/parsoid
10611 <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>
10612 !! end
10613
10614 !! article
10615 File:Barfoo.jpg
10616 !! text
10617 #REDIRECT [[File:Barfoo.jpg]]
10618 !! endarticle
10619
10620 !! test
10621 Redirected image
10622 !! wikitext
10623 [[Image:Barfoo.jpg]]
10624 !! html
10625 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10626 </p>
10627 !! end
10628
10629 !! test
10630 Missing image with uploads disabled
10631 !! options
10632 wgEnableUploads=0
10633 !! wikitext
10634 [[Image:Foobaz.jpg]]
10635 !! html
10636 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10637 </p>
10638 !! end
10639
10640 # Parsoid-specific testing for images
10641 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10642 # Currently imperfect due to a flaw in the Parsoid testrunner
10643 # Work in progress
10644 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10645 # image tests.
10646
10647 !! test
10648 Parsoid-specific image handling - simple image with size and middle alignment
10649 !! wikitext
10650 [[File:Foobar.jpg|middle|50px]]
10651 !! html/parsoid
10652 <p><span class="mw-valign-middle" typeof="mw:Image">
10653 <a href="File:Foobar.jpg">
10654 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10655 </a>
10656 </span>
10657 </p>
10658 !! end
10659
10660 !! test
10661 Parsoid-specific image handling - simple image with size, middle alignment,
10662 non-standard namespace alias
10663 !! options
10664 parsoid=wt2wt,wt2html,html2html
10665 !! wikitext
10666 [[Image:Foobar.jpg|middle|50px]]
10667 !! html/parsoid
10668 <p><span class="mw-valign-middle" typeof="mw:Image">
10669 <a href="File:Foobar.jpg">
10670 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10671 </a>
10672 </span>
10673 </p>
10674 !! end
10675
10676 !! test
10677 Parsoid-specific image handling - simple image with size and middle alignment
10678 (existing content)
10679 !! wikitext
10680 [[File:Foobar.jpg|50px|middle]]
10681 !! html/parsoid
10682 <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>
10683 !! end
10684
10685 !! test
10686 Parsoid-specific image handling - simple image with size and middle alignment
10687 and non-standard namespace name
10688 !! options
10689 parsoid=wt2html,wt2wt,html2html
10690 !! wikitext
10691 [[Image:Foobar.jpg|50px|middle]]
10692 !! html/parsoid
10693 <p><span class="mw-valign-middle" typeof="mw:Image">
10694 <a href="File:Foobar.jpg">
10695 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10696 </a>
10697 </span>
10698 </p>
10699 !! end
10700
10701 !! test
10702 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10703 !! wikitext
10704 [[File:Foobar.jpg|500x10px|baseline|caption]]
10705 !! html/parsoid
10706 <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>
10707 !! end
10708
10709 !! test
10710 Parsoid-specific image handling - simple image with border and size spec
10711 !! wikitext
10712 [[File:Foobar.jpg|50px|border|caption]]
10713 !! html/parsoid
10714 <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>
10715 !! end
10716
10717 !! test
10718 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10719 !! wikitext
10720 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10721 !! html/parsoid
10722 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10723 <a href="File:Foobar.jpg">
10724 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10725 </a>
10726 <figcaption>caption content</figcaption>
10727 </figure>
10728 !! end
10729
10730 !! test
10731 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10732 (existing content)
10733 !! wikitext
10734 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10735 !! html/parsoid
10736 <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>
10737 !! end
10738
10739 !! test
10740 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10741 !! wikitext
10742 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10743 !! html/parsoid
10744 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10745 <a href="File:Foobar.jpg">
10746 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10747 </a>
10748 <figcaption>caption</figcaption>
10749 </figure>
10750 !! end
10751
10752 !! test
10753 Parsoid-specific image handling - thumbnail with specific size, halign,
10754 valign, and caption (existing content)
10755 !! wikitext
10756 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10757 !! html/parsoid
10758 <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>
10759 !! end
10760
10761 !! test
10762 Parsoid-specific image handling - framed image with specific size and caption
10763 !! wikitext
10764 [[Image:Foobar.jpg|frame|500x50px|caption]]
10765 !! html/parsoid
10766 <figure typeof="mw:Image/Frame">
10767 <a href="File:Foobar.jpg">
10768 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10769 </a>
10770 <figcaption>caption</figcaption>
10771 </figure>
10772 !! end
10773
10774 !! test
10775 Parsoid-specific image handling - framed image with specific size and caption
10776 (existing content)
10777 !! wikitext
10778 [[File:Foobar.jpg|442x50px|frame|caption]]
10779 !! html/parsoid
10780 <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>
10781 !! end
10782
10783 !! test
10784 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10785 !! wikitext
10786 [[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10787 !! html/parsoid
10788 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10789 <a href="File:Foobar.jpg">
10790 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10791 </a>
10792 <figcaption>caption</figcaption>
10793 </figure>
10794 !! end
10795
10796 !! test
10797 Parsoid-specific image handling - framed image with specific size, halign,
10798 valign, and caption (existing content)
10799 !! wikitext
10800 [[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
10801 !! html/parsoid
10802 <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>
10803 !! end
10804
10805 !! test
10806 Parsoid-specific image handling - frameless image with specific size, border, and caption
10807 !! wikitext
10808 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
10809 !! html/parsoid
10810 <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>
10811 !! end
10812
10813 !! test
10814 Parsoid-specific image handling - simple image with a formatted caption
10815 !! wikitext
10816 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10817 !! html/parsoid
10818 <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>"}'>
10819 <a href="File:Foobar.jpg">
10820 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10821 </a></span></p>
10822 !! end
10823
10824 !! test
10825 Parsoid-specific image handling - caption with a template in it
10826 !! wikitext
10827 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
10828 !! html/parsoid
10829 <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>
10830 !! end
10831
10832 !! test
10833 Parsoid-specific image handling - caption with unbalanced tags in it
10834 !! options
10835 parsoid=wt2html,wt2wt,html2html
10836 !! wikitext
10837 foo
10838 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
10839 bar
10840 !! html/parsoid
10841 <p>foo</p>
10842 <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>
10843 <p>bar</p>
10844 !! end
10845
10846 !! test
10847 Parsoid-specific image handling - empty caption
10848 !! wikitext
10849 [[File:Foobar.jpg|thumb|]]
10850 !! html/parsoid
10851 <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>
10852 !! end
10853
10854 !! test
10855 Parsoid-specific image handling - whitespace caption
10856 !! wikitext
10857 [[File:Foobar.jpg|thumb| ]]
10858 !! html/parsoid
10859 <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>
10860 !! end
10861
10862 !! test
10863 Parsoid-specific image handling - lang option
10864 !! wikitext
10865 foo
10866 [[File:Foobar.svg|lang=de|caption]]
10867 bar
10868 !! html/parsoid
10869 <p>foo
10870 <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>
10871 bar</p>
10872 !! end
10873
10874
10875 ###
10876 ### Subpages
10877 ###
10878 !! article
10879 Subpage test/subpage
10880 !! text
10881 foo
10882 !! endarticle
10883
10884 !! test
10885 Subpage link
10886 !! options
10887 subpage title=[[Subpage test]]
10888 !! wikitext
10889 [[/subpage]]
10890 !! html
10891 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10892 </p>
10893 !! end
10894
10895 !! test
10896 Subpage noslash link
10897 !! options
10898 subpage title=[[Subpage test]]
10899 !! wikitext
10900 [[/subpage/]]
10901 !! html
10902 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10903 </p>
10904 !! end
10905
10906 # TODO: make this PHP-parser compatible!
10907 !! test
10908 Relative subpage noslash link
10909 !! options
10910 parsoid=wt2wt,wt2html,html2html
10911 subpage title=[[Subpage test/1/2/3/4]]
10912 !! wikitext
10913 [[../../subpage/]]
10914
10915 [[../../subpage]]
10916 !! html
10917 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10918 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10919 !! end
10920
10921 # TODO: make this PHP-parser compatible!
10922 !! test
10923 Parsoid: dot-slash prefixed wikilinks
10924 !! options
10925 parsoid=wt2wt,wt2html,html2html
10926 !! wikitext
10927 [[./foo]]
10928
10929 [[././bar]]
10930
10931 [[././baz/]]
10932 !! html
10933 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10934 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10935 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10936 !! end
10937
10938 !! test
10939 Disabled subpages
10940 !! wikitext
10941 [[/subpage]]
10942 !! html
10943 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10944 </p>
10945 !! end
10946
10947 !! test
10948 BUG 561: {{/Subpage}}
10949 !! options
10950 subpage title=[[Page]]
10951 !! wikitext
10952 {{/Subpage}}
10953 !! html
10954 <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>
10955 </p>
10956 !! end
10957
10958 ###
10959 ### Categories
10960 ###
10961 !! article
10962 Category:MediaWiki User's Guide
10963 !! text
10964 blah
10965 !! endarticle
10966
10967 !! test
10968 Link to category
10969 !! wikitext
10970 [[:Category:MediaWiki User's Guide]]
10971 !! html
10972 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10973 </p>
10974 !! end
10975
10976 !! test
10977 Simple category
10978 !! options
10979 cat
10980 !! wikitext
10981 [[Category:MediaWiki User's Guide]]
10982 !! html
10983 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10984 !! end
10985
10986 !! test
10987 PAGESINCATEGORY invalid title fatal (r33546 fix)
10988 !! wikitext
10989 {{PAGESINCATEGORY:<bogus>}}
10990 !! html
10991 <p>0
10992 </p>
10993 !! end
10994
10995 !! test
10996 Category with different sort key
10997 !! options
10998 cat
10999 !! wikitext
11000 [[Category:MediaWiki User's Guide|Foo]]
11001 !! html
11002 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11003 !! end
11004
11005 !! test
11006 Category with identical sort key
11007 !! options
11008 cat
11009 !! wikitext
11010 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11011 !! html
11012 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11013 !! end
11014
11015 !! test
11016 Category with empty sort key
11017 !! options
11018 cat
11019 pst
11020 !! wikitext
11021 [[Category:MediaWiki User's Guide|]]
11022 !! html
11023 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11024 !! end
11025
11026 !! test
11027 Category with empty sort key and parentheses
11028 !! options
11029 cat
11030 pst
11031 !! wikitext
11032 [[Category:Foo (bar)|]]
11033 !! html
11034 [[Category:Foo (bar)|Foo]]
11035 !! end
11036
11037 !! test
11038 Category with link tail
11039 !! options
11040 cat
11041 pst
11042 !! wikitext
11043 123[[Category:Foo]]456
11044 !! html
11045 123[[Category:Foo]]456
11046 !! end
11047
11048 !! test
11049 Category with template
11050 !! options
11051 cat
11052 pst
11053 !! wikitext
11054 [[Category:{{echo|Foo}}]]
11055 !! html
11056 [[Category:{{echo|Foo}}]]
11057 !! end
11058
11059 !! test
11060 Category with template in sort key
11061 !! options
11062 cat
11063 pst
11064 !! wikitext
11065 [[Category:Foo|{{echo|Bar}}]]
11066 !! html
11067 [[Category:Foo|{{echo|Bar}}]]
11068 !! end
11069
11070 !! test
11071 Category with template in sort key and title
11072 !! options
11073 cat
11074 pst
11075 !! wikitext
11076 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11077 !! html
11078 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11079 !! end
11080
11081 !! test
11082 Category / paragraph interactions
11083 !! wikitext
11084 Foo [[Category:Baz]] Bar
11085
11086 Foo [[Category:Baz]]
11087 Bar
11088
11089 Foo
11090 [[Category:Baz]]
11091 Bar
11092
11093 Foo
11094 [[Category:Baz]] Bar
11095
11096 Foo
11097 [[Category:Baz]]
11098 [[Category:Baz]]
11099 [[Category:Baz]]
11100 Bar
11101
11102 [[Category:Baz]]
11103 [[Category:Baz]]
11104 [[Category:Baz]]
11105
11106 [[Category:Baz]]
11107 {{echo|[[Category:Baz]]}}
11108 [[Category:Baz]]
11109 !! html
11110 <p>Foo Bar
11111 </p><p>Foo
11112 Bar
11113 </p><p>Foo
11114 Bar
11115 </p><p>Foo Bar
11116 </p><p>Foo
11117 Bar
11118 </p>
11119 !! end
11120
11121 !! test
11122 Parsoid: Serialize link to category page with colon escape
11123 !! options
11124 parsoid
11125 !! wikitext
11126
11127 [[:Category:Foo]]
11128 [[:Category:Foo|Bar]]
11129 !! html
11130 <p>
11131 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11132 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11133 </p>
11134 !! end
11135
11136 !! test
11137 Parsoid: Link prefix/suffixes aren't applied to category links
11138 !! options
11139 parsoid=wt2html,wt2wt,html2html
11140 language=is
11141 !! wikitext
11142 x[[Category:Foo]]y
11143 !! html
11144 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11145 !! end
11146
11147 !! test
11148 Parsoid: Serialize link to file page with colon escape
11149 !! options
11150 parsoid
11151 !! wikitext
11152
11153 [[:File:Foo.png]]
11154 [[:File:Foo.png|Bar]]
11155 !! html
11156 <p>
11157 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11158 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11159 </p>
11160 !! end
11161
11162 !! test
11163 Parsoid: Serialize a genuine category link without colon escape
11164 !! options
11165 parsoid
11166 !! wikitext
11167 [[Category:Foo]]
11168 [[Category:Foo|Bar]]
11169 !! html
11170 <link rel="mw:PageProp/Category" href="Category:Foo">
11171 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11172 !! end
11173
11174 !! test
11175 Parsoid: Defaultsort
11176 !! options
11177 parsoid
11178 !! wikitext
11179 {{DEFAULTSORT:Foo}}
11180 !! html
11181 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11182 !! end
11183
11184 ###
11185 ### Inter-language links
11186 ###
11187 !! test
11188 Inter-language links
11189 !! options
11190 ill
11191 !! wikitext
11192 [[es:Alimento]]
11193 [[fr:Nourriture]]
11194 [[zh:&#39135;&#21697;]]
11195 !! html
11196 es:Alimento fr:Nourriture zh:食品
11197 !! end
11198
11199 !! test
11200 Duplicate interlanguage links (bug 24502)
11201 !! options
11202 ill
11203 !! wikitext
11204 [[es:1]]
11205 [[es:2]]
11206 [[fr:1]]
11207 [[fr:2]]
11208 !! html
11209 es:1 fr:1
11210 !! end
11211
11212 ###
11213 ### Sections
11214 ###
11215 !! test
11216 Basic section headings
11217 !! wikitext
11218 == Headline 1 ==
11219 Some text
11220
11221 ==Headline 2==
11222 More
11223 ===Smaller headline===
11224 Blah blah
11225 !! html
11226 <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>
11227 <p>Some text
11228 </p>
11229 <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>
11230 <p>More
11231 </p>
11232 <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>
11233 <p>Blah blah
11234 </p>
11235 !! end
11236
11237 !! test
11238 Section headings with TOC
11239 !! wikitext
11240 == Headline 1 ==
11241 === Subheadline 1 ===
11242 ===== Skipping a level =====
11243 ====== Skipping a level ======
11244
11245 == Headline 2 ==
11246 Some text
11247 ===Another headline===
11248 !! html
11249 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11250 <ul>
11251 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11252 <ul>
11253 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11254 <ul>
11255 <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>
11256 <ul>
11257 <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>
11258 </ul>
11259 </li>
11260 </ul>
11261 </li>
11262 </ul>
11263 </li>
11264 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11265 <ul>
11266 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11267 </ul>
11268 </li>
11269 </ul>
11270 </div>
11271
11272 <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>
11273 <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>
11274 <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>
11275 <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>
11276 <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>
11277 <p>Some text
11278 </p>
11279 <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>
11280
11281 !! end
11282
11283 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11284 !! test
11285 Handling of sections up to level 6 and beyond
11286 !! wikitext
11287 = Level 1 Heading=
11288 == Level 2 Heading==
11289 === Level 3 Heading===
11290 ==== Level 4 Heading====
11291 ===== Level 5 Heading=====
11292 ====== Level 6 Heading======
11293 ======= Level 7 Heading=======
11294 ======== Level 8 Heading========
11295 ========= Level 9 Heading=========
11296 ========== Level 10 Heading==========
11297 !! html
11298 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11299 <ul>
11300 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11301 <ul>
11302 <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>
11303 <ul>
11304 <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>
11305 <ul>
11306 <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>
11307 <ul>
11308 <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>
11309 <ul>
11310 <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>
11311 <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>
11312 <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>
11313 <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>
11314 <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>
11315 </ul>
11316 </li>
11317 </ul>
11318 </li>
11319 </ul>
11320 </li>
11321 </ul>
11322 </li>
11323 </ul>
11324 </li>
11325 </ul>
11326 </div>
11327
11328 <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>
11329 <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>
11330 <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>
11331 <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>
11332 <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>
11333 <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>
11334 <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>
11335 <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>
11336 <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>
11337 <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>
11338
11339 !! end
11340
11341 !! test
11342 TOC regression (bug 9764)
11343 !! wikitext
11344 == title 1 ==
11345 === title 1.1 ===
11346 ==== title 1.1.1 ====
11347 === title 1.2 ===
11348 == title 2 ==
11349 === title 2.1 ===
11350 !! html
11351 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11352 <ul>
11353 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11354 <ul>
11355 <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>
11356 <ul>
11357 <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>
11358 </ul>
11359 </li>
11360 <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>
11361 </ul>
11362 </li>
11363 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11364 <ul>
11365 <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>
11366 </ul>
11367 </li>
11368 </ul>
11369 </div>
11370
11371 <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>
11372 <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>
11373 <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>
11374 <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>
11375 <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>
11376 <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>
11377
11378 !! end
11379
11380 !! test
11381 TOC with wgMaxTocLevel=3 (bug 6204)
11382 !! options
11383 wgMaxTocLevel=3
11384 !! wikitext
11385 == title 1 ==
11386 === title 1.1 ===
11387 ==== title 1.1.1 ====
11388 === title 1.2 ===
11389 == title 2 ==
11390 === title 2.1 ===
11391 !! html
11392 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11393 <ul>
11394 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11395 <ul>
11396 <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>
11397 <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>
11398 </ul>
11399 </li>
11400 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11401 <ul>
11402 <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>
11403 </ul>
11404 </li>
11405 </ul>
11406 </div>
11407
11408 <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>
11409 <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>
11410 <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>
11411 <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>
11412 <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>
11413 <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>
11414
11415 !! end
11416
11417 !! test
11418 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11419 !! options
11420 wgMaxTocLevel=3
11421 !! wikitext
11422 ==Section 1==
11423 ===Section 1.1===
11424 ====Section 1.1.1====
11425 ====Section 1.1.1.1====
11426 ==Section 2==
11427 !! html
11428 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11429 <ul>
11430 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11431 <ul>
11432 <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>
11433 </ul>
11434 </li>
11435 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11436 </ul>
11437 </div>
11438
11439 <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>
11440 <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>
11441 <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>
11442 <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>
11443 <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>
11444
11445 !! end
11446
11447
11448 !! test
11449 Resolving duplicate section names
11450 !! wikitext
11451 == Foo bar ==
11452 == Foo bar ==
11453 !! html
11454 <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>
11455 <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>
11456
11457 !! end
11458
11459 !! test
11460 Resolving duplicate section names with differing case (bug 10721)
11461 !! wikitext
11462 == Foo bar ==
11463 == Foo Bar ==
11464 !! html
11465 <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>
11466 <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>
11467
11468 !! end
11469
11470 !! article
11471 Template:sections
11472 !! text
11473 ===Section 1===
11474 ==Section 2==
11475 !! endarticle
11476
11477 !! test
11478 Template with sections, __NOTOC__
11479 !! wikitext
11480 __NOTOC__
11481 ==Section 0==
11482 {{sections}}
11483 ==Section 4==
11484 !! html
11485 <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>
11486 <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>
11487 <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>
11488 <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>
11489
11490 !! end
11491
11492 !! test
11493 __NOEDITSECTION__ keyword
11494 !! wikitext
11495 __NOEDITSECTION__
11496 ==Section 1==
11497 ==Section 2==
11498 !! html
11499 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11500 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11501
11502 !! end
11503
11504 !! test
11505 Link inside a section heading
11506 !! wikitext
11507 ==Section with a [[Main Page|link]] in it==
11508 !! html
11509 <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>
11510
11511 !! end
11512
11513 !! test
11514 TOC regression (bug 12077)
11515 !! wikitext
11516 __TOC__
11517 == title 1 ==
11518 === title 1.1 ===
11519 == title 2 ==
11520 !! html
11521 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11522 <ul>
11523 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11524 <ul>
11525 <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>
11526 </ul>
11527 </li>
11528 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11529 </ul>
11530 </div>
11531
11532 <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>
11533 <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>
11534 <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>
11535
11536 !! end
11537
11538 !! test
11539 BUG 1219 URL next to image (good)
11540 !! wikitext
11541 http://example.com [[Image:foobar.jpg]]
11542 !! html
11543 <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>
11544 </p>
11545 !!end
11546
11547 !! test
11548 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11549 !! wikitext
11550 ===
11551 The line above must have a trailing space!
11552 === <!--
11553 --> <!-- -->
11554 But just in case it doesn't...
11555 !! html
11556 <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>
11557 <p>The line above must have a trailing space!
11558 </p>
11559 <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>
11560 <p>But just in case it doesn't...
11561 </p>
11562 !! end
11563
11564 !! test
11565 Header with special characters (bug 25462)
11566 !! wikitext
11567 The tooltips shall not show entities to the user (ie. be double escaped)
11568
11569 == text > text ==
11570 section 1
11571
11572 == text < text ==
11573 section 2
11574
11575 == text & text ==
11576 section 3
11577
11578 == text ' text ==
11579 section 4
11580
11581 == text " text ==
11582 section 5
11583 !! html
11584 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11585 </p>
11586 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11587 <ul>
11588 <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>
11589 <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>
11590 <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>
11591 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11592 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11593 </ul>
11594 </div>
11595
11596 <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>
11597 <p>section 1
11598 </p>
11599 <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>
11600 <p>section 2
11601 </p>
11602 <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>
11603 <p>section 3
11604 </p>
11605 <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>
11606 <p>section 4
11607 </p>
11608 <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>
11609 <p>section 5
11610 </p>
11611 !! end
11612
11613 !! test
11614 Headers with excess '=' characters
11615 (Are similar tests necessary beyond the 1st level?)
11616 !! wikitext
11617 =foo==
11618 ==foo=
11619 =''italic'' heading==
11620 ==''italic'' heading=
11621 !! html
11622 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11623 <ul>
11624 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11625 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11626 <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>
11627 <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>
11628 </ul>
11629 </div>
11630
11631 <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>
11632 <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>
11633 <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>
11634 <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>
11635
11636 !! end
11637
11638 !! test
11639 HTML headers vs TOC (bug 23393)
11640 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11641 !! wikitext
11642 <h1>Header 1</h1>
11643 == Header 1.1 ==
11644 == Header 1.2 ==
11645
11646 <h1>Header 2
11647 </h1>
11648 == Header 2.1 ==
11649 == Header 2.2 ==
11650 __NOEDITSECTION__
11651 !! html
11652 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11653 <ul>
11654 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11655 <ul>
11656 <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>
11657 <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>
11658 </ul>
11659 </li>
11660 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11661 <ul>
11662 <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>
11663 <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>
11664 </ul>
11665 </li>
11666 </ul>
11667 </div>
11668
11669 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11670 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11671 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11672 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11673 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11674 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11675
11676 !! end
11677
11678 !! test
11679 BUG 1219 URL next to image (broken)
11680 !! wikitext
11681 http://example.com[[Image:foobar.jpg]]
11682 !! html
11683 <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>
11684 </p>
11685 !!end
11686
11687 !! test
11688 Bug 1186 news: in the middle of text
11689 !! wikitext
11690 http://en.wikinews.org/wiki/Wikinews:Workplace
11691 !! html
11692 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11693 </p>
11694 !!end
11695
11696
11697 !! test
11698 Namespaced link must have a title
11699 !! wikitext
11700 [[Project:]]
11701 !! html
11702 <p>[[Project:]]
11703 </p>
11704 !!end
11705
11706 !! test
11707 Namespaced link must have a title (bad fragment version)
11708 !! wikitext
11709 [[Project:#fragment]]
11710 !! html
11711 <p>[[Project:#fragment]]
11712 </p>
11713 !!end
11714
11715
11716 ###
11717 ### HTML tags and HTML attributes
11718 ###
11719
11720 !! test
11721 div with no attributes
11722 !! wikitext
11723 <div>HTML rocks</div>
11724 !! html
11725 <div>HTML rocks</div>
11726
11727 !! end
11728
11729 !! test
11730 div with double-quoted attribute
11731 !! wikitext
11732 <div id="rock">HTML rocks</div>
11733 !! html
11734 <div id="rock">HTML rocks</div>
11735
11736 !! end
11737
11738 !! test
11739 div with single-quoted attribute
11740 !! wikitext
11741 <div id='rock'>HTML rocks</div>
11742 !! html
11743 <div id="rock">HTML rocks</div>
11744
11745 !! end
11746
11747 !! test
11748 div with unquoted 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 illegal double attributes
11758 !! wikitext
11759 <div id="a" id="b">HTML rocks</div>
11760 !! html
11761 <div id="b">HTML rocks</div>
11762
11763 !!end
11764
11765 # FIXME: produce empty string instead of "class" in the PHP parser, following
11766 # the HTML5 spec.
11767 !! test
11768 div with empty attribute value, space before equals
11769 !! options
11770 parsoid
11771 !! wikitext
11772 <div class =>HTML rocks</div>
11773 !! html
11774 <div class="">HTML rocks</div>
11775
11776 !! end
11777
11778 # The PHP parser escapes the opening brace to &#123; for some reason, so
11779 # disabled this test for it.
11780 !! test
11781 div with braces in attribute value
11782 !! options
11783 parsoid
11784 !! wikitext
11785 <div title="{}">Foo</div>
11786 !! html
11787 <div title="{}">Foo</div>
11788 !! end
11789
11790 # This it very inconsistent in the PHP parser: it returns
11791 # class="class" if there is a space between the name and the equal sign (see
11792 # 'div with empty attribute value, space before equals'), but strips the
11793 # attribute completely if the space is missing. We hope that not much content
11794 # depends on this, so are implementing the behavior below in Parsoid for
11795 # consistencies' sake. Disabled for the PHP parser.
11796 # FIXME: fix this behavior in the PHP parser?
11797 !! test
11798 div with empty attribute value, no space before equals
11799 !! options
11800 parsoid
11801 !! wikitext
11802 <div class=>HTML rocks</div>
11803 !! html
11804 <div class="">HTML rocks</div>
11805
11806 !! end
11807
11808 !! test
11809 HTML multiple attributes correction
11810 !! wikitext
11811 <p class="error" class="awesome">Awesome!</p>
11812 !! html
11813 <p class="awesome">Awesome!</p>
11814
11815 !!end
11816
11817 !! test
11818 Table multiple attributes correction
11819 !! wikitext
11820 {|
11821 !+ class="error" class="awesome"| status
11822 |}
11823 !! html
11824 <table>
11825 <tr>
11826 <th class="awesome"> status
11827 </th></tr></table>
11828
11829 !!end
11830
11831 !! test
11832 DIV IN UPPERCASE
11833 !! wikitext
11834 <DIV ID="x">HTML ROCKS</DIV>
11835 !! html
11836 <div id="x">HTML ROCKS</div>
11837
11838 !!end
11839
11840 !! test
11841 Non-ASCII pseudo-tags are rendered as text
11842 !! wikitext
11843 <khyô>
11844 !! html
11845 <p>&lt;khyô&gt;
11846 </p>
11847 !! end
11848
11849 !! test
11850 Pseudo-tag with URL 'name' renders as url link
11851 !! wikitext
11852 <http://example.com/>
11853 !! html
11854 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11855 </p>
11856 !! end
11857
11858 !! test
11859 text with amp in the middle of nowhere
11860 !! wikitext
11861 Remember AT&T?
11862 !! html
11863 <p>Remember AT&amp;T?
11864 </p>
11865 !! end
11866
11867 !! test
11868 text with character entity: eacute
11869 !! wikitext
11870 I always thought &eacute; was a cute letter.
11871 !! html
11872 <p>I always thought &#233; was a cute letter.
11873 </p>
11874 !! end
11875
11876 !! test
11877 text with entity-escaped character entity-like string: eacute
11878 !! wikitext
11879 I always thought &amp;eacute; was a cute letter.
11880 !! html
11881 <p>I always thought &amp;eacute; was a cute letter.
11882 </p>
11883 !! end
11884
11885 !! test
11886 text with undefined character entity: xacute
11887 !! wikitext
11888 I always thought &xacute; was a cute letter.
11889 !! html
11890 <p>I always thought &amp;xacute; was a cute letter.
11891 </p>
11892 !! end
11893
11894 # TODO: generalize to PHP parser?
11895 !! test
11896 HTML5 tags
11897 !! options
11898 parsoid
11899 !! wikitext
11900 <data value="5">five</data>
11901 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11902 <mark>This highlighted text</mark>
11903 !! html
11904 <p><data value="5">five</data>
11905 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11906 <mark>This highlighted text</mark></p>
11907 !! end
11908
11909 !! test
11910 HTML tag with leading space is parsed as text
11911 !! wikitext
11912 < div>foo< /div>
11913 !! html
11914 <p>&lt; div&gt;foo&lt; /div&gt;
11915 </p>
11916 !! end
11917
11918 ###
11919 ### Nesting tests (see bug 41545, 50604, 51081)
11920 ###
11921
11922 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11923 # Note that html2wt is considerably more difficult if we use <b> in
11924 # the test case, instead of <big>
11925 !! test
11926 Ensure that HTML adoption agency algorithm is properly implemented.
11927 !! wikitext
11928 <big>X<big>Y</big>Z</big>
11929 !! html
11930 <p><big>X<big>Y</big>Z</big>
11931 </p>
11932 !! end
11933
11934 # This was bug 41545 in the PHP parser.
11935 !! test
11936 Nesting of <kbd>
11937 !! wikitext
11938 <kbd>X<kbd>Y</kbd>Z</kbd>
11939 !! html
11940 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11941 </p>
11942 !! end
11943
11944 # The following cases were bug 51081 in the PHP parser.
11945 # Note that there are some other nestable tags (b, i, etc) which are
11946 # not covered; see bug 51081 for discussion.
11947 !! test
11948 Nesting of <em>
11949 !! wikitext
11950 <em>X<em>Y</em>Z</em>
11951 !! html
11952 <p><em>X<em>Y</em>Z</em>
11953 </p>
11954 !! end
11955
11956 !! test
11957 Nesting of <strong>
11958 !! wikitext
11959 <strong>X<strong>Y</strong>Z</strong>
11960 !! html
11961 <p><strong>X<strong>Y</strong>Z</strong>
11962 </p>
11963 !! end
11964
11965 !! test
11966 Nesting of <q>
11967 !! wikitext
11968 <q>X<q>Y</q>Z</q>
11969 !! html
11970 <p><q>X<q>Y</q>Z</q>
11971 </p>
11972 !! end
11973
11974 !! test
11975 Nesting of <ruby>
11976 !! wikitext
11977 <ruby>X<ruby>Y</ruby>Z</ruby>
11978 !! html
11979 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11980 </p>
11981 !! end
11982
11983 !! test
11984 Nesting of <bdo>
11985 !! wikitext
11986 <bdo>X<bdo>Y</bdo>Z</bdo>
11987 !! html
11988 <p><bdo>X<bdo>Y</bdo>Z</bdo>
11989 </p>
11990 !! end
11991
11992
11993 ###
11994 ### Media links
11995 ###
11996
11997 !! test
11998 Media link
11999 !! wikitext
12000 [[Media:Foobar.jpg]]
12001 !! html
12002 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12003 </p>
12004 !! end
12005
12006 !! test
12007 Media link with text
12008 !! wikitext
12009 [[Media:Foobar.jpg|A neat file to look at]]
12010 !! html
12011 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12012 </p>
12013 !! end
12014
12015 # FIXME: this is still bad HTML tag nesting
12016 !! test
12017 Media link with nasty text
12018 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12019 !! wikitext
12020 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12021 !! html
12022 <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>
12023
12024 !! end
12025
12026 !! test
12027 Media link to nonexistent file (bug 1702)
12028 !! wikitext
12029 [[Media:No such.jpg]]
12030 !! html
12031 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12032 </p>
12033 !! end
12034
12035 !! test
12036 Image link to nonexistent file (bug 1850 - good)
12037 !! wikitext
12038 [[Image:No such.jpg]]
12039 !! html
12040 <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>
12041 </p>
12042 !! end
12043
12044 !! test
12045 :Image link to nonexistent file (bug 1850 - bad)
12046 !! wikitext
12047 [[:Image:No such.jpg]]
12048 !! html
12049 <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>
12050 </p>
12051 !! end
12052
12053
12054
12055 !! test
12056 Character reference normalization in link text (bug 1938)
12057 !! wikitext
12058 [[Main Page|this&that]]
12059 !! html
12060 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12061 </p>
12062 !!end
12063
12064 !! article
12065 אַ
12066 !! text
12067 Test for unicode normalization
12068
12069 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12070 !! endarticle
12071
12072 !! test
12073 (bug 19451) Links should refer to the normalized form.
12074 !! wikitext
12075 [[&#xFB2E;]]
12076 [[&#x5d0;&#x5b7;]]
12077 [[&#x5d0;ַ]]
12078 [[א&#x5b7;]]
12079 [[אַ]]
12080 !! html
12081 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12082 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12083 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12084 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12085 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12086 </p>
12087 !! end
12088
12089 !! test
12090 Empty attribute crash test (bug 2067)
12091 !! wikitext
12092 <font color="">foo</font>
12093 !! html
12094 <p><font color="">foo</font>
12095 </p>
12096 !! end
12097
12098 !! test
12099 Empty attribute crash test single-quotes (bug 2067)
12100 !! wikitext
12101 <font color=''>foo</font>
12102 !! html
12103 <p><font color="">foo</font>
12104 </p>
12105 !! end
12106
12107 !! test
12108 Attribute test: equals, then nothing
12109 !! wikitext
12110 <font color=>foo</font>
12111 !! html
12112 <p><font>foo</font>
12113 </p>
12114 !! end
12115
12116 !! test
12117 Attribute test: unquoted value
12118 !! wikitext
12119 <font color=x>foo</font>
12120 !! html
12121 <p><font color="x">foo</font>
12122 </p>
12123 !! end
12124
12125 !! test
12126 Attribute test: unquoted but illegal value (hash)
12127 !! wikitext
12128 <font color=#x>foo</font>
12129 !! html
12130 <p><font color="#x">foo</font>
12131 </p>
12132 !! end
12133
12134 !! test
12135 Attribute test: no value
12136 !! wikitext
12137 <font color>foo</font>
12138 !! html
12139 <p><font color="color">foo</font>
12140 </p>
12141 !! end
12142
12143 !! test
12144 Bug 2095: link with three closing brackets
12145 !! wikitext
12146 [[Main Page]]]
12147 !! html
12148 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12149 </p>
12150 !! end
12151
12152 !! test
12153 Bug 2095: link with pipe and three closing brackets
12154 !! wikitext
12155 [[Main Page|link]]]
12156 !! html
12157 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12158 </p>
12159 !! end
12160
12161 !! test
12162 Bug 2095: link with pipe and three closing brackets, version 2
12163 !! wikitext
12164 [[Main Page|[http://example.com/]]]
12165 !! html
12166 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12167 </p>
12168 !! end
12169
12170
12171 ###
12172 ### Safety
12173 ###
12174
12175 !! article
12176 Template:Dangerous attribute
12177 !! text
12178 " onmouseover="alert(document.cookie)
12179 !! endarticle
12180
12181 !! article
12182 Template:Dangerous style attribute
12183 !! text
12184 border-size: expression(alert(document.cookie))
12185 !! endarticle
12186
12187 !! article
12188 Template:Div style
12189 !! text
12190 <div style="float: right; {{{1}}}">Magic div</div>
12191 !! endarticle
12192
12193 !! test
12194 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12195 !! wikitext
12196 <div title="{{test}}"></div>
12197 !! html
12198 <div title="This is a test template"></div>
12199
12200 !! end
12201
12202 !! test
12203 Bug 2304: HTML attribute safety (dangerous template; 2309)
12204 !! wikitext
12205 <div title="{{dangerous attribute}}"></div>
12206 !! html
12207 <div title=""></div>
12208
12209 !! end
12210
12211 !! test
12212 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12213 !! wikitext
12214 <div style="{{dangerous style attribute}}"></div>
12215 !! html
12216 <div style="/* insecure input */"></div>
12217
12218 !! end
12219
12220 !! test
12221 Bug 2304: HTML attribute safety (safe parameter; 2309)
12222 !! wikitext
12223 {{div style|width: 200px}}
12224 !! html
12225 <div style="float: right; width: 200px">Magic div</div>
12226
12227 !! end
12228
12229 !! test
12230 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12231 !! wikitext
12232 {{div style|width: expression(alert(document.cookie))}}
12233 !! html
12234 <div style="/* insecure input */">Magic div</div>
12235
12236 !! end
12237
12238 !! test
12239 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12240 !! wikitext
12241 {{div style|"><script>alert(document.cookie)</script>}}
12242 !! html
12243 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12244
12245 !! end
12246
12247 !! test
12248 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12249 !! wikitext
12250 {{div style|" ><script>alert(document.cookie)</script>}}
12251 !! html
12252 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12253
12254 !! end
12255
12256 !! test
12257 Bug 2304: HTML attribute safety (link)
12258 !! wikitext
12259 <div title="[[Main Page]]"></div>
12260 !! html
12261 <div title="&#91;&#91;Main Page]]"></div>
12262
12263 !! end
12264
12265 !! test
12266 Bug 2304: HTML attribute safety (italics)
12267 !! wikitext
12268 <div title="''foobar''"></div>
12269 !! html
12270 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12271
12272 !! end
12273
12274 !! test
12275 Bug 2304: HTML attribute safety (bold)
12276 !! wikitext
12277 <div title="'''foobar'''"></div>
12278 !! html
12279 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12280
12281 !! end
12282
12283
12284 !! test
12285 Bug 2304: HTML attribute safety (ISBN)
12286 !! wikitext
12287 <div title="ISBN 1234567890"></div>
12288 !! html
12289 <div title="&#73;SBN 1234567890"></div>
12290
12291 !! end
12292
12293 !! test
12294 Bug 2304: HTML attribute safety (RFC)
12295 !! wikitext
12296 <div title="RFC 1234"></div>
12297 !! html
12298 <div title="&#82;FC 1234"></div>
12299
12300 !! end
12301
12302 !! test
12303 Bug 2304: HTML attribute safety (PMID)
12304 !! wikitext
12305 <div title="PMID 1234567890"></div>
12306 !! html
12307 <div title="&#80;MID 1234567890"></div>
12308
12309 !! end
12310
12311 !! test
12312 Bug 2304: HTML attribute safety (web link)
12313 !! wikitext
12314 <div title="http://example.com/"></div>
12315 !! html
12316 <div title="http&#58;//example.com/"></div>
12317
12318 !! end
12319
12320 !! test
12321 Bug 2304: HTML attribute safety (named web link)
12322 !! wikitext
12323 <div title="[http://example.com/ link]"></div>
12324 !! html
12325 <div title="&#91;http&#58;//example.com/ link]"></div>
12326
12327 !! end
12328
12329 !! test
12330 Bug 3244: HTML attribute safety (extension; safe)
12331 !! wikitext
12332 <div style="<nowiki>background:blue</nowiki>"></div>
12333 !! html
12334 <div style="background:blue"></div>
12335
12336 !! end
12337
12338 !! test
12339 Bug 3244: HTML attribute safety (extension; unsafe)
12340 !! wikitext
12341 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12342 !! html
12343 <div style="/* insecure input */"></div>
12344
12345 !! end
12346
12347 # More MSIE fun discovered by Tom Gilder
12348
12349 !! test
12350 MSIE CSS safety test: spurious slash
12351 !! wikitext
12352 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12353 !! html
12354 <div style="/* insecure input */">evil</div>
12355
12356 !! end
12357
12358 !! test
12359 MSIE CSS safety test: hex code
12360 !! wikitext
12361 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12362 !! html
12363 <div style="/* insecure input */">evil</div>
12364
12365 !! end
12366
12367 !! test
12368 MSIE CSS safety test: comment in url
12369 !! wikitext
12370 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12371 !! html
12372 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12373
12374 !! end
12375
12376 !! test
12377 MSIE CSS safety test: comment in expression
12378 !! wikitext
12379 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12380 !! html
12381 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12382
12383 !! end
12384
12385 !! test
12386 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12387 !! wikitext
12388 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12389 !! html
12390 <p style="/* invalid control char */">A</p>
12391
12392 !! end
12393
12394 !! test
12395 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12396 !! wikitext
12397 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12398 <div style="top:EXPRESSION(alert())">B</div>
12399 !! html
12400 <p style="/* insecure input */">A</p>
12401 <div style="/* insecure input */">B</div>
12402
12403 !! end
12404
12405 !! test
12406 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12407 !! wikitext
12408 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12409 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12410 !! html
12411 <div style="/* insecure input */">A</div>
12412 <p style="/* insecure input */">B</p>
12413
12414 !! end
12415
12416 !! test
12417 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12418 !! wikitext
12419 <div style="background-image:url⁽javascript:alert())">A</div>
12420 <div style="background-image:url₍javascript:alert())">B</div>
12421 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12422 !! html
12423 <div style="/* insecure input */">A</div>
12424 <div style="/* insecure input */">B</div>
12425 <p style="/* insecure input */">C</p>
12426
12427 !! end
12428
12429 !! test
12430 Opera -o-link CSS
12431 !! wikitext
12432 <div
12433 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;"
12434 style="-o-link:attr(title);-o-link-source:current">X</div>
12435 !! html
12436 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12437
12438 !! end
12439
12440 !! test
12441 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12442 !! wikitext
12443 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12444 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12445 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12446 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12447 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12448 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12449 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12450 !! html
12451 <p style="/* insecure input */">A</p>
12452 <p style="/* insecure input */">B</p>
12453 <p style="/* insecure input */">C</p>
12454 <p style="/* insecure input */">D</p>
12455 <p style="/* insecure input */">E</p>
12456 <p style="/* insecure input */">F</p>
12457 <p style="/* insecure input */">G</p>
12458
12459 !! end
12460
12461 !! test
12462 Table attribute legitimate extension
12463 !! wikitext
12464 {|
12465 !+ style="<nowiki>color:blue</nowiki>"| status
12466 |}
12467 !! html
12468 <table>
12469 <tr>
12470 <th style="color:blue"> status
12471 </th></tr></table>
12472
12473 !!end
12474
12475 !! test
12476 Table attribute safety
12477 !! wikitext
12478 {|
12479 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12480 |}
12481 !! html
12482 <table>
12483 <tr>
12484 <th style="/* insecure input */"> status
12485 </th></tr></table>
12486
12487 !! end
12488
12489 !! test
12490 CSS line continuation 1
12491 !! wikitext
12492 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12493 !! html
12494 <div style="/* insecure input */"></div>
12495
12496 !! end
12497
12498 !! test
12499 CSS line continuation 2
12500 !! wikitext
12501 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12502 !! html
12503 <div style="/* insecure input */"></div>
12504
12505 !! end
12506
12507 !! article
12508 Template:Identity
12509 !! text
12510 {{{1}}}
12511 !! endarticle
12512
12513 !! test
12514 Expansion of multi-line templates in attribute values (bug 6255)
12515 !! wikitext
12516 <div style="background: {{identity|#00FF00}}">-</div>
12517 !! html
12518 <div style="background: #00FF00">-</div>
12519
12520 !! end
12521
12522
12523 !! test
12524 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12525 !! wikitext
12526 <div style="background:
12527 #00FF00">-</div>
12528 !! html
12529 <div style="background: #00FF00">-</div>
12530
12531 !! end
12532
12533 !! test
12534 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12535 !! wikitext
12536 <div style="background: &#10;#00FF00">-</div>
12537 !! html
12538 <div style="background: &#10;#00FF00">-</div>
12539
12540 !! end
12541
12542 ###
12543 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12544 ###
12545 !! test
12546 Parser hook: empty input
12547 !! wikitext
12548 <tag></tag>
12549 !! html
12550 <pre>
12551 ''
12552 array (
12553 )
12554 </pre>
12555
12556 !! end
12557
12558 !! test
12559 Parser hook: empty input using terminated empty elements
12560 !! wikitext
12561 <tag/>
12562 !! html
12563 <pre>
12564 NULL
12565 array (
12566 )
12567 </pre>
12568
12569 !! end
12570
12571 !! test
12572 Parser hook: empty input using terminated empty elements (space before)
12573 !! wikitext
12574 <tag />
12575 !! html
12576 <pre>
12577 NULL
12578 array (
12579 )
12580 </pre>
12581
12582 !! end
12583
12584 !! test
12585 Parser hook: basic input
12586 !! wikitext
12587 <tag>input</tag>
12588 !! html
12589 <pre>
12590 'input'
12591 array (
12592 )
12593 </pre>
12594
12595 !! end
12596
12597
12598 !! test
12599 Parser hook: case insensitive
12600 !! wikitext
12601 <TAG>input</TAG>
12602 !! html
12603 <pre>
12604 'input'
12605 array (
12606 )
12607 </pre>
12608
12609 !! end
12610
12611
12612 !! test
12613 Parser hook: case insensitive, redux
12614 !! wikitext
12615 <TaG>input</TAg>
12616 !! html
12617 <pre>
12618 'input'
12619 array (
12620 )
12621 </pre>
12622
12623 !! end
12624
12625 !! test
12626 Parser hook: nested tags
12627 !! options
12628 noxml
12629 !! wikitext
12630 <tag><tag></tag></tag>
12631 !! html
12632 <pre>
12633 '<tag>'
12634 array (
12635 )
12636 </pre>&lt;/tag&gt;
12637
12638 !! end
12639
12640 !! test
12641 Parser hook: basic arguments
12642 !! wikitext
12643 <tag width=200 height = "100" depth = '50' square></tag>
12644 !! html
12645 <pre>
12646 ''
12647 array (
12648 'width' => '200',
12649 'height' => '100',
12650 'depth' => '50',
12651 'square' => 'square',
12652 )
12653 </pre>
12654
12655 !! end
12656
12657 !! test
12658 Parser hook: argument containing a forward slash (bug 5344)
12659 !! wikitext
12660 <tag filename='/tmp/bla'></tag>
12661 !! html
12662 <pre>
12663 ''
12664 array (
12665 'filename' => '/tmp/bla',
12666 )
12667 </pre>
12668
12669 !! end
12670
12671 !! test
12672 Parser hook: empty input using terminated empty elements (bug 2374)
12673 !! wikitext
12674 <tag foo=bar/>text
12675 !! html
12676 <pre>
12677 NULL
12678 array (
12679 'foo' => 'bar',
12680 )
12681 </pre>text
12682
12683 !! end
12684
12685 # </tag> should be output literally since there is no matching tag that begins it
12686 !! test
12687 Parser hook: basic arguments using terminated empty elements (bug 2374)
12688 !! wikitext
12689 <tag width=200 height = "100" depth = '50' square/>
12690 other stuff
12691 </tag>
12692 !! html
12693 <pre>
12694 NULL
12695 array (
12696 'width' => '200',
12697 'height' => '100',
12698 'depth' => '50',
12699 'square' => 'square',
12700 )
12701 </pre>
12702 <p>other stuff
12703 &lt;/tag&gt;
12704 </p>
12705 !! end
12706
12707 ###
12708 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12709 ###
12710
12711 !! test
12712 Parser hook: static parser hook not inside a comment
12713 !! wikitext
12714 <statictag>hello, world</statictag>
12715 <statictag action=flush/>
12716 !! html
12717 <p>hello, world
12718 </p>
12719 !! end
12720
12721
12722 !! test
12723 Parser hook: static parser hook inside a comment
12724 !! wikitext
12725 <!-- <statictag>hello, world</statictag> -->
12726 <statictag action=flush/>
12727 !! html
12728 <p><br />
12729 </p>
12730 !! end
12731
12732 # Nested template calls; this case was broken by Parser.php rev 1.506,
12733 # since reverted.
12734
12735 !! article
12736 Template:One-parameter
12737 !! text
12738 (My parameter is: {{{1}}})
12739 !! endarticle
12740
12741 !! article
12742 Template:Map-one-parameter
12743 !! text
12744 {{{{{1}}}|{{{2}}}}}
12745 !! endarticle
12746
12747 !! test
12748 Nested template calls
12749 !! wikitext
12750 {{Map-one-parameter|One-parameter|param}}
12751 !! html
12752 <p>(My parameter is: param)
12753 </p>
12754 !! end
12755
12756
12757 ###
12758 ### Sanitizer
12759 ###
12760 !! test
12761 Sanitizer: Closing of open tags
12762 !! wikitext
12763 <s></s><table></table>
12764 !! html
12765 <s></s><table></table>
12766
12767 !! end
12768
12769 !! test
12770 Sanitizer: Closing of open but not closed tags
12771 !! wikitext
12772 <s>foo
12773 !! html
12774 <p><s>foo</s>
12775 </p>
12776 !! end
12777
12778 !! test
12779 Sanitizer: Closing of closed but not open tags
12780 !! wikitext
12781 </s>
12782 !! html
12783 <p>&lt;/s&gt;
12784 </p>
12785 !! end
12786
12787 !! test
12788 Sanitizer: Closing of closed but not open table tags
12789 !! wikitext
12790 Table not started</td></tr></table>
12791 !! html
12792 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12793 </p>
12794 !! end
12795
12796 !! test
12797 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12798 !! wikitext
12799 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12800 !! html
12801 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12802 </p>
12803 !! end
12804
12805 !! test
12806 Sanitizer: Validating the contents of the id attribute (bug 4515)
12807 !! options
12808 disabled
12809 !! wikitext
12810 <br id=9 />
12811 !! html
12812 Something, but definitely not <br id="9" />...
12813 !! end
12814
12815 !! test
12816 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12817 !! options
12818 disabled
12819 !! wikitext
12820 <br id="foo" /><br id="foo" />
12821 !! html
12822 Something need to be done. foo-2 ?
12823 !! end
12824
12825 !! test
12826 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12827 !! wikitext
12828 <div itemscope>
12829 <meta itemprop="hello" content="world">
12830 <meta http-equiv="refresh" content="5">
12831 <meta itemprop="hello" http-equiv="refresh" content="5">
12832 <link itemprop="hello" href="{{SERVER}}">
12833 <link rel="stylesheet" href="{{SERVER}}">
12834 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12835 </div>
12836 !! html
12837 <div itemscope="itemscope">
12838 <p> <meta itemprop="hello" content="world" />
12839 &lt;meta http-equiv="refresh" content="5"&gt;
12840 <meta itemprop="hello" content="5" />
12841 </p>
12842 <link itemprop="hello" href="http&#58;//example.org" />
12843 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12844 <link itemprop="hello" href="http&#58;//example.org" />
12845 </div>
12846
12847 !! end
12848
12849 !! test
12850 Language converter: output gets cut off unexpectedly (bug 5757)
12851 !! options
12852 language=zh
12853 !! wikitext
12854 this bit is safe: }-
12855
12856 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12857
12858 then we get cut off here: }-
12859
12860 all additional text is vanished
12861 !! html
12862 <p>this bit is safe: }-
12863 </p><p>but if we add a conversion instance: xxx
12864 </p><p>then we get cut off here: }-
12865 </p><p>all additional text is vanished
12866 </p>
12867 !! end
12868
12869 !! test
12870 Self closed html pairs (bug 5487)
12871 !! options
12872 !! wikitext
12873 <center><font id="bug" />Centered text</center>
12874 <div><font id="bug2" />In div text</div>
12875 !! html
12876 <center>&lt;font id="bug" /&gt;Centered text</center>
12877 <div>&lt;font id="bug2" /&gt;In div text</div>
12878
12879 !! end
12880
12881 #
12882 #
12883 #
12884
12885 !! test
12886 Punctuation: nbsp before exclamation
12887 !! wikitext
12888 C'est grave !
12889 !! html
12890 <p>C'est grave&#160;!
12891 </p>
12892 !! end
12893
12894 !! test
12895 Punctuation: CSS !important (bug 11874)
12896 !! wikitext
12897 <div style="width:50% !important">important</div>
12898 !! html
12899 <div style="width:50% !important">important</div>
12900
12901 !!end
12902
12903 !! test
12904 Punctuation: CSS ! important (bug 11874; with space after)
12905 !! wikitext
12906 <div style="width:50% ! important">important</div>
12907 !! html
12908 <div style="width:50% ! important">important</div>
12909
12910 !!end
12911
12912
12913 !! test
12914 HTML bullet list, closed tags (bug 5497)
12915 !! wikitext
12916 <ul>
12917 <li>One</li>
12918 <li>Two</li>
12919 </ul>
12920 !! html
12921 <ul>
12922 <li>One</li>
12923 <li>Two</li>
12924 </ul>
12925
12926 !! end
12927
12928 !! test
12929 HTML bullet list, unclosed tags (bug 5497)
12930 !! options
12931 disabled
12932 !! wikitext
12933 <ul>
12934 <li>One
12935 <li>Two
12936 </ul>
12937 !! html
12938 <ul>
12939 <li>One
12940 </li>
12941 <li>Two
12942 </li>
12943 </ul>
12944
12945 !! end
12946
12947 !! test
12948 HTML ordered list, closed tags (bug 5497)
12949 !! wikitext
12950 <ol>
12951 <li>One</li>
12952 <li>Two</li>
12953 </ol>
12954 !! html
12955 <ol>
12956 <li>One</li>
12957 <li>Two</li>
12958 </ol>
12959
12960 !! end
12961
12962 !! test
12963 HTML ordered list, unclosed tags (bug 5497)
12964 !! options
12965 disabled
12966 !! wikitext
12967 <ol>
12968 <li>One
12969 <li>Two
12970 </ol>
12971 !! html
12972 <ol>
12973 <li>One
12974 </li>
12975 <li>Two
12976 </li>
12977 </ol>
12978
12979 !! end
12980
12981 !! test
12982 HTML nested bullet list, closed tags (bug 5497)
12983 !! wikitext
12984 <ul>
12985 <li>One</li>
12986 <li>Two:
12987 <ul>
12988 <li>Sub-one</li>
12989 <li>Sub-two</li>
12990 </ul>
12991 </li>
12992 </ul>
12993 !! html
12994 <ul>
12995 <li>One</li>
12996 <li>Two:
12997 <ul>
12998 <li>Sub-one</li>
12999 <li>Sub-two</li>
13000 </ul>
13001 </li>
13002 </ul>
13003
13004 !! end
13005
13006 !! test
13007 HTML nested bullet list, open tags (bug 5497)
13008 !! options
13009 disabled
13010 !! wikitext
13011 <ul>
13012 <li>One
13013 <li>Two:
13014 <ul>
13015 <li>Sub-one
13016 <li>Sub-two
13017 </ul>
13018 </ul>
13019 !! html
13020 <ul>
13021 <li>One
13022 </li>
13023 <li>Two:
13024 <ul>
13025 <li>Sub-one
13026 </li>
13027 <li>Sub-two
13028 </li>
13029 </ul>
13030 </li>
13031 </ul>
13032
13033 !! end
13034
13035 !! test
13036 HTML nested ordered list, closed tags (bug 5497)
13037 !! wikitext
13038 <ol>
13039 <li>One</li>
13040 <li>Two:
13041 <ol>
13042 <li>Sub-one</li>
13043 <li>Sub-two</li>
13044 </ol>
13045 </li>
13046 </ol>
13047 !! html
13048 <ol>
13049 <li>One</li>
13050 <li>Two:
13051 <ol>
13052 <li>Sub-one</li>
13053 <li>Sub-two</li>
13054 </ol>
13055 </li>
13056 </ol>
13057
13058 !! end
13059
13060 !! test
13061 HTML nested ordered list, open tags (bug 5497)
13062 !! options
13063 disabled
13064 !! wikitext
13065 <ol>
13066 <li>One
13067 <li>Two:
13068 <ol>
13069 <li>Sub-one
13070 <li>Sub-two
13071 </ol>
13072 </ol>
13073 !! html
13074 <ol>
13075 <li>One
13076 </li>
13077 <li>Two:
13078 <ol>
13079 <li>Sub-one
13080 </li>
13081 <li>Sub-two
13082 </li>
13083 </ol>
13084 </li>
13085 </ol>
13086
13087 !! end
13088
13089 !! test
13090 HTML ordered list item with parameters oddity
13091 !! wikitext
13092 <ol><li id="fragment">One</li>
13093 </ol>
13094 !! html
13095 <ol><li id="fragment">One</li>
13096 </ol>
13097
13098 !! end
13099
13100 !!test
13101 bug 5918: autonumbering
13102 !! wikitext
13103 [http://first/] [http://second] [ftp://ftp]
13104
13105 ftp://inlineftp
13106
13107 [mailto:enclosed@mail.tld With target]
13108
13109 [mailto:enclosed@mail.tld]
13110
13111 mailto:inline@mail.tld
13112 !! html
13113 <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>
13114 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13115 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13116 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13117 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13118 </p>
13119 !! end
13120
13121
13122 #
13123 # Security and HTML correctness
13124 # From Nick Jenkins' fuzz testing
13125 #
13126
13127 !! test
13128 Fuzz testing: Parser13
13129 !! wikitext
13130 {|
13131 | http://a|
13132 !! html
13133 <table>
13134 <tr>
13135 <td>
13136 </td>
13137 </tr>
13138 </table>
13139
13140 !! end
13141
13142 !! test
13143 Fuzz testing: Parser14
13144 !! wikitext
13145 == onmouseover= ==
13146 http://__TOC__
13147 !! html
13148 <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>
13149 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13150 <ul>
13151 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13152 </ul>
13153 </div>
13154
13155
13156 !! end
13157
13158 !! test
13159 Fuzz testing: Parser14-table
13160 !! wikitext
13161 ==a==
13162 {| STYLE=__TOC__
13163 !! html
13164 <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>
13165 <table style="&#95;_TOC&#95;_">
13166 <tr><td></td></tr>
13167 </table>
13168
13169 !! end
13170
13171 # Known to produce bogus xml (extra </td>)
13172 !! test
13173 Fuzz testing: Parser16
13174 !! options
13175 noxml
13176 !! wikitext
13177 {|
13178 !https://||||||
13179 !! html
13180 <table>
13181 <tr>
13182 <th>https://</th>
13183 <th></th>
13184 <th></th>
13185 <th>
13186 </td>
13187 </tr>
13188 </table>
13189
13190 !! end
13191
13192 !! test
13193 Fuzz testing: Parser21
13194 !! wikitext
13195 {|
13196 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13197 |
13198 !! html
13199 <table>
13200 <tr>
13201 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13202 </th>
13203 <td>
13204 </td>
13205 </tr>
13206 </table>
13207
13208 !! end
13209
13210 !! test
13211 Fuzz testing: Parser22
13212 !! wikitext
13213 http://===r:::https://b
13214
13215 {|
13216 !! html
13217 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13218 </p>
13219 <table>
13220 <tr><td></td></tr>
13221 </table>
13222
13223 !! end
13224
13225 # Known to produce bad XML for now
13226 !! test
13227 Fuzz testing: Parser24
13228 !! options
13229 noxml
13230 !! wikitext
13231 {|
13232 {{{|
13233 <u CLASS=
13234 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13235 <br style="onmouseover='alert(document.cookie);' " />
13236
13237 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13238 |
13239 !! html
13240 <table>
13241 {{{|
13242 <u class="&#124;">}}}} &gt;
13243 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13244
13245 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13246 <tr>
13247 <td></u>
13248 </td>
13249 </tr>
13250 </table>
13251
13252 !! end
13253
13254 # Note: the current result listed for this is not what the original one was,
13255 # but the original bug was JavaScript injection, which is fixed in any case.
13256 # It's not clear that the original result listed was any more correct than the
13257 # current one. Original result:
13258 # <p>{{{|
13259 # </p>
13260 # <li class="&#124;&#124;">
13261 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13262 !!test
13263 Fuzz testing: Parser25 (bug 6055)
13264 !! wikitext
13265 {{{
13266 |
13267 <LI CLASS=||
13268 >
13269 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13270 !! html
13271 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13272 </p>
13273 !! end
13274
13275 !!test
13276 Fuzz testing: URL adjacent extension (with space, clean)
13277 !! options
13278 !! wikitext
13279 http://example.com <nowiki>junk</nowiki>
13280 !! html
13281 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13282 </p>
13283 !!end
13284
13285 !!test
13286 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13287 !! options
13288 !! wikitext
13289 http://example.com<nowiki>junk</nowiki>
13290 !! html
13291 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13292 </p>
13293 !!end
13294
13295 !!test
13296 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13297 !! options
13298 !! wikitext
13299 http://example.com<pre>junk</pre>
13300 !! html
13301 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13302
13303 !!end
13304
13305 !!test
13306 Fuzz testing: image with bogus manual thumbnail
13307 !! wikitext
13308 [[Image:foobar.jpg|thumbnail= ]]
13309 !! html/php
13310 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13311
13312 !! html/parsoid
13313 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13314 !!end
13315
13316 !! test
13317 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13318 !! wikitext
13319 <pre dir="&#10;"></pre>
13320 !! html
13321 <pre dir="&#10;"></pre>
13322
13323 !! end
13324
13325 !! test
13326 Parsing optional HTML elements (Bug 6171)
13327 !! options
13328 !! wikitext
13329 <table>
13330 <tr>
13331 <td> Some tabular data</td>
13332 <td> More tabular data ...
13333 <td> And yet som tabular data</td>
13334 </tr>
13335 </table>
13336 !! html
13337 <table>
13338 <tr>
13339 <td> Some tabular data</td>
13340 <td> More tabular data ...
13341 </td><td> And yet som tabular data</td>
13342 </tr>
13343 </table>
13344
13345 !! end
13346
13347 !! test
13348 Correct handling of <td>, <tr> (Bug 6171)
13349 !! options
13350 !! wikitext
13351 <table>
13352 <tr>
13353 <td> Some tabular data</td>
13354 <td> More tabular data ...</td>
13355 <td> And yet som tabular data</td>
13356 </tr>
13357 </table>
13358 !! html
13359 <table>
13360 <tr>
13361 <td> Some tabular data</td>
13362 <td> More tabular data ...</td>
13363 <td> And yet som tabular data</td>
13364 </tr>
13365 </table>
13366
13367 !! end
13368
13369
13370 !! test
13371 Parsing crashing regression (fr:JavaScript)
13372 !! wikitext
13373 </body></x>
13374 !! html
13375 <p>&lt;/body&gt;&lt;/x&gt;
13376 </p>
13377 !! end
13378
13379 !! test
13380 Inline wiki vs wiki block nesting
13381 !! wikitext
13382 '''Bold paragraph
13383
13384 New wiki paragraph
13385 !! html
13386 <p><b>Bold paragraph</b>
13387 </p><p>New wiki paragraph
13388 </p>
13389 !! end
13390
13391 !! test
13392 Inline HTML vs wiki block nesting
13393 !! options
13394 disabled
13395 !! wikitext
13396 <b>Bold paragraph
13397
13398 New wiki paragraph
13399 !! html
13400 <p><b>Bold paragraph</b>
13401 </p><p>New wiki paragraph
13402 </p>
13403 !! end
13404
13405 # Original result was this:
13406 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13407 # </p>
13408 # While that might be marginally more intuitive, maybe, the six-apostrophe
13409 # construct is clearly pathological and the result stated here (which is what
13410 # the parser actually does) is about as reasonable as anything.
13411 !!test
13412 Mixing markup for italics and bold
13413 !! options
13414 !! wikitext
13415 '''bold''''''bold''bolditalics'''''
13416 !! html
13417 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13418 </p>
13419 !! end
13420
13421
13422 !! article
13423 Xyzzyx
13424 !! text
13425 Article for special page transclusion test
13426 !! endarticle
13427
13428 !! test
13429 Special page transclusion
13430 !! options
13431 !! wikitext
13432 {{Special:Prefixindex/Xyzzyx}}
13433 !! html
13434 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13435
13436 !! end
13437
13438 !! test
13439 Special page transclusion twice (bug 5021)
13440 !! options
13441 !! wikitext
13442 {{Special:Prefixindex/Xyzzyx}}
13443 {{Special:Prefixindex/Xyzzyx}}
13444 !! html
13445 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13446 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13447
13448 !! end
13449
13450 !! test
13451 Transclusion of default MediaWiki message
13452 !! wikitext
13453 {{MediaWiki:Mainpage}}
13454 !! html
13455 <p>Main Page
13456 </p>
13457 !! end
13458
13459 !! test
13460 Transclusion of nonexistent MediaWiki message
13461 !! wikitext
13462 {{MediaWiki:Mainpagexxx}}
13463 !! html
13464 <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>
13465 </p>
13466 !! end
13467
13468 !! test
13469 Transclusion of MediaWiki message with underscore
13470 !! wikitext
13471 {{MediaWiki:history_short}}
13472 !! html
13473 <p>History
13474 </p>
13475 !! end
13476
13477 !! test
13478 Transclusion of MediaWiki message with space
13479 !! wikitext
13480 {{MediaWiki:history short}}
13481 !! html
13482 <p>History
13483 </p>
13484 !! end
13485
13486 !! test
13487 Invalid header with following text
13488 !! wikitext
13489 = x = y
13490 !! html
13491 <p>= x = y
13492 </p>
13493 !! end
13494
13495
13496 !! test
13497 Section extraction test (section 0)
13498 !! options
13499 section=0
13500 !! wikitext
13501 start
13502 ==a==
13503 ===aa===
13504 ====aaa====
13505 ==b==
13506 ===ba===
13507 ===bb===
13508 ====bba====
13509 ===bc===
13510 ==c==
13511 ===ca===
13512 !! html
13513 start
13514 !! end
13515
13516 !! test
13517 Section extraction test (section 1)
13518 !! options
13519 section=1
13520 !! wikitext
13521 start
13522 ==a==
13523 ===aa===
13524 ====aaa====
13525 ==b==
13526 ===ba===
13527 ===bb===
13528 ====bba====
13529 ===bc===
13530 ==c==
13531 ===ca===
13532 !! html
13533 ==a==
13534 ===aa===
13535 ====aaa====
13536 !! end
13537
13538 !! test
13539 Section extraction test (section 2)
13540 !! options
13541 section=2
13542 !! wikitext
13543 start
13544 ==a==
13545 ===aa===
13546 ====aaa====
13547 ==b==
13548 ===ba===
13549 ===bb===
13550 ====bba====
13551 ===bc===
13552 ==c==
13553 ===ca===
13554 !! html
13555 ===aa===
13556 ====aaa====
13557 !! end
13558
13559 !! test
13560 Section extraction test (section 3)
13561 !! options
13562 section=3
13563 !! wikitext
13564 start
13565 ==a==
13566 ===aa===
13567 ====aaa====
13568 ==b==
13569 ===ba===
13570 ===bb===
13571 ====bba====
13572 ===bc===
13573 ==c==
13574 ===ca===
13575 !! html
13576 ====aaa====
13577 !! end
13578
13579 !! test
13580 Section extraction test (section 4)
13581 !! options
13582 section=4
13583 !! wikitext
13584 start
13585 ==a==
13586 ===aa===
13587 ====aaa====
13588 ==b==
13589 ===ba===
13590 ===bb===
13591 ====bba====
13592 ===bc===
13593 ==c==
13594 ===ca===
13595 !! html
13596 ==b==
13597 ===ba===
13598 ===bb===
13599 ====bba====
13600 ===bc===
13601 !! end
13602
13603 !! test
13604 Section extraction test (section 5)
13605 !! options
13606 section=5
13607 !! wikitext
13608 start
13609 ==a==
13610 ===aa===
13611 ====aaa====
13612 ==b==
13613 ===ba===
13614 ===bb===
13615 ====bba====
13616 ===bc===
13617 ==c==
13618 ===ca===
13619 !! html
13620 ===ba===
13621 !! end
13622
13623 !! test
13624 Section extraction test (section 6)
13625 !! options
13626 section=6
13627 !! wikitext
13628 start
13629 ==a==
13630 ===aa===
13631 ====aaa====
13632 ==b==
13633 ===ba===
13634 ===bb===
13635 ====bba====
13636 ===bc===
13637 ==c==
13638 ===ca===
13639 !! html
13640 ===bb===
13641 ====bba====
13642 !! end
13643
13644 !! test
13645 Section extraction test (section 7)
13646 !! options
13647 section=7
13648 !! wikitext
13649 start
13650 ==a==
13651 ===aa===
13652 ====aaa====
13653 ==b==
13654 ===ba===
13655 ===bb===
13656 ====bba====
13657 ===bc===
13658 ==c==
13659 ===ca===
13660 !! html
13661 ====bba====
13662 !! end
13663
13664 !! test
13665 Section extraction test (section 8)
13666 !! options
13667 section=8
13668 !! wikitext
13669 start
13670 ==a==
13671 ===aa===
13672 ====aaa====
13673 ==b==
13674 ===ba===
13675 ===bb===
13676 ====bba====
13677 ===bc===
13678 ==c==
13679 ===ca===
13680 !! html
13681 ===bc===
13682 !! end
13683
13684 !! test
13685 Section extraction test (section 9)
13686 !! options
13687 section=9
13688 !! wikitext
13689 start
13690 ==a==
13691 ===aa===
13692 ====aaa====
13693 ==b==
13694 ===ba===
13695 ===bb===
13696 ====bba====
13697 ===bc===
13698 ==c==
13699 ===ca===
13700 !! html
13701 ==c==
13702 ===ca===
13703 !! end
13704
13705 !! test
13706 Section extraction test (section 10)
13707 !! options
13708 section=10
13709 !! wikitext
13710 start
13711 ==a==
13712 ===aa===
13713 ====aaa====
13714 ==b==
13715 ===ba===
13716 ===bb===
13717 ====bba====
13718 ===bc===
13719 ==c==
13720 ===ca===
13721 !! html
13722 ===ca===
13723 !! end
13724
13725 !! test
13726 Section extraction test (nonexistent section 11)
13727 !! options
13728 section=11
13729 !! wikitext
13730 start
13731 ==a==
13732 ===aa===
13733 ====aaa====
13734 ==b==
13735 ===ba===
13736 ===bb===
13737 ====bba====
13738 ===bc===
13739 ==c==
13740 ===ca===
13741 !! html
13742 !! end
13743
13744 !! test
13745 Section extraction test with bogus heading (section 1)
13746 !! options
13747 section=1
13748 !! wikitext
13749 ==a==
13750 ==bogus== not a legal section
13751 ==b==
13752 !! html
13753 ==a==
13754 ==bogus== not a legal section
13755 !! end
13756
13757 !! test
13758 Section extraction test with bogus heading (section 2)
13759 !! options
13760 section=2
13761 !! wikitext
13762 ==a==
13763 ==bogus== not a legal section
13764 ==b==
13765 !! html
13766 ==b==
13767 !! end
13768
13769 !! test
13770 Section extraction test with comment after heading (section 1)
13771 !! options
13772 section=1
13773 !! wikitext
13774 ==a==
13775 ==b== <!-- -->
13776 ==c==
13777 !! html
13778 ==a==
13779 !! end
13780
13781 !! test
13782 Section extraction test with comment after heading (section 2)
13783 !! options
13784 section=2
13785 !! wikitext
13786 ==a==
13787 ==b== <!-- -->
13788 ==c==
13789 !! html
13790 ==b== <!-- -->
13791 !! end
13792
13793 !! test
13794 Section extraction test with bogus <nowiki> heading (section 1)
13795 !! options
13796 section=1
13797 !! wikitext
13798 ==a==
13799 ==bogus== <nowiki>not a legal section</nowiki>
13800 ==b==
13801 !! html
13802 ==a==
13803 ==bogus== <nowiki>not a legal section</nowiki>
13804 !! end
13805
13806 !! test
13807 Section extraction test with bogus <nowiki> heading (section 2)
13808 !! options
13809 section=2
13810 !! wikitext
13811 ==a==
13812 ==bogus== <nowiki>not a legal section</nowiki>
13813 ==b==
13814 !! html
13815 ==b==
13816 !! end
13817
13818
13819 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13820 # instead of respecting commented sections
13821 !! test
13822 Section extraction prefixed by comment (section 1)
13823 !! options
13824 section=1
13825 !! wikitext
13826 <!-- -->==sec1==
13827 ==sec2==
13828 !! html
13829 ==sec2==
13830 !!end
13831
13832 !! test
13833 Section extraction prefixed by comment (section 2)
13834 !! options
13835 section=2
13836 !! wikitext
13837 <!-- -->==sec1==
13838 ==sec2==
13839 !! html
13840
13841 !!end
13842
13843
13844 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13845 # instead of respecting HTML-style headings
13846 !! test
13847 Section extraction, mixed wiki and html (section 1)
13848 !! options
13849 section=1
13850 !! wikitext
13851 <h2>unmarked</h2>
13852 unmarked
13853 ==1==
13854 one
13855 ==2==
13856 two
13857 !! html
13858 ==1==
13859 one
13860 !! end
13861
13862 !! test
13863 Section extraction, mixed wiki and html (section 2)
13864 !! options
13865 section=2
13866 !! wikitext
13867 <h2>unmarked</h2>
13868 unmarked
13869 ==1==
13870 one
13871 ==2==
13872 two
13873 !! html
13874 ==2==
13875 two
13876 !! end
13877
13878
13879 # Formerly testing for bug 3342
13880 !! test
13881 Section extraction, heading surrounded by <noinclude>
13882 !! options
13883 section=1
13884 !! wikitext
13885 <noinclude>==unmarked==</noinclude>
13886 ==marked==
13887 !! html
13888 ==marked==
13889 !!end
13890
13891 # Test behavior of bug 19910
13892 !! test
13893 Sectiion with all-equals
13894 !! options
13895 section=2
13896 !! wikitext
13897 ===
13898 The line above must have a trailing space
13899 === <!--
13900 --> <!-- -->
13901 But just in case it doesn't...
13902 !! html
13903 === <!--
13904 --> <!-- -->
13905 But just in case it doesn't...
13906 !! end
13907
13908 !! test
13909 Section replacement test (section 0)
13910 !! options
13911 replace=0,"xxx"
13912 !! wikitext
13913 start
13914 ==a==
13915 ===aa===
13916 ====aaa====
13917 ==b==
13918 ===ba===
13919 ===bb===
13920 ====bba====
13921 ===bc===
13922 ==c==
13923 ===ca===
13924 !! html
13925 xxx
13926
13927 ==a==
13928 ===aa===
13929 ====aaa====
13930 ==b==
13931 ===ba===
13932 ===bb===
13933 ====bba====
13934 ===bc===
13935 ==c==
13936 ===ca===
13937 !! end
13938
13939 !! test
13940 Section replacement test (section 1)
13941 !! options
13942 replace=1,"xxx"
13943 !! wikitext
13944 start
13945 ==a==
13946 ===aa===
13947 ====aaa====
13948 ==b==
13949 ===ba===
13950 ===bb===
13951 ====bba====
13952 ===bc===
13953 ==c==
13954 ===ca===
13955 !! html
13956 start
13957 xxx
13958
13959 ==b==
13960 ===ba===
13961 ===bb===
13962 ====bba====
13963 ===bc===
13964 ==c==
13965 ===ca===
13966 !! end
13967
13968 !! test
13969 Section replacement test (section 2)
13970 !! options
13971 replace=2,"xxx"
13972 !! wikitext
13973 start
13974 ==a==
13975 ===aa===
13976 ====aaa====
13977 ==b==
13978 ===ba===
13979 ===bb===
13980 ====bba====
13981 ===bc===
13982 ==c==
13983 ===ca===
13984 !! html
13985 start
13986 ==a==
13987 xxx
13988
13989 ==b==
13990 ===ba===
13991 ===bb===
13992 ====bba====
13993 ===bc===
13994 ==c==
13995 ===ca===
13996 !! end
13997
13998 !! test
13999 Section replacement test (section 3)
14000 !! options
14001 replace=3,"xxx"
14002 !! wikitext
14003 start
14004 ==a==
14005 ===aa===
14006 ====aaa====
14007 ==b==
14008 ===ba===
14009 ===bb===
14010 ====bba====
14011 ===bc===
14012 ==c==
14013 ===ca===
14014 !! html
14015 start
14016 ==a==
14017 ===aa===
14018 xxx
14019
14020 ==b==
14021 ===ba===
14022 ===bb===
14023 ====bba====
14024 ===bc===
14025 ==c==
14026 ===ca===
14027 !! end
14028
14029 !! test
14030 Section replacement test (section 4)
14031 !! options
14032 replace=4,"xxx"
14033 !! wikitext
14034 start
14035 ==a==
14036 ===aa===
14037 ====aaa====
14038 ==b==
14039 ===ba===
14040 ===bb===
14041 ====bba====
14042 ===bc===
14043 ==c==
14044 ===ca===
14045 !! html
14046 start
14047 ==a==
14048 ===aa===
14049 ====aaa====
14050 xxx
14051
14052 ==c==
14053 ===ca===
14054 !! end
14055
14056 !! test
14057 Section replacement test (section 5)
14058 !! options
14059 replace=5,"xxx"
14060 !! wikitext
14061 start
14062 ==a==
14063 ===aa===
14064 ====aaa====
14065 ==b==
14066 ===ba===
14067 ===bb===
14068 ====bba====
14069 ===bc===
14070 ==c==
14071 ===ca===
14072 !! html
14073 start
14074 ==a==
14075 ===aa===
14076 ====aaa====
14077 ==b==
14078 xxx
14079
14080 ===bb===
14081 ====bba====
14082 ===bc===
14083 ==c==
14084 ===ca===
14085 !! end
14086
14087 !! test
14088 Section replacement test (section 6)
14089 !! options
14090 replace=6,"xxx"
14091 !! wikitext
14092 start
14093 ==a==
14094 ===aa===
14095 ====aaa====
14096 ==b==
14097 ===ba===
14098 ===bb===
14099 ====bba====
14100 ===bc===
14101 ==c==
14102 ===ca===
14103 !! html
14104 start
14105 ==a==
14106 ===aa===
14107 ====aaa====
14108 ==b==
14109 ===ba===
14110 xxx
14111
14112 ===bc===
14113 ==c==
14114 ===ca===
14115 !! end
14116
14117 !! test
14118 Section replacement test (section 7)
14119 !! options
14120 replace=7,"xxx"
14121 !! wikitext
14122 start
14123 ==a==
14124 ===aa===
14125 ====aaa====
14126 ==b==
14127 ===ba===
14128 ===bb===
14129 ====bba====
14130 ===bc===
14131 ==c==
14132 ===ca===
14133 !! html
14134 start
14135 ==a==
14136 ===aa===
14137 ====aaa====
14138 ==b==
14139 ===ba===
14140 ===bb===
14141 xxx
14142
14143 ===bc===
14144 ==c==
14145 ===ca===
14146 !! end
14147
14148 !! test
14149 Section replacement test (section 8)
14150 !! options
14151 replace=8,"xxx"
14152 !! wikitext
14153 start
14154 ==a==
14155 ===aa===
14156 ====aaa====
14157 ==b==
14158 ===ba===
14159 ===bb===
14160 ====bba====
14161 ===bc===
14162 ==c==
14163 ===ca===
14164 !! html
14165 start
14166 ==a==
14167 ===aa===
14168 ====aaa====
14169 ==b==
14170 ===ba===
14171 ===bb===
14172 ====bba====
14173 xxx
14174
14175 ==c==
14176 ===ca===
14177 !!end
14178
14179 !! test
14180 Section replacement test (section 9)
14181 !! options
14182 replace=9,"xxx"
14183 !! wikitext
14184 start
14185 ==a==
14186 ===aa===
14187 ====aaa====
14188 ==b==
14189 ===ba===
14190 ===bb===
14191 ====bba====
14192 ===bc===
14193 ==c==
14194 ===ca===
14195 !! html
14196 start
14197 ==a==
14198 ===aa===
14199 ====aaa====
14200 ==b==
14201 ===ba===
14202 ===bb===
14203 ====bba====
14204 ===bc===
14205 xxx
14206 !! end
14207
14208 !! test
14209 Section replacement test (section 10)
14210 !! options
14211 replace=10,"xxx"
14212 !! wikitext
14213 start
14214 ==a==
14215 ===aa===
14216 ====aaa====
14217 ==b==
14218 ===ba===
14219 ===bb===
14220 ====bba====
14221 ===bc===
14222 ==c==
14223 ===ca===
14224 !! html
14225 start
14226 ==a==
14227 ===aa===
14228 ====aaa====
14229 ==b==
14230 ===ba===
14231 ===bb===
14232 ====bba====
14233 ===bc===
14234 ==c==
14235 xxx
14236 !! end
14237
14238 !! test
14239 Section replacement test with initial whitespace (bug 13728)
14240 !! options
14241 replace=2,"xxx"
14242 !! wikitext
14243 Preformatted initial line
14244 ==a==
14245 ===a===
14246 !! html
14247 Preformatted initial line
14248 ==a==
14249 xxx
14250 !! end
14251
14252
14253 !! test
14254 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14255 !! options
14256 section=1
14257 !! wikitext
14258 ==a==
14259 a
14260 !! html
14261 ==a==
14262 a
14263 !! end
14264
14265 !! test
14266 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14267 !! options
14268 section=1
14269 !! wikitext
14270 ==a==
14271 a
14272 !! html
14273 ==a==
14274 a
14275 !! end
14276
14277
14278 !! test
14279 Section extraction, <pre> around bogus header (bug 10309)
14280 !! options
14281 noxml section=2
14282 !! wikitext
14283 == Section One ==
14284 <pre>
14285 =======
14286 </pre>
14287
14288 == Section Two ==
14289 stuff
14290 !! html
14291 == Section Two ==
14292 stuff
14293 !! end
14294
14295 !! test
14296 Section replacement, <pre> around bogus header (bug 10309)
14297 !! options
14298 noxml replace=2,"xxx"
14299 !! wikitext
14300 == Section One ==
14301 <pre>
14302 =======
14303 </pre>
14304
14305 == Section Two ==
14306 stuff
14307 !! html
14308 == Section One ==
14309 <pre>
14310 =======
14311 </pre>
14312
14313 xxx
14314 !! end
14315
14316
14317
14318 !! test
14319 Handling of &#x0A; in URLs
14320 !! wikitext
14321 **irc://&#x0A;a
14322 !! html
14323 <ul>
14324 <li><ul>
14325 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14326 </li>
14327 </ul>
14328 </li>
14329 </ul>
14330
14331 !!end
14332
14333 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14334 !! test
14335 5 quotes, code coverage +1 line
14336 !! wikitext
14337 '''''
14338 !! html/php
14339 !! html/parsoid
14340 <p><b><i></i></b></p>
14341 !! end
14342
14343 !! test
14344 Special:Search page linking.
14345 !! wikitext
14346 {{Special:search}}
14347 !! html
14348 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14349 </p>
14350 !! end
14351
14352 !! test
14353 Say the magic word
14354 !! options
14355 title=[[Parser test]]
14356 !! wikitext
14357 * {{PAGENAME}}
14358 * {{PAGENAMEE}}
14359 * {{FULLPAGENAME}}
14360 * {{FULLPAGENAMEE}}
14361 * {{BASEPAGENAME}}
14362 * {{BASEPAGENAMEE}}
14363 * {{SUBPAGENAME}}
14364 * {{SUBPAGENAMEE}}
14365 * {{ROOTPAGENAME}}
14366 * {{ROOTPAGENAMEE}}
14367 * {{TALKPAGENAME}}
14368 * {{TALKPAGENAMEE}}
14369 * {{SUBJECTPAGENAME}}
14370 * {{SUBJECTPAGENAMEE}}
14371 * {{NAMESPACEE}}
14372 * {{NAMESPACE}}
14373 * {{NAMESPACENUMBER}}
14374 * {{TALKSPACE}}
14375 * {{TALKSPACEE}}
14376 * {{SUBJECTSPACE}}
14377 * {{SUBJECTSPACEE}}
14378 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14379 !! html
14380 <ul>
14381 <li> Parser test
14382 </li>
14383 <li> Parser_test
14384 </li>
14385 <li> Parser test
14386 </li>
14387 <li> Parser_test
14388 </li>
14389 <li> Parser test
14390 </li>
14391 <li> Parser_test
14392 </li>
14393 <li> Parser test
14394 </li>
14395 <li> Parser_test
14396 </li>
14397 <li> Parser test
14398 </li>
14399 <li> Parser_test
14400 </li>
14401 <li> Talk:Parser test
14402 </li>
14403 <li> Talk:Parser_test
14404 </li>
14405 <li> Parser test
14406 </li>
14407 <li> Parser_test
14408 </li>
14409 <li>
14410 </li>
14411 <li>
14412 </li>
14413 <li> 0
14414 </li>
14415 <li> Talk
14416 </li>
14417 <li> Talk
14418 </li>
14419 <li>
14420 </li>
14421 <li>
14422 </li>
14423 <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>
14424 </li>
14425 </ul>
14426
14427 !! end
14428 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14429
14430 !! test
14431 Gallery
14432 !! wikitext
14433 <gallery>
14434 image1.png |
14435 image2.gif|||||
14436
14437 image3|
14438 image4 |300px| centre
14439 image5.svg| http://///////
14440 [[x|xx]]]]
14441 * image6
14442 </gallery>
14443 !! html
14444 <ul class="gallery mw-gallery-traditional">
14445 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14446 <div class="thumb" style="height: 150px;">Image1.png</div>
14447 <div class="gallerytext">
14448 </div>
14449 </div></li>
14450 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14451 <div class="thumb" style="height: 150px;">Image2.gif</div>
14452 <div class="gallerytext">
14453 <p>||||
14454 </p>
14455 </div>
14456 </div></li>
14457 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14458 <div class="thumb" style="height: 150px;">Image3</div>
14459 <div class="gallerytext">
14460 </div>
14461 </div></li>
14462 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14463 <div class="thumb" style="height: 150px;">Image4</div>
14464 <div class="gallerytext">
14465 <p>300px| centre
14466 </p>
14467 </div>
14468 </div></li>
14469 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14470 <div class="thumb" style="height: 150px;">Image5.svg</div>
14471 <div class="gallerytext">
14472 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14473 </p>
14474 </div>
14475 </div></li>
14476 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14477 <div class="thumb" style="height: 150px;">* image6</div>
14478 <div class="gallerytext">
14479 </div>
14480 </div></li>
14481 </ul>
14482
14483 !! end
14484
14485 !! test
14486 Gallery (with options)
14487 !! wikitext
14488 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14489 File:Nonexistant.jpg|caption
14490 File:Nonexistant.jpg
14491 image:foobar.jpg|some '''caption''' [[Main Page]]
14492 image:foobar.jpg
14493 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14494 </gallery>
14495 !! html
14496 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14497 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14498 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14499 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14500 <div class="gallerytext">
14501 <p>caption
14502 </p>
14503 </div>
14504 </div></li>
14505 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14506 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14507 <div class="gallerytext">
14508 </div>
14509 </div></li>
14510 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14511 <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>
14512 <div class="gallerytext">
14513 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14514 </p>
14515 </div>
14516 </div></li>
14517 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14518 <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>
14519 <div class="gallerytext">
14520 </div>
14521 </div></li>
14522 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14523 <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>
14524 <div class="gallerytext">
14525 <p>Blabla|blabla.
14526 </p>
14527 </div>
14528 </div></li>
14529 </ul>
14530
14531 !! end
14532
14533 !! test
14534 Gallery with wikitext inside caption
14535 !! wikitext
14536 <gallery>
14537 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14538 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14539 </gallery>
14540 !! html
14541 <ul class="gallery mw-gallery-traditional">
14542 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14543 <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>
14544 <div class="gallerytext">
14545 <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>
14546 </p>
14547 </div>
14548 </div></li>
14549 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14550 <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>
14551 <div class="gallerytext">
14552 <p>This is a test template
14553 </p>
14554 </div>
14555 </div></li>
14556 </ul>
14557
14558 !! end
14559
14560 !! test
14561 gallery (with showfilename option)
14562 !! wikitext
14563 <gallery showfilename>
14564 File:Nonexistant.jpg|caption
14565 File:Nonexistant.jpg
14566 image:foobar.jpg|some '''caption''' [[Main Page]]
14567 File:Foobar.jpg
14568 </gallery>
14569 !! html
14570 <ul class="gallery mw-gallery-traditional">
14571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14572 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14573 <div class="gallerytext">
14574 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14575 caption
14576 </p>
14577 </div>
14578 </div></li>
14579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14580 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14581 <div class="gallerytext">
14582 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14583 </p>
14584 </div>
14585 </div></li>
14586 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14587 <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>
14588 <div class="gallerytext">
14589 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14590 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14591 </p>
14592 </div>
14593 </div></li>
14594 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14595 <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>
14596 <div class="gallerytext">
14597 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14598 </p>
14599 </div>
14600 </div></li>
14601 </ul>
14602
14603 !! end
14604
14605 !! test
14606 Gallery (with namespace-less filenames)
14607 !! wikitext
14608 <gallery>
14609 File:Nonexistant.jpg
14610 Nonexistant.jpg
14611 image:foobar.jpg
14612 foobar.jpg
14613 </gallery>
14614 !! html
14615 <ul class="gallery mw-gallery-traditional">
14616 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14617 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14618 <div class="gallerytext">
14619 </div>
14620 </div></li>
14621 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14622 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14623 <div class="gallerytext">
14624 </div>
14625 </div></li>
14626 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14627 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
14628 <div class="gallerytext">
14629 </div>
14630 </div></li>
14631 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14632 <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>
14633 <div class="gallerytext">
14634 </div>
14635 </div></li>
14636 </ul>
14637
14638 !! end
14639
14640 !! test
14641 HTML Hex character encoding (spells the word "JavaScript")
14642 !! wikitext
14643 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14644 !! html
14645 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14646 </p>
14647 !! end
14648
14649 !! test
14650 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14651 !! wikitext
14652 &#xsee;&#XSEE;
14653 !! html
14654 <p>&amp;#xsee;&amp;#XSEE;
14655 </p>
14656 !! end
14657
14658 !! test
14659 HTML Hex character encoding mixed case
14660 !! wikitext
14661 &#xEE;&#Xee;
14662 !! html
14663 <p>&#xee;&#xee;
14664 </p>
14665 !! end
14666
14667 !! test
14668 __FORCETOC__ override
14669 !! wikitext
14670 __NEWSECTIONLINK__
14671 __FORCETOC__
14672 !! html
14673 <p><br />
14674 </p>
14675 !! end
14676
14677 !! test
14678 ISBN code coverage
14679 !! wikitext
14680 ISBN 978-0-1234-56&#x20;789
14681 !! html
14682 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14683 </p>
14684 !! end
14685
14686 !! test
14687 ISBN followed by 5 spaces
14688 !! wikitext
14689 ISBN
14690 !! html
14691 <p>ISBN
14692 </p>
14693 !! end
14694
14695 !! test
14696 Double ISBN
14697 !! wikitext
14698 ISBN ISBN 1234567890
14699 !! html
14700 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14701 </p>
14702 !! end
14703
14704 !! test
14705 ISBN with an X
14706 !! wikitext
14707 ISBN 3-462-04561-X
14708 !! html
14709 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
14710 </p>
14711 !! end
14712
14713 !! test
14714 Bug 22905: <abbr> followed by ISBN followed by </a>
14715 !! wikitext
14716 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14717 !! html
14718 <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>
14719 </p>
14720 !! end
14721
14722 !! test
14723 Double RFC
14724 !! wikitext
14725 RFC RFC 1234
14726 !! html
14727 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14728 </p>
14729 !! end
14730
14731 !! test
14732 Double RFC with a wiki link
14733 !! wikitext
14734 RFC [[RFC 1234]]
14735 !! html
14736 <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>
14737 </p>
14738 !! end
14739
14740 !! test
14741 RFC code coverage
14742 !! wikitext
14743 RFC 983&#x20;987
14744 !! html
14745 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14746 </p>
14747 !! end
14748
14749 !! test
14750 Centre-aligned image
14751 !! wikitext
14752 [[Image:foobar.jpg|centre]]
14753 !! html
14754 <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>
14755
14756 !!end
14757
14758 !! test
14759 None-aligned image
14760 !! wikitext
14761 [[Image:foobar.jpg|none]]
14762 !! html
14763 <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>
14764
14765 !!end
14766
14767 !! test
14768 Width + Height sized image (using px) (height is ignored)
14769 !! wikitext
14770 [[Image:foobar.jpg|640x480px]]
14771 !! html
14772 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
14773 </p>
14774 !!end
14775
14776 !! test
14777 Width-sized image (using px, no following whitespace)
14778 !! wikitext
14779 [[Image:foobar.jpg|640px]]
14780 !! html
14781 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
14782 </p>
14783 !!end
14784
14785 !! test
14786 Width-sized image (using px, with following whitespace - test regression from r39467)
14787 !! wikitext
14788 [[Image:foobar.jpg|640px ]]
14789 !! html
14790 <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>
14791 </p>
14792 !!end
14793
14794 !! test
14795 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14796 !! wikitext
14797 [[Image:foobar.jpg| 640px]]
14798 !! html
14799 <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>
14800 </p>
14801 !!end
14802
14803 !! test
14804 Another italics / bold test
14805 !! wikitext
14806 ''' ''x'
14807 !! html
14808 <pre>'<i> </i>x'
14809 </pre>
14810 !!end
14811
14812 # Note the results may be incorrect, as parserTest output included this:
14813 # XML error: Mismatched tag at byte 6120:
14814 # ...<dd> </dt></dl> </dd...
14815 !! test
14816 dt/dd/dl test
14817 !! options
14818 disabled
14819 !! wikitext
14820 :;;;::
14821 !! html
14822 <dl>
14823 <dd><dl>
14824 <dt><dl>
14825 <dt><dl>
14826 <dt><dl>
14827 <dd><dl>
14828 <dd>
14829 </dd>
14830 </dl>
14831 </dd>
14832 </dl>
14833 </dt>
14834 </dl>
14835 </dt>
14836 </dl>
14837 </dt>
14838 </dl>
14839 </dd>
14840 </dl>
14841
14842 !!end
14843
14844
14845 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14846 !! test
14847 Images with the "|" character in the comment
14848 !! wikitext
14849 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14850 !! html
14851 <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>
14852
14853 !!end
14854
14855 !! test
14856 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14857 !! wikitext
14858 <html><script>alert(1);</script></html>
14859 !! html
14860 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14861 </p>
14862 !! end
14863
14864 !! test
14865 HTML with raw HTML ($wgRawHtml==true)
14866 !! options
14867 wgRawHtml=1
14868 !! wikitext
14869 <html><script>alert(1);</script></html>
14870 !! html
14871 <p><script>alert(1);</script>
14872 </p>
14873 !! end
14874
14875 !! test
14876 Parents of subpages, one level up
14877 !! options
14878 subpage title=[[Subpage test/L1/L2/L3]]
14879 !! wikitext
14880 [[../|L2]]
14881 !! html
14882 <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>
14883 </p>
14884 !! end
14885
14886
14887 !! test
14888 Parents of subpages, one level up, not named
14889 !! options
14890 subpage title=[[Subpage test/L1/L2/L3]]
14891 !! wikitext
14892 [[../]]
14893 !! html
14894 <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>
14895 </p>
14896 !! end
14897
14898
14899
14900 !! test
14901 Parents of subpages, two levels up
14902 !! options
14903 subpage title=[[Subpage test/L1/L2/L3]]
14904 !! wikitext
14905 [[../../|L1]]2
14906
14907 [[../../|L1]]l
14908 !! html
14909 <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
14910 </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>
14911 </p>
14912 !! end
14913
14914 !! test
14915 Parents of subpages, two levels up, without trailing slash or name.
14916 !! options
14917 subpage title=[[Subpage test/L1/L2/L3]]
14918 !! wikitext
14919 [[../..]]
14920 !! html
14921 <p>[[../..]]
14922 </p>
14923 !! end
14924
14925 !! test
14926 Parents of subpages, two levels up, with lots of extra trailing slashes.
14927 !! options
14928 subpage title=[[Subpage test/L1/L2/L3]]
14929 !! wikitext
14930 [[../../////]]
14931 !! html
14932 <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>
14933 </p>
14934 !! end
14935
14936 !! article
14937 Subpage test/L1/L2/L3Sibling
14938 !! text
14939 Sibling article
14940 !! endarticle
14941
14942 !! test
14943 Transclusion of a sibling page (one level up)
14944 !! options
14945 subpage title=[[Subpage test/L1/L2/L3]]
14946 !! wikitext
14947 {{../L3Sibling}}
14948 !! html
14949 <p>Sibling article
14950 </p>
14951 !! end
14952
14953 !! test
14954 Transclusion of a child page
14955 !! options
14956 subpage title=[[Subpage test/L1/L2]]
14957 !! wikitext
14958 {{/L3Sibling}}
14959 !! html
14960 <p>Sibling article
14961 </p>
14962 !! end
14963
14964 !! test
14965 Non-transclusion because of too many up levels
14966 !! options
14967 subpage title=[[Subpage test/L1/L2/L3]]
14968 !! wikitext
14969 {{../../../../More than parent}}
14970 !! html
14971 <p>{{../../../../More than parent}}
14972 </p>
14973 !! end
14974
14975 !! test
14976 Definition list code coverage
14977 !! wikitext
14978 ; title : def
14979 ; title : def
14980 ;title: def
14981 !! html
14982 <dl>
14983 <dt> title &#160;</dt>
14984 <dd> def
14985 </dd>
14986 <dt> title&#160;</dt>
14987 <dd> def
14988 </dd>
14989 <dt>title</dt>
14990 <dd> def
14991 </dd>
14992 </dl>
14993
14994 !! end
14995
14996 !! test
14997 Don't fall for the self-closing div
14998 !! wikitext
14999 <div>hello world</div/>
15000 !! html
15001 <div>hello world</div>
15002
15003 !! end
15004
15005 !! test
15006 MSGNW magic word
15007 !! wikitext
15008 {{MSGNW:msg}}
15009 !! html
15010 <p>&#91;&#91;:Template:Msg&#93;&#93;
15011 </p>
15012 !! end
15013
15014 !! test
15015 RAW magic word
15016 !! wikitext
15017 {{RAW:QUERTY}}
15018 !! html
15019 <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>
15020 </p>
15021 !! end
15022
15023 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15024 !! test
15025 Always escape literal '>' in output, not just after '<'
15026 !! wikitext
15027 ><>
15028 !! html
15029 <p>&gt;&lt;&gt;
15030 </p>
15031 !! end
15032
15033 !! test
15034 Template caching
15035 !! wikitext
15036 {{Test}}
15037 {{Test}}
15038 !! html
15039 <p>This is a test template
15040 This is a test template
15041 </p>
15042 !! end
15043
15044
15045 !! article
15046 MediaWiki:Fake
15047 !! text
15048 ==header==
15049 !! endarticle
15050
15051 !! test
15052 Inclusion of !userCanEdit() content
15053 !! wikitext
15054 {{MediaWiki:Fake}}
15055 !! html
15056 <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>
15057
15058 !! end
15059
15060
15061 !! test
15062 Out-of-order TOC heading levels
15063 !! wikitext
15064 ==2==
15065 ======6======
15066 ===3===
15067 =1=
15068 =====5=====
15069 ==2==
15070 !! html
15071 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15072 <ul>
15073 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15074 <ul>
15075 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15076 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15077 </ul>
15078 </li>
15079 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15080 <ul>
15081 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15082 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15083 </ul>
15084 </li>
15085 </ul>
15086 </div>
15087
15088 <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>
15089 <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>
15090 <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>
15091 <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>
15092 <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>
15093 <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>
15094
15095 !! end
15096
15097
15098 !! test
15099 ISBN with a dummy number
15100 !! wikitext
15101 ISBN ---
15102 !! html
15103 <p>ISBN ---
15104 </p>
15105 !! end
15106
15107
15108 !! test
15109 ISBN with space-delimited number
15110 !! wikitext
15111 ISBN 92 9017 032 8
15112 !! html
15113 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15114 </p>
15115 !! end
15116
15117
15118 !! test
15119 ISBN with multiple spaces, no number
15120 !! wikitext
15121 ISBN foo
15122 !! html
15123 <p>ISBN foo
15124 </p>
15125 !! end
15126
15127
15128 !! test
15129 ISBN length
15130 !! wikitext
15131 ISBN 123456789
15132
15133 ISBN 1234567890
15134
15135 ISBN 12345678901
15136 !! html
15137 <p>ISBN 123456789
15138 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15139 </p><p>ISBN 12345678901
15140 </p>
15141 !! end
15142
15143
15144 !! test
15145 ISBN with trailing year (bug 8110)
15146 !! wikitext
15147 ISBN 1-234-56789-0 - 2006
15148
15149 ISBN 1 234 56789 0 - 2006
15150 !! html
15151 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15152 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15153 </p>
15154 !! end
15155
15156
15157 !! test
15158 anchorencode
15159 !! wikitext
15160 {{anchorencode:foo bar©#%n}}
15161 !! html
15162 <p>foo_bar.C2.A9.23.25n
15163 </p>
15164 !! end
15165
15166 !! test
15167 anchorencode trims spaces
15168 !! wikitext
15169 {{anchorencode: __pretty__please__}}
15170 !! html
15171 <p>pretty_please
15172 </p>
15173 !! end
15174
15175 !! test
15176 anchorencode deals with links
15177 !! wikitext
15178 {{anchorencode: [[hello|world]] [[hi]]}}
15179 !! html
15180 <p>world_hi
15181 </p>
15182 !! end
15183
15184 !! test
15185 anchorencode deals with templates
15186 !! wikitext
15187 {{anchorencode: {{Foo}} }}
15188 !! html
15189 <p>FOO
15190 </p>
15191 !! end
15192
15193 !! test
15194 anchorencode encodes like the TOC generator: (bug 18431)
15195 !! wikitext
15196 === _ +:.3A%3A&&amp;]] ===
15197 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15198 __NOEDITSECTION__
15199 !! html
15200 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15201 <p>.2B:.3A.253A.26.26.5D.5D
15202 </p>
15203 !! end
15204
15205 !! test
15206 Bug 6200: blockquotes and paragraph formatting
15207 !! wikitext
15208 <blockquote>
15209 foo
15210 </blockquote>
15211
15212 bar
15213
15214 baz
15215 !! html
15216 <blockquote>
15217 <p>foo
15218 </p>
15219 </blockquote>
15220 <p>bar
15221 </p>
15222 <pre>baz
15223 </pre>
15224 !! end
15225
15226 !! test
15227 Bug 8293: Use of center tag ruins paragraph formatting
15228 !! wikitext
15229 <center>
15230 foo
15231 </center>
15232
15233 bar
15234
15235 baz
15236 !! html
15237 <center>
15238 <p>foo
15239 </p>
15240 </center>
15241 <p>bar
15242 </p>
15243 <pre>baz
15244 </pre>
15245 !! end
15246
15247 !!test
15248 Parsing of overlapping (improperly nested) inline html tags
15249 !! wikitext
15250 <span><s>x</span></s>
15251 !! html/php
15252 <p><span><s>x&lt;/span&gt;</s></span>
15253 </p>
15254 !! html/parsoid
15255 <p><span><s>x</s></span>
15256 </p>
15257 !!end
15258
15259 ###
15260 ### Language variants related tests
15261 ###
15262 !! test
15263 Self-link in language variants
15264 !! options
15265 title=[[Dunav]] language=sr
15266 !! wikitext
15267 Both [[Dunav]] and [[Дунав]] are names for this river.
15268 !! html
15269 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15270 </p>
15271 !!end
15272
15273 !! article
15274 Дуна
15275 !! text
15276 content
15277 !! endarticle
15278
15279 !! test
15280 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15281 !! options
15282 title=[[Duna]] language=sr
15283 !! wikitext
15284 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15285 !! html
15286 <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.
15287 </p>
15288 !! end
15289
15290 !! test
15291 Link to a section of a variant of this title shouldn't be parsed as self-link
15292 !! options
15293 title=[[Duna]] language=sr
15294 !! wikitext
15295 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15296 !! html
15297 <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.
15298 </p>
15299 !! end
15300
15301 !! test
15302 Link to pages in language variants
15303 !! options
15304 language=sr
15305 !! wikitext
15306 Main Page can be written as [[Маин Паге]]
15307 !! html
15308 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15309 </p>
15310 !!end
15311
15312
15313 !! test
15314 Multiple links to pages in language variants
15315 !! options
15316 language=sr
15317 !! wikitext
15318 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15319 !! html
15320 <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>.
15321 </p>
15322 !!end
15323
15324
15325 !! test
15326 Simple template in language variants
15327 !! options
15328 language=sr
15329 !! wikitext
15330 {{тест}}
15331 !! html
15332 <p>This is a test template
15333 </p>
15334 !! end
15335
15336
15337 !! test
15338 Template with explicit namespace in language variants
15339 !! options
15340 language=sr
15341 !! wikitext
15342 {{Template:тест}}
15343 !! html
15344 <p>This is a test template
15345 </p>
15346 !! end
15347
15348
15349 !! test
15350 Basic test for template parameter in language variants
15351 !! options
15352 language=sr
15353 !! wikitext
15354 {{парамтест|param=foo}}
15355 !! html
15356 <p>This is a test template with parameter foo
15357 </p>
15358 !! end
15359
15360
15361 !! test
15362 Simple category in language variants
15363 !! options
15364 language=sr cat
15365 !! wikitext
15366 [[Category:МедиаWики Усер'с Гуиде]]
15367 !! html
15368 <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>
15369 !! end
15370
15371
15372 !! article
15373 Category:分类
15374 !! text
15375 blah
15376 !! endarticle
15377
15378 !! article
15379 Category:分類
15380 !! text
15381 blah
15382 !! endarticle
15383
15384 !! test
15385 Don't convert blue categorylinks to another variant (bug 33210)
15386 !! options
15387 language=zh cat
15388 !! wikitext
15389 [[A]][[Category:分类]]
15390 !! html
15391 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15392 !! end
15393
15394
15395 !! test
15396 Stripping -{}- tags (language variants)
15397 !! options
15398 language=sr
15399 !! wikitext
15400 Latin proverb: -{Ne nuntium necare}-
15401 !! html
15402 <p>Latin proverb: Ne nuntium necare
15403 </p>
15404 !! end
15405
15406
15407 !! test
15408 Prevent conversion with -{}- tags (language variants)
15409 !! options
15410 language=sr variant=sr-ec
15411 !! wikitext
15412 Latinski: -{Ne nuntium necare}-
15413 !! html
15414 <p>Латински: Ne nuntium necare
15415 </p>
15416 !! end
15417
15418
15419 !! test
15420 Prevent conversion of text with -{}- tags (language variants)
15421 !! options
15422 language=sr variant=sr-ec
15423 !! wikitext
15424 Latinski: -{Ne nuntium necare}-
15425 !! html
15426 <p>Латински: Ne nuntium necare
15427 </p>
15428 !! end
15429
15430
15431 !! test
15432 Prevent conversion of links with -{}- tags (language variants)
15433 !! options
15434 language=sr variant=sr-ec
15435 !! wikitext
15436 -{[[Main Page]]}-
15437 !! html
15438 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15439 </p>
15440 !! end
15441
15442
15443 !! test
15444 -{}- tags within headlines (within html for parserConvert())
15445 !! options
15446 language=sr variant=sr-ec
15447 !! wikitext
15448 == -{Naslov}- ==
15449 !! html
15450 <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>
15451
15452 !! end
15453
15454
15455 !! test
15456 Explicit definition of language variant alternatives
15457 !! options
15458 language=zh variant=zh-tw
15459 !! wikitext
15460 -{zh:China;zh-tw:Taiwan}-, not China
15461 !! html
15462 <p>Taiwan, not China
15463 </p>
15464 !! end
15465
15466
15467 !! test
15468 Conversion around HTML tags
15469 !! options
15470 language=sr variant=sr-ec
15471 !! wikitext
15472 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15473 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15474 !! html
15475 <p>
15476 <span title="ЛаCтин">ски</span>
15477 </p>
15478 !! end
15479
15480
15481 !! test
15482 Explicit session-wise language variant mapping (A flag and - flag)
15483 !! options
15484 language=zh variant=zh-tw
15485 !! wikitext
15486 Taiwan is not China.
15487 But -{A|zh:China;zh-tw:Taiwan}- is China,
15488 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15489 and -{China}- is China.
15490 !! html
15491 <p>Taiwan is not China.
15492 But Taiwan is Taiwan,
15493 (This should be stripped!)
15494 and China is China.
15495 </p>
15496 !! end
15497
15498 !! test
15499 Explicit session-wise language variant mapping (H flag for hide)
15500 !! options
15501 language=zh variant=zh-tw
15502 !! wikitext
15503 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15504 Taiwan is China.
15505 !! html
15506 <p>(This should be stripped!)
15507 Taiwan is Taiwan.
15508 </p>
15509 !! end
15510
15511 !! test
15512 Adding explicit conversion rule for title (T flag)
15513 !! options
15514 language=zh variant=zh-tw showtitle
15515 !! wikitext
15516 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15517 !! html
15518 Taiwan
15519 <p>Should be stripped!
15520 </p>
15521 !! end
15522
15523 !! test
15524 Testing that changing the language variant here in the tests actually works
15525 !! options
15526 language=zh variant=zh showtitle
15527 !! wikitext
15528 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15529 !! html
15530 China
15531 <p>Should be stripped!
15532 </p>
15533 !! end
15534
15535 !! test
15536 Recursive conversion of alt and title attrs shouldn't clear converter state
15537 !! options
15538 language=zh variant=zh-cn showtitle
15539 !! wikitext
15540 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15541 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15542 !! html
15543 China
15544 <p>
15545 Should be stripped<span title="Exclamation">!</span>
15546 </p>
15547 !! end
15548
15549 !! test
15550 Bug 24072: more test on conversion rule for title
15551 !! options
15552 language=zh variant=zh-tw showtitle
15553 !! wikitext
15554 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15555 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15556 !! html
15557 Taiwan
15558 <p>This should be stripped!
15559 This won't take interferes with the title rule.
15560 </p>
15561 !! end
15562
15563 !! test
15564 Partly disable title conversion if variant == main language code
15565 !! options
15566 language=zh variant=zh title=[[ZH]] showtitle
15567 !! wikitext
15568 -{T|zh-cn:CN;zh-tw:TW}-
15569 !! html
15570 ZH
15571 <p>
15572 </p>
15573 !! end
15574
15575 !! test
15576 Partly disable title conversion if variant == main language code, more
15577 !! options
15578 language=zh variant=zh title=[[ZH]] showtitle
15579 !! wikitext
15580 -{T|TW}-
15581 !! html
15582 ZH
15583 <p>
15584 </p>
15585 !! end
15586
15587 !! test
15588 Raw output of variant escape tags (R flag)
15589 !! options
15590 language=zh variant=zh-tw
15591 !! wikitext
15592 Raw: -{R|zh:China;zh-tw:Taiwan}-
15593 !! html
15594 <p>Raw: zh:China;zh-tw:Taiwan
15595 </p>
15596 !! end
15597
15598 !! test
15599 Nested using of manual convert syntax
15600 !! options
15601 language=zh variant=zh-hk
15602 !! wikitext
15603 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15604 !! html
15605 <p>Nested: Hello Hong Kong!
15606 </p>
15607 !! end
15608
15609 !! test
15610 Proper conversion of text in external links
15611 !! options
15612 language=sr variant=sr-ec
15613 !! wikitext
15614 http://www.google.com
15615 gopher://www.google.com
15616 [http://www.google.com http://www.google.com]
15617 [gopher://www.google.com gopher://www.google.com]
15618 [https://www.google.com irc://www.google.com]
15619 [ftp://www.google.com www.google.com/ftp://dir]
15620 [//www.google.com www.google.com]
15621 !! html
15622 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15623 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15624 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15625 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15626 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15627 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15628 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15629 </p>
15630 !! end
15631
15632 !! test
15633 Do not convert roman numbers to language variants
15634 !! options
15635 language=sr variant=sr-ec
15636 !! wikitext
15637 Fridrih IV je car.
15638 !! html
15639 <p>Фридрих IV је цар.
15640 </p>
15641 !! end
15642
15643 !! test
15644 Unclosed language converter markup "-{"
15645 !! options
15646 language=sr
15647 !! wikitext
15648 -{T|hello
15649 !! html
15650 <p>-{T|hello
15651 </p>
15652 !! end
15653
15654 !! test
15655 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15656 !! options
15657 language=sr
15658 !! wikitext
15659 -{R|=&gt;}-
15660 !! html
15661 <p>=&gt;
15662 </p>
15663 !!end
15664
15665 !! test
15666 Don't break link parsing if language converter markup is in the caption.
15667 !! options
15668 language=sr variant=sr-ec
15669 !! wikitext
15670 [[Main Page|-{R|main page}-]]
15671 !! html
15672 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15673 </p>
15674 !! end
15675
15676 # This test is currently broken in the PHP parser (bug 52661)
15677 !! test
15678 Don't break image parsing if language converter markup is in the caption.
15679 !! options
15680 language=sr
15681 disabled
15682 !! wikitext
15683 [[File:Foobar.jpg|-{R|caption}-]]
15684 !! html
15685 <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>
15686 </p>
15687 !! end
15688
15689 # This test is currently broken in the PHP parser (bug 52661)
15690 !! test
15691 Don't break list handling if language converter markup is in the item.
15692 !! options
15693 language=zh variant=zh-cn
15694 disabled
15695 !! wikitext
15696 ;-{zh-cn:AAA;zh-tw:BBB}-
15697 !! html
15698 <dl><dt>AAA
15699 </dt></dl>
15700
15701 !! end
15702
15703 # This test is currently broken in the PHP parser (bug 52661)
15704 !! test
15705 Don't break table handling if language converter markup is in the cell.
15706 !! options
15707 language=sr variant=sr-ec
15708 disabled
15709 !! wikitext
15710 {|
15711 |-
15712 | -{R|B}-
15713 |}
15714 !! html
15715 <table>
15716
15717 <tr>
15718 <td> B
15719 </td></tr></table>
15720
15721 !! end
15722
15723 !! test
15724 Bug 529: Uncovered bullet
15725 !! wikitext
15726 * Foo {{bullet}}
15727 !! html
15728 <ul>
15729 <li> Foo
15730 </li>
15731 <li> Bar
15732 </li>
15733 </ul>
15734
15735 !! end
15736
15737 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15738 # Templates in Wikipedia rely on this behavior, as tidy has always been
15739 # enabled there. These tests are normally run *without* tidy, so specify the
15740 # full output here.
15741 # To test realistic parsing behavior, apply a tidy-like transformation to both
15742 # the expected output and your parser's output.
15743 !! test
15744 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15745 !! wikitext
15746 ******* Foo {{bullet}}
15747 !! html
15748 <ul>
15749 <li><ul>
15750 <li><ul>
15751 <li><ul>
15752 <li><ul>
15753 <li><ul>
15754 <li><ul>
15755 <li> Foo
15756 </li>
15757 </ul>
15758 </li>
15759 </ul>
15760 </li>
15761 </ul>
15762 </li>
15763 </ul>
15764 </li>
15765 </ul>
15766 </li>
15767 </ul>
15768 </li>
15769 <li> Bar
15770 </li>
15771 </ul>
15772
15773 !! end
15774
15775 !! test
15776 Bug 529: Uncovered table already at line-start
15777 !! wikitext
15778 x
15779
15780 {{table}}
15781 y
15782 !! html
15783 <p>x
15784 </p>
15785 <table>
15786 <tr>
15787 <td> 1 </td>
15788 <td> 2
15789 </td></tr>
15790 <tr>
15791 <td> 3 </td>
15792 <td> 4
15793 </td></tr></table>
15794 <p>y
15795 </p>
15796 !! end
15797
15798 !! test
15799 Bug 529: Uncovered bullet in parser function result
15800 !! wikitext
15801 * Foo {{lc:{{bullet}} }}
15802 !! html
15803 <ul>
15804 <li> Foo
15805 </li>
15806 <li> bar
15807 </li>
15808 </ul>
15809
15810 !! end
15811
15812 !! test
15813 Bug 5678: Double-parsed template argument
15814 !! wikitext
15815 {{lc:{{{1}}}|hello}}
15816 !! html
15817 <p>{{{1}}}
15818 </p>
15819 !! end
15820
15821 !! test
15822 Bug 5678: Double-parsed template invocation
15823 !! wikitext
15824 {{lc:{{paramtest {{!}} param = hello }} }}
15825 !! html
15826 <p>{{paramtest | param = hello }}
15827 </p>
15828 !! end
15829
15830 !! test
15831 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15832 !! options
15833 language=cs
15834 title=[[Main Page]]
15835 !! wikitext
15836 {{PRVNÍVELKÉ:ěščř}}
15837 {{prvnívelké:ěščř}}
15838 {{PRVNÍMALÉ:ěščř}}
15839 {{prvnímalé:ěščř}}
15840 {{MALÁ:ěščř}}
15841 {{malá:ěščř}}
15842 {{VELKÁ:ěščř}}
15843 {{velká:ěščř}}
15844 !! html
15845 <p>Ěščř
15846 Ěščř
15847 ěščř
15848 ěščř
15849 ěščř
15850 ěščř
15851 ĚŠČŘ
15852 ĚŠČŘ
15853 </p>
15854 !! end
15855
15856 !! test
15857 Morwen/13: Unclosed link followed by heading
15858 !! wikitext
15859 [[link
15860 ==heading==
15861 !! html
15862 <p>[[link
15863 </p>
15864 <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>
15865
15866 !! end
15867
15868 !! test
15869 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15870 !! wikitext
15871 {{foo|
15872 =heading=
15873 !! html
15874 <p>{{foo|
15875 </p>
15876 <h1><span class="mw-headline" id="heading">heading</span></h1>
15877
15878 !! end
15879
15880 !! test
15881 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15882 !! wikitext
15883 {{foo|
15884 ==heading==
15885 !! html
15886 <p>{{foo|
15887 </p>
15888 <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>
15889
15890 !! end
15891
15892 !! test
15893 Tildes in comments
15894 !! options
15895 pst
15896 !! wikitext
15897 <!-- ~~~~ -->
15898 !! html
15899 <!-- ~~~~ -->
15900 !! end
15901
15902 !! test
15903 Paragraphs inside divs (no extra line breaks)
15904 !! wikitext
15905 <div>Line one
15906
15907 Line two</div>
15908 !! html
15909 <div>Line one
15910 Line two</div>
15911
15912 !! end
15913
15914 !! test
15915 Paragraphs inside divs (extra line break on open)
15916 !! wikitext
15917 <div>
15918 Line one
15919
15920 Line two</div>
15921 !! html
15922 <div>
15923 <p>Line one
15924 </p>
15925 Line two</div>
15926
15927 !! end
15928
15929 !! test
15930 Paragraphs inside divs (extra line break on close)
15931 !! wikitext
15932 <div>Line one
15933
15934 Line two
15935 </div>
15936 !! html
15937 <div>Line one
15938 <p>Line two
15939 </p>
15940 </div>
15941
15942 !! end
15943
15944 !! test
15945 Paragraphs inside divs (extra line break on open and close)
15946 !! wikitext
15947 <div>
15948 Line one
15949
15950 Line two
15951 </div>
15952 !! html
15953 <div>
15954 <p>Line one
15955 </p><p>Line two
15956 </p>
15957 </div>
15958
15959 !! end
15960
15961 !! test
15962 Nesting tags, paragraphs on lines which begin with <div>
15963 !! options
15964 disabled
15965 !! wikitext
15966 <div></div><strong>A
15967 B</strong>
15968 !! html
15969 <div></div>
15970 <p><strong>A
15971 B</strong>
15972 </p>
15973 !! end
15974
15975 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15976 !! test
15977 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15978 !! wikitext
15979 <blockquote>Line one
15980
15981 Line two</blockquote>
15982 !! html
15983 <blockquote>Line one
15984 Line two</blockquote>
15985
15986 !! end
15987
15988 !! test
15989 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15990 !! wikitext
15991 <blockquote>
15992 Line one
15993
15994 Line two</blockquote>
15995 !! html
15996 <blockquote>
15997 <p>Line one
15998 </p>
15999 Line two</blockquote>
16000
16001 !! end
16002
16003 !! test
16004 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16005 !! wikitext
16006 <blockquote>Line one
16007
16008 Line two
16009 </blockquote>
16010 !! html
16011 <blockquote>Line one
16012 <p>Line two
16013 </p>
16014 </blockquote>
16015
16016 !! end
16017
16018 !! test
16019 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16020 !! wikitext
16021 <blockquote>
16022 Line one
16023
16024 Line two
16025 </blockquote>
16026 !! html
16027 <blockquote>
16028 <p>Line one
16029 </p><p>Line two
16030 </p>
16031 </blockquote>
16032
16033 !! end
16034
16035 !! test
16036 Paragraphs inside blockquotes/divs (no extra line breaks)
16037 !! wikitext
16038 <blockquote><div>Line one
16039
16040 Line two</div></blockquote>
16041 !! html
16042 <blockquote><div>Line one
16043 Line two</div></blockquote>
16044
16045 !! end
16046
16047 !! test
16048 Paragraphs inside blockquotes/divs (extra line break on open)
16049 !! wikitext
16050 <blockquote><div>
16051 Line one
16052
16053 Line two</div></blockquote>
16054 !! html
16055 <blockquote><div>
16056 <p>Line one
16057 </p>
16058 Line two</div></blockquote>
16059
16060 !! end
16061
16062 !! test
16063 Paragraphs inside blockquotes/divs (extra line break on close)
16064 !! wikitext
16065 <blockquote><div>Line one
16066
16067 Line two
16068 </div></blockquote>
16069 !! html
16070 <blockquote><div>Line one
16071 <p>Line two
16072 </p>
16073 </div></blockquote>
16074
16075 !! end
16076
16077 !! test
16078 Paragraphs inside blockquotes/divs (extra line break on open and close)
16079 !! wikitext
16080 <blockquote><div>
16081 Line one
16082
16083 Line two
16084 </div></blockquote>
16085 !! html
16086 <blockquote><div>
16087 <p>Line one
16088 </p><p>Line two
16089 </p>
16090 </div></blockquote>
16091
16092 !! end
16093
16094 !! test
16095 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16096 !! options
16097 wgLinkHolderBatchSize=0
16098 !! wikitext
16099 [[meatball:1]]
16100 [[meatball:2]]
16101 [[meatball:3]]
16102 !! html
16103 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16104 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16105 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16106 </p>
16107 !! end
16108
16109 !! test
16110 Free external link invading image caption
16111 !! wikitext
16112 [[Image:Foobar.jpg|thumb|http://x|hello]]
16113 !! html
16114 <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>
16115
16116 !! end
16117
16118 !! test
16119 Bug 15196: localised external link numbers
16120 !! options
16121 language=fa
16122 !! wikitext
16123 [http://en.wikipedia.org/]
16124 !! html
16125 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16126 </p>
16127 !! end
16128
16129 !! test
16130 Multibyte character in padleft
16131 !! wikitext
16132 {{padleft:-Hello|7|Æ}}
16133 !! html
16134 <p>Æ-Hello
16135 </p>
16136 !! end
16137
16138 !! test
16139 Multibyte character in padright
16140 !! wikitext
16141 {{padright:Hello-|7|Æ}}
16142 !! html
16143 <p>Hello-Æ
16144 </p>
16145 !! end
16146
16147 !!test
16148 formatdate parser function
16149 !! wikitext
16150 {{#formatdate:2009-03-24}}
16151 !! html
16152 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16153 </p>
16154 !! end
16155
16156 !!test
16157 formatdate parser function, with default format
16158 !! wikitext
16159 {{#formatdate:2009-03-24|mdy}}
16160 !! html
16161 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16162 </p>
16163 !! end
16164
16165 !! test
16166 Spacing of numbers in formatted dates
16167 !! wikitext
16168 {{#formatdate:January 15}}
16169 !! html
16170 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16171 </p>
16172 !! end
16173
16174 !! test
16175 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
16176 !! options
16177 language=nl title=[[MediaWiki:Common.css]]
16178 !! wikitext
16179 {{#formatdate:2009-03-24|dmy}}
16180 !! html
16181 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16182 </p>
16183 !! end
16184
16185 #
16186 #
16187 #
16188
16189 #
16190 # Edit comments
16191 #
16192
16193 !! test
16194 Edit comment with link
16195 !! options
16196 comment
16197 !! wikitext
16198 I like the [[Main Page]] a lot
16199 !! html
16200 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16201 !!end
16202
16203 !! test
16204 Edit comment with link and link text
16205 !! options
16206 comment
16207 !! wikitext
16208 I like the [[Main Page|best pages]] a lot
16209 !! html
16210 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16211 !!end
16212
16213 !! test
16214 Edit comment with link and link text with suffix
16215 !! options
16216 comment
16217 !! wikitext
16218 I like the [[Main Page|best page]]s a lot
16219 !! html
16220 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16221 !!end
16222
16223 !! test
16224 Edit comment with section link (non-local, eg in history list)
16225 !! options
16226 comment title=[[Main Page]]
16227 !! wikitext
16228 /* External links */ removed bogus entries
16229 !! html
16230 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16231 !!end
16232
16233 !! test
16234 Edit comment with section link and text before it (non-local, eg in history list)
16235 !! options
16236 comment title=[[Main Page]]
16237 !! wikitext
16238 pre-comment text /* External links */ removed bogus entries
16239 !! html
16240 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>
16241 !!end
16242
16243 !! test
16244 Edit comment with section link (local, eg in diff view)
16245 !! options
16246 comment local title=[[Main Page]]
16247 !! wikitext
16248 /* External links */ removed bogus entries
16249 !! html
16250 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16251 !!end
16252
16253 !! test
16254 Edit comment with subpage link (bug 14080)
16255 !! options
16256 comment
16257 subpage
16258 title=[[Subpage test]]
16259 !! wikitext
16260 Poked at a [[/subpage]] here...
16261 !! html
16262 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16263 !!end
16264
16265 !! test
16266 Edit comment with subpage link and link text (bug 14080)
16267 !! options
16268 comment
16269 subpage
16270 title=[[Subpage test]]
16271 !! wikitext
16272 Poked at a [[/subpage|neat little page]] here...
16273 !! html
16274 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16275 !!end
16276
16277 !! test
16278 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16279 !! options
16280 comment
16281 title=[[Subpage test]]
16282 !! wikitext
16283 Poked at a [[/subpage]] here...
16284 !! html
16285 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...
16286 !!end
16287
16288 !! test
16289 Edit comment with bare anchor link (local, as on diff)
16290 !! options
16291 comment
16292 local
16293 title=[[Main Page]]
16294 !! wikitext
16295 [[#section]]
16296 !! html
16297 <a href="#section">#section</a>
16298 !! end
16299
16300 !! test
16301 Edit comment with bare anchor link (non-local, as on history)
16302 !! options
16303 comment
16304 title=[[Main Page]]
16305 !! wikitext
16306 [[#section]]
16307 !! html
16308 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16309 !! end
16310
16311 !! test
16312 Anchor starting with underscore
16313 !! wikitext
16314 [[#_ref|One]]
16315 !! html
16316 <p><a href="#_ref">One</a>
16317 </p>
16318 !! end
16319
16320 !! test
16321 Id starting with underscore
16322 !! wikitext
16323 <div id="_ref"></div>
16324 !! html
16325 <div id="_ref"></div>
16326
16327 !! end
16328
16329 !! test
16330 Space normalisation on autocomment (bug 22784)
16331 !! options
16332 comment
16333 title=[[Main Page]]
16334 !! wikitext
16335 /* __hello__world__ */
16336 !! html
16337 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16338 !! end
16339
16340 !! test
16341 percent-encoding and + signs in comments (Bug 26410)
16342 !! options
16343 comment
16344 !! wikitext
16345 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16346 !! html
16347 <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>
16348 !! end
16349
16350 !! test
16351 Bad images - basic functionality
16352 !! options
16353 disabled
16354 !! wikitext
16355 [[File:Bad.jpg]]
16356 !! html
16357 !! end
16358
16359 !! test
16360 Bad images - bug 16039: text after bad image disappears
16361 !! options
16362 disabled
16363 !! wikitext
16364 Foo bar
16365 [[File:Bad.jpg]]
16366 Bar foo
16367 !! html
16368 <p>Foo bar
16369 </p><p>Bar foo
16370 </p>
16371 !! end
16372
16373 !! test
16374 Verify that displaytitle works (bug #22501) no displaytitle
16375 !! options
16376 showtitle
16377 !! config
16378 wgAllowDisplayTitle=true
16379 wgRestrictDisplayTitle=false
16380 !! wikitext
16381 this is not the the title
16382 !! html
16383 Parser test
16384 <p>this is not the the title
16385 </p>
16386 !! end
16387
16388 !! test
16389 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16390 !! options
16391 showtitle
16392 title=[[Screen]]
16393 !! config
16394 wgAllowDisplayTitle=true
16395 wgRestrictDisplayTitle=false
16396 !! wikitext
16397 this is not the the title
16398 {{DISPLAYTITLE:whatever}}
16399 !! html
16400 whatever
16401 <p>this is not the the title
16402 </p>
16403 !! end
16404
16405 !! test
16406 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16407 !! options
16408 showtitle
16409 title=[[Screen]]
16410 !! config
16411 wgAllowDisplayTitle=true
16412 wgRestrictDisplayTitle=true
16413 !! wikitext
16414 this is not the the title
16415 {{DISPLAYTITLE:whatever}}
16416 !! html
16417 Screen
16418 <p>this is not the the title
16419 </p>
16420 !! end
16421
16422 !! test
16423 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16424 !! options
16425 showtitle
16426 title=[[Screen]]
16427 !! config
16428 wgAllowDisplayTitle=true
16429 wgRestrictDisplayTitle=true
16430 !! wikitext
16431 this is not the the title
16432 {{DISPLAYTITLE:screen}}
16433 !! html
16434 screen
16435 <p>this is not the the title
16436 </p>
16437 !! end
16438
16439 !! test
16440 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16441 !! options
16442 showtitle
16443 title=[[Screen]]
16444 !! config
16445 wgAllowDisplayTitle=false
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 <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>
16453 </p>
16454 !! end
16455
16456 !! test
16457 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16458 !! options
16459 showtitle
16460 title=[[Screen]]
16461 !! config
16462 wgAllowDisplayTitle=false
16463 !! wikitext
16464 this is not the the title
16465 !! html
16466 Screen
16467 <p>this is not the the title
16468 </p>
16469 !! end
16470
16471 !! test
16472 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16473 !! options
16474 showtitle
16475 title=[[Screen]]
16476 !! config
16477 wgAllowDisplayTitle=true
16478 wgRestrictDisplayTitle=true
16479 !! wikitext
16480 this is not the the title
16481 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16482 !! html
16483 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16484 <p>this is not the the title
16485 </p>
16486 !! end
16487
16488 !! test
16489 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16490 !! options
16491 showtitle
16492 title=[[Screen]]
16493 !! config
16494 wgAllowDisplayTitle=true
16495 wgRestrictDisplayTitle=true
16496 !! wikitext
16497 this is not the the title
16498 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16499 !! html
16500 <span style="color: red;">s</span>creen
16501 <p>this is not the the title
16502 </p>
16503 !! end
16504
16505 !! test
16506 preload: check <noinclude> and <includeonly>
16507 !! options
16508 preload
16509 !! wikitext
16510 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16511 !! html
16512 Hello kind world.
16513 !! end
16514
16515 !! test
16516 preload: check <onlyinclude>
16517 !! options
16518 preload
16519 !! wikitext
16520 Goodbye <onlyinclude>Hello world</onlyinclude>
16521 !! html
16522 Hello world
16523 !! end
16524
16525 !! test
16526 preload: can pass tags through if we want to
16527 !! options
16528 preload
16529 !! wikitext
16530 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16531 !! html
16532 <includeonly>Hello world</includeonly>
16533 !! end
16534
16535 !! test
16536 preload: check that it doesn't try to do tricks
16537 !! options
16538 preload
16539 !! wikitext
16540 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16541 !! html
16542 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16543 !! end
16544
16545 !! test
16546 Play a bit with r67090 and bug 3158
16547 !! options
16548 disabled
16549 !! wikitext
16550 <div style="width:50% !important">&nbsp;</div>
16551 <div style="width:50%&nbsp;!important">&nbsp;</div>
16552 <div style="width:50%&#160;!important">&nbsp;</div>
16553 <div style="border : solid;">&nbsp;</div>
16554 !! html
16555 <div style="width:50% !important">&nbsp;</div>
16556 <div style="width:50% !important">&nbsp;</div>
16557 <div style="width:50% !important">&nbsp;</div>
16558 <div style="border&#160;: solid;">&nbsp;</div>
16559
16560 !! end
16561
16562 !! test
16563 HTML5 data attributes
16564 !! wikitext
16565 <span data-foo="bar">Baz</span>
16566 <p data-abc-def_hij="">Quuz</p>
16567 !! html
16568 <p><span data-foo="bar">Baz</span>
16569 </p>
16570 <p data-abc-def_hij="">Quuz</p>
16571
16572 !! end
16573
16574 !! test
16575 percent-encoding and + signs in internal links (Bug 26410)
16576 !! wikitext
16577 [[User:+%]] [[Page+title%]]
16578 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16579 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16580 [[%33%45]] [[%33%45+]]
16581 !! html
16582 <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>
16583 <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>
16584 <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>
16585 <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>
16586 </p>
16587 !! end
16588
16589 !! test
16590 Special characters in embedded file links (bug 27679)
16591 !! wikitext
16592 [[File:Contains & ampersand.jpg]]
16593 [[File:Does not exist.jpg|Title with & ampersand]]
16594 !! html
16595 <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>
16596 <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>
16597 </p>
16598 !! end
16599
16600
16601 !! test
16602 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16603 !! wikitext
16604 Text&apos;s been normalized?
16605 !! html
16606 <p>Text&#39;s been normalized?
16607 </p>
16608 !! end
16609
16610 !! test
16611 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16612 !! wikitext
16613 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16614 !! html
16615 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16616 </p>
16617 !! end
16618
16619 !! test
16620 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16621 !! wikitext
16622 [http://www.example.org/ ideograms]
16623 !! html
16624 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16625 </p>
16626 !! end
16627
16628 !! test
16629 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16630 !! wikitext
16631 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16632 !! html
16633 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16634 </p>
16635 !! end
16636
16637 !! article
16638 Mediawiki:loop1
16639 !! text
16640 {{Identical|A}}
16641 !! endarticle
16642
16643 !! article
16644 Mediawiki:loop2
16645 !! text
16646 {{Identical|B}}
16647 !! endarticle
16648
16649 !! article
16650 Template:Identical
16651 !! text
16652 {{int:loop1}}
16653 {{int:loop2}}
16654 !! endarticle
16655
16656 !! test
16657 Bug 31098 Template which includes system messages which includes the template
16658 !! wikitext
16659 {{Identical}}
16660 !! html
16661 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16662 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16663 </p>
16664 !! end
16665
16666 !! test
16667 Bug31490 Turkish: ucfirst 'blah'
16668 !! options
16669 language=tr
16670 !! wikitext
16671 {{ucfirst:blah}}
16672 !! html
16673 <p>Blah
16674 </p>
16675 !! end
16676
16677 !! test
16678 Bug31490 Turkish: ucfirst 'ix'
16679 !! options
16680 language=tr
16681 !! wikitext
16682 {{ucfirst:ix}}
16683 !! html
16684 <p>İx
16685 </p>
16686 !! end
16687
16688 !! test
16689 Bug31490 Turkish: lcfirst 'BLAH'
16690 !! options
16691 language=tr
16692 !! wikitext
16693 {{lcfirst:BLAH}}
16694 !! html
16695 <p>bLAH
16696 </p>
16697 !! end
16698
16699 !! test
16700 Bug31490 Turkish: ucfırst (with a dotless i)
16701 !! options
16702 language=tr
16703 !! wikitext
16704 {{ucfırst:blah}}
16705 !! html
16706 <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>
16707 </p>
16708 !! end
16709
16710 !! test
16711 Bug31490 ucfırst (with a dotless i) with English language
16712 !! options
16713 language=en
16714 !! wikitext
16715 {{ucfırst:blah}}
16716 !! html
16717 <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>
16718 </p>
16719 !! end
16720
16721 !! test
16722 Bug 26375: TOC with italics
16723 !! options
16724 title=[[Main Page]]
16725 !! wikitext
16726 __TOC__
16727 == ''Lost'' episodes ==
16728 !! html
16729 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16730 <ul>
16731 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
16732 </ul>
16733 </div>
16734
16735 <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>
16736
16737 !! end
16738
16739 !! test
16740 Bug 26375: TOC with bold
16741 !! options
16742 title=[[Main Page]]
16743 !! wikitext
16744 __TOC__
16745 == '''should be bold''' then normal text ==
16746 !! html
16747 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16748 <ul>
16749 <li class="toclevel-1 tocsection-1"><a href="#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>
16750 </ul>
16751 </div>
16752
16753 <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>
16754
16755 !! end
16756
16757 !! test
16758 Bug 33845: Headings become cursive in TOC when they contain an image
16759 !! options
16760 title=[[Main Page]]
16761 !! wikitext
16762 __TOC__
16763 == Image [[Image:foobar.jpg]] ==
16764 !! html
16765 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16766 <ul>
16767 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16768 </ul>
16769 </div>
16770
16771 <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>
16772
16773 !! end
16774
16775 !! test
16776 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16777 !! options
16778 title=[[Main Page]]
16779 !! wikitext
16780 __TOC__
16781 == <blockquote>Quote</blockquote> ==
16782 !! html
16783 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16784 <ul>
16785 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16786 </ul>
16787 </div>
16788
16789 <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>
16790
16791 !! end
16792
16793 !! test
16794 Unclosed tags in TOC
16795 !! options
16796 title=[[Main Page]]
16797 !! wikitext
16798 __TOC__
16799 == Proof: 2 < 3 ==
16800 <small>Hanc marginis exiguitas non caperet.</small>
16801 QED
16802 !! html
16803 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16804 <ul>
16805 <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>
16806 </ul>
16807 </div>
16808
16809 <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>
16810 <p><small>Hanc marginis exiguitas non caperet.</small>
16811 QED
16812 </p>
16813 !! end
16814
16815 !! test
16816 Multiple tags in TOC
16817 !! wikitext
16818 __TOC__
16819 == <i>Foo</i> <b>Bar</b> ==
16820
16821 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16822 !! html
16823 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16824 <ul>
16825 <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>
16826 <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>
16827 </ul>
16828 </div>
16829
16830 <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>
16831 <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>
16832
16833 !! end
16834
16835 !! test
16836 Tags with parameters in TOC
16837 !! wikitext
16838 __TOC__
16839 == <sup class="in-h2">Hello</sup> ==
16840
16841 == <sup class="a > b">Evilbye</sup> ==
16842 !! html
16843 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16844 <ul>
16845 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16846 <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>
16847 </ul>
16848 </div>
16849
16850 <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>
16851 <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>
16852
16853 !! end
16854
16855 !! test
16856 span tags with directionality in TOC
16857 !! wikitext
16858 __TOC__
16859 == <span dir="ltr">C++</span> ==
16860
16861 == <span dir="rtl">זבנג!</span> ==
16862
16863 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16864
16865 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16866
16867 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16868 !! html
16869 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16870 <ul>
16871 <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>
16872 <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>
16873 <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>
16874 <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>
16875 <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>
16876 </ul>
16877 </div>
16878
16879 <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>
16880 <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>
16881 <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>
16882 <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>
16883 <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>
16884
16885 !! end
16886
16887 !! article
16888 MediaWiki:Bug32057
16889 !! text
16890 == {{int:headline_sample}} ==
16891 !! endarticle
16892
16893 !! test
16894 Bug 32057: Title needed when expanding <h> nodes.
16895 !! options
16896 title=[[Main Page]]
16897 !! wikitext
16898 {{int:Bug32057}}
16899 !! html
16900 <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>
16901
16902 !! end
16903
16904 !! test
16905 Strip marker in urlencode
16906 !! wikitext
16907 {{urlencode:x<nowiki/>y}}
16908 {{urlencode:x<nowiki/>y|wiki}}
16909 {{urlencode:x<nowiki/>y|path}}
16910 !! html
16911 <p>xy
16912 xy
16913 xy
16914 </p>
16915 !! end
16916
16917 !! test
16918 Strip marker in lc
16919 !! wikitext
16920 {{lc:x<nowiki/>y}}
16921 !! html
16922 <p>xy
16923 </p>
16924 !! end
16925
16926 !! test
16927 Strip marker in uc
16928 !! wikitext
16929 {{uc:x<nowiki/>y}}
16930 !! html
16931 <p>XY
16932 </p>
16933 !! end
16934
16935 !! test
16936 Strip marker in formatNum
16937 !! wikitext
16938 {{formatnum:1<nowiki/>2}}
16939 {{formatnum:1<nowiki/>2|R}}
16940 !! html
16941 <p>12
16942 12
16943 </p>
16944 !! end
16945
16946 !! test
16947 Check noCommafy in formatNum
16948 !! options
16949 language=be-tarask
16950 !! wikitext
16951 {{formatnum:123456.78}}
16952 {{formatnum:123456.78|NOSEP}}
16953 !! html
16954 <p>123 456,78
16955 123456.78
16956 </p>
16957 !! end
16958
16959 !! test
16960 Wrong option for formatNum (bug 56199)
16961 !! wikitext
16962 {{formatnum:1,234.56|Random}}
16963 {{formatnum:1,234.56|EVERYTHING}}
16964 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
16965 !! html
16966 <p>1,234.56
16967 1,234.56
16968 1,234.56
16969 </p>
16970 !! end
16971
16972 !! test
16973 Strip marker in grammar
16974 !! options
16975 language=fi
16976 !! wikitext
16977 {{grammar:elative|foo<nowiki/>bar}}
16978 !! html
16979 <p>foobarista
16980 </p>
16981 !! end
16982
16983 !! test
16984 Strip marker in padleft
16985 !! wikitext
16986 {{padleft:|2|x<nowiki/>y}}
16987 !! html
16988 <p>xy
16989 </p>
16990 !! end
16991
16992 !! test
16993 Strip marker in padright
16994 !! wikitext
16995 {{padright:|2|x<nowiki/>y}}
16996 !! html
16997 <p>xy
16998 </p>
16999 !! end
17000
17001 !! test
17002 Strip marker in anchorencode
17003 !! wikitext
17004 {{anchorencode:x<nowiki/>y}}
17005 !! html
17006 <p>xy
17007 </p>
17008 !! end
17009
17010 !! test
17011 nowiki inside link inside heading (bug 18295)
17012 !! wikitext
17013 ==[[foo|x<nowiki>y</nowiki>z]]==
17014 !! html
17015 <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>
17016
17017 !! end
17018
17019 !! test
17020 new support for bdi element (bug 31817)
17021 !! wikitext
17022 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17023 !! html
17024 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17025
17026 !!end
17027
17028 !! test
17029 Ignore pipe between table row attributes
17030 !! wikitext
17031 {|
17032 | quux
17033 |- id=foo | style='color: red'
17034 | bar
17035 |}
17036 !! html
17037 <table>
17038 <tr>
17039 <td> quux
17040 </td></tr>
17041 <tr id="foo" style="color: red">
17042 <td> bar
17043 </td></tr></table>
17044
17045 !! end
17046
17047 !!test
17048 Gallery override link with WikiLink (bug 34852)
17049 !! wikitext
17050 <gallery>
17051 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17052 </gallery>
17053 !! html
17054 <ul class="gallery mw-gallery-traditional">
17055 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17056 <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>
17057 <div class="gallerytext">
17058 <p>caption
17059 </p>
17060 </div>
17061 </div></li>
17062 </ul>
17063
17064 !! end
17065
17066 !!test
17067 Gallery override link with absolute external link (bug 34852)
17068 !! wikitext
17069 <gallery>
17070 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17071 </gallery>
17072 !! html
17073 <ul class="gallery mw-gallery-traditional">
17074 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17075 <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>
17076 <div class="gallerytext">
17077 <p>caption
17078 </p>
17079 </div>
17080 </div></li>
17081 </ul>
17082
17083 !! end
17084
17085 !!test
17086 Gallery override link with malicious javascript (bug 34852)
17087 !! wikitext
17088 <gallery>
17089 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17090 </gallery>
17091 !! html
17092 <ul class="gallery mw-gallery-traditional">
17093 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17094 <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>
17095 <div class="gallerytext">
17096 <p>caption
17097 </p>
17098 </div>
17099 </div></li>
17100 </ul>
17101
17102 !! end
17103
17104 !!test
17105 Gallery with invalid title as link (bug 43964)
17106 !! wikitext
17107 <gallery>
17108 File:foobar.jpg|link=<
17109 </gallery>
17110 !! html
17111 <ul class="gallery mw-gallery-traditional">
17112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17113 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
17114 <div class="gallerytext">
17115 </div>
17116 </div></li>
17117 </ul>
17118
17119 !! end
17120
17121 !!test
17122 Language parser function
17123 !! wikitext
17124 {{#language:ar}}
17125 !! html
17126 <p>العربية
17127 </p>
17128 !! end
17129
17130 !!test
17131 Padleft and padright as substr
17132 !! wikitext
17133 {{padleft:|3|abcde}}
17134 {{padright:|3|abcde}}
17135 !! html
17136 <p>abc
17137 abc
17138 </p>
17139 !! end
17140
17141 !!test
17142 Special parser function
17143 !! wikitext
17144 {{#special:RandomPage}}
17145 {{#special:BaDtItLe}}
17146 {{#special:Foobar}}
17147 !! html
17148 <p>Special:Random
17149 Special:Badtitle
17150 Special:Foobar
17151 </p>
17152 !! end
17153
17154 !!test
17155 Bug 34939 - Case insensitive link parsing ([HttP://])
17156 !! wikitext
17157 [HttP://MediaWiki.Org/]
17158 !! html
17159 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17160 </p>
17161 !! end
17162
17163 !!test
17164 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17165 !! wikitext
17166 [HttP://MediaWiki.Org/ MediaWiki]
17167 !! html
17168 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17169 </p>
17170 !! end
17171
17172 !!test
17173 Bug 34939 - Case insensitive link parsing (HttP://)
17174 !! wikitext
17175 HttP://MediaWiki.Org/
17176 !! html
17177 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17178 </p>
17179 !! end
17180
17181 !!test
17182 Disable TOC
17183 !! options
17184 notoc
17185 !! wikitext
17186 Lead
17187 == Section 1 ==
17188 == Section 2 ==
17189 == Section 3 ==
17190 == Section 4 ==
17191 == Section 5 ==
17192 !! html
17193 <p>Lead
17194 </p>
17195
17196 <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>
17197 <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>
17198 <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>
17199 <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>
17200 <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>
17201
17202 !! end
17203
17204
17205 ###
17206 ### Parsoids-specific tests
17207 ### Parsoid-PHP parser incompatibilities
17208 ###
17209 !!test
17210 1. SOL-sensitive wikitext tokens as template-args
17211 !!options
17212 parsoid=wt2html,wt2wt
17213 !! wikitext
17214 {{echo|*a}}
17215 {{echo|#a}}
17216 {{echo|:a}}
17217 !! html
17218 <span about="#mwt1" typeof="mw:Transclusion">
17219 </span><ul about="#mwt1"><li>a</li>
17220 </ul>
17221 <span about="#mwt2" typeof="mw:Transclusion">
17222 </span><ol about="#mwt2"><li>a</li>
17223 </ol>
17224 <span about="#mwt3" typeof="mw:Transclusion">
17225 </span><dl about="#mwt3"><dd>a</dd>
17226 </dl>
17227 !!end
17228
17229 #### ----------------------------------------------------------------
17230 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17231 #### tags. Parsoid's output for these tags differs from that of the
17232 #### PHP parser.
17233 #### ----------------------------------------------------------------
17234
17235 !!test
17236 Ref: 1. ref-location should be replaced with an index span
17237 !!options
17238 parsoid
17239 !! wikitext
17240 A <ref>foo</ref>
17241 B <ref name="x">foo</ref>
17242 C <ref name="y" />
17243 !! html
17244 <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>
17245 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>
17246 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>
17247 !!end
17248
17249 !!test
17250 Ref: 2. ref-tags with identical names should all get the same index
17251 !!options
17252 parsoid
17253 !! wikitext
17254 A <ref name="x">foo</ref>
17255 B <ref name="x" />
17256 !! html
17257 <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>
17258 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>
17259 !!end
17260
17261 !!test
17262 Ref: 3. spaces in ref-names should be ignored
17263 !!options
17264 parsoid
17265 !! wikitext
17266 A <ref name="x">foo</ref>
17267 B <ref name=" x " />
17268 C <ref name= x />
17269 !! html
17270 <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>
17271 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>
17272 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>
17273 !!end
17274
17275 !!test
17276 Ref: 4. 'constructor' should be accepted as a valid ref-name
17277 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17278 !!options
17279 parsoid
17280 !! wikitext
17281 A <ref name="constructor">foo</ref>
17282 !! html
17283 <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>
17284 !!end
17285
17286 !!test
17287 Ref: 5. body should accept generic wikitext
17288 !!options
17289 parsoid
17290 !! wikitext
17291 A <ref>
17292 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17293 </ref>
17294
17295 <references />
17296 !! html
17297 <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>
17298
17299 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17300 <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>
17301 </li>
17302 </ol>
17303 !!end
17304
17305 !!test
17306 Ref: 6. indent-pres should not be output in ref-body
17307 !!options
17308 parsoid
17309 !! wikitext
17310 A <ref>
17311 foo
17312 bar
17313 baz
17314 </ref>
17315
17316 <references />
17317 !! html
17318 <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>
17319
17320 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17321 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17322 bar
17323 baz
17324 </li>
17325 </ol>
17326 !!end
17327
17328 !!test
17329 Ref: 7. No p-wrapping in ref-body
17330 !!options
17331 parsoid
17332 !! wikitext
17333 A <ref>
17334 foo
17335
17336 bar
17337
17338
17339 baz
17340
17341
17342
17343 booz
17344 </ref>
17345
17346 <references />
17347 !! html
17348 <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>
17349
17350 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17351 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17352
17353 bar
17354
17355
17356 baz
17357
17358
17359
17360 booz
17361 </li>
17362 </ol>
17363 !!end
17364
17365 !!test
17366 Ref: 8. transclusion wikitext has lower precedence
17367 !!options
17368 parsoid
17369 !! wikitext
17370 A <ref> foo {{echo|</ref> B C}}
17371
17372 <references />
17373 !! html
17374 <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>
17375 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17376 <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>
17377 </ol>
17378 !!end
17379
17380 !!test
17381 Ref: 9. unclosed comments should not leak out of ref-body
17382 !!options
17383 parsoid
17384 !! wikitext
17385 A <ref> foo <!--</ref> B C
17386 <references />
17387 !! html
17388 <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>
17389 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17390 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17391 </ol>
17392 !!end
17393
17394 !!test
17395 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17396 !!options
17397 parsoid
17398 !! wikitext
17399 A <ref> <b> foo </ref> B C
17400
17401 <references />
17402 !! html
17403 <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>
17404
17405
17406 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17407 <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>
17408 </ol>
17409 !!end
17410
17411 !!test
17412 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17413 !!options
17414 parsoid
17415 !! wikitext
17416 A <ref>foo</ref> B
17417 C <ref>bar</ref> D
17418 !! html
17419 <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
17420 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>
17421 !!end
17422
17423 !!test
17424 Ref: 12. ref-tags act as trailing newline migration barrier
17425 !!options
17426 parsoid
17427 !! wikitext
17428 <!--the newline at the end of this line moves out of the p-tag-->a
17429
17430 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17431 <ref />
17432
17433 c
17434 !! html
17435 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17436
17437
17438 <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>
17439 <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>
17440
17441
17442 <p>c</p>
17443 !!end
17444
17445 !!test
17446 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17447 !!options
17448 parsoid
17449 !! wikitext
17450 <ref>foo</ref> A
17451 <ref>bar
17452 </ref> B
17453 !! html
17454 <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
17455 <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>
17456 !!end
17457
17458 !!test
17459 Ref: 14. A nested ref-tag should be emitted as plain text
17460 !!options
17461 parsoid
17462 !! wikitext
17463 <ref>foo <ref>bar</ref> baz</ref>
17464
17465 <references />
17466 !! html
17467 <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>
17468
17469 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17470 <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>
17471 </ol>
17472 !!end
17473
17474 !!test
17475 Ref: 15. ref-tags with identical names should get identical indexes
17476 !!options
17477 parsoid
17478 !! wikitext
17479 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17480 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17481
17482 <references />
17483 !! html
17484 <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>
17485 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>
17486
17487 <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>
17488 </ol>
17489 !!end
17490
17491 ## We don't bother wt2wt-ing non-standard whitespace
17492 !!test
17493 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17494 !!options
17495 parsoid=wt2html
17496 !! wikitext
17497 A <ref >foo</ref >
17498
17499 <references />
17500 !! html
17501 <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>
17502
17503 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17504 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17505 !!end
17506
17507 !!test
17508 References: 1. references tag without any refs should be handled properly
17509 !!options
17510 parsoid
17511 !! wikitext
17512 <references />
17513 !! html
17514 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17515 !!end
17516
17517 !!test
17518 References: 2. references tag with group only outputs references from that group
17519 !!options
17520 parsoid
17521 !! wikitext
17522 A <ref group="a">foo</ref>
17523 B <ref group="b">bar</ref>
17524
17525 <references group="a" />
17526 !! html
17527 <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>
17528 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>
17529
17530 <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>
17531 </ol>
17532 !!end
17533
17534 !!test
17535 References: 3. ref list should be cleared after processing references
17536 !!options
17537 parsoid
17538 !! wikitext
17539 A <ref>foo</ref>
17540
17541 <references />
17542
17543 B <ref>bar</ref>
17544
17545 <references />
17546 !! html
17547 <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>
17548
17549 <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>
17550 </ol>
17551
17552 <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>
17553
17554 <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>
17555 </ol>
17556 !!end
17557
17558 !!test
17559 References: 4. only referenced group should be cleared after processing references
17560 !!options
17561 parsoid
17562 !! wikitext
17563 A <ref group="a">afoo</ref>
17564 B <ref>bfoo</ref>
17565
17566 <references group="a" />
17567
17568 C <ref>cfoo</ref>
17569
17570 <references />
17571 !! html
17572 <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>
17573 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>
17574
17575 <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>
17576 </ol>
17577
17578 <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>
17579
17580 <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>
17581 </ol>
17582 !!end
17583
17584 !!test
17585 References: 5. ref tags in references should be processed while ignoring all other content
17586 !!options
17587 parsoid
17588 !! wikitext
17589 A <ref name="a" />
17590 B <ref name="b">bar</ref>
17591
17592 <references>
17593 <ref name="a">foo</ref>
17594 This should just get lost.
17595 </references>
17596 !! html
17597 <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>
17598 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>
17599
17600
17601 <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":{}}'>
17602 <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>
17603 <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>
17604 </ol>
17605 !!end
17606
17607 !!test
17608 References: 6. <references /> from a transclusion
17609 !!options
17610 parsoid
17611 !! wikitext
17612 <ref>Foo</ref> {{echo|<references />}}
17613 !! html
17614 <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>
17615 !!end
17616
17617 !! test
17618 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17619 !! options
17620 parsoid
17621 !! wikitext
17622 A <ref>foo bar for a</ref>
17623 B <ref group="X" name="b" />
17624
17625 <references />
17626
17627 <references group="X">
17628 <ref name="b">foo</ref>
17629 </references>
17630 !! html
17631 <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>
17632 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>
17633
17634 <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>
17635
17636 <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>
17637 !! end
17638
17639 # This test is wt2html only because we're permitting the serializer to produce
17640 # dirty diffs, normalizing the unclosed references to the self-closed version.
17641 !! test
17642 Generate references for unclosed references tag
17643 !! options
17644 parsoid=wt2html
17645 !! wikitext
17646 a<ref>foo</ref>
17647
17648 <references>
17649 !! html
17650 <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>
17651
17652
17653 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17654 <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>
17655 !! end
17656
17657 !! test
17658 New reference serializes on its own line
17659 !! options
17660 parsoid=wt2wt,html2wt
17661 !! wikitext
17662 foo
17663 <references />
17664 !! html
17665 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17666 !! end
17667
17668 #### ----------------------------------------------------------------
17669 #### The following section of tests are primarily to test
17670 #### wikitext escaping capabilities of Parsoid. Given that
17671 #### escaping can be done any number of ways, the wikitext (input)
17672 #### is always adjusted to reflect how Parsoid adds nowiki
17673 #### escape tags.
17674 ####
17675 #### We are marking several tests as parsoid-only since the
17676 #### HTML in the result section is different from what the
17677 #### PHP parser generates for it.
17678 #### ----------------------------------------------------------------
17679
17680
17681 #### --------------- Headings ---------------
17682 #### 0. Unnested
17683 #### 1. Nested inside html <h1>=foo=</h1>
17684 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17685 #### 3. Nested inside html with wikitext split by html tags
17686 #### 4. No escape needed
17687 #### 5. Empty headings <h1></h1>
17688 #### 6. Heading chars in SOL context
17689 #### ----------------------------------------
17690 !! test
17691 Headings: 0. Unnested
17692 !! options
17693 parsoid
17694 !! wikitext
17695 <nowiki>=foo=</nowiki>
17696
17697 <nowiki> =foo= </nowiki>
17698 <!--cmt-->
17699 <nowiki>=foo=</nowiki>
17700
17701 =foo''a''<nowiki>=</nowiki>
17702 !! html
17703 <p><span typeof="mw:Nowiki">=foo=</span></p>
17704
17705 <p><span typeof="mw:Nowiki"> =foo= </span>
17706 <!--cmt-->
17707 <span typeof="mw:Nowiki">=foo=</span></p>
17708
17709 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17710 !!end
17711
17712 !! test
17713 Headings: 1. Nested inside html
17714 (New headings and existing headings are handled differently)
17715 !! options
17716 parsoid=html2wt
17717 !! wikitext
17718 = =foo= =
17719
17720 == =foo= ==
17721
17722 === =foo= ===
17723
17724 =<nowiki>=foo=</nowiki>=
17725 ==<nowiki>=foo=</nowiki>==
17726 ===<nowiki>=foo=</nowiki>===
17727 ====<nowiki>=foo=</nowiki>====
17728 =====<nowiki>=foo=</nowiki>=====
17729 ======<nowiki>=foo=</nowiki>======
17730
17731 !! html
17732 <h1>=foo=</h1>
17733 <h2>=foo=</h2>
17734 <h3>=foo=</h3>
17735
17736 <h1 data-parsoid='{}'>=foo=</h1>
17737 <h2 data-parsoid='{}'>=foo=</h2>
17738 <h3 data-parsoid='{}'>=foo=</h3>
17739 <h4 data-parsoid='{}'>=foo=</h4>
17740 <h5 data-parsoid='{}'>=foo=</h5>
17741 <h6 data-parsoid='{}'>=foo=</h6>
17742 !!end
17743
17744 !! test
17745 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17746 !! options
17747 parsoid=html2wt
17748 !! wikitext
17749 = foo =
17750 <nowiki>*</nowiki>bar
17751
17752 = foo =
17753 =bar
17754
17755 = foo =
17756 <nowiki>=bar=</nowiki>
17757 !! html
17758 <h1>foo</h1>*bar
17759 <h1>foo</h1>=bar
17760 <h1>foo</h1>=bar=
17761 !!end
17762
17763 !! test
17764 Headings: 3. Nested inside html with wikitext split by html tags
17765 !! options
17766 parsoid=html2wt
17767 !! wikitext
17768 = ='''bold'''<nowiki>foo=</nowiki> =
17769 !! html
17770 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17771 !!end
17772
17773 !! test
17774 Headings: 4a. No escaping needed (testing just h1 and h2)
17775 !! options
17776 parsoid=html2wt
17777 !! wikitext
17778 = =foo =
17779
17780 = foo= =
17781
17782 = =foo= =
17783
17784 = =foo= bar =
17785
17786 == =foo ==
17787
17788 == foo= ==
17789
17790 = ''=''foo= =
17791
17792 = <nowiki>=</nowiki> =
17793 !! html
17794 <h1>=foo</h1>
17795 <h1>foo=</h1>
17796 <h1> =foo= </h1>
17797 <h1>=foo= bar</h1>
17798 <h2>=foo</h2>
17799 <h2>foo=</h2>
17800 <h1><i>=</i>foo=</h1>
17801 <h1><span typeof="mw:Nowiki">=</span></h1>
17802 !!end
17803
17804 !! test
17805 Headings: 4b. No escaping needed (inside p-tags)
17806 !! options
17807 parsoid=html2wt
17808 !! wikitext
17809 ===
17810 =foo= x
17811 =foo= <s></s>
17812 !! html
17813 <p>===
17814 =foo= x
17815 =foo= <s></s>
17816 </p>
17817 !!end
17818
17819 !! test
17820 Headings: 5. Empty headings
17821 !! options
17822 parsoid
17823 !! wikitext
17824 =<nowiki/>=
17825
17826 ==<nowiki/>==
17827
17828 ===<nowiki/>===
17829
17830 ====<nowiki/>====
17831
17832 =====<nowiki/>=====
17833
17834 ======<nowiki/>======
17835 !! html
17836 <h1></h1>
17837 <h2></h2>
17838 <h3></h3>
17839 <h4></h4>
17840 <h5></h5>
17841 <h6></h6>
17842 !!end
17843
17844 !! test
17845 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17846 !! options
17847 parsoid
17848 !! wikitext
17849 <nowiki>=a=</nowiki>
17850
17851 <nowiki>=a=</nowiki>
17852
17853 <nowiki>=a=</nowiki>
17854
17855 <nowiki>=a=</nowiki>
17856 !! html
17857 <p>=a=</p>
17858 <p>=a= </p>
17859 <p>=a= </p>
17860 <p>=a= </p>
17861 !!end
17862
17863 !! test
17864 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17865 !! options
17866 parsoid
17867 !! wikitext
17868 <nowiki>=a=
17869 b</nowiki>
17870
17871 <nowiki>=a=
17872 b</nowiki>
17873
17874 <nowiki>=a=
17875 b</nowiki>
17876
17877 <nowiki>=a=
17878 b</nowiki>
17879 !! html
17880 <p>=a=
17881 b</p>
17882 <p>=a=
17883 b</p>
17884 <p>=a=
17885 b</p>
17886 <p>=a=
17887 b</p>
17888 </p>
17889 !!end
17890
17891 !! test
17892 Headings: 6c. Heading chars in SOL context (leading newline break)
17893 !! options
17894 parsoid
17895 !! wikitext
17896 a
17897 <nowiki>=b=</nowiki>
17898 !! html
17899 <p>a
17900 =b=</p>
17901 !!end
17902
17903 !! test
17904 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17905 !! options
17906 parsoid
17907 !! wikitext
17908 <!--c0--><nowiki>=a=</nowiki>
17909
17910 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17911 !! html
17912 <p><!--c0-->=a=</p>
17913 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17914 !!end
17915
17916 !! test
17917 Headings: 6d. Heading chars in SOL context (No escaping needed)
17918 !! options
17919 parsoid=html2wt
17920 !! wikitext
17921 =a=<div>b</div>
17922 !! html
17923 =a=<div>b</div>
17924 !!end
17925
17926 #### --------------- Lists ---------------
17927 #### 0. Outside nests (*foo, etc.)
17928 #### 1. Nested inside html <ul><li>*foo</li></ul>
17929 #### 2. Inside definition lists
17930 #### 3. Only bullets at start should be escaped
17931 #### 4. No escapes needed
17932 #### 5. No unnecessary escapes
17933 #### 6. Escape bullets in SOL position
17934 #### 7. Escape bullets in a multi-line context
17935 #### ----------------------------------------
17936
17937 !! test
17938 Lists: 0. Outside nests
17939 !! wikitext
17940 <nowiki>*</nowiki>foo
17941
17942 <nowiki>#</nowiki>foo
17943 !! html
17944 <p>*foo
17945 </p><p>#foo
17946 </p>
17947 !!end
17948
17949 !! test
17950 Lists: 1. Nested inside html
17951 !! wikitext
17952 *<nowiki>*foo</nowiki>
17953
17954 *<nowiki>#foo</nowiki>
17955
17956 *<nowiki>:foo</nowiki>
17957
17958 *<nowiki>;foo</nowiki>
17959
17960 #<nowiki>*foo</nowiki>
17961
17962 #<nowiki>#foo</nowiki>
17963
17964 #<nowiki>:foo</nowiki>
17965
17966 #<nowiki>;foo</nowiki>
17967 !! html
17968 <ul>
17969 <li>*foo
17970 </li>
17971 </ul>
17972 <ul>
17973 <li>#foo
17974 </li>
17975 </ul>
17976 <ul>
17977 <li>:foo
17978 </li>
17979 </ul>
17980 <ul>
17981 <li>;foo
17982 </li>
17983 </ul>
17984 <ol>
17985 <li>*foo
17986 </li>
17987 </ol>
17988 <ol>
17989 <li>#foo
17990 </li>
17991 </ol>
17992 <ol>
17993 <li>:foo
17994 </li>
17995 </ol>
17996 <ol>
17997 <li>;foo
17998 </li>
17999 </ol>
18000
18001 !!end
18002
18003 !! test
18004 Lists: 2. Inside definition lists
18005 !! wikitext
18006 ;<nowiki>;foo</nowiki>
18007
18008 ;<nowiki>:foo</nowiki>
18009
18010 ;<nowiki>:foo</nowiki>
18011 :bar
18012
18013 :<nowiki>:foo</nowiki>
18014 !! html
18015 <dl>
18016 <dt>;foo
18017 </dt>
18018 </dl>
18019 <dl>
18020 <dt>:foo
18021 </dt>
18022 </dl>
18023 <dl>
18024 <dt>:foo
18025 </dt>
18026 <dd>bar
18027 </dd>
18028 </dl>
18029 <dl>
18030 <dd>:foo
18031 </dd>
18032 </dl>
18033
18034 !!end
18035
18036 !! test
18037 Lists: 3. Only bullets at start of text should be escaped
18038 !! wikitext
18039 *<nowiki>*foo*bar</nowiki>
18040
18041 *<nowiki>*foo</nowiki>''it''*bar
18042 !! html
18043 <ul>
18044 <li>*foo*bar
18045 </li>
18046 </ul>
18047 <ul>
18048 <li>*foo<i>it</i>*bar
18049 </li>
18050 </ul>
18051
18052 !!end
18053
18054 !! test
18055 Lists: 4. No escapes needed
18056 !! options
18057 parsoid
18058 !! wikitext
18059 *foo*bar
18060
18061 *''foo''*bar
18062
18063 *[[Foo]]: bar
18064
18065 *[[Foo]]*bar
18066 !! html
18067 <ul>
18068 <li>foo*bar
18069 </li>
18070 </ul>
18071 <ul>
18072 <li><i>foo</i>*bar
18073 </li>
18074 </ul>
18075 <ul>
18076 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18077 </li>
18078 </ul>
18079 <ul>
18080 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18081 </li>
18082 </ul>
18083 !!end
18084
18085 !! test
18086 Lists: 5. No unnecessary escapes
18087 !! wikitext
18088 * bar <span><nowiki>[[foo]]</nowiki></span>
18089
18090 *=bar <span><nowiki>[[foo]]</nowiki></span>
18091
18092 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18093
18094 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18095
18096 *=bar <span>foo]]</span>=
18097
18098 * <s></s>: a
18099 !! html
18100 <ul>
18101 <li> bar <span>[[foo]]</span>
18102 </li>
18103 </ul>
18104 <ul>
18105 <li>=bar <span>[[foo]]</span>
18106 </li>
18107 </ul>
18108 <ul>
18109 <li>[[bar <span>[[foo]]</span>
18110 </li>
18111 </ul>
18112 <ul>
18113 <li>]]bar <span>[[foo]]</span>
18114 </li>
18115 </ul>
18116 <ul>
18117 <li>=bar <span>foo]]</span>=
18118 </li>
18119 </ul>
18120 <ul>
18121 <li> <s></s>: a
18122 </li>
18123 </ul>
18124
18125 !!end
18126
18127 !! test
18128 Lists: 6. Escape bullets in SOL position
18129 !! options
18130 parsoid
18131 !! wikitext
18132 <!--cmt--><nowiki>*foo</nowiki>
18133 !! html
18134 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18135 !!end
18136
18137 !! test
18138 Lists: 7. Escape bullets in a multi-line context
18139 !! wikitext
18140 a
18141 <nowiki>*</nowiki>b
18142 !! html
18143 <p>a
18144 *b
18145 </p>
18146 !!end
18147
18148 #### --------------- HRs ---------------
18149 #### 1. Single line
18150 #### -----------------------------------
18151
18152 !! test
18153 HRs: 1. Single line
18154 !! options
18155 parsoid
18156 !! wikitext
18157 ----<nowiki>----</nowiki>
18158 ----=foo=
18159 ----*foo
18160 !! html
18161 <hr><span typeof="mw:Nowiki">----</span>
18162 <hr>=foo=
18163 <hr>*foo
18164 !! end
18165
18166 #### --------------- Tables ---------------
18167 #### 1a. Simple example
18168 #### 1b. No escaping needed (!foo)
18169 #### 1c. No escaping needed (|foo)
18170 #### 1d. No escaping needed (|}foo)
18171 ####
18172 #### 2a. Nested in td (<td>foo|bar</td>)
18173 #### 2b. Nested in td (<td>foo||bar</td>)
18174 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18175 ####
18176 #### 3a. Nested in th (<th>foo!bar</th>)
18177 #### 3b. Nested in th (<th>foo!!bar</th>)
18178 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18179 ####
18180 #### 4a. Escape -
18181 #### 4b. Escape +
18182 #### 4c. No escaping needed
18183 #### --------------------------------------
18184
18185 !! test
18186 Tables: 1a. Simple example
18187 !! wikitext
18188 <nowiki>{|
18189 |}</nowiki>
18190 !! html
18191 <p>{|
18192 |}
18193 </p>
18194 !! end
18195
18196 !! test
18197 Tables: 1b. No escaping needed
18198 !! wikitext
18199 !foo
18200 !! html
18201 <p>!foo
18202 </p>
18203 !! end
18204
18205 !! test
18206 Tables: 1c. No escaping needed
18207 !! wikitext
18208 |foo
18209 !! html
18210 <p>|foo
18211 </p>
18212 !! end
18213
18214 !! test
18215 Tables: 1d. No escaping needed
18216 !! wikitext
18217 |}foo
18218 !! html
18219 <p>|}foo
18220 </p>
18221 !! end
18222
18223 !! test
18224 Tables: 2a. Nested in td
18225 !! options
18226 parsoid=html2wt
18227 !! wikitext
18228 {|
18229 |<nowiki>foo|bar</nowiki>
18230 |-
18231 |x<div><nowiki>a|b</nowiki></div>
18232 |}
18233 !! html
18234 <table><tbody><tr>
18235 <td>foo|bar</td></tr>
18236 <tr><td>x<div>a|b</div></td>
18237 </tbody></table>
18238 !! end
18239
18240 !! test
18241 Tables: 2b. Nested in td
18242 !! options
18243 parsoid
18244 !! wikitext
18245 {|
18246 |<nowiki>foo||bar</nowiki>
18247 |''it''<nowiki>foo||bar</nowiki>
18248 |}
18249 !! html
18250 <table><tbody><tr>
18251 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18252 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18253 !! end
18254
18255 !! test
18256 Tables: 2c. Nested in td -- no escaping needed
18257 !! options
18258 parsoid
18259 !! wikitext
18260 {|
18261 |foo!!bar
18262 |}
18263 !! html
18264 <table><tbody><tr><td>foo!!bar
18265 </td></tr></tbody></table>
18266
18267 !! end
18268
18269 !! test
18270 Tables: 3a. Nested in th
18271 !! options
18272 parsoid
18273 !! wikitext
18274 {|
18275 !foo!bar
18276 |}
18277 !! html
18278 <table><tbody><tr><th>foo!bar
18279 </th></tr></tbody></table>
18280
18281 !! end
18282
18283 !! test
18284 Tables: 3b. Nested in th
18285 !! options
18286 parsoid
18287 !! wikitext
18288 {|
18289 !<nowiki>foo!!bar</nowiki>
18290 |}
18291 !! html
18292 <table>
18293 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18294 </tbody></table>
18295 !! end
18296
18297 !! test
18298 Tables: 3c. Nested in th -- no escaping needed
18299 !! options
18300 parsoid
18301 !! wikitext
18302 {|
18303 !<nowiki>foo||bar</nowiki>
18304 |}
18305 !! html
18306 <table><tbody><tr>
18307 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18308 !! end
18309
18310 !! test
18311 Tables: 4a. Escape -
18312 !! options
18313 parsoid
18314 !! wikitext
18315 {|
18316 !-bar
18317 |-
18318 |<nowiki>-bar</nowiki>
18319 |}
18320 !! html
18321 <table><tbody>
18322 <tr><th>-bar</th></tr>
18323 <tr>
18324 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18325 !! end
18326
18327 !! test
18328 Tables: 4b. Escape +
18329 !! options
18330 parsoid
18331 !! wikitext
18332 {|
18333 !+bar
18334 |-
18335 |<nowiki>+bar</nowiki>
18336 |}
18337 !! html
18338 <table><tbody>
18339 <tr><th>+bar</th></tr>
18340 <tr>
18341 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18342 !! end
18343
18344 !! test
18345 Tables: 4c. No escaping needed
18346 !! options
18347 parsoid
18348 !! wikitext
18349 {|
18350 |foo-bar
18351 |foo+bar
18352 |-
18353 |''foo''-bar
18354 |''foo''+bar
18355 |-
18356 |foo
18357 bar|baz
18358 +bar
18359 -bar
18360 |-
18361 |x
18362 <div>a|b</div>
18363 |}
18364 !! html
18365 <table><tbody>
18366 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18367 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18368 <tr><td>foo
18369 <p>bar|baz
18370 +bar
18371 -bar</p></td></tr>
18372 <tr><td>x
18373 <div>a|b</div></td>
18374 </tbody></table>
18375 !! end
18376
18377 !! test
18378 Tables: 4d. No escaping needed
18379 !! options
18380 parsoid
18381 !! wikitext
18382 {|
18383 |[[Foo]]-bar
18384 ||+1
18385 ||-2
18386 |}
18387 !! html
18388 <table>
18389 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18390 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18391 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18392 </tbody></table>
18393 !! end
18394
18395 !! test
18396 Tables: Digest broken attributes on table and tr tag
18397 !! options
18398 parsoid=wt2html
18399 !! wikitext
18400 {| || |} ++
18401 |- || || ++ --
18402 |- > [
18403 |}
18404 !! html
18405 <table>
18406 <tbody>
18407 <tr></tr>
18408 <tr></tr>
18409 </tbody></table>
18410 !! end
18411
18412 #### --------------- Links ----------------
18413 #### 1. Quote marks in link text
18414 #### 2. Wikilinks: Escapes needed
18415 #### 3. Wikilinks: No escapes needed
18416 #### 4. Extlinks: Escapes needed
18417 #### 5. Extlinks: No escapes needed
18418 #### --------------------------------------
18419 !! test
18420 Links 1. Quote marks in link text
18421 !! options
18422 parsoid
18423 !! wikitext
18424 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18425 !! html
18426 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18427 !! end
18428
18429 !! test
18430 Links 2. WikiLinks: Escapes needed
18431 !! options
18432 parsoid
18433 !! wikitext
18434 [[Foo|[Foobar]]]
18435 [[Foo|<nowiki>Foobar]</nowiki>]]
18436 [[Foo|x [Foobar] x]]
18437 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18438 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18439 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18440 [[Foo|<nowiki>|Bar</nowiki>]]
18441 [[Foo|<nowiki>]]bar</nowiki>]]
18442 [[Foo|<nowiki>[[bar</nowiki>]]
18443 [[Foo|<nowiki>x [[ y</nowiki>]]
18444 [[Foo|<nowiki>x ]] y</nowiki>]]
18445 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18446 !! html
18447 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18448 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18449 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18450 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18451 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18452 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18453 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18454 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18455 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18456 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18457 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18458 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18459 !! end
18460
18461 !! test
18462 Links 3. WikiLinks: No escapes needed
18463 !! options
18464 parsoid
18465 !! wikitext
18466 [[Foo|[Foobar]]
18467 [[Foo|foo|bar]]
18468 !! html
18469 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18470 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18471 !! end
18472
18473 !! test
18474 Links 4. ExtLinks: Escapes needed
18475 !! options
18476 parsoid
18477 !! wikitext
18478 [http://google.com <nowiki>[google]</nowiki>]
18479 [http://google.com <nowiki>google]</nowiki>]
18480
18481 <nowiki>[http://google.com]</nowiki>
18482
18483 <nowiki>[http://google.com google]</nowiki>
18484
18485 !! html
18486 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18487 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18488 <p>[http://google.com]</p>
18489 <p>[http://google.com google]</p>
18490 !! end
18491
18492 !! test
18493 Links 5. ExtLinks: No escapes needed
18494 !! options
18495 parsoid
18496 !! wikitext
18497 [http://google.com [google]
18498 !! html
18499 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18500 !! end
18501
18502 #### --------------- Quotes ---------------
18503 #### 1. Quotes inside <b> and <i>
18504 #### 2. Link fragments separated by <i> and <b> tags
18505 #### 3. Link fragments inside <i> and <b>
18506 #### 4. No escaping needed
18507 #### --------------------------------------
18508 !! test
18509 1. Quotes inside <b> and <i>
18510 !! options
18511 parsoid=html2wt,wt2wt
18512 !! wikitext
18513 ''<nowiki>'foo'</nowiki>''
18514 ''<nowiki>''foo''</nowiki>''
18515 ''<nowiki>'''foo'''</nowiki>''
18516 ''foo''<nowiki/>'s
18517 '''<nowiki>'foo'</nowiki>'''
18518 '''<nowiki>''foo''</nowiki>'''
18519 '''<nowiki>'''foo'''</nowiki>'''
18520 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18521 '''foo'''<nowiki/>'s
18522 '''foo''
18523 ''foo''<nowiki/>'
18524 '<nowiki/>''foo''<nowiki/>'
18525 ''''foo'''
18526 '''foo'''<nowiki/>'
18527 '<nowiki/>'''foo'''<nowiki/>'
18528 ''fools'<span> errand</span>''
18529 ''<span>fool</span>'s errand''
18530 !! html
18531 <p><i>'foo'</i>
18532 <i>''foo''</i>
18533 <i>'''foo'''</i>
18534 <i>foo</i>'s
18535 <b>'foo'</b>
18536 <b>''foo''</b>
18537 <b>'''foo'''</b>
18538 <b>foo'<i>bar'</i>baz</b>
18539 <b>foo</b>'s
18540 '<i>foo</i>
18541 <i>foo</i>'
18542 '<i>foo</i>'
18543 '<b>foo</b>
18544 <b>foo</b>'
18545 '<b>foo</b>'</p>
18546 <i>fools'<span> errand</span></i>
18547 <i><span>fool</span>'s errand</i>
18548 !! end
18549
18550 !! test
18551 2. Link fragments separated by <i> and <b> tags
18552 !! wikitext
18553 [[''foo''<nowiki>hello]]</nowiki>
18554
18555 [['''foo'''<nowiki>hello]]</nowiki>
18556 !! html
18557 <p>[[<i>foo</i>hello]]
18558 </p><p>[[<b>foo</b>hello]]
18559 </p>
18560 !! end
18561
18562 !! test
18563 3. Link fragments inside <i> and <b>
18564 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18565 this is one of the shortcomings of this format)
18566 !! wikitext
18567 ''[[foo''<nowiki>]]</nowiki>
18568
18569 '''[[foo'''<nowiki>]]</nowiki>
18570 !! html
18571 <p><i>[[foo</i>]]
18572 </p><p><b>[[foo</b>]]
18573 </p>
18574 !! end
18575
18576 !! test
18577 4. No escaping needed
18578 !! wikitext
18579 '<span>''bar''</span>'
18580 '<span>'''bar'''</span>'
18581 !! html
18582 <p>'<span><i>bar</i></span>'
18583 '<span><b>bar</b></span>'
18584 </p>
18585 !! end
18586
18587 #### ----------- Paragraphs ---------------
18588 #### 1. No unnecessary escapes
18589 #### --------------------------------------
18590
18591 !! test
18592 1. No unnecessary escapes
18593 !! wikitext
18594 bar <span><nowiki>[[foo]]</nowiki></span>
18595
18596 =bar <span><nowiki>[[foo]]</nowiki></span>
18597
18598 [[bar <span><nowiki>[[foo]]</nowiki></span>
18599
18600 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18601
18602 =bar <span>foo]]</span><nowiki>=</nowiki>
18603 !! html
18604 <p>bar <span>[[foo]]</span>
18605 </p><p>=bar <span>[[foo]]</span>
18606 </p><p>[[bar <span>[[foo]]</span>
18607 </p><p>]]bar <span>[[foo]]</span>
18608 </p><p>=bar <span>foo]]</span>=
18609 </p>
18610 !!end
18611
18612 #### ----------------------- PRE --------------------------
18613 #### 1. Leading whitespace in SOL context should be escaped
18614 #### ------------------------------------------------------
18615 !! test
18616 1. Leading whitespace in SOL context should be escaped
18617 !! options
18618 parsoid
18619 !! wikitext
18620 <nowiki> </nowiki>a
18621
18622 <nowiki> </nowiki> a
18623
18624 <nowiki> </nowiki>a(tab)
18625
18626 <nowiki> </nowiki> a
18627 <!--cmt-->
18628 <nowiki> </nowiki> a
18629
18630 a
18631 <nowiki> </nowiki>b
18632
18633 a
18634 <nowiki> </nowiki>b
18635
18636 a
18637 <nowiki> </nowiki> b
18638 !! html
18639 <p> a</p>
18640 <p> a</p>
18641 <p> a(tab)</p>
18642 <p> a</p>
18643 <p><!--cmt--> a</p>
18644 <p>a
18645 b</p>
18646 <p>a
18647 b</p>
18648 <p>a
18649 b</p>
18650 !! end
18651
18652 #### --------------- Behavior Switches --------------------
18653 !! test
18654 1. Valid behavior switches should be escaped
18655 !! options
18656 parsoid=html2wt
18657 !! wikitext
18658 <nowiki>__TOC__</nowiki>
18659 !! html
18660 __TOC__
18661 !! end
18662
18663 !! test
18664 2. Invalid behavior switches should not be escaped
18665 !! options
18666 parsoid=html2wt
18667 !! wikitext
18668 __TOO__
18669 __|__
18670 !! html
18671 __TOO__
18672 __|__
18673 !! end
18674
18675 #### --------------- HTML tags ---------------
18676 #### 1. a tags
18677 #### 2. other tags
18678 #### 3. multi-line html tag
18679 #### 4. extension tags
18680 #### -----------------------------------------
18681 !! test
18682 1. a tags
18683 !! options
18684 parsoid
18685 !! wikitext
18686 <a href="http://google.com">google</a>
18687 !! html
18688 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18689 !! end
18690
18691 !! test
18692 2. other tags
18693 !! wikitext
18694 <nowiki><div>foo</div>
18695 <div style="color:red">foo</div></nowiki>
18696 !! html
18697 <p>&lt;div&gt;foo&lt;/div&gt;
18698 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18699 </p>
18700 !! end
18701
18702 !! test
18703 3. multi-line html tag
18704 !! wikitext
18705 <nowiki><div
18706 >foo</div
18707 ></nowiki>
18708 !! html
18709 <p>&lt;div
18710 &gt;foo&lt;/div
18711 &gt;
18712 </p>
18713 !! end
18714
18715 !! test
18716 4. extension tags
18717 !! wikitext
18718 <nowiki><ref>foo</ref></nowiki>
18719
18720 <nowiki><ref>bar</nowiki>
18721
18722 baz<nowiki></ref></nowiki>
18723 !! html
18724 <p>&lt;ref&gt;foo&lt;/ref&gt;
18725 </p><p>&lt;ref&gt;bar
18726 </p><p>baz&lt;/ref&gt;
18727 </p>
18728 !! end
18729
18730 #### --------------- Others ---------------
18731 !! test
18732 Escaping nowikis
18733 !! wikitext
18734 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18735 !! html
18736 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18737 </p>
18738 !! end
18739
18740 ## The quote-char in the input is necessary for triggering the bug
18741 !! test
18742 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18743 !! options
18744 parsoid=wt2wt,html2wt
18745 !! wikitext
18746 foo's bar :
18747 !! html
18748 <p>foo's bar :</p>
18749 !! end
18750
18751 !! test
18752
18753 Tag-like HTML structures are passed through as text
18754 !! wikitext
18755 <x y>
18756
18757 <x.y>
18758
18759 <x-y>
18760
18761 1>2
18762
18763 x<y
18764
18765 a>b
18766
18767 1<d e>f
18768 !! html
18769 <p>&lt;x y&gt;
18770 </p><p>&lt;x.y&gt;
18771 </p><p>&lt;x-y&gt;
18772 </p><p>1&gt;2
18773 </p><p>x&lt;y
18774 </p><p>a&gt;b
18775 </p><p>1&lt;d e&gt;f
18776 </p>
18777 !! end
18778
18779
18780 # This was a bug in the PHP parser (see bug 17663 and its dups,
18781 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18782 !! test
18783 Tag names followed by punctuation should not be recognized as tags
18784 !! wikitext
18785 <s.ome> text
18786 !! html
18787 <p>&lt;s.ome&gt; text
18788 </p>
18789 !! end
18790
18791 !! test
18792 HTML tag with necessary entities in attributes
18793 !! wikitext
18794 <span title="&amp;amp;">foo</span>
18795 !! html
18796 <p><span title="&amp;amp;">foo</span>
18797 </p>
18798 !! end
18799
18800 !! test
18801 HTML tag with 'unnecessary' entity encoding in attributes
18802 !! wikitext
18803 <span title="&amp;">foo</span>
18804 !! html
18805 <p><span title="&amp;">foo</span>
18806 </p>
18807 !! end
18808
18809 !! test
18810 HTML tag with broken attribute value quoting
18811 !! wikitext
18812 <span title="Hello world>Foo</span>
18813 !! html
18814 <p><span>Foo</span>
18815 </p>
18816 !! end
18817
18818 !! test
18819 Parsoid-only: HTML tag with broken attribute value quoting
18820 !! options
18821 parsoid
18822 !! wikitext
18823 <span title="Hello world>Foo</span>
18824 !! html
18825 <p><span title="Hello world">Foo</span>
18826 </p>
18827 !! end
18828
18829 !! test
18830 Table with broken attribute value quoting
18831 !! wikitext
18832 {|
18833 | title="Hello world|Foo
18834 |}
18835 !! html
18836 <table>
18837 <tr>
18838 <td>Foo
18839 </td></tr></table>
18840
18841 !! end
18842
18843 !! test
18844 Table with broken attribute value quoting on consecutive lines
18845 !! wikitext
18846 {|
18847 | title="Hello world|Foo
18848 | style="color:red|Bar
18849 |}
18850 !! html
18851 <table>
18852 <tr>
18853 <td>Foo
18854 </td>
18855 <td>Bar
18856 </td></tr></table>
18857
18858 !! end
18859
18860 !! test
18861 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18862 !! options
18863 parsoid
18864 !! wikitext
18865 {|
18866 | title="Hello world|Foo
18867 | style="color:red|Bar
18868 |}
18869 !! html
18870 <table><tbody>
18871 <tr>
18872 <td title="Hello world">Foo
18873 </td><td style="color: red">Bar
18874 </td></tr></tbody></table>
18875
18876 !! end
18877
18878 !! test
18879 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18880 !! options
18881 parsoid
18882 !! wikitext
18883 {{}}
18884 !! html
18885 {{}}
18886 !! end
18887
18888 !! test
18889 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18890 !! options
18891 parsoid
18892 !! wikitext
18893 }}{{
18894 !! html
18895 }}{{
18896 !! end
18897
18898 !!test
18899 Accept empty td cell attribute
18900 !! wikitext
18901 {|
18902 | align="center" | foo || |
18903 |}
18904 !! html
18905 <table>
18906 <tr>
18907 <td align="center"> foo </td>
18908 <td>
18909 </td></tr></table>
18910
18911 !!end
18912
18913 !!test
18914 Non-empty attributes in th-cells
18915 !! wikitext
18916 {|
18917 ! Foo !! style="color: red" | Bar
18918 |}
18919 !! html
18920 <table>
18921 <tr>
18922 <th> Foo </th>
18923 <th style="color: red"> Bar
18924 </th></tr></table>
18925
18926 !!end
18927
18928 !!test
18929 Accept empty attributes in th-cells
18930 !! wikitext
18931 {|
18932 !| foo !!| bar
18933 |}
18934 !! html
18935 <table>
18936 <tr>
18937 <th> foo </th>
18938 <th> bar
18939 </th></tr></table>
18940
18941 !!end
18942
18943 !!test
18944 Empty table rows go away
18945 !! wikitext
18946 {|
18947 | Hello
18948 | there
18949 |- class="foo"
18950 |-
18951 |}
18952 !! html
18953 <table>
18954 <tr>
18955 <td> Hello
18956 </td>
18957 <td> there
18958 </td></tr>
18959
18960 </table>
18961
18962 !! end
18963
18964 ###
18965 ### Parsoid-centric tests for testing RTing of inter-element separators
18966 ### Edge cases not tested by existing parser tests and specific to
18967 ### Parsoid-specific serialization strategies.
18968 ###
18969
18970 !!test
18971 RT-ed inter-element separators should be valid separators
18972 !! wikitext
18973 {|
18974 |- [[foo]]
18975 |}
18976 !! html
18977 <table>
18978
18979 </table>
18980
18981 !!end
18982
18983 !!test
18984 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
18985 (Parsoid-only since PHP parser relies on Tidy for correct output)
18986 !!options
18987 parsoid
18988 !! wikitext
18989 {|
18990 |<small>foo
18991 bar
18992 |}
18993
18994 {|
18995 |<small>foo<small>
18996 |}
18997 !! html
18998 !!end
18999
19000 !!test
19001 Empty TD followed by TD with tpl-generated attribute
19002 !! wikitext
19003 {|
19004 |-
19005 |
19006 |{{echo|style='color:red'}}|foo
19007 |}
19008 !! html
19009 <table>
19010
19011 <tr>
19012 <td>
19013 </td>
19014 <td>foo
19015 </td></tr></table>
19016
19017 !!end
19018
19019 !!test
19020 Indented table with an empty td
19021 !! wikitext
19022 {|
19023 |-
19024 |
19025 |foo
19026 |}
19027 !! html
19028 <table>
19029
19030 <tr>
19031 <td>
19032 </td>
19033 <td>foo
19034 </td></tr></table>
19035
19036 !!end
19037
19038 !!test
19039 Empty TR followed by a template-generated TR
19040 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19041 !!options
19042 parsoid
19043 !! wikitext
19044 {|
19045 |-
19046 {{echo|<tr><td>foo</td></tr>}}
19047 |}
19048 !! html
19049 <table>
19050 <tbody>
19051 <tr></tr>
19052 <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}}]}'>
19053 <td>foo</td></tr>
19054 </tbody></table>
19055 !!end
19056
19057 ## PHP and parsoid output differ for this, and since this is primarily
19058 ## for testing Parsoid's serializer, marking this Parsoid only
19059 !!test
19060 Empty TR followed by mixed-ws-comment line should RT correctly
19061 !!options
19062 parsoid
19063 !! wikitext
19064 {|
19065 |-
19066 <!--c-->
19067 |-
19068 <!--c--> <!--d-->
19069 |}
19070 !! html
19071 <table>
19072 <tbody>
19073 <tr></tr>
19074 <!--c-->
19075 <tr>
19076 <!--c--> </tr><!--d-->
19077 </tbody></table>
19078
19079 !!end
19080
19081 !!test
19082 Multi-line image caption generated by templates with/without trailing newlines
19083 !!options
19084 parsoid
19085 !! wikitext
19086 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19087 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19088 !! html
19089 <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>
19090 <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>
19091
19092 !!end
19093
19094 ## PHP emits broken html for this, and since this is primarily
19095 ## a Parsoid serializer test, marking this Parsoid only
19096 !!test
19097 Improperly nested inline or quotes tags with whitespace in between
19098 !!options
19099 parsoid
19100 !! wikitext
19101 <span> <s>x</span> </s>
19102 ''' ''x''' ''
19103 !! html
19104 <p><span> <s>x</s></span><s> </s>
19105 <b> <i>x</i></b><i> </i>
19106 </p>
19107 !!end
19108
19109 !!test
19110 Encapsulate protected attributes from wt
19111 !!options
19112 parsoid
19113 !! wikitext
19114 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19115 !! html
19116 <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>
19117 </body>
19118 !!end
19119
19120 ## Currently the p-wrapper is fragile in how adds / removes transformations.
19121 ## Having nested or stray pre tags results in the attempt to add duplicates,
19122 ## causing an assertion fail. This test tries to prevent that situation.
19123 !!test
19124 Ensure ParagraphWrapper can deal with stray closing pre tags
19125 !!options
19126 parsoid=wt2html
19127 !! wikitext
19128 plain text</pre>
19129 !! html
19130 plain text
19131 !!end
19132
19133 !!test
19134 1. Ensure fostered text content is wrapped in spans
19135 !!options
19136 parsoid=wt2html
19137 !! wikitext
19138 <table>hi</table><table>ho</table>
19139 !! html
19140 <span>hi</span>
19141 <table></table>
19142 <span>ho</span>
19143 <table></table>
19144 !!end
19145
19146 !!test
19147 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19148 !!options
19149 parsoid=wt2html,wt2wt
19150 !! wikitext
19151 <table>
19152 <tr> || ||
19153 <td> a
19154 </table>
19155 !! html
19156 <span> || ||</span>
19157 <table>
19158 <tbody>
19159 <tr>
19160 <td> a</td></tr>
19161 </tbody></table>
19162 !!end
19163
19164 !!test
19165 Encapsulation properly handles null DSR information from foster box
19166 !!options
19167 parsoid=wt2html,wt2wt
19168 !! wikitext
19169 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19170 !! html
19171 <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;
19172 <table>foo
19173 <tr>
19174 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19175 <table>
19176 <tbody>
19177 <tr>
19178 <td>bar</td></tr></tbody></table>
19179 !!end
19180
19181 !!test
19182 1. Encapsulate foster-parented transclusion content
19183 !!options
19184 parsoid=wt2wt,wt2html
19185 !! wikitext
19186 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19187 !! html
19188 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19189 <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
19190 <tr>
19191 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19192 <table>
19193 <tbody>
19194 <tr>
19195 <td>bar</td></tr></tbody></table>
19196 !!end
19197
19198 !!test
19199 2. Encapsulate foster-parented transclusion content
19200 !!options
19201 parsoid=wt2wt,wt2html
19202 !! wikitext
19203 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19204 !! html
19205 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19206 <table>
19207 <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>
19208 <tr>
19209 <td>bar</td></tr></table>&quot;]}">foo</div>
19210 <table>
19211 <tbody>
19212 <tr>
19213 <td>bar</td></tr></tbody></table>
19214 !!end
19215
19216 !!test
19217 3. Encapsulate foster-parented transclusion content
19218 !!options
19219 parsoid=wt2wt,wt2html
19220 !! wikitext
19221 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19222 !! html
19223 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19224 <table>
19225 <div>
19226 <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>
19227 <tr>
19228 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19229 <p>foo</p></div>
19230 <table>
19231 <tbody>
19232 <tr>
19233 <td>bar</td></tr></tbody></table>
19234 !!end
19235
19236 !!test
19237 4. Encapsulate foster-parented transclusion content
19238 !!options
19239 parsoid=wt2wt,wt2html
19240 !! wikitext
19241 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19242 !! html
19243 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19244 <table>
19245 <div>
19246 <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>
19247 <tr>
19248 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19249 <p>foo</p></div>
19250 <table>
19251 <tbody>
19252 <tr>
19253 <td>bar</td></tr></tbody></table>
19254 !!end
19255
19256 !!test
19257 5. Encapsulate foster-parented transclusion content
19258 !!options
19259 parsoid=wt2wt,wt2html
19260 !! wikitext
19261 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19262 !! html
19263 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19264 <table>
19265 <tr>
19266 <td>
19267 <div>
19268 <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>
19269 <table>
19270 <tbody>
19271 <tr>
19272 <td>
19273 <div>
19274 <p>foo</p></div></td></tr></tbody></table>
19275 !!end
19276
19277 !!test
19278 6. Encapsulate foster-parented transclusion content
19279 !!options
19280 parsoid=wt2wt,wt2html
19281 !! wikitext
19282 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19283 !! html
19284 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19285 <table>
19286 <tr>
19287 <td>
19288 <div>
19289 <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>
19290 <table>
19291 <tbody>
19292 <tr>
19293 <td>
19294 <div>
19295 <p>foo</p></div></td></tr></tbody></table>
19296 <p>ok</p>
19297 !!end
19298
19299 !!test
19300 7. Encapsulate foster-parented transclusion content
19301 !!options
19302 parsoid=wt2wt,wt2html
19303 !! wikitext
19304 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19305 !! html
19306 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19307 <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;
19308 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19309 <td>bar</td></table>&quot;]}">foo</p>
19310 <table>
19311 <tbody>
19312 <tr>
19313 <td>bar</td></tr></tbody></table>
19314 !!end
19315
19316 !!test
19317 8. Encapsulate foster-parented transclusion content
19318 !!options
19319 parsoid=wt2wt,wt2html
19320 !! wikitext
19321 {{echo|a
19322 }}{|{{echo|style='color:red'}}
19323 |-
19324 |b
19325 |}
19326 !! html
19327 <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>
19328 <table>
19329 <tbody>
19330 <tr>
19331 <td>b</td></tr></tbody></table>
19332 !!end
19333
19334 !!test
19335 Table in fosterable position
19336 !!options
19337 parsoid=wt2html,wt2wt
19338 !! wikitext
19339 {{OpenTable}}
19340 <div>
19341 {|
19342 |}
19343 </div>
19344 |}
19345 !! html
19346 <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="{}">
19347 </span>
19348 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19349
19350 <table>
19351 </table>
19352 !!end
19353
19354 !!test
19355 Support <object> element with .data attribute
19356 !!options
19357 parsoid=html2wt
19358 !! wikitext
19359 <object data="test.swf"></object>
19360 !! html
19361 <object data="test.swf"></object>
19362 !!end
19363
19364 # -----------------------------------------------------------------
19365 # The following section of tests are primarily to spec requirements
19366 # around serialization of new/edited content.
19367 #
19368 # All these tests are marked Parsoid html2wt and html2html only
19369 # ----------------------------------------------------------------
19370
19371 !! test
19372 Image: Modifying size of an image (1)
19373 !! options
19374 parsoid=html2wt
19375 !! wikitext
19376 [[Image:Foobar.jpg|200x200px]]
19377 !! html
19378 <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>
19379 !!end
19380
19381 !! test
19382 Image: Modifying size of an image (2)
19383 !! options
19384 parsoid=html2wt
19385 !! wikitext
19386 [[Image:Foobar.jpg|500x500px]]
19387 !! html
19388 <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>
19389 !!end
19390
19391 # note that the data-parsoid value conflicts with the figure's class
19392 !! test
19393 Image: Modifying alignment of an image (bug 48665)
19394 !! options
19395 parsoid=html2wt
19396 !! wikitext
19397 [[Image:Foobar.jpg|thumb|caption|left]]
19398 !! html
19399 <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>
19400 !! end
19401
19402 !! test
19403 Image: Modifying valign of an image (bug 49221)
19404 !! options
19405 parsoid=html2wt
19406 !! wikitext
19407 [[File:Foobar.jpg|20px|text-top]]
19408 !! html
19409 <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>
19410 !! end
19411
19412 !! test
19413 Image: Modifying alt attribute of an image (bug 56400)
19414 !! options
19415 parsoid=html2wt
19416 !! wikitext
19417 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19418 !! html
19419 <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>
19420 !!end
19421
19422 !! test
19423 Image: Modifying caption of an image
19424 !! options
19425 parsoid=html2wt
19426 !! wikitext
19427 [[Image:Foobar.jpg|thumb|new caption]]
19428 !! html
19429 <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>
19430 !!end
19431
19432 !! test
19433 Image: empty alt attribute (bug 48924)
19434 !! options
19435 parsoid
19436 !! wikitext
19437 [[File:Foobar.jpg|thumb|alt=|bar]]
19438 !! html
19439 <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>
19440 !! end
19441
19442 #!! test
19443 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19444 #!! options
19445 #parsoid=html2wt
19446 #language=ar
19447 #!! input
19448 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19449 #!! result
19450 #<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>
19451 #!! end
19452
19453 !! test
19454 Image: Block level image should have \n before and after
19455 !! options
19456 parsoid
19457 !! wikitext
19458 123
19459 [[File:Foobar.jpg|right|thumb|150x150px]]
19460 456
19461 !! html
19462 <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>
19463 !!end
19464
19465 !! test
19466 Image: New block level image should have \n before and after (existing
19467 content)
19468 !! options
19469 parsoid
19470 !! wikitext
19471 123
19472 [[File:Foobar.jpg|right|thumb|150x150px]]
19473 456
19474 !! html
19475 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19476 <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>
19477 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19478 !!end
19479
19480 !! test
19481 Images: upright option (parsoid)
19482 !! options
19483 parsoid
19484 !! wikitext
19485 [[File:Foobar.jpg|thumb|upright|caption]]
19486 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19487 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19488 !! html
19489 <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>
19490 !!end
19491
19492 !! test
19493 Images: upright option is ignored on inline and frame images (parsoid)
19494 !! options
19495 parsoid
19496 !! wikitext
19497 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19498 !! html
19499 <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>
19500 !!end
19501
19502 !! test
19503 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19504 !! options
19505 parsoid=html2wt
19506 !! wikitext
19507 * foo
19508 !! html
19509 <ul>
19510 <li><p>foo</p></li>
19511 </ul>
19512 !! end
19513
19514 !! test
19515 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19516 !! options
19517 parsoid=html2wt
19518 !! wikitext
19519 * foo
19520 !! html
19521 <ul> <li>foo</li></ul>
19522 !! end
19523
19524 !! test
19525 Don't strip leading whitespace when handling indent-pre suppressing tags
19526 !! options
19527 parsoid=html2wt
19528 !! wikitext
19529 {|
19530 | indented row
19531 |}
19532 <blockquote>
19533 '''This is very bold of you!'''
19534
19535 {|
19536 |
19537 indented cell (no pre-wrapping!)
19538 |}
19539 </blockquote>
19540 foo
19541 <div>bar</div>
19542 !! html
19543 <table>
19544 <tr><td> indented row</td></tr>
19545 </table>
19546 <blockquote><p>
19547 <b>This is very bold of you!</b>
19548 </p>
19549 <table><tr><td>
19550 indented cell (no pre-wrapping!)
19551 </td></tr></table>
19552 </blockquote>
19553 <p>foo</p>
19554 <div>bar</div>
19555 !! end
19556
19557 !! test
19558 Strip leading whitespace when handling indent-pre inducing tags
19559 !! options
19560 parsoid=html2wt
19561 !! wikitext
19562 foo
19563 <span>bar</span>
19564
19565 <span>foo2
19566 </span>bar2
19567
19568 <div>foo</div>
19569 <span>bar</span>
19570
19571 <div>
19572 <span>foo</span>
19573 </div>
19574 !! html
19575 <p>foo</p>
19576 <span>bar</span>
19577
19578 <span>foo2
19579 </span>bar2
19580
19581 <div>foo</div>
19582 <span>bar</span>
19583
19584 <div>
19585 <span>foo</span>
19586 </div>
19587 !! end
19588
19589 !! test
19590 Lists: Add space after bullets
19591 !! options
19592 parsoid=html2wt
19593 !! wikitext
19594 * foo
19595 * bar
19596 * <span> baz</span>
19597 !! html
19598 <ul>
19599 <li>foo</li>
19600 <li> bar</li>
19601 <li><span> baz</span></li>
19602 </ul>
19603 !! end
19604
19605 !! test
19606 Lists: Dont insert newlines in a serialized list item.
19607 !! options
19608 parsoid=html2wt
19609 !! wikitext
19610 * a<br>b
19611 * c
19612 !! html
19613 <ul><li>a<br>b</li><li>c</li></ul>
19614 !! end
19615
19616 !! test
19617 Headings: Add space before/after == (Bug 51744)
19618 !! options
19619 parsoid=html2wt
19620 !! wikitext
19621 == foo ==
19622
19623 == bar ==
19624
19625 == baz ==
19626
19627 == <span> baz</span> ==
19628 !! html
19629 <h2>foo</h2>
19630 <h2> bar</h2>
19631 <h2>baz </h2>
19632 <h2><span> baz</span></h2>
19633 !! end
19634
19635 !! test
19636 Parsoid: Serialize positional parameters with = in them as named parameter
19637 !! options
19638 parsoid=html2wt
19639 !! wikitext
19640 {{echo|1 = f=oo}}
19641
19642 {{echo|1 = f=oo|2 = bar}}
19643
19644 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19645 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19646 {{echo|<nowiki>f=oo</nowiki>|bar}}
19647 !! html
19648 <p about="#mwt1" typeof="mw:Transclusion"
19649 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19650
19651 <p about="#mwt1" typeof="mw:Transclusion"
19652 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19653
19654 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19655 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19656 <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>
19657 !! end
19658
19659 !! test
19660 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19661 !! options
19662 parsoid=html2wt
19663 !! wikitext
19664 <div>a
19665 b
19666 </div>
19667 <div>a
19668 b
19669 </div>
19670 <div>
19671 a
19672
19673 b
19674 </div>
19675 !! html
19676 <div>a<p>b</p></div>
19677 <div>a
19678 <p>b</p></div>
19679 <div>
19680 a
19681 <p>b</p></div>
19682 !! end
19683
19684 #-----------------------------
19685 # I/B quote minimization tests
19686 #-----------------------------
19687
19688 !! test
19689 1. I/B quote minimization: wikitext-only tags should be combined
19690 !! options
19691 parsoid=html2wt
19692 !! wikitext
19693 ''AB''
19694
19695 '''AB'''
19696
19697 ''A'''B'''''
19698
19699 '''A''B'''''
19700
19701 '''A''BC''D'''
19702
19703 '''''AB'''''
19704
19705 '''''AB'''''
19706
19707 '''''AB'''''
19708 !! html
19709 <p><i>A</i><i>B</i></p>
19710 <p><b>A</b><b>B</b></p>
19711 <p><i>A</i><b><i>B</i></b></p>
19712 <p><b>A</b><i><b>B</b></i></p>
19713 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19714 <p><i><b>A</b></i><i><b>B</b></i></p>
19715 <p><i><b>A</b></i><b><i>B</i></b></p>
19716 <p><b><i>A</i></b><i><b>B</b></i></p>
19717 !! end
19718
19719 !! test
19720 2. I/B quote minimization: wikitext and html tags should not be combined
19721 !! options
19722 parsoid=html2wt
19723 !! wikitext
19724 ''A''<i>B</i>
19725
19726 ''A'''''<i>B</i>'''
19727 !! html
19728 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19729 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19730 !! end
19731
19732 !! test
19733 3. I/B quote minimization: templated content stops minimization
19734 !! options
19735 parsoid=html2wt
19736 !! wikitext
19737 ''A''{{echo|''B''}}
19738
19739 ''A''{{echo|'''''B'''''}}
19740 !! html
19741 <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>
19742 <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>
19743 !! end
19744
19745 !! test
19746 4. I/B quote minimization: new content should be mimimized with adjacent old content
19747 !! options
19748 parsoid=html2wt
19749 !! wikitext
19750 ''AB''
19751
19752 '''AB'''
19753
19754 ''A'''B'''''
19755 !! html
19756 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19757 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19758 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19759 !! end
19760
19761 #------------------------------------
19762 # End of I/B quote minimization tests
19763 #------------------------------------
19764
19765 !!test
19766 Bug 54262: New entities
19767 !! options
19768 parsoid=html2wt
19769 !! wikitext
19770 foo
19771 !! html
19772 <span typeof="mw:Entity">foo</span>
19773 !! end
19774
19775 ## Note that there is no wikitext output for 'unknownproperty' ##
19776 ## Unknown magic words are silently dropped ##
19777
19778 !! test
19779 Magic words
19780 !! options
19781 parsoid=html2wt
19782 !! wikitext
19783 __TOC__
19784 __NOTOC__
19785 __FORCETOC__
19786 __INDEX__
19787 __NOINDEX__
19788 __NOGALLERY__
19789 __NOEDITSECTION__
19790 __NOTITLECONVERT__
19791 __NOCONTENTCONVERT__
19792 !! html
19793 <meta property='mw:PageProp/toc' />
19794 <meta property='mw:PageProp/notoc' />
19795 <meta property='mw:PageProp/forcetoc' />
19796 <meta property='mw:PageProp/index' />
19797 <meta property='mw:PageProp/noindex' />
19798 <meta property='mw:PageProp/nogallery' />
19799 <meta property='mw:PageProp/noeditsection' />
19800 <meta property='mw:PageProp/notitleconvert' />
19801 <meta property='mw:PageProp/nocontentconvert' />
19802 <meta property='mw:PageProp/unknownproperty' />
19803 !! end
19804
19805 !! test
19806 Consecutive <pre>s should not get merged
19807 !! options
19808 parsoid=html2wt,html2html
19809 !! wikitext
19810 a
19811
19812 b
19813
19814 c
19815
19816 d
19817
19818 e
19819
19820
19821
19822 f
19823 !! html
19824 <pre>a</pre><pre>b</pre>
19825
19826 <pre>c
19827 </pre><pre>
19828 d</pre>
19829
19830 <pre>e
19831
19832 </pre><pre>
19833
19834 f</pre>
19835 !! end
19836
19837 !! test
19838 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
19839 !! options
19840 parsoid=html2wt
19841 !! wikitext
19842 [[Special:BookSources/1234567890|ISBN 1234567895]]
19843 !! html
19844 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
19845 !! end
19846
19847 !! test
19848 Edited RFC links not serializable as RFC links should serialize as extlinks
19849 !! options
19850 parsoid=html2wt
19851 !! wikitext
19852 [//tools.ietf.org/html/rfc123 New RFC]
19853 !! html
19854 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
19855 !! end
19856
19857 !! test
19858 Edited PMID links not serializable as PMID links should serialize as extlinks
19859 !! options
19860 parsoid=html2wt
19861 !! wikitext
19862 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
19863 !! html
19864 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
19865 !! end
19866
19867 !! test
19868 Edited Redirect link should emit a non-piped wikitext link
19869 !! options
19870 parsoid=html2wt
19871 !! wikitext
19872 #REDIRECT [[Bar]]
19873 !! html
19874 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
19875 !! end
19876
19877 # -----------------------------------------------------------------
19878 # End of section for Parsoid-only html2wt tests for serialization
19879 # of new content
19880 # -----------------------------------------------------------------
19881
19882 TODO:
19883 more images
19884 more tables
19885 character entities
19886 and much more
19887 Try for 100% code coverage