Merge "Fix wording of protect-cascadeon"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 # notoc disable table of contents
30 #
31 # You can also set the following parser properties via test options:
32 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
33 # wgLinkHolderBatchSize, wgRawHtml
34 #
35 # For testing purposes, temporary articles can created:
36 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
37 # where '/' denotes a newline.
38
39 # This is the standard article assumed to exist.
40 !! article
41 Main Page
42 !! text
43 blah blah
44 !! endarticle
45
46 !!article
47 Template:Foo
48 !!text
49 FOO
50 !!endarticle
51
52 !! article
53 Template:Blank
54 !! text
55 !! endarticle
56
57 !! article
58 Template:pipe
59 !! text
60 |
61 !! endarticle
62
63 !!article
64 MediaWiki:bad image list
65 !!text
66 * [[File:Bad.jpg]] except [[Nasty page]]
67 !!endarticle
68
69 !! article
70 Template:inner list
71 !! text
72 * item 1
73 !! endarticle
74
75 !! article
76 Template:tbl-start
77 !! text
78 {|
79 !! endarticle
80
81 !! article
82 Template:tbl-end
83 !! text
84 |}
85 !! endarticle
86
87 !! article
88 Template:!
89 !! text
90 |
91 !! endarticle
92
93 !! article
94 Template:echo
95 !! text
96 {{{1}}}
97 !! endarticle
98
99 !! article
100 Template:echo_with_span
101 !! text
102 <span>{{{1}}}</span>
103 !! endarticle
104
105 !! article
106 Template:echo_with_div
107 !! text
108 <div>{{{1}}}</div>
109 !! endarticle
110
111 !! article
112 Template:attr_str
113 !! text
114 {{{1}}}="{{{2}}}"
115 !! endarticle
116
117 !! article
118 Template:table_attribs
119 !! text
120 <noinclude>
121 |</noinclude>style="color: red"| Foo
122 !! endarticle
123
124 !! article
125 Template:table_cells
126 !! text
127 {{table_attribs}} || Bar || Baz
128 !! endarticle
129
130 !! article
131 Template:image_attribs
132 !! text
133 <noinclude>
134 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
135 !! endarticle
136
137 !! article
138 A?b
139 !! text
140 Weirdo titles!
141 !! endarticle
142
143 !!article
144 Template:Bullet
145 !!text
146 * Bar
147 !!endarticle
148
149 !!article
150 Template:OpenTable
151 !!text
152 {|
153 !!endarticle
154
155 ###
156 ### Basic tests
157 ###
158 !! test
159 Blank input
160 !! wikitext
161 !! html
162 !! end
163
164
165 !! test
166 Simple paragraph
167 !! wikitext
168 This is a simple paragraph.
169 !! html
170 <p>This is a simple paragraph.
171 </p>
172 !! end
173
174 !! test
175 Paragraphs with extra newline spacing
176 !! wikitext
177 foo
178
179 bar
180
181
182 baz
183
184
185
186 booz
187 !! html
188 <p>foo
189 </p><p>bar
190 </p><p><br />
191 baz
192 </p><p><br />
193 </p><p>booz
194 </p>
195 !! end
196
197 !! test
198 Paragraphs with newline spacing with comment lines in between
199 !! wikitext
200 ----
201 a
202 <!--foo-->
203 b
204 ----
205 a
206 <!--foo--><!--More than 1 comment, still stripped-->
207 b
208 ----
209 a
210 <!--foo--> <!----> <!-- bar -->
211 b
212 ----
213 a
214 <!--foo-->
215
216 b
217 ----
218 a
219
220 <!--foo-->
221 b
222 ----
223 a
224 <!--foo-->
225
226
227 b
228 ----
229 a
230
231
232 <!--foo-->
233 b
234 ----
235 !! html
236 <hr />
237 <p>a
238 b
239 </p>
240 <hr />
241 <p>a
242 b
243 </p>
244 <hr />
245 <p>a
246 b
247 </p>
248 <hr />
249 <p>a
250 </p><p>b
251 </p>
252 <hr />
253 <p>a
254 </p><p>b
255 </p>
256 <hr />
257 <p>a
258 </p><p><br />
259 b
260 </p>
261 <hr />
262 <p>a
263 </p><p><br />
264 b
265 </p>
266 <hr />
267
268 !! end
269
270 !! test
271 Paragraphs with newline spacing with non-empty white-space lines in between
272 !! wikitext
273 ----
274 a
275
276 b
277 ----
278 a
279
280
281 b
282 ----
283 !! html
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p><br />
291 b
292 </p>
293 <hr />
294
295 !! end
296
297 !! test
298 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
299 !! wikitext
300 ----
301 a
302 <!--foo-->
303 b
304 ----
305 a
306 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
307 b
308 ----
309 a
310
311 <!--foo-->
312 <!--bar-->
313 b
314 ----
315 a
316
317 <!--foo-->
318 <!--bar-->
319
320 b
321 ----
322 !! html
323 <hr />
324 <p>a
325 b
326 </p>
327 <hr />
328 <p>a
329 b
330 </p>
331 <hr />
332 <p>a
333 </p><p>b
334 </p>
335 <hr />
336 <p>a
337 </p><p><br />
338 b
339 </p>
340 <hr />
341
342 !! end
343
344 !! test
345 Extra newlines: More paragraphs with indented comment
346 !! wikitext
347 a
348
349 <!--boo-->
350
351 b
352 !! html
353 <p>a
354 </p><p><br />
355 b
356 </p>
357 !!end
358
359 !! test
360 Extra newlines followed by heading
361 !! wikitext
362 a
363
364
365
366 =b=
367 [[a]]
368
369
370 =b=
371 !! html
372 <p>a
373 </p><p><br />
374 </p>
375 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
376 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
377 </p><p><br />
378 </p>
379 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
380
381 !! end
382
383 !! test
384 Extra newlines between heading and content are swallowed
385 !! wikitext
386 =b=
387
388
389
390 [[a]]
391 !! html
392 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
393 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
394 </p>
395 !! end
396
397 !! test
398 Parsing an URL
399 !! wikitext
400 http://fr.wikipedia.org/wiki/🍺
401 <!-- EasterEgg we love beer, better be able be able to link to it -->
402 !! html
403 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
404 </p>
405 !! end
406
407 !! test
408 Simple list
409 !! wikitext
410 * Item 1
411 * Item 2
412 !! html
413 <ul>
414 <li> Item 1
415 </li>
416 <li> Item 2
417 </li>
418 </ul>
419
420 !! end
421
422 !! test
423 Italics and bold
424 !! wikitext
425 * plain
426 * plain''italic''plain
427 * plain''italic''plain''italic''plain
428 * plain'''bold'''plain
429 * plain'''bold'''plain'''bold'''plain
430 * plain''italic''plain'''bold'''plain
431 * plain'''bold'''plain''italic''plain
432 * plain''italic'''bold-italic'''italic''plain
433 * plain'''bold''bold-italic''bold'''plain
434 * plain'''''bold-italic'''italic''plain
435 * plain'''''bold-italic''bold'''plain
436 * plain''italic'''bold-italic'''''plain
437 * plain'''bold''bold-italic'''''plain
438 * plain l'''italic''plain
439 * plain l''''bold''' plain
440 !! html
441 <ul>
442 <li> plain
443 </li>
444 <li> plain<i>italic</i>plain
445 </li>
446 <li> plain<i>italic</i>plain<i>italic</i>plain
447 </li>
448 <li> plain<b>bold</b>plain
449 </li>
450 <li> plain<b>bold</b>plain<b>bold</b>plain
451 </li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain
453 </li>
454 <li> plain<b>bold</b>plain<i>italic</i>plain
455 </li>
456 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
457 </li>
458 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
459 </li>
460 <li> plain<i><b>bold-italic</b>italic</i>plain
461 </li>
462 <li> plain<b><i>bold-italic</i>bold</b>plain
463 </li>
464 <li> plain<i>italic<b>bold-italic</b></i>plain
465 </li>
466 <li> plain<b>bold<i>bold-italic</i></b>plain
467 </li>
468 <li> plain l'<i>italic</i>plain
469 </li>
470 <li> plain l'<b>bold</b> plain
471 </li>
472 </ul>
473
474 !! end
475
476 # this example taken from the [[simple:Moon]] article (bug 47326)
477 !! test
478 Italics and possessives (1)
479 !! wikitext
480 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
481 !! html
482 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
483 </p>
484 !! end
485
486 # this example taken from [[en:Flaming Pie]] (bug 49926)
487 !! test
488 Italics and possessives (2)
489 !! wikitext
490 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
491 !! html
492 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
493 </p>
494 !! end
495
496 # this example taken from [[en:Dictionary]] (bug 49926)
497 !! test
498 Italics and possessives (3)
499 !! wikitext
500 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
501 !! html
502 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
503 </p>
504 !! end
505
506
507 ###
508 ### 2-quote opening sequence tests
509 ###
510 !! test
511 Italics and bold: 2-quote opening sequence: (2,2)
512 !! wikitext
513 ''foo''
514 !! html
515 <p><i>foo</i>
516 </p>
517 !!end
518
519
520 !! test
521 Italics and bold: 2-quote opening sequence: (2,3)
522 !! wikitext
523 ''foo'''
524 !! html
525 <p><i>foo'</i>
526 </p>
527 !!end
528
529
530 !! test
531 Italics and bold: 2-quote opening sequence: (2,4)
532 !! wikitext
533 ''foo''''
534 !! html
535 <p><i>foo''</i>
536 </p>
537 !!end
538
539
540 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
541 !! test
542 Italics and bold: 2-quote opening sequence: (2,5)
543 !! wikitext
544 ''foo'''''
545 !! html/php
546 <p><i>foo</i>
547 </p>
548 !! html/parsoid
549 <p><i>foo</i><b></b>
550 </p>
551 !!end
552
553
554 ###
555 ### 3-quote opening sequence tests
556 ###
557
558 !! test
559 Italics and bold: 3-quote opening sequence: (3,2)
560 !! wikitext
561 '''foo''
562 !! html
563 <p>'<i>foo</i>
564 </p>
565 !!end
566
567
568 !! test
569 Italics and bold: 3-quote opening sequence: (3,3)
570 !! wikitext
571 '''foo'''
572 !! html
573 <p><b>foo</b>
574 </p>
575 !!end
576
577
578 !! test
579 Italics and bold: 3-quote opening sequence: (3,4)
580 !! wikitext
581 '''foo''''
582 !! html
583 <p><b>foo'</b>
584 </p>
585 !!end
586
587
588 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
589 !! test
590 Italics and bold: 3-quote opening sequence: (3,5)
591 !! wikitext
592 '''foo'''''
593 !! html/php
594 <p><b>foo</b>
595 </p>
596 !! html/parsoid
597 <p><b>foo</b><i></i>
598 </p>
599 !!end
600
601
602 ###
603 ### 4-quote opening sequence tests
604 ###
605
606 !! test
607 Italics and bold: 4-quote opening sequence: (4,2)
608 !! wikitext
609 ''''foo''
610 !! html
611 <p>''<i>foo</i>
612 </p>
613 !!end
614
615
616 !! test
617 Italics and bold: 4-quote opening sequence: (4,3)
618 !! wikitext
619 ''''foo'''
620 !! html
621 <p>'<b>foo</b>
622 </p>
623 !!end
624
625
626 !! test
627 Italics and bold: 4-quote opening sequence: (4,4)
628 !! wikitext
629 ''''foo''''
630 !! html
631 <p>'<b>foo'</b>
632 </p>
633 !!end
634
635
636 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
637 !! test
638 Italics and bold: 4-quote opening sequence: (4,5)
639 !! wikitext
640 ''''foo'''''
641 !! html/php
642 <p>'<b>foo</b>
643 </p>
644 !! html/parsoid
645 <p>'<b>foo</b><i></i>
646 </p>
647 !!end
648
649
650 ###
651 ### 5-quote opening sequence tests
652 ###
653
654 !! test
655 Italics and bold: 5-quote opening sequence: (5,2)
656 !! options
657 !! wikitext
658 '''''foo''
659 !! html
660 <p><b><i>foo</i></b>
661 </p>
662 !!end
663
664
665 !! test
666 Italics and bold: 5-quote opening sequence: (5,3)
667 !! wikitext
668 '''''foo'''
669 !! html
670 <p><i><b>foo</b></i>
671 </p>
672 !!end
673
674
675 !! test
676 Italics and bold: 5-quote opening sequence: (5,4)
677 !! wikitext
678 '''''foo''''
679 !! html
680 <p><i><b>foo'</b></i>
681 </p>
682 !!end
683
684
685 !! test
686 Italics and bold: 5-quote opening sequence: (5,5)
687 !! wikitext
688 '''''foo'''''
689 !! html
690 <p><i><b>foo</b></i>
691 </p>
692 !!end
693
694 ###
695 ### multiple quote sequences in a line
696 ###
697 !! test
698 Italics and bold: multiple quote sequences: (2,4,2)
699 !! wikitext
700 ''foo''''bar''
701 !! html
702 <p><i>foo'<b>bar</b></i>
703 </p>
704 !!end
705
706
707 !! test
708 Italics and bold: multiple quote sequences: (2,4,3)
709 !! wikitext
710 ''foo''''bar'''
711 !! html
712 <p><i>foo'<b>bar</b></i>
713 </p>
714 !!end
715
716
717 !! test
718 Italics and bold: multiple quote sequences: (2,4,4)
719 !! wikitext
720 ''foo''''bar''''
721 !! html
722 <p><i>foo'<b>bar'</b></i>
723 </p>
724 !!end
725
726
727 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,2)
730 !! wikitext
731 '''foo''''bar''
732 !! html/php
733 <p><b>foo'</b>bar
734 </p>
735 !! html/parsoid
736 <p><b>foo'</b>bar<i></i>
737 </p>
738 !!end
739
740
741 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
742 !! test
743 Italics and bold: multiple quote sequences: (3,4,3)
744 !! wikitext
745 '''foo''''bar'''
746 !! html/php
747 <p><b>foo'</b>bar
748 </p>
749 !! html/parsoid
750 <p><b>foo'</b>bar<b></b>
751 </p>
752 !!end
753
754 ###
755 ### other quote tests
756 ###
757 !! test
758 Italics and bold: other quote tests: (2,3,5)
759 !! wikitext
760 ''this is about '''foo's family'''''
761 !! html
762 <p><i>this is about <b>foo's family</b></i>
763 </p>
764 !!end
765
766
767 !! test
768 Italics and bold: other quote tests: (2,(3,3),2)
769 !! wikitext
770 ''this is about '''foo's''' family''
771 !! html
772 <p><i>this is about <b>foo's</b> family</i>
773 </p>
774 !!end
775
776
777 !! test
778 Italics and bold: other quote tests: (3,2,3,2)
779 !! wikitext
780 '''this is about ''foo'''s family''
781 !! html
782 <p><b>this is about <i>foo</i></b><i>s family</i>
783 </p>
784 !!end
785
786
787 !! test
788 Italics and bold: other quote tests: (3,2,3,3)
789 !! options
790 !! wikitext
791 '''this is about ''foo'''s family'''
792 !! html
793 <p>'<i>this is about </i>foo<b>s family</b>
794 </p>
795 !!end
796
797
798 !! test
799 Italics and bold: other quote tests: (3,(2,2),3)
800 !! wikitext
801 '''this is about ''foo's'' family'''
802 !! html
803 <p><b>this is about <i>foo's</i> family</b>
804 </p>
805 !!end
806
807
808 !! test
809 Italicized possessive
810 !! wikitext
811 The ''[[Main Page]]'''s talk page.
812 !! html
813 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
814 </p>
815 !! end
816
817 !! test
818 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
819 (Requires tidy for PHP parser output to be fixed up)
820 !! options
821 parsoid=wt2html,wt2wt
822 !! wikitext
823 {|
824 !''a!!''b
825 |''a||''b
826 |}
827 !! html
828 <table>
829 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
830 <td><i>a</i></td><td><i>b</i></td></tr>
831 </tbody></table>
832 !! end
833
834 ###
835 ### Non-html5 tags
836 ###
837
838 !! test
839 Non-html5 tags should be accepted
840 !! wikitext
841 <center>''foo''</center>
842 <big>''foo''</big>
843 <font>''foo''</font>
844 <strike>''foo''</strike>
845 <tt>''foo''</tt>
846 !! html
847 <center><i>foo</i></center>
848 <p><big><i>foo</i></big>
849 <font><i>foo</i></font>
850 <strike><i>foo</i></strike>
851 <tt><i>foo</i></tt>
852 </p>
853 !! end
854
855 !! test
856 <wbr> is valid wikitext (bug 52468)
857 !! wikitext
858 <wbr>
859 !! html
860 <p><wbr />
861 </p>
862 !! end
863
864 # <strike> is HTML4, <s> is HTML4/5.
865 !! test
866 <s> or <strike> for strikethrough
867 !! wikitext
868 <strike>strike</strike>
869
870 <s>s</s>
871 !! html
872 <p><strike>strike</strike>
873 </p><p><s>s</s>
874 </p>
875 !! end
876
877 !! test
878 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
879 !! wikitext
880 <b→> doesn't work! </b→>
881
882 <bä> doesn't work! </bä>
883
884 <boo> works fine </boo>
885
886 <s.foo>s.foo</s.foo>
887
888 <sub-ID#1>
889 !! html
890 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
891 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
892 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
893 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
894 </p><p>&lt;sub-ID#1&gt;
895 </p>
896 !! end
897
898 !! test
899 Isolated close tags should be treated as literal text (bug 52760)
900 !! wikitext
901 </b>
902
903 <s.foo>s</s>
904 !! html
905 <p>&lt;/b&gt;
906 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
907 </p>
908 !! end
909
910 ###
911 ### Special characters
912 ###
913
914 !! test
915 Bare pipe character (bug 52363)
916 !! wikitext
917 |
918 !! html
919 <p>|
920 </p>
921 !! end
922
923 !! test
924 Bare pipe character from a template (bug 52363)
925 !! wikitext
926 {{pipe}}
927 !! html
928 <p>|
929 </p>
930 !! end
931
932 ###
933 ### <nowiki> test cases
934 ###
935
936 !! test
937 <nowiki> unordered list
938 !! wikitext
939 <nowiki>* This is not an unordered list item.</nowiki>
940 !! html
941 <p>* This is not an unordered list item.
942 </p>
943 !! end
944
945 !! test
946 <nowiki> spacing
947 !! wikitext
948 <nowiki>Lorem ipsum dolor
949
950 sed abit.
951 sed nullum.
952
953 :and a colon
954 </nowiki>
955 !! html
956 <p>Lorem ipsum dolor
957
958 sed abit.
959 sed nullum.
960
961 :and a colon
962
963 </p>
964 !! end
965
966 !! test
967 nowiki 3
968 !! wikitext
969 :There is not nowiki.
970 :There is <nowiki>nowiki</nowiki>.
971
972 #There is not nowiki.
973 #There is <nowiki>nowiki</nowiki>.
974
975 *There is not nowiki.
976 *There is <nowiki>nowiki</nowiki>.
977 !! html
978 <dl>
979 <dd>There is not nowiki.
980 </dd>
981 <dd>There is nowiki.
982 </dd>
983 </dl>
984 <ol>
985 <li>There is not nowiki.
986 </li>
987 <li>There is nowiki.
988 </li>
989 </ol>
990 <ul>
991 <li>There is not nowiki.
992 </li>
993 <li>There is nowiki.
994 </li>
995 </ul>
996
997 !! end
998
999 !! test
1000 Entities inside <nowiki>
1001 !! wikitext
1002 <nowiki>&lt;</nowiki>
1003 !! html
1004 <p>&lt;
1005 </p>
1006 !! end
1007
1008 !! test
1009 Entities inside template parameters
1010 !! options
1011 parsoid
1012 !! wikitext
1013 {{echo|&ndash;}}
1014 !! html
1015 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span>
1016 </p>
1017 !! end
1018
1019 ###
1020 ### Comments
1021 ###
1022 !! test
1023 Comments and Indent-Pre
1024 !! wikitext
1025 <!-- comment 1 --> asdf
1026
1027 <!-- comment 1 --> asdf
1028 <!-- comment 2 -->
1029
1030 <!-- comment 1 --> asdf
1031 <!-- comment 2 -->xyz
1032
1033 <!-- comment 1 --> asdf
1034 <!-- comment 2 --> xyz
1035 !! html
1036 <pre>asdf
1037 </pre>
1038 <pre>asdf
1039 </pre>
1040 <pre>asdf
1041 </pre>
1042 <p>xyz
1043 </p>
1044 <pre>asdf
1045 xyz
1046 </pre>
1047 !! end
1048
1049 !! test
1050 Comment test 2a
1051 !! wikitext
1052 asdf
1053 <!-- comment 1 -->
1054 jkl
1055 !! html
1056 <p>asdf
1057 jkl
1058 </p>
1059 !! end
1060
1061 !! test
1062 Comment test 2b
1063 !! wikitext
1064 asdf
1065 <!-- comment 1 -->
1066
1067 jkl
1068 !! html
1069 <p>asdf
1070 </p><p>jkl
1071 </p>
1072 !! end
1073
1074 !! test
1075 Comment test 3
1076 !! wikitext
1077 asdf
1078 <!-- comment 1 -->
1079 <!-- comment 2 -->
1080 jkl
1081 !! html
1082 <p>asdf
1083 jkl
1084 </p>
1085 !! end
1086
1087 !! test
1088 Comment test 4
1089 !! wikitext
1090 asdf<!-- comment 1 -->jkl
1091 !! html
1092 <p>asdfjkl
1093 </p>
1094 !! end
1095
1096 !! test
1097 Comment spacing
1098 !! wikitext
1099 a
1100 <!-- foo --> b <!-- bar -->
1101 c
1102 !! html
1103 <p>a
1104 </p>
1105 <pre> b
1106 </pre>
1107 <p>c
1108 </p>
1109 !! end
1110
1111 !! test
1112 Comment whitespace
1113 !! wikitext
1114 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1115 !! html
1116
1117 !! end
1118
1119 !! test
1120 Comment semantics and delimiters
1121 !! wikitext
1122 <!-- --><!----><!-----><!------>
1123 !! html
1124
1125 !! end
1126
1127 !! test
1128 Comment semantics and delimiters, redux
1129 !! wikitext
1130 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1131 -- foo -- funky huh? ... -->
1132 !! html
1133
1134 !! end
1135
1136 !! test
1137 Comment semantics and delimiters: directors cut
1138 !! wikitext
1139 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1140 everything starting with < followed by !-- until the first -- and > we see,
1141 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1142 -->-->
1143 !! html
1144 <p>--&gt;
1145 </p>
1146 !! end
1147
1148 !! test
1149 Comment semantics: nesting
1150 !! wikitext
1151 <!--<!-- no, we're not going to do anything fancy here -->-->
1152 !! html
1153 <p>--&gt;
1154 </p>
1155 !! end
1156
1157 !! test
1158 Comment semantics: unclosed comment at end
1159 !! wikitext
1160 <!--This comment will run out to the end of the document
1161 !! html
1162
1163 !! end
1164
1165 !! test
1166 Comment in template title
1167 !! wikitext
1168 {{f<!---->oo}}
1169 !! html
1170 <p>FOO
1171 </p>
1172 !! end
1173
1174 !! test
1175 Comment on its own line post-expand
1176 !! wikitext
1177 a
1178 {{blank}}<!---->
1179 b
1180 !! html
1181 <p>a
1182 </p><p>b
1183 </p>
1184 !! end
1185
1186 !! test
1187 Comment on its own line post-expand with non-significant whitespace
1188 !! wikitext
1189 a
1190 {{blank}} <!---->
1191 b
1192 !! html
1193 <p>a
1194 </p><p>b
1195 </p>
1196 !! end
1197
1198 ###
1199 ### paragraph wrapping tests
1200 ###
1201 !! test
1202 No block tags
1203 !! wikitext
1204 a
1205
1206 b
1207 !! html
1208 <p>a
1209 </p><p>b
1210 </p>
1211 !! end
1212
1213 !! test
1214 Block tag on one line (<div>)
1215 !! wikitext
1216 a <div>foo</div>
1217
1218 b
1219 !! html
1220 a <div>foo</div>
1221 <p>b
1222 </p>
1223 !! end
1224
1225 !! test
1226 Block tag on one line (<blockquote>)
1227 !! wikitext
1228 a <blockquote>foo</blockquote>
1229
1230 b
1231 !! html
1232 a <blockquote>foo</blockquote>
1233 <p>b
1234 </p>
1235 !! end
1236
1237 !! test
1238 Block tag on both lines (<div>)
1239 !! wikitext
1240 a <div>foo</div>
1241
1242 b <div>foo</div>
1243 !! html
1244 a <div>foo</div>
1245 b <div>foo</div>
1246
1247 !! end
1248
1249 !! test
1250 Block tag on both lines (<blockquote>)
1251 !! wikitext
1252 a <blockquote>foo</blockquote>
1253
1254 b <blockquote>foo</blockquote>
1255 !! html
1256 a <blockquote>foo</blockquote>
1257 b <blockquote>foo</blockquote>
1258
1259 !! end
1260
1261 !! test
1262 Multiple lines without block tags
1263 !! wikitext
1264 <div>foo</div> a
1265 b
1266 c
1267 d<!--foo--> e
1268 x <div>foo</div> z
1269 !! html
1270 <div>foo</div> a
1271 <p>b
1272 c
1273 d e
1274 </p>
1275 x <div>foo</div> z
1276
1277 !! end
1278
1279 !! test
1280 Empty lines between lines with block tags
1281 !! wikitext
1282 <div></div>
1283
1284
1285 <div></div>a
1286
1287 b
1288 <div>a</div>b
1289
1290 <div>b</div>d
1291
1292
1293 <div>e</div>
1294 !! html
1295 <div></div>
1296 <p><br />
1297 </p>
1298 <div></div>a
1299 <p>b
1300 </p>
1301 <div>a</div>b
1302 <div>b</div>d
1303 <p><br />
1304 </p>
1305 <div>e</div>
1306
1307 !! end
1308
1309 ## PHP parser emits output which is broken
1310 !! test
1311 Unclosed HTML p-tags should be handled properly
1312 !! wikitext
1313 <div><p>foo</div>
1314 a
1315
1316 b
1317 !! html/parsoid
1318 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1319 <p>a</p>
1320 <p>b</p>
1321 !! end
1322
1323 ###
1324 ### Preformatted text
1325 ###
1326 !! test
1327 Preformatted text
1328 !! wikitext
1329 This is some
1330 Preformatted text
1331 With ''italic''
1332 And '''bold'''
1333 And a [[Main Page|link]]
1334 !! html
1335 <pre>This is some
1336 Preformatted text
1337 With <i>italic</i>
1338 And <b>bold</b>
1339 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1340 </pre>
1341 !! end
1342
1343 !! test
1344 Tabs don't trigger preformatted text
1345 !! wikitext
1346 This is not
1347 preformatted text.
1348 This is preformatted text.
1349 So is this.
1350 !! html
1351 <p> This is not
1352 preformatted text.
1353 </p>
1354 <pre>This is preformatted text.
1355 So is this.
1356 </pre>
1357 !! end
1358
1359 !! test
1360 Ident preformatting with inline content
1361 !! wikitext
1362 a
1363 ''b''
1364 !! html
1365 <pre>a
1366 <i>b</i>
1367 </pre>
1368 !! end
1369
1370 !! test
1371 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1372 !! wikitext
1373 <pre><nowiki>
1374 <b>
1375 <cite>
1376 <em>
1377 </nowiki></pre>
1378 !! html
1379 <pre>
1380 &lt;b&gt;
1381 &lt;cite&gt;
1382 &lt;em&gt;
1383 </pre>
1384
1385 !! end
1386
1387 !! test
1388 Regression with preformatted in <center>
1389 !! wikitext
1390 <center>
1391 Blah
1392 </center>
1393 !! html
1394 <center>
1395 <pre>Blah
1396 </pre>
1397 </center>
1398
1399 !! end
1400
1401 !! test
1402 Bug 52763: Preformatted in <blockquote>
1403 !! wikitext
1404 <blockquote>
1405 Blah
1406 {|
1407 |
1408 indented cell (no pre-wrapping!)
1409 |}
1410 </blockquote>
1411 !! html
1412 <blockquote>
1413 <p> Blah
1414 </p>
1415 <table>
1416 <tr>
1417 <td>
1418 <p> indented cell (no pre-wrapping!)
1419 </p>
1420 </td></tr></table>
1421 </blockquote>
1422
1423 !! end
1424
1425 !! test
1426 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1427 !! wikitext
1428 <blockquote>
1429 Foo
1430
1431 Bar
1432 </blockquote>
1433 !! html
1434 <blockquote>
1435 <p>Foo
1436 </p><p>Bar
1437 </p>
1438 </blockquote>
1439
1440 !! end
1441
1442 !! test
1443 Bug 15491: <ins>/<del> in blockquote
1444 !! wikitext
1445 <blockquote>
1446 Foo <del>bar</del> <ins>baz</ins> quux
1447 </blockquote>
1448 !! html
1449 <blockquote>
1450 <p>Foo <del>bar</del> <ins>baz</ins> quux
1451 </p>
1452 </blockquote>
1453
1454 !! end
1455
1456 # Note that the p-wrapping is newline sensitive, which could be
1457 # considered a bug: tidy will wrap only the 'Foo' in the example
1458 # below in a <p> tag. (see comment 23-25 of bug #6200)
1459 !! test
1460 Bug 15491: <ins>/<del> in blockquote (2)
1461 !! wikitext
1462 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1463 </blockquote>
1464 !! html
1465 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1466 </blockquote>
1467
1468 !! end
1469
1470 !! test
1471 <pre> with attributes (bug 3202)
1472 !! wikitext
1473 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1474 !! html
1475 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1476
1477 !! end
1478
1479 !! test
1480 <pre> with width attribute (bug 3202)
1481 !! wikitext
1482 <pre width="8">Narrow screen goodies</pre>
1483 !! html
1484 <pre width="8">Narrow screen goodies</pre>
1485
1486 !! end
1487
1488 !! test
1489 <pre> with forbidden attribute (bug 3202)
1490 !! wikitext
1491 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1492 !! html
1493 <pre width="8">Narrow screen goodies</pre>
1494
1495 !! end
1496
1497 !! test
1498 Entities inside <pre>
1499 !! wikitext
1500 <pre>&lt;</pre>
1501 !! html
1502 <pre>&lt;</pre>
1503
1504 !! end
1505
1506 !! test
1507 <pre> with forbidden attribute values (bug 3202)
1508 !! wikitext
1509 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1510 !! html
1511 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1512
1513 !! end
1514
1515 !! test
1516 <nowiki> inside <pre> (bug 13238)
1517 !! wikitext
1518 <pre>
1519 <nowiki>
1520 </pre>
1521 <pre>
1522 <nowiki></nowiki>
1523 </pre>
1524 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1525 !! html
1526 <pre>
1527 &lt;nowiki&gt;
1528 </pre>
1529 <pre>
1530
1531 </pre>
1532 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1533
1534 !! end
1535
1536 !! test
1537 <nowiki> and <pre> preference (first one wins)
1538 !! wikitext
1539 <pre>
1540 <nowiki>
1541 </pre>
1542 </nowiki>
1543 </pre>
1544
1545 <nowiki>
1546 <pre>
1547 <nowiki>
1548 </pre>
1549 </nowiki>
1550 </pre>
1551
1552 !! html
1553 <pre>
1554 &lt;nowiki&gt;
1555 </pre>
1556 <p>&lt;/nowiki&gt;
1557 &lt;/pre&gt;
1558 </p><p>
1559 &lt;pre&gt;
1560 &lt;nowiki&gt;
1561 &lt;/pre&gt;
1562
1563 &lt;/pre&gt;
1564 </p>
1565 !! end
1566
1567 !! test
1568 </pre> inside nowiki
1569 !! wikitext
1570 <nowiki></pre></nowiki>
1571 !! html
1572 <p>&lt;/pre&gt;
1573 </p>
1574 !! end
1575
1576 !! test
1577 Empty pre; pre inside other HTML tags (bug 54946)
1578 !! wikitext
1579 a
1580
1581 <div><pre>
1582 foo
1583 </pre></div>
1584 <pre></pre>
1585 !! html
1586 <p>a
1587 </p>
1588 <div><pre>
1589 foo
1590 </pre></div>
1591 <pre></pre>
1592
1593 !! end
1594
1595 !! test
1596 HTML pre followed by indent-pre
1597 !! wikitext
1598 <pre>foo</pre>
1599 bar
1600 !! html
1601 <pre>foo</pre>
1602 <pre>bar
1603 </pre>
1604 !! end
1605
1606 !!test
1607 Block tag pre
1608 !!options
1609 parsoid
1610 !! wikitext
1611 <p><pre>foo</pre></p>
1612 !! html
1613 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1614 !!end
1615
1616 !!test
1617 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1618 !! wikitext
1619 {{echo|}}
1620 !! html
1621
1622 !!end
1623
1624 !!test
1625 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1626 !! wikitext
1627 {{echo|
1628 foo}}
1629 !! html
1630 <p>foo
1631 </p>
1632 !!end
1633
1634 !! test
1635 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1636 !! wikitext
1637 {{echo|a
1638 b}}
1639 !! html
1640 <pre>a
1641 </pre>
1642 <p>b
1643 </p>
1644 !!end
1645
1646 !! test
1647 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1648 !! wikitext
1649 {{echo|a
1650 b
1651 c
1652 d
1653 e
1654 }}
1655 !! html
1656 <pre>a
1657 </pre>
1658 <p>b
1659 c
1660 </p>
1661 <pre>d
1662 </pre>
1663 <p>e
1664 </p>
1665 !!end
1666
1667 !!test
1668 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1669 !! wikitext
1670 {{echo| foo}}
1671
1672 {{echo| foo}}{{echo| bar}}
1673
1674 {{echo| foo}}
1675 {{echo| bar}}
1676
1677 {{echo|<!--cmt--> foo}}
1678
1679 <!--cmt-->{{echo| foo}}
1680
1681 {{echo|{{echo| }}bar}}
1682 !! html
1683 <pre>foo
1684 </pre>
1685 <pre>foo bar
1686 </pre>
1687 <pre>foo
1688 bar
1689 </pre>
1690 <pre>foo
1691 </pre>
1692 <pre>foo
1693 </pre>
1694 <pre>bar
1695 </pre>
1696 !!end
1697
1698 !! test
1699 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1700 !! wikitext
1701 {{echo| }}a
1702
1703 {{echo|
1704 }}a
1705
1706 {{echo|
1707 b}}
1708
1709 {{echo|a
1710 }}b
1711
1712 {{echo|a
1713 }} b
1714 !! html
1715 <pre>a
1716 </pre>
1717 <p><br />
1718 </p>
1719 <pre>a
1720 </pre>
1721 <p><br />
1722 </p>
1723 <pre>b
1724 </pre>
1725 <p>a
1726 </p>
1727 <pre>b
1728 </pre>
1729 <p>a
1730 </p>
1731 <pre>b
1732 </pre>
1733 !!end
1734
1735 !! test
1736 Things that look like <pre> tags aren't treated as such
1737 !! wikitext
1738 Barack Obama <President> of the United States
1739 !! html
1740 <p>Barack Obama &lt;President&gt; of the United States
1741 </p>
1742 !! end
1743
1744 !! test
1745 Parsoid: handle pre with space after attribute
1746 !! options
1747 parsoid=wt2html
1748 !! wikitext
1749 <pre style="width:50%;" >{{echo|foo}}</pre>
1750 !! html
1751 <pre style="width:50%;">{{echo|foo}}</pre>
1752 !! end
1753
1754 # TODO / maybe: fix wt2wt for this
1755 !! test
1756 Parsoid: Don't paragraph-wrap fosterable content
1757 !! options
1758 parsoid=wt2html
1759 !! wikitext
1760 {|
1761 <td></td>
1762 <td></td>
1763
1764
1765
1766 |}
1767 !! html
1768 <table>
1769
1770 <tbody>
1771 <tr>
1772 <td></td>
1773
1774 <td></td></tr>
1775
1776
1777
1778 </tbody></table>
1779 !! end
1780
1781 !! test
1782 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1783 !! options
1784 parsoid=wt2html
1785 !! wikitext
1786 {|
1787 <td>
1788 <td>
1789 </td>
1790
1791
1792
1793 |}
1794 !! html
1795 <table>
1796
1797 <tbody>
1798 <tr>
1799 <td></td>
1800
1801 <td>
1802 </td></tr>
1803
1804
1805
1806 </tbody></table>
1807 !! end
1808
1809
1810 #--------------------------------------------------------------------
1811 # Transclusion parameter whitespace stripping tests
1812 # Behavior is different for positional and named parameters
1813 #--------------------------------------------------------------------
1814 !! test
1815 Templates: Strip leading and trailing whitespace from named-param values
1816 !! wikitext
1817 {{echo|1= a }}
1818
1819 {{echo|1= {{echo|b}} }}
1820
1821 {{echo| 1 =
1822 c }}
1823
1824 {{echo| 1 =
1825 * d
1826 }}
1827 !! html
1828 <p>a
1829 </p><p>b
1830 </p><p>c
1831 </p>
1832 <ul>
1833 <li> d
1834 </li>
1835 </ul>
1836
1837 !! end
1838
1839 !! test
1840 Templates: Don't strip whitespace from positional-param values
1841 !! wikitext
1842 {{echo|a }}
1843
1844 {{echo|{{echo|b}} }}
1845
1846 {{echo| c
1847 }}
1848
1849 {{echo| {{echo|d}}
1850 }}
1851
1852 {{echo|
1853 e}}
1854
1855 {{echo|
1856 * f}}
1857
1858 {{echo|
1859 }}g
1860 !! html
1861 <p>a
1862 </p><p>b
1863 </p>
1864 <pre>c
1865 </pre>
1866 <p><br />
1867 </p>
1868 <pre>d
1869 </pre>
1870 <p><br />
1871 </p>
1872 <pre>e
1873 </pre>
1874 <p><br />
1875 </p>
1876 <ul>
1877 <li> f
1878 </li>
1879 </ul>
1880 <p><br />
1881 </p>
1882 <pre>g
1883 </pre>
1884 !! end
1885
1886 !! test
1887 Templates: Handle empty comment-and-ws-only lines correctly
1888 !! wikitext
1889 {{echo|foo
1890 <!--should be ignored-->
1891 <!--should be ignored as well-->
1892 bar}}
1893 !! html
1894 <p>foo
1895 bar
1896 </p>
1897 !! end
1898
1899 #--------------------------------------------------------------------
1900 # Transclusion parameter escaping tests
1901 #--------------------------------------------------------------------
1902 !! test
1903 Templates: Parsoid parameter escaping test 1
1904 !! options
1905 parsoid
1906 !! wikitext
1907 {{echo|[foo]|{{echo|[bar]}}}}
1908 !! html
1909 <p about="#mwt1" typeof="mw:Transclusion"
1910 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1911 !! end
1912
1913 !! test
1914 Parsoid: Pipes in external links in template parameter
1915 !! options
1916 parsoid
1917 !! wikitext
1918 {{echo|[{{echo|http://example.com}} link]}}
1919 !! html
1920 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
1921 !! end
1922
1923 !! test
1924 Parsoid: pipe in transclusion parameter
1925 !! options
1926 parsoid
1927 !! wikitext
1928 {{echo|http://foo.com/a&#124;b}}
1929 !! html
1930 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1931 typeof="mw:Transclusion"
1932 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
1933 !! end
1934
1935 !! test
1936 Parsoid: Pipe in external link target and content in template parameter
1937 !! options
1938 parsoid=html2wt,wt2wt
1939 !! wikitext
1940 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1941 !! html
1942 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1943 typeof="mw:Transclusion"
1944 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1945 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1946 !! end
1947
1948 !! test
1949 Templates: Don't escape already nowiki-escaped text in template parameters
1950 !! options
1951 parsoid=html2wt,wt2wt
1952 !! wikitext
1953 {{echo|foo<nowiki>|</nowiki>bar}}
1954 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1955 {{echo|<nowiki></nowiki>}}
1956 !! html
1957 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
1958 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
1959 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
1960 </p>
1961 !! end
1962
1963 ## Bug 52824
1964 !! test
1965 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1966 !! options
1967 parsoid=html2wt,wt2wt
1968 !! wikitext
1969 {{echo|{{echo|1=bar}}}}
1970 !! html
1971 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
1972 !! end
1973
1974 ## Bug 56733
1975 !! test
1976 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
1977 !! options
1978 parsoid
1979 !! wikitext
1980 {{echo|a : b}}
1981 !! html
1982 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
1983 !! end
1984
1985 ###
1986 ### Parsoid-centric tests for testing RT edge cases for pre
1987 ###
1988
1989 !!test
1990 1a. Indent-Pre and Comments
1991 !! wikitext
1992 a
1993 <!--a-->
1994 c
1995 !! html
1996 <pre>a
1997 </pre>
1998 <p>c
1999 </p>
2000 !!end
2001
2002 !!test
2003 1b. Indent-Pre and Comments
2004 !! wikitext
2005 a
2006 <!--a-->
2007 c
2008 !! html
2009 <pre>a
2010 </pre>
2011 <p>c
2012 </p>
2013 !!end
2014
2015 !!test
2016 1c. Indent-Pre and Comments
2017 !! wikitext
2018 <!--a--> a
2019
2020 <!--a--> a
2021 !! html
2022 <pre> a
2023 </pre>
2024 <pre> a
2025 </pre>
2026 !!end
2027
2028 !!test
2029 1d. Indent-Pre and Comments
2030 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2031 !! wikitext
2032 <!--a--> a
2033
2034 <!--b-->b
2035 !! html
2036 <pre>a
2037 </pre>
2038 <pre>b
2039 </pre>
2040 !!end
2041
2042 !!test
2043 2a. Indent-Pre and tables
2044 !! wikitext
2045 {|
2046 |-
2047 !h1!!h2
2048 |foo||bar
2049 |}
2050 !! html
2051 <table>
2052
2053 <tr>
2054 <th>h1</th>
2055 <th>h2
2056 </th>
2057 <td>foo</td>
2058 <td>bar
2059 </td></tr></table>
2060
2061 !!end
2062
2063 !!test
2064 2b. Indent-Pre and tables
2065 !! wikitext
2066 {|
2067 |-
2068 |foo
2069 |}
2070 !! html
2071 <table>
2072
2073 <tr>
2074 <td>foo
2075 </td></tr></table>
2076
2077 !!end
2078
2079 !!test
2080 2c. Indent-Pre and tables (bug 42252)
2081 !! wikitext
2082 {|
2083 |+ foo
2084 ! | bar
2085 |}
2086 !! html
2087 <table>
2088 <caption> foo
2089 </caption>
2090 <tr>
2091 <th> bar
2092 </th></tr></table>
2093
2094 !!end
2095
2096 !!test
2097 3a. Indent-Pre and block tags (single-line html)
2098 !! wikitext
2099 a <p> foo </p>
2100 b <div> foo </div>
2101 c <blockquote> foo </blockquote>
2102 <span> foo </span>
2103 !! html
2104 a <p> foo </p>
2105 b <div> foo </div>
2106 c <blockquote> foo </blockquote>
2107 <pre><span> foo </span>
2108 </pre>
2109 !!end
2110
2111 !!test
2112 3b. Indent-Pre and block tags (multi-line html)
2113 !! wikitext
2114 a <span>foo</span>
2115 b <div> foo </div>
2116 !! html
2117 <pre>a <span>foo</span>
2118 </pre>
2119 b <div> foo </div>
2120
2121 !!end
2122
2123 !!test
2124 3c. Indent-Pre and block tags (pre-content on separate line)
2125 !! wikitext
2126 <p>
2127 foo
2128 </p>
2129
2130 <div>
2131 foo
2132 </div>
2133
2134 <center>
2135 foo
2136 </center>
2137
2138 <blockquote>
2139 foo
2140 </blockquote>
2141
2142 <blockquote>
2143 <pre>
2144 foo
2145 </pre>
2146 </blockquote>
2147
2148 <table><tr><td>
2149 foo
2150 </td></tr></table>
2151
2152 <ul><li>
2153 foo
2154 </li></ul>
2155
2156 !! html
2157 <p>
2158 foo
2159 </p>
2160 <div>
2161 <pre>foo
2162 </pre>
2163 </div>
2164 <center>
2165 <pre>foo
2166 </pre>
2167 </center>
2168 <blockquote>
2169 <p> foo
2170 </p>
2171 </blockquote>
2172 <blockquote>
2173 <pre>
2174 foo
2175 </pre>
2176 </blockquote>
2177 <table><tr><td>
2178 <pre>foo
2179 </pre>
2180 </td></tr></table>
2181 <ul><li>
2182 foo
2183 </li></ul>
2184
2185 !!end
2186
2187 !!test
2188 4. Indent-Pre and extension tags
2189 !! wikitext
2190 a <gallery>
2191 File:foobar.jpg
2192 </gallery>
2193 !! html
2194 a <ul class="gallery mw-gallery-traditional">
2195 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2196 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
2197 <div class="gallerytext">
2198 </div>
2199 </div></li>
2200 </ul>
2201
2202 !!end
2203
2204 !! test
2205 Leading pipes outside of tables
2206 !! options
2207 parsoid
2208 !! wikitext
2209 | foo
2210 !! html
2211 <p>| foo</p>
2212 !! end
2213
2214 !! test
2215 Leading pipes outside of tables 2
2216 !! options
2217 parsoid
2218 !! wikitext
2219 a
2220 | foo
2221 b
2222 !! html
2223 <p>a
2224 | foo
2225 b</p>
2226 !! end
2227
2228 !! test
2229 Leading pipes outside of tables 3
2230 !! options
2231 parsoid
2232 !! wikitext
2233 a
2234 | class="foo bar" | baz
2235 b
2236 !! html
2237 <p>a
2238 | class="foo bar" | baz
2239 b</p>
2240 !! end
2241
2242 !!test
2243 Render paragraphs when indent-pre is suppressed in blocklevels
2244 !! wikitext
2245 <blockquote>
2246 foo
2247
2248 bar
2249 </blockquote>
2250 !! html
2251 <blockquote>
2252 <p> foo
2253 </p><p> bar
2254 </p>
2255 </blockquote>
2256
2257 !!end
2258
2259 !!test
2260 4. Multiple spaces at start-of-line
2261 !! wikitext
2262 <p> foo </p>
2263 foo
2264 {|
2265 |foo
2266 |}
2267 !! html
2268 <p> foo </p>
2269 <pre> foo
2270 </pre>
2271 <table>
2272 <tr>
2273 <td>foo
2274 </td></tr></table>
2275
2276 !!end
2277
2278 ## NOTE: the leading white-space chars on empty line are significant
2279 !! test
2280 5a. White-space in indent-pre
2281 !! wikitext
2282 a<br />
2283
2284 b
2285 !! html
2286 <pre>a<br />
2287
2288 b
2289 </pre>
2290 !! end
2291
2292 ## NOTE: the leading white-space chars on empty line are significant
2293 !! test
2294 5b. White-space in indent-pre
2295 !! wikitext
2296 a
2297
2298 b
2299
2300
2301 c
2302 !! html
2303 <pre>a
2304
2305 b
2306
2307
2308 c
2309 </pre>
2310 !! end
2311
2312 !! test
2313 5c. White-space in indent-pre
2314 !! wikitext
2315 ''a''
2316 ''b''
2317 ''c''
2318 !! html
2319 <pre><i>a</i>
2320 <i>b</i>
2321 <i>c</i>
2322 </pre>
2323 !! end
2324
2325 !! test
2326 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2327 !! wikitext
2328 a
2329
2330 <!-- continue -->
2331 b
2332
2333 c
2334
2335 d
2336 !! html
2337 <pre>a
2338
2339 b
2340 </pre>
2341 <pre>c
2342
2343 </pre>
2344 <p>d
2345 </p>
2346 !! end
2347
2348 !! test
2349 7a. Indent-pre and category links
2350 !! options
2351 parsoid=wt2html,wt2wt
2352 !! wikitext
2353 [[Category:foo]] <!-- No pre-wrapping -->
2354 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2355 !! html
2356 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2357 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2358 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2359 !! end
2360
2361 !! test
2362 7b. Indent-pre and category links
2363 !! options
2364 parsoid=wt2html,wt2wt
2365 !! wikitext
2366 [[Category:foo]] a
2367 [[Category:foo]] {{echo|b}}
2368 !! html
2369 <pre>
2370 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2371
2372 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
2373 !! end
2374
2375 ###
2376 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2377 ###
2378
2379 !!test
2380 HTML-pre: 1. embedded newlines
2381 !! wikitext
2382 <pre>foo</pre>
2383
2384 <pre>
2385 foo
2386 </pre>
2387
2388 <pre>
2389
2390 foo
2391 </pre>
2392
2393 <pre>
2394
2395
2396 foo
2397 </pre>
2398 !! html
2399 <pre>foo</pre>
2400 <pre>
2401 foo
2402 </pre>
2403 <pre>
2404
2405 foo
2406 </pre>
2407 <pre>
2408
2409
2410 foo
2411 </pre>
2412
2413 !!end
2414
2415 !!test
2416 HTML-pre: 2: indented text
2417 !! wikitext
2418 <pre>
2419 foo
2420 </pre>
2421 !! html
2422 <pre>
2423 foo
2424 </pre>
2425
2426 !!end
2427
2428 !!test
2429 HTML-pre: 3: other wikitext
2430 !! wikitext
2431 <pre>
2432 * foo
2433 # bar
2434 = no-h =
2435 '' no-italic ''
2436 [[ NoLink ]]
2437 </pre>
2438 !! html
2439 <pre>
2440 * foo
2441 # bar
2442 = no-h =
2443 '' no-italic ''
2444 [[ NoLink ]]
2445 </pre>
2446
2447 !!end
2448
2449 ###
2450 ### Definition lists
2451 ###
2452 !! test
2453 Simple definition
2454 !! wikitext
2455 ; name : Definition
2456 !! html
2457 <dl>
2458 <dt> name&#160;</dt>
2459 <dd> Definition
2460 </dd>
2461 </dl>
2462
2463 !! end
2464
2465 !! test
2466 Definition list for indentation only
2467 !! wikitext
2468 : Indented text
2469 !! html
2470 <dl>
2471 <dd> Indented text
2472 </dd>
2473 </dl>
2474
2475 !! end
2476
2477 !! test
2478 Definition list with no space
2479 !! wikitext
2480 ;name:Definition
2481 !! html
2482 <dl>
2483 <dt>name</dt>
2484 <dd>Definition
2485 </dd>
2486 </dl>
2487
2488 !!end
2489
2490 !! test
2491 Definition list with URL link
2492 !! wikitext
2493 ; http://example.com/ : definition
2494 !! html
2495 <dl>
2496 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2497 <dd> definition
2498 </dd>
2499 </dl>
2500
2501 !! end
2502
2503 !! test
2504 Definition list with bracketed URL link
2505 !! wikitext
2506 ;[http://www.example.com/ Example]:Something about it
2507 !! html
2508 <dl>
2509 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2510 <dd>Something about it
2511 </dd>
2512 </dl>
2513
2514 !! end
2515
2516 !! test
2517 Definition list with wikilink containing colon
2518 !! wikitext
2519 ; [[Help:FAQ]]: The least-read page on Wikipedia
2520 !! html
2521 <dl>
2522 <dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
2523 <dd> The least-read page on Wikipedia
2524 </dd>
2525 </dl>
2526
2527 !! end
2528
2529 # At Brion's and JeLuF's insistence... :)
2530 !! test
2531 Definition list with news link containing colon
2532 !! wikitext
2533 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2534 !! html
2535 <dl>
2536 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2537 <dd> This isn't even a real newsgroup!
2538 </dd>
2539 </dl>
2540
2541 !! end
2542
2543 !! test
2544 Malformed definition list with colon
2545 !! wikitext
2546 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2547 !! html
2548 <dl>
2549 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
2550 </dt>
2551 </dl>
2552
2553 !! end
2554
2555 !! test
2556 Definition lists: colon in external link text
2557 !! wikitext
2558 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2559 !! html
2560 <dl>
2561 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2562 <dd> OK, I made that up
2563 </dd>
2564 </dl>
2565
2566 !! end
2567
2568 !! test
2569 Definition lists: colon in HTML attribute
2570 !! wikitext
2571 ;<b style="display: inline">bold</b>
2572 !! html
2573 <dl>
2574 <dt><b style="display: inline">bold</b>
2575 </dt>
2576 </dl>
2577
2578 !! end
2579
2580 !! test
2581 Definition lists: self-closed tag
2582 !! wikitext
2583 ;one<br/>two : two-line fun
2584 !! html
2585 <dl>
2586 <dt>one<br />two&#160;</dt>
2587 <dd> two-line fun
2588 </dd>
2589 </dl>
2590
2591 !! end
2592
2593 !! test
2594 Bug 11748: Literal closing tags
2595 !! wikitext
2596 <dl>
2597 <dt>test 1</dt>
2598 <dd>test test test test test</dd>
2599 <dt>test 2</dt>
2600 <dd>test test test test test</dd>
2601 </dl>
2602 !! html
2603 <dl>
2604 <dt>test 1</dt>
2605 <dd>test test test test test</dd>
2606 <dt>test 2</dt>
2607 <dd>test test test test test</dd>
2608 </dl>
2609
2610 !! end
2611
2612 !! test
2613 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2614 !! wikitext
2615 <ul><li>
2616 ; term : description
2617 * unordered
2618 </li></ul>
2619 !! html
2620 <ul><li>
2621 <dl>
2622 <dt> term&#160;</dt>
2623 <dd> description
2624 </dd>
2625 </dl>
2626 <ul>
2627 <li> unordered
2628 </li>
2629 </ul>
2630 </li></ul>
2631
2632 !! end
2633
2634 !! test
2635
2636 Definition list with empty definition and following paragraph
2637 !! wikitext
2638 ; term:
2639 Paragraph text
2640 !! html
2641 <dl>
2642 <dt> term</dt>
2643 <dd>
2644 </dd>
2645 </dl>
2646 <p>Paragraph text
2647 </p>
2648 !! end
2649
2650 !! test
2651 Nested definition lists using html syntax
2652 !! wikitext
2653 <dl><dd>
2654 <dl>
2655 <dd>Foo</dd>
2656 </dl>
2657 </dd></dl>
2658 !! html
2659 <dl><dd>
2660 <dl>
2661 <dd>Foo</dd>
2662 </dl>
2663 </dd></dl>
2664
2665 !! end
2666
2667 !! test
2668 Definition Lists: No nesting: Multiple dd's
2669 !! wikitext
2670 ;x
2671 :a
2672 :b
2673 !! html
2674 <dl>
2675 <dt>x
2676 </dt>
2677 <dd>a
2678 </dd>
2679 <dd>b
2680 </dd>
2681 </dl>
2682
2683 !! end
2684
2685 !! test
2686 Definition Lists: Indentation: Regular
2687 !! wikitext
2688 :i1
2689 ::i2
2690 :::i3
2691 !! html
2692 <dl>
2693 <dd>i1
2694 <dl>
2695 <dd>i2
2696 <dl>
2697 <dd>i3
2698 </dd>
2699 </dl>
2700 </dd>
2701 </dl>
2702 </dd>
2703 </dl>
2704
2705 !! end
2706
2707 !! test
2708 Definition Lists: Indentation: Missing 1st level
2709 !! wikitext
2710 ::i2
2711 :::i3
2712 !! html
2713 <dl>
2714 <dd><dl>
2715 <dd>i2
2716 <dl>
2717 <dd>i3
2718 </dd>
2719 </dl>
2720 </dd>
2721 </dl>
2722 </dd>
2723 </dl>
2724
2725 !! end
2726
2727 !! test
2728 Definition Lists: Indentation: Multi-level indent
2729 !! wikitext
2730 :::i3
2731 !! html
2732 <dl>
2733 <dd><dl>
2734 <dd><dl>
2735 <dd>i3
2736 </dd>
2737 </dl>
2738 </dd>
2739 </dl>
2740 </dd>
2741 </dl>
2742
2743 !! end
2744
2745 !! test
2746 Definition Lists: Hacky use to indent tables
2747 !! wikitext
2748 ::{|
2749 |foo
2750 |bar
2751 |}
2752 this text
2753 should be left alone
2754 !! html
2755 <dl><dd><dl><dd><table>
2756 <tr>
2757 <td>foo
2758 </td>
2759 <td>bar
2760 </td></tr></table></dd></dl></dd></dl>
2761 <p>this text
2762 should be left alone
2763 </p>
2764 !! end
2765
2766 # Bug 52473
2767 !! test
2768 Definition Lists: Hacky use to indent tables (WS-insensitive)
2769 !! options
2770 parsoid
2771 !! wikitext
2772 : {|
2773 |a
2774 |}
2775 !! html
2776 <dl>
2777 <dd> <table><tr><td>a</td></tr></table> </dd>
2778 </dl>
2779 !! end
2780 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2781 ## as an empty dt item. It also ignores all but the last ";" when followed
2782 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2783 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2784 ## ";"s.
2785 ##
2786 ## Ex: ";;t2 ::d2" is transformed into:
2787 ##
2788 ## <dl>
2789 ## <dt>t2 </dt>
2790 ## <dd>
2791 ## <dl>
2792 ## <dt></dt>
2793 ## <dd>d2</dd>
2794 ## </dl>
2795 ## </dd>
2796 ## </dl>
2797 ##
2798 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2799 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2800 ##
2801 ## <dl>
2802 ## <dt>
2803 ## <dl>
2804 ## <dt>t2 </dt>
2805 ## <dd>:d2</dd>
2806 ## </dl>
2807 ## </dt>
2808 ## </dl>
2809 ##
2810 ## All Parsoid only definition list tests have this difference.
2811 ##
2812 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2813 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2814
2815 !! test
2816 Table / list interaction: indented table with lists in table contents
2817 !! wikitext
2818 :{|
2819 |-
2820 | a
2821 * b
2822 |-
2823 | c
2824 * d
2825 |}
2826 !! html
2827 <dl><dd><table>
2828
2829 <tr>
2830 <td> a
2831 <ul>
2832 <li> b
2833 </li>
2834 </ul>
2835 </td></tr>
2836 <tr>
2837 <td> c
2838 <ul>
2839 <li> d
2840 </li>
2841 </ul>
2842 </td></tr></table></dd></dl>
2843
2844 !! end
2845
2846 !!test
2847 Table / list interaction: lists nested in tables nested in indented lists
2848 !! wikitext
2849 :{|
2850 |
2851 :a
2852 :b
2853 |
2854 *c
2855 *d
2856 |}
2857
2858 *e
2859 *f
2860 !! html
2861 <dl><dd><table>
2862 <tr>
2863 <td>
2864 <dl>
2865 <dd>a
2866 </dd>
2867 <dd>b
2868 </dd>
2869 </dl>
2870 </td>
2871 <td>
2872 <ul>
2873 <li>c
2874 </li>
2875 <li>d
2876 </li>
2877 </ul>
2878 </td></tr></table></dd></dl>
2879 <ul>
2880 <li>e
2881 </li>
2882 <li>f
2883 </li>
2884 </ul>
2885
2886 !!end
2887
2888 !! test
2889 Definition Lists: Nesting: Multi-level (Parsoid only)
2890 !! options
2891 parsoid
2892 !! wikitext
2893 ;t1 :d1
2894 ;;t2 ::d2
2895 ;;;t3 :::d3
2896 !! html
2897 <dl>
2898 <dt>t1 </dt>
2899 <dd>d1</dd>
2900 <dt>
2901 <dl>
2902 <dt>t2 </dt>
2903 <dd>:d2</dd>
2904 <dt>
2905 <dl>
2906 <dt>t3 </dt>
2907 <dd>::d3</dd>
2908 </dl>
2909 </dt>
2910 </dl>
2911 </dt>
2912 </dl>
2913
2914
2915 !! end
2916
2917
2918 !! test
2919 Definition Lists: Nesting: Test 2 (Parsoid only)
2920 !! options
2921 parsoid
2922 !! wikitext
2923 ;t1
2924 ::d2
2925 !! html
2926 <dl>
2927 <dt>t1</dt>
2928 <dd>
2929 <dl>
2930 <dd>d2</dd>
2931 </dl>
2932 </dd>
2933 </dl>
2934
2935 !! end
2936
2937
2938 !! test
2939 Definition Lists: Nesting: Test 3 (Parsoid only)
2940 !! options
2941 parsoid
2942 !! wikitext
2943 :;t1
2944 ::::d2
2945 !! html
2946 <dl>
2947 <dd>
2948 <dl>
2949 <dt>t1</dt>
2950 <dd>
2951 <dl>
2952 <dd>
2953 <dl>
2954 <dd>d2</dd>
2955 </dl>
2956 </dd>
2957 </dl>
2958 </dd>
2959 </dl>
2960 </dd>
2961 </dl>
2962
2963 !! end
2964
2965
2966 !! test
2967 Definition Lists: Nesting: Test 4
2968 !! wikitext
2969 ::;t3
2970 :::d3
2971 !! html
2972 <dl>
2973 <dd><dl>
2974 <dd><dl>
2975 <dt>t3
2976 </dt>
2977 <dd>d3
2978 </dd>
2979 </dl>
2980 </dd>
2981 </dl>
2982 </dd>
2983 </dl>
2984
2985 !! end
2986
2987
2988 ## The Parsoid team believes the following three test exposes a
2989 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2990 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2991 !! test
2992 Definition Lists: Mixed Lists: Test 1
2993 !! wikitext
2994 :;* foo
2995 ::* bar
2996 :; baz
2997 !! html/php
2998 <dl>
2999 <dd><dl>
3000 <dt><ul>
3001 <li> foo
3002 </li>
3003 <li> bar
3004 </li>
3005 </ul>
3006 </dt>
3007 </dl>
3008 <dl>
3009 <dt> baz
3010 </dt>
3011 </dl>
3012 </dd>
3013 </dl>
3014
3015 !! html/parsoid
3016 <dl>
3017 <dd><dl>
3018 <dt><ul>
3019 <li> foo
3020 </li>
3021 </ul></dt>
3022 <dd><ul>
3023 <li> bar
3024 </li>
3025 </ul></dd>
3026 <dt> baz</dt>
3027 </dl></dd>
3028 </dl>
3029 !! end
3030
3031 !! test
3032 Definition Lists: Mixed Lists: Test 2
3033 !! wikitext
3034 *: d1
3035 *: d2
3036 !! html
3037 <ul>
3038 <li><dl>
3039 <dd> d1
3040 </dd>
3041 <dd> d2
3042 </dd>
3043 </dl>
3044 </li>
3045 </ul>
3046
3047 !! end
3048
3049
3050 !! test
3051 Definition Lists: Mixed Lists: Test 3
3052 !! wikitext
3053 *::: d1
3054 *::: d2
3055 !! html
3056 <ul>
3057 <li><dl>
3058 <dd><dl>
3059 <dd><dl>
3060 <dd> d1
3061 </dd>
3062 <dd> d2
3063 </dd>
3064 </dl>
3065 </dd>
3066 </dl>
3067 </dd>
3068 </dl>
3069 </li>
3070 </ul>
3071
3072 !! end
3073
3074
3075 !! test
3076 Definition Lists: Mixed Lists: Test 4
3077 !! wikitext
3078 *;d1 :d2
3079 *;d3 :d4
3080 !! html
3081 <ul>
3082 <li><dl>
3083 <dt>d1&#160;</dt>
3084 <dd>d2
3085 </dd>
3086 <dt>d3&#160;</dt>
3087 <dd>d4
3088 </dd>
3089 </dl>
3090 </li>
3091 </ul>
3092
3093 !! end
3094
3095
3096 !! test
3097 Definition Lists: Mixed Lists: Test 5
3098 !! wikitext
3099 *:d1
3100 *:: d2
3101 !! html
3102 <ul>
3103 <li><dl>
3104 <dd>d1
3105 <dl>
3106 <dd> d2
3107 </dd>
3108 </dl>
3109 </dd>
3110 </dl>
3111 </li>
3112 </ul>
3113
3114 !! end
3115
3116
3117 !! test
3118 Definition Lists: Mixed Lists: Test 6
3119 !! wikitext
3120 #*:d1
3121 #*::: d3
3122 !! html
3123 <ol>
3124 <li><ul>
3125 <li><dl>
3126 <dd>d1
3127 <dl>
3128 <dd><dl>
3129 <dd> d3
3130 </dd>
3131 </dl>
3132 </dd>
3133 </dl>
3134 </dd>
3135 </dl>
3136 </li>
3137 </ul>
3138 </li>
3139 </ol>
3140
3141 !! end
3142
3143
3144 !! test
3145 Definition Lists: Mixed Lists: Test 7
3146 !! wikitext
3147 :* d1
3148 :* d2
3149 !! html
3150 <dl>
3151 <dd><ul>
3152 <li> d1
3153 </li>
3154 <li> d2
3155 </li>
3156 </ul>
3157 </dd>
3158 </dl>
3159
3160 !! end
3161
3162
3163 !! test
3164 Definition Lists: Mixed Lists: Test 8
3165 !! wikitext
3166 :* d1
3167 ::* d2
3168 !! html
3169 <dl>
3170 <dd><ul>
3171 <li> d1
3172 </li>
3173 </ul>
3174 <dl>
3175 <dd><ul>
3176 <li> d2
3177 </li>
3178 </ul>
3179 </dd>
3180 </dl>
3181 </dd>
3182 </dl>
3183
3184 !! end
3185
3186
3187 !! test
3188 Definition Lists: Mixed Lists: Test 9
3189 !! wikitext
3190 *;foo :bar
3191 !! html
3192 <ul>
3193 <li><dl>
3194 <dt>foo&#160;</dt>
3195 <dd>bar
3196 </dd>
3197 </dl>
3198 </li>
3199 </ul>
3200
3201 !! end
3202
3203
3204 !! test
3205 Definition Lists: Mixed Lists: Test 10
3206 !! wikitext
3207 *#;foo :bar
3208 !! html
3209 <ul>
3210 <li><ol>
3211 <li><dl>
3212 <dt>foo&#160;</dt>
3213 <dd>bar
3214 </dd>
3215 </dl>
3216 </li>
3217 </ol>
3218 </li>
3219 </ul>
3220
3221 !! end
3222
3223 # The Parsoid team disagrees with the PHP parser's seemingly-random
3224 # rules regarding dd/dt on the next two tests. Parsoid is more
3225 # consistent, and recognizes the shared nesting and keeps the
3226 # still-open tags around until the nesting is complete.
3227
3228 !! test
3229 Definition Lists: Mixed Lists: Test 11
3230 !! wikitext
3231 *#*#;*;;foo :bar
3232 *#*#;boo :baz
3233 !! html/php
3234 <ul>
3235 <li><ol>
3236 <li><ul>
3237 <li><ol>
3238 <li><dl>
3239 <dt>foo&#160;</dt>
3240 <dd><ul>
3241 <li><dl>
3242 <dt><dl>
3243 <dt>bar
3244 </dt>
3245 </dl>
3246 </dd>
3247 </dl>
3248 </li>
3249 </ul>
3250 </dd>
3251 </dl>
3252 <dl>
3253 <dt>boo&#160;</dt>
3254 <dd>baz
3255 </dd>
3256 </dl>
3257 </li>
3258 </ol>
3259 </li>
3260 </ul>
3261 </li>
3262 </ol>
3263 </li>
3264 </ul>
3265
3266 !! html/parsoid
3267 <ul>
3268 <li>
3269 <ol>
3270 <li>
3271 <ul>
3272 <li>
3273 <ol>
3274 <li>
3275 <dl>
3276 <dt>
3277 <ul>
3278 <li>
3279 <dl>
3280 <dt>
3281 <dl>
3282 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3283 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3284 </dl></dt>
3285 </dl></li>
3286 </ul></dt>
3287 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3288 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3289 </dl></li>
3290 </ol></li>
3291 </ul></li>
3292 </ol></li>
3293 </ul>
3294 !! end
3295
3296
3297 !! test
3298 Definition Lists: Weird Ones: Test 1
3299 !! wikitext
3300 *#;*::;; foo : bar (who uses this?)
3301 !! html/php
3302 <ul>
3303 <li><ol>
3304 <li><dl>
3305 <dt> foo&#160;</dt>
3306 <dd><ul>
3307 <li><dl>
3308 <dd><dl>
3309 <dd><dl>
3310 <dt><dl>
3311 <dt> bar (who uses this?)
3312 </dt>
3313 </dl>
3314 </dd>
3315 </dl>
3316 </dd>
3317 </dl>
3318 </dd>
3319 </dl>
3320 </li>
3321 </ul>
3322 </dd>
3323 </dl>
3324 </li>
3325 </ol>
3326 </li>
3327 </ul>
3328
3329 !! html/parsoid
3330 <ul>
3331 <li>
3332 <ol>
3333 <li>
3334 <dl>
3335 <dt>
3336 <ul>
3337 <li>
3338 <dl>
3339 <dd>
3340 <dl>
3341 <dd>
3342 <dl>
3343 <dt>
3344 <dl>
3345 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3346 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3347 </dl></dt>
3348 </dl></dd>
3349 </dl></dd>
3350 </dl></li>
3351 </ul></dt>
3352 </dl></li>
3353 </ol></li>
3354 </ul>
3355 !! end
3356
3357 ###
3358 ### External links
3359 ###
3360 !! test
3361 External links: non-bracketed
3362 !! wikitext
3363 Non-bracketed: http://example.com
3364 !! html
3365 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3366 </p>
3367 !! end
3368
3369 !! test
3370 External links: numbered
3371 !! wikitext
3372 Numbered: [http://example.com]
3373 Numbered: [http://example.net]
3374 Numbered: [http://example.com]
3375 !! html
3376 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3377 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3378 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3379 </p>
3380 !!end
3381
3382 !! test
3383 External links: specified text
3384 !! wikitext
3385 Specified text: [http://example.com link]
3386 !! html
3387 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3388 </p>
3389 !!end
3390
3391 !! test
3392 External links: trail
3393 !! wikitext
3394 Linktrails should not work for external links: [http://example.com link]s
3395 !! html
3396 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3397 </p>
3398 !! end
3399
3400 !! test
3401 External links: dollar sign in URL
3402 !! wikitext
3403 http://example.com/1$2345
3404 !! html
3405 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3406 </p>
3407 !! end
3408
3409 !! test
3410 External links: dollar sign in URL (named)
3411 !! wikitext
3412 [http://example.com/1$2345]
3413 !! html
3414 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3415 </p>
3416 !!end
3417
3418 !! test
3419 External links: open square bracket forbidden in URL (bug 4377)
3420 !! wikitext
3421 http://example.com/1[2345
3422 !! html
3423 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3424 </p>
3425 !! end
3426
3427 !! test
3428 External links: open square bracket forbidden in URL (named) (bug 4377)
3429 !! wikitext
3430 [http://example.com/1[2345]
3431 !! html
3432 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3433 </p>
3434 !!end
3435
3436 !! test
3437 External links: nowiki in URL link text (bug 6230)
3438 !! wikitext
3439 [http://example.com/ <nowiki>''example site''</nowiki>]
3440 !! html
3441 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3442 </p>
3443 !! end
3444
3445 !! test
3446 External links: newline forbidden in text (bug 6230 regression check)
3447 !! wikitext
3448 [http://example.com/ first
3449 second]
3450 !! html
3451 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3452 second]
3453 </p>
3454 !!end
3455
3456 !! test
3457 External links: Pipe char between url and text
3458 !! wikitext
3459 [http://example.com | link]
3460 !! html
3461 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3462 </p>
3463 !!end
3464
3465 !! test
3466 External links: protocol-relative URL in brackets
3467 !! wikitext
3468 [//example.com/ Test]
3469 !! html
3470 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3471 </p>
3472 !! end
3473
3474 !! test
3475 External links: protocol-relative URL in brackets without text
3476 !! wikitext
3477 [//example.com]
3478 !! html
3479 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3480 </p>
3481 !! end
3482
3483 !! test
3484 External links: protocol-relative URL in free text is left alone
3485 !! wikitext
3486 //example.com/Foo
3487 !! html
3488 <p>//example.com/Foo
3489 </p>
3490 !!end
3491
3492 !! test
3493 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3494 !! wikitext
3495 foo//example.com/Foo
3496 !! html
3497 <p>foo//example.com/Foo
3498 </p>
3499 !! end
3500
3501 !! test
3502 External image
3503 !! wikitext
3504 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3505 !! html
3506 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3507 </p>
3508 !! end
3509
3510 !! test
3511 External image from https
3512 !! wikitext
3513 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3514 !! html
3515 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3516 </p>
3517 !! end
3518
3519 !! test
3520 External image (when not allowed)
3521 !! options
3522 wgAllowExternalImages=0
3523 !! wikitext
3524 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3525 !! html
3526 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
3527 </p>
3528 !! end
3529
3530 !! test
3531 Link to non-http image, no img tag
3532 !! wikitext
3533 Link to non-http image, no img tag: ftp://example.com/test.jpg
3534 !! html
3535 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
3536 </p>
3537 !! end
3538
3539 !! test
3540 External links: terminating separator
3541 !! wikitext
3542 Terminating separator: http://example.com/thing,
3543 !! html
3544 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3545 </p>
3546 !! end
3547
3548 !! test
3549 External links: intervening separator
3550 !! wikitext
3551 Intervening separator: http://example.com/1,2,3
3552 !! html
3553 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3554 </p>
3555 !! end
3556
3557 !! test
3558 External links: old bug with URL in query
3559 !! wikitext
3560 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3561 !! html
3562 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3563 </p>
3564 !! end
3565
3566 !! test
3567 External links: old URL-in-URL bug, mixed protocols
3568 !! wikitext
3569 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3570 !! html
3571 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3572 </p>
3573 !!end
3574
3575 !! test
3576 External links: URL in text
3577 !! wikitext
3578 URL in text: [http://example.com http://example.com]
3579 !! html
3580 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3581 </p>
3582 !! end
3583
3584 !! test
3585 External links: Clickable images
3586 !! wikitext
3587 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3588 !! html
3589 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
3590 </p>
3591 !!end
3592
3593 !! test
3594 External links: raw ampersand
3595 !! wikitext
3596 Old &amp; use: http://x&y
3597 !! html
3598 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3599 </p>
3600 !! end
3601
3602 !! test
3603 External links: encoded ampersand
3604 !! wikitext
3605 Old &amp; use: http://x&amp;y
3606 !! html
3607 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3608 </p>
3609 !! end
3610
3611 !! test
3612 External links: encoded equals (bug 6102)
3613 !! wikitext
3614 http://example.com/?foo&#61;bar
3615 !! html
3616 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3617 </p>
3618 !! end
3619
3620 !! test
3621 External links: [raw ampersand]
3622 !! wikitext
3623 Old &amp; use: [http://x&y]
3624 !! html
3625 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3626 </p>
3627 !! end
3628
3629 !! test
3630 External links: [encoded ampersand]
3631 !! wikitext
3632 Old &amp; use: [http://x&amp;y]
3633 !! html
3634 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3635 </p>
3636 !! end
3637
3638 !! test
3639 External links: [encoded equals] (bug 6102)
3640 !! wikitext
3641 [http://example.com/?foo&#61;bar]
3642 !! html
3643 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3644 </p>
3645 !! end
3646
3647 !! test
3648 External links: [IDN ignored character reference in hostname; strip it right off]
3649 !! wikitext
3650 [http://e&zwnj;xample.com/]
3651 !! html
3652 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3653 </p>
3654 !! end
3655
3656 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3657 # Where an external link could easily circumvent the sanitization of the text of
3658 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3659 # test demands a higher standard. That's a bit strange.
3660 #
3661 # Example:
3662 #
3663 # http://e‌xample.com -> [http://example.com|http://example.com]
3664 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3665 #
3666 # The first example is sanitized, but the second is not. Any security benefits
3667 # from this production are trivial to circumvent. Either remove this test and
3668 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3669 # the test accordingly.
3670 #
3671 # All our love,
3672 # The Parsoid team.
3673 !! test
3674 External links: IDN ignored character reference in hostname; strip it right off
3675 !! wikitext
3676 http://e&zwnj;xample.com/
3677 !! html
3678 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3679 </p>
3680 !! end
3681
3682 !! test
3683 External links: www.jpeg.org (bug 554)
3684 !! wikitext
3685 http://www.jpeg.org
3686 !! html
3687 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3688 </p>
3689 !! end
3690
3691 !! test
3692 External links: URL within URL (original bug 2)
3693 !! wikitext
3694 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3695 !! html
3696 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3697 </p>
3698 !! end
3699
3700 !! test
3701 BUG 361: URL inside bracketed URL
3702 !! wikitext
3703 [http://www.example.com/foo http://www.example.com/bar]
3704 !! html
3705 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3706 </p>
3707 !! end
3708
3709 !! test
3710 BUG 361: URL within URL, not bracketed
3711 !! wikitext
3712 http://www.example.com/foo?=http://www.example.com/bar
3713 !! html
3714 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
3715 </p>
3716 !! end
3717
3718 !! test
3719 BUG 289: ">"-token in URL-tail
3720 !! wikitext
3721 http://www.example.com/<hello>
3722 !! html
3723 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3724 </p>
3725 !!end
3726
3727 !! test
3728 BUG 289: literal ">"-token in URL-tail
3729 !! wikitext
3730 http://www.example.com/<b>html</b>
3731 !! html
3732 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3733 </p>
3734 !!end
3735
3736 !! test
3737 BUG 289: ">"-token in bracketed URL
3738 !! wikitext
3739 [http://www.example.com/<hello> stuff]
3740 !! html
3741 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3742 </p>
3743 !!end
3744
3745 !! test
3746 BUG 289: literal ">"-token in bracketed URL
3747 !! wikitext
3748 [http://www.example.com/<b>html</b> stuff]
3749 !! html
3750 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3751 </p>
3752 !!end
3753
3754 !! test
3755 BUG 289: literal double quote at end of URL
3756 !! wikitext
3757 http://www.example.com/"hello"
3758 !! html
3759 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3760 </p>
3761 !!end
3762
3763 !! test
3764 BUG 289: literal double quote in bracketed URL
3765 !! wikitext
3766 [http://www.example.com/"hello" stuff]
3767 !! html
3768 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3769 </p>
3770 !!end
3771
3772 !! test
3773 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3774 !! wikitext
3775 [http://www.example.com test]
3776 !! html
3777 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3778 </p>
3779 !! end
3780
3781 !! test
3782 External links: link text with spaces
3783 !! wikitext
3784 [http://www.example.com a b c]
3785 [http://www.example.com ''a'' ''b'']
3786 !! html
3787 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3788 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3789 </p>
3790 !! end
3791
3792 !! test
3793 External links: wiki links within external link (Bug 3695)
3794 !! wikitext
3795 [http://example.com [[wikilink]] embedded in ext link]
3796 !! html/php
3797 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
3798 </p>
3799 !! html/parsoid
3800 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
3801 !! end
3802
3803 !! test
3804 BUG 787: Links with one slash after the url protocol are invalid
3805 !! wikitext
3806 http:/example.com
3807
3808 [http:/example.com title]
3809 !! html
3810 <p>http:/example.com
3811 </p><p>[http:/example.com title]
3812 </p>
3813 !! end
3814
3815 !! test
3816 Bracketed external links with template-generated invalid target
3817 !! wikitext
3818 [{{echo|http:/example.com}} title]
3819 !! html
3820 <p>[http:/example.com title]
3821 </p>
3822 !! end
3823
3824 !! test
3825 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3826 !! wikitext
3827 ''[http://example.com text'']
3828 [http://example.com '''text]'''
3829 ''Something [http://example.com in italic'']
3830 ''Something [http://example.com mixed''''', even bold]'''
3831 '''''Now [http://example.com both''''']
3832 !! html
3833 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3834 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3835 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3836 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3837 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3838 </p>
3839 !! end
3840
3841
3842 !! test
3843 Bug 4781: %26 in URL
3844 !! wikitext
3845 http://www.example.com/?title=AT%26T
3846 !! html
3847 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3848 </p>
3849 !! end
3850
3851 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3852 # % is actually legal in HTML5. Any change in output would need testing though.
3853 !! test
3854 Bug 4781, 5267: %25 in URL
3855 !! wikitext
3856 http://www.example.com/?title=100%25_Bran
3857 !! html
3858 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
3859 </p>
3860 !! end
3861
3862 !! test
3863 Bug 4781, 5267: %28, %29 in URL
3864 !! wikitext
3865 http://www.example.com/?title=Ben-Hur_%281959_film%29
3866 !! html
3867 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
3868 </p>
3869 !! end
3870
3871
3872 !! test
3873 Bug 4781: %26 in autonumber URL
3874 !! wikitext
3875 [http://www.example.com/?title=AT%26T]
3876 !! html
3877 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3878 </p>
3879 !! end
3880
3881 !! test
3882 Bug 4781, 5267: %26 in autonumber URL
3883 !! wikitext
3884 [http://www.example.com/?title=100%25_Bran]
3885 !! html
3886 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3887 </p>
3888 !! end
3889
3890 !! test
3891 Bug 4781, 5267: %28, %29 in autonumber URL
3892 !! wikitext
3893 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3894 !! html
3895 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3896 </p>
3897 !! end
3898
3899
3900 !! test
3901 Bug 4781: %26 in bracketed URL
3902 !! wikitext
3903 [http://www.example.com/?title=AT%26T link]
3904 !! html
3905 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3906 </p>
3907 !! end
3908
3909 !! test
3910 Bug 4781, 5267: %26 in bracketed URL
3911 !! wikitext
3912 [http://www.example.com/?title=100%25_Bran link]
3913 !! html
3914 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3915 </p>
3916 !! end
3917
3918 !! test
3919 Bug 4781, 5267: %28, %29 in bracketed URL
3920 !! wikitext
3921 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3922 !! html
3923 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3924 </p>
3925 !! end
3926
3927 !! test
3928 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3929 !! wikitext
3930 Some [http://example.com/ pretty ''italics'' and stuff]!
3931 !! html
3932 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3933 </p>
3934 !! end
3935
3936 !! test
3937 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3938 !! wikitext
3939 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3940 !! html
3941 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
3942 </p>
3943 !! end
3944
3945 !! test
3946 External link containing double-single-quotes with no space separating the url from text in italics
3947 !! wikitext
3948 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
3949 !! html/php
3950 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
3951 </p>
3952 !! html/parsoid
3953 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)">Museo Picasso</a><span>.</span></p>
3954 !! end
3955
3956 !! test
3957 External link with comments in link text
3958 !! wikitext
3959 [http://www.google.com Google <!-- comment -->]
3960 !! html
3961 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3962 </p>
3963 !! end
3964
3965 !! test
3966 URL-encoding in URL functions (single parameter)
3967 !! wikitext
3968 {{localurl:Some page|amp=&}}
3969 !! html
3970 <p>/index.php?title=Some_page&amp;amp=&amp;
3971 </p>
3972 !! end
3973
3974 !! test
3975 URL-encoding in URL functions (multiple parameters)
3976 !! wikitext
3977 {{localurl:Some page|q=?&amp=&}}
3978 !! html
3979 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3980 </p>
3981 !! end
3982
3983 !! test
3984 Brackets in urls
3985 !! wikitext
3986 http://example.com/index.php?foozoid%5B%5D=bar
3987
3988 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3989 !! html
3990 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3991 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3992 </p>
3993 !! end
3994
3995 !! test
3996 IPv6 urls (bug 21261)
3997 !! options
3998 disabled
3999 !! wikitext
4000 http://[2404:130:0:1000::187:2]/index.php
4001 !! html
4002 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
4003 </p>
4004 !! end
4005
4006 !! test
4007 Non-extlinks in brackets
4008 !! wikitext
4009 [foo]
4010 [foo bar]
4011 [foo ''bar'']
4012 [fool's] errand
4013 [fool's errand]
4014 [{{echo|foo}}]
4015 [{{echo|foo}} bar]
4016 [{{echo|foo}} ''bar'']
4017 [{{echo|foo}}l's] errand
4018 [{{echo|foo}}l's errand]
4019 [url={{echo|foo}}]
4020 [url=http://example.com]
4021 !! html
4022 <p>[foo]
4023 [foo bar]
4024 [foo <i>bar</i>]
4025 [fool's] errand
4026 [fool's errand]
4027 [foo]
4028 [foo bar]
4029 [foo <i>bar</i>]
4030 [fool's] errand
4031 [fool's errand]
4032 [url=foo]
4033 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4034 </p>
4035 !! end
4036
4037 !! test
4038 Percent encoding in external links
4039 !! wikitext
4040 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4041 !! html/php
4042 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4043 </p>
4044 !! html/parsoid
4045 <p><a rel="mw:ExtLink"
4046 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4047 !! end
4048
4049 !! test
4050 Use url link syntax for links where the content is equal the link target
4051 !! wikitext
4052 http://example.com
4053 !! html/php
4054 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4055 </p>
4056 !! html/parsoid
4057 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4058 !! end
4059
4060 !! test
4061 Parenthesis in external links, especially URL links
4062 !! wikitext
4063 http://example.com)
4064
4065 http://example.com/test)
4066
4067 http://example.com/(test)
4068
4069 http://example.com/((test)
4070
4071 (http://example.com/(test))
4072
4073 (http://example.com/(test)))))
4074
4075 http://example.com/a)b
4076
4077 [http://example.com) foo]
4078 !! html/php
4079 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4080 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4081 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4082 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4083 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4084 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4085 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4086 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4087 </p>
4088 !! html/parsoid
4089 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4090 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4091 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4092 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4093 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4094 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4095 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4096 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4097 !! end
4098
4099 !! test
4100 Parenthesis in external links, w/ transclusion or comment
4101 !! wikitext
4102 (http://example.com/{{echo|hi}})
4103
4104 (http://example.com<!-- hi -->)
4105 !! html/php
4106 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4107 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4108 </p>
4109 !! html/parsoid
4110 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[20,31,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p>
4111
4112 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
4113 !! end
4114
4115 ###
4116 ### Quotes
4117 ###
4118
4119 !! test
4120 Quotes
4121 !! wikitext
4122 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4123
4124 Normal text. '''''Bold italic text.''''' Normal text.
4125 !! html
4126 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4127 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4128 </p>
4129 !! end
4130
4131
4132 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4133 # parser strips. The wikitext contains just the first half of the bold
4134 # quote pair.
4135 !! test
4136 Unclosed and unmatched quotes
4137 !! wikitext
4138 '''''Bold italic text '''with bold deactivated''' in between.'''''
4139
4140 '''''Bold italic text ''with italic deactivated'' in between.'''''
4141
4142 '''Bold text..
4143
4144 ..spanning two paragraphs (should not work).'''
4145
4146 '''Bold tag left open
4147
4148 ''Italic tag left open
4149
4150 Normal text.
4151
4152 <!-- Unmatching number of opening, closing tags: -->
4153 '''This year''''s election ''should'' beat '''last year''''s.
4154
4155 ''Tom'''s car is bigger than ''Susan'''s.
4156
4157 Plain ''italic'''s plain
4158 !! html/php
4159 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4160 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4161 </p><p><b>Bold text..</b>
4162 </p><p>..spanning two paragraphs (should not work).
4163 </p><p><b>Bold tag left open</b>
4164 </p><p><i>Italic tag left open</i>
4165 </p><p>Normal text.
4166 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4167 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4168 </p><p>Plain <i>italic'</i>s plain
4169 </p>
4170 !! html/parsoid
4171 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4172 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4173 </p><p><b>Bold text..</b>
4174 </p><p>..spanning two paragraphs (should not work).<b></b>
4175 </p><p><b>Bold tag left open</b>
4176 </p><p><i>Italic tag left open</i>
4177 </p><p>Normal text.
4178 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4179 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4180 </p><p>Plain <i>italic'</i>s plain
4181 </p>
4182 !! end
4183
4184 ###
4185 ### Tables
4186 ###
4187 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4188 ###
4189
4190 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4191 # is the bare minimum required by the spec, see:
4192 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4193 # Parsoid team replies: empty table tags are legal in HTML5
4194 !! test
4195 A table with no data.
4196 !! options
4197 parsoid=wt2html
4198 !! wikitext
4199 {||}
4200 !! html/php
4201
4202 !! html/parsoid
4203 <table></table>
4204
4205 !! end
4206
4207 !! test
4208 A table with stray table end tags on start tag line (wt2html)
4209 !! options
4210 parsoid=wt2html
4211 !! wikitext
4212 {|style="color: red;"|}
4213
4214 {|style="color: red;" |}
4215 |foo
4216 |}
4217
4218 {|style="color: red;"|} id="foo"
4219 |foo
4220 |}
4221
4222 {|style="color: red;" |} id="foo"
4223 |foo
4224 |}
4225 !! html
4226 <table style="color: red;"></table>
4227
4228 <table style="color: red;">
4229 <tbody><tr>
4230 <td>foo</td>
4231 </tr></tbody>
4232 </table>
4233
4234 <table style="color: red;" id="foo">
4235 <tbody><tr>
4236 <td>foo</td>
4237 </tr></tbody>
4238 </table>
4239
4240 <table style="color: red;" id="foo">
4241 <tbody><tr>
4242 <td>foo</td>
4243 </tr></tbody>
4244 </table>
4245
4246 !! end
4247
4248 !! test
4249 A table with no data (take 2)
4250 !! wikitext
4251 {|
4252 |}
4253 !! html/parsoid
4254 <table></table>
4255 !! end
4256
4257 # A table with nothing but a caption is invalid XHTML, we might want to render
4258 # this as <p>caption</p>
4259 # Parsoid team replies: table with only a caption is legal in HTML5
4260 !! test
4261 A table with nothing but a caption
4262 !! wikitext
4263 {|
4264 |+ caption
4265 |}
4266 !! html/php
4267 <table>
4268 <caption> caption
4269 </caption><tr><td></td></tr></table>
4270
4271 !! html/parsoid
4272 <table><caption> caption</caption></table>
4273 !! end
4274
4275 !! test
4276 A table with caption with default-spaced attributes and a table row
4277 !! wikitext
4278 {|
4279 |+ style="color: red;" | caption1
4280 |-
4281 | foo
4282 |}
4283 !! html
4284 <table>
4285 <caption style="color: red;"> caption1
4286 </caption>
4287 <tr>
4288 <td> foo
4289 </td></tr></table>
4290
4291 !! end
4292
4293 !! test
4294 A table with captions with non-default spaced attributes and a table row
4295 !! wikitext
4296 {|
4297 |+style="color: red;"|caption2
4298 |+ style="color: red;"| caption3
4299 |-
4300 | foo
4301 |}
4302 !! html
4303 <table>
4304 <caption style="color: red;">caption2
4305 </caption>
4306 <caption style="color: red;"> caption3
4307 </caption>
4308 <tr>
4309 <td> foo
4310 </td></tr></table>
4311
4312 !! end
4313
4314 !! test
4315 Table td-cell syntax variations
4316 !! wikitext
4317 {|
4318 | foo bar foo | baz
4319 | foo bar foo || baz
4320 | style='color:red;' | baz
4321 | style='color:red;' || baz
4322 |}
4323 !! html
4324 <table>
4325 <tr>
4326 <td> baz
4327 </td>
4328 <td> foo bar foo </td>
4329 <td> baz
4330 </td>
4331 <td style="color:red;"> baz
4332 </td>
4333 <td> style='color:red;' </td>
4334 <td> baz
4335 </td></tr></table>
4336
4337 !! end
4338
4339 !! test
4340 Simple table
4341 !! wikitext
4342 {|
4343 | 1 || 2
4344 |-
4345 | 3 || 4
4346 |}
4347 !! html
4348 <table>
4349 <tr>
4350 <td> 1 </td>
4351 <td> 2
4352 </td></tr>
4353 <tr>
4354 <td> 3 </td>
4355 <td> 4
4356 </td></tr></table>
4357
4358 !! end
4359
4360 !! test
4361 Simple table but with multiple dashes for row wikitext
4362 !! wikitext
4363 {|
4364 | foo
4365 |-----
4366 | bar
4367 |}
4368 !! html
4369 <table>
4370 <tr>
4371 <td> foo
4372 </td></tr>
4373 <tr>
4374 <td> bar
4375 </td></tr></table>
4376
4377 !! end
4378 !! test
4379 Multiplication table
4380 !! wikitext
4381 {| border="1" cellpadding="2"
4382 |+Multiplication table
4383 |-
4384 ! &times; !! 1 !! 2 !! 3
4385 |-
4386 ! 1
4387 | 1 || 2 || 3
4388 |-
4389 ! 2
4390 | 2 || 4 || 6
4391 |-
4392 ! 3
4393 | 3 || 6 || 9
4394 |-
4395 ! 4
4396 | 4 || 8 || 12
4397 |-
4398 ! 5
4399 | 5 || 10 || 15
4400 |}
4401 !! html
4402 <table border="1" cellpadding="2">
4403 <caption>Multiplication table
4404 </caption>
4405 <tr>
4406 <th> &#215; </th>
4407 <th> 1 </th>
4408 <th> 2 </th>
4409 <th> 3
4410 </th></tr>
4411 <tr>
4412 <th> 1
4413 </th>
4414 <td> 1 </td>
4415 <td> 2 </td>
4416 <td> 3
4417 </td></tr>
4418 <tr>
4419 <th> 2
4420 </th>
4421 <td> 2 </td>
4422 <td> 4 </td>
4423 <td> 6
4424 </td></tr>
4425 <tr>
4426 <th> 3
4427 </th>
4428 <td> 3 </td>
4429 <td> 6 </td>
4430 <td> 9
4431 </td></tr>
4432 <tr>
4433 <th> 4
4434 </th>
4435 <td> 4 </td>
4436 <td> 8 </td>
4437 <td> 12
4438 </td></tr>
4439 <tr>
4440 <th> 5
4441 </th>
4442 <td> 5 </td>
4443 <td> 10 </td>
4444 <td> 15
4445 </td></tr></table>
4446
4447 !! end
4448
4449 !! test
4450 Accept "||" in table headings
4451 !! wikitext
4452 {|
4453 !h1 || h2
4454 |}
4455 !! html
4456 <table>
4457 <tr>
4458 <th>h1 </th>
4459 <th> h2
4460 </th></tr></table>
4461
4462 !! end
4463
4464 !! test
4465 Accept "||" in indented table headings
4466 !! wikitext
4467 :{|
4468 !h1 || h2
4469 |}
4470 !! html
4471 <dl><dd><table>
4472 <tr>
4473 <th>h1 </th>
4474 <th> h2
4475 </th></tr></table></dd></dl>
4476
4477 !! end
4478
4479 !! test
4480 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4481 !! wikitext
4482 {|
4483 !| h1
4484 || a
4485 |}
4486 !! html
4487 <table>
4488 <tr>
4489 <th> h1
4490 </th>
4491 <td> a
4492 </td></tr></table>
4493
4494 !! end
4495
4496 !!test
4497 Accept "| !" at start of line in tables (ignore !-attribute)
4498 !! wikitext
4499 {|
4500 |-
4501 | !style="color:red" | bar
4502 |}
4503 !! html
4504 <table>
4505
4506 <tr>
4507 <td> bar
4508 </td></tr></table>
4509
4510 !!end
4511
4512 !!test
4513 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
4514 !! wikitext
4515 {|
4516 |-
4517 |style='color:red;'|+1
4518 |style='color:blue;'|-1
4519 |-
4520 | 1 || 2 || 3
4521 | 1 ||+2 ||-3
4522 |-
4523 | +1
4524 | -1
4525 |}
4526 !! html
4527 <table>
4528
4529 <tr>
4530 <td style="color:red;">+1
4531 </td>
4532 <td style="color:blue;">-1
4533 </td></tr>
4534 <tr>
4535 <td> 1 </td>
4536 <td> 2 </td>
4537 <td> 3
4538 </td>
4539 <td> 1 </td>
4540 <td>+2 </td>
4541 <td>-3
4542 </td></tr>
4543 <tr>
4544 <td> +1
4545 </td>
4546 <td> -1
4547 </td></tr></table>
4548
4549 !!end
4550
4551 !! test
4552 Table rowspan
4553 !! wikitext
4554 {| border=1
4555 | Cell 1, row 1
4556 |rowspan=2| Cell 2, row 1 (and 2)
4557 | Cell 3, row 1
4558 |-
4559 | Cell 1, row 2
4560 | Cell 3, row 2
4561 |}
4562 !! html
4563 <table border="1">
4564 <tr>
4565 <td> Cell 1, row 1
4566 </td>
4567 <td rowspan="2"> Cell 2, row 1 (and 2)
4568 </td>
4569 <td> Cell 3, row 1
4570 </td></tr>
4571 <tr>
4572 <td> Cell 1, row 2
4573 </td>
4574 <td> Cell 3, row 2
4575 </td></tr></table>
4576
4577 !! end
4578
4579 !! test
4580 Nested table
4581 !! wikitext
4582 {| border=1
4583 | &alpha;
4584 |
4585 {| bgcolor=#ABCDEF border=2
4586 |nested
4587 |-
4588 |table
4589 |}
4590 |the original table again
4591 |}
4592 !! html
4593 <table border="1">
4594 <tr>
4595 <td> &#945;
4596 </td>
4597 <td>
4598 <table bgcolor="#ABCDEF" border="2">
4599 <tr>
4600 <td>nested
4601 </td></tr>
4602 <tr>
4603 <td>table
4604 </td></tr></table>
4605 </td>
4606 <td>the original table again
4607 </td></tr></table>
4608
4609 !! end
4610
4611 !! test
4612 Invalid attributes in table cell (bug 1830)
4613 !! wikitext
4614 {|
4615 |Cell:|broken
4616 |}
4617 !! html
4618 <table>
4619 <tr>
4620 <td>broken
4621 </td></tr></table>
4622
4623 !! end
4624
4625
4626 !! test
4627 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4628 !! wikitext
4629 {|
4630 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4631 !! html
4632 <table>
4633 <tr>
4634 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4635 <td>]" onmouseover="alert(document.cookie)"&gt;test
4636 </td>
4637 </tr>
4638 </table>
4639
4640 !! end
4641
4642
4643 !! test
4644 Indented table markup mixed with indented pre content (proposed in bug 6200)
4645 !! wikitext
4646 <table>
4647 <tr>
4648 <td>
4649 Text that should be rendered preformatted
4650 </td>
4651 </tr>
4652 </table>
4653 !! html
4654 <table>
4655 <tr>
4656 <td>
4657 <pre>Text that should be rendered preformatted
4658 </pre>
4659 </td>
4660 </tr>
4661 </table>
4662
4663 !! end
4664
4665 !! test
4666 Template-generated table cell attributes and cell content
4667 !! wikitext
4668 {|
4669 |{{table_attribs}}
4670 | {{table_attribs}}
4671 |}
4672 !! html
4673 <table>
4674 <tr>
4675 <td style="color: red"> Foo
4676 </td>
4677 <td style="color: red"> Foo
4678 </td></tr></table>
4679
4680 !! end
4681
4682 !! test
4683 Template-generated table cell attributes and cell content (2)
4684 !! wikitext
4685 {|
4686 |align=center {{table_attribs}}
4687 |}
4688 !! html
4689 <table>
4690 <tr>
4691 <td align="center" style="color: red"> Foo
4692 </td></tr></table>
4693
4694 !! end
4695
4696 !! test
4697 Template-generated table cell attributes and cell content (3)
4698 !! wikitext
4699 {|
4700 |align=center {{table_cells}}
4701 |}
4702 !! html
4703 <table>
4704 <tr>
4705 <td align="center" style="color: red"> Foo </td>
4706 <td> Bar </td>
4707 <td> Baz
4708 </td></tr></table>
4709
4710 !! end
4711
4712 !! test
4713 Table with row followed by newlines and table heading
4714 !! wikitext
4715 {|
4716 |-
4717
4718 ! foo
4719 |}
4720 !! html
4721 <table>
4722
4723
4724 <tr>
4725 <th> foo
4726 </th></tr></table>
4727
4728 !! end
4729
4730 !! test
4731 Table with empty line following the start tag
4732 !! wikitext
4733 {|
4734
4735 |-
4736 | foo
4737 |}
4738 !! html
4739 <table>
4740
4741
4742 <tr>
4743 <td> foo
4744 </td></tr></table>
4745
4746 !! end
4747
4748 # FIXME: Preserve the attribute properly (with an empty string as value) in
4749 # the PHP parser. Parsoid implements the behavior below.
4750 !! test
4751 Table attributes with empty value
4752 !! wikitext
4753 {|
4754 | style=| hello
4755 |}
4756 !! html/parsoid
4757 <table>
4758 <tbody>
4759 <tr>
4760 <td style=""> hello
4761 </td></tr></tbody></table>
4762
4763 !! end
4764
4765 !! test
4766 Wikitext table with a lot of comments
4767 !! wikitext
4768 {|
4769 <!-- c0 -->
4770 | foo
4771 <!-- c1 -->
4772 |- <!-- c2 -->
4773 <!-- c3 -->
4774 |<!-- c4 -->
4775 <!-- c5 -->
4776 |}
4777 !! html
4778 <table>
4779 <tr>
4780 <td> foo
4781 </td></tr>
4782 <tr>
4783 <td>
4784 </td></tr></table>
4785
4786 !! end
4787
4788 !! test
4789 Wikitext table with double-line table cell
4790 !! wikitext
4791 {|
4792 |a
4793 b
4794 |}
4795 !! html
4796 <table>
4797 <tr>
4798 <td>a
4799 <p>b
4800 </p>
4801 </td></tr></table>
4802
4803 !! end
4804
4805 !! test
4806 Table cell with a single comment
4807 !! wikitext
4808 {|
4809 | <!-- c1 -->
4810 | a
4811 |}
4812 !! html
4813 <table>
4814 <tr>
4815 <td>
4816 </td>
4817 <td> a
4818 </td></tr></table>
4819
4820 !! end
4821
4822 # The expected HTML structure in this test is debatable. The PHP parser does
4823 # not parse this kind of table at all. The main focus for Parsoid is on
4824 # round-tripping, so this output is ok for now. TODO: revisit!
4825 !! test
4826 Wikitext table with html-syntax row
4827 !! wikitext
4828 {|
4829 |-
4830 <td>foo</td>
4831 |}
4832 !! html/parsoid
4833 <table>
4834 <tbody>
4835 <tr>
4836 <td>foo</td></tr></tbody></table>
4837 !! end
4838
4839 !! test
4840 Implicit <td> after a |-
4841 (PHP parser relies on Tidy to add the missing <td> tags)
4842 !! options
4843 parsoid=wt2html,wt2wt
4844 !! wikitext
4845 {|
4846 |-
4847 a
4848 |}
4849 !! html
4850 <table>
4851 <tr><td>a</td></tr>
4852 </table>
4853 !! end
4854
4855 !! test
4856 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4857 (PHP parser relies on Tidy to add the missing <td> tags)
4858 !! options
4859 parsoid=wt2html,wt2wt
4860 !! wikitext
4861 {|
4862 |-
4863 |
4864 a
4865 |-
4866 b
4867 |}
4868 !! html
4869 <table>
4870 <tbody>
4871 <tr><td><pre>a</pre></td></tr>
4872 <tr><td> b</td></tr>
4873 </tbody>
4874 </table>
4875 !! end
4876
4877 !! test
4878 Lists should be recognized in an implicit <td> context
4879 (PHP parser relies on Tidy to add the missing <td> tags)
4880 !! options
4881 parsoid=wt2html,wt2wt
4882 !! wikitext
4883 {|
4884 |-
4885 *a
4886 |}
4887 !! html
4888 <table>
4889 <tr>
4890 <td><ul>
4891 <li>a</li>
4892 </ul></td>
4893 </tr>
4894 </table>
4895 !! end
4896
4897 !! test
4898 Parsoid: Round-trip tables directly followed by content (bug 51219)
4899 !! options
4900 parsoid=wt2html,wt2wt
4901 !! wikitext
4902 {|
4903 |foo
4904 |} bar
4905
4906 {|
4907 |baz
4908 |}<b>quux</b>
4909 !! html
4910 <table><tbody>
4911 <tr>
4912 <td>foo</td></tr></tbody></table> bar
4913 <table>
4914 <tbody>
4915 <tr>
4916 <td>baz</td></tr></tbody></table><b>quux</b>
4917 !! end
4918
4919 !! test
4920 Parsoid: Default to a newline after tables in new content (bug 51219)
4921 !! options
4922 parsoid=html2wt
4923 !! wikitext
4924 {|
4925 |foo
4926 |}
4927 <nowiki> </nowiki>bar
4928 {|
4929 |baz
4930 |}
4931 '''quux'''
4932 !! html
4933 <table><tbody>
4934 <tr><td>foo</td></tr></tbody></table> bar
4935 <table><tbody>
4936 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4937 !! end
4938
4939 !! test
4940 Parsoid: newline inducing block nodes don't suppress <nowiki>
4941 !! options
4942 parsoid=html2wt
4943 !! wikitext
4944 <nowiki> </nowiki>a
4945
4946 = foo =
4947 !! html
4948 a<h1>foo</h1>
4949 !! end
4950
4951 ###
4952 ### Internal links
4953 ###
4954 !! test
4955 Plain link, capitalized
4956 !! wikitext
4957 [[Main Page]]
4958 !! html
4959 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4960 </p>
4961 !! end
4962
4963 !! test
4964 Plain link, uncapitalized
4965 !! wikitext
4966 [[main Page]]
4967 !! html
4968 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4969 </p>
4970 !! end
4971
4972 !! test
4973 Piped link
4974 !! wikitext
4975 [[Main Page|The Main Page]]
4976 !! html
4977 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4978 </p>
4979 !! end
4980
4981 !! test
4982 Piped link with comment in link text
4983 !! wikitext
4984 [[Main Page|The Main<!--front--> Page]]
4985 !! html
4986 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4987 </p>
4988 !! end
4989
4990 !! test
4991 Broken link
4992 !! wikitext
4993 [[Zigzagzogzagzig]]
4994 !! html
4995 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4996 </p>
4997 !! end
4998
4999 !! test
5000 Broken link with fragment
5001 !! wikitext
5002 [[Zigzagzogzagzig#zug]]
5003 !! html
5004 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5005 </p>
5006 !! end
5007
5008 !! test
5009 Special page link with fragment
5010 !! wikitext
5011 [[Special:Version#anchor]]
5012 !! html
5013 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5014 </p>
5015 !! end
5016
5017 !! test
5018 Nonexistent special page link with fragment
5019 !! wikitext
5020 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5021 !! html
5022 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5023 </p>
5024 !! end
5025
5026 !! test
5027 Link with prefix
5028 !! wikitext
5029 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5030 !! html
5031 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5032 </p>
5033 !! end
5034
5035 !! test
5036 Link with suffix
5037 !! wikitext
5038 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5039 !! html
5040 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
5041 </p>
5042 !! end
5043
5044 !! article
5045 prefixed article
5046 !! text
5047 Some text
5048 !! endarticle
5049
5050 !! test
5051 Bug 43661: Piped links with identical prefixes
5052 !! wikitext
5053 [[prefixed article|prefixed articles with spaces]]
5054
5055 [[prefixed article|prefixed articlesaoeu]]
5056
5057 [[Main Page|Main Page test]]
5058 !! html
5059 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5060 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5061 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5062 </p>
5063 !! end
5064
5065
5066 !! test
5067 Link with HTML entity in suffix / tail
5068 !! wikitext
5069 [[Main Page]]&quot;, [[Main Page]]&#97;
5070 !! html
5071 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
5072 </p>
5073 !! end
5074
5075 !! test
5076 Link with 3 brackets
5077 !! wikitext
5078 [[[Main Page]]]
5079 !! html
5080 <p>[[[Main Page]]]
5081 </p>
5082 !! end
5083
5084 !! test
5085 Link with 4 brackets
5086 !! wikitext
5087 [[[[Main Page]]]]
5088 !! html
5089 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5090 </p>
5091 !! end
5092
5093 !! test
5094 Piped link with 3 brackets
5095 !! wikitext
5096 [[[main page|the main page]]]
5097 !! html
5098 <p>[[[main page|the main page]]]
5099 </p>
5100 !! end
5101
5102 !! test
5103 Piped link with extlink-like text
5104 !! wikitext
5105 [[Main Page|[bar]]]
5106 [[Main Page|This is a [bar]]]
5107 !! html
5108 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5109 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5110 </p>
5111 !! end
5112
5113 !! test
5114 Link with multiple pipes
5115 !! wikitext
5116 [[Main Page|The|Main|Page]]
5117 !! html
5118 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5119 </p>
5120 !! end
5121
5122 !! test
5123 Link to namespaces
5124 !! wikitext
5125 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5126 !! html
5127 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
5128 </p>
5129 !! end
5130
5131 !! article
5132 MemoryAlpha:AlphaTest
5133 !! text
5134 This is an article in the MemoryAlpha namespace
5135 (which shadows the memoryalpha interwiki link).
5136 !! endarticle
5137
5138 !! test
5139 Namespace takes precedence over interwiki link (bug 51680)
5140 !! wikitext
5141 [[MemoryAlpha:AlphaTest]]
5142 !! html
5143 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5144 </p>
5145 !! end
5146
5147 # The previous test doesn't work correctly in html2*, due to not recognizing the
5148 # link as an internal one. This one checks for the correct behavior.
5149 !! test
5150 Link to namespace preferred over interwiki with correct rel attribute
5151 !! options
5152 parsoid=html2wt,html2html
5153 !! wikitext
5154 [[MemoryAlpha:AlphaTest]]
5155 !! html
5156 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5157 </p>
5158 !! end
5159
5160 !! test
5161 Piped link to namespace
5162 !! wikitext
5163 [[Meta:Disclaimers|The disclaimers]]
5164 !! html
5165 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
5166 </p>
5167 !! end
5168
5169 !! test
5170 Link containing }
5171 !! wikitext
5172 [[Usually caused by a typo (oops}]]
5173 !! html
5174 <p>[[Usually caused by a typo (oops}]]
5175 </p>
5176 !! end
5177
5178 !! test
5179 Link containing % (not as a hex sequence)
5180 !! wikitext
5181 [[7% Solution]]
5182 !! html
5183 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5184 </p>
5185 !! end
5186
5187 !! test
5188 Link containing % as a single hex sequence interpreted to char
5189 !! wikitext
5190 [[7%25 Solution]]
5191 !! html
5192 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5193 </p>
5194 !!end
5195
5196 !! test
5197 Link containing % as a double hex sequence interpreted to hex sequence
5198 !! wikitext
5199 [[7%2525 Solution]]
5200 !! html
5201 <p>[[7%2525 Solution]]
5202 </p>
5203 !!end
5204
5205 !! test
5206 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5207 Example for such a section: == < ==
5208 !! wikitext
5209 [[%23%3c]][[%23%3e]]
5210 !! html
5211 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5212 </p>
5213 !! end
5214
5215 !! test
5216 Link containing "<#" and ">#" as a hex sequences
5217 !! wikitext
5218 [[%3c%23]][[%3e%23]]
5219 !! html
5220 <p>[[%3c%23]][[%3e%23]]
5221 </p>
5222 !! end
5223
5224 !! test
5225 Link containing an equals sign
5226 !! wikitext
5227 [[Special:BookSources/isbn=4-00-026157-6]]
5228 !! html
5229 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
5230 </p>
5231 !! end
5232
5233 !! article
5234 Foo~bar
5235 !! text
5236 Just a test of an article title containing a tilde.
5237 !! endarticle
5238
5239 # note that links containing signatures, like [[Foo~~~~]], are
5240 # massaged by the pre-save transform (PST) and so the tildes are never
5241 # seen by the parser.
5242 !! test
5243 Link containing a tilde
5244 !! wikitext
5245 [[Foo~bar]]
5246 !! html
5247 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5248 </p>
5249 !! end
5250
5251 !! test
5252 Link containing double-single-quotes '' (bug 4598)
5253 !! wikitext
5254 [[Lista d''e paise d''o munno]]
5255 !! html
5256 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
5257 </p>
5258 !! end
5259
5260 !! test
5261 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5262 !! wikitext
5263 Some [[Link|pretty ''italics'' and stuff]]!
5264 !! html
5265 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
5266 </p>
5267 !! end
5268
5269 !! test
5270 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5271 !! wikitext
5272 ''Some [[Link|pretty ''italics'' and stuff]]!
5273 !! html
5274 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
5275 </p>
5276 !! end
5277
5278 !! test
5279 Link with double quotes in title part (literal) and alternate part (interpreted)
5280 !! wikitext
5281 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5282
5283 [[''Pentecoste'']]
5284
5285 [[''Pentecoste''|Pentecoste]]
5286
5287 [[''Pentecoste''|''Pentecoste'']]
5288 !! html
5289 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
5290 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
5291 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
5292 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
5293 </p>
5294 !! end
5295
5296 !! test
5297 Broken image links with HTML captions (bug 39700)
5298 !! wikitext
5299 [[File:Nonexistent|<script></script>]]
5300 [[File:Nonexistent|100px|<script></script>]]
5301 [[File:Nonexistent|&lt;]]
5302 [[File:Nonexistent|a<i>b</i>c]]
5303 !! html
5304 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5305 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5306 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5307 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5308 </p>
5309 !! end
5310
5311 !! test
5312 Plain link to URL
5313 !! wikitext
5314 [[http://www.example.com]]
5315 !! html
5316 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5317 </p>
5318 !! end
5319
5320 !! test
5321 Plain link to URL with link text
5322 !! wikitext
5323 [[http://www.example.com Link text]]
5324 !! html
5325 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5326 </p>
5327 !! end
5328
5329 !! test
5330 Plain link to protocol-relative URL
5331 !! wikitext
5332 [[//www.example.com]]
5333 !! html
5334 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5335 </p>
5336 !! end
5337
5338 !! test
5339 Plain link to protocol-relative URL with link text
5340 !! wikitext
5341 [[//www.example.com Link text]]
5342 !! html
5343 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5344 </p>
5345 !! end
5346
5347 !! test
5348 Plain link to page with question mark in title
5349 !! wikitext
5350 [[A?b]]
5351
5352 [[A?b|Baz]]
5353 !! html
5354 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5355 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5356 </p>
5357 !! end
5358
5359
5360 # I'm fairly sure the expected result here is wrong.
5361 # We want these to be URL links, not pseudo-pages with URLs for titles....
5362 # However the current output is also pretty screwy.
5363 #
5364 # ----
5365 # I'm changing it to match the current output--it arguably makes more
5366 # sense in the light of the test above. Old expected result was:
5367 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5368 #</p>
5369 # But I think this test is bordering on "garbage in, garbage out" anyway.
5370 # -- wtm
5371 !! test
5372 Piped link to URL
5373 !! wikitext
5374 Piped link to URL: [[http://www.example.com|an example URL]]
5375 !! html
5376 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5377 </p>
5378 !! end
5379
5380 !! test
5381 BUG 2: [[page|http://url/]] should link to page, not http://url/
5382 !! wikitext
5383 [[Main Page|http://url/]]
5384 !! html
5385 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5386 </p>
5387 !! end
5388
5389 !! test
5390 BUG 337: Escaped self-links should be bold
5391 !! options
5392 title=[[Bug462]]
5393 !! wikitext
5394 [[Bu&#103;462]] [[Bug462]]
5395 !! html
5396 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5397 </p>
5398 !! end
5399
5400 !! test
5401 Self-link to section should not be bold
5402 !! options
5403 title=[[Main Page]]
5404 !! wikitext
5405 [[Main Page#section]]
5406 !! html
5407 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5408 </p>
5409 !! end
5410
5411 !! article
5412 00
5413 !! text
5414 This is 00.
5415 !! endarticle
5416
5417 !!test
5418 Self-link to numeric title
5419 !!options
5420 title=[[0]]
5421 !! wikitext
5422 [[0]]
5423 !! html
5424 <p><strong class="selflink">0</strong>
5425 </p>
5426 !!end
5427
5428 !!test
5429 Link to numeric-equivalent title
5430 !!options
5431 title=[[0]]
5432 !! wikitext
5433 [[00]]
5434 !! html
5435 <p><a href="/wiki/00" title="00">00</a>
5436 </p>
5437 !!end
5438
5439 !! test
5440 <nowiki> inside a link
5441 !! wikitext
5442 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5443 !! html
5444 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5445 </p>
5446 !! end
5447
5448 !! test
5449 Non-breaking spaces in title
5450 !! wikitext
5451 [[&nbsp; Main &nbsp; Page &nbsp;]]
5452 !! html
5453 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5454 </p>
5455 !!end
5456
5457 !! test
5458 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5459 !! options
5460 language=ca
5461 !! wikitext
5462 '''[[Main Page]]'''
5463 !! html
5464 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5465 </p>
5466 !! end
5467
5468 !! test
5469 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5470 !! options
5471 language=ca
5472 !! wikitext
5473 ''[[Main Page]]''
5474 !! html
5475 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5476 </p>
5477 !! end
5478
5479 !! test
5480 Internal link with en linktrail: no apostrophes (bug 27473)
5481 !! options
5482 language=en
5483 !! wikitext
5484 [[Something]]'nice
5485 !! html
5486 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5487 </p>
5488 !! end
5489
5490 !! test
5491 Internal link with ca linktrail with apostrophes (bug 27473)
5492 !! options
5493 language=ca
5494 !! wikitext
5495 [[Something]]'nice
5496 !! html
5497 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5498 </p>
5499 !! end
5500
5501 !! test
5502 Internal link with kaa linktrail with apostrophes (bug 27473)
5503 !! options
5504 language=kaa
5505 !! wikitext
5506 [[Something]]'nice
5507 !! html
5508 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
5509 </p>
5510 !! end
5511
5512 !! test
5513 1. Interaction of linktrail and template encapsulation
5514 !! options
5515 parsoid
5516 !! wikitext
5517 {{echo|[[Foo]]}}l
5518 !! html
5519 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
5520 !! end
5521
5522 !! test
5523 2. Interaction of linktrail and template encapsulation
5524 !! options
5525 parsoid
5526 !! wikitext
5527 {{echo|Some [[Fool]]}}s
5528 !! html
5529 <p data-parsoid='{}'><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
5530 !! end
5531
5532 !! test
5533 3. Interaction of linktrail and template encapsulation
5534 !! options
5535 parsoid
5536 !! wikitext
5537 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5538 !! html
5539 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
5540 !! end
5541
5542 !! article
5543 Söfnuður
5544 !! text
5545 Test.
5546 !! endarticle
5547
5548 !! test
5549 Internal link with is link prefix
5550 !! options
5551 language=is
5552 !! wikitext
5553 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5554 !! html
5555 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5556 </p>
5557 !! end
5558
5559 !! article
5560 Mótmælendatrú
5561 !! text
5562 Test.
5563 !! endarticle
5564
5565 !! test
5566 Internal link with is link trail and link prefix
5567 !! options
5568 language=is
5569 !! wikitext
5570 [[mótmælendatrú|xxx]]ar
5571 [[mótmælendatrú]]ar
5572 mótmælenda[[söfnuður]]
5573 mótmælenda[[söfnuður|söfnuðir]]
5574 mótmælenda[[söfnuður|söfnuðir]]xxx
5575 !! html
5576 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5577 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5578 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5579 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5580 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5581 </p>
5582 !! end
5583
5584 !! test
5585 Parsoid link trail escaping
5586 !! options
5587 parsoid=html2wt,html2html
5588 !! wikitext
5589 [[apple]]<nowiki/>s
5590 !! html
5591 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5592 !! end
5593
5594 !! test
5595 Parsoid link prefix escaping
5596 !! options
5597 language=is
5598 parsoid=html2wt,html2html
5599 !! wikitext
5600 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5601 !! html
5602 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5603 !! end
5604
5605 !! test
5606 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5607 !! wikitext
5608 [[Foo| bar]]
5609
5610 [[Foo| ''bar'']]
5611
5612 [http://wp.org foo]
5613
5614 [http://wp.org ''foo'']
5615 !! html
5616 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5617 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
5618 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5619 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5620 </p>
5621 !! end
5622
5623 !! test
5624 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5625 !! options
5626 parsoid
5627 !! wikitext
5628 [[Foo|{{echo|a}} b {{echo|c}}]]
5629 !! html
5630 <p><a rel="mw:WikiLink" href="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
5631 !! end
5632
5633 ###
5634 ### Interwiki links (see maintenance/interwiki.sql)
5635 ###
5636
5637 !! test
5638 Inline interwiki link
5639 !! wikitext
5640 [[MeatBall:SoftSecurity]]
5641 !! html
5642 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5643 </p>
5644 !! end
5645
5646 !! test
5647 Inline interwiki link with empty title (bug 2372)
5648 !! wikitext
5649 [[MeatBall:]]
5650 !! html
5651 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5652 </p>
5653 !! end
5654
5655 !! test
5656 Interwiki link encoding conversion (bug 1636)
5657 !! wikitext
5658 *[[Wikipedia:ro:Olteni&#0355;a]]
5659 *[[Wikipedia:ro:Olteni&#355;a]]
5660 !! html
5661 <ul>
5662 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
5663 </li>
5664 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
5665 </li>
5666 </ul>
5667
5668 !! end
5669
5670 !! test
5671 Interwiki link with fragment (bug 2130)
5672 !! wikitext
5673 [[MeatBall:SoftSecurity#foo]]
5674 !! html
5675 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5676 </p>
5677 !! end
5678
5679 # Ideally the wikipedia: prefix here should be proto-relative too
5680 !! test
5681 Different interwiki prefixes mapping to the same URL
5682 !! options
5683 parsoid
5684 !! wikitext
5685 [[wikipedia:Foo]]
5686
5687 [[:en:Foo]]
5688 !! html
5689 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}'>wikipedia:Foo</a></p>
5690
5691 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}'>en:Foo</a></p>
5692 !! end
5693
5694 !! test
5695 Interwiki links that cannot be represented in wiki syntax
5696 !! options
5697 parsoid
5698 !! wikitext
5699 [[meatball:ok]]
5700 [[meatball:ok#foo|ok with fragment]]
5701 [[meatball:ok_as_well?|ok ending with ? mark]]
5702 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5703 [http://de.wikipedia.org/wiki/#foo is just fragment]
5704
5705 !! html
5706 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5707 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5708 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
5709 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5710 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5711 !! end
5712
5713 !! test
5714 Interwiki links: trail
5715 !! options
5716 parsoid
5717 !! wikitext
5718 [[wikipedia:Foo|Ba]]r
5719 !! html
5720 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}'>Bar</a></p>
5721 !! end
5722
5723 ###
5724 ### Interlanguage links
5725 ### Language links (so that searching for '### language' matches..)
5726 ###
5727
5728 !! test
5729 Interlanguage link
5730 !! wikitext
5731 Blah blah blah
5732 [[zh:Chinese]]
5733 !! html
5734 <p>Blah blah blah
5735 </p>
5736 !! end
5737
5738 !! test
5739 Double interlanguage link
5740 !! wikitext
5741 Blah blah blah
5742 [[es:Spanish]]
5743 [[zh:Chinese]]
5744 !! html
5745 <p>Blah blah blah
5746 </p>
5747 !! end
5748
5749 !! test
5750 Interlanguage link, with prefix links
5751 !! options
5752 language=ln
5753 !! wikitext
5754 Blah blah blah
5755 [[zh:Chinese]]
5756 !! html
5757 <p>Blah blah blah
5758 </p>
5759 !! end
5760
5761 !! test
5762 Double interlanguage link, with prefix links (bug 8897)
5763 !! options
5764 language=ln
5765 !! wikitext
5766 Blah blah blah
5767 [[es:Spanish]]
5768 [[zh:Chinese]]
5769 !! html
5770 <p>Blah blah blah
5771 </p>
5772 !! end
5773
5774 !! test
5775 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5776 !! options
5777 language=ln
5778 !! wikitext
5779 [[WW&nbsp;II]]
5780 !! html
5781 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
5782 </p>
5783 !! end
5784
5785 !! test
5786 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5787 !! options
5788 parsoid=html2wt
5789 !! wikitext
5790 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5791
5792 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5793 !! html
5794 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5795 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5796 !! end
5797
5798 !! test
5799 Parsoid: handle constructor well
5800 !! options
5801 parsoid
5802 !! wikitext
5803 [[constructor]]
5804
5805 [[constructor:foo]]
5806 !! html
5807 <p><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
5808
5809 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
5810 !! end
5811
5812 !! test
5813 Parsoid: recognize interlanguage links without a target page
5814 !! options
5815 parsoid
5816 !! wikitext
5817 [[ko:]]
5818 !! html
5819 <p>
5820 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5821 !! end
5822
5823 !! test
5824 Parsoid: recognize interwiki links without a target page
5825 !! options
5826 parsoid
5827 !! wikitext
5828 [[:ko:]]
5829 !! html
5830 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
5831 !! end
5832
5833 !! test
5834 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
5835 !! options
5836 parsoid
5837 !! wikitext
5838 [[en:Foo]]
5839 !! html
5840 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
5841 !! end
5842
5843 ###
5844 ### Redirects, Parsoid-only
5845 ###
5846 !! test
5847 1. Simple redirect to page
5848 !! options
5849 parsoid
5850 !! wikitext
5851 #REDIRECT [[Main Page]]
5852 !! html
5853 <link rel="mw:PageProp/redirect" href="./Main_Page">
5854 !! end
5855
5856 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
5857 !! test
5858 2. Other redirect variants
5859 !! options
5860 parsoid=wt2html,wt2wt
5861 !! wikitext
5862 #REDIRECT [[Main_Page]]
5863 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
5864 !! html
5865 <link rel="mw:PageProp/redirect" href="./Main_Page">
5866 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
5867 !! end
5868
5869 !! test
5870 Optional colon in #REDIRECT
5871 !! options
5872 # the colon is archaic syntax. we support it for wt2html, but we
5873 # don't care that it roundtrips back to the modern syntax.
5874 parsoid=wt2html,html2html
5875 !! wikitext
5876 #REDIRECT:[[Main Page]]
5877 !! html
5878 <link rel="mw:PageProp/redirect" href="./Main_Page">
5879 !! end
5880
5881 !! test
5882 Whitespace in #REDIRECT with optional colon
5883 !! options
5884 # the colon and gratuitous whitespace is archaic syntax. we support
5885 # it for wt2html, but we don't care that it roundtrips back to the
5886 # modern syntax (without extra whitespace)
5887 parsoid=wt2html,html2html
5888 !! wikitext
5889
5890 #REDIRECT
5891 :
5892 [[Main Page]]
5893 !! html
5894 <link rel="mw:PageProp/redirect" href="./Main_Page">
5895 !! end
5896
5897 !! test
5898 Piped link in #REDIRECT
5899 !! options
5900 # content after piped link is ignored. we support this syntax,
5901 # but don't care that the piped link is lost when we roundtrip this.
5902 parsoid=wt2html
5903 !! wikitext
5904 #REDIRECT [[Main Page|bar]]
5905 !! html
5906 <link rel="mw:PageProp/redirect" href="./Main_Page">
5907 !! end
5908
5909 !! test
5910 Redirect to category
5911 !! options
5912 parsoid=wt2html
5913 !! wikitext
5914 #REDIRECT [[Category:Foo]]
5915 !! html
5916 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5917 !! end
5918
5919 !! test
5920 Redirect to category with URL encoding
5921 !! options
5922 parsoid=wt2html
5923 !! wikitext
5924 #REDIRECT [[Category%3AFoo]]
5925 !! html
5926 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5927 !! end
5928
5929 !! test
5930 Redirect to category page
5931 !! options
5932 parsoid=wt2html,html2html
5933 !! wikitext
5934 #REDIRECT [[:Category:Foo]]
5935 !! html
5936 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5937 !! end
5938
5939 !! test
5940 Redirect to image page (1)
5941 !! options
5942 parsoid
5943 !! wikitext
5944 #REDIRECT [[File:Wiki.png]]
5945 !! html
5946 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5947 !! end
5948
5949 !! test
5950 Redirect to image page (2)
5951 !! options
5952 parsoid
5953 !! wikitext
5954 #REDIRECT [[Image:Wiki.png]]
5955 !! html
5956 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5957 !! end
5958
5959 !! test
5960 Redirect to language
5961 !! options
5962 parsoid
5963 !! wikitext
5964 #REDIRECT [[en:File:Wiki.png]]
5965 !! html
5966 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5967 !! end
5968
5969 !! test
5970 Redirect to interwiki
5971 !! options
5972 parsoid
5973 !! wikitext
5974 #REDIRECT [[meatball:File:Wiki.png]]
5975 !! html
5976 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5977 !! end
5978
5979 !! test
5980 Non-English #REDIRECT
5981 !! options
5982 parsoid
5983 language=is
5984 !! wikitext
5985 #TILVÍSUN [[Main Page]]
5986 !! html
5987 <link rel="mw:PageProp/redirect" href="./Main_Page">
5988 !! end
5989
5990 !! test
5991 New redirect
5992 !! options
5993 parsoid=html2wt
5994 !! wikitext
5995 Foo
5996 #REDIRECT [[Foo]]
5997 !! html
5998 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
5999 !! end
6000
6001 ##
6002 ## XHTML tidiness
6003 ###
6004
6005 !! test
6006 <br> to <br />
6007 !! wikitext
6008 1<br>2<br />3
6009 !! html
6010 <p>1<br />2<br />3
6011 </p>
6012 !! end
6013
6014 !! test
6015 Broken br tag sanitization
6016 !! wikitext
6017 </br>
6018 !! html/php
6019 <p>&lt;/br&gt;
6020 </p>
6021 !! end
6022
6023 # TODO: Fix html2html mode (bug 51055)!
6024 !! test
6025 Parsoid: Broken br tag recognition
6026 !! options
6027 parsoid=wt2html
6028 !! wikitext
6029 </br>
6030 !! html/parsoid
6031 <p><br></p>
6032 !! end
6033
6034 !! test
6035 Incorrecly removing closing slashes from correctly formed XHTML
6036 !! wikitext
6037 <br style="clear:both;" />
6038 !! html
6039 <p><br style="clear:both;" />
6040 </p>
6041 !! end
6042
6043 !! test
6044 Failing to transform badly formed HTML into correct XHTML
6045 !! wikitext
6046 <br style="clear: left;">
6047 <br style="clear: right;">
6048 <br style="clear: both;">
6049 !! html
6050 <p><br style="clear: left;" />
6051 <br style="clear: right;" />
6052 <br style="clear: both;" />
6053 </p>
6054 !!end
6055
6056 !! test
6057 Handling html with a div self-closing tag
6058 !! wikitext
6059 <div title />
6060 <div title/>
6061 <div title/ >
6062 <div title=bar />
6063 <div title=bar/>
6064 <div title=bar/ >
6065 !! html
6066 <p>&lt;div title /&gt;
6067 &lt;div title/&gt;
6068 </p>
6069 <div>
6070 <p>&lt;div title=bar /&gt;
6071 &lt;div title=bar/&gt;
6072 </p>
6073 <div title="bar/"></div>
6074 </div>
6075
6076 !! end
6077
6078 !! test
6079 Handling html with a br self-closing tag
6080 !! wikitext
6081 <br title />
6082 <br title/>
6083 <br title/ >
6084 <br title=bar />
6085 <br title=bar/>
6086 <br title=bar/ >
6087 !! html
6088 <p><br title="title" />
6089 <br title="title" />
6090 <br />
6091 <br title="bar" />
6092 <br title="bar" />
6093 <br title="bar/" />
6094 </p>
6095 !! end
6096
6097 !! test
6098 Horizontal ruler (should it add that extra space?)
6099 !! wikitext
6100 <hr>
6101 <hr >
6102 foo <hr
6103 > bar
6104 !! html
6105 <hr />
6106 <hr />
6107 foo <hr /> bar
6108
6109 !! end
6110
6111 !! test
6112 Horizontal ruler -- 4+ dashes render hr
6113 !! wikitext
6114 ----
6115 !! html
6116 <hr />
6117
6118 !! end
6119
6120 !! test
6121 Horizontal ruler -- eats additional dashes on the same line
6122 !! wikitext
6123 ---------
6124 !! html
6125 <hr />
6126
6127 !! end
6128
6129 !! test
6130 Horizontal ruler -- does not collapse dashes on consecutive lines
6131 !! wikitext
6132 ----
6133 ----
6134 !! html
6135 <hr />
6136 <hr />
6137
6138 !! end
6139
6140 !! test
6141 Horizontal ruler -- <4 dashes render as plain text
6142 !! wikitext
6143 ---
6144 !! html
6145 <p>---
6146 </p>
6147 !! end
6148
6149 !! test
6150 Horizontal ruler -- Supports content following dashes on same line
6151 !! wikitext
6152 ---- Foo
6153 !! html
6154 <hr /> Foo
6155
6156 !! end
6157
6158 ###
6159 ### Block-level elements
6160 ###
6161 !! test
6162 Common list
6163 !! wikitext
6164 *Common list
6165 * item 2
6166 *item 3
6167 !! html
6168 <ul>
6169 <li>Common list
6170 </li>
6171 <li> item 2
6172 </li>
6173 <li>item 3
6174 </li>
6175 </ul>
6176
6177 !! end
6178
6179 !! test
6180 Numbered list
6181 !! wikitext
6182 #Numbered list
6183 #item 2
6184 # item 3
6185 !! html
6186 <ol>
6187 <li>Numbered list
6188 </li>
6189 <li>item 2
6190 </li>
6191 <li> item 3
6192 </li>
6193 </ol>
6194
6195 !! end
6196
6197 !! test
6198 Mixed list
6199 !! wikitext
6200 *Mixed list
6201 *# with numbers
6202 ** and bullets
6203 *# and numbers
6204 *bullets again
6205 **bullet level 2
6206 ***bullet level 3
6207 ***#Number on level 4
6208 **bullet level 2
6209 **#Number on level 3
6210 **#Number on level 3
6211 *#number level 2
6212 *Level 1
6213 *** Level 3
6214 #** Level 3, but ordered
6215 !! html
6216 <ul>
6217 <li>Mixed list
6218 <ol>
6219 <li> with numbers
6220 </li>
6221 </ol>
6222 <ul>
6223 <li> and bullets
6224 </li>
6225 </ul>
6226 <ol>
6227 <li> and numbers
6228 </li>
6229 </ol>
6230 </li>
6231 <li>bullets again
6232 <ul>
6233 <li>bullet level 2
6234 <ul>
6235 <li>bullet level 3
6236 <ol>
6237 <li>Number on level 4
6238 </li>
6239 </ol>
6240 </li>
6241 </ul>
6242 </li>
6243 <li>bullet level 2
6244 <ol>
6245 <li>Number on level 3
6246 </li>
6247 <li>Number on level 3
6248 </li>
6249 </ol>
6250 </li>
6251 </ul>
6252 <ol>
6253 <li>number level 2
6254 </li>
6255 </ol>
6256 </li>
6257 <li>Level 1
6258 <ul>
6259 <li><ul>
6260 <li> Level 3
6261 </li>
6262 </ul>
6263 </li>
6264 </ul>
6265 </li>
6266 </ul>
6267 <ol>
6268 <li><ul>
6269 <li><ul>
6270 <li> Level 3, but ordered
6271 </li>
6272 </ul>
6273 </li>
6274 </ul>
6275 </li>
6276 </ol>
6277
6278 !! end
6279
6280 !! test
6281 Nested lists 1
6282 !! wikitext
6283 *foo
6284 **bar
6285 !! html
6286 <ul>
6287 <li>foo
6288 <ul>
6289 <li>bar
6290 </li>
6291 </ul>
6292 </li>
6293 </ul>
6294
6295 !! end
6296
6297 !! test
6298 Nested lists 2
6299 !! wikitext
6300 **foo
6301 *bar
6302 !! html
6303 <ul>
6304 <li><ul>
6305 <li>foo
6306 </li>
6307 </ul>
6308 </li>
6309 <li>bar
6310 </li>
6311 </ul>
6312
6313 !! end
6314
6315 !! test
6316 Nested lists 3 (first element empty)
6317 !! wikitext
6318 *
6319 **bar
6320 !! html
6321 <ul>
6322 <li>
6323 <ul>
6324 <li>bar
6325 </li>
6326 </ul>
6327 </li>
6328 </ul>
6329
6330 !! end
6331
6332 !! test
6333 Nested lists 4 (first element empty)
6334 !! wikitext
6335 **
6336 *bar
6337 !! html
6338 <ul>
6339 <li><ul>
6340 <li>
6341 </li>
6342 </ul>
6343 </li>
6344 <li>bar
6345 </li>
6346 </ul>
6347
6348 !! end
6349
6350 !! test
6351 Nested lists 5 (both elements empty)
6352 !! wikitext
6353 **
6354 *
6355 !! html
6356 <ul>
6357 <li><ul>
6358 <li>
6359 </li>
6360 </ul>
6361 </li>
6362 <li>
6363 </li>
6364 </ul>
6365
6366 !! end
6367
6368 !! test
6369 Nested lists 6 (both elements empty)
6370 !! wikitext
6371 *
6372 **
6373 !! html
6374 <ul>
6375 <li>
6376 <ul>
6377 <li>
6378 </li>
6379 </ul>
6380 </li>
6381 </ul>
6382
6383 !! end
6384
6385 !! test
6386 Nested lists 7 (skip initial nesting levels)
6387 !! wikitext
6388 *** foo
6389 !! html
6390 <ul>
6391 <li><ul>
6392 <li><ul>
6393 <li> foo
6394 </li>
6395 </ul>
6396 </li>
6397 </ul>
6398 </li>
6399 </ul>
6400
6401 !! end
6402
6403 !! test
6404 Nested lists 8 (multiple nesting transitions)
6405 !! wikitext
6406 * foo
6407 *** bar
6408 ** baz
6409 * boo
6410 !! html
6411 <ul>
6412 <li> foo
6413 <ul>
6414 <li><ul>
6415 <li> bar
6416 </li>
6417 </ul>
6418 </li>
6419 <li> baz
6420 </li>
6421 </ul>
6422 </li>
6423 <li> boo
6424 </li>
6425 </ul>
6426
6427 !! end
6428
6429 !! test
6430 1. Lists with start-of-line-transparent tokens before bullets: Comments
6431 !! wikitext
6432 *foo
6433 *<!--cmt-->bar
6434 <!--cmt-->*baz
6435 !! html
6436 <ul>
6437 <li>foo
6438 </li>
6439 <li>bar
6440 </li>
6441 <li>baz
6442 </li>
6443 </ul>
6444
6445 !! end
6446
6447 !! test
6448 2. Lists with start-of-line-transparent tokens before bullets: Template close
6449 !! wikitext
6450 *foo {{echo|bar
6451 }}*baz
6452 !! html
6453 <ul>
6454 <li>foo bar
6455 </li>
6456 <li>baz
6457 </li>
6458 </ul>
6459
6460 !! end
6461
6462 !! test
6463 List items are not parsed correctly following a <pre> block (bug 785)
6464 !! wikitext
6465 * <pre>foo</pre>
6466 * <pre>bar</pre>
6467 * zar
6468 !! html
6469 <ul>
6470 <li> <pre>foo</pre>
6471 </li>
6472 <li> <pre>bar</pre>
6473 </li>
6474 <li> zar
6475 </li>
6476 </ul>
6477
6478 !! end
6479
6480 !! test
6481 List items from template
6482 !! wikitext
6483
6484 {{inner list}}
6485 * item 2
6486
6487 * item 0
6488 {{inner list}}
6489 * item 2
6490
6491 * item 0
6492 * notSOL{{inner list}}
6493 * item 2
6494 !! html
6495 <ul>
6496 <li> item 1
6497 </li>
6498 <li> item 2
6499 </li>
6500 </ul>
6501 <ul>
6502 <li> item 0
6503 </li>
6504 <li> item 1
6505 </li>
6506 <li> item 2
6507 </li>
6508 </ul>
6509 <ul>
6510 <li> item 0
6511 </li>
6512 <li> notSOL
6513 </li>
6514 <li> item 1
6515 </li>
6516 <li> item 2
6517 </li>
6518 </ul>
6519
6520 !! end
6521
6522 !! test
6523 List interrupted by empty line or heading
6524 !! wikitext
6525 * foo
6526
6527 ** bar
6528 == A heading ==
6529 * Another list item
6530 !! html
6531 <ul>
6532 <li> foo
6533 </li>
6534 </ul>
6535 <ul>
6536 <li><ul>
6537 <li> bar
6538 </li>
6539 </ul>
6540 </li>
6541 </ul>
6542 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6543 <ul>
6544 <li> Another list item
6545 </li>
6546 </ul>
6547
6548 !!end
6549
6550 !!test
6551 Multiple list tags generated by templates
6552 !! wikitext
6553 {{echo|<li>}}a
6554 {{echo|<li>}}b
6555 {{echo|<li>}}c
6556 !! html
6557 <li>a
6558 <li>b
6559 <li>c</li>
6560 </li>
6561 </li>
6562
6563 !!end
6564
6565 !!test
6566 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6567 !! wikitext
6568 *a
6569 <!--This line will NOT split the list-->
6570 *b
6571 <!--This line will NOT split the list either-->
6572 *c
6573 <!--foo--> <!----> <!--This line NOT split the list either-->
6574 *d
6575 !! html
6576 <ul>
6577 <li>a
6578 </li>
6579 <li>b
6580 </li>
6581 <li>c
6582 </li>
6583 <li>d
6584 </li>
6585 </ul>
6586
6587 !!end
6588
6589 !!test
6590 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6591 !! wikitext
6592 *a
6593 <!--This line will NOT split the list-->
6594 *b
6595 <!--This line will NOT split the list either-->
6596 *c
6597 <!--foo--> <!----> <!--This line NOT split the list
6598 either-->
6599 *d
6600 !! html
6601 <ul>
6602 <li>a
6603 </li>
6604 <li>b
6605 </li>
6606 <li>c
6607 </li>
6608 <li>d
6609 </li>
6610 </ul>
6611
6612 !!end
6613
6614 !!test
6615 Test the li-hack
6616 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6617 !!options
6618 parsoid=wt2html,wt2wt
6619 !! wikitext
6620 * foo
6621 * <li>li-hack
6622 * {{echo|<li>templated li-hack}}
6623 * <!--foo--> <li> unsupported li-hack with preceding comments
6624
6625 <ul>
6626 <li><li>not a li-hack
6627 </li>
6628 </ul>
6629 !! html
6630 <ul>
6631 <li> foo</li>
6632 <li>li-hack</li>
6633 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
6634 <li> <!--foo--> </li>
6635 <li> li-hack with preceding comments</li>
6636 </ul>
6637
6638 <ul>
6639 <li></li>
6640 <li>not a li-hack
6641 </li>
6642 </ul>
6643 !!end
6644
6645 !! test
6646 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6647 !! options
6648 parsoid
6649 !! wikitext
6650 # foo
6651 ## bar
6652 * foo
6653 ** bar
6654 : foo
6655 :: bar
6656 !! html
6657 <ol>
6658 <li> foo<ol>
6659 <li> bar</li>
6660 </ol></li>
6661 </ol><ul>
6662 <li> foo<ul>
6663 <li> bar</li>
6664 </ul></li>
6665 </ul><dl>
6666 <dd> foo<dl>
6667 <dd> bar</dd>
6668 </dl></dd>
6669 </dl>
6670 !! end
6671
6672 !! test
6673 Parsoid: Test of whitespace serialization with Templated bullets
6674 !! options
6675 parsoid
6676 !! wikitext
6677 * {{bullet}}
6678 !! html
6679 <ul>
6680 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6681 </ul>
6682 !! end
6683
6684 # ------------------------------------------------------------------------
6685 # The next set of tests are about Parsoid's ability to handle badly nested
6686 # tags (parse, minimize scope of fixup, and roundtrip back)
6687 # ------------------------------------------------------------------------
6688
6689 !! test
6690 Unbalanced closing block tags break a list
6691 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6692 !! wikitext
6693 <div>
6694 *a</div><div>
6695 *b</div>
6696 !! html/parsoid
6697 <div>
6698 <ul>
6699 <li>a
6700 </li>
6701 </ul></div><div>
6702 <ul>
6703 <li>b
6704 </li>
6705 </ul></div>
6706 !! end
6707
6708 !! test
6709 Unbalanced closing non-block tags don't break a list
6710 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6711 !! wikitext
6712 <span>
6713 *a</span><span>
6714 *b</span>
6715 !! html/parsoid
6716 <p><span></span>
6717 </p>
6718 <ul>
6719 <li>a<span></span>
6720 </li>
6721 <li>b
6722 </li>
6723 </ul>
6724 !! end
6725
6726 !! test
6727 Unclosed formatting tags that straddle lists are closed and reopened
6728 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6729 !! wikitext
6730 # <s> a
6731 # b </s>
6732 !! html/parsoid
6733 <ol>
6734 <li> <s> a </s>
6735 </li>
6736 <li> <s> b </s>
6737 </li>
6738 </ol>
6739 !! end
6740
6741 !!test
6742 List embedded in a non-block tag
6743 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6744 !! wikitext
6745 <small>
6746 * foo
6747 </small>
6748 !! html/parsoid
6749 <p><small></small></p>
6750 <small>
6751 <ul>
6752 <li> foo</li>
6753 </ul>
6754 </small>
6755 <p><small></small></p>
6756 !!end
6757
6758 !! test
6759 Table with missing opening <tr> tag
6760 !! options
6761 parsoid=wt2html,wt2wt
6762 !! wikitext
6763 <table>
6764 <td>foo</td>
6765 </tr>
6766 </table>
6767 !! html/parsoid
6768 <table>
6769 <tr>
6770 <td>foo</td>
6771 </tr>
6772 </table>
6773 !! end
6774
6775 ###
6776 ### Magic Words
6777 ###
6778
6779 # Note that the current date is hard-coded as
6780 # 1970-01-01T00:02:03Z (a Thursday)
6781 # when running parser tests. The timezone is also fixed to GMT, so
6782 # local date will be identical to current date.
6783
6784 !! test
6785 Magic Word: {{CURRENTDAY}}
6786 !! wikitext
6787 {{CURRENTDAY}}
6788 !! html
6789 <p>1
6790 </p>
6791 !! end
6792
6793 !! test
6794 Magic Word: {{CURRENTDAY2}}
6795 !! wikitext
6796 {{CURRENTDAY2}}
6797 !! html
6798 <p>01
6799 </p>
6800 !! end
6801
6802 !! test
6803 Magic Word: {{CURRENTDAYNAME}}
6804 !! wikitext
6805 {{CURRENTDAYNAME}}
6806 !! html
6807 <p>Thursday
6808 </p>
6809 !! end
6810
6811 !! test
6812 Magic Word: {{CURRENTDOW}}
6813 !! wikitext
6814 {{CURRENTDOW}}
6815 !! html
6816 <p>4
6817 </p>
6818 !! end
6819
6820 !! test
6821 Magic Word: {{CURRENTMONTH}}
6822 !! wikitext
6823 {{CURRENTMONTH}}
6824 !! html
6825 <p>01
6826 </p>
6827 !! end
6828
6829 !! test
6830 Magic Word: {{CURRENTMONTH1}}
6831 !! wikitext
6832 {{CURRENTMONTH1}}
6833 !! html
6834 <p>1
6835 </p>
6836 !! end
6837
6838 !! test
6839 Magic Word: {{CURRENTMONTHABBREV}}
6840 !! wikitext
6841 {{CURRENTMONTHABBREV}}
6842 !! html
6843 <p>Jan
6844 </p>
6845 !! end
6846
6847 !! test
6848 Magic Word: {{CURRENTMONTHNAME}}
6849 !! wikitext
6850 {{CURRENTMONTHNAME}}
6851 !! html
6852 <p>January
6853 </p>
6854 !! end
6855
6856 !! test
6857 Magic Word: {{CURRENTMONTHNAMEGEN}}
6858 !! wikitext
6859 {{CURRENTMONTHNAMEGEN}}
6860 !! html
6861 <p>January
6862 </p>
6863 !! end
6864
6865 !! test
6866 Magic Word: {{CURRENTTIME}}
6867 !! wikitext
6868 {{CURRENTTIME}}
6869 !! html
6870 <p>00:02
6871 </p>
6872 !! end
6873
6874 !! test
6875 Magic Word: {{CURRENTHOUR}}
6876 !! wikitext
6877 {{CURRENTHOUR}}
6878 !! html
6879 <p>00
6880 </p>
6881 !! end
6882
6883 !! test
6884 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6885 !! wikitext
6886 {{CURRENTWEEK}}
6887 !! html
6888 <p>1
6889 </p>
6890 !! end
6891
6892 !! test
6893 Magic Word: {{CURRENTYEAR}}
6894 !! wikitext
6895 {{CURRENTYEAR}}
6896 !! html
6897 <p>1970
6898 </p>
6899 !! end
6900
6901 !! test
6902 Magic Word: {{CURRENTTIMESTAMP}}
6903 !! wikitext
6904 {{CURRENTTIMESTAMP}}
6905 !! html
6906 <p>19700101000203
6907 </p>
6908 !! end
6909
6910 !! test
6911 Magic Words LOCAL (UTC)
6912 !! wikitext
6913 * {{LOCALMONTH}}
6914 * {{LOCALMONTH1}}
6915 * {{LOCALMONTHNAME}}
6916 * {{LOCALMONTHNAMEGEN}}
6917 * {{LOCALMONTHABBREV}}
6918 * {{LOCALDAY}}
6919 * {{LOCALDAY2}}
6920 * {{LOCALDAYNAME}}
6921 * {{LOCALYEAR}}
6922 * {{LOCALTIME}}
6923 * {{LOCALHOUR}}
6924 * {{LOCALWEEK}}
6925 * {{LOCALDOW}}
6926 * {{LOCALTIMESTAMP}}
6927 !! html
6928 <ul>
6929 <li> 01
6930 </li>
6931 <li> 1
6932 </li>
6933 <li> January
6934 </li>
6935 <li> January
6936 </li>
6937 <li> Jan
6938 </li>
6939 <li> 1
6940 </li>
6941 <li> 01
6942 </li>
6943 <li> Thursday
6944 </li>
6945 <li> 1970
6946 </li>
6947 <li> 00:02
6948 </li>
6949 <li> 00
6950 </li>
6951 <li> 1
6952 </li>
6953 <li> 4
6954 </li>
6955 <li> 19700101000203
6956 </li>
6957 </ul>
6958
6959 !! end
6960
6961 !! test
6962 Magic Word: {{FULLPAGENAME}}
6963 !! options
6964 title=[[User:Ævar Arnfjörð Bjarmason]]
6965 !! wikitext
6966 {{FULLPAGENAME}}
6967 !! html
6968 <p>User:Ævar Arnfjörð Bjarmason
6969 </p>
6970 !! end
6971
6972 !! test
6973 Magic Word: {{FULLPAGENAMEE}}
6974 !! options
6975 title=[[User:Ævar Arnfjörð Bjarmason]]
6976 !! wikitext
6977 {{FULLPAGENAMEE}}
6978 !! html
6979 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6980 </p>
6981 !! end
6982
6983 !! test
6984 Magic Word: {{TALKSPACE}}
6985 !! options
6986 title=[[User:Ævar Arnfjörð Bjarmason]]
6987 !! wikitext
6988 {{TALKSPACE}}
6989 !! html
6990 <p>User talk
6991 </p>
6992 !! end
6993
6994 !! test
6995 Magic Word: {{TALKSPACE}}, same namespace
6996 !! options
6997 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6998 !! wikitext
6999 {{TALKSPACE}}
7000 !! html
7001 <p>User talk
7002 </p>
7003 !! end
7004
7005 !! test
7006 Magic Word: {{TALKSPACE}}, main namespace
7007 !! options
7008 title=[[Parser Test]]
7009 !! wikitext
7010 {{TALKSPACE}}
7011 !! html
7012 <p>Talk
7013 </p>
7014 !! end
7015
7016 !! test
7017 Magic Word: {{TALKSPACEE}}
7018 !! options
7019 title=[[User:Ævar Arnfjörð Bjarmason]]
7020 !! wikitext
7021 {{TALKSPACEE}}
7022 !! html
7023 <p>User_talk
7024 </p>
7025 !! end
7026
7027 !! test
7028 Magic Word: {{SUBJECTSPACE}}
7029 !! options
7030 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7031 !! wikitext
7032 {{SUBJECTSPACE}}
7033 !! html
7034 <p>User
7035 </p>
7036 !! end
7037
7038 !! test
7039 Magic Word: {{SUBJECTSPACE}}, same namespace
7040 !! options
7041 title=[[User:Ævar Arnfjörð Bjarmason]]
7042 !! wikitext
7043 {{SUBJECTSPACE}}
7044 !! html
7045 <p>User
7046 </p>
7047 !! end
7048
7049 !! test
7050 Magic Word: {{SUBJECTSPACE}}, main namespace
7051 !! options
7052 title=[[Parser Test]]
7053 !! wikitext
7054 {{SUBJECTSPACE}}
7055 !! html
7056
7057 !! end
7058
7059 !! test
7060 Magic Word: {{SUBJECTSPACEE}}
7061 !! options
7062 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7063 !! wikitext
7064 {{SUBJECTSPACEE}}
7065 !! html
7066 <p>User
7067 </p>
7068 !! end
7069
7070 !! test
7071 Magic Word: {{NAMESPACE}}
7072 !! options
7073 title=[[User:Ævar Arnfjörð Bjarmason]]
7074 !! wikitext
7075 {{NAMESPACE}}
7076 !! html
7077 <p>User
7078 </p>
7079 !! end
7080
7081 !! test
7082 Magic Word: {{NAMESPACEE}}
7083 !! options
7084 title=[[User:Ævar Arnfjörð Bjarmason]]
7085 !! wikitext
7086 {{NAMESPACEE}}
7087 !! html
7088 <p>User
7089 </p>
7090 !! end
7091
7092 !! test
7093 Magic Word: {{NAMESPACENUMBER}}
7094 !! options
7095 title=[[User:Ævar Arnfjörð Bjarmason]]
7096 !! wikitext
7097 {{NAMESPACENUMBER}}
7098 !! html
7099 <p>2
7100 </p>
7101 !! end
7102
7103 !! test
7104 Magic Word: {{SUBPAGENAME}}
7105 !! options
7106 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7107 !! wikitext
7108 {{SUBPAGENAME}}
7109 !! html
7110 <p>sub ö
7111 </p>
7112 !! end
7113
7114 !! test
7115 Magic Word: {{SUBPAGENAMEE}}
7116 !! options
7117 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7118 !! wikitext
7119 {{SUBPAGENAMEE}}
7120 !! html
7121 <p>sub_%C3%B6
7122 </p>
7123 !! end
7124
7125 !! test
7126 Magic Word: {{ROOTPAGENAME}}
7127 !! options
7128 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7129 !! wikitext
7130 {{ROOTPAGENAME}}
7131 !! html
7132 <p>Ævar Arnfjörð Bjarmason
7133 </p>
7134 !! end
7135
7136 !! test
7137 Magic Word: {{ROOTPAGENAMEE}}
7138 !! options
7139 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7140 !! wikitext
7141 {{ROOTPAGENAMEE}}
7142 !! html
7143 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7144 </p>
7145 !! end
7146
7147 !! test
7148 Magic Word: {{BASEPAGENAME}}
7149 !! options
7150 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7151 !! wikitext
7152 {{BASEPAGENAME}}
7153 !! html
7154 <p>Ævar Arnfjörð Bjarmason
7155 </p>
7156 !! end
7157
7158 !! test
7159 Magic Word: {{BASEPAGENAMEE}}
7160 !! options
7161 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7162 !! wikitext
7163 {{BASEPAGENAMEE}}
7164 !! html
7165 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7166 </p>
7167 !! end
7168
7169 !! test
7170 Magic Word: {{TALKPAGENAME}}
7171 !! options
7172 title=[[User:Ævar Arnfjörð Bjarmason]]
7173 !! wikitext
7174 {{TALKPAGENAME}}
7175 !! html
7176 <p>User talk:Ævar Arnfjörð Bjarmason
7177 </p>
7178 !! end
7179
7180 !! test
7181 Magic Word: {{TALKPAGENAMEE}}
7182 !! options
7183 title=[[User:Ævar Arnfjörð Bjarmason]]
7184 !! wikitext
7185 {{TALKPAGENAMEE}}
7186 !! html
7187 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7188 </p>
7189 !! end
7190
7191 !! test
7192 Magic Word: {{SUBJECTPAGENAME}}
7193 !! options
7194 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7195 !! wikitext
7196 {{SUBJECTPAGENAME}}
7197 !! html
7198 <p>User:Ævar Arnfjörð Bjarmason
7199 </p>
7200 !! end
7201
7202 !! test
7203 Magic Word: {{SUBJECTPAGENAMEE}}
7204 !! options
7205 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7206 !! wikitext
7207 {{SUBJECTPAGENAMEE}}
7208 !! html
7209 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7210 </p>
7211 !! end
7212
7213 !! test
7214 Magic Word: {{NUMBEROFFILES}}
7215 !! wikitext
7216 {{NUMBEROFFILES}}
7217 !! html
7218 <p>4
7219 </p>
7220 !! end
7221
7222 !! test
7223 Magic Word: {{PAGENAME}}
7224 !! options
7225 title=[[User:Ævar Arnfjörð Bjarmason]]
7226 !! wikitext
7227 {{PAGENAME}}
7228 !! html
7229 <p>Ævar Arnfjörð Bjarmason
7230 </p>
7231 !! end
7232
7233 !! test
7234 Magic Word: {{PAGENAME}} with metacharacters
7235 !! options
7236 title=[['foo & bar = baz']]
7237 !! wikitext
7238 ''{{PAGENAME}}''
7239 !! html
7240 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7241 </p>
7242 !! end
7243
7244 !! test
7245 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7246 !! options
7247 title=[[*RFC 1234 http://example.com/]]
7248 !! wikitext
7249 {{PAGENAME}}
7250 !! html
7251 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7252 </p>
7253 !! end
7254
7255 !! test
7256 Magic Word: {{PAGENAMEE}}
7257 !! options
7258 title=[[User:Ævar Arnfjörð Bjarmason]]
7259 !! wikitext
7260 {{PAGENAMEE}}
7261 !! html
7262 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7263 </p>
7264 !! end
7265
7266 !! test
7267 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7268 !! options
7269 title=[[*RFC 1234 http://example.com/]]
7270 !! wikitext
7271 {{PAGENAMEE}}
7272 !! html
7273 <p>&#42;RFC_1234_http&#58;//example.com/
7274 </p>
7275 !! end
7276
7277 !! test
7278 Magic Word: {{REVISIONID}}
7279 !! wikitext
7280 {{REVISIONID}}
7281 !! html
7282 <p>1337
7283 </p>
7284 !! end
7285
7286 !! test
7287 Magic Word: {{SCRIPTPATH}}
7288 !! wikitext
7289 {{SCRIPTPATH}}
7290 !! html
7291 <p>/
7292 </p>
7293 !! end
7294
7295 !! test
7296 Magic Word: {{STYLEPATH}}
7297 !! wikitext
7298 {{STYLEPATH}}
7299 !! html
7300 <p>/skins
7301 </p>
7302 !! end
7303
7304 !! test
7305 Magic Word: {{SERVER}}
7306 !! wikitext
7307 {{SERVER}}
7308 !! html
7309 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7310 </p>
7311 !! end
7312
7313 !! test
7314 Magic Word: {{SERVERNAME}}
7315 !! wikitext
7316 {{SERVERNAME}}
7317 !! html
7318 <p>example.org
7319 </p>
7320 !! end
7321
7322 !! test
7323 Magic Word: {{SITENAME}}
7324 !! wikitext
7325 {{SITENAME}}
7326 !! html
7327 <p>MediaWiki
7328 </p>
7329 !! end
7330
7331 !! test
7332 Case-sensitive magic words, when cased differently, should just be template transclusions
7333 !! wikitext
7334 {{CurrentMonth}}
7335 {{currentday}}
7336 {{cURreNTweEK}}
7337 {{currentHour}}
7338 !! html
7339 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
7340 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
7341 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
7342 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
7343 </p>
7344 !! end
7345
7346 !! test
7347 Case-insensitive magic words should still work with weird casing.
7348 !! wikitext
7349 {{sErVeRNaMe}}
7350 {{LCFirst:AOEU}}
7351 {{ucFIRST:aoeu}}
7352 {{SERver}}
7353 !! html
7354 <p>example.org
7355 aOEU
7356 Aoeu
7357 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7358 </p>
7359 !! end
7360
7361 !! test
7362 Namespace 1 {{ns:1}}
7363 !! wikitext
7364 {{ns:1}}
7365 !! html
7366 <p>Talk
7367 </p>
7368 !! end
7369
7370 !! test
7371 Namespace 1 {{ns:01}}
7372 !! wikitext
7373 {{ns:01}}
7374 !! html
7375 <p>Talk
7376 </p>
7377 !! end
7378
7379 !! test
7380 Namespace 0 {{ns:0}} (bug 4783)
7381 !! wikitext
7382 {{ns:0}}
7383 !! html
7384
7385 !! end
7386
7387 !! test
7388 Namespace 0 {{ns:00}} (bug 4783)
7389 !! wikitext
7390 {{ns:00}}
7391 !! html
7392
7393 !! end
7394
7395 !! test
7396 Namespace -1 {{ns:-1}}
7397 !! wikitext
7398 {{ns:-1}}
7399 !! html
7400 <p>Special
7401 </p>
7402 !! end
7403
7404 !! test
7405 Namespace User {{ns:User}}
7406 !! wikitext
7407 {{ns:User}}
7408 !! html
7409 <p>User
7410 </p>
7411 !! end
7412
7413 !! test
7414 Namespace User talk {{ns:User_talk}}
7415 !! wikitext
7416 {{ns:User_talk}}
7417 !! html
7418 <p>User talk
7419 </p>
7420 !! end
7421
7422 !! test
7423 Namespace User talk {{ns:uSeR tAlK}}
7424 !! wikitext
7425 {{ns:uSeR tAlK}}
7426 !! html
7427 <p>User talk
7428 </p>
7429 !! end
7430
7431 !! test
7432 Namespace File {{ns:File}}
7433 !! wikitext
7434 {{ns:File}}
7435 !! html
7436 <p>File
7437 </p>
7438 !! end
7439
7440 !! test
7441 Namespace File {{ns:Image}}
7442 !! wikitext
7443 {{ns:Image}}
7444 !! html
7445 <p>File
7446 </p>
7447 !! end
7448
7449 !! test
7450 Namespace (lang=de) Benutzer {{ns:User}}
7451 !! options
7452 language=de
7453 !! wikitext
7454 {{ns:User}}
7455 !! html
7456 <p>Benutzer
7457 </p>
7458 !! end
7459
7460 !! test
7461 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7462 !! options
7463 language=de
7464 !! wikitext
7465 {{ns:3}}
7466 !! html
7467 <p>Benutzer Diskussion
7468 </p>
7469 !! end
7470
7471
7472 !! test
7473 Urlencode
7474 !! wikitext
7475 {{urlencode:hi world?!}}
7476 {{urlencode:hi world?!|WIKI}}
7477 {{urlencode:hi world?!|PATH}}
7478 {{urlencode:hi world?!|QUERY}}
7479 !! html
7480 <p>hi+world%3F%21
7481 hi_world%3F!
7482 hi%20world%3F%21
7483 hi+world%3F%21
7484 </p>
7485 !! end
7486
7487 !! test
7488 Magic Word: prioritize type info over data-parsoid
7489 !! options
7490 parsoid=html2wt
7491 !! wikitext
7492 __FORCETOC__
7493 !! html
7494 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7495 !! end
7496
7497 !! test
7498 Magic Word: serialize on separate line (parsoid)
7499 !! options
7500 parsoid=wt2wt,html2wt
7501 !! wikitext
7502 foo
7503 __NOTOC__
7504 bar
7505 !! html
7506 foo<meta property="mw:PageProp/notoc"/>bar
7507 !! end
7508
7509 !! test
7510 Magic Word: rt non-english wikis
7511 !! options
7512 parsoid=wt2wt
7513 language=de
7514 !! wikitext
7515 __NOEDITSECTION__
7516 !! html
7517 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7518 !! end
7519
7520 ###
7521 ### Magic links
7522 ###
7523 !! test
7524 Magic links: internal link to RFC (bug 479)
7525 !! wikitext
7526 [[RFC 123]]
7527 !! html
7528 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
7529 </p>
7530 !! end
7531
7532 !! test
7533 Magic links: RFC (bug 479)
7534 !! wikitext
7535 RFC 822
7536 !! html
7537 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7538 </p>
7539 !! end
7540
7541 !! test
7542 Magic links: ISBN (bug 1937)
7543 !! wikitext
7544 ISBN 0-306-40615-2
7545 !! html
7546 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7547 </p>
7548 !! end
7549
7550 !! test
7551 Magic links: PMID incorrectly converts space to underscore
7552 !! wikitext
7553 PMID 1234
7554 !! html
7555 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7556 </p>
7557 !! end
7558
7559 ###
7560 ### Templates
7561 ####
7562
7563 !! test
7564 Nonexistent template
7565 !! wikitext
7566 {{thistemplatedoesnotexist}}
7567 !! html
7568 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
7569 </p>
7570 !! end
7571
7572 !! test
7573 Template with invalid target containing tags
7574 !! wikitext
7575 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7576 !! html
7577 <p>{{a<b>b</b>|foo|a=b|a = b}}
7578 </p>
7579 !! end
7580
7581 !! test
7582 Template with invalid target containing unclosed tag
7583 !! wikitext
7584 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7585 !! html
7586 <p>{{a<b>|foo|a=b|a = b}}</b>
7587 </p>
7588 !! end
7589
7590 !! test
7591 Template with invalid target containing wikilink
7592 !! wikitext
7593 {{[[Main Page]]}}
7594 !! html/php
7595 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7596 </p>
7597 !! html/parsoid
7598 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
7599 !! end
7600
7601 !! article
7602 Template:test
7603 !! text
7604 This is a test template
7605 !! endarticle
7606
7607 !! test
7608 Simple template
7609 !! wikitext
7610 {{test}}
7611 !! html
7612 <p>This is a test template
7613 </p>
7614 !! end
7615
7616 !! test
7617 Template with explicit namespace
7618 !! wikitext
7619 {{Template:test}}
7620 !! html
7621 <p>This is a test template
7622 </p>
7623 !! end
7624
7625
7626 !! article
7627 Template:paramtest
7628 !! text
7629 This is a test template with parameter {{{param}}}
7630 !! endarticle
7631
7632 !! test
7633 Template parameter
7634 !! wikitext
7635 {{paramtest|param=foo}}
7636 !! html
7637 <p>This is a test template with parameter foo
7638 </p>
7639 !! end
7640
7641 !! article
7642 Template:paramtestnum
7643 !! text
7644 [[{{{1}}}|{{{2}}}]]
7645 !! endarticle
7646
7647 !! test
7648 Template unnamed parameter
7649 !! wikitext
7650 {{paramtestnum|Main Page|the main page}}
7651 !! html
7652 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7653 </p>
7654 !! end
7655
7656 !! article
7657 Template:templatesimple
7658 !! text
7659 (test)
7660 !! endarticle
7661
7662 !! article
7663 Template:templateredirect
7664 !! text
7665 #redirect [[Template:templatesimple]]
7666 !! endarticle
7667
7668 !! article
7669 Template:templateasargtestnum
7670 !! text
7671 {{{{{1}}}}}
7672 !! endarticle
7673
7674 !! article
7675 Template:templateasargtest
7676 !! text
7677 {{template{{{templ}}}}}
7678 !! endarticle
7679
7680 !! article
7681 Template:templateasargtest2
7682 !! text
7683 {{{{{templ}}}}}
7684 !! endarticle
7685
7686 !! test
7687 Template with template name as unnamed argument
7688 !! wikitext
7689 {{templateasargtestnum|templatesimple}}
7690 !! html
7691 <p>(test)
7692 </p>
7693 !! end
7694
7695 !! test
7696 Template with template name as argument
7697 !! wikitext
7698 {{templateasargtest|templ=simple}}
7699 !! html
7700 <p>(test)
7701 </p>
7702 !! end
7703
7704 !! test
7705 Template with template name as argument (2)
7706 !! wikitext
7707 {{templateasargtest2|templ=templatesimple}}
7708 !! html
7709 <p>(test)
7710 </p>
7711 !! end
7712
7713 !! article
7714 Template:templateasargtestdefault
7715 !! text
7716 {{{{{templ|templatesimple}}}}}
7717 !! endarticle
7718
7719 !! article
7720 Template:templa
7721 !! text
7722 '''templ'''
7723 !! endarticle
7724
7725 !! test
7726 Template with default value
7727 !! wikitext
7728 {{templateasargtestdefault}}
7729 !! html
7730 <p>(test)
7731 </p>
7732 !! end
7733
7734 !! test
7735 Template with default value (value set)
7736 !! wikitext
7737 {{templateasargtestdefault|templ=templa}}
7738 !! html
7739 <p><b>templ</b>
7740 </p>
7741 !! end
7742
7743 !! test
7744 Template redirect
7745 !! wikitext
7746 {{templateredirect}}
7747 !! html
7748 <p>(test)
7749 </p>
7750 !! end
7751
7752 !! test
7753 Template with argument in separate line
7754 !! wikitext
7755 {{ templateasargtest |
7756 templ = simple }}
7757 !! html
7758 <p>(test)
7759 </p>
7760 !! end
7761
7762 !! test
7763 Template with complex template as argument
7764 !! wikitext
7765 {{paramtest|
7766 param ={{ templateasargtest |
7767 templ = simple }}}}
7768 !! html
7769 <p>This is a test template with parameter (test)
7770 </p>
7771 !! end
7772
7773 !! test
7774 Template with thumb image (with link in description)
7775 !! wikitext
7776 {{paramtest|
7777 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7778 !! html
7779 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
7780
7781 !! end
7782
7783 !! article
7784 Template:complextemplate
7785 !! text
7786 {{{1}}} {{paramtest|
7787 param ={{{param}}}}}
7788 !! endarticle
7789
7790 !! test
7791 Template with complex arguments
7792 !! wikitext
7793 {{complextemplate|
7794 param ={{ templateasargtest |
7795 templ = simple }}|[[Template:complextemplate|link]]}}
7796 !! html
7797 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7798 </p>
7799 !! end
7800
7801 !! test
7802 BUG 553: link with two variables in a piped link
7803 !! wikitext
7804 {|
7805 |[[{{{1}}}|{{{2}}}]]
7806 |}
7807 !! html
7808 <table>
7809 <tr>
7810 <td>[[{{{1}}}|{{{2}}}]]
7811 </td></tr></table>
7812
7813 !! end
7814
7815 !! test
7816 Magic variable as template parameter
7817 !! wikitext
7818 {{paramtest|param={{SITENAME}}}}
7819 !! html
7820 <p>This is a test template with parameter MediaWiki
7821 </p>
7822 !! end
7823
7824 !! article
7825 Template:linktest
7826 !! text
7827 [[{{{param}}}|link]]
7828 !! endarticle
7829
7830 !! test
7831 Template parameter as link source
7832 !! wikitext
7833 {{linktest|param=Main Page}}
7834 !! html
7835 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7836 </p>
7837 !! end
7838
7839 !!test
7840 Template-generated attribute string (k='v')
7841 !! wikitext
7842 <span {{attr_str|id|v1}}>bar</span>
7843 !! html
7844 <p><span id="v1">bar</span>
7845 </p>
7846 !!end
7847
7848 !!article
7849 Template:paramtest2
7850 !! text
7851 including another template, {{paramtest|param={{{arg}}}}}
7852 !! endarticle
7853
7854 !! test
7855 Template passing argument to another template
7856 !! wikitext
7857 {{paramtest2|arg='hmm'}}
7858 !! html
7859 <p>including another template, This is a test template with parameter 'hmm'
7860 </p>
7861 !! end
7862
7863 !! article
7864 Template:Linktest2
7865 !! text
7866 Main Page
7867 !! endarticle
7868
7869 !! test
7870 Template as link source
7871 !! wikitext
7872 [[{{linktest2}}]]
7873
7874 [[{{linktest2}}|Main Page]]
7875
7876 [[{{linktest2}}]]Page
7877 !! html
7878 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7879 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7880 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7881 </p>
7882 !! end
7883
7884
7885 !! article
7886 Template:loop1
7887 !! text
7888 {{loop2}}
7889 !! endarticle
7890
7891 !! article
7892 Template:loop2
7893 !! text
7894 {{loop1}}
7895 !! endarticle
7896
7897 !! test
7898 Template infinite loop
7899 !! wikitext
7900 {{loop1}}
7901 !! html
7902 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7903 </p>
7904 !! end
7905
7906 !! test
7907 Template from main namespace
7908 !! wikitext
7909 {{:Main Page}}
7910 !! html
7911 <p>blah blah
7912 </p>
7913 !! end
7914
7915 !! article
7916 Template:table
7917 !! text
7918 {|
7919 | 1 || 2
7920 |-
7921 | 3 || 4
7922 |}
7923 !! endarticle
7924
7925 !! test
7926 BUG 529: Template with table, not included at beginning of line
7927 !! wikitext
7928 foo {{table}}
7929 !! html
7930 <p>foo
7931 </p>
7932 <table>
7933 <tr>
7934 <td> 1 </td>
7935 <td> 2
7936 </td></tr>
7937 <tr>
7938 <td> 3 </td>
7939 <td> 4
7940 </td></tr></table>
7941
7942 !! end
7943
7944 !! test
7945 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7946 !! wikitext
7947 foo
7948 {{table}}
7949 !! html
7950 <p>foo
7951 </p>
7952 <table>
7953 <tr>
7954 <td> 1 </td>
7955 <td> 2
7956 </td></tr>
7957 <tr>
7958 <td> 3 </td>
7959 <td> 4
7960 </td></tr></table>
7961
7962 !! end
7963
7964 !! test
7965 BUG 41: Template parameters shown as broken links
7966 !! wikitext
7967 {{{parameter}}}
7968 !! html
7969 <p>{{{parameter}}}
7970 </p>
7971 !! end
7972
7973 !! test
7974 Template with targets containing wikilinks
7975 !! wikitext
7976 {{[[foo]]}}
7977
7978 {{[[{{echo|foo}}]]}}
7979
7980 {{{{echo|[[foo}}]]}}
7981 !! html
7982 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7983 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7984 </p><p>{{[[foo}}]]
7985 </p>
7986 !! end
7987
7988 !! article
7989 Template:MSGNW test
7990 !! text
7991 ''None'' of '''this''' should be
7992 * interpreted
7993 but rather passed unmodified
7994 {{test}}
7995 !! endarticle
7996
7997 # hmm, fix this or just deprecate msgnw and document its behavior?
7998 !! test
7999 msgnw keyword
8000 !! options
8001 disabled
8002 !! wikitext
8003 {{msgnw:MSGNW test}}
8004 !! html
8005 <p>''None'' of '''this''' should be
8006 * interpreted
8007 but rather passed unmodified
8008 {{test}}
8009 </p>
8010 !! end
8011
8012 !! test
8013 int keyword
8014 !! wikitext
8015 {{int:youhavenewmessages|lots of money|not!}}
8016 !! html
8017 <p>You have lots of money (not!).
8018 </p>
8019 !! end
8020
8021 !! article
8022 Template:Includes
8023 !! text
8024 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8025 !! endarticle
8026
8027 !! test
8028 <includeonly> and <noinclude> being included
8029 !! wikitext
8030 {{Includes}}
8031 !! html
8032 <p>Foobar
8033 </p>
8034 !! end
8035
8036 !! article
8037 Template:Includes2
8038 !! text
8039 <onlyinclude>Foo</onlyinclude>bar
8040 !! endarticle
8041
8042 !! test
8043 <onlyinclude> being included
8044 !! wikitext
8045 {{Includes2}}
8046 !! html
8047 <p>Foo
8048 </p>
8049 !! end
8050
8051
8052 !! article
8053 Template:Includes3
8054 !! text
8055 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8056 !! endarticle
8057
8058 !! test
8059 <onlyinclude> and <includeonly> being included
8060 !! wikitext
8061 {{Includes3}}
8062 !! html
8063 <p>Foo
8064 </p>
8065 !! end
8066
8067 !! test
8068 <includeonly> and <noinclude> on a page
8069 !! wikitext
8070 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8071 !! html
8072 <p>Foozar
8073 </p>
8074 !! end
8075
8076 !! test
8077 Un-closed <noinclude>
8078 !! wikitext
8079 <noinclude>
8080 !! html
8081 !! end
8082
8083 !! test
8084 <onlyinclude> on a page
8085 !! wikitext
8086 <onlyinclude>Foo</onlyinclude>bar
8087 !! html
8088 <p>Foobar
8089 </p>
8090 !! end
8091
8092 !! test
8093 Un-closed <onlyinclude>
8094 !! wikitext
8095 <onlyinclude>
8096 !! html
8097 !! end
8098
8099 !!test
8100 Self-closed noinclude, includeonly, onlyinclude tags
8101 !! wikitext
8102 <noinclude />
8103 <includeonly />
8104 <onlyinclude />
8105 !! html
8106 <p><br />
8107 </p>
8108 !!end
8109
8110 !!test
8111 Unbalanced includeonly and noinclude tags
8112 !! wikitext
8113 {|
8114 |a</noinclude>
8115 |b</noinclude></noinclude>
8116 |c</noinclude></includeonly>
8117 |d</includeonly></includeonly>
8118 |}
8119 !! html
8120 <table>
8121 <tr>
8122 <td>a
8123 </td>
8124 <td>b
8125 </td>
8126 <td>c&lt;/includeonly&gt;
8127 </td>
8128 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8129 </td></tr></table>
8130
8131 !!end
8132
8133 !! article
8134 Template:Includeonly section
8135 !! text
8136 <includeonly>
8137 ==Includeonly section==
8138 </includeonly>
8139 ==Section T-1==
8140 !!endarticle
8141
8142 !! test
8143 Bug 6563: Edit link generation for section shown by <includeonly>
8144 !! wikitext
8145 {{includeonly section}}
8146 !! html
8147 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8148 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8149
8150 !! end
8151
8152 # Uses same input as the contents of [[Template:Includeonly section]]
8153 !! test
8154 Bug 6563: Section extraction for section shown by <includeonly>
8155 !! options
8156 section=T-2
8157 !! wikitext
8158 <includeonly>
8159 ==Includeonly section==
8160 </includeonly>
8161 ==Section T-2==
8162 !! html
8163 ==Section T-2==
8164 !! end
8165
8166 !! test
8167 Bug 6563: Edit link generation for section suppressed by <includeonly>
8168 !! wikitext
8169 <includeonly>
8170 ==Includeonly section==
8171 </includeonly>
8172 ==Section 1==
8173 !! html
8174 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8175
8176 !! end
8177
8178 !! test
8179 Bug 6563: Section extraction for section suppressed by <includeonly>
8180 !! options
8181 section=1
8182 !! wikitext
8183 <includeonly>
8184 ==Includeonly section==
8185 </includeonly>
8186 ==Section 1==
8187 !! html
8188 ==Section 1==
8189 !! end
8190
8191 !! test
8192 Un-closed <includeonly>
8193 !! wikitext
8194 <includeonly>
8195 !! html
8196 !! end
8197
8198 # TODO: test with DOM fragment reuse!
8199 !! test
8200 Parsoid: DOM fragment reuse
8201 !! options
8202 parsoid=wt2wt,wt2html
8203 !! wikitext
8204 a{{echo|b<table></table>c}}d
8205
8206 a{{echo|b
8207 <table></table>
8208 c}}d
8209
8210 {{echo|a
8211
8212 <table></table>
8213
8214 b}}
8215 !! html
8216 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8217 <table></table>c"}},"i":0}}]}'>b</span>
8218 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8219
8220
8221 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2">
8222 </span>
8223 <table about="#mwt2"></table><span about="#mwt2">
8224 </span>
8225 <p about="#mwt2">cd</p>
8226
8227
8228 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3">
8229
8230 </span>
8231 <table about="#mwt3"></table><span about="#mwt3">
8232
8233 </span>
8234 <p about="#mwt3">b</p>
8235 !! end
8236
8237 !! test
8238 Parsoid: Merge double tds (bug 50603)
8239 !! options
8240 parsoid
8241 !! wikitext
8242 {|
8243 |{{echo|{{!}} foo}}
8244 |}
8245 !! html
8246 <table><tbody>
8247 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
8248 </tbody></table>
8249 !! end
8250
8251 !! test
8252 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8253 !! options
8254 parsoid
8255 !! wikitext
8256 {{echo|<div>}}
8257 {|
8258 |{{echo|{{!}} foo}}
8259 |}
8260 {{echo|</div>}}
8261 !! html
8262 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
8263 <table><tbody>
8264 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8265 </tbody></table>
8266 </div>
8267 !! end
8268
8269 ###
8270 ### <includeonly> and <noinclude> in attributes
8271 ###
8272 !!test
8273 0. includeonly around the entire attribute
8274 !! wikitext
8275 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8276 !! html
8277 <p><span id="v2">bar</span>
8278 </p>
8279 !!end
8280
8281 !!test
8282 1. includeonly in html attr key
8283 !! wikitext
8284 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8285 !! html
8286 <p><span id="foo">bar</span>
8287 </p>
8288 !!end
8289
8290 !!test
8291 2. includeonly in html attr value
8292 !! wikitext
8293 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8294 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8295 !! html
8296 <p><span id="v1">bar</span>
8297 <span id="v1">bar</span>
8298 </p>
8299 !!end
8300
8301 !!test
8302 3. includeonly in part of an attr value
8303 !! wikitext
8304 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8305 !! html
8306 <p><span style="color:red;">bar</span>
8307 </p>
8308 !!end
8309
8310 !!test
8311 4. includeonly in table attributes
8312 !! wikitext
8313 {|
8314 |- <noinclude>
8315 |-
8316 |a
8317 </noinclude>
8318 |- <includeonly>
8319 |-
8320 |b
8321 </includeonly>
8322 |}
8323 !! html
8324 <table>
8325
8326
8327 <tr>
8328 <td>a
8329 </td></tr>
8330 </table>
8331
8332 !!end
8333
8334 ###
8335 ### Testing parsing of templates where a template arg
8336 ### has the same name as the template itself.
8337 ###
8338
8339 !! article
8340 Template:quote
8341 !! text
8342 {{{quote|{{{1}}}}}}
8343 !! endarticle
8344
8345 !!test
8346 Templates: Template Name/Arg clash: 1. Use of positional param
8347 !! wikitext
8348 {{quote|foo}}
8349 !! html
8350 <p>foo
8351 </p>
8352 !!end
8353
8354 !!test
8355 Templates: Template Name/Arg clash: 2. Use of named param
8356 !! wikitext
8357 {{quote|quote=foo}}
8358 !! html
8359 <p>foo
8360 </p>
8361 !!end
8362
8363 !!test
8364 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8365 !! wikitext
8366 {{quote|quote}}
8367 !! html
8368 <p>quote
8369 </p>
8370 !!end
8371
8372 ###
8373 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8374 ###
8375
8376 !!test
8377 Templates: 1. Simple use
8378 !! wikitext
8379 {{echo|Foo}}
8380 !! html
8381 <p>Foo
8382 </p>
8383 !!end
8384
8385 !!test
8386 Templates: 2. Inside a block tag
8387 !! wikitext
8388 <div>{{echo|Foo}}</div>
8389 <blockquote>{{echo|Foo}}</blockquote>
8390 !! html
8391 <div>Foo</div>
8392 <blockquote>Foo</blockquote>
8393
8394 !!end
8395
8396 !!test
8397 Templates: P-wrapping: 1a. Templates on consecutive lines
8398 !! wikitext
8399 {{echo|Foo}}
8400 {{echo|bar}}
8401 !! html
8402 <p>Foo
8403 bar
8404 </p>
8405 !!end
8406
8407 !!test
8408 Templates: P-wrapping: 1b. Templates on consecutive lines
8409 !! wikitext
8410 Foo
8411
8412 {{echo|bar}}
8413 {{echo|baz}}
8414 !! html
8415 <p>Foo
8416 </p><p>bar
8417 baz
8418 </p>
8419 !!end
8420
8421 !!test
8422 Templates: P-wrapping: 1c. Templates on consecutive lines
8423 !! wikitext
8424 {{echo|Foo}}
8425 {{echo|bar}} <div>baz</div>
8426 !! html
8427 <p>Foo
8428 </p>
8429 bar <div>baz</div>
8430
8431 !!end
8432
8433 !!test
8434 Templates: P-wrapping: 1d. Template preceded by comment-only line
8435 !!options
8436 parsoid
8437 !! wikitext
8438 <!-- foo -->
8439 {{echo|Bar}}
8440 !! html
8441 <!-- foo -->
8442
8443 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8444 !!end
8445
8446 !!test
8447 Templates: Inline Text: 1. Multiple tmeplate uses
8448 !! wikitext
8449 {{echo|Foo}}bar{{echo|baz}}
8450 !! html
8451 <p>Foobarbaz
8452 </p>
8453 !!end
8454
8455 !!test
8456 Templates: Inline Text: 2. Back-to-back template uses
8457 !! wikitext
8458 {{echo|Foo}}{{echo|bar}}
8459 !! html
8460 <p>Foobar
8461 </p>
8462 !!end
8463
8464 !!test
8465 Templates: Block Tags: 1. Multiple template uses
8466 !! wikitext
8467 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8468 !! html
8469 <div>Foo</div><div>bar</div><div>baz</div>
8470
8471 !!end
8472
8473 !!test
8474 Templates: Block Tags: 2. Back-to-back template uses
8475 !! wikitext
8476 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8477 !! html
8478 <div>Foo</div><div>bar</div>
8479
8480 !!end
8481
8482 !!test
8483 Templates: Links: 1. Simple example
8484 !! wikitext
8485 {{echo|[[Foo|bar]]}}
8486 !! html
8487 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8488 </p>
8489 !!end
8490
8491 !!test
8492 Templates: Links: 2. Generation of link href
8493 !! wikitext
8494 [[{{echo|Foo}}|bar]]
8495 !! html
8496 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8497 </p>
8498 !!end
8499
8500 !!test
8501 Templates: Links: 3. Generation of part of a link href
8502 !! wikitext
8503 [[Fo{{echo|o}}|bar]]
8504
8505 [[Foo{{echo|bar}}]]
8506
8507 [[Foo{{echo|bar}}baz]]
8508
8509 [[Foo{{echo|bar}}|bar]]
8510
8511 [[:Foo{{echo|bar}}]]
8512
8513 [[:Foo{{echo|bar}}|bar]]
8514 !! html
8515 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8516 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8517 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8518 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8519 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8520 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8521 </p>
8522 !!end
8523
8524 !!test
8525 Templates: Links: 4. Multiple templates generating link href
8526 !! wikitext
8527 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8528 !! html
8529 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8530 </p>
8531 !!end
8532
8533 !!test
8534 Templates: Links: 5. Generation of link text
8535 !! wikitext
8536 [[Foo|{{echo|bar}}]]
8537 !! html
8538 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8539 </p>
8540 !!end
8541
8542 !!test
8543 Templates: Links: 5. Nested templates (only outermost template should be marked)
8544 !! wikitext
8545 {{echo|[[{{echo|Foo}}|bar]]}}
8546 !! html
8547 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8548 </p>
8549 !!end
8550
8551 !!test
8552 Templates: HTML Tag: 1. Generation of HTML attr. key
8553 !! wikitext
8554 <div {{echo|style}}="color:red;">foo</div>
8555 !! html
8556 <div style="color:red;">foo</div>
8557
8558 !!end
8559
8560 !!test
8561 Templates: HTML Tag: 2. Generation of HTML attr. value
8562 !! wikitext
8563 <div style={{echo|'color:red;'}}>foo</div>
8564 !! html
8565 <div style="color:red;">foo</div>
8566
8567 !!end
8568
8569 !!test
8570 Templates: HTML Tag: 3. Generation of HTML attr key and value
8571 !! wikitext
8572 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8573 !! html
8574 <div style="color:red;">foo</div>
8575
8576 !!end
8577
8578 !!test
8579 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8580 !! wikitext
8581 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8582 !! html
8583 <div title="This is a long title with just one piece templated">foo</div>
8584
8585 !!end
8586
8587 !!test
8588 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8589 !! wikitext
8590 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8591 !! html
8592 <div title="This is a long title with just one piece templated">foo</div>
8593
8594 !!end
8595
8596 !!test
8597 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8598 !! wikitext
8599 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8600 !! html
8601 <div title="This is a long title with just one piece templated">foo</div>
8602
8603 !!end
8604
8605 !!test
8606 Templates: HTML Tag: 7. Generation of partial attribute key string
8607 !! wikitext
8608 <div st{{echo|yle}}="color:red;">foo</div>
8609 !! html
8610 <div style="color:red;">foo</div>
8611
8612 !!end
8613
8614 !!test
8615 Templates: HTML Tables: 1. Generating start of a HTML table
8616 !! wikitext
8617 {{echo|<table><tr><td>foo</td>}}</tr></table>
8618 !! html
8619 <table><tr><td>foo</td></tr></table>
8620
8621 !!end
8622
8623 !!test
8624 Templates: HTML Tables: 2a. Generating middle of a HTML table
8625 !! wikitext
8626 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8627 !! html
8628 <table><tr><td>foo</td></tr></table>
8629
8630 !!end
8631
8632 !!test
8633 Templates: HTML Tables: 2b. Generating middle of a HTML table
8634 !! wikitext
8635 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8636 !! html
8637 <table><tr><td>foo</td></tr></table>
8638
8639 !!end
8640
8641 !!test
8642 Templates: HTML Tables: 3. Generating end of a HTML table
8643 !! wikitext
8644 <table><tr>{{echo|<td>foo</td></tr></table>}}
8645 !! html
8646 <table><tr><td>foo</td></tr></table>
8647
8648 !!end
8649
8650 !!test
8651 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8652 !! wikitext
8653 {{echo|<table>}}<tr><td>foo</td></tr></table>
8654 !! html
8655 <table><tr><td>foo</td></tr></table>
8656
8657 !!end
8658
8659 !!test
8660 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8661 !! wikitext
8662 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8663 !! html
8664 <table><tr><td>foo</td></tr></table>
8665
8666 !!end
8667
8668 !!test
8669 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8670 !! wikitext
8671 <table><tr>{{echo|<td>}}foo</td></tr></table>
8672 !! html
8673 <table><tr><td>foo</td></tr></table>
8674
8675 !!end
8676
8677 !!test
8678 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8679 !! wikitext
8680 <table><tr><td>foo{{echo|</td>}}</tr></table>
8681 !! html
8682 <table><tr><td>foo</td></tr></table>
8683
8684 !!end
8685
8686 !!test
8687 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8688 !! wikitext
8689 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8690 !! html
8691 <table><tr><td>foo</td></tr></table>
8692
8693 !!end
8694
8695 !!test
8696 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8697 !! wikitext
8698 <table><tr><td>foo</td></tr>{{echo|</table>}}
8699 !! html
8700 <table><tr><td>foo</td></tr></table>
8701
8702 !!end
8703
8704 !!test
8705 Templates: HTML Tables: 5. Proper fostering of categories from inside
8706 !!options
8707 parsoid=wt2html,wt2wt
8708 !! wikitext
8709 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8710 <!--Two categories (Bug 50330)-->
8711 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8712 !! html
8713 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8714 <!--Two categories (Bug 50330)-->
8715 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
8716 !!end
8717
8718 !!test
8719 Templates: Wiki Tables: 1a. Fostering of entire template content
8720 !! wikitext
8721 {|
8722 {{echo|a}}
8723 |}
8724 !! html
8725 <table>
8726 a
8727 <tr><td></td></tr></table>
8728
8729 !!end
8730
8731 !!test
8732 Templates: Wiki Tables: 1b. Fostering of entire template content
8733 !! wikitext
8734 {|
8735 {{echo|<div>}}
8736 foo
8737 {{echo|</div>}}
8738 |}
8739 !! html
8740 <table>
8741 <div>
8742 <p>foo
8743 </p>
8744 </div>
8745 <tr><td></td></tr></table>
8746
8747 !!end
8748
8749 !!test
8750 Templates: Wiki Tables: 2. Fostering of partial template content
8751 !! wikitext
8752 {|
8753 {{echo|a
8754 <div>b</div>}}
8755 |}
8756 !! html
8757 <table>
8758 a
8759 <div>b</div>
8760 <tr><td></td></tr></table>
8761
8762 !!end
8763
8764 !!test
8765 Templates: Wiki Tables: 3. td-content via multiple templates
8766 !! wikitext
8767 {|
8768 {{echo|{{pipe}}a}}{{echo|b}}
8769 |}
8770 !! html
8771 <table>
8772 <tr>
8773 <td>ab
8774 </td></tr></table>
8775
8776 !!end
8777
8778 !!test
8779 Templates: Wiki Tables: 4. Templated tags, no content
8780 !! wikitext
8781 {{tbl-start}}
8782 {{tbl-end}}
8783 !! html
8784 <table>
8785 <tr><td></td></tr></table>
8786
8787 !!end
8788
8789 !!test
8790 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8791 !! wikitext
8792 {{tbl-start}}
8793 |foo
8794 {{tbl-end}}
8795 !! html
8796 <table>
8797 <tr>
8798 <td>foo
8799 </td></tr></table>
8800
8801 !!end
8802
8803 !!test
8804 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8805 !! wikitext
8806 {{tbl-start}}
8807 {{!}}foo
8808 {{tbl-end}}
8809 !! html
8810 <table>
8811 <tr>
8812 <td>foo
8813 </td></tr></table>
8814
8815 !!end
8816
8817 !!test
8818 Templates: Lists: Multi-line list-items via templates
8819 !! wikitext
8820 *{{echo|a {{nonexistent|
8821 unused}}}}
8822 *{{echo|b {{nonexistent|
8823 unused}}}}
8824 !! html
8825 <ul>
8826 <li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
8827 </li>
8828 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
8829 </li>
8830 </ul>
8831
8832 !!end
8833
8834 !!test
8835 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8836 !! wikitext
8837 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8838 !! html
8839 <p><i>ab</i>c<i>d</i>e
8840 </p>
8841 !!end
8842
8843 !!test
8844 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8845 (PHP parser generates misnested html)
8846 !! wikitext
8847 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8848 !! html/parsoid
8849 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
8850 !!end
8851
8852 !!test
8853 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8854 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8855 !! options
8856 parsoid=wt2html,wt2wt
8857 !! wikitext
8858 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8859 !! html
8860 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
8861 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
8862 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
8863 !!end
8864
8865 !!test
8866 Templates: Ugly nesting: 4. Divs opened/closed across templates
8867 !! wikitext
8868 a<div>b{{echo|c</div>d}}e
8869 !! html
8870 a<div>bc</div>de
8871
8872 !!end
8873
8874 !!test
8875 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8876 (Parsoid-centric)
8877 !! options
8878 parsoid
8879 !! wikitext
8880 {|
8881 |{{echo|foo</table>}}
8882 |bar
8883 |}
8884 !! html
8885 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
8886
8887 <tbody>
8888 <tr>
8889 <td>foo</td></tr></tbody></table><span about="#mwt1">
8890 </span><span about="#mwt1">|bar</span><span about="#mwt1">
8891 |}</span>
8892 !!end
8893
8894 !!test
8895 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8896 (Parsoid-centric)
8897 !! options
8898 parsoid
8899 !! wikitext
8900 <table>
8901 <tr>
8902 <td>
8903 <table>
8904 <tr>
8905 <td>1. {{echo|foo </table>}}</td>
8906 <td> bar </td>
8907 <td>2. {{echo|baz </table>}}</td>
8908 </tr>
8909 <tr>
8910 <td>abc</td>
8911 </tr>
8912 </table>
8913 </td>
8914 </tr>
8915 <tr>
8916 <td>xyz</td>
8917 </tr>
8918 </table>
8919 !! html
8920 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
8921 <tbody><tr>
8922 <td>
8923 <table>
8924 <tbody><tr>
8925 <td>1. foo </td></tr></tbody></table></td>
8926 <td> bar </td>
8927 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8928 </span><span about="#mwt2">
8929 </span><span about="#mwt2">
8930 </span><span about="#mwt2">abc</span><span about="#mwt2">
8931 </span><span about="#mwt2">
8932 </span><span about="#mwt2">
8933 </span><span about="#mwt2">
8934 </span><span about="#mwt2">
8935 </span><span about="#mwt2">
8936 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8937 </span><span about="#mwt2">
8938 </span>
8939 !!end
8940
8941 !! test
8942 Templates: Ugly templates: 3. newline-only template parameter
8943 !! wikitext
8944 foo {{echo|
8945 }}
8946 !! html
8947 <p>foo
8948 </p>
8949 !! end
8950
8951 # This looks like a bug: a single newline triggers p/br for some reason.
8952 !! test
8953 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8954 !! wikitext
8955 {{echo|
8956 }}
8957 !! html
8958 <p><br />
8959 </p>
8960 !! end
8961
8962
8963 !!test
8964 Parser Functions: 1. Simple example
8965 !! wikitext
8966 {{uc:foo}}
8967 !! html
8968 <p>FOO
8969 </p>
8970 !!end
8971
8972 !!test
8973 Parser Functions: 2. Nested use (only outermost should be marked up)
8974 !! wikitext
8975 {{uc:{{lc:FOO}}}}
8976 !! html
8977 <p>FOO
8978 </p>
8979 !!end
8980
8981 ###
8982 ### Pre-save transform tests
8983 ###
8984 !! test
8985 pre-save transform: subst:
8986 !! options
8987 PST
8988 !! wikitext
8989 {{subst:test}}
8990 !! html
8991 This is a test template
8992 !! end
8993
8994 !! test
8995 pre-save transform: normal template
8996 !! options
8997 PST
8998 !! wikitext
8999 {{test}}
9000 !! html
9001 {{test}}
9002 !! end
9003
9004 !! test
9005 pre-save transform: nonexistent template
9006 !! options
9007 PST
9008 !! wikitext
9009 {{thistemplatedoesnotexist}}
9010 !! html
9011 {{thistemplatedoesnotexist}}
9012 !! end
9013
9014
9015 !! test
9016 pre-save transform: subst magic variables
9017 !! options
9018 PST
9019 !! wikitext
9020 {{subst:SITENAME}}
9021 !! html
9022 MediaWiki
9023 !! end
9024
9025 # This is bug 89, which I fixed. -- wtm
9026 !! test
9027 pre-save transform: subst: templates with parameters
9028 !! options
9029 pst
9030 !! wikitext
9031 {{subst:paramtest|param="something else"}}
9032 !! html
9033 This is a test template with parameter "something else"
9034 !! end
9035
9036 !! article
9037 Template:nowikitest
9038 !! text
9039 <nowiki>'''not wiki'''</nowiki>
9040 !! endarticle
9041
9042 !! test
9043 pre-save transform: nowiki in subst (bug 1188)
9044 !! options
9045 pst
9046 !! wikitext
9047 {{subst:nowikitest}}
9048 !! html
9049 <nowiki>'''not wiki'''</nowiki>
9050 !! end
9051
9052
9053 !! article
9054 Template:commenttest
9055 !! text
9056 This template has <!-- a comment --> in it.
9057 !! endarticle
9058
9059 !! test
9060 pre-save transform: comment in subst (bug 1936)
9061 !! options
9062 pst
9063 !! wikitext
9064 {{subst:commenttest}}
9065 !! html
9066 This template has <!-- a comment --> in it.
9067 !! end
9068
9069 !! test
9070 pre-save transform: unclosed tag
9071 !! options
9072 pst noxml
9073 !! wikitext
9074 <nowiki>'''not wiki'''
9075 !! html
9076 <nowiki>'''not wiki'''
9077 !! end
9078
9079 !! test
9080 pre-save transform: mixed tag case
9081 !! options
9082 pst noxml
9083 !! wikitext
9084 <NOwiki>'''not wiki'''</noWIKI>
9085 !! html
9086 <NOwiki>'''not wiki'''</noWIKI>
9087 !! end
9088
9089 !! test
9090 pre-save transform: unclosed comment in <nowiki>
9091 !! options
9092 pst noxml
9093 !! wikitext
9094 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9095 !! html
9096 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9097 !!end
9098
9099 # Leading @ in this template definition works around a limitation
9100 # in parsoid's parserTests which otherwise strips the <span> from the
9101 # result (confusing it for a template wrapper)
9102 !! article
9103 Template:dangerous
9104 !!text
9105 @<span onmouseover="alert('crap')">Oh no</span>
9106 !!endarticle
9107
9108 !!test
9109 (confirming safety of fix for subst bug 1936)
9110 !! wikitext
9111 {{Template:dangerous}}
9112 !! html
9113 <p>@<span>Oh no</span>
9114 </p>
9115 !! end
9116
9117 !! test
9118 pre-save transform: comment containing gallery (bug 5024)
9119 !! options
9120 pst
9121 !! wikitext
9122 <!-- <gallery>data</gallery> -->
9123 !! html
9124 <!-- <gallery>data</gallery> -->
9125 !!end
9126
9127 !! test
9128 pre-save transform: comment containing extension
9129 !! options
9130 pst
9131 !! wikitext
9132 <!-- <tag>data</tag> -->
9133 !! html
9134 <!-- <tag>data</tag> -->
9135 !!end
9136
9137 !! test
9138 pre-save transform: comment containing nowiki
9139 !! options
9140 pst
9141 !! wikitext
9142 <!-- <nowiki>data</nowiki> -->
9143 !! html
9144 <!-- <nowiki>data</nowiki> -->
9145 !!end
9146
9147 !! test
9148 pre-save transform: <noinclude> in subst (bug 3298)
9149 !! options
9150 pst
9151 !! wikitext
9152 {{subst:Includes}}
9153 !! html
9154 Foobar
9155 !! end
9156
9157 !! test
9158 pre-save transform: <onlyinclude> in subst (bug 3298)
9159 !! options
9160 pst
9161 !! wikitext
9162 {{subst:Includes2}}
9163 !! html
9164 Foo
9165 !! end
9166
9167 !! article
9168 Template:SubstTest
9169 !!text
9170 {{<includeonly>subst:</includeonly>Includes}}
9171 !! endarticle
9172
9173 !! article
9174 Template:SafeSubstTest
9175 !! text
9176 {{<includeonly>safesubst:</includeonly>Includes}}
9177 !! endarticle
9178
9179 !! test
9180 bug 22297: safesubst: works during PST
9181 !! options
9182 pst
9183 !! wikitext
9184 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9185 !! html
9186 FoobarFoobar
9187 !! end
9188
9189 !! test
9190 bug 22297: safesubst: works during normal parse
9191 !! wikitext
9192 {{SafeSubstTest}}
9193 !! html
9194 <p>Foobar
9195 </p>
9196 !! end
9197
9198 !! test
9199 subst: does not work during normal parse
9200 !! wikitext
9201 {{SubstTest}}
9202 !! html
9203 <p>{{subst:Includes}}
9204 </p>
9205 !! end
9206
9207 !! test
9208 pre-save transform: context links ("pipe trick")
9209 !! options
9210 pst
9211 !! wikitext
9212 [[Article (context)|]]
9213 [[Bar:Article|]]
9214 [[:Bar:Article|]]
9215 [[Bar:Article (context)|]]
9216 [[:Bar:Article (context)|]]
9217 [[|Article]]
9218 [[|Article (context)]]
9219 [[Bar:X (Y) Z|]]
9220 [[:Bar:X (Y) Z|]]
9221 !! html
9222 [[Article (context)|Article]]
9223 [[Bar:Article|Article]]
9224 [[:Bar:Article|Article]]
9225 [[Bar:Article (context)|Article]]
9226 [[:Bar:Article (context)|Article]]
9227 [[Article]]
9228 [[Article (context)]]
9229 [[Bar:X (Y) Z|X (Y) Z]]
9230 [[:Bar:X (Y) Z|X (Y) Z]]
9231 !! end
9232
9233 !! test
9234 pre-save transform: context links ("pipe trick") with interwiki prefix
9235 !! options
9236 pst
9237 !! wikitext
9238 [[interwiki:Article|]]
9239 [[:interwiki:Article|]]
9240 [[interwiki:Bar:Article|]]
9241 [[:interwiki:Bar:Article|]]
9242 !! html
9243 [[interwiki:Article|Article]]
9244 [[:interwiki:Article|Article]]
9245 [[interwiki:Bar:Article|Bar:Article]]
9246 [[:interwiki:Bar:Article|Bar:Article]]
9247 !! end
9248
9249 !! test
9250 pre-save transform: context links ("pipe trick") with parens in title
9251 !! options
9252 pst title=[[Somearticle (context)]]
9253 !! wikitext
9254 [[|Article]]
9255 !! html
9256 [[Article (context)|Article]]
9257 !! end
9258
9259 !! test
9260 pre-save transform: context links ("pipe trick") with comma in title
9261 !! options
9262 pst title=[[Someplace, Somewhere]]
9263 !! wikitext
9264 [[|Otherplace]]
9265 [[Otherplace, Elsewhere|]]
9266 [[Otherplace, Elsewhere, Anywhere|]]
9267 !! html
9268 [[Otherplace, Somewhere|Otherplace]]
9269 [[Otherplace, Elsewhere|Otherplace]]
9270 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9271 !! end
9272
9273 !! test
9274 pre-save transform: context links ("pipe trick") with parens and comma
9275 !! options
9276 pst title=[[Someplace (IGNORED), Somewhere]]
9277 !! wikitext
9278 [[|Otherplace]]
9279 [[Otherplace (place), Elsewhere|]]
9280 !! html
9281 [[Otherplace, Somewhere|Otherplace]]
9282 [[Otherplace (place), Elsewhere|Otherplace]]
9283 !! end
9284
9285 !! test
9286 pre-save transform: context links ("pipe trick") with comma and parens
9287 !! options
9288 pst title=[[Who, me? (context)]]
9289 !! wikitext
9290 [[|Yes, you.]]
9291 [[Me, Myself, and I (1937 song)|]]
9292 !! html
9293 [[Yes, you. (context)|Yes, you.]]
9294 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9295 !! end
9296
9297 !! test
9298 pre-save transform: context links ("pipe trick") with namespace
9299 !! options
9300 pst title=[[Ns:Somearticle]]
9301 !! wikitext
9302 [[|Article]]
9303 !! html
9304 [[Ns:Article|Article]]
9305 !! end
9306
9307 !! test
9308 pre-save transform: context links ("pipe trick") with namespace and parens
9309 !! options
9310 pst title=[[Ns:Somearticle (context)]]
9311 !! wikitext
9312 [[|Article]]
9313 !! html
9314 [[Ns:Article (context)|Article]]
9315 !! end
9316
9317 !! test
9318 pre-save transform: context links ("pipe trick") with namespace and comma
9319 !! options
9320 pst title=[[Ns:Somearticle, Context, Whatever]]
9321 !! wikitext
9322 [[|Article]]
9323 !! html
9324 [[Ns:Article, Context, Whatever|Article]]
9325 !! end
9326
9327 !! test
9328 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9329 !! options
9330 pst title=[[Ns:Somearticle, Context (context)]]
9331 !! wikitext
9332 [[|Article]]
9333 !! html
9334 [[Ns:Article (context)|Article]]
9335 !! end
9336
9337 !! test
9338 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9339 !! options
9340 pst title=[[Ns:Somearticle (IGNORED), Context]]
9341 !! wikitext
9342 [[|Article]]
9343 !! html
9344 [[Ns:Article, Context|Article]]
9345 !! end
9346
9347 !! test
9348 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9349 !! options
9350 pst
9351 !! wikitext
9352 [[Article(context)|]]
9353 [[Bar:Article(context)|]]
9354 [[:Bar:Article(context)|]]
9355 [[|Article(context)]]
9356 [[Bar:X(Y)Z|]]
9357 [[:Bar:X(Y)Z|]]
9358 !! html
9359 [[Article(context)|Article]]
9360 [[Bar:Article(context)|Article]]
9361 [[:Bar:Article(context)|Article]]
9362 [[Article(context)]]
9363 [[Bar:X(Y)Z|X(Y)Z]]
9364 [[:Bar:X(Y)Z|X(Y)Z]]
9365 !! end
9366
9367 !! test
9368 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9369 !! options
9370 pst
9371 !! wikitext
9372 [[Article (context)|]]
9373 [[Bar:Article (context)|]]
9374 [[:Bar:Article (context)|]]
9375 [[|Article (context)]]
9376 [[Bar:X (Y) Z|]]
9377 [[:Bar:X (Y) Z|]]
9378 !! html
9379 [[Article (context)|Article]]
9380 [[Bar:Article (context)|Article]]
9381 [[:Bar:Article (context)|Article]]
9382 [[Article (context)]]
9383 [[Bar:X (Y) Z|X (Y) Z]]
9384 [[:Bar:X (Y) Z|X (Y) Z]]
9385 !! end
9386
9387 !! test
9388 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9389 !! options
9390 pst
9391 !! wikitext
9392 [[Article(context)|]]
9393 [[Bar:Article(context)|]]
9394 [[:Bar:Article(context)|]]
9395 [[|Article(context)]]
9396 [[Bar:X(Y)Z|]]
9397 [[:Bar:X(Y)Z|]]
9398 !! html
9399 [[Article(context)|Article]]
9400 [[Bar:Article(context)|Article]]
9401 [[:Bar:Article(context)|Article]]
9402 [[Article(context)]]
9403 [[Bar:X(Y)Z|X(Y)Z]]
9404 [[:Bar:X(Y)Z|X(Y)Z]]
9405 !! end
9406
9407 !! test
9408 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9409 !! options
9410 pst
9411 !! wikitext
9412 [[Article (context), context|]]
9413 [[Article (context),context|]]
9414 [[Bar:Article (context), context|]]
9415 [[Bar:Article (context),context|]]
9416 [[:Bar:Article (context), context|]]
9417 [[:Bar:Article (context),context|]]
9418 !! html
9419 [[Article (context), context|Article]]
9420 [[Article (context),context|Article]]
9421 [[Bar:Article (context), context|Article]]
9422 [[Bar:Article (context),context|Article]]
9423 [[:Bar:Article (context), context|Article]]
9424 [[:Bar:Article (context),context|Article]]
9425 !! end
9426
9427 !! test
9428 pre-save transform: trim trailing empty lines
9429 !! options
9430 pst
9431 !! wikitext
9432 Empty lines are trimmed
9433
9434
9435
9436
9437 !! html
9438 Empty lines are trimmed
9439 !! end
9440
9441 !! test
9442 pre-save transform: Signature expansion
9443 !! options
9444 pst
9445 !! wikitext
9446 * ~~~
9447 * <noinclude>~~~</noinclude>
9448 * <includeonly>~~~</includeonly>
9449 * <onlyinclude>~~~</onlyinclude>
9450 !! html
9451 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9452 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9453 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9454 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9455 !! end
9456
9457
9458 !! test
9459 pre-save transform: Signature expansion in nowiki tags (bug 93)
9460 !! options
9461 pst disabled
9462 !! wikitext
9463 Shall not expand:
9464
9465 <nowiki>~~~~</nowiki>
9466
9467 <includeonly><nowiki>~~~~</nowiki></includeonly>
9468
9469 <noinclude><nowiki>~~~~</nowiki></noinclude>
9470
9471 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9472
9473 {{subst:Foo}} shall be converted to FOO
9474
9475 As well as inside noinclude/onlyinclude
9476 <noinclude>{{subst:Foo}}</noinclude>
9477 <onlyinclude>{{subst:Foo}}</onlyinclude>
9478
9479 But not inside includeonly
9480 <includeonly>{{subst:Foo}}</includeonly>
9481 !! html
9482 Shall not expand:
9483
9484 <nowiki>~~~~</nowiki>
9485
9486 <includeonly><nowiki>~~~~</nowiki></includeonly>
9487
9488 <noinclude><nowiki>~~~~</nowiki></noinclude>
9489
9490 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9491
9492 FOO shall be converted to FOO
9493
9494 As well as inside noinclude/onlyinclude
9495 <noinclude>FOO</noinclude>
9496 <onlyinclude>FOO</onlyinclude>
9497
9498 But not inside includeonly
9499 <includeonly>{{subst:Foo}}</includeonly>
9500 !! end
9501
9502 !! test
9503 Parsoid: Recognize nowiki with trailing space in tags
9504 !! options
9505 parsoid=wt2html
9506 !! wikitext
9507 <nowiki ><div>[[foo]]</nowiki >
9508
9509 a<nowiki / >b
9510
9511 c<nowiki />d
9512
9513 e<nowiki/ >f
9514 !! html
9515 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9516 <p>ab</p>
9517 <p>cd</p>
9518 <p>ef</p>
9519 !! end
9520
9521 !! test
9522 Parsoid: Recognize nowiki with odd capitalization
9523 !! options
9524 parsoid=wt2html
9525 !! wikitext
9526 <noWikI ><div>[[foo]]</Nowiki >
9527 !! html
9528 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9529 !! end
9530
9531
9532 !! test
9533 Parsoid: Escape nowiki with trailing space in tags
9534 !! options
9535 parsoid=html2wt
9536 !! wikitext
9537 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9538
9539 a&lt;nowiki /&gt;b
9540
9541 c&lt;nowiki/ &gt;d
9542 !! html
9543 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9544 <p>a&lt;nowiki /&gt;b</p>
9545 <p>c&lt;nowiki/ &gt;d</p>
9546 !! end
9547
9548 !! test
9549 Parsoid: Escape weird noWikI capitalizations
9550 !! options
9551 parsoid=html2wt
9552 !! wikitext
9553 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9554 !! html
9555 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9556 !! end
9557
9558 ###
9559 ### Message transform tests
9560 ###
9561 !! test
9562 message transform: magic variables
9563 !! options
9564 msg
9565 !! wikitext
9566 {{SITENAME}}
9567 !! html
9568 MediaWiki
9569 !! end
9570
9571 !! test
9572 message transform: should not transform wiki markup
9573 !! options
9574 msg
9575 !! wikitext
9576 ''test''
9577 !! html
9578 ''test''
9579 !! end
9580
9581 !! test
9582 message transform: <noinclude> in transcluded template (bug 4926)
9583 !! options
9584 msg
9585 !! wikitext
9586 {{Includes}}
9587 !! html
9588 Foobar
9589 !! end
9590
9591 !! test
9592 message transform: <onlyinclude> in transcluded template (bug 4926)
9593 !! options
9594 msg
9595 !! wikitext
9596 {{Includes2}}
9597 !! html
9598 Foo
9599 !! end
9600
9601 !! test
9602 {{#special:}} page name, known
9603 !! options
9604 msg
9605 !! wikitext
9606 {{#special:Recentchanges}}
9607 !! html
9608 Special:RecentChanges
9609 !! end
9610
9611 !! test
9612 {{#special:}} page name with subpage, known
9613 !! options
9614 msg
9615 !! wikitext
9616 {{#special:Recentchanges/param}}
9617 !! html
9618 Special:RecentChanges/param
9619 !! end
9620
9621 !! test
9622 {{#special:}} page name, unknown
9623 !! options
9624 msg
9625 !! wikitext
9626 {{#special:foobar nonexistent}}
9627 !! html
9628 Special:Foobar nonexistent
9629 !! end
9630
9631 !! test
9632 {{#speciale:}} page name, known
9633 !! options
9634 msg
9635 !! wikitext
9636 {{#speciale:Recentchanges}}
9637 !! html
9638 Special:RecentChanges
9639 !! end
9640
9641 !! test
9642 {{#speciale:}} page name with subpage, known
9643 !! options
9644 msg
9645 !! wikitext
9646 {{#speciale:Recentchanges/param}}
9647 !! html
9648 Special:RecentChanges/param
9649 !! end
9650
9651 !! test
9652 {{#speciale:}} page name, unknown
9653 !! options
9654 msg
9655 !! wikitext
9656 {{#speciale:foobar nonexistent}}
9657 !! html
9658 Special:Foobar_nonexistent
9659 !! end
9660
9661 ###
9662 ### Images
9663 ###
9664 ### For Parsoid-specific tests, see
9665 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9666
9667 !! test
9668 Simple image
9669 !! options
9670 parsoid=wt2html,wt2wt,html2html
9671 !! wikitext
9672 [[Image:foobar.jpg]]
9673 !! html/php
9674 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9675 </p>
9676 !! html/parsoid
9677 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
9678 </p>
9679 !! end
9680
9681 !! test
9682 Simple image (using File: namespace, now canonical)
9683 !! wikitext
9684 [[File:Foobar.jpg]]
9685 !! html/php
9686 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9687 </p>
9688 !! html/parsoid
9689 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
9690 </p>
9691 !! end
9692
9693 !! test
9694 Right-aligned image
9695 !! wikitext
9696 [[File:Foobar.jpg|right]]
9697 !! html/php
9698 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9699
9700 !! html/parsoid
9701 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>
9702 !! end
9703
9704 !! test
9705 Image with caption
9706 !! wikitext
9707 [[File:Foobar.jpg|right|Caption text]]
9708 !! html/php
9709 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9710
9711 !! html/parsoid
9712 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
9713 !! end
9714
9715 !! test
9716 Image with caption, bug 53312 #1
9717 !! wikitext
9718 [[File:Foobar.jpg|right|Caption page stuff]]
9719 !! html/php
9720 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9721
9722 !! html/parsoid
9723 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
9724 !! end
9725
9726 !! test
9727 Image with caption, bug 53312 #2
9728 !! wikitext
9729 [[File:Foobar.jpg|right|Caption page=]]
9730 !! html/php
9731 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9732
9733 !! html/parsoid
9734 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
9735 !! end
9736
9737 !! test
9738 Image with caption, bug 53312 #3
9739 !! wikitext
9740 [[File:Foobar.jpg|right|Caption page=stuff]]
9741 !! html/php
9742 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9743
9744 !! html/parsoid
9745 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
9746 !! end
9747
9748 !! test
9749 Allow empty links in image captions (Bug 60753)
9750 !! wikitext
9751 [[File:Foobar.jpg|thumb|Caption [[Link1]]
9752 [[]]
9753 [[Link2]]
9754 ]]
9755 !! html/php
9756 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
9757
9758 !! html/parsoid
9759 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
9760 [[]]
9761 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
9762 </figcaption></figure>
9763 !! end
9764
9765 !! test
9766 Link with empty target
9767 !! wikitext
9768 [[]]
9769 !! html
9770 <p>[[]]
9771 </p>
9772 !! end
9773
9774 !! test
9775 Image with empty attribute
9776 !! options
9777 parsoid=wt2html,wt2wt,html2html
9778 !! wikitext
9779 [[File:Foobar.jpg|right||Caption text]]
9780 !! html/php
9781 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9782
9783 !! html/parsoid
9784 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
9785 !! end
9786
9787 !! test
9788 1. Block image with individual attributes from templates
9789 !! wikitext
9790 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
9791 !! html/php
9792 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
9793
9794 !! html/parsoid
9795 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[24,38,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
9796 !! end
9797
9798 !! test
9799 2. Block Image with individual attributes from templates
9800 !! wikitext
9801 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
9802 !! html/php
9803 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
9804
9805 !! html/parsoid
9806 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,32,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[33,47,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
9807 !! end
9808
9809 !! test
9810 3. Inline image with individual attributes from templates
9811 !! wikitext
9812 [[File:Foobar.jpg|{{echo|50px}}]]
9813 !! html/php
9814 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
9815 </p>
9816 !! html/parsoid
9817 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,31,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
9818 !! end
9819
9820 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
9821 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
9822 !! test
9823 Image with multiple attributes from the same template
9824 !! wikitext
9825 [[File:Foobar.jpg|{{image_attribs}}]]
9826 !! html/php
9827 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9828
9829 !! html/parsoid
9830 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
9831 !! end
9832
9833 !! test
9834 Image with link tails
9835 !! wikitext
9836 123[[File:Foobar.jpg]]456
9837 123[[File:Foobar.jpg|right]]456
9838 123[[File:Foobar.jpg|thumb]]456
9839 !! html/php
9840 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
9841 </p>
9842 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
9843 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
9844
9845 !! html/parsoid
9846 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>456</p>
9847 123<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>456
9848 123<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220"></a></figure>456
9849 !! end
9850
9851 !! test
9852 Image with multiple captions -- only last one is accepted
9853 !! wikitext
9854 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9855 !! html/php
9856 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9857
9858 !! html/parsoid
9859 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
9860 !! end
9861
9862 !! test
9863 Image with multiple widths -- use last
9864 !! wikitext
9865 [[File:Foobar.jpg|200px|300px|caption]]
9866 !! html/php
9867 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
9868 </p>
9869 !! html/parsoid
9870 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="34" width="300"/></a></span></p>
9871 !! end
9872
9873 !! test
9874 Image with multiple alignments -- use first (bug 48664)
9875 !! wikitext
9876 [[File:Foobar.jpg|thumb|left|right|center|caption]]
9877
9878 [[File:Foobar.jpg|middle|text-top|caption]]
9879 !! html/php
9880 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
9881 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
9882 </p>
9883 !! html/parsoid
9884 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
9885 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
9886 !! end
9887
9888 !! test
9889 Image with width attribute at different positions
9890 !! wikitext
9891 [[File:Foobar.jpg|200px|right|Caption]]
9892 [[File:Foobar.jpg|right|200px|Caption]]
9893 [[File:Foobar.jpg|right|Caption|200px]]
9894 !! html/php
9895 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
9896 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
9897 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
9898
9899 !! html/parsoid
9900 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9901 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9902 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9903 !! end
9904
9905 # a sad bit of backward-compatibility
9906 !! test
9907 Image with size specified with pxpx (bug 13500, 51628)
9908 !! options
9909 parsoid=wt2html,wt2wt,html2html
9910 !! wikitext
9911 [[File:Foobar.jpg|20pxpx]]
9912 [[File:Foobar.jpg|200x20pxpx]]
9913 !! html/php
9914 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
9915 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
9916 </p>
9917 !! html/parsoid
9918 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="2" width="20"/></a></span><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="177"/></a></span></p>
9919 !! end
9920
9921 !! test
9922 Image with link parameter, wiki target
9923 !! wikitext
9924 [[File:Foobar.jpg|link=Main Page]]
9925 !! html/php
9926 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9927 </p>
9928 !! html/parsoid
9929 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9930 !! end
9931
9932 # parsoid bug 49293 (part 1)
9933 !! test
9934 Image with link parameter, URL target
9935 !! wikitext
9936 [[File:Foobar.jpg|link=http://example.com/]]
9937 !! html/php
9938 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9939 </p>
9940 !! html/parsoid
9941 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9942 !! end
9943
9944 # parsoid bug 49293 (part 2)
9945 !! test
9946 Image with link parameter, protocol-less URL target
9947 !! wikitext
9948 [[File:Foobar.jpg|link=//example.com/]]
9949 !! html/php
9950 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9951 </p>
9952 !! html/parsoid
9953 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9954 !! end
9955
9956 !! test
9957 Image with link parameter, wgExternalLinkTarget
9958 !! wikitext
9959 [[Image:foobar.jpg|link=http://example.com/]]
9960 !! config
9961 wgExternalLinkTarget='foobar'
9962 !! html
9963 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9964 </p>
9965 !! end
9966
9967 !! test
9968 Image with link parameter, wgNoFollowLinks set to false
9969 !! wikitext
9970 [[Image:foobar.jpg|link=http://example.com/]]
9971 !! config
9972 wgNoFollowLinks=false
9973 !! html
9974 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9975 </p>
9976 !! end
9977
9978 !! test
9979 Image with link parameter, wgNoFollowDomainExceptions
9980 !! wikitext
9981 [[Image:foobar.jpg|link=http://example.com/]]
9982 !! config
9983 wgNoFollowDomainExceptions='example.com'
9984 !! html
9985 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9986 </p>
9987 !! end
9988
9989 !! test
9990 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9991 !! wikitext
9992 [[Image:foobar.jpg|link=http://example.com/|Title]]
9993 !! config
9994 wgExternalLinkTarget='foobar'
9995 !! html
9996 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9997 </p>
9998 !! end
9999
10000 !! test
10001 Image with empty link parameter
10002 !! wikitext
10003 [[File:Foobar.jpg|link=]]
10004 !! html/php
10005 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10006 </p>
10007 !! html/parsoid
10008 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
10009 !! end
10010
10011 !! test
10012 Image with link parameter (wiki target) and unnamed parameter
10013 !! wikitext
10014 [[File:Foobar.jpg|link=Main_Page|Title]]
10015 !! html/php
10016 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10017 </p>
10018 !! html/parsoid
10019 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10020 !! end
10021
10022 !! test
10023 Image with link parameter (URL target) and unnamed parameter
10024 !! wikitext
10025 [[File:Foobar.jpg|link=http://example.com/|Title]]
10026 !! html/php
10027 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10028 </p>
10029 !! html/parsoid
10030 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10031 !! end
10032
10033 !! test
10034 Thumbnail image with link parameter
10035 !! options
10036 parsoid=wt2html,wt2wt,html2html
10037 !! wikitext
10038 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10039 !! html/php
10040 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10041
10042 !! html/parsoid
10043 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
10044 !! end
10045
10046 !! test
10047 Manually-specified thumbnail image
10048 !! wikitext
10049 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10050 !! html/php
10051 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10052
10053 !! html/parsoid
10054 <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>
10055 !! end
10056
10057 !! test
10058 Manually-specified thumbnail image with explicit link to wiki page
10059 !! options
10060 parsoid=wt2html,wt2wt,html2html
10061 !! wikitext
10062 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10063 !! html/php
10064 <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>
10065
10066 !! html/parsoid
10067 <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>
10068 !! end
10069
10070 !! test
10071 Manually-specified thumbnail image with explicit link to url
10072 !! options
10073 parsoid=wt2html,wt2wt,html2html
10074 !! wikitext
10075 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10076 !! html/php
10077 <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>
10078
10079 !! html/parsoid
10080 <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>
10081 !! end
10082
10083 !! test
10084 Manually-specified thumbnail image with explicit no link
10085 !! options
10086 parsoid=wt2html,wt2wt,html2html
10087 !! wikitext
10088 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10089 !! html/php
10090 <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>
10091
10092 !! html/parsoid
10093 <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>
10094 !! end
10095
10096 !! test
10097 Manually-specified thumbnail image with explicit link and alt text
10098 !! options
10099 parsoid=wt2html,wt2wt,html2html
10100 !! wikitext
10101 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10102 !! html/php
10103 <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>
10104
10105 !! html/parsoid
10106 <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>
10107 !! end
10108
10109 !! test
10110 Image with frame and link
10111 !! options
10112 parsoid=wt2html,wt2wt,html2html
10113 !! wikitext
10114 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10115 !! html/php
10116 <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>
10117
10118 !! html/parsoid
10119 <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>
10120 !! end
10121
10122 !! test
10123 Image with frame and link and explicit alt
10124 !! options
10125 parsoid=wt2html,wt2wt,html2html
10126 !! wikitext
10127 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10128 !! html/php
10129 <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>
10130
10131 !! html/parsoid
10132 <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>
10133 !! end
10134
10135 !! test
10136 Image with wiki markup in implicit alt
10137 !! options
10138 parsoid=wt2html,wt2wt,html2html
10139 !! wikitext
10140 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10141
10142 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10143 !! html/php
10144 <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>
10145 </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>
10146 </p>
10147 !! html/parsoid
10148 <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>
10149 <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>
10150 !! end
10151
10152 ###################
10153 # Image sizing.
10154 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10155 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10156 # Foobar has actual size of 1941x220
10157 # 1. Thumbs & frameless always reduce, can't be enlarged
10158 # 2. Framed images ignore width; always render at default size.
10159 # If given a height, they respect height but continue to ignore width.
10160 # 3. "Unspecified format" and border are the only types which can be
10161 # enlarged.
10162
10163 !! test
10164 Image: "unspecified format" and border enlarge
10165 !! options
10166 parsoid=wt2html,wt2wt,html2html
10167 !! wikitext
10168 [[File:Foobar.jpg|2000px]]
10169
10170 [[File:Foobar.jpg|border|2000px]]
10171 !! html/php
10172 <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>
10173 </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>
10174 </p>
10175 !! html/parsoid
10176 <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>
10177 <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>
10178 !! end
10179
10180 !! test
10181 Image: "unspecified format" and border reduce
10182 !! options
10183 parsoid=wt2html,wt2wt,html2html
10184 !! wikitext
10185 [[File:Foobar.jpg|1000px]]
10186
10187 [[File:Foobar.jpg|border|1000px]]
10188 !! html/php
10189 <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>
10190 </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>
10191 </p>
10192 !! html/parsoid
10193 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
10194 <p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
10195 !! end
10196
10197 !! test
10198 Image: thumbs reduce
10199 !! options
10200 parsoid=wt2html,wt2wt,html2html
10201 !! wikitext
10202 [[File:Foobar.jpg|thumb|50px]]
10203 !! html/php
10204 <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>
10205
10206 !! html/parsoid
10207 <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>
10208 !! end
10209
10210 !! test
10211 Image: thumbs can't be enlarged past original size
10212 !! options
10213 parsoid=wt2html,wt2wt,html2html
10214 !! wikitext
10215 [[File:Foobar.jpg|thumb|2000px]]
10216 !! html/php
10217 <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>
10218
10219 !! html/parsoid
10220 <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>
10221 !! end
10222
10223 !! test
10224 Image: frameless can reduce in size
10225 !! options
10226 parsoid=wt2html,wt2wt,html2html
10227 !! wikitext
10228 [[File:Foobar.jpg|frameless|50px]]
10229 !! html/php
10230 <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>
10231 </p>
10232 !! html/parsoid
10233 <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>
10234 !! end
10235
10236 !! test
10237 Image: frameless can't be enlarged past original size
10238 !! options
10239 parsoid=wt2html,wt2wt,html2html
10240 !! wikitext
10241 [[File:Foobar.jpg|frameless|2000px]]
10242 !! html/php
10243 <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>
10244 </p>
10245 !! html/parsoid
10246 <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>
10247 !! end
10248
10249 !! test
10250 Image: framed images ignore size if only width is given
10251 !! options
10252 parsoid=wt2html,wt2wt,html2html
10253 !! wikitext
10254 [[File:Foobar.jpg|frame]]
10255
10256 [[File:Foobar.jpg|frame|50px]]
10257
10258 [[File:Foobar.jpg|frame|2000px]]
10259 !! html/php
10260 <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>
10261 <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>
10262 <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>
10263
10264 !! html/parsoid
10265 <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>
10266 !! end
10267
10268 !! test
10269 Image: framed images respect size if given a height, but ignore width.
10270 !! wikitext
10271 [[File:Foobar.jpg|frame|50x50px]]
10272 !! html/php
10273 <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>
10274
10275 !! html/parsoid
10276 <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>
10277 !! end
10278
10279 ###################
10280
10281 !! test
10282 Link to image page- image page normally doesn't exists, hence edit link
10283 Add test with existing image page
10284 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10285 !! wikitext
10286 [[:Image:test]]
10287 !! html
10288 <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>
10289 </p>
10290 !! end
10291
10292 !! test
10293 bug 18784 Link to non-existent image page with caption should use caption as link text
10294 !! wikitext
10295 [[:Image:test|caption]]
10296 !! html
10297 <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>
10298 </p>
10299 !! end
10300
10301 !! test
10302 Frameless image caption with a free URL
10303 !! wikitext
10304 [[File:Foobar.jpg|http://example.com]]
10305 !! html/php
10306 <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>
10307 </p>
10308 !! html/parsoid
10309 <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>
10310 !! end
10311
10312 !! test
10313 Thumbnail image caption with a free URL
10314 !! wikitext
10315 [[File:Foobar.jpg|thumb|http://example.com]]
10316 !! html/php
10317 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10318
10319 !! html/parsoid
10320 <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>
10321 !! end
10322
10323 !! test
10324 Thumbnail image caption with a free URL and explicit alt
10325 !! options
10326 parsoid=wt2html,wt2wt,html2html
10327 !! wikitext
10328 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10329 !! html/php
10330 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10331
10332 !! html/parsoid
10333 <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>
10334 !! end
10335
10336 !! test
10337 SVG thumbnails with no language set
10338 !! options
10339 !! wikitext
10340 [[File:Foobar.svg|thumb|caption]]
10341 !! html
10342 <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>
10343
10344 !! end
10345
10346 !! test
10347 SVG thumbnails with language de
10348 !! options
10349 !! wikitext
10350 [[File:Foobar.svg|thumb|caption|lang=de]]
10351 !! html
10352 <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>
10353
10354 !! end
10355
10356 !! test
10357 SVG thumbnails with invalid language code
10358 !! options
10359 !! wikitext
10360 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10361 !! html
10362 <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>
10363
10364 !! end
10365
10366 !! test
10367 BUG 1887: A ISBN with a thumbnail
10368 !! wikitext
10369 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
10370 !! html
10371 <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>
10372
10373 !! end
10374
10375 !! test
10376 BUG 1887: A RFC with a thumbnail
10377 !! wikitext
10378 [[Image:foobar.jpg|thumb|This is RFC 12354]]
10379 !! html
10380 <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>
10381
10382 !! end
10383
10384 !! test
10385 BUG 1887: A mailto link with a thumbnail
10386 !! wikitext
10387 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
10388 !! html
10389 <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>
10390
10391 !! end
10392
10393 # Pending resolution to bug 368
10394 !! test
10395 BUG 648: Frameless image caption with a link
10396 !! wikitext
10397 [[Image:foobar.jpg|text with a [[link]] in it]]
10398 !! html
10399 <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>
10400 </p>
10401 !! end
10402
10403 !! test
10404 BUG 648: Frameless image caption with a link (suffix)
10405 !! wikitext
10406 [[Image:foobar.jpg|text with a [[link]]foo in it]]
10407 !! html
10408 <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>
10409 </p>
10410 !! end
10411
10412 !! test
10413 BUG 648: Frameless image caption with an interwiki link
10414 !! wikitext
10415 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
10416 !! html
10417 <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>
10418 </p>
10419 !! end
10420
10421 !! test
10422 BUG 648: Frameless image caption with a piped interwiki link
10423 !! wikitext
10424 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10425 !! html
10426 <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>
10427 </p>
10428 !! end
10429
10430 !! test
10431 Escape HTML special chars in image alt text
10432 !! wikitext
10433 [[Image:foobar.jpg|& < > "]]
10434 !! html
10435 <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>
10436 </p>
10437 !! end
10438
10439 !! test
10440 BUG 499: Alt text should have &#1234;, not &amp;1234;
10441 !! wikitext
10442 [[Image:foobar.jpg|&#9792;]]
10443 !! html
10444 <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>
10445 </p>
10446 !! end
10447
10448 !! test
10449 Broken image caption with link
10450 !! wikitext
10451 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10452 !! html
10453 <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.
10454 </p>
10455 !! end
10456
10457 !! test
10458 Image caption containing another image
10459 !! wikitext
10460 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
10461 !! html
10462 <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>
10463
10464 !! end
10465
10466 !! test
10467 Image caption containing a newline
10468 !! wikitext
10469 [[Image:Foobar.jpg|This
10470 *is some text]]
10471 !! html
10472 <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>
10473 </p>
10474 !!end
10475
10476 !!test
10477 Parsoid: Image caption containing leading space
10478 (The leading space should not trigger nowiki escaping in wt2wt mode)
10479 !! wikitext
10480 [[Image:Foobar.jpg|thumb| bar]]
10481 !! html
10482 <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>
10483
10484 !!end
10485
10486 !! test
10487 Images: caption containing a table
10488 !! wikitext
10489 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10490 {|
10491 ! Foo !! Bar
10492 |-
10493 | Foo1 || Bar1
10494 |}
10495 and some more text.]]
10496 !! html/php
10497 <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>
10498
10499 !! html/parsoid
10500 <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
10501 <table>
10502 <tbody>
10503 <tr><th>Foo </th><th>Bar</th></tr>
10504 <tr>
10505 <td>Foo1 </td>
10506 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10507 !! end
10508
10509 !! test
10510 Bug 3090: External links other than http: in image captions
10511 !! wikitext
10512 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
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 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>
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 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>
10518 !! end
10519
10520 !! test
10521 Custom class
10522 !! options
10523 parsoid=wt2html,wt2wt,html2html
10524 !! wikitext
10525 [[Image:foobar.jpg|a|class=b]]
10526 !! html/php
10527 <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>
10528 </p>
10529 !! html/parsoid
10530 <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>
10531 !! end
10532
10533 !! test
10534 Localized image handling (1).
10535 !! options
10536 parsoid=wt2html,wt2wt,html2html
10537 language=es
10538 !! wikitext
10539 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10540 !! html/php
10541 <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>
10542
10543 !! html/parsoid
10544 <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>
10545 !! end
10546
10547 !! test
10548 Localized image handling (2).
10549 !! options
10550 parsoid=wt2html,wt2wt,html2html
10551 language=es
10552 !! wikitext
10553 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10554 !! html/php
10555 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10556
10557 !! html/parsoid
10558 <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>
10559 !! end
10560
10561 !! test
10562 "border", "frameless" and "class" attributes on an image.
10563 !! options
10564 parsoid=wt2html,wt2wt,html2html
10565 !! wikitext
10566 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10567 !! html/php
10568 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
10569 </p>
10570 !! html/parsoid
10571 <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>
10572 !! end
10573
10574 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10575 !! test
10576 Invalid image attributes (bug 62500)
10577 !! options
10578 parsoid=wt2html,wt2wt,html2html
10579 !! wikitext
10580 [[File:Foobar.jpg|thumb|float|left|caption]]
10581
10582 [[File:Foobar.jpg|thumb|righ|caption]]
10583
10584 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10585 !! html/php
10586 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10587 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10588 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10589
10590 !! html/parsoid
10591 <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>
10592 !! end
10593
10594 !! article
10595 File:Barfoo.jpg
10596 !! text
10597 #REDIRECT [[File:Barfoo.jpg]]
10598 !! endarticle
10599
10600 !! test
10601 Redirected image
10602 !! wikitext
10603 [[Image:Barfoo.jpg]]
10604 !! html
10605 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10606 </p>
10607 !! end
10608
10609 !! test
10610 Missing image with uploads disabled
10611 !! options
10612 wgEnableUploads=0
10613 !! wikitext
10614 [[Image:Foobaz.jpg]]
10615 !! html
10616 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10617 </p>
10618 !! end
10619
10620 # Parsoid-specific testing for images
10621 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10622 # Currently imperfect due to a flaw in the Parsoid testrunner
10623 # Work in progress
10624 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10625 # image tests.
10626
10627 !! test
10628 Parsoid-specific image handling - simple image with size and middle alignment
10629 !! wikitext
10630 [[File:Foobar.jpg|middle|50px]]
10631 !! html/parsoid
10632 <p><span class="mw-valign-middle" typeof="mw:Image">
10633 <a href="File:Foobar.jpg">
10634 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10635 </a>
10636 </span>
10637 </p>
10638 !! end
10639
10640 !! test
10641 Parsoid-specific image handling - simple image with size, middle alignment,
10642 non-standard namespace alias
10643 !! options
10644 parsoid=wt2wt,wt2html,html2html
10645 !! wikitext
10646 [[Image:Foobar.jpg|middle|50px]]
10647 !! html/parsoid
10648 <p><span class="mw-valign-middle" typeof="mw:Image">
10649 <a href="File:Foobar.jpg">
10650 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10651 </a>
10652 </span>
10653 </p>
10654 !! end
10655
10656 !! test
10657 Parsoid-specific image handling - simple image with size and middle alignment
10658 (existing content)
10659 !! wikitext
10660 [[File:Foobar.jpg|50px|middle]]
10661 !! html/parsoid
10662 <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>
10663 !! end
10664
10665 !! test
10666 Parsoid-specific image handling - simple image with size and middle alignment
10667 and non-standard namespace name
10668 !! options
10669 parsoid=wt2html,wt2wt,html2html
10670 !! wikitext
10671 [[Image:Foobar.jpg|50px|middle]]
10672 !! html/parsoid
10673 <p><span class="mw-valign-middle" typeof="mw:Image">
10674 <a href="File:Foobar.jpg">
10675 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10676 </a>
10677 </span>
10678 </p>
10679 !! end
10680
10681 !! test
10682 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10683 !! wikitext
10684 [[File:Foobar.jpg|500x10px|baseline|caption]]
10685 !! html/parsoid
10686 <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>
10687 !! end
10688
10689 !! test
10690 Parsoid-specific image handling - simple image with border and size spec
10691 !! wikitext
10692 [[File:Foobar.jpg|50px|border|caption]]
10693 !! html/parsoid
10694 <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>
10695 !! end
10696
10697 !! test
10698 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10699 !! wikitext
10700 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10701 !! html/parsoid
10702 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10703 <a href="File:Foobar.jpg">
10704 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10705 </a>
10706 <figcaption>caption content</figcaption>
10707 </figure>
10708 !! end
10709
10710 !! test
10711 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10712 (existing content)
10713 !! wikitext
10714 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10715 !! html/parsoid
10716 <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>
10717 !! end
10718
10719 !! test
10720 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10721 !! wikitext
10722 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10723 !! html/parsoid
10724 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10725 <a href="File:Foobar.jpg">
10726 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10727 </a>
10728 <figcaption>caption</figcaption>
10729 </figure>
10730 !! end
10731
10732 !! test
10733 Parsoid-specific image handling - thumbnail with specific size, halign,
10734 valign, and caption (existing content)
10735 !! wikitext
10736 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10737 !! html/parsoid
10738 <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>
10739 !! end
10740
10741 !! test
10742 Parsoid-specific image handling - framed image with specific size and caption
10743 !! wikitext
10744 [[Image:Foobar.jpg|frame|500x50px|caption]]
10745 !! html/parsoid
10746 <figure typeof="mw:Image/Frame">
10747 <a href="File:Foobar.jpg">
10748 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10749 </a>
10750 <figcaption>caption</figcaption>
10751 </figure>
10752 !! end
10753
10754 !! test
10755 Parsoid-specific image handling - framed image with specific size and caption
10756 (existing content)
10757 !! wikitext
10758 [[File:Foobar.jpg|442x50px|frame|caption]]
10759 !! html/parsoid
10760 <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>
10761 !! end
10762
10763 !! test
10764 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10765 !! wikitext
10766 [[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10767 !! html/parsoid
10768 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10769 <a href="File:Foobar.jpg">
10770 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10771 </a>
10772 <figcaption>caption</figcaption>
10773 </figure>
10774 !! end
10775
10776 !! test
10777 Parsoid-specific image handling - framed image with specific size, halign,
10778 valign, and caption (existing content)
10779 !! wikitext
10780 [[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
10781 !! html/parsoid
10782 <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>
10783 !! end
10784
10785 !! test
10786 Parsoid-specific image handling - frameless image with specific size, border, and caption
10787 !! wikitext
10788 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
10789 !! html/parsoid
10790 <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>
10791 !! end
10792
10793 !! test
10794 Parsoid-specific image handling - simple image with a formatted caption
10795 !! wikitext
10796 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10797 !! html/parsoid
10798 <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>"}'>
10799 <a href="File:Foobar.jpg">
10800 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10801 </a></span></p>
10802 !! end
10803
10804 !! test
10805 Parsoid-specific image handling - caption with a template in it
10806 !! wikitext
10807 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
10808 !! html/parsoid
10809 <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>
10810 !! end
10811
10812 !! test
10813 Parsoid-specific image handling - caption with unbalanced tags in it
10814 !! options
10815 parsoid=wt2html,wt2wt,html2html
10816 !! wikitext
10817 foo
10818 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
10819 bar
10820 !! html/parsoid
10821 <p>foo</p>
10822 <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>
10823 <p>bar</p>
10824 !! end
10825
10826 !! test
10827 Parsoid-specific image handling - empty caption
10828 !! wikitext
10829 [[File:Foobar.jpg|thumb|]]
10830 !! html/parsoid
10831 <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>
10832 !! end
10833
10834 !! test
10835 Parsoid-specific image handling - whitespace caption
10836 !! wikitext
10837 [[File:Foobar.jpg|thumb| ]]
10838 !! html/parsoid
10839 <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>
10840 !! end
10841
10842 !! test
10843 Parsoid-specific image handling - lang option
10844 !! wikitext
10845 foo
10846 [[File:Foobar.svg|lang=de|caption]]
10847 bar
10848 !! html/parsoid
10849 <p>foo
10850 <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>
10851 bar</p>
10852 !! end
10853
10854
10855 ###
10856 ### Subpages
10857 ###
10858 !! article
10859 Subpage test/subpage
10860 !! text
10861 foo
10862 !! endarticle
10863
10864 !! test
10865 Subpage link
10866 !! options
10867 subpage title=[[Subpage test]]
10868 !! wikitext
10869 [[/subpage]]
10870 !! html
10871 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10872 </p>
10873 !! end
10874
10875 !! test
10876 Subpage noslash link
10877 !! options
10878 subpage title=[[Subpage test]]
10879 !! wikitext
10880 [[/subpage/]]
10881 !! html
10882 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10883 </p>
10884 !! end
10885
10886 # TODO: make this PHP-parser compatible!
10887 !! test
10888 Relative subpage noslash link
10889 !! options
10890 parsoid=wt2wt,wt2html,html2html
10891 subpage title=[[Subpage test/1/2/3/4]]
10892 !! wikitext
10893 [[../../subpage/]]
10894
10895 [[../../subpage]]
10896 !! html
10897 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10898 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10899 !! end
10900
10901 # TODO: make this PHP-parser compatible!
10902 !! test
10903 Parsoid: dot-slash prefixed wikilinks
10904 !! options
10905 parsoid=wt2wt,wt2html,html2html
10906 !! wikitext
10907 [[./foo]]
10908
10909 [[././bar]]
10910
10911 [[././baz/]]
10912 !! html
10913 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10914 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10915 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10916 !! end
10917
10918 !! test
10919 Disabled subpages
10920 !! wikitext
10921 [[/subpage]]
10922 !! html
10923 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10924 </p>
10925 !! end
10926
10927 !! test
10928 BUG 561: {{/Subpage}}
10929 !! options
10930 subpage title=[[Page]]
10931 !! wikitext
10932 {{/Subpage}}
10933 !! html
10934 <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>
10935 </p>
10936 !! end
10937
10938 ###
10939 ### Categories
10940 ###
10941 !! article
10942 Category:MediaWiki User's Guide
10943 !! text
10944 blah
10945 !! endarticle
10946
10947 !! test
10948 Link to category
10949 !! wikitext
10950 [[:Category:MediaWiki User's Guide]]
10951 !! html
10952 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10953 </p>
10954 !! end
10955
10956 !! test
10957 Simple category
10958 !! options
10959 cat
10960 !! wikitext
10961 [[Category:MediaWiki User's Guide]]
10962 !! html
10963 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10964 !! end
10965
10966 !! test
10967 PAGESINCATEGORY invalid title fatal (r33546 fix)
10968 !! wikitext
10969 {{PAGESINCATEGORY:<bogus>}}
10970 !! html
10971 <p>0
10972 </p>
10973 !! end
10974
10975 !! test
10976 Category with different sort key
10977 !! options
10978 cat
10979 !! wikitext
10980 [[Category:MediaWiki User's Guide|Foo]]
10981 !! html
10982 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10983 !! end
10984
10985 !! test
10986 Category with identical sort key
10987 !! options
10988 cat
10989 !! wikitext
10990 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10991 !! html
10992 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10993 !! end
10994
10995 !! test
10996 Category with empty sort key
10997 !! options
10998 cat
10999 pst
11000 !! wikitext
11001 [[Category:MediaWiki User's Guide|]]
11002 !! html
11003 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11004 !! end
11005
11006 !! test
11007 Category with empty sort key and parentheses
11008 !! options
11009 cat
11010 pst
11011 !! wikitext
11012 [[Category:Foo (bar)|]]
11013 !! html
11014 [[Category:Foo (bar)|Foo]]
11015 !! end
11016
11017 !! test
11018 Category with link tail
11019 !! options
11020 cat
11021 pst
11022 !! wikitext
11023 123[[Category:Foo]]456
11024 !! html
11025 123[[Category:Foo]]456
11026 !! end
11027
11028 !! test
11029 Category with template
11030 !! options
11031 cat
11032 pst
11033 !! wikitext
11034 [[Category:{{echo|Foo}}]]
11035 !! html
11036 [[Category:{{echo|Foo}}]]
11037 !! end
11038
11039 !! test
11040 Category with template in sort key
11041 !! options
11042 cat
11043 pst
11044 !! wikitext
11045 [[Category:Foo|{{echo|Bar}}]]
11046 !! html
11047 [[Category:Foo|{{echo|Bar}}]]
11048 !! end
11049
11050 !! test
11051 Category with template in sort key and title
11052 !! options
11053 cat
11054 pst
11055 !! wikitext
11056 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11057 !! html
11058 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11059 !! end
11060
11061 !! test
11062 Category / paragraph interactions
11063 !! wikitext
11064 Foo [[Category:Baz]] Bar
11065
11066 Foo [[Category:Baz]]
11067 Bar
11068
11069 Foo
11070 [[Category:Baz]]
11071 Bar
11072
11073 Foo
11074 [[Category:Baz]] Bar
11075
11076 Foo
11077 [[Category:Baz]]
11078 [[Category:Baz]]
11079 [[Category:Baz]]
11080 Bar
11081
11082 [[Category:Baz]]
11083 [[Category:Baz]]
11084 [[Category:Baz]]
11085
11086 [[Category:Baz]]
11087 {{echo|[[Category:Baz]]}}
11088 [[Category:Baz]]
11089 !! html
11090 <p>Foo Bar
11091 </p><p>Foo
11092 Bar
11093 </p><p>Foo
11094 Bar
11095 </p><p>Foo Bar
11096 </p><p>Foo
11097 Bar
11098 </p>
11099 !! end
11100
11101 !! test
11102 Parsoid: Serialize link to category page with colon escape
11103 !! options
11104 parsoid
11105 !! wikitext
11106
11107 [[:Category:Foo]]
11108 [[:Category:Foo|Bar]]
11109 !! html
11110 <p>
11111 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11112 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11113 </p>
11114 !! end
11115
11116 !! test
11117 Parsoid: Link prefix/suffixes aren't applied to category links
11118 !! options
11119 parsoid=wt2html,wt2wt,html2html
11120 language=is
11121 !! wikitext
11122 x[[Category:Foo]]y
11123 !! html
11124 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11125 !! end
11126
11127 !! test
11128 Parsoid: Serialize link to file page with colon escape
11129 !! options
11130 parsoid
11131 !! wikitext
11132
11133 [[:File:Foo.png]]
11134 [[:File:Foo.png|Bar]]
11135 !! html
11136 <p>
11137 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11138 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11139 </p>
11140 !! end
11141
11142 !! test
11143 Parsoid: Serialize a genuine category link without colon escape
11144 !! options
11145 parsoid
11146 !! wikitext
11147 [[Category:Foo]]
11148 [[Category:Foo|Bar]]
11149 !! html
11150 <link rel="mw:PageProp/Category" href="Category:Foo">
11151 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11152 !! end
11153
11154 !! test
11155 Parsoid: Defaultsort
11156 !! options
11157 parsoid
11158 !! wikitext
11159 {{DEFAULTSORT:Foo}}
11160 !! html
11161 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11162 !! end
11163
11164 ###
11165 ### Inter-language links
11166 ###
11167 !! test
11168 Inter-language links
11169 !! options
11170 ill
11171 !! wikitext
11172 [[es:Alimento]]
11173 [[fr:Nourriture]]
11174 [[zh:&#39135;&#21697;]]
11175 !! html
11176 es:Alimento fr:Nourriture zh:食品
11177 !! end
11178
11179 !! test
11180 Duplicate interlanguage links (bug 24502)
11181 !! options
11182 ill
11183 !! wikitext
11184 [[es:1]]
11185 [[es:2]]
11186 [[fr:1]]
11187 [[fr:2]]
11188 !! html
11189 es:1 fr:1
11190 !! end
11191
11192 ###
11193 ### Sections
11194 ###
11195 !! test
11196 Basic section headings
11197 !! wikitext
11198 == Headline 1 ==
11199 Some text
11200
11201 ==Headline 2==
11202 More
11203 ===Smaller headline===
11204 Blah blah
11205 !! html
11206 <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>
11207 <p>Some text
11208 </p>
11209 <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>
11210 <p>More
11211 </p>
11212 <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>
11213 <p>Blah blah
11214 </p>
11215 !! end
11216
11217 !! test
11218 Section headings with TOC
11219 !! wikitext
11220 == Headline 1 ==
11221 === Subheadline 1 ===
11222 ===== Skipping a level =====
11223 ====== Skipping a level ======
11224
11225 == Headline 2 ==
11226 Some text
11227 ===Another headline===
11228 !! html
11229 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11230 <ul>
11231 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11232 <ul>
11233 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11234 <ul>
11235 <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>
11236 <ul>
11237 <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>
11238 </ul>
11239 </li>
11240 </ul>
11241 </li>
11242 </ul>
11243 </li>
11244 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11245 <ul>
11246 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11247 </ul>
11248 </li>
11249 </ul>
11250 </div>
11251
11252 <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>
11253 <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>
11254 <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>
11255 <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>
11256 <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>
11257 <p>Some text
11258 </p>
11259 <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>
11260
11261 !! end
11262
11263 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11264 !! test
11265 Handling of sections up to level 6 and beyond
11266 !! wikitext
11267 = Level 1 Heading=
11268 == Level 2 Heading==
11269 === Level 3 Heading===
11270 ==== Level 4 Heading====
11271 ===== Level 5 Heading=====
11272 ====== Level 6 Heading======
11273 ======= Level 7 Heading=======
11274 ======== Level 8 Heading========
11275 ========= Level 9 Heading=========
11276 ========== Level 10 Heading==========
11277 !! html
11278 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11279 <ul>
11280 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11281 <ul>
11282 <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>
11283 <ul>
11284 <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>
11285 <ul>
11286 <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>
11287 <ul>
11288 <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>
11289 <ul>
11290 <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>
11291 <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>
11292 <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>
11293 <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>
11294 <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>
11295 </ul>
11296 </li>
11297 </ul>
11298 </li>
11299 </ul>
11300 </li>
11301 </ul>
11302 </li>
11303 </ul>
11304 </li>
11305 </ul>
11306 </div>
11307
11308 <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>
11309 <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>
11310 <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>
11311 <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>
11312 <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>
11313 <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>
11314 <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>
11315 <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>
11316 <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>
11317 <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>
11318
11319 !! end
11320
11321 !! test
11322 TOC regression (bug 9764)
11323 !! wikitext
11324 == title 1 ==
11325 === title 1.1 ===
11326 ==== title 1.1.1 ====
11327 === title 1.2 ===
11328 == title 2 ==
11329 === title 2.1 ===
11330 !! html
11331 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11332 <ul>
11333 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11334 <ul>
11335 <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>
11336 <ul>
11337 <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>
11338 </ul>
11339 </li>
11340 <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>
11341 </ul>
11342 </li>
11343 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11344 <ul>
11345 <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>
11346 </ul>
11347 </li>
11348 </ul>
11349 </div>
11350
11351 <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>
11352 <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>
11353 <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>
11354 <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>
11355 <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>
11356 <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>
11357
11358 !! end
11359
11360 !! test
11361 TOC with wgMaxTocLevel=3 (bug 6204)
11362 !! options
11363 wgMaxTocLevel=3
11364 !! wikitext
11365 == title 1 ==
11366 === title 1.1 ===
11367 ==== title 1.1.1 ====
11368 === title 1.2 ===
11369 == title 2 ==
11370 === title 2.1 ===
11371 !! html
11372 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11373 <ul>
11374 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11375 <ul>
11376 <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>
11377 <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>
11378 </ul>
11379 </li>
11380 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11381 <ul>
11382 <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>
11383 </ul>
11384 </li>
11385 </ul>
11386 </div>
11387
11388 <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>
11389 <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>
11390 <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>
11391 <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>
11392 <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>
11393 <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>
11394
11395 !! end
11396
11397 !! test
11398 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11399 !! options
11400 wgMaxTocLevel=3
11401 !! wikitext
11402 ==Section 1==
11403 ===Section 1.1===
11404 ====Section 1.1.1====
11405 ====Section 1.1.1.1====
11406 ==Section 2==
11407 !! html
11408 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11409 <ul>
11410 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11411 <ul>
11412 <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>
11413 </ul>
11414 </li>
11415 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11416 </ul>
11417 </div>
11418
11419 <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>
11420 <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>
11421 <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>
11422 <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>
11423 <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>
11424
11425 !! end
11426
11427
11428 !! test
11429 Resolving duplicate section names
11430 !! wikitext
11431 == Foo bar ==
11432 == Foo bar ==
11433 !! html
11434 <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>
11435 <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>
11436
11437 !! end
11438
11439 !! test
11440 Resolving duplicate section names with differing case (bug 10721)
11441 !! wikitext
11442 == Foo bar ==
11443 == Foo Bar ==
11444 !! html
11445 <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>
11446 <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>
11447
11448 !! end
11449
11450 !! article
11451 Template:sections
11452 !! text
11453 ===Section 1===
11454 ==Section 2==
11455 !! endarticle
11456
11457 !! test
11458 Template with sections, __NOTOC__
11459 !! wikitext
11460 __NOTOC__
11461 ==Section 0==
11462 {{sections}}
11463 ==Section 4==
11464 !! html
11465 <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>
11466 <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>
11467 <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>
11468 <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>
11469
11470 !! end
11471
11472 !! test
11473 __NOEDITSECTION__ keyword
11474 !! wikitext
11475 __NOEDITSECTION__
11476 ==Section 1==
11477 ==Section 2==
11478 !! html
11479 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11480 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11481
11482 !! end
11483
11484 !! test
11485 Link inside a section heading
11486 !! wikitext
11487 ==Section with a [[Main Page|link]] in it==
11488 !! html
11489 <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>
11490
11491 !! end
11492
11493 !! test
11494 TOC regression (bug 12077)
11495 !! wikitext
11496 __TOC__
11497 == title 1 ==
11498 === title 1.1 ===
11499 == title 2 ==
11500 !! html
11501 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11502 <ul>
11503 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11504 <ul>
11505 <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>
11506 </ul>
11507 </li>
11508 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11509 </ul>
11510 </div>
11511
11512 <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>
11513 <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>
11514 <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>
11515
11516 !! end
11517
11518 !! test
11519 BUG 1219 URL next to image (good)
11520 !! wikitext
11521 http://example.com [[Image:foobar.jpg]]
11522 !! html
11523 <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>
11524 </p>
11525 !!end
11526
11527 !! test
11528 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11529 !! wikitext
11530 ===
11531 The line above must have a trailing space!
11532 === <!--
11533 --> <!-- -->
11534 But just in case it doesn't...
11535 !! html
11536 <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>
11537 <p>The line above must have a trailing space!
11538 </p>
11539 <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>
11540 <p>But just in case it doesn't...
11541 </p>
11542 !! end
11543
11544 !! test
11545 Header with special characters (bug 25462)
11546 !! wikitext
11547 The tooltips shall not show entities to the user (ie. be double escaped)
11548
11549 == text > text ==
11550 section 1
11551
11552 == text < text ==
11553 section 2
11554
11555 == text & text ==
11556 section 3
11557
11558 == text ' text ==
11559 section 4
11560
11561 == text " text ==
11562 section 5
11563 !! html
11564 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11565 </p>
11566 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11567 <ul>
11568 <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>
11569 <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>
11570 <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>
11571 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11572 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11573 </ul>
11574 </div>
11575
11576 <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>
11577 <p>section 1
11578 </p>
11579 <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>
11580 <p>section 2
11581 </p>
11582 <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>
11583 <p>section 3
11584 </p>
11585 <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>
11586 <p>section 4
11587 </p>
11588 <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>
11589 <p>section 5
11590 </p>
11591 !! end
11592
11593 !! test
11594 Headers with excess '=' characters
11595 (Are similar tests necessary beyond the 1st level?)
11596 !! wikitext
11597 =foo==
11598 ==foo=
11599 =''italic'' heading==
11600 ==''italic'' heading=
11601 !! html
11602 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11603 <ul>
11604 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11605 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11606 <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>
11607 <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>
11608 </ul>
11609 </div>
11610
11611 <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>
11612 <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>
11613 <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>
11614 <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>
11615
11616 !! end
11617
11618 !! test
11619 HTML headers vs TOC (bug 23393)
11620 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11621 !! wikitext
11622 <h1>Header 1</h1>
11623 == Header 1.1 ==
11624 == Header 1.2 ==
11625
11626 <h1>Header 2
11627 </h1>
11628 == Header 2.1 ==
11629 == Header 2.2 ==
11630 __NOEDITSECTION__
11631 !! html
11632 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11633 <ul>
11634 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11635 <ul>
11636 <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>
11637 <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>
11638 </ul>
11639 </li>
11640 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11641 <ul>
11642 <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>
11643 <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>
11644 </ul>
11645 </li>
11646 </ul>
11647 </div>
11648
11649 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11650 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11651 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11652 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11653 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11654 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11655
11656 !! end
11657
11658 !! test
11659 BUG 1219 URL next to image (broken)
11660 !! wikitext
11661 http://example.com[[Image:foobar.jpg]]
11662 !! html
11663 <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>
11664 </p>
11665 !!end
11666
11667 !! test
11668 Bug 1186 news: in the middle of text
11669 !! wikitext
11670 http://en.wikinews.org/wiki/Wikinews:Workplace
11671 !! html
11672 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11673 </p>
11674 !!end
11675
11676
11677 !! test
11678 Namespaced link must have a title
11679 !! wikitext
11680 [[Project:]]
11681 !! html
11682 <p>[[Project:]]
11683 </p>
11684 !!end
11685
11686 !! test
11687 Namespaced link must have a title (bad fragment version)
11688 !! wikitext
11689 [[Project:#fragment]]
11690 !! html
11691 <p>[[Project:#fragment]]
11692 </p>
11693 !!end
11694
11695
11696 ###
11697 ### HTML tags and HTML attributes
11698 ###
11699
11700 !! test
11701 div with no attributes
11702 !! wikitext
11703 <div>HTML rocks</div>
11704 !! html
11705 <div>HTML rocks</div>
11706
11707 !! end
11708
11709 !! test
11710 div with double-quoted attribute
11711 !! wikitext
11712 <div id="rock">HTML rocks</div>
11713 !! html
11714 <div id="rock">HTML rocks</div>
11715
11716 !! end
11717
11718 !! test
11719 div with single-quoted attribute
11720 !! wikitext
11721 <div id='rock'>HTML rocks</div>
11722 !! html
11723 <div id="rock">HTML rocks</div>
11724
11725 !! end
11726
11727 !! test
11728 div with unquoted attribute
11729 !! wikitext
11730 <div id=rock>HTML rocks</div>
11731 !! html
11732 <div id="rock">HTML rocks</div>
11733
11734 !! end
11735
11736 !! test
11737 div with illegal double attributes
11738 !! wikitext
11739 <div id="a" id="b">HTML rocks</div>
11740 !! html
11741 <div id="b">HTML rocks</div>
11742
11743 !!end
11744
11745 # FIXME: produce empty string instead of "class" in the PHP parser, following
11746 # the HTML5 spec.
11747 !! test
11748 div with empty attribute value, space before equals
11749 !! options
11750 parsoid
11751 !! wikitext
11752 <div class =>HTML rocks</div>
11753 !! html
11754 <div class="">HTML rocks</div>
11755
11756 !! end
11757
11758 # The PHP parser escapes the opening brace to &#123; for some reason, so
11759 # disabled this test for it.
11760 !! test
11761 div with braces in attribute value
11762 !! options
11763 parsoid
11764 !! wikitext
11765 <div title="{}">Foo</div>
11766 !! html
11767 <div title="{}">Foo</div>
11768 !! end
11769
11770 # This it very inconsistent in the PHP parser: it returns
11771 # class="class" if there is a space between the name and the equal sign (see
11772 # 'div with empty attribute value, space before equals'), but strips the
11773 # attribute completely if the space is missing. We hope that not much content
11774 # depends on this, so are implementing the behavior below in Parsoid for
11775 # consistencies' sake. Disabled for the PHP parser.
11776 # FIXME: fix this behavior in the PHP parser?
11777 !! test
11778 div with empty attribute value, no space before equals
11779 !! options
11780 parsoid
11781 !! wikitext
11782 <div class=>HTML rocks</div>
11783 !! html
11784 <div class="">HTML rocks</div>
11785
11786 !! end
11787
11788 !! test
11789 HTML multiple attributes correction
11790 !! wikitext
11791 <p class="error" class="awesome">Awesome!</p>
11792 !! html
11793 <p class="awesome">Awesome!</p>
11794
11795 !!end
11796
11797 !! test
11798 Table multiple attributes correction
11799 !! wikitext
11800 {|
11801 !+ class="error" class="awesome"| status
11802 |}
11803 !! html
11804 <table>
11805 <tr>
11806 <th class="awesome"> status
11807 </th></tr></table>
11808
11809 !!end
11810
11811 !! test
11812 DIV IN UPPERCASE
11813 !! wikitext
11814 <DIV ID="x">HTML ROCKS</DIV>
11815 !! html
11816 <div id="x">HTML ROCKS</div>
11817
11818 !!end
11819
11820 !! test
11821 Non-ASCII pseudo-tags are rendered as text
11822 !! wikitext
11823 <khyô>
11824 !! html
11825 <p>&lt;khyô&gt;
11826 </p>
11827 !! end
11828
11829 !! test
11830 Pseudo-tag with URL 'name' renders as url link
11831 !! wikitext
11832 <http://example.com/>
11833 !! html
11834 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11835 </p>
11836 !! end
11837
11838 !! test
11839 text with amp in the middle of nowhere
11840 !! wikitext
11841 Remember AT&T?
11842 !! html
11843 <p>Remember AT&amp;T?
11844 </p>
11845 !! end
11846
11847 !! test
11848 text with character entity: eacute
11849 !! wikitext
11850 I always thought &eacute; was a cute letter.
11851 !! html
11852 <p>I always thought &#233; was a cute letter.
11853 </p>
11854 !! end
11855
11856 !! test
11857 text with entity-escaped character entity-like string: eacute
11858 !! wikitext
11859 I always thought &amp;eacute; was a cute letter.
11860 !! html
11861 <p>I always thought &amp;eacute; was a cute letter.
11862 </p>
11863 !! end
11864
11865 !! test
11866 text with undefined character entity: xacute
11867 !! wikitext
11868 I always thought &xacute; was a cute letter.
11869 !! html
11870 <p>I always thought &amp;xacute; was a cute letter.
11871 </p>
11872 !! end
11873
11874 # TODO: generalize to PHP parser?
11875 !! test
11876 HTML5 tags
11877 !! options
11878 parsoid
11879 !! wikitext
11880 <data value="5">five</data>
11881 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11882 <mark>This highlighted text</mark>
11883 !! html
11884 <p><data value="5">five</data>
11885 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11886 <mark>This highlighted text</mark></p>
11887 !! end
11888
11889 !! test
11890 HTML tag with leading space is parsed as text
11891 !! wikitext
11892 < div>foo< /div>
11893 !! html
11894 <p>&lt; div&gt;foo&lt; /div&gt;
11895 </p>
11896 !! end
11897
11898 ###
11899 ### Nesting tests (see bug 41545, 50604, 51081)
11900 ###
11901
11902 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11903 # Note that html2wt is considerably more difficult if we use <b> in
11904 # the test case, instead of <big>
11905 !! test
11906 Ensure that HTML adoption agency algorithm is properly implemented.
11907 !! wikitext
11908 <big>X<big>Y</big>Z</big>
11909 !! html
11910 <p><big>X<big>Y</big>Z</big>
11911 </p>
11912 !! end
11913
11914 # This was bug 41545 in the PHP parser.
11915 !! test
11916 Nesting of <kbd>
11917 !! wikitext
11918 <kbd>X<kbd>Y</kbd>Z</kbd>
11919 !! html
11920 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11921 </p>
11922 !! end
11923
11924 # The following cases were bug 51081 in the PHP parser.
11925 # Note that there are some other nestable tags (b, i, etc) which are
11926 # not covered; see bug 51081 for discussion.
11927 !! test
11928 Nesting of <em>
11929 !! wikitext
11930 <em>X<em>Y</em>Z</em>
11931 !! html
11932 <p><em>X<em>Y</em>Z</em>
11933 </p>
11934 !! end
11935
11936 !! test
11937 Nesting of <strong>
11938 !! wikitext
11939 <strong>X<strong>Y</strong>Z</strong>
11940 !! html
11941 <p><strong>X<strong>Y</strong>Z</strong>
11942 </p>
11943 !! end
11944
11945 !! test
11946 Nesting of <q>
11947 !! wikitext
11948 <q>X<q>Y</q>Z</q>
11949 !! html
11950 <p><q>X<q>Y</q>Z</q>
11951 </p>
11952 !! end
11953
11954 !! test
11955 Nesting of <ruby>
11956 !! wikitext
11957 <ruby>X<ruby>Y</ruby>Z</ruby>
11958 !! html
11959 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11960 </p>
11961 !! end
11962
11963 !! test
11964 Nesting of <bdo>
11965 !! wikitext
11966 <bdo>X<bdo>Y</bdo>Z</bdo>
11967 !! html
11968 <p><bdo>X<bdo>Y</bdo>Z</bdo>
11969 </p>
11970 !! end
11971
11972
11973 ###
11974 ### Media links
11975 ###
11976
11977 !! test
11978 Media link
11979 !! wikitext
11980 [[Media:Foobar.jpg]]
11981 !! html
11982 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
11983 </p>
11984 !! end
11985
11986 !! test
11987 Media link with text
11988 !! wikitext
11989 [[Media:Foobar.jpg|A neat file to look at]]
11990 !! html
11991 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
11992 </p>
11993 !! end
11994
11995 # FIXME: this is still bad HTML tag nesting
11996 !! test
11997 Media link with nasty text
11998 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
11999 !! wikitext
12000 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12001 !! html
12002 <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>
12003
12004 !! end
12005
12006 !! test
12007 Media link to nonexistent file (bug 1702)
12008 !! wikitext
12009 [[Media:No such.jpg]]
12010 !! html
12011 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12012 </p>
12013 !! end
12014
12015 !! test
12016 Image link to nonexistent file (bug 1850 - good)
12017 !! wikitext
12018 [[Image:No such.jpg]]
12019 !! html
12020 <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>
12021 </p>
12022 !! end
12023
12024 !! test
12025 :Image link to nonexistent file (bug 1850 - bad)
12026 !! wikitext
12027 [[:Image:No such.jpg]]
12028 !! html
12029 <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>
12030 </p>
12031 !! end
12032
12033
12034
12035 !! test
12036 Character reference normalization in link text (bug 1938)
12037 !! wikitext
12038 [[Main Page|this&that]]
12039 !! html
12040 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12041 </p>
12042 !!end
12043
12044 !! article
12045 אַ
12046 !! text
12047 Test for unicode normalization
12048
12049 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12050 !! endarticle
12051
12052 !! test
12053 (bug 19451) Links should refer to the normalized form.
12054 !! wikitext
12055 [[&#xFB2E;]]
12056 [[&#x5d0;&#x5b7;]]
12057 [[&#x5d0;ַ]]
12058 [[א&#x5b7;]]
12059 [[אַ]]
12060 !! html
12061 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12062 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12063 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12064 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12065 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12066 </p>
12067 !! end
12068
12069 !! test
12070 Empty attribute crash test (bug 2067)
12071 !! wikitext
12072 <font color="">foo</font>
12073 !! html
12074 <p><font color="">foo</font>
12075 </p>
12076 !! end
12077
12078 !! test
12079 Empty attribute crash test single-quotes (bug 2067)
12080 !! wikitext
12081 <font color=''>foo</font>
12082 !! html
12083 <p><font color="">foo</font>
12084 </p>
12085 !! end
12086
12087 !! test
12088 Attribute test: equals, then nothing
12089 !! wikitext
12090 <font color=>foo</font>
12091 !! html
12092 <p><font>foo</font>
12093 </p>
12094 !! end
12095
12096 !! test
12097 Attribute test: unquoted value
12098 !! wikitext
12099 <font color=x>foo</font>
12100 !! html
12101 <p><font color="x">foo</font>
12102 </p>
12103 !! end
12104
12105 !! test
12106 Attribute test: unquoted but illegal value (hash)
12107 !! wikitext
12108 <font color=#x>foo</font>
12109 !! html
12110 <p><font color="#x">foo</font>
12111 </p>
12112 !! end
12113
12114 !! test
12115 Attribute test: no value
12116 !! wikitext
12117 <font color>foo</font>
12118 !! html
12119 <p><font color="color">foo</font>
12120 </p>
12121 !! end
12122
12123 !! test
12124 Bug 2095: link with three closing brackets
12125 !! wikitext
12126 [[Main Page]]]
12127 !! html
12128 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12129 </p>
12130 !! end
12131
12132 !! test
12133 Bug 2095: link with pipe and three closing brackets
12134 !! wikitext
12135 [[Main Page|link]]]
12136 !! html
12137 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12138 </p>
12139 !! end
12140
12141 !! test
12142 Bug 2095: link with pipe and three closing brackets, version 2
12143 !! wikitext
12144 [[Main Page|[http://example.com/]]]
12145 !! html
12146 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12147 </p>
12148 !! end
12149
12150
12151 ###
12152 ### Safety
12153 ###
12154
12155 !! article
12156 Template:Dangerous attribute
12157 !! text
12158 " onmouseover="alert(document.cookie)
12159 !! endarticle
12160
12161 !! article
12162 Template:Dangerous style attribute
12163 !! text
12164 border-size: expression(alert(document.cookie))
12165 !! endarticle
12166
12167 !! article
12168 Template:Div style
12169 !! text
12170 <div style="float: right; {{{1}}}">Magic div</div>
12171 !! endarticle
12172
12173 !! test
12174 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12175 !! wikitext
12176 <div title="{{test}}"></div>
12177 !! html
12178 <div title="This is a test template"></div>
12179
12180 !! end
12181
12182 !! test
12183 Bug 2304: HTML attribute safety (dangerous template; 2309)
12184 !! wikitext
12185 <div title="{{dangerous attribute}}"></div>
12186 !! html
12187 <div title=""></div>
12188
12189 !! end
12190
12191 !! test
12192 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12193 !! wikitext
12194 <div style="{{dangerous style attribute}}"></div>
12195 !! html
12196 <div style="/* insecure input */"></div>
12197
12198 !! end
12199
12200 !! test
12201 Bug 2304: HTML attribute safety (safe parameter; 2309)
12202 !! wikitext
12203 {{div style|width: 200px}}
12204 !! html
12205 <div style="float: right; width: 200px">Magic div</div>
12206
12207 !! end
12208
12209 !! test
12210 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12211 !! wikitext
12212 {{div style|width: expression(alert(document.cookie))}}
12213 !! html
12214 <div style="/* insecure input */">Magic div</div>
12215
12216 !! end
12217
12218 !! test
12219 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12220 !! wikitext
12221 {{div style|"><script>alert(document.cookie)</script>}}
12222 !! html
12223 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12224
12225 !! end
12226
12227 !! test
12228 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12229 !! wikitext
12230 {{div style|" ><script>alert(document.cookie)</script>}}
12231 !! html
12232 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12233
12234 !! end
12235
12236 !! test
12237 Bug 2304: HTML attribute safety (link)
12238 !! wikitext
12239 <div title="[[Main Page]]"></div>
12240 !! html
12241 <div title="&#91;&#91;Main Page]]"></div>
12242
12243 !! end
12244
12245 !! test
12246 Bug 2304: HTML attribute safety (italics)
12247 !! wikitext
12248 <div title="''foobar''"></div>
12249 !! html
12250 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12251
12252 !! end
12253
12254 !! test
12255 Bug 2304: HTML attribute safety (bold)
12256 !! wikitext
12257 <div title="'''foobar'''"></div>
12258 !! html
12259 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12260
12261 !! end
12262
12263
12264 !! test
12265 Bug 2304: HTML attribute safety (ISBN)
12266 !! wikitext
12267 <div title="ISBN 1234567890"></div>
12268 !! html
12269 <div title="&#73;SBN 1234567890"></div>
12270
12271 !! end
12272
12273 !! test
12274 Bug 2304: HTML attribute safety (RFC)
12275 !! wikitext
12276 <div title="RFC 1234"></div>
12277 !! html
12278 <div title="&#82;FC 1234"></div>
12279
12280 !! end
12281
12282 !! test
12283 Bug 2304: HTML attribute safety (PMID)
12284 !! wikitext
12285 <div title="PMID 1234567890"></div>
12286 !! html
12287 <div title="&#80;MID 1234567890"></div>
12288
12289 !! end
12290
12291 !! test
12292 Bug 2304: HTML attribute safety (web link)
12293 !! wikitext
12294 <div title="http://example.com/"></div>
12295 !! html
12296 <div title="http&#58;//example.com/"></div>
12297
12298 !! end
12299
12300 !! test
12301 Bug 2304: HTML attribute safety (named web link)
12302 !! wikitext
12303 <div title="[http://example.com/ link]"></div>
12304 !! html
12305 <div title="&#91;http&#58;//example.com/ link]"></div>
12306
12307 !! end
12308
12309 !! test
12310 Bug 3244: HTML attribute safety (extension; safe)
12311 !! wikitext
12312 <div style="<nowiki>background:blue</nowiki>"></div>
12313 !! html
12314 <div style="background:blue"></div>
12315
12316 !! end
12317
12318 !! test
12319 Bug 3244: HTML attribute safety (extension; unsafe)
12320 !! wikitext
12321 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12322 !! html
12323 <div style="/* insecure input */"></div>
12324
12325 !! end
12326
12327 # More MSIE fun discovered by Tom Gilder
12328
12329 !! test
12330 MSIE CSS safety test: spurious slash
12331 !! wikitext
12332 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12333 !! html
12334 <div style="/* insecure input */">evil</div>
12335
12336 !! end
12337
12338 !! test
12339 MSIE CSS safety test: hex code
12340 !! wikitext
12341 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12342 !! html
12343 <div style="/* insecure input */">evil</div>
12344
12345 !! end
12346
12347 !! test
12348 MSIE CSS safety test: comment in url
12349 !! wikitext
12350 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12351 !! html
12352 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12353
12354 !! end
12355
12356 !! test
12357 MSIE CSS safety test: comment in expression
12358 !! wikitext
12359 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12360 !! html
12361 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12362
12363 !! end
12364
12365 !! test
12366 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12367 !! wikitext
12368 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12369 !! html
12370 <p style="/* invalid control char */">A</p>
12371
12372 !! end
12373
12374 !! test
12375 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12376 !! wikitext
12377 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12378 <div style="top:EXPRESSION(alert())">B</div>
12379 !! html
12380 <p style="/* insecure input */">A</p>
12381 <div style="/* insecure input */">B</div>
12382
12383 !! end
12384
12385 !! test
12386 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12387 !! wikitext
12388 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12389 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12390 !! html
12391 <div style="/* insecure input */">A</div>
12392 <p style="/* insecure input */">B</p>
12393
12394 !! end
12395
12396 !! test
12397 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12398 !! wikitext
12399 <div style="background-image:url⁽javascript:alert())">A</div>
12400 <div style="background-image:url₍javascript:alert())">B</div>
12401 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12402 !! html
12403 <div style="/* insecure input */">A</div>
12404 <div style="/* insecure input */">B</div>
12405 <p style="/* insecure input */">C</p>
12406
12407 !! end
12408
12409 !! test
12410 Opera -o-link CSS
12411 !! wikitext
12412 <div
12413 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;"
12414 style="-o-link:attr(title);-o-link-source:current">X</div>
12415 !! html
12416 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12417
12418 !! end
12419
12420 !! test
12421 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12422 !! wikitext
12423 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12424 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12425 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12426 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12427 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12428 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12429 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12430 !! html
12431 <p style="/* insecure input */">A</p>
12432 <p style="/* insecure input */">B</p>
12433 <p style="/* insecure input */">C</p>
12434 <p style="/* insecure input */">D</p>
12435 <p style="/* insecure input */">E</p>
12436 <p style="/* insecure input */">F</p>
12437 <p style="/* insecure input */">G</p>
12438
12439 !! end
12440
12441 !! test
12442 Table attribute legitimate extension
12443 !! wikitext
12444 {|
12445 !+ style="<nowiki>color:blue</nowiki>"| status
12446 |}
12447 !! html
12448 <table>
12449 <tr>
12450 <th style="color:blue"> status
12451 </th></tr></table>
12452
12453 !!end
12454
12455 !! test
12456 Table attribute safety
12457 !! wikitext
12458 {|
12459 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12460 |}
12461 !! html
12462 <table>
12463 <tr>
12464 <th style="/* insecure input */"> status
12465 </th></tr></table>
12466
12467 !! end
12468
12469 !! test
12470 CSS line continuation 1
12471 !! wikitext
12472 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12473 !! html
12474 <div style="/* insecure input */"></div>
12475
12476 !! end
12477
12478 !! test
12479 CSS line continuation 2
12480 !! wikitext
12481 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12482 !! html
12483 <div style="/* insecure input */"></div>
12484
12485 !! end
12486
12487 !! article
12488 Template:Identity
12489 !! text
12490 {{{1}}}
12491 !! endarticle
12492
12493 !! test
12494 Expansion of multi-line templates in attribute values (bug 6255)
12495 !! wikitext
12496 <div style="background: {{identity|#00FF00}}">-</div>
12497 !! html
12498 <div style="background: #00FF00">-</div>
12499
12500 !! end
12501
12502
12503 !! test
12504 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12505 !! wikitext
12506 <div style="background:
12507 #00FF00">-</div>
12508 !! html
12509 <div style="background: #00FF00">-</div>
12510
12511 !! end
12512
12513 !! test
12514 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12515 !! wikitext
12516 <div style="background: &#10;#00FF00">-</div>
12517 !! html
12518 <div style="background: &#10;#00FF00">-</div>
12519
12520 !! end
12521
12522 ###
12523 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12524 ###
12525 !! test
12526 Parser hook: empty input
12527 !! wikitext
12528 <tag></tag>
12529 !! html
12530 <pre>
12531 ''
12532 array (
12533 )
12534 </pre>
12535
12536 !! end
12537
12538 !! test
12539 Parser hook: empty input using terminated empty elements
12540 !! wikitext
12541 <tag/>
12542 !! html
12543 <pre>
12544 NULL
12545 array (
12546 )
12547 </pre>
12548
12549 !! end
12550
12551 !! test
12552 Parser hook: empty input using terminated empty elements (space before)
12553 !! wikitext
12554 <tag />
12555 !! html
12556 <pre>
12557 NULL
12558 array (
12559 )
12560 </pre>
12561
12562 !! end
12563
12564 !! test
12565 Parser hook: basic input
12566 !! wikitext
12567 <tag>input</tag>
12568 !! html
12569 <pre>
12570 'input'
12571 array (
12572 )
12573 </pre>
12574
12575 !! end
12576
12577
12578 !! test
12579 Parser hook: case insensitive
12580 !! wikitext
12581 <TAG>input</TAG>
12582 !! html
12583 <pre>
12584 'input'
12585 array (
12586 )
12587 </pre>
12588
12589 !! end
12590
12591
12592 !! test
12593 Parser hook: case insensitive, redux
12594 !! wikitext
12595 <TaG>input</TAg>
12596 !! html
12597 <pre>
12598 'input'
12599 array (
12600 )
12601 </pre>
12602
12603 !! end
12604
12605 !! test
12606 Parser hook: nested tags
12607 !! options
12608 noxml
12609 !! wikitext
12610 <tag><tag></tag></tag>
12611 !! html
12612 <pre>
12613 '<tag>'
12614 array (
12615 )
12616 </pre>&lt;/tag&gt;
12617
12618 !! end
12619
12620 !! test
12621 Parser hook: basic arguments
12622 !! wikitext
12623 <tag width=200 height = "100" depth = '50' square></tag>
12624 !! html
12625 <pre>
12626 ''
12627 array (
12628 'width' => '200',
12629 'height' => '100',
12630 'depth' => '50',
12631 'square' => 'square',
12632 )
12633 </pre>
12634
12635 !! end
12636
12637 !! test
12638 Parser hook: argument containing a forward slash (bug 5344)
12639 !! wikitext
12640 <tag filename='/tmp/bla'></tag>
12641 !! html
12642 <pre>
12643 ''
12644 array (
12645 'filename' => '/tmp/bla',
12646 )
12647 </pre>
12648
12649 !! end
12650
12651 !! test
12652 Parser hook: empty input using terminated empty elements (bug 2374)
12653 !! wikitext
12654 <tag foo=bar/>text
12655 !! html
12656 <pre>
12657 NULL
12658 array (
12659 'foo' => 'bar',
12660 )
12661 </pre>text
12662
12663 !! end
12664
12665 # </tag> should be output literally since there is no matching tag that begins it
12666 !! test
12667 Parser hook: basic arguments using terminated empty elements (bug 2374)
12668 !! wikitext
12669 <tag width=200 height = "100" depth = '50' square/>
12670 other stuff
12671 </tag>
12672 !! html
12673 <pre>
12674 NULL
12675 array (
12676 'width' => '200',
12677 'height' => '100',
12678 'depth' => '50',
12679 'square' => 'square',
12680 )
12681 </pre>
12682 <p>other stuff
12683 &lt;/tag&gt;
12684 </p>
12685 !! end
12686
12687 ###
12688 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12689 ###
12690
12691 !! test
12692 Parser hook: static parser hook not inside a comment
12693 !! wikitext
12694 <statictag>hello, world</statictag>
12695 <statictag action=flush/>
12696 !! html
12697 <p>hello, world
12698 </p>
12699 !! end
12700
12701
12702 !! test
12703 Parser hook: static parser hook inside a comment
12704 !! wikitext
12705 <!-- <statictag>hello, world</statictag> -->
12706 <statictag action=flush/>
12707 !! html
12708 <p><br />
12709 </p>
12710 !! end
12711
12712 # Nested template calls; this case was broken by Parser.php rev 1.506,
12713 # since reverted.
12714
12715 !! article
12716 Template:One-parameter
12717 !! text
12718 (My parameter is: {{{1}}})
12719 !! endarticle
12720
12721 !! article
12722 Template:Map-one-parameter
12723 !! text
12724 {{{{{1}}}|{{{2}}}}}
12725 !! endarticle
12726
12727 !! test
12728 Nested template calls
12729 !! wikitext
12730 {{Map-one-parameter|One-parameter|param}}
12731 !! html
12732 <p>(My parameter is: param)
12733 </p>
12734 !! end
12735
12736
12737 ###
12738 ### Sanitizer
12739 ###
12740 !! test
12741 Sanitizer: Closing of open tags
12742 !! wikitext
12743 <s></s><table></table>
12744 !! html
12745 <s></s><table></table>
12746
12747 !! end
12748
12749 !! test
12750 Sanitizer: Closing of open but not closed tags
12751 !! wikitext
12752 <s>foo
12753 !! html
12754 <p><s>foo</s>
12755 </p>
12756 !! end
12757
12758 !! test
12759 Sanitizer: Closing of closed but not open tags
12760 !! wikitext
12761 </s>
12762 !! html
12763 <p>&lt;/s&gt;
12764 </p>
12765 !! end
12766
12767 !! test
12768 Sanitizer: Closing of closed but not open table tags
12769 !! wikitext
12770 Table not started</td></tr></table>
12771 !! html
12772 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12773 </p>
12774 !! end
12775
12776 !! test
12777 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12778 !! wikitext
12779 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12780 !! html
12781 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12782 </p>
12783 !! end
12784
12785 !! test
12786 Sanitizer: Validating the contents of the id attribute (bug 4515)
12787 !! options
12788 disabled
12789 !! wikitext
12790 <br id=9 />
12791 !! html
12792 Something, but definitely not <br id="9" />...
12793 !! end
12794
12795 !! test
12796 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12797 !! options
12798 disabled
12799 !! wikitext
12800 <br id="foo" /><br id="foo" />
12801 !! html
12802 Something need to be done. foo-2 ?
12803 !! end
12804
12805 !! test
12806 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12807 !! wikitext
12808 <div itemscope>
12809 <meta itemprop="hello" content="world">
12810 <meta http-equiv="refresh" content="5">
12811 <meta itemprop="hello" http-equiv="refresh" content="5">
12812 <link itemprop="hello" href="{{SERVER}}">
12813 <link rel="stylesheet" href="{{SERVER}}">
12814 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12815 </div>
12816 !! html
12817 <div itemscope="itemscope">
12818 <p> <meta itemprop="hello" content="world" />
12819 &lt;meta http-equiv="refresh" content="5"&gt;
12820 <meta itemprop="hello" content="5" />
12821 </p>
12822 <link itemprop="hello" href="http&#58;//example.org" />
12823 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12824 <link itemprop="hello" href="http&#58;//example.org" />
12825 </div>
12826
12827 !! end
12828
12829 !! test
12830 Language converter: output gets cut off unexpectedly (bug 5757)
12831 !! options
12832 language=zh
12833 !! wikitext
12834 this bit is safe: }-
12835
12836 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12837
12838 then we get cut off here: }-
12839
12840 all additional text is vanished
12841 !! html
12842 <p>this bit is safe: }-
12843 </p><p>but if we add a conversion instance: xxx
12844 </p><p>then we get cut off here: }-
12845 </p><p>all additional text is vanished
12846 </p>
12847 !! end
12848
12849 !! test
12850 Self closed html pairs (bug 5487)
12851 !! options
12852 !! wikitext
12853 <center><font id="bug" />Centered text</center>
12854 <div><font id="bug2" />In div text</div>
12855 !! html
12856 <center>&lt;font id="bug" /&gt;Centered text</center>
12857 <div>&lt;font id="bug2" /&gt;In div text</div>
12858
12859 !! end
12860
12861 #
12862 #
12863 #
12864
12865 !! test
12866 Punctuation: nbsp before exclamation
12867 !! wikitext
12868 C'est grave !
12869 !! html
12870 <p>C'est grave&#160;!
12871 </p>
12872 !! end
12873
12874 !! test
12875 Punctuation: CSS !important (bug 11874)
12876 !! wikitext
12877 <div style="width:50% !important">important</div>
12878 !! html
12879 <div style="width:50% !important">important</div>
12880
12881 !!end
12882
12883 !! test
12884 Punctuation: CSS ! important (bug 11874; with space after)
12885 !! wikitext
12886 <div style="width:50% ! important">important</div>
12887 !! html
12888 <div style="width:50% ! important">important</div>
12889
12890 !!end
12891
12892
12893 !! test
12894 HTML bullet list, closed tags (bug 5497)
12895 !! wikitext
12896 <ul>
12897 <li>One</li>
12898 <li>Two</li>
12899 </ul>
12900 !! html
12901 <ul>
12902 <li>One</li>
12903 <li>Two</li>
12904 </ul>
12905
12906 !! end
12907
12908 !! test
12909 HTML bullet list, unclosed tags (bug 5497)
12910 !! options
12911 disabled
12912 !! wikitext
12913 <ul>
12914 <li>One
12915 <li>Two
12916 </ul>
12917 !! html
12918 <ul>
12919 <li>One
12920 </li>
12921 <li>Two
12922 </li>
12923 </ul>
12924
12925 !! end
12926
12927 !! test
12928 HTML ordered list, closed tags (bug 5497)
12929 !! wikitext
12930 <ol>
12931 <li>One</li>
12932 <li>Two</li>
12933 </ol>
12934 !! html
12935 <ol>
12936 <li>One</li>
12937 <li>Two</li>
12938 </ol>
12939
12940 !! end
12941
12942 !! test
12943 HTML ordered list, unclosed tags (bug 5497)
12944 !! options
12945 disabled
12946 !! wikitext
12947 <ol>
12948 <li>One
12949 <li>Two
12950 </ol>
12951 !! html
12952 <ol>
12953 <li>One
12954 </li>
12955 <li>Two
12956 </li>
12957 </ol>
12958
12959 !! end
12960
12961 !! test
12962 HTML nested bullet list, closed tags (bug 5497)
12963 !! wikitext
12964 <ul>
12965 <li>One</li>
12966 <li>Two:
12967 <ul>
12968 <li>Sub-one</li>
12969 <li>Sub-two</li>
12970 </ul>
12971 </li>
12972 </ul>
12973 !! html
12974 <ul>
12975 <li>One</li>
12976 <li>Two:
12977 <ul>
12978 <li>Sub-one</li>
12979 <li>Sub-two</li>
12980 </ul>
12981 </li>
12982 </ul>
12983
12984 !! end
12985
12986 !! test
12987 HTML nested bullet list, open tags (bug 5497)
12988 !! options
12989 disabled
12990 !! wikitext
12991 <ul>
12992 <li>One
12993 <li>Two:
12994 <ul>
12995 <li>Sub-one
12996 <li>Sub-two
12997 </ul>
12998 </ul>
12999 !! html
13000 <ul>
13001 <li>One
13002 </li>
13003 <li>Two:
13004 <ul>
13005 <li>Sub-one
13006 </li>
13007 <li>Sub-two
13008 </li>
13009 </ul>
13010 </li>
13011 </ul>
13012
13013 !! end
13014
13015 !! test
13016 HTML nested ordered list, closed tags (bug 5497)
13017 !! wikitext
13018 <ol>
13019 <li>One</li>
13020 <li>Two:
13021 <ol>
13022 <li>Sub-one</li>
13023 <li>Sub-two</li>
13024 </ol>
13025 </li>
13026 </ol>
13027 !! html
13028 <ol>
13029 <li>One</li>
13030 <li>Two:
13031 <ol>
13032 <li>Sub-one</li>
13033 <li>Sub-two</li>
13034 </ol>
13035 </li>
13036 </ol>
13037
13038 !! end
13039
13040 !! test
13041 HTML nested ordered list, open tags (bug 5497)
13042 !! options
13043 disabled
13044 !! wikitext
13045 <ol>
13046 <li>One
13047 <li>Two:
13048 <ol>
13049 <li>Sub-one
13050 <li>Sub-two
13051 </ol>
13052 </ol>
13053 !! html
13054 <ol>
13055 <li>One
13056 </li>
13057 <li>Two:
13058 <ol>
13059 <li>Sub-one
13060 </li>
13061 <li>Sub-two
13062 </li>
13063 </ol>
13064 </li>
13065 </ol>
13066
13067 !! end
13068
13069 !! test
13070 HTML ordered list item with parameters oddity
13071 !! wikitext
13072 <ol><li id="fragment">One</li>
13073 </ol>
13074 !! html
13075 <ol><li id="fragment">One</li>
13076 </ol>
13077
13078 !! end
13079
13080 !!test
13081 bug 5918: autonumbering
13082 !! wikitext
13083 [http://first/] [http://second] [ftp://ftp]
13084
13085 ftp://inlineftp
13086
13087 [mailto:enclosed@mail.tld With target]
13088
13089 [mailto:enclosed@mail.tld]
13090
13091 mailto:inline@mail.tld
13092 !! html
13093 <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>
13094 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13095 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13096 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13097 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13098 </p>
13099 !! end
13100
13101
13102 #
13103 # Security and HTML correctness
13104 # From Nick Jenkins' fuzz testing
13105 #
13106
13107 !! test
13108 Fuzz testing: Parser13
13109 !! wikitext
13110 {|
13111 | http://a|
13112 !! html
13113 <table>
13114 <tr>
13115 <td>
13116 </td>
13117 </tr>
13118 </table>
13119
13120 !! end
13121
13122 !! test
13123 Fuzz testing: Parser14
13124 !! wikitext
13125 == onmouseover= ==
13126 http://__TOC__
13127 !! html
13128 <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>
13129 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13130 <ul>
13131 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13132 </ul>
13133 </div>
13134
13135
13136 !! end
13137
13138 !! test
13139 Fuzz testing: Parser14-table
13140 !! wikitext
13141 ==a==
13142 {| STYLE=__TOC__
13143 !! html
13144 <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>
13145 <table style="&#95;_TOC&#95;_">
13146 <tr><td></td></tr>
13147 </table>
13148
13149 !! end
13150
13151 # Known to produce bogus xml (extra </td>)
13152 !! test
13153 Fuzz testing: Parser16
13154 !! options
13155 noxml
13156 !! wikitext
13157 {|
13158 !https://||||||
13159 !! html
13160 <table>
13161 <tr>
13162 <th>https://</th>
13163 <th></th>
13164 <th></th>
13165 <th>
13166 </td>
13167 </tr>
13168 </table>
13169
13170 !! end
13171
13172 !! test
13173 Fuzz testing: Parser21
13174 !! wikitext
13175 {|
13176 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13177 |
13178 !! html
13179 <table>
13180 <tr>
13181 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13182 </th>
13183 <td>
13184 </td>
13185 </tr>
13186 </table>
13187
13188 !! end
13189
13190 !! test
13191 Fuzz testing: Parser22
13192 !! wikitext
13193 http://===r:::https://b
13194
13195 {|
13196 !! html
13197 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13198 </p>
13199 <table>
13200 <tr><td></td></tr>
13201 </table>
13202
13203 !! end
13204
13205 # Known to produce bad XML for now
13206 !! test
13207 Fuzz testing: Parser24
13208 !! options
13209 noxml
13210 !! wikitext
13211 {|
13212 {{{|
13213 <u CLASS=
13214 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13215 <br style="onmouseover='alert(document.cookie);' " />
13216
13217 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13218 |
13219 !! html
13220 <table>
13221 {{{|
13222 <u class="&#124;">}}}} &gt;
13223 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13224
13225 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13226 <tr>
13227 <td></u>
13228 </td>
13229 </tr>
13230 </table>
13231
13232 !! end
13233
13234 # Note: the current result listed for this is not what the original one was,
13235 # but the original bug was JavaScript injection, which is fixed in any case.
13236 # It's not clear that the original result listed was any more correct than the
13237 # current one. Original result:
13238 # <p>{{{|
13239 # </p>
13240 # <li class="&#124;&#124;">
13241 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13242 !!test
13243 Fuzz testing: Parser25 (bug 6055)
13244 !! wikitext
13245 {{{
13246 |
13247 <LI CLASS=||
13248 >
13249 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13250 !! html
13251 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13252 </p>
13253 !! end
13254
13255 !!test
13256 Fuzz testing: URL adjacent extension (with space, clean)
13257 !! options
13258 !! wikitext
13259 http://example.com <nowiki>junk</nowiki>
13260 !! html
13261 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13262 </p>
13263 !!end
13264
13265 !!test
13266 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13267 !! options
13268 !! wikitext
13269 http://example.com<nowiki>junk</nowiki>
13270 !! html
13271 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13272 </p>
13273 !!end
13274
13275 !!test
13276 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13277 !! options
13278 !! wikitext
13279 http://example.com<pre>junk</pre>
13280 !! html
13281 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13282
13283 !!end
13284
13285 !!test
13286 Fuzz testing: image with bogus manual thumbnail
13287 !! wikitext
13288 [[Image:foobar.jpg|thumbnail= ]]
13289 !! html/php
13290 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13291
13292 !! html/parsoid
13293 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13294 !!end
13295
13296 !! test
13297 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13298 !! wikitext
13299 <pre dir="&#10;"></pre>
13300 !! html
13301 <pre dir="&#10;"></pre>
13302
13303 !! end
13304
13305 !! test
13306 Parsing optional HTML elements (Bug 6171)
13307 !! options
13308 !! wikitext
13309 <table>
13310 <tr>
13311 <td> Some tabular data</td>
13312 <td> More tabular data ...
13313 <td> And yet som tabular data</td>
13314 </tr>
13315 </table>
13316 !! html
13317 <table>
13318 <tr>
13319 <td> Some tabular data</td>
13320 <td> More tabular data ...
13321 </td><td> And yet som tabular data</td>
13322 </tr>
13323 </table>
13324
13325 !! end
13326
13327 !! test
13328 Correct handling of <td>, <tr> (Bug 6171)
13329 !! options
13330 !! wikitext
13331 <table>
13332 <tr>
13333 <td> Some tabular data</td>
13334 <td> More tabular data ...</td>
13335 <td> And yet som tabular data</td>
13336 </tr>
13337 </table>
13338 !! html
13339 <table>
13340 <tr>
13341 <td> Some tabular data</td>
13342 <td> More tabular data ...</td>
13343 <td> And yet som tabular data</td>
13344 </tr>
13345 </table>
13346
13347 !! end
13348
13349
13350 !! test
13351 Parsing crashing regression (fr:JavaScript)
13352 !! wikitext
13353 </body></x>
13354 !! html
13355 <p>&lt;/body&gt;&lt;/x&gt;
13356 </p>
13357 !! end
13358
13359 !! test
13360 Inline wiki vs wiki block nesting
13361 !! wikitext
13362 '''Bold paragraph
13363
13364 New wiki paragraph
13365 !! html
13366 <p><b>Bold paragraph</b>
13367 </p><p>New wiki paragraph
13368 </p>
13369 !! end
13370
13371 !! test
13372 Inline HTML vs wiki block nesting
13373 !! options
13374 disabled
13375 !! wikitext
13376 <b>Bold paragraph
13377
13378 New wiki paragraph
13379 !! html
13380 <p><b>Bold paragraph</b>
13381 </p><p>New wiki paragraph
13382 </p>
13383 !! end
13384
13385 # Original result was this:
13386 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13387 # </p>
13388 # While that might be marginally more intuitive, maybe, the six-apostrophe
13389 # construct is clearly pathological and the result stated here (which is what
13390 # the parser actually does) is about as reasonable as anything.
13391 !!test
13392 Mixing markup for italics and bold
13393 !! options
13394 !! wikitext
13395 '''bold''''''bold''bolditalics'''''
13396 !! html
13397 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13398 </p>
13399 !! end
13400
13401
13402 !! article
13403 Xyzzyx
13404 !! text
13405 Article for special page transclusion test
13406 !! endarticle
13407
13408 !! test
13409 Special page transclusion
13410 !! options
13411 !! wikitext
13412 {{Special:Prefixindex/Xyzzyx}}
13413 !! html
13414 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13415
13416 !! end
13417
13418 !! test
13419 Special page transclusion twice (bug 5021)
13420 !! options
13421 !! wikitext
13422 {{Special:Prefixindex/Xyzzyx}}
13423 {{Special:Prefixindex/Xyzzyx}}
13424 !! html
13425 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13426 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13427
13428 !! end
13429
13430 !! test
13431 Transclusion of default MediaWiki message
13432 !! wikitext
13433 {{MediaWiki:Mainpage}}
13434 !! html
13435 <p>Main Page
13436 </p>
13437 !! end
13438
13439 !! test
13440 Transclusion of nonexistent MediaWiki message
13441 !! wikitext
13442 {{MediaWiki:Mainpagexxx}}
13443 !! html
13444 <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>
13445 </p>
13446 !! end
13447
13448 !! test
13449 Transclusion of MediaWiki message with underscore
13450 !! wikitext
13451 {{MediaWiki:history_short}}
13452 !! html
13453 <p>History
13454 </p>
13455 !! end
13456
13457 !! test
13458 Transclusion of MediaWiki message with space
13459 !! wikitext
13460 {{MediaWiki:history short}}
13461 !! html
13462 <p>History
13463 </p>
13464 !! end
13465
13466 !! test
13467 Invalid header with following text
13468 !! wikitext
13469 = x = y
13470 !! html
13471 <p>= x = y
13472 </p>
13473 !! end
13474
13475
13476 !! test
13477 Section extraction test (section 0)
13478 !! options
13479 section=0
13480 !! wikitext
13481 start
13482 ==a==
13483 ===aa===
13484 ====aaa====
13485 ==b==
13486 ===ba===
13487 ===bb===
13488 ====bba====
13489 ===bc===
13490 ==c==
13491 ===ca===
13492 !! html
13493 start
13494 !! end
13495
13496 !! test
13497 Section extraction test (section 1)
13498 !! options
13499 section=1
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 ==a==
13514 ===aa===
13515 ====aaa====
13516 !! end
13517
13518 !! test
13519 Section extraction test (section 2)
13520 !! options
13521 section=2
13522 !! wikitext
13523 start
13524 ==a==
13525 ===aa===
13526 ====aaa====
13527 ==b==
13528 ===ba===
13529 ===bb===
13530 ====bba====
13531 ===bc===
13532 ==c==
13533 ===ca===
13534 !! html
13535 ===aa===
13536 ====aaa====
13537 !! end
13538
13539 !! test
13540 Section extraction test (section 3)
13541 !! options
13542 section=3
13543 !! wikitext
13544 start
13545 ==a==
13546 ===aa===
13547 ====aaa====
13548 ==b==
13549 ===ba===
13550 ===bb===
13551 ====bba====
13552 ===bc===
13553 ==c==
13554 ===ca===
13555 !! html
13556 ====aaa====
13557 !! end
13558
13559 !! test
13560 Section extraction test (section 4)
13561 !! options
13562 section=4
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 ==b==
13577 ===ba===
13578 ===bb===
13579 ====bba====
13580 ===bc===
13581 !! end
13582
13583 !! test
13584 Section extraction test (section 5)
13585 !! options
13586 section=5
13587 !! wikitext
13588 start
13589 ==a==
13590 ===aa===
13591 ====aaa====
13592 ==b==
13593 ===ba===
13594 ===bb===
13595 ====bba====
13596 ===bc===
13597 ==c==
13598 ===ca===
13599 !! html
13600 ===ba===
13601 !! end
13602
13603 !! test
13604 Section extraction test (section 6)
13605 !! options
13606 section=6
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 ===bb===
13621 ====bba====
13622 !! end
13623
13624 !! test
13625 Section extraction test (section 7)
13626 !! options
13627 section=7
13628 !! wikitext
13629 start
13630 ==a==
13631 ===aa===
13632 ====aaa====
13633 ==b==
13634 ===ba===
13635 ===bb===
13636 ====bba====
13637 ===bc===
13638 ==c==
13639 ===ca===
13640 !! html
13641 ====bba====
13642 !! end
13643
13644 !! test
13645 Section extraction test (section 8)
13646 !! options
13647 section=8
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 ===bc===
13662 !! end
13663
13664 !! test
13665 Section extraction test (section 9)
13666 !! options
13667 section=9
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 ==c==
13682 ===ca===
13683 !! end
13684
13685 !! test
13686 Section extraction test (section 10)
13687 !! options
13688 section=10
13689 !! wikitext
13690 start
13691 ==a==
13692 ===aa===
13693 ====aaa====
13694 ==b==
13695 ===ba===
13696 ===bb===
13697 ====bba====
13698 ===bc===
13699 ==c==
13700 ===ca===
13701 !! html
13702 ===ca===
13703 !! end
13704
13705 !! test
13706 Section extraction test (nonexistent section 11)
13707 !! options
13708 section=11
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 !! end
13723
13724 !! test
13725 Section extraction test with bogus heading (section 1)
13726 !! options
13727 section=1
13728 !! wikitext
13729 ==a==
13730 ==bogus== not a legal section
13731 ==b==
13732 !! html
13733 ==a==
13734 ==bogus== not a legal section
13735 !! end
13736
13737 !! test
13738 Section extraction test with bogus heading (section 2)
13739 !! options
13740 section=2
13741 !! wikitext
13742 ==a==
13743 ==bogus== not a legal section
13744 ==b==
13745 !! html
13746 ==b==
13747 !! end
13748
13749 !! test
13750 Section extraction test with comment after heading (section 1)
13751 !! options
13752 section=1
13753 !! wikitext
13754 ==a==
13755 ==b== <!-- -->
13756 ==c==
13757 !! html
13758 ==a==
13759 !! end
13760
13761 !! test
13762 Section extraction test with comment after heading (section 2)
13763 !! options
13764 section=2
13765 !! wikitext
13766 ==a==
13767 ==b== <!-- -->
13768 ==c==
13769 !! html
13770 ==b== <!-- -->
13771 !! end
13772
13773 !! test
13774 Section extraction test with bogus <nowiki> heading (section 1)
13775 !! options
13776 section=1
13777 !! wikitext
13778 ==a==
13779 ==bogus== <nowiki>not a legal section</nowiki>
13780 ==b==
13781 !! html
13782 ==a==
13783 ==bogus== <nowiki>not a legal section</nowiki>
13784 !! end
13785
13786 !! test
13787 Section extraction test with bogus <nowiki> heading (section 2)
13788 !! options
13789 section=2
13790 !! wikitext
13791 ==a==
13792 ==bogus== <nowiki>not a legal section</nowiki>
13793 ==b==
13794 !! html
13795 ==b==
13796 !! end
13797
13798
13799 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13800 # instead of respecting commented sections
13801 !! test
13802 Section extraction prefixed by comment (section 1)
13803 !! options
13804 section=1
13805 !! wikitext
13806 <!-- -->==sec1==
13807 ==sec2==
13808 !! html
13809 ==sec2==
13810 !!end
13811
13812 !! test
13813 Section extraction prefixed by comment (section 2)
13814 !! options
13815 section=2
13816 !! wikitext
13817 <!-- -->==sec1==
13818 ==sec2==
13819 !! html
13820
13821 !!end
13822
13823
13824 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13825 # instead of respecting HTML-style headings
13826 !! test
13827 Section extraction, mixed wiki and html (section 1)
13828 !! options
13829 section=1
13830 !! wikitext
13831 <h2>unmarked</h2>
13832 unmarked
13833 ==1==
13834 one
13835 ==2==
13836 two
13837 !! html
13838 ==1==
13839 one
13840 !! end
13841
13842 !! test
13843 Section extraction, mixed wiki and html (section 2)
13844 !! options
13845 section=2
13846 !! wikitext
13847 <h2>unmarked</h2>
13848 unmarked
13849 ==1==
13850 one
13851 ==2==
13852 two
13853 !! html
13854 ==2==
13855 two
13856 !! end
13857
13858
13859 # Formerly testing for bug 3342
13860 !! test
13861 Section extraction, heading surrounded by <noinclude>
13862 !! options
13863 section=1
13864 !! wikitext
13865 <noinclude>==unmarked==</noinclude>
13866 ==marked==
13867 !! html
13868 ==marked==
13869 !!end
13870
13871 # Test behavior of bug 19910
13872 !! test
13873 Sectiion with all-equals
13874 !! options
13875 section=2
13876 !! wikitext
13877 ===
13878 The line above must have a trailing space
13879 === <!--
13880 --> <!-- -->
13881 But just in case it doesn't...
13882 !! html
13883 === <!--
13884 --> <!-- -->
13885 But just in case it doesn't...
13886 !! end
13887
13888 !! test
13889 Section replacement test (section 0)
13890 !! options
13891 replace=0,"xxx"
13892 !! wikitext
13893 start
13894 ==a==
13895 ===aa===
13896 ====aaa====
13897 ==b==
13898 ===ba===
13899 ===bb===
13900 ====bba====
13901 ===bc===
13902 ==c==
13903 ===ca===
13904 !! html
13905 xxx
13906
13907 ==a==
13908 ===aa===
13909 ====aaa====
13910 ==b==
13911 ===ba===
13912 ===bb===
13913 ====bba====
13914 ===bc===
13915 ==c==
13916 ===ca===
13917 !! end
13918
13919 !! test
13920 Section replacement test (section 1)
13921 !! options
13922 replace=1,"xxx"
13923 !! wikitext
13924 start
13925 ==a==
13926 ===aa===
13927 ====aaa====
13928 ==b==
13929 ===ba===
13930 ===bb===
13931 ====bba====
13932 ===bc===
13933 ==c==
13934 ===ca===
13935 !! html
13936 start
13937 xxx
13938
13939 ==b==
13940 ===ba===
13941 ===bb===
13942 ====bba====
13943 ===bc===
13944 ==c==
13945 ===ca===
13946 !! end
13947
13948 !! test
13949 Section replacement test (section 2)
13950 !! options
13951 replace=2,"xxx"
13952 !! wikitext
13953 start
13954 ==a==
13955 ===aa===
13956 ====aaa====
13957 ==b==
13958 ===ba===
13959 ===bb===
13960 ====bba====
13961 ===bc===
13962 ==c==
13963 ===ca===
13964 !! html
13965 start
13966 ==a==
13967 xxx
13968
13969 ==b==
13970 ===ba===
13971 ===bb===
13972 ====bba====
13973 ===bc===
13974 ==c==
13975 ===ca===
13976 !! end
13977
13978 !! test
13979 Section replacement test (section 3)
13980 !! options
13981 replace=3,"xxx"
13982 !! wikitext
13983 start
13984 ==a==
13985 ===aa===
13986 ====aaa====
13987 ==b==
13988 ===ba===
13989 ===bb===
13990 ====bba====
13991 ===bc===
13992 ==c==
13993 ===ca===
13994 !! html
13995 start
13996 ==a==
13997 ===aa===
13998 xxx
13999
14000 ==b==
14001 ===ba===
14002 ===bb===
14003 ====bba====
14004 ===bc===
14005 ==c==
14006 ===ca===
14007 !! end
14008
14009 !! test
14010 Section replacement test (section 4)
14011 !! options
14012 replace=4,"xxx"
14013 !! wikitext
14014 start
14015 ==a==
14016 ===aa===
14017 ====aaa====
14018 ==b==
14019 ===ba===
14020 ===bb===
14021 ====bba====
14022 ===bc===
14023 ==c==
14024 ===ca===
14025 !! html
14026 start
14027 ==a==
14028 ===aa===
14029 ====aaa====
14030 xxx
14031
14032 ==c==
14033 ===ca===
14034 !! end
14035
14036 !! test
14037 Section replacement test (section 5)
14038 !! options
14039 replace=5,"xxx"
14040 !! wikitext
14041 start
14042 ==a==
14043 ===aa===
14044 ====aaa====
14045 ==b==
14046 ===ba===
14047 ===bb===
14048 ====bba====
14049 ===bc===
14050 ==c==
14051 ===ca===
14052 !! html
14053 start
14054 ==a==
14055 ===aa===
14056 ====aaa====
14057 ==b==
14058 xxx
14059
14060 ===bb===
14061 ====bba====
14062 ===bc===
14063 ==c==
14064 ===ca===
14065 !! end
14066
14067 !! test
14068 Section replacement test (section 6)
14069 !! options
14070 replace=6,"xxx"
14071 !! wikitext
14072 start
14073 ==a==
14074 ===aa===
14075 ====aaa====
14076 ==b==
14077 ===ba===
14078 ===bb===
14079 ====bba====
14080 ===bc===
14081 ==c==
14082 ===ca===
14083 !! html
14084 start
14085 ==a==
14086 ===aa===
14087 ====aaa====
14088 ==b==
14089 ===ba===
14090 xxx
14091
14092 ===bc===
14093 ==c==
14094 ===ca===
14095 !! end
14096
14097 !! test
14098 Section replacement test (section 7)
14099 !! options
14100 replace=7,"xxx"
14101 !! wikitext
14102 start
14103 ==a==
14104 ===aa===
14105 ====aaa====
14106 ==b==
14107 ===ba===
14108 ===bb===
14109 ====bba====
14110 ===bc===
14111 ==c==
14112 ===ca===
14113 !! html
14114 start
14115 ==a==
14116 ===aa===
14117 ====aaa====
14118 ==b==
14119 ===ba===
14120 ===bb===
14121 xxx
14122
14123 ===bc===
14124 ==c==
14125 ===ca===
14126 !! end
14127
14128 !! test
14129 Section replacement test (section 8)
14130 !! options
14131 replace=8,"xxx"
14132 !! wikitext
14133 start
14134 ==a==
14135 ===aa===
14136 ====aaa====
14137 ==b==
14138 ===ba===
14139 ===bb===
14140 ====bba====
14141 ===bc===
14142 ==c==
14143 ===ca===
14144 !! html
14145 start
14146 ==a==
14147 ===aa===
14148 ====aaa====
14149 ==b==
14150 ===ba===
14151 ===bb===
14152 ====bba====
14153 xxx
14154
14155 ==c==
14156 ===ca===
14157 !!end
14158
14159 !! test
14160 Section replacement test (section 9)
14161 !! options
14162 replace=9,"xxx"
14163 !! wikitext
14164 start
14165 ==a==
14166 ===aa===
14167 ====aaa====
14168 ==b==
14169 ===ba===
14170 ===bb===
14171 ====bba====
14172 ===bc===
14173 ==c==
14174 ===ca===
14175 !! html
14176 start
14177 ==a==
14178 ===aa===
14179 ====aaa====
14180 ==b==
14181 ===ba===
14182 ===bb===
14183 ====bba====
14184 ===bc===
14185 xxx
14186 !! end
14187
14188 !! test
14189 Section replacement test (section 10)
14190 !! options
14191 replace=10,"xxx"
14192 !! wikitext
14193 start
14194 ==a==
14195 ===aa===
14196 ====aaa====
14197 ==b==
14198 ===ba===
14199 ===bb===
14200 ====bba====
14201 ===bc===
14202 ==c==
14203 ===ca===
14204 !! html
14205 start
14206 ==a==
14207 ===aa===
14208 ====aaa====
14209 ==b==
14210 ===ba===
14211 ===bb===
14212 ====bba====
14213 ===bc===
14214 ==c==
14215 xxx
14216 !! end
14217
14218 !! test
14219 Section replacement test with initial whitespace (bug 13728)
14220 !! options
14221 replace=2,"xxx"
14222 !! wikitext
14223 Preformatted initial line
14224 ==a==
14225 ===a===
14226 !! html
14227 Preformatted initial line
14228 ==a==
14229 xxx
14230 !! end
14231
14232
14233 !! test
14234 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14235 !! options
14236 section=1
14237 !! wikitext
14238 ==a==
14239 a
14240 !! html
14241 ==a==
14242 a
14243 !! end
14244
14245 !! test
14246 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14247 !! options
14248 section=1
14249 !! wikitext
14250 ==a==
14251 a
14252 !! html
14253 ==a==
14254 a
14255 !! end
14256
14257
14258 !! test
14259 Section extraction, <pre> around bogus header (bug 10309)
14260 !! options
14261 noxml section=2
14262 !! wikitext
14263 == Section One ==
14264 <pre>
14265 =======
14266 </pre>
14267
14268 == Section Two ==
14269 stuff
14270 !! html
14271 == Section Two ==
14272 stuff
14273 !! end
14274
14275 !! test
14276 Section replacement, <pre> around bogus header (bug 10309)
14277 !! options
14278 noxml replace=2,"xxx"
14279 !! wikitext
14280 == Section One ==
14281 <pre>
14282 =======
14283 </pre>
14284
14285 == Section Two ==
14286 stuff
14287 !! html
14288 == Section One ==
14289 <pre>
14290 =======
14291 </pre>
14292
14293 xxx
14294 !! end
14295
14296
14297
14298 !! test
14299 Handling of &#x0A; in URLs
14300 !! wikitext
14301 **irc://&#x0A;a
14302 !! html
14303 <ul>
14304 <li><ul>
14305 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14306 </li>
14307 </ul>
14308 </li>
14309 </ul>
14310
14311 !!end
14312
14313 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14314 !! test
14315 5 quotes, code coverage +1 line
14316 !! wikitext
14317 '''''
14318 !! html/php
14319 !! html/parsoid
14320 <p><b><i></i></b></p>
14321 !! end
14322
14323 !! test
14324 Special:Search page linking.
14325 !! wikitext
14326 {{Special:search}}
14327 !! html
14328 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14329 </p>
14330 !! end
14331
14332 !! test
14333 Say the magic word
14334 !! options
14335 title=[[Parser test]]
14336 !! wikitext
14337 * {{PAGENAME}}
14338 * {{PAGENAMEE}}
14339 * {{FULLPAGENAME}}
14340 * {{FULLPAGENAMEE}}
14341 * {{BASEPAGENAME}}
14342 * {{BASEPAGENAMEE}}
14343 * {{SUBPAGENAME}}
14344 * {{SUBPAGENAMEE}}
14345 * {{ROOTPAGENAME}}
14346 * {{ROOTPAGENAMEE}}
14347 * {{TALKPAGENAME}}
14348 * {{TALKPAGENAMEE}}
14349 * {{SUBJECTPAGENAME}}
14350 * {{SUBJECTPAGENAMEE}}
14351 * {{NAMESPACEE}}
14352 * {{NAMESPACE}}
14353 * {{NAMESPACENUMBER}}
14354 * {{TALKSPACE}}
14355 * {{TALKSPACEE}}
14356 * {{SUBJECTSPACE}}
14357 * {{SUBJECTSPACEE}}
14358 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14359 !! html
14360 <ul>
14361 <li> Parser test
14362 </li>
14363 <li> Parser_test
14364 </li>
14365 <li> Parser test
14366 </li>
14367 <li> Parser_test
14368 </li>
14369 <li> Parser test
14370 </li>
14371 <li> Parser_test
14372 </li>
14373 <li> Parser test
14374 </li>
14375 <li> Parser_test
14376 </li>
14377 <li> Parser test
14378 </li>
14379 <li> Parser_test
14380 </li>
14381 <li> Talk:Parser test
14382 </li>
14383 <li> Talk:Parser_test
14384 </li>
14385 <li> Parser test
14386 </li>
14387 <li> Parser_test
14388 </li>
14389 <li>
14390 </li>
14391 <li>
14392 </li>
14393 <li> 0
14394 </li>
14395 <li> Talk
14396 </li>
14397 <li> Talk
14398 </li>
14399 <li>
14400 </li>
14401 <li>
14402 </li>
14403 <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>
14404 </li>
14405 </ul>
14406
14407 !! end
14408 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14409
14410 !! test
14411 Gallery
14412 !! wikitext
14413 <gallery>
14414 image1.png |
14415 image2.gif|||||
14416
14417 image3|
14418 image4 |300px| centre
14419 image5.svg| http://///////
14420 [[x|xx]]]]
14421 * image6
14422 </gallery>
14423 !! html
14424 <ul class="gallery mw-gallery-traditional">
14425 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14426 <div class="thumb" style="height: 150px;">Image1.png</div>
14427 <div class="gallerytext">
14428 </div>
14429 </div></li>
14430 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14431 <div class="thumb" style="height: 150px;">Image2.gif</div>
14432 <div class="gallerytext">
14433 <p>||||
14434 </p>
14435 </div>
14436 </div></li>
14437 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14438 <div class="thumb" style="height: 150px;">Image3</div>
14439 <div class="gallerytext">
14440 </div>
14441 </div></li>
14442 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14443 <div class="thumb" style="height: 150px;">Image4</div>
14444 <div class="gallerytext">
14445 <p>300px| centre
14446 </p>
14447 </div>
14448 </div></li>
14449 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14450 <div class="thumb" style="height: 150px;">Image5.svg</div>
14451 <div class="gallerytext">
14452 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14453 </p>
14454 </div>
14455 </div></li>
14456 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14457 <div class="thumb" style="height: 150px;">* image6</div>
14458 <div class="gallerytext">
14459 </div>
14460 </div></li>
14461 </ul>
14462
14463 !! end
14464
14465 !! test
14466 Gallery (with options)
14467 !! wikitext
14468 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14469 File:Nonexistant.jpg|caption
14470 File:Nonexistant.jpg
14471 image:foobar.jpg|some '''caption''' [[Main Page]]
14472 image:foobar.jpg
14473 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14474 </gallery>
14475 !! html
14476 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14477 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14478 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14479 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14480 <div class="gallerytext">
14481 <p>caption
14482 </p>
14483 </div>
14484 </div></li>
14485 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14486 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14487 <div class="gallerytext">
14488 </div>
14489 </div></li>
14490 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14491 <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>
14492 <div class="gallerytext">
14493 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14494 </p>
14495 </div>
14496 </div></li>
14497 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14498 <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>
14499 <div class="gallerytext">
14500 </div>
14501 </div></li>
14502 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14503 <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>
14504 <div class="gallerytext">
14505 <p>Blabla|blabla.
14506 </p>
14507 </div>
14508 </div></li>
14509 </ul>
14510
14511 !! end
14512
14513 !! test
14514 Gallery with wikitext inside caption
14515 !! wikitext
14516 <gallery>
14517 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14518 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14519 </gallery>
14520 !! html
14521 <ul class="gallery mw-gallery-traditional">
14522 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14523 <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>
14524 <div class="gallerytext">
14525 <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>
14526 </p>
14527 </div>
14528 </div></li>
14529 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14530 <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>
14531 <div class="gallerytext">
14532 <p>This is a test template
14533 </p>
14534 </div>
14535 </div></li>
14536 </ul>
14537
14538 !! end
14539
14540 !! test
14541 gallery (with showfilename option)
14542 !! wikitext
14543 <gallery showfilename>
14544 File:Nonexistant.jpg|caption
14545 File:Nonexistant.jpg
14546 image:foobar.jpg|some '''caption''' [[Main Page]]
14547 File:Foobar.jpg
14548 </gallery>
14549 !! html
14550 <ul class="gallery mw-gallery-traditional">
14551 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14552 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14553 <div class="gallerytext">
14554 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14555 caption
14556 </p>
14557 </div>
14558 </div></li>
14559 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14560 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14561 <div class="gallerytext">
14562 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14563 </p>
14564 </div>
14565 </div></li>
14566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14567 <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>
14568 <div class="gallerytext">
14569 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14570 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14571 </p>
14572 </div>
14573 </div></li>
14574 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14575 <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>
14576 <div class="gallerytext">
14577 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14578 </p>
14579 </div>
14580 </div></li>
14581 </ul>
14582
14583 !! end
14584
14585 !! test
14586 Gallery (with namespace-less filenames)
14587 !! wikitext
14588 <gallery>
14589 File:Nonexistant.jpg
14590 Nonexistant.jpg
14591 image:foobar.jpg
14592 foobar.jpg
14593 </gallery>
14594 !! html
14595 <ul class="gallery mw-gallery-traditional">
14596 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14597 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14598 <div class="gallerytext">
14599 </div>
14600 </div></li>
14601 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14602 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14603 <div class="gallerytext">
14604 </div>
14605 </div></li>
14606 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14607 <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>
14608 <div class="gallerytext">
14609 </div>
14610 </div></li>
14611 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14612 <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>
14613 <div class="gallerytext">
14614 </div>
14615 </div></li>
14616 </ul>
14617
14618 !! end
14619
14620 !! test
14621 HTML Hex character encoding (spells the word "JavaScript")
14622 !! wikitext
14623 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14624 !! html
14625 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14626 </p>
14627 !! end
14628
14629 !! test
14630 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14631 !! wikitext
14632 &#xsee;&#XSEE;
14633 !! html
14634 <p>&amp;#xsee;&amp;#XSEE;
14635 </p>
14636 !! end
14637
14638 !! test
14639 HTML Hex character encoding mixed case
14640 !! wikitext
14641 &#xEE;&#Xee;
14642 !! html
14643 <p>&#xee;&#xee;
14644 </p>
14645 !! end
14646
14647 !! test
14648 __FORCETOC__ override
14649 !! wikitext
14650 __NEWSECTIONLINK__
14651 __FORCETOC__
14652 !! html
14653 <p><br />
14654 </p>
14655 !! end
14656
14657 !! test
14658 ISBN code coverage
14659 !! wikitext
14660 ISBN 978-0-1234-56&#x20;789
14661 !! html
14662 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14663 </p>
14664 !! end
14665
14666 !! test
14667 ISBN followed by 5 spaces
14668 !! wikitext
14669 ISBN
14670 !! html
14671 <p>ISBN
14672 </p>
14673 !! end
14674
14675 !! test
14676 Double ISBN
14677 !! wikitext
14678 ISBN ISBN 1234567890
14679 !! html
14680 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14681 </p>
14682 !! end
14683
14684 !! test
14685 ISBN with an X
14686 !! wikitext
14687 ISBN 3-462-04561-X
14688 !! html
14689 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
14690 </p>
14691 !! end
14692
14693 !! test
14694 Bug 22905: <abbr> followed by ISBN followed by </a>
14695 !! wikitext
14696 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14697 !! html
14698 <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>
14699 </p>
14700 !! end
14701
14702 !! test
14703 Double RFC
14704 !! wikitext
14705 RFC RFC 1234
14706 !! html
14707 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14708 </p>
14709 !! end
14710
14711 !! test
14712 Double RFC with a wiki link
14713 !! wikitext
14714 RFC [[RFC 1234]]
14715 !! html
14716 <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>
14717 </p>
14718 !! end
14719
14720 !! test
14721 RFC code coverage
14722 !! wikitext
14723 RFC 983&#x20;987
14724 !! html
14725 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14726 </p>
14727 !! end
14728
14729 !! test
14730 Centre-aligned image
14731 !! wikitext
14732 [[Image:foobar.jpg|centre]]
14733 !! html
14734 <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>
14735
14736 !!end
14737
14738 !! test
14739 None-aligned image
14740 !! wikitext
14741 [[Image:foobar.jpg|none]]
14742 !! html
14743 <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>
14744
14745 !!end
14746
14747 !! test
14748 Width + Height sized image (using px) (height is ignored)
14749 !! wikitext
14750 [[Image:foobar.jpg|640x480px]]
14751 !! html
14752 <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>
14753 </p>
14754 !!end
14755
14756 !! test
14757 Width-sized image (using px, no following whitespace)
14758 !! wikitext
14759 [[Image:foobar.jpg|640px]]
14760 !! html
14761 <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>
14762 </p>
14763 !!end
14764
14765 !! test
14766 Width-sized image (using px, with following whitespace - test regression from r39467)
14767 !! wikitext
14768 [[Image:foobar.jpg|640px ]]
14769 !! html
14770 <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>
14771 </p>
14772 !!end
14773
14774 !! test
14775 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14776 !! wikitext
14777 [[Image:foobar.jpg| 640px]]
14778 !! html
14779 <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>
14780 </p>
14781 !!end
14782
14783 !! test
14784 Another italics / bold test
14785 !! wikitext
14786 ''' ''x'
14787 !! html
14788 <pre>'<i> </i>x'
14789 </pre>
14790 !!end
14791
14792 # Note the results may be incorrect, as parserTest output included this:
14793 # XML error: Mismatched tag at byte 6120:
14794 # ...<dd> </dt></dl> </dd...
14795 !! test
14796 dt/dd/dl test
14797 !! options
14798 disabled
14799 !! wikitext
14800 :;;;::
14801 !! html
14802 <dl>
14803 <dd><dl>
14804 <dt><dl>
14805 <dt><dl>
14806 <dt><dl>
14807 <dd><dl>
14808 <dd>
14809 </dd>
14810 </dl>
14811 </dd>
14812 </dl>
14813 </dt>
14814 </dl>
14815 </dt>
14816 </dl>
14817 </dt>
14818 </dl>
14819 </dd>
14820 </dl>
14821
14822 !!end
14823
14824
14825 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14826 !! test
14827 Images with the "|" character in the comment
14828 !! wikitext
14829 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14830 !! html
14831 <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>
14832
14833 !!end
14834
14835 !! test
14836 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14837 !! wikitext
14838 <html><script>alert(1);</script></html>
14839 !! html
14840 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14841 </p>
14842 !! end
14843
14844 !! test
14845 HTML with raw HTML ($wgRawHtml==true)
14846 !! options
14847 wgRawHtml=1
14848 !! wikitext
14849 <html><script>alert(1);</script></html>
14850 !! html
14851 <p><script>alert(1);</script>
14852 </p>
14853 !! end
14854
14855 !! test
14856 Parents of subpages, one level up
14857 !! options
14858 subpage title=[[Subpage test/L1/L2/L3]]
14859 !! wikitext
14860 [[../|L2]]
14861 !! html
14862 <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>
14863 </p>
14864 !! end
14865
14866
14867 !! test
14868 Parents of subpages, one level up, not named
14869 !! options
14870 subpage title=[[Subpage test/L1/L2/L3]]
14871 !! wikitext
14872 [[../]]
14873 !! html
14874 <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>
14875 </p>
14876 !! end
14877
14878
14879
14880 !! test
14881 Parents of subpages, two levels up
14882 !! options
14883 subpage title=[[Subpage test/L1/L2/L3]]
14884 !! wikitext
14885 [[../../|L1]]2
14886
14887 [[../../|L1]]l
14888 !! html
14889 <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
14890 </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>
14891 </p>
14892 !! end
14893
14894 !! test
14895 Parents of subpages, two levels up, without trailing slash or name.
14896 !! options
14897 subpage title=[[Subpage test/L1/L2/L3]]
14898 !! wikitext
14899 [[../..]]
14900 !! html
14901 <p>[[../..]]
14902 </p>
14903 !! end
14904
14905 !! test
14906 Parents of subpages, two levels up, with lots of extra trailing slashes.
14907 !! options
14908 subpage title=[[Subpage test/L1/L2/L3]]
14909 !! wikitext
14910 [[../../////]]
14911 !! html
14912 <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>
14913 </p>
14914 !! end
14915
14916 !! article
14917 Subpage test/L1/L2/L3Sibling
14918 !! text
14919 Sibling article
14920 !! endarticle
14921
14922 !! test
14923 Transclusion of a sibling page (one level up)
14924 !! options
14925 subpage title=[[Subpage test/L1/L2/L3]]
14926 !! wikitext
14927 {{../L3Sibling}}
14928 !! html
14929 <p>Sibling article
14930 </p>
14931 !! end
14932
14933 !! test
14934 Transclusion of a child page
14935 !! options
14936 subpage title=[[Subpage test/L1/L2]]
14937 !! wikitext
14938 {{/L3Sibling}}
14939 !! html
14940 <p>Sibling article
14941 </p>
14942 !! end
14943
14944 !! test
14945 Non-transclusion because of too many up levels
14946 !! options
14947 subpage title=[[Subpage test/L1/L2/L3]]
14948 !! wikitext
14949 {{../../../../More than parent}}
14950 !! html
14951 <p>{{../../../../More than parent}}
14952 </p>
14953 !! end
14954
14955 !! test
14956 Definition list code coverage
14957 !! wikitext
14958 ; title : def
14959 ; title : def
14960 ;title: def
14961 !! html
14962 <dl>
14963 <dt> title &#160;</dt>
14964 <dd> def
14965 </dd>
14966 <dt> title&#160;</dt>
14967 <dd> def
14968 </dd>
14969 <dt>title</dt>
14970 <dd> def
14971 </dd>
14972 </dl>
14973
14974 !! end
14975
14976 !! test
14977 Don't fall for the self-closing div
14978 !! wikitext
14979 <div>hello world</div/>
14980 !! html
14981 <div>hello world</div>
14982
14983 !! end
14984
14985 !! test
14986 MSGNW magic word
14987 !! wikitext
14988 {{MSGNW:msg}}
14989 !! html
14990 <p>&#91;&#91;:Template:Msg&#93;&#93;
14991 </p>
14992 !! end
14993
14994 !! test
14995 RAW magic word
14996 !! wikitext
14997 {{RAW:QUERTY}}
14998 !! html
14999 <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>
15000 </p>
15001 !! end
15002
15003 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15004 !! test
15005 Always escape literal '>' in output, not just after '<'
15006 !! wikitext
15007 ><>
15008 !! html
15009 <p>&gt;&lt;&gt;
15010 </p>
15011 !! end
15012
15013 !! test
15014 Template caching
15015 !! wikitext
15016 {{Test}}
15017 {{Test}}
15018 !! html
15019 <p>This is a test template
15020 This is a test template
15021 </p>
15022 !! end
15023
15024
15025 !! article
15026 MediaWiki:Fake
15027 !! text
15028 ==header==
15029 !! endarticle
15030
15031 !! test
15032 Inclusion of !userCanEdit() content
15033 !! wikitext
15034 {{MediaWiki:Fake}}
15035 !! html
15036 <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>
15037
15038 !! end
15039
15040
15041 !! test
15042 Out-of-order TOC heading levels
15043 !! wikitext
15044 ==2==
15045 ======6======
15046 ===3===
15047 =1=
15048 =====5=====
15049 ==2==
15050 !! html
15051 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15052 <ul>
15053 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15054 <ul>
15055 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15056 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15057 </ul>
15058 </li>
15059 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15060 <ul>
15061 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15062 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15063 </ul>
15064 </li>
15065 </ul>
15066 </div>
15067
15068 <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>
15069 <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>
15070 <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>
15071 <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>
15072 <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>
15073 <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>
15074
15075 !! end
15076
15077
15078 !! test
15079 ISBN with a dummy number
15080 !! wikitext
15081 ISBN ---
15082 !! html
15083 <p>ISBN ---
15084 </p>
15085 !! end
15086
15087
15088 !! test
15089 ISBN with space-delimited number
15090 !! wikitext
15091 ISBN 92 9017 032 8
15092 !! html
15093 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15094 </p>
15095 !! end
15096
15097
15098 !! test
15099 ISBN with multiple spaces, no number
15100 !! wikitext
15101 ISBN foo
15102 !! html
15103 <p>ISBN foo
15104 </p>
15105 !! end
15106
15107
15108 !! test
15109 ISBN length
15110 !! wikitext
15111 ISBN 123456789
15112
15113 ISBN 1234567890
15114
15115 ISBN 12345678901
15116 !! html
15117 <p>ISBN 123456789
15118 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15119 </p><p>ISBN 12345678901
15120 </p>
15121 !! end
15122
15123
15124 !! test
15125 ISBN with trailing year (bug 8110)
15126 !! wikitext
15127 ISBN 1-234-56789-0 - 2006
15128
15129 ISBN 1 234 56789 0 - 2006
15130 !! html
15131 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15132 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15133 </p>
15134 !! end
15135
15136
15137 !! test
15138 anchorencode
15139 !! wikitext
15140 {{anchorencode:foo bar©#%n}}
15141 !! html
15142 <p>foo_bar.C2.A9.23.25n
15143 </p>
15144 !! end
15145
15146 !! test
15147 anchorencode trims spaces
15148 !! wikitext
15149 {{anchorencode: __pretty__please__}}
15150 !! html
15151 <p>pretty_please
15152 </p>
15153 !! end
15154
15155 !! test
15156 anchorencode deals with links
15157 !! wikitext
15158 {{anchorencode: [[hello|world]] [[hi]]}}
15159 !! html
15160 <p>world_hi
15161 </p>
15162 !! end
15163
15164 !! test
15165 anchorencode deals with templates
15166 !! wikitext
15167 {{anchorencode: {{Foo}} }}
15168 !! html
15169 <p>FOO
15170 </p>
15171 !! end
15172
15173 !! test
15174 anchorencode encodes like the TOC generator: (bug 18431)
15175 !! wikitext
15176 === _ +:.3A%3A&&amp;]] ===
15177 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15178 __NOEDITSECTION__
15179 !! html
15180 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15181 <p>.2B:.3A.253A.26.26.5D.5D
15182 </p>
15183 !! end
15184
15185 !! test
15186 Bug 6200: blockquotes and paragraph formatting
15187 !! wikitext
15188 <blockquote>
15189 foo
15190 </blockquote>
15191
15192 bar
15193
15194 baz
15195 !! html
15196 <blockquote>
15197 <p>foo
15198 </p>
15199 </blockquote>
15200 <p>bar
15201 </p>
15202 <pre>baz
15203 </pre>
15204 !! end
15205
15206 !! test
15207 Bug 8293: Use of center tag ruins paragraph formatting
15208 !! wikitext
15209 <center>
15210 foo
15211 </center>
15212
15213 bar
15214
15215 baz
15216 !! html
15217 <center>
15218 <p>foo
15219 </p>
15220 </center>
15221 <p>bar
15222 </p>
15223 <pre>baz
15224 </pre>
15225 !! end
15226
15227 !!test
15228 Parsing of overlapping (improperly nested) inline html tags
15229 !! wikitext
15230 <span><s>x</span></s>
15231 !! html/php
15232 <p><span><s>x&lt;/span&gt;</s></span>
15233 </p>
15234 !! html/parsoid
15235 <p><span><s>x</s></span>
15236 </p>
15237 !!end
15238
15239 ###
15240 ### Language variants related tests
15241 ###
15242 !! test
15243 Self-link in language variants
15244 !! options
15245 title=[[Dunav]] language=sr
15246 !! wikitext
15247 Both [[Dunav]] and [[Дунав]] are names for this river.
15248 !! html
15249 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15250 </p>
15251 !!end
15252
15253 !! article
15254 Дуна
15255 !! text
15256 content
15257 !! endarticle
15258
15259 !! test
15260 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15261 !! options
15262 title=[[Duna]] language=sr
15263 !! wikitext
15264 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15265 !! html
15266 <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.
15267 </p>
15268 !! end
15269
15270 !! test
15271 Link to a section of a variant of this title shouldn't be parsed as self-link
15272 !! options
15273 title=[[Duna]] language=sr
15274 !! wikitext
15275 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15276 !! html
15277 <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.
15278 </p>
15279 !! end
15280
15281 !! test
15282 Link to pages in language variants
15283 !! options
15284 language=sr
15285 !! wikitext
15286 Main Page can be written as [[Маин Паге]]
15287 !! html
15288 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15289 </p>
15290 !!end
15291
15292
15293 !! test
15294 Multiple links to pages in language variants
15295 !! options
15296 language=sr
15297 !! wikitext
15298 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15299 !! html
15300 <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>.
15301 </p>
15302 !!end
15303
15304
15305 !! test
15306 Simple template in language variants
15307 !! options
15308 language=sr
15309 !! wikitext
15310 {{тест}}
15311 !! html
15312 <p>This is a test template
15313 </p>
15314 !! end
15315
15316
15317 !! test
15318 Template with explicit namespace in language variants
15319 !! options
15320 language=sr
15321 !! wikitext
15322 {{Template:тест}}
15323 !! html
15324 <p>This is a test template
15325 </p>
15326 !! end
15327
15328
15329 !! test
15330 Basic test for template parameter in language variants
15331 !! options
15332 language=sr
15333 !! wikitext
15334 {{парамтест|param=foo}}
15335 !! html
15336 <p>This is a test template with parameter foo
15337 </p>
15338 !! end
15339
15340
15341 !! test
15342 Simple category in language variants
15343 !! options
15344 language=sr cat
15345 !! wikitext
15346 [[Category:МедиаWики Усер'с Гуиде]]
15347 !! html
15348 <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>
15349 !! end
15350
15351
15352 !! article
15353 Category:分类
15354 !! text
15355 blah
15356 !! endarticle
15357
15358 !! article
15359 Category:分類
15360 !! text
15361 blah
15362 !! endarticle
15363
15364 !! test
15365 Don't convert blue categorylinks to another variant (bug 33210)
15366 !! options
15367 language=zh cat
15368 !! wikitext
15369 [[A]][[Category:分类]]
15370 !! html
15371 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15372 !! end
15373
15374
15375 !! test
15376 Stripping -{}- tags (language variants)
15377 !! options
15378 language=sr
15379 !! wikitext
15380 Latin proverb: -{Ne nuntium necare}-
15381 !! html
15382 <p>Latin proverb: Ne nuntium necare
15383 </p>
15384 !! end
15385
15386
15387 !! test
15388 Prevent conversion with -{}- tags (language variants)
15389 !! options
15390 language=sr variant=sr-ec
15391 !! wikitext
15392 Latinski: -{Ne nuntium necare}-
15393 !! html
15394 <p>Латински: Ne nuntium necare
15395 </p>
15396 !! end
15397
15398
15399 !! test
15400 Prevent conversion of text with -{}- tags (language variants)
15401 !! options
15402 language=sr variant=sr-ec
15403 !! wikitext
15404 Latinski: -{Ne nuntium necare}-
15405 !! html
15406 <p>Латински: Ne nuntium necare
15407 </p>
15408 !! end
15409
15410
15411 !! test
15412 Prevent conversion of links with -{}- tags (language variants)
15413 !! options
15414 language=sr variant=sr-ec
15415 !! wikitext
15416 -{[[Main Page]]}-
15417 !! html
15418 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15419 </p>
15420 !! end
15421
15422
15423 !! test
15424 -{}- tags within headlines (within html for parserConvert())
15425 !! options
15426 language=sr variant=sr-ec
15427 !! wikitext
15428 == -{Naslov}- ==
15429 !! html
15430 <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>
15431
15432 !! end
15433
15434
15435 !! test
15436 Explicit definition of language variant alternatives
15437 !! options
15438 language=zh variant=zh-tw
15439 !! wikitext
15440 -{zh:China;zh-tw:Taiwan}-, not China
15441 !! html
15442 <p>Taiwan, not China
15443 </p>
15444 !! end
15445
15446
15447 !! test
15448 Conversion around HTML tags
15449 !! options
15450 language=sr variant=sr-ec
15451 !! wikitext
15452 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15453 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15454 !! html
15455 <p>
15456 <span title="ЛаCтин">ски</span>
15457 </p>
15458 !! end
15459
15460
15461 !! test
15462 Explicit session-wise language variant mapping (A flag and - flag)
15463 !! options
15464 language=zh variant=zh-tw
15465 !! wikitext
15466 Taiwan is not China.
15467 But -{A|zh:China;zh-tw:Taiwan}- is China,
15468 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15469 and -{China}- is China.
15470 !! html
15471 <p>Taiwan is not China.
15472 But Taiwan is Taiwan,
15473 (This should be stripped!)
15474 and China is China.
15475 </p>
15476 !! end
15477
15478 !! test
15479 Explicit session-wise language variant mapping (H flag for hide)
15480 !! options
15481 language=zh variant=zh-tw
15482 !! wikitext
15483 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15484 Taiwan is China.
15485 !! html
15486 <p>(This should be stripped!)
15487 Taiwan is Taiwan.
15488 </p>
15489 !! end
15490
15491 !! test
15492 Adding explicit conversion rule for title (T flag)
15493 !! options
15494 language=zh variant=zh-tw showtitle
15495 !! wikitext
15496 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15497 !! html
15498 Taiwan
15499 <p>Should be stripped!
15500 </p>
15501 !! end
15502
15503 !! test
15504 Testing that changing the language variant here in the tests actually works
15505 !! options
15506 language=zh variant=zh showtitle
15507 !! wikitext
15508 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15509 !! html
15510 China
15511 <p>Should be stripped!
15512 </p>
15513 !! end
15514
15515 !! test
15516 Recursive conversion of alt and title attrs shouldn't clear converter state
15517 !! options
15518 language=zh variant=zh-cn showtitle
15519 !! wikitext
15520 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15521 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15522 !! html
15523 China
15524 <p>
15525 Should be stripped<span title="Exclamation">!</span>
15526 </p>
15527 !! end
15528
15529 !! test
15530 Bug 24072: more test on conversion rule for title
15531 !! options
15532 language=zh variant=zh-tw showtitle
15533 !! wikitext
15534 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15535 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15536 !! html
15537 Taiwan
15538 <p>This should be stripped!
15539 This won't take interferes with the title rule.
15540 </p>
15541 !! end
15542
15543 !! test
15544 Partly disable title conversion if variant == main language code
15545 !! options
15546 language=zh variant=zh title=[[ZH]] showtitle
15547 !! wikitext
15548 -{T|zh-cn:CN;zh-tw:TW}-
15549 !! html
15550 ZH
15551 <p>
15552 </p>
15553 !! end
15554
15555 !! test
15556 Partly disable title conversion if variant == main language code, more
15557 !! options
15558 language=zh variant=zh title=[[ZH]] showtitle
15559 !! wikitext
15560 -{T|TW}-
15561 !! html
15562 ZH
15563 <p>
15564 </p>
15565 !! end
15566
15567 !! test
15568 Raw output of variant escape tags (R flag)
15569 !! options
15570 language=zh variant=zh-tw
15571 !! wikitext
15572 Raw: -{R|zh:China;zh-tw:Taiwan}-
15573 !! html
15574 <p>Raw: zh:China;zh-tw:Taiwan
15575 </p>
15576 !! end
15577
15578 !! test
15579 Nested using of manual convert syntax
15580 !! options
15581 language=zh variant=zh-hk
15582 !! wikitext
15583 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15584 !! html
15585 <p>Nested: Hello Hong Kong!
15586 </p>
15587 !! end
15588
15589 !! test
15590 Proper conversion of text in external links
15591 !! options
15592 language=sr variant=sr-ec
15593 !! wikitext
15594 http://www.google.com
15595 gopher://www.google.com
15596 [http://www.google.com http://www.google.com]
15597 [gopher://www.google.com gopher://www.google.com]
15598 [https://www.google.com irc://www.google.com]
15599 [ftp://www.google.com www.google.com/ftp://dir]
15600 [//www.google.com www.google.com]
15601 !! html
15602 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15603 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15604 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15605 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15606 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15607 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15608 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15609 </p>
15610 !! end
15611
15612 !! test
15613 Do not convert roman numbers to language variants
15614 !! options
15615 language=sr variant=sr-ec
15616 !! wikitext
15617 Fridrih IV je car.
15618 !! html
15619 <p>Фридрих IV је цар.
15620 </p>
15621 !! end
15622
15623 !! test
15624 Unclosed language converter markup "-{"
15625 !! options
15626 language=sr
15627 !! wikitext
15628 -{T|hello
15629 !! html
15630 <p>-{T|hello
15631 </p>
15632 !! end
15633
15634 !! test
15635 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15636 !! options
15637 language=sr
15638 !! wikitext
15639 -{R|=&gt;}-
15640 !! html
15641 <p>=&gt;
15642 </p>
15643 !!end
15644
15645 !! test
15646 Don't break link parsing if language converter markup is in the caption.
15647 !! options
15648 language=sr variant=sr-ec
15649 !! wikitext
15650 [[Main Page|-{R|main page}-]]
15651 !! html
15652 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15653 </p>
15654 !! end
15655
15656 # This test is currently broken in the PHP parser (bug 52661)
15657 !! test
15658 Don't break image parsing if language converter markup is in the caption.
15659 !! options
15660 language=sr
15661 disabled
15662 !! wikitext
15663 [[File:Foobar.jpg|-{R|caption}-]]
15664 !! html
15665 <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>
15666 </p>
15667 !! end
15668
15669 # This test is currently broken in the PHP parser (bug 52661)
15670 !! test
15671 Don't break list handling if language converter markup is in the item.
15672 !! options
15673 language=zh variant=zh-cn
15674 disabled
15675 !! wikitext
15676 ;-{zh-cn:AAA;zh-tw:BBB}-
15677 !! html
15678 <dl><dt>AAA
15679 </dt></dl>
15680
15681 !! end
15682
15683 # This test is currently broken in the PHP parser (bug 52661)
15684 !! test
15685 Don't break table handling if language converter markup is in the cell.
15686 !! options
15687 language=sr variant=sr-ec
15688 disabled
15689 !! wikitext
15690 {|
15691 |-
15692 | -{R|B}-
15693 |}
15694 !! html
15695 <table>
15696
15697 <tr>
15698 <td> B
15699 </td></tr></table>
15700
15701 !! end
15702
15703 !! test
15704 Bug 529: Uncovered bullet
15705 !! wikitext
15706 * Foo {{bullet}}
15707 !! html
15708 <ul>
15709 <li> Foo
15710 </li>
15711 <li> Bar
15712 </li>
15713 </ul>
15714
15715 !! end
15716
15717 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15718 # Templates in Wikipedia rely on this behavior, as tidy has always been
15719 # enabled there. These tests are normally run *without* tidy, so specify the
15720 # full output here.
15721 # To test realistic parsing behavior, apply a tidy-like transformation to both
15722 # the expected output and your parser's output.
15723 !! test
15724 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15725 !! wikitext
15726 ******* Foo {{bullet}}
15727 !! html
15728 <ul>
15729 <li><ul>
15730 <li><ul>
15731 <li><ul>
15732 <li><ul>
15733 <li><ul>
15734 <li><ul>
15735 <li> Foo
15736 </li>
15737 </ul>
15738 </li>
15739 </ul>
15740 </li>
15741 </ul>
15742 </li>
15743 </ul>
15744 </li>
15745 </ul>
15746 </li>
15747 </ul>
15748 </li>
15749 <li> Bar
15750 </li>
15751 </ul>
15752
15753 !! end
15754
15755 !! test
15756 Bug 529: Uncovered table already at line-start
15757 !! wikitext
15758 x
15759
15760 {{table}}
15761 y
15762 !! html
15763 <p>x
15764 </p>
15765 <table>
15766 <tr>
15767 <td> 1 </td>
15768 <td> 2
15769 </td></tr>
15770 <tr>
15771 <td> 3 </td>
15772 <td> 4
15773 </td></tr></table>
15774 <p>y
15775 </p>
15776 !! end
15777
15778 !! test
15779 Bug 529: Uncovered bullet in parser function result
15780 !! wikitext
15781 * Foo {{lc:{{bullet}} }}
15782 !! html
15783 <ul>
15784 <li> Foo
15785 </li>
15786 <li> bar
15787 </li>
15788 </ul>
15789
15790 !! end
15791
15792 !! test
15793 Bug 5678: Double-parsed template argument
15794 !! wikitext
15795 {{lc:{{{1}}}|hello}}
15796 !! html
15797 <p>{{{1}}}
15798 </p>
15799 !! end
15800
15801 !! test
15802 Bug 5678: Double-parsed template invocation
15803 !! wikitext
15804 {{lc:{{paramtest {{!}} param = hello }} }}
15805 !! html
15806 <p>{{paramtest | param = hello }}
15807 </p>
15808 !! end
15809
15810 !! test
15811 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15812 !! options
15813 language=cs
15814 title=[[Main Page]]
15815 !! wikitext
15816 {{PRVNÍVELKÉ:ěščř}}
15817 {{prvnívelké:ěščř}}
15818 {{PRVNÍMALÉ:ěščř}}
15819 {{prvnímalé:ěščř}}
15820 {{MALÁ:ěščř}}
15821 {{malá:ěščř}}
15822 {{VELKÁ:ěščř}}
15823 {{velká:ěščř}}
15824 !! html
15825 <p>Ěščř
15826 Ěščř
15827 ěščř
15828 ěščř
15829 ěščř
15830 ěščř
15831 ĚŠČŘ
15832 ĚŠČŘ
15833 </p>
15834 !! end
15835
15836 !! test
15837 Morwen/13: Unclosed link followed by heading
15838 !! wikitext
15839 [[link
15840 ==heading==
15841 !! html
15842 <p>[[link
15843 </p>
15844 <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>
15845
15846 !! end
15847
15848 !! test
15849 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15850 !! wikitext
15851 {{foo|
15852 =heading=
15853 !! html
15854 <p>{{foo|
15855 </p>
15856 <h1><span class="mw-headline" id="heading">heading</span></h1>
15857
15858 !! end
15859
15860 !! test
15861 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15862 !! wikitext
15863 {{foo|
15864 ==heading==
15865 !! html
15866 <p>{{foo|
15867 </p>
15868 <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>
15869
15870 !! end
15871
15872 !! test
15873 Tildes in comments
15874 !! options
15875 pst
15876 !! wikitext
15877 <!-- ~~~~ -->
15878 !! html
15879 <!-- ~~~~ -->
15880 !! end
15881
15882 !! test
15883 Paragraphs inside divs (no extra line breaks)
15884 !! wikitext
15885 <div>Line one
15886
15887 Line two</div>
15888 !! html
15889 <div>Line one
15890 Line two</div>
15891
15892 !! end
15893
15894 !! test
15895 Paragraphs inside divs (extra line break on open)
15896 !! wikitext
15897 <div>
15898 Line one
15899
15900 Line two</div>
15901 !! html
15902 <div>
15903 <p>Line one
15904 </p>
15905 Line two</div>
15906
15907 !! end
15908
15909 !! test
15910 Paragraphs inside divs (extra line break on close)
15911 !! wikitext
15912 <div>Line one
15913
15914 Line two
15915 </div>
15916 !! html
15917 <div>Line one
15918 <p>Line two
15919 </p>
15920 </div>
15921
15922 !! end
15923
15924 !! test
15925 Paragraphs inside divs (extra line break on open and close)
15926 !! wikitext
15927 <div>
15928 Line one
15929
15930 Line two
15931 </div>
15932 !! html
15933 <div>
15934 <p>Line one
15935 </p><p>Line two
15936 </p>
15937 </div>
15938
15939 !! end
15940
15941 !! test
15942 Nesting tags, paragraphs on lines which begin with <div>
15943 !! options
15944 disabled
15945 !! wikitext
15946 <div></div><strong>A
15947 B</strong>
15948 !! html
15949 <div></div>
15950 <p><strong>A
15951 B</strong>
15952 </p>
15953 !! end
15954
15955 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15956 !! test
15957 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15958 !! wikitext
15959 <blockquote>Line one
15960
15961 Line two</blockquote>
15962 !! html
15963 <blockquote>Line one
15964 Line two</blockquote>
15965
15966 !! end
15967
15968 !! test
15969 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15970 !! wikitext
15971 <blockquote>
15972 Line one
15973
15974 Line two</blockquote>
15975 !! html
15976 <blockquote>
15977 <p>Line one
15978 </p>
15979 Line two</blockquote>
15980
15981 !! end
15982
15983 !! test
15984 Bug 6200: paragraphs inside blockquotes (extra line break on close)
15985 !! wikitext
15986 <blockquote>Line one
15987
15988 Line two
15989 </blockquote>
15990 !! html
15991 <blockquote>Line one
15992 <p>Line two
15993 </p>
15994 </blockquote>
15995
15996 !! end
15997
15998 !! test
15999 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16000 !! wikitext
16001 <blockquote>
16002 Line one
16003
16004 Line two
16005 </blockquote>
16006 !! html
16007 <blockquote>
16008 <p>Line one
16009 </p><p>Line two
16010 </p>
16011 </blockquote>
16012
16013 !! end
16014
16015 !! test
16016 Paragraphs inside blockquotes/divs (no extra line breaks)
16017 !! wikitext
16018 <blockquote><div>Line one
16019
16020 Line two</div></blockquote>
16021 !! html
16022 <blockquote><div>Line one
16023 Line two</div></blockquote>
16024
16025 !! end
16026
16027 !! test
16028 Paragraphs inside blockquotes/divs (extra line break on open)
16029 !! wikitext
16030 <blockquote><div>
16031 Line one
16032
16033 Line two</div></blockquote>
16034 !! html
16035 <blockquote><div>
16036 <p>Line one
16037 </p>
16038 Line two</div></blockquote>
16039
16040 !! end
16041
16042 !! test
16043 Paragraphs inside blockquotes/divs (extra line break on close)
16044 !! wikitext
16045 <blockquote><div>Line one
16046
16047 Line two
16048 </div></blockquote>
16049 !! html
16050 <blockquote><div>Line one
16051 <p>Line two
16052 </p>
16053 </div></blockquote>
16054
16055 !! end
16056
16057 !! test
16058 Paragraphs inside blockquotes/divs (extra line break on open and close)
16059 !! wikitext
16060 <blockquote><div>
16061 Line one
16062
16063 Line two
16064 </div></blockquote>
16065 !! html
16066 <blockquote><div>
16067 <p>Line one
16068 </p><p>Line two
16069 </p>
16070 </div></blockquote>
16071
16072 !! end
16073
16074 !! test
16075 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16076 !! options
16077 wgLinkHolderBatchSize=0
16078 !! wikitext
16079 [[meatball:1]]
16080 [[meatball:2]]
16081 [[meatball:3]]
16082 !! html
16083 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16084 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16085 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16086 </p>
16087 !! end
16088
16089 !! test
16090 Free external link invading image caption
16091 !! wikitext
16092 [[Image:Foobar.jpg|thumb|http://x|hello]]
16093 !! html
16094 <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>
16095
16096 !! end
16097
16098 !! test
16099 Bug 15196: localised external link numbers
16100 !! options
16101 language=fa
16102 !! wikitext
16103 [http://en.wikipedia.org/]
16104 !! html
16105 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16106 </p>
16107 !! end
16108
16109 !! test
16110 Multibyte character in padleft
16111 !! wikitext
16112 {{padleft:-Hello|7|Æ}}
16113 !! html
16114 <p>Æ-Hello
16115 </p>
16116 !! end
16117
16118 !! test
16119 Multibyte character in padright
16120 !! wikitext
16121 {{padright:Hello-|7|Æ}}
16122 !! html
16123 <p>Hello-Æ
16124 </p>
16125 !! end
16126
16127 !!test
16128 formatdate parser function
16129 !! wikitext
16130 {{#formatdate:2009-03-24}}
16131 !! html
16132 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16133 </p>
16134 !! end
16135
16136 !!test
16137 formatdate parser function, with default format
16138 !! wikitext
16139 {{#formatdate:2009-03-24|mdy}}
16140 !! html
16141 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16142 </p>
16143 !! end
16144
16145 !! test
16146 Spacing of numbers in formatted dates
16147 !! wikitext
16148 {{#formatdate:January 15}}
16149 !! html
16150 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16151 </p>
16152 !! end
16153
16154 !! test
16155 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
16156 !! options
16157 language=nl title=[[MediaWiki:Common.css]]
16158 !! wikitext
16159 {{#formatdate:2009-03-24|dmy}}
16160 !! html
16161 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16162 </p>
16163 !! end
16164
16165 #
16166 #
16167 #
16168
16169 #
16170 # Edit comments
16171 #
16172
16173 !! test
16174 Edit comment with link
16175 !! options
16176 comment
16177 !! wikitext
16178 I like the [[Main Page]] a lot
16179 !! html
16180 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16181 !!end
16182
16183 !! test
16184 Edit comment with link and link text
16185 !! options
16186 comment
16187 !! wikitext
16188 I like the [[Main Page|best pages]] a lot
16189 !! html
16190 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16191 !!end
16192
16193 !! test
16194 Edit comment with link and link text with suffix
16195 !! options
16196 comment
16197 !! wikitext
16198 I like the [[Main Page|best page]]s a lot
16199 !! html
16200 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16201 !!end
16202
16203 !! test
16204 Edit comment with section link (non-local, eg in history list)
16205 !! options
16206 comment title=[[Main Page]]
16207 !! wikitext
16208 /* External links */ removed bogus entries
16209 !! html
16210 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16211 !!end
16212
16213 !! test
16214 Edit comment with section link and text before it (non-local, eg in history list)
16215 !! options
16216 comment title=[[Main Page]]
16217 !! wikitext
16218 pre-comment text /* External links */ removed bogus entries
16219 !! html
16220 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>
16221 !!end
16222
16223 !! test
16224 Edit comment with section link (local, eg in diff view)
16225 !! options
16226 comment local title=[[Main Page]]
16227 !! wikitext
16228 /* External links */ removed bogus entries
16229 !! html
16230 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16231 !!end
16232
16233 !! test
16234 Edit comment with subpage link (bug 14080)
16235 !! options
16236 comment
16237 subpage
16238 title=[[Subpage test]]
16239 !! wikitext
16240 Poked at a [[/subpage]] here...
16241 !! html
16242 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16243 !!end
16244
16245 !! test
16246 Edit comment with subpage link and link text (bug 14080)
16247 !! options
16248 comment
16249 subpage
16250 title=[[Subpage test]]
16251 !! wikitext
16252 Poked at a [[/subpage|neat little page]] here...
16253 !! html
16254 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16255 !!end
16256
16257 !! test
16258 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16259 !! options
16260 comment
16261 title=[[Subpage test]]
16262 !! wikitext
16263 Poked at a [[/subpage]] here...
16264 !! html
16265 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...
16266 !!end
16267
16268 !! test
16269 Edit comment with bare anchor link (local, as on diff)
16270 !! options
16271 comment
16272 local
16273 title=[[Main Page]]
16274 !! wikitext
16275 [[#section]]
16276 !! html
16277 <a href="#section">#section</a>
16278 !! end
16279
16280 !! test
16281 Edit comment with bare anchor link (non-local, as on history)
16282 !! options
16283 comment
16284 title=[[Main Page]]
16285 !! wikitext
16286 [[#section]]
16287 !! html
16288 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16289 !! end
16290
16291 !! test
16292 Anchor starting with underscore
16293 !! wikitext
16294 [[#_ref|One]]
16295 !! html
16296 <p><a href="#_ref">One</a>
16297 </p>
16298 !! end
16299
16300 !! test
16301 Id starting with underscore
16302 !! wikitext
16303 <div id="_ref"></div>
16304 !! html
16305 <div id="_ref"></div>
16306
16307 !! end
16308
16309 !! test
16310 Space normalisation on autocomment (bug 22784)
16311 !! options
16312 comment
16313 title=[[Main Page]]
16314 !! wikitext
16315 /* __hello__world__ */
16316 !! html
16317 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16318 !! end
16319
16320 !! test
16321 percent-encoding and + signs in comments (Bug 26410)
16322 !! options
16323 comment
16324 !! wikitext
16325 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16326 !! html
16327 <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>
16328 !! end
16329
16330 !! test
16331 Bad images - basic functionality
16332 !! options
16333 disabled
16334 !! wikitext
16335 [[File:Bad.jpg]]
16336 !! html
16337 !! end
16338
16339 !! test
16340 Bad images - bug 16039: text after bad image disappears
16341 !! options
16342 disabled
16343 !! wikitext
16344 Foo bar
16345 [[File:Bad.jpg]]
16346 Bar foo
16347 !! html
16348 <p>Foo bar
16349 </p><p>Bar foo
16350 </p>
16351 !! end
16352
16353 !! test
16354 Verify that displaytitle works (bug #22501) no displaytitle
16355 !! options
16356 showtitle
16357 !! config
16358 wgAllowDisplayTitle=true
16359 wgRestrictDisplayTitle=false
16360 !! wikitext
16361 this is not the the title
16362 !! html
16363 Parser test
16364 <p>this is not the the title
16365 </p>
16366 !! end
16367
16368 !! test
16369 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16370 !! options
16371 showtitle
16372 title=[[Screen]]
16373 !! config
16374 wgAllowDisplayTitle=true
16375 wgRestrictDisplayTitle=false
16376 !! wikitext
16377 this is not the the title
16378 {{DISPLAYTITLE:whatever}}
16379 !! html
16380 whatever
16381 <p>this is not the the title
16382 </p>
16383 !! end
16384
16385 !! test
16386 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16387 !! options
16388 showtitle
16389 title=[[Screen]]
16390 !! config
16391 wgAllowDisplayTitle=true
16392 wgRestrictDisplayTitle=true
16393 !! wikitext
16394 this is not the the title
16395 {{DISPLAYTITLE:whatever}}
16396 !! html
16397 Screen
16398 <p>this is not the the title
16399 </p>
16400 !! end
16401
16402 !! test
16403 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16404 !! options
16405 showtitle
16406 title=[[Screen]]
16407 !! config
16408 wgAllowDisplayTitle=true
16409 wgRestrictDisplayTitle=true
16410 !! wikitext
16411 this is not the the title
16412 {{DISPLAYTITLE:screen}}
16413 !! html
16414 screen
16415 <p>this is not the the title
16416 </p>
16417 !! end
16418
16419 !! test
16420 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16421 !! options
16422 showtitle
16423 title=[[Screen]]
16424 !! config
16425 wgAllowDisplayTitle=false
16426 !! wikitext
16427 this is not the the title
16428 {{DISPLAYTITLE:screen}}
16429 !! html
16430 Screen
16431 <p>this is not the the title
16432 <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>
16433 </p>
16434 !! end
16435
16436 !! test
16437 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16438 !! options
16439 showtitle
16440 title=[[Screen]]
16441 !! config
16442 wgAllowDisplayTitle=false
16443 !! wikitext
16444 this is not the the title
16445 !! html
16446 Screen
16447 <p>this is not the the title
16448 </p>
16449 !! end
16450
16451 !! test
16452 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16453 !! options
16454 showtitle
16455 title=[[Screen]]
16456 !! config
16457 wgAllowDisplayTitle=true
16458 wgRestrictDisplayTitle=true
16459 !! wikitext
16460 this is not the the title
16461 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16462 !! html
16463 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16464 <p>this is not the the title
16465 </p>
16466 !! end
16467
16468 !! test
16469 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16470 !! options
16471 showtitle
16472 title=[[Screen]]
16473 !! config
16474 wgAllowDisplayTitle=true
16475 wgRestrictDisplayTitle=true
16476 !! wikitext
16477 this is not the the title
16478 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16479 !! html
16480 <span style="color: red;">s</span>creen
16481 <p>this is not the the title
16482 </p>
16483 !! end
16484
16485 !! test
16486 preload: check <noinclude> and <includeonly>
16487 !! options
16488 preload
16489 !! wikitext
16490 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16491 !! html
16492 Hello kind world.
16493 !! end
16494
16495 !! test
16496 preload: check <onlyinclude>
16497 !! options
16498 preload
16499 !! wikitext
16500 Goodbye <onlyinclude>Hello world</onlyinclude>
16501 !! html
16502 Hello world
16503 !! end
16504
16505 !! test
16506 preload: can pass tags through if we want to
16507 !! options
16508 preload
16509 !! wikitext
16510 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16511 !! html
16512 <includeonly>Hello world</includeonly>
16513 !! end
16514
16515 !! test
16516 preload: check that it doesn't try to do tricks
16517 !! options
16518 preload
16519 !! wikitext
16520 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16521 !! html
16522 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16523 !! end
16524
16525 !! test
16526 Play a bit with r67090 and bug 3158
16527 !! options
16528 disabled
16529 !! wikitext
16530 <div style="width:50% !important">&nbsp;</div>
16531 <div style="width:50%&nbsp;!important">&nbsp;</div>
16532 <div style="width:50%&#160;!important">&nbsp;</div>
16533 <div style="border : solid;">&nbsp;</div>
16534 !! html
16535 <div style="width:50% !important">&nbsp;</div>
16536 <div style="width:50% !important">&nbsp;</div>
16537 <div style="width:50% !important">&nbsp;</div>
16538 <div style="border&#160;: solid;">&nbsp;</div>
16539
16540 !! end
16541
16542 !! test
16543 HTML5 data attributes
16544 !! wikitext
16545 <span data-foo="bar">Baz</span>
16546 <p data-abc-def_hij="">Quuz</p>
16547 !! html
16548 <p><span data-foo="bar">Baz</span>
16549 </p>
16550 <p data-abc-def_hij="">Quuz</p>
16551
16552 !! end
16553
16554 !! test
16555 percent-encoding and + signs in internal links (Bug 26410)
16556 !! wikitext
16557 [[User:+%]] [[Page+title%]]
16558 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16559 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16560 [[%33%45]] [[%33%45+]]
16561 !! html
16562 <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>
16563 <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>
16564 <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>
16565 <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>
16566 </p>
16567 !! end
16568
16569 !! test
16570 Special characters in embedded file links (bug 27679)
16571 !! wikitext
16572 [[File:Contains & ampersand.jpg]]
16573 [[File:Does not exist.jpg|Title with & ampersand]]
16574 !! html
16575 <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>
16576 <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>
16577 </p>
16578 !! end
16579
16580
16581 !! test
16582 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16583 !! wikitext
16584 Text&apos;s been normalized?
16585 !! html
16586 <p>Text&#39;s been normalized?
16587 </p>
16588 !! end
16589
16590 !! test
16591 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16592 !! wikitext
16593 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16594 !! html
16595 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16596 </p>
16597 !! end
16598
16599 !! test
16600 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16601 !! wikitext
16602 [http://www.example.org/ ideograms]
16603 !! html
16604 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16605 </p>
16606 !! end
16607
16608 !! test
16609 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16610 !! wikitext
16611 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16612 !! html
16613 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16614 </p>
16615 !! end
16616
16617 !! article
16618 Mediawiki:loop1
16619 !! text
16620 {{Identical|A}}
16621 !! endarticle
16622
16623 !! article
16624 Mediawiki:loop2
16625 !! text
16626 {{Identical|B}}
16627 !! endarticle
16628
16629 !! article
16630 Template:Identical
16631 !! text
16632 {{int:loop1}}
16633 {{int:loop2}}
16634 !! endarticle
16635
16636 !! test
16637 Bug 31098 Template which includes system messages which includes the template
16638 !! wikitext
16639 {{Identical}}
16640 !! html
16641 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16642 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16643 </p>
16644 !! end
16645
16646 !! test
16647 Bug31490 Turkish: ucfirst 'blah'
16648 !! options
16649 language=tr
16650 !! wikitext
16651 {{ucfirst:blah}}
16652 !! html
16653 <p>Blah
16654 </p>
16655 !! end
16656
16657 !! test
16658 Bug31490 Turkish: ucfirst 'ix'
16659 !! options
16660 language=tr
16661 !! wikitext
16662 {{ucfirst:ix}}
16663 !! html
16664 <p>İx
16665 </p>
16666 !! end
16667
16668 !! test
16669 Bug31490 Turkish: lcfirst 'BLAH'
16670 !! options
16671 language=tr
16672 !! wikitext
16673 {{lcfirst:BLAH}}
16674 !! html
16675 <p>bLAH
16676 </p>
16677 !! end
16678
16679 !! test
16680 Bug31490 Turkish: ucfırst (with a dotless i)
16681 !! options
16682 language=tr
16683 !! wikitext
16684 {{ucfırst:blah}}
16685 !! html
16686 <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>
16687 </p>
16688 !! end
16689
16690 !! test
16691 Bug31490 ucfırst (with a dotless i) with English language
16692 !! options
16693 language=en
16694 !! wikitext
16695 {{ucfırst:blah}}
16696 !! html
16697 <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>
16698 </p>
16699 !! end
16700
16701 !! test
16702 Bug 26375: TOC with italics
16703 !! options
16704 title=[[Main Page]]
16705 !! wikitext
16706 __TOC__
16707 == ''Lost'' episodes ==
16708 !! html
16709 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16710 <ul>
16711 <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>
16712 </ul>
16713 </div>
16714
16715 <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>
16716
16717 !! end
16718
16719 !! test
16720 Bug 26375: TOC with bold
16721 !! options
16722 title=[[Main Page]]
16723 !! wikitext
16724 __TOC__
16725 == '''should be bold''' then normal text ==
16726 !! html
16727 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16728 <ul>
16729 <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>
16730 </ul>
16731 </div>
16732
16733 <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>
16734
16735 !! end
16736
16737 !! test
16738 Bug 33845: Headings become cursive in TOC when they contain an image
16739 !! options
16740 title=[[Main Page]]
16741 !! wikitext
16742 __TOC__
16743 == Image [[Image:foobar.jpg]] ==
16744 !! html
16745 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16746 <ul>
16747 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16748 </ul>
16749 </div>
16750
16751 <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>
16752
16753 !! end
16754
16755 !! test
16756 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16757 !! options
16758 title=[[Main Page]]
16759 !! wikitext
16760 __TOC__
16761 == <blockquote>Quote</blockquote> ==
16762 !! html
16763 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16764 <ul>
16765 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16766 </ul>
16767 </div>
16768
16769 <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>
16770
16771 !! end
16772
16773 !! test
16774 Unclosed tags in TOC
16775 !! options
16776 title=[[Main Page]]
16777 !! wikitext
16778 __TOC__
16779 == Proof: 2 < 3 ==
16780 <small>Hanc marginis exiguitas non caperet.</small>
16781 QED
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="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
16786 </ul>
16787 </div>
16788
16789 <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>
16790 <p><small>Hanc marginis exiguitas non caperet.</small>
16791 QED
16792 </p>
16793 !! end
16794
16795 !! test
16796 Multiple tags in TOC
16797 !! wikitext
16798 __TOC__
16799 == <i>Foo</i> <b>Bar</b> ==
16800
16801 == <i>Foo</i> <blockquote>Bar</blockquote> ==
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="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
16806 <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>
16807 </ul>
16808 </div>
16809
16810 <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>
16811 <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>
16812
16813 !! end
16814
16815 !! test
16816 Tags with parameters in TOC
16817 !! wikitext
16818 __TOC__
16819 == <sup class="in-h2">Hello</sup> ==
16820
16821 == <sup class="a > b">Evilbye</sup> ==
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="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16826 <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>
16827 </ul>
16828 </div>
16829
16830 <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>
16831 <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>
16832
16833 !! end
16834
16835 !! test
16836 span tags with directionality in TOC
16837 !! wikitext
16838 __TOC__
16839 == <span dir="ltr">C++</span> ==
16840
16841 == <span dir="rtl">זבנג!</span> ==
16842
16843 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16844
16845 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16846
16847 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16848 !! html
16849 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16850 <ul>
16851 <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>
16852 <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>
16853 <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>
16854 <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>
16855 <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>
16856 </ul>
16857 </div>
16858
16859 <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>
16860 <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>
16861 <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>
16862 <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>
16863 <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>
16864
16865 !! end
16866
16867 !! article
16868 MediaWiki:Bug32057
16869 !! text
16870 == {{int:headline_sample}} ==
16871 !! endarticle
16872
16873 !! test
16874 Bug 32057: Title needed when expanding <h> nodes.
16875 !! options
16876 title=[[Main Page]]
16877 !! wikitext
16878 {{int:Bug32057}}
16879 !! html
16880 <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>
16881
16882 !! end
16883
16884 !! test
16885 Strip marker in urlencode
16886 !! wikitext
16887 {{urlencode:x<nowiki/>y}}
16888 {{urlencode:x<nowiki/>y|wiki}}
16889 {{urlencode:x<nowiki/>y|path}}
16890 !! html
16891 <p>xy
16892 xy
16893 xy
16894 </p>
16895 !! end
16896
16897 !! test
16898 Strip marker in lc
16899 !! wikitext
16900 {{lc:x<nowiki/>y}}
16901 !! html
16902 <p>xy
16903 </p>
16904 !! end
16905
16906 !! test
16907 Strip marker in uc
16908 !! wikitext
16909 {{uc:x<nowiki/>y}}
16910 !! html
16911 <p>XY
16912 </p>
16913 !! end
16914
16915 !! test
16916 Strip marker in formatNum
16917 !! wikitext
16918 {{formatnum:1<nowiki/>2}}
16919 {{formatnum:1<nowiki/>2|R}}
16920 !! html
16921 <p>12
16922 12
16923 </p>
16924 !! end
16925
16926 !! test
16927 Check noCommafy in formatNum
16928 !! options
16929 language=be-tarask
16930 !! wikitext
16931 {{formatnum:123456.78}}
16932 {{formatnum:123456.78|NOSEP}}
16933 !! html
16934 <p>123 456,78
16935 123456.78
16936 </p>
16937 !! end
16938
16939 !! test
16940 Wrong option for formatNum (bug 56199)
16941 !! wikitext
16942 {{formatnum:1,234.56|Random}}
16943 {{formatnum:1,234.56|EVERYTHING}}
16944 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
16945 !! html
16946 <p>1,234.56
16947 1,234.56
16948 1,234.56
16949 </p>
16950 !! end
16951
16952 !! test
16953 Strip marker in grammar
16954 !! options
16955 language=fi
16956 !! wikitext
16957 {{grammar:elative|foo<nowiki/>bar}}
16958 !! html
16959 <p>foobarista
16960 </p>
16961 !! end
16962
16963 !! test
16964 Strip marker in padleft
16965 !! wikitext
16966 {{padleft:|2|x<nowiki/>y}}
16967 !! html
16968 <p>xy
16969 </p>
16970 !! end
16971
16972 !! test
16973 Strip marker in padright
16974 !! wikitext
16975 {{padright:|2|x<nowiki/>y}}
16976 !! html
16977 <p>xy
16978 </p>
16979 !! end
16980
16981 !! test
16982 Strip marker in anchorencode
16983 !! wikitext
16984 {{anchorencode:x<nowiki/>y}}
16985 !! html
16986 <p>xy
16987 </p>
16988 !! end
16989
16990 !! test
16991 nowiki inside link inside heading (bug 18295)
16992 !! wikitext
16993 ==[[foo|x<nowiki>y</nowiki>z]]==
16994 !! html
16995 <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>
16996
16997 !! end
16998
16999 !! test
17000 new support for bdi element (bug 31817)
17001 !! wikitext
17002 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17003 !! html
17004 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17005
17006 !!end
17007
17008 !! test
17009 Ignore pipe between table row attributes
17010 !! wikitext
17011 {|
17012 | quux
17013 |- id=foo | style='color: red'
17014 | bar
17015 |}
17016 !! html
17017 <table>
17018 <tr>
17019 <td> quux
17020 </td></tr>
17021 <tr id="foo" style="color: red">
17022 <td> bar
17023 </td></tr></table>
17024
17025 !! end
17026
17027 !!test
17028 Gallery override link with WikiLink (bug 34852)
17029 !! wikitext
17030 <gallery>
17031 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17032 </gallery>
17033 !! html
17034 <ul class="gallery mw-gallery-traditional">
17035 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17036 <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>
17037 <div class="gallerytext">
17038 <p>caption
17039 </p>
17040 </div>
17041 </div></li>
17042 </ul>
17043
17044 !! end
17045
17046 !!test
17047 Gallery override link with absolute external link (bug 34852)
17048 !! wikitext
17049 <gallery>
17050 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17051 </gallery>
17052 !! html
17053 <ul class="gallery mw-gallery-traditional">
17054 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17055 <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>
17056 <div class="gallerytext">
17057 <p>caption
17058 </p>
17059 </div>
17060 </div></li>
17061 </ul>
17062
17063 !! end
17064
17065 !!test
17066 Gallery override link with malicious javascript (bug 34852)
17067 !! wikitext
17068 <gallery>
17069 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17070 </gallery>
17071 !! html
17072 <ul class="gallery mw-gallery-traditional">
17073 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17074 <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>
17075 <div class="gallerytext">
17076 <p>caption
17077 </p>
17078 </div>
17079 </div></li>
17080 </ul>
17081
17082 !! end
17083
17084 !!test
17085 Gallery with invalid title as link (bug 43964)
17086 !! wikitext
17087 <gallery>
17088 File:foobar.jpg|link=<
17089 </gallery>
17090 !! html
17091 <ul class="gallery mw-gallery-traditional">
17092 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17093 <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>
17094 <div class="gallerytext">
17095 </div>
17096 </div></li>
17097 </ul>
17098
17099 !! end
17100
17101 !!test
17102 Language parser function
17103 !! wikitext
17104 {{#language:ar}}
17105 !! html
17106 <p>العربية
17107 </p>
17108 !! end
17109
17110 !!test
17111 Padleft and padright as substr
17112 !! wikitext
17113 {{padleft:|3|abcde}}
17114 {{padright:|3|abcde}}
17115 !! html
17116 <p>abc
17117 abc
17118 </p>
17119 !! end
17120
17121 !!test
17122 Special parser function
17123 !! wikitext
17124 {{#special:RandomPage}}
17125 {{#special:BaDtItLe}}
17126 {{#special:Foobar}}
17127 !! html
17128 <p>Special:Random
17129 Special:Badtitle
17130 Special:Foobar
17131 </p>
17132 !! end
17133
17134 !!test
17135 Bug 34939 - Case insensitive link parsing ([HttP://])
17136 !! wikitext
17137 [HttP://MediaWiki.Org/]
17138 !! html
17139 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17140 </p>
17141 !! end
17142
17143 !!test
17144 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17145 !! wikitext
17146 [HttP://MediaWiki.Org/ MediaWiki]
17147 !! html
17148 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17149 </p>
17150 !! end
17151
17152 !!test
17153 Bug 34939 - Case insensitive link parsing (HttP://)
17154 !! wikitext
17155 HttP://MediaWiki.Org/
17156 !! html
17157 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17158 </p>
17159 !! end
17160
17161 !!test
17162 Disable TOC
17163 !! options
17164 notoc
17165 !! wikitext
17166 Lead
17167 == Section 1 ==
17168 == Section 2 ==
17169 == Section 3 ==
17170 == Section 4 ==
17171 == Section 5 ==
17172 !! html
17173 <p>Lead
17174 </p>
17175
17176 <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>
17177 <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>
17178 <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>
17179 <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>
17180 <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>
17181
17182 !! end
17183
17184
17185 ###
17186 ### Parsoids-specific tests
17187 ### Parsoid-PHP parser incompatibilities
17188 ###
17189 !!test
17190 1. SOL-sensitive wikitext tokens as template-args
17191 !!options
17192 parsoid=wt2html,wt2wt
17193 !! wikitext
17194 {{echo|*a}}
17195 {{echo|#a}}
17196 {{echo|:a}}
17197 !! html
17198 <span about="#mwt1" typeof="mw:Transclusion">
17199 </span><ul about="#mwt1"><li>a</li>
17200 </ul>
17201 <span about="#mwt2" typeof="mw:Transclusion">
17202 </span><ol about="#mwt2"><li>a</li>
17203 </ol>
17204 <span about="#mwt3" typeof="mw:Transclusion">
17205 </span><dl about="#mwt3"><dd>a</dd>
17206 </dl>
17207 !!end
17208
17209 #### ----------------------------------------------------------------
17210 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17211 #### tags. Parsoid's output for these tags differs from that of the
17212 #### PHP parser.
17213 #### ----------------------------------------------------------------
17214
17215 !!test
17216 Ref: 1. ref-location should be replaced with an index span
17217 !!options
17218 parsoid
17219 !! wikitext
17220 A <ref>foo</ref>
17221 B <ref name="x">foo</ref>
17222 C <ref name="y" />
17223 !! html
17224 <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>
17225 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>
17226 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>
17227 !!end
17228
17229 !!test
17230 Ref: 2. ref-tags with identical names should all get the same index
17231 !!options
17232 parsoid
17233 !! wikitext
17234 A <ref name="x">foo</ref>
17235 B <ref name="x" />
17236 !! html
17237 <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>
17238 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>
17239 !!end
17240
17241 !!test
17242 Ref: 3. spaces in ref-names should be ignored
17243 !!options
17244 parsoid
17245 !! wikitext
17246 A <ref name="x">foo</ref>
17247 B <ref name=" x " />
17248 C <ref name= x />
17249 !! html
17250 <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>
17251 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>
17252 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>
17253 !!end
17254
17255 !!test
17256 Ref: 4. 'constructor' should be accepted as a valid ref-name
17257 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17258 !!options
17259 parsoid
17260 !! wikitext
17261 A <ref name="constructor">foo</ref>
17262 !! html
17263 <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>
17264 !!end
17265
17266 !!test
17267 Ref: 5. body should accept generic wikitext
17268 !!options
17269 parsoid
17270 !! wikitext
17271 A <ref>
17272 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17273 </ref>
17274
17275 <references />
17276 !! html
17277 <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>
17278
17279 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17280 <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>
17281 </li>
17282 </ol>
17283 !!end
17284
17285 !!test
17286 Ref: 6. indent-pres should not be output in ref-body
17287 !!options
17288 parsoid
17289 !! wikitext
17290 A <ref>
17291 foo
17292 bar
17293 baz
17294 </ref>
17295
17296 <references />
17297 !! html
17298 <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>
17299
17300 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17301 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17302 bar
17303 baz
17304 </li>
17305 </ol>
17306 !!end
17307
17308 !!test
17309 Ref: 7. No p-wrapping in ref-body
17310 !!options
17311 parsoid
17312 !! wikitext
17313 A <ref>
17314 foo
17315
17316 bar
17317
17318
17319 baz
17320
17321
17322
17323 booz
17324 </ref>
17325
17326 <references />
17327 !! html
17328 <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>
17329
17330 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17331 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17332
17333 bar
17334
17335
17336 baz
17337
17338
17339
17340 booz
17341 </li>
17342 </ol>
17343 !!end
17344
17345 !!test
17346 Ref: 8. transclusion wikitext has lower precedence
17347 !!options
17348 parsoid
17349 !! wikitext
17350 A <ref> foo {{echo|</ref> B C}}
17351
17352 <references />
17353 !! html
17354 <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>
17355 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17356 <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>
17357 </ol>
17358 !!end
17359
17360 !!test
17361 Ref: 9. unclosed comments should not leak out of ref-body
17362 !!options
17363 parsoid
17364 !! wikitext
17365 A <ref> foo <!--</ref> B C
17366 <references />
17367 !! html
17368 <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>
17369 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17370 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17371 </ol>
17372 !!end
17373
17374 !!test
17375 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17376 !!options
17377 parsoid
17378 !! wikitext
17379 A <ref> <b> foo </ref> B C
17380
17381 <references />
17382 !! html
17383 <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>
17384
17385
17386 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17387 <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>
17388 </ol>
17389 !!end
17390
17391 !!test
17392 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17393 !!options
17394 parsoid
17395 !! wikitext
17396 A <ref>foo</ref> B
17397 C <ref>bar</ref> D
17398 !! html
17399 <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
17400 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>
17401 !!end
17402
17403 !!test
17404 Ref: 12. ref-tags act as trailing newline migration barrier
17405 !!options
17406 parsoid
17407 !! wikitext
17408 <!--the newline at the end of this line moves out of the p-tag-->a
17409
17410 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17411 <ref />
17412
17413 c
17414 !! html
17415 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17416
17417
17418 <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>
17419 <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>
17420
17421
17422 <p>c</p>
17423 !!end
17424
17425 !!test
17426 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17427 !!options
17428 parsoid
17429 !! wikitext
17430 <ref>foo</ref> A
17431 <ref>bar
17432 </ref> B
17433 !! html
17434 <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
17435 <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>
17436 !!end
17437
17438 !!test
17439 Ref: 14. A nested ref-tag should be emitted as plain text
17440 !!options
17441 parsoid
17442 !! wikitext
17443 <ref>foo <ref>bar</ref> baz</ref>
17444
17445 <references />
17446 !! html
17447 <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>
17448
17449 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17450 <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>
17451 </ol>
17452 !!end
17453
17454 !!test
17455 Ref: 15. ref-tags with identical names should get identical indexes
17456 !!options
17457 parsoid
17458 !! wikitext
17459 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17460 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17461
17462 <references />
17463 !! html
17464 <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>
17465 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>
17466
17467 <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>
17468 </ol>
17469 !!end
17470
17471 ## We don't bother wt2wt-ing non-standard whitespace
17472 !!test
17473 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17474 !!options
17475 parsoid=wt2html
17476 !! wikitext
17477 A <ref >foo</ref >
17478
17479 <references />
17480 !! html
17481 <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>
17482
17483 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17484 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17485 !!end
17486
17487 !!test
17488 References: 1. references tag without any refs should be handled properly
17489 !!options
17490 parsoid
17491 !! wikitext
17492 <references />
17493 !! html
17494 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17495 !!end
17496
17497 !!test
17498 References: 2. references tag with group only outputs references from that group
17499 !!options
17500 parsoid
17501 !! wikitext
17502 A <ref group="a">foo</ref>
17503 B <ref group="b">bar</ref>
17504
17505 <references group="a" />
17506 !! html
17507 <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>
17508 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>
17509
17510 <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>
17511 </ol>
17512 !!end
17513
17514 !!test
17515 References: 3. ref list should be cleared after processing references
17516 !!options
17517 parsoid
17518 !! wikitext
17519 A <ref>foo</ref>
17520
17521 <references />
17522
17523 B <ref>bar</ref>
17524
17525 <references />
17526 !! html
17527 <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>
17528
17529 <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>
17530 </ol>
17531
17532 <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>
17533
17534 <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>
17535 </ol>
17536 !!end
17537
17538 !!test
17539 References: 4. only referenced group should be cleared after processing references
17540 !!options
17541 parsoid
17542 !! wikitext
17543 A <ref group="a">afoo</ref>
17544 B <ref>bfoo</ref>
17545
17546 <references group="a" />
17547
17548 C <ref>cfoo</ref>
17549
17550 <references />
17551 !! html
17552 <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>
17553 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>
17554
17555 <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>
17556 </ol>
17557
17558 <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>
17559
17560 <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>
17561 </ol>
17562 !!end
17563
17564 !!test
17565 References: 5. ref tags in references should be processed while ignoring all other content
17566 !!options
17567 parsoid
17568 !! wikitext
17569 A <ref name="a" />
17570 B <ref name="b">bar</ref>
17571
17572 <references>
17573 <ref name="a">foo</ref>
17574 This should just get lost.
17575 </references>
17576 !! html
17577 <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>
17578 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>
17579
17580
17581 <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":{}}'>
17582 <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>
17583 <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>
17584 </ol>
17585 !!end
17586
17587 !!test
17588 References: 6. <references /> from a transclusion
17589 !!options
17590 parsoid
17591 !! wikitext
17592 <ref>Foo</ref> {{echo|<references />}}
17593 !! html
17594 <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>
17595 !!end
17596
17597 !! test
17598 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17599 !! options
17600 parsoid
17601 !! wikitext
17602 A <ref>foo bar for a</ref>
17603 B <ref group="X" name="b" />
17604
17605 <references />
17606
17607 <references group="X">
17608 <ref name="b">foo</ref>
17609 </references>
17610 !! html
17611 <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>
17612 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>
17613
17614 <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>
17615
17616 <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>
17617 !! end
17618
17619 # This test is wt2html only because we're permitting the serializer to produce
17620 # dirty diffs, normalizing the unclosed references to the self-closed version.
17621 !! test
17622 Generate references for unclosed references tag
17623 !! options
17624 parsoid=wt2html
17625 !! wikitext
17626 a<ref>foo</ref>
17627
17628 <references>
17629 !! html
17630 <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>
17631
17632
17633 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17634 <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>
17635 !! end
17636
17637 !! test
17638 New reference serializes on its own line
17639 !! options
17640 parsoid=wt2wt,html2wt
17641 !! wikitext
17642 foo
17643 <references />
17644 !! html
17645 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17646 !! end
17647
17648 #### ----------------------------------------------------------------
17649 #### The following section of tests are primarily to test
17650 #### wikitext escaping capabilities of Parsoid. Given that
17651 #### escaping can be done any number of ways, the wikitext (input)
17652 #### is always adjusted to reflect how Parsoid adds nowiki
17653 #### escape tags.
17654 ####
17655 #### We are marking several tests as parsoid-only since the
17656 #### HTML in the result section is different from what the
17657 #### PHP parser generates for it.
17658 #### ----------------------------------------------------------------
17659
17660
17661 #### --------------- Headings ---------------
17662 #### 0. Unnested
17663 #### 1. Nested inside html <h1>=foo=</h1>
17664 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17665 #### 3. Nested inside html with wikitext split by html tags
17666 #### 4. No escape needed
17667 #### 5. Empty headings <h1></h1>
17668 #### 6. Heading chars in SOL context
17669 #### ----------------------------------------
17670 !! test
17671 Headings: 0. Unnested
17672 !! options
17673 parsoid
17674 !! wikitext
17675 <nowiki>=foo=</nowiki>
17676
17677 <nowiki> =foo= </nowiki>
17678 <!--cmt-->
17679 <nowiki>=foo=</nowiki>
17680
17681 =foo''a''<nowiki>=</nowiki>
17682 !! html
17683 <p><span typeof="mw:Nowiki">=foo=</span></p>
17684
17685 <p><span typeof="mw:Nowiki"> =foo= </span>
17686 <!--cmt-->
17687 <span typeof="mw:Nowiki">=foo=</span></p>
17688
17689 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17690 !!end
17691
17692 !! test
17693 Headings: 1. Nested inside html
17694 (New headings and existing headings are handled differently)
17695 !! options
17696 parsoid=html2wt
17697 !! wikitext
17698 = =foo= =
17699
17700 == =foo= ==
17701
17702 === =foo= ===
17703
17704 =<nowiki>=foo=</nowiki>=
17705 ==<nowiki>=foo=</nowiki>==
17706 ===<nowiki>=foo=</nowiki>===
17707 ====<nowiki>=foo=</nowiki>====
17708 =====<nowiki>=foo=</nowiki>=====
17709 ======<nowiki>=foo=</nowiki>======
17710
17711 !! html
17712 <h1>=foo=</h1>
17713 <h2>=foo=</h2>
17714 <h3>=foo=</h3>
17715
17716 <h1 data-parsoid='{}'>=foo=</h1>
17717 <h2 data-parsoid='{}'>=foo=</h2>
17718 <h3 data-parsoid='{}'>=foo=</h3>
17719 <h4 data-parsoid='{}'>=foo=</h4>
17720 <h5 data-parsoid='{}'>=foo=</h5>
17721 <h6 data-parsoid='{}'>=foo=</h6>
17722 !!end
17723
17724 !! test
17725 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17726 !! options
17727 parsoid=html2wt
17728 !! wikitext
17729 = foo =
17730 <nowiki>*</nowiki>bar
17731
17732 = foo =
17733 =bar
17734
17735 = foo =
17736 <nowiki>=bar=</nowiki>
17737 !! html
17738 <h1>foo</h1>*bar
17739 <h1>foo</h1>=bar
17740 <h1>foo</h1>=bar=
17741 !!end
17742
17743 !! test
17744 Headings: 3. Nested inside html with wikitext split by html tags
17745 !! options
17746 parsoid=html2wt
17747 !! wikitext
17748 = ='''bold'''<nowiki>foo=</nowiki> =
17749 !! html
17750 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17751 !!end
17752
17753 !! test
17754 Headings: 4a. No escaping needed (testing just h1 and h2)
17755 !! options
17756 parsoid=html2wt
17757 !! wikitext
17758 = =foo =
17759
17760 = foo= =
17761
17762 = =foo= =
17763
17764 = =foo= bar =
17765
17766 == =foo ==
17767
17768 == foo= ==
17769
17770 = ''=''foo= =
17771
17772 = <nowiki>=</nowiki> =
17773 !! html
17774 <h1>=foo</h1>
17775 <h1>foo=</h1>
17776 <h1> =foo= </h1>
17777 <h1>=foo= bar</h1>
17778 <h2>=foo</h2>
17779 <h2>foo=</h2>
17780 <h1><i>=</i>foo=</h1>
17781 <h1><span typeof="mw:Nowiki">=</span></h1>
17782 !!end
17783
17784 !! test
17785 Headings: 4b. No escaping needed (inside p-tags)
17786 !! options
17787 parsoid=html2wt
17788 !! wikitext
17789 ===
17790 =foo= x
17791 =foo= <s></s>
17792 !! html
17793 <p>===
17794 =foo= x
17795 =foo= <s></s>
17796 </p>
17797 !!end
17798
17799 !! test
17800 Headings: 5. Empty headings
17801 !! options
17802 parsoid
17803 !! wikitext
17804 =<nowiki/>=
17805
17806 ==<nowiki/>==
17807
17808 ===<nowiki/>===
17809
17810 ====<nowiki/>====
17811
17812 =====<nowiki/>=====
17813
17814 ======<nowiki/>======
17815 !! html
17816 <h1></h1>
17817 <h2></h2>
17818 <h3></h3>
17819 <h4></h4>
17820 <h5></h5>
17821 <h6></h6>
17822 !!end
17823
17824 !! test
17825 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17826 !! options
17827 parsoid
17828 !! wikitext
17829 <nowiki>=a=</nowiki>
17830
17831 <nowiki>=a=</nowiki>
17832
17833 <nowiki>=a=</nowiki>
17834
17835 <nowiki>=a=</nowiki>
17836 !! html
17837 <p>=a=</p>
17838 <p>=a= </p>
17839 <p>=a= </p>
17840 <p>=a= </p>
17841 !!end
17842
17843 !! test
17844 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17845 !! options
17846 parsoid
17847 !! wikitext
17848 <nowiki>=a=
17849 b</nowiki>
17850
17851 <nowiki>=a=
17852 b</nowiki>
17853
17854 <nowiki>=a=
17855 b</nowiki>
17856
17857 <nowiki>=a=
17858 b</nowiki>
17859 !! html
17860 <p>=a=
17861 b</p>
17862 <p>=a=
17863 b</p>
17864 <p>=a=
17865 b</p>
17866 <p>=a=
17867 b</p>
17868 </p>
17869 !!end
17870
17871 !! test
17872 Headings: 6c. Heading chars in SOL context (leading newline break)
17873 !! options
17874 parsoid
17875 !! wikitext
17876 a
17877 <nowiki>=b=</nowiki>
17878 !! html
17879 <p>a
17880 =b=</p>
17881 !!end
17882
17883 !! test
17884 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17885 !! options
17886 parsoid
17887 !! wikitext
17888 <!--c0--><nowiki>=a=</nowiki>
17889
17890 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17891 !! html
17892 <p><!--c0-->=a=</p>
17893 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17894 !!end
17895
17896 !! test
17897 Headings: 6d. Heading chars in SOL context (No escaping needed)
17898 !! options
17899 parsoid=html2wt
17900 !! wikitext
17901 =a=<div>b</div>
17902 !! html
17903 =a=<div>b</div>
17904 !!end
17905
17906 #### --------------- Lists ---------------
17907 #### 0. Outside nests (*foo, etc.)
17908 #### 1. Nested inside html <ul><li>*foo</li></ul>
17909 #### 2. Inside definition lists
17910 #### 3. Only bullets at start should be escaped
17911 #### 4. No escapes needed
17912 #### 5. No unnecessary escapes
17913 #### 6. Escape bullets in SOL position
17914 #### 7. Escape bullets in a multi-line context
17915 #### ----------------------------------------
17916
17917 !! test
17918 Lists: 0. Outside nests
17919 !! wikitext
17920 <nowiki>*</nowiki>foo
17921
17922 <nowiki>#</nowiki>foo
17923 !! html
17924 <p>*foo
17925 </p><p>#foo
17926 </p>
17927 !!end
17928
17929 !! test
17930 Lists: 1. Nested inside html
17931 !! wikitext
17932 *<nowiki>*foo</nowiki>
17933
17934 *<nowiki>#foo</nowiki>
17935
17936 *<nowiki>:foo</nowiki>
17937
17938 *<nowiki>;foo</nowiki>
17939
17940 #<nowiki>*foo</nowiki>
17941
17942 #<nowiki>#foo</nowiki>
17943
17944 #<nowiki>:foo</nowiki>
17945
17946 #<nowiki>;foo</nowiki>
17947 !! html
17948 <ul>
17949 <li>*foo
17950 </li>
17951 </ul>
17952 <ul>
17953 <li>#foo
17954 </li>
17955 </ul>
17956 <ul>
17957 <li>:foo
17958 </li>
17959 </ul>
17960 <ul>
17961 <li>;foo
17962 </li>
17963 </ul>
17964 <ol>
17965 <li>*foo
17966 </li>
17967 </ol>
17968 <ol>
17969 <li>#foo
17970 </li>
17971 </ol>
17972 <ol>
17973 <li>:foo
17974 </li>
17975 </ol>
17976 <ol>
17977 <li>;foo
17978 </li>
17979 </ol>
17980
17981 !!end
17982
17983 !! test
17984 Lists: 2. Inside definition lists
17985 !! wikitext
17986 ;<nowiki>;foo</nowiki>
17987
17988 ;<nowiki>:foo</nowiki>
17989
17990 ;<nowiki>:foo</nowiki>
17991 :bar
17992
17993 :<nowiki>:foo</nowiki>
17994 !! html
17995 <dl>
17996 <dt>;foo
17997 </dt>
17998 </dl>
17999 <dl>
18000 <dt>:foo
18001 </dt>
18002 </dl>
18003 <dl>
18004 <dt>:foo
18005 </dt>
18006 <dd>bar
18007 </dd>
18008 </dl>
18009 <dl>
18010 <dd>:foo
18011 </dd>
18012 </dl>
18013
18014 !!end
18015
18016 !! test
18017 Lists: 3. Only bullets at start of text should be escaped
18018 !! wikitext
18019 *<nowiki>*foo*bar</nowiki>
18020
18021 *<nowiki>*foo</nowiki>''it''*bar
18022 !! html
18023 <ul>
18024 <li>*foo*bar
18025 </li>
18026 </ul>
18027 <ul>
18028 <li>*foo<i>it</i>*bar
18029 </li>
18030 </ul>
18031
18032 !!end
18033
18034 !! test
18035 Lists: 4. No escapes needed
18036 !! options
18037 parsoid
18038 !! wikitext
18039 *foo*bar
18040
18041 *''foo''*bar
18042
18043 *[[Foo]]: bar
18044
18045 *[[Foo]]*bar
18046 !! html
18047 <ul>
18048 <li>foo*bar
18049 </li>
18050 </ul>
18051 <ul>
18052 <li><i>foo</i>*bar
18053 </li>
18054 </ul>
18055 <ul>
18056 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18057 </li>
18058 </ul>
18059 <ul>
18060 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18061 </li>
18062 </ul>
18063 !!end
18064
18065 !! test
18066 Lists: 5. No unnecessary escapes
18067 !! wikitext
18068 * bar <span><nowiki>[[foo]]</nowiki></span>
18069
18070 *=bar <span><nowiki>[[foo]]</nowiki></span>
18071
18072 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18073
18074 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18075
18076 *=bar <span>foo]]</span>=
18077
18078 * <s></s>: a
18079 !! html
18080 <ul>
18081 <li> bar <span>[[foo]]</span>
18082 </li>
18083 </ul>
18084 <ul>
18085 <li>=bar <span>[[foo]]</span>
18086 </li>
18087 </ul>
18088 <ul>
18089 <li>[[bar <span>[[foo]]</span>
18090 </li>
18091 </ul>
18092 <ul>
18093 <li>]]bar <span>[[foo]]</span>
18094 </li>
18095 </ul>
18096 <ul>
18097 <li>=bar <span>foo]]</span>=
18098 </li>
18099 </ul>
18100 <ul>
18101 <li> <s></s>: a
18102 </li>
18103 </ul>
18104
18105 !!end
18106
18107 !! test
18108 Lists: 6. Escape bullets in SOL position
18109 !! options
18110 parsoid
18111 !! wikitext
18112 <!--cmt--><nowiki>*foo</nowiki>
18113 !! html
18114 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18115 !!end
18116
18117 !! test
18118 Lists: 7. Escape bullets in a multi-line context
18119 !! wikitext
18120 a
18121 <nowiki>*</nowiki>b
18122 !! html
18123 <p>a
18124 *b
18125 </p>
18126 !!end
18127
18128 #### --------------- HRs ---------------
18129 #### 1. Single line
18130 #### -----------------------------------
18131
18132 !! test
18133 HRs: 1. Single line
18134 !! options
18135 parsoid
18136 !! wikitext
18137 ----<nowiki>----</nowiki>
18138 ----=foo=
18139 ----*foo
18140 !! html
18141 <hr><span typeof="mw:Nowiki">----</span>
18142 <hr>=foo=
18143 <hr>*foo
18144 !! end
18145
18146 #### --------------- Tables ---------------
18147 #### 1a. Simple example
18148 #### 1b. No escaping needed (!foo)
18149 #### 1c. No escaping needed (|foo)
18150 #### 1d. No escaping needed (|}foo)
18151 ####
18152 #### 2a. Nested in td (<td>foo|bar</td>)
18153 #### 2b. Nested in td (<td>foo||bar</td>)
18154 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18155 ####
18156 #### 3a. Nested in th (<th>foo!bar</th>)
18157 #### 3b. Nested in th (<th>foo!!bar</th>)
18158 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18159 ####
18160 #### 4a. Escape -
18161 #### 4b. Escape +
18162 #### 4c. No escaping needed
18163 #### --------------------------------------
18164
18165 !! test
18166 Tables: 1a. Simple example
18167 !! wikitext
18168 <nowiki>{|
18169 |}</nowiki>
18170 !! html
18171 <p>{|
18172 |}
18173 </p>
18174 !! end
18175
18176 !! test
18177 Tables: 1b. No escaping needed
18178 !! wikitext
18179 !foo
18180 !! html
18181 <p>!foo
18182 </p>
18183 !! end
18184
18185 !! test
18186 Tables: 1c. No escaping needed
18187 !! wikitext
18188 |foo
18189 !! html
18190 <p>|foo
18191 </p>
18192 !! end
18193
18194 !! test
18195 Tables: 1d. No escaping needed
18196 !! wikitext
18197 |}foo
18198 !! html
18199 <p>|}foo
18200 </p>
18201 !! end
18202
18203 !! test
18204 Tables: 2a. Nested in td
18205 !! options
18206 parsoid=html2wt
18207 !! wikitext
18208 {|
18209 |<nowiki>foo|bar</nowiki>
18210 |-
18211 |x<div><nowiki>a|b</nowiki></div>
18212 |}
18213 !! html
18214 <table><tbody><tr>
18215 <td>foo|bar</td></tr>
18216 <tr><td>x<div>a|b</div></td>
18217 </tbody></table>
18218 !! end
18219
18220 !! test
18221 Tables: 2b. Nested in td
18222 !! options
18223 parsoid
18224 !! wikitext
18225 {|
18226 |<nowiki>foo||bar</nowiki>
18227 |''it''<nowiki>foo||bar</nowiki>
18228 |}
18229 !! html
18230 <table><tbody><tr>
18231 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18232 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18233 !! end
18234
18235 !! test
18236 Tables: 2c. Nested in td -- no escaping needed
18237 !! options
18238 parsoid
18239 !! wikitext
18240 {|
18241 |foo!!bar
18242 |}
18243 !! html
18244 <table><tbody><tr><td>foo!!bar
18245 </td></tr></tbody></table>
18246
18247 !! end
18248
18249 !! test
18250 Tables: 3a. Nested in th
18251 !! options
18252 parsoid
18253 !! wikitext
18254 {|
18255 !foo!bar
18256 |}
18257 !! html
18258 <table><tbody><tr><th>foo!bar
18259 </th></tr></tbody></table>
18260
18261 !! end
18262
18263 !! test
18264 Tables: 3b. Nested in th
18265 !! options
18266 parsoid
18267 !! wikitext
18268 {|
18269 !<nowiki>foo!!bar</nowiki>
18270 |}
18271 !! html
18272 <table>
18273 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18274 </tbody></table>
18275 !! end
18276
18277 !! test
18278 Tables: 3c. Nested in th -- no escaping needed
18279 !! options
18280 parsoid
18281 !! wikitext
18282 {|
18283 !<nowiki>foo||bar</nowiki>
18284 |}
18285 !! html
18286 <table><tbody><tr>
18287 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18288 !! end
18289
18290 !! test
18291 Tables: 4a. Escape -
18292 !! options
18293 parsoid
18294 !! wikitext
18295 {|
18296 !-bar
18297 |-
18298 |<nowiki>-bar</nowiki>
18299 |}
18300 !! html
18301 <table><tbody>
18302 <tr><th>-bar</th></tr>
18303 <tr>
18304 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18305 !! end
18306
18307 !! test
18308 Tables: 4b. Escape +
18309 !! options
18310 parsoid
18311 !! wikitext
18312 {|
18313 !+bar
18314 |-
18315 |<nowiki>+bar</nowiki>
18316 |}
18317 !! html
18318 <table><tbody>
18319 <tr><th>+bar</th></tr>
18320 <tr>
18321 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18322 !! end
18323
18324 !! test
18325 Tables: 4c. No escaping needed
18326 !! options
18327 parsoid
18328 !! wikitext
18329 {|
18330 |foo-bar
18331 |foo+bar
18332 |-
18333 |''foo''-bar
18334 |''foo''+bar
18335 |-
18336 |foo
18337 bar|baz
18338 +bar
18339 -bar
18340 |-
18341 |x
18342 <div>a|b</div>
18343 |}
18344 !! html
18345 <table><tbody>
18346 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18347 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18348 <tr><td>foo
18349 <p>bar|baz
18350 +bar
18351 -bar</p></td></tr>
18352 <tr><td>x
18353 <div>a|b</div></td>
18354 </tbody></table>
18355 !! end
18356
18357 !! test
18358 Tables: 4d. No escaping needed
18359 !! options
18360 parsoid
18361 !! wikitext
18362 {|
18363 |[[Foo]]-bar
18364 ||+1
18365 ||-2
18366 |}
18367 !! html
18368 <table>
18369 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18370 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18371 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18372 </tbody></table>
18373 !! end
18374
18375 !! test
18376 Tables: Digest broken attributes on table and tr tag
18377 !! options
18378 parsoid=wt2html
18379 !! wikitext
18380 {| || |} ++
18381 |- || || ++ --
18382 |- > [
18383 |}
18384 !! html
18385 <table>
18386 <tbody>
18387 <tr></tr>
18388 <tr></tr>
18389 </tbody></table>
18390 !! end
18391
18392 #### --------------- Links ----------------
18393 #### 1. Quote marks in link text
18394 #### 2. Wikilinks: Escapes needed
18395 #### 3. Wikilinks: No escapes needed
18396 #### 4. Extlinks: Escapes needed
18397 #### 5. Extlinks: No escapes needed
18398 #### --------------------------------------
18399 !! test
18400 Links 1. Quote marks in link text
18401 !! options
18402 parsoid
18403 !! wikitext
18404 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18405 !! html
18406 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18407 !! end
18408
18409 !! test
18410 Links 2. WikiLinks: Escapes needed
18411 !! options
18412 parsoid
18413 !! wikitext
18414 [[Foo|[Foobar]]]
18415 [[Foo|<nowiki>Foobar]</nowiki>]]
18416 [[Foo|x [Foobar] x]]
18417 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18418 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18419 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18420 [[Foo|<nowiki>|Bar</nowiki>]]
18421 [[Foo|<nowiki>]]bar</nowiki>]]
18422 [[Foo|<nowiki>[[bar</nowiki>]]
18423 [[Foo|<nowiki>x [[ y</nowiki>]]
18424 [[Foo|<nowiki>x ]] y</nowiki>]]
18425 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18426 !! html
18427 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18428 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18429 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18430 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18431 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18432 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18433 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18434 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18435 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18436 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18437 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18438 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18439 !! end
18440
18441 !! test
18442 Links 3. WikiLinks: No escapes needed
18443 !! options
18444 parsoid
18445 !! wikitext
18446 [[Foo|[Foobar]]
18447 [[Foo|foo|bar]]
18448 !! html
18449 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18450 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18451 !! end
18452
18453 !! test
18454 Links 4. ExtLinks: Escapes needed
18455 !! options
18456 parsoid
18457 !! wikitext
18458 [http://google.com <nowiki>[google]</nowiki>]
18459 [http://google.com <nowiki>google]</nowiki>]
18460
18461 <nowiki>[http://google.com]</nowiki>
18462
18463 <nowiki>[http://google.com google]</nowiki>
18464
18465 !! html
18466 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18467 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18468 <p>[http://google.com]</p>
18469 <p>[http://google.com google]</p>
18470 !! end
18471
18472 !! test
18473 Links 5. ExtLinks: No escapes needed
18474 !! options
18475 parsoid
18476 !! wikitext
18477 [http://google.com [google]
18478 !! html
18479 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18480 !! end
18481
18482 #### --------------- Quotes ---------------
18483 #### 1. Quotes inside <b> and <i>
18484 #### 2. Link fragments separated by <i> and <b> tags
18485 #### 3. Link fragments inside <i> and <b>
18486 #### 4. No escaping needed
18487 #### --------------------------------------
18488 !! test
18489 1. Quotes inside <b> and <i>
18490 !! options
18491 parsoid=html2wt,wt2wt
18492 !! wikitext
18493 ''<nowiki>'foo'</nowiki>''
18494 ''<nowiki>''foo''</nowiki>''
18495 ''<nowiki>'''foo'''</nowiki>''
18496 ''foo''<nowiki/>'s
18497 '''<nowiki>'foo'</nowiki>'''
18498 '''<nowiki>''foo''</nowiki>'''
18499 '''<nowiki>'''foo'''</nowiki>'''
18500 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18501 '''foo'''<nowiki/>'s
18502 '''foo''
18503 ''foo''<nowiki/>'
18504 '<nowiki/>''foo''<nowiki/>'
18505 ''''foo'''
18506 '''foo'''<nowiki/>'
18507 '<nowiki/>'''foo'''<nowiki/>'
18508 ''fools'<span> errand</span>''
18509 ''<span>fool</span>'s errand''
18510 !! html
18511 <p><i>'foo'</i>
18512 <i>''foo''</i>
18513 <i>'''foo'''</i>
18514 <i>foo</i>'s
18515 <b>'foo'</b>
18516 <b>''foo''</b>
18517 <b>'''foo'''</b>
18518 <b>foo'<i>bar'</i>baz</b>
18519 <b>foo</b>'s
18520 '<i>foo</i>
18521 <i>foo</i>'
18522 '<i>foo</i>'
18523 '<b>foo</b>
18524 <b>foo</b>'
18525 '<b>foo</b>'</p>
18526 <i>fools'<span> errand</span></i>
18527 <i><span>fool</span>'s errand</i>
18528 !! end
18529
18530 !! test
18531 2. Link fragments separated by <i> and <b> tags
18532 !! wikitext
18533 [[''foo''<nowiki>hello]]</nowiki>
18534
18535 [['''foo'''<nowiki>hello]]</nowiki>
18536 !! html
18537 <p>[[<i>foo</i>hello]]
18538 </p><p>[[<b>foo</b>hello]]
18539 </p>
18540 !! end
18541
18542 !! test
18543 3. Link fragments inside <i> and <b>
18544 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18545 this is one of the shortcomings of this format)
18546 !! wikitext
18547 ''[[foo''<nowiki>]]</nowiki>
18548
18549 '''[[foo'''<nowiki>]]</nowiki>
18550 !! html
18551 <p><i>[[foo</i>]]
18552 </p><p><b>[[foo</b>]]
18553 </p>
18554 !! end
18555
18556 !! test
18557 4. No escaping needed
18558 !! wikitext
18559 '<span>''bar''</span>'
18560 '<span>'''bar'''</span>'
18561 !! html
18562 <p>'<span><i>bar</i></span>'
18563 '<span><b>bar</b></span>'
18564 </p>
18565 !! end
18566
18567 #### ----------- Paragraphs ---------------
18568 #### 1. No unnecessary escapes
18569 #### --------------------------------------
18570
18571 !! test
18572 1. No unnecessary escapes
18573 !! wikitext
18574 bar <span><nowiki>[[foo]]</nowiki></span>
18575
18576 =bar <span><nowiki>[[foo]]</nowiki></span>
18577
18578 [[bar <span><nowiki>[[foo]]</nowiki></span>
18579
18580 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18581
18582 =bar <span>foo]]</span><nowiki>=</nowiki>
18583 !! html
18584 <p>bar <span>[[foo]]</span>
18585 </p><p>=bar <span>[[foo]]</span>
18586 </p><p>[[bar <span>[[foo]]</span>
18587 </p><p>]]bar <span>[[foo]]</span>
18588 </p><p>=bar <span>foo]]</span>=
18589 </p>
18590 !!end
18591
18592 #### ----------------------- PRE --------------------------
18593 #### 1. Leading whitespace in SOL context should be escaped
18594 #### ------------------------------------------------------
18595 !! test
18596 1. Leading whitespace in SOL context should be escaped
18597 !! options
18598 parsoid
18599 !! wikitext
18600 <nowiki> </nowiki>a
18601
18602 <nowiki> </nowiki> a
18603
18604 <nowiki> </nowiki>a(tab)
18605
18606 <nowiki> </nowiki> a
18607 <!--cmt-->
18608 <nowiki> </nowiki> a
18609
18610 a
18611 <nowiki> </nowiki>b
18612
18613 a
18614 <nowiki> </nowiki>b
18615
18616 a
18617 <nowiki> </nowiki> b
18618 !! html
18619 <p> a</p>
18620 <p> a</p>
18621 <p> a(tab)</p>
18622 <p> a</p>
18623 <p><!--cmt--> a</p>
18624 <p>a
18625 b</p>
18626 <p>a
18627 b</p>
18628 <p>a
18629 b</p>
18630 !! end
18631
18632 #### --------------- Behavior Switches --------------------
18633 !! test
18634 1. Valid behavior switches should be escaped
18635 !! options
18636 parsoid=html2wt
18637 !! wikitext
18638 <nowiki>__TOC__</nowiki>
18639 !! html
18640 __TOC__
18641 !! end
18642
18643 !! test
18644 2. Invalid behavior switches should not be escaped
18645 !! options
18646 parsoid=html2wt
18647 !! wikitext
18648 __TOO__
18649 __|__
18650 !! html
18651 __TOO__
18652 __|__
18653 !! end
18654
18655 #### --------------- HTML tags ---------------
18656 #### 1. a tags
18657 #### 2. other tags
18658 #### 3. multi-line html tag
18659 #### 4. extension tags
18660 #### -----------------------------------------
18661 !! test
18662 1. a tags
18663 !! options
18664 parsoid
18665 !! wikitext
18666 <a href="http://google.com">google</a>
18667 !! html
18668 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18669 !! end
18670
18671 !! test
18672 2. other tags
18673 !! wikitext
18674 <nowiki><div>foo</div>
18675 <div style="color:red">foo</div></nowiki>
18676 !! html
18677 <p>&lt;div&gt;foo&lt;/div&gt;
18678 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18679 </p>
18680 !! end
18681
18682 !! test
18683 3. multi-line html tag
18684 !! wikitext
18685 <nowiki><div
18686 >foo</div
18687 ></nowiki>
18688 !! html
18689 <p>&lt;div
18690 &gt;foo&lt;/div
18691 &gt;
18692 </p>
18693 !! end
18694
18695 !! test
18696 4. extension tags
18697 !! wikitext
18698 <nowiki><ref>foo</ref></nowiki>
18699
18700 <nowiki><ref>bar</nowiki>
18701
18702 baz<nowiki></ref></nowiki>
18703 !! html
18704 <p>&lt;ref&gt;foo&lt;/ref&gt;
18705 </p><p>&lt;ref&gt;bar
18706 </p><p>baz&lt;/ref&gt;
18707 </p>
18708 !! end
18709
18710 #### --------------- Others ---------------
18711 !! test
18712 Escaping nowikis
18713 !! wikitext
18714 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18715 !! html
18716 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18717 </p>
18718 !! end
18719
18720 ## The quote-char in the input is necessary for triggering the bug
18721 !! test
18722 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18723 !! options
18724 parsoid=wt2wt,html2wt
18725 !! wikitext
18726 foo's bar :
18727 !! html
18728 <p>foo's bar :</p>
18729 !! end
18730
18731 !! test
18732
18733 Tag-like HTML structures are passed through as text
18734 !! wikitext
18735 <x y>
18736
18737 <x.y>
18738
18739 <x-y>
18740
18741 1>2
18742
18743 x<y
18744
18745 a>b
18746
18747 1<d e>f
18748 !! html
18749 <p>&lt;x y&gt;
18750 </p><p>&lt;x.y&gt;
18751 </p><p>&lt;x-y&gt;
18752 </p><p>1&gt;2
18753 </p><p>x&lt;y
18754 </p><p>a&gt;b
18755 </p><p>1&lt;d e&gt;f
18756 </p>
18757 !! end
18758
18759
18760 # This was a bug in the PHP parser (see bug 17663 and its dups,
18761 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18762 !! test
18763 Tag names followed by punctuation should not be recognized as tags
18764 !! wikitext
18765 <s.ome> text
18766 !! html
18767 <p>&lt;s.ome&gt; text
18768 </p>
18769 !! end
18770
18771 !! test
18772 HTML tag with necessary entities in attributes
18773 !! wikitext
18774 <span title="&amp;amp;">foo</span>
18775 !! html
18776 <p><span title="&amp;amp;">foo</span>
18777 </p>
18778 !! end
18779
18780 !! test
18781 HTML tag with 'unnecessary' entity encoding in attributes
18782 !! wikitext
18783 <span title="&amp;">foo</span>
18784 !! html
18785 <p><span title="&amp;">foo</span>
18786 </p>
18787 !! end
18788
18789 !! test
18790 HTML tag with broken attribute value quoting
18791 !! wikitext
18792 <span title="Hello world>Foo</span>
18793 !! html
18794 <p><span>Foo</span>
18795 </p>
18796 !! end
18797
18798 !! test
18799 Parsoid-only: HTML tag with broken attribute value quoting
18800 !! options
18801 parsoid
18802 !! wikitext
18803 <span title="Hello world>Foo</span>
18804 !! html
18805 <p><span title="Hello world">Foo</span>
18806 </p>
18807 !! end
18808
18809 !! test
18810 Table with broken attribute value quoting
18811 !! wikitext
18812 {|
18813 | title="Hello world|Foo
18814 |}
18815 !! html
18816 <table>
18817 <tr>
18818 <td>Foo
18819 </td></tr></table>
18820
18821 !! end
18822
18823 !! test
18824 Table with broken attribute value quoting on consecutive lines
18825 !! wikitext
18826 {|
18827 | title="Hello world|Foo
18828 | style="color:red|Bar
18829 |}
18830 !! html
18831 <table>
18832 <tr>
18833 <td>Foo
18834 </td>
18835 <td>Bar
18836 </td></tr></table>
18837
18838 !! end
18839
18840 !! test
18841 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18842 !! options
18843 parsoid
18844 !! wikitext
18845 {|
18846 | title="Hello world|Foo
18847 | style="color:red|Bar
18848 |}
18849 !! html
18850 <table><tbody>
18851 <tr>
18852 <td title="Hello world">Foo
18853 </td><td style="color: red">Bar
18854 </td></tr></tbody></table>
18855
18856 !! end
18857
18858 !! test
18859 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18860 !! options
18861 parsoid
18862 !! wikitext
18863 {{}}
18864 !! html
18865 {{}}
18866 !! end
18867
18868 !! test
18869 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18870 !! options
18871 parsoid
18872 !! wikitext
18873 }}{{
18874 !! html
18875 }}{{
18876 !! end
18877
18878 !!test
18879 Accept empty td cell attribute
18880 !! wikitext
18881 {|
18882 | align="center" | foo || |
18883 |}
18884 !! html
18885 <table>
18886 <tr>
18887 <td align="center"> foo </td>
18888 <td>
18889 </td></tr></table>
18890
18891 !!end
18892
18893 !!test
18894 Non-empty attributes in th-cells
18895 !! wikitext
18896 {|
18897 ! Foo !! style="color: red" | Bar
18898 |}
18899 !! html
18900 <table>
18901 <tr>
18902 <th> Foo </th>
18903 <th style="color: red"> Bar
18904 </th></tr></table>
18905
18906 !!end
18907
18908 !!test
18909 Accept empty attributes in th-cells
18910 !! wikitext
18911 {|
18912 !| foo !!| bar
18913 |}
18914 !! html
18915 <table>
18916 <tr>
18917 <th> foo </th>
18918 <th> bar
18919 </th></tr></table>
18920
18921 !!end
18922
18923 !!test
18924 Empty table rows go away
18925 !! wikitext
18926 {|
18927 | Hello
18928 | there
18929 |- class="foo"
18930 |-
18931 |}
18932 !! html
18933 <table>
18934 <tr>
18935 <td> Hello
18936 </td>
18937 <td> there
18938 </td></tr>
18939
18940 </table>
18941
18942 !! end
18943
18944 ###
18945 ### Parsoid-centric tests for testing RTing of inter-element separators
18946 ### Edge cases not tested by existing parser tests and specific to
18947 ### Parsoid-specific serialization strategies.
18948 ###
18949
18950 !!test
18951 RT-ed inter-element separators should be valid separators
18952 !! wikitext
18953 {|
18954 |- [[foo]]
18955 |}
18956 !! html
18957 <table>
18958
18959 </table>
18960
18961 !!end
18962
18963 !!test
18964 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
18965 (Parsoid-only since PHP parser relies on Tidy for correct output)
18966 !!options
18967 parsoid
18968 !! wikitext
18969 {|
18970 |<small>foo
18971 bar
18972 |}
18973
18974 {|
18975 |<small>foo<small>
18976 |}
18977 !! html
18978 !!end
18979
18980 !!test
18981 Empty TD followed by TD with tpl-generated attribute
18982 !! wikitext
18983 {|
18984 |-
18985 |
18986 |{{echo|style='color:red'}}|foo
18987 |}
18988 !! html
18989 <table>
18990
18991 <tr>
18992 <td>
18993 </td>
18994 <td>foo
18995 </td></tr></table>
18996
18997 !!end
18998
18999 !!test
19000 Indented table with an empty td
19001 !! wikitext
19002 {|
19003 |-
19004 |
19005 |foo
19006 |}
19007 !! html
19008 <table>
19009
19010 <tr>
19011 <td>
19012 </td>
19013 <td>foo
19014 </td></tr></table>
19015
19016 !!end
19017
19018 !!test
19019 Empty TR followed by a template-generated TR
19020 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19021 !!options
19022 parsoid
19023 !! wikitext
19024 {|
19025 |-
19026 {{echo|<tr><td>foo</td></tr>}}
19027 |}
19028 !! html
19029 <table>
19030 <tbody>
19031 <tr></tr>
19032 <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}}]}'>
19033 <td>foo</td></tr>
19034 </tbody></table>
19035 !!end
19036
19037 ## PHP and parsoid output differ for this, and since this is primarily
19038 ## for testing Parsoid's serializer, marking this Parsoid only
19039 !!test
19040 Empty TR followed by mixed-ws-comment line should RT correctly
19041 !!options
19042 parsoid
19043 !! wikitext
19044 {|
19045 |-
19046 <!--c-->
19047 |-
19048 <!--c--> <!--d-->
19049 |}
19050 !! html
19051 <table>
19052 <tbody>
19053 <tr></tr>
19054 <!--c-->
19055 <tr>
19056 <!--c--> </tr><!--d-->
19057 </tbody></table>
19058
19059 !!end
19060
19061 !!test
19062 Multi-line image caption generated by templates with/without trailing newlines
19063 !!options
19064 parsoid
19065 !! wikitext
19066 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19067 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19068 !! html
19069 <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>
19070 <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>
19071
19072 !!end
19073
19074 ## PHP emits broken html for this, and since this is primarily
19075 ## a Parsoid serializer test, marking this Parsoid only
19076 !!test
19077 Improperly nested inline or quotes tags with whitespace in between
19078 !!options
19079 parsoid
19080 !! wikitext
19081 <span> <s>x</span> </s>
19082 ''' ''x''' ''
19083 !! html
19084 <p><span> <s>x</s></span><s> </s>
19085 <b> <i>x</i></b><i> </i>
19086 </p>
19087 !!end
19088
19089 !!test
19090 Encapsulate protected attributes from wt
19091 !!options
19092 parsoid
19093 !! wikitext
19094 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19095 !! html
19096 <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>
19097 </body>
19098 !!end
19099
19100 ## Currently the p-wrapper is fragile in how adds / removes transformations.
19101 ## Having nested or stray pre tags results in the attempt to add duplicates,
19102 ## causing an assertion fail. This test tries to prevent that situation.
19103 !!test
19104 Ensure ParagraphWrapper can deal with stray closing pre tags
19105 !!options
19106 parsoid=wt2html
19107 !! wikitext
19108 plain text</pre>
19109 !! html
19110 plain text
19111 !!end
19112
19113 !!test
19114 1. Ensure fostered text content is wrapped in spans
19115 !!options
19116 parsoid=wt2html
19117 !! wikitext
19118 <table>hi</table><table>ho</table>
19119 !! html
19120 <span>hi</span>
19121 <table></table>
19122 <span>ho</span>
19123 <table></table>
19124 !!end
19125
19126 !!test
19127 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19128 !!options
19129 parsoid=wt2html,wt2wt
19130 !! wikitext
19131 <table>
19132 <tr> || ||
19133 <td> a
19134 </table>
19135 !! html
19136 <span> || ||</span>
19137 <table>
19138 <tbody>
19139 <tr>
19140 <td> a</td></tr>
19141 </tbody></table>
19142 !!end
19143
19144 !!test
19145 Encapsulation properly handles null DSR information from foster box
19146 !!options
19147 parsoid=wt2html,wt2wt
19148 !! wikitext
19149 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19150 !! html
19151 <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;
19152 <table>foo
19153 <tr>
19154 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19155 <table>
19156 <tbody>
19157 <tr>
19158 <td>bar</td></tr></tbody></table>
19159 !!end
19160
19161 !!test
19162 1. Encapsulate foster-parented transclusion content
19163 !!options
19164 parsoid=wt2wt,wt2html
19165 !! wikitext
19166 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19167 !! html
19168 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19169 <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
19170 <tr>
19171 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19172 <table>
19173 <tbody>
19174 <tr>
19175 <td>bar</td></tr></tbody></table>
19176 !!end
19177
19178 !!test
19179 2. Encapsulate foster-parented transclusion content
19180 !!options
19181 parsoid=wt2wt,wt2html
19182 !! wikitext
19183 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19184 !! html
19185 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19186 <table>
19187 <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>
19188 <tr>
19189 <td>bar</td></tr></table>&quot;]}">foo</div>
19190 <table>
19191 <tbody>
19192 <tr>
19193 <td>bar</td></tr></tbody></table>
19194 !!end
19195
19196 !!test
19197 3. Encapsulate foster-parented transclusion content
19198 !!options
19199 parsoid=wt2wt,wt2html
19200 !! wikitext
19201 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19202 !! html
19203 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19204 <table>
19205 <div>
19206 <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>
19207 <tr>
19208 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19209 <p>foo</p></div>
19210 <table>
19211 <tbody>
19212 <tr>
19213 <td>bar</td></tr></tbody></table>
19214 !!end
19215
19216 !!test
19217 4. 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 5. Encapsulate foster-parented transclusion content
19238 !!options
19239 parsoid=wt2wt,wt2html
19240 !! wikitext
19241 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19242 !! html
19243 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19244 <table>
19245 <tr>
19246 <td>
19247 <div>
19248 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</span>
19249 <table>
19250 <tbody>
19251 <tr>
19252 <td>
19253 <div>
19254 <p>foo</p></div></td></tr></tbody></table>
19255 !!end
19256
19257 !!test
19258 6. Encapsulate foster-parented transclusion content
19259 !!options
19260 parsoid=wt2wt,wt2html
19261 !! wikitext
19262 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19263 !! html
19264 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19265 <table>
19266 <tr>
19267 <td>
19268 <div>
19269 <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>
19270 <table>
19271 <tbody>
19272 <tr>
19273 <td>
19274 <div>
19275 <p>foo</p></div></td></tr></tbody></table>
19276 <p>ok</p>
19277 !!end
19278
19279 !!test
19280 7. Encapsulate foster-parented transclusion content
19281 !!options
19282 parsoid=wt2wt,wt2html
19283 !! wikitext
19284 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19285 !! html
19286 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19287 <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;
19288 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19289 <td>bar</td></table>&quot;]}">foo</p>
19290 <table>
19291 <tbody>
19292 <tr>
19293 <td>bar</td></tr></tbody></table>
19294 !!end
19295
19296 !!test
19297 8. Encapsulate foster-parented transclusion content
19298 !!options
19299 parsoid=wt2wt,wt2html
19300 !! wikitext
19301 {{echo|a
19302 }}{|{{echo|style='color:red'}}
19303 |-
19304 |b
19305 |}
19306 !! html
19307 <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>
19308 <table>
19309 <tbody>
19310 <tr>
19311 <td>b</td></tr></tbody></table>
19312 !!end
19313
19314 !!test
19315 Table in fosterable position
19316 !!options
19317 parsoid=wt2html,wt2wt
19318 !! wikitext
19319 {{OpenTable}}
19320 <div>
19321 {|
19322 |}
19323 </div>
19324 |}
19325 !! html
19326 <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="{}">
19327 </span>
19328 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19329
19330 <table>
19331 </table>
19332 !!end
19333
19334 !!test
19335 Support <object> element with .data attribute
19336 !!options
19337 parsoid=html2wt
19338 !! wikitext
19339 <object data="test.swf"></object>
19340 !! html
19341 <object data="test.swf"></object>
19342 !!end
19343
19344 # -----------------------------------------------------------------
19345 # The following section of tests are primarily to spec requirements
19346 # around serialization of new/edited content.
19347 #
19348 # All these tests are marked Parsoid html2wt and html2html only
19349 # ----------------------------------------------------------------
19350
19351 !! test
19352 Image: Modifying size of an image (1)
19353 !! options
19354 parsoid=html2wt
19355 !! wikitext
19356 [[Image:Foobar.jpg|200x200px]]
19357 !! html
19358 <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>
19359 !!end
19360
19361 !! test
19362 Image: Modifying size of an image (2)
19363 !! options
19364 parsoid=html2wt
19365 !! wikitext
19366 [[Image:Foobar.jpg|500x500px]]
19367 !! html
19368 <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>
19369 !!end
19370
19371 # note that the data-parsoid value conflicts with the figure's class
19372 !! test
19373 Image: Modifying alignment of an image (bug 48665)
19374 !! options
19375 parsoid=html2wt
19376 !! wikitext
19377 [[Image:Foobar.jpg|thumb|caption|left]]
19378 !! html
19379 <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>
19380 !! end
19381
19382 !! test
19383 Image: Modifying valign of an image (bug 49221)
19384 !! options
19385 parsoid=html2wt
19386 !! wikitext
19387 [[File:Foobar.jpg|20px|text-top]]
19388 !! html
19389 <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>
19390 !! end
19391
19392 !! test
19393 Image: Modifying alt attribute of an image (bug 56400)
19394 !! options
19395 parsoid=html2wt
19396 !! wikitext
19397 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19398 !! html
19399 <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>
19400 !!end
19401
19402 !! test
19403 Image: Modifying caption of an image
19404 !! options
19405 parsoid=html2wt
19406 !! wikitext
19407 [[Image:Foobar.jpg|thumb|new caption]]
19408 !! html
19409 <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>
19410 !!end
19411
19412 !! test
19413 Image: empty alt attribute (bug 48924)
19414 !! options
19415 parsoid
19416 !! wikitext
19417 [[File:Foobar.jpg|thumb|alt=|bar]]
19418 !! html
19419 <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>
19420 !! end
19421
19422 #!! test
19423 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19424 #!! options
19425 #parsoid=html2wt
19426 #language=ar
19427 #!! input
19428 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19429 #!! result
19430 #<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>
19431 #!! end
19432
19433 !! test
19434 Image: Block level image should have \n before and after
19435 !! options
19436 parsoid
19437 !! wikitext
19438 123
19439 [[File:Foobar.jpg|right|thumb|150x150px]]
19440 456
19441 !! html
19442 <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>
19443 !!end
19444
19445 !! test
19446 Image: New block level image should have \n before and after (existing
19447 content)
19448 !! options
19449 parsoid
19450 !! wikitext
19451 123
19452 [[File:Foobar.jpg|right|thumb|150x150px]]
19453 456
19454 !! html
19455 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19456 <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>
19457 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19458 !!end
19459
19460 !! test
19461 Images: upright option (parsoid)
19462 !! options
19463 parsoid
19464 !! wikitext
19465 [[File:Foobar.jpg|thumb|upright|caption]]
19466 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19467 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19468 !! html
19469 <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>
19470 !!end
19471
19472 !! test
19473 Images: upright option is ignored on inline and frame images (parsoid)
19474 !! options
19475 parsoid
19476 !! wikitext
19477 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19478 !! html
19479 <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>
19480 !!end
19481
19482 !! test
19483 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19484 !! options
19485 parsoid=html2wt
19486 !! wikitext
19487 * foo
19488 !! html
19489 <ul>
19490 <li><p>foo</p></li>
19491 </ul>
19492 !! end
19493
19494 !! test
19495 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19496 !! options
19497 parsoid=html2wt
19498 !! wikitext
19499 * foo
19500 !! html
19501 <ul> <li>foo</li></ul>
19502 !! end
19503
19504 !! test
19505 Don't strip leading whitespace when handling indent-pre suppressing tags
19506 !! options
19507 parsoid=html2wt
19508 !! wikitext
19509 {|
19510 | indented row
19511 |}
19512 <blockquote>
19513 '''This is very bold of you!'''
19514
19515 {|
19516 |
19517 indented cell (no pre-wrapping!)
19518 |}
19519 </blockquote>
19520 foo
19521 <div>bar</div>
19522 !! html
19523 <table>
19524 <tr><td> indented row</td></tr>
19525 </table>
19526 <blockquote><p>
19527 <b>This is very bold of you!</b>
19528 </p>
19529 <table><tr><td>
19530 indented cell (no pre-wrapping!)
19531 </td></tr></table>
19532 </blockquote>
19533 <p>foo</p>
19534 <div>bar</div>
19535 !! end
19536
19537 !! test
19538 Strip leading whitespace when handling indent-pre inducing tags
19539 !! options
19540 parsoid=html2wt
19541 !! wikitext
19542 foo
19543 <span>bar</span>
19544
19545 <span>foo2
19546 </span>bar2
19547
19548 <div>foo</div>
19549 <span>bar</span>
19550
19551 <div>
19552 <span>foo</span>
19553 </div>
19554 !! html
19555 <p>foo</p>
19556 <span>bar</span>
19557
19558 <span>foo2
19559 </span>bar2
19560
19561 <div>foo</div>
19562 <span>bar</span>
19563
19564 <div>
19565 <span>foo</span>
19566 </div>
19567 !! end
19568
19569 !! test
19570 Lists: Add space after bullets
19571 !! options
19572 parsoid=html2wt
19573 !! wikitext
19574 * foo
19575 * bar
19576 * <span> baz</span>
19577 !! html
19578 <ul>
19579 <li>foo</li>
19580 <li> bar</li>
19581 <li><span> baz</span></li>
19582 </ul>
19583 !! end
19584
19585 !! test
19586 Lists: Dont insert newlines in a serialized list item.
19587 !! options
19588 parsoid=html2wt
19589 !! wikitext
19590 * a<br>b
19591 * c
19592 !! html
19593 <ul><li>a<br>b</li><li>c</li></ul>
19594 !! end
19595
19596 !! test
19597 Headings: Add space before/after == (Bug 51744)
19598 !! options
19599 parsoid=html2wt
19600 !! wikitext
19601 == foo ==
19602
19603 == bar ==
19604
19605 == baz ==
19606
19607 == <span> baz</span> ==
19608 !! html
19609 <h2>foo</h2>
19610 <h2> bar</h2>
19611 <h2>baz </h2>
19612 <h2><span> baz</span></h2>
19613 !! end
19614
19615 !! test
19616 Parsoid: Serialize positional parameters with = in them as named parameter
19617 !! options
19618 parsoid=html2wt
19619 !! wikitext
19620 {{echo|1 = f=oo}}
19621
19622 {{echo|1 = f=oo|2 = bar}}
19623
19624 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19625 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19626 {{echo|<nowiki>f=oo</nowiki>|bar}}
19627 !! html
19628 <p about="#mwt1" typeof="mw:Transclusion"
19629 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19630
19631 <p about="#mwt1" typeof="mw:Transclusion"
19632 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
19633
19634 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19635 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19636 <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>
19637 !! end
19638
19639 !! test
19640 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19641 !! options
19642 parsoid=html2wt
19643 !! wikitext
19644 <div>a
19645 b
19646 </div>
19647 <div>a
19648 b
19649 </div>
19650 <div>
19651 a
19652
19653 b
19654 </div>
19655 !! html
19656 <div>a<p>b</p></div>
19657 <div>a
19658 <p>b</p></div>
19659 <div>
19660 a
19661 <p>b</p></div>
19662 !! end
19663
19664 #-----------------------------
19665 # I/B quote minimization tests
19666 #-----------------------------
19667
19668 !! test
19669 1. I/B quote minimization: wikitext-only tags should be combined
19670 !! options
19671 parsoid=html2wt
19672 !! wikitext
19673 ''AB''
19674
19675 '''AB'''
19676
19677 ''A'''B'''''
19678
19679 '''A''B'''''
19680
19681 '''A''BC''D'''
19682
19683 '''''AB'''''
19684
19685 '''''AB'''''
19686
19687 '''''AB'''''
19688 !! html
19689 <p><i>A</i><i>B</i></p>
19690 <p><b>A</b><b>B</b></p>
19691 <p><i>A</i><b><i>B</i></b></p>
19692 <p><b>A</b><i><b>B</b></i></p>
19693 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19694 <p><i><b>A</b></i><i><b>B</b></i></p>
19695 <p><i><b>A</b></i><b><i>B</i></b></p>
19696 <p><b><i>A</i></b><i><b>B</b></i></p>
19697 !! end
19698
19699 !! test
19700 2. I/B quote minimization: wikitext and html tags should not be combined
19701 !! options
19702 parsoid=html2wt
19703 !! wikitext
19704 ''A''<i>B</i>
19705
19706 ''A'''''<i>B</i>'''
19707 !! html
19708 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19709 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19710 !! end
19711
19712 !! test
19713 3. I/B quote minimization: templated content stops minimization
19714 !! options
19715 parsoid=html2wt
19716 !! wikitext
19717 ''A''{{echo|''B''}}
19718
19719 ''A''{{echo|'''''B'''''}}
19720 !! html
19721 <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>
19722 <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>
19723 !! end
19724
19725 !! test
19726 4. I/B quote minimization: new content should be mimimized with adjacent old content
19727 !! options
19728 parsoid=html2wt
19729 !! wikitext
19730 ''AB''
19731
19732 '''AB'''
19733
19734 ''A'''B'''''
19735 !! html
19736 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19737 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19738 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19739 !! end
19740
19741 #------------------------------------
19742 # End of I/B quote minimization tests
19743 #------------------------------------
19744
19745 !!test
19746 Bug 54262: New entities
19747 !! options
19748 parsoid=html2wt
19749 !! wikitext
19750 foo
19751 !! html
19752 <span typeof="mw:Entity">foo</span>
19753 !! end
19754
19755 ## Note that there is no wikitext output for 'unknownproperty' ##
19756 ## Unknown magic words are silently dropped ##
19757
19758 !! test
19759 Magic words
19760 !! options
19761 parsoid=html2wt
19762 !! wikitext
19763 __TOC__
19764 __NOTOC__
19765 __FORCETOC__
19766 __INDEX__
19767 __NOINDEX__
19768 __NOGALLERY__
19769 __NOEDITSECTION__
19770 __NOTITLECONVERT__
19771 __NOCONTENTCONVERT__
19772 !! html
19773 <meta property='mw:PageProp/toc' />
19774 <meta property='mw:PageProp/notoc' />
19775 <meta property='mw:PageProp/forcetoc' />
19776 <meta property='mw:PageProp/index' />
19777 <meta property='mw:PageProp/noindex' />
19778 <meta property='mw:PageProp/nogallery' />
19779 <meta property='mw:PageProp/noeditsection' />
19780 <meta property='mw:PageProp/notitleconvert' />
19781 <meta property='mw:PageProp/nocontentconvert' />
19782 <meta property='mw:PageProp/unknownproperty' />
19783 !! end
19784
19785 !! test
19786 Consecutive <pre>s should not get merged
19787 !! options
19788 parsoid=html2wt,html2html
19789 !! wikitext
19790 a
19791
19792 b
19793
19794 c
19795
19796 d
19797
19798 e
19799
19800
19801
19802 f
19803 !! html
19804 <pre>a</pre><pre>b</pre>
19805
19806 <pre>c
19807 </pre><pre>
19808 d</pre>
19809
19810 <pre>e
19811
19812 </pre><pre>
19813
19814 f</pre>
19815 !! end
19816
19817 !! test
19818 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
19819 !! options
19820 parsoid=html2wt
19821 !! wikitext
19822 [[Special:BookSources/1234567890|ISBN 1234567895]]
19823 !! html
19824 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
19825 !! end
19826
19827 !! test
19828 Edited RFC links not serializable as RFC links should serialize as extlinks
19829 !! options
19830 parsoid=html2wt
19831 !! wikitext
19832 [//tools.ietf.org/html/rfc123 New RFC]
19833 !! html
19834 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
19835 !! end
19836
19837 !! test
19838 Edited PMID links not serializable as PMID links should serialize as extlinks
19839 !! options
19840 parsoid=html2wt
19841 !! wikitext
19842 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
19843 !! html
19844 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
19845 !! end
19846
19847 !! test
19848 Edited Redirect link should emit a non-piped wikitext link
19849 !! options
19850 parsoid=html2wt
19851 !! wikitext
19852 #REDIRECT [[Bar]]
19853 !! html
19854 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
19855 !! end
19856
19857 # -----------------------------------------------------------------
19858 # End of section for Parsoid-only html2wt tests for serialization
19859 # of new content
19860 # -----------------------------------------------------------------
19861
19862 TODO:
19863 more images
19864 more tables
19865 character entities
19866 and much more
19867 Try for 100% code coverage