Add tests for case-(in)sensitive magic words
[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 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Parsing an URL
169 !! input
170 http://fr.wikipedia.org/wiki/🍺
171 <!-- EasterEgg we love beer, better be able be able to link to it -->
172 !! result
173 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
174 </p>
175 !! end
176
177 !! test
178 Simple list
179 !! input
180 * Item 1
181 * Item 2
182 !! result
183 <ul><li> Item 1
184 </li><li> Item 2
185 </li></ul>
186
187 !! end
188
189 !! test
190 Italics and bold
191 !! input
192 * plain
193 * plain''italic''plain
194 * plain''italic''plain''italic''plain
195 * plain'''bold'''plain
196 * plain'''bold'''plain'''bold'''plain
197 * plain''italic''plain'''bold'''plain
198 * plain'''bold'''plain''italic''plain
199 * plain''italic'''bold-italic'''italic''plain
200 * plain'''bold''bold-italic''bold'''plain
201 * plain'''''bold-italic'''italic''plain
202 * plain'''''bold-italic''bold'''plain
203 * plain''italic'''bold-italic'''''plain
204 * plain'''bold''bold-italic'''''plain
205 * plain l'''italic''plain
206 * plain l''''bold''' plain
207 !! result
208 <ul><li> plain
209 </li><li> plain<i>italic</i>plain
210 </li><li> plain<i>italic</i>plain<i>italic</i>plain
211 </li><li> plain<b>bold</b>plain
212 </li><li> plain<b>bold</b>plain<b>bold</b>plain
213 </li><li> plain<i>italic</i>plain<b>bold</b>plain
214 </li><li> plain<b>bold</b>plain<i>italic</i>plain
215 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
216 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
217 </li><li> plain<i><b>bold-italic</b>italic</i>plain
218 </li><li> plain<b><i>bold-italic</i>bold</b>plain
219 </li><li> plain<i>italic<b>bold-italic</b></i>plain
220 </li><li> plain<b>bold<i>bold-italic</i></b>plain
221 </li><li> plain l'<i>italic</i>plain
222 </li><li> plain l'<b>bold</b> plain
223 </li></ul>
224
225 !! end
226
227 ###
228 ### 2-quote opening sequence tests
229 ###
230 !! test
231 Italics and bold: 2-quote opening sequence: (2,2)
232 !! input
233 ''foo''
234 !! result
235 <p><i>foo</i>
236 </p>
237 !!end
238
239
240 !! test
241 Italics and bold: 2-quote opening sequence: (2,3)
242 !! input
243 ''foo'''
244 !! result
245 <p><i>foo'</i>
246 </p>
247 !!end
248
249
250 !! test
251 Italics and bold: 2-quote opening sequence: (2,4)
252 !! input
253 ''foo''''
254 !! result
255 <p><i>foo''</i>
256 </p>
257 !!end
258
259
260 !! test
261 Italics and bold: 2-quote opening sequence: (2,5)
262 !! input
263 ''foo'''''
264 !! result
265 <p><i>foo</i>
266 </p>
267 !!end
268
269
270 ###
271 ### 3-quote opening sequence tests
272 ###
273
274 !! test
275 Italics and bold: 3-quote opening sequence: (3,2)
276 !! input
277 '''foo''
278 !! result
279 <p>'<i>foo</i>
280 </p>
281 !!end
282
283
284 !! test
285 Italics and bold: 3-quote opening sequence: (3,3)
286 !! input
287 '''foo'''
288 !! result
289 <p><b>foo</b>
290 </p>
291 !!end
292
293
294 !! test
295 Italics and bold: 3-quote opening sequence: (3,4)
296 !! input
297 '''foo''''
298 !! result
299 <p><b>foo'</b>
300 </p>
301 !!end
302
303
304 !! test
305 Italics and bold: 3-quote opening sequence: (3,5)
306 !! input
307 '''foo'''''
308 !! result
309 <p><b>foo</b>
310 </p>
311 !!end
312
313
314 ###
315 ### 4-quote opening sequence tests
316 ###
317
318 !! test
319 Italics and bold: 4-quote opening sequence: (4,2)
320 !! input
321 ''''foo''
322 !! result
323 <p>''<i>foo</i>
324 </p>
325 !!end
326
327
328 !! test
329 Italics and bold: 4-quote opening sequence: (4,3)
330 !! input
331 ''''foo'''
332 !! result
333 <p>'<b>foo</b>
334 </p>
335 !!end
336
337
338 !! test
339 Italics and bold: 4-quote opening sequence: (4,4)
340 !! input
341 ''''foo''''
342 !! result
343 <p>'<b>foo'</b>
344 </p>
345 !!end
346
347
348 !! test
349 Italics and bold: 4-quote opening sequence: (4,5)
350 !! input
351 ''''foo'''''
352 !! result
353 <p>'<b>foo</b>
354 </p>
355 !!end
356
357
358 ###
359 ### 5-quote opening sequence tests
360 ###
361
362 !! test
363 Italics and bold: 5-quote opening sequence: (5,2)
364 !! input
365 '''''foo''
366 !! result
367 <p><b><i>foo</i></b>
368 </p>
369 !!end
370
371
372 !! test
373 Italics and bold: 5-quote opening sequence: (5,3)
374 !! input
375 '''''foo'''
376 !! result
377 <p><i><b>foo</b></i>
378 </p>
379 !!end
380
381
382 !! test
383 Italics and bold: 5-quote opening sequence: (5,4)
384 !! input
385 '''''foo''''
386 !! result
387 <p><i><b>foo'</b></i>
388 </p>
389 !!end
390
391
392 !! test
393 Italics and bold: 5-quote opening sequence: (5,5)
394 !! input
395 '''''foo'''''
396 !! result
397 <p><i><b>foo</b></i>
398 </p>
399 !!end
400
401 ###
402 ### multiple quote sequences in a line
403 ###
404 !! test
405 Italics and bold: multiple quote sequences: (2,4,2)
406 !! input
407 ''foo''''bar''
408 !! result
409 <p><i>foo'<b>bar</b></i>
410 </p>
411 !!end
412
413
414 !! test
415 Italics and bold: multiple quote sequences: (2,4,3)
416 !! input
417 ''foo''''bar'''
418 !! result
419 <p><i>foo'<b>bar</b></i>
420 </p>
421 !!end
422
423
424 !! test
425 Italics and bold: multiple quote sequences: (2,4,4)
426 !! input
427 ''foo''''bar''''
428 !! result
429 <p><i>foo'<b>bar'</b></i>
430 </p>
431 !!end
432
433
434 !! test
435 Italics and bold: multiple quote sequences: (3,4,2)
436 !! input
437 '''foo''''bar''
438 !! result
439 <p><b>foo'</b>bar
440 </p>
441 !!end
442
443
444 !! test
445 Italics and bold: multiple quote sequences: (3,4,3)
446 !! input
447 '''foo''''bar'''
448 !! result
449 <p><b>foo'</b>bar
450 </p>
451 !!end
452
453 ###
454 ### other quote tests
455 ###
456 !! test
457 Italics and bold: other quote tests: (2,3,5)
458 !! input
459 ''this is about '''foo's family'''''
460 !! result
461 <p><i>this is about <b>foo's family</b></i>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: other quote tests: (2,(3,3),2)
468 !! input
469 ''this is about '''foo's''' family''
470 !! result
471 <p><i>this is about <b>foo's</b> family</i>
472 </p>
473 !!end
474
475
476 !! test
477 Italics and bold: other quote tests: (3,2,3,2)
478 !! input
479 '''this is about ''foo'''s family''
480 !! result
481 <p><b>this is about <i>foo</i></b><i>s family</i>
482 </p>
483 !!end
484
485
486 !! test
487 Italics and bold: other quote tests: (3,2,3,3)
488 !! input
489 '''this is about ''foo'''s family'''
490 !! result
491 <p>'<i>this is about </i>foo<b>s family</b>
492 </p>
493 !!end
494
495
496 !! test
497 Italics and bold: other quote tests: (3,(2,2),3)
498 !! input
499 '''this is about ''foo's'' family'''
500 !! result
501 <p><b>this is about <i>foo's</i> family</b>
502 </p>
503 !!end
504
505
506 !! test
507 Italicized possessive
508 !! input
509 The ''[[Main Page]]'''s talk page.
510 !! result
511 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
512 </p>
513 !! end
514
515 ###
516 ### Non-html5 tags
517 ###
518
519 !! test
520 Non-html5 tags should be accepted
521 !! input
522 <center>''foo''</center>
523 <big>''foo''</big>
524 <font>''foo''</font>
525 <strike>''foo''</strike>
526 <tt>''foo''</tt>
527 !! result
528 <center><i>foo</i></center>
529 <p><big><i>foo</i></big>
530 <font><i>foo</i></font>
531 <strike><i>foo</i></strike>
532 <tt><i>foo</i></tt>
533 </p>
534 !! end
535
536 ###
537 ### <nowiki> test cases
538 ###
539
540 !! test
541 <nowiki> unordered list
542 !! input
543 <nowiki>* This is not an unordered list item.</nowiki>
544 !! result
545 <p>* This is not an unordered list item.
546 </p>
547 !! end
548
549 !! test
550 <nowiki> spacing
551 !! input
552 <nowiki>Lorem ipsum dolor
553
554 sed abit.
555 sed nullum.
556
557 :and a colon
558 </nowiki>
559 !! result
560 <p>Lorem ipsum dolor
561
562 sed abit.
563 sed nullum.
564
565 :and a colon
566
567 </p>
568 !! end
569
570 !! test
571 nowiki 3
572 !! input
573 :There is not nowiki.
574 :There is <nowiki>nowiki</nowiki>.
575
576 #There is not nowiki.
577 #There is <nowiki>nowiki</nowiki>.
578
579 *There is not nowiki.
580 *There is <nowiki>nowiki</nowiki>.
581 !! result
582 <dl><dd>There is not nowiki.
583 </dd><dd>There is nowiki.
584 </dd></dl>
585 <ol><li>There is not nowiki.
586 </li><li>There is nowiki.
587 </li></ol>
588 <ul><li>There is not nowiki.
589 </li><li>There is nowiki.
590 </li></ul>
591
592 !! end
593
594 !! test
595 Entities inside <nowiki>
596 !! input
597 <nowiki>&lt;</nowiki>
598 !! result
599 <p>&lt;
600 </p>
601 !! end
602
603
604 ###
605 ### Comments
606 ###
607 !! test
608 Comments and Indent-Pre
609 !! input
610 <!-- comment 1 --> asdf
611
612 <!-- comment 1 --> asdf
613 <!-- comment 2 -->
614
615 <!-- comment 1 --> asdf
616 <!-- comment 2 -->xyz
617
618 <!-- comment 1 --> asdf
619 <!-- comment 2 --> xyz
620 !! result
621 <pre>asdf
622 </pre>
623 <pre>asdf
624 </pre>
625 <pre>asdf
626 </pre>
627 <p>xyz
628 </p>
629 <pre>asdf
630 xyz
631 </pre>
632 !! end
633
634 !! test
635 Comment test 2a
636 !! input
637 asdf
638 <!-- comment 1 -->
639 jkl
640 !! result
641 <p>asdf
642 jkl
643 </p>
644 !! end
645
646 !! test
647 Comment test 2b
648 !! input
649 asdf
650 <!-- comment 1 -->
651
652 jkl
653 !! result
654 <p>asdf
655 </p><p>jkl
656 </p>
657 !! end
658
659 !! test
660 Comment test 3
661 !! input
662 asdf
663 <!-- comment 1 -->
664 <!-- comment 2 -->
665 jkl
666 !! result
667 <p>asdf
668 jkl
669 </p>
670 !! end
671
672 !! test
673 Comment test 4
674 !! input
675 asdf<!-- comment 1 -->jkl
676 !! result
677 <p>asdfjkl
678 </p>
679 !! end
680
681 !! test
682 Comment spacing
683 !! input
684 a
685 <!-- foo --> b <!-- bar -->
686 c
687 !! result
688 <p>a
689 </p>
690 <pre> b
691 </pre>
692 <p>c
693 </p>
694 !! end
695
696 !! test
697 Comment whitespace
698 !! input
699 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
700 !! result
701
702 !! end
703
704 !! test
705 Comment semantics and delimiters
706 !! input
707 <!-- --><!----><!-----><!------>
708 !! result
709
710 !! end
711
712 !! test
713 Comment semantics and delimiters, redux
714 !! input
715 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
716 -- foo -- funky huh? ... -->
717 !! result
718
719 !! end
720
721 !! test
722 Comment semantics and delimiters: directors cut
723 !! input
724 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
725 everything starting with < followed by !-- until the first -- and > we see,
726 that wouldn't be valid XML however, since in XML -- has to terminate a comment
727 -->-->
728 !! result
729 <p>--&gt;
730 </p>
731 !! end
732
733 !! test
734 Comment semantics: nesting
735 !! input
736 <!--<!-- no, we're not going to do anything fancy here -->-->
737 !! result
738 <p>--&gt;
739 </p>
740 !! end
741
742 !! test
743 Comment semantics: unclosed comment at end
744 !! input
745 <!--This comment will run out to the end of the document
746 !! result
747
748 !! end
749
750 !! test
751 Comment in template title
752 !! input
753 {{f<!---->oo}}
754 !! result
755 <p>FOO
756 </p>
757 !! end
758
759 !! test
760 Comment on its own line post-expand
761 !! input
762 a
763 {{blank}}<!---->
764 b
765 !! result
766 <p>a
767 </p><p>b
768 </p>
769 !! end
770
771 !! test
772 Comment on its own line post-expand with non-significant whitespace
773 !! input
774 a
775 {{blank}} <!---->
776 b
777 !! result
778 <p>a
779 </p><p>b
780 </p>
781 !! end
782
783 ###
784 ### paragraph wraping tests
785 ###
786 !! test
787 No block tags
788 !! input
789 a
790
791 b
792 !! result
793 <p>a
794 </p><p>b
795 </p>
796 !! end
797 !! test
798 Block tag on one line
799 !! input
800 a <div>foo</div>
801
802 b
803 !! result
804 a <div>foo</div>
805 <p>b
806 </p>
807 !! end
808
809 !! test
810 Block tag on both lines
811 !! input
812 a <div>foo</div>
813
814 b <div>foo</div>
815 !! result
816 a <div>foo</div>
817 b <div>foo</div>
818
819 !! end
820
821 !! test
822 Multiple lines without block tags
823 !! input
824 <div>foo</div> a
825 b
826 c
827 d<!--foo--> e
828 x <div>foo</div> z
829 !! result
830 <div>foo</div> a
831 <p>b
832 c
833 d e
834 </p>
835 x <div>foo</div> z
836
837 !! end
838
839 !! test
840 Empty lines between block tags to test open p-tags are closed between the block tags
841 !! input
842 <div></div>
843
844
845 <div></div>a
846
847 b
848 !! result
849 <div></div>
850 <p><br />
851 </p>
852 <div></div>a
853 <p>b
854 </p>
855 !! end
856
857 ###
858 ### Preformatted text
859 ###
860 !! test
861 Preformatted text
862 !! input
863 This is some
864 Preformatted text
865 With ''italic''
866 And '''bold'''
867 And a [[Main Page|link]]
868 !! result
869 <pre>This is some
870 Preformatted text
871 With <i>italic</i>
872 And <b>bold</b>
873 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
874 </pre>
875 !! end
876
877 !! test
878 Ident preformatting with inline content
879 !! input
880 a
881 ''b''
882 !! result
883 <pre>a
884 <i>b</i>
885 </pre>
886 !! end
887
888 !! test
889 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
890 !! input
891 <pre><nowiki>
892 <b>
893 <cite>
894 <em>
895 </nowiki></pre>
896 !! result
897 <pre>
898 &lt;b&gt;
899 &lt;cite&gt;
900 &lt;em&gt;
901 </pre>
902
903 !! end
904
905 !! test
906 Regression with preformatted in <center>
907 !! input
908 <center>
909 Blah
910 </center>
911 !! result
912 <center>
913 <pre>Blah
914 </pre>
915 </center>
916
917 !! end
918
919 # Expected output in the following test is not really expected (there should be
920 # <pre> in the output) -- it's only testing for well-formedness.
921 !! test
922 Bug 6200: Preformatted in <blockquote>
923 !! input
924 <blockquote>
925 Blah
926 </blockquote>
927 !! result
928 <blockquote>
929 Blah
930 </blockquote>
931
932 !! end
933
934 !! test
935 <pre> with attributes (bug 3202)
936 !! input
937 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
938 !! result
939 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
940
941 !! end
942
943 !! test
944 <pre> with width attribute (bug 3202)
945 !! input
946 <pre width="8">Narrow screen goodies</pre>
947 !! result
948 <pre width="8">Narrow screen goodies</pre>
949
950 !! end
951
952 !! test
953 <pre> with forbidden attribute (bug 3202)
954 !! input
955 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
956 !! result
957 <pre width="8">Narrow screen goodies</pre>
958
959 !! end
960
961 !! test
962 Entities inside <pre>
963 !! input
964 <pre>&lt;</pre>
965 !! result
966 <pre>&lt;</pre>
967
968 !! end
969
970 !! test
971 <pre> with forbidden attribute values (bug 3202)
972 !! input
973 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
974 !! result
975 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
976
977 !! end
978
979 !! test
980 <nowiki> inside <pre> (bug 13238)
981 !! input
982 <pre>
983 <nowiki>
984 </pre>
985 <pre>
986 <nowiki></nowiki>
987 </pre>
988 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
989 !! result
990 <pre>
991 &lt;nowiki&gt;
992 </pre>
993 <pre>
994
995 </pre>
996 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
997
998 !! end
999
1000 !! test
1001 <nowiki> and <pre> preference (first one wins)
1002 !! input
1003 <pre>
1004 <nowiki>
1005 </pre>
1006 </nowiki>
1007 </pre>
1008
1009 <nowiki>
1010 <pre>
1011 <nowiki>
1012 </pre>
1013 </nowiki>
1014 </pre>
1015
1016 !! result
1017 <pre>
1018 &lt;nowiki&gt;
1019 </pre>
1020 <p>&lt;/nowiki&gt;
1021 &lt;/pre&gt;
1022 </p><p>
1023 &lt;pre&gt;
1024 &lt;nowiki&gt;
1025 &lt;/pre&gt;
1026
1027 &lt;/pre&gt;
1028 </p>
1029 !! end
1030
1031 !! test
1032 </pre> inside nowiki
1033 !! input
1034 <nowiki></pre></nowiki>
1035 !! result
1036 <p>&lt;/pre&gt;
1037 </p>
1038 !! end
1039
1040 !!test
1041 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1042 !!input
1043 {{echo|}}
1044 !!result
1045
1046 !!end
1047
1048 !!test
1049 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1050 !!input
1051 {{echo|
1052 foo}}
1053 !!result
1054 <p>foo
1055 </p>
1056 !!end
1057
1058 !! test
1059 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1060 !! input
1061 {{echo|a
1062 b}}
1063 !!result
1064 <pre>a
1065 </pre>
1066 <p>b
1067 </p>
1068 !!end
1069
1070 !! test
1071 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1072 !! input
1073 {{echo|a
1074 b
1075 c
1076 d
1077 e
1078 }}
1079 !!result
1080 <pre>a
1081 </pre>
1082 <p>b
1083 c
1084 </p>
1085 <pre>d
1086 </pre>
1087 <p>e
1088 </p>
1089 !!end
1090
1091 !!test
1092 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1093 !!input
1094 {{echo| foo}}
1095
1096 {{echo| foo}}{{echo| bar}}
1097
1098 {{echo| foo}}
1099 {{echo| bar}}
1100
1101 {{echo|<!--cmt--> foo}}
1102
1103 <!--cmt-->{{echo| foo}}
1104
1105 {{echo|{{echo| }}bar}}
1106 !!result
1107 <pre>foo
1108 </pre>
1109 <pre>foo bar
1110 </pre>
1111 <pre>foo
1112 bar
1113 </pre>
1114 <pre>foo
1115 </pre>
1116 <pre>foo
1117 </pre>
1118 <pre>bar
1119 </pre>
1120 !!end
1121
1122 !! test
1123 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1124 !! input
1125 {{echo| }}a
1126
1127 {{echo|
1128 }}a
1129
1130 {{echo|
1131 b}}
1132
1133 {{echo|a
1134 }}b
1135
1136 {{echo|a
1137 }} b
1138 !!result
1139 <pre>a
1140 </pre>
1141 <p><br />
1142 </p>
1143 <pre>a
1144 </pre>
1145 <p><br />
1146 </p>
1147 <pre>b
1148 </pre>
1149 <p>a
1150 </p>
1151 <pre>b
1152 </pre>
1153 <p>a
1154 </p>
1155 <pre>b
1156 </pre>
1157 !!end
1158
1159 !! test
1160 Templates: Single-line variant of parameter whitespace stripping test
1161 !! input
1162 {{echo| a}}
1163
1164 {{echo|1= a}}
1165
1166 {{echo|{{echo| a}}}}
1167
1168 {{echo|1={{echo| a}}}}
1169 !! result
1170 <pre>a
1171 </pre>
1172 <p>a
1173 </p>
1174 <pre>a
1175 </pre>
1176 <p>a
1177 </p>
1178 !! end
1179
1180 !! test
1181 Templates: Strip whitespace from named parameters, but not positional ones
1182 !! input
1183 {{echo|
1184 foo}}
1185
1186 {{echo|
1187 * foo}}
1188
1189 {{echo| 1 =
1190 foo}}
1191
1192 {{echo| 1 =
1193 * foo}}
1194 !! result
1195 <pre>foo
1196 </pre>
1197 <p><br />
1198 </p>
1199 <ul><li> foo
1200 </li></ul>
1201 <p>foo
1202 </p>
1203 <ul><li> foo
1204 </li></ul>
1205
1206 !! end
1207
1208 ###
1209 ### Parsoid-centric tests for testing RT edge cases for pre
1210 ###
1211
1212 !!test
1213 1a. Indent-Pre and Comments
1214 !!input
1215 a
1216 <!--a-->
1217 c
1218 !!result
1219 <pre>a
1220 </pre>
1221 <p>c
1222 </p>
1223 !!end
1224
1225 !!test
1226 1b. Indent-Pre and Comments
1227 !!input
1228 a
1229 <!--a-->
1230 c
1231 !!result
1232 <pre>a
1233 </pre>
1234 <p>c
1235 </p>
1236 !!end
1237
1238 !!test
1239 1c. Indent-Pre and Comments
1240 !!input
1241 <!--a--> a
1242
1243 <!--a--> a
1244 !!result
1245 <pre> a
1246 </pre>
1247 <pre> a
1248 </pre>
1249 !!end
1250
1251 !!test
1252 2a. Indent-Pre and tables
1253 !!input
1254 {|
1255 |-
1256 !h1!!h2
1257 |foo||bar
1258 |}
1259 !!result
1260 <table>
1261
1262 <tr>
1263 <th>h1</th>
1264 <th>h2
1265 </th>
1266 <td>foo</td>
1267 <td>bar
1268 </td></tr></table>
1269
1270 !!end
1271
1272 !!test
1273 2b. Indent-Pre and tables
1274 !!input
1275 {|
1276 |-
1277 |foo
1278 |}
1279 !!result
1280 <table>
1281
1282 <tr>
1283 <td>foo
1284 </td></tr></table>
1285
1286 !!end
1287
1288 !!test
1289 2c. Indent-Pre and tables (bug 42252)
1290 !!input
1291 {|
1292 |+ foo
1293 ! | bar
1294 |}
1295 !!result
1296 <table>
1297 <caption> foo
1298 </caption>
1299 <tr>
1300 <th> bar
1301 </th></tr></table>
1302
1303 !!end
1304
1305 !!test
1306 3a. Indent-Pre and block tags (single-line html)
1307 !!input
1308 <p> foo </p>
1309 <div> foo </div>
1310 <span> foo </span>
1311 !!result
1312 <p> foo </p>
1313 <div> foo </div>
1314 <pre><span> foo </span>
1315 </pre>
1316 !!end
1317
1318 !!test
1319 3b. Indent-Pre and block tags (pre-content on separate line)
1320 !!input
1321 <p>
1322 foo
1323 </p>
1324
1325 <div>
1326 foo
1327 </div>
1328
1329 <center>
1330 foo
1331 </center>
1332
1333 <blockquote>
1334 foo
1335 </blockquote>
1336
1337 <table><tr><td>
1338 foo
1339 </td></tr></table>
1340
1341 <ul><li>
1342 foo
1343 </li></ul>
1344
1345 !!result
1346 <p>
1347 foo
1348 </p>
1349 <div>
1350 <pre>foo
1351 </pre>
1352 </div>
1353 <center>
1354 <pre>foo
1355 </pre>
1356 </center>
1357 <blockquote>
1358 foo
1359 </blockquote>
1360 <table><tr><td>
1361 <pre>foo
1362 </pre>
1363 </td></tr></table>
1364 <ul><li>
1365 foo
1366 </li></ul>
1367
1368 !!end
1369
1370 !!test
1371 4. Multiple spaces at start-of-line
1372 !!input
1373 <p> foo </p>
1374 foo
1375 {|
1376 |foo
1377 |}
1378 !!result
1379 <p> foo </p>
1380 <pre> foo
1381 </pre>
1382 <table>
1383 <tr>
1384 <td>foo
1385 </td></tr></table>
1386
1387 !!end
1388
1389 !! test
1390 5. White-space in indent-pre
1391 NOTE: the white-space char on 2nd line is significant
1392 !! input
1393 a<br/>
1394
1395 b
1396 !! result
1397 <pre>a<br />
1398
1399 b
1400 </pre>
1401 !! end
1402
1403 ###
1404 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1405 ###
1406
1407 !!test
1408 HTML-pre: 1. embedded newlines
1409 !!input
1410 <pre>foo</pre>
1411
1412 <pre>
1413 foo
1414 </pre>
1415
1416 <pre>
1417
1418 foo
1419 </pre>
1420
1421 <pre>
1422
1423
1424 foo
1425 </pre>
1426 !!result
1427 <pre>foo</pre>
1428 <pre>
1429 foo
1430 </pre>
1431 <pre>
1432
1433 foo
1434 </pre>
1435 <pre>
1436
1437
1438 foo
1439 </pre>
1440
1441 !!end
1442
1443 !!test
1444 HTML-pre: 2: indented text
1445 !!input
1446 <pre>
1447 foo
1448 </pre>
1449 !!result
1450 <pre>
1451 foo
1452 </pre>
1453
1454 !!end
1455
1456 !!test
1457 HTML-pre: 3: other wikitext
1458 !!input
1459 <pre>
1460 * foo
1461 # bar
1462 = no-h =
1463 '' no-italic ''
1464 [[ NoLink ]]
1465 </pre>
1466 !!result
1467 <pre>
1468 * foo
1469 # bar
1470 = no-h =
1471 '' no-italic ''
1472 [[ NoLink ]]
1473 </pre>
1474
1475 !!end
1476
1477 ###
1478 ### Definition lists
1479 ###
1480 !! test
1481 Simple definition
1482 !! input
1483 ; name : Definition
1484 !! result
1485 <dl><dt> name&#160;</dt><dd> Definition
1486 </dd></dl>
1487
1488 !! end
1489
1490 !! test
1491 Definition list for indentation only
1492 !! input
1493 : Indented text
1494 !! result
1495 <dl><dd> Indented text
1496 </dd></dl>
1497
1498 !! end
1499
1500 !! test
1501 Definition list with no space
1502 !! input
1503 ;name:Definition
1504 !! result
1505 <dl><dt>name</dt><dd>Definition
1506 </dd></dl>
1507
1508 !!end
1509
1510 !! test
1511 Definition list with URL link
1512 !! input
1513 ; http://example.com/ : definition
1514 !! result
1515 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1516 </dd></dl>
1517
1518 !! end
1519
1520 !! test
1521 Definition list with bracketed URL link
1522 !! input
1523 ;[http://www.example.com/ Example]:Something about it
1524 !! result
1525 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1526 </dd></dl>
1527
1528 !! end
1529
1530 !! test
1531 Definition list with wikilink containing colon
1532 !! input
1533 ; [[Help:FAQ]]: The least-read page on Wikipedia
1534 !! result
1535 <dl><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><dd> The least-read page on Wikipedia
1536 </dd></dl>
1537
1538 !! end
1539
1540 # At Brion's and JeLuF's insistence... :)
1541 !! test
1542 Definition list with news link containing colon
1543 !! input
1544 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1545 !! result
1546 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1547 </dd></dl>
1548
1549 !! end
1550
1551 !! test
1552 Malformed definition list with colon
1553 !! input
1554 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1555 !! result
1556 <dl><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
1557 </dt></dl>
1558
1559 !! end
1560
1561 !! test
1562 Definition lists: colon in external link text
1563 !! input
1564 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1565 !! result
1566 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1567 </dd></dl>
1568
1569 !! end
1570
1571 !! test
1572 Definition lists: colon in HTML attribute
1573 !! input
1574 ;<b style="display: inline">bold</b>
1575 !! result
1576 <dl><dt><b style="display: inline">bold</b>
1577 </dt></dl>
1578
1579 !! end
1580
1581 !! test
1582 Definition lists: self-closed tag
1583 !! input
1584 ;one<br/>two : two-line fun
1585 !! result
1586 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1587 </dd></dl>
1588
1589 !! end
1590
1591 !! test
1592 Bug 11748: Literal closing tags
1593 !! input
1594 <dl>
1595 <dt>test 1</dt>
1596 <dd>test test test test test</dd>
1597 <dt>test 2</dt>
1598 <dd>test test test test test</dd>
1599 </dl>
1600 !! result
1601 <dl>
1602 <dt>test 1</dt>
1603 <dd>test test test test test</dd>
1604 <dt>test 2</dt>
1605 <dd>test test test test test</dd>
1606 </dl>
1607
1608 !! end
1609
1610 !! test
1611 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1612 !! input
1613 <ul><li>
1614 ; term : description
1615 * unordered
1616 </li>
1617 </ul>
1618 !! result
1619 <ul><li>
1620 <dl><dt> term&#160;</dt><dd> description
1621 </dd></dl>
1622 <ul><li> unordered
1623 </li></ul>
1624 </li>
1625 </ul>
1626
1627 !! end
1628
1629 !! test
1630
1631 Definition list with empty definition and following paragraph
1632 !! input
1633 ; term:
1634 Paragraph text
1635 !! result
1636 <dl><dt> term</dt><dd>
1637 </dd></dl>
1638 <p>Paragraph text
1639 </p>
1640 !! end
1641
1642 !! test
1643 Nested definition lists using html syntax
1644 !! input
1645 <dl><dd>
1646 <dl>
1647 <dd>Foo</dd>
1648 </dl>
1649 </dd></dl>
1650 !! result
1651 <dl><dd>
1652 <dl>
1653 <dd>Foo</dd>
1654 </dl>
1655 </dd></dl>
1656
1657 !! end
1658
1659 !! test
1660 Definition Lists: No nesting: Multiple dd's
1661 !! input
1662 ;x
1663 :a
1664 :b
1665 !! result
1666 <dl><dt>x
1667 </dt><dd>a
1668 </dd><dd>b
1669 </dd></dl>
1670
1671 !! end
1672
1673 !! test
1674 Definition Lists: Indentation: Regular
1675 !! input
1676 :i1
1677 ::i2
1678 :::i3
1679 !! result
1680 <dl><dd>i1
1681 <dl><dd>i2
1682 <dl><dd>i3
1683 </dd></dl>
1684 </dd></dl>
1685 </dd></dl>
1686
1687 !! end
1688
1689 !! test
1690 Definition Lists: Indentation: Missing 1st level
1691 !! input
1692 ::i2
1693 :::i3
1694 !! result
1695 <dl><dd><dl><dd>i2
1696 <dl><dd>i3
1697 </dd></dl>
1698 </dd></dl>
1699 </dd></dl>
1700
1701 !! end
1702
1703 !! test
1704 Definition Lists: Indentation: Multi-level indent
1705 !! input
1706 :::i3
1707 !! result
1708 <dl><dd><dl><dd><dl><dd>i3
1709 </dd></dl>
1710 </dd></dl>
1711 </dd></dl>
1712
1713 !! end
1714
1715 !! test
1716 Definition Lists: Hacky use to indent tables
1717 !! input
1718 ::{|
1719 |foo
1720 |bar
1721 |}
1722 this text
1723 should be left alone
1724 !! result
1725 <dl><dd><dl><dd><table>
1726 <tr>
1727 <td>foo
1728 </td>
1729 <td>bar
1730 </td></tr></table></dd></dl></dd></dl>
1731 <p>this text
1732 should be left alone
1733 </p>
1734 !! end
1735 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1736 ## as an empty dt item. It also ignores all but the last ";" when followed
1737 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1738 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1739 ## ";"s.
1740 ##
1741 ## Ex: ";;t2 ::d2" is transformed into:
1742 ##
1743 ## <dl>
1744 ## <dt>t2 </dt>
1745 ## <dd>
1746 ## <dl>
1747 ## <dt></dt>
1748 ## <dd>d2</dd>
1749 ## </dl>
1750 ## </dd>
1751 ## </dl>
1752 ##
1753 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1754 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1755 ##
1756 ## <dl>
1757 ## <dt>
1758 ## <dl>
1759 ## <dt>t2 </dt>
1760 ## <dd>:d2</dd>
1761 ## </dl>
1762 ## </dt>
1763 ## </dl>
1764 ##
1765 ## All Parsoid only definition list tests have this difference.
1766 ##
1767 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1768 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1769
1770 !! test
1771 Table / list interaction: indented table with lists in table contents
1772 !! input
1773 :{|
1774 |-
1775 | a
1776 * b
1777 |-
1778 | c
1779 * d
1780 |}
1781 !! result
1782 <dl><dd><table>
1783
1784 <tr>
1785 <td> a
1786 <ul><li> b
1787 </li></ul>
1788 </td></tr>
1789 <tr>
1790 <td> c
1791 <ul><li> d
1792 </li></ul>
1793 </td></tr></table></dd></dl>
1794
1795 !! end
1796
1797 !!test
1798 Table / list interaction: lists nested in tables nested in indented lists
1799 !!input
1800 :{|
1801 |
1802 :a
1803 :b
1804 |
1805 *c
1806 *d
1807 |}
1808
1809 *e
1810 *f
1811 !!result
1812 <dl><dd><table>
1813 <tr>
1814 <td>
1815 <dl><dd>a
1816 </dd><dd>b
1817 </dd></dl>
1818 </td>
1819 <td>
1820 <ul><li>c
1821 </li><li>d
1822 </li></ul>
1823 </td></tr></table></dd></dl>
1824 <ul><li>e
1825 </li><li>f
1826 </li></ul>
1827
1828 !!end
1829
1830 !! test
1831 Definition Lists: Nesting: Multi-level (Parsoid only)
1832 !! options
1833 parsoid
1834 !! input
1835 ;t1 :d1
1836 ;;t2 ::d2
1837 ;;;t3 :::d3
1838 !! result
1839 <dl>
1840 <dt>t1 </dt>
1841 <dd>d1</dd>
1842 <dt>
1843 <dl>
1844 <dt>t2 </dt>
1845 <dd>:d2</dd>
1846 <dt>
1847 <dl>
1848 <dt>t3 </dt>
1849 <dd>::d3</dd>
1850 </dl>
1851 </dt>
1852 </dl>
1853 </dt>
1854 </dl>
1855
1856
1857 !! end
1858
1859
1860 !! test
1861 Definition Lists: Nesting: Test 2 (Parsoid only)
1862 !! options
1863 parsoid
1864 !! input
1865 ;t1
1866 ::d2
1867 !! result
1868 <dl>
1869 <dt>t1</dt>
1870 <dd>
1871 <dl>
1872 <dd>d2</dd>
1873 </dl>
1874 </dd>
1875 </dl>
1876
1877 !! end
1878
1879
1880 !! test
1881 Definition Lists: Nesting: Test 3 (Parsoid only)
1882 !! options
1883 parsoid
1884 !! input
1885 :;t1
1886 ::::d2
1887 !! result
1888 <dl>
1889 <dd>
1890 <dl>
1891 <dt>t1</dt>
1892 <dd>
1893 <dl>
1894 <dd>
1895 <dl>
1896 <dd>d2</dd>
1897 </dl>
1898 </dd>
1899 </dl>
1900 </dd>
1901 </dl>
1902 </dd>
1903 </dl>
1904
1905 !! end
1906
1907
1908 !! test
1909 Definition Lists: Nesting: Test 4
1910 !! input
1911 ::;t3
1912 :::d3
1913 !! result
1914 <dl><dd><dl><dd><dl><dt>t3
1915 </dt><dd>d3
1916 </dd></dl>
1917 </dd></dl>
1918 </dd></dl>
1919
1920 !! end
1921
1922
1923 !! test
1924 Definition Lists: Mixed Lists: Test 1
1925 !! input
1926 :;* foo
1927 ::* bar
1928 :; baz
1929 !! result
1930 <dl><dd><dl><dt><ul><li> foo
1931 </li><li> bar
1932 </li></ul>
1933 </dt></dl>
1934 <dl><dt> baz
1935 </dt></dl>
1936 </dd></dl>
1937
1938 !! end
1939
1940
1941 !! test
1942 Definition Lists: Mixed Lists: Test 2
1943 !! input
1944 *: d1
1945 *: d2
1946 !! result
1947 <ul><li><dl><dd> d1
1948 </dd><dd> d2
1949 </dd></dl>
1950 </li></ul>
1951
1952 !! end
1953
1954
1955 !! test
1956 Definition Lists: Mixed Lists: Test 3
1957 !! input
1958 *::: d1
1959 *::: d2
1960 !! result
1961 <ul><li><dl><dd><dl><dd><dl><dd> d1
1962 </dd><dd> d2
1963 </dd></dl>
1964 </dd></dl>
1965 </dd></dl>
1966 </li></ul>
1967
1968 !! end
1969
1970
1971 !! test
1972 Definition Lists: Mixed Lists: Test 4
1973 !! input
1974 *;d1 :d2
1975 *;d3 :d4
1976 !! result
1977 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1978 </dd><dt>d3&#160;</dt><dd>d4
1979 </dd></dl>
1980 </li></ul>
1981
1982 !! end
1983
1984
1985 !! test
1986 Definition Lists: Mixed Lists: Test 5
1987 !! input
1988 *:d1
1989 *:: d2
1990 !! result
1991 <ul><li><dl><dd>d1
1992 <dl><dd> d2
1993 </dd></dl>
1994 </dd></dl>
1995 </li></ul>
1996
1997 !! end
1998
1999
2000 !! test
2001 Definition Lists: Mixed Lists: Test 6
2002 !! input
2003 #*:d1
2004 #*::: d3
2005 !! result
2006 <ol><li><ul><li><dl><dd>d1
2007 <dl><dd><dl><dd> d3
2008 </dd></dl>
2009 </dd></dl>
2010 </dd></dl>
2011 </li></ul>
2012 </li></ol>
2013
2014 !! end
2015
2016
2017 !! test
2018 Definition Lists: Mixed Lists: Test 7
2019 !! input
2020 :* d1
2021 :* d2
2022 !! result
2023 <dl><dd><ul><li> d1
2024 </li><li> d2
2025 </li></ul>
2026 </dd></dl>
2027
2028 !! end
2029
2030
2031 !! test
2032 Definition Lists: Mixed Lists: Test 8
2033 !! input
2034 :* d1
2035 ::* d2
2036 !! result
2037 <dl><dd><ul><li> d1
2038 </li></ul>
2039 <dl><dd><ul><li> d2
2040 </li></ul>
2041 </dd></dl>
2042 </dd></dl>
2043
2044 !! end
2045
2046
2047 !! test
2048 Definition Lists: Mixed Lists: Test 9
2049 !! input
2050 *;foo :bar
2051 !! result
2052 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2053 </dd></dl>
2054 </li></ul>
2055
2056 !! end
2057
2058
2059 !! test
2060 Definition Lists: Mixed Lists: Test 10
2061 !! input
2062 *#;foo :bar
2063 !! result
2064 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2065 </dd></dl>
2066 </li></ol>
2067 </li></ul>
2068
2069 !! end
2070
2071
2072 !! test
2073 Definition Lists: Mixed Lists: Test 11
2074 !! input
2075 *#*#;*;;foo :bar
2076 *#*#;boo :baz
2077 !! result
2078 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2079 </dt></dl>
2080 </dd></dl>
2081 </li></ul>
2082 </dd></dl>
2083 <dl><dt>boo&#160;</dt><dd>baz
2084 </dd></dl>
2085 </li></ol>
2086 </li></ul>
2087 </li></ol>
2088 </li></ul>
2089
2090 !! end
2091
2092
2093 !! test
2094 Definition Lists: Weird Ones: Test 1
2095 !! input
2096 *#;*::;; foo : bar (who uses this?)
2097 !! result
2098 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2099 </dt></dl>
2100 </dd></dl>
2101 </dd></dl>
2102 </dd></dl>
2103 </li></ul>
2104 </dd></dl>
2105 </li></ol>
2106 </li></ul>
2107
2108 !! end
2109
2110 ###
2111 ### External links
2112 ###
2113 !! test
2114 External links: non-bracketed
2115 !! input
2116 Non-bracketed: http://example.com
2117 !! result
2118 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2119 </p>
2120 !! end
2121
2122 !! test
2123 External links: numbered
2124 !! input
2125 Numbered: [http://example.com]
2126 Numbered: [http://example.net]
2127 Numbered: [http://example.com]
2128 !! result
2129 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2130 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2131 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2132 </p>
2133 !!end
2134
2135 !! test
2136 External links: specified text
2137 !! input
2138 Specified text: [http://example.com link]
2139 !! result
2140 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2141 </p>
2142 !!end
2143
2144 !! test
2145 External links: trail
2146 !! input
2147 Linktrails should not work for external links: [http://example.com link]s
2148 !! result
2149 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2150 </p>
2151 !! end
2152
2153 !! test
2154 External links: dollar sign in URL
2155 !! input
2156 http://example.com/1$2345
2157 !! result
2158 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2159 </p>
2160 !! end
2161
2162 !! test
2163 External links: dollar sign in URL (named)
2164 !! input
2165 [http://example.com/1$2345]
2166 !! result
2167 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2168 </p>
2169 !!end
2170
2171 !! test
2172 External links: open square bracket forbidden in URL (bug 4377)
2173 !! input
2174 http://example.com/1[2345
2175 !! result
2176 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2177 </p>
2178 !! end
2179
2180 !! test
2181 External links: open square bracket forbidden in URL (named) (bug 4377)
2182 !! input
2183 [http://example.com/1[2345]
2184 !! result
2185 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2186 </p>
2187 !!end
2188
2189 !! test
2190 External links: nowiki in URL link text (bug 6230)
2191 !!input
2192 [http://example.com/ <nowiki>''example site''</nowiki>]
2193 !! result
2194 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2195 </p>
2196 !! end
2197
2198 !! test
2199 External links: newline forbidden in text (bug 6230 regression check)
2200 !! input
2201 [http://example.com/ first
2202 second]
2203 !! result
2204 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2205 second]
2206 </p>
2207 !!end
2208
2209 !! test
2210 External links: Pipe char between url and text
2211 !! input
2212 [http://example.com | link]
2213 !! result
2214 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2215 </p>
2216 !!end
2217
2218 !! test
2219 External links: protocol-relative URL in brackets
2220 !! input
2221 [//example.com/ Test]
2222 !! result
2223 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2224 </p>
2225 !! end
2226
2227 !! test
2228 External links: protocol-relative URL in brackets without text
2229 !! input
2230 [//example.com]
2231 !! result
2232 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2233 </p>
2234 !! end
2235
2236 !! test
2237 External links: protocol-relative URL in free text is left alone
2238 !! input
2239 //example.com/Foo
2240 !! result
2241 <p>//example.com/Foo
2242 </p>
2243 !!end
2244
2245 !! test
2246 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2247 !! input
2248 foo//example.com/Foo
2249 !! result
2250 <p>foo//example.com/Foo
2251 </p>
2252 !! end
2253
2254 !! test
2255 External image
2256 !! input
2257 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2258 !! result
2259 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2260 </p>
2261 !! end
2262
2263 !! test
2264 External image from https
2265 !! input
2266 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2267 !! result
2268 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2269 </p>
2270 !! end
2271
2272 !! test
2273 Link to non-http image, no img tag
2274 !! input
2275 Link to non-http image, no img tag: ftp://example.com/test.jpg
2276 !! result
2277 <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>
2278 </p>
2279 !! end
2280
2281 !! test
2282 External links: terminating separator
2283 !! input
2284 Terminating separator: http://example.com/thing,
2285 !! result
2286 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2287 </p>
2288 !! end
2289
2290 !! test
2291 External links: intervening separator
2292 !! input
2293 Intervening separator: http://example.com/1,2,3
2294 !! result
2295 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2296 </p>
2297 !! end
2298
2299 !! test
2300 External links: old bug with URL in query
2301 !! input
2302 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2303 !! result
2304 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2305 </p>
2306 !! end
2307
2308 !! test
2309 External links: old URL-in-URL bug, mixed protocols
2310 !! input
2311 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2312 !! result
2313 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2314 </p>
2315 !!end
2316
2317 !! test
2318 External links: URL in text
2319 !! input
2320 URL in text: [http://example.com http://example.com]
2321 !! result
2322 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2323 </p>
2324 !! end
2325
2326 !! test
2327 External links: Clickable images
2328 !! input
2329 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2330 !! result
2331 <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>
2332 </p>
2333 !!end
2334
2335 !! test
2336 External links: raw ampersand
2337 !! input
2338 Old &amp; use: http://x&y
2339 !! result
2340 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2341 </p>
2342 !! end
2343
2344 !! test
2345 External links: encoded ampersand
2346 !! input
2347 Old &amp; use: http://x&amp;y
2348 !! result
2349 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2350 </p>
2351 !! end
2352
2353 !! test
2354 External links: encoded equals (bug 6102)
2355 !! input
2356 http://example.com/?foo&#61;bar
2357 !! result
2358 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2359 </p>
2360 !! end
2361
2362 !! test
2363 External links: [raw ampersand]
2364 !! input
2365 Old &amp; use: [http://x&y]
2366 !! result
2367 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2368 </p>
2369 !! end
2370
2371 !! test
2372 External links: [encoded ampersand]
2373 !! input
2374 Old &amp; use: [http://x&amp;y]
2375 !! result
2376 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2377 </p>
2378 !! end
2379
2380 !! test
2381 External links: [encoded equals] (bug 6102)
2382 !! input
2383 [http://example.com/?foo&#61;bar]
2384 !! result
2385 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2386 </p>
2387 !! end
2388
2389 !! test
2390 External links: [IDN ignored character reference in hostname; strip it right off]
2391 !! input
2392 [http://e&zwnj;xample.com/]
2393 !! result
2394 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2395 </p>
2396 !! end
2397
2398 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2399 # Where an external link could easily circumvent the sanitization of the text of
2400 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2401 # test demands a higher standard. That's a bit strange.
2402 #
2403 # Example:
2404 #
2405 # http://e‌xample.com -> [http://example.com|http://example.com]
2406 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2407 #
2408 # The first example is sanitized, but the second is not. Any security benefits
2409 # from this production are trivial to circumvent. Either remove this test and
2410 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2411 # the test accordingly.
2412 #
2413 # All our love,
2414 # The Parsoid team.
2415 !! test
2416 External links: IDN ignored character reference in hostname; strip it right off
2417 !! input
2418 http://e&zwnj;xample.com/
2419 !! result
2420 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2421 </p>
2422 !! end
2423
2424 !! test
2425 External links: www.jpeg.org (bug 554)
2426 !! input
2427 http://www.jpeg.org
2428 !!result
2429 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2430 </p>
2431 !! end
2432
2433 !! test
2434 External links: URL within URL (original bug 2)
2435 !! input
2436 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2437 !! result
2438 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2439 </p>
2440 !! end
2441
2442 !! test
2443 BUG 361: URL inside bracketed URL
2444 !! input
2445 [http://www.example.com/foo http://www.example.com/bar]
2446 !! result
2447 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2448 </p>
2449 !! end
2450
2451 !! test
2452 BUG 361: URL within URL, not bracketed
2453 !! input
2454 http://www.example.com/foo?=http://www.example.com/bar
2455 !! result
2456 <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>
2457 </p>
2458 !! end
2459
2460 !! test
2461 BUG 289: ">"-token in URL-tail
2462 !! input
2463 http://www.example.com/<hello>
2464 !! result
2465 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2466 </p>
2467 !!end
2468
2469 !! test
2470 BUG 289: literal ">"-token in URL-tail
2471 !! input
2472 http://www.example.com/<b>html</b>
2473 !! result
2474 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2475 </p>
2476 !!end
2477
2478 !! test
2479 BUG 289: ">"-token in bracketed URL
2480 !! input
2481 [http://www.example.com/<hello> stuff]
2482 !! result
2483 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2484 </p>
2485 !!end
2486
2487 !! test
2488 BUG 289: literal ">"-token in bracketed URL
2489 !! input
2490 [http://www.example.com/<b>html</b> stuff]
2491 !! result
2492 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2493 </p>
2494 !!end
2495
2496 !! test
2497 BUG 289: literal double quote at end of URL
2498 !! input
2499 http://www.example.com/"hello"
2500 !! result
2501 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2502 </p>
2503 !!end
2504
2505 !! test
2506 BUG 289: literal double quote in bracketed URL
2507 !! input
2508 [http://www.example.com/"hello" stuff]
2509 !! result
2510 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2511 </p>
2512 !!end
2513
2514 !! test
2515 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2516 !! input
2517 [http://www.example.com test]
2518 !! result
2519 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2520 </p>
2521 !! end
2522
2523 !! test
2524 External links: link text with spaces
2525 !! input
2526 [http://www.example.com a b c]
2527 [http://www.example.com ''a'' ''b'']
2528 !! result
2529 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2530 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2531 </p>
2532 !! end
2533
2534 !! test
2535 External links: wiki links within external link (Bug 3695)
2536 !! input
2537 [http://example.com [[wikilink]] embedded in ext link]
2538 !! result
2539 <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>
2540 </p>
2541 !! end
2542
2543 !! test
2544 BUG 787: Links with one slash after the url protocol are invalid
2545 !! input
2546 http:/example.com
2547
2548 [http:/example.com title]
2549 !! result
2550 <p>http:/example.com
2551 </p><p>[http:/example.com title]
2552 </p>
2553 !! end
2554
2555 !! test
2556 Bracketed external links with template-generated invalid target
2557 !! input
2558 [{{echo|http:/example.com}} title]
2559 !! result
2560 <p>[http:/example.com title]
2561 </p>
2562 !! end
2563
2564 !! test
2565 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2566 !! input
2567 ''[http://example.com text'']
2568 [http://example.com '''text]'''
2569 ''Something [http://example.com in italic'']
2570 ''Something [http://example.com mixed''''', even bold]'''
2571 '''''Now [http://example.com both''''']
2572 !! result
2573 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2574 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2575 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2576 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2577 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2578 </p>
2579 !! end
2580
2581
2582 !! test
2583 Bug 4781: %26 in URL
2584 !! input
2585 http://www.example.com/?title=AT%26T
2586 !! result
2587 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2588 </p>
2589 !! end
2590
2591 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2592 # % is actually legal in HTML5. Any change in output would need testing though.
2593 !! test
2594 Bug 4781, 5267: %25 in URL
2595 !! input
2596 http://www.example.com/?title=100%25_Bran
2597 !! result
2598 <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>
2599 </p>
2600 !! end
2601
2602 !! test
2603 Bug 4781, 5267: %28, %29 in URL
2604 !! input
2605 http://www.example.com/?title=Ben-Hur_%281959_film%29
2606 !! result
2607 <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>
2608 </p>
2609 !! end
2610
2611
2612 !! test
2613 Bug 4781: %26 in autonumber URL
2614 !! input
2615 [http://www.example.com/?title=AT%26T]
2616 !! result
2617 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2618 </p>
2619 !! end
2620
2621 !! test
2622 Bug 4781, 5267: %26 in autonumber URL
2623 !! input
2624 [http://www.example.com/?title=100%25_Bran]
2625 !! result
2626 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2627 </p>
2628 !! end
2629
2630 !! test
2631 Bug 4781, 5267: %28, %29 in autonumber URL
2632 !! input
2633 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2634 !! result
2635 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2636 </p>
2637 !! end
2638
2639
2640 !! test
2641 Bug 4781: %26 in bracketed URL
2642 !! input
2643 [http://www.example.com/?title=AT%26T link]
2644 !! result
2645 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2646 </p>
2647 !! end
2648
2649 !! test
2650 Bug 4781, 5267: %26 in bracketed URL
2651 !! input
2652 [http://www.example.com/?title=100%25_Bran link]
2653 !! result
2654 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2655 </p>
2656 !! end
2657
2658 !! test
2659 Bug 4781, 5267: %28, %29 in bracketed URL
2660 !! input
2661 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2662 !! result
2663 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2664 </p>
2665 !! end
2666
2667 !! test
2668 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2669 !! input
2670 Some [http://example.com/ pretty ''italics'' and stuff]!
2671 !! result
2672 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2673 </p>
2674 !! end
2675
2676 !! test
2677 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2678 !! input
2679 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2680 !! result
2681 <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>
2682 </p>
2683 !! end
2684
2685 !! test
2686 External link containing double-single-quotes with no space separating the url from text in italics
2687 !! input
2688 [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]].]
2689 !! result
2690 <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>
2691 </p>
2692 !! end
2693
2694 !! test
2695 URL-encoding in URL functions (single parameter)
2696 !! input
2697 {{localurl:Some page|amp=&}}
2698 !! result
2699 <p>/index.php?title=Some_page&amp;amp=&amp;
2700 </p>
2701 !! end
2702
2703 !! test
2704 URL-encoding in URL functions (multiple parameters)
2705 !! input
2706 {{localurl:Some page|q=?&amp=&}}
2707 !! result
2708 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2709 </p>
2710 !! end
2711
2712 !! test
2713 Brackets in urls
2714 !! input
2715 http://example.com/index.php?foozoid%5B%5D=bar
2716
2717 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2718 !! result
2719 <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>
2720 </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>
2721 </p>
2722 !! end
2723
2724 !! test
2725 IPv6 urls (bug 21261)
2726 !! options
2727 disabled
2728 !! input
2729 http://[2404:130:0:1000::187:2]/index.php
2730 !! result
2731 <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>
2732 </p>
2733 !! end
2734
2735 !! test
2736 Non-extlinks in brackets
2737 !! input
2738 [foo]
2739 [foo bar]
2740 [foo ''bar'']
2741 [fool's] errand
2742 [fool's errand]
2743 [{{echo|foo}}]
2744 [{{echo|foo}} bar]
2745 [{{echo|foo}} ''bar'']
2746 [{{echo|foo}}l's] errand
2747 [{{echo|foo}}l's errand]
2748 [url={{echo|foo}}]
2749 [url=http://example.com]
2750 !! result
2751 <p>[foo]
2752 [foo bar]
2753 [foo <i>bar</i>]
2754 [fool's] errand
2755 [fool's errand]
2756 [foo]
2757 [foo bar]
2758 [foo <i>bar</i>]
2759 [fool's] errand
2760 [fool's errand]
2761 [url=foo]
2762 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
2763 </p>
2764 !! end
2765
2766 ###
2767 ### Quotes
2768 ###
2769
2770 !! test
2771 Quotes
2772 !! input
2773 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2774
2775 Normal text. '''''Bold italic text.''''' Normal text.
2776 !!result
2777 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2778 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2779 </p>
2780 !! end
2781
2782
2783 !! test
2784 Unclosed and unmatched quotes
2785 !! input
2786 '''''Bold italic text '''with bold deactivated''' in between.'''''
2787
2788 '''''Bold italic text ''with italic deactivated'' in between.'''''
2789
2790 '''Bold text..
2791
2792 ..spanning two paragraphs (should not work).'''
2793
2794 '''Bold tag left open
2795
2796 ''Italic tag left open
2797
2798 Normal text.
2799
2800 <!-- Unmatching number of opening, closing tags: -->
2801 '''This year''''s election ''should'' beat '''last year''''s.
2802
2803 ''Tom'''s car is bigger than ''Susan'''s.
2804
2805 Plain ''italic'''s plain
2806 !! result
2807 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2808 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2809 </p><p><b>Bold text..</b>
2810 </p><p>..spanning two paragraphs (should not work).
2811 </p><p><b>Bold tag left open</b>
2812 </p><p><i>Italic tag left open</i>
2813 </p><p>Normal text.
2814 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2815 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2816 </p><p>Plain <i>italic'</i>s plain
2817 </p>
2818 !! end
2819
2820 ###
2821 ### Tables
2822 ###
2823 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2824 ###
2825
2826 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2827 # is the bare minimun required by the spec, see:
2828 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2829 !! test
2830 A table with no data.
2831 !! input
2832 {||}
2833 !! result
2834 !! end
2835
2836 # A table with nothing but a caption is invalid XHTML, we might want to render
2837 # this as <p>caption</p>
2838 !! test
2839 A table with nothing but a caption
2840 !! input
2841 {|
2842 |+ caption
2843 |}
2844 !! result
2845 <table>
2846 <caption> caption
2847 </caption><tr><td></td></tr></table>
2848
2849 !! end
2850
2851 !! test
2852 A table with caption with default-spaced attributes and a table row
2853 !! input
2854 {|
2855 |+ style="color: red;" | caption1
2856 |-
2857 | foo
2858 |}
2859 !! result
2860 <table>
2861 <caption style="color: red;"> caption1
2862 </caption>
2863 <tr>
2864 <td> foo
2865 </td></tr></table>
2866
2867 !! end
2868
2869 !! test
2870 A table with captions with non-default spaced attributes and a table row
2871 !! input
2872 {|
2873 |+style="color: red;"|caption2
2874 |+ style="color: red;"| caption3
2875 |-
2876 | foo
2877 |}
2878 !! result
2879 <table>
2880 <caption style="color: red;">caption2
2881 </caption>
2882 <caption style="color: red;"> caption3
2883 </caption>
2884 <tr>
2885 <td> foo
2886 </td></tr></table>
2887
2888 !! end
2889
2890 !! test
2891 Table td-cell syntax variations
2892 !! input
2893 {|
2894 | foo bar foo | baz
2895 | foo bar foo || baz
2896 | style='color:red;' | baz
2897 | style='color:red;' || baz
2898 |}
2899 !! result
2900 <table>
2901 <tr>
2902 <td> baz
2903 </td>
2904 <td> foo bar foo </td>
2905 <td> baz
2906 </td>
2907 <td style="color:red;"> baz
2908 </td>
2909 <td> style='color:red;' </td>
2910 <td> baz
2911 </td></tr></table>
2912
2913 !! end
2914
2915 !! test
2916 Simple table
2917 !! input
2918 {|
2919 | 1 || 2
2920 |-
2921 | 3 || 4
2922 |}
2923 !! result
2924 <table>
2925 <tr>
2926 <td> 1 </td>
2927 <td> 2
2928 </td></tr>
2929 <tr>
2930 <td> 3 </td>
2931 <td> 4
2932 </td></tr></table>
2933
2934 !! end
2935
2936 !! test
2937 Simple table but with multiple dashes for row wikitext
2938 !! input
2939 {|
2940 | foo
2941 |-----
2942 | bar
2943 |}
2944 !! result
2945 <table>
2946 <tr>
2947 <td> foo
2948 </td></tr>
2949 <tr>
2950 <td> bar
2951 </td></tr></table>
2952
2953 !! end
2954 !! test
2955 Multiplication table
2956 !! input
2957 {| border="1" cellpadding="2"
2958 |+Multiplication table
2959 |-
2960 ! &times; !! 1 !! 2 !! 3
2961 |-
2962 ! 1
2963 | 1 || 2 || 3
2964 |-
2965 ! 2
2966 | 2 || 4 || 6
2967 |-
2968 ! 3
2969 | 3 || 6 || 9
2970 |-
2971 ! 4
2972 | 4 || 8 || 12
2973 |-
2974 ! 5
2975 | 5 || 10 || 15
2976 |}
2977 !! result
2978 <table border="1" cellpadding="2">
2979 <caption>Multiplication table
2980 </caption>
2981 <tr>
2982 <th> &#215; </th>
2983 <th> 1 </th>
2984 <th> 2 </th>
2985 <th> 3
2986 </th></tr>
2987 <tr>
2988 <th> 1
2989 </th>
2990 <td> 1 </td>
2991 <td> 2 </td>
2992 <td> 3
2993 </td></tr>
2994 <tr>
2995 <th> 2
2996 </th>
2997 <td> 2 </td>
2998 <td> 4 </td>
2999 <td> 6
3000 </td></tr>
3001 <tr>
3002 <th> 3
3003 </th>
3004 <td> 3 </td>
3005 <td> 6 </td>
3006 <td> 9
3007 </td></tr>
3008 <tr>
3009 <th> 4
3010 </th>
3011 <td> 4 </td>
3012 <td> 8 </td>
3013 <td> 12
3014 </td></tr>
3015 <tr>
3016 <th> 5
3017 </th>
3018 <td> 5 </td>
3019 <td> 10 </td>
3020 <td> 15
3021 </td></tr></table>
3022
3023 !! end
3024
3025 !! test
3026 Accept "||" in table headings
3027 !! input
3028 {|
3029 !h1 || h2
3030 |}
3031 !! result
3032 <table>
3033 <tr>
3034 <th>h1 </th>
3035 <th> h2
3036 </th></tr></table>
3037
3038 !! end
3039
3040 !! test
3041 Accept "||" in indented table headings
3042 !! input
3043 :{|
3044 !h1 || h2
3045 |}
3046 !! result
3047 <dl><dd><table>
3048 <tr>
3049 <th>h1 </th>
3050 <th> h2
3051 </th></tr></table></dd></dl>
3052
3053 !! end
3054
3055 !! test
3056 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3057 !! input
3058 {|
3059 !| h1
3060 || a
3061 |}
3062 !! result
3063 <table>
3064 <tr>
3065 <th> h1
3066 </th>
3067 <td> a
3068 </td></tr></table>
3069
3070 !! end
3071
3072 !!test
3073 Accept "| !" at start of line in tables (ignore !-attribute)
3074 !!input
3075 {|
3076 |-
3077 | !style="color:red" | bar
3078 |}
3079 !!result
3080 <table>
3081
3082 <tr>
3083 <td> bar
3084 </td></tr></table>
3085
3086 !!end
3087
3088 !!test
3089 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 +/-
3090 !!input
3091 {|
3092 |-
3093 |style='color:red;'|+1
3094 |style='color:blue;'|-1
3095 |-
3096 | 1 || 2 || 3
3097 | 1 ||+2 ||-3
3098 |-
3099 | +1
3100 | -1
3101 |}
3102 !!result
3103 <table>
3104
3105 <tr>
3106 <td style="color:red;">+1
3107 </td>
3108 <td style="color:blue;">-1
3109 </td></tr>
3110 <tr>
3111 <td> 1 </td>
3112 <td> 2 </td>
3113 <td> 3
3114 </td>
3115 <td> 1 </td>
3116 <td>+2 </td>
3117 <td>-3
3118 </td></tr>
3119 <tr>
3120 <td> +1
3121 </td>
3122 <td> -1
3123 </td></tr></table>
3124
3125 !!end
3126
3127 !! test
3128 Table rowspan
3129 !! input
3130 {| border=1
3131 | Cell 1, row 1
3132 |rowspan=2| Cell 2, row 1 (and 2)
3133 | Cell 3, row 1
3134 |-
3135 | Cell 1, row 2
3136 | Cell 3, row 2
3137 |}
3138 !! result
3139 <table border="1">
3140 <tr>
3141 <td> Cell 1, row 1
3142 </td>
3143 <td rowspan="2"> Cell 2, row 1 (and 2)
3144 </td>
3145 <td> Cell 3, row 1
3146 </td></tr>
3147 <tr>
3148 <td> Cell 1, row 2
3149 </td>
3150 <td> Cell 3, row 2
3151 </td></tr></table>
3152
3153 !! end
3154
3155 !! test
3156 Nested table
3157 !! input
3158 {| border=1
3159 | &alpha;
3160 |
3161 {| bgcolor=#ABCDEF border=2
3162 |nested
3163 |-
3164 |table
3165 |}
3166 |the original table again
3167 |}
3168 !! result
3169 <table border="1">
3170 <tr>
3171 <td> &#945;
3172 </td>
3173 <td>
3174 <table bgcolor="#ABCDEF" border="2">
3175 <tr>
3176 <td>nested
3177 </td></tr>
3178 <tr>
3179 <td>table
3180 </td></tr></table>
3181 </td>
3182 <td>the original table again
3183 </td></tr></table>
3184
3185 !! end
3186
3187 !! test
3188 Invalid attributes in table cell (bug 1830)
3189 !! input
3190 {|
3191 |Cell:|broken
3192 |}
3193 !! result
3194 <table>
3195 <tr>
3196 <td>broken
3197 </td></tr></table>
3198
3199 !! end
3200
3201
3202 !! test
3203 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3204 !! input
3205 {|
3206 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3207 !! result
3208 <table>
3209 <tr>
3210 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3211 <td>]" onmouseover="alert(document.cookie)"&gt;test
3212 </td>
3213 </tr>
3214 </table>
3215
3216 !! end
3217
3218
3219 !! test
3220 Indented table markup mixed with indented pre content (proposed in bug 6200)
3221 !! input
3222 <table>
3223 <tr>
3224 <td>
3225 Text that should be rendered preformatted
3226 </td>
3227 </tr>
3228 </table>
3229 !! result
3230 <table>
3231 <tr>
3232 <td>
3233 <pre>Text that should be rendered preformatted
3234 </pre>
3235 </td>
3236 </tr>
3237 </table>
3238
3239 !! end
3240
3241 !! test
3242 Template-generated table cell attributes and cell content
3243 !! input
3244 {|
3245 |{{table_attribs}}
3246 |}
3247 !! result
3248 <table>
3249 <tr>
3250 <td style="color: red"> Foo
3251 </td></tr></table>
3252
3253 !! end
3254
3255 !! test
3256 Table with row followed by newlines and table heading
3257 !! input
3258 {|
3259 |-
3260
3261 ! foo
3262 |}
3263 !! result
3264 <table>
3265
3266
3267 <tr>
3268 <th> foo
3269 </th></tr></table>
3270
3271 !! end
3272
3273 # FIXME: Preserve the attribute properly (with an empty string as value) in
3274 # the PHP parser. Parsoid implements the behavior below.
3275 !! test
3276 Table attributes with empty value
3277 !! options
3278 disabled
3279 !! input
3280 {|
3281 | style=| hello
3282 |}
3283 !! result
3284 <table>
3285 <tr>
3286 <td style=""> hello
3287 </td></tr></table>
3288
3289 !! end
3290
3291 !! test
3292 Wikitext table with a lot of comments
3293 !! input
3294 {|
3295 <!-- c0 -->
3296 | foo
3297 <!-- c1 -->
3298 |- <!-- c2 -->
3299 <!-- c3 -->
3300 |<!-- c4 -->
3301 <!-- c5 -->
3302 |}
3303 !! result
3304 <table>
3305 <tr>
3306 <td> foo
3307 </td></tr>
3308 <tr>
3309 <td>
3310 </td></tr></table>
3311
3312 !! end
3313
3314 !! test
3315 Wikitext table with double-line table cell
3316 !! input
3317 {|
3318 |a
3319 b
3320 |}
3321 !! result
3322 <table>
3323 <tr>
3324 <td>a
3325 <p>b
3326 </p>
3327 </td></tr></table>
3328
3329 !! end
3330
3331 # The expected HTML structure in this test is debatable. The PHP parser does
3332 # not parse this kind of table at all. The main focus for Parsoid is on
3333 # round-tripping, so this output is ok for now. TODO: revisit!
3334 !! test
3335 Wikitext table with html-syntax row (Parsoid)
3336 !! options
3337 parsoid
3338 !! input
3339 {|
3340 |-
3341 <td>foo</td>
3342 |}
3343 !! result
3344 <table>
3345 <tbody>
3346 <tr>
3347 <td></td>
3348 <td>foo</td></tr></tbody></table>
3349 !! end
3350
3351 ###
3352 ### Internal links
3353 ###
3354 !! test
3355 Plain link, capitalized
3356 !! input
3357 [[Main Page]]
3358 !! result
3359 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3360 </p>
3361 !! end
3362
3363 !! test
3364 Plain link, uncapitalized
3365 !! input
3366 [[main Page]]
3367 !! result
3368 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3369 </p>
3370 !! end
3371
3372 !! test
3373 Piped link
3374 !! input
3375 [[Main Page|The Main Page]]
3376 !! result
3377 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3378 </p>
3379 !! end
3380
3381 !! test
3382 Broken link
3383 !! input
3384 [[Zigzagzogzagzig]]
3385 !! result
3386 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3387 </p>
3388 !! end
3389
3390 !! test
3391 Broken link with fragment
3392 !! input
3393 [[Zigzagzogzagzig#zug]]
3394 !! result
3395 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3396 </p>
3397 !! end
3398
3399 !! test
3400 Special page link with fragment
3401 !! input
3402 [[Special:Version#anchor]]
3403 !! result
3404 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3405 </p>
3406 !! end
3407
3408 !! test
3409 Nonexistent special page link with fragment
3410 !! input
3411 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3412 !! result
3413 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3414 </p>
3415 !! end
3416
3417 !! test
3418 Link with prefix
3419 !! input
3420 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3421 !! result
3422 <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>
3423 </p>
3424 !! end
3425
3426 !! test
3427 Link with suffix
3428 !! input
3429 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3430 !! result
3431 <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>!!!
3432 </p>
3433 !! end
3434
3435 !! article
3436 prefixed article
3437 !! text
3438 Some text
3439 !! endarticle
3440
3441 !! test
3442 Bug 43661: Piped links with identical prefixes
3443 !! input
3444 [[prefixed article|prefixed articles with spaces]]
3445
3446 [[prefixed article|prefixed articlesaoeu]]
3447
3448 [[Main Page|Main Page test]]
3449 !! result
3450 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3451 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3452 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3453 </p>
3454 !! end
3455
3456
3457 !! test
3458 Link with HTML entity in suffix / tail
3459 !! input
3460 [[Main Page]]&quot;, [[Main Page]]&#97;
3461 !! result
3462 <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;
3463 </p>
3464 !! end
3465
3466 !! test
3467 Link with 3 brackets
3468 !! input
3469 [[[main page]]]
3470 !! result
3471 <p>[[[main page]]]
3472 </p>
3473 !! end
3474
3475 !! test
3476 Piped link with 3 brackets
3477 !! input
3478 [[[main page|the main page]]]
3479 !! result
3480 <p>[[[main page|the main page]]]
3481 </p>
3482 !! end
3483
3484 !! test
3485 Link with multiple pipes
3486 !! input
3487 [[Main Page|The|Main|Page]]
3488 !! result
3489 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3490 </p>
3491 !! end
3492
3493 !! test
3494 Link to namespaces
3495 !! input
3496 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3497 !! result
3498 <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>
3499 </p>
3500 !! end
3501
3502 !! test
3503 Piped link to namespace
3504 !! input
3505 [[Meta:Disclaimers|The disclaimers]]
3506 !! result
3507 <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>
3508 </p>
3509 !! end
3510
3511 !! test
3512 Link containing }
3513 !! input
3514 [[Usually caused by a typo (oops}]]
3515 !! result
3516 <p>[[Usually caused by a typo (oops}]]
3517 </p>
3518 !! end
3519
3520 !! test
3521 Link containing % (not as a hex sequence)
3522 !! input
3523 [[7% Solution]]
3524 !! result
3525 <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>
3526 </p>
3527 !! end
3528
3529 !! test
3530 Link containing % as a single hex sequence interpreted to char
3531 !! input
3532 [[7%25 Solution]]
3533 !! result
3534 <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>
3535 </p>
3536 !!end
3537
3538 !! test
3539 Link containing % as a double hex sequence interpreted to hex sequence
3540 !! input
3541 [[7%2525 Solution]]
3542 !! result
3543 <p>[[7%2525 Solution]]
3544 </p>
3545 !!end
3546
3547 !! test
3548 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3549 Example for such a section: == < ==
3550 !! input
3551 [[%23%3c]][[%23%3e]]
3552 !! result
3553 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3554 </p>
3555 !! end
3556
3557 !! test
3558 Link containing "<#" and ">#" as a hex sequences
3559 !! input
3560 [[%3c%23]][[%3e%23]]
3561 !! result
3562 <p>[[%3c%23]][[%3e%23]]
3563 </p>
3564 !! end
3565
3566 !! test
3567 Link containing double-single-quotes '' (bug 4598)
3568 !! input
3569 [[Lista d''e paise d''o munno]]
3570 !! result
3571 <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>
3572 </p>
3573 !! end
3574
3575 !! test
3576 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3577 !! input
3578 Some [[Link|pretty ''italics'' and stuff]]!
3579 !! result
3580 <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>!
3581 </p>
3582 !! end
3583
3584 !! test
3585 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3586 !! input
3587 ''Some [[Link|pretty ''italics'' and stuff]]!
3588 !! result
3589 <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>
3590 </p>
3591 !! end
3592
3593 !! test
3594 Link with double quotes in title part (literal) and alternate part (interpreted)
3595 !! input
3596 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3597
3598 [[''Pentecoste'']]
3599
3600 [[''Pentecoste''|Pentecoste]]
3601
3602 [[''Pentecoste''|''Pentecoste'']]
3603 !! result
3604 <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>
3605 </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>
3606 </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>
3607 </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>
3608 </p>
3609 !! end
3610
3611 !! test
3612 Broken image links with HTML captions (bug 39700)
3613 !! input
3614 [[File:Nonexistent|<script></script>]]
3615 [[File:Nonexistent|100px|<script></script>]]
3616 [[File:Nonexistent|&lt;]]
3617 [[File:Nonexistent|a<i>b</i>c]]
3618 !! result
3619 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3620 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3621 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3622 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3623 </p>
3624 !! end
3625
3626 !! test
3627 Plain link to URL
3628 !! input
3629 [[http://www.example.com]]
3630 !! result
3631 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3632 </p>
3633 !! end
3634
3635 !! test
3636 Plain link to URL with link text
3637 !! input
3638 [[http://www.example.com Link text]]
3639 !! result
3640 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3641 </p>
3642 !! end
3643
3644 !! test
3645 Plain link to protocol-relative URL
3646 !! input
3647 [[//www.example.com]]
3648 !! result
3649 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3650 </p>
3651 !! end
3652
3653 !! test
3654 Plain link to protocol-relative URL with link text
3655 !! input
3656 [[//www.example.com Link text]]
3657 !! result
3658 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3659 </p>
3660 !! end
3661
3662 !! test
3663 Plain link to page with question mark in title
3664 !! input
3665 [[A?b]]
3666
3667 [[A?b|Baz]]
3668 !! result
3669 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3670 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3671 </p>
3672 !! end
3673
3674
3675 # I'm fairly sure the expected result here is wrong.
3676 # We want these to be URL links, not pseudo-pages with URLs for titles....
3677 # However the current output is also pretty screwy.
3678 #
3679 # ----
3680 # I'm changing it to match the current output--it arguably makes more
3681 # sense in the light of the test above. Old expected result was:
3682 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3683 #</p>
3684 # But I think this test is bordering on "garbage in, garbage out" anyway.
3685 # -- wtm
3686 !! test
3687 Piped link to URL
3688 !! input
3689 Piped link to URL: [[http://www.example.com|an example URL]]
3690 !! result
3691 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3692 </p>
3693 !! end
3694
3695 !! test
3696 BUG 2: [[page|http://url/]] should link to page, not http://url/
3697 !! input
3698 [[Main Page|http://url/]]
3699 !! result
3700 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3701 </p>
3702 !! end
3703
3704 !! test
3705 BUG 337: Escaped self-links should be bold
3706 !! options
3707 title=[[Bug462]]
3708 !! input
3709 [[Bu&#103;462]] [[Bug462]]
3710 !! result
3711 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3712 </p>
3713 !! end
3714
3715 !! test
3716 Self-link to section should not be bold
3717 !! options
3718 title=[[Main Page]]
3719 !! input
3720 [[Main Page#section]]
3721 !! result
3722 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3723 </p>
3724 !! end
3725
3726 !! article
3727 00
3728 !! text
3729 This is 00.
3730 !! endarticle
3731
3732 !!test
3733 Self-link to numeric title
3734 !!options
3735 title=[[0]]
3736 !!input
3737 [[0]]
3738 !!result
3739 <p><strong class="selflink">0</strong>
3740 </p>
3741 !!end
3742
3743 !!test
3744 Link to numeric-equivalent title
3745 !!options
3746 title=[[0]]
3747 !!input
3748 [[00]]
3749 !!result
3750 <p><a href="/wiki/00" title="00">00</a>
3751 </p>
3752 !!end
3753
3754 !! test
3755 <nowiki> inside a link
3756 !! input
3757 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3758 !! result
3759 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3760 </p>
3761 !! end
3762
3763 !! test
3764 Non-breaking spaces in title
3765 !! input
3766 [[&nbsp; Main &nbsp; Page &nbsp;]]
3767 !! result
3768 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3769 </p>
3770 !!end
3771
3772 !! test
3773 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3774 !! options
3775 language=ca
3776 !! input
3777 '''[[Main Page]]'''
3778 !! result
3779 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3780 </p>
3781 !! end
3782
3783 !! test
3784 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3785 !! options
3786 language=ca
3787 !! input
3788 ''[[Main Page]]''
3789 !! result
3790 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3791 </p>
3792 !! end
3793
3794 !! test
3795 Internal link with en linktrail: no apostrophes (bug 27473)
3796 !! options
3797 language=en
3798 !! input
3799 [[Something]]'nice
3800 !! result
3801 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3802 </p>
3803 !! end
3804
3805 !! test
3806 Internal link with ca linktrail with apostrophes (bug 27473)
3807 !! options
3808 language=ca
3809 !! input
3810 [[Something]]'nice
3811 !! result
3812 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3813 </p>
3814 !! end
3815
3816 !! test
3817 Internal link with kaa linktrail with apostrophes (bug 27473)
3818 !! options
3819 language=kaa
3820 !! input
3821 [[Something]]'nice
3822 !! result
3823 <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>
3824 </p>
3825 !! end
3826
3827 !! test
3828 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
3829 !! input
3830 [[Foo| bar]]
3831
3832 [[Foo| ''bar'']]
3833
3834 [http://wp.org foo]
3835
3836 [http://wp.org ''foo'']
3837 !! result
3838 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
3839 </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>
3840 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
3841 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
3842 </p>
3843 !! end
3844
3845 ###
3846 ### Interwiki links (see maintenance/interwiki.sql)
3847 ###
3848
3849 !! test
3850 Inline interwiki link
3851 !! input
3852 [[MeatBall:SoftSecurity]]
3853 !! result
3854 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3855 </p>
3856 !! end
3857
3858 !! test
3859 Inline interwiki link with empty title (bug 2372)
3860 !! input
3861 [[MeatBall:]]
3862 !! result
3863 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3864 </p>
3865 !! end
3866
3867 !! test
3868 Interwiki link encoding conversion (bug 1636)
3869 !! input
3870 *[[Wikipedia:ro:Olteni&#0355;a]]
3871 *[[Wikipedia:ro:Olteni&#355;a]]
3872 !! result
3873 <ul><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>
3874 </li><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>
3875 </li></ul>
3876
3877 !! end
3878
3879 !! test
3880 Interwiki link with fragment (bug 2130)
3881 !! input
3882 [[MeatBall:SoftSecurity#foo]]
3883 !! result
3884 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3885 </p>
3886 !! end
3887
3888 !! test
3889 Interlanguage link
3890 !! input
3891 Blah blah blah
3892 [[zh:Chinese]]
3893 !!result
3894 <p>Blah blah blah
3895 </p>
3896 !! end
3897
3898 !! test
3899 Double interlanguage link
3900 !! input
3901 Blah blah blah
3902 [[es:Spanish]]
3903 [[zh:Chinese]]
3904 !!result
3905 <p>Blah blah blah
3906 </p>
3907 !! end
3908
3909 !! test
3910 Interlanguage link, with prefix links
3911 !! options
3912 language=ln
3913 !! input
3914 Blah blah blah
3915 [[zh:Chinese]]
3916 !!result
3917 <p>Blah blah blah
3918 </p>
3919 !! end
3920
3921 !! test
3922 Double interlanguage link, with prefix links (bug 8897)
3923 !! options
3924 language=ln
3925 !! input
3926 Blah blah blah
3927 [[es:Spanish]]
3928 [[zh:Chinese]]
3929 !!result
3930 <p>Blah blah blah
3931 </p>
3932 !! end
3933
3934 !! test
3935 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3936 !! options
3937 language=ln
3938 !! input
3939 [[WW&nbsp;II]]
3940 !!result
3941 <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>
3942 </p>
3943 !! end
3944
3945 ##
3946 ## XHTML tidiness
3947 ###
3948
3949 !! test
3950 <br> to <br />
3951 !! input
3952 1<br>2<br />3
3953 !! result
3954 <p>1<br />2<br />3
3955 </p>
3956 !! end
3957
3958 !! test
3959 Broken br tag sanitization
3960 !! input
3961 </br>
3962 !! result
3963 <p>&lt;/br&gt;
3964 </p>
3965 !! end
3966
3967 !! test
3968 Incorrecly removing closing slashes from correctly formed XHTML
3969 !! input
3970 <br style="clear:both;" />
3971 !! result
3972 <p><br style="clear:both;" />
3973 </p>
3974 !! end
3975
3976 !! test
3977 Failing to transform badly formed HTML into correct XHTML
3978 !! input
3979 <br style="clear: left;">
3980 <br style="clear: right;">
3981 <br style="clear: both;">
3982 !! result
3983 <p><br style="clear: left;" />
3984 <br style="clear: right;" />
3985 <br style="clear: both;" />
3986 </p>
3987 !!end
3988
3989 !! test
3990 Handling html with a div self-closing tag
3991 !! input
3992 <div title />
3993 <div title/>
3994 <div title/ >
3995 <div title=bar />
3996 <div title=bar/>
3997 <div title=bar/ >
3998 !! result
3999 <p>&lt;div title /&gt;
4000 &lt;div title/&gt;
4001 </p>
4002 <div>
4003 <p>&lt;div title=bar /&gt;
4004 &lt;div title=bar/&gt;
4005 </p>
4006 <div title="bar/"></div>
4007 </div>
4008
4009 !! end
4010
4011 !! test
4012 Handling html with a br self-closing tag
4013 !! input
4014 <br title />
4015 <br title/>
4016 <br title/ >
4017 <br title=bar />
4018 <br title=bar/>
4019 <br title=bar/ >
4020 !! result
4021 <p><br title="title" />
4022 <br title="title" />
4023 <br />
4024 <br title="bar" />
4025 <br title="bar" />
4026 <br title="bar/" />
4027 </p>
4028 !! end
4029
4030 !! test
4031 Horizontal ruler (should it add that extra space?)
4032 !! input
4033 <hr>
4034 <hr >
4035 foo <hr
4036 > bar
4037 !! result
4038 <hr />
4039 <hr />
4040 foo <hr /> bar
4041
4042 !! end
4043
4044 !! test
4045 Horizontal ruler -- 4+ dashes render hr
4046 !! input
4047 ----
4048 !! result
4049 <hr />
4050
4051 !! end
4052
4053 !! test
4054 Horizontal ruler -- eats additional dashes on the same line
4055 !! input
4056 ---------
4057 !! result
4058 <hr />
4059
4060 !! end
4061
4062 !! test
4063 Horizontal ruler -- does not collaps dashes on consecutive lines
4064 !! input
4065 ----
4066 ----
4067 !! result
4068 <hr />
4069 <hr />
4070
4071 !! end
4072
4073 !! test
4074 Horizontal ruler -- <4 dashes render as plain text
4075 !! input
4076 ---
4077 !! result
4078 <p>---
4079 </p>
4080 !! end
4081
4082 !! test
4083 Horizontal ruler -- Supports content following dashes on same line
4084 !! input
4085 ---- Foo
4086 !! result
4087 <hr /> Foo
4088
4089 !! end
4090
4091 ###
4092 ### Block-level elements
4093 ###
4094 !! test
4095 Common list
4096 !! input
4097 *Common list
4098 * item 2
4099 *item 3
4100 !! result
4101 <ul><li>Common list
4102 </li><li> item 2
4103 </li><li>item 3
4104 </li></ul>
4105
4106 !! end
4107
4108 !! test
4109 Numbered list
4110 !! input
4111 #Numbered list
4112 #item 2
4113 # item 3
4114 !! result
4115 <ol><li>Numbered list
4116 </li><li>item 2
4117 </li><li> item 3
4118 </li></ol>
4119
4120 !! end
4121
4122 !! test
4123 Mixed list
4124 !! input
4125 *Mixed list
4126 *# with numbers
4127 ** and bullets
4128 *# and numbers
4129 *bullets again
4130 **bullet level 2
4131 ***bullet level 3
4132 ***#Number on level 4
4133 **bullet level 2
4134 **#Number on level 3
4135 **#Number on level 3
4136 *#number level 2
4137 *Level 1
4138 *** Level 3
4139 #** Level 3, but ordered
4140 !! result
4141 <ul><li>Mixed list
4142 <ol><li> with numbers
4143 </li></ol>
4144 <ul><li> and bullets
4145 </li></ul>
4146 <ol><li> and numbers
4147 </li></ol>
4148 </li><li>bullets again
4149 <ul><li>bullet level 2
4150 <ul><li>bullet level 3
4151 <ol><li>Number on level 4
4152 </li></ol>
4153 </li></ul>
4154 </li><li>bullet level 2
4155 <ol><li>Number on level 3
4156 </li><li>Number on level 3
4157 </li></ol>
4158 </li></ul>
4159 <ol><li>number level 2
4160 </li></ol>
4161 </li><li>Level 1
4162 <ul><li><ul><li> Level 3
4163 </li></ul>
4164 </li></ul>
4165 </li></ul>
4166 <ol><li><ul><li><ul><li> Level 3, but ordered
4167 </li></ul>
4168 </li></ul>
4169 </li></ol>
4170
4171 !! end
4172
4173 !! test
4174 Nested lists 1
4175 !! input
4176 *foo
4177 **bar
4178 !! result
4179 <ul><li>foo
4180 <ul><li>bar
4181 </li></ul>
4182 </li></ul>
4183
4184 !! end
4185
4186 !! test
4187 Nested lists 2
4188 !! input
4189 **foo
4190 *bar
4191 !! result
4192 <ul><li><ul><li>foo
4193 </li></ul>
4194 </li><li>bar
4195 </li></ul>
4196
4197 !! end
4198
4199 !! test
4200 Nested lists 3 (first element empty)
4201 !! input
4202 *
4203 **bar
4204 !! result
4205 <ul><li>
4206 <ul><li>bar
4207 </li></ul>
4208 </li></ul>
4209
4210 !! end
4211
4212 !! test
4213 Nested lists 4 (first element empty)
4214 !! input
4215 **
4216 *bar
4217 !! result
4218 <ul><li><ul><li>
4219 </li></ul>
4220 </li><li>bar
4221 </li></ul>
4222
4223 !! end
4224
4225 !! test
4226 Nested lists 5 (both elements empty)
4227 !! input
4228 **
4229 *
4230 !! result
4231 <ul><li><ul><li>
4232 </li></ul>
4233 </li><li>
4234 </li></ul>
4235
4236 !! end
4237
4238 !! test
4239 Nested lists 6 (both elements empty)
4240 !! input
4241 *
4242 **
4243 !! result
4244 <ul><li>
4245 <ul><li>
4246 </li></ul>
4247 </li></ul>
4248
4249 !! end
4250
4251 !! test
4252 Nested lists 7 (skip initial nesting levels)
4253 !! input
4254 *** foo
4255 !! result
4256 <ul><li><ul><li><ul><li> foo
4257 </li></ul>
4258 </li></ul>
4259 </li></ul>
4260
4261 !! end
4262
4263 !! test
4264 Nested lists 8 (multiple nesting transitions)
4265 !! input
4266 * foo
4267 *** bar
4268 ** baz
4269 * boo
4270 !! result
4271 <ul><li> foo
4272 <ul><li><ul><li> bar
4273 </li></ul>
4274 </li><li> baz
4275 </li></ul>
4276 </li><li> boo
4277 </li></ul>
4278
4279 !! end
4280
4281 !! test
4282 1. Lists with start-of-line-transparent tokens before bullets: Comments
4283 !! input
4284 *foo
4285 *<!--cmt-->bar
4286 <!--cmt-->*baz
4287 !! result
4288 <ul><li>foo
4289 </li><li>bar
4290 </li><li>baz
4291 </li></ul>
4292
4293 !! end
4294
4295 !! test
4296 2. Lists with start-of-line-transparent tokens before bullets: Template close
4297 !! input
4298 *foo {{echo|bar
4299 }}*baz
4300 !! result
4301 <ul><li>foo bar
4302 </li><li>baz
4303 </li></ul>
4304
4305 !! end
4306
4307 !! test
4308 Unbalanced closing block tags break a list
4309 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4310 !! options
4311 disabled
4312 !! input
4313 <div>
4314 *a</div><div>
4315 *b</div>
4316 !! result
4317 <div>
4318 <ul><li>a
4319 </li></ul></div><div>
4320 <ul><li>b
4321 </li></ul></div>
4322 !! end
4323
4324 !! test
4325 Unbalanced closing non-block tags don't break a list
4326 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4327 !! options
4328 disabled
4329 !! input
4330 <span>
4331 *a</span><span>
4332 *b</span>
4333 !! result
4334 <p><span></span>
4335 </p>
4336 <ul><li>a<span></span>
4337 </li><li>b
4338 </li></ul>
4339 !! end
4340
4341 !! test
4342 Unclosed formatting tags that straddle lists are closed and reopened
4343 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4344 !! options
4345 disabled
4346 !! input
4347 # <s> a
4348 # b </s>
4349 !! result
4350 <ol><li> <s> a </s>
4351 </li><li> <s> b </s>
4352 </li></ol>
4353 !! end
4354
4355 !!test
4356 List embedded in a non-block tag
4357 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4358 !! options
4359 parsoid
4360 !!input
4361 <small>
4362 * foo
4363 </small>
4364 !!result
4365 <p><small></small></p>
4366 <small>
4367 <ul>
4368 <li> foo</li>
4369 </ul>
4370 </small>
4371 <p><small></small></p>
4372 !!end
4373
4374 !! test
4375 List items are not parsed correctly following a <pre> block (bug 785)
4376 !! input
4377 * <pre>foo</pre>
4378 * <pre>bar</pre>
4379 * zar
4380 !! result
4381 <ul><li> <pre>foo</pre>
4382 </li><li> <pre>bar</pre>
4383 </li><li> zar
4384 </li></ul>
4385
4386 !! end
4387
4388 !! test
4389 List items from template
4390 !! input
4391
4392 {{inner list}}
4393 * item 2
4394
4395 * item 0
4396 {{inner list}}
4397 * item 2
4398
4399 * item 0
4400 * notSOL{{inner list}}
4401 * item 2
4402 !! result
4403 <ul><li> item 1
4404 </li><li> item 2
4405 </li></ul>
4406 <ul><li> item 0
4407 </li><li> item 1
4408 </li><li> item 2
4409 </li></ul>
4410 <ul><li> item 0
4411 </li><li> notSOL
4412 </li><li> item 1
4413 </li><li> item 2
4414 </li></ul>
4415
4416 !! end
4417
4418 !! test
4419 List interrupted by empty line or heading
4420 !! input
4421 * foo
4422
4423 ** bar
4424 == A heading ==
4425 * Another list item
4426 !! result
4427 <ul><li> foo
4428 </li></ul>
4429 <ul><li><ul><li> bar
4430 </li></ul>
4431 </li></ul>
4432 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading"> A heading </span></h2>
4433 <ul><li> Another list item
4434 </li></ul>
4435
4436 !!end
4437
4438 !!test
4439 Multiple list tags generated by templates
4440 !!input
4441 {{echo|<li>}}a
4442 {{echo|<li>}}b
4443 {{echo|<li>}}c
4444 !!result
4445 <li>a
4446 <li>b
4447 <li>c</li>
4448 </li>
4449 </li>
4450
4451 !!end
4452
4453 ###
4454 ### Magic Words
4455 ###
4456
4457 !! test
4458 Magic Word: {{CURRENTDAY}}
4459 !! input
4460 {{CURRENTDAY}}
4461 !! result
4462 <p>1
4463 </p>
4464 !! end
4465
4466 !! test
4467 Magic Word: {{CURRENTDAY2}}
4468 !! input
4469 {{CURRENTDAY2}}
4470 !! result
4471 <p>01
4472 </p>
4473 !! end
4474
4475 !! test
4476 Magic Word: {{CURRENTDAYNAME}}
4477 !! input
4478 {{CURRENTDAYNAME}}
4479 !! result
4480 <p>Thursday
4481 </p>
4482 !! end
4483
4484 !! test
4485 Magic Word: {{CURRENTDOW}}
4486 !! input
4487 {{CURRENTDOW}}
4488 !! result
4489 <p>4
4490 </p>
4491 !! end
4492
4493 !! test
4494 Magic Word: {{CURRENTMONTH}}
4495 !! input
4496 {{CURRENTMONTH}}
4497 !! result
4498 <p>01
4499 </p>
4500 !! end
4501
4502 !! test
4503 Magic Word: {{CURRENTMONTHABBREV}}
4504 !! input
4505 {{CURRENTMONTHABBREV}}
4506 !! result
4507 <p>Jan
4508 </p>
4509 !! end
4510
4511 !! test
4512 Magic Word: {{CURRENTMONTHNAME}}
4513 !! input
4514 {{CURRENTMONTHNAME}}
4515 !! result
4516 <p>January
4517 </p>
4518 !! end
4519
4520 !! test
4521 Magic Word: {{CURRENTMONTHNAMEGEN}}
4522 !! input
4523 {{CURRENTMONTHNAMEGEN}}
4524 !! result
4525 <p>January
4526 </p>
4527 !! end
4528
4529 !! test
4530 Magic Word: {{CURRENTTIME}}
4531 !! input
4532 {{CURRENTTIME}}
4533 !! result
4534 <p>00:02
4535 </p>
4536 !! end
4537
4538 !! test
4539 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4540 !! input
4541 {{CURRENTWEEK}}
4542 !! result
4543 <p>1
4544 </p>
4545 !! end
4546
4547 !! test
4548 Magic Word: {{CURRENTYEAR}}
4549 !! input
4550 {{CURRENTYEAR}}
4551 !! result
4552 <p>1970
4553 </p>
4554 !! end
4555
4556 !! test
4557 Magic Word: {{FULLPAGENAME}}
4558 !! options
4559 title=[[User:Ævar Arnfjörð Bjarmason]]
4560 !! input
4561 {{FULLPAGENAME}}
4562 !! result
4563 <p>User:Ævar Arnfjörð Bjarmason
4564 </p>
4565 !! end
4566
4567 !! test
4568 Magic Word: {{FULLPAGENAMEE}}
4569 !! options
4570 title=[[User:Ævar Arnfjörð Bjarmason]]
4571 !! input
4572 {{FULLPAGENAMEE}}
4573 !! result
4574 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4575 </p>
4576 !! end
4577
4578 !! test
4579 Magic Word: {{NAMESPACE}}
4580 !! options
4581 title=[[User:Ævar Arnfjörð Bjarmason]]
4582 !! input
4583 {{NAMESPACE}}
4584 !! result
4585 <p>User
4586 </p>
4587 !! end
4588
4589 !! test
4590 Magic Word: {{NAMESPACEE}}
4591 !! options
4592 title=[[User:Ævar Arnfjörð Bjarmason]]
4593 !! input
4594 {{NAMESPACEE}}
4595 !! result
4596 <p>User
4597 </p>
4598 !! end
4599
4600 !! test
4601 Magic Word: {{NAMESPACENUMBER}}
4602 !! options
4603 title=[[User:Ævar Arnfjörð Bjarmason]]
4604 !! input
4605 {{NAMESPACENUMBER}}
4606 !! result
4607 <p>2
4608 </p>
4609 !! end
4610
4611 !! test
4612 Magic Word: {{NUMBEROFFILES}}
4613 !! input
4614 {{NUMBEROFFILES}}
4615 !! result
4616 <p>2
4617 </p>
4618 !! end
4619
4620 !! test
4621 Magic Word: {{PAGENAME}}
4622 !! options
4623 title=[[User:Ævar Arnfjörð Bjarmason]]
4624 !! input
4625 {{PAGENAME}}
4626 !! result
4627 <p>Ævar Arnfjörð Bjarmason
4628 </p>
4629 !! end
4630
4631 !! test
4632 Magic Word: {{PAGENAME}} with metacharacters
4633 !! options
4634 title=[['foo & bar = baz']]
4635 !! input
4636 ''{{PAGENAME}}''
4637 !! result
4638 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4639 </p>
4640 !! end
4641
4642 !! test
4643 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4644 !! options
4645 title=[[*RFC 1234 http://example.com/]]
4646 !! input
4647 {{PAGENAME}}
4648 !! result
4649 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4650 </p>
4651 !! end
4652
4653 !! test
4654 Magic Word: {{PAGENAMEE}}
4655 !! options
4656 title=[[User:Ævar Arnfjörð Bjarmason]]
4657 !! input
4658 {{PAGENAMEE}}
4659 !! result
4660 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4661 </p>
4662 !! end
4663
4664 !! test
4665 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4666 !! options
4667 title=[[*RFC 1234 http://example.com/]]
4668 !! input
4669 {{PAGENAMEE}}
4670 !! result
4671 <p>&#42;RFC_1234_http&#58;//example.com/
4672 </p>
4673 !! end
4674
4675 !! test
4676 Magic Word: {{REVISIONID}}
4677 !! input
4678 {{REVISIONID}}
4679 !! result
4680 <p>1337
4681 </p>
4682 !! end
4683
4684 !! test
4685 Magic Word: {{SCRIPTPATH}}
4686 !! input
4687 {{SCRIPTPATH}}
4688 !! result
4689 <p>/
4690 </p>
4691 !! end
4692
4693 !! test
4694 Magic Word: {{SERVER}}
4695 !! input
4696 {{SERVER}}
4697 !! result
4698 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4699 </p>
4700 !! end
4701
4702 !! test
4703 Magic Word: {{SERVERNAME}}
4704 !! input
4705 {{SERVERNAME}}
4706 !! result
4707 <p>example.org
4708 </p>
4709 !! end
4710
4711 !! test
4712 Magic Word: {{SITENAME}}
4713 !! input
4714 {{SITENAME}}
4715 !! result
4716 <p>MediaWiki
4717 </p>
4718 !! end
4719
4720 !! test
4721 Case-sensitive magic words, when cased differently, should just be template transclusions
4722 !! input
4723 {{CurrentMonth}}
4724 {{currentday}}
4725 {{cURreNTweEK}}
4726 {{currentHour}}
4727 !! result
4728 <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>
4729 <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>
4730 <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>
4731 <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>
4732 </p>
4733 !! end
4734
4735 !! test
4736 Case-insensitive magic words should still work with weird casing.
4737 !! input
4738 {{sErVeRNaMe}}
4739 {{LCFirst:AOEU}}
4740 {{ucFIRST:aoeu}}
4741 {{SERver}}
4742 !! result
4743 <p>example.org
4744 aOEU
4745 Aoeu
4746 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4747 </p>
4748 !! end
4749
4750 !! test
4751 Namespace 1 {{ns:1}}
4752 !! input
4753 {{ns:1}}
4754 !! result
4755 <p>Talk
4756 </p>
4757 !! end
4758
4759 !! test
4760 Namespace 1 {{ns:01}}
4761 !! input
4762 {{ns:01}}
4763 !! result
4764 <p>Talk
4765 </p>
4766 !! end
4767
4768 !! test
4769 Namespace 0 {{ns:0}} (bug 4783)
4770 !! input
4771 {{ns:0}}
4772 !! result
4773
4774 !! end
4775
4776 !! test
4777 Namespace 0 {{ns:00}} (bug 4783)
4778 !! input
4779 {{ns:00}}
4780 !! result
4781
4782 !! end
4783
4784 !! test
4785 Namespace -1 {{ns:-1}}
4786 !! input
4787 {{ns:-1}}
4788 !! result
4789 <p>Special
4790 </p>
4791 !! end
4792
4793 !! test
4794 Namespace User {{ns:User}}
4795 !! input
4796 {{ns:User}}
4797 !! result
4798 <p>User
4799 </p>
4800 !! end
4801
4802 !! test
4803 Namespace User talk {{ns:User_talk}}
4804 !! input
4805 {{ns:User_talk}}
4806 !! result
4807 <p>User talk
4808 </p>
4809 !! end
4810
4811 !! test
4812 Namespace User talk {{ns:uSeR tAlK}}
4813 !! input
4814 {{ns:uSeR tAlK}}
4815 !! result
4816 <p>User talk
4817 </p>
4818 !! end
4819
4820 !! test
4821 Namespace File {{ns:File}}
4822 !! input
4823 {{ns:File}}
4824 !! result
4825 <p>File
4826 </p>
4827 !! end
4828
4829 !! test
4830 Namespace File {{ns:Image}}
4831 !! input
4832 {{ns:Image}}
4833 !! result
4834 <p>File
4835 </p>
4836 !! end
4837
4838 !! test
4839 Namespace (lang=de) Benutzer {{ns:User}}
4840 !! options
4841 language=de
4842 !! input
4843 {{ns:User}}
4844 !! result
4845 <p>Benutzer
4846 </p>
4847 !! end
4848
4849 !! test
4850 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4851 !! options
4852 language=de
4853 !! input
4854 {{ns:3}}
4855 !! result
4856 <p>Benutzer Diskussion
4857 </p>
4858 !! end
4859
4860
4861 !! test
4862 Urlencode
4863 !! input
4864 {{urlencode:hi world?!}}
4865 {{urlencode:hi world?!|WIKI}}
4866 {{urlencode:hi world?!|PATH}}
4867 {{urlencode:hi world?!|QUERY}}
4868 !! result
4869 <p>hi+world%3F%21
4870 hi_world%3F!
4871 hi%20world%3F%21
4872 hi+world%3F%21
4873 </p>
4874 !! end
4875
4876 ###
4877 ### Magic links
4878 ###
4879 !! test
4880 Magic links: internal link to RFC (bug 479)
4881 !! input
4882 [[RFC 123]]
4883 !! result
4884 <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>
4885 </p>
4886 !! end
4887
4888 !! test
4889 Magic links: RFC (bug 479)
4890 !! input
4891 RFC 822
4892 !! result
4893 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4894 </p>
4895 !! end
4896
4897 !! test
4898 Magic links: ISBN (bug 1937)
4899 !! input
4900 ISBN 0-306-40615-2
4901 !! result
4902 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4903 </p>
4904 !! end
4905
4906 !! test
4907 Magic links: PMID incorrectly converts space to underscore
4908 !! input
4909 PMID 1234
4910 !! result
4911 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4912 </p>
4913 !! end
4914
4915 ###
4916 ### Templates
4917 ####
4918
4919 !! test
4920 Nonexistent template
4921 !! input
4922 {{thistemplatedoesnotexist}}
4923 !! result
4924 <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>
4925 </p>
4926 !! end
4927
4928 !! test
4929 Template with invalid target containing tags
4930 !! input
4931 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4932 !! result
4933 <p>{{a<b>b</b>|foo|a=b|a = b}}
4934 </p>
4935 !! end
4936
4937 !! test
4938 Template with invalid target containing unclosed tag
4939 !! input
4940 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4941 !! result
4942 <p>{{a<b>|foo|a=b|a = b}}</b>
4943 </p>
4944 !! end
4945
4946 !! article
4947 Template:test
4948 !! text
4949 This is a test template
4950 !! endarticle
4951
4952 !! test
4953 Simple template
4954 !! input
4955 {{test}}
4956 !! result
4957 <p>This is a test template
4958 </p>
4959 !! end
4960
4961 !! test
4962 Template with explicit namespace
4963 !! input
4964 {{Template:test}}
4965 !! result
4966 <p>This is a test template
4967 </p>
4968 !! end
4969
4970
4971 !! article
4972 Template:paramtest
4973 !! text
4974 This is a test template with parameter {{{param}}}
4975 !! endarticle
4976
4977 !! test
4978 Template parameter
4979 !! input
4980 {{paramtest|param=foo}}
4981 !! result
4982 <p>This is a test template with parameter foo
4983 </p>
4984 !! end
4985
4986 !! article
4987 Template:paramtestnum
4988 !! text
4989 [[{{{1}}}|{{{2}}}]]
4990 !! endarticle
4991
4992 !! test
4993 Template unnamed parameter
4994 !! input
4995 {{paramtestnum|Main Page|the main page}}
4996 !! result
4997 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4998 </p>
4999 !! end
5000
5001 !! article
5002 Template:templatesimple
5003 !! text
5004 (test)
5005 !! endarticle
5006
5007 !! article
5008 Template:templateredirect
5009 !! text
5010 #redirect [[Template:templatesimple]]
5011 !! endarticle
5012
5013 !! article
5014 Template:templateasargtestnum
5015 !! text
5016 {{{{{1}}}}}
5017 !! endarticle
5018
5019 !! article
5020 Template:templateasargtest
5021 !! text
5022 {{template{{{templ}}}}}
5023 !! endarticle
5024
5025 !! article
5026 Template:templateasargtest2
5027 !! text
5028 {{{{{templ}}}}}
5029 !! endarticle
5030
5031 !! test
5032 Template with template name as unnamed argument
5033 !! input
5034 {{templateasargtestnum|templatesimple}}
5035 !! result
5036 <p>(test)
5037 </p>
5038 !! end
5039
5040 !! test
5041 Template with template name as argument
5042 !! input
5043 {{templateasargtest|templ=simple}}
5044 !! result
5045 <p>(test)
5046 </p>
5047 !! end
5048
5049 !! test
5050 Template with template name as argument (2)
5051 !! input
5052 {{templateasargtest2|templ=templatesimple}}
5053 !! result
5054 <p>(test)
5055 </p>
5056 !! end
5057
5058 !! article
5059 Template:templateasargtestdefault
5060 !! text
5061 {{{{{templ|templatesimple}}}}}
5062 !! endarticle
5063
5064 !! article
5065 Template:templa
5066 !! text
5067 '''templ'''
5068 !! endarticle
5069
5070 !! test
5071 Template with default value
5072 !! input
5073 {{templateasargtestdefault}}
5074 !! result
5075 <p>(test)
5076 </p>
5077 !! end
5078
5079 !! test
5080 Template with default value (value set)
5081 !! input
5082 {{templateasargtestdefault|templ=templa}}
5083 !! result
5084 <p><b>templ</b>
5085 </p>
5086 !! end
5087
5088 !! test
5089 Template redirect
5090 !! input
5091 {{templateredirect}}
5092 !! result
5093 <p>(test)
5094 </p>
5095 !! end
5096
5097 !! test
5098 Template with argument in separate line
5099 !! input
5100 {{ templateasargtest |
5101 templ = simple }}
5102 !! result
5103 <p>(test)
5104 </p>
5105 !! end
5106
5107 !! test
5108 Template with complex template as argument
5109 !! input
5110 {{paramtest|
5111 param ={{ templateasargtest |
5112 templ = simple }}}}
5113 !! result
5114 <p>This is a test template with parameter (test)
5115 </p>
5116 !! end
5117
5118 !! test
5119 Template with thumb image (with link in description)
5120 !! input
5121 {{paramtest|
5122 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5123 !! result
5124 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>
5125
5126 !! end
5127
5128 !! article
5129 Template:complextemplate
5130 !! text
5131 {{{1}}} {{paramtest|
5132 param ={{{param}}}}}
5133 !! endarticle
5134
5135 !! test
5136 Template with complex arguments
5137 !! input
5138 {{complextemplate|
5139 param ={{ templateasargtest |
5140 templ = simple }}|[[Template:complextemplate|link]]}}
5141 !! result
5142 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5143 </p>
5144 !! end
5145
5146 !! test
5147 BUG 553: link with two variables in a piped link
5148 !! input
5149 {|
5150 |[[{{{1}}}|{{{2}}}]]
5151 |}
5152 !! result
5153 <table>
5154 <tr>
5155 <td>[[{{{1}}}|{{{2}}}]]
5156 </td></tr></table>
5157
5158 !! end
5159
5160 !! test
5161 Magic variable as template parameter
5162 !! input
5163 {{paramtest|param={{SITENAME}}}}
5164 !! result
5165 <p>This is a test template with parameter MediaWiki
5166 </p>
5167 !! end
5168
5169 !! article
5170 Template:linktest
5171 !! text
5172 [[{{{param}}}|link]]
5173 !! endarticle
5174
5175 !! test
5176 Template parameter as link source
5177 !! input
5178 {{linktest|param=Main Page}}
5179 !! result
5180 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5181 </p>
5182 !! end
5183
5184 !!test
5185 Template-generated attribute string (k='v')
5186 !!input
5187 <span {{attr_str|id|v1}}>bar</span>
5188 !!result
5189 <p><span id="v1">bar</span>
5190 </p>
5191 !!end
5192
5193 !!article
5194 Template:paramtest2
5195 !! text
5196 including another template, {{paramtest|param={{{arg}}}}}
5197 !! endarticle
5198
5199 !! test
5200 Template passing argument to another template
5201 !! input
5202 {{paramtest2|arg='hmm'}}
5203 !! result
5204 <p>including another template, This is a test template with parameter 'hmm'
5205 </p>
5206 !! end
5207
5208 !! article
5209 Template:Linktest2
5210 !! text
5211 Main Page
5212 !! endarticle
5213
5214 !! test
5215 Template as link source
5216 !! input
5217 [[{{linktest2}}]]
5218
5219 [[{{linktest2}}|Main Page]]
5220
5221 [[{{linktest2}}]]Page
5222 !! result
5223 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5224 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5225 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5226 </p>
5227 !! end
5228
5229
5230 !! article
5231 Template:loop1
5232 !! text
5233 {{loop2}}
5234 !! endarticle
5235
5236 !! article
5237 Template:loop2
5238 !! text
5239 {{loop1}}
5240 !! endarticle
5241
5242 !! test
5243 Template infinite loop
5244 !! input
5245 {{loop1}}
5246 !! result
5247 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5248 </p>
5249 !! end
5250
5251 !! test
5252 Template from main namespace
5253 !! input
5254 {{:Main Page}}
5255 !! result
5256 <p>blah blah
5257 </p>
5258 !! end
5259
5260 !! article
5261 Template:table
5262 !! text
5263 {|
5264 | 1 || 2
5265 |-
5266 | 3 || 4
5267 |}
5268 !! endarticle
5269
5270 !! test
5271 BUG 529: Template with table, not included at beginning of line
5272 !! input
5273 foo {{table}}
5274 !! result
5275 <p>foo
5276 </p>
5277 <table>
5278 <tr>
5279 <td> 1 </td>
5280 <td> 2
5281 </td></tr>
5282 <tr>
5283 <td> 3 </td>
5284 <td> 4
5285 </td></tr></table>
5286
5287 !! end
5288
5289 !! test
5290 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5291 !! input
5292 foo
5293 {{table}}
5294 !! result
5295 <p>foo
5296 </p>
5297 <table>
5298 <tr>
5299 <td> 1 </td>
5300 <td> 2
5301 </td></tr>
5302 <tr>
5303 <td> 3 </td>
5304 <td> 4
5305 </td></tr></table>
5306
5307 !! end
5308
5309 !! test
5310 BUG 41: Template parameters shown as broken links
5311 !! input
5312 {{{parameter}}}
5313 !! result
5314 <p>{{{parameter}}}
5315 </p>
5316 !! end
5317
5318 !! test
5319 Template with targets containing wikilinks
5320 !! input
5321 {{[[foo]]}}
5322
5323 {{[[{{echo|foo}}]]}}
5324
5325 {{{{echo|[[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)">foo</a>}}
5328 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5329 </p><p>{{[[foo}}]]
5330 </p>
5331 !! end
5332
5333 !! article
5334 Template:MSGNW test
5335 !! text
5336 ''None'' of '''this''' should be
5337 * interpreted
5338 but rather passed unmodified
5339 {{test}}
5340 !! endarticle
5341
5342 # hmm, fix this or just deprecate msgnw and document its behavior?
5343 !! test
5344 msgnw keyword
5345 !! options
5346 disabled
5347 !! input
5348 {{msgnw:MSGNW test}}
5349 !! result
5350 <p>''None'' of '''this''' should be
5351 * interpreted
5352 but rather passed unmodified
5353 {{test}}
5354 </p>
5355 !! end
5356
5357 !! test
5358 int keyword
5359 !! input
5360 {{int:youhavenewmessages|lots of money|not!}}
5361 !! result
5362 <p>You have lots of money (not!).
5363 </p>
5364 !! end
5365
5366 !! article
5367 Template:Includes
5368 !! text
5369 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5370 !! endarticle
5371
5372 !! test
5373 <includeonly> and <noinclude> being included
5374 !! input
5375 {{Includes}}
5376 !! result
5377 <p>Foobar
5378 </p>
5379 !! end
5380
5381 !! article
5382 Template:Includes2
5383 !! text
5384 <onlyinclude>Foo</onlyinclude>bar
5385 !! endarticle
5386
5387 !! test
5388 <onlyinclude> being included
5389 !! input
5390 {{Includes2}}
5391 !! result
5392 <p>Foo
5393 </p>
5394 !! end
5395
5396
5397 !! article
5398 Template:Includes3
5399 !! text
5400 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5401 !! endarticle
5402
5403 !! test
5404 <onlyinclude> and <includeonly> being included
5405 !! input
5406 {{Includes3}}
5407 !! result
5408 <p>Foo
5409 </p>
5410 !! end
5411
5412 !! test
5413 <includeonly> and <noinclude> on a page
5414 !! input
5415 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5416 !! result
5417 <p>Foozar
5418 </p>
5419 !! end
5420
5421 !! test
5422 Un-closed <noinclude>
5423 !! input
5424 <noinclude>
5425 !! result
5426 !! end
5427
5428 !! test
5429 <onlyinclude> on a page
5430 !! input
5431 <onlyinclude>Foo</onlyinclude>bar
5432 !! result
5433 <p>Foobar
5434 </p>
5435 !! end
5436
5437 !! test
5438 Un-closed <onlyinclude>
5439 !! input
5440 <onlyinclude>
5441 !! result
5442 !! end
5443
5444 !!test
5445 Self-closed noinclude, includeonly, onlyinclude tags
5446 !!input
5447 <noinclude />
5448 <includeonly />
5449 <onlyinclude />
5450 !!result
5451 <p><br />
5452 </p>
5453 !!end
5454
5455 !!test
5456 Unbalanced includeonly and noinclude tags
5457 !!input
5458 {|
5459 |a</noinclude>
5460 |b</noinclude></noinclude>
5461 |c</noinclude></includeonly>
5462 |d</includeonly></includeonly>
5463 |}
5464 !!result
5465 <table>
5466 <tr>
5467 <td>a
5468 </td>
5469 <td>b
5470 </td>
5471 <td>c&lt;/includeonly&gt;
5472 </td>
5473 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5474 </td></tr></table>
5475
5476 !!end
5477
5478 !! article
5479 Template:Includeonly section
5480 !! text
5481 <includeonly>
5482 ==Includeonly section==
5483 </includeonly>
5484 ==Section T-1==
5485 !!endarticle
5486
5487 !! test
5488 Bug 6563: Edit link generation for section shown by <includeonly>
5489 !! input
5490 {{includeonly section}}
5491 !! result
5492 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
5493 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
5494
5495 !! end
5496
5497 # Uses same input as the contents of [[Template:Includeonly section]]
5498 !! test
5499 Bug 6563: Section extraction for section shown by <includeonly>
5500 !! options
5501 section=T-2
5502 !! input
5503 <includeonly>
5504 ==Includeonly section==
5505 </includeonly>
5506 ==Section T-2==
5507 !! result
5508 ==Section T-2==
5509 !! end
5510
5511 !! test
5512 Bug 6563: Edit link generation for section suppressed by <includeonly>
5513 !! input
5514 <includeonly>
5515 ==Includeonly section==
5516 </includeonly>
5517 ==Section 1==
5518 !! result
5519 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
5520
5521 !! end
5522
5523 !! test
5524 Bug 6563: Section extraction for section suppressed by <includeonly>
5525 !! options
5526 section=1
5527 !! input
5528 <includeonly>
5529 ==Includeonly section==
5530 </includeonly>
5531 ==Section 1==
5532 !! result
5533 ==Section 1==
5534 !! end
5535
5536 !! test
5537 Un-closed <includeonly>
5538 !! input
5539 <includeonly>
5540 !! result
5541 !! end
5542
5543 ###
5544 ### <includeonly> and <noinclude> in attributes
5545 ###
5546 !!test
5547 0. includeonly around the entire attribute
5548 !!input
5549 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5550 !!result
5551 <p><span id="v2">bar</span>
5552 </p>
5553 !!end
5554
5555 !!test
5556 1. includeonly in html attr key
5557 !!input
5558 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5559 !!result
5560 <p><span id="foo">bar</span>
5561 </p>
5562 !!end
5563
5564 !!test
5565 2. includeonly in html attr value
5566 !!input
5567 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5568 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5569 !!result
5570 <p><span id="v1">bar</span>
5571 <span id="v1">bar</span>
5572 </p>
5573 !!end
5574
5575 !!test
5576 3. includeonly in part of an attr value
5577 !!input
5578 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5579 !!result
5580 <p><span style="color:red;">bar</span>
5581 </p>
5582 !!end
5583
5584 ###
5585 ### Testing parsing of templates where a template arg
5586 ### has the same name as the template itself.
5587 ###
5588
5589 !! article
5590 Template:quote
5591 !! text
5592 {{{quote|{{{1}}}}}}
5593 !! endarticle
5594
5595 !!test
5596 Templates: Template Name/Arg clash: 1. Use of positional param
5597 !!input
5598 {{quote|foo}}
5599 !!result
5600 <p>foo
5601 </p>
5602 !!end
5603
5604 !!test
5605 Templates: Template Name/Arg clash: 2. Use of named param
5606 !!input
5607 {{quote|quote=foo}}
5608 !!result
5609 <p>foo
5610 </p>
5611 !!end
5612
5613 !!test
5614 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5615 !!input
5616 {{quote|quote}}
5617 !!result
5618 <p>quote
5619 </p>
5620 !!end
5621
5622 ###
5623 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5624 ###
5625
5626 !!test
5627 Templates: 1. Simple use
5628 !!input
5629 {{echo|Foo}}
5630 !!result
5631 <p>Foo
5632 </p>
5633 !!end
5634
5635 !!test
5636 Templates: 2. Inside a block tag
5637 !!input
5638 <div>{{echo|Foo}}</div>
5639 !!result
5640 <div>Foo</div>
5641
5642 !!end
5643
5644 !!test
5645 Templates: P-wrapping: 1a. Templates on consecutive lines
5646 !!input
5647 {{echo|Foo}}
5648 {{echo|bar}}
5649 !!result
5650 <p>Foo
5651 bar
5652 </p>
5653 !!end
5654
5655 !!test
5656 Templates: P-wrapping: 1b. Templates on consecutive lines
5657 !!input
5658 Foo
5659
5660 {{echo|bar}}
5661 {{echo|baz}}
5662 !!result
5663 <p>Foo
5664 </p><p>bar
5665 baz
5666 </p>
5667 !!end
5668
5669 !!test
5670 Templates: P-wrapping: 1c. Templates on consecutive lines
5671 !!input
5672 {{echo|Foo}}
5673 {{echo|bar}} <div>baz</div>
5674 !!result
5675 <p>Foo
5676 </p>
5677 bar <div>baz</div>
5678
5679 !!end
5680
5681 !!test
5682 Templates: Inline Text: 1. Multiple tmeplate uses
5683 !!input
5684 {{echo|Foo}}bar{{echo|baz}}
5685 !!result
5686 <p>Foobarbaz
5687 </p>
5688 !!end
5689
5690 !!test
5691 Templates: Inline Text: 2. Back-to-back template uses
5692 !!input
5693 {{echo|Foo}}{{echo|bar}}
5694 !!result
5695 <p>Foobar
5696 </p>
5697 !!end
5698
5699 !!test
5700 Templates: Block Tags: 1. Multiple template uses
5701 !!input
5702 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5703 !!result
5704 <div>Foo</div><div>bar</div><div>baz</div>
5705
5706 !!end
5707
5708 !!test
5709 Templates: Block Tags: 2. Back-to-back template uses
5710 !!input
5711 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5712 !!result
5713 <div>Foo</div><div>bar</div>
5714
5715 !!end
5716
5717 !!test
5718 Templates: Links: 1. Simple example
5719 !!input
5720 {{echo|[[Foo|bar]]}}
5721 !!result
5722 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5723 </p>
5724 !!end
5725
5726 !!test
5727 Templates: Links: 2. Generation of link href
5728 !!input
5729 [[{{echo|Foo}}|bar]]
5730 !!result
5731 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5732 </p>
5733 !!end
5734
5735 !!test
5736 Templates: Links: 3. Generation of part of a link href
5737 !!input
5738 [[Fo{{echo|o}}|bar]]
5739
5740 [[Foo{{echo|bar}}]]
5741
5742 [[Foo{{echo|bar}}baz]]
5743
5744 [[Foo{{echo|bar}}|bar]]
5745
5746 [[:Foo{{echo|bar}}]]
5747
5748 [[:Foo{{echo|bar}}|bar]]
5749 !!result
5750 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5751 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5752 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5753 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5754 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5755 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5756 </p>
5757 !!end
5758
5759 !!test
5760 Templates: Links: 4. Multiple templates generating link href
5761 !!input
5762 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5763 !!result
5764 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5765 </p>
5766 !!end
5767
5768 !!test
5769 Templates: Links: 5. Generation of link text
5770 !!input
5771 [[Foo|{{echo|bar}}]]
5772 !!result
5773 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5774 </p>
5775 !!end
5776
5777 !!test
5778 Templates: Links: 5. Nested templates (only outermost template should be marked)
5779 !!input
5780 {{echo|[[{{echo|Foo}}|bar]]}}
5781 !!result
5782 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5783 </p>
5784 !!end
5785
5786 !!test
5787 Templates: HTML Tag: 1. Generation of HTML attr. key
5788 !!input
5789 <div {{echo|style}}="color:red;">foo</div>
5790 !!result
5791 <div style="color:red;">foo</div>
5792
5793 !!end
5794
5795 !!test
5796 Templates: HTML Tag: 2. Generation of HTML attr. value
5797 !!input
5798 <div style={{echo|'color:red;'}}>foo</div>
5799 !!result
5800 <div style="color:red;">foo</div>
5801
5802 !!end
5803
5804 !!test
5805 Templates: HTML Tag: 3. Generation of HTML attr key and value
5806 !!input
5807 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5808 !!result
5809 <div style="color:red;">foo</div>
5810
5811 !!end
5812
5813 !!test
5814 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5815 !!input
5816 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5817 !!result
5818 <div title="This is a long title with just one piece templated">foo</div>
5819
5820 !!end
5821
5822 !!test
5823 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5824 !!input
5825 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5826 !!result
5827 <div title="This is a long title with just one piece templated">foo</div>
5828
5829 !!end
5830
5831 !!test
5832 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5833 !!input
5834 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
5835 !!result
5836 <div title="This is a long title with just one piece templated">foo</div>
5837
5838 !!end
5839
5840 !!test
5841 Templates: HTML Tables: 1. Generating start of a HTML table
5842 !!input
5843 {{echo|<table><tr><td>foo</td>}}</tr></table>
5844 !!result
5845 <table><tr><td>foo</td></tr></table>
5846
5847 !!end
5848
5849 !!test
5850 Templates: HTML Tables: 2a. Generating middle of a HTML table
5851 !!input
5852 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5853 !!result
5854 <table><tr><td>foo</td></tr></table>
5855
5856 !!end
5857
5858 !!test
5859 Templates: HTML Tables: 2b. Generating middle of a HTML table
5860 !!input
5861 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5862 !!result
5863 <table><tr><td>foo</td></tr></table>
5864
5865 !!end
5866
5867 !!test
5868 Templates: HTML Tables: 3. Generating end of a HTML table
5869 !!input
5870 <table><tr>{{echo|<td>foo</td></tr></table>}}
5871 !!result
5872 <table><tr><td>foo</td></tr></table>
5873
5874 !!end
5875
5876 !!test
5877 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5878 !!input
5879 {{echo|<table>}}<tr><td>foo</td></tr></table>
5880 !!result
5881 <table><tr><td>foo</td></tr></table>
5882
5883 !!end
5884
5885 !!test
5886 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5887 !!input
5888 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5889 !!result
5890 <table><tr><td>foo</td></tr></table>
5891
5892 !!end
5893
5894 !!test
5895 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5896 !!input
5897 <table><tr>{{echo|<td>}}foo</td></tr></table>
5898 !!result
5899 <table><tr><td>foo</td></tr></table>
5900
5901 !!end
5902
5903 !!test
5904 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5905 !!input
5906 <table><tr><td>foo{{echo|</td>}}</tr></table>
5907 !!result
5908 <table><tr><td>foo</td></tr></table>
5909
5910 !!end
5911
5912 !!test
5913 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5914 !!input
5915 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5916 !!result
5917 <table><tr><td>foo</td></tr></table>
5918
5919 !!end
5920
5921 !!test
5922 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5923 !!input
5924 <table><tr><td>foo</td></tr>{{echo|</table>}}
5925 !!result
5926 <table><tr><td>foo</td></tr></table>
5927
5928 !!end
5929
5930 !!test
5931 Templates: Wiki Tables: 1a. Fostering of entire template content
5932 !!input
5933 {|
5934 {{echo|a}}
5935 |}
5936 !!result
5937 <table>
5938 a
5939 <tr><td></td></tr></table>
5940
5941 !!end
5942
5943 !!test
5944 Templates: Wiki Tables: 1b. Fostering of entire template content
5945 !!input
5946 {|
5947 {{echo|<div>}}
5948 foo
5949 {{echo|</div>}}
5950 |}
5951 !!result
5952 <table>
5953 <div>
5954 <p>foo
5955 </p>
5956 </div>
5957 <tr><td></td></tr></table>
5958
5959 !!end
5960
5961 !!test
5962 Templates: Wiki Tables: 2. Fostering of partial template content
5963 !!input
5964 {|
5965 {{echo|a
5966 <div>b</div>}}
5967 |}
5968 !!result
5969 <table>
5970 a
5971 <div>b</div>
5972 <tr><td></td></tr></table>
5973
5974 !!end
5975
5976 !!test
5977 Templates: Wiki Tables: 3. td-content via multiple templates
5978 !!input
5979 {|
5980 {{echo|{{pipe}}a}}{{echo|b}}
5981 |}
5982 !!result
5983 <table>
5984 <tr>
5985 <td>ab
5986 </td></tr></table>
5987
5988 !!end
5989
5990 !!test
5991 Templates: Wiki Tables: 4. Templated tags, no content
5992 !!input
5993 {{tbl-start}}
5994 {{tbl-end}}
5995 !!result
5996 <table>
5997 <tr><td></td></tr></table>
5998
5999 !!end
6000
6001 !!test
6002 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6003 !!input
6004 {{tbl-start}}
6005 |foo
6006 {{tbl-end}}
6007 !!result
6008 <table>
6009 <tr>
6010 <td>foo
6011 </td></tr></table>
6012
6013 !!end
6014
6015 !!test
6016 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6017 !!input
6018 {{tbl-start}}
6019 {{!}}foo
6020 {{tbl-end}}
6021 !!result
6022 <table>
6023 <tr>
6024 <td>foo
6025 </td></tr></table>
6026
6027 !!end
6028
6029 !!test
6030 Templates: Lists: Multi-line list-items via templates
6031 !!input
6032 *{{echo|a {{nonexistent|
6033 unused}}}}
6034 *{{echo|b {{nonexistent|
6035 unused}}}}
6036 !!result
6037 <ul><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>
6038 </li><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>
6039 </li></ul>
6040
6041 !!end
6042
6043 !!test
6044 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6045 !!input
6046 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6047 !!result
6048 <p><i>ab</i>c<i>d</i>e
6049 </p>
6050 !!end
6051
6052 !!test
6053 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6054 (PHP parser generates misnested html)
6055 !! options
6056 disabled
6057 !!input
6058 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6059 !!result
6060 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6061 !!end
6062
6063 !!test
6064 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6065 (PHP parser generates misnested html)
6066 !! options
6067 disabled
6068 !!input
6069 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6070 !!result
6071 <div><i>a</i></div>
6072 <div><i>b</i>c<i>d</i></div>
6073 <div>e</div>
6074 !!end
6075
6076 !!test
6077 Templates: Ugly nesting: 4. Divs opened/closed across templates
6078 !!input
6079 a<div>b{{echo|c</div>d}}e
6080 !!result
6081 a<div>bc</div>de
6082
6083 !!end
6084
6085 !!test
6086 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6087 (Parsoid-centric)
6088 !! options
6089 parsoid
6090 !!input
6091 {|
6092 |{{echo|foo</table>}}
6093 |bar
6094 |}
6095 !!result
6096 <table about="#mwt1" typeof="mw:Object/Template ">
6097 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6098 bar</span><span about="#mwt1">
6099 </span>
6100 !!end
6101
6102 !!test
6103 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6104 (Parsoid-centric)
6105 !! options
6106 parsoid
6107 !!input
6108 <table>
6109 <tr>
6110 <td>
6111 <table>
6112 <tr>
6113 <td>1. {{echo|foo </table>}}</td>
6114 <td> bar </td>
6115 <td>2. {{echo|baz </table>}}</td>
6116 </tr>
6117 <tr>
6118 <td>abc</td>
6119 </tr>
6120 </table>
6121 </td>
6122 </tr>
6123 <tr>
6124 <td>xyz</td>
6125 </tr>
6126 </table>
6127 !!result
6128 <table about="#mwt1" typeof="mw:Object/Template">
6129 <tbody><tr >
6130 <td >
6131 <table >
6132 <tbody><tr >
6133 <td >1. foo </td></tr></tbody></table></td>
6134 <td > bar </td>
6135 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6136 </span><span about="#mwt1">
6137
6138 abc</span><span about="#mwt1">
6139 </span><span about="#mwt1">
6140 </span><span about="#mwt1">
6141 </span><span about="#mwt1">
6142 </span><span about="#mwt1">
6143
6144 xyz</span><span about="#mwt1">
6145 </span><span about="#mwt1">
6146 </span>
6147 !!end
6148
6149 !! test
6150 Templates: Ugly templates: 3. newline-only template parameter
6151 !! input
6152 foo {{echo|
6153 }}
6154 !! result
6155 <p>foo
6156 </p>
6157 !! end
6158
6159 # This looks like a bug: a single newline triggers p/br for some reason.
6160 !! test
6161 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6162 !! input
6163 {{echo|
6164 }}
6165 !! result
6166 <p><br />
6167 </p>
6168 !! end
6169
6170
6171 !!test
6172 Parser Functions: 1. Simple example
6173 !!input
6174 {{uc:foo}}
6175 !!result
6176 <p>FOO
6177 </p>
6178 !!end
6179
6180 !!test
6181 Parser Functions: 2. Nested use (only outermost should be marked up)
6182 !!input
6183 {{uc:{{lc:FOO}}}}
6184 !!result
6185 <p>FOO
6186 </p>
6187 !!end
6188
6189 ###
6190 ### Pre-save transform tests
6191 ###
6192 !! test
6193 pre-save transform: subst:
6194 !! options
6195 PST
6196 !! input
6197 {{subst:test}}
6198 !! result
6199 This is a test template
6200 !! end
6201
6202 !! test
6203 pre-save transform: normal template
6204 !! options
6205 PST
6206 !! input
6207 {{test}}
6208 !! result
6209 {{test}}
6210 !! end
6211
6212 !! test
6213 pre-save transform: nonexistent template
6214 !! options
6215 PST
6216 !! input
6217 {{thistemplatedoesnotexist}}
6218 !! result
6219 {{thistemplatedoesnotexist}}
6220 !! end
6221
6222
6223 !! test
6224 pre-save transform: subst magic variables
6225 !! options
6226 PST
6227 !! input
6228 {{subst:SITENAME}}
6229 !! result
6230 MediaWiki
6231 !! end
6232
6233 # This is bug 89, which I fixed. -- wtm
6234 !! test
6235 pre-save transform: subst: templates with parameters
6236 !! options
6237 pst
6238 !! input
6239 {{subst:paramtest|param="something else"}}
6240 !! result
6241 This is a test template with parameter "something else"
6242 !! end
6243
6244 !! article
6245 Template:nowikitest
6246 !! text
6247 <nowiki>'''not wiki'''</nowiki>
6248 !! endarticle
6249
6250 !! test
6251 pre-save transform: nowiki in subst (bug 1188)
6252 !! options
6253 pst
6254 !! input
6255 {{subst:nowikitest}}
6256 !! result
6257 <nowiki>'''not wiki'''</nowiki>
6258 !! end
6259
6260
6261 !! article
6262 Template:commenttest
6263 !! text
6264 This template has <!-- a comment --> in it.
6265 !! endarticle
6266
6267 !! test
6268 pre-save transform: comment in subst (bug 1936)
6269 !! options
6270 pst
6271 !! input
6272 {{subst:commenttest}}
6273 !! result
6274 This template has <!-- a comment --> in it.
6275 !! end
6276
6277 !! test
6278 pre-save transform: unclosed tag
6279 !! options
6280 pst noxml
6281 !! input
6282 <nowiki>'''not wiki'''
6283 !! result
6284 <nowiki>'''not wiki'''
6285 !! end
6286
6287 !! test
6288 pre-save transform: mixed tag case
6289 !! options
6290 pst noxml
6291 !! input
6292 <NOwiki>'''not wiki'''</noWIKI>
6293 !! result
6294 <NOwiki>'''not wiki'''</noWIKI>
6295 !! end
6296
6297 !! test
6298 pre-save transform: unclosed comment in <nowiki>
6299 !! options
6300 pst noxml
6301 !! input
6302 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6303 !! result
6304 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6305 !!end
6306
6307 !! article
6308 Template:dangerous
6309 !!text
6310 <span onmouseover="alert('crap')">Oh no</span>
6311 !!endarticle
6312
6313 !!test
6314 (confirming safety of fix for subst bug 1936)
6315 !! input
6316 {{Template:dangerous}}
6317 !! result
6318 <p><span>Oh no</span>
6319 </p>
6320 !! end
6321
6322 !! test
6323 pre-save transform: comment containing gallery (bug 5024)
6324 !! options
6325 pst
6326 !! input
6327 <!-- <gallery>data</gallery> -->
6328 !!result
6329 <!-- <gallery>data</gallery> -->
6330 !!end
6331
6332 !! test
6333 pre-save transform: comment containing extension
6334 !! options
6335 pst
6336 !! input
6337 <!-- <tag>data</tag> -->
6338 !!result
6339 <!-- <tag>data</tag> -->
6340 !!end
6341
6342 !! test
6343 pre-save transform: comment containing nowiki
6344 !! options
6345 pst
6346 !! input
6347 <!-- <nowiki>data</nowiki> -->
6348 !!result
6349 <!-- <nowiki>data</nowiki> -->
6350 !!end
6351
6352 !! test
6353 pre-save transform: <noinclude> in subst (bug 3298)
6354 !! options
6355 pst
6356 !! input
6357 {{subst:Includes}}
6358 !! result
6359 Foobar
6360 !! end
6361
6362 !! test
6363 pre-save transform: <onlyinclude> in subst (bug 3298)
6364 !! options
6365 pst
6366 !! input
6367 {{subst:Includes2}}
6368 !! result
6369 Foo
6370 !! end
6371
6372 !! article
6373 Template:SubstTest
6374 !!text
6375 {{<includeonly>subst:</includeonly>Includes}}
6376 !! endarticle
6377
6378 !! article
6379 Template:SafeSubstTest
6380 !! text
6381 {{<includeonly>safesubst:</includeonly>Includes}}
6382 !! endarticle
6383
6384 !! test
6385 bug 22297: safesubst: works during PST
6386 !! options
6387 pst
6388 !! input
6389 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6390 !! result
6391 FoobarFoobar
6392 !! end
6393
6394 !! test
6395 bug 22297: safesubst: works during normal parse
6396 !! input
6397 {{SafeSubstTest}}
6398 !! result
6399 <p>Foobar
6400 </p>
6401 !! end
6402
6403 !! test:
6404 subst: does not work during normal parse
6405 !! input
6406 {{SubstTest}}
6407 !! result
6408 <p>{{subst:Includes}}
6409 </p>
6410 !! end
6411
6412 !! test
6413 pre-save transform: context links ("pipe trick")
6414 !! options
6415 pst
6416 !! input
6417 [[Article (context)|]]
6418 [[Bar:Article|]]
6419 [[:Bar:Article|]]
6420 [[Bar:Article (context)|]]
6421 [[:Bar:Article (context)|]]
6422 [[|Article]]
6423 [[|Article (context)]]
6424 [[Bar:X (Y) Z|]]
6425 [[:Bar:X (Y) Z|]]
6426 !! result
6427 [[Article (context)|Article]]
6428 [[Bar:Article|Article]]
6429 [[:Bar:Article|Article]]
6430 [[Bar:Article (context)|Article]]
6431 [[:Bar:Article (context)|Article]]
6432 [[Article]]
6433 [[Article (context)]]
6434 [[Bar:X (Y) Z|X (Y) Z]]
6435 [[:Bar:X (Y) Z|X (Y) Z]]
6436 !! end
6437
6438 !! test
6439 pre-save transform: context links ("pipe trick") with interwiki prefix
6440 !! options
6441 pst
6442 !! input
6443 [[interwiki:Article|]]
6444 [[:interwiki:Article|]]
6445 [[interwiki:Bar:Article|]]
6446 [[:interwiki:Bar:Article|]]
6447 !! result
6448 [[interwiki:Article|Article]]
6449 [[:interwiki:Article|Article]]
6450 [[interwiki:Bar:Article|Bar:Article]]
6451 [[:interwiki:Bar:Article|Bar:Article]]
6452 !! end
6453
6454 !! test
6455 pre-save transform: context links ("pipe trick") with parens in title
6456 !! options
6457 pst title=[[Somearticle (context)]]
6458 !! input
6459 [[|Article]]
6460 !! result
6461 [[Article (context)|Article]]
6462 !! end
6463
6464 !! test
6465 pre-save transform: context links ("pipe trick") with comma in title
6466 !! options
6467 pst title=[[Someplace, Somewhere]]
6468 !! input
6469 [[|Otherplace]]
6470 [[Otherplace, Elsewhere|]]
6471 [[Otherplace, Elsewhere, Anywhere|]]
6472 !! result
6473 [[Otherplace, Somewhere|Otherplace]]
6474 [[Otherplace, Elsewhere|Otherplace]]
6475 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6476 !! end
6477
6478 !! test
6479 pre-save transform: context links ("pipe trick") with parens and comma
6480 !! options
6481 pst title=[[Someplace (IGNORED), Somewhere]]
6482 !! input
6483 [[|Otherplace]]
6484 [[Otherplace (place), Elsewhere|]]
6485 !! result
6486 [[Otherplace, Somewhere|Otherplace]]
6487 [[Otherplace (place), Elsewhere|Otherplace]]
6488 !! end
6489
6490 !! test
6491 pre-save transform: context links ("pipe trick") with comma and parens
6492 !! options
6493 pst title=[[Who, me? (context)]]
6494 !! input
6495 [[|Yes, you.]]
6496 [[Me, Myself, and I (1937 song)|]]
6497 !! result
6498 [[Yes, you. (context)|Yes, you.]]
6499 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6500 !! end
6501
6502 !! test
6503 pre-save transform: context links ("pipe trick") with namespace
6504 !! options
6505 pst title=[[Ns:Somearticle]]
6506 !! input
6507 [[|Article]]
6508 !! result
6509 [[Ns:Article|Article]]
6510 !! end
6511
6512 !! test
6513 pre-save transform: context links ("pipe trick") with namespace and parens
6514 !! options
6515 pst title=[[Ns:Somearticle (context)]]
6516 !! input
6517 [[|Article]]
6518 !! result
6519 [[Ns:Article (context)|Article]]
6520 !! end
6521
6522 !! test
6523 pre-save transform: context links ("pipe trick") with namespace and comma
6524 !! options
6525 pst title=[[Ns:Somearticle, Context, Whatever]]
6526 !! input
6527 [[|Article]]
6528 !! result
6529 [[Ns:Article, Context, Whatever|Article]]
6530 !! end
6531
6532 !! test
6533 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6534 !! options
6535 pst title=[[Ns:Somearticle, Context (context)]]
6536 !! input
6537 [[|Article]]
6538 !! result
6539 [[Ns:Article (context)|Article]]
6540 !! end
6541
6542 !! test
6543 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6544 !! options
6545 pst title=[[Ns:Somearticle (IGNORED), Context]]
6546 !! input
6547 [[|Article]]
6548 !! result
6549 [[Ns:Article, Context|Article]]
6550 !! end
6551
6552 !! test
6553 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6554 !! options
6555 pst
6556 !! input
6557 [[Article(context)|]]
6558 [[Bar:Article(context)|]]
6559 [[:Bar:Article(context)|]]
6560 [[|Article(context)]]
6561 [[Bar:X(Y)Z|]]
6562 [[:Bar:X(Y)Z|]]
6563 !! result
6564 [[Article(context)|Article]]
6565 [[Bar:Article(context)|Article]]
6566 [[:Bar:Article(context)|Article]]
6567 [[Article(context)]]
6568 [[Bar:X(Y)Z|X(Y)Z]]
6569 [[:Bar:X(Y)Z|X(Y)Z]]
6570 !! end
6571
6572 !! test
6573 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6574 !! options
6575 pst
6576 !! input
6577 [[Article (context)|]]
6578 [[Bar:Article (context)|]]
6579 [[:Bar:Article (context)|]]
6580 [[|Article (context)]]
6581 [[Bar:X (Y) Z|]]
6582 [[:Bar:X (Y) Z|]]
6583 !! result
6584 [[Article (context)|Article]]
6585 [[Bar:Article (context)|Article]]
6586 [[:Bar:Article (context)|Article]]
6587 [[Article (context)]]
6588 [[Bar:X (Y) Z|X (Y) Z]]
6589 [[:Bar:X (Y) Z|X (Y) Z]]
6590 !! end
6591
6592 !! test
6593 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6594 !! options
6595 pst
6596 !! input
6597 [[Article(context)|]]
6598 [[Bar:Article(context)|]]
6599 [[:Bar:Article(context)|]]
6600 [[|Article(context)]]
6601 [[Bar:X(Y)Z|]]
6602 [[:Bar:X(Y)Z|]]
6603 !! result
6604 [[Article(context)|Article]]
6605 [[Bar:Article(context)|Article]]
6606 [[:Bar:Article(context)|Article]]
6607 [[Article(context)]]
6608 [[Bar:X(Y)Z|X(Y)Z]]
6609 [[:Bar:X(Y)Z|X(Y)Z]]
6610 !! end
6611
6612 !! test
6613 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6614 !! options
6615 pst
6616 !! input
6617 [[Article (context), context|]]
6618 [[Article (context),context|]]
6619 [[Bar:Article (context), context|]]
6620 [[Bar:Article (context),context|]]
6621 [[:Bar:Article (context), context|]]
6622 [[:Bar:Article (context),context|]]
6623 !! result
6624 [[Article (context), context|Article]]
6625 [[Article (context),context|Article]]
6626 [[Bar:Article (context), context|Article]]
6627 [[Bar:Article (context),context|Article]]
6628 [[:Bar:Article (context), context|Article]]
6629 [[:Bar:Article (context),context|Article]]
6630 !! end
6631
6632 !! test
6633 pre-save transform: trim trailing empty lines
6634 !! options
6635 pst
6636 !! input
6637 Empty lines are trimmed
6638
6639
6640
6641
6642 !! result
6643 Empty lines are trimmed
6644 !! end
6645
6646 !! test
6647 pre-save transform: Signature expansion
6648 !! options
6649 pst
6650 !! input
6651 * ~~~
6652 * <noinclude>~~~</noinclude>
6653 * <includeonly>~~~</includeonly>
6654 * <onlyinclude>~~~</onlyinclude>
6655 !! result
6656 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6657 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6658 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6659 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6660 !! end
6661
6662
6663 !! test
6664 pre-save transform: Signature expansion in nowiki tags (bug 93)
6665 !! options
6666 pst disabled
6667 !! input
6668 Shall not expand:
6669
6670 <nowiki>~~~~</nowiki>
6671
6672 <includeonly><nowiki>~~~~</nowiki></includeonly>
6673
6674 <noinclude><nowiki>~~~~</nowiki></noinclude>
6675
6676 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6677
6678 {{subst:Foo}} shall be converted to FOO
6679
6680 As well as inside noinclude/onlyinclude
6681 <noinclude>{{subst:Foo}}</noinclude>
6682 <onlyinclude>{{subst:Foo}}</onlyinclude>
6683
6684 But not inside includeonly
6685 <includeonly>{{subst:Foo}}</includeonly>
6686 !! result
6687 Shall not expand:
6688
6689 <nowiki>~~~~</nowiki>
6690
6691 <includeonly><nowiki>~~~~</nowiki></includeonly>
6692
6693 <noinclude><nowiki>~~~~</nowiki></noinclude>
6694
6695 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6696
6697 FOO shall be converted to FOO
6698
6699 As well as inside noinclude/onlyinclude
6700 <noinclude>FOO</noinclude>
6701 <onlyinclude>FOO</onlyinclude>
6702
6703 But not inside includeonly
6704 <includeonly>{{subst:Foo}}</includeonly>
6705 !! end
6706
6707 ###
6708 ### Message transform tests
6709 ###
6710 !! test
6711 message transform: magic variables
6712 !! options
6713 msg
6714 !! input
6715 {{SITENAME}}
6716 !! result
6717 MediaWiki
6718 !! end
6719
6720 !! test
6721 message transform: should not transform wiki markup
6722 !! options
6723 msg
6724 !! input
6725 ''test''
6726 !! result
6727 ''test''
6728 !! end
6729
6730 !! test
6731 message transform: <noinclude> in transcluded template (bug 4926)
6732 !! options
6733 msg
6734 !! input
6735 {{Includes}}
6736 !! result
6737 Foobar
6738 !! end
6739
6740 !! test
6741 message transform: <onlyinclude> in transcluded template (bug 4926)
6742 !! options
6743 msg
6744 !! input
6745 {{Includes2}}
6746 !! result
6747 Foo
6748 !! end
6749
6750 !! test
6751 {{#special:}} page name, known
6752 !! options
6753 msg
6754 !! input
6755 {{#special:Recentchanges}}
6756 !! result
6757 Special:RecentChanges
6758 !! end
6759
6760 !! test
6761 {{#special:}} page name with subpage, known
6762 !! options
6763 msg
6764 !! input
6765 {{#special:Recentchanges/param}}
6766 !! result
6767 Special:RecentChanges/param
6768 !! end
6769
6770 !! test
6771 {{#special:}} page name, unknown
6772 !! options
6773 msg
6774 !! input
6775 {{#special:foobarnonexistent}}
6776 !! result
6777 No such special page
6778 !! end
6779
6780 !! test
6781 {{#speciale:}} page name, known
6782 !! options
6783 msg
6784 !! input
6785 {{#speciale:Recentchanges}}
6786 !! result
6787 Special:RecentChanges
6788 !! end
6789
6790 !! test
6791 {{#speciale:}} page name with subpage, known
6792 !! options
6793 msg
6794 !! input
6795 {{#speciale:Recentchanges/param}}
6796 !! result
6797 Special:RecentChanges/param
6798 !! end
6799
6800 !! test
6801 {{#speciale:}} page name, unknown
6802 !! options
6803 msg
6804 !! input
6805 {{#speciale:foobarnonexistent}}
6806 !! result
6807 No_such_special_page
6808 !! end
6809
6810 ###
6811 ### Images
6812 ###
6813 !! test
6814 Simple image
6815 !! input
6816 [[Image:foobar.jpg]]
6817 !! result
6818 <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>
6819 </p>
6820 !! end
6821
6822 !! test
6823 Right-aligned image
6824 !! input
6825 [[Image:foobar.jpg|right]]
6826 !! result
6827 <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>
6828
6829 !! end
6830
6831 !! test
6832 Simple image (using File: namespace, now canonical)
6833 !! input
6834 [[File:foobar.jpg]]
6835 !! result
6836 <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>
6837 </p>
6838 !! end
6839
6840 !! test
6841 Image with caption
6842 !! input
6843 [[Image:foobar.jpg|right|Caption text]]
6844 !! result
6845 <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>
6846
6847 !! end
6848
6849 !! test
6850 Image with empty attribute
6851 !! input
6852 [[Image:foobar.jpg|right||Caption text]]
6853 !! result
6854 <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>
6855
6856 !! end
6857
6858 !! test
6859 Image with link tails
6860 !! input
6861 123[[Image:foobar.jpg]]456
6862 123[[Image:foobar.jpg|right]]456
6863 123[[Image:foobar.jpg|thumb]]456
6864 !! result
6865 <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
6866 </p>
6867 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
6868 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
6869
6870 !! end
6871
6872 !! test
6873 Image with multiple captions -- only last one is accepted
6874 !! input
6875 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6876 !! result
6877 <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>
6878
6879 !! end
6880
6881 !! test
6882 Image with width attribute at different positions
6883 !! input
6884 [[Image:foobar.jpg|200px|right|Caption]]
6885 [[Image:foobar.jpg|right|200px|Caption]]
6886 [[Image:foobar.jpg|right|Caption|200px]]
6887 !! result
6888 <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>
6889 <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>
6890 <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>
6891
6892 !! end
6893
6894 !! test
6895 Image with link parameter, wiki target
6896 !! input
6897 [[Image:foobar.jpg|link=Target page]]
6898 !! result
6899 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6900 </p>
6901 !! end
6902
6903 !! test
6904 Image with link parameter, URL target
6905 !! input
6906 [[Image:foobar.jpg|link=http://example.com/]]
6907 !! result
6908 <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>
6909 </p>
6910 !! end
6911
6912 !! test
6913 Image with link parameter, wgExternalLinkTarget
6914 !! input
6915 [[Image:foobar.jpg|link=http://example.com/]]
6916 !! config
6917 wgExternalLinkTarget='foobar'
6918 !! result
6919 <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>
6920 </p>
6921 !! end
6922
6923 !! test
6924 Image with link parameter, wgNoFollowLinks set to false
6925 !! input
6926 [[Image:foobar.jpg|link=http://example.com/]]
6927 !! config
6928 wgNoFollowLinks=false
6929 !! result
6930 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6931 </p>
6932 !! end
6933
6934 !! test
6935 Image with link parameter, wgNoFollowDomainExceptions
6936 !! input
6937 [[Image:foobar.jpg|link=http://example.com/]]
6938 !! config
6939 wgNoFollowDomainExceptions='example.com'
6940 !! result
6941 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6942 </p>
6943 !! end
6944
6945 !! test
6946 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6947 !! input
6948 [[Image:foobar.jpg|link=http://example.com/|Title]]
6949 !! config
6950 wgExternalLinkTarget='foobar'
6951 !! result
6952 <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>
6953 </p>
6954 !! end
6955
6956 !! test
6957 Image with empty link parameter
6958 !! input
6959 [[Image:foobar.jpg|link=]]
6960 !! result
6961 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6962 </p>
6963 !! end
6964
6965 !! test
6966 Image with link parameter (wiki target) and unnamed parameter
6967 !! input
6968 [[Image:foobar.jpg|link=Target page|Title]]
6969 !! result
6970 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6971 </p>
6972 !! end
6973
6974 !! test
6975 Image with link parameter (URL target) and unnamed parameter
6976 !! input
6977 [[Image:foobar.jpg|link=http://example.com/|Title]]
6978 !! result
6979 <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>
6980 </p>
6981 !! end
6982
6983 !! test
6984 Thumbnail image with link parameter
6985 !! input
6986 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6987 !! result
6988 <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>
6989
6990 !! end
6991
6992 !! test
6993 Image with frame and link
6994 !! input
6995 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6996 !! result
6997 <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>
6998
6999 !! end
7000
7001 !! test
7002 Image with frame and link and explicit alt
7003 !! input
7004 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7005 !! result
7006 <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>
7007
7008 !! end
7009
7010 !! test
7011 Image with wiki markup in implicit alt
7012 !! input
7013 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7014 !! result
7015 <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>
7016 </p>
7017 !! end
7018
7019 !! test
7020 Image with wiki markup in explicit alt
7021 !! input
7022 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7023 !! result
7024 <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>
7025 </p>
7026 !! end
7027
7028 !! test
7029 Link to image page- image page normally doesn't exists, hence edit link
7030 Add test with existing image page
7031 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7032 !! input
7033 [[:Image:test]]
7034 !! result
7035 <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>
7036 </p>
7037 !! end
7038
7039 !! test
7040 bug 18784 Link to non-existent image page with caption should use caption as link text
7041 !! input
7042 [[:Image:test|caption]]
7043 !! result
7044 <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>
7045 </p>
7046 !! end
7047
7048 !! test
7049 Frameless image caption with a free URL
7050 !! input
7051 [[Image:foobar.jpg|http://example.com]]
7052 !! result
7053 <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>
7054 </p>
7055 !! end
7056
7057 !! test
7058 Thumbnail image caption with a free URL
7059 !! input
7060 [[Image:foobar.jpg|thumb|http://example.com]]
7061 !! result
7062 <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>
7063
7064 !! end
7065
7066 !! test
7067 Thumbnail image caption with a free URL and explicit alt
7068 !! input
7069 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7070 !! result
7071 <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>
7072
7073 !! end
7074
7075 !! test
7076 BUG 1887: A ISBN with a thumbnail
7077 !! input
7078 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7079 !! result
7080 <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>
7081
7082 !! end
7083
7084 !! test
7085 BUG 1887: A RFC with a thumbnail
7086 !! input
7087 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7088 !! result
7089 <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>
7090
7091 !! end
7092
7093 !! test
7094 BUG 1887: A mailto link with a thumbnail
7095 !! input
7096 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7097 !! result
7098 <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>
7099
7100 !! end
7101
7102 # Pending resolution to bug 368
7103 !! test
7104 BUG 648: Frameless image caption with a link
7105 !! input
7106 [[Image:foobar.jpg|text with a [[link]] in it]]
7107 !! result
7108 <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>
7109 </p>
7110 !! end
7111
7112 !! test
7113 BUG 648: Frameless image caption with a link (suffix)
7114 !! input
7115 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7116 !! result
7117 <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>
7118 </p>
7119 !! end
7120
7121 !! test
7122 BUG 648: Frameless image caption with an interwiki link
7123 !! input
7124 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7125 !! result
7126 <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>
7127 </p>
7128 !! end
7129
7130 !! test
7131 BUG 648: Frameless image caption with a piped interwiki link
7132 !! input
7133 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7134 !! result
7135 <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>
7136 </p>
7137 !! end
7138
7139 !! test
7140 Escape HTML special chars in image alt text
7141 !! input
7142 [[Image:foobar.jpg|& < > "]]
7143 !! result
7144 <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>
7145 </p>
7146 !! end
7147
7148 !! test
7149 BUG 499: Alt text should have &#1234;, not &amp;1234;
7150 !! input
7151 [[Image:foobar.jpg|&#9792;]]
7152 !! result
7153 <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>
7154 </p>
7155 !! end
7156
7157 !! test
7158 Broken image caption with link
7159 !! input
7160 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7161 !! result
7162 <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.
7163 </p>
7164 !! end
7165
7166 !! test
7167 Image caption containing another image
7168 !! input
7169 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7170 !! result
7171 <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>
7172
7173 !! end
7174
7175 !! test
7176 Image caption containing a newline
7177 !! input
7178 [[Image:Foobar.jpg|This
7179 *is some text]]
7180 !! result
7181 <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>
7182 </p>
7183 !!end
7184
7185 !!test
7186 Parsoid: Image caption containing leading space
7187 (The leading space should not trigger nowiki escaping in wt2wt mode)
7188 !! input
7189 [[Image:Foobar.jpg|thumb| bar]]
7190 !! result
7191 <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>
7192
7193 !!end
7194
7195 !! test
7196 Bug 3090: External links other than http: in image captions
7197 !! input
7198 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7199 !! result
7200 <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>
7201
7202 !! end
7203
7204 !! test
7205 Custom class
7206 !! input
7207 [[Image:foobar.jpg|a|class=b]]
7208 !! result
7209 <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>
7210 </p>
7211 !! end
7212
7213 !! test
7214 Localized image handling (1).
7215 !! options
7216 language=es
7217 !! input
7218 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7219 !! result
7220 <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>
7221
7222 !! end
7223
7224 !! test
7225 Localized image handling (2).
7226 !! options
7227 language=es
7228 !! input
7229 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7230 !! result
7231 <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>
7232
7233 !! end
7234
7235 !! test
7236 "border", "frameless" and "class" attributes on an image.
7237 !! input
7238 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7239 !! result
7240 <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>
7241 </p>
7242 !! end
7243
7244 !! article
7245 File:Barfoo.jpg
7246 !! text
7247 #REDIRECT [[File:Barfoo.jpg]]
7248 !! endarticle
7249
7250 !! test
7251 Redirected image
7252 !! input
7253 [[Image:Barfoo.jpg]]
7254 !! result
7255 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7256 </p>
7257 !! end
7258
7259 !! test
7260 Missing image with uploads disabled
7261 !! options
7262 wgEnableUploads=0
7263 !! input
7264 [[Image:Foobaz.jpg]]
7265 !! result
7266 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7267 </p>
7268 !! end
7269
7270
7271 ###
7272 ### Subpages
7273 ###
7274 !! article
7275 Subpage test/subpage
7276 !! text
7277 foo
7278 !! endarticle
7279
7280 !! test
7281 Subpage link
7282 !! options
7283 subpage title=[[Subpage test]]
7284 !! input
7285 [[/subpage]]
7286 !! result
7287 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7288 </p>
7289 !! end
7290
7291 !! test
7292 Subpage noslash link
7293 !! options
7294 subpage title=[[Subpage test]]
7295 !!input
7296 [[/subpage/]]
7297 !! result
7298 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7299 </p>
7300 !! end
7301
7302 !! test
7303 Disabled subpages
7304 !! input
7305 [[/subpage]]
7306 !! result
7307 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7308 </p>
7309 !! end
7310
7311 !! test
7312 BUG 561: {{/Subpage}}
7313 !! options
7314 subpage title=[[Page]]
7315 !! input
7316 {{/Subpage}}
7317 !! result
7318 <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>
7319 </p>
7320 !! end
7321
7322 ###
7323 ### Categories
7324 ###
7325 !! article
7326 Category:MediaWiki User's Guide
7327 !! text
7328 blah
7329 !! endarticle
7330
7331 !! test
7332 Link to category
7333 !! input
7334 [[:Category:MediaWiki User's Guide]]
7335 !! result
7336 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7337 </p>
7338 !! end
7339
7340 !! test
7341 Simple category
7342 !! options
7343 cat
7344 !! input
7345 [[Category:MediaWiki User's Guide]]
7346 !! result
7347 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7348 !! end
7349
7350 !! test
7351 PAGESINCATEGORY invalid title fatal (r33546 fix)
7352 !! input
7353 {{PAGESINCATEGORY:<bogus>}}
7354 !! result
7355 <p>0
7356 </p>
7357 !! end
7358
7359 !! test
7360 Category with different sort key
7361 !! options
7362 cat
7363 !! input
7364 [[Category:MediaWiki User's Guide|Foo]]
7365 !! result
7366 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7367 !! end
7368
7369 !! test
7370 Category with identical sort key
7371 !! options
7372 cat
7373 !! input
7374 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7375 !! result
7376 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7377 !! end
7378
7379 !! test
7380 Category with empty sort key
7381 !! options
7382 cat
7383 pst
7384 !! input
7385 [[Category:MediaWiki User's Guide|]]
7386 !! result
7387 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7388 !! end
7389
7390 !! test
7391 Category with empty sort key and parentheses
7392 !! options
7393 cat
7394 pst
7395 !! input
7396 [[Category:Foo (bar)|]]
7397 !! result
7398 [[Category:Foo (bar)|Foo]]
7399 !! end
7400
7401 !! test
7402 Category with link tail
7403 !! options
7404 cat
7405 pst
7406 !! input
7407 123[[Category:Foo]]456
7408 !! result
7409 123[[Category:Foo]]456
7410 !! end
7411
7412 !! test
7413 Category with template
7414 !! options
7415 cat
7416 pst
7417 !! input
7418 [[Category:{{echo|Foo}}]]
7419 !! result
7420 [[Category:{{echo|Foo}}]]
7421 !! end
7422
7423 !! test
7424 Category with template in sort key
7425 !! options
7426 cat
7427 pst
7428 !! input
7429 [[Category:Foo|{{echo|Bar}}]]
7430 !! result
7431 [[Category:Foo|{{echo|Bar}}]]
7432 !! end
7433
7434 !! test
7435 Category with template in sort key and title
7436 !! options
7437 cat
7438 pst
7439 !! input
7440 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7441 !! result
7442 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7443 !! end
7444
7445 !! test
7446 Category / paragraph interactions
7447 !! input
7448 Foo [[Category:Baz]] Bar
7449
7450 Foo [[Category:Baz]]
7451 Bar
7452
7453 Foo
7454 [[Category:Baz]]
7455 Bar
7456
7457 Foo
7458 [[Category:Baz]] Bar
7459
7460 Foo
7461 [[Category:Baz]]
7462 [[Category:Baz]]
7463 [[Category:Baz]]
7464 Bar
7465
7466 [[Category:Baz]]
7467 [[Category:Baz]]
7468 [[Category:Baz]]
7469
7470 [[Category:Baz]]
7471 {{echo|[[Category:Baz]]}}
7472 [[Category:Baz]]
7473 !! result
7474 <p>Foo Bar
7475 </p><p>Foo
7476 Bar
7477 </p><p>Foo
7478 Bar
7479 </p><p>Foo Bar
7480 </p><p>Foo
7481 Bar
7482 </p>
7483 !! end
7484
7485 ###
7486 ### Inter-language links
7487 ###
7488 !! test
7489 Inter-language links
7490 !! options
7491 ill
7492 !! input
7493 [[es:Alimento]]
7494 [[fr:Nourriture]]
7495 [[zh:&#39135;&#21697;]]
7496 !! result
7497 es:Alimento fr:Nourriture zh:食品
7498 !! end
7499
7500 !! test
7501 Duplicate interlanguage links (bug 24502)
7502 !! options
7503 ill
7504 !! input
7505 [[es:1]]
7506 [[es:2]]
7507 [[fr:1]]
7508 [[fr:2]]
7509 !! result
7510 es:1 fr:1
7511 !! end
7512
7513 ###
7514 ### Sections
7515 ###
7516 !! test
7517 Basic section headings
7518 !! input
7519 == Headline 1 ==
7520 Some text
7521
7522 ==Headline 2==
7523 More
7524 ===Smaller headline===
7525 Blah blah
7526 !! result
7527 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
7528 <p>Some text
7529 </p>
7530 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
7531 <p>More
7532 </p>
7533 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3>
7534 <p>Blah blah
7535 </p>
7536 !! end
7537
7538 !! test
7539 Section headings with TOC
7540 !! input
7541 == Headline 1 ==
7542 === Subheadline 1 ===
7543 ===== Skipping a level =====
7544 ====== Skipping a level ======
7545
7546 == Headline 2 ==
7547 Some text
7548 ===Another headline===
7549 !! result
7550 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7551 <ul>
7552 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7553 <ul>
7554 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7555 <ul>
7556 <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>
7557 <ul>
7558 <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>
7559 </ul>
7560 </li>
7561 </ul>
7562 </li>
7563 </ul>
7564 </li>
7565 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7566 <ul>
7567 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7568 </ul>
7569 </li>
7570 </ul>
7571 </td></tr></table>
7572 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
7573 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1"> Subheadline 1 </span></h3>
7574 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level"> Skipping a level </span></h5>
7575 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2"> Skipping a level </span></h6>
7576 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2"> Headline 2 </span></h2>
7577 <p>Some text
7578 </p>
7579 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3>
7580
7581 !! end
7582
7583 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7584 !! test
7585 Handling of sections up to level 6 and beyond
7586 !! input
7587 = Level 1 Heading=
7588 == Level 2 Heading==
7589 === Level 3 Heading===
7590 ==== Level 4 Heading====
7591 ===== Level 5 Heading=====
7592 ====== Level 6 Heading======
7593 ======= Level 7 Heading=======
7594 ======== Level 8 Heading========
7595 ========= Level 9 Heading=========
7596 ========== Level 10 Heading==========
7597 !! result
7598 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7599 <ul>
7600 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7601 <ul>
7602 <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>
7603 <ul>
7604 <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>
7605 <ul>
7606 <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>
7607 <ul>
7608 <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>
7609 <ul>
7610 <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>
7611 <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>
7612 <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>
7613 <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>
7614 <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>
7615 </ul>
7616 </li>
7617 </ul>
7618 </li>
7619 </ul>
7620 </li>
7621 </ul>
7622 </li>
7623 </ul>
7624 </li>
7625 </ul>
7626 </td></tr></table>
7627 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading"> Level 1 Heading</span></h1>
7628 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading"> Level 2 Heading</span></h2>
7629 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading"> Level 3 Heading</span></h3>
7630 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading"> Level 4 Heading</span></h4>
7631 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading"> Level 5 Heading</span></h5>
7632 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading"> Level 6 Heading</span></h6>
7633 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6>
7634 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6>
7635 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6>
7636 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6>
7637
7638 !! end
7639
7640 !! test
7641 TOC regression (bug 9764)
7642 !! input
7643 == title 1 ==
7644 === title 1.1 ===
7645 ==== title 1.1.1 ====
7646 === title 1.2 ===
7647 == title 2 ==
7648 === title 2.1 ===
7649 !! result
7650 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7651 <ul>
7652 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7653 <ul>
7654 <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>
7655 <ul>
7656 <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>
7657 </ul>
7658 </li>
7659 <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>
7660 </ul>
7661 </li>
7662 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7663 <ul>
7664 <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>
7665 </ul>
7666 </li>
7667 </ul>
7668 </td></tr></table>
7669 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
7670 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
7671 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
7672 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
7673 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
7674 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
7675
7676 !! end
7677
7678 !! test
7679 TOC with wgMaxTocLevel=3 (bug 6204)
7680 !! options
7681 wgMaxTocLevel=3
7682 !! input
7683 == title 1 ==
7684 === title 1.1 ===
7685 ==== title 1.1.1 ====
7686 === title 1.2 ===
7687 == title 2 ==
7688 === title 2.1 ===
7689 !! result
7690 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7691 <ul>
7692 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7693 <ul>
7694 <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>
7695 <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>
7696 </ul>
7697 </li>
7698 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7699 <ul>
7700 <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>
7701 </ul>
7702 </li>
7703 </ul>
7704 </td></tr></table>
7705 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
7706 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
7707 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
7708 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
7709 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
7710 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
7711
7712 !! end
7713
7714 !! test
7715 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7716 !! options
7717 wgMaxTocLevel=3
7718 !! input
7719 ==Section 1==
7720 ===Section 1.1===
7721 ====Section 1.1.1====
7722 ====Section 1.1.1.1====
7723 ==Section 2==
7724 !! result
7725 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7726 <ul>
7727 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7728 <ul>
7729 <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>
7730 </ul>
7731 </li>
7732 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7733 </ul>
7734 </td></tr></table>
7735 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7736 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3>
7737 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4>
7738 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4>
7739 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7740
7741 !! end
7742
7743
7744 !! test
7745 Resolving duplicate section names
7746 !! input
7747 == Foo bar ==
7748 == Foo bar ==
7749 !! result
7750 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
7751 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2"> Foo bar </span></h2>
7752
7753 !! end
7754
7755 !! test
7756 Resolving duplicate section names with differing case (bug 10721)
7757 !! input
7758 == Foo bar ==
7759 == Foo Bar ==
7760 !! result
7761 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
7762 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> Foo Bar </span></h2>
7763
7764 !! end
7765
7766 !! article
7767 Template:sections
7768 !! text
7769 ===Section 1===
7770 ==Section 2==
7771 !! endarticle
7772
7773 !! test
7774 Template with sections, __NOTOC__
7775 !! input
7776 __NOTOC__
7777 ==Section 0==
7778 {{sections}}
7779 ==Section 4==
7780 !! result
7781 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2>
7782 <h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3>
7783 <h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7784 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2>
7785
7786 !! end
7787
7788 !! test
7789 __NOEDITSECTION__ keyword
7790 !! input
7791 __NOEDITSECTION__
7792 ==Section 1==
7793 ==Section 2==
7794 !! result
7795 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7796 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7797
7798 !! end
7799
7800 !! test
7801 Link inside a section heading
7802 !! input
7803 ==Section with a [[Main Page|link]] in it==
7804 !! result
7805 <h2><span class="editsection">[<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> <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></h2>
7806
7807 !! end
7808
7809 !! test
7810 TOC regression (bug 12077)
7811 !! input
7812 __TOC__
7813 == title 1 ==
7814 === title 1.1 ===
7815 == title 2 ==
7816 !! result
7817 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7818 <ul>
7819 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7820 <ul>
7821 <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>
7822 </ul>
7823 </li>
7824 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7825 </ul>
7826 </td></tr></table>
7827 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
7828 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
7829 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
7830
7831 !! end
7832
7833 !! test
7834 BUG 1219 URL next to image (good)
7835 !! input
7836 http://example.com [[Image:foobar.jpg]]
7837 !! result
7838 <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>
7839 </p>
7840 !!end
7841
7842 !! test
7843 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
7844 !! input
7845 ===
7846 The line above must have a trailing space!
7847 === <!--
7848 --> <!-- -->
7849 But just in case it doesn't...
7850 !! result
7851 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
7852 <p>The line above must have a trailing space!
7853 </p>
7854 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
7855 <p>But just in case it doesn't...
7856 </p>
7857 !! end
7858
7859 !! test
7860 Header with special characters (bug 25462)
7861 !! input
7862 The tooltips shall not show entities to the user (ie. be double escaped)
7863
7864 == text > text ==
7865 section 1
7866
7867 == text < text ==
7868 section 2
7869
7870 == text & text ==
7871 section 3
7872
7873 == text ' text ==
7874 section 4
7875
7876 == text " text ==
7877 section 5
7878 !! result
7879 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7880 </p>
7881 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7882 <ul>
7883 <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>
7884 <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>
7885 <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>
7886 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7887 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7888 </ul>
7889 </td></tr></table>
7890 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span> <span class="mw-headline" id="text_.3E_text"> text &gt; text </span></h2>
7891 <p>section 1
7892 </p>
7893 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span> <span class="mw-headline" id="text_.3C_text"> text &lt; text </span></h2>
7894 <p>section 2
7895 </p>
7896 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span> <span class="mw-headline" id="text_.26_text"> text &amp; text </span></h2>
7897 <p>section 3
7898 </p>
7899 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span> <span class="mw-headline" id="text_.27_text"> text ' text </span></h2>
7900 <p>section 4
7901 </p>
7902 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span> <span class="mw-headline" id="text_.22_text"> text " text </span></h2>
7903 <p>section 5
7904 </p>
7905 !! end
7906
7907 !! test
7908 Headers with excess '=' characters
7909 (Are similar tests necessary beyond the 1st level?)
7910 !! input
7911 =foo==
7912 ==foo=
7913 =''italic'' heading==
7914 ==''italic'' heading=
7915 !! result
7916 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7917 <ul>
7918 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7919 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7920 <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>
7921 <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>
7922 </ul>
7923 </td></tr></table>
7924 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span> <span class="mw-headline" id="foo.3D">foo=</span></h1>
7925 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span> <span class="mw-headline" id=".3Dfoo">=foo</span></h1>
7926 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span> <span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span></h1>
7927 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span> <span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span></h1>
7928
7929 !! end
7930
7931 !! test
7932 BUG 1219 URL next to image (broken)
7933 !! input
7934 http://example.com[[Image:foobar.jpg]]
7935 !! result
7936 <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>
7937 </p>
7938 !!end
7939
7940 !! test
7941 Bug 1186 news: in the middle of text
7942 !! input
7943 http://en.wikinews.org/wiki/Wikinews:Workplace
7944 !! result
7945 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7946 </p>
7947 !!end
7948
7949
7950 !! test
7951 Namespaced link must have a title
7952 !! input
7953 [[Project:]]
7954 !! result
7955 <p>[[Project:]]
7956 </p>
7957 !!end
7958
7959 !! test
7960 Namespaced link must have a title (bad fragment version)
7961 !! input
7962 [[Project:#fragment]]
7963 !! result
7964 <p>[[Project:#fragment]]
7965 </p>
7966 !!end
7967
7968
7969 ###
7970 ### HTML tags and HTML attributes
7971 ###
7972
7973 !! test
7974 div with no attributes
7975 !! input
7976 <div>HTML rocks</div>
7977 !! result
7978 <div>HTML rocks</div>
7979
7980 !! end
7981
7982 !! test
7983 div with double-quoted attribute
7984 !! input
7985 <div id="rock">HTML rocks</div>
7986 !! result
7987 <div id="rock">HTML rocks</div>
7988
7989 !! end
7990
7991 !! test
7992 div with single-quoted attribute
7993 !! input
7994 <div id='rock'>HTML rocks</div>
7995 !! result
7996 <div id="rock">HTML rocks</div>
7997
7998 !! end
7999
8000 !! test
8001 div with unquoted attribute
8002 !! input
8003 <div id=rock>HTML rocks</div>
8004 !! result
8005 <div id="rock">HTML rocks</div>
8006
8007 !! end
8008
8009 !! test
8010 div with illegal double attributes
8011 !! input
8012 <div id="a" id="b">HTML rocks</div>
8013 !! result
8014 <div id="b">HTML rocks</div>
8015
8016 !!end
8017
8018 # FIXME: produce empty string instead of "class" in the PHP parser, following
8019 # the HTML5 spec.
8020 !! test
8021 div with empty attribute value, space before equals
8022 !! options
8023 disabled
8024 !! input
8025 <div class =>HTML rocks</div>
8026 !! result
8027 <div class="">HTML rocks</div>
8028
8029 !! end
8030
8031 # The PHP parser escapes the opening brace to &#123; for some reason, so
8032 # disabled this test for it.
8033 !! test
8034 div with braces in attribute value
8035 !! options
8036 disabled
8037 !! input
8038 <div title="{}">Foo</div>
8039 !! result
8040 <div title="{}">Foo</div>
8041 !! end
8042
8043 # This it very inconsistent in the PHP parser: it returns
8044 # class="class" if there is a space between the name and the equal sign (see
8045 # 'div with empty attribute value, space before equals'), but strips the
8046 # attribute completely if the space is missing. We hope that not much content
8047 # depends on this, so are implementing the behavior below in Parsoid for
8048 # consistencies' sake. Disabled for the PHP parser.
8049 # FIXME: fix this behavior in the PHP parser?
8050 !! test
8051 div with empty attribute value, no space before equals
8052 !! options
8053 disabled
8054 !! input
8055 <div class=>HTML rocks</div>
8056 !! result
8057 <div class="">HTML rocks</div>
8058
8059 !! end
8060
8061 !! test
8062 HTML multiple attributes correction
8063 !! input
8064 <p class="error" class="awesome">Awesome!</p>
8065 !! result
8066 <p class="awesome">Awesome!</p>
8067
8068 !!end
8069
8070 !! test
8071 Table multiple attributes correction
8072 !! input
8073 {|
8074 !+ class="error" class="awesome"| status
8075 |}
8076 !! result
8077 <table>
8078 <tr>
8079 <th class="awesome"> status
8080 </th></tr></table>
8081
8082 !!end
8083
8084 !! test
8085 DIV IN UPPERCASE
8086 !! input
8087 <DIV ID="x">HTML ROCKS</DIV>
8088 !! result
8089 <div id="x">HTML ROCKS</div>
8090
8091 !!end
8092
8093 !! test
8094 Non-ASCII pseudo-tags are rendered as text
8095 !! input
8096 <khyô>
8097 !! result
8098 <p>&lt;khyô&gt;
8099 </p>
8100 !! end
8101
8102 !! test
8103 Pseudo-tag with URL 'name' renders as url link
8104 !! input
8105 <http://example.com/>
8106 !! result
8107 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8108 </p>
8109 !! end
8110
8111 !! test
8112 text with amp in the middle of nowhere
8113 !! input
8114 Remember AT&T?
8115 !!result
8116 <p>Remember AT&amp;T?
8117 </p>
8118 !! end
8119
8120 !! test
8121 text with character entity: eacute
8122 !! input
8123 I always thought &eacute; was a cute letter.
8124 !! result
8125 <p>I always thought &#233; was a cute letter.
8126 </p>
8127 !! end
8128
8129 !! test
8130 text with entity-escaped character entity-like string: eacute
8131 !! input
8132 I always thought &amp;eacute; was a cute letter.
8133 !! result
8134 <p>I always thought &amp;eacute; was a cute letter.
8135 </p>
8136 !! end
8137
8138 !! test
8139 text with undefined character entity: xacute
8140 !! input
8141 I always thought &xacute; was a cute letter.
8142 !! result
8143 <p>I always thought &amp;xacute; was a cute letter.
8144 </p>
8145 !! end
8146
8147
8148 ###
8149 ### Media links
8150 ###
8151
8152 !! test
8153 Media link
8154 !! input
8155 [[Media:Foobar.jpg]]
8156 !! result
8157 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8158 </p>
8159 !! end
8160
8161 !! test
8162 Media link with text
8163 !! input
8164 [[Media:Foobar.jpg|A neat file to look at]]
8165 !! result
8166 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8167 </p>
8168 !! end
8169
8170 # FIXME: this is still bad HTML tag nesting
8171 !! test
8172 Media link with nasty text
8173 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8174 !! input
8175 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8176 !! result
8177 <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>
8178
8179 !! end
8180
8181 !! test
8182 Media link to nonexistent file (bug 1702)
8183 !! input
8184 [[Media:No such.jpg]]
8185 !! result
8186 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8187 </p>
8188 !! end
8189
8190 !! test
8191 Image link to nonexistent file (bug 1850 - good)
8192 !! input
8193 [[Image:No such.jpg]]
8194 !! result
8195 <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>
8196 </p>
8197 !! end
8198
8199 !! test
8200 :Image link to nonexistent file (bug 1850 - bad)
8201 !! input
8202 [[:Image:No such.jpg]]
8203 !! result
8204 <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>
8205 </p>
8206 !! end
8207
8208
8209
8210 !! test
8211 Character reference normalization in link text (bug 1938)
8212 !! input
8213 [[Main Page|this&that]]
8214 !! result
8215 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8216 </p>
8217 !!end
8218
8219 !! article
8220 אַ
8221 !! text
8222 Test for unicode normalization
8223
8224 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8225 !! endarticle
8226
8227 !! test
8228 (bug 19451) Links should refer to the normalized form.
8229 !! input
8230 [[&#xFB2E;]]
8231 [[&#x5d0;&#x5b7;]]
8232 [[&#x5d0;ַ]]
8233 [[א&#x5b7;]]
8234 [[אַ]]
8235 !! result
8236 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8237 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8238 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8239 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8240 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8241 </p>
8242 !! end
8243
8244 !! test
8245 Empty attribute crash test (bug 2067)
8246 !! input
8247 <font color="">foo</font>
8248 !! result
8249 <p><font color="">foo</font>
8250 </p>
8251 !! end
8252
8253 !! test
8254 Empty attribute crash test single-quotes (bug 2067)
8255 !! input
8256 <font color=''>foo</font>
8257 !! result
8258 <p><font color="">foo</font>
8259 </p>
8260 !! end
8261
8262 !! test
8263 Attribute test: equals, then nothing
8264 !! input
8265 <font color=>foo</font>
8266 !! result
8267 <p><font>foo</font>
8268 </p>
8269 !! end
8270
8271 !! test
8272 Attribute test: unquoted value
8273 !! input
8274 <font color=x>foo</font>
8275 !! result
8276 <p><font color="x">foo</font>
8277 </p>
8278 !! end
8279
8280 !! test
8281 Attribute test: unquoted but illegal value (hash)
8282 !! input
8283 <font color=#x>foo</font>
8284 !! result
8285 <p><font color="#x">foo</font>
8286 </p>
8287 !! end
8288
8289 !! test
8290 Attribute test: no value
8291 !! input
8292 <font color>foo</font>
8293 !! result
8294 <p><font color="color">foo</font>
8295 </p>
8296 !! end
8297
8298 !! test
8299 Bug 2095: link with three closing brackets
8300 !! input
8301 [[Main Page]]]
8302 !! result
8303 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8304 </p>
8305 !! end
8306
8307 !! test
8308 Bug 2095: link with pipe and three closing brackets
8309 !! input
8310 [[Main Page|link]]]
8311 !! result
8312 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8313 </p>
8314 !! end
8315
8316 !! test
8317 Bug 2095: link with pipe and three closing brackets, version 2
8318 !! input
8319 [[Main Page|[http://example.com/]]]
8320 !! result
8321 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8322 </p>
8323 !! end
8324
8325
8326 ###
8327 ### Safety
8328 ###
8329
8330 !! article
8331 Template:Dangerous attribute
8332 !! text
8333 " onmouseover="alert(document.cookie)
8334 !! endarticle
8335
8336 !! article
8337 Template:Dangerous style attribute
8338 !! text
8339 border-size: expression(alert(document.cookie))
8340 !! endarticle
8341
8342 !! article
8343 Template:Div style
8344 !! text
8345 <div style="float: right; {{{1}}}">Magic div</div>
8346 !! endarticle
8347
8348 !! test
8349 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8350 !! input
8351 <div title="{{test}}"></div>
8352 !! result
8353 <div title="This is a test template"></div>
8354
8355 !! end
8356
8357 !! test
8358 Bug 2304: HTML attribute safety (dangerous template; 2309)
8359 !! input
8360 <div title="{{dangerous attribute}}"></div>
8361 !! result
8362 <div title=""></div>
8363
8364 !! end
8365
8366 !! test
8367 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8368 !! input
8369 <div style="{{dangerous style attribute}}"></div>
8370 !! result
8371 <div style="/* insecure input */"></div>
8372
8373 !! end
8374
8375 !! test
8376 Bug 2304: HTML attribute safety (safe parameter; 2309)
8377 !! input
8378 {{div style|width: 200px}}
8379 !! result
8380 <div style="float: right; width: 200px">Magic div</div>
8381
8382 !! end
8383
8384 !! test
8385 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8386 !! input
8387 {{div style|width: expression(alert(document.cookie))}}
8388 !! result
8389 <div style="/* insecure input */">Magic div</div>
8390
8391 !! end
8392
8393 !! test
8394 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8395 !! input
8396 {{div style|"><script>alert(document.cookie)</script>}}
8397 !! result
8398 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8399
8400 !! end
8401
8402 !! test
8403 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8404 !! input
8405 {{div style|" ><script>alert(document.cookie)</script>}}
8406 !! result
8407 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8408
8409 !! end
8410
8411 !! test
8412 Bug 2304: HTML attribute safety (link)
8413 !! input
8414 <div title="[[Main Page]]"></div>
8415 !! result
8416 <div title="&#91;&#91;Main Page]]"></div>
8417
8418 !! end
8419
8420 !! test
8421 Bug 2304: HTML attribute safety (italics)
8422 !! input
8423 <div title="''foobar''"></div>
8424 !! result
8425 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8426
8427 !! end
8428
8429 !! test
8430 Bug 2304: HTML attribute safety (bold)
8431 !! input
8432 <div title="'''foobar'''"></div>
8433 !! result
8434 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8435
8436 !! end
8437
8438
8439 !! test
8440 Bug 2304: HTML attribute safety (ISBN)
8441 !! input
8442 <div title="ISBN 1234567890"></div>
8443 !! result
8444 <div title="&#73;SBN 1234567890"></div>
8445
8446 !! end
8447
8448 !! test
8449 Bug 2304: HTML attribute safety (RFC)
8450 !! input
8451 <div title="RFC 1234"></div>
8452 !! result
8453 <div title="&#82;FC 1234"></div>
8454
8455 !! end
8456
8457 !! test
8458 Bug 2304: HTML attribute safety (PMID)
8459 !! input
8460 <div title="PMID 1234567890"></div>
8461 !! result
8462 <div title="&#80;MID 1234567890"></div>
8463
8464 !! end
8465
8466 !! test
8467 Bug 2304: HTML attribute safety (web link)
8468 !! input
8469 <div title="http://example.com/"></div>
8470 !! result
8471 <div title="http&#58;//example.com/"></div>
8472
8473 !! end
8474
8475 !! test
8476 Bug 2304: HTML attribute safety (named web link)
8477 !! input
8478 <div title="[http://example.com/ link]"></div>
8479 !! result
8480 <div title="&#91;http&#58;//example.com/ link]"></div>
8481
8482 !! end
8483
8484 !! test
8485 Bug 3244: HTML attribute safety (extension; safe)
8486 !! input
8487 <div style="<nowiki>background:blue</nowiki>"></div>
8488 !! result
8489 <div style="background:blue"></div>
8490
8491 !! end
8492
8493 !! test
8494 Bug 3244: HTML attribute safety (extension; unsafe)
8495 !! input
8496 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8497 !! result
8498 <div style="/* insecure input */"></div>
8499
8500 !! end
8501
8502 # More MSIE fun discovered by Tom Gilder
8503
8504 !! test
8505 MSIE CSS safety test: spurious slash
8506 !! input
8507 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8508 !! result
8509 <div style="/* insecure input */">evil</div>
8510
8511 !! end
8512
8513 !! test
8514 MSIE CSS safety test: hex code
8515 !! input
8516 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8517 !! result
8518 <div style="/* insecure input */">evil</div>
8519
8520 !! end
8521
8522 !! test
8523 MSIE CSS safety test: comment in url
8524 !! input
8525 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8526 !! result
8527 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8528
8529 !! end
8530
8531 !! test
8532 MSIE CSS safety test: comment in expression
8533 !! input
8534 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8535 !! result
8536 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8537
8538 !! end
8539
8540
8541 !! test
8542 Table attribute legitimate extension
8543 !! input
8544 {|
8545 !+ style="<nowiki>color:blue</nowiki>"| status
8546 |}
8547 !! result
8548 <table>
8549 <tr>
8550 <th style="color:blue"> status
8551 </th></tr></table>
8552
8553 !!end
8554
8555 !! test
8556 Table attribute safety
8557 !! input
8558 {|
8559 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8560 |}
8561 !! result
8562 <table>
8563 <tr>
8564 <th style="/* insecure input */"> status
8565 </th></tr></table>
8566
8567 !! end
8568
8569 !! test
8570 CSS line continuation 1
8571 !! input
8572 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8573 !! result
8574 <div style="/* insecure input */"></div>
8575
8576 !! end
8577
8578 !! test
8579 CSS line continuation 2
8580 !! input
8581 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8582 !! result
8583 <div style="/* insecure input */"></div>
8584
8585 !! end
8586
8587 !! article
8588 Template:Identity
8589 !! text
8590 {{{1}}}
8591 !! endarticle
8592
8593 !! test
8594 Expansion of multi-line templates in attribute values (bug 6255)
8595 !! input
8596 <div style="background: {{identity|#00FF00}}">-</div>
8597 !! result
8598 <div style="background: #00FF00">-</div>
8599
8600 !! end
8601
8602
8603 !! test
8604 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8605 !! input
8606 <div style="background:
8607 #00FF00">-</div>
8608 !! result
8609 <div style="background: #00FF00">-</div>
8610
8611 !! end
8612
8613 !! test
8614 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8615 !! input
8616 <div style="background: &#10;#00FF00">-</div>
8617 !! result
8618 <div style="background: &#10;#00FF00">-</div>
8619
8620 !! end
8621
8622 ###
8623 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8624 ###
8625 !! test
8626 Parser hook: empty input
8627 !! input
8628 <tag></tag>
8629 !! result
8630 <pre>
8631 ''
8632 array (
8633 )
8634 </pre>
8635
8636 !! end
8637
8638 !! test
8639 Parser hook: empty input using terminated empty elements
8640 !! input
8641 <tag/>
8642 !! result
8643 <pre>
8644 NULL
8645 array (
8646 )
8647 </pre>
8648
8649 !! end
8650
8651 !! test
8652 Parser hook: empty input using terminated empty elements (space before)
8653 !! input
8654 <tag />
8655 !! result
8656 <pre>
8657 NULL
8658 array (
8659 )
8660 </pre>
8661
8662 !! end
8663
8664 !! test
8665 Parser hook: basic input
8666 !! input
8667 <tag>input</tag>
8668 !! result
8669 <pre>
8670 'input'
8671 array (
8672 )
8673 </pre>
8674
8675 !! end
8676
8677
8678 !! test
8679 Parser hook: case insensitive
8680 !! input
8681 <TAG>input</TAG>
8682 !! result
8683 <pre>
8684 'input'
8685 array (
8686 )
8687 </pre>
8688
8689 !! end
8690
8691
8692 !! test
8693 Parser hook: case insensitive, redux
8694 !! input
8695 <TaG>input</TAg>
8696 !! result
8697 <pre>
8698 'input'
8699 array (
8700 )
8701 </pre>
8702
8703 !! end
8704
8705 !! test
8706 Parser hook: nested tags
8707 !! options
8708 noxml
8709 !! input
8710 <tag><tag></tag></tag>
8711 !! result
8712 <pre>
8713 '<tag>'
8714 array (
8715 )
8716 </pre>&lt;/tag&gt;
8717
8718 !! end
8719
8720 !! test
8721 Parser hook: basic arguments
8722 !! input
8723 <tag width=200 height = "100" depth = '50' square></tag>
8724 !! result
8725 <pre>
8726 ''
8727 array (
8728 'width' => '200',
8729 'height' => '100',
8730 'depth' => '50',
8731 'square' => 'square',
8732 )
8733 </pre>
8734
8735 !! end
8736
8737 !! test
8738 Parser hook: argument containing a forward slash (bug 5344)
8739 !! input
8740 <tag filename='/tmp/bla'></tag>
8741 !! result
8742 <pre>
8743 ''
8744 array (
8745 'filename' => '/tmp/bla',
8746 )
8747 </pre>
8748
8749 !! end
8750
8751 !! test
8752 Parser hook: empty input using terminated empty elements (bug 2374)
8753 !! input
8754 <tag foo=bar/>text
8755 !! result
8756 <pre>
8757 NULL
8758 array (
8759 'foo' => 'bar',
8760 )
8761 </pre>text
8762
8763 !! end
8764
8765 # </tag> should be output literally since there is no matching tag that begins it
8766 !! test
8767 Parser hook: basic arguments using terminated empty elements (bug 2374)
8768 !! input
8769 <tag width=200 height = "100" depth = '50' square/>
8770 other stuff
8771 </tag>
8772 !! result
8773 <pre>
8774 NULL
8775 array (
8776 'width' => '200',
8777 'height' => '100',
8778 'depth' => '50',
8779 'square' => 'square',
8780 )
8781 </pre>
8782 <p>other stuff
8783 &lt;/tag&gt;
8784 </p>
8785 !! end
8786
8787 ###
8788 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8789 ###
8790
8791 !! test
8792 Parser hook: static parser hook not inside a comment
8793 !! input
8794 <statictag>hello, world</statictag>
8795 <statictag action=flush/>
8796 !! result
8797 <p>hello, world
8798 </p>
8799 !! end
8800
8801
8802 !! test
8803 Parser hook: static parser hook inside a comment
8804 !! input
8805 <!-- <statictag>hello, world</statictag> -->
8806 <statictag action=flush/>
8807 !! result
8808 <p><br />
8809 </p>
8810 !! end
8811
8812 # Nested template calls; this case was broken by Parser.php rev 1.506,
8813 # since reverted.
8814
8815 !! article
8816 Template:One-parameter
8817 !! text
8818 (My parameter is: {{{1}}})
8819 !! endarticle
8820
8821 !! article
8822 Template:Map-one-parameter
8823 !! text
8824 {{{{{1}}}|{{{2}}}}}
8825 !! endarticle
8826
8827 !! test
8828 Nested template calls
8829 !! input
8830 {{Map-one-parameter|One-parameter|param}}
8831 !! result
8832 <p>(My parameter is: param)
8833 </p>
8834 !! end
8835
8836
8837 ###
8838 ### Sanitizer
8839 ###
8840 !! test
8841 Sanitizer: Closing of open tags
8842 !! input
8843 <s></s><table></table>
8844 !! result
8845 <s></s><table></table>
8846
8847 !! end
8848
8849 !! test
8850 Sanitizer: Closing of open but not closed tags
8851 !! input
8852 <s>foo
8853 !! result
8854 <p><s>foo</s>
8855 </p>
8856 !! end
8857
8858 !! test
8859 Sanitizer: Closing of closed but not open tags
8860 !! input
8861 </s>
8862 !! result
8863 <p>&lt;/s&gt;
8864 </p>
8865 !! end
8866
8867 !! test
8868 Sanitizer: Closing of closed but not open table tags
8869 !! input
8870 Table not started</td></tr></table>
8871 !! result
8872 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8873 </p>
8874 !! end
8875
8876 !! test
8877 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8878 !! input
8879 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8880 !! result
8881 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8882 </p>
8883 !! end
8884
8885 !! test
8886 Sanitizer: Validating the contents of the id attribute (bug 4515)
8887 !! options
8888 disabled
8889 !! input
8890 <br id=9 />
8891 !! result
8892 Something, but definitely not <br id="9" />...
8893 !! end
8894
8895 !! test
8896 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8897 !! options
8898 disabled
8899 !! input
8900 <br id="foo" /><br id="foo" />
8901 !! result
8902 Something need to be done. foo-2 ?
8903 !! end
8904
8905 !! test
8906 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8907 !! input
8908 <div itemscope>
8909 <meta itemprop="hello" content="world">
8910 <meta http-equiv="refresh" content="5">
8911 <meta itemprop="hello" http-equiv="refresh" content="5">
8912 <link itemprop="hello" href="{{SERVER}}">
8913 <link rel="stylesheet" href="{{SERVER}}">
8914 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8915 </div>
8916 !! result
8917 <div itemscope="itemscope">
8918 <p> <meta itemprop="hello" content="world" />
8919 &lt;meta http-equiv="refresh" content="5"&gt;
8920 <meta itemprop="hello" content="5" />
8921 </p>
8922 <link itemprop="hello" href="http&#58;//example.org" />
8923 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
8924 <link itemprop="hello" href="http&#58;//example.org" />
8925 </div>
8926
8927 !! end
8928
8929 !! test
8930 Language converter: output gets cut off unexpectedly (bug 5757)
8931 !! options
8932 language=zh
8933 !! input
8934 this bit is safe: }-
8935
8936 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8937
8938 then we get cut off here: }-
8939
8940 all additional text is vanished
8941 !! result
8942 <p>this bit is safe: }-
8943 </p><p>but if we add a conversion instance: xxx
8944 </p><p>then we get cut off here: }-
8945 </p><p>all additional text is vanished
8946 </p>
8947 !! end
8948
8949 !! test
8950 Self closed html pairs (bug 5487)
8951 !! options
8952 !! input
8953 <center><font id="bug" />Centered text</center>
8954 <div><font id="bug2" />In div text</div>
8955 !! result
8956 <center>&lt;font id="bug" /&gt;Centered text</center>
8957 <div>&lt;font id="bug2" /&gt;In div text</div>
8958
8959 !! end
8960
8961 #
8962 #
8963 #
8964
8965 !! test
8966 Punctuation: nbsp before exclamation
8967 !! input
8968 C'est grave !
8969 !! result
8970 <p>C'est grave&#160;!
8971 </p>
8972 !! end
8973
8974 !! test
8975 Punctuation: CSS !important (bug 11874)
8976 !! input
8977 <div style="width:50% !important">important</div>
8978 !! result
8979 <div style="width:50% !important">important</div>
8980
8981 !!end
8982
8983 !! test
8984 Punctuation: CSS ! important (bug 11874; with space after)
8985 !! input
8986 <div style="width:50% ! important">important</div>
8987 !! result
8988 <div style="width:50% ! important">important</div>
8989
8990 !!end
8991
8992
8993 !! test
8994 HTML bullet list, closed tags (bug 5497)
8995 !! input
8996 <ul>
8997 <li>One</li>
8998 <li>Two</li>
8999 </ul>
9000 !! result
9001 <ul>
9002 <li>One</li>
9003 <li>Two</li>
9004 </ul>
9005
9006 !! end
9007
9008 !! test
9009 HTML bullet list, unclosed tags (bug 5497)
9010 !! options
9011 disabled
9012 !! input
9013 <ul>
9014 <li>One
9015 <li>Two
9016 </ul>
9017 !! result
9018 <ul>
9019 <li>One
9020 </li><li>Two
9021 </li></ul>
9022
9023 !! end
9024
9025 !! test
9026 HTML ordered list, closed tags (bug 5497)
9027 !! input
9028 <ol>
9029 <li>One</li>
9030 <li>Two</li>
9031 </ol>
9032 !! result
9033 <ol>
9034 <li>One</li>
9035 <li>Two</li>
9036 </ol>
9037
9038 !! end
9039
9040 !! test
9041 HTML ordered list, unclosed tags (bug 5497)
9042 !! options
9043 disabled
9044 !! input
9045 <ol>
9046 <li>One
9047 <li>Two
9048 </ol>
9049 !! result
9050 <ol>
9051 <li>One
9052 </li><li>Two
9053 </li></ol>
9054
9055 !! end
9056
9057 !! test
9058 HTML nested bullet list, closed tags (bug 5497)
9059 !! input
9060 <ul>
9061 <li>One</li>
9062 <li>Two:
9063 <ul>
9064 <li>Sub-one</li>
9065 <li>Sub-two</li>
9066 </ul>
9067 </li>
9068 </ul>
9069 !! result
9070 <ul>
9071 <li>One</li>
9072 <li>Two:
9073 <ul>
9074 <li>Sub-one</li>
9075 <li>Sub-two</li>
9076 </ul>
9077 </li>
9078 </ul>
9079
9080 !! end
9081
9082 !! test
9083 HTML nested bullet list, open tags (bug 5497)
9084 !! options
9085 disabled
9086 !! input
9087 <ul>
9088 <li>One
9089 <li>Two:
9090 <ul>
9091 <li>Sub-one
9092 <li>Sub-two
9093 </ul>
9094 </ul>
9095 !! result
9096 <ul>
9097 <li>One
9098 </li><li>Two:
9099 <ul>
9100 <li>Sub-one
9101 </li><li>Sub-two
9102 </li></ul>
9103 </li></ul>
9104
9105 !! end
9106
9107 !! test
9108 HTML nested ordered list, closed tags (bug 5497)
9109 !! input
9110 <ol>
9111 <li>One</li>
9112 <li>Two:
9113 <ol>
9114 <li>Sub-one</li>
9115 <li>Sub-two</li>
9116 </ol>
9117 </li>
9118 </ol>
9119 !! result
9120 <ol>
9121 <li>One</li>
9122 <li>Two:
9123 <ol>
9124 <li>Sub-one</li>
9125 <li>Sub-two</li>
9126 </ol>
9127 </li>
9128 </ol>
9129
9130 !! end
9131
9132 !! test
9133 HTML nested ordered list, open tags (bug 5497)
9134 !! options
9135 disabled
9136 !! input
9137 <ol>
9138 <li>One
9139 <li>Two:
9140 <ol>
9141 <li>Sub-one
9142 <li>Sub-two
9143 </ol>
9144 </ol>
9145 !! result
9146 <ol>
9147 <li>One
9148 </li><li>Two:
9149 <ol>
9150 <li>Sub-one
9151 </li><li>Sub-two
9152 </li></ol>
9153 </li></ol>
9154
9155 !! end
9156
9157 !! test
9158 HTML ordered list item with parameters oddity
9159 !! input
9160 <ol><li id="fragment">One</li></ol>
9161 !! result
9162 <ol><li id="fragment">One</li></ol>
9163
9164 !! end
9165
9166 !!test
9167 bug 5918: autonumbering
9168 !! input
9169 [http://first/] [http://second] [ftp://ftp]
9170
9171 ftp://inlineftp
9172
9173 [mailto:enclosed@mail.tld With target]
9174
9175 [mailto:enclosed@mail.tld]
9176
9177 mailto:inline@mail.tld
9178 !! result
9179 <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>
9180 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9181 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9182 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9183 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9184 </p>
9185 !! end
9186
9187
9188 #
9189 # Security and HTML correctness
9190 # From Nick Jenkins' fuzz testing
9191 #
9192
9193 !! test
9194 Fuzz testing: Parser13
9195 !! input
9196 {|
9197 | http://a|
9198 !! result
9199 <table>
9200 <tr>
9201 <td>
9202 </td>
9203 </tr>
9204 </table>
9205
9206 !! end
9207
9208 !! test
9209 Fuzz testing: Parser14
9210 !! input
9211 == onmouseover= ==
9212 http://__TOC__
9213 !! result
9214 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D"> onmouseover= </span></h2>
9215 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9216 <ul>
9217 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9218 </ul>
9219 </td></tr></table>
9220
9221 !! end
9222
9223 !! test
9224 Fuzz testing: Parser14-table
9225 !! input
9226 ==a==
9227 {| STYLE=__TOC__
9228 !! result
9229 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
9230 <table style="&#95;_TOC&#95;_">
9231 <tr><td></td></tr>
9232 </table>
9233
9234 !! end
9235
9236 # Known to produce bogus xml (extra </td>)
9237 !! test
9238 Fuzz testing: Parser16
9239 !! options
9240 noxml
9241 !! input
9242 {|
9243 !https://||||||
9244 !! result
9245 <table>
9246 <tr>
9247 <th>https://</th>
9248 <th></th>
9249 <th></th>
9250 <th>
9251 </td>
9252 </tr>
9253 </table>
9254
9255 !! end
9256
9257 !! test
9258 Fuzz testing: Parser21
9259 !! input
9260 {|
9261 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9262 |
9263 !! result
9264 <table>
9265 <tr>
9266 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9267 </th>
9268 <td>
9269 </td>
9270 </tr>
9271 </table>
9272
9273 !! end
9274
9275 !! test
9276 Fuzz testing: Parser22
9277 !! input
9278 http://===r:::https://b
9279
9280 {|
9281 !!result
9282 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9283 </p>
9284 <table>
9285 <tr><td></td></tr>
9286 </table>
9287
9288 !! end
9289
9290 # Known to produce bad XML for now
9291 !! test
9292 Fuzz testing: Parser24
9293 !! options
9294 noxml
9295 !! input
9296 {|
9297 {{{|
9298 <u CLASS=
9299 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9300 <br style="onmouseover='alert(document.cookie);' " />
9301
9302 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9303 |
9304 !! result
9305 <table>
9306 {{{|
9307 <u class="&#124;">}}}} &gt;
9308 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9309
9310 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9311 <tr>
9312 <td></u>
9313 </td>
9314 </tr>
9315 </table>
9316
9317 !! end
9318
9319 # Note: the current result listed for this is not what the original one was,
9320 # but the original bug was JavaScript injection, which is fixed in any case.
9321 # It's not clear that the original result listed was any more correct than the
9322 # current one. Original result:
9323 # <p>{{{|
9324 # </p>
9325 # <li class="&#124;&#124;">
9326 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9327 !!test
9328 Fuzz testing: Parser25 (bug 6055)
9329 !! input
9330 {{{
9331 |
9332 <LI CLASS=||
9333 >
9334 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9335 !! result
9336 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9337 </p>
9338 !! end
9339
9340 !!test
9341 Fuzz testing: URL adjacent extension (with space, clean)
9342 !! options
9343 !! input
9344 http://example.com <nowiki>junk</nowiki>
9345 !! result
9346 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9347 </p>
9348 !!end
9349
9350 !!test
9351 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9352 !! options
9353 !! input
9354 http://example.com<nowiki>junk</nowiki>
9355 !! result
9356 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9357 </p>
9358 !!end
9359
9360 !!test
9361 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9362 !! options
9363 !! input
9364 http://example.com<pre>junk</pre>
9365 !! result
9366 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9367
9368 !!end
9369
9370 !!test
9371 Fuzz testing: image with bogus manual thumbnail
9372 !!input
9373 [[Image:foobar.jpg|thumbnail= ]]
9374 !!result
9375 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9376
9377 !!end
9378
9379 !! test
9380 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9381 !! input
9382 <pre dir="&#10;"></pre>
9383 !! result
9384 <pre dir="&#10;"></pre>
9385
9386 !! end
9387
9388 !! test
9389 Parsing optional HTML elements (Bug 6171)
9390 !! options
9391 !! input
9392 <table>
9393 <tr>
9394 <td> Some tabular data</td>
9395 <td> More tabular data ...
9396 <td> And yet som tabular data</td>
9397 </tr>
9398 </table>
9399 !! result
9400 <table>
9401 <tr>
9402 <td> Some tabular data</td>
9403 <td> More tabular data ...
9404 </td><td> And yet som tabular data</td>
9405 </tr>
9406 </table>
9407
9408 !! end
9409
9410 !! test
9411 Correct handling of <td>, <tr> (Bug 6171)
9412 !! options
9413 !! input
9414 <table>
9415 <tr>
9416 <td> Some tabular data</td>
9417 <td> More tabular data ...</td>
9418 <td> And yet som tabular data</td>
9419 </tr>
9420 </table>
9421 !! result
9422 <table>
9423 <tr>
9424 <td> Some tabular data</td>
9425 <td> More tabular data ...</td>
9426 <td> And yet som tabular data</td>
9427 </tr>
9428 </table>
9429
9430 !! end
9431
9432
9433 !! test
9434 Parsing crashing regression (fr:JavaScript)
9435 !! input
9436 </body></x>
9437 !! result
9438 <p>&lt;/body&gt;&lt;/x&gt;
9439 </p>
9440 !! end
9441
9442 !! test
9443 Inline wiki vs wiki block nesting
9444 !! input
9445 '''Bold paragraph
9446
9447 New wiki paragraph
9448 !! result
9449 <p><b>Bold paragraph</b>
9450 </p><p>New wiki paragraph
9451 </p>
9452 !! end
9453
9454 !! test
9455 Inline HTML vs wiki block nesting
9456 !! options
9457 disabled
9458 !! input
9459 <b>Bold paragraph
9460
9461 New wiki paragraph
9462 !! result
9463 <p><b>Bold paragraph</b>
9464 </p><p>New wiki paragraph
9465 </p>
9466 !! end
9467
9468 # Original result was this:
9469 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9470 # </p>
9471 # While that might be marginally more intuitive, maybe, the six-apostrophe
9472 # construct is clearly pathological and the result stated here (which is what
9473 # the parser actually does) is about as reasonable as anything.
9474 !!test
9475 Mixing markup for italics and bold
9476 !! options
9477 !! input
9478 '''bold''''''bold''bolditalics'''''
9479 !! result
9480 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9481 </p>
9482 !! end
9483
9484
9485 !! article
9486 Xyzzyx
9487 !! text
9488 Article for special page transclusion test
9489 !! endarticle
9490
9491 !! test
9492 Special page transclusion
9493 !! options
9494 !! input
9495 {{Special:Prefixindex/Xyzzyx}}
9496 !! result
9497 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9498
9499 !! end
9500
9501 !! test
9502 Special page transclusion twice (bug 5021)
9503 !! options
9504 !! input
9505 {{Special:Prefixindex/Xyzzyx}}
9506 {{Special:Prefixindex/Xyzzyx}}
9507 !! result
9508 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9509 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9510
9511 !! end
9512
9513 !! test
9514 Transclusion of default MediaWiki message
9515 !! input
9516 {{MediaWiki:Mainpage}}
9517 !!result
9518 <p>Main Page
9519 </p>
9520 !! end
9521
9522 !! test
9523 Transclusion of nonexistent MediaWiki message
9524 !! input
9525 {{MediaWiki:Mainpagexxx}}
9526 !!result
9527 <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>
9528 </p>
9529 !! end
9530
9531 !! test
9532 Transclusion of MediaWiki message with underscore
9533 !! input
9534 {{MediaWiki:history_short}}
9535 !! result
9536 <p>History
9537 </p>
9538 !! end
9539
9540 !! test
9541 Transclusion of MediaWiki message with space
9542 !! input
9543 {{MediaWiki:history short}}
9544 !! result
9545 <p>History
9546 </p>
9547 !! end
9548
9549 !! test
9550 Invalid header with following text
9551 !! input
9552 = x = y
9553 !! result
9554 <p>= x = y
9555 </p>
9556 !! end
9557
9558
9559 !! test
9560 Section extraction test (section 0)
9561 !! options
9562 section=0
9563 !! input
9564 start
9565 ==a==
9566 ===aa===
9567 ====aaa====
9568 ==b==
9569 ===ba===
9570 ===bb===
9571 ====bba====
9572 ===bc===
9573 ==c==
9574 ===ca===
9575 !! result
9576 start
9577 !! end
9578
9579 !! test
9580 Section extraction test (section 1)
9581 !! options
9582 section=1
9583 !! input
9584 start
9585 ==a==
9586 ===aa===
9587 ====aaa====
9588 ==b==
9589 ===ba===
9590 ===bb===
9591 ====bba====
9592 ===bc===
9593 ==c==
9594 ===ca===
9595 !! result
9596 ==a==
9597 ===aa===
9598 ====aaa====
9599 !! end
9600
9601 !! test
9602 Section extraction test (section 2)
9603 !! options
9604 section=2
9605 !! input
9606 start
9607 ==a==
9608 ===aa===
9609 ====aaa====
9610 ==b==
9611 ===ba===
9612 ===bb===
9613 ====bba====
9614 ===bc===
9615 ==c==
9616 ===ca===
9617 !! result
9618 ===aa===
9619 ====aaa====
9620 !! end
9621
9622 !! test
9623 Section extraction test (section 3)
9624 !! options
9625 section=3
9626 !! input
9627 start
9628 ==a==
9629 ===aa===
9630 ====aaa====
9631 ==b==
9632 ===ba===
9633 ===bb===
9634 ====bba====
9635 ===bc===
9636 ==c==
9637 ===ca===
9638 !! result
9639 ====aaa====
9640 !! end
9641
9642 !! test
9643 Section extraction test (section 4)
9644 !! options
9645 section=4
9646 !! input
9647 start
9648 ==a==
9649 ===aa===
9650 ====aaa====
9651 ==b==
9652 ===ba===
9653 ===bb===
9654 ====bba====
9655 ===bc===
9656 ==c==
9657 ===ca===
9658 !! result
9659 ==b==
9660 ===ba===
9661 ===bb===
9662 ====bba====
9663 ===bc===
9664 !! end
9665
9666 !! test
9667 Section extraction test (section 5)
9668 !! options
9669 section=5
9670 !! input
9671 start
9672 ==a==
9673 ===aa===
9674 ====aaa====
9675 ==b==
9676 ===ba===
9677 ===bb===
9678 ====bba====
9679 ===bc===
9680 ==c==
9681 ===ca===
9682 !! result
9683 ===ba===
9684 !! end
9685
9686 !! test
9687 Section extraction test (section 6)
9688 !! options
9689 section=6
9690 !! input
9691 start
9692 ==a==
9693 ===aa===
9694 ====aaa====
9695 ==b==
9696 ===ba===
9697 ===bb===
9698 ====bba====
9699 ===bc===
9700 ==c==
9701 ===ca===
9702 !! result
9703 ===bb===
9704 ====bba====
9705 !! end
9706
9707 !! test
9708 Section extraction test (section 7)
9709 !! options
9710 section=7
9711 !! input
9712 start
9713 ==a==
9714 ===aa===
9715 ====aaa====
9716 ==b==
9717 ===ba===
9718 ===bb===
9719 ====bba====
9720 ===bc===
9721 ==c==
9722 ===ca===
9723 !! result
9724 ====bba====
9725 !! end
9726
9727 !! test
9728 Section extraction test (section 8)
9729 !! options
9730 section=8
9731 !! input
9732 start
9733 ==a==
9734 ===aa===
9735 ====aaa====
9736 ==b==
9737 ===ba===
9738 ===bb===
9739 ====bba====
9740 ===bc===
9741 ==c==
9742 ===ca===
9743 !! result
9744 ===bc===
9745 !! end
9746
9747 !! test
9748 Section extraction test (section 9)
9749 !! options
9750 section=9
9751 !! input
9752 start
9753 ==a==
9754 ===aa===
9755 ====aaa====
9756 ==b==
9757 ===ba===
9758 ===bb===
9759 ====bba====
9760 ===bc===
9761 ==c==
9762 ===ca===
9763 !! result
9764 ==c==
9765 ===ca===
9766 !! end
9767
9768 !! test
9769 Section extraction test (section 10)
9770 !! options
9771 section=10
9772 !! input
9773 start
9774 ==a==
9775 ===aa===
9776 ====aaa====
9777 ==b==
9778 ===ba===
9779 ===bb===
9780 ====bba====
9781 ===bc===
9782 ==c==
9783 ===ca===
9784 !! result
9785 ===ca===
9786 !! end
9787
9788 !! test
9789 Section extraction test (nonexistent section 11)
9790 !! options
9791 section=11
9792 !! input
9793 start
9794 ==a==
9795 ===aa===
9796 ====aaa====
9797 ==b==
9798 ===ba===
9799 ===bb===
9800 ====bba====
9801 ===bc===
9802 ==c==
9803 ===ca===
9804 !! result
9805 !! end
9806
9807 !! test
9808 Section extraction test with bogus heading (section 1)
9809 !! options
9810 section=1
9811 !! input
9812 ==a==
9813 ==bogus== not a legal section
9814 ==b==
9815 !! result
9816 ==a==
9817 ==bogus== not a legal section
9818 !! end
9819
9820 !! test
9821 Section extraction test with bogus heading (section 2)
9822 !! options
9823 section=2
9824 !! input
9825 ==a==
9826 ==bogus== not a legal section
9827 ==b==
9828 !! result
9829 ==b==
9830 !! end
9831
9832 !! test
9833 Section extraction test with comment after heading (section 1)
9834 !! options
9835 section=1
9836 !! input
9837 ==a==
9838 ==b== <!-- -->
9839 ==c==
9840 !! result
9841 ==a==
9842 !! end
9843
9844 !! test
9845 Section extraction test with comment after heading (section 2)
9846 !! options
9847 section=2
9848 !! input
9849 ==a==
9850 ==b== <!-- -->
9851 ==c==
9852 !! result
9853 ==b== <!-- -->
9854 !! end
9855
9856 !! test
9857 Section extraction test with bogus <nowiki> heading (section 1)
9858 !! options
9859 section=1
9860 !! input
9861 ==a==
9862 ==bogus== <nowiki>not a legal section</nowiki>
9863 ==b==
9864 !! result
9865 ==a==
9866 ==bogus== <nowiki>not a legal section</nowiki>
9867 !! end
9868
9869 !! test
9870 Section extraction test with bogus <nowiki> heading (section 2)
9871 !! options
9872 section=2
9873 !! input
9874 ==a==
9875 ==bogus== <nowiki>not a legal section</nowiki>
9876 ==b==
9877 !! result
9878 ==b==
9879 !! end
9880
9881
9882 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9883 # instead of respecting commented sections
9884 !! test
9885 Section extraction prefixed by comment (section 1)
9886 !! options
9887 section=1
9888 !! input
9889 <!-- -->==sec1==
9890 ==sec2==
9891 !!result
9892 ==sec2==
9893 !!end
9894
9895 !! test
9896 Section extraction prefixed by comment (section 2)
9897 !! options
9898 section=2
9899 !! input
9900 <!-- -->==sec1==
9901 ==sec2==
9902 !!result
9903
9904 !!end
9905
9906
9907 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9908 # instead of respecting HTML-style headings
9909 !! test
9910 Section extraction, mixed wiki and html (section 1)
9911 !! options
9912 section=1
9913 !! input
9914 <h2>unmarked</h2>
9915 unmarked
9916 ==1==
9917 one
9918 ==2==
9919 two
9920 !! result
9921 ==1==
9922 one
9923 !! end
9924
9925 !! test
9926 Section extraction, mixed wiki and html (section 2)
9927 !! options
9928 section=2
9929 !! input
9930 <h2>unmarked</h2>
9931 unmarked
9932 ==1==
9933 one
9934 ==2==
9935 two
9936 !! result
9937 ==2==
9938 two
9939 !! end
9940
9941
9942 # Formerly testing for bug 3342
9943 !! test
9944 Section extraction, heading surrounded by <noinclude>
9945 !! options
9946 section=1
9947 !! input
9948 <noinclude>==unmarked==</noinclude>
9949 ==marked==
9950 !! result
9951 ==marked==
9952 !!end
9953
9954 # Test behavior of bug 19910
9955 !! test
9956 Sectiion with all-equals
9957 !! options
9958 section=2
9959 !! input
9960 ===
9961 The line above must have a trailing space
9962 === <!--
9963 --> <!-- -->
9964 But just in case it doesn't...
9965 !! result
9966 === <!--
9967 --> <!-- -->
9968 But just in case it doesn't...
9969 !! end
9970
9971 !! test
9972 Section replacement test (section 0)
9973 !! options
9974 replace=0,"xxx"
9975 !! input
9976 start
9977 ==a==
9978 ===aa===
9979 ====aaa====
9980 ==b==
9981 ===ba===
9982 ===bb===
9983 ====bba====
9984 ===bc===
9985 ==c==
9986 ===ca===
9987 !! result
9988 xxx
9989
9990 ==a==
9991 ===aa===
9992 ====aaa====
9993 ==b==
9994 ===ba===
9995 ===bb===
9996 ====bba====
9997 ===bc===
9998 ==c==
9999 ===ca===
10000 !! end
10001
10002 !! test
10003 Section replacement test (section 1)
10004 !! options
10005 replace=1,"xxx"
10006 !! input
10007 start
10008 ==a==
10009 ===aa===
10010 ====aaa====
10011 ==b==
10012 ===ba===
10013 ===bb===
10014 ====bba====
10015 ===bc===
10016 ==c==
10017 ===ca===
10018 !! result
10019 start
10020 xxx
10021
10022 ==b==
10023 ===ba===
10024 ===bb===
10025 ====bba====
10026 ===bc===
10027 ==c==
10028 ===ca===
10029 !! end
10030
10031 !! test
10032 Section replacement test (section 2)
10033 !! options
10034 replace=2,"xxx"
10035 !! input
10036 start
10037 ==a==
10038 ===aa===
10039 ====aaa====
10040 ==b==
10041 ===ba===
10042 ===bb===
10043 ====bba====
10044 ===bc===
10045 ==c==
10046 ===ca===
10047 !! result
10048 start
10049 ==a==
10050 xxx
10051
10052 ==b==
10053 ===ba===
10054 ===bb===
10055 ====bba====
10056 ===bc===
10057 ==c==
10058 ===ca===
10059 !! end
10060
10061 !! test
10062 Section replacement test (section 3)
10063 !! options
10064 replace=3,"xxx"
10065 !! input
10066 start
10067 ==a==
10068 ===aa===
10069 ====aaa====
10070 ==b==
10071 ===ba===
10072 ===bb===
10073 ====bba====
10074 ===bc===
10075 ==c==
10076 ===ca===
10077 !! result
10078 start
10079 ==a==
10080 ===aa===
10081 xxx
10082
10083 ==b==
10084 ===ba===
10085 ===bb===
10086 ====bba====
10087 ===bc===
10088 ==c==
10089 ===ca===
10090 !! end
10091
10092 !! test
10093 Section replacement test (section 4)
10094 !! options
10095 replace=4,"xxx"
10096 !! input
10097 start
10098 ==a==
10099 ===aa===
10100 ====aaa====
10101 ==b==
10102 ===ba===
10103 ===bb===
10104 ====bba====
10105 ===bc===
10106 ==c==
10107 ===ca===
10108 !! result
10109 start
10110 ==a==
10111 ===aa===
10112 ====aaa====
10113 xxx
10114
10115 ==c==
10116 ===ca===
10117 !! end
10118
10119 !! test
10120 Section replacement test (section 5)
10121 !! options
10122 replace=5,"xxx"
10123 !! input
10124 start
10125 ==a==
10126 ===aa===
10127 ====aaa====
10128 ==b==
10129 ===ba===
10130 ===bb===
10131 ====bba====
10132 ===bc===
10133 ==c==
10134 ===ca===
10135 !! result
10136 start
10137 ==a==
10138 ===aa===
10139 ====aaa====
10140 ==b==
10141 xxx
10142
10143 ===bb===
10144 ====bba====
10145 ===bc===
10146 ==c==
10147 ===ca===
10148 !! end
10149
10150 !! test
10151 Section replacement test (section 6)
10152 !! options
10153 replace=6,"xxx"
10154 !! input
10155 start
10156 ==a==
10157 ===aa===
10158 ====aaa====
10159 ==b==
10160 ===ba===
10161 ===bb===
10162 ====bba====
10163 ===bc===
10164 ==c==
10165 ===ca===
10166 !! result
10167 start
10168 ==a==
10169 ===aa===
10170 ====aaa====
10171 ==b==
10172 ===ba===
10173 xxx
10174
10175 ===bc===
10176 ==c==
10177 ===ca===
10178 !! end
10179
10180 !! test
10181 Section replacement test (section 7)
10182 !! options
10183 replace=7,"xxx"
10184 !! input
10185 start
10186 ==a==
10187 ===aa===
10188 ====aaa====
10189 ==b==
10190 ===ba===
10191 ===bb===
10192 ====bba====
10193 ===bc===
10194 ==c==
10195 ===ca===
10196 !! result
10197 start
10198 ==a==
10199 ===aa===
10200 ====aaa====
10201 ==b==
10202 ===ba===
10203 ===bb===
10204 xxx
10205
10206 ===bc===
10207 ==c==
10208 ===ca===
10209 !! end
10210
10211 !! test
10212 Section replacement test (section 8)
10213 !! options
10214 replace=8,"xxx"
10215 !! input
10216 start
10217 ==a==
10218 ===aa===
10219 ====aaa====
10220 ==b==
10221 ===ba===
10222 ===bb===
10223 ====bba====
10224 ===bc===
10225 ==c==
10226 ===ca===
10227 !! result
10228 start
10229 ==a==
10230 ===aa===
10231 ====aaa====
10232 ==b==
10233 ===ba===
10234 ===bb===
10235 ====bba====
10236 xxx
10237
10238 ==c==
10239 ===ca===
10240 !!end
10241
10242 !! test
10243 Section replacement test (section 9)
10244 !! options
10245 replace=9,"xxx"
10246 !! input
10247 start
10248 ==a==
10249 ===aa===
10250 ====aaa====
10251 ==b==
10252 ===ba===
10253 ===bb===
10254 ====bba====
10255 ===bc===
10256 ==c==
10257 ===ca===
10258 !! result
10259 start
10260 ==a==
10261 ===aa===
10262 ====aaa====
10263 ==b==
10264 ===ba===
10265 ===bb===
10266 ====bba====
10267 ===bc===
10268 xxx
10269 !! end
10270
10271 !! test
10272 Section replacement test (section 10)
10273 !! options
10274 replace=10,"xxx"
10275 !! input
10276 start
10277 ==a==
10278 ===aa===
10279 ====aaa====
10280 ==b==
10281 ===ba===
10282 ===bb===
10283 ====bba====
10284 ===bc===
10285 ==c==
10286 ===ca===
10287 !! result
10288 start
10289 ==a==
10290 ===aa===
10291 ====aaa====
10292 ==b==
10293 ===ba===
10294 ===bb===
10295 ====bba====
10296 ===bc===
10297 ==c==
10298 xxx
10299 !! end
10300
10301 !! test
10302 Section replacement test with initial whitespace (bug 13728)
10303 !! options
10304 replace=2,"xxx"
10305 !! input
10306 Preformatted initial line
10307 ==a==
10308 ===a===
10309 !! result
10310 Preformatted initial line
10311 ==a==
10312 xxx
10313 !! end
10314
10315
10316 !! test
10317 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10318 !! options
10319 section=1
10320 !! input
10321 ==a==
10322 a
10323 !! result
10324 ==a==
10325 a
10326 !! end
10327
10328 !! test
10329 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10330 !! options
10331 section=1
10332 !! input
10333 ==a==
10334 a
10335 !! result
10336 ==a==
10337 a
10338 !! end
10339
10340
10341 !! test
10342 Section extraction, <pre> around bogus header (bug 10309)
10343 !! options
10344 noxml section=2
10345 !! input
10346 == Section One ==
10347 <pre>
10348 =======
10349 </pre>
10350
10351 == Section Two ==
10352 stuff
10353 !! result
10354 == Section Two ==
10355 stuff
10356 !! end
10357
10358 !! test
10359 Section replacement, <pre> around bogus header (bug 10309)
10360 !! options
10361 noxml replace=2,"xxx"
10362 !! input
10363 == Section One ==
10364 <pre>
10365 =======
10366 </pre>
10367
10368 == Section Two ==
10369 stuff
10370 !! result
10371 == Section One ==
10372 <pre>
10373 =======
10374 </pre>
10375
10376 xxx
10377 !! end
10378
10379
10380
10381 !! test
10382 Handling of &#x0A; in URLs
10383 !! input
10384 **irc://&#x0A;a
10385 !! result
10386 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10387 </li></ul>
10388 </li></ul>
10389
10390 !!end
10391
10392 !! test
10393 5 quotes, code coverage +1 line
10394 !! input
10395 '''''
10396 !! result
10397 !! end
10398
10399 !! test
10400 Special:Search page linking.
10401 !! input
10402 {{Special:search}}
10403 !! result
10404 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10405 </p>
10406 !! end
10407
10408 !! test
10409 Say the magic word
10410 !! input
10411 * {{PAGENAME}}
10412 * {{BASEPAGENAME}}
10413 * {{SUBPAGENAME}}
10414 * {{SUBPAGENAMEE}}
10415 * {{BASEPAGENAME}}
10416 * {{BASEPAGENAMEE}}
10417 * {{TALKPAGENAME}}
10418 * {{TALKPAGENAMEE}}
10419 * {{SUBJECTPAGENAME}}
10420 * {{SUBJECTPAGENAMEE}}
10421 * {{NAMESPACEE}}
10422 * {{NAMESPACE}}
10423 * {{TALKSPACE}}
10424 * {{TALKSPACEE}}
10425 * {{SUBJECTSPACE}}
10426 * {{SUBJECTSPACEE}}
10427 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10428 !! result
10429 <ul><li> Parser test
10430 </li><li> Parser test
10431 </li><li> Parser test
10432 </li><li> Parser_test
10433 </li><li> Parser test
10434 </li><li> Parser_test
10435 </li><li> Talk:Parser test
10436 </li><li> Talk:Parser_test
10437 </li><li> Parser test
10438 </li><li> Parser_test
10439 </li><li>
10440 </li><li>
10441 </li><li> Talk
10442 </li><li> Talk
10443 </li><li>
10444 </li><li>
10445 </li><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>
10446 </li></ul>
10447
10448 !! end
10449 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10450
10451 !! test
10452 Gallery
10453 !! input
10454 <gallery>
10455 image1.png |
10456 image2.gif|||||
10457
10458 image3|
10459 image4 |300px| centre
10460 image5.svg| http://///////
10461 [[x|xx]]]]
10462 * image6
10463 </gallery>
10464 !! result
10465 <ul class="gallery">
10466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10467 <div style="height: 150px;">Image1.png</div>
10468 <div class="gallerytext">
10469 </div>
10470 </div></li>
10471 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10472 <div style="height: 150px;">Image2.gif</div>
10473 <div class="gallerytext">
10474 <p>||||
10475 </p>
10476 </div>
10477 </div></li>
10478 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10479 <div style="height: 150px;">Image3</div>
10480 <div class="gallerytext">
10481 </div>
10482 </div></li>
10483 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10484 <div style="height: 150px;">Image4</div>
10485 <div class="gallerytext">
10486 <p>300px| centre
10487 </p>
10488 </div>
10489 </div></li>
10490 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10491 <div style="height: 150px;">Image5.svg</div>
10492 <div class="gallerytext">
10493 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10494 </p>
10495 </div>
10496 </div></li>
10497 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10498 <div style="height: 150px;">* image6</div>
10499 <div class="gallerytext">
10500 </div>
10501 </div></li>
10502 </ul>
10503
10504 !! end
10505
10506 !! test
10507 Gallery (with options)
10508 !! input
10509 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10510 File:Nonexistant.jpg|caption
10511 File:Nonexistant.jpg
10512 image:foobar.jpg|some '''caption''' [[Main Page]]
10513 image:foobar.jpg
10514 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10515 </gallery>
10516 !! result
10517 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10518 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10519 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10520 <div style="height: 70px;">Nonexistant.jpg</div>
10521 <div class="gallerytext">
10522 <p>caption
10523 </p>
10524 </div>
10525 </div></li>
10526 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10527 <div style="height: 70px;">Nonexistant.jpg</div>
10528 <div class="gallerytext">
10529 </div>
10530 </div></li>
10531 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10532 <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>
10533 <div class="gallerytext">
10534 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10535 </p>
10536 </div>
10537 </div></li>
10538 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10539 <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>
10540 <div class="gallerytext">
10541 </div>
10542 </div></li>
10543 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10544 <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>
10545 <div class="gallerytext">
10546 <p>Blabla|blabla.
10547 </p>
10548 </div>
10549 </div></li>
10550 </ul>
10551
10552 !! end
10553
10554 !! test
10555 Gallery with wikitext inside caption
10556 !! input
10557 <gallery>
10558 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10559 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10560 </gallery>
10561 !! result
10562 <ul class="gallery">
10563 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10564 <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>
10565 <div class="gallerytext">
10566 <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>
10567 </p>
10568 </div>
10569 </div></li>
10570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10571 <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>
10572 <div class="gallerytext">
10573 <p>This is a test template
10574 </p>
10575 </div>
10576 </div></li>
10577 </ul>
10578
10579 !! end
10580
10581 !! test
10582 gallery (with showfilename option)
10583 !! input
10584 <gallery showfilename>
10585 File:Nonexistant.jpg|caption
10586 File:Nonexistant.jpg
10587 image:foobar.jpg|some '''caption''' [[Main Page]]
10588 File:Foobar.jpg
10589 </gallery>
10590 !! result
10591 <ul class="gallery">
10592 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10593 <div style="height: 150px;">Nonexistant.jpg</div>
10594 <div class="gallerytext">
10595 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10596 caption
10597 </p>
10598 </div>
10599 </div></li>
10600 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10601 <div style="height: 150px;">Nonexistant.jpg</div>
10602 <div class="gallerytext">
10603 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10604 </p>
10605 </div>
10606 </div></li>
10607 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10608 <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>
10609 <div class="gallerytext">
10610 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10611 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10612 </p>
10613 </div>
10614 </div></li>
10615 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10616 <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>
10617 <div class="gallerytext">
10618 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10619 </p>
10620 </div>
10621 </div></li>
10622 </ul>
10623
10624 !! end
10625
10626 !! test
10627 Gallery (with namespace-less filenames)
10628 !! input
10629 <gallery>
10630 File:Nonexistant.jpg
10631 Nonexistant.jpg
10632 image:foobar.jpg
10633 foobar.jpg
10634 </gallery>
10635 !! result
10636 <ul class="gallery">
10637 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10638 <div style="height: 150px;">Nonexistant.jpg</div>
10639 <div class="gallerytext">
10640 </div>
10641 </div></li>
10642 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10643 <div style="height: 150px;">Nonexistant.jpg</div>
10644 <div class="gallerytext">
10645 </div>
10646 </div></li>
10647 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10648 <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>
10649 <div class="gallerytext">
10650 </div>
10651 </div></li>
10652 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10653 <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>
10654 <div class="gallerytext">
10655 </div>
10656 </div></li>
10657 </ul>
10658
10659 !! end
10660
10661 !! test
10662 HTML Hex character encoding (spells the word "JavaScript")
10663 !! input
10664 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10665 !! result
10666 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10667 </p>
10668 !! end
10669
10670 !! test
10671 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10672 !! input
10673 &#xsee;&#XSEE;
10674 !! result
10675 <p>&amp;#xsee;&amp;#XSEE;
10676 </p>
10677 !! end
10678
10679 !! test
10680 HTML Hex character encoding mixed case
10681 !! input
10682 &#xEE;&#Xee;
10683 !! result
10684 <p>&#xee;&#xee;
10685 </p>
10686 !! end
10687
10688 !! test
10689 __FORCETOC__ override
10690 !! input
10691 __NEWSECTIONLINK__
10692 __FORCETOC__
10693 !! result
10694 <p><br />
10695 </p>
10696 !! end
10697
10698 !! test
10699 ISBN code coverage
10700 !! input
10701 ISBN 978-0-1234-56&#x20;789
10702 !! result
10703 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10704 </p>
10705 !! end
10706
10707 !! test
10708 ISBN followed by 5 spaces
10709 !! input
10710 ISBN
10711 !! result
10712 <p>ISBN
10713 </p>
10714 !! end
10715
10716 !! test
10717 Double ISBN
10718 !! input
10719 ISBN ISBN 1234567890
10720 !! result
10721 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10722 </p>
10723 !! end
10724
10725 !! test
10726 Bug 22905: <abbr> followed by ISBN followed by </a>
10727 !! input
10728 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10729 !! result
10730 <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>
10731 </p>
10732 !! end
10733
10734 !! test
10735 Double RFC
10736 !! input
10737 RFC RFC 1234
10738 !! result
10739 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10740 </p>
10741 !! end
10742
10743 !! test
10744 Double RFC with a wiki link
10745 !! input
10746 RFC [[RFC 1234]]
10747 !! result
10748 <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>
10749 </p>
10750 !! end
10751
10752 !! test
10753 RFC code coverage
10754 !! input
10755 RFC 983&#x20;987
10756 !! result
10757 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10758 </p>
10759 !! end
10760
10761 !! test
10762 Centre-aligned image
10763 !! input
10764 [[Image:foobar.jpg|centre]]
10765 !! result
10766 <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>
10767
10768 !!end
10769
10770 !! test
10771 None-aligned image
10772 !! input
10773 [[Image:foobar.jpg|none]]
10774 !! result
10775 <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>
10776
10777 !!end
10778
10779 !! test
10780 Width + Height sized image (using px) (height is ignored)
10781 !! input
10782 [[Image:foobar.jpg|640x480px]]
10783 !! result
10784 <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>
10785 </p>
10786 !!end
10787
10788 !! test
10789 Width-sized image (using px, no following whitespace)
10790 !! input
10791 [[Image:foobar.jpg|640px]]
10792 !! result
10793 <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>
10794 </p>
10795 !!end
10796
10797 !! test
10798 Width-sized image (using px, with following whitespace - test regression from r39467)
10799 !! input
10800 [[Image:foobar.jpg|640px ]]
10801 !! result
10802 <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>
10803 </p>
10804 !!end
10805
10806 !! test
10807 Width-sized image (using px, with preceding whitespace - test regression from r39467)
10808 !! input
10809 [[Image:foobar.jpg| 640px]]
10810 !! result
10811 <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>
10812 </p>
10813 !!end
10814
10815 !! test
10816 Another italics / bold test
10817 !! input
10818 ''' ''x'
10819 !! result
10820 <pre>'<i> </i>x'
10821 </pre>
10822 !!end
10823
10824 # Note the results may be incorrect, as parserTest output included this:
10825 # XML error: Mismatched tag at byte 6120:
10826 # ...<dd> </dt></dl> </dd...
10827 !! test
10828 dt/dd/dl test
10829 !! options
10830 disabled
10831 !! input
10832 :;;;::
10833 !! result
10834 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10835 </dd></dl>
10836 </dd></dl>
10837 </dt></dl>
10838 </dt></dl>
10839 </dt></dl>
10840 </dd></dl>
10841
10842 !!end
10843
10844
10845 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10846 !! test
10847 Images with the "|" character in the comment
10848 !! input
10849 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10850 !! result
10851 <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>
10852
10853 !!end
10854
10855 !! test
10856 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10857 !! input
10858 <html><script>alert(1);</script></html>
10859 !! result
10860 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10861 </p>
10862 !! end
10863
10864 !! test
10865 HTML with raw HTML ($wgRawHtml==true)
10866 !! options
10867 rawhtml
10868 !! input
10869 <html><script>alert(1);</script></html>
10870 !! result
10871 <p><script>alert(1);</script>
10872 </p>
10873 !! end
10874
10875 !! test
10876 Parents of subpages, one level up
10877 !! options
10878 subpage title=[[Subpage test/L1/L2/L3]]
10879 !! input
10880 [[../|L2]]
10881 !! result
10882 <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>
10883 </p>
10884 !! end
10885
10886
10887 !! test
10888 Parents of subpages, one level up, not named
10889 !! options
10890 subpage title=[[Subpage test/L1/L2/L3]]
10891 !! input
10892 [[../]]
10893 !! result
10894 <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>
10895 </p>
10896 !! end
10897
10898
10899
10900 !! test
10901 Parents of subpages, two levels up
10902 !! options
10903 subpage title=[[Subpage test/L1/L2/L3]]
10904 !! input
10905 [[../../|L1]]2
10906
10907 [[../../|L1]]l
10908 !! result
10909 <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
10910 </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>
10911 </p>
10912 !! end
10913
10914 !! test
10915 Parents of subpages, two levels up, without trailing slash or name.
10916 !! options
10917 subpage title=[[Subpage test/L1/L2/L3]]
10918 !! input
10919 [[../..]]
10920 !! result
10921 <p>[[../..]]
10922 </p>
10923 !! end
10924
10925 !! test
10926 Parents of subpages, two levels up, with lots of extra trailing slashes.
10927 !! options
10928 subpage title=[[Subpage test/L1/L2/L3]]
10929 !! input
10930 [[../../////]]
10931 !! result
10932 <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>
10933 </p>
10934 !! end
10935
10936 !! test
10937 Definition list code coverage
10938 !! input
10939 ; title : def
10940 ; title : def
10941 ;title: def
10942 !! result
10943 <dl><dt> title &#160;</dt><dd> def
10944 </dd><dt> title&#160;</dt><dd> def
10945 </dd><dt>title</dt><dd> def
10946 </dd></dl>
10947
10948 !! end
10949
10950 !! test
10951 Don't fall for the self-closing div
10952 !! input
10953 <div>hello world</div/>
10954 !! result
10955 <div>hello world</div>
10956
10957 !! end
10958
10959 !! test
10960 MSGNW magic word
10961 !! input
10962 {{MSGNW:msg}}
10963 !! result
10964 <p>&#91;&#91;:Template:Msg&#93;&#93;
10965 </p>
10966 !! end
10967
10968 !! test
10969 RAW magic word
10970 !! input
10971 {{RAW:QUERTY}}
10972 !! result
10973 <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>
10974 </p>
10975 !! end
10976
10977 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10978 !! test
10979 Always escape literal '>' in output, not just after '<'
10980 !! input
10981 ><>
10982 !! result
10983 <p>&gt;&lt;&gt;
10984 </p>
10985 !! end
10986
10987 !! test
10988 Template caching
10989 !! input
10990 {{Test}}
10991 {{Test}}
10992 !! result
10993 <p>This is a test template
10994 This is a test template
10995 </p>
10996 !! end
10997
10998
10999 !! article
11000 MediaWiki:Fake
11001 !! text
11002 ==header==
11003 !! endarticle
11004
11005 !! test
11006 Inclusion of !userCanEdit() content
11007 !! input
11008 {{MediaWiki:Fake}}
11009 !! result
11010 <h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2>
11011
11012 !! end
11013
11014
11015 !! test
11016 Out-of-order TOC heading levels
11017 !! input
11018 ==2==
11019 ======6======
11020 ===3===
11021 =1=
11022 =====5=====
11023 ==2==
11024 !! result
11025 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11026 <ul>
11027 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11028 <ul>
11029 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11030 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11031 </ul>
11032 </li>
11033 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11034 <ul>
11035 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11036 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11037 </ul>
11038 </li>
11039 </ul>
11040 </td></tr></table>
11041 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2>
11042 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6>
11043 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3>
11044 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1>
11045 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5>
11046 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2>
11047
11048 !! end
11049
11050
11051 !! test
11052 ISBN with a dummy number
11053 !! input
11054 ISBN ---
11055 !! result
11056 <p>ISBN ---
11057 </p>
11058 !! end
11059
11060
11061 !! test
11062 ISBN with space-delimited number
11063 !! input
11064 ISBN 92 9017 032 8
11065 !! result
11066 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11067 </p>
11068 !! end
11069
11070
11071 !! test
11072 ISBN with multiple spaces, no number
11073 !! input
11074 ISBN foo
11075 !! result
11076 <p>ISBN foo
11077 </p>
11078 !! end
11079
11080
11081 !! test
11082 ISBN length
11083 !! input
11084 ISBN 123456789
11085
11086 ISBN 1234567890
11087
11088 ISBN 12345678901
11089 !! result
11090 <p>ISBN 123456789
11091 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11092 </p><p>ISBN 12345678901
11093 </p>
11094 !! end
11095
11096
11097 !! test
11098 ISBN with trailing year (bug 8110)
11099 !! input
11100 ISBN 1-234-56789-0 - 2006
11101
11102 ISBN 1 234 56789 0 - 2006
11103 !! result
11104 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11105 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11106 </p>
11107 !! end
11108
11109
11110 !! test
11111 anchorencode
11112 !! input
11113 {{anchorencode:foo bar©#%n}}
11114 !! result
11115 <p>foo_bar.C2.A9.23.25n
11116 </p>
11117 !! end
11118
11119 !! test
11120 anchorencode trims spaces
11121 !! input
11122 {{anchorencode: __pretty__please__}}
11123 !! result
11124 <p>pretty_please
11125 </p>
11126 !! end
11127
11128 !! test
11129 anchorencode deals with links
11130 !! input
11131 {{anchorencode: [[hello|world]] [[hi]]}}
11132 !! result
11133 <p>world_hi
11134 </p>
11135 !! end
11136
11137 !! test
11138 anchorencode deals with templates
11139 !! input
11140 {{anchorencode: {{Foo}} }}
11141 !! result
11142 <p>FOO
11143 </p>
11144 !! end
11145
11146 !! test
11147 anchorencode encodes like the TOC generator: (bug 18431)
11148 !! input
11149 === _ +:.3A%3A&&amp;]] ===
11150 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11151 __NOEDITSECTION__
11152 !! result
11153 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
11154 <p>.2B:.3A.253A.26.26.5D.5D
11155 </p>
11156 !! end
11157
11158 # Expected output in the following test is not necessarily expected (there
11159 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11160 # only testing for well-formedness.
11161 !! test
11162 Bug 6200: blockquotes and paragraph formatting
11163 !! input
11164 <blockquote>
11165 foo
11166 </blockquote>
11167
11168 bar
11169
11170 baz
11171 !! result
11172 <blockquote>
11173 foo
11174 </blockquote>
11175 <p>bar
11176 </p>
11177 <pre>baz
11178 </pre>
11179 !! end
11180
11181 !! test
11182 Bug 8293: Use of center tag ruins paragraph formatting
11183 !! input
11184 <center>
11185 foo
11186 </center>
11187
11188 bar
11189
11190 baz
11191 !! result
11192 <center>
11193 <p>foo
11194 </p>
11195 </center>
11196 <p>bar
11197 </p>
11198 <pre>baz
11199 </pre>
11200 !! end
11201
11202
11203 ###
11204 ### Language variants related tests
11205 ###
11206 !! test
11207 Self-link in language variants
11208 !! options
11209 title=[[Dunav]] language=sr
11210 !! input
11211 Both [[Dunav]] and [[Дунав]] are names for this river.
11212 !! result
11213 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11214 </p>
11215 !!end
11216
11217 !! article
11218 Дуна
11219 !! text
11220 content
11221 !! endarticle
11222
11223 !! test
11224 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11225 !! options
11226 title=[[Duna]] language=sr
11227 !! input
11228 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11229 !! result
11230 <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.
11231 </p>
11232 !! end
11233
11234 !! test
11235 Link to pages in language variants
11236 !! options
11237 language=sr
11238 !! input
11239 Main Page can be written as [[Маин Паге]]
11240 !! result
11241 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11242 </p>
11243 !!end
11244
11245
11246 !! test
11247 Multiple links to pages in language variants
11248 !! options
11249 language=sr
11250 !! input
11251 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11252 !! result
11253 <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>.
11254 </p>
11255 !!end
11256
11257
11258 !! test
11259 Simple template in language variants
11260 !! options
11261 language=sr
11262 !! input
11263 {{тест}}
11264 !! result
11265 <p>This is a test template
11266 </p>
11267 !! end
11268
11269
11270 !! test
11271 Template with explicit namespace in language variants
11272 !! options
11273 language=sr
11274 !! input
11275 {{Template:тест}}
11276 !! result
11277 <p>This is a test template
11278 </p>
11279 !! end
11280
11281
11282 !! test
11283 Basic test for template parameter in language variants
11284 !! options
11285 language=sr
11286 !! input
11287 {{парамтест|param=foo}}
11288 !! result
11289 <p>This is a test template with parameter foo
11290 </p>
11291 !! end
11292
11293
11294 !! test
11295 Simple category in language variants
11296 !! options
11297 language=sr cat
11298 !! input
11299 [[Category:МедиаWики Усер'с Гуиде]]
11300 !! result
11301 <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>
11302 !! end
11303
11304
11305 !! article
11306 Category:分类
11307 !! text
11308 blah
11309 !! endarticle
11310
11311 !! article
11312 Category:分類
11313 !! text
11314 blah
11315 !! endarticle
11316
11317 !! test
11318 Don't convert blue categorylinks to another variant (bug 33210)
11319 !! options
11320 language=zh cat
11321 !! input
11322 [[A]][[Category:分类]]
11323 !! result
11324 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11325 !! end
11326
11327
11328 !! test
11329 Stripping -{}- tags (language variants)
11330 !! options
11331 language=sr
11332 !! input
11333 Latin proverb: -{Ne nuntium necare}-
11334 !! result
11335 <p>Latin proverb: Ne nuntium necare
11336 </p>
11337 !! end
11338
11339
11340 !! test
11341 Prevent conversion with -{}- tags (language variants)
11342 !! options
11343 language=sr variant=sr-ec
11344 !! input
11345 Latinski: -{Ne nuntium necare}-
11346 !! result
11347 <p>Латински: Ne nuntium necare
11348 </p>
11349 !! end
11350
11351
11352 !! test
11353 Prevent conversion of text with -{}- tags (language variants)
11354 !! options
11355 language=sr variant=sr-ec
11356 !! input
11357 Latinski: -{Ne nuntium necare}-
11358 !! result
11359 <p>Латински: Ne nuntium necare
11360 </p>
11361 !! end
11362
11363
11364 !! test
11365 Prevent conversion of links with -{}- tags (language variants)
11366 !! options
11367 language=sr variant=sr-ec
11368 !! input
11369 -{[[Main Page]]}-
11370 !! result
11371 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11372 </p>
11373 !! end
11374
11375
11376 !! test
11377 -{}- tags within headlines (within html for parserConvert())
11378 !! options
11379 language=sr variant=sr-ec
11380 !! input
11381 == -{Naslov}- ==
11382 !! result
11383 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2>
11384
11385 !! end
11386
11387
11388 !! test
11389 Explicit definition of language variant alternatives
11390 !! options
11391 language=zh variant=zh-tw
11392 !! input
11393 -{zh:China;zh-tw:Taiwan}-, not China
11394 !! result
11395 <p>Taiwan, not China
11396 </p>
11397 !! end
11398
11399
11400 !! test
11401 Conversion around HTML tags
11402 !! options
11403 language=sr variant=sr-ec
11404 !! input
11405 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11406 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11407 !! result
11408 <p>
11409 <span title="ЛаCтин">ски</span>
11410 </p>
11411 !! end
11412
11413
11414 !! test
11415 Explicit session-wise language variant mapping (A flag and - flag)
11416 !! options
11417 language=zh variant=zh-tw
11418 !! input
11419 Taiwan is not China.
11420 But -{A|zh:China;zh-tw:Taiwan}- is China,
11421 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11422 and -{China}- is China.
11423 !! result
11424 <p>Taiwan is not China.
11425 But Taiwan is Taiwan,
11426 (This should be stripped!)
11427 and China is China.
11428 </p>
11429 !! end
11430
11431 !! test
11432 Explicit session-wise language variant mapping (H flag for hide)
11433 !! options
11434 language=zh variant=zh-tw
11435 !! input
11436 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11437 Taiwan is China.
11438 !! result
11439 <p>(This should be stripped!)
11440 Taiwan is Taiwan.
11441 </p>
11442 !! end
11443
11444 !! test
11445 Adding explicit conversion rule for title (T flag)
11446 !! options
11447 language=zh variant=zh-tw showtitle
11448 !! input
11449 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11450 !! result
11451 Taiwan
11452 <p>Should be stripped!
11453 </p>
11454 !! end
11455
11456 !! test
11457 Testing that changing the language variant here in the tests actually works
11458 !! options
11459 language=zh variant=zh showtitle
11460 !! input
11461 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11462 !! result
11463 China
11464 <p>Should be stripped!
11465 </p>
11466 !! end
11467
11468 !! test
11469 Recursive conversion of alt and title attrs shouldn't clear converter state
11470 !! options
11471 language=zh variant=zh-cn showtitle
11472 !! input
11473 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11474 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11475 !! result
11476 China
11477 <p>
11478 Should be stripped<span title="Exclamation">!</span>
11479 </p>
11480 !! end
11481
11482 !! test
11483 Bug 24072: more test on conversion rule for title
11484 !! options
11485 language=zh variant=zh-tw showtitle
11486 !! input
11487 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11488 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11489 !! result
11490 Taiwan
11491 <p>This should be stripped!
11492 This won't take interferes with the title rule.
11493 </p>
11494 !! end
11495
11496 !! test
11497 Raw output of variant escape tags (R flag)
11498 !! options
11499 language=zh variant=zh-tw
11500 !! input
11501 Raw: -{R|zh:China;zh-tw:Taiwan}-
11502 !! result
11503 <p>Raw: zh:China;zh-tw:Taiwan
11504 </p>
11505 !! end
11506
11507 !! test
11508 Nested using of manual convert syntax
11509 !! options
11510 language=zh variant=zh-hk
11511 !! input
11512 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11513 !! result
11514 <p>Nested: Hello Hong Kong!
11515 </p>
11516 !! end
11517
11518 !! test
11519 Proper conversion of text in external links
11520 !! options
11521 language=sr variant=sr-ec
11522 !! input
11523 http://www.google.com
11524 gopher://www.google.com
11525 [http://www.google.com http://www.google.com]
11526 [gopher://www.google.com gopher://www.google.com]
11527 [https://www.google.com irc://www.google.com]
11528 [ftp://www.google.com www.google.com/ftp://dir]
11529 [//www.google.com www.google.com]
11530 !! result
11531 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11532 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11533 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11534 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11535 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11536 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11537 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11538 </p>
11539 !! end
11540
11541 !! test
11542 Do not convert roman numbers to language variants
11543 !! options
11544 language=sr variant=sr-ec
11545 !! input
11546 Fridrih IV je car.
11547 !! result
11548 <p>Фридрих IV је цар.
11549 </p>
11550 !! end
11551
11552 !! test
11553 Unclosed language converter markup "-{"
11554 !! options
11555 language=sr
11556 !! input
11557 -{T|hello
11558 !! result
11559 <p>-{T|hello
11560 </p>
11561 !! end
11562
11563 !! test
11564 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11565 !! options
11566 language=sr
11567 !! input
11568 -{R|=&gt;}-
11569 !! result
11570 <p>=&gt;
11571 </p>
11572 !!end
11573
11574 !!article
11575 Template:Bullet
11576 !!text
11577 * Bar
11578 !!endarticle
11579
11580 !! test
11581 Bug 529: Uncovered bullet
11582 !! input
11583 * Foo {{bullet}}
11584 !! result
11585 <ul><li> Foo
11586 </li><li> Bar
11587 </li></ul>
11588
11589 !! end
11590
11591 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11592 # Templates in Wikipedia rely on this behavior, as tidy has always been
11593 # enabled there. These tests are normally run *without* tidy, so specify the
11594 # full output here.
11595 # To test realistic parsing behavior, apply a tidy-like transformation to both
11596 # the expected output and your parser's output.
11597 !! test
11598 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11599 !! input
11600 ******* Foo {{bullet}}
11601 !! result
11602 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11603 </li></ul>
11604 </li></ul>
11605 </li></ul>
11606 </li></ul>
11607 </li></ul>
11608 </li></ul>
11609 </li><li> Bar
11610 </li></ul>
11611
11612 !! end
11613
11614 !! test
11615 Bug 529: Uncovered table already at line-start
11616 !! input
11617 x
11618
11619 {{table}}
11620 y
11621 !! result
11622 <p>x
11623 </p>
11624 <table>
11625 <tr>
11626 <td> 1 </td>
11627 <td> 2
11628 </td></tr>
11629 <tr>
11630 <td> 3 </td>
11631 <td> 4
11632 </td></tr></table>
11633 <p>y
11634 </p>
11635 !! end
11636
11637 !! test
11638 Bug 529: Uncovered bullet in parser function result
11639 !! input
11640 * Foo {{lc:{{bullet}} }}
11641 !! result
11642 <ul><li> Foo
11643 </li><li> bar
11644 </li></ul>
11645
11646 !! end
11647
11648 !! test
11649 Bug 5678: Double-parsed template argument
11650 !! input
11651 {{lc:{{{1}}}|hello}}
11652 !! result
11653 <p>{{{1}}}
11654 </p>
11655 !! end
11656
11657 !! test
11658 Bug 5678: Double-parsed template invocation
11659 !! input
11660 {{lc:{{paramtest {{!}} param = hello }} }}
11661 !! result
11662 <p>{{paramtest | param = hello }}
11663 </p>
11664 !! end
11665
11666 !! test
11667 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11668 !! options
11669 language=cs
11670 title=[[Main Page]]
11671 !! input
11672 {{PRVNÍVELKÉ:ěščř}}
11673 {{prvnívelké:ěščř}}
11674 {{PRVNÍMALÉ:ěščř}}
11675 {{prvnímalé:ěščř}}
11676 {{MALÁ:ěščř}}
11677 {{malá:ěščř}}
11678 {{VELKÁ:ěščř}}
11679 {{velká:ěščř}}
11680 !! result
11681 <p>Ěščř
11682 Ěščř
11683 ěščř
11684 ěščř
11685 ěščř
11686 ěščř
11687 ĚŠČŘ
11688 ĚŠČŘ
11689 </p>
11690 !! end
11691
11692 !! test
11693 Morwen/13: Unclosed link followed by heading
11694 !! input
11695 [[link
11696 ==heading==
11697 !! result
11698 <p>[[link
11699 </p>
11700 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
11701
11702 !! end
11703
11704 !! test
11705 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11706 !! input
11707 {{foo|
11708 =heading=
11709 !! result
11710 <p>{{foo|
11711 </p>
11712 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11713
11714 !! end
11715
11716 !! test
11717 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11718 !! input
11719 {{foo|
11720 ==heading==
11721 !! result
11722 <p>{{foo|
11723 </p>
11724 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
11725
11726 !! end
11727
11728 !! test
11729 Tildes in comments
11730 !! options
11731 pst
11732 !! input
11733 <!-- ~~~~ -->
11734 !! result
11735 <!-- ~~~~ -->
11736 !! end
11737
11738 !! test
11739 Paragraphs inside divs (no extra line breaks)
11740 !! input
11741 <div>Line one
11742
11743 Line two</div>
11744 !! result
11745 <div>Line one
11746 Line two</div>
11747
11748 !! end
11749
11750 !! test
11751 Paragraphs inside divs (extra line break on open)
11752 !! input
11753 <div>
11754 Line one
11755
11756 Line two</div>
11757 !! result
11758 <div>
11759 <p>Line one
11760 </p>
11761 Line two</div>
11762
11763 !! end
11764
11765 !! test
11766 Paragraphs inside divs (extra line break on close)
11767 !! input
11768 <div>Line one
11769
11770 Line two
11771 </div>
11772 !! result
11773 <div>Line one
11774 <p>Line two
11775 </p>
11776 </div>
11777
11778 !! end
11779
11780 !! test
11781 Paragraphs inside divs (extra line break on open and close)
11782 !! input
11783 <div>
11784 Line one
11785
11786 Line two
11787 </div>
11788 !! result
11789 <div>
11790 <p>Line one
11791 </p><p>Line two
11792 </p>
11793 </div>
11794
11795 !! end
11796
11797 !! test
11798 Nesting tags, paragraphs on lines which begin with <div>
11799 !! options
11800 disabled
11801 !! input
11802 <div></div><strong>A
11803 B</strong>
11804 !! result
11805 <div></div>
11806 <p><strong>A
11807 B</strong>
11808 </p>
11809 !! end
11810
11811 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11812 !! test
11813 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11814 !! options
11815 disabled
11816 !! input
11817 <blockquote>Line one
11818
11819 Line two</blockquote>
11820 !! result
11821 <blockquote>Line one
11822 Line two</blockquote>
11823
11824 !! end
11825
11826 !! test
11827 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11828 !! options
11829 disabled
11830 !! input
11831 <blockquote>
11832 Line one
11833
11834 Line two</blockquote>
11835 !! result
11836 <blockquote>
11837 <p>Line one
11838 </p>
11839 Line two</blockquote>
11840
11841 !! end
11842
11843 !! test
11844 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11845 !! options
11846 disabled
11847 !! input
11848 <blockquote>Line one
11849
11850 Line two
11851 </blockquote>
11852 !! result
11853 <blockquote>Line one
11854 <p>Line two
11855 </p>
11856 </blockquote>
11857
11858 !! end
11859
11860 !! test
11861 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11862 !! options
11863 disabled
11864 !! input
11865 <blockquote>
11866 Line one
11867
11868 Line two
11869 </blockquote>
11870 !! result
11871 <blockquote>
11872 <p>Line one
11873 </p><p>Line two
11874 </p>
11875 </blockquote>
11876
11877 !! end
11878
11879 !! test
11880 Paragraphs inside blockquotes/divs (no extra line breaks)
11881 !! input
11882 <blockquote><div>Line one
11883
11884 Line two</div></blockquote>
11885 !! result
11886 <blockquote><div>Line one
11887 Line two</div></blockquote>
11888
11889 !! end
11890
11891 !! test
11892 Paragraphs inside blockquotes/divs (extra line break on open)
11893 !! input
11894 <blockquote><div>
11895 Line one
11896
11897 Line two</div></blockquote>
11898 !! result
11899 <blockquote><div>
11900 <p>Line one
11901 </p>
11902 Line two</div></blockquote>
11903
11904 !! end
11905
11906 !! test
11907 Paragraphs inside blockquotes/divs (extra line break on close)
11908 !! input
11909 <blockquote><div>Line one
11910
11911 Line two
11912 </div></blockquote>
11913 !! result
11914 <blockquote><div>Line one
11915 <p>Line two
11916 </p>
11917 </div></blockquote>
11918
11919 !! end
11920
11921 !! test
11922 Paragraphs inside blockquotes/divs (extra line break on open and close)
11923 !! input
11924 <blockquote><div>
11925 Line one
11926
11927 Line two
11928 </div></blockquote>
11929 !! result
11930 <blockquote><div>
11931 <p>Line one
11932 </p><p>Line two
11933 </p>
11934 </div></blockquote>
11935
11936 !! end
11937
11938 !! test
11939 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11940 !! options
11941 wgLinkHolderBatchSize=0
11942 !! input
11943 [[meatball:1]]
11944 [[meatball:2]]
11945 [[meatball:3]]
11946 !! result
11947 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11948 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11949 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11950 </p>
11951 !! end
11952
11953 !! test
11954 Free external link invading image caption
11955 !! input
11956 [[Image:Foobar.jpg|thumb|http://x|hello]]
11957 !! result
11958 <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>
11959
11960 !! end
11961
11962 !! test
11963 Bug 15196: localised external link numbers
11964 !! options
11965 language=fa
11966 !! input
11967 [http://en.wikipedia.org/]
11968 !! result
11969 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11970 </p>
11971 !! end
11972
11973 !! test
11974 Multibyte character in padleft
11975 !! input
11976 {{padleft:-Hello|7|Æ}}
11977 !! result
11978 <p>Æ-Hello
11979 </p>
11980 !! end
11981
11982 !! test
11983 Multibyte character in padright
11984 !! input
11985 {{padright:Hello-|7|Æ}}
11986 !! result
11987 <p>Hello-Æ
11988 </p>
11989 !! end
11990
11991 !!test
11992 formatdate parser function
11993 !!input
11994 {{#formatdate:2009-03-24}}
11995 !! result
11996 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11997 </p>
11998 !! end
11999
12000 !!test
12001 formatdate parser function, with default format
12002 !!input
12003 {{#formatdate:2009-03-24|mdy}}
12004 !! result
12005 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12006 </p>
12007 !! end
12008
12009 !! test
12010 Spacing of numbers in formatted dates
12011 !! input
12012 {{#formatdate:January 15}}
12013 !! result
12014 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12015 </p>
12016 !! end
12017
12018 !! test
12019 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
12020 !! options
12021 language=nl title=[[MediaWiki:Common.css]]
12022 !! input
12023 {{#formatdate:2009-03-24|dmy}}
12024 !! result
12025 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12026 </p>
12027 !! end
12028
12029 #
12030 #
12031 #
12032
12033 #
12034 # Edit comments
12035 #
12036
12037 !! test
12038 Edit comment with link
12039 !! options
12040 comment
12041 !! input
12042 I like the [[Main Page]] a lot
12043 !! result
12044 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12045 !!end
12046
12047 !! test
12048 Edit comment with link and link text
12049 !! options
12050 comment
12051 !! input
12052 I like the [[Main Page|best pages]] a lot
12053 !! result
12054 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12055 !!end
12056
12057 !! test
12058 Edit comment with link and link text with suffix
12059 !! options
12060 comment
12061 !! input
12062 I like the [[Main Page|best page]]s a lot
12063 !! result
12064 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12065 !!end
12066
12067 !! test
12068 Edit comment with section link (non-local, eg in history list)
12069 !! options
12070 comment title=[[Main Page]]
12071 !! input
12072 /* External links */ removed bogus entries
12073 !! result
12074 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12075 !!end
12076
12077 !! test
12078 Edit comment with section link and text before it (non-local, eg in history list)
12079 !! options
12080 comment title=[[Main Page]]
12081 !! input
12082 pre-comment text /* External links */ removed bogus entries
12083 !! result
12084 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>
12085 !!end
12086
12087 !! test
12088 Edit comment with section link (local, eg in diff view)
12089 !! options
12090 comment local title=[[Main Page]]
12091 !! input
12092 /* External links */ removed bogus entries
12093 !! result
12094 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12095 !!end
12096
12097 !! test
12098 Edit comment with subpage link (bug 14080)
12099 !! options
12100 comment
12101 subpage
12102 title=[[Subpage test]]
12103 !! input
12104 Poked at a [[/subpage]] here...
12105 !! result
12106 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12107 !!end
12108
12109 !! test
12110 Edit comment with subpage link and link text (bug 14080)
12111 !! options
12112 comment
12113 subpage
12114 title=[[Subpage test]]
12115 !! input
12116 Poked at a [[/subpage|neat little page]] here...
12117 !! result
12118 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12119 !!end
12120
12121 !! test
12122 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12123 !! options
12124 comment
12125 title=[[Subpage test]]
12126 !! input
12127 Poked at a [[/subpage]] here...
12128 !! result
12129 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...
12130 !!end
12131
12132 !! test
12133 Edit comment with bare anchor link (local, as on diff)
12134 !! options
12135 comment
12136 local
12137 title=[[Main Page]]
12138 !!input
12139 [[#section]]
12140 !! result
12141 <a href="#section">#section</a>
12142 !! end
12143
12144 !! test
12145 Edit comment with bare anchor link (non-local, as on history)
12146 !! options
12147 comment
12148 title=[[Main Page]]
12149 !!input
12150 [[#section]]
12151 !! result
12152 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12153 !! end
12154
12155 !! test
12156 Anchor starting with underscore
12157 !!input
12158 [[#_ref|One]]
12159 !! result
12160 <p><a href="#_ref">One</a>
12161 </p>
12162 !! end
12163
12164 !! test
12165 Id starting with underscore
12166 !!input
12167 <div id="_ref"></div>
12168 !! result
12169 <div id="_ref"></div>
12170
12171 !! end
12172
12173 !! test
12174 Space normalisation on autocomment (bug 22784)
12175 !! options
12176 comment
12177 title=[[Main Page]]
12178 !!input
12179 /* __hello__world__ */
12180 !! result
12181 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12182 !! end
12183
12184 !! test
12185 percent-encoding and + signs in comments (Bug 26410)
12186 !! options
12187 comment
12188 !!input
12189 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12190 !! result
12191 <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>
12192 !! end
12193
12194 !! test
12195 Bad images - basic functionality
12196 !! options
12197 disabled
12198 !! input
12199 [[File:Bad.jpg]]
12200 !! result
12201 !! end
12202
12203 !! test
12204 Bad images - bug 16039: text after bad image disappears
12205 !! options
12206 disabled
12207 !! input
12208 Foo bar
12209 [[File:Bad.jpg]]
12210 Bar foo
12211 !! result
12212 <p>Foo bar
12213 </p><p>Bar foo
12214 </p>
12215 !! end
12216
12217 !! test
12218 Verify that displaytitle works (bug #22501) no displaytitle
12219 !! options
12220 showtitle
12221 !! config
12222 wgAllowDisplayTitle=true
12223 wgRestrictDisplayTitle=false
12224 !! input
12225 this is not the the title
12226 !! result
12227 Parser test
12228 <p>this is not the the title
12229 </p>
12230 !! end
12231
12232 !! test
12233 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12234 !! options
12235 showtitle
12236 title=[[Screen]]
12237 !! config
12238 wgAllowDisplayTitle=true
12239 wgRestrictDisplayTitle=false
12240 !! input
12241 this is not the the title
12242 {{DISPLAYTITLE:whatever}}
12243 !! result
12244 whatever
12245 <p>this is not the the title
12246 </p>
12247 !! end
12248
12249 !! test
12250 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12251 !! options
12252 showtitle
12253 title=[[Screen]]
12254 !! config
12255 wgAllowDisplayTitle=true
12256 wgRestrictDisplayTitle=true
12257 !! input
12258 this is not the the title
12259 {{DISPLAYTITLE:whatever}}
12260 !! result
12261 Screen
12262 <p>this is not the the title
12263 </p>
12264 !! end
12265
12266 !! test
12267 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12268 !! options
12269 showtitle
12270 title=[[Screen]]
12271 !! config
12272 wgAllowDisplayTitle=true
12273 wgRestrictDisplayTitle=true
12274 !! input
12275 this is not the the title
12276 {{DISPLAYTITLE:screen}}
12277 !! result
12278 screen
12279 <p>this is not the the title
12280 </p>
12281 !! end
12282
12283 !! test
12284 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12285 !! options
12286 showtitle
12287 title=[[Screen]]
12288 !! config
12289 wgAllowDisplayTitle=false
12290 !! input
12291 this is not the the title
12292 {{DISPLAYTITLE:screen}}
12293 !! result
12294 Screen
12295 <p>this is not the the title
12296 <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>
12297 </p>
12298 !! end
12299
12300 !! test
12301 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12302 !! options
12303 showtitle
12304 title=[[Screen]]
12305 !! config
12306 wgAllowDisplayTitle=false
12307 !! input
12308 this is not the the title
12309 !! result
12310 Screen
12311 <p>this is not the the title
12312 </p>
12313 !! end
12314
12315 !! test
12316 preload: check <noinclude> and <includeonly>
12317 !! options
12318 preload
12319 !! input
12320 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12321 !! result
12322 Hello kind world.
12323 !! end
12324
12325 !! test
12326 preload: check <onlyinclude>
12327 !! options
12328 preload
12329 !! input
12330 Goodbye <onlyinclude>Hello world</onlyinclude>
12331 !! result
12332 Hello world
12333 !! end
12334
12335 !! test
12336 preload: can pass tags through if we want to
12337 !! options
12338 preload
12339 !! input
12340 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12341 !! result
12342 <includeonly>Hello world</includeonly>
12343 !! end
12344
12345 !! test
12346 preload: check that it doesn't try to do tricks
12347 !! options
12348 preload
12349 !! input
12350 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12351 !! result
12352 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12353 !! end
12354
12355 !! test
12356 Play a bit with r67090 and bug 3158
12357 !! options
12358 disabled
12359 !! input
12360 <div style="width:50% !important">&nbsp;</div>
12361 <div style="width:50%&nbsp;!important">&nbsp;</div>
12362 <div style="width:50%&#160;!important">&nbsp;</div>
12363 <div style="border : solid;">&nbsp;</div>
12364 !! result
12365 <div style="width:50% !important">&nbsp;</div>
12366 <div style="width:50% !important">&nbsp;</div>
12367 <div style="width:50% !important">&nbsp;</div>
12368 <div style="border&#160;: solid;">&nbsp;</div>
12369
12370 !! end
12371
12372 !! test
12373 HTML5 data attributes
12374 !! input
12375 <span data-foo="bar">Baz</span>
12376 <p data-abc-def_hij="">Quuz</p>
12377 !! result
12378 <p><span data-foo="bar">Baz</span>
12379 </p>
12380 <p data-abc-def_hij="">Quuz</p>
12381
12382 !! end
12383
12384 !! test
12385 percent-encoding and + signs in internal links (Bug 26410)
12386 !! input
12387 [[User:+%]] [[Page+title%]]
12388 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12389 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12390 [[%33%45]] [[%33%45+]]
12391 !! result
12392 <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>
12393 <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>
12394 <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>
12395 <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>
12396 </p>
12397 !! end
12398
12399 !! test
12400 Special characters in embedded file links (bug 27679)
12401 !! input
12402 [[File:Contains & ampersand.jpg]]
12403 [[File:Does not exist.jpg|Title with & ampersand]]
12404 !! result
12405 <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>
12406 <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>
12407 </p>
12408 !! end
12409
12410
12411 !! test
12412 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12413 !! input
12414 Text&apos;s been normalized?
12415 !! result
12416 <p>Text&#39;s been normalized?
12417 </p>
12418 !! end
12419
12420 !! test
12421 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12422 !! input
12423 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12424 !! result
12425 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12426 </p>
12427 !! end
12428
12429 !! test
12430 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12431 !! input
12432 [http://www.example.org/ ideograms]
12433 !! result
12434 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12435 </p>
12436 !! end
12437
12438 !! test
12439 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12440 !! input
12441 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12442 !! result
12443 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12444 </p>
12445 !! end
12446
12447 !! article
12448 Mediawiki:loop1
12449 !! text
12450 {{Identical|A}}
12451 !! endarticle
12452
12453 !! article
12454 Mediawiki:loop2
12455 !! text
12456 {{Identical|B}}
12457 !! endarticle
12458
12459 !! article
12460 Template:Identical
12461 !! text
12462 {{int:loop1}}
12463 {{int:loop2}}
12464 !! endarticle
12465
12466 !! test
12467 Bug 31098 Template which includes system messages which includes the template
12468 !! input
12469 {{Identical}}
12470 !! result
12471 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12472 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12473 </p>
12474 !! end
12475
12476 !! test
12477 Bug31490 Turkish: ucfirst 'blah'
12478 !! options
12479 language=tr
12480 !! input
12481 {{ucfirst:blah}}
12482 !! result
12483 <p>Blah
12484 </p>
12485 !! end
12486
12487 !! test
12488 Bug31490 Turkish: ucfirst 'ix'
12489 !! options
12490 language=tr
12491 !! input
12492 {{ucfirst:ix}}
12493 !! result
12494 <p>İx
12495 </p>
12496 !! end
12497
12498 !! test
12499 Bug31490 Turkish: lcfirst 'BLAH'
12500 !! options
12501 language=tr
12502 !! input
12503 {{lcfirst:BLAH}}
12504 !! result
12505 <p>bLAH
12506 </p>
12507 !! end
12508
12509 !! test
12510 Bug31490 Turkish: ucfırst (with a dotless i)
12511 !! options
12512 language=tr
12513 !! input
12514 {{ucfırst:blah}}
12515 !! result
12516 <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>
12517 </p>
12518 !! end
12519
12520 !! test
12521 Bug31490 ucfırst (with a dotless i) with English language
12522 !! options
12523 language=en
12524 !! input
12525 {{ucfırst:blah}}
12526 !! result
12527 <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>
12528 </p>
12529 !! end
12530
12531 !! test
12532 Bug 26375: TOC with italics
12533 !! options
12534 title=[[Main Page]]
12535 !! input
12536 __TOC__
12537 == ''Lost'' episodes ==
12538 !! result
12539 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12540 <ul>
12541 <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>
12542 </ul>
12543 </td></tr></table>
12544 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span> <span class="mw-headline" id="Lost_episodes"> <i>Lost</i> episodes </span></h2>
12545
12546 !! end
12547
12548 !! test
12549 Bug 26375: TOC with bold
12550 !! options
12551 title=[[Main Page]]
12552 !! input
12553 __TOC__
12554 == '''should be bold''' then normal text ==
12555 !! result
12556 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12557 <ul>
12558 <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>
12559 </ul>
12560 </td></tr></table>
12561 <h2><span class="editsection">[<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> <span class="mw-headline" id="should_be_bold_then_normal_text"> <b>should be bold</b> then normal text </span></h2>
12562
12563 !! end
12564
12565 !! test
12566 Bug 33845: Headings become cursive in TOC when they contain an image
12567 !! options
12568 title=[[Main Page]]
12569 !! input
12570 __TOC__
12571 == Image [[Image:foobar.jpg]] ==
12572 !! result
12573 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12574 <ul>
12575 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12576 </ul>
12577 </td></tr></table>
12578 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span> <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></h2>
12579
12580 !! end
12581
12582 !! test
12583 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12584 !! options
12585 title=[[Main Page]]
12586 !! input
12587 __TOC__
12588 == <blockquote>Quote</blockquote> ==
12589 !! result
12590 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12591 <ul>
12592 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12593 </ul>
12594 </td></tr></table>
12595 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span> <span class="mw-headline" id="Quote"> <blockquote>Quote</blockquote> </span></h2>
12596
12597 !! end
12598
12599 !! test
12600 Unclosed tags in TOC
12601 !! options
12602 title=[[Main Page]]
12603 !! input
12604 __TOC__
12605 == Proof: 2 < 3 ==
12606 <small>Hanc marginis exiguitas non caperet.</small>
12607 QED
12608 !! result
12609 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12610 <ul>
12611 <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>
12612 </ul>
12613 </td></tr></table>
12614 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span> <span class="mw-headline" id="Proof:_2_.3C_3"> Proof: 2 &lt; 3 </span></h2>
12615 <p><small>Hanc marginis exiguitas non caperet.</small>
12616 QED
12617 </p>
12618 !! end
12619
12620 !! test
12621 Multiple tags in TOC
12622 !! input
12623 __TOC__
12624 == <i>Foo</i> <b>Bar</b> ==
12625
12626 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12627 !! result
12628 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12629 <ul>
12630 <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>
12631 <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>
12632 </ul>
12633 </td></tr></table>
12634 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar"> <i>Foo</i> <b>Bar</b> </span></h2>
12635 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> <i>Foo</i> <blockquote>Bar</blockquote> </span></h2>
12636
12637 !! end
12638
12639 !! test
12640 Tags with parameters in TOC
12641 !! input
12642 __TOC__
12643 == <sup class="in-h2">Hello</sup> ==
12644
12645 == <sup class="a > b">Evilbye</sup> ==
12646 !! result
12647 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12648 <ul>
12649 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12650 <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>
12651 </ul>
12652 </td></tr></table>
12653 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span> <span class="mw-headline" id="Hello"> <sup class="in-h2">Hello</sup> </span></h2>
12654 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span> <span class="mw-headline" id="b.22.3EEvilbye"> <sup> b"&gt;Evilbye</sup> </span></h2>
12655
12656 !! end
12657
12658 !! test
12659 span tags with directionality in TOC
12660 !! input
12661 __TOC__
12662 == <span dir="ltr">C++</span> ==
12663
12664 == <span dir="rtl">זבנג!</span> ==
12665
12666 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12667
12668 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12669
12670 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12671 !! result
12672 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12673 <ul>
12674 <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>
12675 <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>
12676 <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>
12677 <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>
12678 <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>
12679 </ul>
12680 </td></tr></table>
12681 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span> <span class="mw-headline" id="C.2B.2B"> <span dir="ltr">C++</span> </span></h2>
12682 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span> <span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"> <span dir="rtl">זבנג!</span> </span></h2>
12683 <h2><span class="editsection">[<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> <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></h2>
12684 <h2><span class="editsection">[<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> <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></h2>
12685 <h2><span class="editsection">[<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> <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></h2>
12686
12687 !! end
12688
12689 !! article
12690 MediaWiki:Bug32057
12691 !! text
12692 == {{int:headline_sample}} ==
12693 !! endarticle
12694
12695 !! test
12696 Bug 32057: Title needed when expanding <h> nodes.
12697 !! options
12698 title=[[Main Page]]
12699 !! input
12700 {{int:Bug32057}}
12701 !! result
12702 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span> <span class="mw-headline" id="Headline_text"> Headline text </span></h2>
12703
12704 !! end
12705
12706 !! test
12707 Strip marker in urlencode
12708 !! input
12709 {{urlencode:x<nowiki/>y}}
12710 {{urlencode:x<nowiki/>y|wiki}}
12711 {{urlencode:x<nowiki/>y|path}}
12712 !! result
12713 <p>xy
12714 xy
12715 xy
12716 </p>
12717 !! end
12718
12719 !! test
12720 Strip marker in lc
12721 !! input
12722 {{lc:x<nowiki/>y}}
12723 !! result
12724 <p>xy
12725 </p>
12726 !! end
12727
12728 !! test
12729 Strip marker in uc
12730 !! input
12731 {{uc:x<nowiki/>y}}
12732 !! result
12733 <p>XY
12734 </p>
12735 !! end
12736
12737 !! test
12738 Strip marker in formatNum
12739 !! input
12740 {{formatnum:1<nowiki/>2}}
12741 {{formatnum:1<nowiki/>2|R}}
12742 !! result
12743 <p>12
12744 12
12745 </p>
12746 !! end
12747
12748 !! test
12749 Check noCommafy in formatNum
12750 !! options
12751 language=be-tarask
12752 !! input
12753 {{formatnum:123456.78}}
12754 {{formatnum:123456.78|NOSEP}}
12755 !! result
12756 <p>123 456,78
12757 123456.78
12758 </p>
12759 !! end
12760
12761 !! test
12762 Strip marker in grammar
12763 !! options
12764 language=fi
12765 !! input
12766 {{grammar:elative|foo<nowiki/>bar}}
12767 !! result
12768 <p>foobarista
12769 </p>
12770 !! end
12771
12772 !! test
12773 Strip marker in padleft
12774 !! input
12775 {{padleft:|2|x<nowiki/>y}}
12776 !! result
12777 <p>xy
12778 </p>
12779 !! end
12780
12781 !! test
12782 Strip marker in padright
12783 !! input
12784 {{padright:|2|x<nowiki/>y}}
12785 !! result
12786 <p>xy
12787 </p>
12788 !! end
12789
12790 !! test
12791 Strip marker in anchorencode
12792 !! input
12793 {{anchorencode:x<nowiki/>y}}
12794 !! result
12795 <p>xy
12796 </p>
12797 !! end
12798
12799 !! test
12800 nowiki inside link inside heading (bug 18295)
12801 !! input
12802 ==[[foo|x<nowiki>y</nowiki>z]]==
12803 !! result
12804 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span> <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></h2>
12805
12806 !! end
12807
12808 !! test
12809 new support for bdi element (bug 31817)
12810 !! input
12811 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12812 !! result
12813 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12814
12815 !!end
12816
12817 !! test
12818 Ignore pipe between table row attributes
12819 !! input
12820 {|
12821 | quux
12822 |- id=foo | style='color: red'
12823 | bar
12824 |}
12825 !! result
12826 <table>
12827 <tr>
12828 <td> quux
12829 </td></tr>
12830 <tr id="foo" style="color: red">
12831 <td> bar
12832 </td></tr></table>
12833
12834 !! end
12835
12836 !!test
12837 Gallery override link with WikiLink (bug 34852)
12838 !! input
12839 <gallery>
12840 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12841 </gallery>
12842 !! result
12843 <ul class="gallery">
12844 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12845 <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>
12846 <div class="gallerytext">
12847 <p>caption
12848 </p>
12849 </div>
12850 </div></li>
12851 </ul>
12852
12853 !! end
12854
12855 !!test
12856 Gallery override link with absolute external link (bug 34852)
12857 !! input
12858 <gallery>
12859 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12860 </gallery>
12861 !! result
12862 <ul class="gallery">
12863 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12864 <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>
12865 <div class="gallerytext">
12866 <p>caption
12867 </p>
12868 </div>
12869 </div></li>
12870 </ul>
12871
12872 !! end
12873
12874 !!test
12875 Gallery override link with malicious javascript (bug 34852)
12876 !! input
12877 <gallery>
12878 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12879 </gallery>
12880 !! result
12881 <ul class="gallery">
12882 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12883 <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>
12884 <div class="gallerytext">
12885 <p>caption
12886 </p>
12887 </div>
12888 </div></li>
12889 </ul>
12890
12891 !! end
12892
12893 !!test
12894 Gallery with invalid title as link (bug 43964)
12895 !! input
12896 <gallery>
12897 File:foobar.jpg|link=<
12898 </gallery>
12899 !! result
12900 <ul class="gallery">
12901 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12902 <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>
12903 <div class="gallerytext">
12904 </div>
12905 </div></li>
12906 </ul>
12907
12908 !! end
12909
12910 !!test
12911 Language parser function
12912 !! input
12913 {{#language:ar}}
12914 !! result
12915 <p>العربية
12916 </p>
12917 !! end
12918
12919 !!test
12920 Padleft and padright as substr
12921 !! input
12922 {{padleft:|3|abcde}}
12923 {{padright:|3|abcde}}
12924 !! result
12925 <p>abc
12926 abc
12927 </p>
12928 !! end
12929
12930 !!test
12931 Bug 34939 - Case insensitive link parsing ([HttP://])
12932 !! input
12933 [HttP://MediaWiki.Org/]
12934 !! result
12935 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12936 </p>
12937 !! end
12938
12939 !!test
12940 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12941 !! input
12942 [HttP://MediaWiki.Org/ MediaWiki]
12943 !! result
12944 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12945 </p>
12946 !! end
12947
12948 !!test
12949 Bug 34939 - Case insensitive link parsing (HttP://)
12950 !! input
12951 HttP://MediaWiki.Org/
12952 !! result
12953 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12954 </p>
12955 !! end
12956
12957 ###
12958 ### Parsoids-specific tests
12959 ### Parsoid-PHP parser incompatibilities
12960 ###
12961 !!test
12962 1. SOL-sensitive wikitext tokens as template-args
12963 !!options
12964 disabled
12965 !!input
12966 {{echo|*a}}
12967 {{echo|#a}}
12968 {{echo|:a}}
12969 !!result
12970 <p>*a
12971 #a
12972 :a
12973 </p>
12974 !!end
12975
12976 #### The following section of tests are primarily to test
12977 #### wikitext escaping capabilities of Parsoid.
12978 #### A lot of the tests are disabled for the PHP parser either
12979 #### because of minor newline diffs or other reasons.
12980 #### As Parsoid serializer can handle newlines and other HTML
12981 #### more robustly, some of these tests might get reenabled
12982 #### for the PHP parser.
12983
12984 #### --------------- Headings ---------------
12985 #### 0. Unnested
12986 #### 1. Nested inside html <h1>=foo=</h1>
12987 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12988 #### 3. Nested inside html with wikitext split by html tags
12989 #### 4. No escape needed
12990 #### 5. Empty headings <h1></h1>
12991 #### 6. Heading chars in SOL context
12992 #### ----------------------------------------
12993 !! test
12994 Headings: 0. Unnested
12995 !! input
12996 <nowiki>=foo=</nowiki>
12997
12998 <nowiki>=foo</nowiki>''a''=
12999 !! result
13000 <p>=foo=
13001 </p><p>=foo<i>a</i>=
13002 </p>
13003 !!end
13004
13005 !! test
13006 Headings: 1. Nested inside html
13007 !! options
13008 disabled
13009 !! input
13010 =<nowiki>=foo=</nowiki>=
13011 ==<nowiki>=foo=</nowiki>==
13012 ===<nowiki>=foo=</nowiki>===
13013 ====<nowiki>=foo=</nowiki>====
13014 =====<nowiki>=foo=</nowiki>=====
13015 ======<nowiki>=foo=</nowiki>======
13016 !! result
13017 <h1>=foo=</h1>
13018 <h2>=foo=</h2>
13019 <h3>=foo=</h3>
13020 <h4>=foo=</h4>
13021 <h5>=foo=</h5>
13022 <h6>=foo=</h6>
13023 !!end
13024
13025 !! test
13026 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13027 !! options
13028 disabled
13029 !! input
13030 =foo=
13031 <nowiki>*bar</nowiki>
13032 =foo=
13033 =bar
13034 =foo=
13035 <nowiki>=bar=</nowiki>
13036 !! result
13037 <h1>foo</h1>*bar
13038 <h1>foo</h1>=bar
13039 <h1>foo</h1>=bar=
13040 !!end
13041
13042 !! test
13043 Headings: 3. Nested inside html with wikitext split by html tags
13044 !! options
13045 disabled
13046 !! input
13047 =<nowiki>=</nowiki>'''bold'''foo==
13048 !! result
13049 <h1>=<b>bold</b>foo=</h1>
13050 !!end
13051
13052 !! test
13053 Headings: 4. No escaping needed (testing just h1 and h2)
13054 !! options
13055 disabled
13056 !! input
13057 ==foo=
13058 =foo==
13059 ===foo==
13060 ==foo===
13061 =''=''foo==
13062 ===
13063 !! result
13064 <h1>=foo</h1>
13065 <h1>foo=</h1>
13066 <h2>=foo</h2>
13067 <h2>foo=</h2>
13068 <h1><i>=</i>foo=</h1>
13069 <h1>=</h1>
13070 !!end
13071
13072 !! test
13073 Headings: 5. Empty headings
13074 !! options
13075 disabled
13076 !! input
13077 =<nowiki></nowiki>=
13078 ==<nowiki></nowiki>==
13079 ===<nowiki></nowiki>===
13080 ====<nowiki></nowiki>====
13081 =====<nowiki></nowiki>=====
13082 ======<nowiki></nowiki>======
13083 !! result
13084 <h1></h1>
13085 <h2></h2>
13086 <h3></h3>
13087 <h4></h4>
13088 <h5></h5>
13089 <h6></h6>
13090 !!end
13091
13092 !! test
13093 Headings: 6. Heading chars in SOL context
13094 !! options
13095 disabled
13096 !! input
13097 <!--cmt--><nowiki>=h1=</nowiki>
13098 !! result
13099 <p><!--cmt-->=h1=
13100 </p>
13101 !!end
13102
13103 #### --------------- Lists ---------------
13104 #### 0. Outside nests (*foo, etc.)
13105 #### 1. Nested inside html <ul><li>*foo</li></ul>
13106 #### 2. Inside definition lists
13107 #### 3. Only bullets at start should be escaped
13108 #### 4. No escapes needed
13109 #### 5. No unnecessary escapes
13110 #### 6. Escape bullets in SOL position
13111 #### 7. Escape bullets in a multi-line context
13112 #### ----------------------------------------
13113
13114 !! test
13115 Lists: 0. Outside nests
13116 !! input
13117 <nowiki>*foo</nowiki>
13118
13119 <nowiki>#foo</nowiki>
13120 !! result
13121 <p>*foo
13122 </p><p>#foo
13123 </p>
13124 !!end
13125
13126 !! test
13127 Lists: 1. Nested inside html
13128 !! input
13129 *<nowiki>*foo</nowiki>
13130
13131 *<nowiki>#foo</nowiki>
13132
13133 *<nowiki>:foo</nowiki>
13134
13135 *<nowiki>;foo</nowiki>
13136
13137 #<nowiki>*foo</nowiki>
13138
13139 #<nowiki>#foo</nowiki>
13140
13141 #<nowiki>:foo</nowiki>
13142
13143 #<nowiki>;foo</nowiki>
13144 !! result
13145 <ul><li>*foo
13146 </li></ul>
13147 <ul><li>#foo
13148 </li></ul>
13149 <ul><li>:foo
13150 </li></ul>
13151 <ul><li>;foo
13152 </li></ul>
13153 <ol><li>*foo
13154 </li></ol>
13155 <ol><li>#foo
13156 </li></ol>
13157 <ol><li>:foo
13158 </li></ol>
13159 <ol><li>;foo
13160 </li></ol>
13161
13162 !!end
13163
13164 !! test
13165 Lists: 2. Inside definition lists
13166 !! input
13167 ;<nowiki>;foo</nowiki>
13168
13169 ;<nowiki>:foo</nowiki>
13170
13171 ;<nowiki>:foo</nowiki>
13172 :bar
13173
13174 :<nowiki>:foo</nowiki>
13175 !! result
13176 <dl><dt>;foo
13177 </dt></dl>
13178 <dl><dt>:foo
13179 </dt></dl>
13180 <dl><dt>:foo
13181 </dt><dd>bar
13182 </dd></dl>
13183 <dl><dd>:foo
13184 </dd></dl>
13185
13186 !!end
13187
13188 !! test
13189 Lists: 3. Only bullets at start of text should be escaped
13190 !! input
13191 *<nowiki>*foo*bar</nowiki>
13192
13193 *<nowiki>*foo</nowiki>''it''*bar
13194 !! result
13195 <ul><li>*foo*bar
13196 </li></ul>
13197 <ul><li>*foo<i>it</i>*bar
13198 </li></ul>
13199
13200 !!end
13201
13202 !! test
13203 Lists: 4. No escapes needed
13204 !! options
13205 disabled
13206 !! input
13207 *foo*bar
13208
13209 *''foo''*bar
13210
13211 *[[Foo]]: bar
13212 !! result
13213 <ul><li>foo*bar
13214 </li></ul>
13215 <ul><li><i>foo</i>*bar
13216 </li></ul>
13217 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13218 </li></ul>
13219 !!end
13220
13221 !! test
13222 Lists: 5. No unnecessary escapes
13223 !! input
13224 * bar <span><nowiki>[[foo]]</nowiki></span>
13225
13226 *=bar <span><nowiki>[[foo]]</nowiki></span>
13227
13228 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13229
13230 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13231
13232 *=bar <span>foo]]</span>=
13233 !! result
13234 <ul><li> bar <span>[[foo]]</span>
13235 </li></ul>
13236 <ul><li>=bar <span>[[foo]]</span>
13237 </li></ul>
13238 <ul><li>[[bar <span>[[foo]]</span>
13239 </li></ul>
13240 <ul><li>]]bar <span>[[foo]]</span>
13241 </li></ul>
13242 <ul><li>=bar <span>foo]]</span>=
13243 </li></ul>
13244
13245 !!end
13246
13247 !! test
13248 Lists: 6. Escape bullets in SOL position
13249 !! options
13250 disabled
13251 !! input
13252 <!--cmt--><nowiki>*foo</nowiki>
13253 !! result
13254 <p><!--cmt-->*foo
13255 </p>
13256 !!end
13257
13258 !! test
13259 Lists: 7. Escape bullets in a multi-line context
13260 !! input
13261 <nowiki>a
13262 *b</nowiki>
13263 !! result
13264 <p>a
13265 *b
13266 </p>
13267 !!end
13268
13269 #### --------------- HRs ---------------
13270 #### 1. Single line
13271 #### -----------------------------------
13272
13273 !! test
13274 HRs: 1. Single line
13275 !! options
13276 disabled
13277 !! input
13278 ----
13279 <nowiki>----</nowiki>
13280 ----
13281 <nowiki>=foo=</nowiki>
13282 ----
13283 <nowiki>*foo</nowiki>
13284 !! result
13285 <hr/>----
13286 <hr/>=foo=
13287 <hr/>*foo
13288 !! end
13289
13290 #### --------------- Tables ---------------
13291 #### 1a. Simple example
13292 #### 1b. No escaping needed (!foo)
13293 #### 1c. No escaping needed (|foo)
13294 #### 1d. No escaping needed (|}foo)
13295 ####
13296 #### 2a. Nested in td (<td>foo|bar</td>)
13297 #### 2b. Nested in td (<td>foo||bar</td>)
13298 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13299 ####
13300 #### 3a. Nested in th (<th>foo!bar</th>)
13301 #### 3b. Nested in th (<th>foo!!bar</th>)
13302 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13303 ####
13304 #### 4a. Escape -
13305 #### 4b. Escape +
13306 #### 4c. No escaping needed
13307 #### --------------------------------------
13308
13309 !! test
13310 Tables: 1a. Simple example
13311 !! input
13312 <nowiki>{|
13313 |}</nowiki>
13314 !! result
13315 <p>{|
13316 |}
13317 </p>
13318 !! end
13319
13320 !! test
13321 Tables: 1b. No escaping needed
13322 !! input
13323 !foo
13324 !! result
13325 <p>!foo
13326 </p>
13327 !! end
13328
13329 !! test
13330 Tables: 1c. No escaping needed
13331 !! input
13332 |foo
13333 !! result
13334 <p>|foo
13335 </p>
13336 !! end
13337
13338 !! test
13339 Tables: 1d. No escaping needed
13340 !! input
13341 |}foo
13342 !! result
13343 <p>|}foo
13344 </p>
13345 !! end
13346
13347 !! test
13348 Tables: 2a. Nested in td
13349 !! options
13350 disabled
13351 !! input
13352 {|
13353 |<nowiki>foo|bar</nowiki>
13354 |}
13355 !! result
13356 <table>
13357 <tr><td>foo|bar
13358 </td></tr></table>
13359
13360 !! end
13361
13362 !! test
13363 Tables: 2b. Nested in td
13364 !! options
13365 disabled
13366 !! input
13367 {|
13368 |<nowiki>foo||bar</nowiki>
13369 |''it''<nowiki>foo||bar</nowiki>
13370 |}
13371 !! result
13372 <table>
13373 <tr><td>foo||bar
13374 </td><td><i>it</i>foo||bar
13375 </td></tr></table>
13376
13377 !! end
13378
13379 !! test
13380 Tables: 2c. Nested in td -- no escaping needed
13381 !! options
13382 disabled
13383 !! input
13384 {|
13385 |foo!!bar
13386 |}
13387 !! result
13388 <table>
13389 <tr><td>foo!!bar
13390 </td></tr></table>
13391
13392 !! end
13393
13394 !! test
13395 Tables: 3a. Nested in th
13396 !! options
13397 disabled
13398 !! input
13399 {|
13400 !foo!bar
13401 |}
13402 !! result
13403 <table>
13404 <tr><th>foo!bar
13405 </th></tr></table>
13406
13407 !! end
13408
13409 !! test
13410 Tables: 3b. Nested in th
13411 !! options
13412 disabled
13413 !! input
13414 {|
13415 !<nowiki>foo!!bar</nowiki>
13416 |}
13417 !! result
13418 <table>
13419 <tr><th>foo!!bar
13420 </th></tr></table>
13421
13422 !! end
13423
13424 !! test
13425 Tables: 3c. Nested in th -- no escaping needed
13426 !! options
13427 disabled
13428 !! input
13429 {|
13430 !foo||bar
13431 |}
13432 !! result
13433 <table>
13434 <tr><th>foo||bar
13435 </th></tr></table>
13436
13437 !! end
13438
13439 !! test
13440 Tables: 4a. Escape -
13441 !! options
13442 disabled
13443 !! input
13444 {|
13445 |-
13446 !-bar
13447 |-
13448 |<nowiki>-bar</nowiki>
13449 |}
13450 !! result
13451 <table><tbody>
13452 <tr><th>-bar</th></tr>
13453 <tr><td>-bar</td></tr>
13454 </tbody></table>
13455 !! end
13456
13457 !! test
13458 Tables: 4b. Escape +
13459 !! options
13460 disabled
13461 !! input
13462 {|
13463 |-
13464 !+bar
13465 |-
13466 |<nowiki>+bar</nowiki>
13467 |}
13468 !! result
13469 <table><tbody>
13470 <tr><th>+bar</th></tr>
13471 <tr><td>+bar</td></tr>
13472 </tbody></table>
13473 !! end
13474
13475 !! test
13476 Tables: 4c. No escaping needed
13477 !! options
13478 disabled
13479 !! input
13480 {|
13481 |-
13482 |foo-bar
13483 |foo+bar
13484 |-
13485 |''foo''-bar
13486 |''foo''+bar
13487 |}
13488 !! result
13489 <table><tbody>
13490 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13491 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13492 </tbody></table>
13493 !! end
13494
13495 !! test
13496 Tables: 4d. No escaping needed
13497 !! input
13498 {|
13499 ||+1
13500 ||-2
13501 |}
13502 !! result
13503 <table>
13504 <tr>
13505 <td>+1
13506 </td>
13507 <td>-2
13508 </td></tr></table>
13509
13510 !! end
13511
13512 #### --------------- Links ---------------
13513 #### 1. Quote marks in link text
13514 #### 2. Wikilinks: Escapes needed
13515 #### 3. Wikilinks: No escapes needed
13516 #### 4. Extlinks: Escapes needed
13517 #### 5. Extlinks: No escapes needed
13518 #### --------------------------------------
13519 !! test
13520 Links 1. Quote marks in link text
13521 !! options
13522 disabled
13523 !! input
13524 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13525 !! result
13526 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13527 !! end
13528
13529 !! test
13530 Links 2. WikiLinks: Escapes needed
13531 !! options
13532 disabled
13533 !! input
13534 [[Foo|<nowiki>[Foobar]</nowiki>]]
13535 [[Foo|<nowiki>Foobar]</nowiki>]]
13536 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13537 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13538 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13539 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13540 [[Foo|<nowiki>|Bar</nowiki>]]
13541 !! result
13542 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13543 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13544 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13545 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13546 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13547 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13548 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13549 !! end
13550
13551 !! test
13552 Links 3. WikiLinks: No escapes needed
13553 !! options
13554 disabled
13555 !! input
13556 [[Foo|[Foobar]]
13557 [[Foo|foo|bar]]
13558 !! result
13559 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13560 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13561 !! end
13562
13563 !! test
13564 Links 4. ExtLinks: Escapes needed
13565 !! options
13566 disabled
13567 !! input
13568 [http://google.com <nowiki>[google]</nowiki>]
13569 [http://google.com <nowiki>google]</nowiki>]
13570 !! result
13571 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13572 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13573 !! end
13574
13575 !! test
13576 Links 5. ExtLinks: No escapes needed
13577 !! options
13578 disabled
13579 !! input
13580 [http://google.com [google]
13581 !! result
13582 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13583 !! end
13584
13585 #### --------------- Quotes ---------------
13586 #### 1. Quotes inside <b> and <i>
13587 #### 2. Link fragments separated by <i> and <b> tags
13588 #### 3. Link fragments inside <i> and <b>
13589 #### --------------------------------------
13590 !! test
13591 1. Quotes inside <b> and <i>
13592 !! input
13593 ''<nowiki>'foo'</nowiki>''
13594 ''<nowiki>''foo''</nowiki>''
13595 ''<nowiki>'''foo'''</nowiki>''
13596 '''<nowiki>'foo'</nowiki>'''
13597 '''<nowiki>''foo''</nowiki>'''
13598 '''<nowiki>'''foo'''</nowiki>'''
13599 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13600 !! result
13601 <p><i>'foo'</i>
13602 <i>''foo''</i>
13603 <i>'''foo'''</i>
13604 <b>'foo'</b>
13605 <b>''foo''</b>
13606 <b>'''foo'''</b>
13607 <b>foo'<i>bar'</i>baz</b>
13608 </p>
13609 !! end
13610
13611 !! test
13612 2. Link fragments separated by <i> and <b> tags
13613 !! input
13614 [[''foo''<nowiki>hello]]</nowiki>
13615
13616 [['''foo'''<nowiki>hello]]</nowiki>
13617 !! result
13618 <p>[[<i>foo</i>hello]]
13619 </p><p>[[<b>foo</b>hello]]
13620 </p>
13621 !! end
13622
13623 !! test
13624 2. Link fragments inside <i> and <b>
13625 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13626 this is one of the shortcomings of this format)
13627 !! input
13628 ''[[foo''<nowiki>]]</nowiki>
13629
13630 '''[[foo'''<nowiki>]]</nowiki>
13631 !! result
13632 <p><i>[[foo</i>]]
13633 </p><p><b>[[foo</b>]]
13634 </p>
13635 !! end
13636
13637 #### --------------- Paragraphs ---------------
13638 #### 1. No unnecessary escapes
13639 #### --------------------------------------
13640
13641 !! test
13642 1. No unnecessary escapes
13643 !! input
13644 bar <span><nowiki>[[foo]]</nowiki></span>
13645
13646 =bar <span><nowiki>[[foo]]</nowiki></span>
13647
13648 [[bar <span><nowiki>[[foo]]</nowiki></span>
13649
13650 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13651
13652 <nowiki>=bar </nowiki><span>foo]]</span>=
13653 !! result
13654 <p>bar <span>[[foo]]</span>
13655 </p><p>=bar <span>[[foo]]</span>
13656 </p><p>[[bar <span>[[foo]]</span>
13657 </p><p>]]bar <span>[[foo]]</span>
13658 </p><p>=bar <span>foo]]</span>=
13659 </p>
13660 !!end
13661
13662 #### --------------- PRE ------------------
13663 #### 1. Leading space in SOL context should be escaped
13664 #### --------------------------------------
13665 !! test
13666 1. Leading space in SOL context should be escaped
13667 !! options
13668 disabled
13669 !! input
13670 <nowiki> foo</nowiki>
13671 <!--cmt--><nowiki> foo</nowiki>
13672 !! result
13673 <p> foo
13674 <!--cmt--> foo
13675 </p>
13676 !! end
13677
13678 #### --------------- HTML tags ---------------
13679 #### 1. a tags
13680 #### 2. other tags
13681 #### 3. multi-line html tag
13682 #### --------------------------------------
13683 !! test
13684 1. a tags
13685 !! options
13686 disabled
13687 !! input
13688 <a href="http://google.com">google</a>
13689 !! result
13690 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13691 !! end
13692
13693 !! test
13694 2. other tags
13695 !! input
13696 <nowiki><div>foo</div>
13697 <div style="color:red">foo</div></nowiki>
13698 !! result
13699 <p>&lt;div&gt;foo&lt;/div&gt;
13700 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13701 </p>
13702 !! end
13703
13704 !! test
13705 3. multi-line html tag
13706 !! input
13707 <nowiki><div
13708 >foo</div
13709 ></nowiki>
13710 !! result
13711 <p>&lt;div
13712 &gt;foo&lt;/div
13713 &gt;
13714 </p>
13715 !! end
13716
13717 #### --------------- Others ---------------
13718 !! test
13719 Escaping nowikis
13720 !! input
13721 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13722 !! result
13723 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13724 </p>
13725 !! end
13726
13727 !! test
13728 Tag-like HTML structures are passed through as text
13729 !! input
13730 <x y>
13731
13732 <x.y>
13733
13734 <x-y>
13735
13736 1>2
13737
13738 x<y
13739
13740 a>b
13741
13742 1<d e>f
13743 !! result
13744 <p>&lt;x y&gt;
13745 </p><p>&lt;x.y&gt;
13746 </p><p>&lt;x-y&gt;
13747 </p><p>1&gt;2
13748 </p><p>x&lt;y
13749 </p><p>a&gt;b
13750 </p><p>1&lt;d e&gt;f
13751 </p>
13752 !! end
13753
13754
13755 # This fails in the PHP parser (see bug 40670,
13756 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13757 !! test
13758 Tag names followed by punctuation should not be recognized as tags
13759 !! options
13760 disabled
13761 !! input
13762 <s.ome> text
13763 !! result
13764 <p>&lt;s.ome&gt text
13765 </p>
13766 !! end
13767
13768 !! test
13769 HTML tag with necessary entities in attributes
13770 !! input
13771 <span title="&amp;amp;">foo</span>
13772 !! result
13773 <p><span title="&amp;amp;">foo</span>
13774 </p>
13775 !! end
13776
13777 !! test
13778 HTML tag with 'unnecessary' entity encoding in attributes
13779 !! input
13780 <span title="&amp;">foo</span>
13781 !! result
13782 <p><span title="&amp;">foo</span>
13783 </p>
13784 !! end
13785
13786 !! test
13787 HTML tag with broken attribute value quoting
13788 !! input
13789 <span title="Hello world>Foo</span>
13790 !! result
13791 <p><span>Foo</span>
13792 </p>
13793 !! end
13794
13795 !! test
13796 Parsoid-only: HTML tag with broken attribute value quoting
13797 !! options
13798 parsoid
13799 !! input
13800 <span title="Hello world>Foo</span>
13801 !! result
13802 <p><span title="Hello world">Foo</span>
13803 </p>
13804 !! end
13805
13806 !! test
13807 Table with broken attribute value quoting
13808 !! input
13809 {|
13810 | title="Hello world|Foo
13811 |}
13812 !! result
13813 <table>
13814 <tr>
13815 <td>Foo
13816 </td></tr></table>
13817
13818 !! end
13819
13820 !! test
13821 Table with broken attribute value quoting on consecutive lines
13822 !! input
13823 {|
13824 | title="Hello world|Foo
13825 | style="color:red|Bar
13826 |}
13827 !! result
13828 <table>
13829 <tr>
13830 <td>Foo
13831 </td>
13832 <td>Bar
13833 </td></tr></table>
13834
13835 !! end
13836
13837 !! test
13838 Parsoid-only: Table with broken attribute value quoting on consecutive lines
13839 !! options
13840 parsoid
13841 !! input
13842 {|
13843 | title="Hello world|Foo
13844 | style="color:red|Bar
13845 |}
13846 !! result
13847 <table>
13848 <tr>
13849 <td title="Hello world">Foo
13850 </td><td style="color: red">Bar
13851 </td></tr></table>
13852
13853 !! end
13854
13855 !!test
13856 Accept empty td cell attribute
13857 !!input
13858 {|
13859 | align="center" | foo || |
13860 |}
13861 !!result
13862 <table>
13863 <tr>
13864 <td align="center"> foo </td>
13865 <td>
13866 </td></tr></table>
13867
13868 !!end
13869
13870 !!test
13871 Non-empty attributes in th-cells
13872 !!input
13873 {|
13874 ! Foo !! style="color: red" | Bar
13875 |}
13876 !!result
13877 <table>
13878 <tr>
13879 <th> Foo </th>
13880 <th style="color: red"> Bar
13881 </th></tr></table>
13882
13883 !!end
13884
13885 !!test
13886 Accept empty attributes in th-cells
13887 !!input
13888 {|
13889 !| foo !!| bar
13890 |}
13891 !!result
13892 <table>
13893 <tr>
13894 <th> foo </th>
13895 <th> bar
13896 </th></tr></table>
13897
13898 !!end
13899
13900 !!test
13901 Empty table rows go away
13902 !!input
13903 {|
13904 | Hello
13905 | there
13906 |- class="foo"
13907 |-
13908 |}
13909 !! result
13910 <table>
13911 <tr>
13912 <td> Hello
13913 </td>
13914 <td> there
13915 </td></tr>
13916
13917 </table>
13918
13919 !! end
13920
13921 TODO:
13922 more images
13923 more tables
13924 character entities
13925 and much more
13926 Try for 100% code coverage