Merge "Cleanup a bunch of tests and add todos"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 # notoc disable table of contents
30 #
31 # You can also set the following parser properties via test options:
32 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
33 # wgLinkHolderBatchSize, wgRawHtml
34 #
35 # For testing purposes, temporary articles can created:
36 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
37 # where '/' denotes a newline.
38
39 # This is the standard article assumed to exist.
40 !! article
41 Main Page
42 !! text
43 blah blah
44 !! endarticle
45
46 !!article
47 Template:Foo
48 !!text
49 FOO
50 !!endarticle
51
52 !! article
53 Template:Blank
54 !! text
55 !! endarticle
56
57 !! article
58 Template:pipe
59 !! text
60 |
61 !! endarticle
62
63 !!article
64 MediaWiki:bad image list
65 !!text
66 * [[File:Bad.jpg]] except [[Nasty page]]
67 !!endarticle
68
69 !! article
70 Template:inner list
71 !! text
72 * item 1
73 !! endarticle
74
75 !! article
76 Template:tbl-start
77 !! text
78 {|
79 !! endarticle
80
81 !! article
82 Template:tbl-end
83 !! text
84 |}
85 !! endarticle
86
87 !! article
88 Template:!
89 !! text
90 |
91 !! endarticle
92
93 !! article
94 Template:echo
95 !! text
96 {{{1}}}
97 !! endarticle
98
99 !! article
100 Template:echo_with_span
101 !! text
102 <span>{{{1}}}</span>
103 !! endarticle
104
105 !! article
106 Template:echo_with_div
107 !! text
108 <div>{{{1}}}</div>
109 !! endarticle
110
111 !! article
112 Template:attr_str
113 !! text
114 {{{1}}}="{{{2}}}"
115 !! endarticle
116
117 !! article
118 Template:table_attribs
119 !! text
120 <noinclude>
121 |</noinclude>style="color: red"| Foo
122 !! endarticle
123
124 !! article
125 Template:table_cells
126 !! text
127 {{table_attribs}} || Bar || Baz
128 !! endarticle
129
130 !! article
131 Template:image_attribs
132 !! text
133 <noinclude>
134 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
135 !! endarticle
136
137 !! article
138 A?b
139 !! text
140 Weirdo titles!
141 !! endarticle
142
143 !!article
144 Template:Bullet
145 !!text
146 * Bar
147 !!endarticle
148
149 !!article
150 Template:OpenTable
151 !!text
152 {|
153 !!endarticle
154
155 ###
156 ### Basic tests
157 ###
158 !! test
159 Blank input
160 !! wikitext
161 !! html
162 !! end
163
164
165 !! test
166 Simple paragraph
167 !! wikitext
168 This is a simple paragraph.
169 !! html
170 <p>This is a simple paragraph.
171 </p>
172 !! end
173
174 !! test
175 Paragraphs with extra newline spacing
176 !! wikitext
177 foo
178
179 bar
180
181
182 baz
183
184
185
186 booz
187 !! html
188 <p>foo
189 </p><p>bar
190 </p><p><br />
191 baz
192 </p><p><br />
193 </p><p>booz
194 </p>
195 !! end
196
197 !! test
198 Paragraphs with newline spacing with comment lines in between
199 !! wikitext
200 ----
201 a
202 <!--foo-->
203 b
204 ----
205 a
206 <!--foo--><!--More than 1 comment, still stripped-->
207 b
208 ----
209 a
210 <!--foo--> <!----> <!-- bar -->
211 b
212 ----
213 a
214 <!--foo-->
215
216 b
217 ----
218 a
219
220 <!--foo-->
221 b
222 ----
223 a
224 <!--foo-->
225
226
227 b
228 ----
229 a
230
231
232 <!--foo-->
233 b
234 ----
235 !! html
236 <hr />
237 <p>a
238 b
239 </p>
240 <hr />
241 <p>a
242 b
243 </p>
244 <hr />
245 <p>a
246 b
247 </p>
248 <hr />
249 <p>a
250 </p><p>b
251 </p>
252 <hr />
253 <p>a
254 </p><p>b
255 </p>
256 <hr />
257 <p>a
258 </p><p><br />
259 b
260 </p>
261 <hr />
262 <p>a
263 </p><p><br />
264 b
265 </p>
266 <hr />
267
268 !! end
269
270 !! test
271 Paragraphs with newline spacing with non-empty white-space lines in between
272 !! wikitext
273 ----
274 a
275
276 b
277 ----
278 a
279
280
281 b
282 ----
283 !! html
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p><br />
291 b
292 </p>
293 <hr />
294
295 !! end
296
297 !! test
298 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
299 !! wikitext
300 ----
301 a
302 <!--foo-->
303 b
304 ----
305 a
306 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
307 b
308 ----
309 a
310
311 <!--foo-->
312 <!--bar-->
313 b
314 ----
315 a
316
317 <!--foo-->
318 <!--bar-->
319
320 b
321 ----
322 !! html
323 <hr />
324 <p>a
325 b
326 </p>
327 <hr />
328 <p>a
329 b
330 </p>
331 <hr />
332 <p>a
333 </p><p>b
334 </p>
335 <hr />
336 <p>a
337 </p><p><br />
338 b
339 </p>
340 <hr />
341
342 !! end
343
344 !! test
345 Extra newlines: More paragraphs with indented comment
346 !! wikitext
347 a
348
349 <!--boo-->
350
351 b
352 !! html
353 <p>a
354 </p><p><br />
355 b
356 </p>
357 !!end
358
359 !! test
360 Extra newlines followed by heading
361 !! wikitext
362 a
363
364
365
366 =b=
367 [[a]]
368
369
370 =b=
371 !! html
372 <p>a
373 </p><p><br />
374 </p>
375 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
376 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
377 </p><p><br />
378 </p>
379 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
380
381 !! end
382
383 !! test
384 Extra newlines between heading and content are swallowed
385 !! wikitext
386 =b=
387
388
389
390 [[a]]
391 !! html
392 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
393 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
394 </p>
395 !! end
396
397 !! test
398 Parsing an URL
399 !! wikitext
400 http://fr.wikipedia.org/wiki/🍺
401 <!-- EasterEgg we love beer, better be able be able to link to it -->
402 !! html
403 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
404 </p>
405 !! end
406
407 !! test
408 Simple list
409 !! wikitext
410 * Item 1
411 * Item 2
412 !! html
413 <ul>
414 <li> Item 1
415 </li>
416 <li> Item 2
417 </li>
418 </ul>
419
420 !! end
421
422 !! test
423 Italics and bold
424 !! wikitext
425 * plain
426 * plain''italic''plain
427 * plain''italic''plain''italic''plain
428 * plain'''bold'''plain
429 * plain'''bold'''plain'''bold'''plain
430 * plain''italic''plain'''bold'''plain
431 * plain'''bold'''plain''italic''plain
432 * plain''italic'''bold-italic'''italic''plain
433 * plain'''bold''bold-italic''bold'''plain
434 * plain'''''bold-italic'''italic''plain
435 * plain'''''bold-italic''bold'''plain
436 * plain''italic'''bold-italic'''''plain
437 * plain'''bold''bold-italic'''''plain
438 * plain l'''italic''plain
439 * plain l''''bold''' plain
440 !! html
441 <ul>
442 <li> plain
443 </li>
444 <li> plain<i>italic</i>plain
445 </li>
446 <li> plain<i>italic</i>plain<i>italic</i>plain
447 </li>
448 <li> plain<b>bold</b>plain
449 </li>
450 <li> plain<b>bold</b>plain<b>bold</b>plain
451 </li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain
453 </li>
454 <li> plain<b>bold</b>plain<i>italic</i>plain
455 </li>
456 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
457 </li>
458 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
459 </li>
460 <li> plain<i><b>bold-italic</b>italic</i>plain
461 </li>
462 <li> plain<b><i>bold-italic</i>bold</b>plain
463 </li>
464 <li> plain<i>italic<b>bold-italic</b></i>plain
465 </li>
466 <li> plain<b>bold<i>bold-italic</i></b>plain
467 </li>
468 <li> plain l'<i>italic</i>plain
469 </li>
470 <li> plain l'<b>bold</b> plain
471 </li>
472 </ul>
473
474 !! end
475
476 # this example taken from the [[simple:Moon]] article (bug 47326)
477 !! test
478 Italics and possessives (1)
479 !! wikitext
480 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
481 !! html
482 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
483 </p>
484 !! end
485
486 # this example taken from [[en:Flaming Pie]] (bug 49926)
487 !! test
488 Italics and possessives (2)
489 !! wikitext
490 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
491 !! html
492 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
493 </p>
494 !! end
495
496 # this example taken from [[en:Dictionary]] (bug 49926)
497 !! test
498 Italics and possessives (3)
499 !! wikitext
500 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
501 !! html
502 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
503 </p>
504 !! end
505
506
507 ###
508 ### 2-quote opening sequence tests
509 ###
510 !! test
511 Italics and bold: 2-quote opening sequence: (2,2)
512 !! wikitext
513 ''foo''
514 !! html
515 <p><i>foo</i>
516 </p>
517 !!end
518
519
520 !! test
521 Italics and bold: 2-quote opening sequence: (2,3)
522 !! wikitext
523 ''foo'''
524 !! html
525 <p><i>foo'</i>
526 </p>
527 !!end
528
529
530 !! test
531 Italics and bold: 2-quote opening sequence: (2,4)
532 !! wikitext
533 ''foo''''
534 !! html
535 <p><i>foo''</i>
536 </p>
537 !!end
538
539
540 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
541 !! test
542 Italics and bold: 2-quote opening sequence: (2,5)
543 !! wikitext
544 ''foo'''''
545 !! html/php
546 <p><i>foo</i>
547 </p>
548 !! html/parsoid
549 <p><i>foo</i><b></b>
550 </p>
551 !!end
552
553
554 ###
555 ### 3-quote opening sequence tests
556 ###
557
558 !! test
559 Italics and bold: 3-quote opening sequence: (3,2)
560 !! wikitext
561 '''foo''
562 !! html
563 <p>'<i>foo</i>
564 </p>
565 !!end
566
567
568 !! test
569 Italics and bold: 3-quote opening sequence: (3,3)
570 !! wikitext
571 '''foo'''
572 !! html
573 <p><b>foo</b>
574 </p>
575 !!end
576
577
578 !! test
579 Italics and bold: 3-quote opening sequence: (3,4)
580 !! wikitext
581 '''foo''''
582 !! html
583 <p><b>foo'</b>
584 </p>
585 !!end
586
587
588 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
589 !! test
590 Italics and bold: 3-quote opening sequence: (3,5)
591 !! wikitext
592 '''foo'''''
593 !! html/php
594 <p><b>foo</b>
595 </p>
596 !! html/parsoid
597 <p><b>foo</b><i></i>
598 </p>
599 !!end
600
601
602 ###
603 ### 4-quote opening sequence tests
604 ###
605
606 !! test
607 Italics and bold: 4-quote opening sequence: (4,2)
608 !! wikitext
609 ''''foo''
610 !! html
611 <p>''<i>foo</i>
612 </p>
613 !!end
614
615
616 !! test
617 Italics and bold: 4-quote opening sequence: (4,3)
618 !! wikitext
619 ''''foo'''
620 !! html
621 <p>'<b>foo</b>
622 </p>
623 !!end
624
625
626 !! test
627 Italics and bold: 4-quote opening sequence: (4,4)
628 !! wikitext
629 ''''foo''''
630 !! html
631 <p>'<b>foo'</b>
632 </p>
633 !!end
634
635
636 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
637 !! test
638 Italics and bold: 4-quote opening sequence: (4,5)
639 !! wikitext
640 ''''foo'''''
641 !! html/php
642 <p>'<b>foo</b>
643 </p>
644 !! html/parsoid
645 <p>'<b>foo</b><i></i>
646 </p>
647 !!end
648
649
650 ###
651 ### 5-quote opening sequence tests
652 ###
653
654 !! test
655 Italics and bold: 5-quote opening sequence: (5,2)
656 !! options
657 !! wikitext
658 '''''foo''
659 !! html
660 <p><b><i>foo</i></b>
661 </p>
662 !!end
663
664
665 !! test
666 Italics and bold: 5-quote opening sequence: (5,3)
667 !! wikitext
668 '''''foo'''
669 !! html
670 <p><i><b>foo</b></i>
671 </p>
672 !!end
673
674
675 !! test
676 Italics and bold: 5-quote opening sequence: (5,4)
677 !! wikitext
678 '''''foo''''
679 !! html
680 <p><i><b>foo'</b></i>
681 </p>
682 !!end
683
684
685 !! test
686 Italics and bold: 5-quote opening sequence: (5,5)
687 !! wikitext
688 '''''foo'''''
689 !! html
690 <p><i><b>foo</b></i>
691 </p>
692 !!end
693
694 ###
695 ### multiple quote sequences in a line
696 ###
697 !! test
698 Italics and bold: multiple quote sequences: (2,4,2)
699 !! wikitext
700 ''foo''''bar''
701 !! html
702 <p><i>foo'<b>bar</b></i>
703 </p>
704 !!end
705
706
707 !! test
708 Italics and bold: multiple quote sequences: (2,4,3)
709 !! wikitext
710 ''foo''''bar'''
711 !! html
712 <p><i>foo'<b>bar</b></i>
713 </p>
714 !!end
715
716
717 !! test
718 Italics and bold: multiple quote sequences: (2,4,4)
719 !! wikitext
720 ''foo''''bar''''
721 !! html
722 <p><i>foo'<b>bar'</b></i>
723 </p>
724 !!end
725
726
727 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,2)
730 !! wikitext
731 '''foo''''bar''
732 !! html/php
733 <p><b>foo'</b>bar
734 </p>
735 !! html/parsoid
736 <p><b>foo'</b>bar<i></i>
737 </p>
738 !!end
739
740
741 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
742 !! test
743 Italics and bold: multiple quote sequences: (3,4,3)
744 !! wikitext
745 '''foo''''bar'''
746 !! html/php
747 <p><b>foo'</b>bar
748 </p>
749 !! html/parsoid
750 <p><b>foo'</b>bar<b></b>
751 </p>
752 !!end
753
754 ###
755 ### other quote tests
756 ###
757 !! test
758 Italics and bold: other quote tests: (2,3,5)
759 !! wikitext
760 ''this is about '''foo's family'''''
761 !! html
762 <p><i>this is about <b>foo's family</b></i>
763 </p>
764 !!end
765
766
767 !! test
768 Italics and bold: other quote tests: (2,(3,3),2)
769 !! wikitext
770 ''this is about '''foo's''' family''
771 !! html
772 <p><i>this is about <b>foo's</b> family</i>
773 </p>
774 !!end
775
776
777 !! test
778 Italics and bold: other quote tests: (3,2,3,2)
779 !! wikitext
780 '''this is about ''foo'''s family''
781 !! html
782 <p><b>this is about <i>foo</i></b><i>s family</i>
783 </p>
784 !!end
785
786
787 !! test
788 Italics and bold: other quote tests: (3,2,3,3)
789 !! options
790 !! wikitext
791 '''this is about ''foo'''s family'''
792 !! html
793 <p>'<i>this is about </i>foo<b>s family</b>
794 </p>
795 !!end
796
797
798 !! test
799 Italics and bold: other quote tests: (3,(2,2),3)
800 !! wikitext
801 '''this is about ''foo's'' family'''
802 !! html
803 <p><b>this is about <i>foo's</i> family</b>
804 </p>
805 !!end
806
807
808 !! test
809 Italicized possessive
810 !! wikitext
811 The ''[[Main Page]]'''s talk page.
812 !! html
813 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
814 </p>
815 !! end
816
817 !! test
818 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
819 (Requires tidy for PHP parser output to be fixed up)
820 !! options
821 parsoid=wt2html,wt2wt
822 !! wikitext
823 {|
824 !''a!!''b
825 |''a||''b
826 |}
827 !! html
828 <table>
829 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
830 <td><i>a</i></td><td><i>b</i></td></tr>
831 </tbody></table>
832 !! end
833
834 ###
835 ### Non-html5 tags
836 ###
837
838 !! test
839 Non-html5 tags should be accepted
840 !! wikitext
841 <center>''foo''</center>
842 <big>''foo''</big>
843 <font>''foo''</font>
844 <strike>''foo''</strike>
845 <tt>''foo''</tt>
846 !! html
847 <center><i>foo</i></center>
848 <p><big><i>foo</i></big>
849 <font><i>foo</i></font>
850 <strike><i>foo</i></strike>
851 <tt><i>foo</i></tt>
852 </p>
853 !! end
854
855 !! test
856 <wbr> is valid wikitext (bug 52468)
857 !! wikitext
858 <wbr>
859 !! html
860 <p><wbr />
861 </p>
862 !! end
863
864 # <strike> is HTML4, <s> is HTML4/5.
865 !! test
866 <s> or <strike> for strikethrough
867 !! wikitext
868 <strike>strike</strike>
869
870 <s>s</s>
871 !! html
872 <p><strike>strike</strike>
873 </p><p><s>s</s>
874 </p>
875 !! end
876
877 !! test
878 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
879 !! wikitext
880 <b→> doesn't work! </b→>
881
882 <bä> doesn't work! </bä>
883
884 <boo> works fine </boo>
885
886 <s.foo>s.foo</s.foo>
887
888 <sub-ID#1>
889 !! html
890 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
891 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
892 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
893 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
894 </p><p>&lt;sub-ID#1&gt;
895 </p>
896 !! end
897
898 !! test
899 Isolated close tags should be treated as literal text (bug 52760)
900 !! wikitext
901 </b>
902
903 <s.foo>s</s>
904 !! html
905 <p>&lt;/b&gt;
906 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
907 </p>
908 !! end
909
910 ###
911 ### Special characters
912 ###
913
914 !! test
915 Bare pipe character (bug 52363)
916 !! wikitext
917 |
918 !! html
919 <p>|
920 </p>
921 !! end
922
923 !! test
924 Bare pipe character from a template (bug 52363)
925 !! wikitext
926 {{pipe}}
927 !! html
928 <p>|
929 </p>
930 !! end
931
932 ###
933 ### <nowiki> test cases
934 ###
935
936 !! test
937 <nowiki> unordered list
938 !! wikitext
939 <nowiki>* This is not an unordered list item.</nowiki>
940 !! html
941 <p>* This is not an unordered list item.
942 </p>
943 !! end
944
945 !! test
946 <nowiki> spacing
947 !! wikitext
948 <nowiki>Lorem ipsum dolor
949
950 sed abit.
951 sed nullum.
952
953 :and a colon
954 </nowiki>
955 !! html
956 <p>Lorem ipsum dolor
957
958 sed abit.
959 sed nullum.
960
961 :and a colon
962
963 </p>
964 !! end
965
966 !! test
967 nowiki 3
968 !! wikitext
969 :There is not nowiki.
970 :There is <nowiki>nowiki</nowiki>.
971
972 #There is not nowiki.
973 #There is <nowiki>nowiki</nowiki>.
974
975 *There is not nowiki.
976 *There is <nowiki>nowiki</nowiki>.
977 !! html
978 <dl>
979 <dd>There is not nowiki.
980 </dd>
981 <dd>There is nowiki.
982 </dd>
983 </dl>
984 <ol>
985 <li>There is not nowiki.
986 </li>
987 <li>There is nowiki.
988 </li>
989 </ol>
990 <ul>
991 <li>There is not nowiki.
992 </li>
993 <li>There is nowiki.
994 </li>
995 </ul>
996
997 !! end
998
999 !! test
1000 Entities inside <nowiki>
1001 !! wikitext
1002 <nowiki>&lt;</nowiki>
1003 !! html
1004 <p>&lt;
1005 </p>
1006 !! end
1007
1008 !! test
1009 Entities inside template parameters
1010 !! options
1011 parsoid
1012 !! wikitext
1013 {{echo|&ndash;}}
1014 !! html
1015 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span>
1016 </p>
1017 !! end
1018
1019 ###
1020 ### Comments
1021 ###
1022 !! test
1023 Comments and Indent-Pre
1024 !! wikitext
1025 <!-- comment 1 --> asdf
1026
1027 <!-- comment 1 --> asdf
1028 <!-- comment 2 -->
1029
1030 <!-- comment 1 --> asdf
1031 <!-- comment 2 -->xyz
1032
1033 <!-- comment 1 --> asdf
1034 <!-- comment 2 --> xyz
1035 !! html
1036 <pre>asdf
1037 </pre>
1038 <pre>asdf
1039 </pre>
1040 <pre>asdf
1041 </pre>
1042 <p>xyz
1043 </p>
1044 <pre>asdf
1045 xyz
1046 </pre>
1047 !! end
1048
1049 !! test
1050 Comment test 2a
1051 !! wikitext
1052 asdf
1053 <!-- comment 1 -->
1054 jkl
1055 !! html
1056 <p>asdf
1057 jkl
1058 </p>
1059 !! end
1060
1061 !! test
1062 Comment test 2b
1063 !! wikitext
1064 asdf
1065 <!-- comment 1 -->
1066
1067 jkl
1068 !! html
1069 <p>asdf
1070 </p><p>jkl
1071 </p>
1072 !! end
1073
1074 !! test
1075 Comment test 3
1076 !! wikitext
1077 asdf
1078 <!-- comment 1 -->
1079 <!-- comment 2 -->
1080 jkl
1081 !! html
1082 <p>asdf
1083 jkl
1084 </p>
1085 !! end
1086
1087 !! test
1088 Comment test 4
1089 !! wikitext
1090 asdf<!-- comment 1 -->jkl
1091 !! html
1092 <p>asdfjkl
1093 </p>
1094 !! end
1095
1096 !! test
1097 Comment spacing
1098 !! wikitext
1099 a
1100 <!-- foo --> b <!-- bar -->
1101 c
1102 !! html
1103 <p>a
1104 </p>
1105 <pre> b
1106 </pre>
1107 <p>c
1108 </p>
1109 !! end
1110
1111 !! test
1112 Comment whitespace
1113 !! wikitext
1114 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1115 !! html
1116
1117 !! end
1118
1119 !! test
1120 Comment semantics and delimiters
1121 !! wikitext
1122 <!-- --><!----><!-----><!------>
1123 !! html
1124
1125 !! end
1126
1127 !! test
1128 Comment semantics and delimiters, redux
1129 !! wikitext
1130 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1131 -- foo -- funky huh? ... -->
1132 !! html
1133
1134 !! end
1135
1136 !! test
1137 Comment semantics and delimiters: directors cut
1138 !! wikitext
1139 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1140 everything starting with < followed by !-- until the first -- and > we see,
1141 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1142 -->-->
1143 !! html
1144 <p>--&gt;
1145 </p>
1146 !! end
1147
1148 !! test
1149 Comment semantics: nesting
1150 !! wikitext
1151 <!--<!-- no, we're not going to do anything fancy here -->-->
1152 !! html
1153 <p>--&gt;
1154 </p>
1155 !! end
1156
1157 !! test
1158 Comment semantics: unclosed comment at end
1159 !! wikitext
1160 <!--This comment will run out to the end of the document
1161 !! html
1162
1163 !! end
1164
1165 !! test
1166 Comment in template title
1167 !! wikitext
1168 {{f<!---->oo}}
1169 !! html
1170 <p>FOO
1171 </p>
1172 !! end
1173
1174 !! test
1175 Comment on its own line post-expand
1176 !! wikitext
1177 a
1178 {{blank}}<!---->
1179 b
1180 !! html
1181 <p>a
1182 </p><p>b
1183 </p>
1184 !! end
1185
1186 !! test
1187 Comment on its own line post-expand with non-significant whitespace
1188 !! wikitext
1189 a
1190 {{blank}} <!---->
1191 b
1192 !! html
1193 <p>a
1194 </p><p>b
1195 </p>
1196 !! end
1197
1198 ###
1199 ### paragraph wrapping tests
1200 ###
1201 !! test
1202 No block tags
1203 !! wikitext
1204 a
1205
1206 b
1207 !! html
1208 <p>a
1209 </p><p>b
1210 </p>
1211 !! end
1212
1213 !! test
1214 Block tag on one line (<div>)
1215 !! wikitext
1216 a <div>foo</div>
1217
1218 b
1219 !! html
1220 a <div>foo</div>
1221 <p>b
1222 </p>
1223 !! end
1224
1225 !! test
1226 Block tag on one line (<blockquote>)
1227 !! wikitext
1228 a <blockquote>foo</blockquote>
1229
1230 b
1231 !! html
1232 a <blockquote>foo</blockquote>
1233 <p>b
1234 </p>
1235 !! end
1236
1237 !! test
1238 Block tag on both lines (<div>)
1239 !! wikitext
1240 a <div>foo</div>
1241
1242 b <div>foo</div>
1243 !! html
1244 a <div>foo</div>
1245 b <div>foo</div>
1246
1247 !! end
1248
1249 !! test
1250 Block tag on both lines (<blockquote>)
1251 !! wikitext
1252 a <blockquote>foo</blockquote>
1253
1254 b <blockquote>foo</blockquote>
1255 !! html
1256 a <blockquote>foo</blockquote>
1257 b <blockquote>foo</blockquote>
1258
1259 !! end
1260
1261 !! test
1262 Multiple lines without block tags
1263 !! wikitext
1264 <div>foo</div> a
1265 b
1266 c
1267 d<!--foo--> e
1268 x <div>foo</div> z
1269 !! html
1270 <div>foo</div> a
1271 <p>b
1272 c
1273 d e
1274 </p>
1275 x <div>foo</div> z
1276
1277 !! end
1278
1279 !! test
1280 Empty lines between lines with block tags
1281 !! wikitext
1282 <div></div>
1283
1284
1285 <div></div>a
1286
1287 b
1288 <div>a</div>b
1289
1290 <div>b</div>d
1291
1292
1293 <div>e</div>
1294 !! html
1295 <div></div>
1296 <p><br />
1297 </p>
1298 <div></div>a
1299 <p>b
1300 </p>
1301 <div>a</div>b
1302 <div>b</div>d
1303 <p><br />
1304 </p>
1305 <div>e</div>
1306
1307 !! end
1308
1309 ## PHP parser emits output which is broken
1310 !! test
1311 Unclosed HTML p-tags should be handled properly
1312 !! wikitext
1313 <div><p>foo</div>
1314 a
1315
1316 b
1317 !! html/parsoid
1318 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1319 <p>a</p>
1320 <p>b</p>
1321 !! end
1322
1323 ###
1324 ### Preformatted text
1325 ###
1326 !! test
1327 Preformatted text
1328 !! wikitext
1329 This is some
1330 Preformatted text
1331 With ''italic''
1332 And '''bold'''
1333 And a [[Main Page|link]]
1334 !! html
1335 <pre>This is some
1336 Preformatted text
1337 With <i>italic</i>
1338 And <b>bold</b>
1339 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1340 </pre>
1341 !! end
1342
1343 !! test
1344 Tabs don't trigger preformatted text
1345 !! wikitext
1346 This is not
1347 preformatted text.
1348 This is preformatted text.
1349 So is this.
1350 !! html
1351 <p> This is not
1352 preformatted text.
1353 </p>
1354 <pre>This is preformatted text.
1355 So is this.
1356 </pre>
1357 !! end
1358
1359 !! test
1360 Ident preformatting with inline content
1361 !! wikitext
1362 a
1363 ''b''
1364 !! html
1365 <pre>a
1366 <i>b</i>
1367 </pre>
1368 !! end
1369
1370 !! test
1371 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1372 !! wikitext
1373 <pre><nowiki>
1374 <b>
1375 <cite>
1376 <em>
1377 </nowiki></pre>
1378 !! html
1379 <pre>
1380 &lt;b&gt;
1381 &lt;cite&gt;
1382 &lt;em&gt;
1383 </pre>
1384
1385 !! end
1386
1387 !! test
1388 Regression with preformatted in <center>
1389 !! wikitext
1390 <center>
1391 Blah
1392 </center>
1393 !! html
1394 <center>
1395 <pre>Blah
1396 </pre>
1397 </center>
1398
1399 !! end
1400
1401 !! test
1402 Bug 52763: Preformatted in <blockquote>
1403 !! wikitext
1404 <blockquote>
1405 Blah
1406 {|
1407 |
1408 indented cell (no pre-wrapping!)
1409 |}
1410 </blockquote>
1411 !! html
1412 <blockquote>
1413 <p> Blah
1414 </p>
1415 <table>
1416 <tr>
1417 <td>
1418 <p> indented cell (no pre-wrapping!)
1419 </p>
1420 </td></tr></table>
1421 </blockquote>
1422
1423 !! end
1424
1425 !! test
1426 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1427 !! wikitext
1428 <blockquote>
1429 Foo
1430
1431 Bar
1432 </blockquote>
1433 !! html
1434 <blockquote>
1435 <p>Foo
1436 </p><p>Bar
1437 </p>
1438 </blockquote>
1439
1440 !! end
1441
1442 !! test
1443 Bug 15491: <ins>/<del> in blockquote
1444 !! wikitext
1445 <blockquote>
1446 Foo <del>bar</del> <ins>baz</ins> quux
1447 </blockquote>
1448 !! html
1449 <blockquote>
1450 <p>Foo <del>bar</del> <ins>baz</ins> quux
1451 </p>
1452 </blockquote>
1453
1454 !! end
1455
1456 # Note that the p-wrapping is newline sensitive, which could be
1457 # considered a bug: tidy will wrap only the 'Foo' in the example
1458 # below in a <p> tag. (see comment 23-25 of bug #6200)
1459 !! test
1460 Bug 15491: <ins>/<del> in blockquote (2)
1461 !! wikitext
1462 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1463 </blockquote>
1464 !! html
1465 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1466 </blockquote>
1467
1468 !! end
1469
1470 !! test
1471 <pre> with attributes (bug 3202)
1472 !! wikitext
1473 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1474 !! html
1475 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1476
1477 !! end
1478
1479 !! test
1480 <pre> with width attribute (bug 3202)
1481 !! wikitext
1482 <pre width="8">Narrow screen goodies</pre>
1483 !! html
1484 <pre width="8">Narrow screen goodies</pre>
1485
1486 !! end
1487
1488 !! test
1489 <pre> with forbidden attribute (bug 3202)
1490 !! wikitext
1491 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1492 !! html
1493 <pre width="8">Narrow screen goodies</pre>
1494
1495 !! end
1496
1497 !! test
1498 Entities inside <pre>
1499 !! wikitext
1500 <pre>&lt;</pre>
1501 !! html
1502 <pre>&lt;</pre>
1503
1504 !! end
1505
1506 !! test
1507 <pre> with forbidden attribute values (bug 3202)
1508 !! wikitext
1509 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1510 !! html
1511 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1512
1513 !! end
1514
1515 !! test
1516 <nowiki> inside <pre> (bug 13238)
1517 !! wikitext
1518 <pre>
1519 <nowiki>
1520 </pre>
1521 <pre>
1522 <nowiki></nowiki>
1523 </pre>
1524 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1525 !! html
1526 <pre>
1527 &lt;nowiki&gt;
1528 </pre>
1529 <pre>
1530
1531 </pre>
1532 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1533
1534 !! end
1535
1536 !! test
1537 <nowiki> and <pre> preference (first one wins)
1538 !! wikitext
1539 <pre>
1540 <nowiki>
1541 </pre>
1542 </nowiki>
1543 </pre>
1544
1545 <nowiki>
1546 <pre>
1547 <nowiki>
1548 </pre>
1549 </nowiki>
1550 </pre>
1551
1552 !! html
1553 <pre>
1554 &lt;nowiki&gt;
1555 </pre>
1556 <p>&lt;/nowiki&gt;
1557 &lt;/pre&gt;
1558 </p><p>
1559 &lt;pre&gt;
1560 &lt;nowiki&gt;
1561 &lt;/pre&gt;
1562
1563 &lt;/pre&gt;
1564 </p>
1565 !! end
1566
1567 !! test
1568 </pre> inside nowiki
1569 !! wikitext
1570 <nowiki></pre></nowiki>
1571 !! html
1572 <p>&lt;/pre&gt;
1573 </p>
1574 !! end
1575
1576 !! test
1577 Empty pre; pre inside other HTML tags (bug 54946)
1578 !! wikitext
1579 a
1580
1581 <div><pre>
1582 foo
1583 </pre></div>
1584 <pre></pre>
1585 !! html
1586 <p>a
1587 </p>
1588 <div><pre>
1589 foo
1590 </pre></div>
1591 <pre></pre>
1592
1593 !! end
1594
1595 !! test
1596 HTML pre followed by indent-pre
1597 !! wikitext
1598 <pre>foo</pre>
1599 bar
1600 !! html
1601 <pre>foo</pre>
1602 <pre>bar
1603 </pre>
1604 !! end
1605
1606 !!test
1607 Block tag pre
1608 !!options
1609 parsoid
1610 !! wikitext
1611 <p><pre>foo</pre></p>
1612 !! html
1613 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1614 !!end
1615
1616 !!test
1617 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1618 !! wikitext
1619 {{echo|}}
1620 !! html
1621
1622 !!end
1623
1624 !!test
1625 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1626 !! wikitext
1627 {{echo|
1628 foo}}
1629 !! html
1630 <p>foo
1631 </p>
1632 !!end
1633
1634 !! test
1635 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1636 !! wikitext
1637 {{echo|a
1638 b}}
1639 !! html
1640 <pre>a
1641 </pre>
1642 <p>b
1643 </p>
1644 !!end
1645
1646 !! test
1647 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1648 !! wikitext
1649 {{echo|a
1650 b
1651 c
1652 d
1653 e
1654 }}
1655 !! html
1656 <pre>a
1657 </pre>
1658 <p>b
1659 c
1660 </p>
1661 <pre>d
1662 </pre>
1663 <p>e
1664 </p>
1665 !!end
1666
1667 !!test
1668 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1669 !! wikitext
1670 {{echo| foo}}
1671
1672 {{echo| foo}}{{echo| bar}}
1673
1674 {{echo| foo}}
1675 {{echo| bar}}
1676
1677 {{echo|<!--cmt--> foo}}
1678
1679 <!--cmt-->{{echo| foo}}
1680
1681 {{echo|{{echo| }}bar}}
1682 !! html
1683 <pre>foo
1684 </pre>
1685 <pre>foo bar
1686 </pre>
1687 <pre>foo
1688 bar
1689 </pre>
1690 <pre>foo
1691 </pre>
1692 <pre>foo
1693 </pre>
1694 <pre>bar
1695 </pre>
1696 !!end
1697
1698 !! test
1699 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1700 !! wikitext
1701 {{echo| }}a
1702
1703 {{echo|
1704 }}a
1705
1706 {{echo|
1707 b}}
1708
1709 {{echo|a
1710 }}b
1711
1712 {{echo|a
1713 }} b
1714 !! html
1715 <pre>a
1716 </pre>
1717 <p><br />
1718 </p>
1719 <pre>a
1720 </pre>
1721 <p><br />
1722 </p>
1723 <pre>b
1724 </pre>
1725 <p>a
1726 </p>
1727 <pre>b
1728 </pre>
1729 <p>a
1730 </p>
1731 <pre>b
1732 </pre>
1733 !!end
1734
1735 !! test
1736 Things that look like <pre> tags aren't treated as such
1737 !! wikitext
1738 Barack Obama <President> of the United States
1739 !! html
1740 <p>Barack Obama &lt;President&gt; of the United States
1741 </p>
1742 !! end
1743
1744 !! test
1745 Parsoid: handle pre with space after attribute
1746 !! options
1747 parsoid=wt2html
1748 !! wikitext
1749 <pre style="width:50%;" >{{echo|foo}}</pre>
1750 !! html
1751 <pre style="width:50%;">{{echo|foo}}</pre>
1752 !! end
1753
1754 # TODO / maybe: fix wt2wt for this
1755 !! test
1756 Parsoid: Don't paragraph-wrap fosterable content
1757 !! options
1758 parsoid=wt2html
1759 !! wikitext
1760 {|
1761 <td></td>
1762 <td></td>
1763
1764
1765
1766 |}
1767 !! html
1768 <table>
1769
1770 <tbody>
1771 <tr>
1772 <td></td>
1773
1774 <td></td></tr>
1775
1776
1777
1778 </tbody></table>
1779 !! end
1780
1781 !! test
1782 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1783 !! options
1784 parsoid=wt2html
1785 !! wikitext
1786 {|
1787 <td>
1788 <td>
1789 </td>
1790
1791
1792
1793 |}
1794 !! html
1795 <table>
1796
1797 <tbody>
1798 <tr>
1799 <td></td>
1800
1801 <td>
1802 </td></tr>
1803
1804
1805
1806 </tbody></table>
1807 !! end
1808
1809
1810 #--------------------------------------------------------------------
1811 # Transclusion parameter whitespace stripping tests
1812 # Behavior is different for positional and named parameters
1813 #--------------------------------------------------------------------
1814 !! test
1815 Templates: Strip leading and trailing whitespace from named-param values
1816 !! wikitext
1817 {{echo|1= a }}
1818
1819 {{echo|1= {{echo|b}} }}
1820
1821 {{echo| 1 =
1822 c }}
1823
1824 {{echo| 1 =
1825 * d
1826 }}
1827 !! html
1828 <p>a
1829 </p><p>b
1830 </p><p>c
1831 </p>
1832 <ul>
1833 <li> d
1834 </li>
1835 </ul>
1836
1837 !! end
1838
1839 !! test
1840 Templates: Don't strip whitespace from positional-param values
1841 !! wikitext
1842 {{echo|a }}
1843
1844 {{echo|{{echo|b}} }}
1845
1846 {{echo| c
1847 }}
1848
1849 {{echo| {{echo|d}}
1850 }}
1851
1852 {{echo|
1853 e}}
1854
1855 {{echo|
1856 * f}}
1857
1858 {{echo|
1859 }}g
1860 !! html
1861 <p>a
1862 </p><p>b
1863 </p>
1864 <pre>c
1865 </pre>
1866 <p><br />
1867 </p>
1868 <pre>d
1869 </pre>
1870 <p><br />
1871 </p>
1872 <pre>e
1873 </pre>
1874 <p><br />
1875 </p>
1876 <ul>
1877 <li> f
1878 </li>
1879 </ul>
1880 <p><br />
1881 </p>
1882 <pre>g
1883 </pre>
1884 !! end
1885
1886 !! test
1887 Templates: Handle empty comment-and-ws-only lines correctly
1888 !! wikitext
1889 {{echo|foo
1890 <!--should be ignored-->
1891 <!--should be ignored as well-->
1892 bar}}
1893 !! html
1894 <p>foo
1895 bar
1896 </p>
1897 !! end
1898
1899 #--------------------------------------------------------------------
1900 # Transclusion parameter escaping tests
1901 #--------------------------------------------------------------------
1902 !! test
1903 Templates: Parsoid parameter escaping test 1
1904 !! options
1905 parsoid
1906 !! wikitext
1907 {{echo|[foo]|{{echo|[bar]}}}}
1908 !! html
1909 <p about="#mwt1" typeof="mw:Transclusion"
1910 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1911 !! end
1912
1913 !! test
1914 Parsoid: Pipes in external links in template parameter
1915 !! options
1916 parsoid
1917 !! wikitext
1918 {{echo|[{{echo|http://example.com}} link]}}
1919 !! html
1920 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
1921 !! end
1922
1923 !! test
1924 Parsoid: pipe in transclusion parameter
1925 !! options
1926 parsoid
1927 !! wikitext
1928 {{echo|http://foo.com/a&#124;b}}
1929 !! html
1930 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1931 typeof="mw:Transclusion"
1932 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
1933 !! end
1934
1935 !! test
1936 Parsoid: Pipe in external link target and content in template parameter
1937 !! options
1938 parsoid=html2wt,wt2wt
1939 !! wikitext
1940 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1941 !! html
1942 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1943 typeof="mw:Transclusion"
1944 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1945 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1946 !! end
1947
1948 !! test
1949 Templates: Don't escape already nowiki-escaped text in template parameters
1950 !! options
1951 parsoid=html2wt,wt2wt
1952 !! wikitext
1953 {{echo|foo<nowiki>|</nowiki>bar}}
1954 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1955 {{echo|<nowiki></nowiki>}}
1956 !! html
1957 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
1958 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
1959 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
1960 </p>
1961 !! end
1962
1963 ## Bug 52824
1964 !! test
1965 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1966 !! options
1967 parsoid=html2wt,wt2wt
1968 !! wikitext
1969 {{echo|{{echo|1=bar}}}}
1970 !! html
1971 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
1972 !! end
1973
1974 ## Bug 56733
1975 !! test
1976 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
1977 !! options
1978 parsoid
1979 !! wikitext
1980 {{echo|a : b}}
1981 !! html
1982 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
1983 !! end
1984
1985 ###
1986 ### Parsoid-centric tests for testing RT edge cases for pre
1987 ###
1988
1989 !!test
1990 1a. Indent-Pre and Comments
1991 !! wikitext
1992 a
1993 <!--a-->
1994 c
1995 !! html
1996 <pre>a
1997 </pre>
1998 <p>c
1999 </p>
2000 !!end
2001
2002 !!test
2003 1b. Indent-Pre and Comments
2004 !! wikitext
2005 a
2006 <!--a-->
2007 c
2008 !! html
2009 <pre>a
2010 </pre>
2011 <p>c
2012 </p>
2013 !!end
2014
2015 !!test
2016 1c. Indent-Pre and Comments
2017 !! wikitext
2018 <!--a--> a
2019
2020 <!--a--> a
2021 !! html
2022 <pre> a
2023 </pre>
2024 <pre> a
2025 </pre>
2026 !!end
2027
2028 !!test
2029 1d. Indent-Pre and Comments
2030 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2031 !! wikitext
2032 <!--a--> a
2033
2034 <!--b-->b
2035 !! html
2036 <pre>a
2037 </pre>
2038 <pre>b
2039 </pre>
2040 !!end
2041
2042 !!test
2043 2a. Indent-Pre and tables
2044 !! wikitext
2045 {|
2046 |-
2047 !h1!!h2
2048 |foo||bar
2049 |}
2050 !! html
2051 <table>
2052
2053 <tr>
2054 <th>h1</th>
2055 <th>h2
2056 </th>
2057 <td>foo</td>
2058 <td>bar
2059 </td></tr></table>
2060
2061 !!end
2062
2063 !!test
2064 2b. Indent-Pre and tables
2065 !! wikitext
2066 {|
2067 |-
2068 |foo
2069 |}
2070 !! html
2071 <table>
2072
2073 <tr>
2074 <td>foo
2075 </td></tr></table>
2076
2077 !!end
2078
2079 !!test
2080 2c. Indent-Pre and tables (bug 42252)
2081 !! wikitext
2082 {|
2083 |+ foo
2084 ! | bar
2085 |}
2086 !! html
2087 <table>
2088 <caption> foo
2089 </caption>
2090 <tr>
2091 <th> bar
2092 </th></tr></table>
2093
2094 !!end
2095
2096 !!test
2097 3a. Indent-Pre and block tags (single-line html)
2098 !! wikitext
2099 a <p> foo </p>
2100 b <div> foo </div>
2101 c <blockquote> foo </blockquote>
2102 <span> foo </span>
2103 !! html
2104 a <p> foo </p>
2105 b <div> foo </div>
2106 c <blockquote> foo </blockquote>
2107 <pre><span> foo </span>
2108 </pre>
2109 !!end
2110
2111 !!test
2112 3b. Indent-Pre and block tags (multi-line html)
2113 !! wikitext
2114 a <span>foo</span>
2115 b <div> foo </div>
2116 !! html
2117 <pre>a <span>foo</span>
2118 </pre>
2119 b <div> foo </div>
2120
2121 !!end
2122
2123 !!test
2124 3c. Indent-Pre and block tags (pre-content on separate line)
2125 !! wikitext
2126 <p>
2127 foo
2128 </p>
2129
2130 <div>
2131 foo
2132 </div>
2133
2134 <center>
2135 foo
2136 </center>
2137
2138 <blockquote>
2139 foo
2140 </blockquote>
2141
2142 <blockquote>
2143 <pre>
2144 foo
2145 </pre>
2146 </blockquote>
2147
2148 <table><tr><td>
2149 foo
2150 </td></tr></table>
2151
2152 <ul><li>
2153 foo
2154 </li></ul>
2155
2156 !! html
2157 <p>
2158 foo
2159 </p>
2160 <div>
2161 <pre>foo
2162 </pre>
2163 </div>
2164 <center>
2165 <pre>foo
2166 </pre>
2167 </center>
2168 <blockquote>
2169 <p> foo
2170 </p>
2171 </blockquote>
2172 <blockquote>
2173 <pre>
2174 foo
2175 </pre>
2176 </blockquote>
2177 <table><tr><td>
2178 <pre>foo
2179 </pre>
2180 </td></tr></table>
2181 <ul><li>
2182 foo
2183 </li></ul>
2184
2185 !!end
2186
2187 !!test
2188 4. Indent-Pre and extension tags
2189 !! wikitext
2190 a <gallery>
2191 File:foobar.jpg
2192 </gallery>
2193 !! html
2194 a <ul class="gallery mw-gallery-traditional">
2195 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2196 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
2197 <div class="gallerytext">
2198 </div>
2199 </div></li>
2200 </ul>
2201
2202 !!end
2203
2204 !! test
2205 Leading pipes outside of tables
2206 !! options
2207 parsoid
2208 !! wikitext
2209 | foo
2210 !! html
2211 <p>| foo</p>
2212 !! end
2213
2214 !! test
2215 Leading pipes outside of tables 2
2216 !! options
2217 parsoid
2218 !! wikitext
2219 a
2220 | foo
2221 b
2222 !! html
2223 <p>a
2224 | foo
2225 b</p>
2226 !! end
2227
2228 !! test
2229 Leading pipes outside of tables 3
2230 !! options
2231 parsoid
2232 !! wikitext
2233 a
2234 | class="foo bar" | baz
2235 b
2236 !! html
2237 <p>a
2238 | class="foo bar" | baz
2239 b</p>
2240 !! end
2241
2242 !!test
2243 Render paragraphs when indent-pre is suppressed in blocklevels
2244 !! wikitext
2245 <blockquote>
2246 foo
2247
2248 bar
2249 </blockquote>
2250 !! html
2251 <blockquote>
2252 <p> foo
2253 </p><p> bar
2254 </p>
2255 </blockquote>
2256
2257 !!end
2258
2259 !!test
2260 4. Multiple spaces at start-of-line
2261 !! wikitext
2262 <p> foo </p>
2263 foo
2264 {|
2265 |foo
2266 |}
2267 !! html
2268 <p> foo </p>
2269 <pre> foo
2270 </pre>
2271 <table>
2272 <tr>
2273 <td>foo
2274 </td></tr></table>
2275
2276 !!end
2277
2278 ## NOTE: the leading white-space chars on empty line are significant
2279 !! test
2280 5a. White-space in indent-pre
2281 !! wikitext
2282 a<br />
2283
2284 b
2285 !! html
2286 <pre>a<br />
2287
2288 b
2289 </pre>
2290 !! end
2291
2292 ## NOTE: the leading white-space chars on empty line are significant
2293 !! test
2294 5b. White-space in indent-pre
2295 !! wikitext
2296 a
2297
2298 b
2299
2300
2301 c
2302 !! html
2303 <pre>a
2304
2305 b
2306
2307
2308 c
2309 </pre>
2310 !! end
2311
2312 !! test
2313 5c. White-space in indent-pre
2314 !! wikitext
2315 ''a''
2316 ''b''
2317 ''c''
2318 !! html
2319 <pre><i>a</i>
2320 <i>b</i>
2321 <i>c</i>
2322 </pre>
2323 !! end
2324
2325 !! test
2326 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2327 !! wikitext
2328 a
2329
2330 <!-- continue -->
2331 b
2332
2333 c
2334
2335 d
2336 !! html
2337 <pre>a
2338
2339 b
2340 </pre>
2341 <pre>c
2342
2343 </pre>
2344 <p>d
2345 </p>
2346 !! end
2347
2348 !! test
2349 7a. Indent-pre and category links
2350 !! options
2351 parsoid=wt2html,wt2wt
2352 !! wikitext
2353 [[Category:foo]] <!-- No pre-wrapping -->
2354 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2355 !! html
2356 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2357 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2358 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2359 !! end
2360
2361 !! test
2362 7b. Indent-pre and category links
2363 !! options
2364 parsoid=wt2html,wt2wt
2365 !! wikitext
2366 [[Category:foo]] a
2367 [[Category:foo]] {{echo|b}}
2368 !! html
2369 <pre>
2370 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2371
2372 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
2373 !! end
2374
2375 ###
2376 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2377 ###
2378
2379 !!test
2380 HTML-pre: 1. embedded newlines
2381 !! wikitext
2382 <pre>foo</pre>
2383
2384 <pre>
2385 foo
2386 </pre>
2387
2388 <pre>
2389
2390 foo
2391 </pre>
2392
2393 <pre>
2394
2395
2396 foo
2397 </pre>
2398 !! html
2399 <pre>foo</pre>
2400 <pre>
2401 foo
2402 </pre>
2403 <pre>
2404
2405 foo
2406 </pre>
2407 <pre>
2408
2409
2410 foo
2411 </pre>
2412
2413 !!end
2414
2415 !!test
2416 HTML-pre: 2: indented text
2417 !! wikitext
2418 <pre>
2419 foo
2420 </pre>
2421 !! html
2422 <pre>
2423 foo
2424 </pre>
2425
2426 !!end
2427
2428 !!test
2429 HTML-pre: 3: other wikitext
2430 !! wikitext
2431 <pre>
2432 * foo
2433 # bar
2434 = no-h =
2435 '' no-italic ''
2436 [[ NoLink ]]
2437 </pre>
2438 !! html
2439 <pre>
2440 * foo
2441 # bar
2442 = no-h =
2443 '' no-italic ''
2444 [[ NoLink ]]
2445 </pre>
2446
2447 !!end
2448
2449 ###
2450 ### Definition lists
2451 ###
2452 !! test
2453 Simple definition
2454 !! wikitext
2455 ; name : Definition
2456 !! html
2457 <dl>
2458 <dt> name&#160;</dt>
2459 <dd> Definition
2460 </dd>
2461 </dl>
2462
2463 !! end
2464
2465 !! test
2466 Definition list for indentation only
2467 !! wikitext
2468 : Indented text
2469 !! html
2470 <dl>
2471 <dd> Indented text
2472 </dd>
2473 </dl>
2474
2475 !! end
2476
2477 !! test
2478 Definition list with no space
2479 !! wikitext
2480 ;name:Definition
2481 !! html
2482 <dl>
2483 <dt>name</dt>
2484 <dd>Definition
2485 </dd>
2486 </dl>
2487
2488 !!end
2489
2490 !! test
2491 Definition list with URL link
2492 !! wikitext
2493 ; http://example.com/ : definition
2494 !! html
2495 <dl>
2496 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2497 <dd> definition
2498 </dd>
2499 </dl>
2500
2501 !! end
2502
2503 !! test
2504 Definition list with bracketed URL link
2505 !! wikitext
2506 ;[http://www.example.com/ Example]:Something about it
2507 !! html
2508 <dl>
2509 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2510 <dd>Something about it
2511 </dd>
2512 </dl>
2513
2514 !! end
2515
2516 !! test
2517 Definition list with wikilink containing colon
2518 !! wikitext
2519 ; [[Help:FAQ]]: The least-read page on Wikipedia
2520 !! html
2521 <dl>
2522 <dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
2523 <dd> The least-read page on Wikipedia
2524 </dd>
2525 </dl>
2526
2527 !! end
2528
2529 # At Brion's and JeLuF's insistence... :)
2530 !! test
2531 Definition list with news link containing colon
2532 !! wikitext
2533 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2534 !! html
2535 <dl>
2536 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2537 <dd> This isn't even a real newsgroup!
2538 </dd>
2539 </dl>
2540
2541 !! end
2542
2543 !! test
2544 Malformed definition list with colon
2545 !! wikitext
2546 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2547 !! html
2548 <dl>
2549 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
2550 </dt>
2551 </dl>
2552
2553 !! end
2554
2555 !! test
2556 Definition lists: colon in external link text
2557 !! wikitext
2558 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2559 !! html
2560 <dl>
2561 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2562 <dd> OK, I made that up
2563 </dd>
2564 </dl>
2565
2566 !! end
2567
2568 !! test
2569 Definition lists: colon in HTML attribute
2570 !! wikitext
2571 ;<b style="display: inline">bold</b>
2572 !! html
2573 <dl>
2574 <dt><b style="display: inline">bold</b>
2575 </dt>
2576 </dl>
2577
2578 !! end
2579
2580 !! test
2581 Definition lists: self-closed tag
2582 !! wikitext
2583 ;one<br/>two : two-line fun
2584 !! html
2585 <dl>
2586 <dt>one<br />two&#160;</dt>
2587 <dd> two-line fun
2588 </dd>
2589 </dl>
2590
2591 !! end
2592
2593 !! test
2594 Bug 11748: Literal closing tags
2595 !! wikitext
2596 <dl>
2597 <dt>test 1</dt>
2598 <dd>test test test test test</dd>
2599 <dt>test 2</dt>
2600 <dd>test test test test test</dd>
2601 </dl>
2602 !! html
2603 <dl>
2604 <dt>test 1</dt>
2605 <dd>test test test test test</dd>
2606 <dt>test 2</dt>
2607 <dd>test test test test test</dd>
2608 </dl>
2609
2610 !! end
2611
2612 !! test
2613 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2614 !! wikitext
2615 <ul><li>
2616 ; term : description
2617 * unordered
2618 </li></ul>
2619 !! html
2620 <ul><li>
2621 <dl>
2622 <dt> term&#160;</dt>
2623 <dd> description
2624 </dd>
2625 </dl>
2626 <ul>
2627 <li> unordered
2628 </li>
2629 </ul>
2630 </li></ul>
2631
2632 !! end
2633
2634 !! test
2635
2636 Definition list with empty definition and following paragraph
2637 !! wikitext
2638 ; term:
2639 Paragraph text
2640 !! html
2641 <dl>
2642 <dt> term</dt>
2643 <dd>
2644 </dd>
2645 </dl>
2646 <p>Paragraph text
2647 </p>
2648 !! end
2649
2650 !! test
2651 Nested definition lists using html syntax
2652 !! wikitext
2653 <dl><dd>
2654 <dl>
2655 <dd>Foo</dd>
2656 </dl>
2657 </dd></dl>
2658 !! html
2659 <dl><dd>
2660 <dl>
2661 <dd>Foo</dd>
2662 </dl>
2663 </dd></dl>
2664
2665 !! end
2666
2667 !! test
2668 Definition Lists: No nesting: Multiple dd's
2669 !! wikitext
2670 ;x
2671 :a
2672 :b
2673 !! html
2674 <dl>
2675 <dt>x
2676 </dt>
2677 <dd>a
2678 </dd>
2679 <dd>b
2680 </dd>
2681 </dl>
2682
2683 !! end
2684
2685 !! test
2686 Definition Lists: Indentation: Regular
2687 !! wikitext
2688 :i1
2689 ::i2
2690 :::i3
2691 !! html
2692 <dl>
2693 <dd>i1
2694 <dl>
2695 <dd>i2
2696 <dl>
2697 <dd>i3
2698 </dd>
2699 </dl>
2700 </dd>
2701 </dl>
2702 </dd>
2703 </dl>
2704
2705 !! end
2706
2707 !! test
2708 Definition Lists: Indentation: Missing 1st level
2709 !! wikitext
2710 ::i2
2711 :::i3
2712 !! html
2713 <dl>
2714 <dd><dl>
2715 <dd>i2
2716 <dl>
2717 <dd>i3
2718 </dd>
2719 </dl>
2720 </dd>
2721 </dl>
2722 </dd>
2723 </dl>
2724
2725 !! end
2726
2727 !! test
2728 Definition Lists: Indentation: Multi-level indent
2729 !! wikitext
2730 :::i3
2731 !! html
2732 <dl>
2733 <dd><dl>
2734 <dd><dl>
2735 <dd>i3
2736 </dd>
2737 </dl>
2738 </dd>
2739 </dl>
2740 </dd>
2741 </dl>
2742
2743 !! end
2744
2745 !! test
2746 Definition Lists: Hacky use to indent tables
2747 !! wikitext
2748 ::{|
2749 |foo
2750 |bar
2751 |}
2752 this text
2753 should be left alone
2754 !! html
2755 <dl><dd><dl><dd><table>
2756 <tr>
2757 <td>foo
2758 </td>
2759 <td>bar
2760 </td></tr></table></dd></dl></dd></dl>
2761 <p>this text
2762 should be left alone
2763 </p>
2764 !! end
2765
2766 # Bug 52473
2767 !! test
2768 Definition Lists: Hacky use to indent tables (WS-insensitive)
2769 !! options
2770 parsoid
2771 !! wikitext
2772 : {|
2773 |a
2774 |}
2775 !! html
2776 <dl>
2777 <dd> <table><tr><td>a</td></tr></table> </dd>
2778 </dl>
2779 !! end
2780 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2781 ## as an empty dt item. It also ignores all but the last ";" when followed
2782 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2783 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2784 ## ";"s.
2785 ##
2786 ## Ex: ";;t2 ::d2" is transformed into:
2787 ##
2788 ## <dl>
2789 ## <dt>t2 </dt>
2790 ## <dd>
2791 ## <dl>
2792 ## <dt></dt>
2793 ## <dd>d2</dd>
2794 ## </dl>
2795 ## </dd>
2796 ## </dl>
2797 ##
2798 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2799 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2800 ##
2801 ## <dl>
2802 ## <dt>
2803 ## <dl>
2804 ## <dt>t2 </dt>
2805 ## <dd>:d2</dd>
2806 ## </dl>
2807 ## </dt>
2808 ## </dl>
2809 ##
2810 ## All Parsoid only definition list tests have this difference.
2811 ##
2812 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2813 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2814
2815 !! test
2816 Table / list interaction: indented table with lists in table contents
2817 !! wikitext
2818 :{|
2819 |-
2820 | a
2821 * b
2822 |-
2823 | c
2824 * d
2825 |}
2826 !! html
2827 <dl><dd><table>
2828
2829 <tr>
2830 <td> a
2831 <ul>
2832 <li> b
2833 </li>
2834 </ul>
2835 </td></tr>
2836 <tr>
2837 <td> c
2838 <ul>
2839 <li> d
2840 </li>
2841 </ul>
2842 </td></tr></table></dd></dl>
2843
2844 !! end
2845
2846 !!test
2847 Table / list interaction: lists nested in tables nested in indented lists
2848 !! wikitext
2849 :{|
2850 |
2851 :a
2852 :b
2853 |
2854 *c
2855 *d
2856 |}
2857
2858 *e
2859 *f
2860 !! html
2861 <dl><dd><table>
2862 <tr>
2863 <td>
2864 <dl>
2865 <dd>a
2866 </dd>
2867 <dd>b
2868 </dd>
2869 </dl>
2870 </td>
2871 <td>
2872 <ul>
2873 <li>c
2874 </li>
2875 <li>d
2876 </li>
2877 </ul>
2878 </td></tr></table></dd></dl>
2879 <ul>
2880 <li>e
2881 </li>
2882 <li>f
2883 </li>
2884 </ul>
2885
2886 !!end
2887
2888 !! test
2889 Definition Lists: Nesting: Multi-level (Parsoid only)
2890 !! options
2891 parsoid
2892 !! wikitext
2893 ;t1 :d1
2894 ;;t2 ::d2
2895 ;;;t3 :::d3
2896 !! html
2897 <dl>
2898 <dt>t1 </dt>
2899 <dd>d1</dd>
2900 <dt>
2901 <dl>
2902 <dt>t2 </dt>
2903 <dd>:d2</dd>
2904 <dt>
2905 <dl>
2906 <dt>t3 </dt>
2907 <dd>::d3</dd>
2908 </dl>
2909 </dt>
2910 </dl>
2911 </dt>
2912 </dl>
2913
2914
2915 !! end
2916
2917
2918 !! test
2919 Definition Lists: Nesting: Test 2 (Parsoid only)
2920 !! options
2921 parsoid
2922 !! wikitext
2923 ;t1
2924 ::d2
2925 !! html
2926 <dl>
2927 <dt>t1</dt>
2928 <dd>
2929 <dl>
2930 <dd>d2</dd>
2931 </dl>
2932 </dd>
2933 </dl>
2934
2935 !! end
2936
2937
2938 !! test
2939 Definition Lists: Nesting: Test 3 (Parsoid only)
2940 !! options
2941 parsoid
2942 !! wikitext
2943 :;t1
2944 ::::d2
2945 !! html
2946 <dl>
2947 <dd>
2948 <dl>
2949 <dt>t1</dt>
2950 <dd>
2951 <dl>
2952 <dd>
2953 <dl>
2954 <dd>d2</dd>
2955 </dl>
2956 </dd>
2957 </dl>
2958 </dd>
2959 </dl>
2960 </dd>
2961 </dl>
2962
2963 !! end
2964
2965
2966 !! test
2967 Definition Lists: Nesting: Test 4
2968 !! wikitext
2969 ::;t3
2970 :::d3
2971 !! html
2972 <dl>
2973 <dd><dl>
2974 <dd><dl>
2975 <dt>t3
2976 </dt>
2977 <dd>d3
2978 </dd>
2979 </dl>
2980 </dd>
2981 </dl>
2982 </dd>
2983 </dl>
2984
2985 !! end
2986
2987
2988 ## The Parsoid team believes the following three test exposes a
2989 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2990 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2991 !! test
2992 Definition Lists: Mixed Lists: Test 1
2993 !! wikitext
2994 :;* foo
2995 ::* bar
2996 :; baz
2997 !! html/php
2998 <dl>
2999 <dd><dl>
3000 <dt><ul>
3001 <li> foo
3002 </li>
3003 <li> bar
3004 </li>
3005 </ul>
3006 </dt>
3007 </dl>
3008 <dl>
3009 <dt> baz
3010 </dt>
3011 </dl>
3012 </dd>
3013 </dl>
3014
3015 !! html/parsoid
3016 <dl>
3017 <dd><dl>
3018 <dt><ul>
3019 <li> foo
3020 </li>
3021 </ul></dt>
3022 <dd><ul>
3023 <li> bar
3024 </li>
3025 </ul></dd>
3026 <dt> baz</dt>
3027 </dl></dd>
3028 </dl>
3029 !! end
3030
3031 !! test
3032 Definition Lists: Mixed Lists: Test 2
3033 !! wikitext
3034 *: d1
3035 *: d2
3036 !! html
3037 <ul>
3038 <li><dl>
3039 <dd> d1
3040 </dd>
3041 <dd> d2
3042 </dd>
3043 </dl>
3044 </li>
3045 </ul>
3046
3047 !! end
3048
3049
3050 !! test
3051 Definition Lists: Mixed Lists: Test 3
3052 !! wikitext
3053 *::: d1
3054 *::: d2
3055 !! html
3056 <ul>
3057 <li><dl>
3058 <dd><dl>
3059 <dd><dl>
3060 <dd> d1
3061 </dd>
3062 <dd> d2
3063 </dd>
3064 </dl>
3065 </dd>
3066 </dl>
3067 </dd>
3068 </dl>
3069 </li>
3070 </ul>
3071
3072 !! end
3073
3074
3075 !! test
3076 Definition Lists: Mixed Lists: Test 4
3077 !! wikitext
3078 *;d1 :d2
3079 *;d3 :d4
3080 !! html
3081 <ul>
3082 <li><dl>
3083 <dt>d1&#160;</dt>
3084 <dd>d2
3085 </dd>
3086 <dt>d3&#160;</dt>
3087 <dd>d4
3088 </dd>
3089 </dl>
3090 </li>
3091 </ul>
3092
3093 !! end
3094
3095
3096 !! test
3097 Definition Lists: Mixed Lists: Test 5
3098 !! wikitext
3099 *:d1
3100 *:: d2
3101 !! html
3102 <ul>
3103 <li><dl>
3104 <dd>d1
3105 <dl>
3106 <dd> d2
3107 </dd>
3108 </dl>
3109 </dd>
3110 </dl>
3111 </li>
3112 </ul>
3113
3114 !! end
3115
3116
3117 !! test
3118 Definition Lists: Mixed Lists: Test 6
3119 !! wikitext
3120 #*:d1
3121 #*::: d3
3122 !! html
3123 <ol>
3124 <li><ul>
3125 <li><dl>
3126 <dd>d1
3127 <dl>
3128 <dd><dl>
3129 <dd> d3
3130 </dd>
3131 </dl>
3132 </dd>
3133 </dl>
3134 </dd>
3135 </dl>
3136 </li>
3137 </ul>
3138 </li>
3139 </ol>
3140
3141 !! end
3142
3143
3144 !! test
3145 Definition Lists: Mixed Lists: Test 7
3146 !! wikitext
3147 :* d1
3148 :* d2
3149 !! html
3150 <dl>
3151 <dd><ul>
3152 <li> d1
3153 </li>
3154 <li> d2
3155 </li>
3156 </ul>
3157 </dd>
3158 </dl>
3159
3160 !! end
3161
3162
3163 !! test
3164 Definition Lists: Mixed Lists: Test 8
3165 !! wikitext
3166 :* d1
3167 ::* d2
3168 !! html
3169 <dl>
3170 <dd><ul>
3171 <li> d1
3172 </li>
3173 </ul>
3174 <dl>
3175 <dd><ul>
3176 <li> d2
3177 </li>
3178 </ul>
3179 </dd>
3180 </dl>
3181 </dd>
3182 </dl>
3183
3184 !! end
3185
3186
3187 !! test
3188 Definition Lists: Mixed Lists: Test 9
3189 !! wikitext
3190 *;foo :bar
3191 !! html
3192 <ul>
3193 <li><dl>
3194 <dt>foo&#160;</dt>
3195 <dd>bar
3196 </dd>
3197 </dl>
3198 </li>
3199 </ul>
3200
3201 !! end
3202
3203
3204 !! test
3205 Definition Lists: Mixed Lists: Test 10
3206 !! wikitext
3207 *#;foo :bar
3208 !! html
3209 <ul>
3210 <li><ol>
3211 <li><dl>
3212 <dt>foo&#160;</dt>
3213 <dd>bar
3214 </dd>
3215 </dl>
3216 </li>
3217 </ol>
3218 </li>
3219 </ul>
3220
3221 !! end
3222
3223 # The Parsoid team disagrees with the PHP parser's seemingly-random
3224 # rules regarding dd/dt on the next two tests. Parsoid is more
3225 # consistent, and recognizes the shared nesting and keeps the
3226 # still-open tags around until the nesting is complete.
3227
3228 !! test
3229 Definition Lists: Mixed Lists: Test 11
3230 !! wikitext
3231 *#*#;*;;foo :bar
3232 *#*#;boo :baz
3233 !! html/php
3234 <ul>
3235 <li><ol>
3236 <li><ul>
3237 <li><ol>
3238 <li><dl>
3239 <dt>foo&#160;</dt>
3240 <dd><ul>
3241 <li><dl>
3242 <dt><dl>
3243 <dt>bar
3244 </dt>
3245 </dl>
3246 </dd>
3247 </dl>
3248 </li>
3249 </ul>
3250 </dd>
3251 </dl>
3252 <dl>
3253 <dt>boo&#160;</dt>
3254 <dd>baz
3255 </dd>
3256 </dl>
3257 </li>
3258 </ol>
3259 </li>
3260 </ul>
3261 </li>
3262 </ol>
3263 </li>
3264 </ul>
3265
3266 !! html/parsoid
3267 <ul>
3268 <li>
3269 <ol>
3270 <li>
3271 <ul>
3272 <li>
3273 <ol>
3274 <li>
3275 <dl>
3276 <dt>
3277 <ul>
3278 <li>
3279 <dl>
3280 <dt>
3281 <dl>
3282 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3283 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3284 </dl></dt>
3285 </dl></li>
3286 </ul></dt>
3287 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3288 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3289 </dl></li>
3290 </ol></li>
3291 </ul></li>
3292 </ol></li>
3293 </ul>
3294 !! end
3295
3296
3297 !! test
3298 Definition Lists: Weird Ones: Test 1
3299 !! wikitext
3300 *#;*::;; foo : bar (who uses this?)
3301 !! html/php
3302 <ul>
3303 <li><ol>
3304 <li><dl>
3305 <dt> foo&#160;</dt>
3306 <dd><ul>
3307 <li><dl>
3308 <dd><dl>
3309 <dd><dl>
3310 <dt><dl>
3311 <dt> bar (who uses this?)
3312 </dt>
3313 </dl>
3314 </dd>
3315 </dl>
3316 </dd>
3317 </dl>
3318 </dd>
3319 </dl>
3320 </li>
3321 </ul>
3322 </dd>
3323 </dl>
3324 </li>
3325 </ol>
3326 </li>
3327 </ul>
3328
3329 !! html/parsoid
3330 <ul>
3331 <li>
3332 <ol>
3333 <li>
3334 <dl>
3335 <dt>
3336 <ul>
3337 <li>
3338 <dl>
3339 <dd>
3340 <dl>
3341 <dd>
3342 <dl>
3343 <dt>
3344 <dl>
3345 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3346 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3347 </dl></dt>
3348 </dl></dd>
3349 </dl></dd>
3350 </dl></li>
3351 </ul></dt>
3352 </dl></li>
3353 </ol></li>
3354 </ul>
3355 !! end
3356
3357 ###
3358 ### External links
3359 ###
3360 !! test
3361 External links: non-bracketed
3362 !! wikitext
3363 Non-bracketed: http://example.com
3364 !! html
3365 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3366 </p>
3367 !! end
3368
3369 !! test
3370 External links: numbered
3371 !! wikitext
3372 Numbered: [http://example.com]
3373 Numbered: [http://example.net]
3374 Numbered: [http://example.com]
3375 !! html
3376 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3377 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3378 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3379 </p>
3380 !!end
3381
3382 !! test
3383 External links: specified text
3384 !! wikitext
3385 Specified text: [http://example.com link]
3386 !! html
3387 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3388 </p>
3389 !!end
3390
3391 !! test
3392 External links: trail
3393 !! wikitext
3394 Linktrails should not work for external links: [http://example.com link]s
3395 !! html
3396 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3397 </p>
3398 !! end
3399
3400 !! test
3401 External links: dollar sign in URL
3402 !! wikitext
3403 http://example.com/1$2345
3404 !! html
3405 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3406 </p>
3407 !! end
3408
3409 !! test
3410 External links: dollar sign in URL (named)
3411 !! wikitext
3412 [http://example.com/1$2345]
3413 !! html
3414 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3415 </p>
3416 !!end
3417
3418 !! test
3419 External links: open square bracket forbidden in URL (bug 4377)
3420 !! wikitext
3421 http://example.com/1[2345
3422 !! html
3423 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3424 </p>
3425 !! end
3426
3427 !! test
3428 External links: open square bracket forbidden in URL (named) (bug 4377)
3429 !! wikitext
3430 [http://example.com/1[2345]
3431 !! html
3432 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3433 </p>
3434 !!end
3435
3436 !! test
3437 External links: nowiki in URL link text (bug 6230)
3438 !! wikitext
3439 [http://example.com/ <nowiki>''example site''</nowiki>]
3440 !! html
3441 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3442 </p>
3443 !! end
3444
3445 !! test
3446 External links: newline forbidden in text (bug 6230 regression check)
3447 !! wikitext
3448 [http://example.com/ first
3449 second]
3450 !! html
3451 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3452 second]
3453 </p>
3454 !!end
3455
3456 !! test
3457 External links: Pipe char between url and text
3458 !! wikitext
3459 [http://example.com | link]
3460 !! html
3461 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3462 </p>
3463 !!end
3464
3465 !! test
3466 External links: protocol-relative URL in brackets
3467 !! wikitext
3468 [//example.com/ Test]
3469 !! html
3470 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3471 </p>
3472 !! end
3473
3474 !! test
3475 External links: protocol-relative URL in brackets without text
3476 !! wikitext
3477 [//example.com]
3478 !! html
3479 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3480 </p>
3481 !! end
3482
3483 !! test
3484 External links: protocol-relative URL in free text is left alone
3485 !! wikitext
3486 //example.com/Foo
3487 !! html
3488 <p>//example.com/Foo
3489 </p>
3490 !!end
3491
3492 !! test
3493 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3494 !! wikitext
3495 foo//example.com/Foo
3496 !! html
3497 <p>foo//example.com/Foo
3498 </p>
3499 !! end
3500
3501 !! test
3502 External image
3503 !! wikitext
3504 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3505 !! html
3506 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3507 </p>
3508 !! end
3509
3510 !! test
3511 External image from https
3512 !! wikitext
3513 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3514 !! html
3515 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3516 </p>
3517 !! end
3518
3519 !! test
3520 External image (when not allowed)
3521 !! options
3522 wgAllowExternalImages=0
3523 !! wikitext
3524 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3525 !! html
3526 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
3527 </p>
3528 !! end
3529
3530 !! test
3531 Link to non-http image, no img tag
3532 !! wikitext
3533 Link to non-http image, no img tag: ftp://example.com/test.jpg
3534 !! html
3535 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
3536 </p>
3537 !! end
3538
3539 !! test
3540 External links: terminating separator
3541 !! wikitext
3542 Terminating separator: http://example.com/thing,
3543 !! html
3544 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3545 </p>
3546 !! end
3547
3548 !! test
3549 External links: intervening separator
3550 !! wikitext
3551 Intervening separator: http://example.com/1,2,3
3552 !! html
3553 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3554 </p>
3555 !! end
3556
3557 !! test
3558 External links: old bug with URL in query
3559 !! wikitext
3560 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3561 !! html
3562 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3563 </p>
3564 !! end
3565
3566 !! test
3567 External links: old URL-in-URL bug, mixed protocols
3568 !! wikitext
3569 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3570 !! html
3571 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3572 </p>
3573 !!end
3574
3575 !! test
3576 External links: URL in text
3577 !! wikitext
3578 URL in text: [http://example.com http://example.com]
3579 !! html
3580 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3581 </p>
3582 !! end
3583
3584 !! test
3585 External links: Clickable images
3586 !! wikitext
3587 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3588 !! html
3589 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
3590 </p>
3591 !!end
3592
3593 !! test
3594 External links: raw ampersand
3595 !! wikitext
3596 Old &amp; use: http://x&y
3597 !! html
3598 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3599 </p>
3600 !! end
3601
3602 !! test
3603 External links: encoded ampersand
3604 !! wikitext
3605 Old &amp; use: http://x&amp;y
3606 !! html
3607 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3608 </p>
3609 !! end
3610
3611 !! test
3612 External links: encoded equals (bug 6102)
3613 !! wikitext
3614 http://example.com/?foo&#61;bar
3615 !! html
3616 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3617 </p>
3618 !! end
3619
3620 !! test
3621 External links: [raw ampersand]
3622 !! wikitext
3623 Old &amp; use: [http://x&y]
3624 !! html
3625 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3626 </p>
3627 !! end
3628
3629 !! test
3630 External links: [encoded ampersand]
3631 !! wikitext
3632 Old &amp; use: [http://x&amp;y]
3633 !! html
3634 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3635 </p>
3636 !! end
3637
3638 !! test
3639 External links: [encoded equals] (bug 6102)
3640 !! wikitext
3641 [http://example.com/?foo&#61;bar]
3642 !! html
3643 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3644 </p>
3645 !! end
3646
3647 !! test
3648 External links: [IDN ignored character reference in hostname; strip it right off]
3649 !! wikitext
3650 [http://e&zwnj;xample.com/]
3651 !! html
3652 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3653 </p>
3654 !! end
3655
3656 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3657 # Where an external link could easily circumvent the sanitization of the text of
3658 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3659 # test demands a higher standard. That's a bit strange.
3660 #
3661 # Example:
3662 #
3663 # http://e‌xample.com -> [http://example.com|http://example.com]
3664 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3665 #
3666 # The first example is sanitized, but the second is not. Any security benefits
3667 # from this production are trivial to circumvent. Either remove this test and
3668 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3669 # the test accordingly.
3670 #
3671 # All our love,
3672 # The Parsoid team.
3673 !! test
3674 External links: IDN ignored character reference in hostname; strip it right off
3675 !! wikitext
3676 http://e&zwnj;xample.com/
3677 !! html
3678 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3679 </p>
3680 !! end
3681
3682 !! test
3683 External links: www.jpeg.org (bug 554)
3684 !! wikitext
3685 http://www.jpeg.org
3686 !! html
3687 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3688 </p>
3689 !! end
3690
3691 !! test
3692 External links: URL within URL (original bug 2)
3693 !! wikitext
3694 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3695 !! html
3696 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3697 </p>
3698 !! end
3699
3700 !! test
3701 BUG 361: URL inside bracketed URL
3702 !! wikitext
3703 [http://www.example.com/foo http://www.example.com/bar]
3704 !! html
3705 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3706 </p>
3707 !! end
3708
3709 !! test
3710 BUG 361: URL within URL, not bracketed
3711 !! wikitext
3712 http://www.example.com/foo?=http://www.example.com/bar
3713 !! html
3714 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
3715 </p>
3716 !! end
3717
3718 !! test
3719 BUG 289: ">"-token in URL-tail
3720 !! wikitext
3721 http://www.example.com/<hello>
3722 !! html
3723 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3724 </p>
3725 !!end
3726
3727 !! test
3728 BUG 289: literal ">"-token in URL-tail
3729 !! wikitext
3730 http://www.example.com/<b>html</b>
3731 !! html
3732 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3733 </p>
3734 !!end
3735
3736 !! test
3737 BUG 289: ">"-token in bracketed URL
3738 !! wikitext
3739 [http://www.example.com/<hello> stuff]
3740 !! html
3741 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3742 </p>
3743 !!end
3744
3745 !! test
3746 BUG 289: literal ">"-token in bracketed URL
3747 !! wikitext
3748 [http://www.example.com/<b>html</b> stuff]
3749 !! html
3750 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3751 </p>
3752 !!end
3753
3754 !! test
3755 BUG 289: literal double quote at end of URL
3756 !! wikitext
3757 http://www.example.com/"hello"
3758 !! html
3759 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3760 </p>
3761 !!end
3762
3763 !! test
3764 BUG 289: literal double quote in bracketed URL
3765 !! wikitext
3766 [http://www.example.com/"hello" stuff]
3767 !! html
3768 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3769 </p>
3770 !!end
3771
3772 !! test
3773 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3774 !! wikitext
3775 [http://www.example.com test]
3776 !! html
3777 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3778 </p>
3779 !! end
3780
3781 !! test
3782 External links: link text with spaces
3783 !! wikitext
3784 [http://www.example.com a b c]
3785 [http://www.example.com ''a'' ''b'']
3786 !! html
3787 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3788 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3789 </p>
3790 !! end
3791
3792 !! test
3793 External links: wiki links within external link (Bug 3695)
3794 !! wikitext
3795 [http://example.com [[wikilink]] embedded in ext link]
3796 !! html/php
3797 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
3798 </p>
3799 !! html/parsoid
3800 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
3801 !! end
3802
3803 !! test
3804 BUG 787: Links with one slash after the url protocol are invalid
3805 !! wikitext
3806 http:/example.com
3807
3808 [http:/example.com title]
3809 !! html
3810 <p>http:/example.com
3811 </p><p>[http:/example.com title]
3812 </p>
3813 !! end
3814
3815 !! test
3816 Bracketed external links with template-generated invalid target
3817 !! wikitext
3818 [{{echo|http:/example.com}} title]
3819 !! html
3820 <p>[http:/example.com title]
3821 </p>
3822 !! end
3823
3824 !! test
3825 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3826 !! wikitext
3827 ''[http://example.com text'']
3828 [http://example.com '''text]'''
3829 ''Something [http://example.com in italic'']
3830 ''Something [http://example.com mixed''''', even bold]'''
3831 '''''Now [http://example.com both''''']
3832 !! html
3833 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3834 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3835 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3836 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3837 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3838 </p>
3839 !! end
3840
3841
3842 !! test
3843 Bug 4781: %26 in URL
3844 !! wikitext
3845 http://www.example.com/?title=AT%26T
3846 !! html
3847 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3848 </p>
3849 !! end
3850
3851 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3852 # % is actually legal in HTML5. Any change in output would need testing though.
3853 !! test
3854 Bug 4781, 5267: %25 in URL
3855 !! wikitext
3856 http://www.example.com/?title=100%25_Bran
3857 !! html
3858 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
3859 </p>
3860 !! end
3861
3862 !! test
3863 Bug 4781, 5267: %28, %29 in URL
3864 !! wikitext
3865 http://www.example.com/?title=Ben-Hur_%281959_film%29
3866 !! html
3867 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
3868 </p>
3869 !! end
3870
3871
3872 !! test
3873 Bug 4781: %26 in autonumber URL
3874 !! wikitext
3875 [http://www.example.com/?title=AT%26T]
3876 !! html
3877 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3878 </p>
3879 !! end
3880
3881 !! test
3882 Bug 4781, 5267: %26 in autonumber URL
3883 !! wikitext
3884 [http://www.example.com/?title=100%25_Bran]
3885 !! html
3886 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3887 </p>
3888 !! end
3889
3890 !! test
3891 Bug 4781, 5267: %28, %29 in autonumber URL
3892 !! wikitext
3893 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3894 !! html
3895 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3896 </p>
3897 !! end
3898
3899
3900 !! test
3901 Bug 4781: %26 in bracketed URL
3902 !! wikitext
3903 [http://www.example.com/?title=AT%26T link]
3904 !! html
3905 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3906 </p>
3907 !! end
3908
3909 !! test
3910 Bug 4781, 5267: %26 in bracketed URL
3911 !! wikitext
3912 [http://www.example.com/?title=100%25_Bran link]
3913 !! html
3914 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3915 </p>
3916 !! end
3917
3918 !! test
3919 Bug 4781, 5267: %28, %29 in bracketed URL
3920 !! wikitext
3921 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3922 !! html
3923 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3924 </p>
3925 !! end
3926
3927 !! test
3928 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3929 !! wikitext
3930 Some [http://example.com/ pretty ''italics'' and stuff]!
3931 !! html
3932 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3933 </p>
3934 !! end
3935
3936 !! test
3937 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3938 !! wikitext
3939 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3940 !! html
3941 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
3942 </p>
3943 !! end
3944
3945 !! test
3946 External link containing double-single-quotes with no space separating the url from text in italics
3947 !! wikitext
3948 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
3949 !! html/php
3950 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
3951 </p>
3952 !! html/parsoid
3953 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)">Museo Picasso</a><span>.</span></p>
3954 !! end
3955
3956 !! test
3957 External link with comments in link text
3958 !! wikitext
3959 [http://www.google.com Google <!-- comment -->]
3960 !! html
3961 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3962 </p>
3963 !! end
3964
3965 !! test
3966 URL-encoding in URL functions (single parameter)
3967 !! wikitext
3968 {{localurl:Some page|amp=&}}
3969 !! html
3970 <p>/index.php?title=Some_page&amp;amp=&amp;
3971 </p>
3972 !! end
3973
3974 !! test
3975 URL-encoding in URL functions (multiple parameters)
3976 !! wikitext
3977 {{localurl:Some page|q=?&amp=&}}
3978 !! html
3979 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3980 </p>
3981 !! end
3982
3983 !! test
3984 Brackets in urls
3985 !! wikitext
3986 http://example.com/index.php?foozoid%5B%5D=bar
3987
3988 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3989 !! html
3990 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3991 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3992 </p>
3993 !! end
3994
3995 !! test
3996 IPv6 urls (bug 21261)
3997 !! options
3998 disabled
3999 !! wikitext
4000 http://[2404:130:0:1000::187:2]/index.php
4001 !! html
4002 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
4003 </p>
4004 !! end
4005
4006 !! test
4007 Non-extlinks in brackets
4008 !! wikitext
4009 [foo]
4010 [foo bar]
4011 [foo ''bar'']
4012 [fool's] errand
4013 [fool's errand]
4014 [{{echo|foo}}]
4015 [{{echo|foo}} bar]
4016 [{{echo|foo}} ''bar'']
4017 [{{echo|foo}}l's] errand
4018 [{{echo|foo}}l's errand]
4019 [url={{echo|foo}}]
4020 [url=http://example.com]
4021 !! html
4022 <p>[foo]
4023 [foo bar]
4024 [foo <i>bar</i>]
4025 [fool's] errand
4026 [fool's errand]
4027 [foo]
4028 [foo bar]
4029 [foo <i>bar</i>]
4030 [fool's] errand
4031 [fool's errand]
4032 [url=foo]
4033 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4034 </p>
4035 !! end
4036
4037 !! test
4038 Percent encoding in external links
4039 !! wikitext
4040 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4041 !! html/php
4042 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4043 </p>
4044 !! html/parsoid
4045 <p><a rel="mw:ExtLink"
4046 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4047 !! end
4048
4049 !! test
4050 Use url link syntax for links where the content is equal the link target
4051 !! wikitext
4052 http://example.com
4053 !! html/php
4054 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4055 </p>
4056 !! html/parsoid
4057 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4058 !! end
4059
4060 !! test
4061 Parenthesis in external links, especially URL links
4062 !! wikitext
4063 http://example.com)
4064
4065 http://example.com/test)
4066
4067 http://example.com/(test)
4068
4069 http://example.com/((test)
4070
4071 (http://example.com/(test))
4072
4073 (http://example.com/(test)))))
4074
4075 http://example.com/a)b
4076
4077 [http://example.com) foo]
4078 !! html/php
4079 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4080 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4081 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4082 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4083 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4084 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4085 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4086 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4087 </p>
4088 !! html/parsoid
4089 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4090 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4091 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4092 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4093 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4094 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4095 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4096 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4097 !! end
4098
4099 !! test
4100 Parenthesis in external links, w/ transclusion or comment
4101 !! wikitext
4102 (http://example.com/{{echo|hi}})
4103
4104 (http://example.com<!-- hi -->)
4105 !! html/php
4106 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4107 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4108 </p>
4109 !! html/parsoid
4110 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[20,31,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p>
4111
4112 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
4113 !! end
4114
4115 ###
4116 ### Quotes
4117 ###
4118
4119 !! test
4120 Quotes
4121 !! wikitext
4122 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4123
4124 Normal text. '''''Bold italic text.''''' Normal text.
4125 !! html
4126 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4127 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4128 </p>
4129 !! end
4130
4131
4132 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4133 # parser strips. The wikitext contains just the first half of the bold
4134 # quote pair.
4135 !! test
4136 Unclosed and unmatched quotes
4137 !! wikitext
4138 '''''Bold italic text '''with bold deactivated''' in between.'''''
4139
4140 '''''Bold italic text ''with italic deactivated'' in between.'''''
4141
4142 '''Bold text..
4143
4144 ..spanning two paragraphs (should not work).'''
4145
4146 '''Bold tag left open
4147
4148 ''Italic tag left open
4149
4150 Normal text.
4151
4152 <!-- Unmatching number of opening, closing tags: -->
4153 '''This year''''s election ''should'' beat '''last year''''s.
4154
4155 ''Tom'''s car is bigger than ''Susan'''s.
4156
4157 Plain ''italic'''s plain
4158 !! html/php
4159 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4160 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4161 </p><p><b>Bold text..</b>
4162 </p><p>..spanning two paragraphs (should not work).
4163 </p><p><b>Bold tag left open</b>
4164 </p><p><i>Italic tag left open</i>
4165 </p><p>Normal text.
4166 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4167 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4168 </p><p>Plain <i>italic'</i>s plain
4169 </p>
4170 !! html/parsoid
4171 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4172 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4173 </p><p><b>Bold text..</b>
4174 </p><p>..spanning two paragraphs (should not work).<b></b>
4175 </p><p><b>Bold tag left open</b>
4176 </p><p><i>Italic tag left open</i>
4177 </p><p>Normal text.
4178 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4179 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4180 </p><p>Plain <i>italic'</i>s plain
4181 </p>
4182 !! end
4183
4184 ###
4185 ### Tables
4186 ###
4187 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4188 ###
4189
4190 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4191 # is the bare minimum required by the spec, see:
4192 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4193 # Parsoid team replies: empty table tags are legal in HTML5
4194 !! test
4195 A table with no data.
4196 !! options
4197 parsoid=wt2html
4198 !! wikitext
4199 {||}
4200 !! html/php
4201
4202 !! html/parsoid
4203 <table></table>
4204
4205 !! end
4206
4207 !! test
4208 A table with stray table end tags on start tag line (wt2html)
4209 !! options
4210 parsoid=wt2html
4211 !! wikitext
4212 {|style="color: red;"|}
4213
4214 {|style="color: red;" |}
4215 |foo
4216 |}
4217
4218 {|style="color: red;"|} id="foo"
4219 |foo
4220 |}
4221
4222 {|style="color: red;" |} id="foo"
4223 |foo
4224 |}
4225 !! html
4226 <table style="color: red;"></table>
4227
4228 <table style="color: red;">
4229 <tbody><tr>
4230 <td>foo</td>
4231 </tr></tbody>
4232 </table>
4233
4234 <table style="color: red;" id="foo">
4235 <tbody><tr>
4236 <td>foo</td>
4237 </tr></tbody>
4238 </table>
4239
4240 <table style="color: red;" id="foo">
4241 <tbody><tr>
4242 <td>foo</td>
4243 </tr></tbody>
4244 </table>
4245
4246 !! end
4247
4248 !! test
4249 A table with no data (take 2)
4250 !! wikitext
4251 {|
4252 |}
4253 !! html/parsoid
4254 <table></table>
4255 !! end
4256
4257 # A table with nothing but a caption is invalid XHTML, we might want to render
4258 # this as <p>caption</p>
4259 # Parsoid team replies: table with only a caption is legal in HTML5
4260 !! test
4261 A table with nothing but a caption
4262 !! wikitext
4263 {|
4264 |+ caption
4265 |}
4266 !! html/php
4267 <table>
4268 <caption> caption
4269 </caption><tr><td></td></tr></table>
4270
4271 !! html/parsoid
4272 <table><caption> caption</caption></table>
4273 !! end
4274
4275 !! test
4276 A table with caption with default-spaced attributes and a table row
4277 !! wikitext
4278 {|
4279 |+ style="color: red;" | caption1
4280 |-
4281 | foo
4282 |}
4283 !! html
4284 <table>
4285 <caption style="color: red;"> caption1
4286 </caption>
4287 <tr>
4288 <td> foo
4289 </td></tr></table>
4290
4291 !! end
4292
4293 !! test
4294 A table with captions with non-default spaced attributes and a table row
4295 !! wikitext
4296 {|
4297 |+style="color: red;"|caption2
4298 |+ style="color: red;"| caption3
4299 |-
4300 | foo
4301 |}
4302 !! html
4303 <table>
4304 <caption style="color: red;">caption2
4305 </caption>
4306 <caption style="color: red;"> caption3
4307 </caption>
4308 <tr>
4309 <td> foo
4310 </td></tr></table>
4311
4312 !! end
4313
4314 !! test
4315 Table td-cell syntax variations
4316 !! wikitext
4317 {|
4318 | foo bar foo | baz
4319 | foo bar foo || baz
4320 | style='color:red;' | baz
4321 | style='color:red;' || baz
4322 |}
4323 !! html
4324 <table>
4325 <tr>
4326 <td> baz
4327 </td>
4328 <td> foo bar foo </td>
4329 <td> baz
4330 </td>
4331 <td style="color:red;"> baz
4332 </td>
4333 <td> style='color:red;' </td>
4334 <td> baz
4335 </td></tr></table>
4336
4337 !! end
4338
4339 !! test
4340 Simple table
4341 !! wikitext
4342 {|
4343 | 1 || 2
4344 |-
4345 | 3 || 4
4346 |}
4347 !! html
4348 <table>
4349 <tr>
4350 <td> 1 </td>
4351 <td> 2
4352 </td></tr>
4353 <tr>
4354 <td> 3 </td>
4355 <td> 4
4356 </td></tr></table>
4357
4358 !! end
4359
4360 !! test
4361 Simple table but with multiple dashes for row wikitext
4362 !! wikitext
4363 {|
4364 | foo
4365 |-----
4366 | bar
4367 |}
4368 !! html
4369 <table>
4370 <tr>
4371 <td> foo
4372 </td></tr>
4373 <tr>
4374 <td> bar
4375 </td></tr></table>
4376
4377 !! end
4378 !! test
4379 Multiplication table
4380 !! wikitext
4381 {| border="1" cellpadding="2"
4382 |+Multiplication table
4383 |-
4384 ! &times; !! 1 !! 2 !! 3
4385 |-
4386 ! 1
4387 | 1 || 2 || 3
4388 |-
4389 ! 2
4390 | 2 || 4 || 6
4391 |-
4392 ! 3
4393 | 3 || 6 || 9
4394 |-
4395 ! 4
4396 | 4 || 8 || 12
4397 |-
4398 ! 5
4399 | 5 || 10 || 15
4400 |}
4401 !! html
4402 <table border="1" cellpadding="2">
4403 <caption>Multiplication table
4404 </caption>
4405 <tr>
4406 <th> &#215; </th>
4407 <th> 1 </th>
4408 <th> 2 </th>
4409 <th> 3
4410 </th></tr>
4411 <tr>
4412 <th> 1
4413 </th>
4414 <td> 1 </td>
4415 <td> 2 </td>
4416 <td> 3
4417 </td></tr>
4418 <tr>
4419 <th> 2
4420 </th>
4421 <td> 2 </td>
4422 <td> 4 </td>
4423 <td> 6
4424 </td></tr>
4425 <tr>
4426 <th> 3
4427 </th>
4428 <td> 3 </td>
4429 <td> 6 </td>
4430 <td> 9
4431 </td></tr>
4432 <tr>
4433 <th> 4
4434 </th>
4435 <td> 4 </td>
4436 <td> 8 </td>
4437 <td> 12
4438 </td></tr>
4439 <tr>
4440 <th> 5
4441 </th>
4442 <td> 5 </td>
4443 <td> 10 </td>
4444 <td> 15
4445 </td></tr></table>
4446
4447 !! end
4448
4449 !! test
4450 Accept "||" in table headings
4451 !! wikitext
4452 {|
4453 !h1 || h2
4454 |}
4455 !! html
4456 <table>
4457 <tr>
4458 <th>h1 </th>
4459 <th> h2
4460 </th></tr></table>
4461
4462 !! end
4463
4464 !! test
4465 Accept "||" in indented table headings
4466 !! wikitext
4467 :{|
4468 !h1 || h2
4469 |}
4470 !! html
4471 <dl><dd><table>
4472 <tr>
4473 <th>h1 </th>
4474 <th> h2
4475 </th></tr></table></dd></dl>
4476
4477 !! end
4478
4479 !! test
4480 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4481 !! wikitext
4482 {|
4483 !| h1
4484 || a
4485 |}
4486 !! html
4487 <table>
4488 <tr>
4489 <th> h1
4490 </th>
4491 <td> a
4492 </td></tr></table>
4493
4494 !! end
4495
4496 !!test
4497 Accept "| !" at start of line in tables (ignore !-attribute)
4498 !! wikitext
4499 {|
4500 |-
4501 | !style="color:red" | bar
4502 |}
4503 !! html
4504 <table>
4505
4506 <tr>
4507 <td> bar
4508 </td></tr></table>
4509
4510 !!end
4511
4512 !!test
4513 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
4514 !! wikitext
4515 {|
4516 |-
4517 |style='color:red;'|+1
4518 |style='color:blue;'|-1
4519 |-
4520 | 1 || 2 || 3
4521 | 1 ||+2 ||-3
4522 |-
4523 | +1
4524 | -1
4525 |}
4526 !! html
4527 <table>
4528
4529 <tr>
4530 <td style="color:red;">+1
4531 </td>
4532 <td style="color:blue;">-1
4533 </td></tr>
4534 <tr>
4535 <td> 1 </td>
4536 <td> 2 </td>
4537 <td> 3
4538 </td>
4539 <td> 1 </td>
4540 <td>+2 </td>
4541 <td>-3
4542 </td></tr>
4543 <tr>
4544 <td> +1
4545 </td>
4546 <td> -1
4547 </td></tr></table>
4548
4549 !!end
4550
4551 !! test
4552 Table rowspan
4553 !! wikitext
4554 {| border=1
4555 | Cell 1, row 1
4556 |rowspan=2| Cell 2, row 1 (and 2)
4557 | Cell 3, row 1
4558 |-
4559 | Cell 1, row 2
4560 | Cell 3, row 2
4561 |}
4562 !! html
4563 <table border="1">
4564 <tr>
4565 <td> Cell 1, row 1
4566 </td>
4567 <td rowspan="2"> Cell 2, row 1 (and 2)
4568 </td>
4569 <td> Cell 3, row 1
4570 </td></tr>
4571 <tr>
4572 <td> Cell 1, row 2
4573 </td>
4574 <td> Cell 3, row 2
4575 </td></tr></table>
4576
4577 !! end
4578
4579 !! test
4580 Nested table
4581 !! wikitext
4582 {| border=1
4583 | &alpha;
4584 |
4585 {| bgcolor=#ABCDEF border=2
4586 |nested
4587 |-
4588 |table
4589 |}
4590 |the original table again
4591 |}
4592 !! html
4593 <table border="1">
4594 <tr>
4595 <td> &#945;
4596 </td>
4597 <td>
4598 <table bgcolor="#ABCDEF" border="2">
4599 <tr>
4600 <td>nested
4601 </td></tr>
4602 <tr>
4603 <td>table
4604 </td></tr></table>
4605 </td>
4606 <td>the original table again
4607 </td></tr></table>
4608
4609 !! end
4610
4611 !! test
4612 Invalid attributes in table cell (bug 1830)
4613 !! wikitext
4614 {|
4615 |Cell:|broken
4616 |}
4617 !! html
4618 <table>
4619 <tr>
4620 <td>broken
4621 </td></tr></table>
4622
4623 !! end
4624
4625
4626 !! test
4627 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4628 !! wikitext
4629 {|
4630 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4631 !! html
4632 <table>
4633 <tr>
4634 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4635 <td>]" onmouseover="alert(document.cookie)"&gt;test
4636 </td>
4637 </tr>
4638 </table>
4639
4640 !! end
4641
4642
4643 !! test
4644 Indented table markup mixed with indented pre content (proposed in bug 6200)
4645 !! wikitext
4646 <table>
4647 <tr>
4648 <td>
4649 Text that should be rendered preformatted
4650 </td>
4651 </tr>
4652 </table>
4653 !! html
4654 <table>
4655 <tr>
4656 <td>
4657 <pre>Text that should be rendered preformatted
4658 </pre>
4659 </td>
4660 </tr>
4661 </table>
4662
4663 !! end
4664
4665 !! test
4666 Template-generated table cell attributes and cell content
4667 !! wikitext
4668 {|
4669 |{{table_attribs}}
4670 | {{table_attribs}}
4671 |}
4672 !! html
4673 <table>
4674 <tr>
4675 <td style="color: red"> Foo
4676 </td>
4677 <td style="color: red"> Foo
4678 </td></tr></table>
4679
4680 !! end
4681
4682 !! test
4683 Template-generated table cell attributes and cell content (2)
4684 !! wikitext
4685 {|
4686 |align=center {{table_attribs}}
4687 |}
4688 !! html
4689 <table>
4690 <tr>
4691 <td align="center" style="color: red"> Foo
4692 </td></tr></table>
4693
4694 !! end
4695
4696 !! test
4697 Template-generated table cell attributes and cell content (3)
4698 !! wikitext
4699 {|
4700 |align=center {{table_cells}}
4701 |}
4702 !! html
4703 <table>
4704 <tr>
4705 <td align="center" style="color: red"> Foo </td>
4706 <td> Bar </td>
4707 <td> Baz
4708 </td></tr></table>
4709
4710 !! end
4711
4712 !! test
4713 Table with row followed by newlines and table heading
4714 !! wikitext
4715 {|
4716 |-
4717
4718 ! foo
4719 |}
4720 !! html
4721 <table>
4722
4723
4724 <tr>
4725 <th> foo
4726 </th></tr></table>
4727
4728 !! end
4729
4730 !! test
4731 Table with empty line following the start tag
4732 !! wikitext
4733 {|
4734
4735 |-
4736 | foo
4737 |}
4738 !! html
4739 <table>
4740
4741
4742 <tr>
4743 <td> foo
4744 </td></tr></table>
4745
4746 !! end
4747
4748 # FIXME: Preserve the attribute properly (with an empty string as value) in
4749 # the PHP parser. Parsoid implements the behavior below.
4750 !! test
4751 Table attributes with empty value
4752 !! wikitext
4753 {|
4754 | style=| hello
4755 |}
4756 !! html/parsoid
4757 <table>
4758 <tbody>
4759 <tr>
4760 <td style=""> hello
4761 </td></tr></tbody></table>
4762
4763 !! end
4764
4765 !! test
4766 Wikitext table with a lot of comments
4767 !! wikitext
4768 {|
4769 <!-- c0 -->
4770 | foo
4771 <!-- c1 -->
4772 |- <!-- c2 -->
4773 <!-- c3 -->
4774 |<!-- c4 -->
4775 <!-- c5 -->
4776 |}
4777 !! html
4778 <table>
4779 <tr>
4780 <td> foo
4781 </td></tr>
4782 <tr>
4783 <td>
4784 </td></tr></table>
4785
4786 !! end
4787
4788 !! test
4789 Wikitext table with double-line table cell
4790 !! wikitext
4791 {|
4792 |a
4793 b
4794 |}
4795 !! html
4796 <table>
4797 <tr>
4798 <td>a
4799 <p>b
4800 </p>
4801 </td></tr></table>
4802
4803 !! end
4804
4805 !! test
4806 Table cell with a single comment
4807 !! wikitext
4808 {|
4809 | <!-- c1 -->
4810 | a
4811 |}
4812 !! html
4813 <table>
4814 <tr>
4815 <td>
4816 </td>
4817 <td> a
4818 </td></tr></table>
4819
4820 !! end
4821
4822 # The expected HTML structure in this test is debatable. The PHP parser does
4823 # not parse this kind of table at all. The main focus for Parsoid is on
4824 # round-tripping, so this output is ok for now. TODO: revisit!
4825 !! test
4826 Wikitext table with html-syntax row
4827 !! wikitext
4828 {|
4829 |-
4830 <td>foo</td>
4831 |}
4832 !! html/parsoid
4833 <table>
4834 <tbody>
4835 <tr>
4836 <td>foo</td></tr></tbody></table>
4837 !! end
4838
4839 !! test
4840 Implicit <td> after a |-
4841 (PHP parser relies on Tidy to add the missing <td> tags)
4842 !! options
4843 parsoid=wt2html,wt2wt
4844 !! wikitext
4845 {|
4846 |-
4847 a
4848 |}
4849 !! html
4850 <table>
4851 <tr><td>a</td></tr>
4852 </table>
4853 !! end
4854
4855 !! test
4856 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4857 (PHP parser relies on Tidy to add the missing <td> tags)
4858 !! options
4859 parsoid=wt2html,wt2wt
4860 !! wikitext
4861 {|
4862 |-
4863 |
4864 a
4865 |-
4866 b
4867 |}
4868 !! html
4869 <table>
4870 <tbody>
4871 <tr><td><pre>a</pre></td></tr>
4872 <tr><td> b</td></tr>
4873 </tbody>
4874 </table>
4875 !! end
4876
4877 !! test
4878 Lists should be recognized in an implicit <td> context
4879 (PHP parser relies on Tidy to add the missing <td> tags)
4880 !! options
4881 parsoid=wt2html,wt2wt
4882 !! wikitext
4883 {|
4884 |-
4885 *a
4886 |}
4887 !! html
4888 <table>
4889 <tr>
4890 <td><ul>
4891 <li>a</li>
4892 </ul></td>
4893 </tr>
4894 </table>
4895 !! end
4896
4897 !! test
4898 Parsoid: Round-trip tables directly followed by content (bug 51219)
4899 !! options
4900 parsoid=wt2html,wt2wt
4901 !! wikitext
4902 {|
4903 |foo
4904 |} bar
4905
4906 {|
4907 |baz
4908 |}<b>quux</b>
4909 !! html
4910 <table><tbody>
4911 <tr>
4912 <td>foo</td></tr></tbody></table> bar
4913 <table>
4914 <tbody>
4915 <tr>
4916 <td>baz</td></tr></tbody></table><b>quux</b>
4917 !! end
4918
4919 !! test
4920 Parsoid: Default to a newline after tables in new content (bug 51219)
4921 !! options
4922 parsoid=html2wt
4923 !! wikitext
4924 {|
4925 |foo
4926 |}
4927 <nowiki> </nowiki>bar
4928 {|
4929 |baz
4930 |}
4931 '''quux'''
4932 !! html
4933 <table><tbody>
4934 <tr><td>foo</td></tr></tbody></table> bar
4935 <table><tbody>
4936 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4937 !! end
4938
4939 !! test
4940 Parsoid: newline inducing block nodes don't suppress <nowiki>
4941 !! options
4942 parsoid=html2wt
4943 !! wikitext
4944 <nowiki> </nowiki>a
4945
4946 = foo =
4947 !! html
4948 a<h1>foo</h1>
4949 !! end
4950
4951 ###
4952 ### Internal links
4953 ###
4954 !! test
4955 Plain link, capitalized
4956 !! wikitext
4957 [[Main Page]]
4958 !! html
4959 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4960 </p>
4961 !! end
4962
4963 !! test
4964 Plain link, uncapitalized
4965 !! wikitext
4966 [[main Page]]
4967 !! html
4968 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4969 </p>
4970 !! end
4971
4972 !! test
4973 Piped link
4974 !! wikitext
4975 [[Main Page|The Main Page]]
4976 !! html
4977 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4978 </p>
4979 !! end
4980
4981 !! test
4982 Piped link with comment in link text
4983 !! wikitext
4984 [[Main Page|The Main<!--front--> Page]]
4985 !! html
4986 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4987 </p>
4988 !! end
4989
4990 !! test
4991 Broken link
4992 !! wikitext
4993 [[Zigzagzogzagzig]]
4994 !! html
4995 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4996 </p>
4997 !! end
4998
4999 !! test
5000 Broken link with fragment
5001 !! wikitext
5002 [[Zigzagzogzagzig#zug]]
5003 !! html
5004 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5005 </p>
5006 !! end
5007
5008 !! test
5009 Special page link with fragment
5010 !! wikitext
5011 [[Special:Version#anchor]]
5012 !! html
5013 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5014 </p>
5015 !! end
5016
5017 !! test
5018 Nonexistent special page link with fragment
5019 !! wikitext
5020 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5021 !! html
5022 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5023 </p>
5024 !! end
5025
5026 !! test
5027 Link with prefix
5028 !! wikitext
5029 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5030 !! html
5031 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5032 </p>
5033 !! end
5034
5035 !! test
5036 Link with suffix
5037 !! wikitext
5038 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5039 !! html
5040 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
5041 </p>
5042 !! end
5043
5044 !! article
5045 prefixed article
5046 !! text
5047 Some text
5048 !! endarticle
5049
5050 !! test
5051 Bug 43661: Piped links with identical prefixes
5052 !! wikitext
5053 [[prefixed article|prefixed articles with spaces]]
5054
5055 [[prefixed article|prefixed articlesaoeu]]
5056
5057 [[Main Page|Main Page test]]
5058 !! html
5059 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5060 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5061 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5062 </p>
5063 !! end
5064
5065
5066 !! test
5067 Link with HTML entity in suffix / tail
5068 !! wikitext
5069 [[Main Page]]&quot;, [[Main Page]]&#97;
5070 !! html
5071 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
5072 </p>
5073 !! end
5074
5075 !! test
5076 Link with 3 brackets
5077 !! wikitext
5078 [[[Main Page]]]
5079 !! html
5080 <p>[[[Main Page]]]
5081 </p>
5082 !! end
5083
5084 !! test
5085 Link with 4 brackets
5086 !! wikitext
5087 [[[[Main Page]]]]
5088 !! html
5089 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5090 </p>
5091 !! end
5092
5093 !! test
5094 Piped link with 3 brackets
5095 !! wikitext
5096 [[[main page|the main page]]]
5097 !! html
5098 <p>[[[main page|the main page]]]
5099 </p>
5100 !! end
5101
5102 !! test
5103 Piped link with extlink-like text
5104 !! wikitext
5105 [[Main Page|[bar]]]
5106 [[Main Page|This is a [bar]]]
5107 !! html
5108 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5109 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5110 </p>
5111 !! end
5112
5113 !! test
5114 Link with multiple pipes
5115 !! wikitext
5116 [[Main Page|The|Main|Page]]
5117 !! html
5118 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5119 </p>
5120 !! end
5121
5122 !! test
5123 Link to namespaces
5124 !! wikitext
5125 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5126 !! html
5127 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
5128 </p>
5129 !! end
5130
5131 !! article
5132 MemoryAlpha:AlphaTest
5133 !! text
5134 This is an article in the MemoryAlpha namespace
5135 (which shadows the memoryalpha interwiki link).
5136 !! endarticle
5137
5138 !! test
5139 Namespace takes precedence over interwiki link (bug 51680)
5140 !! wikitext
5141 [[MemoryAlpha:AlphaTest]]
5142 !! html
5143 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5144 </p>
5145 !! end
5146
5147 # The previous test doesn't work correctly in html2*, due to not recognizing the
5148 # link as an internal one. This one checks for the correct behavior.
5149 !! test
5150 Link to namespace preferred over interwiki with correct rel attribute
5151 !! options
5152 parsoid=html2wt,html2html
5153 !! wikitext
5154 [[MemoryAlpha:AlphaTest]]
5155 !! html
5156 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5157 </p>
5158 !! end
5159
5160 !! test
5161 Piped link to namespace
5162 !! wikitext
5163 [[Meta:Disclaimers|The disclaimers]]
5164 !! html
5165 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
5166 </p>
5167 !! end
5168
5169 !! test
5170 Link containing }
5171 !! wikitext
5172 [[Usually caused by a typo (oops}]]
5173 !! html
5174 <p>[[Usually caused by a typo (oops}]]
5175 </p>
5176 !! end
5177
5178 !! test
5179 Link containing % (not as a hex sequence)
5180 !! wikitext
5181 [[7% Solution]]
5182 !! html
5183 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5184 </p>
5185 !! end
5186
5187 !! test
5188 Link containing % as a single hex sequence interpreted to char
5189 !! wikitext
5190 [[7%25 Solution]]
5191 !! html
5192 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5193 </p>
5194 !!end
5195
5196 !! test
5197 Link containing % as a double hex sequence interpreted to hex sequence
5198 !! wikitext
5199 [[7%2525 Solution]]
5200 !! html
5201 <p>[[7%2525 Solution]]
5202 </p>
5203 !!end
5204
5205 !! test
5206 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5207 Example for such a section: == < ==
5208 !! wikitext
5209 [[%23%3c]][[%23%3e]]
5210 !! html
5211 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5212 </p>
5213 !! end
5214
5215 !! test
5216 Link containing "<#" and ">#" as a hex sequences
5217 !! wikitext
5218 [[%3c%23]][[%3e%23]]
5219 !! html
5220 <p>[[%3c%23]][[%3e%23]]
5221 </p>
5222 !! end
5223
5224 !! test
5225 Link containing an equals sign
5226 !! wikitext
5227 [[Special:BookSources/isbn=4-00-026157-6]]
5228 !! html
5229 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
5230 </p>
5231 !! end
5232
5233 !! article
5234 Foo~bar
5235 !! text
5236 Just a test of an article title containing a tilde.
5237 !! endarticle
5238
5239 # note that links containing signatures, like [[Foo~~~~]], are
5240 # massaged by the pre-save transform (PST) and so the tildes are never
5241 # seen by the parser.
5242 !! test
5243 Link containing a tilde
5244 !! wikitext
5245 [[Foo~bar]]
5246 !! html
5247 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5248 </p>
5249 !! end
5250
5251 !! test
5252 Link containing double-single-quotes '' (bug 4598)
5253 !! wikitext
5254 [[Lista d''e paise d''o munno]]
5255 !! html
5256 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
5257 </p>
5258 !! end
5259
5260 !! test
5261 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5262 !! wikitext
5263 Some [[Link|pretty ''italics'' and stuff]]!
5264 !! html
5265 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
5266 </p>
5267 !! end
5268
5269 !! test
5270 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5271 !! wikitext
5272 ''Some [[Link|pretty ''italics'' and stuff]]!
5273 !! html
5274 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
5275 </p>
5276 !! end
5277
5278 !! test
5279 Link with double quotes in title part (literal) and alternate part (interpreted)
5280 !! wikitext
5281 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5282
5283 [[''Pentecoste'']]
5284
5285 [[''Pentecoste''|Pentecoste]]
5286
5287 [[''Pentecoste''|''Pentecoste'']]
5288 !! html
5289 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
5290 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
5291 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
5292 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
5293 </p>
5294 !! end
5295
5296 !! test
5297 Broken image links with HTML captions (bug 39700)
5298 !! wikitext
5299 [[File:Nonexistent|<script></script>]]
5300 [[File:Nonexistent|100px|<script></script>]]
5301 [[File:Nonexistent|&lt;]]
5302 [[File:Nonexistent|a<i>b</i>c]]
5303 !! html
5304 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5305 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5306 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5307 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5308 </p>
5309 !! end
5310
5311 !! test
5312 Plain link to URL
5313 !! wikitext
5314 [[http://www.example.com]]
5315 !! html
5316 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5317 </p>
5318 !! end
5319
5320 !! test
5321 Plain link to URL with link text
5322 !! wikitext
5323 [[http://www.example.com Link text]]
5324 !! html
5325 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5326 </p>
5327 !! end
5328
5329 !! test
5330 Plain link to protocol-relative URL
5331 !! wikitext
5332 [[//www.example.com]]
5333 !! html
5334 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5335 </p>
5336 !! end
5337
5338 !! test
5339 Plain link to protocol-relative URL with link text
5340 !! wikitext
5341 [[//www.example.com Link text]]
5342 !! html
5343 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5344 </p>
5345 !! end
5346
5347 !! test
5348 Plain link to page with question mark in title
5349 !! wikitext
5350 [[A?b]]
5351
5352 [[A?b|Baz]]
5353 !! html
5354 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5355 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5356 </p>
5357 !! end
5358
5359
5360 # I'm fairly sure the expected result here is wrong.
5361 # We want these to be URL links, not pseudo-pages with URLs for titles....
5362 # However the current output is also pretty screwy.
5363 #
5364 # ----
5365 # I'm changing it to match the current output--it arguably makes more
5366 # sense in the light of the test above. Old expected result was:
5367 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5368 #</p>
5369 # But I think this test is bordering on "garbage in, garbage out" anyway.
5370 # -- wtm
5371 !! test
5372 Piped link to URL
5373 !! wikitext
5374 Piped link to URL: [[http://www.example.com|an example URL]]
5375 !! html
5376 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5377 </p>
5378 !! end
5379
5380 !! test
5381 BUG 2: [[page|http://url/]] should link to page, not http://url/
5382 !! wikitext
5383 [[Main Page|http://url/]]
5384 !! html
5385 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5386 </p>
5387 !! end
5388
5389 !! test
5390 BUG 337: Escaped self-links should be bold
5391 !! options
5392 title=[[Bug462]]
5393 !! wikitext
5394 [[Bu&#103;462]] [[Bug462]]
5395 !! html
5396 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5397 </p>
5398 !! end
5399
5400 !! test
5401 Self-link to section should not be bold
5402 !! options
5403 title=[[Main Page]]
5404 !! wikitext
5405 [[Main Page#section]]
5406 !! html
5407 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5408 </p>
5409 !! end
5410
5411 !! article
5412 00
5413 !! text
5414 This is 00.
5415 !! endarticle
5416
5417 !!test
5418 Self-link to numeric title
5419 !!options
5420 title=[[0]]
5421 !! wikitext
5422 [[0]]
5423 !! html
5424 <p><strong class="selflink">0</strong>
5425 </p>
5426 !!end
5427
5428 !!test
5429 Link to numeric-equivalent title
5430 !!options
5431 title=[[0]]
5432 !! wikitext
5433 [[00]]
5434 !! html
5435 <p><a href="/wiki/00" title="00">00</a>
5436 </p>
5437 !!end
5438
5439 !! test
5440 <nowiki> inside a link
5441 !! wikitext
5442 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5443 !! html
5444 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5445 </p>
5446 !! end
5447
5448 !! test
5449 Non-breaking spaces in title
5450 !! wikitext
5451 [[&nbsp; Main &nbsp; Page &nbsp;]]
5452 !! html
5453 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5454 </p>
5455 !!end
5456
5457 !! test
5458 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5459 !! options
5460 language=ca
5461 !! wikitext
5462 '''[[Main Page]]'''
5463 !! html
5464 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5465 </p>
5466 !! end
5467
5468 !! test
5469 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5470 !! options
5471 language=ca
5472 !! wikitext
5473 ''[[Main Page]]''
5474 !! html
5475 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5476 </p>
5477 !! end
5478
5479 !! test
5480 Internal link with en linktrail: no apostrophes (bug 27473)
5481 !! options
5482 language=en
5483 !! wikitext
5484 [[Something]]'nice
5485 !! html
5486 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5487 </p>
5488 !! end
5489
5490 !! test
5491 Internal link with ca linktrail with apostrophes (bug 27473)
5492 !! options
5493 language=ca
5494 !! wikitext
5495 [[Something]]'nice
5496 !! html
5497 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5498 </p>
5499 !! end
5500
5501 !! test
5502 Internal link with kaa linktrail with apostrophes (bug 27473)
5503 !! options
5504 language=kaa
5505 !! wikitext
5506 [[Something]]'nice
5507 !! html
5508 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
5509 </p>
5510 !! end
5511
5512 !! test
5513 1. Interaction of linktrail and template encapsulation
5514 !! options
5515 parsoid
5516 !! wikitext
5517 {{echo|[[Foo]]}}l
5518 !! html
5519 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
5520 !! end
5521
5522 !! test
5523 2. Interaction of linktrail and template encapsulation
5524 !! options
5525 parsoid
5526 !! wikitext
5527 {{echo|Some [[Fool]]}}s
5528 !! html
5529 <p data-parsoid='{}'><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
5530 !! end
5531
5532 !! test
5533 3. Interaction of linktrail and template encapsulation
5534 !! options
5535 parsoid
5536 !! wikitext
5537 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5538 !! html
5539 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
5540 !! end
5541
5542 !! article
5543 Söfnuður
5544 !! text
5545 Test.
5546 !! endarticle
5547
5548 !! test
5549 Internal link with is link prefix
5550 !! options
5551 language=is
5552 !! wikitext
5553 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5554 !! html
5555 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5556 </p>
5557 !! end
5558
5559 !! article
5560 Mótmælendatrú
5561 !! text
5562 Test.
5563 !! endarticle
5564
5565 !! test
5566 Internal link with is link trail and link prefix
5567 !! options
5568 language=is
5569 !! wikitext
5570 [[mótmælendatrú|xxx]]ar
5571 [[mótmælendatrú]]ar
5572 mótmælenda[[söfnuður]]
5573 mótmælenda[[söfnuður|söfnuðir]]
5574 mótmælenda[[söfnuður|söfnuðir]]xxx
5575 !! html
5576 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5577 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5578 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5579 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5580 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5581 </p>
5582 !! end
5583
5584 !! test
5585 Parsoid link trail escaping
5586 !! options
5587 parsoid=html2wt,html2html
5588 !! wikitext
5589 [[apple]]<nowiki/>s
5590 !! html
5591 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5592 !! end
5593
5594 !! test
5595 Parsoid link prefix escaping
5596 !! options
5597 language=is
5598 parsoid=html2wt,html2html
5599 !! wikitext
5600 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5601 !! html
5602 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5603 !! end
5604
5605 !! test
5606 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5607 !! wikitext
5608 [[Foo| bar]]
5609
5610 [[Foo| ''bar'']]
5611
5612 [http://wp.org foo]
5613
5614 [http://wp.org ''foo'']
5615 !! html
5616 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5617 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
5618 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5619 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5620 </p>
5621 !! end
5622
5623 !! test
5624 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5625 !! options
5626 parsoid
5627 !! wikitext
5628 [[Foo|{{echo|a}} b {{echo|c}}]]
5629 !! html
5630 <p><a rel="mw:WikiLink" href="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
5631 !! end
5632
5633 ###
5634 ### Interwiki links (see maintenance/interwiki.sql)
5635 ###
5636
5637 !! test
5638 Inline interwiki link
5639 !! wikitext
5640 [[MeatBall:SoftSecurity]]
5641 !! html
5642 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5643 </p>
5644 !! end
5645
5646 !! test
5647 Inline interwiki link with empty title (bug 2372)
5648 !! wikitext
5649 [[MeatBall:]]
5650 !! html
5651 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5652 </p>
5653 !! end
5654
5655 !! test
5656 Interwiki link encoding conversion (bug 1636)
5657 !! wikitext
5658 *[[Wikipedia:ro:Olteni&#0355;a]]
5659 *[[Wikipedia:ro:Olteni&#355;a]]
5660 !! html
5661 <ul>
5662 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
5663 </li>
5664 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
5665 </li>
5666 </ul>
5667
5668 !! end
5669
5670 !! test
5671 Interwiki link with fragment (bug 2130)
5672 !! wikitext
5673 [[MeatBall:SoftSecurity#foo]]
5674 !! html
5675 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5676 </p>
5677 !! end
5678
5679 # Ideally the wikipedia: prefix here should be proto-relative too
5680 !! test
5681 Different interwiki prefixes mapping to the same URL
5682 !! options
5683 parsoid
5684 !! wikitext
5685 [[wikipedia:Foo]]
5686
5687 [[:en:Foo]]
5688 !! html
5689 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}'>wikipedia:Foo</a></p>
5690
5691 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}'>en:Foo</a></p>
5692 !! end
5693
5694 !! test
5695 Interwiki links that cannot be represented in wiki syntax
5696 !! options
5697 parsoid
5698 !! wikitext
5699 [[meatball:ok]]
5700 [[meatball:ok#foo|ok with fragment]]
5701 [[meatball:ok_as_well?|ok ending with ? mark]]
5702 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5703 [http://de.wikipedia.org/wiki/#foo is just fragment]
5704
5705 !! html
5706 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5707 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5708 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
5709 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5710 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5711 !! end
5712
5713 !! test
5714 Interwiki links: trail
5715 !! options
5716 parsoid
5717 !! wikitext
5718 [[wikipedia:Foo|Ba]]r
5719 !! html
5720 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}'>Bar</a></p>
5721 !! end
5722
5723 ###
5724 ### Interlanguage links
5725 ### Language links (so that searching for '### language' matches..)
5726 ###
5727
5728 !! test
5729 Interlanguage link
5730 !! wikitext
5731 Blah blah blah
5732 [[zh:Chinese]]
5733 !! html
5734 <p>Blah blah blah
5735 </p>
5736 !! end
5737
5738 !! test
5739 Double interlanguage link
5740 !! wikitext
5741 Blah blah blah
5742 [[es:Spanish]]
5743 [[zh:Chinese]]
5744 !! html
5745 <p>Blah blah blah
5746 </p>
5747 !! end
5748
5749 !! test
5750 Interlanguage link, with prefix links
5751 !! options
5752 language=ln
5753 !! wikitext
5754 Blah blah blah
5755 [[zh:Chinese]]
5756 !! html
5757 <p>Blah blah blah
5758 </p>
5759 !! end
5760
5761 !! test
5762 Double interlanguage link, with prefix links (bug 8897)
5763 !! options
5764 language=ln
5765 !! wikitext
5766 Blah blah blah
5767 [[es:Spanish]]
5768 [[zh:Chinese]]
5769 !! html
5770 <p>Blah blah blah
5771 </p>
5772 !! end
5773
5774 !! test
5775 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5776 !! options
5777 language=ln
5778 !! wikitext
5779 [[WW&nbsp;II]]
5780 !! html
5781 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
5782 </p>
5783 !! end
5784
5785 !! test
5786 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5787 !! options
5788 parsoid=html2wt
5789 !! wikitext
5790 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5791
5792 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5793 !! html
5794 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5795 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5796 !! end
5797
5798 !! test
5799 Parsoid: handle constructor well
5800 !! options
5801 parsoid
5802 !! wikitext
5803 [[constructor]]
5804
5805 [[constructor:foo]]
5806 !! html
5807 <p><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
5808
5809 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
5810 !! end
5811
5812 !! test
5813 Parsoid: recognize interlanguage links without a target page
5814 !! options
5815 parsoid
5816 !! wikitext
5817 [[ko:]]
5818 !! html
5819 <p>
5820 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
5821 !! end
5822
5823 !! test
5824 Parsoid: recognize interwiki links without a target page
5825 !! options
5826 parsoid
5827 !! wikitext
5828 [[:ko:]]
5829 !! html
5830 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
5831 !! end
5832
5833 !! test
5834 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
5835 !! options
5836 parsoid
5837 !! wikitext
5838 [[en:Foo]]
5839 !! html
5840 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
5841 !! end
5842
5843 ###
5844 ### Redirects, Parsoid-only
5845 ###
5846 !! test
5847 1. Simple redirect to page
5848 !! options
5849 parsoid
5850 !! wikitext
5851 #REDIRECT [[Main Page]]
5852 !! html
5853 <link rel="mw:PageProp/redirect" href="./Main_Page">
5854 !! end
5855
5856 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
5857 !! test
5858 2. Other redirect variants
5859 !! options
5860 parsoid=wt2html,wt2wt
5861 !! wikitext
5862 #REDIRECT [[Main_Page]]
5863 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
5864 !! html
5865 <link rel="mw:PageProp/redirect" href="./Main_Page">
5866 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
5867 !! end
5868
5869 !! test
5870 Optional colon in #REDIRECT
5871 !! options
5872 # the colon is archaic syntax. we support it for wt2html, but we
5873 # don't care that it roundtrips back to the modern syntax.
5874 parsoid=wt2html,html2html
5875 !! wikitext
5876 #REDIRECT:[[Main Page]]
5877 !! html
5878 <link rel="mw:PageProp/redirect" href="./Main_Page">
5879 !! end
5880
5881 !! test
5882 Whitespace in #REDIRECT with optional colon
5883 !! options
5884 # the colon and gratuitous whitespace is archaic syntax. we support
5885 # it for wt2html, but we don't care that it roundtrips back to the
5886 # modern syntax (without extra whitespace)
5887 parsoid=wt2html,html2html
5888 !! wikitext
5889
5890 #REDIRECT
5891 :
5892 [[Main Page]]
5893 !! html
5894 <link rel="mw:PageProp/redirect" href="./Main_Page">
5895 !! end
5896
5897 !! test
5898 Piped link in #REDIRECT
5899 !! options
5900 # content after piped link is ignored. we support this syntax,
5901 # but don't care that the piped link is lost when we roundtrip this.
5902 parsoid=wt2html
5903 !! wikitext
5904 #REDIRECT [[Main Page|bar]]
5905 !! html
5906 <link rel="mw:PageProp/redirect" href="./Main_Page">
5907 !! end
5908
5909 !! test
5910 Redirect to category
5911 !! options
5912 parsoid=wt2html
5913 !! wikitext
5914 #REDIRECT [[Category:Foo]]
5915 !! html
5916 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5917 !! end
5918
5919 !! test
5920 Redirect to category with URL encoding
5921 !! options
5922 parsoid=wt2html
5923 !! wikitext
5924 #REDIRECT [[Category%3AFoo]]
5925 !! html
5926 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
5927 !! end
5928
5929 !! test
5930 Redirect to category page
5931 !! options
5932 parsoid=wt2html,html2html
5933 !! wikitext
5934 #REDIRECT [[:Category:Foo]]
5935 !! html
5936 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5937 !! end
5938
5939 !! test
5940 Redirect to image page (1)
5941 !! options
5942 parsoid
5943 !! wikitext
5944 #REDIRECT [[File:Wiki.png]]
5945 !! html
5946 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5947 !! end
5948
5949 !! test
5950 Redirect to image page (2)
5951 !! options
5952 parsoid
5953 !! wikitext
5954 #REDIRECT [[Image:Wiki.png]]
5955 !! html
5956 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5957 !! end
5958
5959 !! test
5960 Redirect to language
5961 !! options
5962 parsoid
5963 !! wikitext
5964 #REDIRECT [[en:File:Wiki.png]]
5965 !! html
5966 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5967 !! end
5968
5969 !! test
5970 Redirect to interwiki
5971 !! options
5972 parsoid
5973 !! wikitext
5974 #REDIRECT [[meatball:File:Wiki.png]]
5975 !! html
5976 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5977 !! end
5978
5979 !! test
5980 Non-English #REDIRECT
5981 !! options
5982 parsoid
5983 language=is
5984 !! wikitext
5985 #TILVÍSUN [[Main Page]]
5986 !! html
5987 <link rel="mw:PageProp/redirect" href="./Main_Page">
5988 !! end
5989
5990 !! test
5991 New redirect
5992 !! options
5993 parsoid=html2wt
5994 !! wikitext
5995 Foo
5996 #REDIRECT [[Foo]]
5997 !! html
5998 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
5999 !! end
6000
6001 ##
6002 ## XHTML tidiness
6003 ###
6004
6005 !! test
6006 <br> to <br />
6007 !! wikitext
6008 1<br>2<br />3
6009 !! html
6010 <p>1<br />2<br />3
6011 </p>
6012 !! end
6013
6014 !! test
6015 Broken br tag sanitization
6016 !! wikitext
6017 </br>
6018 !! html/php
6019 <p>&lt;/br&gt;
6020 </p>
6021 !! end
6022
6023 # TODO: Fix html2html mode (bug 51055)!
6024 !! test
6025 Parsoid: Broken br tag recognition
6026 !! options
6027 parsoid=wt2html
6028 !! wikitext
6029 </br>
6030 !! html/parsoid
6031 <p><br></p>
6032 !! end
6033
6034 !! test
6035 Incorrecly removing closing slashes from correctly formed XHTML
6036 !! wikitext
6037 <br style="clear:both;" />
6038 !! html
6039 <p><br style="clear:both;" />
6040 </p>
6041 !! end
6042
6043 !! test
6044 Failing to transform badly formed HTML into correct XHTML
6045 !! wikitext
6046 <br style="clear: left;">
6047 <br style="clear: right;">
6048 <br style="clear: both;">
6049 !! html
6050 <p><br style="clear: left;" />
6051 <br style="clear: right;" />
6052 <br style="clear: both;" />
6053 </p>
6054 !!end
6055
6056 !! test
6057 Handling html with a div self-closing tag
6058 !! wikitext
6059 <div title />
6060 <div title/>
6061 <div title/ >
6062 <div title=bar />
6063 <div title=bar/>
6064 <div title=bar/ >
6065 !! html
6066 <p>&lt;div title /&gt;
6067 &lt;div title/&gt;
6068 </p>
6069 <div>
6070 <p>&lt;div title=bar /&gt;
6071 &lt;div title=bar/&gt;
6072 </p>
6073 <div title="bar/"></div>
6074 </div>
6075
6076 !! end
6077
6078 !! test
6079 Handling html with a br self-closing tag
6080 !! wikitext
6081 <br title />
6082 <br title/>
6083 <br title/ >
6084 <br title=bar />
6085 <br title=bar/>
6086 <br title=bar/ >
6087 !! html
6088 <p><br title="title" />
6089 <br title="title" />
6090 <br />
6091 <br title="bar" />
6092 <br title="bar" />
6093 <br title="bar/" />
6094 </p>
6095 !! end
6096
6097 !! test
6098 Horizontal ruler (should it add that extra space?)
6099 !! wikitext
6100 <hr>
6101 <hr >
6102 foo <hr
6103 > bar
6104 !! html
6105 <hr />
6106 <hr />
6107 foo <hr /> bar
6108
6109 !! end
6110
6111 !! test
6112 Horizontal ruler -- 4+ dashes render hr
6113 !! wikitext
6114 ----
6115 !! html
6116 <hr />
6117
6118 !! end
6119
6120 !! test
6121 Horizontal ruler -- eats additional dashes on the same line
6122 !! wikitext
6123 ---------
6124 !! html
6125 <hr />
6126
6127 !! end
6128
6129 !! test
6130 Horizontal ruler -- does not collapse dashes on consecutive lines
6131 !! wikitext
6132 ----
6133 ----
6134 !! html
6135 <hr />
6136 <hr />
6137
6138 !! end
6139
6140 !! test
6141 Horizontal ruler -- <4 dashes render as plain text
6142 !! wikitext
6143 ---
6144 !! html
6145 <p>---
6146 </p>
6147 !! end
6148
6149 !! test
6150 Horizontal ruler -- Supports content following dashes on same line
6151 !! wikitext
6152 ---- Foo
6153 !! html
6154 <hr /> Foo
6155
6156 !! end
6157
6158 ###
6159 ### Block-level elements
6160 ###
6161 !! test
6162 Common list
6163 !! wikitext
6164 *Common list
6165 * item 2
6166 *item 3
6167 !! html
6168 <ul>
6169 <li>Common list
6170 </li>
6171 <li> item 2
6172 </li>
6173 <li>item 3
6174 </li>
6175 </ul>
6176
6177 !! end
6178
6179 !! test
6180 Numbered list
6181 !! wikitext
6182 #Numbered list
6183 #item 2
6184 # item 3
6185 !! html
6186 <ol>
6187 <li>Numbered list
6188 </li>
6189 <li>item 2
6190 </li>
6191 <li> item 3
6192 </li>
6193 </ol>
6194
6195 !! end
6196
6197 !! test
6198 Mixed list
6199 !! wikitext
6200 *Mixed list
6201 *# with numbers
6202 ** and bullets
6203 *# and numbers
6204 *bullets again
6205 **bullet level 2
6206 ***bullet level 3
6207 ***#Number on level 4
6208 **bullet level 2
6209 **#Number on level 3
6210 **#Number on level 3
6211 *#number level 2
6212 *Level 1
6213 *** Level 3
6214 #** Level 3, but ordered
6215 !! html
6216 <ul>
6217 <li>Mixed list
6218 <ol>
6219 <li> with numbers
6220 </li>
6221 </ol>
6222 <ul>
6223 <li> and bullets
6224 </li>
6225 </ul>
6226 <ol>
6227 <li> and numbers
6228 </li>
6229 </ol>
6230 </li>
6231 <li>bullets again
6232 <ul>
6233 <li>bullet level 2
6234 <ul>
6235 <li>bullet level 3
6236 <ol>
6237 <li>Number on level 4
6238 </li>
6239 </ol>
6240 </li>
6241 </ul>
6242 </li>
6243 <li>bullet level 2
6244 <ol>
6245 <li>Number on level 3
6246 </li>
6247 <li>Number on level 3
6248 </li>
6249 </ol>
6250 </li>
6251 </ul>
6252 <ol>
6253 <li>number level 2
6254 </li>
6255 </ol>
6256 </li>
6257 <li>Level 1
6258 <ul>
6259 <li><ul>
6260 <li> Level 3
6261 </li>
6262 </ul>
6263 </li>
6264 </ul>
6265 </li>
6266 </ul>
6267 <ol>
6268 <li><ul>
6269 <li><ul>
6270 <li> Level 3, but ordered
6271 </li>
6272 </ul>
6273 </li>
6274 </ul>
6275 </li>
6276 </ol>
6277
6278 !! end
6279
6280 !! test
6281 Nested lists 1
6282 !! wikitext
6283 *foo
6284 **bar
6285 !! html
6286 <ul>
6287 <li>foo
6288 <ul>
6289 <li>bar
6290 </li>
6291 </ul>
6292 </li>
6293 </ul>
6294
6295 !! end
6296
6297 !! test
6298 Nested lists 2
6299 !! wikitext
6300 **foo
6301 *bar
6302 !! html
6303 <ul>
6304 <li><ul>
6305 <li>foo
6306 </li>
6307 </ul>
6308 </li>
6309 <li>bar
6310 </li>
6311 </ul>
6312
6313 !! end
6314
6315 !! test
6316 Nested lists 3 (first element empty)
6317 !! wikitext
6318 *
6319 **bar
6320 !! html
6321 <ul>
6322 <li>
6323 <ul>
6324 <li>bar
6325 </li>
6326 </ul>
6327 </li>
6328 </ul>
6329
6330 !! end
6331
6332 !! test
6333 Nested lists 4 (first element empty)
6334 !! wikitext
6335 **
6336 *bar
6337 !! html
6338 <ul>
6339 <li><ul>
6340 <li>
6341 </li>
6342 </ul>
6343 </li>
6344 <li>bar
6345 </li>
6346 </ul>
6347
6348 !! end
6349
6350 !! test
6351 Nested lists 5 (both elements empty)
6352 !! wikitext
6353 **
6354 *
6355 !! html
6356 <ul>
6357 <li><ul>
6358 <li>
6359 </li>
6360 </ul>
6361 </li>
6362 <li>
6363 </li>
6364 </ul>
6365
6366 !! end
6367
6368 !! test
6369 Nested lists 6 (both elements empty)
6370 !! wikitext
6371 *
6372 **
6373 !! html
6374 <ul>
6375 <li>
6376 <ul>
6377 <li>
6378 </li>
6379 </ul>
6380 </li>
6381 </ul>
6382
6383 !! end
6384
6385 !! test
6386 Nested lists 7 (skip initial nesting levels)
6387 !! wikitext
6388 *** foo
6389 !! html
6390 <ul>
6391 <li><ul>
6392 <li><ul>
6393 <li> foo
6394 </li>
6395 </ul>
6396 </li>
6397 </ul>
6398 </li>
6399 </ul>
6400
6401 !! end
6402
6403 !! test
6404 Nested lists 8 (multiple nesting transitions)
6405 !! wikitext
6406 * foo
6407 *** bar
6408 ** baz
6409 * boo
6410 !! html
6411 <ul>
6412 <li> foo
6413 <ul>
6414 <li><ul>
6415 <li> bar
6416 </li>
6417 </ul>
6418 </li>
6419 <li> baz
6420 </li>
6421 </ul>
6422 </li>
6423 <li> boo
6424 </li>
6425 </ul>
6426
6427 !! end
6428
6429 !! test
6430 1. Lists with start-of-line-transparent tokens before bullets: Comments
6431 !! wikitext
6432 *foo
6433 *<!--cmt-->bar
6434 <!--cmt-->*baz
6435 !! html
6436 <ul>
6437 <li>foo
6438 </li>
6439 <li>bar
6440 </li>
6441 <li>baz
6442 </li>
6443 </ul>
6444
6445 !! end
6446
6447 !! test
6448 2. Lists with start-of-line-transparent tokens before bullets: Template close
6449 !! wikitext
6450 *foo {{echo|bar
6451 }}*baz
6452 !! html
6453 <ul>
6454 <li>foo bar
6455 </li>
6456 <li>baz
6457 </li>
6458 </ul>
6459
6460 !! end
6461
6462 !! test
6463 List items are not parsed correctly following a <pre> block (bug 785)
6464 !! wikitext
6465 * <pre>foo</pre>
6466 * <pre>bar</pre>
6467 * zar
6468 !! html
6469 <ul>
6470 <li> <pre>foo</pre>
6471 </li>
6472 <li> <pre>bar</pre>
6473 </li>
6474 <li> zar
6475 </li>
6476 </ul>
6477
6478 !! end
6479
6480 !! test
6481 List items from template
6482 !! wikitext
6483
6484 {{inner list}}
6485 * item 2
6486
6487 * item 0
6488 {{inner list}}
6489 * item 2
6490
6491 * item 0
6492 * notSOL{{inner list}}
6493 * item 2
6494 !! html
6495 <ul>
6496 <li> item 1
6497 </li>
6498 <li> item 2
6499 </li>
6500 </ul>
6501 <ul>
6502 <li> item 0
6503 </li>
6504 <li> item 1
6505 </li>
6506 <li> item 2
6507 </li>
6508 </ul>
6509 <ul>
6510 <li> item 0
6511 </li>
6512 <li> notSOL
6513 </li>
6514 <li> item 1
6515 </li>
6516 <li> item 2
6517 </li>
6518 </ul>
6519
6520 !! end
6521
6522 !! test
6523 List interrupted by empty line or heading
6524 !! wikitext
6525 * foo
6526
6527 ** bar
6528 == A heading ==
6529 * Another list item
6530 !! html
6531 <ul>
6532 <li> foo
6533 </li>
6534 </ul>
6535 <ul>
6536 <li><ul>
6537 <li> bar
6538 </li>
6539 </ul>
6540 </li>
6541 </ul>
6542 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6543 <ul>
6544 <li> Another list item
6545 </li>
6546 </ul>
6547
6548 !!end
6549
6550 !!test
6551 Multiple list tags generated by templates
6552 !! wikitext
6553 {{echo|<li>}}a
6554 {{echo|<li>}}b
6555 {{echo|<li>}}c
6556 !! html
6557 <li>a
6558 <li>b
6559 <li>c</li>
6560 </li>
6561 </li>
6562
6563 !!end
6564
6565 !!test
6566 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6567 !! wikitext
6568 *a
6569 <!--This line will NOT split the list-->
6570 *b
6571 <!--This line will NOT split the list either-->
6572 *c
6573 <!--foo--> <!----> <!--This line NOT split the list either-->
6574 *d
6575 !! html
6576 <ul>
6577 <li>a
6578 </li>
6579 <li>b
6580 </li>
6581 <li>c
6582 </li>
6583 <li>d
6584 </li>
6585 </ul>
6586
6587 !!end
6588
6589 !!test
6590 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6591 !! wikitext
6592 *a
6593 <!--This line will NOT split the list-->
6594 *b
6595 <!--This line will NOT split the list either-->
6596 *c
6597 <!--foo--> <!----> <!--This line NOT split the list
6598 either-->
6599 *d
6600 !! html
6601 <ul>
6602 <li>a
6603 </li>
6604 <li>b
6605 </li>
6606 <li>c
6607 </li>
6608 <li>d
6609 </li>
6610 </ul>
6611
6612 !!end
6613
6614 !!test
6615 Test the li-hack
6616 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6617 !!options
6618 parsoid=wt2html,wt2wt
6619 !! wikitext
6620 * foo
6621 * <li>li-hack
6622 * {{echo|<li>templated li-hack}}
6623 * <!--foo--> <li> unsupported li-hack with preceding comments
6624
6625 <ul>
6626 <li><li>not a li-hack
6627 </li>
6628 </ul>
6629 !! html
6630 <ul>
6631 <li> foo</li>
6632 <li>li-hack</li>
6633 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
6634 <li> <!--foo--> </li>
6635 <li> li-hack with preceding comments</li>
6636 </ul>
6637
6638 <ul>
6639 <li></li>
6640 <li>not a li-hack
6641 </li>
6642 </ul>
6643 !!end
6644
6645 !! test
6646 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6647 !! options
6648 parsoid
6649 !! wikitext
6650 # foo
6651 ## bar
6652 * foo
6653 ** bar
6654 : foo
6655 :: bar
6656 !! html
6657 <ol>
6658 <li> foo<ol>
6659 <li> bar</li>
6660 </ol></li>
6661 </ol><ul>
6662 <li> foo<ul>
6663 <li> bar</li>
6664 </ul></li>
6665 </ul><dl>
6666 <dd> foo<dl>
6667 <dd> bar</dd>
6668 </dl></dd>
6669 </dl>
6670 !! end
6671
6672 !! test
6673 Parsoid: Test of whitespace serialization with Templated bullets
6674 !! options
6675 parsoid
6676 !! wikitext
6677 * {{bullet}}
6678 !! html
6679 <ul>
6680 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6681 </ul>
6682 !! end
6683
6684 # ------------------------------------------------------------------------
6685 # The next set of tests are about Parsoid's ability to handle badly nested
6686 # tags (parse, minimize scope of fixup, and roundtrip back)
6687 # ------------------------------------------------------------------------
6688
6689 !! test
6690 Unbalanced closing block tags break a list
6691 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6692 !! wikitext
6693 <div>
6694 *a</div><div>
6695 *b</div>
6696 !! html/parsoid
6697 <div>
6698 <ul>
6699 <li>a
6700 </li>
6701 </ul></div><div>
6702 <ul>
6703 <li>b
6704 </li>
6705 </ul></div>
6706 !! end
6707
6708 !! test
6709 Unbalanced closing non-block tags don't break a list
6710 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6711 !! wikitext
6712 <span>
6713 *a</span><span>
6714 *b</span>
6715 !! html/parsoid
6716 <p><span></span>
6717 </p>
6718 <ul>
6719 <li>a<span></span>
6720 </li>
6721 <li>b
6722 </li>
6723 </ul>
6724 !! end
6725
6726 !! test
6727 Unclosed formatting tags that straddle lists are closed and reopened
6728 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6729 !! wikitext
6730 # <s> a
6731 # b </s>
6732 !! html/parsoid
6733 <ol>
6734 <li> <s> a </s>
6735 </li>
6736 <li> <s> b </s>
6737 </li>
6738 </ol>
6739 !! end
6740
6741 !!test
6742 List embedded in a non-block tag
6743 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6744 !! wikitext
6745 <small>
6746 * foo
6747 </small>
6748 !! html/parsoid
6749 <p><small></small></p>
6750 <small>
6751 <ul>
6752 <li> foo</li>
6753 </ul>
6754 </small>
6755 <p><small></small></p>
6756 !!end
6757
6758 !! test
6759 Table with missing opening <tr> tag
6760 !! options
6761 parsoid=wt2html,wt2wt
6762 !! wikitext
6763 <table>
6764 <td>foo</td>
6765 </tr>
6766 </table>
6767 !! html/parsoid
6768 <table>
6769 <tr>
6770 <td>foo</td>
6771 </tr>
6772 </table>
6773 !! end
6774
6775 ###
6776 ### Magic Words
6777 ###
6778
6779 # Note that the current date is hard-coded as
6780 # 1970-01-01T00:02:03Z (a Thursday)
6781 # when running parser tests. The timezone is also fixed to GMT, so
6782 # local date will be identical to current date.
6783
6784 !! test
6785 Magic Word: {{CURRENTDAY}}
6786 !! wikitext
6787 {{CURRENTDAY}}
6788 !! html
6789 <p>1
6790 </p>
6791 !! end
6792
6793 !! test
6794 Magic Word: {{CURRENTDAY2}}
6795 !! wikitext
6796 {{CURRENTDAY2}}
6797 !! html
6798 <p>01
6799 </p>
6800 !! end
6801
6802 !! test
6803 Magic Word: {{CURRENTDAYNAME}}
6804 !! wikitext
6805 {{CURRENTDAYNAME}}
6806 !! html
6807 <p>Thursday
6808 </p>
6809 !! end
6810
6811 !! test
6812 Magic Word: {{CURRENTDOW}}
6813 !! wikitext
6814 {{CURRENTDOW}}
6815 !! html
6816 <p>4
6817 </p>
6818 !! end
6819
6820 !! test
6821 Magic Word: {{CURRENTMONTH}}
6822 !! wikitext
6823 {{CURRENTMONTH}}
6824 !! html
6825 <p>01
6826 </p>
6827 !! end
6828
6829 !! test
6830 Magic Word: {{CURRENTMONTH1}}
6831 !! wikitext
6832 {{CURRENTMONTH1}}
6833 !! html
6834 <p>1
6835 </p>
6836 !! end
6837
6838 !! test
6839 Magic Word: {{CURRENTMONTHABBREV}}
6840 !! wikitext
6841 {{CURRENTMONTHABBREV}}
6842 !! html
6843 <p>Jan
6844 </p>
6845 !! end
6846
6847 !! test
6848 Magic Word: {{CURRENTMONTHNAME}}
6849 !! wikitext
6850 {{CURRENTMONTHNAME}}
6851 !! html
6852 <p>January
6853 </p>
6854 !! end
6855
6856 !! test
6857 Magic Word: {{CURRENTMONTHNAMEGEN}}
6858 !! wikitext
6859 {{CURRENTMONTHNAMEGEN}}
6860 !! html
6861 <p>January
6862 </p>
6863 !! end
6864
6865 !! test
6866 Magic Word: {{CURRENTTIME}}
6867 !! wikitext
6868 {{CURRENTTIME}}
6869 !! html
6870 <p>00:02
6871 </p>
6872 !! end
6873
6874 !! test
6875 Magic Word: {{CURRENTHOUR}}
6876 !! wikitext
6877 {{CURRENTHOUR}}
6878 !! html
6879 <p>00
6880 </p>
6881 !! end
6882
6883 !! test
6884 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6885 !! wikitext
6886 {{CURRENTWEEK}}
6887 !! html
6888 <p>1
6889 </p>
6890 !! end
6891
6892 !! test
6893 Magic Word: {{CURRENTYEAR}}
6894 !! wikitext
6895 {{CURRENTYEAR}}
6896 !! html
6897 <p>1970
6898 </p>
6899 !! end
6900
6901 !! test
6902 Magic Word: {{CURRENTTIMESTAMP}}
6903 !! wikitext
6904 {{CURRENTTIMESTAMP}}
6905 !! html
6906 <p>19700101000203
6907 </p>
6908 !! end
6909
6910 !! test
6911 Magic Words LOCAL (UTC)
6912 !! wikitext
6913 * {{LOCALMONTH}}
6914 * {{LOCALMONTH1}}
6915 * {{LOCALMONTHNAME}}
6916 * {{LOCALMONTHNAMEGEN}}
6917 * {{LOCALMONTHABBREV}}
6918 * {{LOCALDAY}}
6919 * {{LOCALDAY2}}
6920 * {{LOCALDAYNAME}}
6921 * {{LOCALYEAR}}
6922 * {{LOCALTIME}}
6923 * {{LOCALHOUR}}
6924 * {{LOCALWEEK}}
6925 * {{LOCALDOW}}
6926 * {{LOCALTIMESTAMP}}
6927 !! html
6928 <ul>
6929 <li> 01
6930 </li>
6931 <li> 1
6932 </li>
6933 <li> January
6934 </li>
6935 <li> January
6936 </li>
6937 <li> Jan
6938 </li>
6939 <li> 1
6940 </li>
6941 <li> 01
6942 </li>
6943 <li> Thursday
6944 </li>
6945 <li> 1970
6946 </li>
6947 <li> 00:02
6948 </li>
6949 <li> 00
6950 </li>
6951 <li> 1
6952 </li>
6953 <li> 4
6954 </li>
6955 <li> 19700101000203
6956 </li>
6957 </ul>
6958
6959 !! end
6960
6961 !! test
6962 Magic Word: {{FULLPAGENAME}}
6963 !! options
6964 title=[[User:Ævar Arnfjörð Bjarmason]]
6965 !! wikitext
6966 {{FULLPAGENAME}}
6967 !! html
6968 <p>User:Ævar Arnfjörð Bjarmason
6969 </p>
6970 !! end
6971
6972 !! test
6973 Magic Word: {{FULLPAGENAMEE}}
6974 !! options
6975 title=[[User:Ævar Arnfjörð Bjarmason]]
6976 !! wikitext
6977 {{FULLPAGENAMEE}}
6978 !! html
6979 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6980 </p>
6981 !! end
6982
6983 !! test
6984 Magic Word: {{TALKSPACE}}
6985 !! options
6986 title=[[User:Ævar Arnfjörð Bjarmason]]
6987 !! wikitext
6988 {{TALKSPACE}}
6989 !! html
6990 <p>User talk
6991 </p>
6992 !! end
6993
6994 !! test
6995 Magic Word: {{TALKSPACE}}, same namespace
6996 !! options
6997 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6998 !! wikitext
6999 {{TALKSPACE}}
7000 !! html
7001 <p>User talk
7002 </p>
7003 !! end
7004
7005 !! test
7006 Magic Word: {{TALKSPACE}}, main namespace
7007 !! options
7008 title=[[Parser Test]]
7009 !! wikitext
7010 {{TALKSPACE}}
7011 !! html
7012 <p>Talk
7013 </p>
7014 !! end
7015
7016 !! test
7017 Magic Word: {{TALKSPACEE}}
7018 !! options
7019 title=[[User:Ævar Arnfjörð Bjarmason]]
7020 !! wikitext
7021 {{TALKSPACEE}}
7022 !! html
7023 <p>User_talk
7024 </p>
7025 !! end
7026
7027 !! test
7028 Magic Word: {{SUBJECTSPACE}}
7029 !! options
7030 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7031 !! wikitext
7032 {{SUBJECTSPACE}}
7033 !! html
7034 <p>User
7035 </p>
7036 !! end
7037
7038 !! test
7039 Magic Word: {{SUBJECTSPACE}}, same namespace
7040 !! options
7041 title=[[User:Ævar Arnfjörð Bjarmason]]
7042 !! wikitext
7043 {{SUBJECTSPACE}}
7044 !! html
7045 <p>User
7046 </p>
7047 !! end
7048
7049 !! test
7050 Magic Word: {{SUBJECTSPACE}}, main namespace
7051 !! options
7052 title=[[Parser Test]]
7053 !! wikitext
7054 {{SUBJECTSPACE}}
7055 !! html
7056
7057 !! end
7058
7059 !! test
7060 Magic Word: {{SUBJECTSPACEE}}
7061 !! options
7062 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7063 !! wikitext
7064 {{SUBJECTSPACEE}}
7065 !! html
7066 <p>User
7067 </p>
7068 !! end
7069
7070 !! test
7071 Magic Word: {{NAMESPACE}}
7072 !! options
7073 title=[[User:Ævar Arnfjörð Bjarmason]]
7074 !! wikitext
7075 {{NAMESPACE}}
7076 !! html
7077 <p>User
7078 </p>
7079 !! end
7080
7081 !! test
7082 Magic Word: {{NAMESPACEE}}
7083 !! options
7084 title=[[User:Ævar Arnfjörð Bjarmason]]
7085 !! wikitext
7086 {{NAMESPACEE}}
7087 !! html
7088 <p>User
7089 </p>
7090 !! end
7091
7092 !! test
7093 Magic Word: {{NAMESPACENUMBER}}
7094 !! options
7095 title=[[User:Ævar Arnfjörð Bjarmason]]
7096 !! wikitext
7097 {{NAMESPACENUMBER}}
7098 !! html
7099 <p>2
7100 </p>
7101 !! end
7102
7103 !! test
7104 Magic Word: {{SUBPAGENAME}}
7105 !! options
7106 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7107 !! wikitext
7108 {{SUBPAGENAME}}
7109 !! html
7110 <p>sub ö
7111 </p>
7112 !! end
7113
7114 !! test
7115 Magic Word: {{SUBPAGENAMEE}}
7116 !! options
7117 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7118 !! wikitext
7119 {{SUBPAGENAMEE}}
7120 !! html
7121 <p>sub_%C3%B6
7122 </p>
7123 !! end
7124
7125 !! test
7126 Magic Word: {{ROOTPAGENAME}}
7127 !! options
7128 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7129 !! wikitext
7130 {{ROOTPAGENAME}}
7131 !! html
7132 <p>Ævar Arnfjörð Bjarmason
7133 </p>
7134 !! end
7135
7136 !! test
7137 Magic Word: {{ROOTPAGENAMEE}}
7138 !! options
7139 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7140 !! wikitext
7141 {{ROOTPAGENAMEE}}
7142 !! html
7143 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7144 </p>
7145 !! end
7146
7147 !! test
7148 Magic Word: {{BASEPAGENAME}}
7149 !! options
7150 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7151 !! wikitext
7152 {{BASEPAGENAME}}
7153 !! html
7154 <p>Ævar Arnfjörð Bjarmason
7155 </p>
7156 !! end
7157
7158 !! test
7159 Magic Word: {{BASEPAGENAMEE}}
7160 !! options
7161 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7162 !! wikitext
7163 {{BASEPAGENAMEE}}
7164 !! html
7165 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7166 </p>
7167 !! end
7168
7169 !! test
7170 Magic Word: {{TALKPAGENAME}}
7171 !! options
7172 title=[[User:Ævar Arnfjörð Bjarmason]]
7173 !! wikitext
7174 {{TALKPAGENAME}}
7175 !! html
7176 <p>User talk:Ævar Arnfjörð Bjarmason
7177 </p>
7178 !! end
7179
7180 !! test
7181 Magic Word: {{TALKPAGENAMEE}}
7182 !! options
7183 title=[[User:Ævar Arnfjörð Bjarmason]]
7184 !! wikitext
7185 {{TALKPAGENAMEE}}
7186 !! html
7187 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7188 </p>
7189 !! end
7190
7191 !! test
7192 Magic Word: {{SUBJECTPAGENAME}}
7193 !! options
7194 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7195 !! wikitext
7196 {{SUBJECTPAGENAME}}
7197 !! html
7198 <p>User:Ævar Arnfjörð Bjarmason
7199 </p>
7200 !! end
7201
7202 !! test
7203 Magic Word: {{SUBJECTPAGENAMEE}}
7204 !! options
7205 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7206 !! wikitext
7207 {{SUBJECTPAGENAMEE}}
7208 !! html
7209 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7210 </p>
7211 !! end
7212
7213 !! test
7214 Magic Word: {{NUMBEROFFILES}}
7215 !! wikitext
7216 {{NUMBEROFFILES}}
7217 !! html
7218 <p>4
7219 </p>
7220 !! end
7221
7222 !! test
7223 Magic Word: {{PAGENAME}}
7224 !! options
7225 title=[[User:Ævar Arnfjörð Bjarmason]]
7226 !! wikitext
7227 {{PAGENAME}}
7228 !! html
7229 <p>Ævar Arnfjörð Bjarmason
7230 </p>
7231 !! end
7232
7233 !! test
7234 Magic Word: {{PAGENAME}} with metacharacters
7235 !! options
7236 title=[['foo & bar = baz']]
7237 !! wikitext
7238 ''{{PAGENAME}}''
7239 !! html
7240 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7241 </p>
7242 !! end
7243
7244 !! test
7245 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7246 !! options
7247 title=[[*RFC 1234 http://example.com/]]
7248 !! wikitext
7249 {{PAGENAME}}
7250 !! html
7251 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7252 </p>
7253 !! end
7254
7255 !! test
7256 Magic Word: {{PAGENAMEE}}
7257 !! options
7258 title=[[User:Ævar Arnfjörð Bjarmason]]
7259 !! wikitext
7260 {{PAGENAMEE}}
7261 !! html
7262 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7263 </p>
7264 !! end
7265
7266 !! test
7267 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7268 !! options
7269 title=[[*RFC 1234 http://example.com/]]
7270 !! wikitext
7271 {{PAGENAMEE}}
7272 !! html
7273 <p>&#42;RFC_1234_http&#58;//example.com/
7274 </p>
7275 !! end
7276
7277 !! test
7278 Magic Word: {{REVISIONID}}
7279 !! wikitext
7280 {{REVISIONID}}
7281 !! html
7282 <p>1337
7283 </p>
7284 !! end
7285
7286 !! test
7287 Magic Word: {{SCRIPTPATH}}
7288 !! wikitext
7289 {{SCRIPTPATH}}
7290 !! html
7291 <p>/
7292 </p>
7293 !! end
7294
7295 !! test
7296 Magic Word: {{STYLEPATH}}
7297 !! wikitext
7298 {{STYLEPATH}}
7299 !! html
7300 <p>/skins
7301 </p>
7302 !! end
7303
7304 !! test
7305 Magic Word: {{SERVER}}
7306 !! wikitext
7307 {{SERVER}}
7308 !! html
7309 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7310 </p>
7311 !! end
7312
7313 !! test
7314 Magic Word: {{SERVERNAME}}
7315 !! wikitext
7316 {{SERVERNAME}}
7317 !! html
7318 <p>example.org
7319 </p>
7320 !! end
7321
7322 !! test
7323 Magic Word: {{SITENAME}}
7324 !! wikitext
7325 {{SITENAME}}
7326 !! html
7327 <p>MediaWiki
7328 </p>
7329 !! end
7330
7331 !! test
7332 Case-sensitive magic words, when cased differently, should just be template transclusions
7333 !! wikitext
7334 {{CurrentMonth}}
7335 {{currentday}}
7336 {{cURreNTweEK}}
7337 {{currentHour}}
7338 !! html
7339 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
7340 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
7341 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
7342 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
7343 </p>
7344 !! end
7345
7346 !! test
7347 Case-insensitive magic words should still work with weird casing.
7348 !! wikitext
7349 {{sErVeRNaMe}}
7350 {{LCFirst:AOEU}}
7351 {{ucFIRST:aoeu}}
7352 {{SERver}}
7353 !! html
7354 <p>example.org
7355 aOEU
7356 Aoeu
7357 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7358 </p>
7359 !! end
7360
7361 !! test
7362 Namespace 1 {{ns:1}}
7363 !! wikitext
7364 {{ns:1}}
7365 !! html
7366 <p>Talk
7367 </p>
7368 !! end
7369
7370 !! test
7371 Namespace 1 {{ns:01}}
7372 !! wikitext
7373 {{ns:01}}
7374 !! html
7375 <p>Talk
7376 </p>
7377 !! end
7378
7379 !! test
7380 Namespace 0 {{ns:0}} (bug 4783)
7381 !! wikitext
7382 {{ns:0}}
7383 !! html
7384
7385 !! end
7386
7387 !! test
7388 Namespace 0 {{ns:00}} (bug 4783)
7389 !! wikitext
7390 {{ns:00}}
7391 !! html
7392
7393 !! end
7394
7395 !! test
7396 Namespace -1 {{ns:-1}}
7397 !! wikitext
7398 {{ns:-1}}
7399 !! html
7400 <p>Special
7401 </p>
7402 !! end
7403
7404 !! test
7405 Namespace User {{ns:User}}
7406 !! wikitext
7407 {{ns:User}}
7408 !! html
7409 <p>User
7410 </p>
7411 !! end
7412
7413 !! test
7414 Namespace User talk {{ns:User_talk}}
7415 !! wikitext
7416 {{ns:User_talk}}
7417 !! html
7418 <p>User talk
7419 </p>
7420 !! end
7421
7422 !! test
7423 Namespace User talk {{ns:uSeR tAlK}}
7424 !! wikitext
7425 {{ns:uSeR tAlK}}
7426 !! html
7427 <p>User talk
7428 </p>
7429 !! end
7430
7431 !! test
7432 Namespace File {{ns:File}}
7433 !! wikitext
7434 {{ns:File}}
7435 !! html
7436 <p>File
7437 </p>
7438 !! end
7439
7440 !! test
7441 Namespace File {{ns:Image}}
7442 !! wikitext
7443 {{ns:Image}}
7444 !! html
7445 <p>File
7446 </p>
7447 !! end
7448
7449 !! test
7450 Namespace (lang=de) Benutzer {{ns:User}}
7451 !! options
7452 language=de
7453 !! wikitext
7454 {{ns:User}}
7455 !! html
7456 <p>Benutzer
7457 </p>
7458 !! end
7459
7460 !! test
7461 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7462 !! options
7463 language=de
7464 !! wikitext
7465 {{ns:3}}
7466 !! html
7467 <p>Benutzer Diskussion
7468 </p>
7469 !! end
7470
7471
7472 !! test
7473 Urlencode
7474 !! wikitext
7475 {{urlencode:hi world?!}}
7476 {{urlencode:hi world?!|WIKI}}
7477 {{urlencode:hi world?!|PATH}}
7478 {{urlencode:hi world?!|QUERY}}
7479 !! html
7480 <p>hi+world%3F%21
7481 hi_world%3F!
7482 hi%20world%3F%21
7483 hi+world%3F%21
7484 </p>
7485 !! end
7486
7487 !! test
7488 Magic Word: prioritize type info over data-parsoid
7489 !! options
7490 parsoid=html2wt
7491 !! wikitext
7492 __FORCETOC__
7493 !! html
7494 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7495 !! end
7496
7497 !! test
7498 Magic Word: serialize on separate line (parsoid)
7499 !! options
7500 parsoid=wt2wt,html2wt
7501 !! wikitext
7502 foo
7503 __NOTOC__
7504 bar
7505 !! html
7506 foo<meta property="mw:PageProp/notoc"/>bar
7507 !! end
7508
7509 !! test
7510 Magic Word: rt non-english wikis
7511 !! options
7512 parsoid=wt2wt
7513 language=de
7514 !! wikitext
7515 __NOEDITSECTION__
7516 !! html
7517 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7518 !! end
7519
7520 ###
7521 ### Magic links
7522 ###
7523 !! test
7524 Magic links: internal link to RFC (bug 479)
7525 !! wikitext
7526 [[RFC 123]]
7527 !! html
7528 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
7529 </p>
7530 !! end
7531
7532 !! test
7533 Magic links: RFC (bug 479)
7534 !! wikitext
7535 RFC 822
7536 !! html
7537 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7538 </p>
7539 !! end
7540
7541 !! test
7542 Magic links: ISBN (bug 1937)
7543 !! wikitext
7544 ISBN 0-306-40615-2
7545 !! html
7546 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7547 </p>
7548 !! end
7549
7550 !! test
7551 Magic links: PMID incorrectly converts space to underscore
7552 !! wikitext
7553 PMID 1234
7554 !! html
7555 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7556 </p>
7557 !! end
7558
7559 ###
7560 ### Templates
7561 ####
7562
7563 !! test
7564 Nonexistent template
7565 !! wikitext
7566 {{thistemplatedoesnotexist}}
7567 !! html
7568 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
7569 </p>
7570 !! end
7571
7572 !! test
7573 Template with invalid target containing tags
7574 !! wikitext
7575 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7576 !! html
7577 <p>{{a<b>b</b>|foo|a=b|a = b}}
7578 </p>
7579 !! end
7580
7581 !! test
7582 Template with invalid target containing unclosed tag
7583 !! wikitext
7584 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7585 !! html
7586 <p>{{a<b>|foo|a=b|a = b}}</b>
7587 </p>
7588 !! end
7589
7590 !! test
7591 Template with invalid target containing wikilink
7592 !! wikitext
7593 {{[[Main Page]]}}
7594 !! html/php
7595 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7596 </p>
7597 !! html/parsoid
7598 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
7599 !! end
7600
7601 !! article
7602 Template:test
7603 !! text
7604 This is a test template
7605 !! endarticle
7606
7607 !! test
7608 Simple template
7609 !! wikitext
7610 {{test}}
7611 !! html
7612 <p>This is a test template
7613 </p>
7614 !! end
7615
7616 !! test
7617 Template with explicit namespace
7618 !! wikitext
7619 {{Template:test}}
7620 !! html
7621 <p>This is a test template
7622 </p>
7623 !! end
7624
7625
7626 !! article
7627 Template:paramtest
7628 !! text
7629 This is a test template with parameter {{{param}}}
7630 !! endarticle
7631
7632 !! test
7633 Template parameter
7634 !! wikitext
7635 {{paramtest|param=foo}}
7636 !! html
7637 <p>This is a test template with parameter foo
7638 </p>
7639 !! end
7640
7641 !! article
7642 Template:paramtestnum
7643 !! text
7644 [[{{{1}}}|{{{2}}}]]
7645 !! endarticle
7646
7647 !! test
7648 Template unnamed parameter
7649 !! wikitext
7650 {{paramtestnum|Main Page|the main page}}
7651 !! html
7652 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7653 </p>
7654 !! end
7655
7656 !! article
7657 Template:templatesimple
7658 !! text
7659 (test)
7660 !! endarticle
7661
7662 !! article
7663 Template:templateredirect
7664 !! text
7665 #redirect [[Template:templatesimple]]
7666 !! endarticle
7667
7668 !! article
7669 Template:templateasargtestnum
7670 !! text
7671 {{{{{1}}}}}
7672 !! endarticle
7673
7674 !! article
7675 Template:templateasargtest
7676 !! text
7677 {{template{{{templ}}}}}
7678 !! endarticle
7679
7680 !! article
7681 Template:templateasargtest2
7682 !! text
7683 {{{{{templ}}}}}
7684 !! endarticle
7685
7686 !! test
7687 Template with template name as unnamed argument
7688 !! wikitext
7689 {{templateasargtestnum|templatesimple}}
7690 !! html
7691 <p>(test)
7692 </p>
7693 !! end
7694
7695 !! test
7696 Template with template name as argument
7697 !! wikitext
7698 {{templateasargtest|templ=simple}}
7699 !! html
7700 <p>(test)
7701 </p>
7702 !! end
7703
7704 !! test
7705 Template with template name as argument (2)
7706 !! wikitext
7707 {{templateasargtest2|templ=templatesimple}}
7708 !! html
7709 <p>(test)
7710 </p>
7711 !! end
7712
7713 !! article
7714 Template:templateasargtestdefault
7715 !! text
7716 {{{{{templ|templatesimple}}}}}
7717 !! endarticle
7718
7719 !! article
7720 Template:templa
7721 !! text
7722 '''templ'''
7723 !! endarticle
7724
7725 !! test
7726 Template with default value
7727 !! wikitext
7728 {{templateasargtestdefault}}
7729 !! html
7730 <p>(test)
7731 </p>
7732 !! end
7733
7734 !! test
7735 Template with default value (value set)
7736 !! wikitext
7737 {{templateasargtestdefault|templ=templa}}
7738 !! html
7739 <p><b>templ</b>
7740 </p>
7741 !! end
7742
7743 !! test
7744 Template redirect
7745 !! wikitext
7746 {{templateredirect}}
7747 !! html
7748 <p>(test)
7749 </p>
7750 !! end
7751
7752 !! test
7753 Template with argument in separate line
7754 !! wikitext
7755 {{ templateasargtest |
7756 templ = simple }}
7757 !! html
7758 <p>(test)
7759 </p>
7760 !! end
7761
7762 !! test
7763 Template with complex template as argument
7764 !! wikitext
7765 {{paramtest|
7766 param ={{ templateasargtest |
7767 templ = simple }}}}
7768 !! html
7769 <p>This is a test template with parameter (test)
7770 </p>
7771 !! end
7772
7773 !! test
7774 Template with thumb image (with link in description)
7775 !! wikitext
7776 {{paramtest|
7777 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7778 !! html
7779 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
7780
7781 !! end
7782
7783 !! article
7784 Template:complextemplate
7785 !! text
7786 {{{1}}} {{paramtest|
7787 param ={{{param}}}}}
7788 !! endarticle
7789
7790 !! test
7791 Template with complex arguments
7792 !! wikitext
7793 {{complextemplate|
7794 param ={{ templateasargtest |
7795 templ = simple }}|[[Template:complextemplate|link]]}}
7796 !! html
7797 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7798 </p>
7799 !! end
7800
7801 !! test
7802 BUG 553: link with two variables in a piped link
7803 !! wikitext
7804 {|
7805 |[[{{{1}}}|{{{2}}}]]
7806 |}
7807 !! html
7808 <table>
7809 <tr>
7810 <td>[[{{{1}}}|{{{2}}}]]
7811 </td></tr></table>
7812
7813 !! end
7814
7815 !! test
7816 Magic variable as template parameter
7817 !! wikitext
7818 {{paramtest|param={{SITENAME}}}}
7819 !! html
7820 <p>This is a test template with parameter MediaWiki
7821 </p>
7822 !! end
7823
7824 !! article
7825 Template:linktest
7826 !! text
7827 [[{{{param}}}|link]]
7828 !! endarticle
7829
7830 !! test
7831 Template parameter as link source
7832 !! wikitext
7833 {{linktest|param=Main Page}}
7834 !! html
7835 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7836 </p>
7837 !! end
7838
7839 !!test
7840 Template-generated attribute string (k='v')
7841 !! wikitext
7842 <span {{attr_str|id|v1}}>bar</span>
7843 !! html
7844 <p><span id="v1">bar</span>
7845 </p>
7846 !!end
7847
7848 !!article
7849 Template:paramtest2
7850 !! text
7851 including another template, {{paramtest|param={{{arg}}}}}
7852 !! endarticle
7853
7854 !! test
7855 Template passing argument to another template
7856 !! wikitext
7857 {{paramtest2|arg='hmm'}}
7858 !! html
7859 <p>including another template, This is a test template with parameter 'hmm'
7860 </p>
7861 !! end
7862
7863 !! article
7864 Template:Linktest2
7865 !! text
7866 Main Page
7867 !! endarticle
7868
7869 !! test
7870 Template as link source
7871 !! wikitext
7872 [[{{linktest2}}]]
7873
7874 [[{{linktest2}}|Main Page]]
7875
7876 [[{{linktest2}}]]Page
7877 !! html
7878 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7879 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7880 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7881 </p>
7882 !! end
7883
7884
7885 !! article
7886 Template:loop1
7887 !! text
7888 {{loop2}}
7889 !! endarticle
7890
7891 !! article
7892 Template:loop2
7893 !! text
7894 {{loop1}}
7895 !! endarticle
7896
7897 !! test
7898 Template infinite loop
7899 !! wikitext
7900 {{loop1}}
7901 !! html
7902 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7903 </p>
7904 !! end
7905
7906 !! test
7907 Template from main namespace
7908 !! wikitext
7909 {{:Main Page}}
7910 !! html
7911 <p>blah blah
7912 </p>
7913 !! end
7914
7915 !! article
7916 Template:table
7917 !! text
7918 {|
7919 | 1 || 2
7920 |-
7921 | 3 || 4
7922 |}
7923 !! endarticle
7924
7925 !! test
7926 BUG 529: Template with table, not included at beginning of line
7927 !! wikitext
7928 foo {{table}}
7929 !! html
7930 <p>foo
7931 </p>
7932 <table>
7933 <tr>
7934 <td> 1 </td>
7935 <td> 2
7936 </td></tr>
7937 <tr>
7938 <td> 3 </td>
7939 <td> 4
7940 </td></tr></table>
7941
7942 !! end
7943
7944 !! test
7945 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7946 !! wikitext
7947 foo
7948 {{table}}
7949 !! html
7950 <p>foo
7951 </p>
7952 <table>
7953 <tr>
7954 <td> 1 </td>
7955 <td> 2
7956 </td></tr>
7957 <tr>
7958 <td> 3 </td>
7959 <td> 4
7960 </td></tr></table>
7961
7962 !! end
7963
7964 !! test
7965 BUG 41: Template parameters shown as broken links
7966 !! wikitext
7967 {{{parameter}}}
7968 !! html
7969 <p>{{{parameter}}}
7970 </p>
7971 !! end
7972
7973 !! test
7974 Template with targets containing wikilinks
7975 !! wikitext
7976 {{[[foo]]}}
7977
7978 {{[[{{echo|foo}}]]}}
7979
7980 {{{{echo|[[foo}}]]}}
7981 !! html
7982 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7983 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7984 </p><p>{{[[foo}}]]
7985 </p>
7986 !! end
7987
7988 !! article
7989 Template:MSGNW test
7990 !! text
7991 ''None'' of '''this''' should be
7992 * interpreted
7993 but rather passed unmodified
7994 {{test}}
7995 !! endarticle
7996
7997 # hmm, fix this or just deprecate msgnw and document its behavior?
7998 !! test
7999 msgnw keyword
8000 !! options
8001 disabled
8002 !! wikitext
8003 {{msgnw:MSGNW test}}
8004 !! html
8005 <p>''None'' of '''this''' should be
8006 * interpreted
8007 but rather passed unmodified
8008 {{test}}
8009 </p>
8010 !! end
8011
8012 !! test
8013 int keyword
8014 !! wikitext
8015 {{int:youhavenewmessages|lots of money|not!}}
8016 !! html
8017 <p>You have lots of money (not!).
8018 </p>
8019 !! end
8020
8021 !! article
8022 Template:Includes
8023 !! text
8024 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8025 !! endarticle
8026
8027 !! test
8028 <includeonly> and <noinclude> being included
8029 !! wikitext
8030 {{Includes}}
8031 !! html
8032 <p>Foobar
8033 </p>
8034 !! end
8035
8036 !! article
8037 Template:Includes2
8038 !! text
8039 <onlyinclude>Foo</onlyinclude>bar
8040 !! endarticle
8041
8042 !! test
8043 <onlyinclude> being included
8044 !! wikitext
8045 {{Includes2}}
8046 !! html
8047 <p>Foo
8048 </p>
8049 !! end
8050
8051
8052 !! article
8053 Template:Includes3
8054 !! text
8055 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8056 !! endarticle
8057
8058 !! test
8059 <onlyinclude> and <includeonly> being included
8060 !! wikitext
8061 {{Includes3}}
8062 !! html
8063 <p>Foo
8064 </p>
8065 !! end
8066
8067 !! test
8068 <includeonly> and <noinclude> on a page
8069 !! wikitext
8070 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8071 !! html
8072 <p>Foozar
8073 </p>
8074 !! end
8075
8076 !! test
8077 Un-closed <noinclude>
8078 !! wikitext
8079 <noinclude>
8080 !! html
8081 !! end
8082
8083 !! test
8084 <onlyinclude> on a page
8085 !! wikitext
8086 <onlyinclude>Foo</onlyinclude>bar
8087 !! html
8088 <p>Foobar
8089 </p>
8090 !! end
8091
8092 !! test
8093 Un-closed <onlyinclude>
8094 !! wikitext
8095 <onlyinclude>
8096 !! html
8097 !! end
8098
8099 !!test
8100 Self-closed noinclude, includeonly, onlyinclude tags
8101 !! wikitext
8102 <noinclude />
8103 <includeonly />
8104 <onlyinclude />
8105 !! html
8106 <p><br />
8107 </p>
8108 !!end
8109
8110 !!test
8111 Unbalanced includeonly and noinclude tags
8112 !! wikitext
8113 {|
8114 |a</noinclude>
8115 |b</noinclude></noinclude>
8116 |c</noinclude></includeonly>
8117 |d</includeonly></includeonly>
8118 |}
8119 !! html
8120 <table>
8121 <tr>
8122 <td>a
8123 </td>
8124 <td>b
8125 </td>
8126 <td>c&lt;/includeonly&gt;
8127 </td>
8128 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8129 </td></tr></table>
8130
8131 !!end
8132
8133 !! article
8134 Template:Includeonly section
8135 !! text
8136 <includeonly>
8137 ==Includeonly section==
8138 </includeonly>
8139 ==Section T-1==
8140 !!endarticle
8141
8142 !! test
8143 Bug 6563: Edit link generation for section shown by <includeonly>
8144 !! wikitext
8145 {{includeonly section}}
8146 !! html
8147 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8148 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8149
8150 !! end
8151
8152 # Uses same input as the contents of [[Template:Includeonly section]]
8153 !! test
8154 Bug 6563: Section extraction for section shown by <includeonly>
8155 !! options
8156 section=T-2
8157 !! wikitext
8158 <includeonly>
8159 ==Includeonly section==
8160 </includeonly>
8161 ==Section T-2==
8162 !! html
8163 ==Section T-2==
8164 !! end
8165
8166 !! test
8167 Bug 6563: Edit link generation for section suppressed by <includeonly>
8168 !! wikitext
8169 <includeonly>
8170 ==Includeonly section==
8171 </includeonly>
8172 ==Section 1==
8173 !! html
8174 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8175
8176 !! end
8177
8178 !! test
8179 Bug 6563: Section extraction for section suppressed by <includeonly>
8180 !! options
8181 section=1
8182 !! wikitext
8183 <includeonly>
8184 ==Includeonly section==
8185 </includeonly>
8186 ==Section 1==
8187 !! html
8188 ==Section 1==
8189 !! end
8190
8191 !! test
8192 Un-closed <includeonly>
8193 !! wikitext
8194 <includeonly>
8195 !! html
8196 !! end
8197
8198 # TODO: test with DOM fragment reuse!
8199 !! test
8200 Parsoid: DOM fragment reuse
8201 !! options
8202 parsoid=wt2wt,wt2html
8203 !! wikitext
8204 a{{echo|b<table></table>c}}d
8205
8206 a{{echo|b
8207 <table></table>
8208 c}}d
8209
8210 {{echo|a
8211
8212 <table></table>
8213
8214 b}}
8215 !! html
8216 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8217 <table></table>c"}},"i":0}}]}'>b</span>
8218 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8219
8220
8221 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2">
8222 </span>
8223 <table about="#mwt2"></table><span about="#mwt2">
8224 </span>
8225 <p about="#mwt2">cd</p>
8226
8227
8228 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3">
8229
8230 </span>
8231 <table about="#mwt3"></table><span about="#mwt3">
8232
8233 </span>
8234 <p about="#mwt3">b</p>
8235 !! end
8236
8237 !! test
8238 Parsoid: Merge double tds (bug 50603)
8239 !! options
8240 parsoid
8241 !! wikitext
8242 {|
8243 |{{echo|{{!}} foo}}
8244 |}
8245 !! html
8246 <table><tbody>
8247 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
8248 </tbody></table>
8249 !! end
8250
8251 !! test
8252 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8253 !! options
8254 parsoid
8255 !! wikitext
8256 {{echo|<div>}}
8257 {|
8258 |{{echo|{{!}} foo}}
8259 |}
8260 {{echo|</div>}}
8261 !! html
8262 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
8263 <table><tbody>
8264 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8265 </tbody></table>
8266 </div>
8267 !! end
8268
8269 ###
8270 ### <includeonly> and <noinclude> in attributes
8271 ###
8272 !!test
8273 0. includeonly around the entire attribute
8274 !! wikitext
8275 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8276 !! html
8277 <p><span id="v2">bar</span>
8278 </p>
8279 !!end
8280
8281 !!test
8282 1. includeonly in html attr key
8283 !! wikitext
8284 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8285 !! html
8286 <p><span id="foo">bar</span>
8287 </p>
8288 !!end
8289
8290 !!test
8291 2. includeonly in html attr value
8292 !! wikitext
8293 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8294 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8295 !! html
8296 <p><span id="v1">bar</span>
8297 <span id="v1">bar</span>
8298 </p>
8299 !!end
8300
8301 !!test
8302 3. includeonly in part of an attr value
8303 !! wikitext
8304 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8305 !! html
8306 <p><span style="color:red;">bar</span>
8307 </p>
8308 !!end
8309
8310 !!test
8311 4. includeonly in table attributes
8312 !! wikitext
8313 {|
8314 |- <noinclude>
8315 |-
8316 |a
8317 </noinclude>
8318 |- <includeonly>
8319 |-
8320 |b
8321 </includeonly>
8322 |}
8323 !! html
8324 <table>
8325
8326
8327 <tr>
8328 <td>a
8329 </td></tr>
8330 </table>
8331
8332 !!end
8333
8334 ###
8335 ### Testing parsing of templates where a template arg
8336 ### has the same name as the template itself.
8337 ###
8338
8339 !! article
8340 Template:quote
8341 !! text
8342 {{{quote|{{{1}}}}}}
8343 !! endarticle
8344
8345 !!test
8346 Templates: Template Name/Arg clash: 1. Use of positional param
8347 !! wikitext
8348 {{quote|foo}}
8349 !! html
8350 <p>foo
8351 </p>
8352 !!end
8353
8354 !!test
8355 Templates: Template Name/Arg clash: 2. Use of named param
8356 !! wikitext
8357 {{quote|quote=foo}}
8358 !! html
8359 <p>foo
8360 </p>
8361 !!end
8362
8363 !!test
8364 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8365 !! wikitext
8366 {{quote|quote}}
8367 !! html
8368 <p>quote
8369 </p>
8370 !!end
8371
8372 ###
8373 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8374 ###
8375
8376 !!test
8377 Templates: 1. Simple use
8378 !! wikitext
8379 {{echo|Foo}}
8380 !! html
8381 <p>Foo
8382 </p>
8383 !!end
8384
8385 !!test
8386 Templates: 2. Inside a block tag
8387 !! wikitext
8388 <div>{{echo|Foo}}</div>
8389 <blockquote>{{echo|Foo}}</blockquote>
8390 !! html
8391 <div>Foo</div>
8392 <blockquote>Foo</blockquote>
8393
8394 !!end
8395
8396 !!test
8397 Templates: P-wrapping: 1a. Templates on consecutive lines
8398 !! wikitext
8399 {{echo|Foo}}
8400 {{echo|bar}}
8401 !! html
8402 <p>Foo
8403 bar
8404 </p>
8405 !!end
8406
8407 !!test
8408 Templates: P-wrapping: 1b. Templates on consecutive lines
8409 !! wikitext
8410 Foo
8411
8412 {{echo|bar}}
8413 {{echo|baz}}
8414 !! html
8415 <p>Foo
8416 </p><p>bar
8417 baz
8418 </p>
8419 !!end
8420
8421 !!test
8422 Templates: P-wrapping: 1c. Templates on consecutive lines
8423 !! wikitext
8424 {{echo|Foo}}
8425 {{echo|bar}} <div>baz</div>
8426 !! html
8427 <p>Foo
8428 </p>
8429 bar <div>baz</div>
8430
8431 !!end
8432
8433 !!test
8434 Templates: P-wrapping: 1d. Template preceded by comment-only line
8435 !!options
8436 parsoid
8437 !! wikitext
8438 <!-- foo -->
8439 {{echo|Bar}}
8440 !! html
8441 <!-- foo -->
8442
8443 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8444 !!end
8445
8446 !!test
8447 Templates: Inline Text: 1. Multiple tmeplate uses
8448 !! wikitext
8449 {{echo|Foo}}bar{{echo|baz}}
8450 !! html
8451 <p>Foobarbaz
8452 </p>
8453 !!end
8454
8455 !!test
8456 Templates: Inline Text: 2. Back-to-back template uses
8457 !! wikitext
8458 {{echo|Foo}}{{echo|bar}}
8459 !! html
8460 <p>Foobar
8461 </p>
8462 !!end
8463
8464 !!test
8465 Templates: Block Tags: 1. Multiple template uses
8466 !! wikitext
8467 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8468 !! html
8469 <div>Foo</div><div>bar</div><div>baz</div>
8470
8471 !!end
8472
8473 !!test
8474 Templates: Block Tags: 2. Back-to-back template uses
8475 !! wikitext
8476 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8477 !! html
8478 <div>Foo</div><div>bar</div>
8479
8480 !!end
8481
8482 !!test
8483 Templates: Links: 1. Simple example
8484 !! wikitext
8485 {{echo|[[Foo|bar]]}}
8486 !! html
8487 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8488 </p>
8489 !!end
8490
8491 !!test
8492 Templates: Links: 2. Generation of link href
8493 !! wikitext
8494 [[{{echo|Foo}}|bar]]
8495 !! html
8496 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8497 </p>
8498 !!end
8499
8500 !!test
8501 Templates: Links: 3. Generation of part of a link href
8502 !! wikitext
8503 [[Fo{{echo|o}}|bar]]
8504
8505 [[Foo{{echo|bar}}]]
8506
8507 [[Foo{{echo|bar}}baz]]
8508
8509 [[Foo{{echo|bar}}|bar]]
8510
8511 [[:Foo{{echo|bar}}]]
8512
8513 [[:Foo{{echo|bar}}|bar]]
8514 !! html
8515 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8516 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8517 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8518 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8519 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8520 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8521 </p>
8522 !!end
8523
8524 !!test
8525 Templates: Links: 4. Multiple templates generating link href
8526 !! wikitext
8527 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8528 !! html
8529 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8530 </p>
8531 !!end
8532
8533 !!test
8534 Templates: Links: 5. Generation of link text
8535 !! wikitext
8536 [[Foo|{{echo|bar}}]]
8537 !! html
8538 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8539 </p>
8540 !!end
8541
8542 !!test
8543 Templates: Links: 5. Nested templates (only outermost template should be marked)
8544 !! wikitext
8545 {{echo|[[{{echo|Foo}}|bar]]}}
8546 !! html
8547 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8548 </p>
8549 !!end
8550
8551 !!test
8552 Templates: HTML Tag: 1. Generation of HTML attr. key
8553 !! wikitext
8554 <div {{echo|style}}="color:red;">foo</div>
8555 !! html
8556 <div style="color:red;">foo</div>
8557
8558 !!end
8559
8560 !!test
8561 Templates: HTML Tag: 2. Generation of HTML attr. value
8562 !! wikitext
8563 <div style={{echo|'color:red;'}}>foo</div>
8564 !! html
8565 <div style="color:red;">foo</div>
8566
8567 !!end
8568
8569 !!test
8570 Templates: HTML Tag: 3. Generation of HTML attr key and value
8571 !! wikitext
8572 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8573 !! html
8574 <div style="color:red;">foo</div>
8575
8576 !!end
8577
8578 !!test
8579 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8580 !! wikitext
8581 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8582 !! html
8583 <div title="This is a long title with just one piece templated">foo</div>
8584
8585 !!end
8586
8587 !!test
8588 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8589 !! wikitext
8590 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8591 !! html
8592 <div title="This is a long title with just one piece templated">foo</div>
8593
8594 !!end
8595
8596 !!test
8597 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8598 !! wikitext
8599 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8600 !! html
8601 <div title="This is a long title with just one piece templated">foo</div>
8602
8603 !!end
8604
8605 !!test
8606 Templates: HTML Tag: 7. Generation of partial attribute key string
8607 !! wikitext
8608 <div st{{echo|yle}}="color:red;">foo</div>
8609 !! html
8610 <div style="color:red;">foo</div>
8611
8612 !!end
8613
8614 !!test
8615 Templates: HTML Tables: 1. Generating start of a HTML table
8616 !! wikitext
8617 {{echo|<table><tr><td>foo</td>}}</tr></table>
8618 !! html
8619 <table><tr><td>foo</td></tr></table>
8620
8621 !!end
8622
8623 !!test
8624 Templates: HTML Tables: 2a. Generating middle of a HTML table
8625 !! wikitext
8626 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8627 !! html
8628 <table><tr><td>foo</td></tr></table>
8629
8630 !!end
8631
8632 !!test
8633 Templates: HTML Tables: 2b. Generating middle of a HTML table
8634 !! wikitext
8635 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8636 !! html
8637 <table><tr><td>foo</td></tr></table>
8638
8639 !!end
8640
8641 !!test
8642 Templates: HTML Tables: 3. Generating end of a HTML table
8643 !! wikitext
8644 <table><tr>{{echo|<td>foo</td></tr></table>}}
8645 !! html
8646 <table><tr><td>foo</td></tr></table>
8647
8648 !!end
8649
8650 !!test
8651 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8652 !! wikitext
8653 {{echo|<table>}}<tr><td>foo</td></tr></table>
8654 !! html
8655 <table><tr><td>foo</td></tr></table>
8656
8657 !!end
8658
8659 !!test
8660 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8661 !! wikitext
8662 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8663 !! html
8664 <table><tr><td>foo</td></tr></table>
8665
8666 !!end
8667
8668 !!test
8669 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8670 !! wikitext
8671 <table><tr>{{echo|<td>}}foo</td></tr></table>
8672 !! html
8673 <table><tr><td>foo</td></tr></table>
8674
8675 !!end
8676
8677 !!test
8678 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8679 !! wikitext
8680 <table><tr><td>foo{{echo|</td>}}</tr></table>
8681 !! html
8682 <table><tr><td>foo</td></tr></table>
8683
8684 !!end
8685
8686 !!test
8687 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8688 !! wikitext
8689 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8690 !! html
8691 <table><tr><td>foo</td></tr></table>
8692
8693 !!end
8694
8695 !!test
8696 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8697 !! wikitext
8698 <table><tr><td>foo</td></tr>{{echo|</table>}}
8699 !! html
8700 <table><tr><td>foo</td></tr></table>
8701
8702 !!end
8703
8704 !!test
8705 Templates: HTML Tables: 5. Proper fostering of categories from inside
8706 !!options
8707 parsoid=wt2html,wt2wt
8708 !! wikitext
8709 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8710 <!--Two categories (Bug 50330)-->
8711 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8712 !! html
8713 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8714 <!--Two categories (Bug 50330)-->
8715 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
8716 !!end
8717
8718 !!test
8719 Templates: Wiki Tables: 1a. Fostering of entire template content
8720 !! wikitext
8721 {|
8722 {{echo|a}}
8723 |}
8724 !! html
8725 <table>
8726 a
8727 <tr><td></td></tr></table>
8728
8729 !!end
8730
8731 !!test
8732 Templates: Wiki Tables: 1b. Fostering of entire template content
8733 !! wikitext
8734 {|
8735 {{echo|<div>}}
8736 foo
8737 {{echo|</div>}}
8738 |}
8739 !! html
8740 <table>
8741 <div>
8742 <p>foo
8743 </p>
8744 </div>
8745 <tr><td></td></tr></table>
8746
8747 !!end
8748
8749 !!test
8750 Templates: Wiki Tables: 2. Fostering of partial template content
8751 !! wikitext
8752 {|
8753 {{echo|a
8754 <div>b</div>}}
8755 |}
8756 !! html
8757 <table>
8758 a
8759 <div>b</div>
8760 <tr><td></td></tr></table>
8761
8762 !!end
8763
8764 !!test
8765 Templates: Wiki Tables: 3. td-content via multiple templates
8766 !! wikitext
8767 {|
8768 {{echo|{{pipe}}a}}{{echo|b}}
8769 |}
8770 !! html
8771 <table>
8772 <tr>
8773 <td>ab
8774 </td></tr></table>
8775
8776 !!end
8777
8778 !!test
8779 Templates: Wiki Tables: 4. Templated tags, no content
8780 !! wikitext
8781 {{tbl-start}}
8782 {{tbl-end}}
8783 !! html
8784 <table>
8785 <tr><td></td></tr></table>
8786
8787 !!end
8788
8789 !!test
8790 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8791 !! wikitext
8792 {{tbl-start}}
8793 |foo
8794 {{tbl-end}}
8795 !! html
8796 <table>
8797 <tr>
8798 <td>foo
8799 </td></tr></table>
8800
8801 !!end
8802
8803 !!test
8804 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8805 !! wikitext
8806 {{tbl-start}}
8807 {{!}}foo
8808 {{tbl-end}}
8809 !! html
8810 <table>
8811 <tr>
8812 <td>foo
8813 </td></tr></table>
8814
8815 !!end
8816
8817 !!test
8818 Templates: Lists: Multi-line list-items via templates
8819 !! wikitext
8820 *{{echo|a {{nonexistent|
8821 unused}}}}
8822 *{{echo|b {{nonexistent|
8823 unused}}}}
8824 !! html
8825 <ul>
8826 <li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
8827 </li>
8828 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
8829 </li>
8830 </ul>
8831
8832 !!end
8833
8834 !!test
8835 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8836 !! wikitext
8837 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8838 !! html
8839 <p><i>ab</i>c<i>d</i>e
8840 </p>
8841 !!end
8842
8843 !!test
8844 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8845 (PHP parser generates misnested html)
8846 !! wikitext
8847 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8848 !! html/parsoid
8849 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
8850 !!end
8851
8852 !!test
8853 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8854 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8855 !! options
8856 parsoid=wt2html,wt2wt
8857 !! wikitext
8858 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8859 !! html
8860 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
8861 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
8862 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
8863 !!end
8864
8865 !!test
8866 Templates: Ugly nesting: 4. Divs opened/closed across templates
8867 !! wikitext
8868 a<div>b{{echo|c</div>d}}e
8869 !! html
8870 a<div>bc</div>de
8871
8872 !!end
8873
8874 !!test
8875 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8876 (Parsoid-centric)
8877 !! options
8878 parsoid
8879 !! wikitext
8880 {|
8881 |{{echo|foo</table>}}
8882 |bar
8883 |}
8884 !! html
8885 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
8886
8887 <tbody>
8888 <tr>
8889 <td>foo</td></tr></tbody></table><span about="#mwt1">
8890 </span><span about="#mwt1">|bar</span><span about="#mwt1">
8891 |}</span>
8892 !!end
8893
8894 !!test
8895 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8896 (Parsoid-centric)
8897 !! options
8898 parsoid
8899 !! wikitext
8900 <table>
8901 <tr>
8902 <td>
8903 <table>
8904 <tr>
8905 <td>1. {{echo|foo </table>}}</td>
8906 <td> bar </td>
8907 <td>2. {{echo|baz </table>}}</td>
8908 </tr>
8909 <tr>
8910 <td>abc</td>
8911 </tr>
8912 </table>
8913 </td>
8914 </tr>
8915 <tr>
8916 <td>xyz</td>
8917 </tr>
8918 </table>
8919 !! html
8920 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
8921 <tbody><tr>
8922 <td>
8923 <table>
8924 <tbody><tr>
8925 <td>1. foo </td></tr></tbody></table></td>
8926 <td> bar </td>
8927 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8928 </span><span about="#mwt2">
8929 </span><span about="#mwt2">
8930 </span><span about="#mwt2">abc</span><span about="#mwt2">
8931 </span><span about="#mwt2">
8932 </span><span about="#mwt2">
8933 </span><span about="#mwt2">
8934 </span><span about="#mwt2">
8935 </span><span about="#mwt2">
8936 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8937 </span><span about="#mwt2">
8938 </span>
8939 !!end
8940
8941 !! test
8942 Templates: Ugly templates: 3. newline-only template parameter
8943 !! wikitext
8944 foo {{echo|
8945 }}
8946 !! html
8947 <p>foo
8948 </p>
8949 !! end
8950
8951 # This looks like a bug: a single newline triggers p/br for some reason.
8952 !! test
8953 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8954 !! wikitext
8955 {{echo|
8956 }}
8957 !! html
8958 <p><br />
8959 </p>
8960 !! end
8961
8962
8963 !!test
8964 Parser Functions: 1. Simple example
8965 !! wikitext
8966 {{uc:foo}}
8967 !! html
8968 <p>FOO
8969 </p>
8970 !!end
8971
8972 !!test
8973 Parser Functions: 2. Nested use (only outermost should be marked up)
8974 !! wikitext
8975 {{uc:{{lc:FOO}}}}
8976 !! html
8977 <p>FOO
8978 </p>
8979 !!end
8980
8981 ###
8982 ### Pre-save transform tests
8983 ###
8984 !! test
8985 pre-save transform: subst:
8986 !! options
8987 PST
8988 !! wikitext
8989 {{subst:test}}
8990 !! html
8991 This is a test template
8992 !! end
8993
8994 !! test
8995 pre-save transform: normal template
8996 !! options
8997 PST
8998 !! wikitext
8999 {{test}}
9000 !! html
9001 {{test}}
9002 !! end
9003
9004 !! test
9005 pre-save transform: nonexistent template
9006 !! options
9007 PST
9008 !! wikitext
9009 {{thistemplatedoesnotexist}}
9010 !! html
9011 {{thistemplatedoesnotexist}}
9012 !! end
9013
9014
9015 !! test
9016 pre-save transform: subst magic variables
9017 !! options
9018 PST
9019 !! wikitext
9020 {{subst:SITENAME}}
9021 !! html
9022 MediaWiki
9023 !! end
9024
9025 # This is bug 89, which I fixed. -- wtm
9026 !! test
9027 pre-save transform: subst: templates with parameters
9028 !! options
9029 pst
9030 !! wikitext
9031 {{subst:paramtest|param="something else"}}
9032 !! html
9033 This is a test template with parameter "something else"
9034 !! end
9035
9036 !! article
9037 Template:nowikitest
9038 !! text
9039 <nowiki>'''not wiki'''</nowiki>
9040 !! endarticle
9041
9042 !! test
9043 pre-save transform: nowiki in subst (bug 1188)
9044 !! options
9045 pst
9046 !! wikitext
9047 {{subst:nowikitest}}
9048 !! html
9049 <nowiki>'''not wiki'''</nowiki>
9050 !! end
9051
9052
9053 !! article
9054 Template:commenttest
9055 !! text
9056 This template has <!-- a comment --> in it.
9057 !! endarticle
9058
9059 !! test
9060 pre-save transform: comment in subst (bug 1936)
9061 !! options
9062 pst
9063 !! wikitext
9064 {{subst:commenttest}}
9065 !! html
9066 This template has <!-- a comment --> in it.
9067 !! end
9068
9069 !! test
9070 pre-save transform: unclosed tag
9071 !! options
9072 pst noxml
9073 !! wikitext
9074 <nowiki>'''not wiki'''
9075 !! html
9076 <nowiki>'''not wiki'''
9077 !! end
9078
9079 !! test
9080 pre-save transform: mixed tag case
9081 !! options
9082 pst noxml
9083 !! wikitext
9084 <NOwiki>'''not wiki'''</noWIKI>
9085 !! html
9086 <NOwiki>'''not wiki'''</noWIKI>
9087 !! end
9088
9089 !! test
9090 pre-save transform: unclosed comment in <nowiki>
9091 !! options
9092 pst noxml
9093 !! wikitext
9094 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9095 !! html
9096 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9097 !!end
9098
9099 # Leading @ in this template definition works around a limitation
9100 # in parsoid's parserTests which otherwise strips the <span> from the
9101 # result (confusing it for a template wrapper)
9102 !! article
9103 Template:dangerous
9104 !!text
9105 @<span onmouseover="alert('crap')">Oh no</span>
9106 !!endarticle
9107
9108 !!test
9109 (confirming safety of fix for subst bug 1936)
9110 !! wikitext
9111 {{Template:dangerous}}
9112 !! html
9113 <p>@<span>Oh no</span>
9114 </p>
9115 !! end
9116
9117 !! test
9118 pre-save transform: comment containing gallery (bug 5024)
9119 !! options
9120 pst
9121 !! wikitext
9122 <!-- <gallery>data</gallery> -->
9123 !! html
9124 <!-- <gallery>data</gallery> -->
9125 !!end
9126
9127 !! test
9128 pre-save transform: comment containing extension
9129 !! options
9130 pst
9131 !! wikitext
9132 <!-- <tag>data</tag> -->
9133 !! html
9134 <!-- <tag>data</tag> -->
9135 !!end
9136
9137 !! test
9138 pre-save transform: comment containing nowiki
9139 !! options
9140 pst
9141 !! wikitext
9142 <!-- <nowiki>data</nowiki> -->
9143 !! html
9144 <!-- <nowiki>data</nowiki> -->
9145 !!end
9146
9147 !! test
9148 pre-save transform: <noinclude> in subst (bug 3298)
9149 !! options
9150 pst
9151 !! wikitext
9152 {{subst:Includes}}
9153 !! html
9154 Foobar
9155 !! end
9156
9157 !! test
9158 pre-save transform: <onlyinclude> in subst (bug 3298)
9159 !! options
9160 pst
9161 !! wikitext
9162 {{subst:Includes2}}
9163 !! html
9164 Foo
9165 !! end
9166
9167 !! article
9168 Template:SubstTest
9169 !!text
9170 {{<includeonly>subst:</includeonly>Includes}}
9171 !! endarticle
9172
9173 !! article
9174 Template:SafeSubstTest
9175 !! text
9176 {{<includeonly>safesubst:</includeonly>Includes}}
9177 !! endarticle
9178
9179 !! test
9180 bug 22297: safesubst: works during PST
9181 !! options
9182 pst
9183 !! wikitext
9184 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9185 !! html
9186 FoobarFoobar
9187 !! end
9188
9189 !! test
9190 bug 22297: safesubst: works during normal parse
9191 !! wikitext
9192 {{SafeSubstTest}}
9193 !! html
9194 <p>Foobar
9195 </p>
9196 !! end
9197
9198 !! test
9199 subst: does not work during normal parse
9200 !! wikitext
9201 {{SubstTest}}
9202 !! html
9203 <p>{{subst:Includes}}
9204 </p>
9205 !! end
9206
9207 !! test
9208 pre-save transform: context links ("pipe trick")
9209 !! options
9210 pst
9211 !! wikitext
9212 [[Article (context)|]]
9213 [[Bar:Article|]]
9214 [[:Bar:Article|]]
9215 [[Bar:Article (context)|]]
9216 [[:Bar:Article (context)|]]
9217 [[|Article]]
9218 [[|Article (context)]]
9219 [[Bar:X (Y) Z|]]
9220 [[:Bar:X (Y) Z|]]
9221 !! html
9222 [[Article (context)|Article]]
9223 [[Bar:Article|Article]]
9224 [[:Bar:Article|Article]]
9225 [[Bar:Article (context)|Article]]
9226 [[:Bar:Article (context)|Article]]
9227 [[Article]]
9228 [[Article (context)]]
9229 [[Bar:X (Y) Z|X (Y) Z]]
9230 [[:Bar:X (Y) Z|X (Y) Z]]
9231 !! end
9232
9233 !! test
9234 pre-save transform: context links ("pipe trick") with interwiki prefix
9235 !! options
9236 pst
9237 !! wikitext
9238 [[interwiki:Article|]]
9239 [[:interwiki:Article|]]
9240 [[interwiki:Bar:Article|]]
9241 [[:interwiki:Bar:Article|]]
9242 !! html
9243 [[interwiki:Article|Article]]
9244 [[:interwiki:Article|Article]]
9245 [[interwiki:Bar:Article|Bar:Article]]
9246 [[:interwiki:Bar:Article|Bar:Article]]
9247 !! end
9248
9249 !! test
9250 pre-save transform: context links ("pipe trick") with parens in title
9251 !! options
9252 pst title=[[Somearticle (context)]]
9253 !! wikitext
9254 [[|Article]]
9255 !! html
9256 [[Article (context)|Article]]
9257 !! end
9258
9259 !! test
9260 pre-save transform: context links ("pipe trick") with comma in title
9261 !! options
9262 pst title=[[Someplace, Somewhere]]
9263 !! wikitext
9264 [[|Otherplace]]
9265 [[Otherplace, Elsewhere|]]
9266 [[Otherplace, Elsewhere, Anywhere|]]
9267 !! html
9268 [[Otherplace, Somewhere|Otherplace]]
9269 [[Otherplace, Elsewhere|Otherplace]]
9270 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9271 !! end
9272
9273 !! test
9274 pre-save transform: context links ("pipe trick") with parens and comma
9275 !! options
9276 pst title=[[Someplace (IGNORED), Somewhere]]
9277 !! wikitext
9278 [[|Otherplace]]
9279 [[Otherplace (place), Elsewhere|]]
9280 !! html
9281 [[Otherplace, Somewhere|Otherplace]]
9282 [[Otherplace (place), Elsewhere|Otherplace]]
9283 !! end
9284
9285 !! test
9286 pre-save transform: context links ("pipe trick") with comma and parens
9287 !! options
9288 pst title=[[Who, me? (context)]]
9289 !! wikitext
9290 [[|Yes, you.]]
9291 [[Me, Myself, and I (1937 song)|]]
9292 !! html
9293 [[Yes, you. (context)|Yes, you.]]
9294 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9295 !! end
9296
9297 !! test
9298 pre-save transform: context links ("pipe trick") with namespace
9299 !! options
9300 pst title=[[Ns:Somearticle]]
9301 !! wikitext
9302 [[|Article]]
9303 !! html
9304 [[Ns:Article|Article]]
9305 !! end
9306
9307 !! test
9308 pre-save transform: context links ("pipe trick") with namespace and parens
9309 !! options
9310 pst title=[[Ns:Somearticle (context)]]
9311 !! wikitext
9312 [[|Article]]
9313 !! html
9314 [[Ns:Article (context)|Article]]
9315 !! end
9316
9317 !! test
9318 pre-save transform: context links ("pipe trick") with namespace and comma
9319 !! options
9320 pst title=[[Ns:Somearticle, Context, Whatever]]
9321 !! wikitext
9322 [[|Article]]
9323 !! html
9324 [[Ns:Article, Context, Whatever|Article]]
9325 !! end
9326
9327 !! test
9328 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9329 !! options
9330 pst title=[[Ns:Somearticle, Context (context)]]
9331 !! wikitext
9332 [[|Article]]
9333 !! html
9334 [[Ns:Article (context)|Article]]
9335 !! end
9336
9337 !! test
9338 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9339 !! options
9340 pst title=[[Ns:Somearticle (IGNORED), Context]]
9341 !! wikitext
9342 [[|Article]]
9343 !! html
9344 [[Ns:Article, Context|Article]]
9345 !! end
9346
9347 !! test
9348 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9349 !! options
9350 pst
9351 !! wikitext
9352 [[Article(context)|]]
9353 [[Bar:Article(context)|]]
9354 [[:Bar:Article(context)|]]
9355 [[|Article(context)]]
9356 [[Bar:X(Y)Z|]]
9357 [[:Bar:X(Y)Z|]]
9358 !! html
9359 [[Article(context)|Article]]
9360 [[Bar:Article(context)|Article]]
9361 [[:Bar:Article(context)|Article]]
9362 [[Article(context)]]
9363 [[Bar:X(Y)Z|X(Y)Z]]
9364 [[:Bar:X(Y)Z|X(Y)Z]]
9365 !! end
9366
9367 !! test
9368 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9369 !! options
9370 pst
9371 !! wikitext
9372 [[Article (context)|]]
9373 [[Bar:Article (context)|]]
9374 [[:Bar:Article (context)|]]
9375 [[|Article (context)]]
9376 [[Bar:X (Y) Z|]]
9377 [[:Bar:X (Y) Z|]]
9378 !! html
9379 [[Article (context)|Article]]
9380 [[Bar:Article (context)|Article]]
9381 [[:Bar:Article (context)|Article]]
9382 [[Article (context)]]
9383 [[Bar:X (Y) Z|X (Y) Z]]
9384 [[:Bar:X (Y) Z|X (Y) Z]]
9385 !! end
9386
9387 !! test
9388 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9389 !! options
9390 pst
9391 !! wikitext
9392 [[Article(context)|]]
9393 [[Bar:Article(context)|]]
9394 [[:Bar:Article(context)|]]
9395 [[|Article(context)]]
9396 [[Bar:X(Y)Z|]]
9397 [[:Bar:X(Y)Z|]]
9398 !! html
9399 [[Article(context)|Article]]
9400 [[Bar:Article(context)|Article]]
9401 [[:Bar:Article(context)|Article]]
9402 [[Article(context)]]
9403 [[Bar:X(Y)Z|X(Y)Z]]
9404 [[:Bar:X(Y)Z|X(Y)Z]]
9405 !! end
9406
9407 !! test
9408 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9409 !! options
9410 pst
9411 !! wikitext
9412 [[Article (context), context|]]
9413 [[Article (context),context|]]
9414 [[Bar:Article (context), context|]]
9415 [[Bar:Article (context),context|]]
9416 [[:Bar:Article (context), context|]]
9417 [[:Bar:Article (context),context|]]
9418 !! html
9419 [[Article (context), context|Article]]
9420 [[Article (context),context|Article]]
9421 [[Bar:Article (context), context|Article]]
9422 [[Bar:Article (context),context|Article]]
9423 [[:Bar:Article (context), context|Article]]
9424 [[:Bar:Article (context),context|Article]]
9425 !! end
9426
9427 !! test
9428 pre-save transform: trim trailing empty lines
9429 !! options
9430 pst
9431 !! wikitext
9432 Empty lines are trimmed
9433
9434
9435
9436
9437 !! html
9438 Empty lines are trimmed
9439 !! end
9440
9441 !! test
9442 pre-save transform: Signature expansion
9443 !! options
9444 pst
9445 !! wikitext
9446 * ~~~
9447 * <noinclude>~~~</noinclude>
9448 * <includeonly>~~~</includeonly>
9449 * <onlyinclude>~~~</onlyinclude>
9450 !! html
9451 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9452 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9453 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9454 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9455 !! end
9456
9457
9458 !! test
9459 pre-save transform: Signature expansion in nowiki tags (bug 93)
9460 !! options
9461 pst disabled
9462 !! wikitext
9463 Shall not expand:
9464
9465 <nowiki>~~~~</nowiki>
9466
9467 <includeonly><nowiki>~~~~</nowiki></includeonly>
9468
9469 <noinclude><nowiki>~~~~</nowiki></noinclude>
9470
9471 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9472
9473 {{subst:Foo}} shall be converted to FOO
9474
9475 As well as inside noinclude/onlyinclude
9476 <noinclude>{{subst:Foo}}</noinclude>
9477 <onlyinclude>{{subst:Foo}}</onlyinclude>
9478
9479 But not inside includeonly
9480 <includeonly>{{subst:Foo}}</includeonly>
9481 !! html
9482 Shall not expand:
9483
9484 <nowiki>~~~~</nowiki>
9485
9486 <includeonly><nowiki>~~~~</nowiki></includeonly>
9487
9488 <noinclude><nowiki>~~~~</nowiki></noinclude>
9489
9490 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9491
9492 FOO shall be converted to FOO
9493
9494 As well as inside noinclude/onlyinclude
9495 <noinclude>FOO</noinclude>
9496 <onlyinclude>FOO</onlyinclude>
9497
9498 But not inside includeonly
9499 <includeonly>{{subst:Foo}}</includeonly>
9500 !! end
9501
9502 !! test
9503 Parsoid: Recognize nowiki with trailing space in tags
9504 !! options
9505 parsoid=wt2html
9506 !! wikitext
9507 <nowiki ><div>[[foo]]</nowiki >
9508
9509 a<nowiki / >b
9510
9511 c<nowiki />d
9512
9513 e<nowiki/ >f
9514 !! html
9515 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9516 <p>ab</p>
9517 <p>cd</p>
9518 <p>ef</p>
9519 !! end
9520
9521 !! test
9522 Parsoid: Recognize nowiki with odd capitalization
9523 !! options
9524 parsoid=wt2html
9525 !! wikitext
9526 <noWikI ><div>[[foo]]</Nowiki >
9527 !! html
9528 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9529 !! end
9530
9531
9532 !! test
9533 Parsoid: Escape nowiki with trailing space in tags
9534 !! options
9535 parsoid=html2wt
9536 !! wikitext
9537 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9538
9539 a&lt;nowiki /&gt;b
9540
9541 c&lt;nowiki/ &gt;d
9542 !! html
9543 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9544 <p>a&lt;nowiki /&gt;b</p>
9545 <p>c&lt;nowiki/ &gt;d</p>
9546 !! end
9547
9548 !! test
9549 Parsoid: Escape weird noWikI capitalizations
9550 !! options
9551 parsoid=html2wt
9552 !! wikitext
9553 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9554 !! html
9555 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9556 !! end
9557
9558 ###
9559 ### Message transform tests
9560 ###
9561 !! test
9562 message transform: magic variables
9563 !! options
9564 msg
9565 !! wikitext
9566 {{SITENAME}}
9567 !! html
9568 MediaWiki
9569 !! end
9570
9571 !! test
9572 message transform: should not transform wiki markup
9573 !! options
9574 msg
9575 !! wikitext
9576 ''test''
9577 !! html
9578 ''test''
9579 !! end
9580
9581 !! test
9582 message transform: <noinclude> in transcluded template (bug 4926)
9583 !! options
9584 msg
9585 !! wikitext
9586 {{Includes}}
9587 !! html
9588 Foobar
9589 !! end
9590
9591 !! test
9592 message transform: <onlyinclude> in transcluded template (bug 4926)
9593 !! options
9594 msg
9595 !! wikitext
9596 {{Includes2}}
9597 !! html
9598 Foo
9599 !! end
9600
9601 !! test
9602 {{#special:}} page name, known
9603 !! options
9604 msg
9605 !! wikitext
9606 {{#special:Recentchanges}}
9607 !! html
9608 Special:RecentChanges
9609 !! end
9610
9611 !! test
9612 {{#special:}} page name with subpage, known
9613 !! options
9614 msg
9615 !! wikitext
9616 {{#special:Recentchanges/param}}
9617 !! html
9618 Special:RecentChanges/param
9619 !! end
9620
9621 !! test
9622 {{#special:}} page name, unknown
9623 !! options
9624 msg
9625 !! wikitext
9626 {{#special:foobar nonexistent}}
9627 !! html
9628 Special:Foobar nonexistent
9629 !! end
9630
9631 !! test
9632 {{#speciale:}} page name, known
9633 !! options
9634 msg
9635 !! wikitext
9636 {{#speciale:Recentchanges}}
9637 !! html
9638 Special:RecentChanges
9639 !! end
9640
9641 !! test
9642 {{#speciale:}} page name with subpage, known
9643 !! options
9644 msg
9645 !! wikitext
9646 {{#speciale:Recentchanges/param}}
9647 !! html
9648 Special:RecentChanges/param
9649 !! end
9650
9651 !! test
9652 {{#speciale:}} page name, unknown
9653 !! options
9654 msg
9655 !! wikitext
9656 {{#speciale:foobar nonexistent}}
9657 !! html
9658 Special:Foobar_nonexistent
9659 !! end
9660
9661 ###
9662 ### Images
9663 ###
9664 ### For Parsoid-specific tests, see
9665 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9666
9667 !! test
9668 Simple image
9669 !! options
9670 parsoid=wt2html,wt2wt,html2html
9671 !! wikitext
9672 [[Image:foobar.jpg]]
9673 !! html/php
9674 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9675 </p>
9676 !! html/parsoid
9677 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
9678 </p>
9679 !! end
9680
9681 !! test
9682 Simple image (using File: namespace, now canonical)
9683 !! wikitext
9684 [[File:Foobar.jpg]]
9685 !! html/php
9686 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9687 </p>
9688 !! html/parsoid
9689 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
9690 </p>
9691 !! end
9692
9693 !! test
9694 Right-aligned image
9695 !! wikitext
9696 [[File:Foobar.jpg|right]]
9697 !! html/php
9698 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9699
9700 !! html/parsoid
9701 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>
9702 !! end
9703
9704 !! test
9705 Image with caption
9706 !! wikitext
9707 [[File:Foobar.jpg|right|Caption text]]
9708 !! html/php
9709 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9710
9711 !! html/parsoid
9712 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
9713 !! end
9714
9715 !! test
9716 Image with caption, bug 53312 #1
9717 !! wikitext
9718 [[File:Foobar.jpg|right|Caption page stuff]]
9719 !! html/php
9720 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9721
9722 !! html/parsoid
9723 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
9724 !! end
9725
9726 !! test
9727 Image with caption, bug 53312 #2
9728 !! wikitext
9729 [[File:Foobar.jpg|right|Caption page=]]
9730 !! html/php
9731 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9732
9733 !! html/parsoid
9734 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
9735 !! end
9736
9737 !! test
9738 Image with caption, bug 53312 #3
9739 !! wikitext
9740 [[File:Foobar.jpg|right|Caption page=stuff]]
9741 !! html/php
9742 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9743
9744 !! html/parsoid
9745 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
9746 !! end
9747
9748 !! test
9749 Allow empty links in image captions (Bug 60753)
9750 !! wikitext
9751 [[File:Foobar.jpg|thumb|Caption [[Link1]]
9752 [[]]
9753 [[Link2]]
9754 ]]
9755 !! html/php
9756 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
9757
9758 !! html/parsoid
9759 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
9760 [[]]
9761 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
9762 </figcaption></figure>
9763 !! end
9764
9765 !! test
9766 Link with empty target
9767 !! wikitext
9768 [[]]
9769 !! html
9770 <p>[[]]
9771 </p>
9772 !! end
9773
9774 !! test
9775 Image with empty attribute
9776 !! options
9777 parsoid=wt2html,wt2wt,html2html
9778 !! wikitext
9779 [[File:Foobar.jpg|right||Caption text]]
9780 !! html/php
9781 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9782
9783 !! html/parsoid
9784 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
9785 !! end
9786
9787 !! test
9788 1. Block image with individual attributes from templates
9789 !! wikitext
9790 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
9791 !! html/php
9792 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
9793
9794 !! html/parsoid
9795 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[24,38,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
9796 !! end
9797
9798 !! test
9799 2. Block Image with individual attributes from templates
9800 !! wikitext
9801 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
9802 !! html/php
9803 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
9804
9805 !! html/parsoid
9806 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,32,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[33,47,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
9807 !! end
9808
9809 !! test
9810 3. Inline image with individual attributes from templates
9811 !! wikitext
9812 [[File:Foobar.jpg|{{echo|50px}}]]
9813 !! html/php
9814 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
9815 </p>
9816 !! html/parsoid
9817 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,31,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
9818 !! end
9819
9820 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
9821 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
9822 !! test
9823 Image with multiple attributes from the same template
9824 !! wikitext
9825 [[File:Foobar.jpg|{{image_attribs}}]]
9826 !! html/php
9827 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9828
9829 !! html/parsoid
9830 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
9831 !! end
9832
9833 !! test
9834 Image with link tails
9835 !! wikitext
9836 123[[File:Foobar.jpg]]456
9837 123[[File:Foobar.jpg|right]]456
9838 123[[File:Foobar.jpg|thumb]]456
9839 !! html/php
9840 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
9841 </p>
9842 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
9843 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
9844
9845 !! html/parsoid
9846 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>456</p>
9847 123<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>456
9848 123<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220"></a></figure>456
9849 !! end
9850
9851 !! test
9852 Image with multiple captions -- only last one is accepted
9853 !! wikitext
9854 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9855 !! html/php
9856 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
9857
9858 !! html/parsoid
9859 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
9860 !! end
9861
9862 !! test
9863 Image with multiple widths -- use last
9864 !! wikitext
9865 [[File:Foobar.jpg|200px|300px|caption]]
9866 !! html/php
9867 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
9868 </p>
9869 !! html/parsoid
9870 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="34" width="300"/></a></span></p>
9871 !! end
9872
9873 !! test
9874 Image with multiple alignments -- use first (bug 48664)
9875 !! wikitext
9876 [[File:Foobar.jpg|thumb|left|right|center|caption]]
9877
9878 [[File:Foobar.jpg|middle|text-top|caption]]
9879 !! html/php
9880 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
9881 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
9882 </p>
9883 !! html/parsoid
9884 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
9885 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
9886 !! end
9887
9888 !! test
9889 Image with width attribute at different positions
9890 !! wikitext
9891 [[File:Foobar.jpg|200px|right|Caption]]
9892 [[File:Foobar.jpg|right|200px|Caption]]
9893 [[File:Foobar.jpg|right|Caption|200px]]
9894 !! html/php
9895 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
9896 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
9897 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
9898
9899 !! html/parsoid
9900 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9901 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9902 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9903 !! end
9904
9905 # a sad bit of backward-compatibility
9906 !! test
9907 Image with size specified with pxpx (bug 13500, 51628)
9908 !! options
9909 parsoid=wt2html,wt2wt,html2html
9910 !! wikitext
9911 [[File:Foobar.jpg|20pxpx]]
9912 [[File:Foobar.jpg|200x20pxpx]]
9913 !! html/php
9914 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
9915 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
9916 </p>
9917 !! html/parsoid
9918 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="2" width="20"/></a></span><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="177"/></a></span></p>
9919 !! end
9920
9921 !! test
9922 Image with link parameter, wiki target
9923 !! wikitext
9924 [[File:Foobar.jpg|link=Main Page]]
9925 !! html/php
9926 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9927 </p>
9928 !! html/parsoid
9929 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9930 !! end
9931
9932 # parsoid bug 49293 (part 1)
9933 !! test
9934 Image with link parameter, URL target
9935 !! wikitext
9936 [[File:Foobar.jpg|link=http://example.com/]]
9937 !! html/php
9938 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9939 </p>
9940 !! html/parsoid
9941 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9942 !! end
9943
9944 # parsoid bug 49293 (part 2)
9945 !! test
9946 Image with link parameter, protocol-less URL target
9947 !! wikitext
9948 [[File:Foobar.jpg|link=//example.com/]]
9949 !! html/php
9950 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9951 </p>
9952 !! html/parsoid
9953 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9954 !! end
9955
9956 !! test
9957 Image with link parameter, wgExternalLinkTarget
9958 !! wikitext
9959 [[Image:foobar.jpg|link=http://example.com/]]
9960 !! config
9961 wgExternalLinkTarget='foobar'
9962 !! html
9963 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9964 </p>
9965 !! end
9966
9967 !! test
9968 Image with link parameter, wgNoFollowLinks set to false
9969 !! wikitext
9970 [[Image:foobar.jpg|link=http://example.com/]]
9971 !! config
9972 wgNoFollowLinks=false
9973 !! html
9974 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9975 </p>
9976 !! end
9977
9978 !! test
9979 Image with link parameter, wgNoFollowDomainExceptions
9980 !! wikitext
9981 [[Image:foobar.jpg|link=http://example.com/]]
9982 !! config
9983 wgNoFollowDomainExceptions='example.com'
9984 !! html
9985 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9986 </p>
9987 !! end
9988
9989 !! test
9990 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9991 !! wikitext
9992 [[Image:foobar.jpg|link=http://example.com/|Title]]
9993 !! config
9994 wgExternalLinkTarget='foobar'
9995 !! html
9996 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9997 </p>
9998 !! end
9999
10000 !! test
10001 Image with empty link parameter
10002 !! wikitext
10003 [[File:Foobar.jpg|link=]]
10004 !! html/php
10005 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10006 </p>
10007 !! html/parsoid
10008 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
10009 !! end
10010
10011 !! test
10012 Image with link parameter (wiki target) and unnamed parameter
10013 !! wikitext
10014 [[File:Foobar.jpg|link=Main_Page|Title]]
10015 !! html/php
10016 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10017 </p>
10018 !! html/parsoid
10019 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10020 !! end
10021
10022 !! test
10023 Image with link parameter (URL target) and unnamed parameter
10024 !! wikitext
10025 [[File:Foobar.jpg|link=http://example.com/|Title]]
10026 !! html/php
10027 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10028 </p>
10029 !! html/parsoid
10030 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
10031 !! end
10032
10033 !! test
10034 Thumbnail image with link parameter
10035 !! options
10036 parsoid=wt2html,wt2wt,html2html
10037 !! wikitext
10038 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10039 !! html/php
10040 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10041
10042 !! html/parsoid
10043 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
10044 !! end
10045
10046 !! test
10047 Manually-specified thumbnail image
10048 !! wikitext
10049 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
10050 !! html/php
10051 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10052
10053 !! html/parsoid
10054 XXX NOT IMPLEMENTED XXX
10055 !! end
10056
10057 !! test
10058 Manually-specified thumbnail image with explicit link to wiki page
10059 !! wikitext
10060 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
10061 !! html/php
10062 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10063
10064 !! html/parsoid
10065 XXX NOT IMPLEMENTED XXX
10066 !! end
10067
10068 !! test
10069 Manually-specified thumbnail image with explicit link to url
10070 !! wikitext
10071 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10072 !! html/php
10073 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10074
10075 !! html/parsoid
10076 XXX NOT IMPLEMENTED XXX
10077 !! end
10078
10079 !! test
10080 Manually-specified thumbnail image with explicit no link
10081 !! wikitext
10082 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10083 !! html/php
10084 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10085
10086 !! html/parsoid
10087 XXX NOT IMPLEMENTED XXX
10088 !! end
10089
10090 !! test
10091 Manually-specified thumbnail image with explicit link and alt text
10092 !! wikitext
10093 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
10094 !! html/php
10095 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10096
10097 !! html/parsoid
10098 XXX NOT IMPLEMENTED XXX
10099 !! end
10100
10101 !! test
10102 Image with frame and link
10103 !! options
10104 parsoid=wt2html,wt2wt,html2html
10105 !! wikitext
10106 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10107 !! html/php
10108 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
10109
10110 !! html/parsoid
10111 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page">Main Page</a></figcaption></figure>
10112 !! end
10113
10114 !! test
10115 Image with frame and link and explicit alt
10116 !! options
10117 parsoid=wt2html,wt2wt,html2html
10118 !! wikitext
10119 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10120 !! html/php
10121 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
10122
10123 !! html/parsoid
10124 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page">Main Page</a></figcaption></figure>
10125 !! end
10126
10127 !! test
10128 Image with wiki markup in implicit alt
10129 !! options
10130 parsoid=wt2html,wt2wt,html2html
10131 !! wikitext
10132 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10133
10134 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10135 !! html/php
10136 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10137 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10138 </p>
10139 !! html/parsoid
10140 <p><span class="mw-default-size" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;testing '''bold''' in alt&quot;}"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10141 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
10142 !! end
10143
10144 ###################
10145 # Image sizing.
10146 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10147 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10148 # Foobar has actual size of 1941x220
10149 # 1. Thumbs & frameless always reduce, can't be enlarged
10150 # 2. Framed images ignore width; always render at default size.
10151 # If given a height, they respect height but continue to ignore width.
10152 # 3. "Unspecified format" and border are the only types which can be
10153 # enlarged.
10154
10155 !! test
10156 Image: "unspecified format" and border enlarge
10157 !! options
10158 parsoid=wt2html,wt2wt,html2html
10159 !! wikitext
10160 [[File:Foobar.jpg|2000px]]
10161
10162 [[File:Foobar.jpg|border|2000px]]
10163 !! html/php
10164 <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>
10165 </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>
10166 </p>
10167 !! html/parsoid
10168 <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>
10169 <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>
10170 !! end
10171
10172 !! test
10173 Image: "unspecified format" and border reduce
10174 !! options
10175 parsoid=wt2html,wt2wt,html2html
10176 !! wikitext
10177 [[File:Foobar.jpg|1000px]]
10178
10179 [[File:Foobar.jpg|border|1000px]]
10180 !! html/php
10181 <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>
10182 </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>
10183 </p>
10184 !! html/parsoid
10185 <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>
10186 <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>
10187 !! end
10188
10189 !! test
10190 Image: thumbs reduce
10191 !! options
10192 parsoid=wt2html,wt2wt,html2html
10193 !! wikitext
10194 [[File:Foobar.jpg|thumb|50px]]
10195 !! html/php
10196 <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>
10197
10198 !! html/parsoid
10199 <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>
10200 !! end
10201
10202 !! test
10203 Image: thumbs can't be enlarged past original size
10204 !! options
10205 parsoid=wt2html,wt2wt,html2html
10206 !! wikitext
10207 [[File:Foobar.jpg|thumb|2000px]]
10208 !! html/php
10209 <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>
10210
10211 !! html/parsoid
10212 <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>
10213 !! end
10214
10215 !! test
10216 Image: frameless can reduce in size
10217 !! options
10218 parsoid=wt2html,wt2wt,html2html
10219 !! wikitext
10220 [[File:Foobar.jpg|frameless|50px]]
10221 !! html/php
10222 <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>
10223 </p>
10224 !! html/parsoid
10225 <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>
10226 !! end
10227
10228 !! test
10229 Image: frameless can't be enlarged past original size
10230 !! options
10231 parsoid=wt2html,wt2wt,html2html
10232 !! wikitext
10233 [[File:Foobar.jpg|frameless|2000px]]
10234 !! html/php
10235 <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>
10236 </p>
10237 !! html/parsoid
10238 <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>
10239 !! end
10240
10241 !! test
10242 Image: framed images ignore size if only width is given
10243 !! options
10244 parsoid=wt2html,wt2wt,html2html
10245 !! wikitext
10246 [[File:Foobar.jpg|frame]]
10247
10248 [[File:Foobar.jpg|frame|50px]]
10249
10250 [[File:Foobar.jpg|frame|2000px]]
10251 !! html/php
10252 <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>
10253 <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>
10254 <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>
10255
10256 !! html/parsoid
10257 <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>
10258 !! end
10259
10260 !! test
10261 Image: framed images respect size if given a height, but ignore width.
10262 !! wikitext
10263 [[File:Foobar.jpg|frame|50x50px]]
10264 !! html/php
10265 <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>
10266
10267 !! html/parsoid
10268 <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>
10269 !! end
10270
10271 ###################
10272
10273 !! test
10274 Link to image page- image page normally doesn't exists, hence edit link
10275 Add test with existing image page
10276 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10277 !! wikitext
10278 [[:Image:test]]
10279 !! html
10280 <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>
10281 </p>
10282 !! end
10283
10284 !! test
10285 bug 18784 Link to non-existent image page with caption should use caption as link text
10286 !! wikitext
10287 [[:Image:test|caption]]
10288 !! html
10289 <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>
10290 </p>
10291 !! end
10292
10293 !! test
10294 Frameless image caption with a free URL
10295 !! wikitext
10296 [[File:Foobar.jpg|http://example.com]]
10297 !! html/php
10298 <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>
10299 </p>
10300 !! html/parsoid
10301 <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>
10302 !! end
10303
10304 !! test
10305 Thumbnail image caption with a free URL
10306 !! wikitext
10307 [[File:Foobar.jpg|thumb|http://example.com]]
10308 !! html/php
10309 <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>
10310
10311 !! html/parsoid
10312 <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>
10313 !! end
10314
10315 !! test
10316 Thumbnail image caption with a free URL and explicit alt
10317 !! options
10318 parsoid=wt2html,wt2wt,html2html
10319 !! wikitext
10320 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10321 !! html/php
10322 <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>
10323
10324 !! html/parsoid
10325 <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>
10326 !! end
10327
10328 !! test
10329 SVG thumbnails with no language set
10330 !! options
10331 !! wikitext
10332 [[File:Foobar.svg|thumb|caption]]
10333 !! html
10334 <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="180" 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>
10335
10336 !! end
10337
10338 !! test
10339 SVG thumbnails with language de
10340 !! options
10341 !! wikitext
10342 [[File:Foobar.svg|thumb|caption|lang=de]]
10343 !! html
10344 <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="180" 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>
10345
10346 !! end
10347
10348 !! test
10349 SVG thumbnails with invalid language code
10350 !! options
10351 !! wikitext
10352 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10353 !! html
10354 <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="180" 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>
10355
10356 !! end
10357
10358 !! test
10359 BUG 1887: A ISBN with a thumbnail
10360 !! wikitext
10361 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
10362 !! html
10363 <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>
10364
10365 !! end
10366
10367 !! test
10368 BUG 1887: A RFC with a thumbnail
10369 !! wikitext
10370 [[Image:foobar.jpg|thumb|This is RFC 12354]]
10371 !! html
10372 <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>
10373
10374 !! end
10375
10376 !! test
10377 BUG 1887: A mailto link with a thumbnail
10378 !! wikitext
10379 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
10380 !! html
10381 <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>
10382
10383 !! end
10384
10385 # Pending resolution to bug 368
10386 !! test
10387 BUG 648: Frameless image caption with a link
10388 !! wikitext
10389 [[Image:foobar.jpg|text with a [[link]] in it]]
10390 !! html
10391 <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>
10392 </p>
10393 !! end
10394
10395 !! test
10396 BUG 648: Frameless image caption with a link (suffix)
10397 !! wikitext
10398 [[Image:foobar.jpg|text with a [[link]]foo in it]]
10399 !! html
10400 <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>
10401 </p>
10402 !! end
10403
10404 !! test
10405 BUG 648: Frameless image caption with an interwiki link
10406 !! wikitext
10407 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
10408 !! html
10409 <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>
10410 </p>
10411 !! end
10412
10413 !! test
10414 BUG 648: Frameless image caption with a piped interwiki link
10415 !! wikitext
10416 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10417 !! html
10418 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10419 </p>
10420 !! end
10421
10422 !! test
10423 Escape HTML special chars in image alt text
10424 !! wikitext
10425 [[Image:foobar.jpg|& < > "]]
10426 !! html
10427 <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>
10428 </p>
10429 !! end
10430
10431 !! test
10432 BUG 499: Alt text should have &#1234;, not &amp;1234;
10433 !! wikitext
10434 [[Image:foobar.jpg|&#9792;]]
10435 !! html
10436 <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>
10437 </p>
10438 !! end
10439
10440 !! test
10441 Broken image caption with link
10442 !! wikitext
10443 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10444 !! html
10445 <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.
10446 </p>
10447 !! end
10448
10449 !! test
10450 Image caption containing another image
10451 !! wikitext
10452 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
10453 !! html
10454 <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>
10455
10456 !! end
10457
10458 !! test
10459 Image caption containing a newline
10460 !! wikitext
10461 [[Image:Foobar.jpg|This
10462 *is some text]]
10463 !! html
10464 <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>
10465 </p>
10466 !!end
10467
10468 !!test
10469 Parsoid: Image caption containing leading space
10470 (The leading space should not trigger nowiki escaping in wt2wt mode)
10471 !! wikitext
10472 [[Image:Foobar.jpg|thumb| bar]]
10473 !! html
10474 <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>
10475
10476 !!end
10477
10478 !! test
10479 Images: caption containing a table
10480 !! wikitext
10481 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10482 {|
10483 ! Foo !! Bar
10484 |-
10485 | Foo1 || Bar1
10486 |}
10487 and some more text.]]
10488 !! html/php
10489 <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>
10490
10491 !! html/parsoid
10492 <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
10493 <table>
10494 <tbody>
10495 <tr><th>Foo </th><th>Bar</th></tr>
10496 <tr>
10497 <td>Foo1 </td>
10498 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10499 !! end
10500
10501 !! test
10502 Bug 3090: External links other than http: in image captions
10503 !! wikitext
10504 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10505 !! html/php
10506 <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>
10507
10508 !! html/parsoid
10509 <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>
10510 !! end
10511
10512 !! test
10513 Custom class
10514 !! options
10515 parsoid=wt2html,wt2wt,html2html
10516 !! wikitext
10517 [[Image:foobar.jpg|a|class=b]]
10518 !! html/php
10519 <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>
10520 </p>
10521 !! html/parsoid
10522 <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>
10523 !! end
10524
10525 !! test
10526 Localized image handling (1).
10527 !! options
10528 parsoid=wt2html,wt2wt,html2html
10529 language=es
10530 !! wikitext
10531 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10532 !! html/php
10533 <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>
10534
10535 !! html/parsoid
10536 <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>
10537 !! end
10538
10539 !! test
10540 Localized image handling (2).
10541 !! options
10542 parsoid=wt2html,wt2wt,html2html
10543 language=es
10544 !! wikitext
10545 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10546 !! html/php
10547 <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>
10548
10549 !! html/parsoid
10550 <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>
10551 !! end
10552
10553 !! test
10554 "border", "frameless" and "class" attributes on an image.
10555 !! options
10556 parsoid=wt2html,wt2wt,html2html
10557 !! wikitext
10558 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10559 !! html/php
10560 <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>
10561 </p>
10562 !! html/parsoid
10563 <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>
10564 !! end
10565
10566 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10567 !! test
10568 Invalid image attributes (bug 62500)
10569 !! options
10570 parsoid=wt2html,wt2wt,html2html
10571 !! wikitext
10572 [[File:Foobar.jpg|thumb|float|left|caption]]
10573
10574 [[File:Foobar.jpg|thumb|righ|caption]]
10575
10576 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10577 !! html/php
10578 <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>
10579 <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>
10580 <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>
10581
10582 !! html/parsoid
10583 <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>
10584 !! end
10585
10586 !! article
10587 File:Barfoo.jpg
10588 !! text
10589 #REDIRECT [[File:Barfoo.jpg]]
10590 !! endarticle
10591
10592 !! test
10593 Redirected image
10594 !! wikitext
10595 [[Image:Barfoo.jpg]]
10596 !! html
10597 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10598 </p>
10599 !! end
10600
10601 !! test
10602 Missing image with uploads disabled
10603 !! options
10604 wgEnableUploads=0
10605 !! wikitext
10606 [[Image:Foobaz.jpg]]
10607 !! html
10608 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10609 </p>
10610 !! end
10611
10612 # Parsoid-specific testing for images
10613 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10614 # Currently imperfect due to a flaw in the Parsoid testrunner
10615 # Work in progress
10616 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10617 # image tests.
10618
10619 !! test
10620 Parsoid-specific image handling - simple image with size and middle alignment
10621 !! wikitext
10622 [[File:Foobar.jpg|middle|50px]]
10623 !! html/parsoid
10624 <p><span class="mw-valign-middle" typeof="mw:Image">
10625 <a href="File:Foobar.jpg">
10626 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10627 </a>
10628 </span>
10629 </p>
10630 !! end
10631
10632 !! test
10633 Parsoid-specific image handling - simple image with size, middle alignment,
10634 non-standard namespace alias
10635 !! options
10636 parsoid=wt2wt,wt2html,html2html
10637 !! wikitext
10638 [[Image:Foobar.jpg|middle|50px]]
10639 !! html/parsoid
10640 <p><span class="mw-valign-middle" typeof="mw:Image">
10641 <a href="File:Foobar.jpg">
10642 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10643 </a>
10644 </span>
10645 </p>
10646 !! end
10647
10648 !! test
10649 Parsoid-specific image handling - simple image with size and middle alignment
10650 (existing content)
10651 !! wikitext
10652 [[File:Foobar.jpg|50px|middle]]
10653 !! html/parsoid
10654 <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>
10655 !! end
10656
10657 !! test
10658 Parsoid-specific image handling - simple image with size and middle alignment
10659 and non-standard namespace name
10660 !! options
10661 parsoid=wt2html,wt2wt,html2html
10662 !! wikitext
10663 [[Image:Foobar.jpg|50px|middle]]
10664 !! html/parsoid
10665 <p><span class="mw-valign-middle" typeof="mw:Image">
10666 <a href="File:Foobar.jpg">
10667 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10668 </a>
10669 </span>
10670 </p>
10671 !! end
10672
10673 !! test
10674 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10675 !! wikitext
10676 [[File:Foobar.jpg|500x10px|baseline|caption]]
10677 !! html/parsoid
10678 <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>
10679 !! end
10680
10681 !! test
10682 Parsoid-specific image handling - simple image with border and size spec
10683 !! wikitext
10684 [[File:Foobar.jpg|50px|border|caption]]
10685 !! html/parsoid
10686 <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>
10687 !! end
10688
10689 !! test
10690 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10691 !! wikitext
10692 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10693 !! html/parsoid
10694 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10695 <a href="File:Foobar.jpg">
10696 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10697 </a>
10698 <figcaption>caption content</figcaption>
10699 </figure>
10700 !! end
10701
10702 !! test
10703 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10704 (existing content)
10705 !! wikitext
10706 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10707 !! html/parsoid
10708 <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>
10709 !! end
10710
10711 !! test
10712 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10713 !! wikitext
10714 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10715 !! html/parsoid
10716 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10717 <a href="File:Foobar.jpg">
10718 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10719 </a>
10720 <figcaption>caption</figcaption>
10721 </figure>
10722 !! end
10723
10724 !! test
10725 Parsoid-specific image handling - thumbnail with specific size, halign,
10726 valign, and caption (existing content)
10727 !! wikitext
10728 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10729 !! html/parsoid
10730 <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>
10731 !! end
10732
10733 !! test
10734 Parsoid-specific image handling - framed image with specific size and caption
10735 !! wikitext
10736 [[Image:Foobar.jpg|frame|500x50px|caption]]
10737 !! html/parsoid
10738 <figure typeof="mw:Image/Frame">
10739 <a href="File:Foobar.jpg">
10740 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10741 </a>
10742 <figcaption>caption</figcaption>
10743 </figure>
10744 !! end
10745
10746 !! test
10747 Parsoid-specific image handling - framed image with specific size and caption
10748 (existing content)
10749 !! wikitext
10750 [[File:Foobar.jpg|442x50px|frame|caption]]
10751 !! html/parsoid
10752 <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>
10753 !! end
10754
10755 !! test
10756 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10757 !! wikitext
10758 [[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10759 !! html/parsoid
10760 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10761 <a href="File:Foobar.jpg">
10762 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10763 </a>
10764 <figcaption>caption</figcaption>
10765 </figure>
10766 !! end
10767
10768 !! test
10769 Parsoid-specific image handling - framed image with specific size, halign,
10770 valign, and caption (existing content)
10771 !! wikitext
10772 [[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
10773 !! html/parsoid
10774 <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>
10775 !! end
10776
10777 !! test
10778 Parsoid-specific image handling - frameless image with specific size, border, and caption
10779 !! wikitext
10780 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
10781 !! html/parsoid
10782 <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>
10783 !! end
10784
10785 !! test
10786 Parsoid-specific image handling - simple image with a formatted caption
10787 !! wikitext
10788 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10789 !! html/parsoid
10790 <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>"}'>
10791 <a href="File:Foobar.jpg">
10792 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10793 </a></span></p>
10794 !! end
10795
10796 !! test
10797 Parsoid-specific image handling - caption with a template in it
10798 !! wikitext
10799 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
10800 !! html/parsoid
10801 <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>
10802 !! end
10803
10804 !! test
10805 Parsoid-specific image handling - caption with unbalanced tags in it
10806 !! options
10807 parsoid=wt2html,wt2wt,html2html
10808 !! wikitext
10809 foo
10810 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
10811 bar
10812 !! html/parsoid
10813 <p>foo</p>
10814 <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>
10815 <p>bar</p>
10816 !! end
10817
10818 !! test
10819 Parsoid-specific image handling - empty caption
10820 !! wikitext
10821 [[File:Foobar.jpg|thumb|]]
10822 !! html/parsoid
10823 <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>
10824 !! end
10825
10826 !! test
10827 Parsoid-specific image handling - whitespace 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 - lang option
10836 !! wikitext
10837 foo
10838 [[File:Foobar.svg|lang=de|caption]]
10839 bar
10840 !! html/parsoid
10841 <p>foo
10842 <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>
10843 bar</p>
10844 !! end
10845
10846
10847 ###
10848 ### Subpages
10849 ###
10850 !! article
10851 Subpage test/subpage
10852 !! text
10853 foo
10854 !! endarticle
10855
10856 !! test
10857 Subpage link
10858 !! options
10859 subpage title=[[Subpage test]]
10860 !! wikitext
10861 [[/subpage]]
10862 !! html
10863 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10864 </p>
10865 !! end
10866
10867 !! test
10868 Subpage noslash link
10869 !! options
10870 subpage title=[[Subpage test]]
10871 !! wikitext
10872 [[/subpage/]]
10873 !! html
10874 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10875 </p>
10876 !! end
10877
10878 # TODO: make this PHP-parser compatible!
10879 !! test
10880 Relative subpage noslash link
10881 !! options
10882 parsoid=wt2wt,wt2html,html2html
10883 subpage title=[[Subpage test/1/2/3/4]]
10884 !! wikitext
10885 [[../../subpage/]]
10886
10887 [[../../subpage]]
10888 !! html
10889 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10890 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10891 !! end
10892
10893 # TODO: make this PHP-parser compatible!
10894 !! test
10895 Parsoid: dot-slash prefixed wikilinks
10896 !! options
10897 parsoid=wt2wt,wt2html,html2html
10898 !! wikitext
10899 [[./foo]]
10900
10901 [[././bar]]
10902
10903 [[././baz/]]
10904 !! html
10905 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10906 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10907 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10908 !! end
10909
10910 !! test
10911 Disabled subpages
10912 !! wikitext
10913 [[/subpage]]
10914 !! html
10915 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10916 </p>
10917 !! end
10918
10919 !! test
10920 BUG 561: {{/Subpage}}
10921 !! options
10922 subpage title=[[Page]]
10923 !! wikitext
10924 {{/Subpage}}
10925 !! html
10926 <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>
10927 </p>
10928 !! end
10929
10930 ###
10931 ### Categories
10932 ###
10933 !! article
10934 Category:MediaWiki User's Guide
10935 !! text
10936 blah
10937 !! endarticle
10938
10939 !! test
10940 Link to category
10941 !! wikitext
10942 [[:Category:MediaWiki User's Guide]]
10943 !! html
10944 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10945 </p>
10946 !! end
10947
10948 !! test
10949 Simple category
10950 !! options
10951 cat
10952 !! wikitext
10953 [[Category:MediaWiki User's Guide]]
10954 !! html
10955 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10956 !! end
10957
10958 !! test
10959 PAGESINCATEGORY invalid title fatal (r33546 fix)
10960 !! wikitext
10961 {{PAGESINCATEGORY:<bogus>}}
10962 !! html
10963 <p>0
10964 </p>
10965 !! end
10966
10967 !! test
10968 Category with different sort key
10969 !! options
10970 cat
10971 !! wikitext
10972 [[Category:MediaWiki User's Guide|Foo]]
10973 !! html
10974 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10975 !! end
10976
10977 !! test
10978 Category with identical sort key
10979 !! options
10980 cat
10981 !! wikitext
10982 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10983 !! html
10984 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10985 !! end
10986
10987 !! test
10988 Category with empty sort key
10989 !! options
10990 cat
10991 pst
10992 !! wikitext
10993 [[Category:MediaWiki User's Guide|]]
10994 !! html
10995 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10996 !! end
10997
10998 !! test
10999 Category with empty sort key and parentheses
11000 !! options
11001 cat
11002 pst
11003 !! wikitext
11004 [[Category:Foo (bar)|]]
11005 !! html
11006 [[Category:Foo (bar)|Foo]]
11007 !! end
11008
11009 !! test
11010 Category with link tail
11011 !! options
11012 cat
11013 pst
11014 !! wikitext
11015 123[[Category:Foo]]456
11016 !! html
11017 123[[Category:Foo]]456
11018 !! end
11019
11020 !! test
11021 Category with template
11022 !! options
11023 cat
11024 pst
11025 !! wikitext
11026 [[Category:{{echo|Foo}}]]
11027 !! html
11028 [[Category:{{echo|Foo}}]]
11029 !! end
11030
11031 !! test
11032 Category with template in sort key
11033 !! options
11034 cat
11035 pst
11036 !! wikitext
11037 [[Category:Foo|{{echo|Bar}}]]
11038 !! html
11039 [[Category:Foo|{{echo|Bar}}]]
11040 !! end
11041
11042 !! test
11043 Category with template in sort key and title
11044 !! options
11045 cat
11046 pst
11047 !! wikitext
11048 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11049 !! html
11050 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11051 !! end
11052
11053 !! test
11054 Category / paragraph interactions
11055 !! wikitext
11056 Foo [[Category:Baz]] Bar
11057
11058 Foo [[Category:Baz]]
11059 Bar
11060
11061 Foo
11062 [[Category:Baz]]
11063 Bar
11064
11065 Foo
11066 [[Category:Baz]] Bar
11067
11068 Foo
11069 [[Category:Baz]]
11070 [[Category:Baz]]
11071 [[Category:Baz]]
11072 Bar
11073
11074 [[Category:Baz]]
11075 [[Category:Baz]]
11076 [[Category:Baz]]
11077
11078 [[Category:Baz]]
11079 {{echo|[[Category:Baz]]}}
11080 [[Category:Baz]]
11081 !! html
11082 <p>Foo Bar
11083 </p><p>Foo
11084 Bar
11085 </p><p>Foo
11086 Bar
11087 </p><p>Foo Bar
11088 </p><p>Foo
11089 Bar
11090 </p>
11091 !! end
11092
11093 !! test
11094 Parsoid: Serialize link to category page with colon escape
11095 !! options
11096 parsoid
11097 !! wikitext
11098
11099 [[:Category:Foo]]
11100 [[:Category:Foo|Bar]]
11101 !! html
11102 <p>
11103 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11104 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11105 </p>
11106 !! end
11107
11108 !! test
11109 Parsoid: Link prefix/suffixes aren't applied to category links
11110 !! options
11111 parsoid=wt2html,wt2wt,html2html
11112 language=is
11113 !! wikitext
11114 x[[Category:Foo]]y
11115 !! html
11116 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11117 !! end
11118
11119 !! test
11120 Parsoid: Serialize link to file page with colon escape
11121 !! options
11122 parsoid
11123 !! wikitext
11124
11125 [[:File:Foo.png]]
11126 [[:File:Foo.png|Bar]]
11127 !! html
11128 <p>
11129 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11130 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11131 </p>
11132 !! end
11133
11134 !! test
11135 Parsoid: Serialize a genuine category link without colon escape
11136 !! options
11137 parsoid
11138 !! wikitext
11139 [[Category:Foo]]
11140 [[Category:Foo|Bar]]
11141 !! html
11142 <link rel="mw:PageProp/Category" href="Category:Foo">
11143 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11144 !! end
11145
11146 !! test
11147 Parsoid: Defaultsort
11148 !! options
11149 parsoid
11150 !! wikitext
11151 {{DEFAULTSORT:Foo}}
11152 !! html
11153 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11154 !! end
11155
11156 ###
11157 ### Inter-language links
11158 ###
11159 !! test
11160 Inter-language links
11161 !! options
11162 ill
11163 !! wikitext
11164 [[es:Alimento]]
11165 [[fr:Nourriture]]
11166 [[zh:&#39135;&#21697;]]
11167 !! html
11168 es:Alimento fr:Nourriture zh:食品
11169 !! end
11170
11171 !! test
11172 Duplicate interlanguage links (bug 24502)
11173 !! options
11174 ill
11175 !! wikitext
11176 [[es:1]]
11177 [[es:2]]
11178 [[fr:1]]
11179 [[fr:2]]
11180 !! html
11181 es:1 fr:1
11182 !! end
11183
11184 ###
11185 ### Sections
11186 ###
11187 !! test
11188 Basic section headings
11189 !! wikitext
11190 == Headline 1 ==
11191 Some text
11192
11193 ==Headline 2==
11194 More
11195 ===Smaller headline===
11196 Blah blah
11197 !! html
11198 <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>
11199 <p>Some text
11200 </p>
11201 <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>
11202 <p>More
11203 </p>
11204 <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>
11205 <p>Blah blah
11206 </p>
11207 !! end
11208
11209 !! test
11210 Section headings with TOC
11211 !! wikitext
11212 == Headline 1 ==
11213 === Subheadline 1 ===
11214 ===== Skipping a level =====
11215 ====== Skipping a level ======
11216
11217 == Headline 2 ==
11218 Some text
11219 ===Another headline===
11220 !! html
11221 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11222 <ul>
11223 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11224 <ul>
11225 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11226 <ul>
11227 <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>
11228 <ul>
11229 <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>
11230 </ul>
11231 </li>
11232 </ul>
11233 </li>
11234 </ul>
11235 </li>
11236 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11237 <ul>
11238 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11239 </ul>
11240 </li>
11241 </ul>
11242 </div>
11243
11244 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11245 <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>
11246 <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>
11247 <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>
11248 <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>
11249 <p>Some text
11250 </p>
11251 <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>
11252
11253 !! end
11254
11255 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11256 !! test
11257 Handling of sections up to level 6 and beyond
11258 !! wikitext
11259 = Level 1 Heading=
11260 == Level 2 Heading==
11261 === Level 3 Heading===
11262 ==== Level 4 Heading====
11263 ===== Level 5 Heading=====
11264 ====== Level 6 Heading======
11265 ======= Level 7 Heading=======
11266 ======== Level 8 Heading========
11267 ========= Level 9 Heading=========
11268 ========== Level 10 Heading==========
11269 !! html
11270 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11271 <ul>
11272 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11273 <ul>
11274 <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>
11275 <ul>
11276 <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>
11277 <ul>
11278 <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>
11279 <ul>
11280 <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>
11281 <ul>
11282 <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>
11283 <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>
11284 <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>
11285 <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>
11286 <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>
11287 </ul>
11288 </li>
11289 </ul>
11290 </li>
11291 </ul>
11292 </li>
11293 </ul>
11294 </li>
11295 </ul>
11296 </li>
11297 </ul>
11298 </div>
11299
11300 <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>
11301 <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>
11302 <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>
11303 <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>
11304 <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>
11305 <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>
11306 <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>
11307 <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>
11308 <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>
11309 <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>
11310
11311 !! end
11312
11313 !! test
11314 TOC regression (bug 9764)
11315 !! wikitext
11316 == title 1 ==
11317 === title 1.1 ===
11318 ==== title 1.1.1 ====
11319 === title 1.2 ===
11320 == title 2 ==
11321 === title 2.1 ===
11322 !! html
11323 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11324 <ul>
11325 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11326 <ul>
11327 <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>
11328 <ul>
11329 <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>
11330 </ul>
11331 </li>
11332 <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>
11333 </ul>
11334 </li>
11335 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11336 <ul>
11337 <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>
11338 </ul>
11339 </li>
11340 </ul>
11341 </div>
11342
11343 <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>
11344 <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>
11345 <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>
11346 <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>
11347 <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>
11348 <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>
11349
11350 !! end
11351
11352 !! test
11353 TOC with wgMaxTocLevel=3 (bug 6204)
11354 !! options
11355 wgMaxTocLevel=3
11356 !! wikitext
11357 == title 1 ==
11358 === title 1.1 ===
11359 ==== title 1.1.1 ====
11360 === title 1.2 ===
11361 == title 2 ==
11362 === title 2.1 ===
11363 !! html
11364 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11365 <ul>
11366 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11367 <ul>
11368 <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>
11369 <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>
11370 </ul>
11371 </li>
11372 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11373 <ul>
11374 <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>
11375 </ul>
11376 </li>
11377 </ul>
11378 </div>
11379
11380 <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>
11381 <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>
11382 <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>
11383 <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>
11384 <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>
11385 <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>
11386
11387 !! end
11388
11389 !! test
11390 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11391 !! options
11392 wgMaxTocLevel=3
11393 !! wikitext
11394 ==Section 1==
11395 ===Section 1.1===
11396 ====Section 1.1.1====
11397 ====Section 1.1.1.1====
11398 ==Section 2==
11399 !! html
11400 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11401 <ul>
11402 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11403 <ul>
11404 <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>
11405 </ul>
11406 </li>
11407 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11408 </ul>
11409 </div>
11410
11411 <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>
11412 <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>
11413 <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>
11414 <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>
11415 <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>
11416
11417 !! end
11418
11419
11420 !! test
11421 Resolving duplicate section names
11422 !! wikitext
11423 == Foo bar ==
11424 == Foo bar ==
11425 !! html
11426 <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>
11427 <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>
11428
11429 !! end
11430
11431 !! test
11432 Resolving duplicate section names with differing case (bug 10721)
11433 !! wikitext
11434 == Foo bar ==
11435 == Foo Bar ==
11436 !! html
11437 <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>
11438 <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>
11439
11440 !! end
11441
11442 !! article
11443 Template:sections
11444 !! text
11445 ===Section 1===
11446 ==Section 2==
11447 !! endarticle
11448
11449 !! test
11450 Template with sections, __NOTOC__
11451 !! wikitext
11452 __NOTOC__
11453 ==Section 0==
11454 {{sections}}
11455 ==Section 4==
11456 !! html
11457 <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>
11458 <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>
11459 <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>
11460 <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>
11461
11462 !! end
11463
11464 !! test
11465 __NOEDITSECTION__ keyword
11466 !! wikitext
11467 __NOEDITSECTION__
11468 ==Section 1==
11469 ==Section 2==
11470 !! html
11471 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11472 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11473
11474 !! end
11475
11476 !! test
11477 Link inside a section heading
11478 !! wikitext
11479 ==Section with a [[Main Page|link]] in it==
11480 !! html
11481 <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>
11482
11483 !! end
11484
11485 !! test
11486 TOC regression (bug 12077)
11487 !! wikitext
11488 __TOC__
11489 == title 1 ==
11490 === title 1.1 ===
11491 == title 2 ==
11492 !! html
11493 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11494 <ul>
11495 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11496 <ul>
11497 <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>
11498 </ul>
11499 </li>
11500 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11501 </ul>
11502 </div>
11503
11504 <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>
11505 <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>
11506 <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>
11507
11508 !! end
11509
11510 !! test
11511 BUG 1219 URL next to image (good)
11512 !! wikitext
11513 http://example.com [[Image:foobar.jpg]]
11514 !! html
11515 <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>
11516 </p>
11517 !!end
11518
11519 !! test
11520 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11521 !! wikitext
11522 ===
11523 The line above must have a trailing space!
11524 === <!--
11525 --> <!-- -->
11526 But just in case it doesn't...
11527 !! html
11528 <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>
11529 <p>The line above must have a trailing space!
11530 </p>
11531 <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>
11532 <p>But just in case it doesn't...
11533 </p>
11534 !! end
11535
11536 !! test
11537 Header with special characters (bug 25462)
11538 !! wikitext
11539 The tooltips shall not show entities to the user (ie. be double escaped)
11540
11541 == text > text ==
11542 section 1
11543
11544 == text < text ==
11545 section 2
11546
11547 == text & text ==
11548 section 3
11549
11550 == text ' text ==
11551 section 4
11552
11553 == text " text ==
11554 section 5
11555 !! html
11556 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11557 </p>
11558 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11559 <ul>
11560 <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>
11561 <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>
11562 <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>
11563 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11564 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11565 </ul>
11566 </div>
11567
11568 <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>
11569 <p>section 1
11570 </p>
11571 <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>
11572 <p>section 2
11573 </p>
11574 <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>
11575 <p>section 3
11576 </p>
11577 <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>
11578 <p>section 4
11579 </p>
11580 <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>
11581 <p>section 5
11582 </p>
11583 !! end
11584
11585 !! test
11586 Headers with excess '=' characters
11587 (Are similar tests necessary beyond the 1st level?)
11588 !! wikitext
11589 =foo==
11590 ==foo=
11591 =''italic'' heading==
11592 ==''italic'' heading=
11593 !! html
11594 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11595 <ul>
11596 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11597 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11598 <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>
11599 <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>
11600 </ul>
11601 </div>
11602
11603 <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>
11604 <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>
11605 <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>
11606 <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>
11607
11608 !! end
11609
11610 !! test
11611 HTML headers vs TOC (bug 23393)
11612 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11613 !! wikitext
11614 <h1>Header 1</h1>
11615 == Header 1.1 ==
11616 == Header 1.2 ==
11617
11618 <h1>Header 2
11619 </h1>
11620 == Header 2.1 ==
11621 == Header 2.2 ==
11622 __NOEDITSECTION__
11623 !! html
11624 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11625 <ul>
11626 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11627 <ul>
11628 <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>
11629 <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>
11630 </ul>
11631 </li>
11632 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11633 <ul>
11634 <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>
11635 <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>
11636 </ul>
11637 </li>
11638 </ul>
11639 </div>
11640
11641 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11642 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11643 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11644 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11645 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11646 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11647
11648 !! end
11649
11650 !! test
11651 BUG 1219 URL next to image (broken)
11652 !! wikitext
11653 http://example.com[[Image:foobar.jpg]]
11654 !! html
11655 <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>
11656 </p>
11657 !!end
11658
11659 !! test
11660 Bug 1186 news: in the middle of text
11661 !! wikitext
11662 http://en.wikinews.org/wiki/Wikinews:Workplace
11663 !! html
11664 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11665 </p>
11666 !!end
11667
11668
11669 !! test
11670 Namespaced link must have a title
11671 !! wikitext
11672 [[Project:]]
11673 !! html
11674 <p>[[Project:]]
11675 </p>
11676 !!end
11677
11678 !! test
11679 Namespaced link must have a title (bad fragment version)
11680 !! wikitext
11681 [[Project:#fragment]]
11682 !! html
11683 <p>[[Project:#fragment]]
11684 </p>
11685 !!end
11686
11687
11688 ###
11689 ### HTML tags and HTML attributes
11690 ###
11691
11692 !! test
11693 div with no attributes
11694 !! wikitext
11695 <div>HTML rocks</div>
11696 !! html
11697 <div>HTML rocks</div>
11698
11699 !! end
11700
11701 !! test
11702 div with double-quoted attribute
11703 !! wikitext
11704 <div id="rock">HTML rocks</div>
11705 !! html
11706 <div id="rock">HTML rocks</div>
11707
11708 !! end
11709
11710 !! test
11711 div with single-quoted attribute
11712 !! wikitext
11713 <div id='rock'>HTML rocks</div>
11714 !! html
11715 <div id="rock">HTML rocks</div>
11716
11717 !! end
11718
11719 !! test
11720 div with unquoted attribute
11721 !! wikitext
11722 <div id=rock>HTML rocks</div>
11723 !! html
11724 <div id="rock">HTML rocks</div>
11725
11726 !! end
11727
11728 !! test
11729 div with illegal double attributes
11730 !! wikitext
11731 <div id="a" id="b">HTML rocks</div>
11732 !! html
11733 <div id="b">HTML rocks</div>
11734
11735 !!end
11736
11737 # FIXME: produce empty string instead of "class" in the PHP parser, following
11738 # the HTML5 spec.
11739 !! test
11740 div with empty attribute value, space before equals
11741 !! options
11742 parsoid
11743 !! wikitext
11744 <div class =>HTML rocks</div>
11745 !! html
11746 <div class="">HTML rocks</div>
11747
11748 !! end
11749
11750 # The PHP parser escapes the opening brace to &#123; for some reason, so
11751 # disabled this test for it.
11752 !! test
11753 div with braces in attribute value
11754 !! options
11755 parsoid
11756 !! wikitext
11757 <div title="{}">Foo</div>
11758 !! html
11759 <div title="{}">Foo</div>
11760 !! end
11761
11762 # This it very inconsistent in the PHP parser: it returns
11763 # class="class" if there is a space between the name and the equal sign (see
11764 # 'div with empty attribute value, space before equals'), but strips the
11765 # attribute completely if the space is missing. We hope that not much content
11766 # depends on this, so are implementing the behavior below in Parsoid for
11767 # consistencies' sake. Disabled for the PHP parser.
11768 # FIXME: fix this behavior in the PHP parser?
11769 !! test
11770 div with empty attribute value, no space before equals
11771 !! options
11772 parsoid
11773 !! wikitext
11774 <div class=>HTML rocks</div>
11775 !! html
11776 <div class="">HTML rocks</div>
11777
11778 !! end
11779
11780 !! test
11781 HTML multiple attributes correction
11782 !! wikitext
11783 <p class="error" class="awesome">Awesome!</p>
11784 !! html
11785 <p class="awesome">Awesome!</p>
11786
11787 !!end
11788
11789 !! test
11790 Table multiple attributes correction
11791 !! wikitext
11792 {|
11793 !+ class="error" class="awesome"| status
11794 |}
11795 !! html
11796 <table>
11797 <tr>
11798 <th class="awesome"> status
11799 </th></tr></table>
11800
11801 !!end
11802
11803 !! test
11804 DIV IN UPPERCASE
11805 !! wikitext
11806 <DIV ID="x">HTML ROCKS</DIV>
11807 !! html
11808 <div id="x">HTML ROCKS</div>
11809
11810 !!end
11811
11812 !! test
11813 Non-ASCII pseudo-tags are rendered as text
11814 !! wikitext
11815 <khyô>
11816 !! html
11817 <p>&lt;khyô&gt;
11818 </p>
11819 !! end
11820
11821 !! test
11822 Pseudo-tag with URL 'name' renders as url link
11823 !! wikitext
11824 <http://example.com/>
11825 !! html
11826 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11827 </p>
11828 !! end
11829
11830 !! test
11831 text with amp in the middle of nowhere
11832 !! wikitext
11833 Remember AT&T?
11834 !! html
11835 <p>Remember AT&amp;T?
11836 </p>
11837 !! end
11838
11839 !! test
11840 text with character entity: eacute
11841 !! wikitext
11842 I always thought &eacute; was a cute letter.
11843 !! html
11844 <p>I always thought &#233; was a cute letter.
11845 </p>
11846 !! end
11847
11848 !! test
11849 text with entity-escaped character entity-like string: eacute
11850 !! wikitext
11851 I always thought &amp;eacute; was a cute letter.
11852 !! html
11853 <p>I always thought &amp;eacute; was a cute letter.
11854 </p>
11855 !! end
11856
11857 !! test
11858 text with undefined character entity: xacute
11859 !! wikitext
11860 I always thought &xacute; was a cute letter.
11861 !! html
11862 <p>I always thought &amp;xacute; was a cute letter.
11863 </p>
11864 !! end
11865
11866 # TODO: generalize to PHP parser?
11867 !! test
11868 HTML5 tags
11869 !! options
11870 parsoid
11871 !! wikitext
11872 <data value="5">five</data>
11873 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11874 <mark>This highlighted text</mark>
11875 !! html
11876 <p><data value="5">five</data>
11877 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
11878 <mark>This highlighted text</mark></p>
11879 !! end
11880
11881 !! test
11882 HTML tag with leading space is parsed as text
11883 !! wikitext
11884 < div>foo< /div>
11885 !! html
11886 <p>&lt; div&gt;foo&lt; /div&gt;
11887 </p>
11888 !! end
11889
11890 ###
11891 ### Nesting tests (see bug 41545, 50604, 51081)
11892 ###
11893
11894 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11895 # Note that html2wt is considerably more difficult if we use <b> in
11896 # the test case, instead of <big>
11897 !! test
11898 Ensure that HTML adoption agency algorithm is properly implemented.
11899 !! wikitext
11900 <big>X<big>Y</big>Z</big>
11901 !! html
11902 <p><big>X<big>Y</big>Z</big>
11903 </p>
11904 !! end
11905
11906 # This was bug 41545 in the PHP parser.
11907 !! test
11908 Nesting of <kbd>
11909 !! wikitext
11910 <kbd>X<kbd>Y</kbd>Z</kbd>
11911 !! html
11912 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11913 </p>
11914 !! end
11915
11916 # The following cases were bug 51081 in the PHP parser.
11917 # Note that there are some other nestable tags (b, i, etc) which are
11918 # not covered; see bug 51081 for discussion.
11919 !! test
11920 Nesting of <em>
11921 !! wikitext
11922 <em>X<em>Y</em>Z</em>
11923 !! html
11924 <p><em>X<em>Y</em>Z</em>
11925 </p>
11926 !! end
11927
11928 !! test
11929 Nesting of <strong>
11930 !! wikitext
11931 <strong>X<strong>Y</strong>Z</strong>
11932 !! html
11933 <p><strong>X<strong>Y</strong>Z</strong>
11934 </p>
11935 !! end
11936
11937 !! test
11938 Nesting of <q>
11939 !! wikitext
11940 <q>X<q>Y</q>Z</q>
11941 !! html
11942 <p><q>X<q>Y</q>Z</q>
11943 </p>
11944 !! end
11945
11946 !! test
11947 Nesting of <ruby>
11948 !! wikitext
11949 <ruby>X<ruby>Y</ruby>Z</ruby>
11950 !! html
11951 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11952 </p>
11953 !! end
11954
11955 !! test
11956 Nesting of <bdo>
11957 !! wikitext
11958 <bdo>X<bdo>Y</bdo>Z</bdo>
11959 !! html
11960 <p><bdo>X<bdo>Y</bdo>Z</bdo>
11961 </p>
11962 !! end
11963
11964
11965 ###
11966 ### Media links
11967 ###
11968
11969 !! test
11970 Media link
11971 !! wikitext
11972 [[Media:Foobar.jpg]]
11973 !! html
11974 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
11975 </p>
11976 !! end
11977
11978 !! test
11979 Media link with text
11980 !! wikitext
11981 [[Media:Foobar.jpg|A neat file to look at]]
11982 !! html
11983 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
11984 </p>
11985 !! end
11986
11987 # FIXME: this is still bad HTML tag nesting
11988 !! test
11989 Media link with nasty text
11990 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
11991 !! wikitext
11992 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
11993 !! html
11994 <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>
11995
11996 !! end
11997
11998 !! test
11999 Media link to nonexistent file (bug 1702)
12000 !! wikitext
12001 [[Media:No such.jpg]]
12002 !! html
12003 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12004 </p>
12005 !! end
12006
12007 !! test
12008 Image link to nonexistent file (bug 1850 - good)
12009 !! wikitext
12010 [[Image:No such.jpg]]
12011 !! html
12012 <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>
12013 </p>
12014 !! end
12015
12016 !! test
12017 :Image link to nonexistent file (bug 1850 - bad)
12018 !! wikitext
12019 [[:Image:No such.jpg]]
12020 !! html
12021 <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>
12022 </p>
12023 !! end
12024
12025
12026
12027 !! test
12028 Character reference normalization in link text (bug 1938)
12029 !! wikitext
12030 [[Main Page|this&that]]
12031 !! html
12032 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12033 </p>
12034 !!end
12035
12036 !! article
12037 אַ
12038 !! text
12039 Test for unicode normalization
12040
12041 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12042 !! endarticle
12043
12044 !! test
12045 (bug 19451) Links should refer to the normalized form.
12046 !! wikitext
12047 [[&#xFB2E;]]
12048 [[&#x5d0;&#x5b7;]]
12049 [[&#x5d0;ַ]]
12050 [[א&#x5b7;]]
12051 [[אַ]]
12052 !! html
12053 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12054 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12055 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12056 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12057 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12058 </p>
12059 !! end
12060
12061 !! test
12062 Empty attribute crash test (bug 2067)
12063 !! wikitext
12064 <font color="">foo</font>
12065 !! html
12066 <p><font color="">foo</font>
12067 </p>
12068 !! end
12069
12070 !! test
12071 Empty attribute crash test single-quotes (bug 2067)
12072 !! wikitext
12073 <font color=''>foo</font>
12074 !! html
12075 <p><font color="">foo</font>
12076 </p>
12077 !! end
12078
12079 !! test
12080 Attribute test: equals, then nothing
12081 !! wikitext
12082 <font color=>foo</font>
12083 !! html
12084 <p><font>foo</font>
12085 </p>
12086 !! end
12087
12088 !! test
12089 Attribute test: unquoted value
12090 !! wikitext
12091 <font color=x>foo</font>
12092 !! html
12093 <p><font color="x">foo</font>
12094 </p>
12095 !! end
12096
12097 !! test
12098 Attribute test: unquoted but illegal value (hash)
12099 !! wikitext
12100 <font color=#x>foo</font>
12101 !! html
12102 <p><font color="#x">foo</font>
12103 </p>
12104 !! end
12105
12106 !! test
12107 Attribute test: no value
12108 !! wikitext
12109 <font color>foo</font>
12110 !! html
12111 <p><font color="color">foo</font>
12112 </p>
12113 !! end
12114
12115 !! test
12116 Bug 2095: link with three closing brackets
12117 !! wikitext
12118 [[Main Page]]]
12119 !! html
12120 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12121 </p>
12122 !! end
12123
12124 !! test
12125 Bug 2095: link with pipe and three closing brackets
12126 !! wikitext
12127 [[Main Page|link]]]
12128 !! html
12129 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12130 </p>
12131 !! end
12132
12133 !! test
12134 Bug 2095: link with pipe and three closing brackets, version 2
12135 !! wikitext
12136 [[Main Page|[http://example.com/]]]
12137 !! html
12138 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12139 </p>
12140 !! end
12141
12142
12143 ###
12144 ### Safety
12145 ###
12146
12147 !! article
12148 Template:Dangerous attribute
12149 !! text
12150 " onmouseover="alert(document.cookie)
12151 !! endarticle
12152
12153 !! article
12154 Template:Dangerous style attribute
12155 !! text
12156 border-size: expression(alert(document.cookie))
12157 !! endarticle
12158
12159 !! article
12160 Template:Div style
12161 !! text
12162 <div style="float: right; {{{1}}}">Magic div</div>
12163 !! endarticle
12164
12165 !! test
12166 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12167 !! wikitext
12168 <div title="{{test}}"></div>
12169 !! html
12170 <div title="This is a test template"></div>
12171
12172 !! end
12173
12174 !! test
12175 Bug 2304: HTML attribute safety (dangerous template; 2309)
12176 !! wikitext
12177 <div title="{{dangerous attribute}}"></div>
12178 !! html
12179 <div title=""></div>
12180
12181 !! end
12182
12183 !! test
12184 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12185 !! wikitext
12186 <div style="{{dangerous style attribute}}"></div>
12187 !! html
12188 <div style="/* insecure input */"></div>
12189
12190 !! end
12191
12192 !! test
12193 Bug 2304: HTML attribute safety (safe parameter; 2309)
12194 !! wikitext
12195 {{div style|width: 200px}}
12196 !! html
12197 <div style="float: right; width: 200px">Magic div</div>
12198
12199 !! end
12200
12201 !! test
12202 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12203 !! wikitext
12204 {{div style|width: expression(alert(document.cookie))}}
12205 !! html
12206 <div style="/* insecure input */">Magic div</div>
12207
12208 !! end
12209
12210 !! test
12211 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12212 !! wikitext
12213 {{div style|"><script>alert(document.cookie)</script>}}
12214 !! html
12215 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12216
12217 !! end
12218
12219 !! test
12220 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12221 !! wikitext
12222 {{div style|" ><script>alert(document.cookie)</script>}}
12223 !! html
12224 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12225
12226 !! end
12227
12228 !! test
12229 Bug 2304: HTML attribute safety (link)
12230 !! wikitext
12231 <div title="[[Main Page]]"></div>
12232 !! html
12233 <div title="&#91;&#91;Main Page]]"></div>
12234
12235 !! end
12236
12237 !! test
12238 Bug 2304: HTML attribute safety (italics)
12239 !! wikitext
12240 <div title="''foobar''"></div>
12241 !! html
12242 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12243
12244 !! end
12245
12246 !! test
12247 Bug 2304: HTML attribute safety (bold)
12248 !! wikitext
12249 <div title="'''foobar'''"></div>
12250 !! html
12251 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12252
12253 !! end
12254
12255
12256 !! test
12257 Bug 2304: HTML attribute safety (ISBN)
12258 !! wikitext
12259 <div title="ISBN 1234567890"></div>
12260 !! html
12261 <div title="&#73;SBN 1234567890"></div>
12262
12263 !! end
12264
12265 !! test
12266 Bug 2304: HTML attribute safety (RFC)
12267 !! wikitext
12268 <div title="RFC 1234"></div>
12269 !! html
12270 <div title="&#82;FC 1234"></div>
12271
12272 !! end
12273
12274 !! test
12275 Bug 2304: HTML attribute safety (PMID)
12276 !! wikitext
12277 <div title="PMID 1234567890"></div>
12278 !! html
12279 <div title="&#80;MID 1234567890"></div>
12280
12281 !! end
12282
12283 !! test
12284 Bug 2304: HTML attribute safety (web link)
12285 !! wikitext
12286 <div title="http://example.com/"></div>
12287 !! html
12288 <div title="http&#58;//example.com/"></div>
12289
12290 !! end
12291
12292 !! test
12293 Bug 2304: HTML attribute safety (named web link)
12294 !! wikitext
12295 <div title="[http://example.com/ link]"></div>
12296 !! html
12297 <div title="&#91;http&#58;//example.com/ link]"></div>
12298
12299 !! end
12300
12301 !! test
12302 Bug 3244: HTML attribute safety (extension; safe)
12303 !! wikitext
12304 <div style="<nowiki>background:blue</nowiki>"></div>
12305 !! html
12306 <div style="background:blue"></div>
12307
12308 !! end
12309
12310 !! test
12311 Bug 3244: HTML attribute safety (extension; unsafe)
12312 !! wikitext
12313 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12314 !! html
12315 <div style="/* insecure input */"></div>
12316
12317 !! end
12318
12319 # More MSIE fun discovered by Tom Gilder
12320
12321 !! test
12322 MSIE CSS safety test: spurious slash
12323 !! wikitext
12324 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12325 !! html
12326 <div style="/* insecure input */">evil</div>
12327
12328 !! end
12329
12330 !! test
12331 MSIE CSS safety test: hex code
12332 !! wikitext
12333 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12334 !! html
12335 <div style="/* insecure input */">evil</div>
12336
12337 !! end
12338
12339 !! test
12340 MSIE CSS safety test: comment in url
12341 !! wikitext
12342 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12343 !! html
12344 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12345
12346 !! end
12347
12348 !! test
12349 MSIE CSS safety test: comment in expression
12350 !! wikitext
12351 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12352 !! html
12353 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12354
12355 !! end
12356
12357 !! test
12358 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12359 !! wikitext
12360 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12361 !! html
12362 <p style="/* invalid control char */">A</p>
12363
12364 !! end
12365
12366 !! test
12367 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12368 !! wikitext
12369 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12370 <div style="top:EXPRESSION(alert())">B</div>
12371 !! html
12372 <p style="/* insecure input */">A</p>
12373 <div style="/* insecure input */">B</div>
12374
12375 !! end
12376
12377 !! test
12378 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12379 !! wikitext
12380 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12381 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12382 !! html
12383 <div style="/* insecure input */">A</div>
12384 <p style="/* insecure input */">B</p>
12385
12386 !! end
12387
12388 !! test
12389 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12390 !! wikitext
12391 <div style="background-image:url⁽javascript:alert())">A</div>
12392 <div style="background-image:url₍javascript:alert())">B</div>
12393 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12394 !! html
12395 <div style="/* insecure input */">A</div>
12396 <div style="/* insecure input */">B</div>
12397 <p style="/* insecure input */">C</p>
12398
12399 !! end
12400
12401 !! test
12402 Opera -o-link CSS
12403 !! wikitext
12404 <div
12405 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;"
12406 style="-o-link:attr(title);-o-link-source:current">X</div>
12407 !! html
12408 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12409
12410 !! end
12411
12412 !! test
12413 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12414 !! wikitext
12415 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12416 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12417 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12418 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12419 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12420 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12421 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12422 !! html
12423 <p style="/* insecure input */">A</p>
12424 <p style="/* insecure input */">B</p>
12425 <p style="/* insecure input */">C</p>
12426 <p style="/* insecure input */">D</p>
12427 <p style="/* insecure input */">E</p>
12428 <p style="/* insecure input */">F</p>
12429 <p style="/* insecure input */">G</p>
12430
12431 !! end
12432
12433 !! test
12434 Table attribute legitimate extension
12435 !! wikitext
12436 {|
12437 !+ style="<nowiki>color:blue</nowiki>"| status
12438 |}
12439 !! html
12440 <table>
12441 <tr>
12442 <th style="color:blue"> status
12443 </th></tr></table>
12444
12445 !!end
12446
12447 !! test
12448 Table attribute safety
12449 !! wikitext
12450 {|
12451 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12452 |}
12453 !! html
12454 <table>
12455 <tr>
12456 <th style="/* insecure input */"> status
12457 </th></tr></table>
12458
12459 !! end
12460
12461 !! test
12462 CSS line continuation 1
12463 !! wikitext
12464 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12465 !! html
12466 <div style="/* insecure input */"></div>
12467
12468 !! end
12469
12470 !! test
12471 CSS line continuation 2
12472 !! wikitext
12473 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12474 !! html
12475 <div style="/* insecure input */"></div>
12476
12477 !! end
12478
12479 !! article
12480 Template:Identity
12481 !! text
12482 {{{1}}}
12483 !! endarticle
12484
12485 !! test
12486 Expansion of multi-line templates in attribute values (bug 6255)
12487 !! wikitext
12488 <div style="background: {{identity|#00FF00}}">-</div>
12489 !! html
12490 <div style="background: #00FF00">-</div>
12491
12492 !! end
12493
12494
12495 !! test
12496 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12497 !! wikitext
12498 <div style="background:
12499 #00FF00">-</div>
12500 !! html
12501 <div style="background: #00FF00">-</div>
12502
12503 !! end
12504
12505 !! test
12506 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12507 !! wikitext
12508 <div style="background: &#10;#00FF00">-</div>
12509 !! html
12510 <div style="background: &#10;#00FF00">-</div>
12511
12512 !! end
12513
12514 ###
12515 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12516 ###
12517 !! test
12518 Parser hook: empty input
12519 !! wikitext
12520 <tag></tag>
12521 !! html
12522 <pre>
12523 ''
12524 array (
12525 )
12526 </pre>
12527
12528 !! end
12529
12530 !! test
12531 Parser hook: empty input using terminated empty elements
12532 !! wikitext
12533 <tag/>
12534 !! html
12535 <pre>
12536 NULL
12537 array (
12538 )
12539 </pre>
12540
12541 !! end
12542
12543 !! test
12544 Parser hook: empty input using terminated empty elements (space before)
12545 !! wikitext
12546 <tag />
12547 !! html
12548 <pre>
12549 NULL
12550 array (
12551 )
12552 </pre>
12553
12554 !! end
12555
12556 !! test
12557 Parser hook: basic input
12558 !! wikitext
12559 <tag>input</tag>
12560 !! html
12561 <pre>
12562 'input'
12563 array (
12564 )
12565 </pre>
12566
12567 !! end
12568
12569
12570 !! test
12571 Parser hook: case insensitive
12572 !! wikitext
12573 <TAG>input</TAG>
12574 !! html
12575 <pre>
12576 'input'
12577 array (
12578 )
12579 </pre>
12580
12581 !! end
12582
12583
12584 !! test
12585 Parser hook: case insensitive, redux
12586 !! wikitext
12587 <TaG>input</TAg>
12588 !! html
12589 <pre>
12590 'input'
12591 array (
12592 )
12593 </pre>
12594
12595 !! end
12596
12597 !! test
12598 Parser hook: nested tags
12599 !! options
12600 noxml
12601 !! wikitext
12602 <tag><tag></tag></tag>
12603 !! html
12604 <pre>
12605 '<tag>'
12606 array (
12607 )
12608 </pre>&lt;/tag&gt;
12609
12610 !! end
12611
12612 !! test
12613 Parser hook: basic arguments
12614 !! wikitext
12615 <tag width=200 height = "100" depth = '50' square></tag>
12616 !! html
12617 <pre>
12618 ''
12619 array (
12620 'width' => '200',
12621 'height' => '100',
12622 'depth' => '50',
12623 'square' => 'square',
12624 )
12625 </pre>
12626
12627 !! end
12628
12629 !! test
12630 Parser hook: argument containing a forward slash (bug 5344)
12631 !! wikitext
12632 <tag filename='/tmp/bla'></tag>
12633 !! html
12634 <pre>
12635 ''
12636 array (
12637 'filename' => '/tmp/bla',
12638 )
12639 </pre>
12640
12641 !! end
12642
12643 !! test
12644 Parser hook: empty input using terminated empty elements (bug 2374)
12645 !! wikitext
12646 <tag foo=bar/>text
12647 !! html
12648 <pre>
12649 NULL
12650 array (
12651 'foo' => 'bar',
12652 )
12653 </pre>text
12654
12655 !! end
12656
12657 # </tag> should be output literally since there is no matching tag that begins it
12658 !! test
12659 Parser hook: basic arguments using terminated empty elements (bug 2374)
12660 !! wikitext
12661 <tag width=200 height = "100" depth = '50' square/>
12662 other stuff
12663 </tag>
12664 !! html
12665 <pre>
12666 NULL
12667 array (
12668 'width' => '200',
12669 'height' => '100',
12670 'depth' => '50',
12671 'square' => 'square',
12672 )
12673 </pre>
12674 <p>other stuff
12675 &lt;/tag&gt;
12676 </p>
12677 !! end
12678
12679 ###
12680 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12681 ###
12682
12683 !! test
12684 Parser hook: static parser hook not inside a comment
12685 !! wikitext
12686 <statictag>hello, world</statictag>
12687 <statictag action=flush/>
12688 !! html
12689 <p>hello, world
12690 </p>
12691 !! end
12692
12693
12694 !! test
12695 Parser hook: static parser hook inside a comment
12696 !! wikitext
12697 <!-- <statictag>hello, world</statictag> -->
12698 <statictag action=flush/>
12699 !! html
12700 <p><br />
12701 </p>
12702 !! end
12703
12704 # Nested template calls; this case was broken by Parser.php rev 1.506,
12705 # since reverted.
12706
12707 !! article
12708 Template:One-parameter
12709 !! text
12710 (My parameter is: {{{1}}})
12711 !! endarticle
12712
12713 !! article
12714 Template:Map-one-parameter
12715 !! text
12716 {{{{{1}}}|{{{2}}}}}
12717 !! endarticle
12718
12719 !! test
12720 Nested template calls
12721 !! wikitext
12722 {{Map-one-parameter|One-parameter|param}}
12723 !! html
12724 <p>(My parameter is: param)
12725 </p>
12726 !! end
12727
12728
12729 ###
12730 ### Sanitizer
12731 ###
12732 !! test
12733 Sanitizer: Closing of open tags
12734 !! wikitext
12735 <s></s><table></table>
12736 !! html
12737 <s></s><table></table>
12738
12739 !! end
12740
12741 !! test
12742 Sanitizer: Closing of open but not closed tags
12743 !! wikitext
12744 <s>foo
12745 !! html
12746 <p><s>foo</s>
12747 </p>
12748 !! end
12749
12750 !! test
12751 Sanitizer: Closing of closed but not open tags
12752 !! wikitext
12753 </s>
12754 !! html
12755 <p>&lt;/s&gt;
12756 </p>
12757 !! end
12758
12759 !! test
12760 Sanitizer: Closing of closed but not open table tags
12761 !! wikitext
12762 Table not started</td></tr></table>
12763 !! html
12764 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
12765 </p>
12766 !! end
12767
12768 !! test
12769 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
12770 !! wikitext
12771 <span id="æ: v">byte</span>[[#æ: v|backlink]]
12772 !! html
12773 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
12774 </p>
12775 !! end
12776
12777 !! test
12778 Sanitizer: Validating the contents of the id attribute (bug 4515)
12779 !! options
12780 disabled
12781 !! wikitext
12782 <br id=9 />
12783 !! html
12784 Something, but definitely not <br id="9" />...
12785 !! end
12786
12787 !! test
12788 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
12789 !! options
12790 disabled
12791 !! wikitext
12792 <br id="foo" /><br id="foo" />
12793 !! html
12794 Something need to be done. foo-2 ?
12795 !! end
12796
12797 !! test
12798 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
12799 !! wikitext
12800 <div itemscope>
12801 <meta itemprop="hello" content="world">
12802 <meta http-equiv="refresh" content="5">
12803 <meta itemprop="hello" http-equiv="refresh" content="5">
12804 <link itemprop="hello" href="{{SERVER}}">
12805 <link rel="stylesheet" href="{{SERVER}}">
12806 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
12807 </div>
12808 !! html
12809 <div itemscope="itemscope">
12810 <p> <meta itemprop="hello" content="world" />
12811 &lt;meta http-equiv="refresh" content="5"&gt;
12812 <meta itemprop="hello" content="5" />
12813 </p>
12814 <link itemprop="hello" href="http&#58;//example.org" />
12815 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
12816 <link itemprop="hello" href="http&#58;//example.org" />
12817 </div>
12818
12819 !! end
12820
12821 !! test
12822 Language converter: output gets cut off unexpectedly (bug 5757)
12823 !! options
12824 language=zh
12825 !! wikitext
12826 this bit is safe: }-
12827
12828 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12829
12830 then we get cut off here: }-
12831
12832 all additional text is vanished
12833 !! html
12834 <p>this bit is safe: }-
12835 </p><p>but if we add a conversion instance: xxx
12836 </p><p>then we get cut off here: }-
12837 </p><p>all additional text is vanished
12838 </p>
12839 !! end
12840
12841 !! test
12842 Self closed html pairs (bug 5487)
12843 !! options
12844 !! wikitext
12845 <center><font id="bug" />Centered text</center>
12846 <div><font id="bug2" />In div text</div>
12847 !! html
12848 <center>&lt;font id="bug" /&gt;Centered text</center>
12849 <div>&lt;font id="bug2" /&gt;In div text</div>
12850
12851 !! end
12852
12853 #
12854 #
12855 #
12856
12857 !! test
12858 Punctuation: nbsp before exclamation
12859 !! wikitext
12860 C'est grave !
12861 !! html
12862 <p>C'est grave&#160;!
12863 </p>
12864 !! end
12865
12866 !! test
12867 Punctuation: CSS !important (bug 11874)
12868 !! wikitext
12869 <div style="width:50% !important">important</div>
12870 !! html
12871 <div style="width:50% !important">important</div>
12872
12873 !!end
12874
12875 !! test
12876 Punctuation: CSS ! important (bug 11874; with space after)
12877 !! wikitext
12878 <div style="width:50% ! important">important</div>
12879 !! html
12880 <div style="width:50% ! important">important</div>
12881
12882 !!end
12883
12884
12885 !! test
12886 HTML bullet list, closed tags (bug 5497)
12887 !! wikitext
12888 <ul>
12889 <li>One</li>
12890 <li>Two</li>
12891 </ul>
12892 !! html
12893 <ul>
12894 <li>One</li>
12895 <li>Two</li>
12896 </ul>
12897
12898 !! end
12899
12900 !! test
12901 HTML bullet list, unclosed tags (bug 5497)
12902 !! options
12903 disabled
12904 !! wikitext
12905 <ul>
12906 <li>One
12907 <li>Two
12908 </ul>
12909 !! html
12910 <ul>
12911 <li>One
12912 </li>
12913 <li>Two
12914 </li>
12915 </ul>
12916
12917 !! end
12918
12919 !! test
12920 HTML ordered list, closed tags (bug 5497)
12921 !! wikitext
12922 <ol>
12923 <li>One</li>
12924 <li>Two</li>
12925 </ol>
12926 !! html
12927 <ol>
12928 <li>One</li>
12929 <li>Two</li>
12930 </ol>
12931
12932 !! end
12933
12934 !! test
12935 HTML ordered list, unclosed tags (bug 5497)
12936 !! options
12937 disabled
12938 !! wikitext
12939 <ol>
12940 <li>One
12941 <li>Two
12942 </ol>
12943 !! html
12944 <ol>
12945 <li>One
12946 </li>
12947 <li>Two
12948 </li>
12949 </ol>
12950
12951 !! end
12952
12953 !! test
12954 HTML nested bullet list, closed tags (bug 5497)
12955 !! wikitext
12956 <ul>
12957 <li>One</li>
12958 <li>Two:
12959 <ul>
12960 <li>Sub-one</li>
12961 <li>Sub-two</li>
12962 </ul>
12963 </li>
12964 </ul>
12965 !! html
12966 <ul>
12967 <li>One</li>
12968 <li>Two:
12969 <ul>
12970 <li>Sub-one</li>
12971 <li>Sub-two</li>
12972 </ul>
12973 </li>
12974 </ul>
12975
12976 !! end
12977
12978 !! test
12979 HTML nested bullet list, open tags (bug 5497)
12980 !! options
12981 disabled
12982 !! wikitext
12983 <ul>
12984 <li>One
12985 <li>Two:
12986 <ul>
12987 <li>Sub-one
12988 <li>Sub-two
12989 </ul>
12990 </ul>
12991 !! html
12992 <ul>
12993 <li>One
12994 </li>
12995 <li>Two:
12996 <ul>
12997 <li>Sub-one
12998 </li>
12999 <li>Sub-two
13000 </li>
13001 </ul>
13002 </li>
13003 </ul>
13004
13005 !! end
13006
13007 !! test
13008 HTML nested ordered list, closed tags (bug 5497)
13009 !! wikitext
13010 <ol>
13011 <li>One</li>
13012 <li>Two:
13013 <ol>
13014 <li>Sub-one</li>
13015 <li>Sub-two</li>
13016 </ol>
13017 </li>
13018 </ol>
13019 !! html
13020 <ol>
13021 <li>One</li>
13022 <li>Two:
13023 <ol>
13024 <li>Sub-one</li>
13025 <li>Sub-two</li>
13026 </ol>
13027 </li>
13028 </ol>
13029
13030 !! end
13031
13032 !! test
13033 HTML nested ordered list, open tags (bug 5497)
13034 !! options
13035 disabled
13036 !! wikitext
13037 <ol>
13038 <li>One
13039 <li>Two:
13040 <ol>
13041 <li>Sub-one
13042 <li>Sub-two
13043 </ol>
13044 </ol>
13045 !! html
13046 <ol>
13047 <li>One
13048 </li>
13049 <li>Two:
13050 <ol>
13051 <li>Sub-one
13052 </li>
13053 <li>Sub-two
13054 </li>
13055 </ol>
13056 </li>
13057 </ol>
13058
13059 !! end
13060
13061 !! test
13062 HTML ordered list item with parameters oddity
13063 !! wikitext
13064 <ol><li id="fragment">One</li>
13065 </ol>
13066 !! html
13067 <ol><li id="fragment">One</li>
13068 </ol>
13069
13070 !! end
13071
13072 !!test
13073 bug 5918: autonumbering
13074 !! wikitext
13075 [http://first/] [http://second] [ftp://ftp]
13076
13077 ftp://inlineftp
13078
13079 [mailto:enclosed@mail.tld With target]
13080
13081 [mailto:enclosed@mail.tld]
13082
13083 mailto:inline@mail.tld
13084 !! html
13085 <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>
13086 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13087 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13088 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13089 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13090 </p>
13091 !! end
13092
13093
13094 #
13095 # Security and HTML correctness
13096 # From Nick Jenkins' fuzz testing
13097 #
13098
13099 !! test
13100 Fuzz testing: Parser13
13101 !! wikitext
13102 {|
13103 | http://a|
13104 !! html
13105 <table>
13106 <tr>
13107 <td>
13108 </td>
13109 </tr>
13110 </table>
13111
13112 !! end
13113
13114 !! test
13115 Fuzz testing: Parser14
13116 !! wikitext
13117 == onmouseover= ==
13118 http://__TOC__
13119 !! html
13120 <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>
13121 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13122 <ul>
13123 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13124 </ul>
13125 </div>
13126
13127
13128 !! end
13129
13130 !! test
13131 Fuzz testing: Parser14-table
13132 !! wikitext
13133 ==a==
13134 {| STYLE=__TOC__
13135 !! html
13136 <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>
13137 <table style="&#95;_TOC&#95;_">
13138 <tr><td></td></tr>
13139 </table>
13140
13141 !! end
13142
13143 # Known to produce bogus xml (extra </td>)
13144 !! test
13145 Fuzz testing: Parser16
13146 !! options
13147 noxml
13148 !! wikitext
13149 {|
13150 !https://||||||
13151 !! html
13152 <table>
13153 <tr>
13154 <th>https://</th>
13155 <th></th>
13156 <th></th>
13157 <th>
13158 </td>
13159 </tr>
13160 </table>
13161
13162 !! end
13163
13164 !! test
13165 Fuzz testing: Parser21
13166 !! wikitext
13167 {|
13168 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13169 |
13170 !! html
13171 <table>
13172 <tr>
13173 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13174 </th>
13175 <td>
13176 </td>
13177 </tr>
13178 </table>
13179
13180 !! end
13181
13182 !! test
13183 Fuzz testing: Parser22
13184 !! wikitext
13185 http://===r:::https://b
13186
13187 {|
13188 !! html
13189 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13190 </p>
13191 <table>
13192 <tr><td></td></tr>
13193 </table>
13194
13195 !! end
13196
13197 # Known to produce bad XML for now
13198 !! test
13199 Fuzz testing: Parser24
13200 !! options
13201 noxml
13202 !! wikitext
13203 {|
13204 {{{|
13205 <u CLASS=
13206 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13207 <br style="onmouseover='alert(document.cookie);' " />
13208
13209 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13210 |
13211 !! html
13212 <table>
13213 {{{|
13214 <u class="&#124;">}}}} &gt;
13215 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13216
13217 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13218 <tr>
13219 <td></u>
13220 </td>
13221 </tr>
13222 </table>
13223
13224 !! end
13225
13226 # Note: the current result listed for this is not what the original one was,
13227 # but the original bug was JavaScript injection, which is fixed in any case.
13228 # It's not clear that the original result listed was any more correct than the
13229 # current one. Original result:
13230 # <p>{{{|
13231 # </p>
13232 # <li class="&#124;&#124;">
13233 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13234 !!test
13235 Fuzz testing: Parser25 (bug 6055)
13236 !! wikitext
13237 {{{
13238 |
13239 <LI CLASS=||
13240 >
13241 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13242 !! html
13243 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13244 </p>
13245 !! end
13246
13247 !!test
13248 Fuzz testing: URL adjacent extension (with space, clean)
13249 !! options
13250 !! wikitext
13251 http://example.com <nowiki>junk</nowiki>
13252 !! html
13253 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13254 </p>
13255 !!end
13256
13257 !!test
13258 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13259 !! options
13260 !! wikitext
13261 http://example.com<nowiki>junk</nowiki>
13262 !! html
13263 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13264 </p>
13265 !!end
13266
13267 !!test
13268 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13269 !! options
13270 !! wikitext
13271 http://example.com<pre>junk</pre>
13272 !! html
13273 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13274
13275 !!end
13276
13277 !!test
13278 Fuzz testing: image with bogus manual thumbnail
13279 !! wikitext
13280 [[Image:foobar.jpg|thumbnail= ]]
13281 !! html
13282 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13283
13284 !!end
13285
13286 !! test
13287 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13288 !! wikitext
13289 <pre dir="&#10;"></pre>
13290 !! html
13291 <pre dir="&#10;"></pre>
13292
13293 !! end
13294
13295 !! test
13296 Parsing optional HTML elements (Bug 6171)
13297 !! options
13298 !! wikitext
13299 <table>
13300 <tr>
13301 <td> Some tabular data</td>
13302 <td> More tabular data ...
13303 <td> And yet som tabular data</td>
13304 </tr>
13305 </table>
13306 !! html
13307 <table>
13308 <tr>
13309 <td> Some tabular data</td>
13310 <td> More tabular data ...
13311 </td><td> And yet som tabular data</td>
13312 </tr>
13313 </table>
13314
13315 !! end
13316
13317 !! test
13318 Correct handling of <td>, <tr> (Bug 6171)
13319 !! options
13320 !! wikitext
13321 <table>
13322 <tr>
13323 <td> Some tabular data</td>
13324 <td> More tabular data ...</td>
13325 <td> And yet som tabular data</td>
13326 </tr>
13327 </table>
13328 !! html
13329 <table>
13330 <tr>
13331 <td> Some tabular data</td>
13332 <td> More tabular data ...</td>
13333 <td> And yet som tabular data</td>
13334 </tr>
13335 </table>
13336
13337 !! end
13338
13339
13340 !! test
13341 Parsing crashing regression (fr:JavaScript)
13342 !! wikitext
13343 </body></x>
13344 !! html
13345 <p>&lt;/body&gt;&lt;/x&gt;
13346 </p>
13347 !! end
13348
13349 !! test
13350 Inline wiki vs wiki block nesting
13351 !! wikitext
13352 '''Bold paragraph
13353
13354 New wiki paragraph
13355 !! html
13356 <p><b>Bold paragraph</b>
13357 </p><p>New wiki paragraph
13358 </p>
13359 !! end
13360
13361 !! test
13362 Inline HTML vs wiki block nesting
13363 !! options
13364 disabled
13365 !! wikitext
13366 <b>Bold paragraph
13367
13368 New wiki paragraph
13369 !! html
13370 <p><b>Bold paragraph</b>
13371 </p><p>New wiki paragraph
13372 </p>
13373 !! end
13374
13375 # Original result was this:
13376 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13377 # </p>
13378 # While that might be marginally more intuitive, maybe, the six-apostrophe
13379 # construct is clearly pathological and the result stated here (which is what
13380 # the parser actually does) is about as reasonable as anything.
13381 !!test
13382 Mixing markup for italics and bold
13383 !! options
13384 !! wikitext
13385 '''bold''''''bold''bolditalics'''''
13386 !! html
13387 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13388 </p>
13389 !! end
13390
13391
13392 !! article
13393 Xyzzyx
13394 !! text
13395 Article for special page transclusion test
13396 !! endarticle
13397
13398 !! test
13399 Special page transclusion
13400 !! options
13401 !! wikitext
13402 {{Special:Prefixindex/Xyzzyx}}
13403 !! html
13404 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13405
13406 !! end
13407
13408 !! test
13409 Special page transclusion twice (bug 5021)
13410 !! options
13411 !! wikitext
13412 {{Special:Prefixindex/Xyzzyx}}
13413 {{Special:Prefixindex/Xyzzyx}}
13414 !! html
13415 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13416 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13417
13418 !! end
13419
13420 !! test
13421 Transclusion of default MediaWiki message
13422 !! wikitext
13423 {{MediaWiki:Mainpage}}
13424 !! html
13425 <p>Main Page
13426 </p>
13427 !! end
13428
13429 !! test
13430 Transclusion of nonexistent MediaWiki message
13431 !! wikitext
13432 {{MediaWiki:Mainpagexxx}}
13433 !! html
13434 <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>
13435 </p>
13436 !! end
13437
13438 !! test
13439 Transclusion of MediaWiki message with underscore
13440 !! wikitext
13441 {{MediaWiki:history_short}}
13442 !! html
13443 <p>History
13444 </p>
13445 !! end
13446
13447 !! test
13448 Transclusion of MediaWiki message with space
13449 !! wikitext
13450 {{MediaWiki:history short}}
13451 !! html
13452 <p>History
13453 </p>
13454 !! end
13455
13456 !! test
13457 Invalid header with following text
13458 !! wikitext
13459 = x = y
13460 !! html
13461 <p>= x = y
13462 </p>
13463 !! end
13464
13465
13466 !! test
13467 Section extraction test (section 0)
13468 !! options
13469 section=0
13470 !! wikitext
13471 start
13472 ==a==
13473 ===aa===
13474 ====aaa====
13475 ==b==
13476 ===ba===
13477 ===bb===
13478 ====bba====
13479 ===bc===
13480 ==c==
13481 ===ca===
13482 !! html
13483 start
13484 !! end
13485
13486 !! test
13487 Section extraction test (section 1)
13488 !! options
13489 section=1
13490 !! wikitext
13491 start
13492 ==a==
13493 ===aa===
13494 ====aaa====
13495 ==b==
13496 ===ba===
13497 ===bb===
13498 ====bba====
13499 ===bc===
13500 ==c==
13501 ===ca===
13502 !! html
13503 ==a==
13504 ===aa===
13505 ====aaa====
13506 !! end
13507
13508 !! test
13509 Section extraction test (section 2)
13510 !! options
13511 section=2
13512 !! wikitext
13513 start
13514 ==a==
13515 ===aa===
13516 ====aaa====
13517 ==b==
13518 ===ba===
13519 ===bb===
13520 ====bba====
13521 ===bc===
13522 ==c==
13523 ===ca===
13524 !! html
13525 ===aa===
13526 ====aaa====
13527 !! end
13528
13529 !! test
13530 Section extraction test (section 3)
13531 !! options
13532 section=3
13533 !! wikitext
13534 start
13535 ==a==
13536 ===aa===
13537 ====aaa====
13538 ==b==
13539 ===ba===
13540 ===bb===
13541 ====bba====
13542 ===bc===
13543 ==c==
13544 ===ca===
13545 !! html
13546 ====aaa====
13547 !! end
13548
13549 !! test
13550 Section extraction test (section 4)
13551 !! options
13552 section=4
13553 !! wikitext
13554 start
13555 ==a==
13556 ===aa===
13557 ====aaa====
13558 ==b==
13559 ===ba===
13560 ===bb===
13561 ====bba====
13562 ===bc===
13563 ==c==
13564 ===ca===
13565 !! html
13566 ==b==
13567 ===ba===
13568 ===bb===
13569 ====bba====
13570 ===bc===
13571 !! end
13572
13573 !! test
13574 Section extraction test (section 5)
13575 !! options
13576 section=5
13577 !! wikitext
13578 start
13579 ==a==
13580 ===aa===
13581 ====aaa====
13582 ==b==
13583 ===ba===
13584 ===bb===
13585 ====bba====
13586 ===bc===
13587 ==c==
13588 ===ca===
13589 !! html
13590 ===ba===
13591 !! end
13592
13593 !! test
13594 Section extraction test (section 6)
13595 !! options
13596 section=6
13597 !! wikitext
13598 start
13599 ==a==
13600 ===aa===
13601 ====aaa====
13602 ==b==
13603 ===ba===
13604 ===bb===
13605 ====bba====
13606 ===bc===
13607 ==c==
13608 ===ca===
13609 !! html
13610 ===bb===
13611 ====bba====
13612 !! end
13613
13614 !! test
13615 Section extraction test (section 7)
13616 !! options
13617 section=7
13618 !! wikitext
13619 start
13620 ==a==
13621 ===aa===
13622 ====aaa====
13623 ==b==
13624 ===ba===
13625 ===bb===
13626 ====bba====
13627 ===bc===
13628 ==c==
13629 ===ca===
13630 !! html
13631 ====bba====
13632 !! end
13633
13634 !! test
13635 Section extraction test (section 8)
13636 !! options
13637 section=8
13638 !! wikitext
13639 start
13640 ==a==
13641 ===aa===
13642 ====aaa====
13643 ==b==
13644 ===ba===
13645 ===bb===
13646 ====bba====
13647 ===bc===
13648 ==c==
13649 ===ca===
13650 !! html
13651 ===bc===
13652 !! end
13653
13654 !! test
13655 Section extraction test (section 9)
13656 !! options
13657 section=9
13658 !! wikitext
13659 start
13660 ==a==
13661 ===aa===
13662 ====aaa====
13663 ==b==
13664 ===ba===
13665 ===bb===
13666 ====bba====
13667 ===bc===
13668 ==c==
13669 ===ca===
13670 !! html
13671 ==c==
13672 ===ca===
13673 !! end
13674
13675 !! test
13676 Section extraction test (section 10)
13677 !! options
13678 section=10
13679 !! wikitext
13680 start
13681 ==a==
13682 ===aa===
13683 ====aaa====
13684 ==b==
13685 ===ba===
13686 ===bb===
13687 ====bba====
13688 ===bc===
13689 ==c==
13690 ===ca===
13691 !! html
13692 ===ca===
13693 !! end
13694
13695 !! test
13696 Section extraction test (nonexistent section 11)
13697 !! options
13698 section=11
13699 !! wikitext
13700 start
13701 ==a==
13702 ===aa===
13703 ====aaa====
13704 ==b==
13705 ===ba===
13706 ===bb===
13707 ====bba====
13708 ===bc===
13709 ==c==
13710 ===ca===
13711 !! html
13712 !! end
13713
13714 !! test
13715 Section extraction test with bogus heading (section 1)
13716 !! options
13717 section=1
13718 !! wikitext
13719 ==a==
13720 ==bogus== not a legal section
13721 ==b==
13722 !! html
13723 ==a==
13724 ==bogus== not a legal section
13725 !! end
13726
13727 !! test
13728 Section extraction test with bogus heading (section 2)
13729 !! options
13730 section=2
13731 !! wikitext
13732 ==a==
13733 ==bogus== not a legal section
13734 ==b==
13735 !! html
13736 ==b==
13737 !! end
13738
13739 !! test
13740 Section extraction test with comment after heading (section 1)
13741 !! options
13742 section=1
13743 !! wikitext
13744 ==a==
13745 ==b== <!-- -->
13746 ==c==
13747 !! html
13748 ==a==
13749 !! end
13750
13751 !! test
13752 Section extraction test with comment after heading (section 2)
13753 !! options
13754 section=2
13755 !! wikitext
13756 ==a==
13757 ==b== <!-- -->
13758 ==c==
13759 !! html
13760 ==b== <!-- -->
13761 !! end
13762
13763 !! test
13764 Section extraction test with bogus <nowiki> heading (section 1)
13765 !! options
13766 section=1
13767 !! wikitext
13768 ==a==
13769 ==bogus== <nowiki>not a legal section</nowiki>
13770 ==b==
13771 !! html
13772 ==a==
13773 ==bogus== <nowiki>not a legal section</nowiki>
13774 !! end
13775
13776 !! test
13777 Section extraction test with bogus <nowiki> heading (section 2)
13778 !! options
13779 section=2
13780 !! wikitext
13781 ==a==
13782 ==bogus== <nowiki>not a legal section</nowiki>
13783 ==b==
13784 !! html
13785 ==b==
13786 !! end
13787
13788
13789 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
13790 # instead of respecting commented sections
13791 !! test
13792 Section extraction prefixed by comment (section 1)
13793 !! options
13794 section=1
13795 !! wikitext
13796 <!-- -->==sec1==
13797 ==sec2==
13798 !! html
13799 ==sec2==
13800 !!end
13801
13802 !! test
13803 Section extraction prefixed by comment (section 2)
13804 !! options
13805 section=2
13806 !! wikitext
13807 <!-- -->==sec1==
13808 ==sec2==
13809 !! html
13810
13811 !!end
13812
13813
13814 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
13815 # instead of respecting HTML-style headings
13816 !! test
13817 Section extraction, mixed wiki and html (section 1)
13818 !! options
13819 section=1
13820 !! wikitext
13821 <h2>unmarked</h2>
13822 unmarked
13823 ==1==
13824 one
13825 ==2==
13826 two
13827 !! html
13828 ==1==
13829 one
13830 !! end
13831
13832 !! test
13833 Section extraction, mixed wiki and html (section 2)
13834 !! options
13835 section=2
13836 !! wikitext
13837 <h2>unmarked</h2>
13838 unmarked
13839 ==1==
13840 one
13841 ==2==
13842 two
13843 !! html
13844 ==2==
13845 two
13846 !! end
13847
13848
13849 # Formerly testing for bug 3342
13850 !! test
13851 Section extraction, heading surrounded by <noinclude>
13852 !! options
13853 section=1
13854 !! wikitext
13855 <noinclude>==unmarked==</noinclude>
13856 ==marked==
13857 !! html
13858 ==marked==
13859 !!end
13860
13861 # Test behavior of bug 19910
13862 !! test
13863 Sectiion with all-equals
13864 !! options
13865 section=2
13866 !! wikitext
13867 ===
13868 The line above must have a trailing space
13869 === <!--
13870 --> <!-- -->
13871 But just in case it doesn't...
13872 !! html
13873 === <!--
13874 --> <!-- -->
13875 But just in case it doesn't...
13876 !! end
13877
13878 !! test
13879 Section replacement test (section 0)
13880 !! options
13881 replace=0,"xxx"
13882 !! wikitext
13883 start
13884 ==a==
13885 ===aa===
13886 ====aaa====
13887 ==b==
13888 ===ba===
13889 ===bb===
13890 ====bba====
13891 ===bc===
13892 ==c==
13893 ===ca===
13894 !! html
13895 xxx
13896
13897 ==a==
13898 ===aa===
13899 ====aaa====
13900 ==b==
13901 ===ba===
13902 ===bb===
13903 ====bba====
13904 ===bc===
13905 ==c==
13906 ===ca===
13907 !! end
13908
13909 !! test
13910 Section replacement test (section 1)
13911 !! options
13912 replace=1,"xxx"
13913 !! wikitext
13914 start
13915 ==a==
13916 ===aa===
13917 ====aaa====
13918 ==b==
13919 ===ba===
13920 ===bb===
13921 ====bba====
13922 ===bc===
13923 ==c==
13924 ===ca===
13925 !! html
13926 start
13927 xxx
13928
13929 ==b==
13930 ===ba===
13931 ===bb===
13932 ====bba====
13933 ===bc===
13934 ==c==
13935 ===ca===
13936 !! end
13937
13938 !! test
13939 Section replacement test (section 2)
13940 !! options
13941 replace=2,"xxx"
13942 !! wikitext
13943 start
13944 ==a==
13945 ===aa===
13946 ====aaa====
13947 ==b==
13948 ===ba===
13949 ===bb===
13950 ====bba====
13951 ===bc===
13952 ==c==
13953 ===ca===
13954 !! html
13955 start
13956 ==a==
13957 xxx
13958
13959 ==b==
13960 ===ba===
13961 ===bb===
13962 ====bba====
13963 ===bc===
13964 ==c==
13965 ===ca===
13966 !! end
13967
13968 !! test
13969 Section replacement test (section 3)
13970 !! options
13971 replace=3,"xxx"
13972 !! wikitext
13973 start
13974 ==a==
13975 ===aa===
13976 ====aaa====
13977 ==b==
13978 ===ba===
13979 ===bb===
13980 ====bba====
13981 ===bc===
13982 ==c==
13983 ===ca===
13984 !! html
13985 start
13986 ==a==
13987 ===aa===
13988 xxx
13989
13990 ==b==
13991 ===ba===
13992 ===bb===
13993 ====bba====
13994 ===bc===
13995 ==c==
13996 ===ca===
13997 !! end
13998
13999 !! test
14000 Section replacement test (section 4)
14001 !! options
14002 replace=4,"xxx"
14003 !! wikitext
14004 start
14005 ==a==
14006 ===aa===
14007 ====aaa====
14008 ==b==
14009 ===ba===
14010 ===bb===
14011 ====bba====
14012 ===bc===
14013 ==c==
14014 ===ca===
14015 !! html
14016 start
14017 ==a==
14018 ===aa===
14019 ====aaa====
14020 xxx
14021
14022 ==c==
14023 ===ca===
14024 !! end
14025
14026 !! test
14027 Section replacement test (section 5)
14028 !! options
14029 replace=5,"xxx"
14030 !! wikitext
14031 start
14032 ==a==
14033 ===aa===
14034 ====aaa====
14035 ==b==
14036 ===ba===
14037 ===bb===
14038 ====bba====
14039 ===bc===
14040 ==c==
14041 ===ca===
14042 !! html
14043 start
14044 ==a==
14045 ===aa===
14046 ====aaa====
14047 ==b==
14048 xxx
14049
14050 ===bb===
14051 ====bba====
14052 ===bc===
14053 ==c==
14054 ===ca===
14055 !! end
14056
14057 !! test
14058 Section replacement test (section 6)
14059 !! options
14060 replace=6,"xxx"
14061 !! wikitext
14062 start
14063 ==a==
14064 ===aa===
14065 ====aaa====
14066 ==b==
14067 ===ba===
14068 ===bb===
14069 ====bba====
14070 ===bc===
14071 ==c==
14072 ===ca===
14073 !! html
14074 start
14075 ==a==
14076 ===aa===
14077 ====aaa====
14078 ==b==
14079 ===ba===
14080 xxx
14081
14082 ===bc===
14083 ==c==
14084 ===ca===
14085 !! end
14086
14087 !! test
14088 Section replacement test (section 7)
14089 !! options
14090 replace=7,"xxx"
14091 !! wikitext
14092 start
14093 ==a==
14094 ===aa===
14095 ====aaa====
14096 ==b==
14097 ===ba===
14098 ===bb===
14099 ====bba====
14100 ===bc===
14101 ==c==
14102 ===ca===
14103 !! html
14104 start
14105 ==a==
14106 ===aa===
14107 ====aaa====
14108 ==b==
14109 ===ba===
14110 ===bb===
14111 xxx
14112
14113 ===bc===
14114 ==c==
14115 ===ca===
14116 !! end
14117
14118 !! test
14119 Section replacement test (section 8)
14120 !! options
14121 replace=8,"xxx"
14122 !! wikitext
14123 start
14124 ==a==
14125 ===aa===
14126 ====aaa====
14127 ==b==
14128 ===ba===
14129 ===bb===
14130 ====bba====
14131 ===bc===
14132 ==c==
14133 ===ca===
14134 !! html
14135 start
14136 ==a==
14137 ===aa===
14138 ====aaa====
14139 ==b==
14140 ===ba===
14141 ===bb===
14142 ====bba====
14143 xxx
14144
14145 ==c==
14146 ===ca===
14147 !!end
14148
14149 !! test
14150 Section replacement test (section 9)
14151 !! options
14152 replace=9,"xxx"
14153 !! wikitext
14154 start
14155 ==a==
14156 ===aa===
14157 ====aaa====
14158 ==b==
14159 ===ba===
14160 ===bb===
14161 ====bba====
14162 ===bc===
14163 ==c==
14164 ===ca===
14165 !! html
14166 start
14167 ==a==
14168 ===aa===
14169 ====aaa====
14170 ==b==
14171 ===ba===
14172 ===bb===
14173 ====bba====
14174 ===bc===
14175 xxx
14176 !! end
14177
14178 !! test
14179 Section replacement test (section 10)
14180 !! options
14181 replace=10,"xxx"
14182 !! wikitext
14183 start
14184 ==a==
14185 ===aa===
14186 ====aaa====
14187 ==b==
14188 ===ba===
14189 ===bb===
14190 ====bba====
14191 ===bc===
14192 ==c==
14193 ===ca===
14194 !! html
14195 start
14196 ==a==
14197 ===aa===
14198 ====aaa====
14199 ==b==
14200 ===ba===
14201 ===bb===
14202 ====bba====
14203 ===bc===
14204 ==c==
14205 xxx
14206 !! end
14207
14208 !! test
14209 Section replacement test with initial whitespace (bug 13728)
14210 !! options
14211 replace=2,"xxx"
14212 !! wikitext
14213 Preformatted initial line
14214 ==a==
14215 ===a===
14216 !! html
14217 Preformatted initial line
14218 ==a==
14219 xxx
14220 !! end
14221
14222
14223 !! test
14224 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14225 !! options
14226 section=1
14227 !! wikitext
14228 ==a==
14229 a
14230 !! html
14231 ==a==
14232 a
14233 !! end
14234
14235 !! test
14236 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14237 !! options
14238 section=1
14239 !! wikitext
14240 ==a==
14241 a
14242 !! html
14243 ==a==
14244 a
14245 !! end
14246
14247
14248 !! test
14249 Section extraction, <pre> around bogus header (bug 10309)
14250 !! options
14251 noxml section=2
14252 !! wikitext
14253 == Section One ==
14254 <pre>
14255 =======
14256 </pre>
14257
14258 == Section Two ==
14259 stuff
14260 !! html
14261 == Section Two ==
14262 stuff
14263 !! end
14264
14265 !! test
14266 Section replacement, <pre> around bogus header (bug 10309)
14267 !! options
14268 noxml replace=2,"xxx"
14269 !! wikitext
14270 == Section One ==
14271 <pre>
14272 =======
14273 </pre>
14274
14275 == Section Two ==
14276 stuff
14277 !! html
14278 == Section One ==
14279 <pre>
14280 =======
14281 </pre>
14282
14283 xxx
14284 !! end
14285
14286
14287
14288 !! test
14289 Handling of &#x0A; in URLs
14290 !! wikitext
14291 **irc://&#x0A;a
14292 !! html
14293 <ul>
14294 <li><ul>
14295 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14296 </li>
14297 </ul>
14298 </li>
14299 </ul>
14300
14301 !!end
14302
14303 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14304 !! test
14305 5 quotes, code coverage +1 line
14306 !! wikitext
14307 '''''
14308 !! html/php
14309 !! html/parsoid
14310 <p><b><i></i></b></p>
14311 !! end
14312
14313 !! test
14314 Special:Search page linking.
14315 !! wikitext
14316 {{Special:search}}
14317 !! html
14318 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14319 </p>
14320 !! end
14321
14322 !! test
14323 Say the magic word
14324 !! options
14325 title=[[Parser test]]
14326 !! wikitext
14327 * {{PAGENAME}}
14328 * {{PAGENAMEE}}
14329 * {{FULLPAGENAME}}
14330 * {{FULLPAGENAMEE}}
14331 * {{BASEPAGENAME}}
14332 * {{BASEPAGENAMEE}}
14333 * {{SUBPAGENAME}}
14334 * {{SUBPAGENAMEE}}
14335 * {{ROOTPAGENAME}}
14336 * {{ROOTPAGENAMEE}}
14337 * {{TALKPAGENAME}}
14338 * {{TALKPAGENAMEE}}
14339 * {{SUBJECTPAGENAME}}
14340 * {{SUBJECTPAGENAMEE}}
14341 * {{NAMESPACEE}}
14342 * {{NAMESPACE}}
14343 * {{NAMESPACENUMBER}}
14344 * {{TALKSPACE}}
14345 * {{TALKSPACEE}}
14346 * {{SUBJECTSPACE}}
14347 * {{SUBJECTSPACEE}}
14348 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14349 !! html
14350 <ul>
14351 <li> Parser test
14352 </li>
14353 <li> Parser_test
14354 </li>
14355 <li> Parser test
14356 </li>
14357 <li> Parser_test
14358 </li>
14359 <li> Parser test
14360 </li>
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> Talk:Parser test
14372 </li>
14373 <li> Talk:Parser_test
14374 </li>
14375 <li> Parser test
14376 </li>
14377 <li> Parser_test
14378 </li>
14379 <li>
14380 </li>
14381 <li>
14382 </li>
14383 <li> 0
14384 </li>
14385 <li> Talk
14386 </li>
14387 <li> Talk
14388 </li>
14389 <li>
14390 </li>
14391 <li>
14392 </li>
14393 <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>
14394 </li>
14395 </ul>
14396
14397 !! end
14398 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14399
14400 !! test
14401 Gallery
14402 !! wikitext
14403 <gallery>
14404 image1.png |
14405 image2.gif|||||
14406
14407 image3|
14408 image4 |300px| centre
14409 image5.svg| http://///////
14410 [[x|xx]]]]
14411 * image6
14412 </gallery>
14413 !! html
14414 <ul class="gallery mw-gallery-traditional">
14415 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14416 <div class="thumb" style="height: 150px;">Image1.png</div>
14417 <div class="gallerytext">
14418 </div>
14419 </div></li>
14420 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14421 <div class="thumb" style="height: 150px;">Image2.gif</div>
14422 <div class="gallerytext">
14423 <p>||||
14424 </p>
14425 </div>
14426 </div></li>
14427 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14428 <div class="thumb" style="height: 150px;">Image3</div>
14429 <div class="gallerytext">
14430 </div>
14431 </div></li>
14432 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14433 <div class="thumb" style="height: 150px;">Image4</div>
14434 <div class="gallerytext">
14435 <p>300px| centre
14436 </p>
14437 </div>
14438 </div></li>
14439 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14440 <div class="thumb" style="height: 150px;">Image5.svg</div>
14441 <div class="gallerytext">
14442 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14443 </p>
14444 </div>
14445 </div></li>
14446 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14447 <div class="thumb" style="height: 150px;">* image6</div>
14448 <div class="gallerytext">
14449 </div>
14450 </div></li>
14451 </ul>
14452
14453 !! end
14454
14455 !! test
14456 Gallery (with options)
14457 !! wikitext
14458 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14459 File:Nonexistant.jpg|caption
14460 File:Nonexistant.jpg
14461 image:foobar.jpg|some '''caption''' [[Main Page]]
14462 image:foobar.jpg
14463 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14464 </gallery>
14465 !! html
14466 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14467 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14468 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14469 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14470 <div class="gallerytext">
14471 <p>caption
14472 </p>
14473 </div>
14474 </div></li>
14475 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14476 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14477 <div class="gallerytext">
14478 </div>
14479 </div></li>
14480 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14481 <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>
14482 <div class="gallerytext">
14483 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14484 </p>
14485 </div>
14486 </div></li>
14487 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14488 <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>
14489 <div class="gallerytext">
14490 </div>
14491 </div></li>
14492 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14493 <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>
14494 <div class="gallerytext">
14495 <p>Blabla|blabla.
14496 </p>
14497 </div>
14498 </div></li>
14499 </ul>
14500
14501 !! end
14502
14503 !! test
14504 Gallery with wikitext inside caption
14505 !! wikitext
14506 <gallery>
14507 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14508 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14509 </gallery>
14510 !! html
14511 <ul class="gallery mw-gallery-traditional">
14512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14513 <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>
14514 <div class="gallerytext">
14515 <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>
14516 </p>
14517 </div>
14518 </div></li>
14519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14520 <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>
14521 <div class="gallerytext">
14522 <p>This is a test template
14523 </p>
14524 </div>
14525 </div></li>
14526 </ul>
14527
14528 !! end
14529
14530 !! test
14531 gallery (with showfilename option)
14532 !! wikitext
14533 <gallery showfilename>
14534 File:Nonexistant.jpg|caption
14535 File:Nonexistant.jpg
14536 image:foobar.jpg|some '''caption''' [[Main Page]]
14537 File:Foobar.jpg
14538 </gallery>
14539 !! html
14540 <ul class="gallery mw-gallery-traditional">
14541 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14542 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14543 <div class="gallerytext">
14544 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14545 caption
14546 </p>
14547 </div>
14548 </div></li>
14549 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14550 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14551 <div class="gallerytext">
14552 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14553 </p>
14554 </div>
14555 </div></li>
14556 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14557 <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>
14558 <div class="gallerytext">
14559 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14560 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14561 </p>
14562 </div>
14563 </div></li>
14564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14565 <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>
14566 <div class="gallerytext">
14567 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14568 </p>
14569 </div>
14570 </div></li>
14571 </ul>
14572
14573 !! end
14574
14575 !! test
14576 Gallery (with namespace-less filenames)
14577 !! wikitext
14578 <gallery>
14579 File:Nonexistant.jpg
14580 Nonexistant.jpg
14581 image:foobar.jpg
14582 foobar.jpg
14583 </gallery>
14584 !! html
14585 <ul class="gallery mw-gallery-traditional">
14586 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14587 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14588 <div class="gallerytext">
14589 </div>
14590 </div></li>
14591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14592 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14593 <div class="gallerytext">
14594 </div>
14595 </div></li>
14596 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14597 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
14598 <div class="gallerytext">
14599 </div>
14600 </div></li>
14601 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14602 <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>
14603 <div class="gallerytext">
14604 </div>
14605 </div></li>
14606 </ul>
14607
14608 !! end
14609
14610 !! test
14611 HTML Hex character encoding (spells the word "JavaScript")
14612 !! wikitext
14613 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14614 !! html
14615 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14616 </p>
14617 !! end
14618
14619 !! test
14620 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14621 !! wikitext
14622 &#xsee;&#XSEE;
14623 !! html
14624 <p>&amp;#xsee;&amp;#XSEE;
14625 </p>
14626 !! end
14627
14628 !! test
14629 HTML Hex character encoding mixed case
14630 !! wikitext
14631 &#xEE;&#Xee;
14632 !! html
14633 <p>&#xee;&#xee;
14634 </p>
14635 !! end
14636
14637 !! test
14638 __FORCETOC__ override
14639 !! wikitext
14640 __NEWSECTIONLINK__
14641 __FORCETOC__
14642 !! html
14643 <p><br />
14644 </p>
14645 !! end
14646
14647 !! test
14648 ISBN code coverage
14649 !! wikitext
14650 ISBN 978-0-1234-56&#x20;789
14651 !! html
14652 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14653 </p>
14654 !! end
14655
14656 !! test
14657 ISBN followed by 5 spaces
14658 !! wikitext
14659 ISBN
14660 !! html
14661 <p>ISBN
14662 </p>
14663 !! end
14664
14665 !! test
14666 Double ISBN
14667 !! wikitext
14668 ISBN ISBN 1234567890
14669 !! html
14670 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14671 </p>
14672 !! end
14673
14674 !! test
14675 ISBN with an X
14676 !! wikitext
14677 ISBN 3-462-04561-X
14678 !! html
14679 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
14680 </p>
14681 !! end
14682
14683 !! test
14684 Bug 22905: <abbr> followed by ISBN followed by </a>
14685 !! wikitext
14686 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
14687 !! html
14688 <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>
14689 </p>
14690 !! end
14691
14692 !! test
14693 Double RFC
14694 !! wikitext
14695 RFC RFC 1234
14696 !! html
14697 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
14698 </p>
14699 !! end
14700
14701 !! test
14702 Double RFC with a wiki link
14703 !! wikitext
14704 RFC [[RFC 1234]]
14705 !! html
14706 <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>
14707 </p>
14708 !! end
14709
14710 !! test
14711 RFC code coverage
14712 !! wikitext
14713 RFC 983&#x20;987
14714 !! html
14715 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
14716 </p>
14717 !! end
14718
14719 !! test
14720 Centre-aligned image
14721 !! wikitext
14722 [[Image:foobar.jpg|centre]]
14723 !! html
14724 <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>
14725
14726 !!end
14727
14728 !! test
14729 None-aligned image
14730 !! wikitext
14731 [[Image:foobar.jpg|none]]
14732 !! html
14733 <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>
14734
14735 !!end
14736
14737 !! test
14738 Width + Height sized image (using px) (height is ignored)
14739 !! wikitext
14740 [[Image:foobar.jpg|640x480px]]
14741 !! html
14742 <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>
14743 </p>
14744 !!end
14745
14746 !! test
14747 Width-sized image (using px, no following whitespace)
14748 !! wikitext
14749 [[Image:foobar.jpg|640px]]
14750 !! html
14751 <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>
14752 </p>
14753 !!end
14754
14755 !! test
14756 Width-sized image (using px, with following whitespace - test regression from r39467)
14757 !! wikitext
14758 [[Image:foobar.jpg|640px ]]
14759 !! html
14760 <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>
14761 </p>
14762 !!end
14763
14764 !! test
14765 Width-sized image (using px, with preceding whitespace - test regression from r39467)
14766 !! wikitext
14767 [[Image:foobar.jpg| 640px]]
14768 !! html
14769 <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>
14770 </p>
14771 !!end
14772
14773 !! test
14774 Another italics / bold test
14775 !! wikitext
14776 ''' ''x'
14777 !! html
14778 <pre>'<i> </i>x'
14779 </pre>
14780 !!end
14781
14782 # Note the results may be incorrect, as parserTest output included this:
14783 # XML error: Mismatched tag at byte 6120:
14784 # ...<dd> </dt></dl> </dd...
14785 !! test
14786 dt/dd/dl test
14787 !! options
14788 disabled
14789 !! wikitext
14790 :;;;::
14791 !! html
14792 <dl>
14793 <dd><dl>
14794 <dt><dl>
14795 <dt><dl>
14796 <dt><dl>
14797 <dd><dl>
14798 <dd>
14799 </dd>
14800 </dl>
14801 </dd>
14802 </dl>
14803 </dt>
14804 </dl>
14805 </dt>
14806 </dl>
14807 </dt>
14808 </dl>
14809 </dd>
14810 </dl>
14811
14812 !!end
14813
14814
14815 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
14816 !! test
14817 Images with the "|" character in the comment
14818 !! wikitext
14819 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14820 !! html
14821 <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>
14822
14823 !!end
14824
14825 !! test
14826 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14827 !! wikitext
14828 <html><script>alert(1);</script></html>
14829 !! html
14830 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14831 </p>
14832 !! end
14833
14834 !! test
14835 HTML with raw HTML ($wgRawHtml==true)
14836 !! options
14837 wgRawHtml=1
14838 !! wikitext
14839 <html><script>alert(1);</script></html>
14840 !! html
14841 <p><script>alert(1);</script>
14842 </p>
14843 !! end
14844
14845 !! test
14846 Parents of subpages, one level up
14847 !! options
14848 subpage title=[[Subpage test/L1/L2/L3]]
14849 !! wikitext
14850 [[../|L2]]
14851 !! html
14852 <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>
14853 </p>
14854 !! end
14855
14856
14857 !! test
14858 Parents of subpages, one level up, not named
14859 !! options
14860 subpage title=[[Subpage test/L1/L2/L3]]
14861 !! wikitext
14862 [[../]]
14863 !! html
14864 <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>
14865 </p>
14866 !! end
14867
14868
14869
14870 !! test
14871 Parents of subpages, two levels up
14872 !! options
14873 subpage title=[[Subpage test/L1/L2/L3]]
14874 !! wikitext
14875 [[../../|L1]]2
14876
14877 [[../../|L1]]l
14878 !! html
14879 <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
14880 </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>
14881 </p>
14882 !! end
14883
14884 !! test
14885 Parents of subpages, two levels up, without trailing slash or name.
14886 !! options
14887 subpage title=[[Subpage test/L1/L2/L3]]
14888 !! wikitext
14889 [[../..]]
14890 !! html
14891 <p>[[../..]]
14892 </p>
14893 !! end
14894
14895 !! test
14896 Parents of subpages, two levels up, with lots of extra trailing slashes.
14897 !! options
14898 subpage title=[[Subpage test/L1/L2/L3]]
14899 !! wikitext
14900 [[../../////]]
14901 !! html
14902 <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>
14903 </p>
14904 !! end
14905
14906 !! article
14907 Subpage test/L1/L2/L3Sibling
14908 !! text
14909 Sibling article
14910 !! endarticle
14911
14912 !! test
14913 Transclusion of a sibling page (one level up)
14914 !! options
14915 subpage title=[[Subpage test/L1/L2/L3]]
14916 !! wikitext
14917 {{../L3Sibling}}
14918 !! html
14919 <p>Sibling article
14920 </p>
14921 !! end
14922
14923 !! test
14924 Transclusion of a child page
14925 !! options
14926 subpage title=[[Subpage test/L1/L2]]
14927 !! wikitext
14928 {{/L3Sibling}}
14929 !! html
14930 <p>Sibling article
14931 </p>
14932 !! end
14933
14934 !! test
14935 Non-transclusion because of too many up levels
14936 !! options
14937 subpage title=[[Subpage test/L1/L2/L3]]
14938 !! wikitext
14939 {{../../../../More than parent}}
14940 !! html
14941 <p>{{../../../../More than parent}}
14942 </p>
14943 !! end
14944
14945 !! test
14946 Definition list code coverage
14947 !! wikitext
14948 ; title : def
14949 ; title : def
14950 ;title: def
14951 !! html
14952 <dl>
14953 <dt> title &#160;</dt>
14954 <dd> def
14955 </dd>
14956 <dt> title&#160;</dt>
14957 <dd> def
14958 </dd>
14959 <dt>title</dt>
14960 <dd> def
14961 </dd>
14962 </dl>
14963
14964 !! end
14965
14966 !! test
14967 Don't fall for the self-closing div
14968 !! wikitext
14969 <div>hello world</div/>
14970 !! html
14971 <div>hello world</div>
14972
14973 !! end
14974
14975 !! test
14976 MSGNW magic word
14977 !! wikitext
14978 {{MSGNW:msg}}
14979 !! html
14980 <p>&#91;&#91;:Template:Msg&#93;&#93;
14981 </p>
14982 !! end
14983
14984 !! test
14985 RAW magic word
14986 !! wikitext
14987 {{RAW:QUERTY}}
14988 !! html
14989 <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>
14990 </p>
14991 !! end
14992
14993 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
14994 !! test
14995 Always escape literal '>' in output, not just after '<'
14996 !! wikitext
14997 ><>
14998 !! html
14999 <p>&gt;&lt;&gt;
15000 </p>
15001 !! end
15002
15003 !! test
15004 Template caching
15005 !! wikitext
15006 {{Test}}
15007 {{Test}}
15008 !! html
15009 <p>This is a test template
15010 This is a test template
15011 </p>
15012 !! end
15013
15014
15015 !! article
15016 MediaWiki:Fake
15017 !! text
15018 ==header==
15019 !! endarticle
15020
15021 !! test
15022 Inclusion of !userCanEdit() content
15023 !! wikitext
15024 {{MediaWiki:Fake}}
15025 !! html
15026 <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>
15027
15028 !! end
15029
15030
15031 !! test
15032 Out-of-order TOC heading levels
15033 !! wikitext
15034 ==2==
15035 ======6======
15036 ===3===
15037 =1=
15038 =====5=====
15039 ==2==
15040 !! html
15041 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15042 <ul>
15043 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15044 <ul>
15045 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15046 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15047 </ul>
15048 </li>
15049 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15050 <ul>
15051 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15052 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15053 </ul>
15054 </li>
15055 </ul>
15056 </div>
15057
15058 <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>
15059 <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>
15060 <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>
15061 <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>
15062 <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>
15063 <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>
15064
15065 !! end
15066
15067
15068 !! test
15069 ISBN with a dummy number
15070 !! wikitext
15071 ISBN ---
15072 !! html
15073 <p>ISBN ---
15074 </p>
15075 !! end
15076
15077
15078 !! test
15079 ISBN with space-delimited number
15080 !! wikitext
15081 ISBN 92 9017 032 8
15082 !! html
15083 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15084 </p>
15085 !! end
15086
15087
15088 !! test
15089 ISBN with multiple spaces, no number
15090 !! wikitext
15091 ISBN foo
15092 !! html
15093 <p>ISBN foo
15094 </p>
15095 !! end
15096
15097
15098 !! test
15099 ISBN length
15100 !! wikitext
15101 ISBN 123456789
15102
15103 ISBN 1234567890
15104
15105 ISBN 12345678901
15106 !! html
15107 <p>ISBN 123456789
15108 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15109 </p><p>ISBN 12345678901
15110 </p>
15111 !! end
15112
15113
15114 !! test
15115 ISBN with trailing year (bug 8110)
15116 !! wikitext
15117 ISBN 1-234-56789-0 - 2006
15118
15119 ISBN 1 234 56789 0 - 2006
15120 !! html
15121 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15122 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15123 </p>
15124 !! end
15125
15126
15127 !! test
15128 anchorencode
15129 !! wikitext
15130 {{anchorencode:foo bar©#%n}}
15131 !! html
15132 <p>foo_bar.C2.A9.23.25n
15133 </p>
15134 !! end
15135
15136 !! test
15137 anchorencode trims spaces
15138 !! wikitext
15139 {{anchorencode: __pretty__please__}}
15140 !! html
15141 <p>pretty_please
15142 </p>
15143 !! end
15144
15145 !! test
15146 anchorencode deals with links
15147 !! wikitext
15148 {{anchorencode: [[hello|world]] [[hi]]}}
15149 !! html
15150 <p>world_hi
15151 </p>
15152 !! end
15153
15154 !! test
15155 anchorencode deals with templates
15156 !! wikitext
15157 {{anchorencode: {{Foo}} }}
15158 !! html
15159 <p>FOO
15160 </p>
15161 !! end
15162
15163 !! test
15164 anchorencode encodes like the TOC generator: (bug 18431)
15165 !! wikitext
15166 === _ +:.3A%3A&&amp;]] ===
15167 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15168 __NOEDITSECTION__
15169 !! html
15170 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15171 <p>.2B:.3A.253A.26.26.5D.5D
15172 </p>
15173 !! end
15174
15175 !! test
15176 Bug 6200: blockquotes and paragraph formatting
15177 !! wikitext
15178 <blockquote>
15179 foo
15180 </blockquote>
15181
15182 bar
15183
15184 baz
15185 !! html
15186 <blockquote>
15187 <p>foo
15188 </p>
15189 </blockquote>
15190 <p>bar
15191 </p>
15192 <pre>baz
15193 </pre>
15194 !! end
15195
15196 !! test
15197 Bug 8293: Use of center tag ruins paragraph formatting
15198 !! wikitext
15199 <center>
15200 foo
15201 </center>
15202
15203 bar
15204
15205 baz
15206 !! html
15207 <center>
15208 <p>foo
15209 </p>
15210 </center>
15211 <p>bar
15212 </p>
15213 <pre>baz
15214 </pre>
15215 !! end
15216
15217 !!test
15218 Parsing of overlapping (improperly nested) inline html tags
15219 !! wikitext
15220 <span><s>x</span></s>
15221 !! html/php
15222 <p><span><s>x&lt;/span&gt;</s></span>
15223 </p>
15224 !! html/parsoid
15225 <p><span><s>x</s></span>
15226 </p>
15227 !!end
15228
15229 ###
15230 ### Language variants related tests
15231 ###
15232 !! test
15233 Self-link in language variants
15234 !! options
15235 title=[[Dunav]] language=sr
15236 !! wikitext
15237 Both [[Dunav]] and [[Дунав]] are names for this river.
15238 !! html
15239 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15240 </p>
15241 !!end
15242
15243 !! article
15244 Дуна
15245 !! text
15246 content
15247 !! endarticle
15248
15249 !! test
15250 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15251 !! options
15252 title=[[Duna]] language=sr
15253 !! wikitext
15254 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15255 !! html
15256 <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.
15257 </p>
15258 !! end
15259
15260 !! test
15261 Link to a section of a variant of this title shouldn't be parsed as self-link
15262 !! options
15263 title=[[Duna]] language=sr
15264 !! wikitext
15265 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15266 !! html
15267 <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.
15268 </p>
15269 !! end
15270
15271 !! test
15272 Link to pages in language variants
15273 !! options
15274 language=sr
15275 !! wikitext
15276 Main Page can be written as [[Маин Паге]]
15277 !! html
15278 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15279 </p>
15280 !!end
15281
15282
15283 !! test
15284 Multiple links to pages in language variants
15285 !! options
15286 language=sr
15287 !! wikitext
15288 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15289 !! html
15290 <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>.
15291 </p>
15292 !!end
15293
15294
15295 !! test
15296 Simple template in language variants
15297 !! options
15298 language=sr
15299 !! wikitext
15300 {{тест}}
15301 !! html
15302 <p>This is a test template
15303 </p>
15304 !! end
15305
15306
15307 !! test
15308 Template with explicit namespace in language variants
15309 !! options
15310 language=sr
15311 !! wikitext
15312 {{Template:тест}}
15313 !! html
15314 <p>This is a test template
15315 </p>
15316 !! end
15317
15318
15319 !! test
15320 Basic test for template parameter in language variants
15321 !! options
15322 language=sr
15323 !! wikitext
15324 {{парамтест|param=foo}}
15325 !! html
15326 <p>This is a test template with parameter foo
15327 </p>
15328 !! end
15329
15330
15331 !! test
15332 Simple category in language variants
15333 !! options
15334 language=sr cat
15335 !! wikitext
15336 [[Category:МедиаWики Усер'с Гуиде]]
15337 !! html
15338 <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>
15339 !! end
15340
15341
15342 !! article
15343 Category:分类
15344 !! text
15345 blah
15346 !! endarticle
15347
15348 !! article
15349 Category:分類
15350 !! text
15351 blah
15352 !! endarticle
15353
15354 !! test
15355 Don't convert blue categorylinks to another variant (bug 33210)
15356 !! options
15357 language=zh cat
15358 !! wikitext
15359 [[A]][[Category:分类]]
15360 !! html
15361 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15362 !! end
15363
15364
15365 !! test
15366 Stripping -{}- tags (language variants)
15367 !! options
15368 language=sr
15369 !! wikitext
15370 Latin proverb: -{Ne nuntium necare}-
15371 !! html
15372 <p>Latin proverb: Ne nuntium necare
15373 </p>
15374 !! end
15375
15376
15377 !! test
15378 Prevent conversion with -{}- tags (language variants)
15379 !! options
15380 language=sr variant=sr-ec
15381 !! wikitext
15382 Latinski: -{Ne nuntium necare}-
15383 !! html
15384 <p>Латински: Ne nuntium necare
15385 </p>
15386 !! end
15387
15388
15389 !! test
15390 Prevent conversion of text with -{}- tags (language variants)
15391 !! options
15392 language=sr variant=sr-ec
15393 !! wikitext
15394 Latinski: -{Ne nuntium necare}-
15395 !! html
15396 <p>Латински: Ne nuntium necare
15397 </p>
15398 !! end
15399
15400
15401 !! test
15402 Prevent conversion of links with -{}- tags (language variants)
15403 !! options
15404 language=sr variant=sr-ec
15405 !! wikitext
15406 -{[[Main Page]]}-
15407 !! html
15408 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15409 </p>
15410 !! end
15411
15412
15413 !! test
15414 -{}- tags within headlines (within html for parserConvert())
15415 !! options
15416 language=sr variant=sr-ec
15417 !! wikitext
15418 == -{Naslov}- ==
15419 !! html
15420 <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>
15421
15422 !! end
15423
15424
15425 !! test
15426 Explicit definition of language variant alternatives
15427 !! options
15428 language=zh variant=zh-tw
15429 !! wikitext
15430 -{zh:China;zh-tw:Taiwan}-, not China
15431 !! html
15432 <p>Taiwan, not China
15433 </p>
15434 !! end
15435
15436
15437 !! test
15438 Conversion around HTML tags
15439 !! options
15440 language=sr variant=sr-ec
15441 !! wikitext
15442 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15443 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15444 !! html
15445 <p>
15446 <span title="ЛаCтин">ски</span>
15447 </p>
15448 !! end
15449
15450
15451 !! test
15452 Explicit session-wise language variant mapping (A flag and - flag)
15453 !! options
15454 language=zh variant=zh-tw
15455 !! wikitext
15456 Taiwan is not China.
15457 But -{A|zh:China;zh-tw:Taiwan}- is China,
15458 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15459 and -{China}- is China.
15460 !! html
15461 <p>Taiwan is not China.
15462 But Taiwan is Taiwan,
15463 (This should be stripped!)
15464 and China is China.
15465 </p>
15466 !! end
15467
15468 !! test
15469 Explicit session-wise language variant mapping (H flag for hide)
15470 !! options
15471 language=zh variant=zh-tw
15472 !! wikitext
15473 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15474 Taiwan is China.
15475 !! html
15476 <p>(This should be stripped!)
15477 Taiwan is Taiwan.
15478 </p>
15479 !! end
15480
15481 !! test
15482 Adding explicit conversion rule for title (T flag)
15483 !! options
15484 language=zh variant=zh-tw showtitle
15485 !! wikitext
15486 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15487 !! html
15488 Taiwan
15489 <p>Should be stripped!
15490 </p>
15491 !! end
15492
15493 !! test
15494 Testing that changing the language variant here in the tests actually works
15495 !! options
15496 language=zh variant=zh showtitle
15497 !! wikitext
15498 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15499 !! html
15500 China
15501 <p>Should be stripped!
15502 </p>
15503 !! end
15504
15505 !! test
15506 Recursive conversion of alt and title attrs shouldn't clear converter state
15507 !! options
15508 language=zh variant=zh-cn showtitle
15509 !! wikitext
15510 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15511 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15512 !! html
15513 China
15514 <p>
15515 Should be stripped<span title="Exclamation">!</span>
15516 </p>
15517 !! end
15518
15519 !! test
15520 Bug 24072: more test on conversion rule for title
15521 !! options
15522 language=zh variant=zh-tw showtitle
15523 !! wikitext
15524 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15525 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15526 !! html
15527 Taiwan
15528 <p>This should be stripped!
15529 This won't take interferes with the title rule.
15530 </p>
15531 !! end
15532
15533 !! test
15534 Partly disable title conversion if variant == main language code
15535 !! options
15536 language=zh variant=zh title=[[ZH]] showtitle
15537 !! wikitext
15538 -{T|zh-cn:CN;zh-tw:TW}-
15539 !! html
15540 ZH
15541 <p>
15542 </p>
15543 !! end
15544
15545 !! test
15546 Partly disable title conversion if variant == main language code, more
15547 !! options
15548 language=zh variant=zh title=[[ZH]] showtitle
15549 !! wikitext
15550 -{T|TW}-
15551 !! html
15552 ZH
15553 <p>
15554 </p>
15555 !! end
15556
15557 !! test
15558 Raw output of variant escape tags (R flag)
15559 !! options
15560 language=zh variant=zh-tw
15561 !! wikitext
15562 Raw: -{R|zh:China;zh-tw:Taiwan}-
15563 !! html
15564 <p>Raw: zh:China;zh-tw:Taiwan
15565 </p>
15566 !! end
15567
15568 !! test
15569 Nested using of manual convert syntax
15570 !! options
15571 language=zh variant=zh-hk
15572 !! wikitext
15573 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15574 !! html
15575 <p>Nested: Hello Hong Kong!
15576 </p>
15577 !! end
15578
15579 !! test
15580 Proper conversion of text in external links
15581 !! options
15582 language=sr variant=sr-ec
15583 !! wikitext
15584 http://www.google.com
15585 gopher://www.google.com
15586 [http://www.google.com http://www.google.com]
15587 [gopher://www.google.com gopher://www.google.com]
15588 [https://www.google.com irc://www.google.com]
15589 [ftp://www.google.com www.google.com/ftp://dir]
15590 [//www.google.com www.google.com]
15591 !! html
15592 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15593 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15594 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15595 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15596 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15597 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15598 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15599 </p>
15600 !! end
15601
15602 !! test
15603 Do not convert roman numbers to language variants
15604 !! options
15605 language=sr variant=sr-ec
15606 !! wikitext
15607 Fridrih IV je car.
15608 !! html
15609 <p>Фридрих IV је цар.
15610 </p>
15611 !! end
15612
15613 !! test
15614 Unclosed language converter markup "-{"
15615 !! options
15616 language=sr
15617 !! wikitext
15618 -{T|hello
15619 !! html
15620 <p>-{T|hello
15621 </p>
15622 !! end
15623
15624 !! test
15625 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15626 !! options
15627 language=sr
15628 !! wikitext
15629 -{R|=&gt;}-
15630 !! html
15631 <p>=&gt;
15632 </p>
15633 !!end
15634
15635 !! test
15636 Don't break link parsing if language converter markup is in the caption.
15637 !! options
15638 language=sr variant=sr-ec
15639 !! wikitext
15640 [[Main Page|-{R|main page}-]]
15641 !! html
15642 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15643 </p>
15644 !! end
15645
15646 # This test is currently broken in the PHP parser (bug 52661)
15647 !! test
15648 Don't break image parsing if language converter markup is in the caption.
15649 !! options
15650 language=sr
15651 disabled
15652 !! wikitext
15653 [[File:Foobar.jpg|-{R|caption}-]]
15654 !! html
15655 <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>
15656 </p>
15657 !! end
15658
15659 # This test is currently broken in the PHP parser (bug 52661)
15660 !! test
15661 Don't break list handling if language converter markup is in the item.
15662 !! options
15663 language=zh variant=zh-cn
15664 disabled
15665 !! wikitext
15666 ;-{zh-cn:AAA;zh-tw:BBB}-
15667 !! html
15668 <dl><dt>AAA
15669 </dt></dl>
15670
15671 !! end
15672
15673 # This test is currently broken in the PHP parser (bug 52661)
15674 !! test
15675 Don't break table handling if language converter markup is in the cell.
15676 !! options
15677 language=sr variant=sr-ec
15678 disabled
15679 !! wikitext
15680 {|
15681 |-
15682 | -{R|B}-
15683 |}
15684 !! html
15685 <table>
15686
15687 <tr>
15688 <td> B
15689 </td></tr></table>
15690
15691 !! end
15692
15693 !! test
15694 Bug 529: Uncovered bullet
15695 !! wikitext
15696 * Foo {{bullet}}
15697 !! html
15698 <ul>
15699 <li> Foo
15700 </li>
15701 <li> Bar
15702 </li>
15703 </ul>
15704
15705 !! end
15706
15707 # Plain MediaWiki does not remove empty lists, but tidy actually does.
15708 # Templates in Wikipedia rely on this behavior, as tidy has always been
15709 # enabled there. These tests are normally run *without* tidy, so specify the
15710 # full output here.
15711 # To test realistic parsing behavior, apply a tidy-like transformation to both
15712 # the expected output and your parser's output.
15713 !! test
15714 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
15715 !! wikitext
15716 ******* Foo {{bullet}}
15717 !! html
15718 <ul>
15719 <li><ul>
15720 <li><ul>
15721 <li><ul>
15722 <li><ul>
15723 <li><ul>
15724 <li><ul>
15725 <li> Foo
15726 </li>
15727 </ul>
15728 </li>
15729 </ul>
15730 </li>
15731 </ul>
15732 </li>
15733 </ul>
15734 </li>
15735 </ul>
15736 </li>
15737 </ul>
15738 </li>
15739 <li> Bar
15740 </li>
15741 </ul>
15742
15743 !! end
15744
15745 !! test
15746 Bug 529: Uncovered table already at line-start
15747 !! wikitext
15748 x
15749
15750 {{table}}
15751 y
15752 !! html
15753 <p>x
15754 </p>
15755 <table>
15756 <tr>
15757 <td> 1 </td>
15758 <td> 2
15759 </td></tr>
15760 <tr>
15761 <td> 3 </td>
15762 <td> 4
15763 </td></tr></table>
15764 <p>y
15765 </p>
15766 !! end
15767
15768 !! test
15769 Bug 529: Uncovered bullet in parser function result
15770 !! wikitext
15771 * Foo {{lc:{{bullet}} }}
15772 !! html
15773 <ul>
15774 <li> Foo
15775 </li>
15776 <li> bar
15777 </li>
15778 </ul>
15779
15780 !! end
15781
15782 !! test
15783 Bug 5678: Double-parsed template argument
15784 !! wikitext
15785 {{lc:{{{1}}}|hello}}
15786 !! html
15787 <p>{{{1}}}
15788 </p>
15789 !! end
15790
15791 !! test
15792 Bug 5678: Double-parsed template invocation
15793 !! wikitext
15794 {{lc:{{paramtest {{!}} param = hello }} }}
15795 !! html
15796 <p>{{paramtest | param = hello }}
15797 </p>
15798 !! end
15799
15800 !! test
15801 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
15802 !! options
15803 language=cs
15804 title=[[Main Page]]
15805 !! wikitext
15806 {{PRVNÍVELKÉ:ěščř}}
15807 {{prvnívelké:ěščř}}
15808 {{PRVNÍMALÉ:ěščř}}
15809 {{prvnímalé:ěščř}}
15810 {{MALÁ:ěščř}}
15811 {{malá:ěščř}}
15812 {{VELKÁ:ěščř}}
15813 {{velká:ěščř}}
15814 !! html
15815 <p>Ěščř
15816 Ěščř
15817 ěščř
15818 ěščř
15819 ěščř
15820 ěščř
15821 ĚŠČŘ
15822 ĚŠČŘ
15823 </p>
15824 !! end
15825
15826 !! test
15827 Morwen/13: Unclosed link followed by heading
15828 !! wikitext
15829 [[link
15830 ==heading==
15831 !! html
15832 <p>[[link
15833 </p>
15834 <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>
15835
15836 !! end
15837
15838 !! test
15839 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
15840 !! wikitext
15841 {{foo|
15842 =heading=
15843 !! html
15844 <p>{{foo|
15845 </p>
15846 <h1><span class="mw-headline" id="heading">heading</span></h1>
15847
15848 !! end
15849
15850 !! test
15851 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
15852 !! wikitext
15853 {{foo|
15854 ==heading==
15855 !! html
15856 <p>{{foo|
15857 </p>
15858 <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>
15859
15860 !! end
15861
15862 !! test
15863 Tildes in comments
15864 !! options
15865 pst
15866 !! wikitext
15867 <!-- ~~~~ -->
15868 !! html
15869 <!-- ~~~~ -->
15870 !! end
15871
15872 !! test
15873 Paragraphs inside divs (no extra line breaks)
15874 !! wikitext
15875 <div>Line one
15876
15877 Line two</div>
15878 !! html
15879 <div>Line one
15880 Line two</div>
15881
15882 !! end
15883
15884 !! test
15885 Paragraphs inside divs (extra line break on open)
15886 !! wikitext
15887 <div>
15888 Line one
15889
15890 Line two</div>
15891 !! html
15892 <div>
15893 <p>Line one
15894 </p>
15895 Line two</div>
15896
15897 !! end
15898
15899 !! test
15900 Paragraphs inside divs (extra line break on close)
15901 !! wikitext
15902 <div>Line one
15903
15904 Line two
15905 </div>
15906 !! html
15907 <div>Line one
15908 <p>Line two
15909 </p>
15910 </div>
15911
15912 !! end
15913
15914 !! test
15915 Paragraphs inside divs (extra line break on open and close)
15916 !! wikitext
15917 <div>
15918 Line one
15919
15920 Line two
15921 </div>
15922 !! html
15923 <div>
15924 <p>Line one
15925 </p><p>Line two
15926 </p>
15927 </div>
15928
15929 !! end
15930
15931 !! test
15932 Nesting tags, paragraphs on lines which begin with <div>
15933 !! options
15934 disabled
15935 !! wikitext
15936 <div></div><strong>A
15937 B</strong>
15938 !! html
15939 <div></div>
15940 <p><strong>A
15941 B</strong>
15942 </p>
15943 !! end
15944
15945 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15946 !! test
15947 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15948 !! wikitext
15949 <blockquote>Line one
15950
15951 Line two</blockquote>
15952 !! html
15953 <blockquote>Line one
15954 Line two</blockquote>
15955
15956 !! end
15957
15958 !! test
15959 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15960 !! wikitext
15961 <blockquote>
15962 Line one
15963
15964 Line two</blockquote>
15965 !! html
15966 <blockquote>
15967 <p>Line one
15968 </p>
15969 Line two</blockquote>
15970
15971 !! end
15972
15973 !! test
15974 Bug 6200: paragraphs inside blockquotes (extra line break on close)
15975 !! wikitext
15976 <blockquote>Line one
15977
15978 Line two
15979 </blockquote>
15980 !! html
15981 <blockquote>Line one
15982 <p>Line two
15983 </p>
15984 </blockquote>
15985
15986 !! end
15987
15988 !! test
15989 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
15990 !! wikitext
15991 <blockquote>
15992 Line one
15993
15994 Line two
15995 </blockquote>
15996 !! html
15997 <blockquote>
15998 <p>Line one
15999 </p><p>Line two
16000 </p>
16001 </blockquote>
16002
16003 !! end
16004
16005 !! test
16006 Paragraphs inside blockquotes/divs (no extra line breaks)
16007 !! wikitext
16008 <blockquote><div>Line one
16009
16010 Line two</div></blockquote>
16011 !! html
16012 <blockquote><div>Line one
16013 Line two</div></blockquote>
16014
16015 !! end
16016
16017 !! test
16018 Paragraphs inside blockquotes/divs (extra line break on open)
16019 !! wikitext
16020 <blockquote><div>
16021 Line one
16022
16023 Line two</div></blockquote>
16024 !! html
16025 <blockquote><div>
16026 <p>Line one
16027 </p>
16028 Line two</div></blockquote>
16029
16030 !! end
16031
16032 !! test
16033 Paragraphs inside blockquotes/divs (extra line break on close)
16034 !! wikitext
16035 <blockquote><div>Line one
16036
16037 Line two
16038 </div></blockquote>
16039 !! html
16040 <blockquote><div>Line one
16041 <p>Line two
16042 </p>
16043 </div></blockquote>
16044
16045 !! end
16046
16047 !! test
16048 Paragraphs inside blockquotes/divs (extra line break on open and close)
16049 !! wikitext
16050 <blockquote><div>
16051 Line one
16052
16053 Line two
16054 </div></blockquote>
16055 !! html
16056 <blockquote><div>
16057 <p>Line one
16058 </p><p>Line two
16059 </p>
16060 </div></blockquote>
16061
16062 !! end
16063
16064 !! test
16065 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16066 !! options
16067 wgLinkHolderBatchSize=0
16068 !! wikitext
16069 [[meatball:1]]
16070 [[meatball:2]]
16071 [[meatball:3]]
16072 !! html
16073 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16074 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16075 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16076 </p>
16077 !! end
16078
16079 !! test
16080 Free external link invading image caption
16081 !! wikitext
16082 [[Image:Foobar.jpg|thumb|http://x|hello]]
16083 !! html
16084 <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>
16085
16086 !! end
16087
16088 !! test
16089 Bug 15196: localised external link numbers
16090 !! options
16091 language=fa
16092 !! wikitext
16093 [http://en.wikipedia.org/]
16094 !! html
16095 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16096 </p>
16097 !! end
16098
16099 !! test
16100 Multibyte character in padleft
16101 !! wikitext
16102 {{padleft:-Hello|7|Æ}}
16103 !! html
16104 <p>Æ-Hello
16105 </p>
16106 !! end
16107
16108 !! test
16109 Multibyte character in padright
16110 !! wikitext
16111 {{padright:Hello-|7|Æ}}
16112 !! html
16113 <p>Hello-Æ
16114 </p>
16115 !! end
16116
16117 !!test
16118 formatdate parser function
16119 !! wikitext
16120 {{#formatdate:2009-03-24}}
16121 !! html
16122 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16123 </p>
16124 !! end
16125
16126 !!test
16127 formatdate parser function, with default format
16128 !! wikitext
16129 {{#formatdate:2009-03-24|mdy}}
16130 !! html
16131 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16132 </p>
16133 !! end
16134
16135 !! test
16136 Spacing of numbers in formatted dates
16137 !! wikitext
16138 {{#formatdate:January 15}}
16139 !! html
16140 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16141 </p>
16142 !! end
16143
16144 !! test
16145 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
16146 !! options
16147 language=nl title=[[MediaWiki:Common.css]]
16148 !! wikitext
16149 {{#formatdate:2009-03-24|dmy}}
16150 !! html
16151 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16152 </p>
16153 !! end
16154
16155 #
16156 #
16157 #
16158
16159 #
16160 # Edit comments
16161 #
16162
16163 !! test
16164 Edit comment with link
16165 !! options
16166 comment
16167 !! wikitext
16168 I like the [[Main Page]] a lot
16169 !! html
16170 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16171 !!end
16172
16173 !! test
16174 Edit comment with link and link text
16175 !! options
16176 comment
16177 !! wikitext
16178 I like the [[Main Page|best pages]] a lot
16179 !! html
16180 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16181 !!end
16182
16183 !! test
16184 Edit comment with link and link text with suffix
16185 !! options
16186 comment
16187 !! wikitext
16188 I like the [[Main Page|best page]]s 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 section link (non-local, eg in history list)
16195 !! options
16196 comment title=[[Main Page]]
16197 !! wikitext
16198 /* External links */ removed bogus entries
16199 !! html
16200 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16201 !!end
16202
16203 !! test
16204 Edit comment with section link and text before it (non-local, eg in history list)
16205 !! options
16206 comment title=[[Main Page]]
16207 !! wikitext
16208 pre-comment text /* External links */ removed bogus entries
16209 !! html
16210 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>
16211 !!end
16212
16213 !! test
16214 Edit comment with section link (local, eg in diff view)
16215 !! options
16216 comment local title=[[Main Page]]
16217 !! wikitext
16218 /* External links */ removed bogus entries
16219 !! html
16220 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16221 !!end
16222
16223 !! test
16224 Edit comment with subpage link (bug 14080)
16225 !! options
16226 comment
16227 subpage
16228 title=[[Subpage test]]
16229 !! wikitext
16230 Poked at a [[/subpage]] here...
16231 !! html
16232 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16233 !!end
16234
16235 !! test
16236 Edit comment with subpage link and link text (bug 14080)
16237 !! options
16238 comment
16239 subpage
16240 title=[[Subpage test]]
16241 !! wikitext
16242 Poked at a [[/subpage|neat little page]] here...
16243 !! html
16244 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16245 !!end
16246
16247 !! test
16248 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16249 !! options
16250 comment
16251 title=[[Subpage test]]
16252 !! wikitext
16253 Poked at a [[/subpage]] here...
16254 !! html
16255 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...
16256 !!end
16257
16258 !! test
16259 Edit comment with bare anchor link (local, as on diff)
16260 !! options
16261 comment
16262 local
16263 title=[[Main Page]]
16264 !! wikitext
16265 [[#section]]
16266 !! html
16267 <a href="#section">#section</a>
16268 !! end
16269
16270 !! test
16271 Edit comment with bare anchor link (non-local, as on history)
16272 !! options
16273 comment
16274 title=[[Main Page]]
16275 !! wikitext
16276 [[#section]]
16277 !! html
16278 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16279 !! end
16280
16281 !! test
16282 Anchor starting with underscore
16283 !! wikitext
16284 [[#_ref|One]]
16285 !! html
16286 <p><a href="#_ref">One</a>
16287 </p>
16288 !! end
16289
16290 !! test
16291 Id starting with underscore
16292 !! wikitext
16293 <div id="_ref"></div>
16294 !! html
16295 <div id="_ref"></div>
16296
16297 !! end
16298
16299 !! test
16300 Space normalisation on autocomment (bug 22784)
16301 !! options
16302 comment
16303 title=[[Main Page]]
16304 !! wikitext
16305 /* __hello__world__ */
16306 !! html
16307 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16308 !! end
16309
16310 !! test
16311 percent-encoding and + signs in comments (Bug 26410)
16312 !! options
16313 comment
16314 !! wikitext
16315 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16316 !! html
16317 <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>
16318 !! end
16319
16320 !! test
16321 Bad images - basic functionality
16322 !! options
16323 disabled
16324 !! wikitext
16325 [[File:Bad.jpg]]
16326 !! html
16327 !! end
16328
16329 !! test
16330 Bad images - bug 16039: text after bad image disappears
16331 !! options
16332 disabled
16333 !! wikitext
16334 Foo bar
16335 [[File:Bad.jpg]]
16336 Bar foo
16337 !! html
16338 <p>Foo bar
16339 </p><p>Bar foo
16340 </p>
16341 !! end
16342
16343 !! test
16344 Verify that displaytitle works (bug #22501) no displaytitle
16345 !! options
16346 showtitle
16347 !! config
16348 wgAllowDisplayTitle=true
16349 wgRestrictDisplayTitle=false
16350 !! wikitext
16351 this is not the the title
16352 !! html
16353 Parser test
16354 <p>this is not the the title
16355 </p>
16356 !! end
16357
16358 !! test
16359 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16360 !! options
16361 showtitle
16362 title=[[Screen]]
16363 !! config
16364 wgAllowDisplayTitle=true
16365 wgRestrictDisplayTitle=false
16366 !! wikitext
16367 this is not the the title
16368 {{DISPLAYTITLE:whatever}}
16369 !! html
16370 whatever
16371 <p>this is not the the title
16372 </p>
16373 !! end
16374
16375 !! test
16376 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16377 !! options
16378 showtitle
16379 title=[[Screen]]
16380 !! config
16381 wgAllowDisplayTitle=true
16382 wgRestrictDisplayTitle=true
16383 !! wikitext
16384 this is not the the title
16385 {{DISPLAYTITLE:whatever}}
16386 !! html
16387 Screen
16388 <p>this is not the the title
16389 </p>
16390 !! end
16391
16392 !! test
16393 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16394 !! options
16395 showtitle
16396 title=[[Screen]]
16397 !! config
16398 wgAllowDisplayTitle=true
16399 wgRestrictDisplayTitle=true
16400 !! wikitext
16401 this is not the the title
16402 {{DISPLAYTITLE:screen}}
16403 !! html
16404 screen
16405 <p>this is not the the title
16406 </p>
16407 !! end
16408
16409 !! test
16410 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16411 !! options
16412 showtitle
16413 title=[[Screen]]
16414 !! config
16415 wgAllowDisplayTitle=false
16416 !! wikitext
16417 this is not the the title
16418 {{DISPLAYTITLE:screen}}
16419 !! html
16420 Screen
16421 <p>this is not the the title
16422 <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>
16423 </p>
16424 !! end
16425
16426 !! test
16427 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16428 !! options
16429 showtitle
16430 title=[[Screen]]
16431 !! config
16432 wgAllowDisplayTitle=false
16433 !! wikitext
16434 this is not the the title
16435 !! html
16436 Screen
16437 <p>this is not the the title
16438 </p>
16439 !! end
16440
16441 !! test
16442 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16443 !! options
16444 showtitle
16445 title=[[Screen]]
16446 !! config
16447 wgAllowDisplayTitle=true
16448 wgRestrictDisplayTitle=true
16449 !! wikitext
16450 this is not the the title
16451 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16452 !! html
16453 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16454 <p>this is not the the title
16455 </p>
16456 !! end
16457
16458 !! test
16459 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16460 !! options
16461 showtitle
16462 title=[[Screen]]
16463 !! config
16464 wgAllowDisplayTitle=true
16465 wgRestrictDisplayTitle=true
16466 !! wikitext
16467 this is not the the title
16468 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16469 !! html
16470 <span style="color: red;">s</span>creen
16471 <p>this is not the the title
16472 </p>
16473 !! end
16474
16475 !! test
16476 preload: check <noinclude> and <includeonly>
16477 !! options
16478 preload
16479 !! wikitext
16480 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16481 !! html
16482 Hello kind world.
16483 !! end
16484
16485 !! test
16486 preload: check <onlyinclude>
16487 !! options
16488 preload
16489 !! wikitext
16490 Goodbye <onlyinclude>Hello world</onlyinclude>
16491 !! html
16492 Hello world
16493 !! end
16494
16495 !! test
16496 preload: can pass tags through if we want to
16497 !! options
16498 preload
16499 !! wikitext
16500 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16501 !! html
16502 <includeonly>Hello world</includeonly>
16503 !! end
16504
16505 !! test
16506 preload: check that it doesn't try to do tricks
16507 !! options
16508 preload
16509 !! wikitext
16510 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16511 !! html
16512 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16513 !! end
16514
16515 !! test
16516 Play a bit with r67090 and bug 3158
16517 !! options
16518 disabled
16519 !! wikitext
16520 <div style="width:50% !important">&nbsp;</div>
16521 <div style="width:50%&nbsp;!important">&nbsp;</div>
16522 <div style="width:50%&#160;!important">&nbsp;</div>
16523 <div style="border : solid;">&nbsp;</div>
16524 !! html
16525 <div style="width:50% !important">&nbsp;</div>
16526 <div style="width:50% !important">&nbsp;</div>
16527 <div style="width:50% !important">&nbsp;</div>
16528 <div style="border&#160;: solid;">&nbsp;</div>
16529
16530 !! end
16531
16532 !! test
16533 HTML5 data attributes
16534 !! wikitext
16535 <span data-foo="bar">Baz</span>
16536 <p data-abc-def_hij="">Quuz</p>
16537 !! html
16538 <p><span data-foo="bar">Baz</span>
16539 </p>
16540 <p data-abc-def_hij="">Quuz</p>
16541
16542 !! end
16543
16544 !! test
16545 percent-encoding and + signs in internal links (Bug 26410)
16546 !! wikitext
16547 [[User:+%]] [[Page+title%]]
16548 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16549 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16550 [[%33%45]] [[%33%45+]]
16551 !! html
16552 <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>
16553 <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>
16554 <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>
16555 <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>
16556 </p>
16557 !! end
16558
16559 !! test
16560 Special characters in embedded file links (bug 27679)
16561 !! wikitext
16562 [[File:Contains & ampersand.jpg]]
16563 [[File:Does not exist.jpg|Title with & ampersand]]
16564 !! html
16565 <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>
16566 <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>
16567 </p>
16568 !! end
16569
16570
16571 !! test
16572 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16573 !! wikitext
16574 Text&apos;s been normalized?
16575 !! html
16576 <p>Text&#39;s been normalized?
16577 </p>
16578 !! end
16579
16580 !! test
16581 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16582 !! wikitext
16583 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16584 !! html
16585 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16586 </p>
16587 !! end
16588
16589 !! test
16590 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16591 !! wikitext
16592 [http://www.example.org/ ideograms]
16593 !! html
16594 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16595 </p>
16596 !! end
16597
16598 !! test
16599 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16600 !! wikitext
16601 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16602 !! html
16603 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16604 </p>
16605 !! end
16606
16607 !! article
16608 Mediawiki:loop1
16609 !! text
16610 {{Identical|A}}
16611 !! endarticle
16612
16613 !! article
16614 Mediawiki:loop2
16615 !! text
16616 {{Identical|B}}
16617 !! endarticle
16618
16619 !! article
16620 Template:Identical
16621 !! text
16622 {{int:loop1}}
16623 {{int:loop2}}
16624 !! endarticle
16625
16626 !! test
16627 Bug 31098 Template which includes system messages which includes the template
16628 !! wikitext
16629 {{Identical}}
16630 !! html
16631 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16632 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16633 </p>
16634 !! end
16635
16636 !! test
16637 Bug31490 Turkish: ucfirst 'blah'
16638 !! options
16639 language=tr
16640 !! wikitext
16641 {{ucfirst:blah}}
16642 !! html
16643 <p>Blah
16644 </p>
16645 !! end
16646
16647 !! test
16648 Bug31490 Turkish: ucfirst 'ix'
16649 !! options
16650 language=tr
16651 !! wikitext
16652 {{ucfirst:ix}}
16653 !! html
16654 <p>İx
16655 </p>
16656 !! end
16657
16658 !! test
16659 Bug31490 Turkish: lcfirst 'BLAH'
16660 !! options
16661 language=tr
16662 !! wikitext
16663 {{lcfirst:BLAH}}
16664 !! html
16665 <p>bLAH
16666 </p>
16667 !! end
16668
16669 !! test
16670 Bug31490 Turkish: ucfırst (with a dotless i)
16671 !! options
16672 language=tr
16673 !! wikitext
16674 {{ucfırst:blah}}
16675 !! html
16676 <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>
16677 </p>
16678 !! end
16679
16680 !! test
16681 Bug31490 ucfırst (with a dotless i) with English language
16682 !! options
16683 language=en
16684 !! wikitext
16685 {{ucfırst:blah}}
16686 !! html
16687 <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>
16688 </p>
16689 !! end
16690
16691 !! test
16692 Bug 26375: TOC with italics
16693 !! options
16694 title=[[Main Page]]
16695 !! wikitext
16696 __TOC__
16697 == ''Lost'' episodes ==
16698 !! html
16699 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16700 <ul>
16701 <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>
16702 </ul>
16703 </div>
16704
16705 <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>
16706
16707 !! end
16708
16709 !! test
16710 Bug 26375: TOC with bold
16711 !! options
16712 title=[[Main Page]]
16713 !! wikitext
16714 __TOC__
16715 == '''should be bold''' then normal text ==
16716 !! html
16717 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16718 <ul>
16719 <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>
16720 </ul>
16721 </div>
16722
16723 <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>
16724
16725 !! end
16726
16727 !! test
16728 Bug 33845: Headings become cursive in TOC when they contain an image
16729 !! options
16730 title=[[Main Page]]
16731 !! wikitext
16732 __TOC__
16733 == Image [[Image:foobar.jpg]] ==
16734 !! html
16735 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16736 <ul>
16737 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
16738 </ul>
16739 </div>
16740
16741 <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>
16742
16743 !! end
16744
16745 !! test
16746 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
16747 !! options
16748 title=[[Main Page]]
16749 !! wikitext
16750 __TOC__
16751 == <blockquote>Quote</blockquote> ==
16752 !! html
16753 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16754 <ul>
16755 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
16756 </ul>
16757 </div>
16758
16759 <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>
16760
16761 !! end
16762
16763 !! test
16764 Unclosed tags in TOC
16765 !! options
16766 title=[[Main Page]]
16767 !! wikitext
16768 __TOC__
16769 == Proof: 2 < 3 ==
16770 <small>Hanc marginis exiguitas non caperet.</small>
16771 QED
16772 !! html
16773 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16774 <ul>
16775 <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>
16776 </ul>
16777 </div>
16778
16779 <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>
16780 <p><small>Hanc marginis exiguitas non caperet.</small>
16781 QED
16782 </p>
16783 !! end
16784
16785 !! test
16786 Multiple tags in TOC
16787 !! wikitext
16788 __TOC__
16789 == <i>Foo</i> <b>Bar</b> ==
16790
16791 == <i>Foo</i> <blockquote>Bar</blockquote> ==
16792 !! html
16793 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16794 <ul>
16795 <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>
16796 <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>
16797 </ul>
16798 </div>
16799
16800 <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>
16801 <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>
16802
16803 !! end
16804
16805 !! test
16806 Tags with parameters in TOC
16807 !! wikitext
16808 __TOC__
16809 == <sup class="in-h2">Hello</sup> ==
16810
16811 == <sup class="a > b">Evilbye</sup> ==
16812 !! html
16813 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16814 <ul>
16815 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
16816 <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>
16817 </ul>
16818 </div>
16819
16820 <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>
16821 <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>
16822
16823 !! end
16824
16825 !! test
16826 span tags with directionality in TOC
16827 !! wikitext
16828 __TOC__
16829 == <span dir="ltr">C++</span> ==
16830
16831 == <span dir="rtl">זבנג!</span> ==
16832
16833 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
16834
16835 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
16836
16837 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
16838 !! html
16839 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16840 <ul>
16841 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
16842 <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>
16843 <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>
16844 <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>
16845 <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>
16846 </ul>
16847 </div>
16848
16849 <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>
16850 <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>
16851 <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>
16852 <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>
16853 <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>
16854
16855 !! end
16856
16857 !! article
16858 MediaWiki:Bug32057
16859 !! text
16860 == {{int:headline_sample}} ==
16861 !! endarticle
16862
16863 !! test
16864 Bug 32057: Title needed when expanding <h> nodes.
16865 !! options
16866 title=[[Main Page]]
16867 !! wikitext
16868 {{int:Bug32057}}
16869 !! html
16870 <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>
16871
16872 !! end
16873
16874 !! test
16875 Strip marker in urlencode
16876 !! wikitext
16877 {{urlencode:x<nowiki/>y}}
16878 {{urlencode:x<nowiki/>y|wiki}}
16879 {{urlencode:x<nowiki/>y|path}}
16880 !! html
16881 <p>xy
16882 xy
16883 xy
16884 </p>
16885 !! end
16886
16887 !! test
16888 Strip marker in lc
16889 !! wikitext
16890 {{lc:x<nowiki/>y}}
16891 !! html
16892 <p>xy
16893 </p>
16894 !! end
16895
16896 !! test
16897 Strip marker in uc
16898 !! wikitext
16899 {{uc:x<nowiki/>y}}
16900 !! html
16901 <p>XY
16902 </p>
16903 !! end
16904
16905 !! test
16906 Strip marker in formatNum
16907 !! wikitext
16908 {{formatnum:1<nowiki/>2}}
16909 {{formatnum:1<nowiki/>2|R}}
16910 !! html
16911 <p>12
16912 12
16913 </p>
16914 !! end
16915
16916 !! test
16917 Check noCommafy in formatNum
16918 !! options
16919 language=be-tarask
16920 !! wikitext
16921 {{formatnum:123456.78}}
16922 {{formatnum:123456.78|NOSEP}}
16923 !! html
16924 <p>123 456,78
16925 123456.78
16926 </p>
16927 !! end
16928
16929 !! test
16930 Wrong option for formatNum (bug 56199)
16931 !! wikitext
16932 {{formatnum:1,234.56|Random}}
16933 {{formatnum:1,234.56|EVERYTHING}}
16934 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
16935 !! html
16936 <p>1,234.56
16937 1,234.56
16938 1,234.56
16939 </p>
16940 !! end
16941
16942 !! test
16943 Strip marker in grammar
16944 !! options
16945 language=fi
16946 !! wikitext
16947 {{grammar:elative|foo<nowiki/>bar}}
16948 !! html
16949 <p>foobarista
16950 </p>
16951 !! end
16952
16953 !! test
16954 Strip marker in padleft
16955 !! wikitext
16956 {{padleft:|2|x<nowiki/>y}}
16957 !! html
16958 <p>xy
16959 </p>
16960 !! end
16961
16962 !! test
16963 Strip marker in padright
16964 !! wikitext
16965 {{padright:|2|x<nowiki/>y}}
16966 !! html
16967 <p>xy
16968 </p>
16969 !! end
16970
16971 !! test
16972 Strip marker in anchorencode
16973 !! wikitext
16974 {{anchorencode:x<nowiki/>y}}
16975 !! html
16976 <p>xy
16977 </p>
16978 !! end
16979
16980 !! test
16981 nowiki inside link inside heading (bug 18295)
16982 !! wikitext
16983 ==[[foo|x<nowiki>y</nowiki>z]]==
16984 !! html
16985 <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>
16986
16987 !! end
16988
16989 !! test
16990 new support for bdi element (bug 31817)
16991 !! wikitext
16992 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16993 !! html
16994 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16995
16996 !!end
16997
16998 !! test
16999 Ignore pipe between table row attributes
17000 !! wikitext
17001 {|
17002 | quux
17003 |- id=foo | style='color: red'
17004 | bar
17005 |}
17006 !! html
17007 <table>
17008 <tr>
17009 <td> quux
17010 </td></tr>
17011 <tr id="foo" style="color: red">
17012 <td> bar
17013 </td></tr></table>
17014
17015 !! end
17016
17017 !!test
17018 Gallery override link with WikiLink (bug 34852)
17019 !! wikitext
17020 <gallery>
17021 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17022 </gallery>
17023 !! html
17024 <ul class="gallery mw-gallery-traditional">
17025 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17026 <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>
17027 <div class="gallerytext">
17028 <p>caption
17029 </p>
17030 </div>
17031 </div></li>
17032 </ul>
17033
17034 !! end
17035
17036 !!test
17037 Gallery override link with absolute external link (bug 34852)
17038 !! wikitext
17039 <gallery>
17040 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17041 </gallery>
17042 !! html
17043 <ul class="gallery mw-gallery-traditional">
17044 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17045 <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>
17046 <div class="gallerytext">
17047 <p>caption
17048 </p>
17049 </div>
17050 </div></li>
17051 </ul>
17052
17053 !! end
17054
17055 !!test
17056 Gallery override link with malicious javascript (bug 34852)
17057 !! wikitext
17058 <gallery>
17059 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17060 </gallery>
17061 !! html
17062 <ul class="gallery mw-gallery-traditional">
17063 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17064 <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>
17065 <div class="gallerytext">
17066 <p>caption
17067 </p>
17068 </div>
17069 </div></li>
17070 </ul>
17071
17072 !! end
17073
17074 !!test
17075 Gallery with invalid title as link (bug 43964)
17076 !! wikitext
17077 <gallery>
17078 File:foobar.jpg|link=<
17079 </gallery>
17080 !! html
17081 <ul class="gallery mw-gallery-traditional">
17082 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17083 <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>
17084 <div class="gallerytext">
17085 </div>
17086 </div></li>
17087 </ul>
17088
17089 !! end
17090
17091 !!test
17092 Language parser function
17093 !! wikitext
17094 {{#language:ar}}
17095 !! html
17096 <p>العربية
17097 </p>
17098 !! end
17099
17100 !!test
17101 Padleft and padright as substr
17102 !! wikitext
17103 {{padleft:|3|abcde}}
17104 {{padright:|3|abcde}}
17105 !! html
17106 <p>abc
17107 abc
17108 </p>
17109 !! end
17110
17111 !!test
17112 Special parser function
17113 !! wikitext
17114 {{#special:RandomPage}}
17115 {{#special:BaDtItLe}}
17116 {{#special:Foobar}}
17117 !! html
17118 <p>Special:Random
17119 Special:Badtitle
17120 Special:Foobar
17121 </p>
17122 !! end
17123
17124 !!test
17125 Bug 34939 - Case insensitive link parsing ([HttP://])
17126 !! wikitext
17127 [HttP://MediaWiki.Org/]
17128 !! html
17129 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17130 </p>
17131 !! end
17132
17133 !!test
17134 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17135 !! wikitext
17136 [HttP://MediaWiki.Org/ MediaWiki]
17137 !! html
17138 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17139 </p>
17140 !! end
17141
17142 !!test
17143 Bug 34939 - Case insensitive link parsing (HttP://)
17144 !! wikitext
17145 HttP://MediaWiki.Org/
17146 !! html
17147 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17148 </p>
17149 !! end
17150
17151 !!test
17152 Disable TOC
17153 !! options
17154 notoc
17155 !! wikitext
17156 Lead
17157 == Section 1 ==
17158 == Section 2 ==
17159 == Section 3 ==
17160 == Section 4 ==
17161 == Section 5 ==
17162 !! html
17163 <p>Lead
17164 </p>
17165
17166 <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>
17167 <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>
17168 <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>
17169 <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>
17170 <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>
17171
17172 !! end
17173
17174
17175 ###
17176 ### Parsoids-specific tests
17177 ### Parsoid-PHP parser incompatibilities
17178 ###
17179 !!test
17180 1. SOL-sensitive wikitext tokens as template-args
17181 !!options
17182 parsoid=wt2html,wt2wt
17183 !! wikitext
17184 {{echo|*a}}
17185 {{echo|#a}}
17186 {{echo|:a}}
17187 !! html
17188 <span about="#mwt1" typeof="mw:Transclusion">
17189 </span><ul about="#mwt1"><li>a</li>
17190 </ul>
17191 <span about="#mwt2" typeof="mw:Transclusion">
17192 </span><ol about="#mwt2"><li>a</li>
17193 </ol>
17194 <span about="#mwt3" typeof="mw:Transclusion">
17195 </span><dl about="#mwt3"><dd>a</dd>
17196 </dl>
17197 !!end
17198
17199 #### ----------------------------------------------------------------
17200 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17201 #### tags. Parsoid's output for these tags differs from that of the
17202 #### PHP parser.
17203 #### ----------------------------------------------------------------
17204
17205 !!test
17206 Ref: 1. ref-location should be replaced with an index span
17207 !!options
17208 parsoid
17209 !! wikitext
17210 A <ref>foo</ref>
17211 B <ref name="x">foo</ref>
17212 C <ref name="y" />
17213 !! html
17214 <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>
17215 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>
17216 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>
17217 !!end
17218
17219 !!test
17220 Ref: 2. ref-tags with identical names should all get the same index
17221 !!options
17222 parsoid
17223 !! wikitext
17224 A <ref name="x">foo</ref>
17225 B <ref name="x" />
17226 !! html
17227 <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>
17228 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>
17229 !!end
17230
17231 !!test
17232 Ref: 3. spaces in ref-names should be ignored
17233 !!options
17234 parsoid
17235 !! wikitext
17236 A <ref name="x">foo</ref>
17237 B <ref name=" x " />
17238 C <ref name= x />
17239 !! html
17240 <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>
17241 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>
17242 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>
17243 !!end
17244
17245 !!test
17246 Ref: 4. 'constructor' should be accepted as a valid ref-name
17247 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17248 !!options
17249 parsoid
17250 !! wikitext
17251 A <ref name="constructor">foo</ref>
17252 !! html
17253 <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>
17254 !!end
17255
17256 !!test
17257 Ref: 5. body should accept generic wikitext
17258 !!options
17259 parsoid
17260 !! wikitext
17261 A <ref>
17262 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17263 </ref>
17264
17265 <references />
17266 !! html
17267 <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>
17268
17269 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17270 <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>
17271 </li>
17272 </ol>
17273 !!end
17274
17275 !!test
17276 Ref: 6. indent-pres should not be output in ref-body
17277 !!options
17278 parsoid
17279 !! wikitext
17280 A <ref>
17281 foo
17282 bar
17283 baz
17284 </ref>
17285
17286 <references />
17287 !! html
17288 <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>
17289
17290 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17291 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17292 bar
17293 baz
17294 </li>
17295 </ol>
17296 !!end
17297
17298 !!test
17299 Ref: 7. No p-wrapping in ref-body
17300 !!options
17301 parsoid
17302 !! wikitext
17303 A <ref>
17304 foo
17305
17306 bar
17307
17308
17309 baz
17310
17311
17312
17313 booz
17314 </ref>
17315
17316 <references />
17317 !! html
17318 <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>
17319
17320 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17321 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17322
17323 bar
17324
17325
17326 baz
17327
17328
17329
17330 booz
17331 </li>
17332 </ol>
17333 !!end
17334
17335 !!test
17336 Ref: 8. transclusion wikitext has lower precedence
17337 !!options
17338 parsoid
17339 !! wikitext
17340 A <ref> foo {{echo|</ref> B C}}
17341
17342 <references />
17343 !! html
17344 <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>
17345 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17346 <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>
17347 </ol>
17348 !!end
17349
17350 !!test
17351 Ref: 9. unclosed comments should not leak out of ref-body
17352 !!options
17353 parsoid
17354 !! wikitext
17355 A <ref> foo <!--</ref> B C
17356 <references />
17357 !! html
17358 <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>
17359 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17360 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17361 </ol>
17362 !!end
17363
17364 !!test
17365 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17366 !!options
17367 parsoid
17368 !! wikitext
17369 A <ref> <b> foo </ref> B C
17370
17371 <references />
17372 !! html
17373 <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>
17374
17375
17376 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17377 <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>
17378 </ol>
17379 !!end
17380
17381 !!test
17382 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17383 !!options
17384 parsoid
17385 !! wikitext
17386 A <ref>foo</ref> B
17387 C <ref>bar</ref> D
17388 !! html
17389 <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
17390 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>
17391 !!end
17392
17393 !!test
17394 Ref: 12. ref-tags act as trailing newline migration barrier
17395 !!options
17396 parsoid
17397 !! wikitext
17398 <!--the newline at the end of this line moves out of the p-tag-->a
17399
17400 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17401 <ref />
17402
17403 c
17404 !! html
17405 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17406
17407
17408 <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>
17409 <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>
17410
17411
17412 <p>c</p>
17413 !!end
17414
17415 !!test
17416 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17417 !!options
17418 parsoid
17419 !! wikitext
17420 <ref>foo</ref> A
17421 <ref>bar
17422 </ref> B
17423 !! html
17424 <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
17425 <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>
17426 !!end
17427
17428 !!test
17429 Ref: 14. A nested ref-tag should be emitted as plain text
17430 !!options
17431 parsoid
17432 !! wikitext
17433 <ref>foo <ref>bar</ref> baz</ref>
17434
17435 <references />
17436 !! html
17437 <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>
17438
17439 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17440 <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>
17441 </ol>
17442 !!end
17443
17444 !!test
17445 Ref: 15. ref-tags with identical names should get identical indexes
17446 !!options
17447 parsoid
17448 !! wikitext
17449 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17450 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17451
17452 <references />
17453 !! html
17454 <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>
17455 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>
17456
17457 <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>
17458 </ol>
17459 !!end
17460
17461 ## We don't bother wt2wt-ing non-standard whitespace
17462 !!test
17463 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17464 !!options
17465 parsoid=wt2html
17466 !! wikitext
17467 A <ref >foo</ref >
17468
17469 <references />
17470 !! html
17471 <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>
17472
17473 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17474 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17475 !!end
17476
17477 !!test
17478 References: 1. references tag without any refs should be handled properly
17479 !!options
17480 parsoid
17481 !! wikitext
17482 <references />
17483 !! html
17484 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17485 !!end
17486
17487 !!test
17488 References: 2. references tag with group only outputs references from that group
17489 !!options
17490 parsoid
17491 !! wikitext
17492 A <ref group="a">foo</ref>
17493 B <ref group="b">bar</ref>
17494
17495 <references group="a" />
17496 !! html
17497 <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>
17498 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>
17499
17500 <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>
17501 </ol>
17502 !!end
17503
17504 !!test
17505 References: 3. ref list should be cleared after processing references
17506 !!options
17507 parsoid
17508 !! wikitext
17509 A <ref>foo</ref>
17510
17511 <references />
17512
17513 B <ref>bar</ref>
17514
17515 <references />
17516 !! html
17517 <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>
17518
17519 <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>
17520 </ol>
17521
17522 <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>
17523
17524 <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>
17525 </ol>
17526 !!end
17527
17528 !!test
17529 References: 4. only referenced group should be cleared after processing references
17530 !!options
17531 parsoid
17532 !! wikitext
17533 A <ref group="a">afoo</ref>
17534 B <ref>bfoo</ref>
17535
17536 <references group="a" />
17537
17538 C <ref>cfoo</ref>
17539
17540 <references />
17541 !! html
17542 <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>
17543 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>
17544
17545 <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>
17546 </ol>
17547
17548 <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>
17549
17550 <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>
17551 </ol>
17552 !!end
17553
17554 !!test
17555 References: 5. ref tags in references should be processed while ignoring all other content
17556 !!options
17557 parsoid
17558 !! wikitext
17559 A <ref name="a" />
17560 B <ref name="b">bar</ref>
17561
17562 <references>
17563 <ref name="a">foo</ref>
17564 This should just get lost.
17565 </references>
17566 !! html
17567 <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>
17568 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>
17569
17570
17571 <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":{}}'>
17572 <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>
17573 <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>
17574 </ol>
17575 !!end
17576
17577 !!test
17578 References: 6. <references /> from a transclusion
17579 !!options
17580 parsoid
17581 !! wikitext
17582 <ref>Foo</ref> {{echo|<references />}}
17583 !! html
17584 <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>
17585 !!end
17586
17587 !! test
17588 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17589 !! options
17590 parsoid
17591 !! wikitext
17592 A <ref>foo bar for a</ref>
17593 B <ref group="X" name="b" />
17594
17595 <references />
17596
17597 <references group="X">
17598 <ref name="b">foo</ref>
17599 </references>
17600 !! html
17601 <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>
17602 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>
17603
17604 <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>
17605
17606 <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>
17607 !! end
17608
17609 # This test is wt2html only because we're permitting the serializer to produce
17610 # dirty diffs, normalizing the unclosed references to the self-closed version.
17611 !! test
17612 Generate references for unclosed references tag
17613 !! options
17614 parsoid=wt2html
17615 !! wikitext
17616 a<ref>foo</ref>
17617
17618 <references>
17619 !! html
17620 <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>
17621
17622
17623 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17624 <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>
17625 !! end
17626
17627 !! test
17628 New reference serializes on its own line
17629 !! options
17630 parsoid=wt2wt,html2wt
17631 !! wikitext
17632 foo
17633 <references />
17634 !! html
17635 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17636 !! end
17637
17638 #### ----------------------------------------------------------------
17639 #### The following section of tests are primarily to test
17640 #### wikitext escaping capabilities of Parsoid. Given that
17641 #### escaping can be done any number of ways, the wikitext (input)
17642 #### is always adjusted to reflect how Parsoid adds nowiki
17643 #### escape tags.
17644 ####
17645 #### We are marking several tests as parsoid-only since the
17646 #### HTML in the result section is different from what the
17647 #### PHP parser generates for it.
17648 #### ----------------------------------------------------------------
17649
17650
17651 #### --------------- Headings ---------------
17652 #### 0. Unnested
17653 #### 1. Nested inside html <h1>=foo=</h1>
17654 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17655 #### 3. Nested inside html with wikitext split by html tags
17656 #### 4. No escape needed
17657 #### 5. Empty headings <h1></h1>
17658 #### 6. Heading chars in SOL context
17659 #### ----------------------------------------
17660 !! test
17661 Headings: 0. Unnested
17662 !! options
17663 parsoid
17664 !! wikitext
17665 <nowiki>=foo=</nowiki>
17666
17667 <nowiki> =foo= </nowiki>
17668 <!--cmt-->
17669 <nowiki>=foo=</nowiki>
17670
17671 =foo''a''<nowiki>=</nowiki>
17672 !! html
17673 <p><span typeof="mw:Nowiki">=foo=</span></p>
17674
17675 <p><span typeof="mw:Nowiki"> =foo= </span>
17676 <!--cmt-->
17677 <span typeof="mw:Nowiki">=foo=</span></p>
17678
17679 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
17680 !!end
17681
17682 !! test
17683 Headings: 1. Nested inside html
17684 (New headings and existing headings are handled differently)
17685 !! options
17686 parsoid=html2wt
17687 !! wikitext
17688 = =foo= =
17689
17690 == =foo= ==
17691
17692 === =foo= ===
17693
17694 =<nowiki>=foo=</nowiki>=
17695 ==<nowiki>=foo=</nowiki>==
17696 ===<nowiki>=foo=</nowiki>===
17697 ====<nowiki>=foo=</nowiki>====
17698 =====<nowiki>=foo=</nowiki>=====
17699 ======<nowiki>=foo=</nowiki>======
17700
17701 !! html
17702 <h1>=foo=</h1>
17703 <h2>=foo=</h2>
17704 <h3>=foo=</h3>
17705
17706 <h1 data-parsoid='{}'>=foo=</h1>
17707 <h2 data-parsoid='{}'>=foo=</h2>
17708 <h3 data-parsoid='{}'>=foo=</h3>
17709 <h4 data-parsoid='{}'>=foo=</h4>
17710 <h5 data-parsoid='{}'>=foo=</h5>
17711 <h6 data-parsoid='{}'>=foo=</h6>
17712 !!end
17713
17714 !! test
17715 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
17716 !! options
17717 parsoid=html2wt
17718 !! wikitext
17719 = foo =
17720 <nowiki>*</nowiki>bar
17721
17722 = foo =
17723 =bar
17724
17725 = foo =
17726 <nowiki>=bar=</nowiki>
17727 !! html
17728 <h1>foo</h1>*bar
17729 <h1>foo</h1>=bar
17730 <h1>foo</h1>=bar=
17731 !!end
17732
17733 !! test
17734 Headings: 3. Nested inside html with wikitext split by html tags
17735 !! options
17736 parsoid=html2wt
17737 !! wikitext
17738 = ='''bold'''<nowiki>foo=</nowiki> =
17739 !! html
17740 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
17741 !!end
17742
17743 !! test
17744 Headings: 4a. No escaping needed (testing just h1 and h2)
17745 !! options
17746 parsoid=html2wt
17747 !! wikitext
17748 = =foo =
17749
17750 = foo= =
17751
17752 = =foo= =
17753
17754 = =foo= bar =
17755
17756 == =foo ==
17757
17758 == foo= ==
17759
17760 = ''=''foo= =
17761
17762 = <nowiki>=</nowiki> =
17763 !! html
17764 <h1>=foo</h1>
17765 <h1>foo=</h1>
17766 <h1> =foo= </h1>
17767 <h1>=foo= bar</h1>
17768 <h2>=foo</h2>
17769 <h2>foo=</h2>
17770 <h1><i>=</i>foo=</h1>
17771 <h1><span typeof="mw:Nowiki">=</span></h1>
17772 !!end
17773
17774 !! test
17775 Headings: 4b. No escaping needed (inside p-tags)
17776 !! options
17777 parsoid=html2wt
17778 !! wikitext
17779 ===
17780 =foo= x
17781 =foo= <s></s>
17782 !! html
17783 <p>===
17784 =foo= x
17785 =foo= <s></s>
17786 </p>
17787 !!end
17788
17789 !! test
17790 Headings: 5. Empty headings
17791 !! options
17792 parsoid
17793 !! wikitext
17794 =<nowiki/>=
17795
17796 ==<nowiki/>==
17797
17798 ===<nowiki/>===
17799
17800 ====<nowiki/>====
17801
17802 =====<nowiki/>=====
17803
17804 ======<nowiki/>======
17805 !! html
17806 <h1></h1>
17807 <h2></h2>
17808 <h3></h3>
17809 <h4></h4>
17810 <h5></h5>
17811 <h6></h6>
17812 !!end
17813
17814 !! test
17815 Headings: 6a. Heading chars in SOL context (with trailing spaces)
17816 !! options
17817 parsoid
17818 !! wikitext
17819 <nowiki>=a=</nowiki>
17820
17821 <nowiki>=a=</nowiki>
17822
17823 <nowiki>=a=</nowiki>
17824
17825 <nowiki>=a=</nowiki>
17826 !! html
17827 <p>=a=</p>
17828 <p>=a= </p>
17829 <p>=a= </p>
17830 <p>=a= </p>
17831 !!end
17832
17833 !! test
17834 Headings: 6b. Heading chars in SOL context (with trailing newlines)
17835 !! options
17836 parsoid
17837 !! wikitext
17838 <nowiki>=a=
17839 b</nowiki>
17840
17841 <nowiki>=a=
17842 b</nowiki>
17843
17844 <nowiki>=a=
17845 b</nowiki>
17846
17847 <nowiki>=a=
17848 b</nowiki>
17849 !! html
17850 <p>=a=
17851 b</p>
17852 <p>=a=
17853 b</p>
17854 <p>=a=
17855 b</p>
17856 <p>=a=
17857 b</p>
17858 </p>
17859 !!end
17860
17861 !! test
17862 Headings: 6c. Heading chars in SOL context (leading newline break)
17863 !! options
17864 parsoid
17865 !! wikitext
17866 a
17867 <nowiki>=b=</nowiki>
17868 !! html
17869 <p>a
17870 =b=</p>
17871 !!end
17872
17873 !! test
17874 Headings: 6d. Heading chars in SOL context (with interspersed comments)
17875 !! options
17876 parsoid
17877 !! wikitext
17878 <!--c0--><nowiki>=a=</nowiki>
17879
17880 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
17881 !! html
17882 <p><!--c0-->=a=</p>
17883 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
17884 !!end
17885
17886 !! test
17887 Headings: 6d. Heading chars in SOL context (No escaping needed)
17888 !! options
17889 parsoid=html2wt
17890 !! wikitext
17891 =a=<div>b</div>
17892 !! html
17893 =a=<div>b</div>
17894 !!end
17895
17896 #### --------------- Lists ---------------
17897 #### 0. Outside nests (*foo, etc.)
17898 #### 1. Nested inside html <ul><li>*foo</li></ul>
17899 #### 2. Inside definition lists
17900 #### 3. Only bullets at start should be escaped
17901 #### 4. No escapes needed
17902 #### 5. No unnecessary escapes
17903 #### 6. Escape bullets in SOL position
17904 #### 7. Escape bullets in a multi-line context
17905 #### ----------------------------------------
17906
17907 !! test
17908 Lists: 0. Outside nests
17909 !! wikitext
17910 <nowiki>*</nowiki>foo
17911
17912 <nowiki>#</nowiki>foo
17913 !! html
17914 <p>*foo
17915 </p><p>#foo
17916 </p>
17917 !!end
17918
17919 !! test
17920 Lists: 1. Nested inside html
17921 !! wikitext
17922 *<nowiki>*foo</nowiki>
17923
17924 *<nowiki>#foo</nowiki>
17925
17926 *<nowiki>:foo</nowiki>
17927
17928 *<nowiki>;foo</nowiki>
17929
17930 #<nowiki>*foo</nowiki>
17931
17932 #<nowiki>#foo</nowiki>
17933
17934 #<nowiki>:foo</nowiki>
17935
17936 #<nowiki>;foo</nowiki>
17937 !! html
17938 <ul>
17939 <li>*foo
17940 </li>
17941 </ul>
17942 <ul>
17943 <li>#foo
17944 </li>
17945 </ul>
17946 <ul>
17947 <li>:foo
17948 </li>
17949 </ul>
17950 <ul>
17951 <li>;foo
17952 </li>
17953 </ul>
17954 <ol>
17955 <li>*foo
17956 </li>
17957 </ol>
17958 <ol>
17959 <li>#foo
17960 </li>
17961 </ol>
17962 <ol>
17963 <li>:foo
17964 </li>
17965 </ol>
17966 <ol>
17967 <li>;foo
17968 </li>
17969 </ol>
17970
17971 !!end
17972
17973 !! test
17974 Lists: 2. Inside definition lists
17975 !! wikitext
17976 ;<nowiki>;foo</nowiki>
17977
17978 ;<nowiki>:foo</nowiki>
17979
17980 ;<nowiki>:foo</nowiki>
17981 :bar
17982
17983 :<nowiki>:foo</nowiki>
17984 !! html
17985 <dl>
17986 <dt>;foo
17987 </dt>
17988 </dl>
17989 <dl>
17990 <dt>:foo
17991 </dt>
17992 </dl>
17993 <dl>
17994 <dt>:foo
17995 </dt>
17996 <dd>bar
17997 </dd>
17998 </dl>
17999 <dl>
18000 <dd>:foo
18001 </dd>
18002 </dl>
18003
18004 !!end
18005
18006 !! test
18007 Lists: 3. Only bullets at start of text should be escaped
18008 !! wikitext
18009 *<nowiki>*foo*bar</nowiki>
18010
18011 *<nowiki>*foo</nowiki>''it''*bar
18012 !! html
18013 <ul>
18014 <li>*foo*bar
18015 </li>
18016 </ul>
18017 <ul>
18018 <li>*foo<i>it</i>*bar
18019 </li>
18020 </ul>
18021
18022 !!end
18023
18024 !! test
18025 Lists: 4. No escapes needed
18026 !! options
18027 parsoid
18028 !! wikitext
18029 *foo*bar
18030
18031 *''foo''*bar
18032
18033 *[[Foo]]: bar
18034
18035 *[[Foo]]*bar
18036 !! html
18037 <ul>
18038 <li>foo*bar
18039 </li>
18040 </ul>
18041 <ul>
18042 <li><i>foo</i>*bar
18043 </li>
18044 </ul>
18045 <ul>
18046 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18047 </li>
18048 </ul>
18049 <ul>
18050 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18051 </li>
18052 </ul>
18053 !!end
18054
18055 !! test
18056 Lists: 5. No unnecessary escapes
18057 !! wikitext
18058 * bar <span><nowiki>[[foo]]</nowiki></span>
18059
18060 *=bar <span><nowiki>[[foo]]</nowiki></span>
18061
18062 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18063
18064 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18065
18066 *=bar <span>foo]]</span>=
18067
18068 * <s></s>: a
18069 !! html
18070 <ul>
18071 <li> bar <span>[[foo]]</span>
18072 </li>
18073 </ul>
18074 <ul>
18075 <li>=bar <span>[[foo]]</span>
18076 </li>
18077 </ul>
18078 <ul>
18079 <li>[[bar <span>[[foo]]</span>
18080 </li>
18081 </ul>
18082 <ul>
18083 <li>]]bar <span>[[foo]]</span>
18084 </li>
18085 </ul>
18086 <ul>
18087 <li>=bar <span>foo]]</span>=
18088 </li>
18089 </ul>
18090 <ul>
18091 <li> <s></s>: a
18092 </li>
18093 </ul>
18094
18095 !!end
18096
18097 !! test
18098 Lists: 6. Escape bullets in SOL position
18099 !! options
18100 parsoid
18101 !! wikitext
18102 <!--cmt--><nowiki>*foo</nowiki>
18103 !! html
18104 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18105 !!end
18106
18107 !! test
18108 Lists: 7. Escape bullets in a multi-line context
18109 !! wikitext
18110 a
18111 <nowiki>*</nowiki>b
18112 !! html
18113 <p>a
18114 *b
18115 </p>
18116 !!end
18117
18118 #### --------------- HRs ---------------
18119 #### 1. Single line
18120 #### -----------------------------------
18121
18122 !! test
18123 HRs: 1. Single line
18124 !! options
18125 parsoid
18126 !! wikitext
18127 ----<nowiki>----</nowiki>
18128 ----=foo=
18129 ----*foo
18130 !! html
18131 <hr><span typeof="mw:Nowiki">----</span>
18132 <hr>=foo=
18133 <hr>*foo
18134 !! end
18135
18136 #### --------------- Tables ---------------
18137 #### 1a. Simple example
18138 #### 1b. No escaping needed (!foo)
18139 #### 1c. No escaping needed (|foo)
18140 #### 1d. No escaping needed (|}foo)
18141 ####
18142 #### 2a. Nested in td (<td>foo|bar</td>)
18143 #### 2b. Nested in td (<td>foo||bar</td>)
18144 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18145 ####
18146 #### 3a. Nested in th (<th>foo!bar</th>)
18147 #### 3b. Nested in th (<th>foo!!bar</th>)
18148 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18149 ####
18150 #### 4a. Escape -
18151 #### 4b. Escape +
18152 #### 4c. No escaping needed
18153 #### --------------------------------------
18154
18155 !! test
18156 Tables: 1a. Simple example
18157 !! wikitext
18158 <nowiki>{|
18159 |}</nowiki>
18160 !! html
18161 <p>{|
18162 |}
18163 </p>
18164 !! end
18165
18166 !! test
18167 Tables: 1b. No escaping needed
18168 !! wikitext
18169 !foo
18170 !! html
18171 <p>!foo
18172 </p>
18173 !! end
18174
18175 !! test
18176 Tables: 1c. No escaping needed
18177 !! wikitext
18178 |foo
18179 !! html
18180 <p>|foo
18181 </p>
18182 !! end
18183
18184 !! test
18185 Tables: 1d. No escaping needed
18186 !! wikitext
18187 |}foo
18188 !! html
18189 <p>|}foo
18190 </p>
18191 !! end
18192
18193 !! test
18194 Tables: 2a. Nested in td
18195 !! options
18196 parsoid=html2wt
18197 !! wikitext
18198 {|
18199 |<nowiki>foo|bar</nowiki>
18200 |-
18201 |x<div><nowiki>a|b</nowiki></div>
18202 |}
18203 !! html
18204 <table><tbody><tr>
18205 <td>foo|bar</td></tr>
18206 <tr><td>x<div>a|b</div></td>
18207 </tbody></table>
18208 !! end
18209
18210 !! test
18211 Tables: 2b. Nested in td
18212 !! options
18213 parsoid
18214 !! wikitext
18215 {|
18216 |<nowiki>foo||bar</nowiki>
18217 |''it''<nowiki>foo||bar</nowiki>
18218 |}
18219 !! html
18220 <table><tbody><tr>
18221 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18222 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18223 !! end
18224
18225 !! test
18226 Tables: 2c. Nested in td -- no escaping needed
18227 !! options
18228 parsoid
18229 !! wikitext
18230 {|
18231 |foo!!bar
18232 |}
18233 !! html
18234 <table><tbody><tr><td>foo!!bar
18235 </td></tr></tbody></table>
18236
18237 !! end
18238
18239 !! test
18240 Tables: 3a. Nested in th
18241 !! options
18242 parsoid
18243 !! wikitext
18244 {|
18245 !foo!bar
18246 |}
18247 !! html
18248 <table><tbody><tr><th>foo!bar
18249 </th></tr></tbody></table>
18250
18251 !! end
18252
18253 !! test
18254 Tables: 3b. Nested in th
18255 !! options
18256 parsoid
18257 !! wikitext
18258 {|
18259 !<nowiki>foo!!bar</nowiki>
18260 |}
18261 !! html
18262 <table>
18263 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18264 </tbody></table>
18265 !! end
18266
18267 !! test
18268 Tables: 3c. Nested in th -- no escaping needed
18269 !! options
18270 parsoid
18271 !! wikitext
18272 {|
18273 !<nowiki>foo||bar</nowiki>
18274 |}
18275 !! html
18276 <table><tbody><tr>
18277 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18278 !! end
18279
18280 !! test
18281 Tables: 4a. Escape -
18282 !! options
18283 parsoid
18284 !! wikitext
18285 {|
18286 !-bar
18287 |-
18288 |<nowiki>-bar</nowiki>
18289 |}
18290 !! html
18291 <table><tbody>
18292 <tr><th>-bar</th></tr>
18293 <tr>
18294 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18295 !! end
18296
18297 !! test
18298 Tables: 4b. Escape +
18299 !! options
18300 parsoid
18301 !! wikitext
18302 {|
18303 !+bar
18304 |-
18305 |<nowiki>+bar</nowiki>
18306 |}
18307 !! html
18308 <table><tbody>
18309 <tr><th>+bar</th></tr>
18310 <tr>
18311 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18312 !! end
18313
18314 !! test
18315 Tables: 4c. No escaping needed
18316 !! options
18317 parsoid
18318 !! wikitext
18319 {|
18320 |foo-bar
18321 |foo+bar
18322 |-
18323 |''foo''-bar
18324 |''foo''+bar
18325 |-
18326 |foo
18327 bar|baz
18328 +bar
18329 -bar
18330 |-
18331 |x
18332 <div>a|b</div>
18333 |}
18334 !! html
18335 <table><tbody>
18336 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18337 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18338 <tr><td>foo
18339 <p>bar|baz
18340 +bar
18341 -bar</p></td></tr>
18342 <tr><td>x
18343 <div>a|b</div></td>
18344 </tbody></table>
18345 !! end
18346
18347 !! test
18348 Tables: 4d. No escaping needed
18349 !! options
18350 parsoid
18351 !! wikitext
18352 {|
18353 |[[Foo]]-bar
18354 ||+1
18355 ||-2
18356 |}
18357 !! html
18358 <table>
18359 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18360 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18361 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18362 </tbody></table>
18363 !! end
18364
18365 !! test
18366 Tables: Digest broken attributes on table and tr tag
18367 !! options
18368 parsoid=wt2html
18369 !! wikitext
18370 {| || |} ++
18371 |- || || ++ --
18372 |- > [
18373 |}
18374 !! html
18375 <table>
18376 <tbody>
18377 <tr></tr>
18378 <tr></tr>
18379 </tbody></table>
18380 !! end
18381
18382 #### --------------- Links ----------------
18383 #### 1. Quote marks in link text
18384 #### 2. Wikilinks: Escapes needed
18385 #### 3. Wikilinks: No escapes needed
18386 #### 4. Extlinks: Escapes needed
18387 #### 5. Extlinks: No escapes needed
18388 #### --------------------------------------
18389 !! test
18390 Links 1. Quote marks in link text
18391 !! options
18392 parsoid
18393 !! wikitext
18394 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18395 !! html
18396 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18397 !! end
18398
18399 !! test
18400 Links 2. WikiLinks: Escapes needed
18401 !! options
18402 parsoid
18403 !! wikitext
18404 [[Foo|[Foobar]]]
18405 [[Foo|<nowiki>Foobar]</nowiki>]]
18406 [[Foo|x [Foobar] x]]
18407 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18408 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18409 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18410 [[Foo|<nowiki>|Bar</nowiki>]]
18411 [[Foo|<nowiki>]]bar</nowiki>]]
18412 [[Foo|<nowiki>[[bar</nowiki>]]
18413 [[Foo|<nowiki>x [[ y</nowiki>]]
18414 [[Foo|<nowiki>x ]] y</nowiki>]]
18415 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18416 !! html
18417 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18418 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18419 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18420 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18421 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18422 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18423 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18424 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18425 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18426 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18427 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18428 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18429 !! end
18430
18431 !! test
18432 Links 3. WikiLinks: No escapes needed
18433 !! options
18434 parsoid
18435 !! wikitext
18436 [[Foo|[Foobar]]
18437 [[Foo|foo|bar]]
18438 !! html
18439 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18440 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18441 !! end
18442
18443 !! test
18444 Links 4. ExtLinks: Escapes needed
18445 !! options
18446 parsoid
18447 !! wikitext
18448 [http://google.com <nowiki>[google]</nowiki>]
18449 [http://google.com <nowiki>google]</nowiki>]
18450
18451 <nowiki>[http://google.com]</nowiki>
18452
18453 <nowiki>[http://google.com google]</nowiki>
18454
18455 !! html
18456 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18457 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18458 <p>[http://google.com]</p>
18459 <p>[http://google.com google]</p>
18460 !! end
18461
18462 !! test
18463 Links 5. ExtLinks: No escapes needed
18464 !! options
18465 parsoid
18466 !! wikitext
18467 [http://google.com [google]
18468 !! html
18469 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18470 !! end
18471
18472 #### --------------- Quotes ---------------
18473 #### 1. Quotes inside <b> and <i>
18474 #### 2. Link fragments separated by <i> and <b> tags
18475 #### 3. Link fragments inside <i> and <b>
18476 #### 4. No escaping needed
18477 #### --------------------------------------
18478 !! test
18479 1. Quotes inside <b> and <i>
18480 !! options
18481 parsoid=html2wt,wt2wt
18482 !! wikitext
18483 ''<nowiki>'foo'</nowiki>''
18484 ''<nowiki>''foo''</nowiki>''
18485 ''<nowiki>'''foo'''</nowiki>''
18486 ''foo''<nowiki/>'s
18487 '''<nowiki>'foo'</nowiki>'''
18488 '''<nowiki>''foo''</nowiki>'''
18489 '''<nowiki>'''foo'''</nowiki>'''
18490 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18491 '''foo'''<nowiki/>'s
18492 '''foo''
18493 ''foo''<nowiki/>'
18494 '<nowiki/>''foo''<nowiki/>'
18495 ''''foo'''
18496 '''foo'''<nowiki/>'
18497 '<nowiki/>'''foo'''<nowiki/>'
18498 ''fools'<span> errand</span>''
18499 ''<span>fool</span>'s errand''
18500 !! html
18501 <p><i>'foo'</i>
18502 <i>''foo''</i>
18503 <i>'''foo'''</i>
18504 <i>foo</i>'s
18505 <b>'foo'</b>
18506 <b>''foo''</b>
18507 <b>'''foo'''</b>
18508 <b>foo'<i>bar'</i>baz</b>
18509 <b>foo</b>'s
18510 '<i>foo</i>
18511 <i>foo</i>'
18512 '<i>foo</i>'
18513 '<b>foo</b>
18514 <b>foo</b>'
18515 '<b>foo</b>'</p>
18516 <i>fools'<span> errand</span></i>
18517 <i><span>fool</span>'s errand</i>
18518 !! end
18519
18520 !! test
18521 2. Link fragments separated by <i> and <b> tags
18522 !! wikitext
18523 [[''foo''<nowiki>hello]]</nowiki>
18524
18525 [['''foo'''<nowiki>hello]]</nowiki>
18526 !! html
18527 <p>[[<i>foo</i>hello]]
18528 </p><p>[[<b>foo</b>hello]]
18529 </p>
18530 !! end
18531
18532 !! test
18533 3. Link fragments inside <i> and <b>
18534 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18535 this is one of the shortcomings of this format)
18536 !! wikitext
18537 ''[[foo''<nowiki>]]</nowiki>
18538
18539 '''[[foo'''<nowiki>]]</nowiki>
18540 !! html
18541 <p><i>[[foo</i>]]
18542 </p><p><b>[[foo</b>]]
18543 </p>
18544 !! end
18545
18546 !! test
18547 4. No escaping needed
18548 !! wikitext
18549 '<span>''bar''</span>'
18550 '<span>'''bar'''</span>'
18551 !! html
18552 <p>'<span><i>bar</i></span>'
18553 '<span><b>bar</b></span>'
18554 </p>
18555 !! end
18556
18557 #### ----------- Paragraphs ---------------
18558 #### 1. No unnecessary escapes
18559 #### --------------------------------------
18560
18561 !! test
18562 1. No unnecessary escapes
18563 !! wikitext
18564 bar <span><nowiki>[[foo]]</nowiki></span>
18565
18566 =bar <span><nowiki>[[foo]]</nowiki></span>
18567
18568 [[bar <span><nowiki>[[foo]]</nowiki></span>
18569
18570 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18571
18572 =bar <span>foo]]</span><nowiki>=</nowiki>
18573 !! html
18574 <p>bar <span>[[foo]]</span>
18575 </p><p>=bar <span>[[foo]]</span>
18576 </p><p>[[bar <span>[[foo]]</span>
18577 </p><p>]]bar <span>[[foo]]</span>
18578 </p><p>=bar <span>foo]]</span>=
18579 </p>
18580 !!end
18581
18582 #### ----------------------- PRE --------------------------
18583 #### 1. Leading whitespace in SOL context should be escaped
18584 #### ------------------------------------------------------
18585 !! test
18586 1. Leading whitespace in SOL context should be escaped
18587 !! options
18588 parsoid
18589 !! wikitext
18590 <nowiki> </nowiki>a
18591
18592 <nowiki> </nowiki> a
18593
18594 <nowiki> </nowiki>a(tab)
18595
18596 <nowiki> </nowiki> a
18597 <!--cmt-->
18598 <nowiki> </nowiki> a
18599
18600 a
18601 <nowiki> </nowiki>b
18602
18603 a
18604 <nowiki> </nowiki>b
18605
18606 a
18607 <nowiki> </nowiki> b
18608 !! html
18609 <p> a</p>
18610 <p> a</p>
18611 <p> a(tab)</p>
18612 <p> a</p>
18613 <p><!--cmt--> a</p>
18614 <p>a
18615 b</p>
18616 <p>a
18617 b</p>
18618 <p>a
18619 b</p>
18620 !! end
18621
18622 #### --------------- Behavior Switches --------------------
18623 !! test
18624 1. Valid behavior switches should be escaped
18625 !! options
18626 parsoid=html2wt
18627 !! wikitext
18628 <nowiki>__TOC__</nowiki>
18629 !! html
18630 __TOC__
18631 !! end
18632
18633 !! test
18634 2. Invalid behavior switches should not be escaped
18635 !! options
18636 parsoid=html2wt
18637 !! wikitext
18638 __TOO__
18639 __|__
18640 !! html
18641 __TOO__
18642 __|__
18643 !! end
18644
18645 #### --------------- HTML tags ---------------
18646 #### 1. a tags
18647 #### 2. other tags
18648 #### 3. multi-line html tag
18649 #### 4. extension tags
18650 #### -----------------------------------------
18651 !! test
18652 1. a tags
18653 !! options
18654 parsoid
18655 !! wikitext
18656 <a href="http://google.com">google</a>
18657 !! html
18658 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18659 !! end
18660
18661 !! test
18662 2. other tags
18663 !! wikitext
18664 <nowiki><div>foo</div>
18665 <div style="color:red">foo</div></nowiki>
18666 !! html
18667 <p>&lt;div&gt;foo&lt;/div&gt;
18668 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18669 </p>
18670 !! end
18671
18672 !! test
18673 3. multi-line html tag
18674 !! wikitext
18675 <nowiki><div
18676 >foo</div
18677 ></nowiki>
18678 !! html
18679 <p>&lt;div
18680 &gt;foo&lt;/div
18681 &gt;
18682 </p>
18683 !! end
18684
18685 !! test
18686 4. extension tags
18687 !! wikitext
18688 <nowiki><ref>foo</ref></nowiki>
18689
18690 <nowiki><ref>bar</nowiki>
18691
18692 baz<nowiki></ref></nowiki>
18693 !! html
18694 <p>&lt;ref&gt;foo&lt;/ref&gt;
18695 </p><p>&lt;ref&gt;bar
18696 </p><p>baz&lt;/ref&gt;
18697 </p>
18698 !! end
18699
18700 #### --------------- Others ---------------
18701 !! test
18702 Escaping nowikis
18703 !! wikitext
18704 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18705 !! html
18706 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18707 </p>
18708 !! end
18709
18710 ## The quote-char in the input is necessary for triggering the bug
18711 !! test
18712 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18713 !! options
18714 parsoid=wt2wt,html2wt
18715 !! wikitext
18716 foo's bar :
18717 !! html
18718 <p>foo's bar :</p>
18719 !! end
18720
18721 !! test
18722
18723 Tag-like HTML structures are passed through as text
18724 !! wikitext
18725 <x y>
18726
18727 <x.y>
18728
18729 <x-y>
18730
18731 1>2
18732
18733 x<y
18734
18735 a>b
18736
18737 1<d e>f
18738 !! html
18739 <p>&lt;x y&gt;
18740 </p><p>&lt;x.y&gt;
18741 </p><p>&lt;x-y&gt;
18742 </p><p>1&gt;2
18743 </p><p>x&lt;y
18744 </p><p>a&gt;b
18745 </p><p>1&lt;d e&gt;f
18746 </p>
18747 !! end
18748
18749
18750 # This was a bug in the PHP parser (see bug 17663 and its dups,
18751 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
18752 !! test
18753 Tag names followed by punctuation should not be recognized as tags
18754 !! wikitext
18755 <s.ome> text
18756 !! html
18757 <p>&lt;s.ome&gt; text
18758 </p>
18759 !! end
18760
18761 !! test
18762 HTML tag with necessary entities in attributes
18763 !! wikitext
18764 <span title="&amp;amp;">foo</span>
18765 !! html
18766 <p><span title="&amp;amp;">foo</span>
18767 </p>
18768 !! end
18769
18770 !! test
18771 HTML tag with 'unnecessary' entity encoding in attributes
18772 !! wikitext
18773 <span title="&amp;">foo</span>
18774 !! html
18775 <p><span title="&amp;">foo</span>
18776 </p>
18777 !! end
18778
18779 !! test
18780 HTML tag with broken attribute value quoting
18781 !! wikitext
18782 <span title="Hello world>Foo</span>
18783 !! html
18784 <p><span>Foo</span>
18785 </p>
18786 !! end
18787
18788 !! test
18789 Parsoid-only: HTML tag with broken attribute value quoting
18790 !! options
18791 parsoid
18792 !! wikitext
18793 <span title="Hello world>Foo</span>
18794 !! html
18795 <p><span title="Hello world">Foo</span>
18796 </p>
18797 !! end
18798
18799 !! test
18800 Table with broken attribute value quoting
18801 !! wikitext
18802 {|
18803 | title="Hello world|Foo
18804 |}
18805 !! html
18806 <table>
18807 <tr>
18808 <td>Foo
18809 </td></tr></table>
18810
18811 !! end
18812
18813 !! test
18814 Table with broken attribute value quoting on consecutive lines
18815 !! wikitext
18816 {|
18817 | title="Hello world|Foo
18818 | style="color:red|Bar
18819 |}
18820 !! html
18821 <table>
18822 <tr>
18823 <td>Foo
18824 </td>
18825 <td>Bar
18826 </td></tr></table>
18827
18828 !! end
18829
18830 !! test
18831 Parsoid-only: Table with broken attribute value quoting on consecutive lines
18832 !! options
18833 parsoid
18834 !! wikitext
18835 {|
18836 | title="Hello world|Foo
18837 | style="color:red|Bar
18838 |}
18839 !! html
18840 <table><tbody>
18841 <tr>
18842 <td title="Hello world">Foo
18843 </td><td style="color: red">Bar
18844 </td></tr></tbody></table>
18845
18846 !! end
18847
18848 !! test
18849 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
18850 !! options
18851 parsoid
18852 !! wikitext
18853 {{}}
18854 !! html
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 Accept empty td cell attribute
18870 !! wikitext
18871 {|
18872 | align="center" | foo || |
18873 |}
18874 !! html
18875 <table>
18876 <tr>
18877 <td align="center"> foo </td>
18878 <td>
18879 </td></tr></table>
18880
18881 !!end
18882
18883 !!test
18884 Non-empty attributes in th-cells
18885 !! wikitext
18886 {|
18887 ! Foo !! style="color: red" | Bar
18888 |}
18889 !! html
18890 <table>
18891 <tr>
18892 <th> Foo </th>
18893 <th style="color: red"> Bar
18894 </th></tr></table>
18895
18896 !!end
18897
18898 !!test
18899 Accept empty attributes in th-cells
18900 !! wikitext
18901 {|
18902 !| foo !!| bar
18903 |}
18904 !! html
18905 <table>
18906 <tr>
18907 <th> foo </th>
18908 <th> bar
18909 </th></tr></table>
18910
18911 !!end
18912
18913 !!test
18914 Empty table rows go away
18915 !! wikitext
18916 {|
18917 | Hello
18918 | there
18919 |- class="foo"
18920 |-
18921 |}
18922 !! html
18923 <table>
18924 <tr>
18925 <td> Hello
18926 </td>
18927 <td> there
18928 </td></tr>
18929
18930 </table>
18931
18932 !! end
18933
18934 ###
18935 ### Parsoid-centric tests for testing RTing of inter-element separators
18936 ### Edge cases not tested by existing parser tests and specific to
18937 ### Parsoid-specific serialization strategies.
18938 ###
18939
18940 !!test
18941 RT-ed inter-element separators should be valid separators
18942 !! wikitext
18943 {|
18944 |- [[foo]]
18945 |}
18946 !! html
18947 <table>
18948
18949 </table>
18950
18951 !!end
18952
18953 !!test
18954 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
18955 (Parsoid-only since PHP parser relies on Tidy for correct output)
18956 !!options
18957 parsoid
18958 !! wikitext
18959 {|
18960 |<small>foo
18961 bar
18962 |}
18963
18964 {|
18965 |<small>foo<small>
18966 |}
18967 !! html
18968 !!end
18969
18970 !!test
18971 Empty TD followed by TD with tpl-generated attribute
18972 !! wikitext
18973 {|
18974 |-
18975 |
18976 |{{echo|style='color:red'}}|foo
18977 |}
18978 !! html
18979 <table>
18980
18981 <tr>
18982 <td>
18983 </td>
18984 <td>foo
18985 </td></tr></table>
18986
18987 !!end
18988
18989 !!test
18990 Indented table with an empty td
18991 !! wikitext
18992 {|
18993 |-
18994 |
18995 |foo
18996 |}
18997 !! html
18998 <table>
18999
19000 <tr>
19001 <td>
19002 </td>
19003 <td>foo
19004 </td></tr></table>
19005
19006 !!end
19007
19008 !!test
19009 Empty TR followed by a template-generated TR
19010 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19011 !!options
19012 parsoid
19013 !! wikitext
19014 {|
19015 |-
19016 {{echo|<tr><td>foo</td></tr>}}
19017 |}
19018 !! html
19019 <table>
19020 <tbody>
19021 <tr></tr>
19022 <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}}]}'>
19023 <td>foo</td></tr>
19024 </tbody></table>
19025 !!end
19026
19027 ## PHP and parsoid output differ for this, and since this is primarily
19028 ## for testing Parsoid's serializer, marking this Parsoid only
19029 !!test
19030 Empty TR followed by mixed-ws-comment line should RT correctly
19031 !!options
19032 parsoid
19033 !! wikitext
19034 {|
19035 |-
19036 <!--c-->
19037 |-
19038 <!--c--> <!--d-->
19039 |}
19040 !! html
19041 <table>
19042 <tbody>
19043 <tr></tr>
19044 <!--c-->
19045 <tr>
19046 <!--c--> </tr><!--d-->
19047 </tbody></table>
19048
19049 !!end
19050
19051 !!test
19052 Multi-line image caption generated by templates with/without trailing newlines
19053 !!options
19054 parsoid
19055 !! wikitext
19056 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19057 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19058 !! html
19059 <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>
19060 <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>
19061
19062 !!end
19063
19064 ## PHP emits broken html for this, and since this is primarily
19065 ## a Parsoid serializer test, marking this Parsoid only
19066 !!test
19067 Improperly nested inline or quotes tags with whitespace in between
19068 !!options
19069 parsoid
19070 !! wikitext
19071 <span> <s>x</span> </s>
19072 ''' ''x''' ''
19073 !! html
19074 <p><span> <s>x</s></span><s> </s>
19075 <b> <i>x</i></b><i> </i>
19076 </p>
19077 !!end
19078
19079 !!test
19080 Encapsulate protected attributes from wt
19081 !!options
19082 parsoid
19083 !! wikitext
19084 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19085 !! html
19086 <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>
19087 </body>
19088 !!end
19089
19090 ## Currently the p-wrapper is fragile in how adds / removes transformations.
19091 ## Having nested or stray pre tags results in the attempt to add duplicates,
19092 ## causing an assertion fail. This test tries to prevent that situation.
19093 !!test
19094 Ensure ParagraphWrapper can deal with stray closing pre tags
19095 !!options
19096 parsoid=wt2html
19097 !! wikitext
19098 plain text</pre>
19099 !! html
19100 plain text
19101 !!end
19102
19103 !!test
19104 1. Ensure fostered text content is wrapped in spans
19105 !!options
19106 parsoid=wt2html
19107 !! wikitext
19108 <table>hi</table><table>ho</table>
19109 !! html
19110 <span>hi</span>
19111 <table></table>
19112 <span>ho</span>
19113 <table></table>
19114 !!end
19115
19116 !!test
19117 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19118 !!options
19119 parsoid=wt2html,wt2wt
19120 !! wikitext
19121 <table>
19122 <tr> || ||
19123 <td> a
19124 </table>
19125 !! html
19126 <span> || ||</span>
19127 <table>
19128 <tbody>
19129 <tr>
19130 <td> a</td></tr>
19131 </tbody></table>
19132 !!end
19133
19134 !!test
19135 Encapsulation properly handles null DSR information from foster box
19136 !!options
19137 parsoid=wt2html,wt2wt
19138 !! wikitext
19139 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19140 !! html
19141 <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;
19142 <table>foo
19143 <tr>
19144 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19145 <table>
19146 <tbody>
19147 <tr>
19148 <td>bar</td></tr></tbody></table>
19149 !!end
19150
19151 !!test
19152 1. Encapsulate foster-parented transclusion content
19153 !!options
19154 parsoid=wt2wt,wt2html
19155 !! wikitext
19156 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19157 !! html
19158 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19159 <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
19160 <tr>
19161 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19162 <table>
19163 <tbody>
19164 <tr>
19165 <td>bar</td></tr></tbody></table>
19166 !!end
19167
19168 !!test
19169 2. Encapsulate foster-parented transclusion content
19170 !!options
19171 parsoid=wt2wt,wt2html
19172 !! wikitext
19173 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19174 !! html
19175 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19176 <table>
19177 <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>
19178 <tr>
19179 <td>bar</td></tr></table>&quot;]}">foo</div>
19180 <table>
19181 <tbody>
19182 <tr>
19183 <td>bar</td></tr></tbody></table>
19184 !!end
19185
19186 !!test
19187 3. Encapsulate foster-parented transclusion content
19188 !!options
19189 parsoid=wt2wt,wt2html
19190 !! wikitext
19191 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19192 !! html
19193 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19194 <table>
19195 <div>
19196 <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>
19197 <tr>
19198 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19199 <p>foo</p></div>
19200 <table>
19201 <tbody>
19202 <tr>
19203 <td>bar</td></tr></tbody></table>
19204 !!end
19205
19206 !!test
19207 4. Encapsulate foster-parented transclusion content
19208 !!options
19209 parsoid=wt2wt,wt2html
19210 !! wikitext
19211 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19212 !! html
19213 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19214 <table>
19215 <div>
19216 <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>
19217 <tr>
19218 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19219 <p>foo</p></div>
19220 <table>
19221 <tbody>
19222 <tr>
19223 <td>bar</td></tr></tbody></table>
19224 !!end
19225
19226 !!test
19227 5. Encapsulate foster-parented transclusion content
19228 !!options
19229 parsoid=wt2wt,wt2html
19230 !! wikitext
19231 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19232 !! html
19233 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19234 <table>
19235 <tr>
19236 <td>
19237 <div>
19238 <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>
19239 <table>
19240 <tbody>
19241 <tr>
19242 <td>
19243 <div>
19244 <p>foo</p></div></td></tr></tbody></table>
19245 !!end
19246
19247 !!test
19248 6. Encapsulate foster-parented transclusion content
19249 !!options
19250 parsoid=wt2wt,wt2html
19251 !! wikitext
19252 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19253 !! html
19254 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19255 <table>
19256 <tr>
19257 <td>
19258 <div>
19259 <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>
19260 <table>
19261 <tbody>
19262 <tr>
19263 <td>
19264 <div>
19265 <p>foo</p></div></td></tr></tbody></table>
19266 <p>ok</p>
19267 !!end
19268
19269 !!test
19270 7. Encapsulate foster-parented transclusion content
19271 !!options
19272 parsoid=wt2wt,wt2html
19273 !! wikitext
19274 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19275 !! html
19276 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19277 <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;
19278 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19279 <td>bar</td></table>&quot;]}">foo</p>
19280 <table>
19281 <tbody>
19282 <tr>
19283 <td>bar</td></tr></tbody></table>
19284 !!end
19285
19286 !!test
19287 8. Encapsulate foster-parented transclusion content
19288 !!options
19289 parsoid=wt2wt,wt2html
19290 !! wikitext
19291 {{echo|a
19292 }}{|{{echo|style='color:red'}}
19293 |-
19294 |b
19295 |}
19296 !! html
19297 <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>
19298 <table>
19299 <tbody>
19300 <tr>
19301 <td>b</td></tr></tbody></table>
19302 !!end
19303
19304 !!test
19305 Table in fosterable position
19306 !!options
19307 parsoid=wt2html,wt2wt
19308 !! wikitext
19309 {{OpenTable}}
19310 <div>
19311 {|
19312 |}
19313 </div>
19314 |}
19315 !! html
19316 <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="{}">
19317 </span>
19318 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19319
19320 <table>
19321 </table>
19322 !!end
19323
19324 !!test
19325 Support <object> element with .data attribute
19326 !!options
19327 parsoid=html2wt
19328 !! wikitext
19329 <object data="test.swf"></object>
19330 !! html
19331 <object data="test.swf"></object>
19332 !!end
19333
19334 # -----------------------------------------------------------------
19335 # The following section of tests are primarily to spec requirements
19336 # around serialization of new/edited content.
19337 #
19338 # All these tests are marked Parsoid html2wt and html2html only
19339 # ----------------------------------------------------------------
19340
19341 !! test
19342 Image: Modifying size of an image (1)
19343 !! options
19344 parsoid=html2wt
19345 !! wikitext
19346 [[Image:Foobar.jpg|200x200px]]
19347 !! html
19348 <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>
19349 !!end
19350
19351 !! test
19352 Image: Modifying size of an image (2)
19353 !! options
19354 parsoid=html2wt
19355 !! wikitext
19356 [[Image:Foobar.jpg|500x500px]]
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="100" width="500" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"26","width":"230"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
19359 !!end
19360
19361 # note that the data-parsoid value conflicts with the figure's class
19362 !! test
19363 Image: Modifying alignment of an image (bug 48665)
19364 !! options
19365 parsoid=html2wt
19366 !! wikitext
19367 [[Image:Foobar.jpg|thumb|caption|left]]
19368 !! html
19369 <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>
19370 !! end
19371
19372 !! test
19373 Image: Modifying valign of an image (bug 49221)
19374 !! options
19375 parsoid=html2wt
19376 !! wikitext
19377 [[File:Foobar.jpg|20px|text-top]]
19378 !! html
19379 <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>
19380 !! end
19381
19382 !! test
19383 Image: Modifying alt attribute of an image (bug 56400)
19384 !! options
19385 parsoid=html2wt
19386 !! wikitext
19387 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19388 !! html
19389 <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>
19390 !!end
19391
19392 !! test
19393 Image: Modifying caption of an image
19394 !! options
19395 parsoid=html2wt
19396 !! wikitext
19397 [[Image:Foobar.jpg|thumb|new caption]]
19398 !! html
19399 <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>
19400 !!end
19401
19402 !! test
19403 Image: empty alt attribute (bug 48924)
19404 !! options
19405 parsoid
19406 !! wikitext
19407 [[File:Foobar.jpg|thumb|alt=|bar]]
19408 !! html
19409 <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>
19410 !! end
19411
19412 #!! test
19413 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19414 #!! options
19415 #parsoid=html2wt
19416 #language=ar
19417 #!! input
19418 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19419 #!! result
19420 #<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>
19421 #!! end
19422
19423 !! test
19424 Image: Block level image should have \n before and after
19425 !! options
19426 parsoid
19427 !! wikitext
19428 123
19429 [[File:Foobar.jpg|right|thumb|150x150px]]
19430 456
19431 !! html
19432 <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>
19433 !!end
19434
19435 !! test
19436 Image: New block level image should have \n before and after (existing
19437 content)
19438 !! options
19439 parsoid
19440 !! wikitext
19441 123
19442 [[File:Foobar.jpg|right|thumb|150x150px]]
19443 456
19444 !! html
19445 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19446 <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>
19447 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19448 !!end
19449
19450 !! test
19451 Images: upright option (parsoid)
19452 !! options
19453 parsoid
19454 !! wikitext
19455 [[File:Foobar.jpg|thumb|upright|caption]]
19456 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19457 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19458 !! html
19459 <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>
19460 !!end
19461
19462 !! test
19463 Images: upright option is ignored on inline and frame images (parsoid)
19464 !! options
19465 parsoid
19466 !! wikitext
19467 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19468 !! html
19469 <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>
19470 !!end
19471
19472 !! test
19473 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19474 !! options
19475 parsoid=html2wt
19476 !! wikitext
19477 * foo
19478 !! html
19479 <ul>
19480 <li><p>foo</p></li>
19481 </ul>
19482 !! end
19483
19484 !! test
19485 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19486 !! options
19487 parsoid=html2wt
19488 !! wikitext
19489 * foo
19490 !! html
19491 <ul> <li>foo</li></ul>
19492 !! end
19493
19494 !! test
19495 Don't strip leading whitespace when handling indent-pre suppressing tags
19496 !! options
19497 parsoid=html2wt
19498 !! wikitext
19499 {|
19500 | indented row
19501 |}
19502 <blockquote>
19503 '''This is very bold of you!'''
19504
19505 {|
19506 |
19507 indented cell (no pre-wrapping!)
19508 |}
19509 </blockquote>
19510 foo
19511 <div>bar</div>
19512 !! html
19513 <table>
19514 <tr><td> indented row</td></tr>
19515 </table>
19516 <blockquote><p>
19517 <b>This is very bold of you!</b>
19518 </p>
19519 <table><tr><td>
19520 indented cell (no pre-wrapping!)
19521 </td></tr></table>
19522 </blockquote>
19523 <p>foo</p>
19524 <div>bar</div>
19525 !! end
19526
19527 !! test
19528 Strip leading whitespace when handling indent-pre inducing tags
19529 !! options
19530 parsoid=html2wt
19531 !! wikitext
19532 foo
19533 <span>bar</span>
19534
19535 <span>foo2
19536 </span>bar2
19537
19538 <div>foo</div>
19539 <span>bar</span>
19540
19541 <div>
19542 <span>foo</span>
19543 </div>
19544 !! html
19545 <p>foo</p>
19546 <span>bar</span>
19547
19548 <span>foo2
19549 </span>bar2
19550
19551 <div>foo</div>
19552 <span>bar</span>
19553
19554 <div>
19555 <span>foo</span>
19556 </div>
19557 !! end
19558
19559 !! test
19560 Lists: Add space after bullets
19561 !! options
19562 parsoid=html2wt
19563 !! wikitext
19564 * foo
19565 * bar
19566 * <span> baz</span>
19567 !! html
19568 <ul>
19569 <li>foo</li>
19570 <li> bar</li>
19571 <li><span> baz</span></li>
19572 </ul>
19573 !! end
19574
19575 !! test
19576 Lists: Dont insert newlines in a serialized list item.
19577 !! options
19578 parsoid=html2wt
19579 !! wikitext
19580 * a<br>b
19581 * c
19582 !! html
19583 <ul><li>a<br>b</li><li>c</li></ul>
19584 !! end
19585
19586 !! test
19587 Headings: Add space before/after == (Bug 51744)
19588 !! options
19589 parsoid=html2wt
19590 !! wikitext
19591 == foo ==
19592
19593 == bar ==
19594
19595 == baz ==
19596
19597 == <span> baz</span> ==
19598 !! html
19599 <h2>foo</h2>
19600 <h2> bar</h2>
19601 <h2>baz </h2>
19602 <h2><span> baz</span></h2>
19603 !! end
19604
19605 !! test
19606 Parsoid: Serialize positional parameters with = in them as named parameter
19607 !! options
19608 parsoid=html2wt
19609 !! wikitext
19610 {{echo|1 = f=oo}}
19611
19612 {{echo|1 = f=oo|2 = bar}}
19613
19614 <!--Orig params with data-parsoid has heuristics for handling = chars-->
19615 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
19616 {{echo|<nowiki>f=oo</nowiki>|bar}}
19617 !! html
19618 <p about="#mwt1" typeof="mw:Transclusion"
19619 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
19620
19621 <p about="#mwt1" typeof="mw:Transclusion"
19622 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
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 <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>
19627 !! end
19628
19629 !! test
19630 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
19631 !! options
19632 parsoid=html2wt
19633 !! wikitext
19634 <div>a
19635 b
19636 </div>
19637 <div>a
19638 b
19639 </div>
19640 <div>
19641 a
19642
19643 b
19644 </div>
19645 !! html
19646 <div>a<p>b</p></div>
19647 <div>a
19648 <p>b</p></div>
19649 <div>
19650 a
19651 <p>b</p></div>
19652 !! end
19653
19654 #-----------------------------
19655 # I/B quote minimization tests
19656 #-----------------------------
19657
19658 !! test
19659 1. I/B quote minimization: wikitext-only tags should be combined
19660 !! options
19661 parsoid=html2wt
19662 !! wikitext
19663 ''AB''
19664
19665 '''AB'''
19666
19667 ''A'''B'''''
19668
19669 '''A''B'''''
19670
19671 '''A''BC''D'''
19672
19673 '''''AB'''''
19674
19675 '''''AB'''''
19676
19677 '''''AB'''''
19678 !! html
19679 <p><i>A</i><i>B</i></p>
19680 <p><b>A</b><b>B</b></p>
19681 <p><i>A</i><b><i>B</i></b></p>
19682 <p><b>A</b><i><b>B</b></i></p>
19683 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
19684 <p><i><b>A</b></i><i><b>B</b></i></p>
19685 <p><i><b>A</b></i><b><i>B</i></b></p>
19686 <p><b><i>A</i></b><i><b>B</b></i></p>
19687 !! end
19688
19689 !! test
19690 2. I/B quote minimization: wikitext and html tags should not be combined
19691 !! options
19692 parsoid=html2wt
19693 !! wikitext
19694 ''A''<i>B</i>
19695
19696 ''A'''''<i>B</i>'''
19697 !! html
19698 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
19699 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
19700 !! end
19701
19702 !! test
19703 3. I/B quote minimization: templated content stops minimization
19704 !! options
19705 parsoid=html2wt
19706 !! wikitext
19707 ''A''{{echo|''B''}}
19708
19709 ''A''{{echo|'''''B'''''}}
19710 !! html
19711 <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>
19712 <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>
19713 !! end
19714
19715 !! test
19716 4. I/B quote minimization: new content should be mimimized with adjacent old content
19717 !! options
19718 parsoid=html2wt
19719 !! wikitext
19720 ''AB''
19721
19722 '''AB'''
19723
19724 ''A'''B'''''
19725 !! html
19726 <p><i>A</i><i data-parsoid='{}'>B</i></p>
19727 <p><b data-parsoid='{}'>A</b><b>B</b></p>
19728 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
19729 !! end
19730
19731 #------------------------------------
19732 # End of I/B quote minimization tests
19733 #------------------------------------
19734
19735 !!test
19736 Bug 54262: New entities
19737 !! options
19738 parsoid=html2wt
19739 !! wikitext
19740 foo
19741 !! html
19742 <span typeof="mw:Entity">foo</span>
19743 !! end
19744
19745 ## Note that there is no wikitext output for 'unknownproperty' ##
19746 ## Unknown magic words are silently dropped ##
19747
19748 !! test
19749 Magic words
19750 !! options
19751 parsoid=html2wt
19752 !! wikitext
19753 __TOC__
19754 __NOTOC__
19755 __FORCETOC__
19756 __INDEX__
19757 __NOINDEX__
19758 __NOGALLERY__
19759 __NOEDITSECTION__
19760 __NOTITLECONVERT__
19761 __NOCONTENTCONVERT__
19762 !! html
19763 <meta property='mw:PageProp/toc' />
19764 <meta property='mw:PageProp/notoc' />
19765 <meta property='mw:PageProp/forcetoc' />
19766 <meta property='mw:PageProp/index' />
19767 <meta property='mw:PageProp/noindex' />
19768 <meta property='mw:PageProp/nogallery' />
19769 <meta property='mw:PageProp/noeditsection' />
19770 <meta property='mw:PageProp/notitleconvert' />
19771 <meta property='mw:PageProp/nocontentconvert' />
19772 <meta property='mw:PageProp/unknownproperty' />
19773 !! end
19774
19775 !! test
19776 Consecutive <pre>s should not get merged
19777 !! options
19778 parsoid=html2wt,html2html
19779 !! wikitext
19780 a
19781
19782 b
19783
19784 c
19785
19786 d
19787
19788 e
19789
19790
19791
19792 f
19793 !! html
19794 <pre>a</pre><pre>b</pre>
19795
19796 <pre>c
19797 </pre><pre>
19798 d</pre>
19799
19800 <pre>e
19801
19802 </pre><pre>
19803
19804 f</pre>
19805 !! end
19806
19807 !! test
19808 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
19809 !! options
19810 parsoid=html2wt
19811 !! wikitext
19812 [[Special:BookSources/1234567890|ISBN 1234567895]]
19813 !! html
19814 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
19815 !! end
19816
19817 !! test
19818 Edited RFC links not serializable as RFC links should serialize as extlinks
19819 !! options
19820 parsoid=html2wt
19821 !! wikitext
19822 [//tools.ietf.org/html/rfc123 New RFC]
19823 !! html
19824 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
19825 !! end
19826
19827 !! test
19828 Edited PMID links not serializable as PMID links should serialize as extlinks
19829 !! options
19830 parsoid=html2wt
19831 !! wikitext
19832 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
19833 !! html
19834 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
19835 !! end
19836
19837 !! test
19838 Edited Redirect link should emit a non-piped wikitext link
19839 !! options
19840 parsoid=html2wt
19841 !! wikitext
19842 #REDIRECT [[Bar]]
19843 !! html
19844 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
19845 !! end
19846
19847 # -----------------------------------------------------------------
19848 # End of section for Parsoid-only html2wt tests for serialization
19849 # of new content
19850 # -----------------------------------------------------------------
19851
19852 TODO:
19853 more images
19854 more tables
19855 character entities
19856 and much more
19857 Try for 100% code coverage