Merge "mediawiki.util: Use 'wikipage.content' hook for TOC hiding"
[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 #
30 # You can also set the following parser properties via test options:
31 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 # wgLinkHolderBatchSize, wgRawHtml
33 #
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
37
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
44
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
50
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
55
56 !! article
57 Template:pipe
58 !! text
59 |
60 !! endarticle
61
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
67
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
73
74 !! article
75 Template:tbl-start
76 !! text
77 {|
78 !! endarticle
79
80 !! article
81 Template:tbl-end
82 !! text
83 |}
84 !! endarticle
85
86 !! article
87 Template:!
88 !! text
89 |
90 !! endarticle
91
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
97
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
103
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
109
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
115
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
122
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
128
129 !! article
130 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
135
136 !! article
137 A?b
138 !! text
139 Weirdo titles!
140 !! endarticle
141
142 !!article
143 Template:Bullet
144 !!text
145 * Bar
146 !!endarticle
147
148 ###
149 ### Basic tests
150 ###
151 !! test
152 Blank input
153 !! input
154 !! result
155 !! end
156
157
158 !! test
159 Simple paragraph
160 !! input
161 This is a simple paragraph.
162 !! result
163 <p>This is a simple paragraph.
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with extra newline spacing
169 !! input
170 foo
171
172 bar
173
174
175 baz
176
177
178
179 booz
180 !! result
181 <p>foo
182 </p><p>bar
183 </p><p><br />
184 baz
185 </p><p><br />
186 </p><p>booz
187 </p>
188 !! end
189
190 !! test
191 Paragraphs with newline spacing with comment lines in between
192 !! input
193 ----
194 a
195 <!--foo-->
196 b
197 ----
198 a
199 <!--foo--><!--More than 1 comment, still stripped-->
200 b
201 ----
202 a
203 <!--foo--> <!----> <!-- bar -->
204 b
205 ----
206 a
207 <!--foo-->
208
209 b
210 ----
211 a
212
213 <!--foo-->
214 b
215 ----
216 a
217 <!--foo-->
218
219
220 b
221 ----
222 a
223
224
225 <!--foo-->
226 b
227 ----
228 !! result
229 <hr />
230 <p>a
231 b
232 </p>
233 <hr />
234 <p>a
235 b
236 </p>
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 </p><p>b
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p><br />
252 b
253 </p>
254 <hr />
255 <p>a
256 </p><p><br />
257 b
258 </p>
259 <hr />
260
261 !! end
262
263 !! test
264 Paragraphs with newline spacing with non-empty white-space lines in between
265 !! input
266 ----
267 a
268
269 b
270 ----
271 a
272
273
274 b
275 ----
276 !! result
277 <hr />
278 <p>a
279 </p><p>b
280 </p>
281 <hr />
282 <p>a
283 </p><p><br />
284 b
285 </p>
286 <hr />
287
288 !! end
289
290 !! test
291 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
292 !! input
293 ----
294 a
295 <!--foo-->
296 b
297 ----
298 a
299 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
300 b
301 ----
302 a
303
304 <!--foo-->
305 <!--bar-->
306 b
307 ----
308 a
309
310 <!--foo-->
311 <!--bar-->
312
313 b
314 ----
315 !! result
316 <hr />
317 <p>a
318 b
319 </p>
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 </p><p>b
327 </p>
328 <hr />
329 <p>a
330 </p><p><br />
331 b
332 </p>
333 <hr />
334
335 !! end
336
337 !! test
338 Extra newlines: More paragraphs with indented comment
339 !! input
340 a
341
342 <!--boo-->
343
344 b
345 !!result
346 <p>a
347 </p><p><br />
348 b
349 </p>
350 !!end
351
352 !! test
353 Extra newlines followed by heading
354 !! input
355 a
356
357
358
359 =b=
360 [[a]]
361
362
363 =b=
364 !! result
365 <p>a
366 </p><p><br />
367 </p>
368 <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>
369 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
370 </p><p><br />
371 </p>
372 <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>
373
374 !! end
375
376 !! test
377 Extra newlines between heading and content are swallowed
378 !! input
379 =b=
380
381
382
383 [[a]]
384 !! result
385 <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>
386 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
387 </p>
388 !! end
389
390 !! test
391 Parsing an URL
392 !! input
393 http://fr.wikipedia.org/wiki/🍺
394 <!-- EasterEgg we love beer, better be able be able to link to it -->
395 !! result
396 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
397 </p>
398 !! end
399
400 !! test
401 Simple list
402 !! input
403 * Item 1
404 * Item 2
405 !! result
406 <ul>
407 <li> Item 1
408 </li>
409 <li> Item 2
410 </li>
411 </ul>
412
413 !! end
414
415 !! test
416 Italics and bold
417 !! input
418 * plain
419 * plain''italic''plain
420 * plain''italic''plain''italic''plain
421 * plain'''bold'''plain
422 * plain'''bold'''plain'''bold'''plain
423 * plain''italic''plain'''bold'''plain
424 * plain'''bold'''plain''italic''plain
425 * plain''italic'''bold-italic'''italic''plain
426 * plain'''bold''bold-italic''bold'''plain
427 * plain'''''bold-italic'''italic''plain
428 * plain'''''bold-italic''bold'''plain
429 * plain''italic'''bold-italic'''''plain
430 * plain'''bold''bold-italic'''''plain
431 * plain l'''italic''plain
432 * plain l''''bold''' plain
433 !! result
434 <ul>
435 <li> plain
436 </li>
437 <li> plain<i>italic</i>plain
438 </li>
439 <li> plain<i>italic</i>plain<i>italic</i>plain
440 </li>
441 <li> plain<b>bold</b>plain
442 </li>
443 <li> plain<b>bold</b>plain<b>bold</b>plain
444 </li>
445 <li> plain<i>italic</i>plain<b>bold</b>plain
446 </li>
447 <li> plain<b>bold</b>plain<i>italic</i>plain
448 </li>
449 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
450 </li>
451 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
452 </li>
453 <li> plain<i><b>bold-italic</b>italic</i>plain
454 </li>
455 <li> plain<b><i>bold-italic</i>bold</b>plain
456 </li>
457 <li> plain<i>italic<b>bold-italic</b></i>plain
458 </li>
459 <li> plain<b>bold<i>bold-italic</i></b>plain
460 </li>
461 <li> plain l'<i>italic</i>plain
462 </li>
463 <li> plain l'<b>bold</b> plain
464 </li>
465 </ul>
466
467 !! end
468
469 # this example taken from the [[simple:Moon]] article (bug 47326)
470 !! test
471 Italics and possessives (1)
472 !! input
473 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
474 !! result
475 <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
476 </p>
477 !! end
478
479 # this example taken from [[en:Flaming Pie]] (bug 49926)
480 !! test
481 Italics and possessives (2)
482 !! input
483 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
484 !! result
485 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
486 </p>
487 !! end
488
489 # this example taken from [[en:Dictionary]] (bug 49926)
490 !! test
491 Italics and possessives (3)
492 !! input
493 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''.
494 !! result
495 <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>.
496 </p>
497 !! end
498
499
500 ###
501 ### 2-quote opening sequence tests
502 ###
503 !! test
504 Italics and bold: 2-quote opening sequence: (2,2)
505 !! input
506 ''foo''
507 !! result
508 <p><i>foo</i>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 2-quote opening sequence: (2,3)
515 !! input
516 ''foo'''
517 !! result
518 <p><i>foo'</i>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 2-quote opening sequence: (2,4)
525 !! input
526 ''foo''''
527 !! result
528 <p><i>foo''</i>
529 </p>
530 !!end
531
532
533 !! test
534 Italics and bold: 2-quote opening sequence: (2,5) (php)
535 !! options
536 php
537 !! input
538 ''foo'''''
539 !! result
540 <p><i>foo</i>
541 </p>
542 !!end
543 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
544 !! test
545 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
546 !! options
547 parsoid
548 !! input
549 ''foo'''''
550 !! result
551 <p><i>foo</i><b></b>
552 </p>
553 !!end
554
555
556 ###
557 ### 3-quote opening sequence tests
558 ###
559
560 !! test
561 Italics and bold: 3-quote opening sequence: (3,2)
562 !! input
563 '''foo''
564 !! result
565 <p>'<i>foo</i>
566 </p>
567 !!end
568
569
570 !! test
571 Italics and bold: 3-quote opening sequence: (3,3)
572 !! input
573 '''foo'''
574 !! result
575 <p><b>foo</b>
576 </p>
577 !!end
578
579
580 !! test
581 Italics and bold: 3-quote opening sequence: (3,4)
582 !! input
583 '''foo''''
584 !! result
585 <p><b>foo'</b>
586 </p>
587 !!end
588
589
590 !! test
591 Italics and bold: 3-quote opening sequence: (3,5) (php)
592 !! options
593 php
594 !! input
595 '''foo'''''
596 !! result
597 <p><b>foo</b>
598 </p>
599 !!end
600 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
601 !! test
602 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
603 !! options
604 parsoid
605 !! input
606 '''foo'''''
607 !! result
608 <p><b>foo</b><i></i>
609 </p>
610 !!end
611
612
613 ###
614 ### 4-quote opening sequence tests
615 ###
616
617 !! test
618 Italics and bold: 4-quote opening sequence: (4,2)
619 !! input
620 ''''foo''
621 !! result
622 <p>''<i>foo</i>
623 </p>
624 !!end
625
626
627 !! test
628 Italics and bold: 4-quote opening sequence: (4,3)
629 !! input
630 ''''foo'''
631 !! result
632 <p>'<b>foo</b>
633 </p>
634 !!end
635
636
637 !! test
638 Italics and bold: 4-quote opening sequence: (4,4)
639 !! input
640 ''''foo''''
641 !! result
642 <p>'<b>foo'</b>
643 </p>
644 !!end
645
646
647 !! test
648 Italics and bold: 4-quote opening sequence: (4,5) (php)
649 !! options
650 php
651 !! input
652 ''''foo'''''
653 !! result
654 <p>'<b>foo</b>
655 </p>
656 !!end
657 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
658 !! test
659 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
660 !! options
661 parsoid
662 !! input
663 ''''foo'''''
664 !! result
665 <p>'<b>foo</b><i></i>
666 </p>
667 !!end
668
669
670 ###
671 ### 5-quote opening sequence tests
672 ###
673
674 !! test
675 Italics and bold: 5-quote opening sequence: (5,2)
676 !! options
677 !! input
678 '''''foo''
679 !! result
680 <p><b><i>foo</i></b>
681 </p>
682 !!end
683
684
685 !! test
686 Italics and bold: 5-quote opening sequence: (5,3)
687 !! input
688 '''''foo'''
689 !! result
690 <p><i><b>foo</b></i>
691 </p>
692 !!end
693
694
695 !! test
696 Italics and bold: 5-quote opening sequence: (5,4)
697 !! input
698 '''''foo''''
699 !! result
700 <p><i><b>foo'</b></i>
701 </p>
702 !!end
703
704
705 !! test
706 Italics and bold: 5-quote opening sequence: (5,5)
707 !! input
708 '''''foo'''''
709 !! result
710 <p><i><b>foo</b></i>
711 </p>
712 !!end
713
714 ###
715 ### multiple quote sequences in a line
716 ###
717 !! test
718 Italics and bold: multiple quote sequences: (2,4,2)
719 !! input
720 ''foo''''bar''
721 !! result
722 <p><i>foo'<b>bar</b></i>
723 </p>
724 !!end
725
726
727 !! test
728 Italics and bold: multiple quote sequences: (2,4,3)
729 !! input
730 ''foo''''bar'''
731 !! result
732 <p><i>foo'<b>bar</b></i>
733 </p>
734 !!end
735
736
737 !! test
738 Italics and bold: multiple quote sequences: (2,4,4)
739 !! input
740 ''foo''''bar''''
741 !! result
742 <p><i>foo'<b>bar'</b></i>
743 </p>
744 !!end
745
746
747 !! test
748 Italics and bold: multiple quote sequences: (3,4,2) (php)
749 !! options
750 php
751 !! input
752 '''foo''''bar''
753 !! result
754 <p><b>foo'</b>bar
755 </p>
756 !!end
757 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
758 !! test
759 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
760 !! options
761 parsoid
762 !! input
763 '''foo''''bar''
764 !! result
765 <p><b>foo'</b>bar<i></i>
766 </p>
767 !!end
768
769
770 !! test
771 Italics and bold: multiple quote sequences: (3,4,3) (php)
772 !! options
773 php
774 !! input
775 '''foo''''bar'''
776 !! result
777 <p><b>foo'</b>bar
778 </p>
779 !!end
780 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
781 !! test
782 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
783 !! options
784 parsoid
785 !! input
786 '''foo''''bar'''
787 !! result
788 <p><b>foo'</b>bar<b></b>
789 </p>
790 !!end
791
792 ###
793 ### other quote tests
794 ###
795 !! test
796 Italics and bold: other quote tests: (2,3,5)
797 !! input
798 ''this is about '''foo's family'''''
799 !! result
800 <p><i>this is about <b>foo's family</b></i>
801 </p>
802 !!end
803
804
805 !! test
806 Italics and bold: other quote tests: (2,(3,3),2)
807 !! input
808 ''this is about '''foo's''' family''
809 !! result
810 <p><i>this is about <b>foo's</b> family</i>
811 </p>
812 !!end
813
814
815 !! test
816 Italics and bold: other quote tests: (3,2,3,2)
817 !! input
818 '''this is about ''foo'''s family''
819 !! result
820 <p><b>this is about <i>foo</i></b><i>s family</i>
821 </p>
822 !!end
823
824
825 !! test
826 Italics and bold: other quote tests: (3,2,3,3)
827 !! options
828 !! input
829 '''this is about ''foo'''s family'''
830 !! result
831 <p>'<i>this is about </i>foo<b>s family</b>
832 </p>
833 !!end
834
835
836 !! test
837 Italics and bold: other quote tests: (3,(2,2),3)
838 !! input
839 '''this is about ''foo's'' family'''
840 !! result
841 <p><b>this is about <i>foo's</i> family</b>
842 </p>
843 !!end
844
845
846 !! test
847 Italicized possessive
848 !! input
849 The ''[[Main Page]]'''s talk page.
850 !! result
851 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
852 </p>
853 !! end
854
855 !! test
856 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
857 (Requires tidy for PHP parser output to be fixed up)
858 !! options
859 parsoid=wt2html,wt2wt
860 !! input
861 {|
862 !''a!!''b
863 |''a||''b
864 |}
865 !! result
866 <table>
867 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
868 <td><i>a</i></td><td><i>b</i></td></tr>
869 </tbody></table>
870 !! end
871
872 ###
873 ### Non-html5 tags
874 ###
875
876 !! test
877 Non-html5 tags should be accepted
878 !! input
879 <center>''foo''</center>
880 <big>''foo''</big>
881 <font>''foo''</font>
882 <strike>''foo''</strike>
883 <tt>''foo''</tt>
884 !! result
885 <center><i>foo</i></center>
886 <p><big><i>foo</i></big>
887 <font><i>foo</i></font>
888 <strike><i>foo</i></strike>
889 <tt><i>foo</i></tt>
890 </p>
891 !! end
892
893 !! test
894 <wbr> is valid wikitext (bug 52468)
895 !! input
896 <wbr>
897 !! result
898 <p><wbr />
899 </p>
900 !! end
901
902 # <strike> is HTML4, <s> is HTML4/5.
903 !! test
904 <s> or <strike> for strikethrough
905 !! input
906 <strike>strike</strike>
907
908 <s>s</s>
909 !! result
910 <p><strike>strike</strike>
911 </p><p><s>s</s>
912 </p>
913 !! end
914
915 !! test
916 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
917 !! input
918 <b→> doesn't work! </b>
919
920 <bä> doesn't work! </b>
921
922 <boo> works fine </b>
923
924 <s.foo>foo</s>
925
926 <s.foo>s.foo</s.foo>
927
928 <sub-ID#1>
929 !! result
930 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
931 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
932 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
933 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
934 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
935 </p><p>&lt;sub-ID#1&gt;
936 </p>
937 !! end
938
939 ###
940 ### Special characters
941 ###
942
943 !! test
944 Bare pipe character (bug 52363)
945 !! input
946 |
947 !! result
948 <p>|
949 </p>
950 !! end
951
952 !! test
953 Bare pipe character from a template (bug 52363)
954 !! input
955 {{pipe}}
956 !! result
957 <p>|
958 </p>
959 !! end
960
961 ###
962 ### <nowiki> test cases
963 ###
964
965 !! test
966 <nowiki> unordered list
967 !! input
968 <nowiki>* This is not an unordered list item.</nowiki>
969 !! result
970 <p>* This is not an unordered list item.
971 </p>
972 !! end
973
974 !! test
975 <nowiki> spacing
976 !! input
977 <nowiki>Lorem ipsum dolor
978
979 sed abit.
980 sed nullum.
981
982 :and a colon
983 </nowiki>
984 !! result
985 <p>Lorem ipsum dolor
986
987 sed abit.
988 sed nullum.
989
990 :and a colon
991
992 </p>
993 !! end
994
995 !! test
996 nowiki 3
997 !! input
998 :There is not nowiki.
999 :There is <nowiki>nowiki</nowiki>.
1000
1001 #There is not nowiki.
1002 #There is <nowiki>nowiki</nowiki>.
1003
1004 *There is not nowiki.
1005 *There is <nowiki>nowiki</nowiki>.
1006 !! result
1007 <dl>
1008 <dd>There is not nowiki.
1009 </dd>
1010 <dd>There is nowiki.
1011 </dd>
1012 </dl>
1013 <ol>
1014 <li>There is not nowiki.
1015 </li>
1016 <li>There is nowiki.
1017 </li>
1018 </ol>
1019 <ul>
1020 <li>There is not nowiki.
1021 </li>
1022 <li>There is nowiki.
1023 </li>
1024 </ul>
1025
1026 !! end
1027
1028 !! test
1029 Entities inside <nowiki>
1030 !! input
1031 <nowiki>&lt;</nowiki>
1032 !! result
1033 <p>&lt;
1034 </p>
1035 !! end
1036
1037 !! test
1038 Entities inside template parameters
1039 !! options
1040 parsoid
1041 !! input
1042 {{echo|&ndash;}}
1043 !! result
1044 <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>
1045 </p>
1046 !! end
1047
1048 ###
1049 ### Comments
1050 ###
1051 !! test
1052 Comments and Indent-Pre
1053 !! input
1054 <!-- comment 1 --> asdf
1055
1056 <!-- comment 1 --> asdf
1057 <!-- comment 2 -->
1058
1059 <!-- comment 1 --> asdf
1060 <!-- comment 2 -->xyz
1061
1062 <!-- comment 1 --> asdf
1063 <!-- comment 2 --> xyz
1064 !! result
1065 <pre>asdf
1066 </pre>
1067 <pre>asdf
1068 </pre>
1069 <pre>asdf
1070 </pre>
1071 <p>xyz
1072 </p>
1073 <pre>asdf
1074 xyz
1075 </pre>
1076 !! end
1077
1078 !! test
1079 Comment test 2a
1080 !! input
1081 asdf
1082 <!-- comment 1 -->
1083 jkl
1084 !! result
1085 <p>asdf
1086 jkl
1087 </p>
1088 !! end
1089
1090 !! test
1091 Comment test 2b
1092 !! input
1093 asdf
1094 <!-- comment 1 -->
1095
1096 jkl
1097 !! result
1098 <p>asdf
1099 </p><p>jkl
1100 </p>
1101 !! end
1102
1103 !! test
1104 Comment test 3
1105 !! input
1106 asdf
1107 <!-- comment 1 -->
1108 <!-- comment 2 -->
1109 jkl
1110 !! result
1111 <p>asdf
1112 jkl
1113 </p>
1114 !! end
1115
1116 !! test
1117 Comment test 4
1118 !! input
1119 asdf<!-- comment 1 -->jkl
1120 !! result
1121 <p>asdfjkl
1122 </p>
1123 !! end
1124
1125 !! test
1126 Comment spacing
1127 !! input
1128 a
1129 <!-- foo --> b <!-- bar -->
1130 c
1131 !! result
1132 <p>a
1133 </p>
1134 <pre> b
1135 </pre>
1136 <p>c
1137 </p>
1138 !! end
1139
1140 !! test
1141 Comment whitespace
1142 !! input
1143 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1144 !! result
1145
1146 !! end
1147
1148 !! test
1149 Comment semantics and delimiters
1150 !! input
1151 <!-- --><!----><!-----><!------>
1152 !! result
1153
1154 !! end
1155
1156 !! test
1157 Comment semantics and delimiters, redux
1158 !! input
1159 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1160 -- foo -- funky huh? ... -->
1161 !! result
1162
1163 !! end
1164
1165 !! test
1166 Comment semantics and delimiters: directors cut
1167 !! input
1168 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1169 everything starting with < followed by !-- until the first -- and > we see,
1170 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1171 -->-->
1172 !! result
1173 <p>--&gt;
1174 </p>
1175 !! end
1176
1177 !! test
1178 Comment semantics: nesting
1179 !! input
1180 <!--<!-- no, we're not going to do anything fancy here -->-->
1181 !! result
1182 <p>--&gt;
1183 </p>
1184 !! end
1185
1186 !! test
1187 Comment semantics: unclosed comment at end
1188 !! input
1189 <!--This comment will run out to the end of the document
1190 !! result
1191
1192 !! end
1193
1194 !! test
1195 Comment in template title
1196 !! input
1197 {{f<!---->oo}}
1198 !! result
1199 <p>FOO
1200 </p>
1201 !! end
1202
1203 !! test
1204 Comment on its own line post-expand
1205 !! input
1206 a
1207 {{blank}}<!---->
1208 b
1209 !! result
1210 <p>a
1211 </p><p>b
1212 </p>
1213 !! end
1214
1215 !! test
1216 Comment on its own line post-expand with non-significant whitespace
1217 !! input
1218 a
1219 {{blank}} <!---->
1220 b
1221 !! result
1222 <p>a
1223 </p><p>b
1224 </p>
1225 !! end
1226
1227 ###
1228 ### paragraph wrapping tests
1229 ###
1230 !! test
1231 No block tags
1232 !! input
1233 a
1234
1235 b
1236 !! result
1237 <p>a
1238 </p><p>b
1239 </p>
1240 !! end
1241
1242 !! test
1243 Block tag on one line (<div>)
1244 !! input
1245 a <div>foo</div>
1246
1247 b
1248 !! result
1249 a <div>foo</div>
1250 <p>b
1251 </p>
1252 !! end
1253
1254 !! test
1255 Block tag on one line (<blockquote>)
1256 !! input
1257 a <blockquote>foo</blockquote>
1258
1259 b
1260 !! result
1261 a <blockquote>foo</blockquote>
1262 <p>b
1263 </p>
1264 !! end
1265
1266 !! test
1267 Block tag on both lines (<div>)
1268 !! input
1269 a <div>foo</div>
1270
1271 b <div>foo</div>
1272 !! result
1273 a <div>foo</div>
1274 b <div>foo</div>
1275
1276 !! end
1277
1278 !! test
1279 Block tag on both lines (<blockquote>)
1280 !! input
1281 a <blockquote>foo</blockquote>
1282
1283 b <blockquote>foo</blockquote>
1284 !! result
1285 a <blockquote>foo</blockquote>
1286 b <blockquote>foo</blockquote>
1287
1288 !! end
1289
1290 !! test
1291 Multiple lines without block tags
1292 !! input
1293 <div>foo</div> a
1294 b
1295 c
1296 d<!--foo--> e
1297 x <div>foo</div> z
1298 !! result
1299 <div>foo</div> a
1300 <p>b
1301 c
1302 d e
1303 </p>
1304 x <div>foo</div> z
1305
1306 !! end
1307
1308 !! test
1309 Empty lines between lines with block tags
1310 !! input
1311 <div></div>
1312
1313
1314 <div></div>a
1315
1316 b
1317 <div>a</div>b
1318
1319 <div>b</div>d
1320
1321
1322 <div>e</div>
1323 !! result
1324 <div></div>
1325 <p><br />
1326 </p>
1327 <div></div>a
1328 <p>b
1329 </p>
1330 <div>a</div>b
1331 <div>b</div>d
1332 <p><br />
1333 </p>
1334 <div>e</div>
1335
1336 !! end
1337
1338 ###
1339 ### Preformatted text
1340 ###
1341 !! test
1342 Preformatted text
1343 !! input
1344 This is some
1345 Preformatted text
1346 With ''italic''
1347 And '''bold'''
1348 And a [[Main Page|link]]
1349 !! result
1350 <pre>This is some
1351 Preformatted text
1352 With <i>italic</i>
1353 And <b>bold</b>
1354 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1355 </pre>
1356 !! end
1357
1358 !! test
1359 Tabs don't trigger preformatted text
1360 !! input
1361 This is not
1362 preformatted text.
1363 This is preformatted text.
1364 So is this.
1365 !! result
1366 <p> This is not
1367 preformatted text.
1368 </p>
1369 <pre>This is preformatted text.
1370 So is this.
1371 </pre>
1372 !! end
1373
1374 !! test
1375 Ident preformatting with inline content
1376 !! input
1377 a
1378 ''b''
1379 !! result
1380 <pre>a
1381 <i>b</i>
1382 </pre>
1383 !! end
1384
1385 !! test
1386 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1387 !! input
1388 <pre><nowiki>
1389 <b>
1390 <cite>
1391 <em>
1392 </nowiki></pre>
1393 !! result
1394 <pre>
1395 &lt;b&gt;
1396 &lt;cite&gt;
1397 &lt;em&gt;
1398 </pre>
1399
1400 !! end
1401
1402 !! test
1403 Regression with preformatted in <center>
1404 !! input
1405 <center>
1406 Blah
1407 </center>
1408 !! result
1409 <center>
1410 <pre>Blah
1411 </pre>
1412 </center>
1413
1414 !! end
1415
1416 !! test
1417 Bug 52763: Preformatted in <blockquote>
1418 !! input
1419 <blockquote>
1420 Blah
1421 </blockquote>
1422 !! result
1423 <blockquote>
1424 <p> Blah
1425 </p>
1426 </blockquote>
1427
1428 !! end
1429
1430 !! test
1431 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1432 !! input
1433 <blockquote>
1434 Foo
1435
1436 Bar
1437 </blockquote>
1438 !! result
1439 <blockquote>
1440 <p>Foo
1441 </p><p>Bar
1442 </p>
1443 </blockquote>
1444
1445 !! end
1446
1447 !! test
1448 Bug 15491: <ins>/<del> in blockquote
1449 !! input
1450 <blockquote>
1451 Foo <del>bar</del> <ins>baz</ins> quux
1452 </blockquote>
1453 !! result
1454 <blockquote>
1455 <p>Foo <del>bar</del> <ins>baz</ins> quux
1456 </p>
1457 </blockquote>
1458
1459 !! end
1460
1461 # Note that the p-wrapping is newline sensitive, which could be
1462 # considered a bug: tidy will wrap only the 'Foo' in the example
1463 # below in a <p> tag. (see comment 23-25 of bug #6200)
1464 !! test
1465 Bug 15491: <ins>/<del> in blockquote (2)
1466 !! input
1467 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1468 </blockquote>
1469 !! result
1470 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1471 </blockquote>
1472
1473 !! end
1474
1475 !! test
1476 <pre> with attributes (bug 3202)
1477 !! input
1478 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1479 !! result
1480 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1481
1482 !! end
1483
1484 !! test
1485 <pre> with width attribute (bug 3202)
1486 !! input
1487 <pre width="8">Narrow screen goodies</pre>
1488 !! result
1489 <pre width="8">Narrow screen goodies</pre>
1490
1491 !! end
1492
1493 !! test
1494 <pre> with forbidden attribute (bug 3202)
1495 !! input
1496 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1497 !! result
1498 <pre width="8">Narrow screen goodies</pre>
1499
1500 !! end
1501
1502 !! test
1503 Entities inside <pre>
1504 !! input
1505 <pre>&lt;</pre>
1506 !! result
1507 <pre>&lt;</pre>
1508
1509 !! end
1510
1511 !! test
1512 <pre> with forbidden attribute values (bug 3202)
1513 !! input
1514 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1515 !! result
1516 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1517
1518 !! end
1519
1520 !! test
1521 <nowiki> inside <pre> (bug 13238)
1522 !! input
1523 <pre>
1524 <nowiki>
1525 </pre>
1526 <pre>
1527 <nowiki></nowiki>
1528 </pre>
1529 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1530 !! result
1531 <pre>
1532 &lt;nowiki&gt;
1533 </pre>
1534 <pre>
1535
1536 </pre>
1537 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1538
1539 !! end
1540
1541 !! test
1542 <nowiki> and <pre> preference (first one wins)
1543 !! input
1544 <pre>
1545 <nowiki>
1546 </pre>
1547 </nowiki>
1548 </pre>
1549
1550 <nowiki>
1551 <pre>
1552 <nowiki>
1553 </pre>
1554 </nowiki>
1555 </pre>
1556
1557 !! result
1558 <pre>
1559 &lt;nowiki&gt;
1560 </pre>
1561 <p>&lt;/nowiki&gt;
1562 &lt;/pre&gt;
1563 </p><p>
1564 &lt;pre&gt;
1565 &lt;nowiki&gt;
1566 &lt;/pre&gt;
1567
1568 &lt;/pre&gt;
1569 </p>
1570 !! end
1571
1572 !! test
1573 </pre> inside nowiki
1574 !! input
1575 <nowiki></pre></nowiki>
1576 !! result
1577 <p>&lt;/pre&gt;
1578 </p>
1579 !! end
1580
1581 !!test
1582 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1583 !!input
1584 {{echo|}}
1585 !!result
1586
1587 !!end
1588
1589 !!test
1590 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1591 !!input
1592 {{echo|
1593 foo}}
1594 !!result
1595 <p>foo
1596 </p>
1597 !!end
1598
1599 !! test
1600 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1601 !! input
1602 {{echo|a
1603 b}}
1604 !!result
1605 <pre>a
1606 </pre>
1607 <p>b
1608 </p>
1609 !!end
1610
1611 !! test
1612 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1613 !! input
1614 {{echo|a
1615 b
1616 c
1617 d
1618 e
1619 }}
1620 !!result
1621 <pre>a
1622 </pre>
1623 <p>b
1624 c
1625 </p>
1626 <pre>d
1627 </pre>
1628 <p>e
1629 </p>
1630 !!end
1631
1632 !!test
1633 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1634 !!input
1635 {{echo| foo}}
1636
1637 {{echo| foo}}{{echo| bar}}
1638
1639 {{echo| foo}}
1640 {{echo| bar}}
1641
1642 {{echo|<!--cmt--> foo}}
1643
1644 <!--cmt-->{{echo| foo}}
1645
1646 {{echo|{{echo| }}bar}}
1647 !!result
1648 <pre>foo
1649 </pre>
1650 <pre>foo bar
1651 </pre>
1652 <pre>foo
1653 bar
1654 </pre>
1655 <pre>foo
1656 </pre>
1657 <pre>foo
1658 </pre>
1659 <pre>bar
1660 </pre>
1661 !!end
1662
1663 !! test
1664 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1665 !! input
1666 {{echo| }}a
1667
1668 {{echo|
1669 }}a
1670
1671 {{echo|
1672 b}}
1673
1674 {{echo|a
1675 }}b
1676
1677 {{echo|a
1678 }} b
1679 !!result
1680 <pre>a
1681 </pre>
1682 <p><br />
1683 </p>
1684 <pre>a
1685 </pre>
1686 <p><br />
1687 </p>
1688 <pre>b
1689 </pre>
1690 <p>a
1691 </p>
1692 <pre>b
1693 </pre>
1694 <p>a
1695 </p>
1696 <pre>b
1697 </pre>
1698 !!end
1699
1700 # TODO / maybe: fix wt2wt for this
1701 !! test
1702 Parsoid: Don't paragraph-wrap fosterable content
1703 !! options
1704 parsoid=wt2html
1705 !! input
1706 {|
1707 <td></td>
1708 <td></td>
1709
1710
1711
1712 |}
1713 !! result
1714 <table>
1715
1716 <tbody>
1717 <tr>
1718 <td></td>
1719
1720 <td></td></tr>
1721
1722
1723
1724 </tbody></table>
1725 !! end
1726
1727 !! test
1728 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1729 !! options
1730 parsoid=wt2html
1731 !! input
1732 {|
1733 <td>
1734 <td>
1735 </td>
1736
1737
1738
1739 |}
1740 !! result
1741 <table>
1742
1743 <tbody>
1744 <tr>
1745 <td></td>
1746
1747 <td>
1748 </td></tr>
1749
1750
1751
1752 </tbody></table>
1753 !! end
1754
1755
1756 #--------------------------------------------------------------------
1757 # Transclusion parameter whitespace stripping tests
1758 # Behavior is different for positional and named parameters
1759 #--------------------------------------------------------------------
1760 !! test
1761 Templates: Strip leading and trailing whitespace from named-param values
1762 !! input
1763 {{echo|1= a }}
1764
1765 {{echo|1= {{echo|b}} }}
1766
1767 {{echo| 1 =
1768 c }}
1769
1770 {{echo| 1 =
1771 * d
1772 }}
1773 !! result
1774 <p>a
1775 </p><p>b
1776 </p><p>c
1777 </p>
1778 <ul>
1779 <li> d
1780 </li>
1781 </ul>
1782
1783 !! end
1784
1785 !! test
1786 Templates: Don't strip whitespace from positional-param values
1787 !! input
1788 {{echo|a }}
1789
1790 {{echo|{{echo|b}} }}
1791
1792 {{echo| c
1793 }}
1794
1795 {{echo| {{echo|d}}
1796 }}
1797
1798 {{echo|
1799 e}}
1800
1801 {{echo|
1802 * f}}
1803
1804 {{echo|
1805 }}g
1806 !! result
1807 <p>a
1808 </p><p>b
1809 </p>
1810 <pre>c
1811 </pre>
1812 <p><br />
1813 </p>
1814 <pre>d
1815 </pre>
1816 <p><br />
1817 </p>
1818 <pre>e
1819 </pre>
1820 <p><br />
1821 </p>
1822 <ul>
1823 <li> f
1824 </li>
1825 </ul>
1826 <p><br />
1827 </p>
1828 <pre>g
1829 </pre>
1830 !! end
1831
1832 !! test
1833 Templates: Handle empty comment-and-ws-only lines correctly
1834 !! input
1835 {{echo|foo
1836 <!--should be ignored-->
1837 <!--should be ignored as well-->
1838 bar}}
1839 !! result
1840 <p>foo
1841 bar
1842 </p>
1843 !! end
1844
1845 #--------------------------------------------------------------------
1846 # Transclusion parameter escaping tests
1847 #--------------------------------------------------------------------
1848 !! test
1849 Templates: Parsoid parameter escaping test 1
1850 !! options
1851 parsoid
1852 !! input
1853 {{echo|[foo]|{{echo|[bar]}}}}
1854 !! result
1855 <p about="#mwt1" typeof="mw:Transclusion"
1856 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1857 !! end
1858
1859 !! test
1860 Parsoid: Pipes in external links in template parameter
1861 !! options
1862 parsoid
1863 !! input
1864 {{echo|[{{echo|http://example.com}} link]}}
1865 !! result
1866 <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>
1867 !! end
1868
1869 !! test
1870 Parsoid: pipe in transclusion parameter
1871 !! options
1872 parsoid
1873 !! input
1874 {{echo|http://foo.com/a&#124;b}}
1875 !! result
1876 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1877 typeof="mw:Transclusion"
1878 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>
1879 !! end
1880
1881 !! test
1882 Parsoid: Pipe in external link target and content in template parameter
1883 !! options
1884 parsoid=html2wt,wt2wt
1885 !! input
1886 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1887 !! result
1888 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1889 typeof="mw:Transclusion"
1890 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1891 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1892 !! end
1893
1894 !! test
1895 Templates: Dont escape already nowiki-escaped text in template parameters
1896 !! options
1897 parsoid=html2wt,wt2wt
1898 !! input
1899 {{echo|foo<nowiki>|</nowiki>bar}}
1900 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1901 {{echo|<nowiki></nowiki>}}
1902 !! result
1903 <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>
1904 <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>
1905 <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>
1906 </p>
1907 !! end
1908
1909 ## Bug 52824
1910 !! test
1911 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1912 !! options
1913 parsoid=html2wt,wt2wt
1914 !! input
1915 {{echo|{{echo|1=bar}}}}
1916 !! result
1917 <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>
1918 !! end
1919
1920 ###
1921 ### Parsoid-centric tests for testing RT edge cases for pre
1922 ###
1923
1924 !!test
1925 1a. Indent-Pre and Comments
1926 !!input
1927 a
1928 <!--a-->
1929 c
1930 !!result
1931 <pre>a
1932 </pre>
1933 <p>c
1934 </p>
1935 !!end
1936
1937 !!test
1938 1b. Indent-Pre and Comments
1939 !!input
1940 a
1941 <!--a-->
1942 c
1943 !!result
1944 <pre>a
1945 </pre>
1946 <p>c
1947 </p>
1948 !!end
1949
1950 !!test
1951 1c. Indent-Pre and Comments
1952 !!input
1953 <!--a--> a
1954
1955 <!--a--> a
1956 !!result
1957 <pre> a
1958 </pre>
1959 <pre> a
1960 </pre>
1961 !!end
1962
1963 !!test
1964 1d. Indent-Pre and Comments
1965 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1966 !!input
1967 <!--a--> a
1968
1969 <!--b-->b
1970 !!result
1971 <pre>a
1972 </pre>
1973 <pre>b
1974 </pre>
1975 !!end
1976
1977 !!test
1978 2a. Indent-Pre and tables
1979 !!input
1980 {|
1981 |-
1982 !h1!!h2
1983 |foo||bar
1984 |}
1985 !!result
1986 <table>
1987
1988 <tr>
1989 <th>h1</th>
1990 <th>h2
1991 </th>
1992 <td>foo</td>
1993 <td>bar
1994 </td></tr></table>
1995
1996 !!end
1997
1998 !!test
1999 2b. Indent-Pre and tables
2000 !!input
2001 {|
2002 |-
2003 |foo
2004 |}
2005 !!result
2006 <table>
2007
2008 <tr>
2009 <td>foo
2010 </td></tr></table>
2011
2012 !!end
2013
2014 !!test
2015 2c. Indent-Pre and tables (bug 42252)
2016 !!input
2017 {|
2018 |+ foo
2019 ! | bar
2020 |}
2021 !!result
2022 <table>
2023 <caption> foo
2024 </caption>
2025 <tr>
2026 <th> bar
2027 </th></tr></table>
2028
2029 !!end
2030
2031 !!test
2032 3a. Indent-Pre and block tags (single-line html)
2033 !!input
2034 <p> foo </p>
2035 <div> foo </div>
2036 <blockquote> foo </blockquote>
2037 <span> foo </span>
2038 !!result
2039 <p> foo </p>
2040 <div> foo </div>
2041 <blockquote> foo </blockquote>
2042 <pre><span> foo </span>
2043 </pre>
2044 !!end
2045
2046 !!test
2047 3b. Indent-Pre and block tags (pre-content on separate line)
2048 !!input
2049 <p>
2050 foo
2051 </p>
2052
2053 <div>
2054 foo
2055 </div>
2056
2057 <center>
2058 foo
2059 </center>
2060
2061 <blockquote>
2062 foo
2063 </blockquote>
2064
2065 <blockquote>
2066 <pre>
2067 foo
2068 </pre>
2069 </blockquote>
2070
2071 <table><tr><td>
2072 foo
2073 </td></tr></table>
2074
2075 <ul><li>
2076 foo
2077 </li></ul>
2078
2079 !!result
2080 <p>
2081 foo
2082 </p>
2083 <div>
2084 <pre>foo
2085 </pre>
2086 </div>
2087 <center>
2088 <pre>foo
2089 </pre>
2090 </center>
2091 <blockquote>
2092 <p> foo
2093 </p>
2094 </blockquote>
2095 <blockquote>
2096 <pre>
2097 foo
2098 </pre>
2099 </blockquote>
2100 <table><tr><td>
2101 <pre>foo
2102 </pre>
2103 </td></tr></table>
2104 <ul><li>
2105 foo
2106 </li></ul>
2107
2108 !!end
2109
2110 !!test
2111 4. Multiple spaces at start-of-line
2112 !!input
2113 <p> foo </p>
2114 foo
2115 {|
2116 |foo
2117 |}
2118 !!result
2119 <p> foo </p>
2120 <pre> foo
2121 </pre>
2122 <table>
2123 <tr>
2124 <td>foo
2125 </td></tr></table>
2126
2127 !!end
2128
2129 !! test
2130 5. White-space in indent-pre
2131 NOTE: the white-space char on 2nd line is significant
2132 !! input
2133 a<br/>
2134
2135 b
2136 !! result
2137 <pre>a<br />
2138
2139 b
2140 </pre>
2141 !! end
2142
2143 !! test
2144 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2145 !! input
2146 a
2147
2148 <!-- continue -->
2149 b
2150
2151 c
2152
2153 d
2154 !! result
2155 <pre>a
2156
2157 b
2158 </pre>
2159 <pre>c
2160
2161 </pre>
2162 <p>d
2163 </p>
2164 !! end
2165
2166 !! test
2167 7a. Indent-pre and category links
2168 !! options
2169 parsoid=wt2html,wt2wt
2170 !! input
2171 [[Category:foo]] <!-- No pre-wrapping -->
2172 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2173 !! result
2174 <link rel="mw:WikiLink/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2175 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2176 <link rel="mw:WikiLink/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2177 !! end
2178
2179 !! test
2180 7b. Indent-pre and category links
2181 !! options
2182 parsoid=wt2html,wt2wt
2183 !! input
2184 [[Category:foo]] a
2185 [[Category:foo]] {{echo|b}}
2186 !! result
2187 <pre>
2188 <link rel="mw:WikiLink/Category" href="./Category:Foo"> a
2189
2190 <link rel="mw:WikiLink/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>
2191 !! end
2192
2193 ###
2194 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2195 ###
2196
2197 !!test
2198 HTML-pre: 1. embedded newlines
2199 !!input
2200 <pre>foo</pre>
2201
2202 <pre>
2203 foo
2204 </pre>
2205
2206 <pre>
2207
2208 foo
2209 </pre>
2210
2211 <pre>
2212
2213
2214 foo
2215 </pre>
2216 !!result
2217 <pre>foo</pre>
2218 <pre>
2219 foo
2220 </pre>
2221 <pre>
2222
2223 foo
2224 </pre>
2225 <pre>
2226
2227
2228 foo
2229 </pre>
2230
2231 !!end
2232
2233 !!test
2234 HTML-pre: 2: indented text
2235 !!input
2236 <pre>
2237 foo
2238 </pre>
2239 !!result
2240 <pre>
2241 foo
2242 </pre>
2243
2244 !!end
2245
2246 !!test
2247 HTML-pre: 3: other wikitext
2248 !!input
2249 <pre>
2250 * foo
2251 # bar
2252 = no-h =
2253 '' no-italic ''
2254 [[ NoLink ]]
2255 </pre>
2256 !!result
2257 <pre>
2258 * foo
2259 # bar
2260 = no-h =
2261 '' no-italic ''
2262 [[ NoLink ]]
2263 </pre>
2264
2265 !!end
2266
2267 ###
2268 ### Definition lists
2269 ###
2270 !! test
2271 Simple definition
2272 !! input
2273 ; name : Definition
2274 !! result
2275 <dl>
2276 <dt> name&#160;</dt>
2277 <dd> Definition
2278 </dd>
2279 </dl>
2280
2281 !! end
2282
2283 !! test
2284 Definition list for indentation only
2285 !! input
2286 : Indented text
2287 !! result
2288 <dl>
2289 <dd> Indented text
2290 </dd>
2291 </dl>
2292
2293 !! end
2294
2295 !! test
2296 Definition list with no space
2297 !! input
2298 ;name:Definition
2299 !! result
2300 <dl>
2301 <dt>name</dt>
2302 <dd>Definition
2303 </dd>
2304 </dl>
2305
2306 !!end
2307
2308 !! test
2309 Definition list with URL link
2310 !! input
2311 ; http://example.com/ : definition
2312 !! result
2313 <dl>
2314 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2315 <dd> definition
2316 </dd>
2317 </dl>
2318
2319 !! end
2320
2321 !! test
2322 Definition list with bracketed URL link
2323 !! input
2324 ;[http://www.example.com/ Example]:Something about it
2325 !! result
2326 <dl>
2327 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2328 <dd>Something about it
2329 </dd>
2330 </dl>
2331
2332 !! end
2333
2334 !! test
2335 Definition list with wikilink containing colon
2336 !! input
2337 ; [[Help:FAQ]]: The least-read page on Wikipedia
2338 !! result
2339 <dl>
2340 <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>
2341 <dd> The least-read page on Wikipedia
2342 </dd>
2343 </dl>
2344
2345 !! end
2346
2347 # At Brion's and JeLuF's insistence... :)
2348 !! test
2349 Definition list with news link containing colon
2350 !! input
2351 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2352 !! result
2353 <dl>
2354 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2355 <dd> This isn't even a real newsgroup!
2356 </dd>
2357 </dl>
2358
2359 !! end
2360
2361 !! test
2362 Malformed definition list with colon
2363 !! input
2364 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2365 !! result
2366 <dl>
2367 <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
2368 </dt>
2369 </dl>
2370
2371 !! end
2372
2373 !! test
2374 Definition lists: colon in external link text
2375 !! input
2376 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2377 !! result
2378 <dl>
2379 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2380 <dd> OK, I made that up
2381 </dd>
2382 </dl>
2383
2384 !! end
2385
2386 !! test
2387 Definition lists: colon in HTML attribute
2388 !! input
2389 ;<b style="display: inline">bold</b>
2390 !! result
2391 <dl>
2392 <dt><b style="display: inline">bold</b>
2393 </dt>
2394 </dl>
2395
2396 !! end
2397
2398 !! test
2399 Definition lists: self-closed tag
2400 !! input
2401 ;one<br/>two : two-line fun
2402 !! result
2403 <dl>
2404 <dt>one<br />two&#160;</dt>
2405 <dd> two-line fun
2406 </dd>
2407 </dl>
2408
2409 !! end
2410
2411 !! test
2412 Bug 11748: Literal closing tags
2413 !! input
2414 <dl>
2415 <dt>test 1</dt>
2416 <dd>test test test test test</dd>
2417 <dt>test 2</dt>
2418 <dd>test test test test test</dd>
2419 </dl>
2420 !! result
2421 <dl>
2422 <dt>test 1</dt>
2423 <dd>test test test test test</dd>
2424 <dt>test 2</dt>
2425 <dd>test test test test test</dd>
2426 </dl>
2427
2428 !! end
2429
2430 !! test
2431 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2432 !! input
2433 <ul><li>
2434 ; term : description
2435 * unordered
2436 </li></ul>
2437 !! result
2438 <ul><li>
2439 <dl>
2440 <dt> term&#160;</dt>
2441 <dd> description
2442 </dd>
2443 </dl>
2444 <ul>
2445 <li> unordered
2446 </li>
2447 </ul>
2448 </li></ul>
2449
2450 !! end
2451
2452 !! test
2453
2454 Definition list with empty definition and following paragraph
2455 !! input
2456 ; term:
2457 Paragraph text
2458 !! result
2459 <dl>
2460 <dt> term</dt>
2461 <dd>
2462 </dd>
2463 </dl>
2464 <p>Paragraph text
2465 </p>
2466 !! end
2467
2468 !! test
2469 Nested definition lists using html syntax
2470 !! input
2471 <dl><dd>
2472 <dl>
2473 <dd>Foo</dd>
2474 </dl>
2475 </dd></dl>
2476 !! result
2477 <dl><dd>
2478 <dl>
2479 <dd>Foo</dd>
2480 </dl>
2481 </dd></dl>
2482
2483 !! end
2484
2485 !! test
2486 Definition Lists: No nesting: Multiple dd's
2487 !! input
2488 ;x
2489 :a
2490 :b
2491 !! result
2492 <dl>
2493 <dt>x
2494 </dt>
2495 <dd>a
2496 </dd>
2497 <dd>b
2498 </dd>
2499 </dl>
2500
2501 !! end
2502
2503 !! test
2504 Definition Lists: Indentation: Regular
2505 !! input
2506 :i1
2507 ::i2
2508 :::i3
2509 !! result
2510 <dl>
2511 <dd>i1
2512 <dl>
2513 <dd>i2
2514 <dl>
2515 <dd>i3
2516 </dd>
2517 </dl>
2518 </dd>
2519 </dl>
2520 </dd>
2521 </dl>
2522
2523 !! end
2524
2525 !! test
2526 Definition Lists: Indentation: Missing 1st level
2527 !! input
2528 ::i2
2529 :::i3
2530 !! result
2531 <dl>
2532 <dd><dl>
2533 <dd>i2
2534 <dl>
2535 <dd>i3
2536 </dd>
2537 </dl>
2538 </dd>
2539 </dl>
2540 </dd>
2541 </dl>
2542
2543 !! end
2544
2545 !! test
2546 Definition Lists: Indentation: Multi-level indent
2547 !! input
2548 :::i3
2549 !! result
2550 <dl>
2551 <dd><dl>
2552 <dd><dl>
2553 <dd>i3
2554 </dd>
2555 </dl>
2556 </dd>
2557 </dl>
2558 </dd>
2559 </dl>
2560
2561 !! end
2562
2563 !! test
2564 Definition Lists: Hacky use to indent tables
2565 !! input
2566 ::{|
2567 |foo
2568 |bar
2569 |}
2570 this text
2571 should be left alone
2572 !! result
2573 <dl><dd><dl><dd><table>
2574 <tr>
2575 <td>foo
2576 </td>
2577 <td>bar
2578 </td></tr></table></dd></dl></dd></dl>
2579 <p>this text
2580 should be left alone
2581 </p>
2582 !! end
2583
2584 # Bug 52473
2585 !! test
2586 Definition Lists: Hacky use to indent tables (WS-insensitive)
2587 !! options
2588 parsoid
2589 !! input
2590 : {|
2591 |a
2592 |}
2593 !! result
2594 <dl>
2595 <dd> <table><tr><td>a</td></tr></table> </dd>
2596 </dl>
2597 !! end
2598 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2599 ## as an empty dt item. It also ignores all but the last ";" when followed
2600 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2601 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2602 ## ";"s.
2603 ##
2604 ## Ex: ";;t2 ::d2" is transformed into:
2605 ##
2606 ## <dl>
2607 ## <dt>t2 </dt>
2608 ## <dd>
2609 ## <dl>
2610 ## <dt></dt>
2611 ## <dd>d2</dd>
2612 ## </dl>
2613 ## </dd>
2614 ## </dl>
2615 ##
2616 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2617 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2618 ##
2619 ## <dl>
2620 ## <dt>
2621 ## <dl>
2622 ## <dt>t2 </dt>
2623 ## <dd>:d2</dd>
2624 ## </dl>
2625 ## </dt>
2626 ## </dl>
2627 ##
2628 ## All Parsoid only definition list tests have this difference.
2629 ##
2630 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2631 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2632
2633 !! test
2634 Table / list interaction: indented table with lists in table contents
2635 !! input
2636 :{|
2637 |-
2638 | a
2639 * b
2640 |-
2641 | c
2642 * d
2643 |}
2644 !! result
2645 <dl><dd><table>
2646
2647 <tr>
2648 <td> a
2649 <ul>
2650 <li> b
2651 </li>
2652 </ul>
2653 </td></tr>
2654 <tr>
2655 <td> c
2656 <ul>
2657 <li> d
2658 </li>
2659 </ul>
2660 </td></tr></table></dd></dl>
2661
2662 !! end
2663
2664 !!test
2665 Table / list interaction: lists nested in tables nested in indented lists
2666 !!input
2667 :{|
2668 |
2669 :a
2670 :b
2671 |
2672 *c
2673 *d
2674 |}
2675
2676 *e
2677 *f
2678 !!result
2679 <dl><dd><table>
2680 <tr>
2681 <td>
2682 <dl>
2683 <dd>a
2684 </dd>
2685 <dd>b
2686 </dd>
2687 </dl>
2688 </td>
2689 <td>
2690 <ul>
2691 <li>c
2692 </li>
2693 <li>d
2694 </li>
2695 </ul>
2696 </td></tr></table></dd></dl>
2697 <ul>
2698 <li>e
2699 </li>
2700 <li>f
2701 </li>
2702 </ul>
2703
2704 !!end
2705
2706 !! test
2707 Definition Lists: Nesting: Multi-level (Parsoid only)
2708 !! options
2709 parsoid
2710 !! input
2711 ;t1 :d1
2712 ;;t2 ::d2
2713 ;;;t3 :::d3
2714 !! result
2715 <dl>
2716 <dt>t1 </dt>
2717 <dd>d1</dd>
2718 <dt>
2719 <dl>
2720 <dt>t2 </dt>
2721 <dd>:d2</dd>
2722 <dt>
2723 <dl>
2724 <dt>t3 </dt>
2725 <dd>::d3</dd>
2726 </dl>
2727 </dt>
2728 </dl>
2729 </dt>
2730 </dl>
2731
2732
2733 !! end
2734
2735
2736 !! test
2737 Definition Lists: Nesting: Test 2 (Parsoid only)
2738 !! options
2739 parsoid
2740 !! input
2741 ;t1
2742 ::d2
2743 !! result
2744 <dl>
2745 <dt>t1</dt>
2746 <dd>
2747 <dl>
2748 <dd>d2</dd>
2749 </dl>
2750 </dd>
2751 </dl>
2752
2753 !! end
2754
2755
2756 !! test
2757 Definition Lists: Nesting: Test 3 (Parsoid only)
2758 !! options
2759 parsoid
2760 !! input
2761 :;t1
2762 ::::d2
2763 !! result
2764 <dl>
2765 <dd>
2766 <dl>
2767 <dt>t1</dt>
2768 <dd>
2769 <dl>
2770 <dd>
2771 <dl>
2772 <dd>d2</dd>
2773 </dl>
2774 </dd>
2775 </dl>
2776 </dd>
2777 </dl>
2778 </dd>
2779 </dl>
2780
2781 !! end
2782
2783
2784 !! test
2785 Definition Lists: Nesting: Test 4
2786 !! input
2787 ::;t3
2788 :::d3
2789 !! result
2790 <dl>
2791 <dd><dl>
2792 <dd><dl>
2793 <dt>t3
2794 </dt>
2795 <dd>d3
2796 </dd>
2797 </dl>
2798 </dd>
2799 </dl>
2800 </dd>
2801 </dl>
2802
2803 !! end
2804
2805
2806 ## The Parsoid team believes the following three test exposes a
2807 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2808 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2809 !! test
2810 Definition Lists: Mixed Lists: Test 1 (php)
2811 !! options
2812 php
2813 !! input
2814 :;* foo
2815 ::* bar
2816 :; baz
2817 !! result
2818 <dl>
2819 <dd><dl>
2820 <dt><ul>
2821 <li> foo
2822 </li>
2823 <li> bar
2824 </li>
2825 </ul>
2826 </dt>
2827 </dl>
2828 <dl>
2829 <dt> baz
2830 </dt>
2831 </dl>
2832 </dd>
2833 </dl>
2834
2835 !! end
2836 !! test
2837 Definition Lists: Mixed Lists: Test 1 (parsoid)
2838 !! options
2839 parsoid
2840 !! input
2841 :;* foo
2842 ::* bar
2843 :; baz
2844 !! result
2845 <dl>
2846 <dd><dl>
2847 <dt><ul>
2848 <li> foo
2849 </li>
2850 </ul></dt>
2851 <dd><ul>
2852 <li> bar
2853 </li>
2854 </ul></dd>
2855 <dt> baz</dt>
2856 </dl></dd>
2857 </dl>
2858 !! end
2859
2860 !! test
2861 Definition Lists: Mixed Lists: Test 2
2862 !! input
2863 *: d1
2864 *: d2
2865 !! result
2866 <ul>
2867 <li><dl>
2868 <dd> d1
2869 </dd>
2870 <dd> d2
2871 </dd>
2872 </dl>
2873 </li>
2874 </ul>
2875
2876 !! end
2877
2878
2879 !! test
2880 Definition Lists: Mixed Lists: Test 3
2881 !! input
2882 *::: d1
2883 *::: d2
2884 !! result
2885 <ul>
2886 <li><dl>
2887 <dd><dl>
2888 <dd><dl>
2889 <dd> d1
2890 </dd>
2891 <dd> d2
2892 </dd>
2893 </dl>
2894 </dd>
2895 </dl>
2896 </dd>
2897 </dl>
2898 </li>
2899 </ul>
2900
2901 !! end
2902
2903
2904 !! test
2905 Definition Lists: Mixed Lists: Test 4
2906 !! input
2907 *;d1 :d2
2908 *;d3 :d4
2909 !! result
2910 <ul>
2911 <li><dl>
2912 <dt>d1&#160;</dt>
2913 <dd>d2
2914 </dd>
2915 <dt>d3&#160;</dt>
2916 <dd>d4
2917 </dd>
2918 </dl>
2919 </li>
2920 </ul>
2921
2922 !! end
2923
2924
2925 !! test
2926 Definition Lists: Mixed Lists: Test 5
2927 !! input
2928 *:d1
2929 *:: d2
2930 !! result
2931 <ul>
2932 <li><dl>
2933 <dd>d1
2934 <dl>
2935 <dd> d2
2936 </dd>
2937 </dl>
2938 </dd>
2939 </dl>
2940 </li>
2941 </ul>
2942
2943 !! end
2944
2945
2946 !! test
2947 Definition Lists: Mixed Lists: Test 6
2948 !! input
2949 #*:d1
2950 #*::: d3
2951 !! result
2952 <ol>
2953 <li><ul>
2954 <li><dl>
2955 <dd>d1
2956 <dl>
2957 <dd><dl>
2958 <dd> d3
2959 </dd>
2960 </dl>
2961 </dd>
2962 </dl>
2963 </dd>
2964 </dl>
2965 </li>
2966 </ul>
2967 </li>
2968 </ol>
2969
2970 !! end
2971
2972
2973 !! test
2974 Definition Lists: Mixed Lists: Test 7
2975 !! input
2976 :* d1
2977 :* d2
2978 !! result
2979 <dl>
2980 <dd><ul>
2981 <li> d1
2982 </li>
2983 <li> d2
2984 </li>
2985 </ul>
2986 </dd>
2987 </dl>
2988
2989 !! end
2990
2991
2992 !! test
2993 Definition Lists: Mixed Lists: Test 8
2994 !! input
2995 :* d1
2996 ::* d2
2997 !! result
2998 <dl>
2999 <dd><ul>
3000 <li> d1
3001 </li>
3002 </ul>
3003 <dl>
3004 <dd><ul>
3005 <li> d2
3006 </li>
3007 </ul>
3008 </dd>
3009 </dl>
3010 </dd>
3011 </dl>
3012
3013 !! end
3014
3015
3016 !! test
3017 Definition Lists: Mixed Lists: Test 9
3018 !! input
3019 *;foo :bar
3020 !! result
3021 <ul>
3022 <li><dl>
3023 <dt>foo&#160;</dt>
3024 <dd>bar
3025 </dd>
3026 </dl>
3027 </li>
3028 </ul>
3029
3030 !! end
3031
3032
3033 !! test
3034 Definition Lists: Mixed Lists: Test 10
3035 !! input
3036 *#;foo :bar
3037 !! result
3038 <ul>
3039 <li><ol>
3040 <li><dl>
3041 <dt>foo&#160;</dt>
3042 <dd>bar
3043 </dd>
3044 </dl>
3045 </li>
3046 </ol>
3047 </li>
3048 </ul>
3049
3050 !! end
3051
3052 # The Parsoid team disagrees with the PHP parser's seemingly-random
3053 # rules regarding dd/dt on the next two tests. Parsoid is more
3054 # consistent, and recognizes the shared nesting and keeps the
3055 # still-open tags around until the nesting is complete.
3056
3057 !! test
3058 Definition Lists: Mixed Lists: Test 11 (php)
3059 !! options
3060 php
3061 !! input
3062 *#*#;*;;foo :bar
3063 *#*#;boo :baz
3064 !! result
3065 <ul>
3066 <li><ol>
3067 <li><ul>
3068 <li><ol>
3069 <li><dl>
3070 <dt>foo&#160;</dt>
3071 <dd><ul>
3072 <li><dl>
3073 <dt><dl>
3074 <dt>bar
3075 </dt>
3076 </dl>
3077 </dd>
3078 </dl>
3079 </li>
3080 </ul>
3081 </dd>
3082 </dl>
3083 <dl>
3084 <dt>boo&#160;</dt>
3085 <dd>baz
3086 </dd>
3087 </dl>
3088 </li>
3089 </ol>
3090 </li>
3091 </ul>
3092 </li>
3093 </ol>
3094 </li>
3095 </ul>
3096
3097 !! end
3098 !! test
3099 Definition Lists: Mixed Lists: Test 11 (parsoid)
3100 !! options
3101 parsoid
3102 !! input
3103 *#*#;*;;foo :bar
3104 *#*#;boo :baz
3105 !! result
3106 <ul>
3107 <li>
3108 <ol>
3109 <li>
3110 <ul>
3111 <li>
3112 <ol>
3113 <li>
3114 <dl>
3115 <dt>
3116 <ul>
3117 <li>
3118 <dl>
3119 <dt>
3120 <dl>
3121 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3122 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3123 </dl></dt>
3124 </dl></li>
3125 </ul></dt>
3126 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3127 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3128 </dl></li>
3129 </ol></li>
3130 </ul></li>
3131 </ol></li>
3132 </ul>
3133 !! end
3134
3135
3136 !! test
3137 Definition Lists: Weird Ones: Test 1 (php)
3138 !! options
3139 php
3140 !! input
3141 *#;*::;; foo : bar (who uses this?)
3142 !! result
3143 <ul>
3144 <li><ol>
3145 <li><dl>
3146 <dt> foo&#160;</dt>
3147 <dd><ul>
3148 <li><dl>
3149 <dd><dl>
3150 <dd><dl>
3151 <dt><dl>
3152 <dt> bar (who uses this?)
3153 </dt>
3154 </dl>
3155 </dd>
3156 </dl>
3157 </dd>
3158 </dl>
3159 </dd>
3160 </dl>
3161 </li>
3162 </ul>
3163 </dd>
3164 </dl>
3165 </li>
3166 </ol>
3167 </li>
3168 </ul>
3169
3170 !! end
3171 !! test
3172 Definition Lists: Weird Ones: Test 1 (parsoid)
3173 !! options
3174 parsoid
3175 !! input
3176 *#;*::;; foo : bar (who uses this?)
3177 !! result
3178 <ul>
3179 <li>
3180 <ol>
3181 <li>
3182 <dl>
3183 <dt>
3184 <ul>
3185 <li>
3186 <dl>
3187 <dd>
3188 <dl>
3189 <dd>
3190 <dl>
3191 <dt>
3192 <dl>
3193 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3194 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3195 </dl></dt>
3196 </dl></dd>
3197 </dl></dd>
3198 </dl></li>
3199 </ul></dt>
3200 </dl></li>
3201 </ol></li>
3202 </ul>
3203 !! end
3204
3205 ###
3206 ### External links
3207 ###
3208 !! test
3209 External links: non-bracketed
3210 !! input
3211 Non-bracketed: http://example.com
3212 !! result
3213 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3214 </p>
3215 !! end
3216
3217 !! test
3218 External links: numbered
3219 !! input
3220 Numbered: [http://example.com]
3221 Numbered: [http://example.net]
3222 Numbered: [http://example.com]
3223 !! result
3224 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3225 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3226 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3227 </p>
3228 !!end
3229
3230 !! test
3231 External links: specified text
3232 !! input
3233 Specified text: [http://example.com link]
3234 !! result
3235 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3236 </p>
3237 !!end
3238
3239 !! test
3240 External links: trail
3241 !! input
3242 Linktrails should not work for external links: [http://example.com link]s
3243 !! result
3244 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3245 </p>
3246 !! end
3247
3248 !! test
3249 External links: dollar sign in URL
3250 !! input
3251 http://example.com/1$2345
3252 !! result
3253 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3254 </p>
3255 !! end
3256
3257 !! test
3258 External links: dollar sign in URL (named)
3259 !! input
3260 [http://example.com/1$2345]
3261 !! result
3262 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3263 </p>
3264 !!end
3265
3266 !! test
3267 External links: open square bracket forbidden in URL (bug 4377)
3268 !! input
3269 http://example.com/1[2345
3270 !! result
3271 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3272 </p>
3273 !! end
3274
3275 !! test
3276 External links: open square bracket forbidden in URL (named) (bug 4377)
3277 !! input
3278 [http://example.com/1[2345]
3279 !! result
3280 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3281 </p>
3282 !!end
3283
3284 !! test
3285 External links: nowiki in URL link text (bug 6230)
3286 !!input
3287 [http://example.com/ <nowiki>''example site''</nowiki>]
3288 !! result
3289 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3290 </p>
3291 !! end
3292
3293 !! test
3294 External links: newline forbidden in text (bug 6230 regression check)
3295 !! input
3296 [http://example.com/ first
3297 second]
3298 !! result
3299 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3300 second]
3301 </p>
3302 !!end
3303
3304 !! test
3305 External links: Pipe char between url and text
3306 !! input
3307 [http://example.com | link]
3308 !! result
3309 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3310 </p>
3311 !!end
3312
3313 !! test
3314 External links: protocol-relative URL in brackets
3315 !! input
3316 [//example.com/ Test]
3317 !! result
3318 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3319 </p>
3320 !! end
3321
3322 !! test
3323 External links: protocol-relative URL in brackets without text
3324 !! input
3325 [//example.com]
3326 !! result
3327 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3328 </p>
3329 !! end
3330
3331 !! test
3332 External links: protocol-relative URL in free text is left alone
3333 !! input
3334 //example.com/Foo
3335 !! result
3336 <p>//example.com/Foo
3337 </p>
3338 !!end
3339
3340 !! test
3341 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3342 !! input
3343 foo//example.com/Foo
3344 !! result
3345 <p>foo//example.com/Foo
3346 </p>
3347 !! end
3348
3349 !! test
3350 External image
3351 !! input
3352 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3353 !! result
3354 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3355 </p>
3356 !! end
3357
3358 !! test
3359 External image from https
3360 !! input
3361 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3362 !! result
3363 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3364 </p>
3365 !! end
3366
3367 !! test
3368 External image (when not allowed)
3369 !! options
3370 wgAllowExternalImages=0
3371 !! input
3372 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3373 !! result
3374 <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>
3375 </p>
3376 !! end
3377
3378 !! test
3379 Link to non-http image, no img tag
3380 !! input
3381 Link to non-http image, no img tag: ftp://example.com/test.jpg
3382 !! result
3383 <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>
3384 </p>
3385 !! end
3386
3387 !! test
3388 External links: terminating separator
3389 !! input
3390 Terminating separator: http://example.com/thing,
3391 !! result
3392 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3393 </p>
3394 !! end
3395
3396 !! test
3397 External links: intervening separator
3398 !! input
3399 Intervening separator: http://example.com/1,2,3
3400 !! result
3401 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3402 </p>
3403 !! end
3404
3405 !! test
3406 External links: old bug with URL in query
3407 !! input
3408 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3409 !! result
3410 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3411 </p>
3412 !! end
3413
3414 !! test
3415 External links: old URL-in-URL bug, mixed protocols
3416 !! input
3417 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3418 !! result
3419 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3420 </p>
3421 !!end
3422
3423 !! test
3424 External links: URL in text
3425 !! input
3426 URL in text: [http://example.com http://example.com]
3427 !! result
3428 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3429 </p>
3430 !! end
3431
3432 !! test
3433 External links: Clickable images
3434 !! input
3435 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3436 !! result
3437 <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>
3438 </p>
3439 !!end
3440
3441 !! test
3442 External links: raw ampersand
3443 !! input
3444 Old &amp; use: http://x&y
3445 !! result
3446 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3447 </p>
3448 !! end
3449
3450 !! test
3451 External links: encoded ampersand
3452 !! input
3453 Old &amp; use: http://x&amp;y
3454 !! result
3455 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3456 </p>
3457 !! end
3458
3459 !! test
3460 External links: encoded equals (bug 6102)
3461 !! input
3462 http://example.com/?foo&#61;bar
3463 !! result
3464 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3465 </p>
3466 !! end
3467
3468 !! test
3469 External links: [raw ampersand]
3470 !! input
3471 Old &amp; use: [http://x&y]
3472 !! result
3473 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3474 </p>
3475 !! end
3476
3477 !! test
3478 External links: [encoded ampersand]
3479 !! input
3480 Old &amp; use: [http://x&amp;y]
3481 !! result
3482 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3483 </p>
3484 !! end
3485
3486 !! test
3487 External links: [encoded equals] (bug 6102)
3488 !! input
3489 [http://example.com/?foo&#61;bar]
3490 !! result
3491 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3492 </p>
3493 !! end
3494
3495 !! test
3496 External links: [IDN ignored character reference in hostname; strip it right off]
3497 !! input
3498 [http://e&zwnj;xample.com/]
3499 !! result
3500 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3501 </p>
3502 !! end
3503
3504 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3505 # Where an external link could easily circumvent the sanitization of the text of
3506 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3507 # test demands a higher standard. That's a bit strange.
3508 #
3509 # Example:
3510 #
3511 # http://e‌xample.com -> [http://example.com|http://example.com]
3512 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3513 #
3514 # The first example is sanitized, but the second is not. Any security benefits
3515 # from this production are trivial to circumvent. Either remove this test and
3516 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3517 # the test accordingly.
3518 #
3519 # All our love,
3520 # The Parsoid team.
3521 !! test
3522 External links: IDN ignored character reference in hostname; strip it right off
3523 !! input
3524 http://e&zwnj;xample.com/
3525 !! result
3526 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3527 </p>
3528 !! end
3529
3530 !! test
3531 External links: www.jpeg.org (bug 554)
3532 !! input
3533 http://www.jpeg.org
3534 !!result
3535 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3536 </p>
3537 !! end
3538
3539 !! test
3540 External links: URL within URL (original bug 2)
3541 !! input
3542 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3543 !! result
3544 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3545 </p>
3546 !! end
3547
3548 !! test
3549 BUG 361: URL inside bracketed URL
3550 !! input
3551 [http://www.example.com/foo http://www.example.com/bar]
3552 !! result
3553 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3554 </p>
3555 !! end
3556
3557 !! test
3558 BUG 361: URL within URL, not bracketed
3559 !! input
3560 http://www.example.com/foo?=http://www.example.com/bar
3561 !! result
3562 <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>
3563 </p>
3564 !! end
3565
3566 !! test
3567 BUG 289: ">"-token in URL-tail
3568 !! input
3569 http://www.example.com/<hello>
3570 !! result
3571 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3572 </p>
3573 !!end
3574
3575 !! test
3576 BUG 289: literal ">"-token in URL-tail
3577 !! input
3578 http://www.example.com/<b>html</b>
3579 !! result
3580 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3581 </p>
3582 !!end
3583
3584 !! test
3585 BUG 289: ">"-token in bracketed URL
3586 !! input
3587 [http://www.example.com/<hello> stuff]
3588 !! result
3589 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3590 </p>
3591 !!end
3592
3593 !! test
3594 BUG 289: literal ">"-token in bracketed URL
3595 !! input
3596 [http://www.example.com/<b>html</b> stuff]
3597 !! result
3598 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3599 </p>
3600 !!end
3601
3602 !! test
3603 BUG 289: literal double quote at end of URL
3604 !! input
3605 http://www.example.com/"hello"
3606 !! result
3607 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3608 </p>
3609 !!end
3610
3611 !! test
3612 BUG 289: literal double quote in bracketed URL
3613 !! input
3614 [http://www.example.com/"hello" stuff]
3615 !! result
3616 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3617 </p>
3618 !!end
3619
3620 !! test
3621 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3622 !! input
3623 [http://www.example.com test]
3624 !! result
3625 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3626 </p>
3627 !! end
3628
3629 !! test
3630 External links: link text with spaces
3631 !! input
3632 [http://www.example.com a b c]
3633 [http://www.example.com ''a'' ''b'']
3634 !! result
3635 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3636 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3637 </p>
3638 !! end
3639
3640 !! test
3641 External links: wiki links within external link (Bug 3695)
3642 !! input
3643 [http://example.com [[wikilink]] embedded in ext link]
3644 !! result
3645 <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>
3646 </p>
3647 !! end
3648
3649 !! test
3650 BUG 787: Links with one slash after the url protocol are invalid
3651 !! input
3652 http:/example.com
3653
3654 [http:/example.com title]
3655 !! result
3656 <p>http:/example.com
3657 </p><p>[http:/example.com title]
3658 </p>
3659 !! end
3660
3661 !! test
3662 Bracketed external links with template-generated invalid target
3663 !! input
3664 [{{echo|http:/example.com}} title]
3665 !! result
3666 <p>[http:/example.com title]
3667 </p>
3668 !! end
3669
3670 !! test
3671 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3672 !! input
3673 ''[http://example.com text'']
3674 [http://example.com '''text]'''
3675 ''Something [http://example.com in italic'']
3676 ''Something [http://example.com mixed''''', even bold]'''
3677 '''''Now [http://example.com both''''']
3678 !! result
3679 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3680 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3681 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3682 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3683 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3684 </p>
3685 !! end
3686
3687
3688 !! test
3689 Bug 4781: %26 in URL
3690 !! input
3691 http://www.example.com/?title=AT%26T
3692 !! result
3693 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3694 </p>
3695 !! end
3696
3697 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3698 # % is actually legal in HTML5. Any change in output would need testing though.
3699 !! test
3700 Bug 4781, 5267: %25 in URL
3701 !! input
3702 http://www.example.com/?title=100%25_Bran
3703 !! result
3704 <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>
3705 </p>
3706 !! end
3707
3708 !! test
3709 Bug 4781, 5267: %28, %29 in URL
3710 !! input
3711 http://www.example.com/?title=Ben-Hur_%281959_film%29
3712 !! result
3713 <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>
3714 </p>
3715 !! end
3716
3717
3718 !! test
3719 Bug 4781: %26 in autonumber URL
3720 !! input
3721 [http://www.example.com/?title=AT%26T]
3722 !! result
3723 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3724 </p>
3725 !! end
3726
3727 !! test
3728 Bug 4781, 5267: %26 in autonumber URL
3729 !! input
3730 [http://www.example.com/?title=100%25_Bran]
3731 !! result
3732 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3733 </p>
3734 !! end
3735
3736 !! test
3737 Bug 4781, 5267: %28, %29 in autonumber URL
3738 !! input
3739 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3740 !! result
3741 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3742 </p>
3743 !! end
3744
3745
3746 !! test
3747 Bug 4781: %26 in bracketed URL
3748 !! input
3749 [http://www.example.com/?title=AT%26T link]
3750 !! result
3751 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3752 </p>
3753 !! end
3754
3755 !! test
3756 Bug 4781, 5267: %26 in bracketed URL
3757 !! input
3758 [http://www.example.com/?title=100%25_Bran link]
3759 !! result
3760 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3761 </p>
3762 !! end
3763
3764 !! test
3765 Bug 4781, 5267: %28, %29 in bracketed URL
3766 !! input
3767 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3768 !! result
3769 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3770 </p>
3771 !! end
3772
3773 !! test
3774 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3775 !! input
3776 Some [http://example.com/ pretty ''italics'' and stuff]!
3777 !! result
3778 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3779 </p>
3780 !! end
3781
3782 !! test
3783 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3784 !! input
3785 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3786 !! result
3787 <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>
3788 </p>
3789 !! end
3790
3791 !! test
3792 External link containing double-single-quotes with no space separating the url from text in italics
3793 !! input
3794 [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]].]
3795 !! result
3796 <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>
3797 </p>
3798 !! end
3799
3800 !! test
3801 External link with comments in link text
3802 !! input
3803 [http://www.google.com Google <!-- comment -->]
3804 !! result
3805 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3806 </p>
3807 !! end
3808
3809 !! test
3810 URL-encoding in URL functions (single parameter)
3811 !! input
3812 {{localurl:Some page|amp=&}}
3813 !! result
3814 <p>/index.php?title=Some_page&amp;amp=&amp;
3815 </p>
3816 !! end
3817
3818 !! test
3819 URL-encoding in URL functions (multiple parameters)
3820 !! input
3821 {{localurl:Some page|q=?&amp=&}}
3822 !! result
3823 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3824 </p>
3825 !! end
3826
3827 !! test
3828 Brackets in urls
3829 !! input
3830 http://example.com/index.php?foozoid%5B%5D=bar
3831
3832 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3833 !! result
3834 <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>
3835 </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>
3836 </p>
3837 !! end
3838
3839 !! test
3840 IPv6 urls (bug 21261)
3841 !! options
3842 disabled
3843 !! input
3844 http://[2404:130:0:1000::187:2]/index.php
3845 !! result
3846 <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>
3847 </p>
3848 !! end
3849
3850 !! test
3851 Non-extlinks in brackets
3852 !! input
3853 [foo]
3854 [foo bar]
3855 [foo ''bar'']
3856 [fool's] errand
3857 [fool's errand]
3858 [{{echo|foo}}]
3859 [{{echo|foo}} bar]
3860 [{{echo|foo}} ''bar'']
3861 [{{echo|foo}}l's] errand
3862 [{{echo|foo}}l's errand]
3863 [url={{echo|foo}}]
3864 [url=http://example.com]
3865 !! result
3866 <p>[foo]
3867 [foo bar]
3868 [foo <i>bar</i>]
3869 [fool's] errand
3870 [fool's errand]
3871 [foo]
3872 [foo bar]
3873 [foo <i>bar</i>]
3874 [fool's] errand
3875 [fool's errand]
3876 [url=foo]
3877 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3878 </p>
3879 !! end
3880
3881 !! test
3882 Parsoid: Percent encoding in external links
3883 !! options
3884 parsoid
3885 !! input
3886 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3887 !! result
3888 <p><a rel="mw:ExtLink"
3889 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3890 !! end
3891
3892 !! test
3893 Parsoid: use url link syntax for links where the content is equal the link
3894 target
3895 !! options
3896 parsoid
3897 !! input
3898 http://example.com
3899 !! result
3900 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3901 !! end
3902
3903 ###
3904 ### Quotes
3905 ###
3906
3907 !! test
3908 Quotes
3909 !! input
3910 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3911
3912 Normal text. '''''Bold italic text.''''' Normal text.
3913 !!result
3914 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3915 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3916 </p>
3917 !! end
3918
3919
3920 !! test
3921 Unclosed and unmatched quotes (php)
3922 !! options
3923 php
3924 !! input
3925 '''''Bold italic text '''with bold deactivated''' in between.'''''
3926
3927 '''''Bold italic text ''with italic deactivated'' in between.'''''
3928
3929 '''Bold text..
3930
3931 ..spanning two paragraphs (should not work).'''
3932
3933 '''Bold tag left open
3934
3935 ''Italic tag left open
3936
3937 Normal text.
3938
3939 <!-- Unmatching number of opening, closing tags: -->
3940 '''This year''''s election ''should'' beat '''last year''''s.
3941
3942 ''Tom'''s car is bigger than ''Susan'''s.
3943
3944 Plain ''italic'''s plain
3945 !! result
3946 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3947 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3948 </p><p><b>Bold text..</b>
3949 </p><p>..spanning two paragraphs (should not work).
3950 </p><p><b>Bold tag left open</b>
3951 </p><p><i>Italic tag left open</i>
3952 </p><p>Normal text.
3953 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3954 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3955 </p><p>Plain <i>italic'</i>s plain
3956 </p>
3957 !! end
3958 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3959 # parser strips. The wikitext contains just the first half of the bold
3960 # quote pair.
3961 !! test
3962 Unclosed and unmatched quotes (parsoid)
3963 !! options
3964 parsoid
3965 !! input
3966 '''''Bold italic text '''with bold deactivated''' in between.'''''
3967
3968 '''''Bold italic text ''with italic deactivated'' in between.'''''
3969
3970 '''Bold text..
3971
3972 ..spanning two paragraphs (should not work).'''
3973
3974 '''Bold tag left open
3975
3976 ''Italic tag left open
3977
3978 Normal text.
3979
3980 <!-- Unmatching number of opening, closing tags: -->
3981 '''This year''''s election ''should'' beat '''last year''''s.
3982
3983 ''Tom'''s car is bigger than ''Susan'''s.
3984
3985 Plain ''italic'''s plain
3986 !! result
3987 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3988 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3989 </p><p><b>Bold text..</b>
3990 </p><p>..spanning two paragraphs (should not work).<b></b>
3991 </p><p><b>Bold tag left open</b>
3992 </p><p><i>Italic tag left open</i>
3993 </p><p>Normal text.
3994 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3995 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3996 </p><p>Plain <i>italic'</i>s plain
3997 </p>
3998 !! end
3999
4000 ###
4001 ### Tables
4002 ###
4003 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4004 ###
4005
4006 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4007 # is the bare minimum required by the spec, see:
4008 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4009 !! test
4010 A table with no data. (php)
4011 !! options
4012 php
4013 !! input
4014 {||}
4015 !! result
4016 !! end
4017 # Parsoid team replies: empty table tags are legal in HTML5
4018 !! test
4019 A table with no data. (parsoid)
4020 !! options
4021 parsoid
4022 !! input
4023 {||}
4024 !! result
4025 <table></table>
4026 !! end
4027
4028 # A table with nothing but a caption is invalid XHTML, we might want to render
4029 # this as <p>caption</p>
4030 !! test
4031 A table with nothing but a caption (php)
4032 !! options
4033 php
4034 !! input
4035 {|
4036 |+ caption
4037 |}
4038 !! result
4039 <table>
4040 <caption> caption
4041 </caption><tr><td></td></tr></table>
4042
4043 !! end
4044 # Parsoid team replies: table with only a caption is legal in HTML5
4045 !! test
4046 A table with nothing but a caption (parsoid)
4047 !! options
4048 parsoid
4049 !! input
4050 {|
4051 |+ caption
4052 |}
4053 !! result
4054 <table><caption> caption</caption></table>
4055 !! end
4056
4057 !! test
4058 A table with caption with default-spaced attributes and a table row
4059 !! input
4060 {|
4061 |+ style="color: red;" | caption1
4062 |-
4063 | foo
4064 |}
4065 !! result
4066 <table>
4067 <caption style="color: red;"> caption1
4068 </caption>
4069 <tr>
4070 <td> foo
4071 </td></tr></table>
4072
4073 !! end
4074
4075 !! test
4076 A table with captions with non-default spaced attributes and a table row
4077 !! input
4078 {|
4079 |+style="color: red;"|caption2
4080 |+ style="color: red;"| caption3
4081 |-
4082 | foo
4083 |}
4084 !! result
4085 <table>
4086 <caption style="color: red;">caption2
4087 </caption>
4088 <caption style="color: red;"> caption3
4089 </caption>
4090 <tr>
4091 <td> foo
4092 </td></tr></table>
4093
4094 !! end
4095
4096 !! test
4097 Table td-cell syntax variations
4098 !! input
4099 {|
4100 | foo bar foo | baz
4101 | foo bar foo || baz
4102 | style='color:red;' | baz
4103 | style='color:red;' || baz
4104 |}
4105 !! result
4106 <table>
4107 <tr>
4108 <td> baz
4109 </td>
4110 <td> foo bar foo </td>
4111 <td> baz
4112 </td>
4113 <td style="color:red;"> baz
4114 </td>
4115 <td> style='color:red;' </td>
4116 <td> baz
4117 </td></tr></table>
4118
4119 !! end
4120
4121 !! test
4122 Simple table
4123 !! input
4124 {|
4125 | 1 || 2
4126 |-
4127 | 3 || 4
4128 |}
4129 !! result
4130 <table>
4131 <tr>
4132 <td> 1 </td>
4133 <td> 2
4134 </td></tr>
4135 <tr>
4136 <td> 3 </td>
4137 <td> 4
4138 </td></tr></table>
4139
4140 !! end
4141
4142 !! test
4143 Simple table but with multiple dashes for row wikitext
4144 !! input
4145 {|
4146 | foo
4147 |-----
4148 | bar
4149 |}
4150 !! result
4151 <table>
4152 <tr>
4153 <td> foo
4154 </td></tr>
4155 <tr>
4156 <td> bar
4157 </td></tr></table>
4158
4159 !! end
4160 !! test
4161 Multiplication table
4162 !! input
4163 {| border="1" cellpadding="2"
4164 |+Multiplication table
4165 |-
4166 ! &times; !! 1 !! 2 !! 3
4167 |-
4168 ! 1
4169 | 1 || 2 || 3
4170 |-
4171 ! 2
4172 | 2 || 4 || 6
4173 |-
4174 ! 3
4175 | 3 || 6 || 9
4176 |-
4177 ! 4
4178 | 4 || 8 || 12
4179 |-
4180 ! 5
4181 | 5 || 10 || 15
4182 |}
4183 !! result
4184 <table border="1" cellpadding="2">
4185 <caption>Multiplication table
4186 </caption>
4187 <tr>
4188 <th> &#215; </th>
4189 <th> 1 </th>
4190 <th> 2 </th>
4191 <th> 3
4192 </th></tr>
4193 <tr>
4194 <th> 1
4195 </th>
4196 <td> 1 </td>
4197 <td> 2 </td>
4198 <td> 3
4199 </td></tr>
4200 <tr>
4201 <th> 2
4202 </th>
4203 <td> 2 </td>
4204 <td> 4 </td>
4205 <td> 6
4206 </td></tr>
4207 <tr>
4208 <th> 3
4209 </th>
4210 <td> 3 </td>
4211 <td> 6 </td>
4212 <td> 9
4213 </td></tr>
4214 <tr>
4215 <th> 4
4216 </th>
4217 <td> 4 </td>
4218 <td> 8 </td>
4219 <td> 12
4220 </td></tr>
4221 <tr>
4222 <th> 5
4223 </th>
4224 <td> 5 </td>
4225 <td> 10 </td>
4226 <td> 15
4227 </td></tr></table>
4228
4229 !! end
4230
4231 !! test
4232 Accept "||" in table headings
4233 !! input
4234 {|
4235 !h1 || h2
4236 |}
4237 !! result
4238 <table>
4239 <tr>
4240 <th>h1 </th>
4241 <th> h2
4242 </th></tr></table>
4243
4244 !! end
4245
4246 !! test
4247 Accept "||" in indented table headings
4248 !! input
4249 :{|
4250 !h1 || h2
4251 |}
4252 !! result
4253 <dl><dd><table>
4254 <tr>
4255 <th>h1 </th>
4256 <th> h2
4257 </th></tr></table></dd></dl>
4258
4259 !! end
4260
4261 !! test
4262 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4263 !! input
4264 {|
4265 !| h1
4266 || a
4267 |}
4268 !! result
4269 <table>
4270 <tr>
4271 <th> h1
4272 </th>
4273 <td> a
4274 </td></tr></table>
4275
4276 !! end
4277
4278 !!test
4279 Accept "| !" at start of line in tables (ignore !-attribute)
4280 !!input
4281 {|
4282 |-
4283 | !style="color:red" | bar
4284 |}
4285 !!result
4286 <table>
4287
4288 <tr>
4289 <td> bar
4290 </td></tr></table>
4291
4292 !!end
4293
4294 !!test
4295 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 +/-
4296 !!input
4297 {|
4298 |-
4299 |style='color:red;'|+1
4300 |style='color:blue;'|-1
4301 |-
4302 | 1 || 2 || 3
4303 | 1 ||+2 ||-3
4304 |-
4305 | +1
4306 | -1
4307 |}
4308 !!result
4309 <table>
4310
4311 <tr>
4312 <td style="color:red;">+1
4313 </td>
4314 <td style="color:blue;">-1
4315 </td></tr>
4316 <tr>
4317 <td> 1 </td>
4318 <td> 2 </td>
4319 <td> 3
4320 </td>
4321 <td> 1 </td>
4322 <td>+2 </td>
4323 <td>-3
4324 </td></tr>
4325 <tr>
4326 <td> +1
4327 </td>
4328 <td> -1
4329 </td></tr></table>
4330
4331 !!end
4332
4333 !! test
4334 Table rowspan
4335 !! input
4336 {| border=1
4337 | Cell 1, row 1
4338 |rowspan=2| Cell 2, row 1 (and 2)
4339 | Cell 3, row 1
4340 |-
4341 | Cell 1, row 2
4342 | Cell 3, row 2
4343 |}
4344 !! result
4345 <table border="1">
4346 <tr>
4347 <td> Cell 1, row 1
4348 </td>
4349 <td rowspan="2"> Cell 2, row 1 (and 2)
4350 </td>
4351 <td> Cell 3, row 1
4352 </td></tr>
4353 <tr>
4354 <td> Cell 1, row 2
4355 </td>
4356 <td> Cell 3, row 2
4357 </td></tr></table>
4358
4359 !! end
4360
4361 !! test
4362 Nested table
4363 !! input
4364 {| border=1
4365 | &alpha;
4366 |
4367 {| bgcolor=#ABCDEF border=2
4368 |nested
4369 |-
4370 |table
4371 |}
4372 |the original table again
4373 |}
4374 !! result
4375 <table border="1">
4376 <tr>
4377 <td> &#945;
4378 </td>
4379 <td>
4380 <table bgcolor="#ABCDEF" border="2">
4381 <tr>
4382 <td>nested
4383 </td></tr>
4384 <tr>
4385 <td>table
4386 </td></tr></table>
4387 </td>
4388 <td>the original table again
4389 </td></tr></table>
4390
4391 !! end
4392
4393 !! test
4394 Invalid attributes in table cell (bug 1830)
4395 !! input
4396 {|
4397 |Cell:|broken
4398 |}
4399 !! result
4400 <table>
4401 <tr>
4402 <td>broken
4403 </td></tr></table>
4404
4405 !! end
4406
4407
4408 !! test
4409 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4410 !! input
4411 {|
4412 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4413 !! result
4414 <table>
4415 <tr>
4416 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4417 <td>]" onmouseover="alert(document.cookie)"&gt;test
4418 </td>
4419 </tr>
4420 </table>
4421
4422 !! end
4423
4424
4425 !! test
4426 Indented table markup mixed with indented pre content (proposed in bug 6200)
4427 !! input
4428 <table>
4429 <tr>
4430 <td>
4431 Text that should be rendered preformatted
4432 </td>
4433 </tr>
4434 </table>
4435 !! result
4436 <table>
4437 <tr>
4438 <td>
4439 <pre>Text that should be rendered preformatted
4440 </pre>
4441 </td>
4442 </tr>
4443 </table>
4444
4445 !! end
4446
4447 !! test
4448 Template-generated table cell attributes and cell content
4449 !! input
4450 {|
4451 |{{table_attribs}}
4452 | {{table_attribs}}
4453 |}
4454 !! result
4455 <table>
4456 <tr>
4457 <td style="color: red"> Foo
4458 </td>
4459 <td style="color: red"> Foo
4460 </td></tr></table>
4461
4462 !! end
4463
4464 !! test
4465 Template-generated table cell attributes and cell content (2)
4466 !! input
4467 {|
4468 |align=center {{table_attribs}}
4469 |}
4470 !! result
4471 <table>
4472 <tr>
4473 <td align="center" style="color: red"> Foo
4474 </td></tr></table>
4475
4476 !! end
4477
4478 !! test
4479 Template-generated table cell attributes and cell content (3)
4480 !! input
4481 {|
4482 |align=center {{table_cells}}
4483 |}
4484 !! result
4485 <table>
4486 <tr>
4487 <td align="center" style="color: red"> Foo </td>
4488 <td> Bar </td>
4489 <td> Baz
4490 </td></tr></table>
4491
4492 !! end
4493
4494 !! test
4495 Table with row followed by newlines and table heading
4496 !! input
4497 {|
4498 |-
4499
4500 ! foo
4501 |}
4502 !! result
4503 <table>
4504
4505
4506 <tr>
4507 <th> foo
4508 </th></tr></table>
4509
4510 !! end
4511
4512 !! test
4513 Table with empty line following the start tag
4514 !! input
4515 {|
4516
4517 |-
4518 | foo
4519 |}
4520 !! result
4521 <table>
4522
4523
4524 <tr>
4525 <td> foo
4526 </td></tr></table>
4527
4528 !! end
4529
4530 # FIXME: Preserve the attribute properly (with an empty string as value) in
4531 # the PHP parser. Parsoid implements the behavior below.
4532 !! test
4533 Table attributes with empty value
4534 !! options
4535 parsoid
4536 !! input
4537 {|
4538 | style=| hello
4539 |}
4540 !! result
4541 <table>
4542 <tbody>
4543 <tr>
4544 <td style=""> hello
4545 </td></tr></tbody></table>
4546
4547 !! end
4548
4549 !! test
4550 Wikitext table with a lot of comments
4551 !! input
4552 {|
4553 <!-- c0 -->
4554 | foo
4555 <!-- c1 -->
4556 |- <!-- c2 -->
4557 <!-- c3 -->
4558 |<!-- c4 -->
4559 <!-- c5 -->
4560 |}
4561 !! result
4562 <table>
4563 <tr>
4564 <td> foo
4565 </td></tr>
4566 <tr>
4567 <td>
4568 </td></tr></table>
4569
4570 !! end
4571
4572 !! test
4573 Wikitext table with double-line table cell
4574 !! input
4575 {|
4576 |a
4577 b
4578 |}
4579 !! result
4580 <table>
4581 <tr>
4582 <td>a
4583 <p>b
4584 </p>
4585 </td></tr></table>
4586
4587 !! end
4588
4589 !! test
4590 Table cell with a single comment
4591 !! input
4592 {|
4593 | <!-- c1 -->
4594 | a
4595 |}
4596 !! result
4597 <table>
4598 <tr>
4599 <td>
4600 </td>
4601 <td> a
4602 </td></tr></table>
4603
4604 !! end
4605
4606 # The expected HTML structure in this test is debatable. The PHP parser does
4607 # not parse this kind of table at all. The main focus for Parsoid is on
4608 # round-tripping, so this output is ok for now. TODO: revisit!
4609 !! test
4610 Wikitext table with html-syntax row (Parsoid)
4611 !! options
4612 parsoid
4613 !! input
4614 {|
4615 |-
4616 <td>foo</td>
4617 |}
4618 !! result
4619 <table>
4620 <tbody>
4621 <tr>
4622 <td>foo</td></tr></tbody></table>
4623 !! end
4624
4625 !! test
4626 Implicit <td> after a |-
4627 (PHP parser relies on Tidy to add the missing <td> tags)
4628 !! options
4629 parsoid=wt2html,wt2wt
4630 !! input
4631 {|
4632 |-
4633 a
4634 |}
4635 !! result
4636 <table>
4637 <tr><td>a</td></tr>
4638 </table>
4639 !! end
4640
4641 !! test
4642 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4643 (PHP parser relies on Tidy to add the missing <td> tags)
4644 !! options
4645 parsoid=wt2html,wt2wt
4646 !! input
4647 {|
4648 |-
4649 |
4650 a
4651 |-
4652 b
4653 |}
4654 !! result
4655 <table>
4656 <tbody>
4657 <tr><td><pre>a</pre></td></tr>
4658 <tr><td> b</td></tr>
4659 </tbody>
4660 </table>
4661 !! end
4662
4663 !! test
4664 Lists should be recognized in an implicit <td> context
4665 (PHP parser relies on Tidy to add the missing <td> tags)
4666 !! options
4667 parsoid=wt2html,wt2wt
4668 !! input
4669 {|
4670 |-
4671 *a
4672 |}
4673 !! result
4674 <table>
4675 <tr>
4676 <td><ul>
4677 <li>a</li>
4678 </ul></td>
4679 </tr>
4680 </table>
4681 !! end
4682
4683 !! test
4684 Parsoid: Round-trip tables directly followed by content (bug 51219)
4685 !! options
4686 parsoid=wt2html,wt2wt
4687 !! input
4688 {|
4689 |foo
4690 |} bar
4691
4692 {|
4693 |baz
4694 |}<b>quux</b>
4695 !! result
4696 <table><tbody>
4697 <tr>
4698 <td>foo</td></tr></tbody></table> bar
4699 <table>
4700 <tbody>
4701 <tr>
4702 <td>baz</td></tr></tbody></table><b>quux</b>
4703 !! end
4704
4705 !! test
4706 Parsoid: Default to a newline after tables in new content (bug 51219)
4707 !! options
4708 parsoid=html2wt
4709 !! input
4710 {|
4711 |foo
4712 |}
4713 <nowiki> </nowiki>bar
4714 {|
4715 |baz
4716 |}
4717 '''quux'''
4718 !! result
4719 <table><tbody>
4720 <tr><td>foo</td></tr></tbody></table> bar
4721 <table><tbody>
4722 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4723 !! end
4724
4725 ###
4726 ### Internal links
4727 ###
4728 !! test
4729 Plain link, capitalized
4730 !! input
4731 [[Main Page]]
4732 !! result
4733 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4734 </p>
4735 !! end
4736
4737 !! test
4738 Plain link, uncapitalized
4739 !! input
4740 [[main Page]]
4741 !! result
4742 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4743 </p>
4744 !! end
4745
4746 !! test
4747 Piped link
4748 !! input
4749 [[Main Page|The Main Page]]
4750 !! result
4751 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4752 </p>
4753 !! end
4754
4755 !! test
4756 Piped link with comment in link text
4757 !! input
4758 [[Main Page|The Main<!--front--> Page]]
4759 !! result
4760 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4761 </p>
4762 !! end
4763
4764 !! test
4765 Broken link
4766 !! input
4767 [[Zigzagzogzagzig]]
4768 !! result
4769 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4770 </p>
4771 !! end
4772
4773 !! test
4774 Broken link with fragment
4775 !! input
4776 [[Zigzagzogzagzig#zug]]
4777 !! result
4778 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4779 </p>
4780 !! end
4781
4782 !! test
4783 Special page link with fragment
4784 !! input
4785 [[Special:Version#anchor]]
4786 !! result
4787 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4788 </p>
4789 !! end
4790
4791 !! test
4792 Nonexistent special page link with fragment
4793 !! input
4794 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4795 !! result
4796 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4797 </p>
4798 !! end
4799
4800 !! test
4801 Link with prefix
4802 !! input
4803 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4804 !! result
4805 <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>
4806 </p>
4807 !! end
4808
4809 !! test
4810 Link with suffix
4811 !! input
4812 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4813 !! result
4814 <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>!!!
4815 </p>
4816 !! end
4817
4818 !! article
4819 prefixed article
4820 !! text
4821 Some text
4822 !! endarticle
4823
4824 !! test
4825 Bug 43661: Piped links with identical prefixes
4826 !! input
4827 [[prefixed article|prefixed articles with spaces]]
4828
4829 [[prefixed article|prefixed articlesaoeu]]
4830
4831 [[Main Page|Main Page test]]
4832 !! result
4833 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4834 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4835 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4836 </p>
4837 !! end
4838
4839
4840 !! test
4841 Link with HTML entity in suffix / tail
4842 !! input
4843 [[Main Page]]&quot;, [[Main Page]]&#97;
4844 !! result
4845 <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;
4846 </p>
4847 !! end
4848
4849 !! test
4850 Link with 3 brackets
4851 !! input
4852 [[[main page]]]
4853 !! result
4854 <p>[[[main page]]]
4855 </p>
4856 !! end
4857
4858 !! test
4859 Piped link with 3 brackets
4860 !! input
4861 [[[main page|the main page]]]
4862 !! result
4863 <p>[[[main page|the main page]]]
4864 </p>
4865 !! end
4866
4867 !! test
4868 Link with multiple pipes
4869 !! input
4870 [[Main Page|The|Main|Page]]
4871 !! result
4872 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4873 </p>
4874 !! end
4875
4876 !! test
4877 Link to namespaces
4878 !! input
4879 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4880 !! result
4881 <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>
4882 </p>
4883 !! end
4884
4885 !! article
4886 MemoryAlpha:AlphaTest
4887 !! text
4888 This is an article in the MemoryAlpha namespace
4889 (which shadows the memoryalpha interwiki link).
4890 !! endarticle
4891
4892 !! test
4893 Namespace takes precedence over interwiki link (bug 51680)
4894 !! input
4895 [[MemoryAlpha:AlphaTest]]
4896 !! result
4897 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
4898 </p>
4899 !! end
4900
4901 !! test
4902 Piped link to namespace
4903 !! input
4904 [[Meta:Disclaimers|The disclaimers]]
4905 !! result
4906 <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>
4907 </p>
4908 !! end
4909
4910 !! test
4911 Link containing }
4912 !! input
4913 [[Usually caused by a typo (oops}]]
4914 !! result
4915 <p>[[Usually caused by a typo (oops}]]
4916 </p>
4917 !! end
4918
4919 !! test
4920 Link containing % (not as a hex sequence)
4921 !! input
4922 [[7% Solution]]
4923 !! result
4924 <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>
4925 </p>
4926 !! end
4927
4928 !! test
4929 Link containing % as a single hex sequence interpreted to char
4930 !! input
4931 [[7%25 Solution]]
4932 !! result
4933 <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>
4934 </p>
4935 !!end
4936
4937 !! test
4938 Link containing % as a double hex sequence interpreted to hex sequence
4939 !! input
4940 [[7%2525 Solution]]
4941 !! result
4942 <p>[[7%2525 Solution]]
4943 </p>
4944 !!end
4945
4946 !! test
4947 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4948 Example for such a section: == < ==
4949 !! input
4950 [[%23%3c]][[%23%3e]]
4951 !! result
4952 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4953 </p>
4954 !! end
4955
4956 !! test
4957 Link containing "<#" and ">#" as a hex sequences
4958 !! input
4959 [[%3c%23]][[%3e%23]]
4960 !! result
4961 <p>[[%3c%23]][[%3e%23]]
4962 </p>
4963 !! end
4964
4965 !! test
4966 Link containing an equals sign
4967 !! input
4968 [[Special:BookSources/isbn=4-00-026157-6]]
4969 !! result
4970 <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>
4971 </p>
4972 !! end
4973
4974 !! article
4975 Foo~bar
4976 !! text
4977 Just a test of an article title containing a tilde.
4978 !! endarticle
4979
4980 # note that links containing signatures, like [[Foo~~~~]], are
4981 # massaged by the pre-save transform (PST) and so the tildes are never
4982 # seen by the parser.
4983 !! test
4984 Link containing a tilde
4985 !! input
4986 [[Foo~bar]]
4987 !! result
4988 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4989 </p>
4990 !! end
4991
4992 !! test
4993 Link containing double-single-quotes '' (bug 4598)
4994 !! input
4995 [[Lista d''e paise d''o munno]]
4996 !! result
4997 <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>
4998 </p>
4999 !! end
5000
5001 !! test
5002 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5003 !! input
5004 Some [[Link|pretty ''italics'' and stuff]]!
5005 !! result
5006 <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>!
5007 </p>
5008 !! end
5009
5010 !! test
5011 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5012 !! input
5013 ''Some [[Link|pretty ''italics'' and stuff]]!
5014 !! result
5015 <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>
5016 </p>
5017 !! end
5018
5019 !! test
5020 Link with double quotes in title part (literal) and alternate part (interpreted)
5021 !! input
5022 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5023
5024 [[''Pentecoste'']]
5025
5026 [[''Pentecoste''|Pentecoste]]
5027
5028 [[''Pentecoste''|''Pentecoste'']]
5029 !! result
5030 <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>
5031 </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>
5032 </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>
5033 </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>
5034 </p>
5035 !! end
5036
5037 !! test
5038 Broken image links with HTML captions (bug 39700)
5039 !! input
5040 [[File:Nonexistent|<script></script>]]
5041 [[File:Nonexistent|100px|<script></script>]]
5042 [[File:Nonexistent|&lt;]]
5043 [[File:Nonexistent|a<i>b</i>c]]
5044 !! result
5045 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5046 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5047 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5048 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5049 </p>
5050 !! end
5051
5052 !! test
5053 Plain link to URL
5054 !! input
5055 [[http://www.example.com]]
5056 !! result
5057 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5058 </p>
5059 !! end
5060
5061 !! test
5062 Plain link to URL with link text
5063 !! input
5064 [[http://www.example.com Link text]]
5065 !! result
5066 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5067 </p>
5068 !! end
5069
5070 !! test
5071 Plain link to protocol-relative URL
5072 !! input
5073 [[//www.example.com]]
5074 !! result
5075 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5076 </p>
5077 !! end
5078
5079 !! test
5080 Plain link to protocol-relative URL with link text
5081 !! input
5082 [[//www.example.com Link text]]
5083 !! result
5084 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5085 </p>
5086 !! end
5087
5088 !! test
5089 Plain link to page with question mark in title
5090 !! input
5091 [[A?b]]
5092
5093 [[A?b|Baz]]
5094 !! result
5095 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5096 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5097 </p>
5098 !! end
5099
5100
5101 # I'm fairly sure the expected result here is wrong.
5102 # We want these to be URL links, not pseudo-pages with URLs for titles....
5103 # However the current output is also pretty screwy.
5104 #
5105 # ----
5106 # I'm changing it to match the current output--it arguably makes more
5107 # sense in the light of the test above. Old expected result was:
5108 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5109 #</p>
5110 # But I think this test is bordering on "garbage in, garbage out" anyway.
5111 # -- wtm
5112 !! test
5113 Piped link to URL
5114 !! input
5115 Piped link to URL: [[http://www.example.com|an example URL]]
5116 !! result
5117 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5118 </p>
5119 !! end
5120
5121 !! test
5122 BUG 2: [[page|http://url/]] should link to page, not http://url/
5123 !! input
5124 [[Main Page|http://url/]]
5125 !! result
5126 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5127 </p>
5128 !! end
5129
5130 !! test
5131 BUG 337: Escaped self-links should be bold
5132 !! options
5133 title=[[Bug462]]
5134 !! input
5135 [[Bu&#103;462]] [[Bug462]]
5136 !! result
5137 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5138 </p>
5139 !! end
5140
5141 !! test
5142 Self-link to section should not be bold
5143 !! options
5144 title=[[Main Page]]
5145 !! input
5146 [[Main Page#section]]
5147 !! result
5148 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5149 </p>
5150 !! end
5151
5152 !! article
5153 00
5154 !! text
5155 This is 00.
5156 !! endarticle
5157
5158 !!test
5159 Self-link to numeric title
5160 !!options
5161 title=[[0]]
5162 !!input
5163 [[0]]
5164 !!result
5165 <p><strong class="selflink">0</strong>
5166 </p>
5167 !!end
5168
5169 !!test
5170 Link to numeric-equivalent title
5171 !!options
5172 title=[[0]]
5173 !!input
5174 [[00]]
5175 !!result
5176 <p><a href="/wiki/00" title="00">00</a>
5177 </p>
5178 !!end
5179
5180 !! test
5181 <nowiki> inside a link
5182 !! input
5183 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5184 !! result
5185 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5186 </p>
5187 !! end
5188
5189 !! test
5190 Non-breaking spaces in title
5191 !! input
5192 [[&nbsp; Main &nbsp; Page &nbsp;]]
5193 !! result
5194 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5195 </p>
5196 !!end
5197
5198 !! test
5199 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5200 !! options
5201 language=ca
5202 !! input
5203 '''[[Main Page]]'''
5204 !! result
5205 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5206 </p>
5207 !! end
5208
5209 !! test
5210 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5211 !! options
5212 language=ca
5213 !! input
5214 ''[[Main Page]]''
5215 !! result
5216 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5217 </p>
5218 !! end
5219
5220 !! test
5221 Internal link with en linktrail: no apostrophes (bug 27473)
5222 !! options
5223 language=en
5224 !! input
5225 [[Something]]'nice
5226 !! result
5227 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5228 </p>
5229 !! end
5230
5231 !! test
5232 Internal link with ca linktrail with apostrophes (bug 27473)
5233 !! options
5234 language=ca
5235 !! input
5236 [[Something]]'nice
5237 !! result
5238 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5239 </p>
5240 !! end
5241
5242 !! test
5243 Internal link with kaa linktrail with apostrophes (bug 27473)
5244 !! options
5245 language=kaa
5246 !! input
5247 [[Something]]'nice
5248 !! result
5249 <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>
5250 </p>
5251 !! end
5252
5253 !! article
5254 Söfnuður
5255 !! text
5256 Test.
5257 !! endarticle
5258
5259 !! test
5260 Internal link with is link prefix
5261 !! options
5262 language=is
5263 !! input
5264 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5265 !! result
5266 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5267 </p>
5268 !! end
5269
5270 !! article
5271 Mótmælendatrú
5272 !! text
5273 Test.
5274 !! endarticle
5275
5276 !! test
5277 Internal link with is link trail and link prefix
5278 !! options
5279 language=is
5280 !! input
5281 [[mótmælendatrú|xxx]]ar
5282 [[mótmælendatrú]]ar
5283 mótmælenda[[söfnuður]]
5284 mótmælenda[[söfnuður|söfnuðir]]
5285 mótmælenda[[söfnuður|söfnuðir]]xxx
5286 !! result
5287 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5288 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5289 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5290 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5291 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5292 </p>
5293 !! end
5294
5295 !! test
5296 Parsoid link trail escaping
5297 !! options
5298 parsoid=html2wt,html2html
5299 !! input
5300 [[apple]]<nowiki/>s
5301 !! result
5302 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5303 !! end
5304
5305 !! test
5306 Parsoid link prefix escaping
5307 !! options
5308 language=is
5309 parsoid=html2wt,html2html
5310 !! input
5311 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5312 !! result
5313 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5314 !! end
5315
5316 !! test
5317 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5318 !! input
5319 [[Foo| bar]]
5320
5321 [[Foo| ''bar'']]
5322
5323 [http://wp.org foo]
5324
5325 [http://wp.org ''foo'']
5326 !! result
5327 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5328 </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>
5329 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5330 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5331 </p>
5332 !! end
5333
5334 ###
5335 ### Interwiki links (see maintenance/interwiki.sql)
5336 ###
5337
5338 !! test
5339 Inline interwiki link
5340 !! input
5341 [[MeatBall:SoftSecurity]]
5342 !! result
5343 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5344 </p>
5345 !! end
5346
5347 !! test
5348 Inline interwiki link with empty title (bug 2372)
5349 !! input
5350 [[MeatBall:]]
5351 !! result
5352 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5353 </p>
5354 !! end
5355
5356 !! test
5357 Interwiki link encoding conversion (bug 1636)
5358 !! input
5359 *[[Wikipedia:ro:Olteni&#0355;a]]
5360 *[[Wikipedia:ro:Olteni&#355;a]]
5361 !! result
5362 <ul>
5363 <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>
5364 </li>
5365 <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>
5366 </li>
5367 </ul>
5368
5369 !! end
5370
5371 !! test
5372 Interwiki link with fragment (bug 2130)
5373 !! input
5374 [[MeatBall:SoftSecurity#foo]]
5375 !! result
5376 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5377 </p>
5378 !! end
5379
5380
5381 ###
5382 ### Interlanguage links
5383 ### Language links (so that searching for '### language' matches..)
5384 ###
5385
5386 !! test
5387 Interlanguage link
5388 !! input
5389 Blah blah blah
5390 [[zh:Chinese]]
5391 !!result
5392 <p>Blah blah blah
5393 </p>
5394 !! end
5395
5396 !! test
5397 Double interlanguage link
5398 !! input
5399 Blah blah blah
5400 [[es:Spanish]]
5401 [[zh:Chinese]]
5402 !!result
5403 <p>Blah blah blah
5404 </p>
5405 !! end
5406
5407 !! test
5408 Interlanguage link, with prefix links
5409 !! options
5410 language=ln
5411 !! input
5412 Blah blah blah
5413 [[zh:Chinese]]
5414 !!result
5415 <p>Blah blah blah
5416 </p>
5417 !! end
5418
5419 !! test
5420 Double interlanguage link, with prefix links (bug 8897)
5421 !! options
5422 language=ln
5423 !! input
5424 Blah blah blah
5425 [[es:Spanish]]
5426 [[zh:Chinese]]
5427 !!result
5428 <p>Blah blah blah
5429 </p>
5430 !! end
5431
5432 !! test
5433 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5434 !! options
5435 language=ln
5436 !! input
5437 [[WW&nbsp;II]]
5438 !!result
5439 <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>
5440 </p>
5441 !! end
5442
5443 !! test
5444 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5445 !! options
5446 parsoid=html2wt
5447 !! input
5448 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5449
5450 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5451 !!result
5452 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5453 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5454 !! end
5455
5456 !! test
5457 Parsoid: handle constructor well
5458 !! options
5459 parsoid
5460 !! input
5461 [[constructor]]
5462
5463 [[constructor:foo]]
5464 !! result
5465 <p data-parsoid="{&quot;dsr&quot;:[0,15,0,0]}"><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;},&quot;dsr&quot;:[0,15,2,2]}">constructor</a></p>
5466
5467
5468 <p data-parsoid="{&quot;dsr&quot;:[17,36,0,0]}"><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;},&quot;dsr&quot;:[17,36,2,2]}">constructor:foo</a></p>
5469 !! end
5470
5471 !! test
5472 Parsoid: recognize interlanguage links without a target page
5473 !! options
5474 parsoid
5475 !! input
5476 [[ko:]]
5477 !! result
5478 <p>
5479 <link rel="mw:WikiLink/Language" href="http://ko.wikipedia.org/wiki/"></p>
5480 !! end
5481
5482 !! test
5483 Parsoid: recognize interwiki links without a target page
5484 !! options
5485 parsoid
5486 !! input
5487 [[:ko:]]
5488 !! result
5489 <p><a rel="mw:WikiLink/Interwiki" href="http://ko.wikipedia.org/wiki/">ko:</a></p>
5490 !! end
5491
5492 ###
5493 ### Redirects, Parsoid-only
5494 ###
5495 !! test
5496 Simple redirect to page
5497 !! options
5498 parsoid
5499 !! input
5500 #REDIRECT [[Main Page]]
5501 !! result
5502 <link rel="mw:PageProp/redirect" href="./Main_Page">
5503 !! end
5504
5505 !! test
5506 Optional colon in #REDIRECT
5507 !! options
5508 # the colon is archaic syntax. we support it for wt2html, but we
5509 # don't care that it roundtrips back to the modern syntax.
5510 parsoid=wt2html,html2html
5511 !! input
5512 #REDIRECT:[[Main Page]]
5513 !! result
5514 <link rel="mw:PageProp/redirect" href="./Main_Page">
5515 !! end
5516
5517 !! test
5518 Whitespace in #REDIRECT with optional colon
5519 !! options
5520 # the colon and gratuitous whitespace is archaic syntax. we support
5521 # it for wt2html, but we don't care that it roundtrips back to the
5522 # modern syntax (without extra whitespace)
5523 parsoid=wt2html,html2html
5524 !! input
5525
5526 #REDIRECT
5527 :
5528 [[Main Page]]
5529 !! result
5530 <link rel="mw:PageProp/redirect" href="./Main_Page">
5531 !! end
5532
5533 !! test
5534 Piped link in #REDIRECT
5535 !! options
5536 # content after piped link is ignored. we support this syntax,
5537 # but don't care that the piped link is lost when we roundtrip this.
5538 parsoid=wt2html
5539 !! input
5540 #REDIRECT [[Main Page|bar]]
5541 !! result
5542 <link rel="mw:PageProp/redirect" href="./Main_Page">
5543 !! end
5544
5545 !! test
5546 Redirect to category
5547 !! options
5548 parsoid=wt2html
5549 !! input
5550 #REDIRECT [[Category:Foo]]
5551 !! result
5552 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5553 !! end
5554
5555 !! test
5556 Redirect to category with URL encoding
5557 !! options
5558 parsoid=wt2html
5559 !! input
5560 #REDIRECT [[Category%3AFoo]]
5561 !! result
5562 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5563 !! end
5564
5565 !! test
5566 Redirect to category page
5567 !! options
5568 parsoid=wt2html,html2html
5569 !! input
5570 #REDIRECT [[:Category:Foo]]
5571 !! result
5572 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5573 !! end
5574
5575 !! test
5576 Redirect to image page (1)
5577 !! options
5578 parsoid
5579 !! input
5580 #REDIRECT [[File:Wiki.png]]
5581 !! result
5582 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5583 !! end
5584
5585 !! test
5586 Redirect to image page (2)
5587 !! options
5588 parsoid
5589 !! input
5590 #REDIRECT [[Image:Wiki.png]]
5591 !! result
5592 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5593 !! end
5594
5595 !! test
5596 Redirect to language
5597 !! options
5598 parsoid
5599 !! input
5600 #REDIRECT [[en:File:Wiki.png]]
5601 !! result
5602 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5603 !! end
5604
5605 !! test
5606 Redirect to interwiki
5607 !! options
5608 parsoid
5609 !! input
5610 #REDIRECT [[meatball:File:Wiki.png]]
5611 !! result
5612 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5613 !! end
5614
5615 !! test
5616 Non-English #REDIRECT
5617 !! options
5618 parsoid
5619 language=is
5620 !! input
5621 #TILVÍSUN [[Main Page]]
5622 !! result
5623 <link rel="mw:PageProp/redirect" href="./Main_Page">
5624 !! end
5625
5626 ##
5627 ## XHTML tidiness
5628 ###
5629
5630 !! test
5631 <br> to <br />
5632 !! input
5633 1<br>2<br />3
5634 !! result
5635 <p>1<br />2<br />3
5636 </p>
5637 !! end
5638
5639 !! test
5640 Broken br tag sanitization
5641 !! options
5642 php
5643 !! input
5644 </br>
5645 !! result
5646 <p>&lt;/br&gt;
5647 </p>
5648 !! end
5649
5650 # TODO: Fix html2html mode (bug 51055)!
5651 !! test
5652 Parsoid: Broken br tag recognition
5653 !! options
5654 parsoid=wt2html
5655 !! input
5656 </br>
5657 !! result
5658 <p><br></p>
5659 !! end
5660
5661 !! test
5662 Incorrecly removing closing slashes from correctly formed XHTML
5663 !! input
5664 <br style="clear:both;" />
5665 !! result
5666 <p><br style="clear:both;" />
5667 </p>
5668 !! end
5669
5670 !! test
5671 Failing to transform badly formed HTML into correct XHTML
5672 !! input
5673 <br style="clear: left;">
5674 <br style="clear: right;">
5675 <br style="clear: both;">
5676 !! result
5677 <p><br style="clear: left;" />
5678 <br style="clear: right;" />
5679 <br style="clear: both;" />
5680 </p>
5681 !!end
5682
5683 !! test
5684 Handling html with a div self-closing tag
5685 !! input
5686 <div title />
5687 <div title/>
5688 <div title/ >
5689 <div title=bar />
5690 <div title=bar/>
5691 <div title=bar/ >
5692 !! result
5693 <p>&lt;div title /&gt;
5694 &lt;div title/&gt;
5695 </p>
5696 <div>
5697 <p>&lt;div title=bar /&gt;
5698 &lt;div title=bar/&gt;
5699 </p>
5700 <div title="bar/"></div>
5701 </div>
5702
5703 !! end
5704
5705 !! test
5706 Handling html with a br self-closing tag
5707 !! input
5708 <br title />
5709 <br title/>
5710 <br title/ >
5711 <br title=bar />
5712 <br title=bar/>
5713 <br title=bar/ >
5714 !! result
5715 <p><br title="title" />
5716 <br title="title" />
5717 <br />
5718 <br title="bar" />
5719 <br title="bar" />
5720 <br title="bar/" />
5721 </p>
5722 !! end
5723
5724 !! test
5725 Horizontal ruler (should it add that extra space?)
5726 !! input
5727 <hr>
5728 <hr >
5729 foo <hr
5730 > bar
5731 !! result
5732 <hr />
5733 <hr />
5734 foo <hr /> bar
5735
5736 !! end
5737
5738 !! test
5739 Horizontal ruler -- 4+ dashes render hr
5740 !! input
5741 ----
5742 !! result
5743 <hr />
5744
5745 !! end
5746
5747 !! test
5748 Horizontal ruler -- eats additional dashes on the same line
5749 !! input
5750 ---------
5751 !! result
5752 <hr />
5753
5754 !! end
5755
5756 !! test
5757 Horizontal ruler -- does not collapse dashes on consecutive lines
5758 !! input
5759 ----
5760 ----
5761 !! result
5762 <hr />
5763 <hr />
5764
5765 !! end
5766
5767 !! test
5768 Horizontal ruler -- <4 dashes render as plain text
5769 !! input
5770 ---
5771 !! result
5772 <p>---
5773 </p>
5774 !! end
5775
5776 !! test
5777 Horizontal ruler -- Supports content following dashes on same line
5778 !! input
5779 ---- Foo
5780 !! result
5781 <hr /> Foo
5782
5783 !! end
5784
5785 ###
5786 ### Block-level elements
5787 ###
5788 !! test
5789 Common list
5790 !! input
5791 *Common list
5792 * item 2
5793 *item 3
5794 !! result
5795 <ul>
5796 <li>Common list
5797 </li>
5798 <li> item 2
5799 </li>
5800 <li>item 3
5801 </li>
5802 </ul>
5803
5804 !! end
5805
5806 !! test
5807 Numbered list
5808 !! input
5809 #Numbered list
5810 #item 2
5811 # item 3
5812 !! result
5813 <ol>
5814 <li>Numbered list
5815 </li>
5816 <li>item 2
5817 </li>
5818 <li> item 3
5819 </li>
5820 </ol>
5821
5822 !! end
5823
5824 !! test
5825 Mixed list
5826 !! input
5827 *Mixed list
5828 *# with numbers
5829 ** and bullets
5830 *# and numbers
5831 *bullets again
5832 **bullet level 2
5833 ***bullet level 3
5834 ***#Number on level 4
5835 **bullet level 2
5836 **#Number on level 3
5837 **#Number on level 3
5838 *#number level 2
5839 *Level 1
5840 *** Level 3
5841 #** Level 3, but ordered
5842 !! result
5843 <ul>
5844 <li>Mixed list
5845 <ol>
5846 <li> with numbers
5847 </li>
5848 </ol>
5849 <ul>
5850 <li> and bullets
5851 </li>
5852 </ul>
5853 <ol>
5854 <li> and numbers
5855 </li>
5856 </ol>
5857 </li>
5858 <li>bullets again
5859 <ul>
5860 <li>bullet level 2
5861 <ul>
5862 <li>bullet level 3
5863 <ol>
5864 <li>Number on level 4
5865 </li>
5866 </ol>
5867 </li>
5868 </ul>
5869 </li>
5870 <li>bullet level 2
5871 <ol>
5872 <li>Number on level 3
5873 </li>
5874 <li>Number on level 3
5875 </li>
5876 </ol>
5877 </li>
5878 </ul>
5879 <ol>
5880 <li>number level 2
5881 </li>
5882 </ol>
5883 </li>
5884 <li>Level 1
5885 <ul>
5886 <li><ul>
5887 <li> Level 3
5888 </li>
5889 </ul>
5890 </li>
5891 </ul>
5892 </li>
5893 </ul>
5894 <ol>
5895 <li><ul>
5896 <li><ul>
5897 <li> Level 3, but ordered
5898 </li>
5899 </ul>
5900 </li>
5901 </ul>
5902 </li>
5903 </ol>
5904
5905 !! end
5906
5907 !! test
5908 Nested lists 1
5909 !! input
5910 *foo
5911 **bar
5912 !! result
5913 <ul>
5914 <li>foo
5915 <ul>
5916 <li>bar
5917 </li>
5918 </ul>
5919 </li>
5920 </ul>
5921
5922 !! end
5923
5924 !! test
5925 Nested lists 2
5926 !! input
5927 **foo
5928 *bar
5929 !! result
5930 <ul>
5931 <li><ul>
5932 <li>foo
5933 </li>
5934 </ul>
5935 </li>
5936 <li>bar
5937 </li>
5938 </ul>
5939
5940 !! end
5941
5942 !! test
5943 Nested lists 3 (first element empty)
5944 !! input
5945 *
5946 **bar
5947 !! result
5948 <ul>
5949 <li>
5950 <ul>
5951 <li>bar
5952 </li>
5953 </ul>
5954 </li>
5955 </ul>
5956
5957 !! end
5958
5959 !! test
5960 Nested lists 4 (first element empty)
5961 !! input
5962 **
5963 *bar
5964 !! result
5965 <ul>
5966 <li><ul>
5967 <li>
5968 </li>
5969 </ul>
5970 </li>
5971 <li>bar
5972 </li>
5973 </ul>
5974
5975 !! end
5976
5977 !! test
5978 Nested lists 5 (both elements empty)
5979 !! input
5980 **
5981 *
5982 !! result
5983 <ul>
5984 <li><ul>
5985 <li>
5986 </li>
5987 </ul>
5988 </li>
5989 <li>
5990 </li>
5991 </ul>
5992
5993 !! end
5994
5995 !! test
5996 Nested lists 6 (both elements empty)
5997 !! input
5998 *
5999 **
6000 !! result
6001 <ul>
6002 <li>
6003 <ul>
6004 <li>
6005 </li>
6006 </ul>
6007 </li>
6008 </ul>
6009
6010 !! end
6011
6012 !! test
6013 Nested lists 7 (skip initial nesting levels)
6014 !! input
6015 *** foo
6016 !! result
6017 <ul>
6018 <li><ul>
6019 <li><ul>
6020 <li> foo
6021 </li>
6022 </ul>
6023 </li>
6024 </ul>
6025 </li>
6026 </ul>
6027
6028 !! end
6029
6030 !! test
6031 Nested lists 8 (multiple nesting transitions)
6032 !! input
6033 * foo
6034 *** bar
6035 ** baz
6036 * boo
6037 !! result
6038 <ul>
6039 <li> foo
6040 <ul>
6041 <li><ul>
6042 <li> bar
6043 </li>
6044 </ul>
6045 </li>
6046 <li> baz
6047 </li>
6048 </ul>
6049 </li>
6050 <li> boo
6051 </li>
6052 </ul>
6053
6054 !! end
6055
6056 !! test
6057 1. Lists with start-of-line-transparent tokens before bullets: Comments
6058 !! input
6059 *foo
6060 *<!--cmt-->bar
6061 <!--cmt-->*baz
6062 !! result
6063 <ul>
6064 <li>foo
6065 </li>
6066 <li>bar
6067 </li>
6068 <li>baz
6069 </li>
6070 </ul>
6071
6072 !! end
6073
6074 !! test
6075 2. Lists with start-of-line-transparent tokens before bullets: Template close
6076 !! input
6077 *foo {{echo|bar
6078 }}*baz
6079 !! result
6080 <ul>
6081 <li>foo bar
6082 </li>
6083 <li>baz
6084 </li>
6085 </ul>
6086
6087 !! end
6088
6089 !! test
6090 List items are not parsed correctly following a <pre> block (bug 785)
6091 !! input
6092 * <pre>foo</pre>
6093 * <pre>bar</pre>
6094 * zar
6095 !! result
6096 <ul>
6097 <li> <pre>foo</pre>
6098 </li>
6099 <li> <pre>bar</pre>
6100 </li>
6101 <li> zar
6102 </li>
6103 </ul>
6104
6105 !! end
6106
6107 !! test
6108 List items from template
6109 !! input
6110
6111 {{inner list}}
6112 * item 2
6113
6114 * item 0
6115 {{inner list}}
6116 * item 2
6117
6118 * item 0
6119 * notSOL{{inner list}}
6120 * item 2
6121 !! result
6122 <ul>
6123 <li> item 1
6124 </li>
6125 <li> item 2
6126 </li>
6127 </ul>
6128 <ul>
6129 <li> item 0
6130 </li>
6131 <li> item 1
6132 </li>
6133 <li> item 2
6134 </li>
6135 </ul>
6136 <ul>
6137 <li> item 0
6138 </li>
6139 <li> notSOL
6140 </li>
6141 <li> item 1
6142 </li>
6143 <li> item 2
6144 </li>
6145 </ul>
6146
6147 !! end
6148
6149 !! test
6150 List interrupted by empty line or heading
6151 !! input
6152 * foo
6153
6154 ** bar
6155 == A heading ==
6156 * Another list item
6157 !! result
6158 <ul>
6159 <li> foo
6160 </li>
6161 </ul>
6162 <ul>
6163 <li><ul>
6164 <li> bar
6165 </li>
6166 </ul>
6167 </li>
6168 </ul>
6169 <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>
6170 <ul>
6171 <li> Another list item
6172 </li>
6173 </ul>
6174
6175 !!end
6176
6177 !!test
6178 Multiple list tags generated by templates
6179 !!input
6180 {{echo|<li>}}a
6181 {{echo|<li>}}b
6182 {{echo|<li>}}c
6183 !!result
6184 <li>a
6185 <li>b
6186 <li>c</li>
6187 </li>
6188 </li>
6189
6190 !!end
6191
6192 !!test
6193 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6194 !!input
6195 *a
6196 <!--This line will NOT split the list-->
6197 *b
6198 <!--This line will NOT split the list either-->
6199 *c
6200 <!--foo--> <!----> <!--This line NOT split the list either-->
6201 *d
6202 !!result
6203 <ul>
6204 <li>a
6205 </li>
6206 <li>b
6207 </li>
6208 <li>c
6209 </li>
6210 <li>d
6211 </li>
6212 </ul>
6213
6214 !!end
6215
6216 !!test
6217 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6218 !!input
6219 *a
6220 <!--This line will NOT split the list-->
6221 *b
6222 <!--This line will NOT split the list either-->
6223 *c
6224 <!--foo--> <!----> <!--This line NOT split the list
6225 either-->
6226 *d
6227 !!result
6228 <ul>
6229 <li>a
6230 </li>
6231 <li>b
6232 </li>
6233 <li>c
6234 </li>
6235 <li>d
6236 </li>
6237 </ul>
6238
6239 !!end
6240
6241 !!test
6242 Test the li-hack
6243 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6244 !!options
6245 parsoid=wt2html,wt2wt
6246 !!input
6247 * foo
6248 * <li>li-hack
6249 * {{echo|<li>templated li-hack}}
6250 * <!--foo--> <li> unsupported li-hack with preceding comments
6251
6252 <ul>
6253 <li><li>not a li-hack
6254 </li>
6255 </ul>
6256 !!result
6257 <ul>
6258 <li> foo</li>
6259 <li>li-hack</li>
6260 <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>
6261 <li> <!--foo--> </li>
6262 <li> li-hack with preceding comments</li>
6263 </ul>
6264
6265 <ul>
6266 <li></li>
6267 <li>not a li-hack
6268 </li>
6269 </ul>
6270 !!end
6271
6272 !! test
6273 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6274 !! options
6275 parsoid
6276 !! input
6277 # foo
6278 ## bar
6279 * foo
6280 ** bar
6281 : foo
6282 :: bar
6283 !! result
6284 <ol>
6285 <li> foo<ol>
6286 <li> bar</li>
6287 </ol></li>
6288 </ol><ul>
6289 <li> foo<ul>
6290 <li> bar</li>
6291 </ul></li>
6292 </ul><dl>
6293 <dd> foo<dl>
6294 <dd> bar</dd>
6295 </dl></dd>
6296 </dl>
6297 !! end
6298
6299 !! test
6300 Parsoid: Test of whitespace serialization with Templated bullets
6301 !! options
6302 parsoid
6303 !! input
6304 * {{bullet}}
6305 !! result
6306 <ul>
6307 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6308 </ul>
6309 !! end
6310
6311 # ------------------------------------------------------------------------
6312 # The next set of tests are about Parsoid's ability to handle badly nested
6313 # tags (parse, minimize scope of fixup, and roundtrip back)
6314 # ------------------------------------------------------------------------
6315
6316 !! test
6317 Unbalanced closing block tags break a list
6318 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6319 !! options
6320 parsoid
6321 !! input
6322 <div>
6323 *a</div><div>
6324 *b</div>
6325 !! result
6326 <div>
6327 <ul>
6328 <li>a
6329 </li>
6330 </ul></div><div>
6331 <ul>
6332 <li>b
6333 </li>
6334 </ul></div>
6335 !! end
6336
6337 !! test
6338 Unbalanced closing non-block tags don't break a list
6339 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6340 !! options
6341 parsoid
6342 !! input
6343 <span>
6344 *a</span><span>
6345 *b</span>
6346 !! result
6347 <p><span></span>
6348 </p>
6349 <ul>
6350 <li>a<span></span>
6351 </li>
6352 <li>b
6353 </li>
6354 </ul>
6355 !! end
6356
6357 !! test
6358 Unclosed formatting tags that straddle lists are closed and reopened
6359 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6360 !! options
6361 parsoid
6362 !! input
6363 # <s> a
6364 # b </s>
6365 !! result
6366 <ol>
6367 <li> <s> a </s>
6368 </li>
6369 <li> <s> b </s>
6370 </li>
6371 </ol>
6372 !! end
6373
6374 !!test
6375 List embedded in a non-block tag
6376 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6377 !! options
6378 parsoid
6379 !!input
6380 <small>
6381 * foo
6382 </small>
6383 !!result
6384 <p><small></small></p>
6385 <small>
6386 <ul>
6387 <li> foo</li>
6388 </ul>
6389 </small>
6390 <p><small></small></p>
6391 !!end
6392
6393 !! test
6394 Table with missing opening <tr> tag
6395 !! options
6396 parsoid=wt2html,wt2wt
6397 !! input
6398 <table>
6399 <td>foo</td>
6400 </tr>
6401 </table>
6402 !! result
6403 <table>
6404 <tr>
6405 <td>foo</td>
6406 </tr>
6407 </table>
6408 !! end
6409
6410 ###
6411 ### Magic Words
6412 ###
6413
6414 # Note that the current date is hard-coded as
6415 # 1970-01-01T00:02:03Z (a Thursday)
6416 # when running parser tests. The timezone is also fixed to GMT, so
6417 # local date will be identical to current date.
6418
6419 !! test
6420 Magic Word: {{CURRENTDAY}}
6421 !! input
6422 {{CURRENTDAY}}
6423 !! result
6424 <p>1
6425 </p>
6426 !! end
6427
6428 !! test
6429 Magic Word: {{CURRENTDAY2}}
6430 !! input
6431 {{CURRENTDAY2}}
6432 !! result
6433 <p>01
6434 </p>
6435 !! end
6436
6437 !! test
6438 Magic Word: {{CURRENTDAYNAME}}
6439 !! input
6440 {{CURRENTDAYNAME}}
6441 !! result
6442 <p>Thursday
6443 </p>
6444 !! end
6445
6446 !! test
6447 Magic Word: {{CURRENTDOW}}
6448 !! input
6449 {{CURRENTDOW}}
6450 !! result
6451 <p>4
6452 </p>
6453 !! end
6454
6455 !! test
6456 Magic Word: {{CURRENTMONTH}}
6457 !! input
6458 {{CURRENTMONTH}}
6459 !! result
6460 <p>01
6461 </p>
6462 !! end
6463
6464 !! test
6465 Magic Word: {{CURRENTMONTH1}}
6466 !! input
6467 {{CURRENTMONTH1}}
6468 !! result
6469 <p>1
6470 </p>
6471 !! end
6472
6473 !! test
6474 Magic Word: {{CURRENTMONTHABBREV}}
6475 !! input
6476 {{CURRENTMONTHABBREV}}
6477 !! result
6478 <p>Jan
6479 </p>
6480 !! end
6481
6482 !! test
6483 Magic Word: {{CURRENTMONTHNAME}}
6484 !! input
6485 {{CURRENTMONTHNAME}}
6486 !! result
6487 <p>January
6488 </p>
6489 !! end
6490
6491 !! test
6492 Magic Word: {{CURRENTMONTHNAMEGEN}}
6493 !! input
6494 {{CURRENTMONTHNAMEGEN}}
6495 !! result
6496 <p>January
6497 </p>
6498 !! end
6499
6500 !! test
6501 Magic Word: {{CURRENTTIME}}
6502 !! input
6503 {{CURRENTTIME}}
6504 !! result
6505 <p>00:02
6506 </p>
6507 !! end
6508
6509 !! test
6510 Magic Word: {{CURRENTHOUR}}
6511 !! input
6512 {{CURRENTHOUR}}
6513 !! result
6514 <p>00
6515 </p>
6516 !! end
6517
6518 !! test
6519 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6520 !! input
6521 {{CURRENTWEEK}}
6522 !! result
6523 <p>1
6524 </p>
6525 !! end
6526
6527 !! test
6528 Magic Word: {{CURRENTYEAR}}
6529 !! input
6530 {{CURRENTYEAR}}
6531 !! result
6532 <p>1970
6533 </p>
6534 !! end
6535
6536 !! test
6537 Magic Word: {{CURRENTTIMESTAMP}}
6538 !! input
6539 {{CURRENTTIMESTAMP}}
6540 !! result
6541 <p>19700101000203
6542 </p>
6543 !! end
6544
6545 !! test
6546 Magic Words LOCAL (UTC)
6547 !! input
6548 * {{LOCALMONTH}}
6549 * {{LOCALMONTH1}}
6550 * {{LOCALMONTHNAME}}
6551 * {{LOCALMONTHNAMEGEN}}
6552 * {{LOCALMONTHABBREV}}
6553 * {{LOCALDAY}}
6554 * {{LOCALDAY2}}
6555 * {{LOCALDAYNAME}}
6556 * {{LOCALYEAR}}
6557 * {{LOCALTIME}}
6558 * {{LOCALHOUR}}
6559 * {{LOCALWEEK}}
6560 * {{LOCALDOW}}
6561 * {{LOCALTIMESTAMP}}
6562 !! result
6563 <ul>
6564 <li> 01
6565 </li>
6566 <li> 1
6567 </li>
6568 <li> January
6569 </li>
6570 <li> January
6571 </li>
6572 <li> Jan
6573 </li>
6574 <li> 1
6575 </li>
6576 <li> 01
6577 </li>
6578 <li> Thursday
6579 </li>
6580 <li> 1970
6581 </li>
6582 <li> 00:02
6583 </li>
6584 <li> 00
6585 </li>
6586 <li> 1
6587 </li>
6588 <li> 4
6589 </li>
6590 <li> 19700101000203
6591 </li>
6592 </ul>
6593
6594 !! end
6595
6596 !! test
6597 Magic Word: {{FULLPAGENAME}}
6598 !! options
6599 title=[[User:Ævar Arnfjörð Bjarmason]]
6600 !! input
6601 {{FULLPAGENAME}}
6602 !! result
6603 <p>User:Ævar Arnfjörð Bjarmason
6604 </p>
6605 !! end
6606
6607 !! test
6608 Magic Word: {{FULLPAGENAMEE}}
6609 !! options
6610 title=[[User:Ævar Arnfjörð Bjarmason]]
6611 !! input
6612 {{FULLPAGENAMEE}}
6613 !! result
6614 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6615 </p>
6616 !! end
6617
6618 !! test
6619 Magic Word: {{TALKSPACE}}
6620 !! options
6621 title=[[User:Ævar Arnfjörð Bjarmason]]
6622 !! input
6623 {{TALKSPACE}}
6624 !! result
6625 <p>User talk
6626 </p>
6627 !! end
6628
6629 !! test
6630 Magic Word: {{TALKSPACE}}, same namespace
6631 !! options
6632 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6633 !! input
6634 {{TALKSPACE}}
6635 !! result
6636 <p>User talk
6637 </p>
6638 !! end
6639
6640 !! test
6641 Magic Word: {{TALKSPACE}}, main namespace
6642 !! options
6643 title=[[Parser Test]]
6644 !! input
6645 {{TALKSPACE}}
6646 !! result
6647 <p>Talk
6648 </p>
6649 !! end
6650
6651 !! test
6652 Magic Word: {{TALKSPACEE}}
6653 !! options
6654 title=[[User:Ævar Arnfjörð Bjarmason]]
6655 !! input
6656 {{TALKSPACEE}}
6657 !! result
6658 <p>User_talk
6659 </p>
6660 !! end
6661
6662 !! test
6663 Magic Word: {{SUBJECTSPACE}}
6664 !! options
6665 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6666 !! input
6667 {{SUBJECTSPACE}}
6668 !! result
6669 <p>User
6670 </p>
6671 !! end
6672
6673 !! test
6674 Magic Word: {{SUBJECTSPACE}}, same namespace
6675 !! options
6676 title=[[User:Ævar Arnfjörð Bjarmason]]
6677 !! input
6678 {{SUBJECTSPACE}}
6679 !! result
6680 <p>User
6681 </p>
6682 !! end
6683
6684 !! test
6685 Magic Word: {{SUBJECTSPACE}}, main namespace
6686 !! options
6687 title=[[Parser Test]]
6688 !! input
6689 {{SUBJECTSPACE}}
6690 !! result
6691
6692 !! end
6693
6694 !! test
6695 Magic Word: {{SUBJECTSPACEE}}
6696 !! options
6697 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6698 !! input
6699 {{SUBJECTSPACEE}}
6700 !! result
6701 <p>User
6702 </p>
6703 !! end
6704
6705 !! test
6706 Magic Word: {{NAMESPACE}}
6707 !! options
6708 title=[[User:Ævar Arnfjörð Bjarmason]]
6709 !! input
6710 {{NAMESPACE}}
6711 !! result
6712 <p>User
6713 </p>
6714 !! end
6715
6716 !! test
6717 Magic Word: {{NAMESPACEE}}
6718 !! options
6719 title=[[User:Ævar Arnfjörð Bjarmason]]
6720 !! input
6721 {{NAMESPACEE}}
6722 !! result
6723 <p>User
6724 </p>
6725 !! end
6726
6727 !! test
6728 Magic Word: {{NAMESPACENUMBER}}
6729 !! options
6730 title=[[User:Ævar Arnfjörð Bjarmason]]
6731 !! input
6732 {{NAMESPACENUMBER}}
6733 !! result
6734 <p>2
6735 </p>
6736 !! end
6737
6738 !! test
6739 Magic Word: {{SUBPAGENAME}}
6740 !! options
6741 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6742 !! input
6743 {{SUBPAGENAME}}
6744 !! result
6745 <p>sub ö
6746 </p>
6747 !! end
6748
6749 !! test
6750 Magic Word: {{SUBPAGENAMEE}}
6751 !! options
6752 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6753 !! input
6754 {{SUBPAGENAMEE}}
6755 !! result
6756 <p>sub_%C3%B6
6757 </p>
6758 !! end
6759
6760 !! test
6761 Magic Word: {{ROOTPAGENAME}}
6762 !! options
6763 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6764 !! input
6765 {{ROOTPAGENAME}}
6766 !! result
6767 <p>Ævar Arnfjörð Bjarmason
6768 </p>
6769 !! end
6770
6771 !! test
6772 Magic Word: {{ROOTPAGENAMEE}}
6773 !! options
6774 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6775 !! input
6776 {{ROOTPAGENAMEE}}
6777 !! result
6778 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6779 </p>
6780 !! end
6781
6782 !! test
6783 Magic Word: {{BASEPAGENAME}}
6784 !! options
6785 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6786 !! input
6787 {{BASEPAGENAME}}
6788 !! result
6789 <p>Ævar Arnfjörð Bjarmason
6790 </p>
6791 !! end
6792
6793 !! test
6794 Magic Word: {{BASEPAGENAMEE}}
6795 !! options
6796 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6797 !! input
6798 {{BASEPAGENAMEE}}
6799 !! result
6800 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6801 </p>
6802 !! end
6803
6804 !! test
6805 Magic Word: {{TALKPAGENAME}}
6806 !! options
6807 title=[[User:Ævar Arnfjörð Bjarmason]]
6808 !! input
6809 {{TALKPAGENAME}}
6810 !! result
6811 <p>User talk:Ævar Arnfjörð Bjarmason
6812 </p>
6813 !! end
6814
6815 !! test
6816 Magic Word: {{TALKPAGENAMEE}}
6817 !! options
6818 title=[[User:Ævar Arnfjörð Bjarmason]]
6819 !! input
6820 {{TALKPAGENAMEE}}
6821 !! result
6822 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6823 </p>
6824 !! end
6825
6826 !! test
6827 Magic Word: {{SUBJECTPAGENAME}}
6828 !! options
6829 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6830 !! input
6831 {{SUBJECTPAGENAME}}
6832 !! result
6833 <p>User:Ævar Arnfjörð Bjarmason
6834 </p>
6835 !! end
6836
6837 !! test
6838 Magic Word: {{SUBJECTPAGENAMEE}}
6839 !! options
6840 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6841 !! input
6842 {{SUBJECTPAGENAMEE}}
6843 !! result
6844 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6845 </p>
6846 !! end
6847
6848 !! test
6849 Magic Word: {{NUMBEROFFILES}}
6850 !! input
6851 {{NUMBEROFFILES}}
6852 !! result
6853 <p>4
6854 </p>
6855 !! end
6856
6857 !! test
6858 Magic Word: {{PAGENAME}}
6859 !! options
6860 title=[[User:Ævar Arnfjörð Bjarmason]]
6861 !! input
6862 {{PAGENAME}}
6863 !! result
6864 <p>Ævar Arnfjörð Bjarmason
6865 </p>
6866 !! end
6867
6868 !! test
6869 Magic Word: {{PAGENAME}} with metacharacters
6870 !! options
6871 title=[['foo & bar = baz']]
6872 !! input
6873 ''{{PAGENAME}}''
6874 !! result
6875 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6876 </p>
6877 !! end
6878
6879 !! test
6880 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6881 !! options
6882 title=[[*RFC 1234 http://example.com/]]
6883 !! input
6884 {{PAGENAME}}
6885 !! result
6886 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6887 </p>
6888 !! end
6889
6890 !! test
6891 Magic Word: {{PAGENAMEE}}
6892 !! options
6893 title=[[User:Ævar Arnfjörð Bjarmason]]
6894 !! input
6895 {{PAGENAMEE}}
6896 !! result
6897 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6898 </p>
6899 !! end
6900
6901 !! test
6902 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6903 !! options
6904 title=[[*RFC 1234 http://example.com/]]
6905 !! input
6906 {{PAGENAMEE}}
6907 !! result
6908 <p>&#42;RFC_1234_http&#58;//example.com/
6909 </p>
6910 !! end
6911
6912 !! test
6913 Magic Word: {{REVISIONID}}
6914 !! input
6915 {{REVISIONID}}
6916 !! result
6917 <p>1337
6918 </p>
6919 !! end
6920
6921 !! test
6922 Magic Word: {{SCRIPTPATH}}
6923 !! input
6924 {{SCRIPTPATH}}
6925 !! result
6926 <p>/
6927 </p>
6928 !! end
6929
6930 !! test
6931 Magic Word: {{STYLEPATH}}
6932 !! input
6933 {{STYLEPATH}}
6934 !! result
6935 <p>/skins
6936 </p>
6937 !! end
6938
6939 !! test
6940 Magic Word: {{SERVER}}
6941 !! input
6942 {{SERVER}}
6943 !! result
6944 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6945 </p>
6946 !! end
6947
6948 !! test
6949 Magic Word: {{SERVERNAME}}
6950 !! input
6951 {{SERVERNAME}}
6952 !! result
6953 <p>example.org
6954 </p>
6955 !! end
6956
6957 !! test
6958 Magic Word: {{SITENAME}}
6959 !! input
6960 {{SITENAME}}
6961 !! result
6962 <p>MediaWiki
6963 </p>
6964 !! end
6965
6966 !! test
6967 Case-sensitive magic words, when cased differently, should just be template transclusions
6968 !! input
6969 {{CurrentMonth}}
6970 {{currentday}}
6971 {{cURreNTweEK}}
6972 {{currentHour}}
6973 !! result
6974 <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>
6975 <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>
6976 <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>
6977 <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>
6978 </p>
6979 !! end
6980
6981 !! test
6982 Case-insensitive magic words should still work with weird casing.
6983 !! input
6984 {{sErVeRNaMe}}
6985 {{LCFirst:AOEU}}
6986 {{ucFIRST:aoeu}}
6987 {{SERver}}
6988 !! result
6989 <p>example.org
6990 aOEU
6991 Aoeu
6992 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6993 </p>
6994 !! end
6995
6996 !! test
6997 Namespace 1 {{ns:1}}
6998 !! input
6999 {{ns:1}}
7000 !! result
7001 <p>Talk
7002 </p>
7003 !! end
7004
7005 !! test
7006 Namespace 1 {{ns:01}}
7007 !! input
7008 {{ns:01}}
7009 !! result
7010 <p>Talk
7011 </p>
7012 !! end
7013
7014 !! test
7015 Namespace 0 {{ns:0}} (bug 4783)
7016 !! input
7017 {{ns:0}}
7018 !! result
7019
7020 !! end
7021
7022 !! test
7023 Namespace 0 {{ns:00}} (bug 4783)
7024 !! input
7025 {{ns:00}}
7026 !! result
7027
7028 !! end
7029
7030 !! test
7031 Namespace -1 {{ns:-1}}
7032 !! input
7033 {{ns:-1}}
7034 !! result
7035 <p>Special
7036 </p>
7037 !! end
7038
7039 !! test
7040 Namespace User {{ns:User}}
7041 !! input
7042 {{ns:User}}
7043 !! result
7044 <p>User
7045 </p>
7046 !! end
7047
7048 !! test
7049 Namespace User talk {{ns:User_talk}}
7050 !! input
7051 {{ns:User_talk}}
7052 !! result
7053 <p>User talk
7054 </p>
7055 !! end
7056
7057 !! test
7058 Namespace User talk {{ns:uSeR tAlK}}
7059 !! input
7060 {{ns:uSeR tAlK}}
7061 !! result
7062 <p>User talk
7063 </p>
7064 !! end
7065
7066 !! test
7067 Namespace File {{ns:File}}
7068 !! input
7069 {{ns:File}}
7070 !! result
7071 <p>File
7072 </p>
7073 !! end
7074
7075 !! test
7076 Namespace File {{ns:Image}}
7077 !! input
7078 {{ns:Image}}
7079 !! result
7080 <p>File
7081 </p>
7082 !! end
7083
7084 !! test
7085 Namespace (lang=de) Benutzer {{ns:User}}
7086 !! options
7087 language=de
7088 !! input
7089 {{ns:User}}
7090 !! result
7091 <p>Benutzer
7092 </p>
7093 !! end
7094
7095 !! test
7096 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7097 !! options
7098 language=de
7099 !! input
7100 {{ns:3}}
7101 !! result
7102 <p>Benutzer Diskussion
7103 </p>
7104 !! end
7105
7106
7107 !! test
7108 Urlencode
7109 !! input
7110 {{urlencode:hi world?!}}
7111 {{urlencode:hi world?!|WIKI}}
7112 {{urlencode:hi world?!|PATH}}
7113 {{urlencode:hi world?!|QUERY}}
7114 !! result
7115 <p>hi+world%3F%21
7116 hi_world%3F!
7117 hi%20world%3F%21
7118 hi+world%3F%21
7119 </p>
7120 !! end
7121
7122 ###
7123 ### Magic links
7124 ###
7125 !! test
7126 Magic links: internal link to RFC (bug 479)
7127 !! input
7128 [[RFC 123]]
7129 !! result
7130 <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>
7131 </p>
7132 !! end
7133
7134 !! test
7135 Magic links: RFC (bug 479)
7136 !! input
7137 RFC 822
7138 !! result
7139 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7140 </p>
7141 !! end
7142
7143 !! test
7144 Magic links: ISBN (bug 1937)
7145 !! input
7146 ISBN 0-306-40615-2
7147 !! result
7148 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7149 </p>
7150 !! end
7151
7152 !! test
7153 Magic links: PMID incorrectly converts space to underscore
7154 !! input
7155 PMID 1234
7156 !! result
7157 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7158 </p>
7159 !! end
7160
7161 ###
7162 ### Templates
7163 ####
7164
7165 !! test
7166 Nonexistent template
7167 !! input
7168 {{thistemplatedoesnotexist}}
7169 !! result
7170 <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>
7171 </p>
7172 !! end
7173
7174 !! test
7175 Template with invalid target containing tags
7176 !! input
7177 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7178 !! result
7179 <p>{{a<b>b</b>|foo|a=b|a = b}}
7180 </p>
7181 !! end
7182
7183 !! test
7184 Template with invalid target containing unclosed tag
7185 !! input
7186 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7187 !! result
7188 <p>{{a<b>|foo|a=b|a = b}}</b>
7189 </p>
7190 !! end
7191
7192 !! article
7193 Template:test
7194 !! text
7195 This is a test template
7196 !! endarticle
7197
7198 !! test
7199 Simple template
7200 !! input
7201 {{test}}
7202 !! result
7203 <p>This is a test template
7204 </p>
7205 !! end
7206
7207 !! test
7208 Template with explicit namespace
7209 !! input
7210 {{Template:test}}
7211 !! result
7212 <p>This is a test template
7213 </p>
7214 !! end
7215
7216
7217 !! article
7218 Template:paramtest
7219 !! text
7220 This is a test template with parameter {{{param}}}
7221 !! endarticle
7222
7223 !! test
7224 Template parameter
7225 !! input
7226 {{paramtest|param=foo}}
7227 !! result
7228 <p>This is a test template with parameter foo
7229 </p>
7230 !! end
7231
7232 !! article
7233 Template:paramtestnum
7234 !! text
7235 [[{{{1}}}|{{{2}}}]]
7236 !! endarticle
7237
7238 !! test
7239 Template unnamed parameter
7240 !! input
7241 {{paramtestnum|Main Page|the main page}}
7242 !! result
7243 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7244 </p>
7245 !! end
7246
7247 !! article
7248 Template:templatesimple
7249 !! text
7250 (test)
7251 !! endarticle
7252
7253 !! article
7254 Template:templateredirect
7255 !! text
7256 #redirect [[Template:templatesimple]]
7257 !! endarticle
7258
7259 !! article
7260 Template:templateasargtestnum
7261 !! text
7262 {{{{{1}}}}}
7263 !! endarticle
7264
7265 !! article
7266 Template:templateasargtest
7267 !! text
7268 {{template{{{templ}}}}}
7269 !! endarticle
7270
7271 !! article
7272 Template:templateasargtest2
7273 !! text
7274 {{{{{templ}}}}}
7275 !! endarticle
7276
7277 !! test
7278 Template with template name as unnamed argument
7279 !! input
7280 {{templateasargtestnum|templatesimple}}
7281 !! result
7282 <p>(test)
7283 </p>
7284 !! end
7285
7286 !! test
7287 Template with template name as argument
7288 !! input
7289 {{templateasargtest|templ=simple}}
7290 !! result
7291 <p>(test)
7292 </p>
7293 !! end
7294
7295 !! test
7296 Template with template name as argument (2)
7297 !! input
7298 {{templateasargtest2|templ=templatesimple}}
7299 !! result
7300 <p>(test)
7301 </p>
7302 !! end
7303
7304 !! article
7305 Template:templateasargtestdefault
7306 !! text
7307 {{{{{templ|templatesimple}}}}}
7308 !! endarticle
7309
7310 !! article
7311 Template:templa
7312 !! text
7313 '''templ'''
7314 !! endarticle
7315
7316 !! test
7317 Template with default value
7318 !! input
7319 {{templateasargtestdefault}}
7320 !! result
7321 <p>(test)
7322 </p>
7323 !! end
7324
7325 !! test
7326 Template with default value (value set)
7327 !! input
7328 {{templateasargtestdefault|templ=templa}}
7329 !! result
7330 <p><b>templ</b>
7331 </p>
7332 !! end
7333
7334 !! test
7335 Template redirect
7336 !! input
7337 {{templateredirect}}
7338 !! result
7339 <p>(test)
7340 </p>
7341 !! end
7342
7343 !! test
7344 Template with argument in separate line
7345 !! input
7346 {{ templateasargtest |
7347 templ = simple }}
7348 !! result
7349 <p>(test)
7350 </p>
7351 !! end
7352
7353 !! test
7354 Template with complex template as argument
7355 !! input
7356 {{paramtest|
7357 param ={{ templateasargtest |
7358 templ = simple }}}}
7359 !! result
7360 <p>This is a test template with parameter (test)
7361 </p>
7362 !! end
7363
7364 !! test
7365 Template with thumb image (with link in description)
7366 !! input
7367 {{paramtest|
7368 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7369 !! result
7370 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>
7371
7372 !! end
7373
7374 !! article
7375 Template:complextemplate
7376 !! text
7377 {{{1}}} {{paramtest|
7378 param ={{{param}}}}}
7379 !! endarticle
7380
7381 !! test
7382 Template with complex arguments
7383 !! input
7384 {{complextemplate|
7385 param ={{ templateasargtest |
7386 templ = simple }}|[[Template:complextemplate|link]]}}
7387 !! result
7388 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7389 </p>
7390 !! end
7391
7392 !! test
7393 BUG 553: link with two variables in a piped link
7394 !! input
7395 {|
7396 |[[{{{1}}}|{{{2}}}]]
7397 |}
7398 !! result
7399 <table>
7400 <tr>
7401 <td>[[{{{1}}}|{{{2}}}]]
7402 </td></tr></table>
7403
7404 !! end
7405
7406 !! test
7407 Magic variable as template parameter
7408 !! input
7409 {{paramtest|param={{SITENAME}}}}
7410 !! result
7411 <p>This is a test template with parameter MediaWiki
7412 </p>
7413 !! end
7414
7415 !! article
7416 Template:linktest
7417 !! text
7418 [[{{{param}}}|link]]
7419 !! endarticle
7420
7421 !! test
7422 Template parameter as link source
7423 !! input
7424 {{linktest|param=Main Page}}
7425 !! result
7426 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7427 </p>
7428 !! end
7429
7430 !!test
7431 Template-generated attribute string (k='v')
7432 !!input
7433 <span {{attr_str|id|v1}}>bar</span>
7434 !!result
7435 <p><span id="v1">bar</span>
7436 </p>
7437 !!end
7438
7439 !!article
7440 Template:paramtest2
7441 !! text
7442 including another template, {{paramtest|param={{{arg}}}}}
7443 !! endarticle
7444
7445 !! test
7446 Template passing argument to another template
7447 !! input
7448 {{paramtest2|arg='hmm'}}
7449 !! result
7450 <p>including another template, This is a test template with parameter 'hmm'
7451 </p>
7452 !! end
7453
7454 !! article
7455 Template:Linktest2
7456 !! text
7457 Main Page
7458 !! endarticle
7459
7460 !! test
7461 Template as link source
7462 !! input
7463 [[{{linktest2}}]]
7464
7465 [[{{linktest2}}|Main Page]]
7466
7467 [[{{linktest2}}]]Page
7468 !! result
7469 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7470 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7471 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7472 </p>
7473 !! end
7474
7475
7476 !! article
7477 Template:loop1
7478 !! text
7479 {{loop2}}
7480 !! endarticle
7481
7482 !! article
7483 Template:loop2
7484 !! text
7485 {{loop1}}
7486 !! endarticle
7487
7488 !! test
7489 Template infinite loop
7490 !! input
7491 {{loop1}}
7492 !! result
7493 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7494 </p>
7495 !! end
7496
7497 !! test
7498 Template from main namespace
7499 !! input
7500 {{:Main Page}}
7501 !! result
7502 <p>blah blah
7503 </p>
7504 !! end
7505
7506 !! article
7507 Template:table
7508 !! text
7509 {|
7510 | 1 || 2
7511 |-
7512 | 3 || 4
7513 |}
7514 !! endarticle
7515
7516 !! test
7517 BUG 529: Template with table, not included at beginning of line
7518 !! input
7519 foo {{table}}
7520 !! result
7521 <p>foo
7522 </p>
7523 <table>
7524 <tr>
7525 <td> 1 </td>
7526 <td> 2
7527 </td></tr>
7528 <tr>
7529 <td> 3 </td>
7530 <td> 4
7531 </td></tr></table>
7532
7533 !! end
7534
7535 !! test
7536 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7537 !! input
7538 foo
7539 {{table}}
7540 !! result
7541 <p>foo
7542 </p>
7543 <table>
7544 <tr>
7545 <td> 1 </td>
7546 <td> 2
7547 </td></tr>
7548 <tr>
7549 <td> 3 </td>
7550 <td> 4
7551 </td></tr></table>
7552
7553 !! end
7554
7555 !! test
7556 BUG 41: Template parameters shown as broken links
7557 !! input
7558 {{{parameter}}}
7559 !! result
7560 <p>{{{parameter}}}
7561 </p>
7562 !! end
7563
7564 !! test
7565 Template with targets containing wikilinks
7566 !! input
7567 {{[[foo]]}}
7568
7569 {{[[{{echo|foo}}]]}}
7570
7571 {{{{echo|[[foo}}]]}}
7572 !! result
7573 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7574 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7575 </p><p>{{[[foo}}]]
7576 </p>
7577 !! end
7578
7579 !! article
7580 Template:MSGNW test
7581 !! text
7582 ''None'' of '''this''' should be
7583 * interpreted
7584 but rather passed unmodified
7585 {{test}}
7586 !! endarticle
7587
7588 # hmm, fix this or just deprecate msgnw and document its behavior?
7589 !! test
7590 msgnw keyword
7591 !! options
7592 disabled
7593 !! input
7594 {{msgnw:MSGNW test}}
7595 !! result
7596 <p>''None'' of '''this''' should be
7597 * interpreted
7598 but rather passed unmodified
7599 {{test}}
7600 </p>
7601 !! end
7602
7603 !! test
7604 int keyword
7605 !! input
7606 {{int:youhavenewmessages|lots of money|not!}}
7607 !! result
7608 <p>You have lots of money (not!).
7609 </p>
7610 !! end
7611
7612 !! article
7613 Template:Includes
7614 !! text
7615 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7616 !! endarticle
7617
7618 !! test
7619 <includeonly> and <noinclude> being included
7620 !! input
7621 {{Includes}}
7622 !! result
7623 <p>Foobar
7624 </p>
7625 !! end
7626
7627 !! article
7628 Template:Includes2
7629 !! text
7630 <onlyinclude>Foo</onlyinclude>bar
7631 !! endarticle
7632
7633 !! test
7634 <onlyinclude> being included
7635 !! input
7636 {{Includes2}}
7637 !! result
7638 <p>Foo
7639 </p>
7640 !! end
7641
7642
7643 !! article
7644 Template:Includes3
7645 !! text
7646 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
7647 !! endarticle
7648
7649 !! test
7650 <onlyinclude> and <includeonly> being included
7651 !! input
7652 {{Includes3}}
7653 !! result
7654 <p>Foo
7655 </p>
7656 !! end
7657
7658 !! test
7659 <includeonly> and <noinclude> on a page
7660 !! input
7661 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7662 !! result
7663 <p>Foozar
7664 </p>
7665 !! end
7666
7667 !! test
7668 Un-closed <noinclude>
7669 !! input
7670 <noinclude>
7671 !! result
7672 !! end
7673
7674 !! test
7675 <onlyinclude> on a page
7676 !! input
7677 <onlyinclude>Foo</onlyinclude>bar
7678 !! result
7679 <p>Foobar
7680 </p>
7681 !! end
7682
7683 !! test
7684 Un-closed <onlyinclude>
7685 !! input
7686 <onlyinclude>
7687 !! result
7688 !! end
7689
7690 !!test
7691 Self-closed noinclude, includeonly, onlyinclude tags
7692 !!input
7693 <noinclude />
7694 <includeonly />
7695 <onlyinclude />
7696 !!result
7697 <p><br />
7698 </p>
7699 !!end
7700
7701 !!test
7702 Unbalanced includeonly and noinclude tags
7703 !!input
7704 {|
7705 |a</noinclude>
7706 |b</noinclude></noinclude>
7707 |c</noinclude></includeonly>
7708 |d</includeonly></includeonly>
7709 |}
7710 !!result
7711 <table>
7712 <tr>
7713 <td>a
7714 </td>
7715 <td>b
7716 </td>
7717 <td>c&lt;/includeonly&gt;
7718 </td>
7719 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7720 </td></tr></table>
7721
7722 !!end
7723
7724 !! article
7725 Template:Includeonly section
7726 !! text
7727 <includeonly>
7728 ==Includeonly section==
7729 </includeonly>
7730 ==Section T-1==
7731 !!endarticle
7732
7733 !! test
7734 Bug 6563: Edit link generation for section shown by <includeonly>
7735 !! input
7736 {{includeonly section}}
7737 !! result
7738 <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>
7739 <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>
7740
7741 !! end
7742
7743 # Uses same input as the contents of [[Template:Includeonly section]]
7744 !! test
7745 Bug 6563: Section extraction for section shown by <includeonly>
7746 !! options
7747 section=T-2
7748 !! input
7749 <includeonly>
7750 ==Includeonly section==
7751 </includeonly>
7752 ==Section T-2==
7753 !! result
7754 ==Section T-2==
7755 !! end
7756
7757 !! test
7758 Bug 6563: Edit link generation for section suppressed by <includeonly>
7759 !! input
7760 <includeonly>
7761 ==Includeonly section==
7762 </includeonly>
7763 ==Section 1==
7764 !! result
7765 <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>
7766
7767 !! end
7768
7769 !! test
7770 Bug 6563: Section extraction for section suppressed by <includeonly>
7771 !! options
7772 section=1
7773 !! input
7774 <includeonly>
7775 ==Includeonly section==
7776 </includeonly>
7777 ==Section 1==
7778 !! result
7779 ==Section 1==
7780 !! end
7781
7782 !! test
7783 Un-closed <includeonly>
7784 !! input
7785 <includeonly>
7786 !! result
7787 !! end
7788
7789 # TODO: test with DOM fragment reuse!
7790 !! test
7791 Parsoid: DOM fragment reuse
7792 !! options
7793 parsoid=wt2wt,wt2html
7794 !! input
7795 a{{echo|b<table></table>c}}d
7796
7797 a{{echo|b
7798 <table></table>
7799 c}}d
7800
7801 {{echo|a
7802
7803 <table></table>
7804
7805 b}}
7806 !! result
7807 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
7808 <table></table>c"}},"i":0}}]}'>b</span>
7809 <table about="#mwt1"></table><span about="#mwt1">c</span>d
7810
7811
7812 <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">
7813 </span>
7814 <table about="#mwt2"></table><span about="#mwt2">
7815 </span>
7816 <p about="#mwt2">cd</p>
7817
7818
7819 <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">
7820
7821 </span>
7822 <table about="#mwt3"></table><span about="#mwt3">
7823
7824 </span>
7825 <p about="#mwt3">b</p>
7826 !! end
7827
7828 !! test
7829 Parsoid: Merge double tds (bug 50603)
7830 !! options
7831 parsoid
7832 !! input
7833 {|
7834 |{{echo|{{!}} foo}}
7835 |}
7836 !! result
7837 <table><tbody>
7838 <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>
7839 </tbody></table>
7840 !! end
7841
7842 !! test
7843 Parsoid: Merge double tds in nested transclusion content (bug 50603)
7844 !! options
7845 parsoid
7846 !! input
7847 {{echo|<div>}}
7848 {|
7849 |{{echo|{{!}} foo}}
7850 |}
7851 {{echo|</div>}}
7852 !! result
7853 <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}}]}'>
7854 <table><tbody>
7855 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
7856 </tbody></table>
7857 </div>
7858 !! end
7859
7860 ###
7861 ### <includeonly> and <noinclude> in attributes
7862 ###
7863 !!test
7864 0. includeonly around the entire attribute
7865 !!input
7866 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7867 !!result
7868 <p><span id="v2">bar</span>
7869 </p>
7870 !!end
7871
7872 !!test
7873 1. includeonly in html attr key
7874 !!input
7875 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7876 !!result
7877 <p><span id="foo">bar</span>
7878 </p>
7879 !!end
7880
7881 !!test
7882 2. includeonly in html attr value
7883 !!input
7884 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7885 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7886 !!result
7887 <p><span id="v1">bar</span>
7888 <span id="v1">bar</span>
7889 </p>
7890 !!end
7891
7892 !!test
7893 3. includeonly in part of an attr value
7894 !!input
7895 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7896 !!result
7897 <p><span style="color:red;">bar</span>
7898 </p>
7899 !!end
7900
7901 ###
7902 ### Testing parsing of templates where a template arg
7903 ### has the same name as the template itself.
7904 ###
7905
7906 !! article
7907 Template:quote
7908 !! text
7909 {{{quote|{{{1}}}}}}
7910 !! endarticle
7911
7912 !!test
7913 Templates: Template Name/Arg clash: 1. Use of positional param
7914 !!input
7915 {{quote|foo}}
7916 !!result
7917 <p>foo
7918 </p>
7919 !!end
7920
7921 !!test
7922 Templates: Template Name/Arg clash: 2. Use of named param
7923 !!input
7924 {{quote|quote=foo}}
7925 !!result
7926 <p>foo
7927 </p>
7928 !!end
7929
7930 !!test
7931 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7932 !!input
7933 {{quote|quote}}
7934 !!result
7935 <p>quote
7936 </p>
7937 !!end
7938
7939 ###
7940 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7941 ###
7942
7943 !!test
7944 Templates: 1. Simple use
7945 !!input
7946 {{echo|Foo}}
7947 !!result
7948 <p>Foo
7949 </p>
7950 !!end
7951
7952 !!test
7953 Templates: 2. Inside a block tag
7954 !!input
7955 <div>{{echo|Foo}}</div>
7956 <blockquote>{{echo|Foo}}</blockquote>
7957 !!result
7958 <div>Foo</div>
7959 <blockquote>Foo</blockquote>
7960
7961 !!end
7962
7963 !!test
7964 Templates: P-wrapping: 1a. Templates on consecutive lines
7965 !!input
7966 {{echo|Foo}}
7967 {{echo|bar}}
7968 !!result
7969 <p>Foo
7970 bar
7971 </p>
7972 !!end
7973
7974 !!test
7975 Templates: P-wrapping: 1b. Templates on consecutive lines
7976 !!input
7977 Foo
7978
7979 {{echo|bar}}
7980 {{echo|baz}}
7981 !!result
7982 <p>Foo
7983 </p><p>bar
7984 baz
7985 </p>
7986 !!end
7987
7988 !!test
7989 Templates: P-wrapping: 1c. Templates on consecutive lines
7990 !!input
7991 {{echo|Foo}}
7992 {{echo|bar}} <div>baz</div>
7993 !!result
7994 <p>Foo
7995 </p>
7996 bar <div>baz</div>
7997
7998 !!end
7999
8000 !!test
8001 Templates: P-wrapping: 1d. Template preceded by comment-only line
8002 !!options
8003 parsoid
8004 !!input
8005 <!-- foo -->
8006 {{echo|Bar}}
8007 !!result
8008 <!-- foo -->
8009
8010 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8011 !!end
8012
8013 !!test
8014 Templates: Inline Text: 1. Multiple tmeplate uses
8015 !!input
8016 {{echo|Foo}}bar{{echo|baz}}
8017 !!result
8018 <p>Foobarbaz
8019 </p>
8020 !!end
8021
8022 !!test
8023 Templates: Inline Text: 2. Back-to-back template uses
8024 !!input
8025 {{echo|Foo}}{{echo|bar}}
8026 !!result
8027 <p>Foobar
8028 </p>
8029 !!end
8030
8031 !!test
8032 Templates: Block Tags: 1. Multiple template uses
8033 !!input
8034 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8035 !!result
8036 <div>Foo</div><div>bar</div><div>baz</div>
8037
8038 !!end
8039
8040 !!test
8041 Templates: Block Tags: 2. Back-to-back template uses
8042 !!input
8043 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8044 !!result
8045 <div>Foo</div><div>bar</div>
8046
8047 !!end
8048
8049 !!test
8050 Templates: Links: 1. Simple example
8051 !!input
8052 {{echo|[[Foo|bar]]}}
8053 !!result
8054 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8055 </p>
8056 !!end
8057
8058 !!test
8059 Templates: Links: 2. Generation of link href
8060 !!input
8061 [[{{echo|Foo}}|bar]]
8062 !!result
8063 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8064 </p>
8065 !!end
8066
8067 !!test
8068 Templates: Links: 3. Generation of part of a link href
8069 !!input
8070 [[Fo{{echo|o}}|bar]]
8071
8072 [[Foo{{echo|bar}}]]
8073
8074 [[Foo{{echo|bar}}baz]]
8075
8076 [[Foo{{echo|bar}}|bar]]
8077
8078 [[:Foo{{echo|bar}}]]
8079
8080 [[:Foo{{echo|bar}}|bar]]
8081 !!result
8082 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8083 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8084 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8085 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8086 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8087 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8088 </p>
8089 !!end
8090
8091 !!test
8092 Templates: Links: 4. Multiple templates generating link href
8093 !!input
8094 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8095 !!result
8096 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8097 </p>
8098 !!end
8099
8100 !!test
8101 Templates: Links: 5. Generation of link text
8102 !!input
8103 [[Foo|{{echo|bar}}]]
8104 !!result
8105 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8106 </p>
8107 !!end
8108
8109 !!test
8110 Templates: Links: 5. Nested templates (only outermost template should be marked)
8111 !!input
8112 {{echo|[[{{echo|Foo}}|bar]]}}
8113 !!result
8114 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8115 </p>
8116 !!end
8117
8118 !!test
8119 Templates: HTML Tag: 1. Generation of HTML attr. key
8120 !!input
8121 <div {{echo|style}}="color:red;">foo</div>
8122 !!result
8123 <div style="color:red;">foo</div>
8124
8125 !!end
8126
8127 !!test
8128 Templates: HTML Tag: 2. Generation of HTML attr. value
8129 !!input
8130 <div style={{echo|'color:red;'}}>foo</div>
8131 !!result
8132 <div style="color:red;">foo</div>
8133
8134 !!end
8135
8136 !!test
8137 Templates: HTML Tag: 3. Generation of HTML attr key and value
8138 !!input
8139 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8140 !!result
8141 <div style="color:red;">foo</div>
8142
8143 !!end
8144
8145 !!test
8146 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8147 !!input
8148 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8149 !!result
8150 <div title="This is a long title with just one piece templated">foo</div>
8151
8152 !!end
8153
8154 !!test
8155 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8156 !!input
8157 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8158 !!result
8159 <div title="This is a long title with just one piece templated">foo</div>
8160
8161 !!end
8162
8163 !!test
8164 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8165 !!input
8166 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8167 !!result
8168 <div title="This is a long title with just one piece templated">foo</div>
8169
8170 !!end
8171
8172 !!test
8173 Templates: HTML Tag: 7. Generation of partial attribute key string
8174 !!input
8175 <div st{{echo|yle}}="color:red;">foo</div>
8176 !!result
8177 <div style="color:red;">foo</div>
8178
8179 !!end
8180
8181 !!test
8182 Templates: HTML Tables: 1. Generating start of a HTML table
8183 !!input
8184 {{echo|<table><tr><td>foo</td>}}</tr></table>
8185 !!result
8186 <table><tr><td>foo</td></tr></table>
8187
8188 !!end
8189
8190 !!test
8191 Templates: HTML Tables: 2a. Generating middle of a HTML table
8192 !!input
8193 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8194 !!result
8195 <table><tr><td>foo</td></tr></table>
8196
8197 !!end
8198
8199 !!test
8200 Templates: HTML Tables: 2b. Generating middle of a HTML table
8201 !!input
8202 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8203 !!result
8204 <table><tr><td>foo</td></tr></table>
8205
8206 !!end
8207
8208 !!test
8209 Templates: HTML Tables: 3. Generating end of a HTML table
8210 !!input
8211 <table><tr>{{echo|<td>foo</td></tr></table>}}
8212 !!result
8213 <table><tr><td>foo</td></tr></table>
8214
8215 !!end
8216
8217 !!test
8218 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8219 !!input
8220 {{echo|<table>}}<tr><td>foo</td></tr></table>
8221 !!result
8222 <table><tr><td>foo</td></tr></table>
8223
8224 !!end
8225
8226 !!test
8227 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8228 !!input
8229 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8230 !!result
8231 <table><tr><td>foo</td></tr></table>
8232
8233 !!end
8234
8235 !!test
8236 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8237 !!input
8238 <table><tr>{{echo|<td>}}foo</td></tr></table>
8239 !!result
8240 <table><tr><td>foo</td></tr></table>
8241
8242 !!end
8243
8244 !!test
8245 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8246 !!input
8247 <table><tr><td>foo{{echo|</td>}}</tr></table>
8248 !!result
8249 <table><tr><td>foo</td></tr></table>
8250
8251 !!end
8252
8253 !!test
8254 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8255 !!input
8256 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8257 !!result
8258 <table><tr><td>foo</td></tr></table>
8259
8260 !!end
8261
8262 !!test
8263 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8264 !!input
8265 <table><tr><td>foo</td></tr>{{echo|</table>}}
8266 !!result
8267 <table><tr><td>foo</td></tr></table>
8268
8269 !!end
8270
8271 !!test
8272 Templates: HTML Tables: 5. Proper fostering of categories from inside
8273 !!options
8274 parsoid=wt2html,wt2wt
8275 !!input
8276 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8277 <!--Two categories (Bug 50330)-->
8278 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8279 !!result
8280 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8281 <!--Two categories (Bug 50330)-->
8282 <link rel="mw:WikiLink/Category" href="./Category:Bar1"><link rel="mw:WikiLink/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
8283 !!end
8284
8285 !!test
8286 Templates: Wiki Tables: 1a. Fostering of entire template content
8287 !!input
8288 {|
8289 {{echo|a}}
8290 |}
8291 !!result
8292 <table>
8293 a
8294 <tr><td></td></tr></table>
8295
8296 !!end
8297
8298 !!test
8299 Templates: Wiki Tables: 1b. Fostering of entire template content
8300 !!input
8301 {|
8302 {{echo|<div>}}
8303 foo
8304 {{echo|</div>}}
8305 |}
8306 !!result
8307 <table>
8308 <div>
8309 <p>foo
8310 </p>
8311 </div>
8312 <tr><td></td></tr></table>
8313
8314 !!end
8315
8316 !!test
8317 Templates: Wiki Tables: 2. Fostering of partial template content
8318 !!input
8319 {|
8320 {{echo|a
8321 <div>b</div>}}
8322 |}
8323 !!result
8324 <table>
8325 a
8326 <div>b</div>
8327 <tr><td></td></tr></table>
8328
8329 !!end
8330
8331 !!test
8332 Templates: Wiki Tables: 3. td-content via multiple templates
8333 !!input
8334 {|
8335 {{echo|{{pipe}}a}}{{echo|b}}
8336 |}
8337 !!result
8338 <table>
8339 <tr>
8340 <td>ab
8341 </td></tr></table>
8342
8343 !!end
8344
8345 !!test
8346 Templates: Wiki Tables: 4. Templated tags, no content
8347 !!input
8348 {{tbl-start}}
8349 {{tbl-end}}
8350 !!result
8351 <table>
8352 <tr><td></td></tr></table>
8353
8354 !!end
8355
8356 !!test
8357 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8358 !!input
8359 {{tbl-start}}
8360 |foo
8361 {{tbl-end}}
8362 !!result
8363 <table>
8364 <tr>
8365 <td>foo
8366 </td></tr></table>
8367
8368 !!end
8369
8370 !!test
8371 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8372 !!input
8373 {{tbl-start}}
8374 {{!}}foo
8375 {{tbl-end}}
8376 !!result
8377 <table>
8378 <tr>
8379 <td>foo
8380 </td></tr></table>
8381
8382 !!end
8383
8384 !!test
8385 Templates: Lists: Multi-line list-items via templates
8386 !!input
8387 *{{echo|a {{nonexistent|
8388 unused}}}}
8389 *{{echo|b {{nonexistent|
8390 unused}}}}
8391 !!result
8392 <ul>
8393 <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>
8394 </li>
8395 <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>
8396 </li>
8397 </ul>
8398
8399 !!end
8400
8401 !!test
8402 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8403 !!input
8404 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8405 !!result
8406 <p><i>ab</i>c<i>d</i>e
8407 </p>
8408 !!end
8409
8410 !!test
8411 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8412 (PHP parser generates misnested html)
8413 !! options
8414 parsoid
8415 !!input
8416 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8417 !!result
8418 <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>
8419 !!end
8420
8421 !!test
8422 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8423 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8424 !! options
8425 parsoid=wt2html,wt2wt
8426 !!input
8427 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8428 !!result
8429 <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>
8430 <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>
8431 <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>
8432 !!end
8433
8434 !!test
8435 Templates: Ugly nesting: 4. Divs opened/closed across templates
8436 !!input
8437 a<div>b{{echo|c</div>d}}e
8438 !!result
8439 a<div>bc</div>de
8440
8441 !!end
8442
8443 !!test
8444 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8445 (Parsoid-centric)
8446 !! options
8447 parsoid
8448 !!input
8449 {|
8450 |{{echo|foo</table>}}
8451 |bar
8452 |}
8453 !!result
8454 <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|}"]}'>
8455
8456 <tbody>
8457 <tr>
8458 <td>foo</td></tr></tbody></table><span about="#mwt1">
8459 </span><span about="#mwt1">bar</span><span about="#mwt1">
8460 </span>
8461 !!end
8462
8463 !!test
8464 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8465 (Parsoid-centric)
8466 !! options
8467 parsoid
8468 !!input
8469 <table>
8470 <tr>
8471 <td>
8472 <table>
8473 <tr>
8474 <td>1. {{echo|foo </table>}}</td>
8475 <td> bar </td>
8476 <td>2. {{echo|baz </table>}}</td>
8477 </tr>
8478 <tr>
8479 <td>abc</td>
8480 </tr>
8481 </table>
8482 </td>
8483 </tr>
8484 <tr>
8485 <td>xyz</td>
8486 </tr>
8487 </table>
8488 !!result
8489 <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>"]}'>
8490 <tbody><tr>
8491 <td>
8492 <table>
8493 <tbody><tr>
8494 <td>1. foo </td></tr></tbody></table></td>
8495 <td> bar </td>
8496 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8497 </span><span about="#mwt2">
8498 </span><span about="#mwt2">
8499 </span><span about="#mwt2">abc</span><span about="#mwt2">
8500 </span><span about="#mwt2">
8501 </span><span about="#mwt2">
8502 </span><span about="#mwt2">
8503 </span><span about="#mwt2">
8504 </span><span about="#mwt2">
8505 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8506 </span><span about="#mwt2">
8507 </span>
8508 !!end
8509
8510 !! test
8511 Templates: Ugly templates: 3. newline-only template parameter
8512 !! input
8513 foo {{echo|
8514 }}
8515 !! result
8516 <p>foo
8517 </p>
8518 !! end
8519
8520 # This looks like a bug: a single newline triggers p/br for some reason.
8521 !! test
8522 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8523 !! input
8524 {{echo|
8525 }}
8526 !! result
8527 <p><br />
8528 </p>
8529 !! end
8530
8531
8532 !!test
8533 Parser Functions: 1. Simple example
8534 !!input
8535 {{uc:foo}}
8536 !!result
8537 <p>FOO
8538 </p>
8539 !!end
8540
8541 !!test
8542 Parser Functions: 2. Nested use (only outermost should be marked up)
8543 !!input
8544 {{uc:{{lc:FOO}}}}
8545 !!result
8546 <p>FOO
8547 </p>
8548 !!end
8549
8550 ###
8551 ### Pre-save transform tests
8552 ###
8553 !! test
8554 pre-save transform: subst:
8555 !! options
8556 PST
8557 !! input
8558 {{subst:test}}
8559 !! result
8560 This is a test template
8561 !! end
8562
8563 !! test
8564 pre-save transform: normal template
8565 !! options
8566 PST
8567 !! input
8568 {{test}}
8569 !! result
8570 {{test}}
8571 !! end
8572
8573 !! test
8574 pre-save transform: nonexistent template
8575 !! options
8576 PST
8577 !! input
8578 {{thistemplatedoesnotexist}}
8579 !! result
8580 {{thistemplatedoesnotexist}}
8581 !! end
8582
8583
8584 !! test
8585 pre-save transform: subst magic variables
8586 !! options
8587 PST
8588 !! input
8589 {{subst:SITENAME}}
8590 !! result
8591 MediaWiki
8592 !! end
8593
8594 # This is bug 89, which I fixed. -- wtm
8595 !! test
8596 pre-save transform: subst: templates with parameters
8597 !! options
8598 pst
8599 !! input
8600 {{subst:paramtest|param="something else"}}
8601 !! result
8602 This is a test template with parameter "something else"
8603 !! end
8604
8605 !! article
8606 Template:nowikitest
8607 !! text
8608 <nowiki>'''not wiki'''</nowiki>
8609 !! endarticle
8610
8611 !! test
8612 pre-save transform: nowiki in subst (bug 1188)
8613 !! options
8614 pst
8615 !! input
8616 {{subst:nowikitest}}
8617 !! result
8618 <nowiki>'''not wiki'''</nowiki>
8619 !! end
8620
8621
8622 !! article
8623 Template:commenttest
8624 !! text
8625 This template has <!-- a comment --> in it.
8626 !! endarticle
8627
8628 !! test
8629 pre-save transform: comment in subst (bug 1936)
8630 !! options
8631 pst
8632 !! input
8633 {{subst:commenttest}}
8634 !! result
8635 This template has <!-- a comment --> in it.
8636 !! end
8637
8638 !! test
8639 pre-save transform: unclosed tag
8640 !! options
8641 pst noxml
8642 !! input
8643 <nowiki>'''not wiki'''
8644 !! result
8645 <nowiki>'''not wiki'''
8646 !! end
8647
8648 !! test
8649 pre-save transform: mixed tag case
8650 !! options
8651 pst noxml
8652 !! input
8653 <NOwiki>'''not wiki'''</noWIKI>
8654 !! result
8655 <NOwiki>'''not wiki'''</noWIKI>
8656 !! end
8657
8658 !! test
8659 pre-save transform: unclosed comment in <nowiki>
8660 !! options
8661 pst noxml
8662 !! input
8663 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8664 !! result
8665 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8666 !!end
8667
8668 # Leading @ in this template definition works around a limitation
8669 # in parsoid's parserTests which otherwise strips the <span> from the
8670 # result (confusing it for a template wrapper)
8671 !! article
8672 Template:dangerous
8673 !!text
8674 @<span onmouseover="alert('crap')">Oh no</span>
8675 !!endarticle
8676
8677 !!test
8678 (confirming safety of fix for subst bug 1936)
8679 !! input
8680 {{Template:dangerous}}
8681 !! result
8682 <p>@<span>Oh no</span>
8683 </p>
8684 !! end
8685
8686 !! test
8687 pre-save transform: comment containing gallery (bug 5024)
8688 !! options
8689 pst
8690 !! input
8691 <!-- <gallery>data</gallery> -->
8692 !!result
8693 <!-- <gallery>data</gallery> -->
8694 !!end
8695
8696 !! test
8697 pre-save transform: comment containing extension
8698 !! options
8699 pst
8700 !! input
8701 <!-- <tag>data</tag> -->
8702 !!result
8703 <!-- <tag>data</tag> -->
8704 !!end
8705
8706 !! test
8707 pre-save transform: comment containing nowiki
8708 !! options
8709 pst
8710 !! input
8711 <!-- <nowiki>data</nowiki> -->
8712 !!result
8713 <!-- <nowiki>data</nowiki> -->
8714 !!end
8715
8716 !! test
8717 pre-save transform: <noinclude> in subst (bug 3298)
8718 !! options
8719 pst
8720 !! input
8721 {{subst:Includes}}
8722 !! result
8723 Foobar
8724 !! end
8725
8726 !! test
8727 pre-save transform: <onlyinclude> in subst (bug 3298)
8728 !! options
8729 pst
8730 !! input
8731 {{subst:Includes2}}
8732 !! result
8733 Foo
8734 !! end
8735
8736 !! article
8737 Template:SubstTest
8738 !!text
8739 {{<includeonly>subst:</includeonly>Includes}}
8740 !! endarticle
8741
8742 !! article
8743 Template:SafeSubstTest
8744 !! text
8745 {{<includeonly>safesubst:</includeonly>Includes}}
8746 !! endarticle
8747
8748 !! test
8749 bug 22297: safesubst: works during PST
8750 !! options
8751 pst
8752 !! input
8753 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8754 !! result
8755 FoobarFoobar
8756 !! end
8757
8758 !! test
8759 bug 22297: safesubst: works during normal parse
8760 !! input
8761 {{SafeSubstTest}}
8762 !! result
8763 <p>Foobar
8764 </p>
8765 !! end
8766
8767 !! test:
8768 subst: does not work during normal parse
8769 !! input
8770 {{SubstTest}}
8771 !! result
8772 <p>{{subst:Includes}}
8773 </p>
8774 !! end
8775
8776 !! test
8777 pre-save transform: context links ("pipe trick")
8778 !! options
8779 pst
8780 !! input
8781 [[Article (context)|]]
8782 [[Bar:Article|]]
8783 [[:Bar:Article|]]
8784 [[Bar:Article (context)|]]
8785 [[:Bar:Article (context)|]]
8786 [[|Article]]
8787 [[|Article (context)]]
8788 [[Bar:X (Y) Z|]]
8789 [[:Bar:X (Y) Z|]]
8790 !! result
8791 [[Article (context)|Article]]
8792 [[Bar:Article|Article]]
8793 [[:Bar:Article|Article]]
8794 [[Bar:Article (context)|Article]]
8795 [[:Bar:Article (context)|Article]]
8796 [[Article]]
8797 [[Article (context)]]
8798 [[Bar:X (Y) Z|X (Y) Z]]
8799 [[:Bar:X (Y) Z|X (Y) Z]]
8800 !! end
8801
8802 !! test
8803 pre-save transform: context links ("pipe trick") with interwiki prefix
8804 !! options
8805 pst
8806 !! input
8807 [[interwiki:Article|]]
8808 [[:interwiki:Article|]]
8809 [[interwiki:Bar:Article|]]
8810 [[:interwiki:Bar:Article|]]
8811 !! result
8812 [[interwiki:Article|Article]]
8813 [[:interwiki:Article|Article]]
8814 [[interwiki:Bar:Article|Bar:Article]]
8815 [[:interwiki:Bar:Article|Bar:Article]]
8816 !! end
8817
8818 !! test
8819 pre-save transform: context links ("pipe trick") with parens in title
8820 !! options
8821 pst title=[[Somearticle (context)]]
8822 !! input
8823 [[|Article]]
8824 !! result
8825 [[Article (context)|Article]]
8826 !! end
8827
8828 !! test
8829 pre-save transform: context links ("pipe trick") with comma in title
8830 !! options
8831 pst title=[[Someplace, Somewhere]]
8832 !! input
8833 [[|Otherplace]]
8834 [[Otherplace, Elsewhere|]]
8835 [[Otherplace, Elsewhere, Anywhere|]]
8836 !! result
8837 [[Otherplace, Somewhere|Otherplace]]
8838 [[Otherplace, Elsewhere|Otherplace]]
8839 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8840 !! end
8841
8842 !! test
8843 pre-save transform: context links ("pipe trick") with parens and comma
8844 !! options
8845 pst title=[[Someplace (IGNORED), Somewhere]]
8846 !! input
8847 [[|Otherplace]]
8848 [[Otherplace (place), Elsewhere|]]
8849 !! result
8850 [[Otherplace, Somewhere|Otherplace]]
8851 [[Otherplace (place), Elsewhere|Otherplace]]
8852 !! end
8853
8854 !! test
8855 pre-save transform: context links ("pipe trick") with comma and parens
8856 !! options
8857 pst title=[[Who, me? (context)]]
8858 !! input
8859 [[|Yes, you.]]
8860 [[Me, Myself, and I (1937 song)|]]
8861 !! result
8862 [[Yes, you. (context)|Yes, you.]]
8863 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8864 !! end
8865
8866 !! test
8867 pre-save transform: context links ("pipe trick") with namespace
8868 !! options
8869 pst title=[[Ns:Somearticle]]
8870 !! input
8871 [[|Article]]
8872 !! result
8873 [[Ns:Article|Article]]
8874 !! end
8875
8876 !! test
8877 pre-save transform: context links ("pipe trick") with namespace and parens
8878 !! options
8879 pst title=[[Ns:Somearticle (context)]]
8880 !! input
8881 [[|Article]]
8882 !! result
8883 [[Ns:Article (context)|Article]]
8884 !! end
8885
8886 !! test
8887 pre-save transform: context links ("pipe trick") with namespace and comma
8888 !! options
8889 pst title=[[Ns:Somearticle, Context, Whatever]]
8890 !! input
8891 [[|Article]]
8892 !! result
8893 [[Ns:Article, Context, Whatever|Article]]
8894 !! end
8895
8896 !! test
8897 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8898 !! options
8899 pst title=[[Ns:Somearticle, Context (context)]]
8900 !! input
8901 [[|Article]]
8902 !! result
8903 [[Ns:Article (context)|Article]]
8904 !! end
8905
8906 !! test
8907 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8908 !! options
8909 pst title=[[Ns:Somearticle (IGNORED), Context]]
8910 !! input
8911 [[|Article]]
8912 !! result
8913 [[Ns:Article, Context|Article]]
8914 !! end
8915
8916 !! test
8917 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8918 !! options
8919 pst
8920 !! input
8921 [[Article(context)|]]
8922 [[Bar:Article(context)|]]
8923 [[:Bar:Article(context)|]]
8924 [[|Article(context)]]
8925 [[Bar:X(Y)Z|]]
8926 [[:Bar:X(Y)Z|]]
8927 !! result
8928 [[Article(context)|Article]]
8929 [[Bar:Article(context)|Article]]
8930 [[:Bar:Article(context)|Article]]
8931 [[Article(context)]]
8932 [[Bar:X(Y)Z|X(Y)Z]]
8933 [[:Bar:X(Y)Z|X(Y)Z]]
8934 !! end
8935
8936 !! test
8937 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8938 !! options
8939 pst
8940 !! input
8941 [[Article (context)|]]
8942 [[Bar:Article (context)|]]
8943 [[:Bar:Article (context)|]]
8944 [[|Article (context)]]
8945 [[Bar:X (Y) Z|]]
8946 [[:Bar:X (Y) Z|]]
8947 !! result
8948 [[Article (context)|Article]]
8949 [[Bar:Article (context)|Article]]
8950 [[:Bar:Article (context)|Article]]
8951 [[Article (context)]]
8952 [[Bar:X (Y) Z|X (Y) Z]]
8953 [[:Bar:X (Y) Z|X (Y) Z]]
8954 !! end
8955
8956 !! test
8957 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8958 !! options
8959 pst
8960 !! input
8961 [[Article(context)|]]
8962 [[Bar:Article(context)|]]
8963 [[:Bar:Article(context)|]]
8964 [[|Article(context)]]
8965 [[Bar:X(Y)Z|]]
8966 [[:Bar:X(Y)Z|]]
8967 !! result
8968 [[Article(context)|Article]]
8969 [[Bar:Article(context)|Article]]
8970 [[:Bar:Article(context)|Article]]
8971 [[Article(context)]]
8972 [[Bar:X(Y)Z|X(Y)Z]]
8973 [[:Bar:X(Y)Z|X(Y)Z]]
8974 !! end
8975
8976 !! test
8977 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8978 !! options
8979 pst
8980 !! input
8981 [[Article (context), context|]]
8982 [[Article (context),context|]]
8983 [[Bar:Article (context), context|]]
8984 [[Bar:Article (context),context|]]
8985 [[:Bar:Article (context), context|]]
8986 [[:Bar:Article (context),context|]]
8987 !! result
8988 [[Article (context), context|Article]]
8989 [[Article (context),context|Article]]
8990 [[Bar:Article (context), context|Article]]
8991 [[Bar:Article (context),context|Article]]
8992 [[:Bar:Article (context), context|Article]]
8993 [[:Bar:Article (context),context|Article]]
8994 !! end
8995
8996 !! test
8997 pre-save transform: trim trailing empty lines
8998 !! options
8999 pst
9000 !! input
9001 Empty lines are trimmed
9002
9003
9004
9005
9006 !! result
9007 Empty lines are trimmed
9008 !! end
9009
9010 !! test
9011 pre-save transform: Signature expansion
9012 !! options
9013 pst
9014 !! input
9015 * ~~~
9016 * <noinclude>~~~</noinclude>
9017 * <includeonly>~~~</includeonly>
9018 * <onlyinclude>~~~</onlyinclude>
9019 !! result
9020 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9021 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9022 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9023 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9024 !! end
9025
9026
9027 !! test
9028 pre-save transform: Signature expansion in nowiki tags (bug 93)
9029 !! options
9030 pst disabled
9031 !! input
9032 Shall not expand:
9033
9034 <nowiki>~~~~</nowiki>
9035
9036 <includeonly><nowiki>~~~~</nowiki></includeonly>
9037
9038 <noinclude><nowiki>~~~~</nowiki></noinclude>
9039
9040 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9041
9042 {{subst:Foo}} shall be converted to FOO
9043
9044 As well as inside noinclude/onlyinclude
9045 <noinclude>{{subst:Foo}}</noinclude>
9046 <onlyinclude>{{subst:Foo}}</onlyinclude>
9047
9048 But not inside includeonly
9049 <includeonly>{{subst:Foo}}</includeonly>
9050 !! result
9051 Shall not expand:
9052
9053 <nowiki>~~~~</nowiki>
9054
9055 <includeonly><nowiki>~~~~</nowiki></includeonly>
9056
9057 <noinclude><nowiki>~~~~</nowiki></noinclude>
9058
9059 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9060
9061 FOO shall be converted to FOO
9062
9063 As well as inside noinclude/onlyinclude
9064 <noinclude>FOO</noinclude>
9065 <onlyinclude>FOO</onlyinclude>
9066
9067 But not inside includeonly
9068 <includeonly>{{subst:Foo}}</includeonly>
9069 !! end
9070
9071 !! test
9072 Parsoid: Recognize nowiki with trailing space in tags
9073 !! options
9074 parsoid=wt2html
9075 !! input
9076 <nowiki ><div>[[foo]]</nowiki >
9077
9078 a<nowiki / >b
9079
9080 c<nowiki />d
9081
9082 e<nowiki/ >f
9083 !! result
9084 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9085 <p>ab</p>
9086 <p>cd</p>
9087 <p>ef</p>
9088 !! end
9089
9090 !! test
9091 Parsoid: Recognize nowiki with odd capitalization
9092 !! options
9093 parsoid=wt2html
9094 !! input
9095 <noWikI ><div>[[foo]]</Nowiki >
9096 !! result
9097 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9098 !! end
9099
9100
9101 !! test
9102 Parsoid: Escape nowiki with trailing space in tags
9103 !! options
9104 parsoid=html2wt
9105 !! input
9106 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9107
9108 a&lt;nowiki /&gt;b
9109
9110 c&lt;nowiki/ &gt;d
9111 !! result
9112 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9113 <p>a&lt;nowiki /&gt;b</p>
9114 <p>c&lt;nowiki/ &gt;d</p>
9115 !! end
9116
9117 !! test
9118 Parsoid: Escape weird noWikI capitalizations
9119 !! options
9120 parsoid=html2wt
9121 !! input
9122 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9123 !! result
9124 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9125 !! end
9126
9127 ###
9128 ### Message transform tests
9129 ###
9130 !! test
9131 message transform: magic variables
9132 !! options
9133 msg
9134 !! input
9135 {{SITENAME}}
9136 !! result
9137 MediaWiki
9138 !! end
9139
9140 !! test
9141 message transform: should not transform wiki markup
9142 !! options
9143 msg
9144 !! input
9145 ''test''
9146 !! result
9147 ''test''
9148 !! end
9149
9150 !! test
9151 message transform: <noinclude> in transcluded template (bug 4926)
9152 !! options
9153 msg
9154 !! input
9155 {{Includes}}
9156 !! result
9157 Foobar
9158 !! end
9159
9160 !! test
9161 message transform: <onlyinclude> in transcluded template (bug 4926)
9162 !! options
9163 msg
9164 !! input
9165 {{Includes2}}
9166 !! result
9167 Foo
9168 !! end
9169
9170 !! test
9171 {{#special:}} page name, known
9172 !! options
9173 msg
9174 !! input
9175 {{#special:Recentchanges}}
9176 !! result
9177 Special:RecentChanges
9178 !! end
9179
9180 !! test
9181 {{#special:}} page name with subpage, known
9182 !! options
9183 msg
9184 !! input
9185 {{#special:Recentchanges/param}}
9186 !! result
9187 Special:RecentChanges/param
9188 !! end
9189
9190 !! test
9191 {{#special:}} page name, unknown
9192 !! options
9193 msg
9194 !! input
9195 {{#special:foobar nonexistent}}
9196 !! result
9197 Special:Foobar nonexistent
9198 !! end
9199
9200 !! test
9201 {{#speciale:}} page name, known
9202 !! options
9203 msg
9204 !! input
9205 {{#speciale:Recentchanges}}
9206 !! result
9207 Special:RecentChanges
9208 !! end
9209
9210 !! test
9211 {{#speciale:}} page name with subpage, known
9212 !! options
9213 msg
9214 !! input
9215 {{#speciale:Recentchanges/param}}
9216 !! result
9217 Special:RecentChanges/param
9218 !! end
9219
9220 !! test
9221 {{#speciale:}} page name, unknown
9222 !! options
9223 msg
9224 !! input
9225 {{#speciale:foobar nonexistent}}
9226 !! result
9227 Special:Foobar_nonexistent
9228 !! end
9229
9230 ###
9231 ### Images
9232 ###
9233 ### For Parsoid-specific tests, see
9234 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9235
9236 !! test
9237 Simple image (php)
9238 !! options
9239 php
9240 !! input
9241 [[Image:foobar.jpg]]
9242 !! result
9243 <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>
9244 </p>
9245 !! end
9246
9247 !! test
9248 Simple image (parsoid)
9249 !! options
9250 parsoid=wt2html
9251 !! input
9252 [[Image:foobar.jpg]]
9253 !! result
9254 <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>
9255 </p>
9256 !! end
9257
9258 !! test
9259 Simple image (using File: namespace, now canonical) (php)
9260 !! options
9261 php
9262 !! input
9263 [[File:foobar.jpg]]
9264 !! result
9265 <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>
9266 </p>
9267 !! end
9268
9269 !! test
9270 Simple image (using File: namespace, now canonical) (parsoid)
9271 !! options
9272 parsoid
9273 !! input
9274 [[File:Foobar.jpg]]
9275 !! result
9276 <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>
9277 </p>
9278 !! end
9279
9280 !! test
9281 Right-aligned image (php)
9282 !! options
9283 php
9284 !! input
9285 [[Image:foobar.jpg|right]]
9286 !! result
9287 <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>
9288
9289 !! end
9290
9291 !! test
9292 Right-aligned image (parsoid)
9293 !! options
9294 parsoid
9295 !! input
9296 [[File:Foobar.jpg|right]]
9297 !! result
9298 <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>
9299 !! end
9300
9301 !! test
9302 Image with caption (php)
9303 !! options
9304 php
9305 !! input
9306 [[File:Foobar.jpg|right|Caption text]]
9307 !! result
9308 <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>
9309
9310 !! end
9311
9312 !! test
9313 Image with caption (parsoid)
9314 !! options
9315 parsoid
9316 !! input
9317 [[File:Foobar.jpg|right|Caption text]]
9318 !! result
9319 <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>
9320 !! end
9321
9322 !! test
9323 Image with empty attribute (php)
9324 !! options
9325 php
9326 !! input
9327 [[File:Foobar.jpg|right||Caption text]]
9328 !! result
9329 <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>
9330
9331 !! end
9332
9333 !! test
9334 Image with empty attribute (parsoid)
9335 !! options
9336 parsoid=wt2html
9337 !! input
9338 [[File:Foobar.jpg|right||Caption text]]
9339 !! result
9340 <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>
9341 !! end
9342
9343 !! test
9344 Image with attributes from template (php)
9345 !! options
9346 php
9347 !! input
9348 [[File:Foobar.jpg|{{image_attribs}}]]
9349 !! result
9350 <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>
9351
9352 !! end
9353
9354 !! test
9355 Image with attributes from template (parsoid)
9356 !! options
9357 parsoid
9358 !! input
9359 [[File:Foobar.jpg|{{image_attribs}}]]
9360 !! result
9361 <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>
9362 !! end
9363
9364 !! test
9365 Image with link tails (php)
9366 !! options
9367 php
9368 !! input
9369 123[[File:Foobar.jpg]]456
9370 123[[File:Foobar.jpg|right]]456
9371 123[[File:Foobar.jpg|thumb]]456
9372 !! result
9373 <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
9374 </p>
9375 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
9376 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
9377
9378 !! end
9379
9380 !! test
9381 Image with link tails (parsoid)
9382 !! options
9383 parsoid
9384 !! input
9385 123[[File:Foobar.jpg]]456
9386 123[[File:Foobar.jpg|right]]456
9387 123[[File:Foobar.jpg|thumb]]456
9388 !! result
9389 <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>
9390 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
9391 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="20" width="180"></a></figure>456
9392 !! end
9393
9394 !! test
9395 Image with multiple captions -- only last one is accepted (php)
9396 !! options
9397 php
9398 !! input
9399 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9400 !! result
9401 <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>
9402
9403 !! end
9404
9405 !! test
9406 Image with multiple captions -- only last one is accepted (parsoid)
9407 !! options
9408 parsoid
9409 !! input
9410 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9411 !! result
9412 <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>
9413 !! end
9414
9415 !! test
9416 Image with width attribute at different positions (php)
9417 !! options
9418 php
9419 !! input
9420 [[File:Foobar.jpg|200px|right|Caption]]
9421 [[File:Foobar.jpg|right|200px|Caption]]
9422 [[File:Foobar.jpg|right|Caption|200px]]
9423 !! result
9424 <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>
9425 <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>
9426 <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>
9427
9428 !! end
9429
9430 !! test
9431 Image with width attribute at different positions (parsoid)
9432 !! options
9433 parsoid
9434 !! input
9435 [[File:Foobar.jpg|200px|right|Caption]]
9436 [[File:Foobar.jpg|right|200px|Caption]]
9437 [[File:Foobar.jpg|right|Caption|200px]]
9438 !! result
9439 <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>
9440 <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>
9441 <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>
9442 !! end
9443
9444 !! test
9445 Image with link parameter, wiki target (php)
9446 !! options
9447 php
9448 !! input
9449 [[File:Foobar.jpg|link=Main Page]]
9450 !! result
9451 <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>
9452 </p>
9453 !! end
9454
9455 !! test
9456 Image with link parameter, wiki target (parsoid)
9457 !! options
9458 parsoid
9459 !! input
9460 [[File:Foobar.jpg|link=Main Page]]
9461 !! result
9462 <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>
9463 !! end
9464
9465 !! test
9466 Image with link parameter, URL target (php)
9467 !! options
9468 php
9469 !! input
9470 [[File:Foobar.jpg|link=http://example.com/]]
9471 !! result
9472 <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>
9473 </p>
9474 !! end
9475
9476 # parsoid bug 49293 (part 1)
9477 !! test
9478 Image with link parameter, URL target (parsoid)
9479 !! options
9480 parsoid
9481 !! input
9482 [[File:Foobar.jpg|link=http://example.com/]]
9483 !! result
9484 <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>
9485 !! end
9486
9487 !! test
9488 Image with link parameter, protocol-less URL target (php)
9489 !! options
9490 php
9491 !! input
9492 [[File:Foobar.jpg|link=//example.com/]]
9493 !! result
9494 <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>
9495 </p>
9496 !! end
9497
9498 # parsoid bug 49293 (part 2)
9499 !! test
9500 Image with link parameter, protocol-less URL target (parsoid)
9501 !! options
9502 parsoid
9503 !! input
9504 [[File:Foobar.jpg|link=//example.com/]]
9505 !! result
9506 <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>
9507 !! end
9508
9509 !! test
9510 Image with link parameter, wgExternalLinkTarget
9511 !! input
9512 [[Image:foobar.jpg|link=http://example.com/]]
9513 !! config
9514 wgExternalLinkTarget='foobar'
9515 !! result
9516 <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>
9517 </p>
9518 !! end
9519
9520 !! test
9521 Image with link parameter, wgNoFollowLinks set to false
9522 !! input
9523 [[Image:foobar.jpg|link=http://example.com/]]
9524 !! config
9525 wgNoFollowLinks=false
9526 !! result
9527 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9528 </p>
9529 !! end
9530
9531 !! test
9532 Image with link parameter, wgNoFollowDomainExceptions
9533 !! input
9534 [[Image:foobar.jpg|link=http://example.com/]]
9535 !! config
9536 wgNoFollowDomainExceptions='example.com'
9537 !! result
9538 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9539 </p>
9540 !! end
9541
9542 !! test
9543 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9544 !! input
9545 [[Image:foobar.jpg|link=http://example.com/|Title]]
9546 !! config
9547 wgExternalLinkTarget='foobar'
9548 !! result
9549 <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>
9550 </p>
9551 !! end
9552
9553 !! test
9554 Image with empty link parameter (php)
9555 !! options
9556 php
9557 !! input
9558 [[File:Foobar.jpg|link=]]
9559 !! result
9560 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
9561 </p>
9562 !! end
9563
9564 !! test
9565 Image with empty link parameter (parsoid)
9566 !! options
9567 parsoid
9568 !! input
9569 [[File:Foobar.jpg|link=]]
9570 !! result
9571 <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>
9572 !! end
9573
9574 !! test
9575 Image with link parameter (wiki target) and unnamed parameter (php)
9576 !! options
9577 php
9578 !! input
9579 [[File:Foobar.jpg|link=Main Page|Title]]
9580 !! result
9581 <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>
9582 </p>
9583 !! end
9584
9585 !! test
9586 Image with link parameter (wiki target) and unnamed parameter (parsoid)
9587 !! options
9588 parsoid
9589 !! input
9590 [[File:Foobar.jpg|link=Main Page|Title]]
9591 !! result
9592 <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>
9593 !! end
9594
9595 !! test
9596 Image with link parameter (URL target) and unnamed parameter (php)
9597 !! options
9598 php
9599 !! input
9600 [[File:Foobar.jpg|link=http://example.com/|Title]]
9601 !! result
9602 <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>
9603 </p>
9604 !! end
9605
9606 !! test
9607 Image with link parameter (URL target) and unnamed parameter (parsoid)
9608 !! options
9609 parsoid
9610 !! input
9611 [[File:Foobar.jpg|link=http://example.com/|Title]]
9612 !! result
9613 <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>
9614 !! end
9615
9616 !! test
9617 Thumbnail image with link parameter
9618 !! options
9619 php
9620 !! input
9621 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
9622 !! result
9623 <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>
9624
9625 !! end
9626
9627 !! test
9628 Manually-specified thumbnail image
9629 !! options
9630 php
9631 !! input
9632 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
9633 !! result
9634 <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>
9635
9636 !! end
9637
9638 !! test
9639 Manually-specified thumbnail image with explicit link to wiki page
9640 !! options
9641 php
9642 !! input
9643 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
9644 !! result
9645 <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>
9646
9647 !! end
9648
9649 !! test
9650 Manually-specified thumbnail image with explicit link to url
9651 !! options
9652 php
9653 !! input
9654 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
9655 !! result
9656 <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>
9657
9658 !! end
9659
9660 !! test
9661 Manually-specified thumbnail image with explicit no link
9662 !! options
9663 php
9664 !! input
9665 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
9666 !! result
9667 <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>
9668
9669 !! end
9670
9671 !! test
9672 Manually-specified thumbnail image with explicit link and alt text
9673 !! options
9674 php
9675 !! input
9676 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
9677 !! result
9678 <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>
9679
9680 !! end
9681
9682 !! test
9683 Image with frame and link
9684 !! input
9685 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
9686 !! result
9687 <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>
9688
9689 !! end
9690
9691 !! test
9692 Image with frame and link and explicit alt
9693 !! input
9694 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
9695 !! result
9696 <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>
9697
9698 !! end
9699
9700 !! test
9701 Image with wiki markup in implicit alt
9702 !! input
9703 [[Image:Foobar.jpg|testing '''bold''' in alt]]
9704 !! result
9705 <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>
9706 </p>
9707 !! end
9708
9709 !! test
9710 Image with wiki markup in explicit alt
9711 !! input
9712 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
9713 !! result
9714 <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>
9715 </p>
9716 !! end
9717
9718 !! test
9719 Link to image page- image page normally doesn't exists, hence edit link
9720 Add test with existing image page
9721 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
9722 !! input
9723 [[:Image:test]]
9724 !! result
9725 <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>
9726 </p>
9727 !! end
9728
9729 !! test
9730 bug 18784 Link to non-existent image page with caption should use caption as link text
9731 !! input
9732 [[:Image:test|caption]]
9733 !! result
9734 <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>
9735 </p>
9736 !! end
9737
9738 !! test
9739 Frameless image caption with a free URL
9740 !! input
9741 [[Image:foobar.jpg|http://example.com]]
9742 !! result
9743 <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>
9744 </p>
9745 !! end
9746
9747 !! test
9748 Thumbnail image caption with a free URL
9749 !! input
9750 [[Image:foobar.jpg|thumb|http://example.com]]
9751 !! result
9752 <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>
9753
9754 !! end
9755
9756 !! test
9757 Thumbnail image caption with a free URL and explicit alt
9758 !! input
9759 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9760 !! result
9761 <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>
9762
9763 !! end
9764
9765 !! test
9766 SVG thumbnails with no language set
9767 !! options
9768 !! input
9769 [[File:Foobar.svg|thumb|width=200]]
9770 !! result
9771 <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>width=200</div></div></div>
9772
9773 !! end
9774
9775 !! test
9776 SVG thumbnails with language de
9777 !! options
9778 !! input
9779 [[File:Foobar.svg|thumb|width=200|lang=de]]
9780 !! result
9781 <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>width=200</div></div></div>
9782
9783 !! end
9784
9785 !! test
9786 SVG thumbnails with invalid language code
9787 !! options
9788 !! input
9789 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9790 !! result
9791 <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>
9792
9793 !! end
9794
9795 !! test
9796 BUG 1887: A ISBN with a thumbnail
9797 !! input
9798 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9799 !! result
9800 <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>
9801
9802 !! end
9803
9804 !! test
9805 BUG 1887: A RFC with a thumbnail
9806 !! input
9807 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9808 !! result
9809 <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>
9810
9811 !! end
9812
9813 !! test
9814 BUG 1887: A mailto link with a thumbnail
9815 !! input
9816 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9817 !! result
9818 <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>
9819
9820 !! end
9821
9822 # Pending resolution to bug 368
9823 !! test
9824 BUG 648: Frameless image caption with a link
9825 !! input
9826 [[Image:foobar.jpg|text with a [[link]] in it]]
9827 !! result
9828 <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>
9829 </p>
9830 !! end
9831
9832 !! test
9833 BUG 648: Frameless image caption with a link (suffix)
9834 !! input
9835 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9836 !! result
9837 <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>
9838 </p>
9839 !! end
9840
9841 !! test
9842 BUG 648: Frameless image caption with an interwiki link
9843 !! input
9844 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9845 !! result
9846 <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>
9847 </p>
9848 !! end
9849
9850 !! test
9851 BUG 648: Frameless image caption with a piped interwiki link
9852 !! input
9853 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9854 !! result
9855 <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>
9856 </p>
9857 !! end
9858
9859 !! test
9860 Escape HTML special chars in image alt text
9861 !! input
9862 [[Image:foobar.jpg|& < > "]]
9863 !! result
9864 <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>
9865 </p>
9866 !! end
9867
9868 !! test
9869 BUG 499: Alt text should have &#1234;, not &amp;1234;
9870 !! input
9871 [[Image:foobar.jpg|&#9792;]]
9872 !! result
9873 <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>
9874 </p>
9875 !! end
9876
9877 !! test
9878 Broken image caption with link
9879 !! input
9880 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9881 !! result
9882 <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.
9883 </p>
9884 !! end
9885
9886 !! test
9887 Image caption containing another image
9888 !! input
9889 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9890 !! result
9891 <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>
9892
9893 !! end
9894
9895 !! test
9896 Image caption containing a newline
9897 !! input
9898 [[Image:Foobar.jpg|This
9899 *is some text]]
9900 !! result
9901 <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>
9902 </p>
9903 !!end
9904
9905 !!test
9906 Parsoid: Image caption containing leading space
9907 (The leading space should not trigger nowiki escaping in wt2wt mode)
9908 !! input
9909 [[Image:Foobar.jpg|thumb| bar]]
9910 !! result
9911 <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>
9912
9913 !!end
9914
9915 !! test
9916 Bug 3090: External links other than http: in image captions
9917 !! input
9918 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9919 !! result
9920 <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>
9921
9922 !! end
9923
9924 !! test
9925 Custom class
9926 !! input
9927 [[Image:foobar.jpg|a|class=b]]
9928 !! result
9929 <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>
9930 </p>
9931 !! end
9932
9933 !! test
9934 Localized image handling (1).
9935 !! options
9936 language=es
9937 !! input
9938 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9939 !! result
9940 <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>
9941
9942 !! end
9943
9944 !! test
9945 Localized image handling (2).
9946 !! options
9947 language=es
9948 !! input
9949 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9950 !! result
9951 <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>
9952
9953 !! end
9954
9955 !! test
9956 "border", "frameless" and "class" attributes on an image.
9957 !! input
9958 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9959 !! result
9960 <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>
9961 </p>
9962 !! end
9963
9964 !! article
9965 File:Barfoo.jpg
9966 !! text
9967 #REDIRECT [[File:Barfoo.jpg]]
9968 !! endarticle
9969
9970 !! test
9971 Redirected image
9972 !! input
9973 [[Image:Barfoo.jpg]]
9974 !! result
9975 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9976 </p>
9977 !! end
9978
9979 !! test
9980 Missing image with uploads disabled
9981 !! options
9982 wgEnableUploads=0
9983 !! input
9984 [[Image:Foobaz.jpg]]
9985 !! result
9986 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9987 </p>
9988 !! end
9989
9990 # Parsoid-specific testing for images
9991 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9992 # Currently imperfect due to a flaw in the Parsoid testrunner
9993 # Work in progress
9994 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9995 # image tests.
9996
9997 !! test
9998 Parsoid-specific image handling - simple image with size and middle alignment
9999 !! options
10000 parsoid
10001 !! input
10002 [[Image:Foobar.jpg|50px|middle]]
10003 !! result
10004 <p>
10005 <span class="mw-valign-middle" typeof="mw:Image">
10006 <a href="File:Foobar.jpg">
10007 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10008 </a>
10009 </span>
10010 </p>
10011 !! end
10012
10013 !! test
10014 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10015 !! options
10016 parsoid
10017 !! input
10018 [[Image:Foobar.jpg|500x10px|baseline|caption]]
10019 !! result
10020 <p>
10021 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10022 <a href="File:Foobar.jpg">
10023 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
10024 </a>
10025 </span>
10026 </p>
10027 !! end
10028
10029 !! test
10030 Parsoid-specific image handling - simple image with border and size spec
10031 !! options
10032 parsoid
10033 !! input
10034 [[Image:Foobar.jpg|50px|border|caption]]
10035 !! result
10036 <p>
10037 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10038 <a href="File:Foobar.jpg">
10039 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10040 </a>
10041 </span>
10042 </p>
10043 !! end
10044
10045 !! test
10046 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10047 !! options
10048 parsoid
10049 !! input
10050 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
10051 !! result
10052 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10053 <a href="File:Foobar.jpg">
10054 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
10055 </a>
10056 <figcaption>caption content</figcaption>
10057 </figure>
10058 !! end
10059
10060 !! test
10061 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10062 !! options
10063 parsoid
10064 !! input
10065 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10066 !! result
10067 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10068 <a href="File:Foobar.jpg">
10069 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10070 </a>
10071 <figcaption>caption</figcaption>
10072 </figure>
10073 !! end
10074
10075 !! test
10076 Parsoid-specific image handling - framed image with specific size and caption
10077 !! options
10078 parsoid
10079 !! input
10080 [[Image:Foobar.jpg|500x50px|frame|caption]]
10081 !! result
10082 <figure typeof="mw:Image/Frame">
10083 <a href="File:Foobar.jpg">
10084 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10085 </a>
10086 <figcaption>caption</figcaption>
10087 </figure>
10088 !! end
10089
10090 !! test
10091 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10092 !! options
10093 parsoid
10094 !! input
10095 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
10096 !! result
10097 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10098 <a href="File:Foobar.jpg">
10099 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10100 </a>
10101 <figcaption>caption</figcaption>
10102 </figure>
10103 !! end
10104
10105 !! test
10106 Parsoid-specific image handling - frameless image with specific size, border, and caption
10107 !! options
10108 parsoid
10109 !! input
10110 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
10111 !! result
10112 <p>
10113 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10114 <a href="File:Foobar.jpg">
10115 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10116 </a>
10117 </p>
10118 !! end
10119
10120 #!! test
10121 #Parsoid-specific image handling - simple image with a formatted caption
10122 #!! options
10123 #parsoid
10124 #!! input
10125 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10126 #!! result
10127 #<p>
10128 #<span typeof="mw:Image">
10129 #<a class="mw-default-size" href="Image:Foobar.jpg">
10130 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10131 #</a>
10132 #<span>abc</span>
10133 #</span>
10134 #</p>
10135
10136
10137 ###
10138 ### Subpages
10139 ###
10140 !! article
10141 Subpage test/subpage
10142 !! text
10143 foo
10144 !! endarticle
10145
10146 !! test
10147 Subpage link
10148 !! options
10149 subpage title=[[Subpage test]]
10150 !! input
10151 [[/subpage]]
10152 !! result
10153 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10154 </p>
10155 !! end
10156
10157 !! test
10158 Subpage noslash link
10159 !! options
10160 subpage title=[[Subpage test]]
10161 !!input
10162 [[/subpage/]]
10163 !! result
10164 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10165 </p>
10166 !! end
10167
10168 # TODO: make this PHP-parser compatible!
10169 !! test
10170 Relative subpage noslash link
10171 !! options
10172 parsoid=wt2wt,wt2html,html2html
10173 subpage title=[[Subpage test/1/2/3/4]]
10174 !!input
10175 [[../../subpage/]]
10176
10177 [[../../subpage]]
10178 !! result
10179 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10180 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10181 !! end
10182
10183 # TODO: make this PHP-parser compatible!
10184 !! test
10185 Parsoid: dot-slash prefixed wikilinks
10186 !! options
10187 parsoid=wt2wt,wt2html,html2html
10188 !!input
10189 [[./foo]]
10190
10191 [[././bar]]
10192
10193 [[././baz/]]
10194 !! result
10195 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10196 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10197 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10198 !! end
10199
10200 !! test
10201 Disabled subpages
10202 !! input
10203 [[/subpage]]
10204 !! result
10205 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10206 </p>
10207 !! end
10208
10209 !! test
10210 BUG 561: {{/Subpage}}
10211 !! options
10212 subpage title=[[Page]]
10213 !! input
10214 {{/Subpage}}
10215 !! result
10216 <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>
10217 </p>
10218 !! end
10219
10220 ###
10221 ### Categories
10222 ###
10223 !! article
10224 Category:MediaWiki User's Guide
10225 !! text
10226 blah
10227 !! endarticle
10228
10229 !! test
10230 Link to category
10231 !! input
10232 [[:Category:MediaWiki User's Guide]]
10233 !! result
10234 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10235 </p>
10236 !! end
10237
10238 !! test
10239 Simple category
10240 !! options
10241 cat
10242 !! input
10243 [[Category:MediaWiki User's Guide]]
10244 !! result
10245 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10246 !! end
10247
10248 !! test
10249 PAGESINCATEGORY invalid title fatal (r33546 fix)
10250 !! input
10251 {{PAGESINCATEGORY:<bogus>}}
10252 !! result
10253 <p>0
10254 </p>
10255 !! end
10256
10257 !! test
10258 Category with different sort key
10259 !! options
10260 cat
10261 !! input
10262 [[Category:MediaWiki User's Guide|Foo]]
10263 !! result
10264 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10265 !! end
10266
10267 !! test
10268 Category with identical sort key
10269 !! options
10270 cat
10271 !! input
10272 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10273 !! result
10274 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10275 !! end
10276
10277 !! test
10278 Category with empty sort key
10279 !! options
10280 cat
10281 pst
10282 !! input
10283 [[Category:MediaWiki User's Guide|]]
10284 !! result
10285 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10286 !! end
10287
10288 !! test
10289 Category with empty sort key and parentheses
10290 !! options
10291 cat
10292 pst
10293 !! input
10294 [[Category:Foo (bar)|]]
10295 !! result
10296 [[Category:Foo (bar)|Foo]]
10297 !! end
10298
10299 !! test
10300 Category with link tail
10301 !! options
10302 cat
10303 pst
10304 !! input
10305 123[[Category:Foo]]456
10306 !! result
10307 123[[Category:Foo]]456
10308 !! end
10309
10310 !! test
10311 Category with template
10312 !! options
10313 cat
10314 pst
10315 !! input
10316 [[Category:{{echo|Foo}}]]
10317 !! result
10318 [[Category:{{echo|Foo}}]]
10319 !! end
10320
10321 !! test
10322 Category with template in sort key
10323 !! options
10324 cat
10325 pst
10326 !! input
10327 [[Category:Foo|{{echo|Bar}}]]
10328 !! result
10329 [[Category:Foo|{{echo|Bar}}]]
10330 !! end
10331
10332 !! test
10333 Category with template in sort key and title
10334 !! options
10335 cat
10336 pst
10337 !! input
10338 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
10339 !! result
10340 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
10341 !! end
10342
10343 !! test
10344 Category / paragraph interactions
10345 !! input
10346 Foo [[Category:Baz]] Bar
10347
10348 Foo [[Category:Baz]]
10349 Bar
10350
10351 Foo
10352 [[Category:Baz]]
10353 Bar
10354
10355 Foo
10356 [[Category:Baz]] Bar
10357
10358 Foo
10359 [[Category:Baz]]
10360 [[Category:Baz]]
10361 [[Category:Baz]]
10362 Bar
10363
10364 [[Category:Baz]]
10365 [[Category:Baz]]
10366 [[Category:Baz]]
10367
10368 [[Category:Baz]]
10369 {{echo|[[Category:Baz]]}}
10370 [[Category:Baz]]
10371 !! result
10372 <p>Foo Bar
10373 </p><p>Foo
10374 Bar
10375 </p><p>Foo
10376 Bar
10377 </p><p>Foo Bar
10378 </p><p>Foo
10379 Bar
10380 </p>
10381 !! end
10382
10383 !! test
10384 Parsoid: Serialize link to category page with colon escape
10385 !! options
10386 parsoid
10387 !! input
10388
10389 [[:Category:Foo]]
10390 [[:Category:Foo|Bar]]
10391 !! result
10392 <p>
10393 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
10394 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
10395 </p>
10396 !! end
10397
10398 !! test
10399 Parsoid: Link prefix/suffixes aren't applied to category links
10400 !! options
10401 parsoid=wt2html,wt2wt,html2html
10402 language=is
10403 !! input
10404 x[[Category:Foo]]y
10405 !! result
10406 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
10407 !! end
10408
10409 !! test
10410 Parsoid: Serialize link to file page with colon escape
10411 !! options
10412 parsoid
10413 !! input
10414
10415 [[:File:Foo.png]]
10416 [[:File:Foo.png|Bar]]
10417 !! result
10418 <p>
10419 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
10420 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
10421 </p>
10422 !! end
10423
10424 !! test
10425 Parsoid: Serialize a genuine category link without colon escape
10426 !! options
10427 parsoid
10428 !! input
10429 [[Category:Foo]]
10430 [[Category:Foo|Bar]]
10431 !! result
10432 <link rel="mw:WikiLink/Category" href="Category:Foo">
10433 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
10434 !! end
10435
10436 ###
10437 ### Inter-language links
10438 ###
10439 !! test
10440 Inter-language links
10441 !! options
10442 ill
10443 !! input
10444 [[es:Alimento]]
10445 [[fr:Nourriture]]
10446 [[zh:&#39135;&#21697;]]
10447 !! result
10448 es:Alimento fr:Nourriture zh:食品
10449 !! end
10450
10451 !! test
10452 Duplicate interlanguage links (bug 24502)
10453 !! options
10454 ill
10455 !! input
10456 [[es:1]]
10457 [[es:2]]
10458 [[fr:1]]
10459 [[fr:2]]
10460 !! result
10461 es:1 fr:1
10462 !! end
10463
10464 ###
10465 ### Sections
10466 ###
10467 !! test
10468 Basic section headings
10469 !! input
10470 == Headline 1 ==
10471 Some text
10472
10473 ==Headline 2==
10474 More
10475 ===Smaller headline===
10476 Blah blah
10477 !! result
10478 <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>
10479 <p>Some text
10480 </p>
10481 <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>
10482 <p>More
10483 </p>
10484 <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>
10485 <p>Blah blah
10486 </p>
10487 !! end
10488
10489 !! test
10490 Section headings with TOC
10491 !! input
10492 == Headline 1 ==
10493 === Subheadline 1 ===
10494 ===== Skipping a level =====
10495 ====== Skipping a level ======
10496
10497 == Headline 2 ==
10498 Some text
10499 ===Another headline===
10500 !! result
10501 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10502 <ul>
10503 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
10504 <ul>
10505 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
10506 <ul>
10507 <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>
10508 <ul>
10509 <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>
10510 </ul>
10511 </li>
10512 </ul>
10513 </li>
10514 </ul>
10515 </li>
10516 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
10517 <ul>
10518 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
10519 </ul>
10520 </li>
10521 </ul>
10522 </div>
10523 <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>
10524 <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>
10525 <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>
10526 <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>
10527 <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>
10528 <p>Some text
10529 </p>
10530 <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>
10531
10532 !! end
10533
10534 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
10535 !! test
10536 Handling of sections up to level 6 and beyond
10537 !! input
10538 = Level 1 Heading=
10539 == Level 2 Heading==
10540 === Level 3 Heading===
10541 ==== Level 4 Heading====
10542 ===== Level 5 Heading=====
10543 ====== Level 6 Heading======
10544 ======= Level 7 Heading=======
10545 ======== Level 8 Heading========
10546 ========= Level 9 Heading=========
10547 ========== Level 10 Heading==========
10548 !! result
10549 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10550 <ul>
10551 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
10552 <ul>
10553 <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>
10554 <ul>
10555 <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>
10556 <ul>
10557 <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>
10558 <ul>
10559 <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>
10560 <ul>
10561 <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>
10562 <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>
10563 <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>
10564 <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>
10565 <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>
10566 </ul>
10567 </li>
10568 </ul>
10569 </li>
10570 </ul>
10571 </li>
10572 </ul>
10573 </li>
10574 </ul>
10575 </li>
10576 </ul>
10577 </div>
10578 <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>
10579 <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>
10580 <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>
10581 <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>
10582 <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>
10583 <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>
10584 <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>
10585 <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>
10586 <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>
10587 <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>
10588
10589 !! end
10590
10591 !! test
10592 TOC regression (bug 9764)
10593 !! input
10594 == title 1 ==
10595 === title 1.1 ===
10596 ==== title 1.1.1 ====
10597 === title 1.2 ===
10598 == title 2 ==
10599 === title 2.1 ===
10600 !! result
10601 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10602 <ul>
10603 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10604 <ul>
10605 <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>
10606 <ul>
10607 <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>
10608 </ul>
10609 </li>
10610 <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>
10611 </ul>
10612 </li>
10613 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10614 <ul>
10615 <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>
10616 </ul>
10617 </li>
10618 </ul>
10619 </div>
10620 <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>
10621 <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>
10622 <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>
10623 <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>
10624 <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>
10625 <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>
10626
10627 !! end
10628
10629 !! test
10630 TOC with wgMaxTocLevel=3 (bug 6204)
10631 !! options
10632 wgMaxTocLevel=3
10633 !! input
10634 == title 1 ==
10635 === title 1.1 ===
10636 ==== title 1.1.1 ====
10637 === title 1.2 ===
10638 == title 2 ==
10639 === title 2.1 ===
10640 !! result
10641 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10642 <ul>
10643 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10644 <ul>
10645 <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>
10646 <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>
10647 </ul>
10648 </li>
10649 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10650 <ul>
10651 <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>
10652 </ul>
10653 </li>
10654 </ul>
10655 </div>
10656 <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>
10657 <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>
10658 <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>
10659 <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>
10660 <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>
10661 <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>
10662
10663 !! end
10664
10665 !! test
10666 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
10667 !! options
10668 wgMaxTocLevel=3
10669 !! input
10670 ==Section 1==
10671 ===Section 1.1===
10672 ====Section 1.1.1====
10673 ====Section 1.1.1.1====
10674 ==Section 2==
10675 !! result
10676 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10677 <ul>
10678 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
10679 <ul>
10680 <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>
10681 </ul>
10682 </li>
10683 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
10684 </ul>
10685 </div>
10686 <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>
10687 <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>
10688 <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>
10689 <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>
10690 <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>
10691
10692 !! end
10693
10694
10695 !! test
10696 Resolving duplicate section names
10697 !! input
10698 == Foo bar ==
10699 == Foo bar ==
10700 !! result
10701 <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>
10702 <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>
10703
10704 !! end
10705
10706 !! test
10707 Resolving duplicate section names with differing case (bug 10721)
10708 !! input
10709 == Foo bar ==
10710 == Foo Bar ==
10711 !! result
10712 <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>
10713 <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>
10714
10715 !! end
10716
10717 !! article
10718 Template:sections
10719 !! text
10720 ===Section 1===
10721 ==Section 2==
10722 !! endarticle
10723
10724 !! test
10725 Template with sections, __NOTOC__
10726 !! input
10727 __NOTOC__
10728 ==Section 0==
10729 {{sections}}
10730 ==Section 4==
10731 !! result
10732 <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>
10733 <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>
10734 <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>
10735 <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>
10736
10737 !! end
10738
10739 !! test
10740 __NOEDITSECTION__ keyword
10741 !! input
10742 __NOEDITSECTION__
10743 ==Section 1==
10744 ==Section 2==
10745 !! result
10746 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
10747 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10748
10749 !! end
10750
10751 !! test
10752 Link inside a section heading
10753 !! input
10754 ==Section with a [[Main Page|link]] in it==
10755 !! result
10756 <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>
10757
10758 !! end
10759
10760 !! test
10761 TOC regression (bug 12077)
10762 !! input
10763 __TOC__
10764 == title 1 ==
10765 === title 1.1 ===
10766 == title 2 ==
10767 !! result
10768 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10769 <ul>
10770 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10771 <ul>
10772 <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>
10773 </ul>
10774 </li>
10775 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10776 </ul>
10777 </div>
10778 <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>
10779 <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>
10780 <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>
10781
10782 !! end
10783
10784 !! test
10785 BUG 1219 URL next to image (good)
10786 !! input
10787 http://example.com [[Image:foobar.jpg]]
10788 !! result
10789 <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>
10790 </p>
10791 !!end
10792
10793 !! test
10794 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10795 !! input
10796 ===
10797 The line above must have a trailing space!
10798 === <!--
10799 --> <!-- -->
10800 But just in case it doesn't...
10801 !! result
10802 <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>
10803 <p>The line above must have a trailing space!
10804 </p>
10805 <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>
10806 <p>But just in case it doesn't...
10807 </p>
10808 !! end
10809
10810 !! test
10811 Header with special characters (bug 25462)
10812 !! input
10813 The tooltips shall not show entities to the user (ie. be double escaped)
10814
10815 == text > text ==
10816 section 1
10817
10818 == text < text ==
10819 section 2
10820
10821 == text & text ==
10822 section 3
10823
10824 == text ' text ==
10825 section 4
10826
10827 == text " text ==
10828 section 5
10829 !! result
10830 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10831 </p>
10832 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10833 <ul>
10834 <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>
10835 <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>
10836 <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>
10837 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10838 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10839 </ul>
10840 </div>
10841 <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>
10842 <p>section 1
10843 </p>
10844 <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>
10845 <p>section 2
10846 </p>
10847 <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>
10848 <p>section 3
10849 </p>
10850 <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>
10851 <p>section 4
10852 </p>
10853 <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>
10854 <p>section 5
10855 </p>
10856 !! end
10857
10858 !! test
10859 Headers with excess '=' characters
10860 (Are similar tests necessary beyond the 1st level?)
10861 !! input
10862 =foo==
10863 ==foo=
10864 =''italic'' heading==
10865 ==''italic'' heading=
10866 !! result
10867 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10868 <ul>
10869 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10870 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10871 <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>
10872 <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>
10873 </ul>
10874 </div>
10875 <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>
10876 <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>
10877 <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>
10878 <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>
10879
10880 !! end
10881
10882 !! test
10883 HTML headers vs TOC (bug 23393)
10884 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10885 !! input
10886 <h1>Header 1</h1>
10887 == Header 1.1 ==
10888 == Header 1.2 ==
10889
10890 <h1>Header 2
10891 </h1>
10892 == Header 2.1 ==
10893 == Header 2.2 ==
10894 __NOEDITSECTION__
10895 !! result
10896 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10897 <ul>
10898 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10899 <ul>
10900 <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>
10901 <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>
10902 </ul>
10903 </li>
10904 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10905 <ul>
10906 <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>
10907 <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>
10908 </ul>
10909 </li>
10910 </ul>
10911 </div>
10912 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10913 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10914 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10915 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10916 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10917 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10918
10919 !! end
10920
10921 !! test
10922 BUG 1219 URL next to image (broken)
10923 !! input
10924 http://example.com[[Image:foobar.jpg]]
10925 !! result
10926 <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>
10927 </p>
10928 !!end
10929
10930 !! test
10931 Bug 1186 news: in the middle of text
10932 !! input
10933 http://en.wikinews.org/wiki/Wikinews:Workplace
10934 !! result
10935 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10936 </p>
10937 !!end
10938
10939
10940 !! test
10941 Namespaced link must have a title
10942 !! input
10943 [[Project:]]
10944 !! result
10945 <p>[[Project:]]
10946 </p>
10947 !!end
10948
10949 !! test
10950 Namespaced link must have a title (bad fragment version)
10951 !! input
10952 [[Project:#fragment]]
10953 !! result
10954 <p>[[Project:#fragment]]
10955 </p>
10956 !!end
10957
10958
10959 ###
10960 ### HTML tags and HTML attributes
10961 ###
10962
10963 !! test
10964 div with no attributes
10965 !! input
10966 <div>HTML rocks</div>
10967 !! result
10968 <div>HTML rocks</div>
10969
10970 !! end
10971
10972 !! test
10973 div with double-quoted attribute
10974 !! input
10975 <div id="rock">HTML rocks</div>
10976 !! result
10977 <div id="rock">HTML rocks</div>
10978
10979 !! end
10980
10981 !! test
10982 div with single-quoted attribute
10983 !! input
10984 <div id='rock'>HTML rocks</div>
10985 !! result
10986 <div id="rock">HTML rocks</div>
10987
10988 !! end
10989
10990 !! test
10991 div with unquoted attribute
10992 !! input
10993 <div id=rock>HTML rocks</div>
10994 !! result
10995 <div id="rock">HTML rocks</div>
10996
10997 !! end
10998
10999 !! test
11000 div with illegal double attributes
11001 !! input
11002 <div id="a" id="b">HTML rocks</div>
11003 !! result
11004 <div id="b">HTML rocks</div>
11005
11006 !!end
11007
11008 # FIXME: produce empty string instead of "class" in the PHP parser, following
11009 # the HTML5 spec.
11010 !! test
11011 div with empty attribute value, space before equals
11012 !! options
11013 parsoid
11014 !! input
11015 <div class =>HTML rocks</div>
11016 !! result
11017 <div class="">HTML rocks</div>
11018
11019 !! end
11020
11021 # The PHP parser escapes the opening brace to &#123; for some reason, so
11022 # disabled this test for it.
11023 !! test
11024 div with braces in attribute value
11025 !! options
11026 parsoid
11027 !! input
11028 <div title="{}">Foo</div>
11029 !! result
11030 <div title="{}">Foo</div>
11031 !! end
11032
11033 # This it very inconsistent in the PHP parser: it returns
11034 # class="class" if there is a space between the name and the equal sign (see
11035 # 'div with empty attribute value, space before equals'), but strips the
11036 # attribute completely if the space is missing. We hope that not much content
11037 # depends on this, so are implementing the behavior below in Parsoid for
11038 # consistencies' sake. Disabled for the PHP parser.
11039 # FIXME: fix this behavior in the PHP parser?
11040 !! test
11041 div with empty attribute value, no space before equals
11042 !! options
11043 parsoid
11044 !! input
11045 <div class=>HTML rocks</div>
11046 !! result
11047 <div class="">HTML rocks</div>
11048
11049 !! end
11050
11051 !! test
11052 HTML multiple attributes correction
11053 !! input
11054 <p class="error" class="awesome">Awesome!</p>
11055 !! result
11056 <p class="awesome">Awesome!</p>
11057
11058 !!end
11059
11060 !! test
11061 Table multiple attributes correction
11062 !! input
11063 {|
11064 !+ class="error" class="awesome"| status
11065 |}
11066 !! result
11067 <table>
11068 <tr>
11069 <th class="awesome"> status
11070 </th></tr></table>
11071
11072 !!end
11073
11074 !! test
11075 DIV IN UPPERCASE
11076 !! input
11077 <DIV ID="x">HTML ROCKS</DIV>
11078 !! result
11079 <div id="x">HTML ROCKS</div>
11080
11081 !!end
11082
11083 !! test
11084 Non-ASCII pseudo-tags are rendered as text
11085 !! input
11086 <khyô>
11087 !! result
11088 <p>&lt;khyô&gt;
11089 </p>
11090 !! end
11091
11092 !! test
11093 Pseudo-tag with URL 'name' renders as url link
11094 !! input
11095 <http://example.com/>
11096 !! result
11097 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11098 </p>
11099 !! end
11100
11101 !! test
11102 text with amp in the middle of nowhere
11103 !! input
11104 Remember AT&T?
11105 !!result
11106 <p>Remember AT&amp;T?
11107 </p>
11108 !! end
11109
11110 !! test
11111 text with character entity: eacute
11112 !! input
11113 I always thought &eacute; was a cute letter.
11114 !! result
11115 <p>I always thought &#233; was a cute letter.
11116 </p>
11117 !! end
11118
11119 !! test
11120 text with entity-escaped character entity-like string: eacute
11121 !! input
11122 I always thought &amp;eacute; was a cute letter.
11123 !! result
11124 <p>I always thought &amp;eacute; was a cute letter.
11125 </p>
11126 !! end
11127
11128 !! test
11129 text with undefined character entity: xacute
11130 !! input
11131 I always thought &xacute; was a cute letter.
11132 !! result
11133 <p>I always thought &amp;xacute; was a cute letter.
11134 </p>
11135 !! end
11136
11137
11138 ###
11139 ### Nesting tests (see bug 41545, 50604, 51081)
11140 ###
11141
11142 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11143 # Note that html2wt is considerably more difficult if we use <b> in
11144 # the test case, instead of <big>
11145 !! test
11146 Ensure that HTML adoption agency algorithm is properly implemented.
11147 !! input
11148 <big>X<big>Y</big>Z</big>
11149 !! result
11150 <p><big>X<big>Y</big>Z</big>
11151 </p>
11152 !! end
11153
11154 # This was bug 41545 in the PHP parser.
11155 !! test
11156 Nesting of <kbd>
11157 !! input
11158 <kbd>X<kbd>Y</kbd>Z</kbd>
11159 !! result
11160 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11161 </p>
11162 !! end
11163
11164 # The following cases were bug 51081 in the PHP parser.
11165 # Note that there are some other nestable tags (b, i, etc) which are
11166 # not covered; see bug 51081 for discussion.
11167 !! test
11168 Nesting of <em>
11169 !! input
11170 <em>X<em>Y</em>Z</em>
11171 !! result
11172 <p><em>X<em>Y</em>Z</em>
11173 </p>
11174 !! end
11175
11176 !! test
11177 Nesting of <strong>
11178 !! input
11179 <strong>X<strong>Y</strong>Z</strong>
11180 !! result
11181 <p><strong>X<strong>Y</strong>Z</strong>
11182 </p>
11183 !! end
11184
11185 !! test
11186 Nesting of <q>
11187 !! input
11188 <q>X<q>Y</q>Z</q>
11189 !! result
11190 <p><q>X<q>Y</q>Z</q>
11191 </p>
11192 !! end
11193
11194 !! test
11195 Nesting of <ruby>
11196 !! input
11197 <ruby>X<ruby>Y</ruby>Z</ruby>
11198 !! result
11199 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11200 </p>
11201 !! end
11202
11203 !! test
11204 Nesting of <bdo>
11205 !! input
11206 <bdo>X<bdo>Y</bdo>Z</bdo>
11207 !! result
11208 <p><bdo>X<bdo>Y</bdo>Z</bdo>
11209 </p>
11210 !! end
11211
11212
11213 ###
11214 ### Media links
11215 ###
11216
11217 !! test
11218 Media link
11219 !! input
11220 [[Media:Foobar.jpg]]
11221 !! result
11222 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
11223 </p>
11224 !! end
11225
11226 !! test
11227 Media link with text
11228 !! input
11229 [[Media:Foobar.jpg|A neat file to look at]]
11230 !! result
11231 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
11232 </p>
11233 !! end
11234
11235 # FIXME: this is still bad HTML tag nesting
11236 !! test
11237 Media link with nasty text
11238 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
11239 !! input
11240 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
11241 !! result
11242 <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>
11243
11244 !! end
11245
11246 !! test
11247 Media link to nonexistent file (bug 1702)
11248 !! input
11249 [[Media:No such.jpg]]
11250 !! result
11251 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
11252 </p>
11253 !! end
11254
11255 !! test
11256 Image link to nonexistent file (bug 1850 - good)
11257 !! input
11258 [[Image:No such.jpg]]
11259 !! result
11260 <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>
11261 </p>
11262 !! end
11263
11264 !! test
11265 :Image link to nonexistent file (bug 1850 - bad)
11266 !! input
11267 [[:Image:No such.jpg]]
11268 !! result
11269 <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>
11270 </p>
11271 !! end
11272
11273
11274
11275 !! test
11276 Character reference normalization in link text (bug 1938)
11277 !! input
11278 [[Main Page|this&that]]
11279 !! result
11280 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
11281 </p>
11282 !!end
11283
11284 !! article
11285 אַ
11286 !! text
11287 Test for unicode normalization
11288
11289 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
11290 !! endarticle
11291
11292 !! test
11293 (bug 19451) Links should refer to the normalized form.
11294 !! input
11295 [[&#xFB2E;]]
11296 [[&#x5d0;&#x5b7;]]
11297 [[&#x5d0;ַ]]
11298 [[א&#x5b7;]]
11299 [[אַ]]
11300 !! result
11301 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
11302 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
11303 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
11304 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
11305 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
11306 </p>
11307 !! end
11308
11309 !! test
11310 Empty attribute crash test (bug 2067)
11311 !! input
11312 <font color="">foo</font>
11313 !! result
11314 <p><font color="">foo</font>
11315 </p>
11316 !! end
11317
11318 !! test
11319 Empty attribute crash test single-quotes (bug 2067)
11320 !! input
11321 <font color=''>foo</font>
11322 !! result
11323 <p><font color="">foo</font>
11324 </p>
11325 !! end
11326
11327 !! test
11328 Attribute test: equals, then nothing
11329 !! input
11330 <font color=>foo</font>
11331 !! result
11332 <p><font>foo</font>
11333 </p>
11334 !! end
11335
11336 !! test
11337 Attribute test: unquoted value
11338 !! input
11339 <font color=x>foo</font>
11340 !! result
11341 <p><font color="x">foo</font>
11342 </p>
11343 !! end
11344
11345 !! test
11346 Attribute test: unquoted but illegal value (hash)
11347 !! input
11348 <font color=#x>foo</font>
11349 !! result
11350 <p><font color="#x">foo</font>
11351 </p>
11352 !! end
11353
11354 !! test
11355 Attribute test: no value
11356 !! input
11357 <font color>foo</font>
11358 !! result
11359 <p><font color="color">foo</font>
11360 </p>
11361 !! end
11362
11363 !! test
11364 Bug 2095: link with three closing brackets
11365 !! input
11366 [[Main Page]]]
11367 !! result
11368 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
11369 </p>
11370 !! end
11371
11372 !! test
11373 Bug 2095: link with pipe and three closing brackets
11374 !! input
11375 [[Main Page|link]]]
11376 !! result
11377 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
11378 </p>
11379 !! end
11380
11381 !! test
11382 Bug 2095: link with pipe and three closing brackets, version 2
11383 !! input
11384 [[Main Page|[http://example.com/]]]
11385 !! result
11386 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
11387 </p>
11388 !! end
11389
11390
11391 ###
11392 ### Safety
11393 ###
11394
11395 !! article
11396 Template:Dangerous attribute
11397 !! text
11398 " onmouseover="alert(document.cookie)
11399 !! endarticle
11400
11401 !! article
11402 Template:Dangerous style attribute
11403 !! text
11404 border-size: expression(alert(document.cookie))
11405 !! endarticle
11406
11407 !! article
11408 Template:Div style
11409 !! text
11410 <div style="float: right; {{{1}}}">Magic div</div>
11411 !! endarticle
11412
11413 !! test
11414 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
11415 !! input
11416 <div title="{{test}}"></div>
11417 !! result
11418 <div title="This is a test template"></div>
11419
11420 !! end
11421
11422 !! test
11423 Bug 2304: HTML attribute safety (dangerous template; 2309)
11424 !! input
11425 <div title="{{dangerous attribute}}"></div>
11426 !! result
11427 <div title=""></div>
11428
11429 !! end
11430
11431 !! test
11432 Bug 2304: HTML attribute safety (dangerous style template; 2309)
11433 !! input
11434 <div style="{{dangerous style attribute}}"></div>
11435 !! result
11436 <div style="/* insecure input */"></div>
11437
11438 !! end
11439
11440 !! test
11441 Bug 2304: HTML attribute safety (safe parameter; 2309)
11442 !! input
11443 {{div style|width: 200px}}
11444 !! result
11445 <div style="float: right; width: 200px">Magic div</div>
11446
11447 !! end
11448
11449 !! test
11450 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
11451 !! input
11452 {{div style|width: expression(alert(document.cookie))}}
11453 !! result
11454 <div style="/* insecure input */">Magic div</div>
11455
11456 !! end
11457
11458 !! test
11459 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
11460 !! input
11461 {{div style|"><script>alert(document.cookie)</script>}}
11462 !! result
11463 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11464
11465 !! end
11466
11467 !! test
11468 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
11469 !! input
11470 {{div style|" ><script>alert(document.cookie)</script>}}
11471 !! result
11472 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11473
11474 !! end
11475
11476 !! test
11477 Bug 2304: HTML attribute safety (link)
11478 !! input
11479 <div title="[[Main Page]]"></div>
11480 !! result
11481 <div title="&#91;&#91;Main Page]]"></div>
11482
11483 !! end
11484
11485 !! test
11486 Bug 2304: HTML attribute safety (italics)
11487 !! input
11488 <div title="''foobar''"></div>
11489 !! result
11490 <div title="&#39;&#39;foobar&#39;&#39;"></div>
11491
11492 !! end
11493
11494 !! test
11495 Bug 2304: HTML attribute safety (bold)
11496 !! input
11497 <div title="'''foobar'''"></div>
11498 !! result
11499 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
11500
11501 !! end
11502
11503
11504 !! test
11505 Bug 2304: HTML attribute safety (ISBN)
11506 !! input
11507 <div title="ISBN 1234567890"></div>
11508 !! result
11509 <div title="&#73;SBN 1234567890"></div>
11510
11511 !! end
11512
11513 !! test
11514 Bug 2304: HTML attribute safety (RFC)
11515 !! input
11516 <div title="RFC 1234"></div>
11517 !! result
11518 <div title="&#82;FC 1234"></div>
11519
11520 !! end
11521
11522 !! test
11523 Bug 2304: HTML attribute safety (PMID)
11524 !! input
11525 <div title="PMID 1234567890"></div>
11526 !! result
11527 <div title="&#80;MID 1234567890"></div>
11528
11529 !! end
11530
11531 !! test
11532 Bug 2304: HTML attribute safety (web link)
11533 !! input
11534 <div title="http://example.com/"></div>
11535 !! result
11536 <div title="http&#58;//example.com/"></div>
11537
11538 !! end
11539
11540 !! test
11541 Bug 2304: HTML attribute safety (named web link)
11542 !! input
11543 <div title="[http://example.com/ link]"></div>
11544 !! result
11545 <div title="&#91;http&#58;//example.com/ link]"></div>
11546
11547 !! end
11548
11549 !! test
11550 Bug 3244: HTML attribute safety (extension; safe)
11551 !! input
11552 <div style="<nowiki>background:blue</nowiki>"></div>
11553 !! result
11554 <div style="background:blue"></div>
11555
11556 !! end
11557
11558 !! test
11559 Bug 3244: HTML attribute safety (extension; unsafe)
11560 !! input
11561 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
11562 !! result
11563 <div style="/* insecure input */"></div>
11564
11565 !! end
11566
11567 # More MSIE fun discovered by Tom Gilder
11568
11569 !! test
11570 MSIE CSS safety test: spurious slash
11571 !! input
11572 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
11573 !! result
11574 <div style="/* insecure input */">evil</div>
11575
11576 !! end
11577
11578 !! test
11579 MSIE CSS safety test: hex code
11580 !! input
11581 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
11582 !! result
11583 <div style="/* insecure input */">evil</div>
11584
11585 !! end
11586
11587 !! test
11588 MSIE CSS safety test: comment in url
11589 !! input
11590 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
11591 !! result
11592 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
11593
11594 !! end
11595
11596 !! test
11597 MSIE CSS safety test: comment in expression
11598 !! input
11599 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
11600 !! result
11601 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
11602
11603 !! end
11604
11605
11606 !! test
11607 Table attribute legitimate extension
11608 !! input
11609 {|
11610 !+ style="<nowiki>color:blue</nowiki>"| status
11611 |}
11612 !! result
11613 <table>
11614 <tr>
11615 <th style="color:blue"> status
11616 </th></tr></table>
11617
11618 !!end
11619
11620 !! test
11621 Table attribute safety
11622 !! input
11623 {|
11624 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
11625 |}
11626 !! result
11627 <table>
11628 <tr>
11629 <th style="/* insecure input */"> status
11630 </th></tr></table>
11631
11632 !! end
11633
11634 !! test
11635 CSS line continuation 1
11636 !! input
11637 <div style="background-image: u\&#10;rl(test.jpg);"></div>
11638 !! result
11639 <div style="/* insecure input */"></div>
11640
11641 !! end
11642
11643 !! test
11644 CSS line continuation 2
11645 !! input
11646 <div style="background-image: u\&#13;rl(test.jpg); "></div>
11647 !! result
11648 <div style="/* insecure input */"></div>
11649
11650 !! end
11651
11652 !! article
11653 Template:Identity
11654 !! text
11655 {{{1}}}
11656 !! endarticle
11657
11658 !! test
11659 Expansion of multi-line templates in attribute values (bug 6255)
11660 !! input
11661 <div style="background: {{identity|#00FF00}}">-</div>
11662 !! result
11663 <div style="background: #00FF00">-</div>
11664
11665 !! end
11666
11667
11668 !! test
11669 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
11670 !! input
11671 <div style="background:
11672 #00FF00">-</div>
11673 !! result
11674 <div style="background: #00FF00">-</div>
11675
11676 !! end
11677
11678 !! test
11679 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11680 !! input
11681 <div style="background: &#10;#00FF00">-</div>
11682 !! result
11683 <div style="background: &#10;#00FF00">-</div>
11684
11685 !! end
11686
11687 ###
11688 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11689 ###
11690 !! test
11691 Parser hook: empty input
11692 !! input
11693 <tag></tag>
11694 !! result
11695 <pre>
11696 ''
11697 array (
11698 )
11699 </pre>
11700
11701 !! end
11702
11703 !! test
11704 Parser hook: empty input using terminated empty elements
11705 !! input
11706 <tag/>
11707 !! result
11708 <pre>
11709 NULL
11710 array (
11711 )
11712 </pre>
11713
11714 !! end
11715
11716 !! test
11717 Parser hook: empty input using terminated empty elements (space before)
11718 !! input
11719 <tag />
11720 !! result
11721 <pre>
11722 NULL
11723 array (
11724 )
11725 </pre>
11726
11727 !! end
11728
11729 !! test
11730 Parser hook: basic input
11731 !! input
11732 <tag>input</tag>
11733 !! result
11734 <pre>
11735 'input'
11736 array (
11737 )
11738 </pre>
11739
11740 !! end
11741
11742
11743 !! test
11744 Parser hook: case insensitive
11745 !! input
11746 <TAG>input</TAG>
11747 !! result
11748 <pre>
11749 'input'
11750 array (
11751 )
11752 </pre>
11753
11754 !! end
11755
11756
11757 !! test
11758 Parser hook: case insensitive, redux
11759 !! input
11760 <TaG>input</TAg>
11761 !! result
11762 <pre>
11763 'input'
11764 array (
11765 )
11766 </pre>
11767
11768 !! end
11769
11770 !! test
11771 Parser hook: nested tags
11772 !! options
11773 noxml
11774 !! input
11775 <tag><tag></tag></tag>
11776 !! result
11777 <pre>
11778 '<tag>'
11779 array (
11780 )
11781 </pre>&lt;/tag&gt;
11782
11783 !! end
11784
11785 !! test
11786 Parser hook: basic arguments
11787 !! input
11788 <tag width=200 height = "100" depth = '50' square></tag>
11789 !! result
11790 <pre>
11791 ''
11792 array (
11793 'width' => '200',
11794 'height' => '100',
11795 'depth' => '50',
11796 'square' => 'square',
11797 )
11798 </pre>
11799
11800 !! end
11801
11802 !! test
11803 Parser hook: argument containing a forward slash (bug 5344)
11804 !! input
11805 <tag filename='/tmp/bla'></tag>
11806 !! result
11807 <pre>
11808 ''
11809 array (
11810 'filename' => '/tmp/bla',
11811 )
11812 </pre>
11813
11814 !! end
11815
11816 !! test
11817 Parser hook: empty input using terminated empty elements (bug 2374)
11818 !! input
11819 <tag foo=bar/>text
11820 !! result
11821 <pre>
11822 NULL
11823 array (
11824 'foo' => 'bar',
11825 )
11826 </pre>text
11827
11828 !! end
11829
11830 # </tag> should be output literally since there is no matching tag that begins it
11831 !! test
11832 Parser hook: basic arguments using terminated empty elements (bug 2374)
11833 !! input
11834 <tag width=200 height = "100" depth = '50' square/>
11835 other stuff
11836 </tag>
11837 !! result
11838 <pre>
11839 NULL
11840 array (
11841 'width' => '200',
11842 'height' => '100',
11843 'depth' => '50',
11844 'square' => 'square',
11845 )
11846 </pre>
11847 <p>other stuff
11848 &lt;/tag&gt;
11849 </p>
11850 !! end
11851
11852 ###
11853 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11854 ###
11855
11856 !! test
11857 Parser hook: static parser hook not inside a comment
11858 !! input
11859 <statictag>hello, world</statictag>
11860 <statictag action=flush/>
11861 !! result
11862 <p>hello, world
11863 </p>
11864 !! end
11865
11866
11867 !! test
11868 Parser hook: static parser hook inside a comment
11869 !! input
11870 <!-- <statictag>hello, world</statictag> -->
11871 <statictag action=flush/>
11872 !! result
11873 <p><br />
11874 </p>
11875 !! end
11876
11877 # Nested template calls; this case was broken by Parser.php rev 1.506,
11878 # since reverted.
11879
11880 !! article
11881 Template:One-parameter
11882 !! text
11883 (My parameter is: {{{1}}})
11884 !! endarticle
11885
11886 !! article
11887 Template:Map-one-parameter
11888 !! text
11889 {{{{{1}}}|{{{2}}}}}
11890 !! endarticle
11891
11892 !! test
11893 Nested template calls
11894 !! input
11895 {{Map-one-parameter|One-parameter|param}}
11896 !! result
11897 <p>(My parameter is: param)
11898 </p>
11899 !! end
11900
11901
11902 ###
11903 ### Sanitizer
11904 ###
11905 !! test
11906 Sanitizer: Closing of open tags
11907 !! input
11908 <s></s><table></table>
11909 !! result
11910 <s></s><table></table>
11911
11912 !! end
11913
11914 !! test
11915 Sanitizer: Closing of open but not closed tags
11916 !! input
11917 <s>foo
11918 !! result
11919 <p><s>foo</s>
11920 </p>
11921 !! end
11922
11923 !! test
11924 Sanitizer: Closing of closed but not open tags
11925 !! input
11926 </s>
11927 !! result
11928 <p>&lt;/s&gt;
11929 </p>
11930 !! end
11931
11932 !! test
11933 Sanitizer: Closing of closed but not open table tags
11934 !! input
11935 Table not started</td></tr></table>
11936 !! result
11937 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11938 </p>
11939 !! end
11940
11941 !! test
11942 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11943 !! input
11944 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11945 !! result
11946 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11947 </p>
11948 !! end
11949
11950 !! test
11951 Sanitizer: Validating the contents of the id attribute (bug 4515)
11952 !! options
11953 disabled
11954 !! input
11955 <br id=9 />
11956 !! result
11957 Something, but definitely not <br id="9" />...
11958 !! end
11959
11960 !! test
11961 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11962 !! options
11963 disabled
11964 !! input
11965 <br id="foo" /><br id="foo" />
11966 !! result
11967 Something need to be done. foo-2 ?
11968 !! end
11969
11970 !! test
11971 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11972 !! input
11973 <div itemscope>
11974 <meta itemprop="hello" content="world">
11975 <meta http-equiv="refresh" content="5">
11976 <meta itemprop="hello" http-equiv="refresh" content="5">
11977 <link itemprop="hello" href="{{SERVER}}">
11978 <link rel="stylesheet" href="{{SERVER}}">
11979 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11980 </div>
11981 !! result
11982 <div itemscope="itemscope">
11983 <p> <meta itemprop="hello" content="world" />
11984 &lt;meta http-equiv="refresh" content="5"&gt;
11985 <meta itemprop="hello" content="5" />
11986 </p>
11987 <link itemprop="hello" href="http&#58;//example.org" />
11988 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11989 <link itemprop="hello" href="http&#58;//example.org" />
11990 </div>
11991
11992 !! end
11993
11994 !! test
11995 Language converter: output gets cut off unexpectedly (bug 5757)
11996 !! options
11997 language=zh
11998 !! input
11999 this bit is safe: }-
12000
12001 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12002
12003 then we get cut off here: }-
12004
12005 all additional text is vanished
12006 !! result
12007 <p>this bit is safe: }-
12008 </p><p>but if we add a conversion instance: xxx
12009 </p><p>then we get cut off here: }-
12010 </p><p>all additional text is vanished
12011 </p>
12012 !! end
12013
12014 !! test
12015 Self closed html pairs (bug 5487)
12016 !! options
12017 !! input
12018 <center><font id="bug" />Centered text</center>
12019 <div><font id="bug2" />In div text</div>
12020 !! result
12021 <center>&lt;font id="bug" /&gt;Centered text</center>
12022 <div>&lt;font id="bug2" /&gt;In div text</div>
12023
12024 !! end
12025
12026 #
12027 #
12028 #
12029
12030 !! test
12031 Punctuation: nbsp before exclamation
12032 !! input
12033 C'est grave !
12034 !! result
12035 <p>C'est grave&#160;!
12036 </p>
12037 !! end
12038
12039 !! test
12040 Punctuation: CSS !important (bug 11874)
12041 !! input
12042 <div style="width:50% !important">important</div>
12043 !! result
12044 <div style="width:50% !important">important</div>
12045
12046 !!end
12047
12048 !! test
12049 Punctuation: CSS ! important (bug 11874; with space after)
12050 !! input
12051 <div style="width:50% ! important">important</div>
12052 !! result
12053 <div style="width:50% ! important">important</div>
12054
12055 !!end
12056
12057
12058 !! test
12059 HTML bullet list, closed tags (bug 5497)
12060 !! input
12061 <ul>
12062 <li>One</li>
12063 <li>Two</li>
12064 </ul>
12065 !! result
12066 <ul>
12067 <li>One</li>
12068 <li>Two</li>
12069 </ul>
12070
12071 !! end
12072
12073 !! test
12074 HTML bullet list, unclosed tags (bug 5497)
12075 !! options
12076 disabled
12077 !! input
12078 <ul>
12079 <li>One
12080 <li>Two
12081 </ul>
12082 !! result
12083 <ul>
12084 <li>One
12085 </li>
12086 <li>Two
12087 </li>
12088 </ul>
12089
12090 !! end
12091
12092 !! test
12093 HTML ordered list, closed tags (bug 5497)
12094 !! input
12095 <ol>
12096 <li>One</li>
12097 <li>Two</li>
12098 </ol>
12099 !! result
12100 <ol>
12101 <li>One</li>
12102 <li>Two</li>
12103 </ol>
12104
12105 !! end
12106
12107 !! test
12108 HTML ordered list, unclosed tags (bug 5497)
12109 !! options
12110 disabled
12111 !! input
12112 <ol>
12113 <li>One
12114 <li>Two
12115 </ol>
12116 !! result
12117 <ol>
12118 <li>One
12119 </li>
12120 <li>Two
12121 </li>
12122 </ol>
12123
12124 !! end
12125
12126 !! test
12127 HTML nested bullet list, closed tags (bug 5497)
12128 !! input
12129 <ul>
12130 <li>One</li>
12131 <li>Two:
12132 <ul>
12133 <li>Sub-one</li>
12134 <li>Sub-two</li>
12135 </ul>
12136 </li>
12137 </ul>
12138 !! result
12139 <ul>
12140 <li>One</li>
12141 <li>Two:
12142 <ul>
12143 <li>Sub-one</li>
12144 <li>Sub-two</li>
12145 </ul>
12146 </li>
12147 </ul>
12148
12149 !! end
12150
12151 !! test
12152 HTML nested bullet list, open tags (bug 5497)
12153 !! options
12154 disabled
12155 !! input
12156 <ul>
12157 <li>One
12158 <li>Two:
12159 <ul>
12160 <li>Sub-one
12161 <li>Sub-two
12162 </ul>
12163 </ul>
12164 !! result
12165 <ul>
12166 <li>One
12167 </li>
12168 <li>Two:
12169 <ul>
12170 <li>Sub-one
12171 </li>
12172 <li>Sub-two
12173 </li>
12174 </ul>
12175 </li>
12176 </ul>
12177
12178 !! end
12179
12180 !! test
12181 HTML nested ordered list, closed tags (bug 5497)
12182 !! input
12183 <ol>
12184 <li>One</li>
12185 <li>Two:
12186 <ol>
12187 <li>Sub-one</li>
12188 <li>Sub-two</li>
12189 </ol>
12190 </li>
12191 </ol>
12192 !! result
12193 <ol>
12194 <li>One</li>
12195 <li>Two:
12196 <ol>
12197 <li>Sub-one</li>
12198 <li>Sub-two</li>
12199 </ol>
12200 </li>
12201 </ol>
12202
12203 !! end
12204
12205 !! test
12206 HTML nested ordered list, open tags (bug 5497)
12207 !! options
12208 disabled
12209 !! input
12210 <ol>
12211 <li>One
12212 <li>Two:
12213 <ol>
12214 <li>Sub-one
12215 <li>Sub-two
12216 </ol>
12217 </ol>
12218 !! result
12219 <ol>
12220 <li>One
12221 </li>
12222 <li>Two:
12223 <ol>
12224 <li>Sub-one
12225 </li>
12226 <li>Sub-two
12227 </li>
12228 </ol>
12229 </li>
12230 </ol>
12231
12232 !! end
12233
12234 !! test
12235 HTML ordered list item with parameters oddity
12236 !! input
12237 <ol><li id="fragment">One</li>
12238 </ol>
12239 !! result
12240 <ol><li id="fragment">One</li>
12241 </ol>
12242
12243 !! end
12244
12245 !!test
12246 bug 5918: autonumbering
12247 !! input
12248 [http://first/] [http://second] [ftp://ftp]
12249
12250 ftp://inlineftp
12251
12252 [mailto:enclosed@mail.tld With target]
12253
12254 [mailto:enclosed@mail.tld]
12255
12256 mailto:inline@mail.tld
12257 !! result
12258 <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>
12259 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
12260 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
12261 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
12262 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
12263 </p>
12264 !! end
12265
12266
12267 #
12268 # Security and HTML correctness
12269 # From Nick Jenkins' fuzz testing
12270 #
12271
12272 !! test
12273 Fuzz testing: Parser13
12274 !! input
12275 {|
12276 | http://a|
12277 !! result
12278 <table>
12279 <tr>
12280 <td>
12281 </td>
12282 </tr>
12283 </table>
12284
12285 !! end
12286
12287 !! test
12288 Fuzz testing: Parser14
12289 !! input
12290 == onmouseover= ==
12291 http://__TOC__
12292 !! result
12293 <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>
12294 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12295 <ul>
12296 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
12297 </ul>
12298 </div>
12299
12300 !! end
12301
12302 !! test
12303 Fuzz testing: Parser14-table
12304 !! input
12305 ==a==
12306 {| STYLE=__TOC__
12307 !! result
12308 <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>
12309 <table style="&#95;_TOC&#95;_">
12310 <tr><td></td></tr>
12311 </table>
12312
12313 !! end
12314
12315 # Known to produce bogus xml (extra </td>)
12316 !! test
12317 Fuzz testing: Parser16
12318 !! options
12319 noxml
12320 !! input
12321 {|
12322 !https://||||||
12323 !! result
12324 <table>
12325 <tr>
12326 <th>https://</th>
12327 <th></th>
12328 <th></th>
12329 <th>
12330 </td>
12331 </tr>
12332 </table>
12333
12334 !! end
12335
12336 !! test
12337 Fuzz testing: Parser21
12338 !! input
12339 {|
12340 ! irc://{{ftp://a" onmouseover="alert('hello world');"
12341 |
12342 !! result
12343 <table>
12344 <tr>
12345 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
12346 </th>
12347 <td>
12348 </td>
12349 </tr>
12350 </table>
12351
12352 !! end
12353
12354 !! test
12355 Fuzz testing: Parser22
12356 !! input
12357 http://===r:::https://b
12358
12359 {|
12360 !!result
12361 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
12362 </p>
12363 <table>
12364 <tr><td></td></tr>
12365 </table>
12366
12367 !! end
12368
12369 # Known to produce bad XML for now
12370 !! test
12371 Fuzz testing: Parser24
12372 !! options
12373 noxml
12374 !! input
12375 {|
12376 {{{|
12377 <u CLASS=
12378 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
12379 <br style="onmouseover='alert(document.cookie);' " />
12380
12381 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12382 |
12383 !! result
12384 <table>
12385 {{{|
12386 <u class="&#124;">}}}} &gt;
12387 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
12388
12389 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12390 <tr>
12391 <td></u>
12392 </td>
12393 </tr>
12394 </table>
12395
12396 !! end
12397
12398 # Note: the current result listed for this is not what the original one was,
12399 # but the original bug was JavaScript injection, which is fixed in any case.
12400 # It's not clear that the original result listed was any more correct than the
12401 # current one. Original result:
12402 # <p>{{{|
12403 # </p>
12404 # <li class="&#124;&#124;">
12405 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12406 !!test
12407 Fuzz testing: Parser25 (bug 6055)
12408 !! input
12409 {{{
12410 |
12411 <LI CLASS=||
12412 >
12413 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
12414 !! result
12415 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12416 </p>
12417 !! end
12418
12419 !!test
12420 Fuzz testing: URL adjacent extension (with space, clean)
12421 !! options
12422 !! input
12423 http://example.com <nowiki>junk</nowiki>
12424 !! result
12425 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
12426 </p>
12427 !!end
12428
12429 !!test
12430 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
12431 !! options
12432 !! input
12433 http://example.com<nowiki>junk</nowiki>
12434 !! result
12435 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
12436 </p>
12437 !!end
12438
12439 !!test
12440 Fuzz testing: URL adjacent extension (no space, dirty; pre)
12441 !! options
12442 !! input
12443 http://example.com<pre>junk</pre>
12444 !! result
12445 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
12446
12447 !!end
12448
12449 !!test
12450 Fuzz testing: image with bogus manual thumbnail
12451 !!input
12452 [[Image:foobar.jpg|thumbnail= ]]
12453 !!result
12454 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
12455
12456 !!end
12457
12458 !! test
12459 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
12460 !! input
12461 <pre dir="&#10;"></pre>
12462 !! result
12463 <pre dir="&#10;"></pre>
12464
12465 !! end
12466
12467 !! test
12468 Parsing optional HTML elements (Bug 6171)
12469 !! options
12470 !! input
12471 <table>
12472 <tr>
12473 <td> Some tabular data</td>
12474 <td> More tabular data ...
12475 <td> And yet som tabular data</td>
12476 </tr>
12477 </table>
12478 !! result
12479 <table>
12480 <tr>
12481 <td> Some tabular data</td>
12482 <td> More tabular data ...
12483 </td><td> And yet som tabular data</td>
12484 </tr>
12485 </table>
12486
12487 !! end
12488
12489 !! test
12490 Correct handling of <td>, <tr> (Bug 6171)
12491 !! options
12492 !! input
12493 <table>
12494 <tr>
12495 <td> Some tabular data</td>
12496 <td> More tabular data ...</td>
12497 <td> And yet som tabular data</td>
12498 </tr>
12499 </table>
12500 !! result
12501 <table>
12502 <tr>
12503 <td> Some tabular data</td>
12504 <td> More tabular data ...</td>
12505 <td> And yet som tabular data</td>
12506 </tr>
12507 </table>
12508
12509 !! end
12510
12511
12512 !! test
12513 Parsing crashing regression (fr:JavaScript)
12514 !! input
12515 </body></x>
12516 !! result
12517 <p>&lt;/body&gt;&lt;/x&gt;
12518 </p>
12519 !! end
12520
12521 !! test
12522 Inline wiki vs wiki block nesting
12523 !! input
12524 '''Bold paragraph
12525
12526 New wiki paragraph
12527 !! result
12528 <p><b>Bold paragraph</b>
12529 </p><p>New wiki paragraph
12530 </p>
12531 !! end
12532
12533 !! test
12534 Inline HTML vs wiki block nesting
12535 !! options
12536 disabled
12537 !! input
12538 <b>Bold paragraph
12539
12540 New wiki paragraph
12541 !! result
12542 <p><b>Bold paragraph</b>
12543 </p><p>New wiki paragraph
12544 </p>
12545 !! end
12546
12547 # Original result was this:
12548 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
12549 # </p>
12550 # While that might be marginally more intuitive, maybe, the six-apostrophe
12551 # construct is clearly pathological and the result stated here (which is what
12552 # the parser actually does) is about as reasonable as anything.
12553 !!test
12554 Mixing markup for italics and bold
12555 !! options
12556 !! input
12557 '''bold''''''bold''bolditalics'''''
12558 !! result
12559 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
12560 </p>
12561 !! end
12562
12563
12564 !! article
12565 Xyzzyx
12566 !! text
12567 Article for special page transclusion test
12568 !! endarticle
12569
12570 !! test
12571 Special page transclusion
12572 !! options
12573 !! input
12574 {{Special:Prefixindex/Xyzzyx}}
12575 !! result
12576 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12577
12578 !! end
12579
12580 !! test
12581 Special page transclusion twice (bug 5021)
12582 !! options
12583 !! input
12584 {{Special:Prefixindex/Xyzzyx}}
12585 {{Special:Prefixindex/Xyzzyx}}
12586 !! result
12587 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12588 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12589
12590 !! end
12591
12592 !! test
12593 Transclusion of default MediaWiki message
12594 !! input
12595 {{MediaWiki:Mainpage}}
12596 !!result
12597 <p>Main Page
12598 </p>
12599 !! end
12600
12601 !! test
12602 Transclusion of nonexistent MediaWiki message
12603 !! input
12604 {{MediaWiki:Mainpagexxx}}
12605 !!result
12606 <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>
12607 </p>
12608 !! end
12609
12610 !! test
12611 Transclusion of MediaWiki message with underscore
12612 !! input
12613 {{MediaWiki:history_short}}
12614 !! result
12615 <p>History
12616 </p>
12617 !! end
12618
12619 !! test
12620 Transclusion of MediaWiki message with space
12621 !! input
12622 {{MediaWiki:history short}}
12623 !! result
12624 <p>History
12625 </p>
12626 !! end
12627
12628 !! test
12629 Invalid header with following text
12630 !! input
12631 = x = y
12632 !! result
12633 <p>= x = y
12634 </p>
12635 !! end
12636
12637
12638 !! test
12639 Section extraction test (section 0)
12640 !! options
12641 section=0
12642 !! input
12643 start
12644 ==a==
12645 ===aa===
12646 ====aaa====
12647 ==b==
12648 ===ba===
12649 ===bb===
12650 ====bba====
12651 ===bc===
12652 ==c==
12653 ===ca===
12654 !! result
12655 start
12656 !! end
12657
12658 !! test
12659 Section extraction test (section 1)
12660 !! options
12661 section=1
12662 !! input
12663 start
12664 ==a==
12665 ===aa===
12666 ====aaa====
12667 ==b==
12668 ===ba===
12669 ===bb===
12670 ====bba====
12671 ===bc===
12672 ==c==
12673 ===ca===
12674 !! result
12675 ==a==
12676 ===aa===
12677 ====aaa====
12678 !! end
12679
12680 !! test
12681 Section extraction test (section 2)
12682 !! options
12683 section=2
12684 !! input
12685 start
12686 ==a==
12687 ===aa===
12688 ====aaa====
12689 ==b==
12690 ===ba===
12691 ===bb===
12692 ====bba====
12693 ===bc===
12694 ==c==
12695 ===ca===
12696 !! result
12697 ===aa===
12698 ====aaa====
12699 !! end
12700
12701 !! test
12702 Section extraction test (section 3)
12703 !! options
12704 section=3
12705 !! input
12706 start
12707 ==a==
12708 ===aa===
12709 ====aaa====
12710 ==b==
12711 ===ba===
12712 ===bb===
12713 ====bba====
12714 ===bc===
12715 ==c==
12716 ===ca===
12717 !! result
12718 ====aaa====
12719 !! end
12720
12721 !! test
12722 Section extraction test (section 4)
12723 !! options
12724 section=4
12725 !! input
12726 start
12727 ==a==
12728 ===aa===
12729 ====aaa====
12730 ==b==
12731 ===ba===
12732 ===bb===
12733 ====bba====
12734 ===bc===
12735 ==c==
12736 ===ca===
12737 !! result
12738 ==b==
12739 ===ba===
12740 ===bb===
12741 ====bba====
12742 ===bc===
12743 !! end
12744
12745 !! test
12746 Section extraction test (section 5)
12747 !! options
12748 section=5
12749 !! input
12750 start
12751 ==a==
12752 ===aa===
12753 ====aaa====
12754 ==b==
12755 ===ba===
12756 ===bb===
12757 ====bba====
12758 ===bc===
12759 ==c==
12760 ===ca===
12761 !! result
12762 ===ba===
12763 !! end
12764
12765 !! test
12766 Section extraction test (section 6)
12767 !! options
12768 section=6
12769 !! input
12770 start
12771 ==a==
12772 ===aa===
12773 ====aaa====
12774 ==b==
12775 ===ba===
12776 ===bb===
12777 ====bba====
12778 ===bc===
12779 ==c==
12780 ===ca===
12781 !! result
12782 ===bb===
12783 ====bba====
12784 !! end
12785
12786 !! test
12787 Section extraction test (section 7)
12788 !! options
12789 section=7
12790 !! input
12791 start
12792 ==a==
12793 ===aa===
12794 ====aaa====
12795 ==b==
12796 ===ba===
12797 ===bb===
12798 ====bba====
12799 ===bc===
12800 ==c==
12801 ===ca===
12802 !! result
12803 ====bba====
12804 !! end
12805
12806 !! test
12807 Section extraction test (section 8)
12808 !! options
12809 section=8
12810 !! input
12811 start
12812 ==a==
12813 ===aa===
12814 ====aaa====
12815 ==b==
12816 ===ba===
12817 ===bb===
12818 ====bba====
12819 ===bc===
12820 ==c==
12821 ===ca===
12822 !! result
12823 ===bc===
12824 !! end
12825
12826 !! test
12827 Section extraction test (section 9)
12828 !! options
12829 section=9
12830 !! input
12831 start
12832 ==a==
12833 ===aa===
12834 ====aaa====
12835 ==b==
12836 ===ba===
12837 ===bb===
12838 ====bba====
12839 ===bc===
12840 ==c==
12841 ===ca===
12842 !! result
12843 ==c==
12844 ===ca===
12845 !! end
12846
12847 !! test
12848 Section extraction test (section 10)
12849 !! options
12850 section=10
12851 !! input
12852 start
12853 ==a==
12854 ===aa===
12855 ====aaa====
12856 ==b==
12857 ===ba===
12858 ===bb===
12859 ====bba====
12860 ===bc===
12861 ==c==
12862 ===ca===
12863 !! result
12864 ===ca===
12865 !! end
12866
12867 !! test
12868 Section extraction test (nonexistent section 11)
12869 !! options
12870 section=11
12871 !! input
12872 start
12873 ==a==
12874 ===aa===
12875 ====aaa====
12876 ==b==
12877 ===ba===
12878 ===bb===
12879 ====bba====
12880 ===bc===
12881 ==c==
12882 ===ca===
12883 !! result
12884 !! end
12885
12886 !! test
12887 Section extraction test with bogus heading (section 1)
12888 !! options
12889 section=1
12890 !! input
12891 ==a==
12892 ==bogus== not a legal section
12893 ==b==
12894 !! result
12895 ==a==
12896 ==bogus== not a legal section
12897 !! end
12898
12899 !! test
12900 Section extraction test with bogus heading (section 2)
12901 !! options
12902 section=2
12903 !! input
12904 ==a==
12905 ==bogus== not a legal section
12906 ==b==
12907 !! result
12908 ==b==
12909 !! end
12910
12911 !! test
12912 Section extraction test with comment after heading (section 1)
12913 !! options
12914 section=1
12915 !! input
12916 ==a==
12917 ==b== <!-- -->
12918 ==c==
12919 !! result
12920 ==a==
12921 !! end
12922
12923 !! test
12924 Section extraction test with comment after heading (section 2)
12925 !! options
12926 section=2
12927 !! input
12928 ==a==
12929 ==b== <!-- -->
12930 ==c==
12931 !! result
12932 ==b== <!-- -->
12933 !! end
12934
12935 !! test
12936 Section extraction test with bogus <nowiki> heading (section 1)
12937 !! options
12938 section=1
12939 !! input
12940 ==a==
12941 ==bogus== <nowiki>not a legal section</nowiki>
12942 ==b==
12943 !! result
12944 ==a==
12945 ==bogus== <nowiki>not a legal section</nowiki>
12946 !! end
12947
12948 !! test
12949 Section extraction test with bogus <nowiki> heading (section 2)
12950 !! options
12951 section=2
12952 !! input
12953 ==a==
12954 ==bogus== <nowiki>not a legal section</nowiki>
12955 ==b==
12956 !! result
12957 ==b==
12958 !! end
12959
12960
12961 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12962 # instead of respecting commented sections
12963 !! test
12964 Section extraction prefixed by comment (section 1)
12965 !! options
12966 section=1
12967 !! input
12968 <!-- -->==sec1==
12969 ==sec2==
12970 !!result
12971 ==sec2==
12972 !!end
12973
12974 !! test
12975 Section extraction prefixed by comment (section 2)
12976 !! options
12977 section=2
12978 !! input
12979 <!-- -->==sec1==
12980 ==sec2==
12981 !!result
12982
12983 !!end
12984
12985
12986 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12987 # instead of respecting HTML-style headings
12988 !! test
12989 Section extraction, mixed wiki and html (section 1)
12990 !! options
12991 section=1
12992 !! input
12993 <h2>unmarked</h2>
12994 unmarked
12995 ==1==
12996 one
12997 ==2==
12998 two
12999 !! result
13000 ==1==
13001 one
13002 !! end
13003
13004 !! test
13005 Section extraction, mixed wiki and html (section 2)
13006 !! options
13007 section=2
13008 !! input
13009 <h2>unmarked</h2>
13010 unmarked
13011 ==1==
13012 one
13013 ==2==
13014 two
13015 !! result
13016 ==2==
13017 two
13018 !! end
13019
13020
13021 # Formerly testing for bug 3342
13022 !! test
13023 Section extraction, heading surrounded by <noinclude>
13024 !! options
13025 section=1
13026 !! input
13027 <noinclude>==unmarked==</noinclude>
13028 ==marked==
13029 !! result
13030 ==marked==
13031 !!end
13032
13033 # Test behavior of bug 19910
13034 !! test
13035 Sectiion with all-equals
13036 !! options
13037 section=2
13038 !! input
13039 ===
13040 The line above must have a trailing space
13041 === <!--
13042 --> <!-- -->
13043 But just in case it doesn't...
13044 !! result
13045 === <!--
13046 --> <!-- -->
13047 But just in case it doesn't...
13048 !! end
13049
13050 !! test
13051 Section replacement test (section 0)
13052 !! options
13053 replace=0,"xxx"
13054 !! input
13055 start
13056 ==a==
13057 ===aa===
13058 ====aaa====
13059 ==b==
13060 ===ba===
13061 ===bb===
13062 ====bba====
13063 ===bc===
13064 ==c==
13065 ===ca===
13066 !! result
13067 xxx
13068
13069 ==a==
13070 ===aa===
13071 ====aaa====
13072 ==b==
13073 ===ba===
13074 ===bb===
13075 ====bba====
13076 ===bc===
13077 ==c==
13078 ===ca===
13079 !! end
13080
13081 !! test
13082 Section replacement test (section 1)
13083 !! options
13084 replace=1,"xxx"
13085 !! input
13086 start
13087 ==a==
13088 ===aa===
13089 ====aaa====
13090 ==b==
13091 ===ba===
13092 ===bb===
13093 ====bba====
13094 ===bc===
13095 ==c==
13096 ===ca===
13097 !! result
13098 start
13099 xxx
13100
13101 ==b==
13102 ===ba===
13103 ===bb===
13104 ====bba====
13105 ===bc===
13106 ==c==
13107 ===ca===
13108 !! end
13109
13110 !! test
13111 Section replacement test (section 2)
13112 !! options
13113 replace=2,"xxx"
13114 !! input
13115 start
13116 ==a==
13117 ===aa===
13118 ====aaa====
13119 ==b==
13120 ===ba===
13121 ===bb===
13122 ====bba====
13123 ===bc===
13124 ==c==
13125 ===ca===
13126 !! result
13127 start
13128 ==a==
13129 xxx
13130
13131 ==b==
13132 ===ba===
13133 ===bb===
13134 ====bba====
13135 ===bc===
13136 ==c==
13137 ===ca===
13138 !! end
13139
13140 !! test
13141 Section replacement test (section 3)
13142 !! options
13143 replace=3,"xxx"
13144 !! input
13145 start
13146 ==a==
13147 ===aa===
13148 ====aaa====
13149 ==b==
13150 ===ba===
13151 ===bb===
13152 ====bba====
13153 ===bc===
13154 ==c==
13155 ===ca===
13156 !! result
13157 start
13158 ==a==
13159 ===aa===
13160 xxx
13161
13162 ==b==
13163 ===ba===
13164 ===bb===
13165 ====bba====
13166 ===bc===
13167 ==c==
13168 ===ca===
13169 !! end
13170
13171 !! test
13172 Section replacement test (section 4)
13173 !! options
13174 replace=4,"xxx"
13175 !! input
13176 start
13177 ==a==
13178 ===aa===
13179 ====aaa====
13180 ==b==
13181 ===ba===
13182 ===bb===
13183 ====bba====
13184 ===bc===
13185 ==c==
13186 ===ca===
13187 !! result
13188 start
13189 ==a==
13190 ===aa===
13191 ====aaa====
13192 xxx
13193
13194 ==c==
13195 ===ca===
13196 !! end
13197
13198 !! test
13199 Section replacement test (section 5)
13200 !! options
13201 replace=5,"xxx"
13202 !! input
13203 start
13204 ==a==
13205 ===aa===
13206 ====aaa====
13207 ==b==
13208 ===ba===
13209 ===bb===
13210 ====bba====
13211 ===bc===
13212 ==c==
13213 ===ca===
13214 !! result
13215 start
13216 ==a==
13217 ===aa===
13218 ====aaa====
13219 ==b==
13220 xxx
13221
13222 ===bb===
13223 ====bba====
13224 ===bc===
13225 ==c==
13226 ===ca===
13227 !! end
13228
13229 !! test
13230 Section replacement test (section 6)
13231 !! options
13232 replace=6,"xxx"
13233 !! input
13234 start
13235 ==a==
13236 ===aa===
13237 ====aaa====
13238 ==b==
13239 ===ba===
13240 ===bb===
13241 ====bba====
13242 ===bc===
13243 ==c==
13244 ===ca===
13245 !! result
13246 start
13247 ==a==
13248 ===aa===
13249 ====aaa====
13250 ==b==
13251 ===ba===
13252 xxx
13253
13254 ===bc===
13255 ==c==
13256 ===ca===
13257 !! end
13258
13259 !! test
13260 Section replacement test (section 7)
13261 !! options
13262 replace=7,"xxx"
13263 !! input
13264 start
13265 ==a==
13266 ===aa===
13267 ====aaa====
13268 ==b==
13269 ===ba===
13270 ===bb===
13271 ====bba====
13272 ===bc===
13273 ==c==
13274 ===ca===
13275 !! result
13276 start
13277 ==a==
13278 ===aa===
13279 ====aaa====
13280 ==b==
13281 ===ba===
13282 ===bb===
13283 xxx
13284
13285 ===bc===
13286 ==c==
13287 ===ca===
13288 !! end
13289
13290 !! test
13291 Section replacement test (section 8)
13292 !! options
13293 replace=8,"xxx"
13294 !! input
13295 start
13296 ==a==
13297 ===aa===
13298 ====aaa====
13299 ==b==
13300 ===ba===
13301 ===bb===
13302 ====bba====
13303 ===bc===
13304 ==c==
13305 ===ca===
13306 !! result
13307 start
13308 ==a==
13309 ===aa===
13310 ====aaa====
13311 ==b==
13312 ===ba===
13313 ===bb===
13314 ====bba====
13315 xxx
13316
13317 ==c==
13318 ===ca===
13319 !!end
13320
13321 !! test
13322 Section replacement test (section 9)
13323 !! options
13324 replace=9,"xxx"
13325 !! input
13326 start
13327 ==a==
13328 ===aa===
13329 ====aaa====
13330 ==b==
13331 ===ba===
13332 ===bb===
13333 ====bba====
13334 ===bc===
13335 ==c==
13336 ===ca===
13337 !! result
13338 start
13339 ==a==
13340 ===aa===
13341 ====aaa====
13342 ==b==
13343 ===ba===
13344 ===bb===
13345 ====bba====
13346 ===bc===
13347 xxx
13348 !! end
13349
13350 !! test
13351 Section replacement test (section 10)
13352 !! options
13353 replace=10,"xxx"
13354 !! input
13355 start
13356 ==a==
13357 ===aa===
13358 ====aaa====
13359 ==b==
13360 ===ba===
13361 ===bb===
13362 ====bba====
13363 ===bc===
13364 ==c==
13365 ===ca===
13366 !! result
13367 start
13368 ==a==
13369 ===aa===
13370 ====aaa====
13371 ==b==
13372 ===ba===
13373 ===bb===
13374 ====bba====
13375 ===bc===
13376 ==c==
13377 xxx
13378 !! end
13379
13380 !! test
13381 Section replacement test with initial whitespace (bug 13728)
13382 !! options
13383 replace=2,"xxx"
13384 !! input
13385 Preformatted initial line
13386 ==a==
13387 ===a===
13388 !! result
13389 Preformatted initial line
13390 ==a==
13391 xxx
13392 !! end
13393
13394
13395 !! test
13396 Section extraction, heading followed by pre with 20 spaces (bug 6398)
13397 !! options
13398 section=1
13399 !! input
13400 ==a==
13401 a
13402 !! result
13403 ==a==
13404 a
13405 !! end
13406
13407 !! test
13408 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
13409 !! options
13410 section=1
13411 !! input
13412 ==a==
13413 a
13414 !! result
13415 ==a==
13416 a
13417 !! end
13418
13419
13420 !! test
13421 Section extraction, <pre> around bogus header (bug 10309)
13422 !! options
13423 noxml section=2
13424 !! input
13425 == Section One ==
13426 <pre>
13427 =======
13428 </pre>
13429
13430 == Section Two ==
13431 stuff
13432 !! result
13433 == Section Two ==
13434 stuff
13435 !! end
13436
13437 !! test
13438 Section replacement, <pre> around bogus header (bug 10309)
13439 !! options
13440 noxml replace=2,"xxx"
13441 !! input
13442 == Section One ==
13443 <pre>
13444 =======
13445 </pre>
13446
13447 == Section Two ==
13448 stuff
13449 !! result
13450 == Section One ==
13451 <pre>
13452 =======
13453 </pre>
13454
13455 xxx
13456 !! end
13457
13458
13459
13460 !! test
13461 Handling of &#x0A; in URLs
13462 !! input
13463 **irc://&#x0A;a
13464 !! result
13465 <ul>
13466 <li><ul>
13467 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
13468 </li>
13469 </ul>
13470 </li>
13471 </ul>
13472
13473 !!end
13474
13475 !! test
13476 5 quotes, code coverage +1 line (php)
13477 !! options
13478 php
13479 !! input
13480 '''''
13481 !! result
13482 !! end
13483 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
13484 !! test
13485 5 quotes, code coverage +1 line (parsoid)
13486 !! options
13487 parsoid
13488 !! input
13489 '''''
13490 !! result
13491 <p><b><i></i></b></p>
13492 !! end
13493
13494 !! test
13495 Special:Search page linking.
13496 !! input
13497 {{Special:search}}
13498 !! result
13499 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
13500 </p>
13501 !! end
13502
13503 !! test
13504 Say the magic word
13505 !! options
13506 title=[[Parser test]]
13507 !! input
13508 * {{PAGENAME}}
13509 * {{PAGENAMEE}}
13510 * {{FULLPAGENAME}}
13511 * {{FULLPAGENAMEE}}
13512 * {{BASEPAGENAME}}
13513 * {{BASEPAGENAMEE}}
13514 * {{SUBPAGENAME}}
13515 * {{SUBPAGENAMEE}}
13516 * {{ROOTPAGENAME}}
13517 * {{ROOTPAGENAMEE}}
13518 * {{TALKPAGENAME}}
13519 * {{TALKPAGENAMEE}}
13520 * {{SUBJECTPAGENAME}}
13521 * {{SUBJECTPAGENAMEE}}
13522 * {{NAMESPACEE}}
13523 * {{NAMESPACE}}
13524 * {{NAMESPACENUMBER}}
13525 * {{TALKSPACE}}
13526 * {{TALKSPACEE}}
13527 * {{SUBJECTSPACE}}
13528 * {{SUBJECTSPACEE}}
13529 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
13530 !! result
13531 <ul>
13532 <li> Parser test
13533 </li>
13534 <li> Parser_test
13535 </li>
13536 <li> Parser test
13537 </li>
13538 <li> Parser_test
13539 </li>
13540 <li> Parser test
13541 </li>
13542 <li> Parser_test
13543 </li>
13544 <li> Parser test
13545 </li>
13546 <li> Parser_test
13547 </li>
13548 <li> Parser test
13549 </li>
13550 <li> Parser_test
13551 </li>
13552 <li> Talk:Parser test
13553 </li>
13554 <li> Talk:Parser_test
13555 </li>
13556 <li> Parser test
13557 </li>
13558 <li> Parser_test
13559 </li>
13560 <li>
13561 </li>
13562 <li>
13563 </li>
13564 <li> 0
13565 </li>
13566 <li> Talk
13567 </li>
13568 <li> Talk
13569 </li>
13570 <li>
13571 </li>
13572 <li>
13573 </li>
13574 <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>
13575 </li>
13576 </ul>
13577
13578 !! end
13579 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
13580
13581 !! test
13582 Gallery
13583 !! input
13584 <gallery>
13585 image1.png |
13586 image2.gif|||||
13587
13588 image3|
13589 image4 |300px| centre
13590 image5.svg| http://///////
13591 [[x|xx]]]]
13592 * image6
13593 </gallery>
13594 !! result
13595 <ul class="gallery mw-gallery-traditional">
13596 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13597 <div class="thumb" style="height: 150px;">Image1.png</div>
13598 <div class="gallerytext">
13599 </div>
13600 </div></li>
13601 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13602 <div class="thumb" style="height: 150px;">Image2.gif</div>
13603 <div class="gallerytext">
13604 <p>||||
13605 </p>
13606 </div>
13607 </div></li>
13608 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13609 <div class="thumb" style="height: 150px;">Image3</div>
13610 <div class="gallerytext">
13611 </div>
13612 </div></li>
13613 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13614 <div class="thumb" style="height: 150px;">Image4</div>
13615 <div class="gallerytext">
13616 <p>300px| centre
13617 </p>
13618 </div>
13619 </div></li>
13620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13621 <div class="thumb" style="height: 150px;">Image5.svg</div>
13622 <div class="gallerytext">
13623 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
13624 </p>
13625 </div>
13626 </div></li>
13627 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13628 <div class="thumb" style="height: 150px;">* image6</div>
13629 <div class="gallerytext">
13630 </div>
13631 </div></li>
13632 </ul>
13633
13634 !! end
13635
13636 !! test
13637 Gallery (with options)
13638 !! input
13639 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
13640 File:Nonexistant.jpg|caption
13641 File:Nonexistant.jpg
13642 image:foobar.jpg|some '''caption''' [[Main Page]]
13643 image:foobar.jpg
13644 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
13645 </gallery>
13646 !! result
13647 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
13648 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
13649 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13650 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13651 <div class="gallerytext">
13652 <p>caption
13653 </p>
13654 </div>
13655 </div></li>
13656 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13657 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13658 <div class="gallerytext">
13659 </div>
13660 </div></li>
13661 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13662 <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>
13663 <div class="gallerytext">
13664 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13665 </p>
13666 </div>
13667 </div></li>
13668 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13669 <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>
13670 <div class="gallerytext">
13671 </div>
13672 </div></li>
13673 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13674 <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>
13675 <div class="gallerytext">
13676 <p>Blabla|blabla.
13677 </p>
13678 </div>
13679 </div></li>
13680 </ul>
13681
13682 !! end
13683
13684 !! test
13685 Gallery with wikitext inside caption
13686 !! input
13687 <gallery>
13688 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
13689 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
13690 </gallery>
13691 !! result
13692 <ul class="gallery mw-gallery-traditional">
13693 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13694 <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>
13695 <div class="gallerytext">
13696 <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>
13697 </p>
13698 </div>
13699 </div></li>
13700 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13701 <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>
13702 <div class="gallerytext">
13703 <p>This is a test template
13704 </p>
13705 </div>
13706 </div></li>
13707 </ul>
13708
13709 !! end
13710
13711 !! test
13712 gallery (with showfilename option)
13713 !! input
13714 <gallery showfilename>
13715 File:Nonexistant.jpg|caption
13716 File:Nonexistant.jpg
13717 image:foobar.jpg|some '''caption''' [[Main Page]]
13718 File:Foobar.jpg
13719 </gallery>
13720 !! result
13721 <ul class="gallery mw-gallery-traditional">
13722 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13723 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13724 <div class="gallerytext">
13725 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13726 caption
13727 </p>
13728 </div>
13729 </div></li>
13730 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13731 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13732 <div class="gallerytext">
13733 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13734 </p>
13735 </div>
13736 </div></li>
13737 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13738 <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>
13739 <div class="gallerytext">
13740 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13741 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13742 </p>
13743 </div>
13744 </div></li>
13745 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13746 <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>
13747 <div class="gallerytext">
13748 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13749 </p>
13750 </div>
13751 </div></li>
13752 </ul>
13753
13754 !! end
13755
13756 !! test
13757 Gallery (with namespace-less filenames)
13758 !! input
13759 <gallery>
13760 File:Nonexistant.jpg
13761 Nonexistant.jpg
13762 image:foobar.jpg
13763 foobar.jpg
13764 </gallery>
13765 !! result
13766 <ul class="gallery mw-gallery-traditional">
13767 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13768 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13769 <div class="gallerytext">
13770 </div>
13771 </div></li>
13772 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13773 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13774 <div class="gallerytext">
13775 </div>
13776 </div></li>
13777 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13778 <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>
13779 <div class="gallerytext">
13780 </div>
13781 </div></li>
13782 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13783 <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>
13784 <div class="gallerytext">
13785 </div>
13786 </div></li>
13787 </ul>
13788
13789 !! end
13790
13791 !! test
13792 HTML Hex character encoding (spells the word "JavaScript")
13793 !! input
13794 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13795 !! result
13796 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13797 </p>
13798 !! end
13799
13800 !! test
13801 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13802 !! input
13803 &#xsee;&#XSEE;
13804 !! result
13805 <p>&amp;#xsee;&amp;#XSEE;
13806 </p>
13807 !! end
13808
13809 !! test
13810 HTML Hex character encoding mixed case
13811 !! input
13812 &#xEE;&#Xee;
13813 !! result
13814 <p>&#xee;&#xee;
13815 </p>
13816 !! end
13817
13818 !! test
13819 __FORCETOC__ override
13820 !! input
13821 __NEWSECTIONLINK__
13822 __FORCETOC__
13823 !! result
13824 <p><br />
13825 </p>
13826 !! end
13827
13828 !! test
13829 ISBN code coverage
13830 !! input
13831 ISBN 978-0-1234-56&#x20;789
13832 !! result
13833 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13834 </p>
13835 !! end
13836
13837 !! test
13838 ISBN followed by 5 spaces
13839 !! input
13840 ISBN
13841 !! result
13842 <p>ISBN
13843 </p>
13844 !! end
13845
13846 !! test
13847 Double ISBN
13848 !! input
13849 ISBN ISBN 1234567890
13850 !! result
13851 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13852 </p>
13853 !! end
13854
13855 !! test
13856 Bug 22905: <abbr> followed by ISBN followed by </a>
13857 !! input
13858 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13859 !! result
13860 <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>
13861 </p>
13862 !! end
13863
13864 !! test
13865 Double RFC
13866 !! input
13867 RFC RFC 1234
13868 !! result
13869 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13870 </p>
13871 !! end
13872
13873 !! test
13874 Double RFC with a wiki link
13875 !! input
13876 RFC [[RFC 1234]]
13877 !! result
13878 <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>
13879 </p>
13880 !! end
13881
13882 !! test
13883 RFC code coverage
13884 !! input
13885 RFC 983&#x20;987
13886 !! result
13887 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13888 </p>
13889 !! end
13890
13891 !! test
13892 Centre-aligned image
13893 !! input
13894 [[Image:foobar.jpg|centre]]
13895 !! result
13896 <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>
13897
13898 !!end
13899
13900 !! test
13901 None-aligned image
13902 !! input
13903 [[Image:foobar.jpg|none]]
13904 !! result
13905 <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>
13906
13907 !!end
13908
13909 !! test
13910 Width + Height sized image (using px) (height is ignored)
13911 !! input
13912 [[Image:foobar.jpg|640x480px]]
13913 !! result
13914 <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>
13915 </p>
13916 !!end
13917
13918 !! test
13919 Width-sized image (using px, no following whitespace)
13920 !! input
13921 [[Image:foobar.jpg|640px]]
13922 !! result
13923 <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>
13924 </p>
13925 !!end
13926
13927 !! test
13928 Width-sized image (using px, with following whitespace - test regression from r39467)
13929 !! input
13930 [[Image:foobar.jpg|640px ]]
13931 !! result
13932 <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>
13933 </p>
13934 !!end
13935
13936 !! test
13937 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13938 !! input
13939 [[Image:foobar.jpg| 640px]]
13940 !! result
13941 <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>
13942 </p>
13943 !!end
13944
13945 !! test
13946 Another italics / bold test
13947 !! input
13948 ''' ''x'
13949 !! result
13950 <pre>'<i> </i>x'
13951 </pre>
13952 !!end
13953
13954 # Note the results may be incorrect, as parserTest output included this:
13955 # XML error: Mismatched tag at byte 6120:
13956 # ...<dd> </dt></dl> </dd...
13957 !! test
13958 dt/dd/dl test
13959 !! options
13960 disabled
13961 !! input
13962 :;;;::
13963 !! result
13964 <dl>
13965 <dd><dl>
13966 <dt><dl>
13967 <dt><dl>
13968 <dt><dl>
13969 <dd><dl>
13970 <dd>
13971 </dd>
13972 </dl>
13973 </dd>
13974 </dl>
13975 </dt>
13976 </dl>
13977 </dt>
13978 </dl>
13979 </dt>
13980 </dl>
13981 </dd>
13982 </dl>
13983
13984 !!end
13985
13986
13987 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13988 !! test
13989 Images with the "|" character in the comment
13990 !! input
13991 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13992 !! result
13993 <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>
13994
13995 !!end
13996
13997 !! test
13998 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13999 !! input
14000 <html><script>alert(1);</script></html>
14001 !! result
14002 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14003 </p>
14004 !! end
14005
14006 !! test
14007 HTML with raw HTML ($wgRawHtml==true)
14008 !! options
14009 wgRawHtml=1
14010 !! input
14011 <html><script>alert(1);</script></html>
14012 !! result
14013 <p><script>alert(1);</script>
14014 </p>
14015 !! end
14016
14017 !! test
14018 Parents of subpages, one level up
14019 !! options
14020 subpage title=[[Subpage test/L1/L2/L3]]
14021 !! input
14022 [[../|L2]]
14023 !! result
14024 <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>
14025 </p>
14026 !! end
14027
14028
14029 !! test
14030 Parents of subpages, one level up, not named
14031 !! options
14032 subpage title=[[Subpage test/L1/L2/L3]]
14033 !! input
14034 [[../]]
14035 !! result
14036 <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>
14037 </p>
14038 !! end
14039
14040
14041
14042 !! test
14043 Parents of subpages, two levels up
14044 !! options
14045 subpage title=[[Subpage test/L1/L2/L3]]
14046 !! input
14047 [[../../|L1]]2
14048
14049 [[../../|L1]]l
14050 !! result
14051 <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
14052 </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>
14053 </p>
14054 !! end
14055
14056 !! test
14057 Parents of subpages, two levels up, without trailing slash or name.
14058 !! options
14059 subpage title=[[Subpage test/L1/L2/L3]]
14060 !! input
14061 [[../..]]
14062 !! result
14063 <p>[[../..]]
14064 </p>
14065 !! end
14066
14067 !! test
14068 Parents of subpages, two levels up, with lots of extra trailing slashes.
14069 !! options
14070 subpage title=[[Subpage test/L1/L2/L3]]
14071 !! input
14072 [[../../////]]
14073 !! result
14074 <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>
14075 </p>
14076 !! end
14077
14078 !! article
14079 Subpage test/L1/L2/L3Sibling
14080 !! text
14081 Sibling article
14082 !! endarticle
14083
14084 !! test
14085 Transclusion of a sibling page (one level up)
14086 !! options
14087 subpage title=[[Subpage test/L1/L2/L3]]
14088 !! input
14089 {{../L3Sibling}}
14090 !! result
14091 <p>Sibling article
14092 </p>
14093 !! end
14094
14095 !! test
14096 Transclusion of a child page
14097 !! options
14098 subpage title=[[Subpage test/L1/L2]]
14099 !! input
14100 {{/L3Sibling}}
14101 !! result
14102 <p>Sibling article
14103 </p>
14104 !! end
14105
14106 !! test
14107 Non-transclusion because of too many up levels
14108 !! options
14109 subpage title=[[Subpage test/L1/L2/L3]]
14110 !! input
14111 {{../../../../More than parent}}
14112 !! result
14113 <p>{{../../../../More than parent}}
14114 </p>
14115 !! end
14116
14117 !! test
14118 Definition list code coverage
14119 !! input
14120 ; title : def
14121 ; title : def
14122 ;title: def
14123 !! result
14124 <dl>
14125 <dt> title &#160;</dt>
14126 <dd> def
14127 </dd>
14128 <dt> title&#160;</dt>
14129 <dd> def
14130 </dd>
14131 <dt>title</dt>
14132 <dd> def
14133 </dd>
14134 </dl>
14135
14136 !! end
14137
14138 !! test
14139 Don't fall for the self-closing div
14140 !! input
14141 <div>hello world</div/>
14142 !! result
14143 <div>hello world</div>
14144
14145 !! end
14146
14147 !! test
14148 MSGNW magic word
14149 !! input
14150 {{MSGNW:msg}}
14151 !! result
14152 <p>&#91;&#91;:Template:Msg&#93;&#93;
14153 </p>
14154 !! end
14155
14156 !! test
14157 RAW magic word
14158 !! input
14159 {{RAW:QUERTY}}
14160 !! result
14161 <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>
14162 </p>
14163 !! end
14164
14165 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
14166 !! test
14167 Always escape literal '>' in output, not just after '<'
14168 !! input
14169 ><>
14170 !! result
14171 <p>&gt;&lt;&gt;
14172 </p>
14173 !! end
14174
14175 !! test
14176 Template caching
14177 !! input
14178 {{Test}}
14179 {{Test}}
14180 !! result
14181 <p>This is a test template
14182 This is a test template
14183 </p>
14184 !! end
14185
14186
14187 !! article
14188 MediaWiki:Fake
14189 !! text
14190 ==header==
14191 !! endarticle
14192
14193 !! test
14194 Inclusion of !userCanEdit() content
14195 !! input
14196 {{MediaWiki:Fake}}
14197 !! result
14198 <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>
14199
14200 !! end
14201
14202
14203 !! test
14204 Out-of-order TOC heading levels
14205 !! input
14206 ==2==
14207 ======6======
14208 ===3===
14209 =1=
14210 =====5=====
14211 ==2==
14212 !! result
14213 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14214 <ul>
14215 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
14216 <ul>
14217 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
14218 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
14219 </ul>
14220 </li>
14221 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
14222 <ul>
14223 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
14224 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
14225 </ul>
14226 </li>
14227 </ul>
14228 </div>
14229 <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>
14230 <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>
14231 <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>
14232 <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>
14233 <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>
14234 <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>
14235
14236 !! end
14237
14238
14239 !! test
14240 ISBN with a dummy number
14241 !! input
14242 ISBN ---
14243 !! result
14244 <p>ISBN ---
14245 </p>
14246 !! end
14247
14248
14249 !! test
14250 ISBN with space-delimited number
14251 !! input
14252 ISBN 92 9017 032 8
14253 !! result
14254 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
14255 </p>
14256 !! end
14257
14258
14259 !! test
14260 ISBN with multiple spaces, no number
14261 !! input
14262 ISBN foo
14263 !! result
14264 <p>ISBN foo
14265 </p>
14266 !! end
14267
14268
14269 !! test
14270 ISBN length
14271 !! input
14272 ISBN 123456789
14273
14274 ISBN 1234567890
14275
14276 ISBN 12345678901
14277 !! result
14278 <p>ISBN 123456789
14279 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14280 </p><p>ISBN 12345678901
14281 </p>
14282 !! end
14283
14284
14285 !! test
14286 ISBN with trailing year (bug 8110)
14287 !! input
14288 ISBN 1-234-56789-0 - 2006
14289
14290 ISBN 1 234 56789 0 - 2006
14291 !! result
14292 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
14293 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
14294 </p>
14295 !! end
14296
14297
14298 !! test
14299 anchorencode
14300 !! input
14301 {{anchorencode:foo bar©#%n}}
14302 !! result
14303 <p>foo_bar.C2.A9.23.25n
14304 </p>
14305 !! end
14306
14307 !! test
14308 anchorencode trims spaces
14309 !! input
14310 {{anchorencode: __pretty__please__}}
14311 !! result
14312 <p>pretty_please
14313 </p>
14314 !! end
14315
14316 !! test
14317 anchorencode deals with links
14318 !! input
14319 {{anchorencode: [[hello|world]] [[hi]]}}
14320 !! result
14321 <p>world_hi
14322 </p>
14323 !! end
14324
14325 !! test
14326 anchorencode deals with templates
14327 !! input
14328 {{anchorencode: {{Foo}} }}
14329 !! result
14330 <p>FOO
14331 </p>
14332 !! end
14333
14334 !! test
14335 anchorencode encodes like the TOC generator: (bug 18431)
14336 !! input
14337 === _ +:.3A%3A&&amp;]] ===
14338 {{anchorencode: _ +:.3A%3A&&amp;]] }}
14339 __NOEDITSECTION__
14340 !! result
14341 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
14342 <p>.2B:.3A.253A.26.26.5D.5D
14343 </p>
14344 !! end
14345
14346 !! test
14347 Bug 6200: blockquotes and paragraph formatting
14348 !! input
14349 <blockquote>
14350 foo
14351 </blockquote>
14352
14353 bar
14354
14355 baz
14356 !! result
14357 <blockquote>
14358 <p>foo
14359 </p>
14360 </blockquote>
14361 <p>bar
14362 </p>
14363 <pre>baz
14364 </pre>
14365 !! end
14366
14367 !! test
14368 Bug 8293: Use of center tag ruins paragraph formatting
14369 !! input
14370 <center>
14371 foo
14372 </center>
14373
14374 bar
14375
14376 baz
14377 !! result
14378 <center>
14379 <p>foo
14380 </p>
14381 </center>
14382 <p>bar
14383 </p>
14384 <pre>baz
14385 </pre>
14386 !! end
14387
14388 !!test
14389 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
14390 !!options
14391 php
14392 !!input
14393 <span><s>x</span></s>
14394 !!result
14395 <p><span><s>x&lt;/span&gt;</s></span>
14396 </p>
14397 !!end
14398
14399 !!test
14400 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
14401 !!options
14402 parsoid
14403 !!input
14404 <span><s>x</span></s>
14405 !!result
14406 <p><span><s>x</s></span><s></s>
14407 </p>
14408 !!end
14409
14410 ###
14411 ### Language variants related tests
14412 ###
14413 !! test
14414 Self-link in language variants
14415 !! options
14416 title=[[Dunav]] language=sr
14417 !! input
14418 Both [[Dunav]] and [[Дунав]] are names for this river.
14419 !! result
14420 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
14421 </p>
14422 !!end
14423
14424 !! article
14425 Дуна
14426 !! text
14427 content
14428 !! endarticle
14429
14430 !! test
14431 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
14432 !! options
14433 title=[[Duna]] language=sr
14434 !! input
14435 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
14436 !! result
14437 <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.
14438 </p>
14439 !! end
14440
14441 !! test
14442 Link to a section of a variant of this title shouldn't be parsed as self-link
14443 !! options
14444 title=[[Duna]] language=sr
14445 !! input
14446 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
14447 !! result
14448 <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.
14449 </p>
14450 !! end
14451
14452 !! test
14453 Link to pages in language variants
14454 !! options
14455 language=sr
14456 !! input
14457 Main Page can be written as [[Маин Паге]]
14458 !! result
14459 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
14460 </p>
14461 !!end
14462
14463
14464 !! test
14465 Multiple links to pages in language variants
14466 !! options
14467 language=sr
14468 !! input
14469 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
14470 !! result
14471 <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>.
14472 </p>
14473 !!end
14474
14475
14476 !! test
14477 Simple template in language variants
14478 !! options
14479 language=sr
14480 !! input
14481 {{тест}}
14482 !! result
14483 <p>This is a test template
14484 </p>
14485 !! end
14486
14487
14488 !! test
14489 Template with explicit namespace in language variants
14490 !! options
14491 language=sr
14492 !! input
14493 {{Template:тест}}
14494 !! result
14495 <p>This is a test template
14496 </p>
14497 !! end
14498
14499
14500 !! test
14501 Basic test for template parameter in language variants
14502 !! options
14503 language=sr
14504 !! input
14505 {{парамтест|param=foo}}
14506 !! result
14507 <p>This is a test template with parameter foo
14508 </p>
14509 !! end
14510
14511
14512 !! test
14513 Simple category in language variants
14514 !! options
14515 language=sr cat
14516 !! input
14517 [[Category:МедиаWики Усер'с Гуиде]]
14518 !! result
14519 <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>
14520 !! end
14521
14522
14523 !! article
14524 Category:分类
14525 !! text
14526 blah
14527 !! endarticle
14528
14529 !! article
14530 Category:分類
14531 !! text
14532 blah
14533 !! endarticle
14534
14535 !! test
14536 Don't convert blue categorylinks to another variant (bug 33210)
14537 !! options
14538 language=zh cat
14539 !! input
14540 [[A]][[Category:分类]]
14541 !! result
14542 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
14543 !! end
14544
14545
14546 !! test
14547 Stripping -{}- tags (language variants)
14548 !! options
14549 language=sr
14550 !! input
14551 Latin proverb: -{Ne nuntium necare}-
14552 !! result
14553 <p>Latin proverb: Ne nuntium necare
14554 </p>
14555 !! end
14556
14557
14558 !! test
14559 Prevent conversion with -{}- tags (language variants)
14560 !! options
14561 language=sr variant=sr-ec
14562 !! input
14563 Latinski: -{Ne nuntium necare}-
14564 !! result
14565 <p>Латински: Ne nuntium necare
14566 </p>
14567 !! end
14568
14569
14570 !! test
14571 Prevent conversion of text with -{}- tags (language variants)
14572 !! options
14573 language=sr variant=sr-ec
14574 !! input
14575 Latinski: -{Ne nuntium necare}-
14576 !! result
14577 <p>Латински: Ne nuntium necare
14578 </p>
14579 !! end
14580
14581
14582 !! test
14583 Prevent conversion of links with -{}- tags (language variants)
14584 !! options
14585 language=sr variant=sr-ec
14586 !! input
14587 -{[[Main Page]]}-
14588 !! result
14589 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14590 </p>
14591 !! end
14592
14593
14594 !! test
14595 -{}- tags within headlines (within html for parserConvert())
14596 !! options
14597 language=sr variant=sr-ec
14598 !! input
14599 == -{Naslov}- ==
14600 !! result
14601 <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>
14602
14603 !! end
14604
14605
14606 !! test
14607 Explicit definition of language variant alternatives
14608 !! options
14609 language=zh variant=zh-tw
14610 !! input
14611 -{zh:China;zh-tw:Taiwan}-, not China
14612 !! result
14613 <p>Taiwan, not China
14614 </p>
14615 !! end
14616
14617
14618 !! test
14619 Conversion around HTML tags
14620 !! options
14621 language=sr variant=sr-ec
14622 !! input
14623 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
14624 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
14625 !! result
14626 <p>
14627 <span title="ЛаCтин">ски</span>
14628 </p>
14629 !! end
14630
14631
14632 !! test
14633 Explicit session-wise language variant mapping (A flag and - flag)
14634 !! options
14635 language=zh variant=zh-tw
14636 !! input
14637 Taiwan is not China.
14638 But -{A|zh:China;zh-tw:Taiwan}- is China,
14639 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
14640 and -{China}- is China.
14641 !! result
14642 <p>Taiwan is not China.
14643 But Taiwan is Taiwan,
14644 (This should be stripped!)
14645 and China is China.
14646 </p>
14647 !! end
14648
14649 !! test
14650 Explicit session-wise language variant mapping (H flag for hide)
14651 !! options
14652 language=zh variant=zh-tw
14653 !! input
14654 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
14655 Taiwan is China.
14656 !! result
14657 <p>(This should be stripped!)
14658 Taiwan is Taiwan.
14659 </p>
14660 !! end
14661
14662 !! test
14663 Adding explicit conversion rule for title (T flag)
14664 !! options
14665 language=zh variant=zh-tw showtitle
14666 !! input
14667 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14668 !! result
14669 Taiwan
14670 <p>Should be stripped!
14671 </p>
14672 !! end
14673
14674 !! test
14675 Testing that changing the language variant here in the tests actually works
14676 !! options
14677 language=zh variant=zh showtitle
14678 !! input
14679 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14680 !! result
14681 China
14682 <p>Should be stripped!
14683 </p>
14684 !! end
14685
14686 !! test
14687 Recursive conversion of alt and title attrs shouldn't clear converter state
14688 !! options
14689 language=zh variant=zh-cn showtitle
14690 !! input
14691 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
14692 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
14693 !! result
14694 China
14695 <p>
14696 Should be stripped<span title="Exclamation">!</span>
14697 </p>
14698 !! end
14699
14700 !! test
14701 Bug 24072: more test on conversion rule for title
14702 !! options
14703 language=zh variant=zh-tw showtitle
14704 !! input
14705 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14706 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
14707 !! result
14708 Taiwan
14709 <p>This should be stripped!
14710 This won't take interferes with the title rule.
14711 </p>
14712 !! end
14713
14714 !! test
14715 Partly disable title conversion if variant == main language code
14716 !! options
14717 language=zh variant=zh title=[[ZH]] showtitle
14718 !! input
14719 -{T|zh-cn:CN;zh-tw:TW}-
14720 !! result
14721 ZH
14722 <p>
14723 </p>
14724 !! end
14725
14726 !! test
14727 Partly disable title conversion if variant == main language code, more
14728 !! options
14729 language=zh variant=zh title=[[ZH]] showtitle
14730 !! input
14731 -{T|TW}-
14732 !! result
14733 ZH
14734 <p>
14735 </p>
14736 !! end
14737
14738 !! test
14739 Raw output of variant escape tags (R flag)
14740 !! options
14741 language=zh variant=zh-tw
14742 !! input
14743 Raw: -{R|zh:China;zh-tw:Taiwan}-
14744 !! result
14745 <p>Raw: zh:China;zh-tw:Taiwan
14746 </p>
14747 !! end
14748
14749 !! test
14750 Nested using of manual convert syntax
14751 !! options
14752 language=zh variant=zh-hk
14753 !! input
14754 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14755 !! result
14756 <p>Nested: Hello Hong Kong!
14757 </p>
14758 !! end
14759
14760 !! test
14761 Proper conversion of text in external links
14762 !! options
14763 language=sr variant=sr-ec
14764 !! input
14765 http://www.google.com
14766 gopher://www.google.com
14767 [http://www.google.com http://www.google.com]
14768 [gopher://www.google.com gopher://www.google.com]
14769 [https://www.google.com irc://www.google.com]
14770 [ftp://www.google.com www.google.com/ftp://dir]
14771 [//www.google.com www.google.com]
14772 !! result
14773 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14774 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14775 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14776 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14777 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14778 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14779 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14780 </p>
14781 !! end
14782
14783 !! test
14784 Do not convert roman numbers to language variants
14785 !! options
14786 language=sr variant=sr-ec
14787 !! input
14788 Fridrih IV je car.
14789 !! result
14790 <p>Фридрих IV је цар.
14791 </p>
14792 !! end
14793
14794 !! test
14795 Unclosed language converter markup "-{"
14796 !! options
14797 language=sr
14798 !! input
14799 -{T|hello
14800 !! result
14801 <p>-{T|hello
14802 </p>
14803 !! end
14804
14805 !! test
14806 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14807 !! options
14808 language=sr
14809 !! input
14810 -{R|=&gt;}-
14811 !! result
14812 <p>=&gt;
14813 </p>
14814 !!end
14815
14816 !! test
14817 Bug 529: Uncovered bullet
14818 !! input
14819 * Foo {{bullet}}
14820 !! result
14821 <ul>
14822 <li> Foo
14823 </li>
14824 <li> Bar
14825 </li>
14826 </ul>
14827
14828 !! end
14829
14830 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14831 # Templates in Wikipedia rely on this behavior, as tidy has always been
14832 # enabled there. These tests are normally run *without* tidy, so specify the
14833 # full output here.
14834 # To test realistic parsing behavior, apply a tidy-like transformation to both
14835 # the expected output and your parser's output.
14836 !! test
14837 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14838 !! input
14839 ******* Foo {{bullet}}
14840 !! result
14841 <ul>
14842 <li><ul>
14843 <li><ul>
14844 <li><ul>
14845 <li><ul>
14846 <li><ul>
14847 <li><ul>
14848 <li> Foo
14849 </li>
14850 </ul>
14851 </li>
14852 </ul>
14853 </li>
14854 </ul>
14855 </li>
14856 </ul>
14857 </li>
14858 </ul>
14859 </li>
14860 </ul>
14861 </li>
14862 <li> Bar
14863 </li>
14864 </ul>
14865
14866 !! end
14867
14868 !! test
14869 Bug 529: Uncovered table already at line-start
14870 !! input
14871 x
14872
14873 {{table}}
14874 y
14875 !! result
14876 <p>x
14877 </p>
14878 <table>
14879 <tr>
14880 <td> 1 </td>
14881 <td> 2
14882 </td></tr>
14883 <tr>
14884 <td> 3 </td>
14885 <td> 4
14886 </td></tr></table>
14887 <p>y
14888 </p>
14889 !! end
14890
14891 !! test
14892 Bug 529: Uncovered bullet in parser function result
14893 !! input
14894 * Foo {{lc:{{bullet}} }}
14895 !! result
14896 <ul>
14897 <li> Foo
14898 </li>
14899 <li> bar
14900 </li>
14901 </ul>
14902
14903 !! end
14904
14905 !! test
14906 Bug 5678: Double-parsed template argument
14907 !! input
14908 {{lc:{{{1}}}|hello}}
14909 !! result
14910 <p>{{{1}}}
14911 </p>
14912 !! end
14913
14914 !! test
14915 Bug 5678: Double-parsed template invocation
14916 !! input
14917 {{lc:{{paramtest {{!}} param = hello }} }}
14918 !! result
14919 <p>{{paramtest | param = hello }}
14920 </p>
14921 !! end
14922
14923 !! test
14924 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14925 !! options
14926 language=cs
14927 title=[[Main Page]]
14928 !! input
14929 {{PRVNÍVELKÉ:ěščř}}
14930 {{prvnívelké:ěščř}}
14931 {{PRVNÍMALÉ:ěščř}}
14932 {{prvnímalé:ěščř}}
14933 {{MALÁ:ěščř}}
14934 {{malá:ěščř}}
14935 {{VELKÁ:ěščř}}
14936 {{velká:ěščř}}
14937 !! result
14938 <p>Ěščř
14939 Ěščř
14940 ěščř
14941 ěščř
14942 ěščř
14943 ěščř
14944 ĚŠČŘ
14945 ĚŠČŘ
14946 </p>
14947 !! end
14948
14949 !! test
14950 Morwen/13: Unclosed link followed by heading
14951 !! input
14952 [[link
14953 ==heading==
14954 !! result
14955 <p>[[link
14956 </p>
14957 <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>
14958
14959 !! end
14960
14961 !! test
14962 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14963 !! input
14964 {{foo|
14965 =heading=
14966 !! result
14967 <p>{{foo|
14968 </p>
14969 <h1><span class="mw-headline" id="heading">heading</span></h1>
14970
14971 !! end
14972
14973 !! test
14974 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14975 !! input
14976 {{foo|
14977 ==heading==
14978 !! result
14979 <p>{{foo|
14980 </p>
14981 <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>
14982
14983 !! end
14984
14985 !! test
14986 Tildes in comments
14987 !! options
14988 pst
14989 !! input
14990 <!-- ~~~~ -->
14991 !! result
14992 <!-- ~~~~ -->
14993 !! end
14994
14995 !! test
14996 Paragraphs inside divs (no extra line breaks)
14997 !! input
14998 <div>Line one
14999
15000 Line two</div>
15001 !! result
15002 <div>Line one
15003 Line two</div>
15004
15005 !! end
15006
15007 !! test
15008 Paragraphs inside divs (extra line break on open)
15009 !! input
15010 <div>
15011 Line one
15012
15013 Line two</div>
15014 !! result
15015 <div>
15016 <p>Line one
15017 </p>
15018 Line two</div>
15019
15020 !! end
15021
15022 !! test
15023 Paragraphs inside divs (extra line break on close)
15024 !! input
15025 <div>Line one
15026
15027 Line two
15028 </div>
15029 !! result
15030 <div>Line one
15031 <p>Line two
15032 </p>
15033 </div>
15034
15035 !! end
15036
15037 !! test
15038 Paragraphs inside divs (extra line break on open and close)
15039 !! input
15040 <div>
15041 Line one
15042
15043 Line two
15044 </div>
15045 !! result
15046 <div>
15047 <p>Line one
15048 </p><p>Line two
15049 </p>
15050 </div>
15051
15052 !! end
15053
15054 !! test
15055 Nesting tags, paragraphs on lines which begin with <div>
15056 !! options
15057 disabled
15058 !! input
15059 <div></div><strong>A
15060 B</strong>
15061 !! result
15062 <div></div>
15063 <p><strong>A
15064 B</strong>
15065 </p>
15066 !! end
15067
15068 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15069 !! test
15070 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15071 !! input
15072 <blockquote>Line one
15073
15074 Line two</blockquote>
15075 !! result
15076 <blockquote>Line one
15077 Line two</blockquote>
15078
15079 !! end
15080
15081 !! test
15082 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15083 !! input
15084 <blockquote>
15085 Line one
15086
15087 Line two</blockquote>
15088 !! result
15089 <blockquote>
15090 <p>Line one
15091 </p>
15092 Line two</blockquote>
15093
15094 !! end
15095
15096 !! test
15097 Bug 6200: paragraphs inside blockquotes (extra line break on close)
15098 !! input
15099 <blockquote>Line one
15100
15101 Line two
15102 </blockquote>
15103 !! result
15104 <blockquote>Line one
15105 <p>Line two
15106 </p>
15107 </blockquote>
15108
15109 !! end
15110
15111 !! test
15112 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
15113 !! input
15114 <blockquote>
15115 Line one
15116
15117 Line two
15118 </blockquote>
15119 !! result
15120 <blockquote>
15121 <p>Line one
15122 </p><p>Line two
15123 </p>
15124 </blockquote>
15125
15126 !! end
15127
15128 !! test
15129 Paragraphs inside blockquotes/divs (no extra line breaks)
15130 !! input
15131 <blockquote><div>Line one
15132
15133 Line two</div></blockquote>
15134 !! result
15135 <blockquote><div>Line one
15136 Line two</div></blockquote>
15137
15138 !! end
15139
15140 !! test
15141 Paragraphs inside blockquotes/divs (extra line break on open)
15142 !! input
15143 <blockquote><div>
15144 Line one
15145
15146 Line two</div></blockquote>
15147 !! result
15148 <blockquote><div>
15149 <p>Line one
15150 </p>
15151 Line two</div></blockquote>
15152
15153 !! end
15154
15155 !! test
15156 Paragraphs inside blockquotes/divs (extra line break on close)
15157 !! input
15158 <blockquote><div>Line one
15159
15160 Line two
15161 </div></blockquote>
15162 !! result
15163 <blockquote><div>Line one
15164 <p>Line two
15165 </p>
15166 </div></blockquote>
15167
15168 !! end
15169
15170 !! test
15171 Paragraphs inside blockquotes/divs (extra line break on open and close)
15172 !! input
15173 <blockquote><div>
15174 Line one
15175
15176 Line two
15177 </div></blockquote>
15178 !! result
15179 <blockquote><div>
15180 <p>Line one
15181 </p><p>Line two
15182 </p>
15183 </div></blockquote>
15184
15185 !! end
15186
15187 !! test
15188 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
15189 !! options
15190 wgLinkHolderBatchSize=0
15191 !! input
15192 [[meatball:1]]
15193 [[meatball:2]]
15194 [[meatball:3]]
15195 !! result
15196 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
15197 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
15198 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
15199 </p>
15200 !! end
15201
15202 !! test
15203 Free external link invading image caption
15204 !! input
15205 [[Image:Foobar.jpg|thumb|http://x|hello]]
15206 !! result
15207 <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>
15208
15209 !! end
15210
15211 !! test
15212 Bug 15196: localised external link numbers
15213 !! options
15214 language=fa
15215 !! input
15216 [http://en.wikipedia.org/]
15217 !! result
15218 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
15219 </p>
15220 !! end
15221
15222 !! test
15223 Multibyte character in padleft
15224 !! input
15225 {{padleft:-Hello|7|Æ}}
15226 !! result
15227 <p>Æ-Hello
15228 </p>
15229 !! end
15230
15231 !! test
15232 Multibyte character in padright
15233 !! input
15234 {{padright:Hello-|7|Æ}}
15235 !! result
15236 <p>Hello-Æ
15237 </p>
15238 !! end
15239
15240 !!test
15241 formatdate parser function
15242 !!input
15243 {{#formatdate:2009-03-24}}
15244 !! result
15245 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
15246 </p>
15247 !! end
15248
15249 !!test
15250 formatdate parser function, with default format
15251 !!input
15252 {{#formatdate:2009-03-24|mdy}}
15253 !! result
15254 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
15255 </p>
15256 !! end
15257
15258 !! test
15259 Spacing of numbers in formatted dates
15260 !! input
15261 {{#formatdate:January 15}}
15262 !! result
15263 <p><span class="mw-formatted-date" title="01-15">January 15</span>
15264 </p>
15265 !! end
15266
15267 !! test
15268 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
15269 !! options
15270 language=nl title=[[MediaWiki:Common.css]]
15271 !! input
15272 {{#formatdate:2009-03-24|dmy}}
15273 !! result
15274 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
15275 </p>
15276 !! end
15277
15278 #
15279 #
15280 #
15281
15282 #
15283 # Edit comments
15284 #
15285
15286 !! test
15287 Edit comment with link
15288 !! options
15289 comment
15290 !! input
15291 I like the [[Main Page]] a lot
15292 !! result
15293 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
15294 !!end
15295
15296 !! test
15297 Edit comment with link and link text
15298 !! options
15299 comment
15300 !! input
15301 I like the [[Main Page|best pages]] a lot
15302 !! result
15303 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15304 !!end
15305
15306 !! test
15307 Edit comment with link and link text with suffix
15308 !! options
15309 comment
15310 !! input
15311 I like the [[Main Page|best page]]s a lot
15312 !! result
15313 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15314 !!end
15315
15316 !! test
15317 Edit comment with section link (non-local, eg in history list)
15318 !! options
15319 comment title=[[Main Page]]
15320 !! input
15321 /* External links */ removed bogus entries
15322 !! result
15323 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15324 !!end
15325
15326 !! test
15327 Edit comment with section link and text before it (non-local, eg in history list)
15328 !! options
15329 comment title=[[Main Page]]
15330 !! input
15331 pre-comment text /* External links */ removed bogus entries
15332 !! result
15333 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>
15334 !!end
15335
15336 !! test
15337 Edit comment with section link (local, eg in diff view)
15338 !! options
15339 comment local title=[[Main Page]]
15340 !! input
15341 /* External links */ removed bogus entries
15342 !! result
15343 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15344 !!end
15345
15346 !! test
15347 Edit comment with subpage link (bug 14080)
15348 !! options
15349 comment
15350 subpage
15351 title=[[Subpage test]]
15352 !! input
15353 Poked at a [[/subpage]] here...
15354 !! result
15355 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
15356 !!end
15357
15358 !! test
15359 Edit comment with subpage link and link text (bug 14080)
15360 !! options
15361 comment
15362 subpage
15363 title=[[Subpage test]]
15364 !! input
15365 Poked at a [[/subpage|neat little page]] here...
15366 !! result
15367 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
15368 !!end
15369
15370 !! test
15371 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
15372 !! options
15373 comment
15374 title=[[Subpage test]]
15375 !! input
15376 Poked at a [[/subpage]] here...
15377 !! result
15378 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...
15379 !!end
15380
15381 !! test
15382 Edit comment with bare anchor link (local, as on diff)
15383 !! options
15384 comment
15385 local
15386 title=[[Main Page]]
15387 !!input
15388 [[#section]]
15389 !! result
15390 <a href="#section">#section</a>
15391 !! end
15392
15393 !! test
15394 Edit comment with bare anchor link (non-local, as on history)
15395 !! options
15396 comment
15397 title=[[Main Page]]
15398 !!input
15399 [[#section]]
15400 !! result
15401 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
15402 !! end
15403
15404 !! test
15405 Anchor starting with underscore
15406 !!input
15407 [[#_ref|One]]
15408 !! result
15409 <p><a href="#_ref">One</a>
15410 </p>
15411 !! end
15412
15413 !! test
15414 Id starting with underscore
15415 !!input
15416 <div id="_ref"></div>
15417 !! result
15418 <div id="_ref"></div>
15419
15420 !! end
15421
15422 !! test
15423 Space normalisation on autocomment (bug 22784)
15424 !! options
15425 comment
15426 title=[[Main Page]]
15427 !!input
15428 /* __hello__world__ */
15429 !! result
15430 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
15431 !! end
15432
15433 !! test
15434 percent-encoding and + signs in comments (Bug 26410)
15435 !! options
15436 comment
15437 !!input
15438 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
15439 !! result
15440 <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>
15441 !! end
15442
15443 !! test
15444 Bad images - basic functionality
15445 !! options
15446 disabled
15447 !! input
15448 [[File:Bad.jpg]]
15449 !! result
15450 !! end
15451
15452 !! test
15453 Bad images - bug 16039: text after bad image disappears
15454 !! options
15455 disabled
15456 !! input
15457 Foo bar
15458 [[File:Bad.jpg]]
15459 Bar foo
15460 !! result
15461 <p>Foo bar
15462 </p><p>Bar foo
15463 </p>
15464 !! end
15465
15466 !! test
15467 Verify that displaytitle works (bug #22501) no displaytitle
15468 !! options
15469 showtitle
15470 !! config
15471 wgAllowDisplayTitle=true
15472 wgRestrictDisplayTitle=false
15473 !! input
15474 this is not the the title
15475 !! result
15476 Parser test
15477 <p>this is not the the title
15478 </p>
15479 !! end
15480
15481 !! test
15482 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
15483 !! options
15484 showtitle
15485 title=[[Screen]]
15486 !! config
15487 wgAllowDisplayTitle=true
15488 wgRestrictDisplayTitle=false
15489 !! input
15490 this is not the the title
15491 {{DISPLAYTITLE:whatever}}
15492 !! result
15493 whatever
15494 <p>this is not the the title
15495 </p>
15496 !! end
15497
15498 !! test
15499 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
15500 !! options
15501 showtitle
15502 title=[[Screen]]
15503 !! config
15504 wgAllowDisplayTitle=true
15505 wgRestrictDisplayTitle=true
15506 !! input
15507 this is not the the title
15508 {{DISPLAYTITLE:whatever}}
15509 !! result
15510 Screen
15511 <p>this is not the the title
15512 </p>
15513 !! end
15514
15515 !! test
15516 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
15517 !! options
15518 showtitle
15519 title=[[Screen]]
15520 !! config
15521 wgAllowDisplayTitle=true
15522 wgRestrictDisplayTitle=true
15523 !! input
15524 this is not the the title
15525 {{DISPLAYTITLE:screen}}
15526 !! result
15527 screen
15528 <p>this is not the the title
15529 </p>
15530 !! end
15531
15532 !! test
15533 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
15534 !! options
15535 showtitle
15536 title=[[Screen]]
15537 !! config
15538 wgAllowDisplayTitle=false
15539 !! input
15540 this is not the the title
15541 {{DISPLAYTITLE:screen}}
15542 !! result
15543 Screen
15544 <p>this is not the the title
15545 <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>
15546 </p>
15547 !! end
15548
15549 !! test
15550 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
15551 !! options
15552 showtitle
15553 title=[[Screen]]
15554 !! config
15555 wgAllowDisplayTitle=false
15556 !! input
15557 this is not the the title
15558 !! result
15559 Screen
15560 <p>this is not the the title
15561 </p>
15562 !! end
15563
15564 !! test
15565 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
15566 !! options
15567 showtitle
15568 title=[[Screen]]
15569 !! config
15570 wgAllowDisplayTitle=true
15571 wgRestrictDisplayTitle=true
15572 !! input
15573 this is not the the title
15574 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
15575 !! result
15576 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
15577 <p>this is not the the title
15578 </p>
15579 !! end
15580
15581 !! test
15582 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
15583 !! options
15584 showtitle
15585 title=[[Screen]]
15586 !! config
15587 wgAllowDisplayTitle=true
15588 wgRestrictDisplayTitle=true
15589 !! input
15590 this is not the the title
15591 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
15592 !! result
15593 <span style="color: red;">s</span>creen
15594 <p>this is not the the title
15595 </p>
15596 !! end
15597
15598 !! test
15599 preload: check <noinclude> and <includeonly>
15600 !! options
15601 preload
15602 !! input
15603 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
15604 !! result
15605 Hello kind world.
15606 !! end
15607
15608 !! test
15609 preload: check <onlyinclude>
15610 !! options
15611 preload
15612 !! input
15613 Goodbye <onlyinclude>Hello world</onlyinclude>
15614 !! result
15615 Hello world
15616 !! end
15617
15618 !! test
15619 preload: can pass tags through if we want to
15620 !! options
15621 preload
15622 !! input
15623 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
15624 !! result
15625 <includeonly>Hello world</includeonly>
15626 !! end
15627
15628 !! test
15629 preload: check that it doesn't try to do tricks
15630 !! options
15631 preload
15632 !! input
15633 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15634 !! result
15635 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15636 !! end
15637
15638 !! test
15639 Play a bit with r67090 and bug 3158
15640 !! options
15641 disabled
15642 !! input
15643 <div style="width:50% !important">&nbsp;</div>
15644 <div style="width:50%&nbsp;!important">&nbsp;</div>
15645 <div style="width:50%&#160;!important">&nbsp;</div>
15646 <div style="border : solid;">&nbsp;</div>
15647 !! result
15648 <div style="width:50% !important">&nbsp;</div>
15649 <div style="width:50% !important">&nbsp;</div>
15650 <div style="width:50% !important">&nbsp;</div>
15651 <div style="border&#160;: solid;">&nbsp;</div>
15652
15653 !! end
15654
15655 !! test
15656 HTML5 data attributes
15657 !! input
15658 <span data-foo="bar">Baz</span>
15659 <p data-abc-def_hij="">Quuz</p>
15660 !! result
15661 <p><span data-foo="bar">Baz</span>
15662 </p>
15663 <p data-abc-def_hij="">Quuz</p>
15664
15665 !! end
15666
15667 !! test
15668 percent-encoding and + signs in internal links (Bug 26410)
15669 !! input
15670 [[User:+%]] [[Page+title%]]
15671 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
15672 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
15673 [[%33%45]] [[%33%45+]]
15674 !! result
15675 <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>
15676 <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>
15677 <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>
15678 <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>
15679 </p>
15680 !! end
15681
15682 !! test
15683 Special characters in embedded file links (bug 27679)
15684 !! input
15685 [[File:Contains & ampersand.jpg]]
15686 [[File:Does not exist.jpg|Title with & ampersand]]
15687 !! result
15688 <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>
15689 <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>
15690 </p>
15691 !! end
15692
15693
15694 !! test
15695 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
15696 !! input
15697 Text&apos;s been normalized?
15698 !! result
15699 <p>Text&#39;s been normalized?
15700 </p>
15701 !! end
15702
15703 !! test
15704 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
15705 !! input
15706 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
15707 !! result
15708 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
15709 </p>
15710 !! end
15711
15712 !! test
15713 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
15714 !! input
15715 [http://www.example.org/ ideograms]
15716 !! result
15717 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
15718 </p>
15719 !! end
15720
15721 !! test
15722 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
15723 !! input
15724 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
15725 !! result
15726 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
15727 </p>
15728 !! end
15729
15730 !! article
15731 Mediawiki:loop1
15732 !! text
15733 {{Identical|A}}
15734 !! endarticle
15735
15736 !! article
15737 Mediawiki:loop2
15738 !! text
15739 {{Identical|B}}
15740 !! endarticle
15741
15742 !! article
15743 Template:Identical
15744 !! text
15745 {{int:loop1}}
15746 {{int:loop2}}
15747 !! endarticle
15748
15749 !! test
15750 Bug 31098 Template which includes system messages which includes the template
15751 !! input
15752 {{Identical}}
15753 !! result
15754 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15755 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15756 </p>
15757 !! end
15758
15759 !! test
15760 Bug31490 Turkish: ucfirst 'blah'
15761 !! options
15762 language=tr
15763 !! input
15764 {{ucfirst:blah}}
15765 !! result
15766 <p>Blah
15767 </p>
15768 !! end
15769
15770 !! test
15771 Bug31490 Turkish: ucfirst 'ix'
15772 !! options
15773 language=tr
15774 !! input
15775 {{ucfirst:ix}}
15776 !! result
15777 <p>İx
15778 </p>
15779 !! end
15780
15781 !! test
15782 Bug31490 Turkish: lcfirst 'BLAH'
15783 !! options
15784 language=tr
15785 !! input
15786 {{lcfirst:BLAH}}
15787 !! result
15788 <p>bLAH
15789 </p>
15790 !! end
15791
15792 !! test
15793 Bug31490 Turkish: ucfırst (with a dotless i)
15794 !! options
15795 language=tr
15796 !! input
15797 {{ucfırst:blah}}
15798 !! result
15799 <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>
15800 </p>
15801 !! end
15802
15803 !! test
15804 Bug31490 ucfırst (with a dotless i) with English language
15805 !! options
15806 language=en
15807 !! input
15808 {{ucfırst:blah}}
15809 !! result
15810 <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>
15811 </p>
15812 !! end
15813
15814 !! test
15815 Bug 26375: TOC with italics
15816 !! options
15817 title=[[Main Page]]
15818 !! input
15819 __TOC__
15820 == ''Lost'' episodes ==
15821 !! result
15822 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15823 <ul>
15824 <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>
15825 </ul>
15826 </div>
15827 <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>
15828
15829 !! end
15830
15831 !! test
15832 Bug 26375: TOC with bold
15833 !! options
15834 title=[[Main Page]]
15835 !! input
15836 __TOC__
15837 == '''should be bold''' then normal text ==
15838 !! result
15839 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15840 <ul>
15841 <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>
15842 </ul>
15843 </div>
15844 <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>
15845
15846 !! end
15847
15848 !! test
15849 Bug 33845: Headings become cursive in TOC when they contain an image
15850 !! options
15851 title=[[Main Page]]
15852 !! input
15853 __TOC__
15854 == Image [[Image:foobar.jpg]] ==
15855 !! result
15856 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15857 <ul>
15858 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15859 </ul>
15860 </div>
15861 <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>
15862
15863 !! end
15864
15865 !! test
15866 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15867 !! options
15868 title=[[Main Page]]
15869 !! input
15870 __TOC__
15871 == <blockquote>Quote</blockquote> ==
15872 !! result
15873 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15874 <ul>
15875 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15876 </ul>
15877 </div>
15878 <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>
15879
15880 !! end
15881
15882 !! test
15883 Unclosed tags in TOC
15884 !! options
15885 title=[[Main Page]]
15886 !! input
15887 __TOC__
15888 == Proof: 2 < 3 ==
15889 <small>Hanc marginis exiguitas non caperet.</small>
15890 QED
15891 !! result
15892 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15893 <ul>
15894 <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>
15895 </ul>
15896 </div>
15897 <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>
15898 <p><small>Hanc marginis exiguitas non caperet.</small>
15899 QED
15900 </p>
15901 !! end
15902
15903 !! test
15904 Multiple tags in TOC
15905 !! input
15906 __TOC__
15907 == <i>Foo</i> <b>Bar</b> ==
15908
15909 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15910 !! result
15911 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15912 <ul>
15913 <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>
15914 <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>
15915 </ul>
15916 </div>
15917 <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>
15918 <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>
15919
15920 !! end
15921
15922 !! test
15923 Tags with parameters in TOC
15924 !! input
15925 __TOC__
15926 == <sup class="in-h2">Hello</sup> ==
15927
15928 == <sup class="a > b">Evilbye</sup> ==
15929 !! result
15930 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15931 <ul>
15932 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15933 <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>
15934 </ul>
15935 </div>
15936 <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>
15937 <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>
15938
15939 !! end
15940
15941 !! test
15942 span tags with directionality in TOC
15943 !! input
15944 __TOC__
15945 == <span dir="ltr">C++</span> ==
15946
15947 == <span dir="rtl">זבנג!</span> ==
15948
15949 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15950
15951 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15952
15953 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15954 !! result
15955 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15956 <ul>
15957 <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>
15958 <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>
15959 <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>
15960 <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>
15961 <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>
15962 </ul>
15963 </div>
15964 <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>
15965 <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>
15966 <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>
15967 <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>
15968 <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>
15969
15970 !! end
15971
15972 !! article
15973 MediaWiki:Bug32057
15974 !! text
15975 == {{int:headline_sample}} ==
15976 !! endarticle
15977
15978 !! test
15979 Bug 32057: Title needed when expanding <h> nodes.
15980 !! options
15981 title=[[Main Page]]
15982 !! input
15983 {{int:Bug32057}}
15984 !! result
15985 <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>
15986
15987 !! end
15988
15989 !! test
15990 Strip marker in urlencode
15991 !! input
15992 {{urlencode:x<nowiki/>y}}
15993 {{urlencode:x<nowiki/>y|wiki}}
15994 {{urlencode:x<nowiki/>y|path}}
15995 !! result
15996 <p>xy
15997 xy
15998 xy
15999 </p>
16000 !! end
16001
16002 !! test
16003 Strip marker in lc
16004 !! input
16005 {{lc:x<nowiki/>y}}
16006 !! result
16007 <p>xy
16008 </p>
16009 !! end
16010
16011 !! test
16012 Strip marker in uc
16013 !! input
16014 {{uc:x<nowiki/>y}}
16015 !! result
16016 <p>XY
16017 </p>
16018 !! end
16019
16020 !! test
16021 Strip marker in formatNum
16022 !! input
16023 {{formatnum:1<nowiki/>2}}
16024 {{formatnum:1<nowiki/>2|R}}
16025 !! result
16026 <p>12
16027 12
16028 </p>
16029 !! end
16030
16031 !! test
16032 Check noCommafy in formatNum
16033 !! options
16034 language=be-tarask
16035 !! input
16036 {{formatnum:123456.78}}
16037 {{formatnum:123456.78|NOSEP}}
16038 !! result
16039 <p>123 456,78
16040 123456.78
16041 </p>
16042 !! end
16043
16044 !! test
16045 Strip marker in grammar
16046 !! options
16047 language=fi
16048 !! input
16049 {{grammar:elative|foo<nowiki/>bar}}
16050 !! result
16051 <p>foobarista
16052 </p>
16053 !! end
16054
16055 !! test
16056 Strip marker in padleft
16057 !! input
16058 {{padleft:|2|x<nowiki/>y}}
16059 !! result
16060 <p>xy
16061 </p>
16062 !! end
16063
16064 !! test
16065 Strip marker in padright
16066 !! input
16067 {{padright:|2|x<nowiki/>y}}
16068 !! result
16069 <p>xy
16070 </p>
16071 !! end
16072
16073 !! test
16074 Strip marker in anchorencode
16075 !! input
16076 {{anchorencode:x<nowiki/>y}}
16077 !! result
16078 <p>xy
16079 </p>
16080 !! end
16081
16082 !! test
16083 nowiki inside link inside heading (bug 18295)
16084 !! input
16085 ==[[foo|x<nowiki>y</nowiki>z]]==
16086 !! result
16087 <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>
16088
16089 !! end
16090
16091 !! test
16092 new support for bdi element (bug 31817)
16093 !! input
16094 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16095 !! result
16096 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16097
16098 !!end
16099
16100 !! test
16101 Ignore pipe between table row attributes
16102 !! input
16103 {|
16104 | quux
16105 |- id=foo | style='color: red'
16106 | bar
16107 |}
16108 !! result
16109 <table>
16110 <tr>
16111 <td> quux
16112 </td></tr>
16113 <tr id="foo" style="color: red">
16114 <td> bar
16115 </td></tr></table>
16116
16117 !! end
16118
16119 !!test
16120 Gallery override link with WikiLink (bug 34852)
16121 !! input
16122 <gallery>
16123 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
16124 </gallery>
16125 !! result
16126 <ul class="gallery mw-gallery-traditional">
16127 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16128 <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>
16129 <div class="gallerytext">
16130 <p>caption
16131 </p>
16132 </div>
16133 </div></li>
16134 </ul>
16135
16136 !! end
16137
16138 !!test
16139 Gallery override link with absolute external link (bug 34852)
16140 !! input
16141 <gallery>
16142 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
16143 </gallery>
16144 !! result
16145 <ul class="gallery mw-gallery-traditional">
16146 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16147 <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>
16148 <div class="gallerytext">
16149 <p>caption
16150 </p>
16151 </div>
16152 </div></li>
16153 </ul>
16154
16155 !! end
16156
16157 !!test
16158 Gallery override link with malicious javascript (bug 34852)
16159 !! input
16160 <gallery>
16161 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
16162 </gallery>
16163 !! result
16164 <ul class="gallery mw-gallery-traditional">
16165 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16166 <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>
16167 <div class="gallerytext">
16168 <p>caption
16169 </p>
16170 </div>
16171 </div></li>
16172 </ul>
16173
16174 !! end
16175
16176 !!test
16177 Gallery with invalid title as link (bug 43964)
16178 !! input
16179 <gallery>
16180 File:foobar.jpg|link=<
16181 </gallery>
16182 !! result
16183 <ul class="gallery mw-gallery-traditional">
16184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16185 <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>
16186 <div class="gallerytext">
16187 </div>
16188 </div></li>
16189 </ul>
16190
16191 !! end
16192
16193 !!test
16194 Language parser function
16195 !! input
16196 {{#language:ar}}
16197 !! result
16198 <p>العربية
16199 </p>
16200 !! end
16201
16202 !!test
16203 Padleft and padright as substr
16204 !! input
16205 {{padleft:|3|abcde}}
16206 {{padright:|3|abcde}}
16207 !! result
16208 <p>abc
16209 abc
16210 </p>
16211 !! end
16212
16213 !!test
16214 Special parser function
16215 !! input
16216 {{#special:RandomPage}}
16217 {{#special:BaDtItLe}}
16218 {{#special:Foobar}}
16219 !! result
16220 <p>Special:Random
16221 Special:Badtitle
16222 Special:Foobar
16223 </p>
16224 !! end
16225
16226 !!test
16227 Bug 34939 - Case insensitive link parsing ([HttP://])
16228 !! input
16229 [HttP://MediaWiki.Org/]
16230 !! result
16231 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
16232 </p>
16233 !! end
16234
16235 !!test
16236 Bug 34939 - Case insensitive link parsing ([HttP:// title])
16237 !! input
16238 [HttP://MediaWiki.Org/ MediaWiki]
16239 !! result
16240 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
16241 </p>
16242 !! end
16243
16244 !!test
16245 Bug 34939 - Case insensitive link parsing (HttP://)
16246 !! input
16247 HttP://MediaWiki.Org/
16248 !! result
16249 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
16250 </p>
16251 !! end
16252
16253
16254 ###
16255 ### Parsoids-specific tests
16256 ### Parsoid-PHP parser incompatibilities
16257 ###
16258 !!test
16259 1. SOL-sensitive wikitext tokens as template-args
16260 !!options
16261 parsoid=wt2html,wt2wt
16262 !!input
16263 {{echo|*a}}
16264 {{echo|#a}}
16265 {{echo|:a}}
16266 !!result
16267 <span about="#mwt1" typeof="mw:Transclusion">
16268 </span><ul about="#mwt1"><li>a</li>
16269 </ul>
16270 <span about="#mwt2" typeof="mw:Transclusion">
16271 </span><ol about="#mwt2"><li>a</li>
16272 </ol>
16273 <span about="#mwt3" typeof="mw:Transclusion">
16274 </span><dl about="#mwt3"><dd>a</dd>
16275 </dl>
16276 !!end
16277
16278 #### ----------------------------------------------------------------
16279 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
16280 #### tags. Parsoid's output for these tags differs from that of the
16281 #### PHP parser.
16282 #### ----------------------------------------------------------------
16283
16284 !!test
16285 Ref: 1. ref-location should be replaced with an index span
16286 !!options
16287 parsoid
16288 !!input
16289 A <ref>foo</ref>
16290 B <ref name="x">foo</ref>
16291 C <ref name="y" />
16292 !!result
16293 <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>
16294 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>
16295 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>
16296 !!end
16297
16298 !!test
16299 Ref: 2. ref-tags with identical names should all get the same index
16300 !!options
16301 parsoid
16302 !!input
16303 A <ref name="x">foo</ref>
16304 B <ref name="x" />
16305 !!result
16306 <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>
16307 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>
16308 !!end
16309
16310 !!test
16311 Ref: 3. spaces in ref-names should be ignored
16312 !!options
16313 parsoid
16314 !!input
16315 A <ref name="x">foo</ref>
16316 B <ref name=" x " />
16317 C <ref name= x />
16318 !!result
16319 <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>
16320 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>
16321 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>
16322 !!end
16323
16324 !!test
16325 Ref: 4. 'constructor' should be accepted as a valid ref-name
16326 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
16327 !!options
16328 parsoid
16329 !!input
16330 A <ref name="constructor">foo</ref>
16331 !!result
16332 <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>
16333 !!end
16334
16335 !!test
16336 Ref: 5. body should accept generic wikitext
16337 !!options
16338 parsoid
16339 !!input
16340 A <ref>
16341 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
16342 </ref>
16343
16344 <references />
16345 !!result
16346 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"This is a <b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[19,40,3,3]}\"><a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bolded_link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bolded link&amp;quot;},&amp;quot;dsr&amp;quot;:[22,37,2,2]}\">bolded link</a></b> and this is a <span about=\"#mwt5\" 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;transclusion&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[55,76,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;]}]]}\">transclusion</span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
16347
16348 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'>
16349 <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>
16350 </li>
16351 </ol>
16352 !!end
16353
16354 !!test
16355 Ref: 6. indent-pres should not be output in ref-body
16356 !!options
16357 parsoid
16358 !!input
16359 A <ref>
16360 foo
16361 bar
16362 baz
16363 </ref>
16364
16365 <references />
16366 !!result
16367 <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>
16368
16369 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
16370 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
16371 bar
16372 baz
16373 </li>
16374 </ol>
16375 !!end
16376
16377 !!test
16378 Ref: 7. No p-wrapping in ref-body
16379 !!options
16380 parsoid
16381 !!input
16382 A <ref>
16383 foo
16384
16385 bar
16386
16387
16388 baz
16389
16390
16391
16392 booz
16393 </ref>
16394
16395 <references />
16396 !!result
16397 <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>
16398
16399 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16400 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
16401
16402 bar
16403
16404
16405 baz
16406
16407
16408
16409 booz
16410 </li>
16411 </ol>
16412 !!end
16413
16414 !!test
16415 Ref: 8. transclusion wikitext has lower precedence
16416 !!options
16417 parsoid
16418 !!input
16419 A <ref> foo {{echo|</ref> B C}}
16420
16421 <references />
16422 !!result
16423 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{&amp;quot;,&amp;quot;dsr&amp;quot;:[12,14,0,0]}\">{{</span>echo|"},"attrs":{}}' 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>
16424
16425 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16426 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
16427 </ol>
16428 !!end
16429
16430 !!test
16431 Ref: 9. unclosed comments should not leak out of ref-body
16432 !!options
16433 parsoid
16434 !!input
16435 A <ref> foo <!--</ref> B C
16436
16437 <references />
16438 !!result
16439 <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> B C</p>
16440
16441 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16442 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
16443 </ol>
16444 !!end
16445
16446 !!test
16447 Ref: 10. Unclosed HTML tags should not leak out of ref-body
16448 !!options
16449 parsoid
16450 !!input
16451 A <ref> <b> foo </ref> B C
16452
16453 <references />
16454 !!result
16455 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"<b data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;autoInsertedEnd&amp;quot;:true,&amp;quot;dsr&amp;quot;:[8,16,3,0]}\"> foo </b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
16456
16457 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16458 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li>
16459 </ol>
16460 !!end
16461
16462 !!test
16463 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
16464 !!options
16465 parsoid
16466 !!input
16467 A <ref>foo</ref> B
16468 C <ref>bar</ref> D
16469 !!result
16470 <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> B
16471 C <span about="#mwt2" 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">[2]</a></span> D</p>
16472 !!end
16473
16474 !!test
16475 Ref: 12. ref-tags act as trailing newline migration barrier
16476 !!options
16477 parsoid
16478 !!input
16479 <!--the newline at the end of this line moves out of the p-tag-->a
16480
16481 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
16482 <ref />
16483
16484 c
16485 !!result
16486 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
16487
16488
16489 <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>
16490 <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>
16491
16492
16493 <p>c</p>
16494 !!end
16495
16496 !!test
16497 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
16498 !!options
16499 parsoid
16500 !!input
16501 <ref>foo</ref> A
16502 <ref>bar
16503 </ref> B
16504 !!result
16505 <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
16506 <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>
16507 !!end
16508
16509 !!test
16510 Ref: 14. A nested ref-tag should be emitted as plain text
16511 !!options
16512 parsoid
16513 !!input
16514 <ref>foo <ref>bar</ref> baz</ref>
16515
16516 <references />
16517 !!result
16518 <p><span about="#mwt1" class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo &amp;lt;ref&amp;gt;bar&amp;lt;/ref&amp;gt; baz&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
16519
16520 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
16521 <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&gt;bar&lt;/ref&gt; baz</li>
16522 </ol>
16523 !!end
16524
16525 !!test
16526 Ref: 15. ref-tags with identical names should get identical indexes
16527 !!options
16528 parsoid
16529 !!input
16530 A1 <ref name="a">foo</ref> A2 <ref name="a" />
16531 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
16532
16533 <references />
16534 !!result
16535 <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>
16536 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>
16537
16538 <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>
16539 </ol>
16540 !!end
16541
16542 !!test
16543 References: 1. references tag without any refs should be handled properly
16544 !!options
16545 parsoid
16546 !!input
16547 <references />
16548 !!result
16549 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
16550 !!end
16551
16552 !!test
16553 References: 2. references tag with group only outputs references from that group
16554 !!options
16555 parsoid
16556 !!input
16557 A <ref group="a">foo</ref>
16558 B <ref group="b">bar</ref>
16559
16560 <references group='a' />
16561 !!result
16562 <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>
16563 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[b 1]</a></span></p>
16564
16565 <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>
16566 </ol>
16567 !!end
16568
16569 !!test
16570 References: 3. ref list should be cleared after processing references
16571 !!options
16572 parsoid
16573 !!input
16574 A <ref>foo</ref>
16575
16576 <references />
16577
16578 B <ref>bar</ref>
16579
16580 <references />
16581 !!result
16582 <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>
16583
16584 <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>
16585 </ol>
16586
16587 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
16588
16589 <ol about="#mwt8" 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> bar</li>
16590 </ol>
16591 !!end
16592
16593 !!test
16594 References: 4. only referenced group should be cleared after processing references
16595 !!options
16596 parsoid
16597 !!input
16598 A <ref group="a">afoo</ref>
16599 B <ref>bfoo</ref>
16600
16601 <references group="a"/>
16602
16603 C <ref>cfoo</ref>
16604
16605 <references />
16606 !!result
16607 <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>
16608 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>","dsr":[30,45,5,6]}'><a href="#cite_note-1">[1]</a></span></p>
16609
16610 <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>
16611 </ol>
16612
16613 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
16614
16615 <ol about="#mwt10" 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> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li>
16616 </ol>
16617 !!end
16618
16619 !!test
16620 References: 5. ref tags in references should be processed while ignoring all other content
16621 !!options
16622 parsoid
16623 !!input
16624 A <ref name="a" />
16625 B <ref name="b">bar</ref>
16626
16627 <references>
16628 <ref name="a">foo</ref>
16629 This should just get lost.
16630 </references>
16631 !!result
16632 <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"><a href="#cite_note-a-1">[1]</a></span>
16633 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"><a href="#cite_note-b-2">[2]</a></span></p>
16634
16635 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"\n<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</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">↑</a></span> bar</li>
16636 </ol>
16637 !!end
16638
16639 !!test
16640 References: 6. <references /> from a transclusion
16641 !!options
16642 parsoid
16643 !!input
16644 {{echo|<references />}}
16645 !!result
16646 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}}]}'></ol>
16647 !!end
16648
16649 !! test
16650 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
16651 !! options
16652 parsoid
16653 !! input
16654 A <ref>foo bar for a</ref>
16655 B <ref name="b" />
16656
16657 <references />
16658
16659 <references>
16660 <ref name="b">foo</ref>
16661 </references>
16662 !! result
16663 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
16664 B <span about="#mwt4" 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></p>
16665
16666 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
16667 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</li>
16668 <li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> </li>
16669 </ol>
16670
16671 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;b&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-1\">[1]</a></span>\n"},"attrs":{}}'>
16672 <li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li>
16673 </ol>
16674 !! end
16675
16676 #### ----------------------------------------------------------------
16677 #### The following section of tests are primarily to test
16678 #### wikitext escaping capabilities of Parsoid. Given that
16679 #### escaping can be done any number of ways, the wikitext (input)
16680 #### is always adjusted to reflect how Parsoid adds nowiki
16681 #### escape tags.
16682 ####
16683 #### We are marking several tests as parsoid-only since the
16684 #### HTML in the result section is different from what the
16685 #### PHP parser generates for it.
16686 #### ----------------------------------------------------------------
16687
16688
16689 #### --------------- Headings ---------------
16690 #### 0. Unnested
16691 #### 1. Nested inside html <h1>=foo=</h1>
16692 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
16693 #### 3. Nested inside html with wikitext split by html tags
16694 #### 4. No escape needed
16695 #### 5. Empty headings <h1></h1>
16696 #### 6. Heading chars in SOL context
16697 #### ----------------------------------------
16698 !! test
16699 Headings: 0. Unnested
16700 !! options
16701 parsoid
16702 !! input
16703 <nowiki>=foo=</nowiki>
16704
16705 <nowiki> =foo= </nowiki>
16706 <!--cmt-->
16707 <nowiki>=foo=</nowiki>
16708
16709 =foo''a''<nowiki>=</nowiki>
16710 !! result
16711 <p><span typeof="mw:Nowiki">=foo=</span></p>
16712
16713 <p><span typeof="mw:Nowiki"> =foo= </span>
16714 <!--cmt-->
16715 <span typeof="mw:Nowiki">=foo=</span></p>
16716
16717 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
16718 !!end
16719
16720 !! test
16721 Headings: 1. Nested inside html
16722 !! options
16723 parsoid
16724 !! input
16725 =<nowiki>=foo=</nowiki>=
16726
16727 ==<nowiki>=foo=</nowiki>==
16728
16729 ===<nowiki>=foo=</nowiki>===
16730
16731 ====<nowiki>=foo=</nowiki>====
16732
16733 =====<nowiki>=foo=</nowiki>=====
16734
16735 ======<nowiki>=foo=</nowiki>======
16736 !! result
16737 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
16738 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
16739 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
16740 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
16741 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
16742 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
16743 !!end
16744
16745 !! test
16746 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
16747 !! options
16748 parsoid
16749 !! input
16750 =foo=
16751 <nowiki>*</nowiki>bar
16752
16753 =foo=
16754 =bar
16755
16756 =foo=
16757 <nowiki>=bar=</nowiki>
16758 !! result
16759 <h1>foo</h1>*bar
16760 <h1>foo</h1>=bar
16761 <h1>foo</h1>=bar=
16762 !!end
16763
16764 !! test
16765 Headings: 3. Nested inside html with wikitext split by html tags
16766 !! options
16767 parsoid
16768 !! input
16769 =='''bold'''<nowiki>foo=</nowiki>=
16770 !! result
16771 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
16772 !!end
16773
16774 !! test
16775 Headings: 4a. No escaping needed (testing just h1 and h2)
16776 !! options
16777 parsoid
16778 !! input
16779 ==foo=
16780
16781 =foo==
16782
16783 = =foo= =
16784
16785 ==foo= bar=
16786
16787 ===foo==
16788
16789 ==foo===
16790
16791 =''=''foo==
16792
16793 =<nowiki>=</nowiki>=
16794 !! result
16795 <h1>=foo</h1>
16796 <h1>foo=</h1>
16797 <h1> =foo= </h1>
16798 <h1>=foo= bar</h1>
16799 <h2>=foo</h2>
16800 <h2>foo=</h2>
16801 <h1><i>=</i>foo=</h1>
16802 <h1><span typeof="mw:Nowiki">=</span></h1>
16803 !!end
16804
16805 !! test
16806 Headings: 4b. No escaping needed (inside p-tags)
16807 !! options
16808 parsoid
16809 !! input
16810 ===
16811 =foo= x
16812 =foo= <s></s>
16813 !! result
16814 <p>===
16815 =foo= x
16816 =foo= <s></s>
16817 </p>
16818 !!end
16819
16820 !! test
16821 Headings: 5. Empty headings
16822 !! options
16823 parsoid
16824 !! input
16825 =<nowiki/>=
16826
16827 ==<nowiki/>==
16828
16829 ===<nowiki/>===
16830
16831 ====<nowiki/>====
16832
16833 =====<nowiki/>=====
16834
16835 ======<nowiki/>======
16836 !! result
16837 <h1></h1>
16838 <h2></h2>
16839 <h3></h3>
16840 <h4></h4>
16841 <h5></h5>
16842 <h6></h6>
16843 !!end
16844
16845 !! test
16846 Headings: 6a. Heading chars in SOL context (with trailing spaces)
16847 !! options
16848 parsoid
16849 !! input
16850 <nowiki>=a=</nowiki>
16851
16852 <nowiki>=a=</nowiki>
16853
16854 <nowiki>=a=</nowiki>
16855
16856 <nowiki>=a=</nowiki>
16857 !! result
16858 <p>=a=</p>
16859 <p>=a= </p>
16860 <p>=a= </p>
16861 <p>=a= </p>
16862 !!end
16863
16864 !! test
16865 Headings: 6b. Heading chars in SOL context (with trailing newlines)
16866 !! options
16867 parsoid
16868 !! input
16869 <nowiki>=a=
16870 b</nowiki>
16871
16872 <nowiki>=a=
16873 b</nowiki>
16874
16875 <nowiki>=a=
16876 b</nowiki>
16877
16878 <nowiki>=a=
16879 b</nowiki>
16880 !! result
16881 <p>=a=
16882 b</p>
16883 <p>=a=
16884 b</p>
16885 <p>=a=
16886 b</p>
16887 <p>=a=
16888 b</p>
16889 </p>
16890 !!end
16891
16892 !! test
16893 Headings: 6c. Heading chars in SOL context (leading newline break)
16894 !! options
16895 parsoid
16896 !! input
16897 a
16898 <nowiki>=b=</nowiki>
16899 !! result
16900 <p>a
16901 =b=</p>
16902 !!end
16903
16904 !! test
16905 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16906 !! options
16907 parsoid
16908 !! input
16909 <!--c0--><nowiki>=a=</nowiki>
16910 <!--c1-->
16911 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16912 !! result
16913 <p><!--c0-->=a=</p>
16914 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16915 !!end
16916
16917 !! test
16918 Headings: 6d. Heading chars in SOL context (No escaping needed)
16919 !! options
16920 parsoid=html2wt
16921 !! input
16922 =a=<div>b</div>
16923 !! result
16924 =a=<div>b</div>
16925 !!end
16926
16927 #### --------------- Lists ---------------
16928 #### 0. Outside nests (*foo, etc.)
16929 #### 1. Nested inside html <ul><li>*foo</li></ul>
16930 #### 2. Inside definition lists
16931 #### 3. Only bullets at start should be escaped
16932 #### 4. No escapes needed
16933 #### 5. No unnecessary escapes
16934 #### 6. Escape bullets in SOL position
16935 #### 7. Escape bullets in a multi-line context
16936 #### ----------------------------------------
16937
16938 !! test
16939 Lists: 0. Outside nests
16940 !! input
16941 <nowiki>*</nowiki>foo
16942
16943 <nowiki>#</nowiki>foo
16944 !! result
16945 <p>*foo
16946 </p><p>#foo
16947 </p>
16948 !!end
16949
16950 !! test
16951 Lists: 1. Nested inside html
16952 !! input
16953 *<nowiki>*foo</nowiki>
16954
16955 *<nowiki>#foo</nowiki>
16956
16957 *<nowiki>:foo</nowiki>
16958
16959 *<nowiki>;foo</nowiki>
16960
16961 #<nowiki>*foo</nowiki>
16962
16963 #<nowiki>#foo</nowiki>
16964
16965 #<nowiki>:foo</nowiki>
16966
16967 #<nowiki>;foo</nowiki>
16968 !! result
16969 <ul>
16970 <li>*foo
16971 </li>
16972 </ul>
16973 <ul>
16974 <li>#foo
16975 </li>
16976 </ul>
16977 <ul>
16978 <li>:foo
16979 </li>
16980 </ul>
16981 <ul>
16982 <li>;foo
16983 </li>
16984 </ul>
16985 <ol>
16986 <li>*foo
16987 </li>
16988 </ol>
16989 <ol>
16990 <li>#foo
16991 </li>
16992 </ol>
16993 <ol>
16994 <li>:foo
16995 </li>
16996 </ol>
16997 <ol>
16998 <li>;foo
16999 </li>
17000 </ol>
17001
17002 !!end
17003
17004 !! test
17005 Lists: 2. Inside definition lists
17006 !! input
17007 ;<nowiki>;foo</nowiki>
17008
17009 ;<nowiki>:foo</nowiki>
17010
17011 ;<nowiki>:foo</nowiki>
17012 :bar
17013
17014 :<nowiki>:foo</nowiki>
17015 !! result
17016 <dl>
17017 <dt>;foo
17018 </dt>
17019 </dl>
17020 <dl>
17021 <dt>:foo
17022 </dt>
17023 </dl>
17024 <dl>
17025 <dt>:foo
17026 </dt>
17027 <dd>bar
17028 </dd>
17029 </dl>
17030 <dl>
17031 <dd>:foo
17032 </dd>
17033 </dl>
17034
17035 !!end
17036
17037 !! test
17038 Lists: 3. Only bullets at start of text should be escaped
17039 !! input
17040 *<nowiki>*foo*bar</nowiki>
17041
17042 *<nowiki>*foo</nowiki>''it''*bar
17043 !! result
17044 <ul>
17045 <li>*foo*bar
17046 </li>
17047 </ul>
17048 <ul>
17049 <li>*foo<i>it</i>*bar
17050 </li>
17051 </ul>
17052
17053 !!end
17054
17055 !! test
17056 Lists: 4. No escapes needed
17057 !! options
17058 parsoid
17059 !! input
17060 *foo*bar
17061
17062 *''foo''*bar
17063
17064 *[[Foo]]: bar
17065 !! result
17066 <ul>
17067 <li>foo*bar
17068 </li>
17069 </ul>
17070 <ul>
17071 <li><i>foo</i>*bar
17072 </li>
17073 </ul>
17074 <ul>
17075 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
17076 </li>
17077 </ul>
17078 !!end
17079
17080 !! test
17081 Lists: 5. No unnecessary escapes
17082 !! input
17083 * bar <span><nowiki>[[foo]]</nowiki></span>
17084
17085 *=bar <span><nowiki>[[foo]]</nowiki></span>
17086
17087 *[[bar <span><nowiki>[[foo]]</nowiki></span>
17088
17089 *]]bar <span><nowiki>[[foo]]</nowiki></span>
17090
17091 *=bar <span>foo]]</span>=
17092
17093 * <s></s>: a
17094 !! result
17095 <ul>
17096 <li> bar <span>[[foo]]</span>
17097 </li>
17098 </ul>
17099 <ul>
17100 <li>=bar <span>[[foo]]</span>
17101 </li>
17102 </ul>
17103 <ul>
17104 <li>[[bar <span>[[foo]]</span>
17105 </li>
17106 </ul>
17107 <ul>
17108 <li>]]bar <span>[[foo]]</span>
17109 </li>
17110 </ul>
17111 <ul>
17112 <li>=bar <span>foo]]</span>=
17113 </li>
17114 </ul>
17115 <ul>
17116 <li> <s></s>: a
17117 </li>
17118 </ul>
17119
17120 !!end
17121
17122 !! test
17123 Lists: 6. Escape bullets in SOL position
17124 !! options
17125 parsoid
17126 !! input
17127 <!--cmt--><nowiki>*foo</nowiki>
17128 !! result
17129 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
17130 !!end
17131
17132 !! test
17133 Lists: 7. Escape bullets in a multi-line context
17134 !! input
17135 a
17136 <nowiki>*</nowiki>b
17137 !! result
17138 <p>a
17139 *b
17140 </p>
17141 !!end
17142
17143 #### --------------- HRs ---------------
17144 #### 1. Single line
17145 #### -----------------------------------
17146
17147 !! test
17148 HRs: 1. Single line
17149 !! options
17150 parsoid
17151 !! input
17152 ----<nowiki>----</nowiki>
17153 ----=foo=
17154 ----*foo
17155 !! result
17156 <hr><span typeof="mw:Nowiki">----</span>
17157 <hr>=foo=
17158 <hr>*foo
17159 !! end
17160
17161 #### --------------- Tables ---------------
17162 #### 1a. Simple example
17163 #### 1b. No escaping needed (!foo)
17164 #### 1c. No escaping needed (|foo)
17165 #### 1d. No escaping needed (|}foo)
17166 ####
17167 #### 2a. Nested in td (<td>foo|bar</td>)
17168 #### 2b. Nested in td (<td>foo||bar</td>)
17169 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
17170 ####
17171 #### 3a. Nested in th (<th>foo!bar</th>)
17172 #### 3b. Nested in th (<th>foo!!bar</th>)
17173 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
17174 ####
17175 #### 4a. Escape -
17176 #### 4b. Escape +
17177 #### 4c. No escaping needed
17178 #### --------------------------------------
17179
17180 !! test
17181 Tables: 1a. Simple example
17182 !! input
17183 <nowiki>{|
17184 |}</nowiki>
17185 !! result
17186 <p>{|
17187 |}
17188 </p>
17189 !! end
17190
17191 !! test
17192 Tables: 1b. No escaping needed
17193 !! input
17194 !foo
17195 !! result
17196 <p>!foo
17197 </p>
17198 !! end
17199
17200 !! test
17201 Tables: 1c. No escaping needed
17202 !! input
17203 |foo
17204 !! result
17205 <p>|foo
17206 </p>
17207 !! end
17208
17209 !! test
17210 Tables: 1d. No escaping needed
17211 !! input
17212 |}foo
17213 !! result
17214 <p>|}foo
17215 </p>
17216 !! end
17217
17218 !! test
17219 Tables: 2a. Nested in td
17220 !! options
17221 parsoid
17222 !! input
17223 {|
17224 |<nowiki>foo|bar</nowiki>
17225 |}
17226 !! result
17227 <table><tbody><tr>
17228 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
17229 !! end
17230
17231 !! test
17232 Tables: 2b. Nested in td
17233 !! options
17234 parsoid
17235 !! input
17236 {|
17237 |<nowiki>foo||bar</nowiki>
17238 |''it''<nowiki>foo||bar</nowiki>
17239 |}
17240 !! result
17241 <table><tbody><tr>
17242 <td><span typeof="mw:Nowiki">foo||bar</span></td>
17243 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
17244 !! end
17245
17246 !! test
17247 Tables: 2c. Nested in td -- no escaping needed
17248 !! options
17249 parsoid
17250 !! input
17251 {|
17252 |foo!!bar
17253 |}
17254 !! result
17255 <table><tbody><tr><td>foo!!bar
17256 </td></tr></tbody></table>
17257
17258 !! end
17259
17260 !! test
17261 Tables: 3a. Nested in th
17262 !! options
17263 parsoid
17264 !! input
17265 {|
17266 !foo!bar
17267 |}
17268 !! result
17269 <table><tbody><tr><th>foo!bar
17270 </th></tr></tbody></table>
17271
17272 !! end
17273
17274 !! test
17275 Tables: 3b. Nested in th
17276 !! options
17277 parsoid
17278 !! input
17279 {|
17280 !<nowiki>foo!!bar</nowiki>
17281 |}
17282 !! result
17283 <table>
17284 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
17285 </tbody></table>
17286 !! end
17287
17288 !! test
17289 Tables: 3c. Nested in th -- no escaping needed
17290 !! options
17291 parsoid
17292 !! input
17293 {|
17294 !<nowiki>foo||bar</nowiki>
17295 |}
17296 !! result
17297 <table><tbody><tr>
17298 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
17299 !! end
17300
17301 !! test
17302 Tables: 4a. Escape -
17303 !! options
17304 parsoid
17305 !! input
17306 {|
17307 !-bar
17308 |-
17309 |<nowiki>-bar</nowiki>
17310 |}
17311 !! result
17312 <table><tbody>
17313 <tr><th>-bar</th></tr>
17314 <tr>
17315 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
17316 !! end
17317
17318 !! test
17319 Tables: 4b. Escape +
17320 !! options
17321 parsoid
17322 !! input
17323 {|
17324 !+bar
17325 |-
17326 |<nowiki>+bar</nowiki>
17327 |}
17328 !! result
17329 <table><tbody>
17330 <tr><th>+bar</th></tr>
17331 <tr>
17332 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
17333 !! end
17334
17335 !! test
17336 Tables: 4c. No escaping needed
17337 !! options
17338 parsoid
17339 !! input
17340 {|
17341 |foo-bar
17342 |foo+bar
17343 |-
17344 |''foo''-bar
17345 |''foo''+bar
17346 |-
17347 |foo
17348 bar|baz
17349 +bar
17350 -bar
17351 |}
17352 !! result
17353 <table><tbody>
17354 <tr><td>foo-bar</td><td>foo+bar</td></tr>
17355 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
17356 <tr><td>foo
17357 <p>bar|baz
17358 +bar
17359 -bar</p></td></tr>
17360 </tbody></table>
17361 !! end
17362
17363 ### SSS FIXME: Disabled right now because accurate html2wt
17364 ### on this snippet requires data-parsoid flags that we've
17365 ### stripped out of these tests. We should scheme how we
17366 ### we want to handle these kind of tests that require
17367 ### data-parsoid flags for accurate html2wt serialization
17368
17369 !! test
17370 Tables: 4d. No escaping needed
17371 !! options
17372 disabled
17373 !! input
17374 {|
17375 ||+1
17376 ||-2
17377 |}
17378 !! result
17379 <table>
17380 <tr>
17381 <td>+1
17382 </td>
17383 <td>-2
17384 </td></tr></table>
17385
17386 !! end
17387
17388 #### --------------- Links ----------------
17389 #### 1. Quote marks in link text
17390 #### 2. Wikilinks: Escapes needed
17391 #### 3. Wikilinks: No escapes needed
17392 #### 4. Extlinks: Escapes needed
17393 #### 5. Extlinks: No escapes needed
17394 #### --------------------------------------
17395 !! test
17396 Links 1. Quote marks in link text
17397 !! options
17398 parsoid
17399 !! input
17400 [[Foo|Foo<nowiki>''boo''</nowiki>]]
17401 !! result
17402 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
17403 !! end
17404
17405 !! test
17406 Links 2. WikiLinks: Escapes needed
17407 !! options
17408 parsoid
17409 !! input
17410 [[Foo|<nowiki>[Foobar]</nowiki>]]
17411 [[Foo|<nowiki>Foobar]</nowiki>]]
17412 [[Foo|x [Foobar] x]]
17413 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
17414 [[Foo|<nowiki>[[Bar]]</nowiki>]]
17415 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
17416 [[Foo|<nowiki>|Bar</nowiki>]]
17417 [[Foo|<nowiki>]]bar</nowiki>]]
17418 [[Foo|<nowiki>[[bar</nowiki>]]
17419 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
17420 !! result
17421 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
17422 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
17423 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
17424 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
17425 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
17426 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
17427 <a href="Foo" rel="mw:WikiLink">|Bar</a>
17428 <a href="Foo" rel="mw:WikiLink">]]bar</a>
17429 <a href="Foo" rel="mw:WikiLink">[[bar</a>
17430 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
17431 !! end
17432
17433 !! test
17434 Links 3. WikiLinks: No escapes needed
17435 !! options
17436 parsoid
17437 !! input
17438 [[Foo|[Foobar]]
17439 [[Foo|foo|bar]]
17440 !! result
17441 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
17442 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
17443 !! end
17444
17445 !! test
17446 Links 4. ExtLinks: Escapes needed
17447 !! options
17448 parsoid
17449 !! input
17450 [http://google.com <nowiki>[google]</nowiki>]
17451 [http://google.com <nowiki>google]</nowiki>]
17452 !! result
17453 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
17454 <a href="http://google.com" rel="mw:ExtLink">google]</a>
17455 !! end
17456
17457 !! test
17458 Links 5. ExtLinks: No escapes needed
17459 !! options
17460 parsoid
17461 !! input
17462 [http://google.com [google]
17463 !! result
17464 <a href="http://google.com" rel="mw:ExtLink">[google</a>
17465 !! end
17466
17467 #### --------------- Quotes ---------------
17468 #### 1. Quotes inside <b> and <i>
17469 #### 2. Link fragments separated by <i> and <b> tags
17470 #### 3. Link fragments inside <i> and <b>
17471 #### 4. No escaping needed
17472 #### --------------------------------------
17473 !! test
17474 1. Quotes inside <b> and <i>
17475 !! options
17476 parsoid=html2wt,wt2wt
17477 !! input
17478 ''<nowiki>'foo'</nowiki>''
17479 ''<nowiki>''foo''</nowiki>''
17480 ''<nowiki>'''foo'''</nowiki>''
17481 ''foo''<nowiki/>'s
17482 '''<nowiki>'foo'</nowiki>'''
17483 '''<nowiki>''foo''</nowiki>'''
17484 '''<nowiki>'''foo'''</nowiki>'''
17485 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
17486 '''foo'''<nowiki/>'s
17487 '''foo''
17488 ''foo''<nowiki/>'
17489 '<nowiki/>''foo''<nowiki/>'
17490 ''''foo'''
17491 '''foo'''<nowiki/>'
17492 '<nowiki/>'''foo'''<nowiki/>'
17493 !! result
17494 <p><i>'foo'</i>
17495 <i>''foo''</i>
17496 <i>'''foo'''</i>
17497 <i>foo</i>'s
17498 <b>'foo'</b>
17499 <b>''foo''</b>
17500 <b>'''foo'''</b>
17501 <b>foo'<i>bar'</i>baz</b>
17502 <b>foo</b>'s
17503 '<i>foo</i>
17504 <i>foo</i>'
17505 '<i>foo</i>'
17506 '<b>foo</b>
17507 <b>foo</b>'
17508 '<b>foo</b>'</p>
17509 !! end
17510
17511 !! test
17512 2. Link fragments separated by <i> and <b> tags
17513 !! input
17514 [[''foo''<nowiki>hello]]</nowiki>
17515
17516 [['''foo'''<nowiki>hello]]</nowiki>
17517 !! result
17518 <p>[[<i>foo</i>hello]]
17519 </p><p>[[<b>foo</b>hello]]
17520 </p>
17521 !! end
17522
17523 !! test
17524 3. Link fragments inside <i> and <b>
17525 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
17526 this is one of the shortcomings of this format)
17527 !! input
17528 ''[[foo''<nowiki>]]</nowiki>
17529
17530 '''[[foo'''<nowiki>]]</nowiki>
17531 !! result
17532 <p><i>[[foo</i>]]
17533 </p><p><b>[[foo</b>]]
17534 </p>
17535 !! end
17536
17537 !! test
17538 4. No escaping needed
17539 !! input
17540 '<span>''bar''</span>'
17541 '<span>'''bar'''</span>'
17542 !! result
17543 <p>'<span><i>bar</i></span>'
17544 '<span><b>bar</b></span>'
17545 </p>
17546 !! end
17547
17548 #### ----------- Paragraphs ---------------
17549 #### 1. No unnecessary escapes
17550 #### --------------------------------------
17551
17552 !! test
17553 1. No unnecessary escapes
17554 !! input
17555 bar <span><nowiki>[[foo]]</nowiki></span>
17556
17557 =bar <span><nowiki>[[foo]]</nowiki></span>
17558
17559 [[bar <span><nowiki>[[foo]]</nowiki></span>
17560
17561 ]]bar <span><nowiki>[[foo]]</nowiki></span>
17562
17563 =bar <span>foo]]</span><nowiki>=</nowiki>
17564 !! result
17565 <p>bar <span>[[foo]]</span>
17566 </p><p>=bar <span>[[foo]]</span>
17567 </p><p>[[bar <span>[[foo]]</span>
17568 </p><p>]]bar <span>[[foo]]</span>
17569 </p><p>=bar <span>foo]]</span>=
17570 </p>
17571 !!end
17572
17573 #### ----------------------- PRE --------------------------
17574 #### 1. Leading whitespace in SOL context should be escaped
17575 #### ------------------------------------------------------
17576 !! test
17577 1. Leading whitespace in SOL context should be escaped
17578 !! options
17579 parsoid
17580 !! input
17581 <nowiki> </nowiki>a
17582
17583 <nowiki> </nowiki> a
17584
17585 <nowiki> </nowiki>a(tab)
17586
17587 <nowiki> </nowiki> a
17588 <!--cmt-->
17589 <nowiki> </nowiki> a
17590
17591 a
17592 <nowiki> </nowiki>b
17593
17594 a
17595 <nowiki> </nowiki>b
17596
17597 a
17598 <nowiki> </nowiki> b
17599 !! result
17600 <p> a</p>
17601 <p> a</p>
17602 <p> a(tab)</p>
17603 <p> a</p>
17604 <p><!--cmt--> a</p>
17605 <p>a
17606 b</p>
17607 <p>a
17608 b</p>
17609 <p>a
17610 b</p>
17611 !! end
17612
17613 #### --------------- Behavior Switches --------------------
17614 !! test
17615 1. Valid behavior switches should be escaped
17616 !! options
17617 parsoid=html2wt
17618 !! input
17619 <nowiki>__TOC__</nowiki>
17620 !! result
17621 __TOC__
17622 !! end
17623
17624 !! test
17625 2. Invalid behavior switches should not be escaped
17626 !! options
17627 parsoid=html2wt
17628 !! input
17629 __TOO__
17630 __|__
17631 !! result
17632 __TOO__
17633 __|__
17634 !! end
17635
17636 #### --------------- HTML tags ---------------
17637 #### 1. a tags
17638 #### 2. other tags
17639 #### 3. multi-line html tag
17640 #### -----------------------------------------
17641 !! test
17642 1. a tags
17643 !! options
17644 parsoid
17645 !! input
17646 <a href="http://google.com">google</a>
17647 !! result
17648 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
17649 !! end
17650
17651 !! test
17652 2. other tags
17653 !! input
17654 <nowiki><div>foo</div>
17655 <div style="color:red">foo</div></nowiki>
17656 !! result
17657 <p>&lt;div&gt;foo&lt;/div&gt;
17658 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
17659 </p>
17660 !! end
17661
17662 !! test
17663 3. multi-line html tag
17664 !! input
17665 <nowiki><div
17666 >foo</div
17667 ></nowiki>
17668 !! result
17669 <p>&lt;div
17670 &gt;foo&lt;/div
17671 &gt;
17672 </p>
17673 !! end
17674
17675 !! test
17676 4. extension tags
17677 !! input
17678 <nowiki><ref>foo</ref></nowiki>
17679 !! result
17680 <p>&lt;ref&gt;foo&lt;/ref&gt;
17681 </p>
17682 !! end
17683
17684 #### --------------- Others ---------------
17685 !! test
17686 Escaping nowikis
17687 !! input
17688 &lt;nowiki&gt;foo&lt;/nowiki&gt;
17689 !! result
17690 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
17691 </p>
17692 !! end
17693
17694 ## The quote-char in the input is necessary for triggering the bug
17695 !! test
17696 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
17697 !! options
17698 parsoid=wt2wt,html2wt
17699 !! input
17700 foo's bar :
17701 !! result
17702 <p>foo's bar :</p>
17703 !! end
17704
17705 !! test
17706
17707 Tag-like HTML structures are passed through as text
17708 !! input
17709 <x y>
17710
17711 <x.y>
17712
17713 <x-y>
17714
17715 1>2
17716
17717 x<y
17718
17719 a>b
17720
17721 1<d e>f
17722 !! result
17723 <p>&lt;x y&gt;
17724 </p><p>&lt;x.y&gt;
17725 </p><p>&lt;x-y&gt;
17726 </p><p>1&gt;2
17727 </p><p>x&lt;y
17728 </p><p>a&gt;b
17729 </p><p>1&lt;d e&gt;f
17730 </p>
17731 !! end
17732
17733
17734 # This was a bug in the PHP parser (see bug 17663 and its dups,
17735 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
17736 !! test
17737 Tag names followed by punctuation should not be recognized as tags
17738 !! input
17739 <s.ome> text
17740 !! result
17741 <p>&lt;s.ome&gt; text
17742 </p>
17743 !! end
17744
17745 !! test
17746 HTML tag with necessary entities in attributes
17747 !! input
17748 <span title="&amp;amp;">foo</span>
17749 !! result
17750 <p><span title="&amp;amp;">foo</span>
17751 </p>
17752 !! end
17753
17754 !! test
17755 HTML tag with 'unnecessary' entity encoding in attributes
17756 !! input
17757 <span title="&amp;">foo</span>
17758 !! result
17759 <p><span title="&amp;">foo</span>
17760 </p>
17761 !! end
17762
17763 !! test
17764 HTML tag with broken attribute value quoting
17765 !! input
17766 <span title="Hello world>Foo</span>
17767 !! result
17768 <p><span>Foo</span>
17769 </p>
17770 !! end
17771
17772 !! test
17773 Parsoid-only: HTML tag with broken attribute value quoting
17774 !! options
17775 parsoid
17776 !! input
17777 <span title="Hello world>Foo</span>
17778 !! result
17779 <p><span title="Hello world">Foo</span>
17780 </p>
17781 !! end
17782
17783 !! test
17784 Table with broken attribute value quoting
17785 !! input
17786 {|
17787 | title="Hello world|Foo
17788 |}
17789 !! result
17790 <table>
17791 <tr>
17792 <td>Foo
17793 </td></tr></table>
17794
17795 !! end
17796
17797 !! test
17798 Table with broken attribute value quoting on consecutive lines
17799 !! input
17800 {|
17801 | title="Hello world|Foo
17802 | style="color:red|Bar
17803 |}
17804 !! result
17805 <table>
17806 <tr>
17807 <td>Foo
17808 </td>
17809 <td>Bar
17810 </td></tr></table>
17811
17812 !! end
17813
17814 !! test
17815 Parsoid-only: Table with broken attribute value quoting on consecutive lines
17816 !! options
17817 parsoid
17818 !! input
17819 {|
17820 | title="Hello world|Foo
17821 | style="color:red|Bar
17822 |}
17823 !! result
17824 <table><tbody>
17825 <tr>
17826 <td title="Hello world">Foo
17827 </td><td style="color: red">Bar
17828 </td></tr></tbody></table>
17829
17830 !! end
17831
17832 !! test
17833 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17834 !! options
17835 parsoid
17836 !! input
17837 {{}}
17838 !! result
17839 {{}}
17840 !! end
17841
17842 !! test
17843 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17844 !! options
17845 parsoid
17846 !! input
17847 }}{{
17848 !! result
17849 }}{{
17850 !! end
17851
17852 !!test
17853 Accept empty td cell attribute
17854 !!input
17855 {|
17856 | align="center" | foo || |
17857 |}
17858 !!result
17859 <table>
17860 <tr>
17861 <td align="center"> foo </td>
17862 <td>
17863 </td></tr></table>
17864
17865 !!end
17866
17867 !!test
17868 Non-empty attributes in th-cells
17869 !!input
17870 {|
17871 ! Foo !! style="color: red" | Bar
17872 |}
17873 !!result
17874 <table>
17875 <tr>
17876 <th> Foo </th>
17877 <th style="color: red"> Bar
17878 </th></tr></table>
17879
17880 !!end
17881
17882 !!test
17883 Accept empty attributes in th-cells
17884 !!input
17885 {|
17886 !| foo !!| bar
17887 |}
17888 !!result
17889 <table>
17890 <tr>
17891 <th> foo </th>
17892 <th> bar
17893 </th></tr></table>
17894
17895 !!end
17896
17897 !!test
17898 Empty table rows go away
17899 !!input
17900 {|
17901 | Hello
17902 | there
17903 |- class="foo"
17904 |-
17905 |}
17906 !! result
17907 <table>
17908 <tr>
17909 <td> Hello
17910 </td>
17911 <td> there
17912 </td></tr>
17913
17914 </table>
17915
17916 !! end
17917
17918 ###
17919 ### Parsoid-centric tests for testing RTing of inter-element separators
17920 ### Edge cases not tested by existing parser tests and specific to
17921 ### Parsoid-specific serialization strategies.
17922 ###
17923
17924 !!test
17925 RT-ed inter-element separators should be valid separators
17926 !!input
17927 {|
17928 |- [[foo]]
17929 |}
17930 !!result
17931 <table>
17932
17933 </table>
17934
17935 !!end
17936
17937 !!test
17938 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17939 (Parsoid-only since PHP parser relies on Tidy for correct output)
17940 !!options
17941 parsoid
17942 !!input
17943 {|
17944 |<small>foo
17945 bar
17946 |}
17947
17948 {|
17949 |<small>foo<small>
17950 |}
17951 !!result
17952 !!end
17953
17954 !!test
17955 Empty TD followed by TD with tpl-generated attribute
17956 !!input
17957 {|
17958 |-
17959 |
17960 |{{echo|style='color:red'}}|foo
17961 |}
17962 !!result
17963 <table>
17964
17965 <tr>
17966 <td>
17967 </td>
17968 <td>foo
17969 </td></tr></table>
17970
17971 !!end
17972
17973 !!test
17974 Indented table with an empty td
17975 !!input
17976 {|
17977 |-
17978 |
17979 |foo
17980 |}
17981 !!result
17982 <table>
17983
17984 <tr>
17985 <td>
17986 </td>
17987 <td>foo
17988 </td></tr></table>
17989
17990 !!end
17991
17992 !!test
17993 Empty TR followed by a template-generated TR
17994 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17995 !!options
17996 parsoid
17997 !!input
17998 {|
17999 |-
18000 {{echo|<tr><td>foo</td></tr>}}
18001 |}
18002 !!result
18003 <table>
18004 <tbody>
18005 <tr></tr>
18006 <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}}]}'>
18007 <td>foo</td></tr>
18008 </tbody></table>
18009 !!end
18010
18011 ## PHP and parsoid output differ for this, and since this is primarily
18012 ## for testing Parsoid's serializer, marking this Parsoid only
18013 !!test
18014 Empty TR followed by mixed-ws-comment line should RT correctly
18015 !!options
18016 parsoid
18017 !!input
18018 {|
18019 |-
18020 <!--c-->
18021 |-
18022 <!--c--> <!--d-->
18023 |}
18024 !!result
18025 <table>
18026 <tbody>
18027 <tr></tr>
18028 <!--c-->
18029 <tr>
18030 <!--c--> </tr><!--d-->
18031 </tbody></table>
18032
18033 !!end
18034
18035 !!test
18036 Multi-line image caption generated by templates with/without trailing newlines
18037 !!options
18038 parsoid
18039 !!input
18040 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
18041 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
18042 !!result
18043 <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>
18044 <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>
18045
18046 !!end
18047
18048 ## PHP emits broken html for this, and since this is primarily
18049 ## a Parsoid serializer test, marking this Parsoid only
18050 !!test
18051 Improperly nested inline or quotes tags with whitespace in between
18052 !!options
18053 parsoid
18054 !!input
18055 <span> <s>x</span> </s>
18056 ''' ''x''' ''
18057 !!result
18058 <p><span> <s>x</s></span><s> </s>
18059 <b> <i>x</i></b><i> </i>
18060 </p>
18061 !!end
18062
18063 !!test
18064 Encapsulate protected attributes from wt
18065 !!options
18066 parsoid
18067 !!input
18068 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
18069 !!result
18070 <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>
18071 </body>
18072 !!end
18073
18074 ## Currently the p-wrapper is fragile in how adds / removes transformations.
18075 ## Having nested or stray pre tags results in the attempt to add duplicates,
18076 ## causing an assertion fail. This test tries to prevent that situation.
18077 !!test
18078 Ensure ParagraphWrapper can deal with stray closing pre tags
18079 !!options
18080 parsoid=wt2html
18081 !!input
18082 plain text</pre>
18083 !!result
18084 plain text
18085 !!end
18086
18087 !!test
18088 Ensure fostered text content is wrapped in spans
18089 !!options
18090 parsoid=wt2html
18091 !!input
18092 <table>hi</table><table>ho</table>
18093 !!result
18094 <span>hi</span>
18095 <table></table>
18096 <span>ho</span>
18097 <table></table>
18098 !!end
18099
18100 !!test
18101 Encapsulation properly handles null DSR information from foster box
18102 !!options
18103 parsoid=wt2html,wt2wt
18104 !!input
18105 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
18106 !!result
18107 <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;
18108 <table>foo
18109 <tr>
18110 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
18111 <table>
18112 <tbody>
18113 <tr>
18114 <td>bar</td></tr></tbody></table>
18115 !!end
18116
18117 !!test
18118 1. Encapsulate foster-parented transclusion content
18119 !!options
18120 parsoid=wt2wt,wt2html
18121 !!input
18122 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
18123 !!result
18124 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18125 <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
18126 <tr>
18127 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
18128 <table>
18129 <tbody>
18130 <tr>
18131 <td>bar</td></tr></tbody></table>
18132 !!end
18133
18134 !!test
18135 2. Encapsulate foster-parented transclusion content
18136 !!options
18137 parsoid=wt2wt,wt2html
18138 !!input
18139 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
18140 !!result
18141 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18142 <table>
18143 <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>
18144 <tr>
18145 <td>bar</td></tr></table>&quot;]}">foo</div>
18146 <table>
18147 <tbody>
18148 <tr>
18149 <td>bar</td></tr></tbody></table>
18150 !!end
18151
18152 !!test
18153 3. Encapsulate foster-parented transclusion content
18154 !!options
18155 parsoid=wt2wt,wt2html
18156 !!input
18157 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18158 !!result
18159 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18160 <table>
18161 <div>
18162 <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>
18163 <tr>
18164 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18165 <p>foo</p></div>
18166 <table>
18167 <tbody>
18168 <tr>
18169 <td>bar</td></tr></tbody></table>
18170 !!end
18171
18172 !!test
18173 4. Encapsulate foster-parented transclusion content
18174 !!options
18175 parsoid=wt2wt,wt2html
18176 !!input
18177 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18178 !!result
18179 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18180 <table>
18181 <div>
18182 <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>
18183 <tr>
18184 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18185 <p>foo</p></div>
18186 <table>
18187 <tbody>
18188 <tr>
18189 <td>bar</td></tr></tbody></table>
18190 !!end
18191
18192 !!test
18193 5. Encapsulate foster-parented transclusion content
18194 !!options
18195 parsoid=wt2wt,wt2html
18196 !!input
18197 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
18198 !!result
18199 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18200 <table>
18201 <tr>
18202 <td>
18203 <div>
18204 <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>
18205 <table>
18206 <tbody>
18207 <tr>
18208 <td>
18209 <div>
18210 <p>foo</p></div></td></tr></tbody></table>
18211 !!end
18212
18213 !!test
18214 6. Encapsulate foster-parented transclusion content
18215 !!options
18216 parsoid=wt2wt,wt2html
18217 !!input
18218 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
18219 !!result
18220 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18221 <table>
18222 <tr>
18223 <td>
18224 <div>
18225 <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>
18226 <table>
18227 <tbody>
18228 <tr>
18229 <td>
18230 <div>
18231 <p>foo</p></div></td></tr></tbody></table>
18232 <p>ok</p>
18233 !!end
18234
18235 !!test
18236 7. Encapsulate foster-parented transclusion content
18237 !!options
18238 parsoid=wt2wt,wt2html
18239 !!input
18240 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
18241 !!result
18242 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18243 <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;
18244 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
18245 <td>bar</td></table>&quot;]}">foo</p>
18246 <table>
18247 <tbody>
18248 <tr>
18249 <td>bar</td></tr></tbody></table>
18250 !!end
18251
18252 !!test
18253 8. Encapsulate foster-parented transclusion content
18254 !!options
18255 parsoid=wt2wt,wt2html
18256 !!input
18257 {{echo|a
18258 }}{|{{echo|style='color:red'}}
18259 |-
18260 |b
18261 |}
18262 !!result
18263 <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>
18264 <table>
18265 <tbody>
18266 <tr>
18267 <td>b</td></tr></tbody></table>
18268 !!end
18269
18270 # -----------------------------------------------------------------
18271 # The following section of tests are primarily to spec requirements
18272 # around serialization of new/edited content.
18273 #
18274 # All these tests are marked Parsoid html2wt and html2html only
18275 # ----------------------------------------------------------------
18276
18277 !! test
18278 Image: Modifying size of an image
18279 !! options
18280 parsoid=html2wt
18281 !! input
18282 [[Image:Wiki.png|230x230px]]
18283 !! result
18284 <p data-parsoid='{"dsr":[0,24,0,0]}'><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100px"}],"cacheKey":"[[Image:Wiki.png|100px]]","img":{"h":115,"w":100,"wdset":true},"dsr":[0,24,null,null]}'><a href="./File:Wiki.png" data-parsoid='{"a":{"href":"./File:Wiki.png"}}'><img resource="./File:Wiki.png" src="//upload.wikimedia.org/wikipedia/en/thumb/b/bc/Wiki.png/100px-Wiki.png" height="230" width="200" data-parsoid='{"a":{"resource":"./File:Wiki.png"},"sa":{"resource":"Image:Wiki.png"}}'></a></span></p>
18285 !!end
18286
18287 !! test
18288 Image: New block level image should have \n before and after
18289 !! options
18290 parsoid=html2wt
18291 !! input
18292 123
18293 [[File:Wiki.png|right|thumb|150x150px]]
18294 456
18295 !! result
18296 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Wiki.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Wiki.png/131px-Wiki.png" width="131" height="150" resource="./File:Wiki.png"></a></figure><p>456</p>
18297 !!end
18298
18299 # Wacky -- the leading newline in input is required because
18300 # that is what the serializer emits. To be fixed. Not fixing
18301 # the test because this test is required to test serialization of
18302 # new content and preferred whitespace style.
18303 !! test
18304 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
18305 !! options
18306 parsoid=html2wt
18307 !! input
18308
18309 * foo
18310 !! result
18311 <ul>
18312 <li><p>foo</p></li>
18313 </ul>
18314 !! end
18315
18316 # Wacky -- the leading newline in input is required because
18317 # that is what the serializer emits. To be fixed. Not fixing
18318 # the test because this test is required to test serialization of
18319 # new content and preferred whitespace style.
18320 !! test
18321 Lists: Add space after bullets
18322 !! options
18323 parsoid=html2wt
18324 !! input
18325
18326 * foo
18327 * bar
18328 * <span> baz</span>
18329 !! result
18330 <ul>
18331 <li>foo</li>
18332 <li> bar</li>
18333 <li><span> baz</span></li>
18334 </ul>
18335 !! end
18336
18337 !! test
18338 Parsoid: Serialize positional parameters with = in them as named parameter
18339 !! options
18340 parsoid=html2wt
18341 !! input
18342 {{echo|1 = f=oo}}
18343
18344 {{echo|1 = f=oo|2 = bar}}
18345
18346 <!--Orig params with data-parsoid has heuristics for handling = chars-->
18347 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
18348 {{echo|<nowiki>f=oo</nowiki>|bar}}
18349 !! result
18350 <p about="#mwt1" typeof="mw:Transclusion"
18351 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
18352
18353 <p about="#mwt1" typeof="mw:Transclusion"
18354 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
18355
18356 <!--Orig params with data-parsoid has heuristics for handling = chars-->
18357 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
18358 <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>
18359 !! end
18360
18361 !! test
18362 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
18363 !! options
18364 parsoid=html2wt
18365 !! input
18366 <div>a
18367 b
18368 </div>
18369 <div>a
18370 b
18371 </div>
18372 <div>
18373 a
18374
18375 b
18376 </div>
18377 !! result
18378 <div>a<p>b</p></div>
18379 <div>a
18380 <p>b</p></div>
18381 <div>
18382 a
18383 <p>b</p></div>
18384 !! end
18385
18386 #-----------------------------
18387 # I/B quote minimization tests
18388 #-----------------------------
18389
18390 !! test
18391 1. I/B quote minimization: wikitext-only tags should be combined
18392 !! options
18393 parsoid=html2wt
18394 !! input
18395 ''AB''
18396
18397 '''AB'''
18398
18399 ''A'''B'''''
18400
18401 '''A''B'''''
18402
18403 '''A''BC''D'''
18404
18405 '''''AB'''''
18406
18407 '''''AB'''''
18408
18409 '''''AB'''''
18410 !! result
18411 <p><i>A</i><i>B</i></p>
18412 <p><b>A</b><b>B</b></p>
18413 <p><i>A</i><b><i>B</i></b></p>
18414 <p><b>A</b><i><b>B</b></i></p>
18415 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
18416 <p><i><b>A</b></i><i><b>B</b></i></p>
18417 <p><i><b>A</b></i><b><i>B</i></b></p>
18418 <p><b><i>A</i></b><i><b>B</b></i></p>
18419 !! end
18420
18421 !! test
18422 2. I/B quote minimization: wikitext and html tags should not be combined
18423 !! options
18424 parsoid=html2wt
18425 !! input
18426 ''A''<i>B</i>
18427
18428 ''A'''''<i>B</i>'''
18429 !! result
18430 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
18431 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
18432 !! end
18433
18434 !! test
18435 3. I/B quote minimization: templated content stops minimization
18436 !! options
18437 parsoid=html2wt
18438 !! input
18439 ''A''{{echo|''B''}}
18440
18441 ''A''{{echo|'''''B'''''}}
18442 !! result
18443 <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>
18444 <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>
18445 !! end
18446
18447 !! test
18448 4. I/B quote minimization: new content should be mimimized with adjacent old content
18449 !! options
18450 parsoid=html2wt
18451 !! input
18452 ''AB''
18453
18454 '''AB'''
18455
18456 ''A'''B'''''
18457 !! result
18458 <p><i>A</i><i data-parsoid='{}'>B</i></p>
18459 <p><b data-parsoid='{}'>A</b><b>B</b></p>
18460 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
18461 !! end
18462
18463 # -----------------------------------------------------------------
18464 # End of section for Parsoid-only html2wt tests for serialization
18465 # of new content
18466 # -----------------------------------------------------------------
18467
18468 TODO:
18469 more images
18470 more tables
18471 character entities
18472 and much more
18473 Try for 100% code coverage