Merge "Memcached PHP client improvements"
[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 # showtitle make the first line the title
25 # comment run through Linker::formatComment() instead of main parser
26 # local format section links in edit comment text as local links
27 #
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
31
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
38
39 !!article
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
44
45 !! article
46 Template:Blank
47 !! text
48 !! endarticle
49
50 !! article
51 Template:!
52 !! text
53 |
54 !! endarticle
55
56 !!article
57 MediaWiki:bad image list
58 !!text
59 * [[File:Bad.jpg]] except [[Nasty page]]
60 !!endarticle
61
62 !! article
63 Template:inner list
64 !! text
65 * item 1
66 !! endarticle
67
68 ###
69 ### Basic tests
70 ###
71 !! test
72 Blank input
73 !! input
74 !! result
75 !! end
76
77
78 !! test
79 Simple paragraph
80 !! input
81 This is a simple paragraph.
82 !! result
83 <p>This is a simple paragraph.
84 </p>
85 !! end
86
87 !! test
88 Paragraphs with extra newline spacing
89 !! input
90 foo
91
92 bar
93
94
95 baz
96
97
98
99 booz
100 !! result
101 <p>foo
102 </p><p>bar
103 </p><p><br />
104 baz
105 </p><p><br />
106 </p><p>booz
107 </p>
108 !! end
109
110 !! test
111 Simple list
112 !! input
113 * Item 1
114 * Item 2
115 !! result
116 <ul><li> Item 1
117 </li><li> Item 2
118 </li></ul>
119
120 !! end
121
122 !! test
123 Italics and bold
124 !! input
125 * plain
126 * plain''italic''plain
127 * plain''italic''plain''italic''plain
128 * plain'''bold'''plain
129 * plain'''bold'''plain'''bold'''plain
130 * plain''italic''plain'''bold'''plain
131 * plain'''bold'''plain''italic''plain
132 * plain''italic'''bold-italic'''italic''plain
133 * plain'''bold''bold-italic''bold'''plain
134 * plain'''''bold-italic'''italic''plain
135 * plain'''''bold-italic''bold'''plain
136 * plain''italic'''bold-italic'''''plain
137 * plain'''bold''bold-italic'''''plain
138 * plain l'''italic''plain
139 * plain l''''bold''' plain
140 !! result
141 <ul><li> plain
142 </li><li> plain<i>italic</i>plain
143 </li><li> plain<i>italic</i>plain<i>italic</i>plain
144 </li><li> plain<b>bold</b>plain
145 </li><li> plain<b>bold</b>plain<b>bold</b>plain
146 </li><li> plain<i>italic</i>plain<b>bold</b>plain
147 </li><li> plain<b>bold</b>plain<i>italic</i>plain
148 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
149 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
150 </li><li> plain<i><b>bold-italic</b>italic</i>plain
151 </li><li> plain<b><i>bold-italic</i>bold</b>plain
152 </li><li> plain<i>italic<b>bold-italic</b></i>plain
153 </li><li> plain<b>bold<i>bold-italic</i></b>plain
154 </li><li> plain l'<i>italic</i>plain
155 </li><li> plain l'<b>bold</b> plain
156 </li></ul>
157
158 !! end
159
160 ###
161 ### 2-quote opening sequence tests
162 ###
163 !! test
164 Italics and bold: 2-quote opening sequence: (2,2)
165 !! input
166 ''foo''
167 !! result
168 <p><i>foo</i>
169 </p>
170 !!end
171
172
173 !! test
174 Italics and bold: 2-quote opening sequence: (2,3)
175 !! input
176 ''foo'''
177 !! result
178 <p><i>foo'</i>
179 </p>
180 !!end
181
182
183 !! test
184 Italics and bold: 2-quote opening sequence: (2,4)
185 !! input
186 ''foo''''
187 !! result
188 <p><i>foo''</i>
189 </p>
190 !!end
191
192
193 !! test
194 Italics and bold: 2-quote opening sequence: (2,5)
195 !! input
196 ''foo'''''
197 !! result
198 <p><i>foo</i>
199 </p>
200 !!end
201
202
203 ###
204 ### 3-quote opening sequence tests
205 ###
206
207 !! test
208 Italics and bold: 3-quote opening sequence: (3,2)
209 !! input
210 '''foo''
211 !! result
212 <p>'<i>foo</i>
213 </p>
214 !!end
215
216
217 !! test
218 Italics and bold: 3-quote opening sequence: (3,3)
219 !! input
220 '''foo'''
221 !! result
222 <p><b>foo</b>
223 </p>
224 !!end
225
226
227 !! test
228 Italics and bold: 3-quote opening sequence: (3,4)
229 !! input
230 '''foo''''
231 !! result
232 <p><b>foo'</b>
233 </p>
234 !!end
235
236
237 !! test
238 Italics and bold: 3-quote opening sequence: (3,5)
239 !! input
240 '''foo'''''
241 !! result
242 <p><b>foo</b>
243 </p>
244 !!end
245
246
247 ###
248 ### 4-quote opening sequence tests
249 ###
250
251 !! test
252 Italics and bold: 4-quote opening sequence: (4,2)
253 !! input
254 ''''foo''
255 !! result
256 <p>''<i>foo</i>
257 </p>
258 !!end
259
260
261 !! test
262 Italics and bold: 4-quote opening sequence: (4,3)
263 !! input
264 ''''foo'''
265 !! result
266 <p>'<b>foo</b>
267 </p>
268 !!end
269
270
271 !! test
272 Italics and bold: 4-quote opening sequence: (4,4)
273 !! input
274 ''''foo''''
275 !! result
276 <p>'<b>foo'</b>
277 </p>
278 !!end
279
280
281 !! test
282 Italics and bold: 4-quote opening sequence: (4,5)
283 !! input
284 ''''foo'''''
285 !! result
286 <p>'<b>foo</b>
287 </p>
288 !!end
289
290
291 ###
292 ### 5-quote opening sequence tests
293 ###
294
295 !! test
296 Italics and bold: 5-quote opening sequence: (5,2)
297 !! input
298 '''''foo''
299 !! result
300 <p><b><i>foo</i></b>
301 </p>
302 !!end
303
304
305 !! test
306 Italics and bold: 5-quote opening sequence: (5,3)
307 !! input
308 '''''foo'''
309 !! result
310 <p><i><b>foo</b></i>
311 </p>
312 !!end
313
314
315 !! test
316 Italics and bold: 5-quote opening sequence: (5,4)
317 !! input
318 '''''foo''''
319 !! result
320 <p><i><b>foo'</b></i>
321 </p>
322 !!end
323
324
325 !! test
326 Italics and bold: 5-quote opening sequence: (5,5)
327 !! input
328 '''''foo'''''
329 !! result
330 <p><i><b>foo</b></i>
331 </p>
332 !!end
333
334 ###
335 ### multiple quote sequences in a line
336 ###
337 !! test
338 Italics and bold: multiple quote sequences: (2,4,2)
339 !! input
340 ''foo''''bar''
341 !! result
342 <p><i>foo'<b>bar</b></i>
343 </p>
344 !!end
345
346
347 !! test
348 Italics and bold: multiple quote sequences: (2,4,3)
349 !! input
350 ''foo''''bar'''
351 !! result
352 <p><i>foo'<b>bar</b></i>
353 </p>
354 !!end
355
356
357 !! test
358 Italics and bold: multiple quote sequences: (2,4,4)
359 !! input
360 ''foo''''bar''''
361 !! result
362 <p><i>foo'<b>bar'</b></i>
363 </p>
364 !!end
365
366
367 !! test
368 Italics and bold: multiple quote sequences: (3,4,2)
369 !! input
370 '''foo''''bar''
371 !! result
372 <p><b>foo'</b>bar
373 </p>
374 !!end
375
376
377 !! test
378 Italics and bold: multiple quote sequences: (3,4,3)
379 !! input
380 '''foo''''bar'''
381 !! result
382 <p><b>foo'</b>bar
383 </p>
384 !!end
385
386 ###
387 ### other quote tests
388 ###
389 !! test
390 Italics and bold: other quote tests: (2,3,5)
391 !! input
392 ''this is about '''foo's family'''''
393 !! result
394 <p><i>this is about <b>foo's family</b></i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: other quote tests: (2,(3,3),2)
401 !! input
402 ''this is about '''foo's''' family''
403 !! result
404 <p><i>this is about <b>foo's</b> family</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: other quote tests: (3,2,3,2)
411 !! input
412 '''this is about ''foo'''s family''
413 !! result
414 <p><b>this is about <i>foo</i></b><i>s family</i>
415 </p>
416 !!end
417
418
419 !! test
420 Italics and bold: other quote tests: (3,2,3,3)
421 !! input
422 '''this is about ''foo'''s family'''
423 !! result
424 <p>'<i>this is about </i>foo<b>s family</b>
425 </p>
426 !!end
427
428
429
430 !! test
431 Italics and bold: other quote tests: (3,(2,2),3)
432 !! input
433 '''this is about ''foo's'' family'''
434 !! result
435 <p><b>this is about <i>foo's</i> family</b>
436 </p>
437 !!end
438
439 ###
440 ### <nowiki> test cases
441 ###
442
443 !! test
444 <nowiki> unordered list
445 !! input
446 <nowiki>* This is not an unordered list item.</nowiki>
447 !! result
448 <p>* This is not an unordered list item.
449 </p>
450 !! end
451
452 !! test
453 <nowiki> spacing
454 !! input
455 <nowiki>Lorem ipsum dolor
456
457 sed abit.
458 sed nullum.
459
460 :and a colon
461 </nowiki>
462 !! result
463 <p>Lorem ipsum dolor
464
465 sed abit.
466 sed nullum.
467
468 :and a colon
469
470 </p>
471 !! end
472
473 !! test
474 nowiki 3
475 !! input
476 :There is not nowiki.
477 :There is <nowiki>nowiki</nowiki>.
478
479 #There is not nowiki.
480 #There is <nowiki>nowiki</nowiki>.
481
482 *There is not nowiki.
483 *There is <nowiki>nowiki</nowiki>.
484 !! result
485 <dl><dd>There is not nowiki.
486 </dd><dd>There is nowiki.
487 </dd></dl>
488 <ol><li>There is not nowiki.
489 </li><li>There is nowiki.
490 </li></ol>
491 <ul><li>There is not nowiki.
492 </li><li>There is nowiki.
493 </li></ul>
494
495 !! end
496
497
498 ###
499 ### Comments
500 ###
501 !! test
502 Comment test 1
503 !! input
504 <!-- comment 1 --> asdf
505 <!-- comment 2 -->
506 !! result
507 <pre>asdf
508 </pre>
509
510 !! end
511
512 !! test
513 Comment test 2
514 !! input
515 asdf
516 <!-- comment 1 -->
517 jkl
518 !! result
519 <p>asdf
520 jkl
521 </p>
522 !! end
523
524 !! test
525 Comment test 3
526 !! input
527 asdf
528 <!-- comment 1 -->
529 <!-- comment 2 -->
530 jkl
531 !! result
532 <p>asdf
533 jkl
534 </p>
535 !! end
536
537 !! test
538 Comment test 4
539 !! input
540 asdf<!-- comment 1 -->jkl
541 !! result
542 <p>asdfjkl
543 </p>
544 !! end
545
546 !! test
547 Comment spacing
548 !! input
549 a
550 <!-- foo --> b <!-- bar -->
551 c
552 !! result
553 <p>a
554 </p>
555 <pre> b
556 </pre>
557 <p>c
558 </p>
559 !! end
560
561 !! test
562 Comment whitespace
563 !! input
564 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
565 !! result
566
567 !! end
568
569 !! test
570 Comment semantics and delimiters
571 !! input
572 <!-- --><!----><!-----><!------>
573 !! result
574
575 !! end
576
577 !! test
578 Comment semantics and delimiters, redux
579 !! input
580 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
581 -- foo -- funky huh? ... -->
582 !! result
583
584 !! end
585
586 !! test
587 Comment semantics and delimiters: directors cut
588 !! input
589 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
590 everything starting with < followed by !-- until the first -- and > we see,
591 that wouldn't be valid XML however, since in XML -- has to terminate a comment
592 -->-->
593 !! result
594 <p>--&gt;
595 </p>
596 !! end
597
598 !! test
599 Comment semantics: nesting
600 !! input
601 <!--<!-- no, we're not going to do anything fancy here -->-->
602 !! result
603 <p>--&gt;
604 </p>
605 !! end
606
607 !! test
608 Comment semantics: unclosed comment at end
609 !! input
610 <!--This comment will run out to the end of the document
611 !! result
612
613 !! end
614
615 !! test
616 Comment in template title
617 !! input
618 {{f<!---->oo}}
619 !! result
620 <p>FOO
621 </p>
622 !! end
623
624 !! test
625 Comment on its own line post-expand
626 !! input
627 a
628 {{blank}}<!---->
629 b
630 !! result
631 <p>a
632 </p><p>b
633 </p>
634 !! end
635
636 ###
637 ### Preformatted text
638 ###
639 !! test
640 Preformatted text
641 !! input
642 This is some
643 Preformatted text
644 With ''italic''
645 And '''bold'''
646 And a [[Main Page|link]]
647 !! result
648 <pre>This is some
649 Preformatted text
650 With <i>italic</i>
651 And <b>bold</b>
652 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
653 </pre>
654 !! end
655
656 !! test
657 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
658 !! input
659 <pre><nowiki>
660 <b>
661 <cite>
662 <em>
663 </nowiki></pre>
664 !! result
665 <pre>
666 &lt;b&gt;
667 &lt;cite&gt;
668 &lt;em&gt;
669 </pre>
670
671 !! end
672
673 !! test
674 Regression with preformatted in <center>
675 !! input
676 <center>
677 Blah
678 </center>
679 !! result
680 <center>
681 <pre>Blah
682 </pre>
683 </center>
684
685 !! end
686
687 # Expected output in the following test is not really expected (there should be
688 # <pre> in the output) -- it's only testing for well-formedness.
689 !! test
690 Bug 6200: Preformatted in <blockquote>
691 !! input
692 <blockquote>
693 Blah
694 </blockquote>
695 !! result
696 <blockquote>
697 Blah
698 </blockquote>
699
700 !! end
701
702 !! test
703 <pre> with attributes (bug 3202)
704 !! input
705 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
706 !! result
707 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
708
709 !! end
710
711 !! test
712 <pre> with width attribute (bug 3202)
713 !! input
714 <pre width="8">Narrow screen goodies</pre>
715 !! result
716 <pre width="8">Narrow screen goodies</pre>
717
718 !! end
719
720 !! test
721 <pre> with forbidden attribute (bug 3202)
722 !! input
723 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
724 !! result
725 <pre width="8">Narrow screen goodies</pre>
726
727 !! end
728
729 !! test
730 <pre> with forbidden attribute values (bug 3202)
731 !! input
732 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
733 !! result
734 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
735
736 !! end
737
738 !! test
739 <nowiki> inside <pre> (bug 13238)
740 !! input
741 <pre>
742 <nowiki>
743 </pre>
744 <pre>
745 <nowiki></nowiki>
746 </pre>
747 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
748 !! result
749 <pre>
750 &lt;nowiki&gt;
751 </pre>
752 <pre>
753
754 </pre>
755 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
756
757 !! end
758
759 !! test
760 <nowiki> and <pre> preference (first one wins)
761 !! input
762 <pre>
763 <nowiki>
764 </pre>
765 </nowiki>
766 </pre>
767
768 <nowiki>
769 <pre>
770 <nowiki>
771 </pre>
772 </nowiki>
773 </pre>
774
775 !! result
776 <pre>
777 &lt;nowiki&gt;
778 </pre>
779 <p>&lt;/nowiki&gt;
780 &lt;/pre&gt;
781 </p><p>
782 &lt;pre&gt;
783 &lt;nowiki&gt;
784 &lt;/pre&gt;
785
786 &lt;/pre&gt;
787 </p>
788 !! end
789
790
791 ###
792 ### Definition lists
793 ###
794 !! test
795 Simple definition
796 !! input
797 ; name : Definition
798 !! result
799 <dl><dt> name&#160;</dt><dd> Definition
800 </dd></dl>
801
802 !! end
803
804 !! test
805 Definition list for indentation only
806 !! input
807 : Indented text
808 !! result
809 <dl><dd> Indented text
810 </dd></dl>
811
812 !! end
813
814 !! test
815 Definition list with no space
816 !! input
817 ;name:Definition
818 !! result
819 <dl><dt>name</dt><dd>Definition
820 </dd></dl>
821
822 !!end
823
824 !! test
825 Definition list with URL link
826 !! input
827 ; http://example.com/ : definition
828 !! result
829 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
830 </dd></dl>
831
832 !! end
833
834 !! test
835 Definition list with bracketed URL link
836 !! input
837 ;[http://www.example.com/ Example]:Something about it
838 !! result
839 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
840 </dd></dl>
841
842 !! end
843
844 !! test
845 Definition list with wikilink containing colon
846 !! input
847 ; [[Help:FAQ]]: The least-read page on Wikipedia
848 !! result
849 <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
850 </dd></dl>
851
852 !! end
853
854 # At Brion's and JeLuF's insistence... :)
855 !! test
856 Definition list with news link containing colon
857 !! input
858 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
859 !! result
860 <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!
861 </dd></dl>
862
863 !! end
864
865 !! test
866 Malformed definition list with colon
867 !! input
868 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
869 !! result
870 <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
871 </dt></dl>
872
873 !! end
874
875 !! test
876 Definition lists: colon in external link text
877 !! input
878 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
879 !! result
880 <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
881 </dd></dl>
882
883 !! end
884
885 !! test
886 Definition lists: colon in HTML attribute
887 !! input
888 ;<b style="display: inline">bold</b>
889 !! result
890 <dl><dt><b style="display: inline">bold</b>
891 </dt></dl>
892
893 !! end
894
895
896 !! test
897 Definition lists: self-closed tag
898 !! input
899 ;one<br/>two : two-line fun
900 !! result
901 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
902 </dd></dl>
903
904 !! end
905
906 !! test
907 Bug 11748: Literal closing tags
908 !! options
909 disabled
910 !! input
911 <dl>
912 <dt>test 1</dt>
913 <dd>test test test test test</dd>
914 <dt>test 2</dt>
915 <dd>test test test test test</dd>
916 </dl>
917 !! result
918 <dl>
919 <dt>test 1</dt>
920 <dd>test test test test test</dd>
921 <dt>test 2</dt>
922 <dd>test test test test test</dd>
923 </dl>
924 !! end
925
926 !! test
927 Definition and unordered list using wiki syntax nested in unordered list using html tags.
928 !! input
929 <ul><li>
930 ; term : description
931 * unordered
932 </li>
933 </ul>
934 !! result
935 <ul><li>
936 <dl><dt> term&#160;</dt><dd> description
937 </dd></dl>
938 <ul><li> unordered
939 </li></ul>
940 </li>
941 </ul>
942
943 !! end
944
945 !! test
946 Definition list with empty definition and following paragraph
947 !! input
948 ; term:
949 Paragraph text
950 !! result
951 <dl><dt> term</dt><dd>
952 </dd></dl>
953 <p>Paragraph text
954 </p>
955 !! end
956
957 !! test
958 Definition Lists: No nesting: Multiple dd's
959 !! input
960 ;x
961 :a
962 :b
963 !! result
964 <dl><dt>x
965 </dt><dd>a
966 </dd><dd>b
967 </dd></dl>
968
969 !! end
970
971 !! test
972 Definition Lists: Indentation: Regular
973 !! input
974 :i1
975 ::i2
976 :::i3
977 !! result
978 <dl><dd>i1
979 <dl><dd>i2
980 <dl><dd>i3
981 </dd></dl>
982 </dd></dl>
983 </dd></dl>
984
985 !! end
986
987 !! test
988 Definition Lists: Indentation: Missing 1st level
989 !! input
990 ::i2
991 :::i3
992 !! result
993 <dl><dd><dl><dd>i2
994 <dl><dd>i3
995 </dd></dl>
996 </dd></dl>
997 </dd></dl>
998
999 !! end
1000
1001 !! test
1002 Definition Lists: Indentation: Multi-level indent
1003 !! input
1004 :::i3
1005 !! result
1006 <dl><dd><dl><dd><dl><dd>i3
1007 </dd></dl>
1008 </dd></dl>
1009 </dd></dl>
1010
1011 !! end
1012
1013 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1014 ## as an empty dt item. It also ignores all but the last ";" when followed
1015 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1016 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1017 ## ";"s.
1018 ##
1019 ## Ex: ";;t2 ::d2" is transformed into:
1020 ##
1021 ## <dl>
1022 ## <dt>t2 </dt>
1023 ## <dd>
1024 ## <dl>
1025 ## <dt></dt>
1026 ## <dd>d2</dd>
1027 ## </dl>
1028 ## </dd>
1029 ## </dl>
1030 ##
1031 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1032 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1033 ##
1034 ## <dl>
1035 ## <dt>
1036 ## <dl>
1037 ## <dt>t2 </dt>
1038 ## <dd>:d2</dd>
1039 ## </dl>
1040 ## </dt>
1041 ## </dl>
1042 ##
1043 ## All Parsoid only definition list tests have this difference.
1044 ##
1045 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1046 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1047
1048 !! test
1049 Definition Lists: Nesting: Multi-level (Parsoid only)
1050 !! options
1051 disabled
1052 !! input
1053 ;t1 :d1
1054 ;;t2 ::d2
1055 ;;;t3 :::d3
1056 !! result
1057 <dl>
1058 <dt>t1 </dt>
1059 <dd>d1</dd>
1060 <dt>
1061 <dl>
1062 <dt>t2 </dt>
1063 <dd>:d2</dd>
1064 <dt>
1065 <dl>
1066 <dt>t3 </dt>
1067 <dd>::d3</dd>
1068 </dl>
1069 </dt>
1070 </dl>
1071 </dt>
1072 </dl>
1073
1074
1075 !! end
1076
1077
1078 !! test
1079 Definition Lists: Nesting: Test 2 (Parsoid only)
1080 !! options
1081 disabled
1082 !! input
1083 ;t1
1084 ::d2
1085 !! result
1086 <dl>
1087 <dt>t1</dt>
1088 <dd>
1089 <dl>
1090 <dd>d2</dd>
1091 </dl>
1092 </dd>
1093 </dl>
1094
1095 !! end
1096
1097
1098 !! test
1099 Definition Lists: Nesting: Test 3 (Parsoid only)
1100 !! options
1101 disabled
1102 !! input
1103 :;t1
1104 ::::d2
1105 !! result
1106 <dl>
1107 <dd>
1108 <dl>
1109 <dt>t1</dt>
1110 <dd>
1111 <dl>
1112 <dd>
1113 <dl>
1114 <dd>d2</dd>
1115 </dl>
1116 </dd>
1117 </dl>
1118 </dd>
1119 </dl>
1120 </dd>
1121 </dl>
1122
1123 !! end
1124
1125
1126 !! test
1127 Definition Lists: Nesting: Test 4
1128 !! input
1129 ::;t3
1130 :::d3
1131 !! result
1132 <dl><dd><dl><dd><dl><dt>t3
1133 </dt><dd>d3
1134 </dd></dl>
1135 </dd></dl>
1136 </dd></dl>
1137
1138 !! end
1139
1140
1141 !! test
1142 Definition Lists: Mixed Lists: Test 1
1143 !! input
1144 :;* foo
1145 ::* bar
1146 :; baz
1147 !! result
1148 <dl><dd><dl><dt><ul><li> foo
1149 </li><li> bar
1150 </li></ul>
1151 </dt></dl>
1152 <dl><dt> baz
1153 </dt></dl>
1154 </dd></dl>
1155
1156 !! end
1157
1158
1159 !! test
1160 Definition Lists: Mixed Lists: Test 2
1161 !! input
1162 *: d1
1163 *: d2
1164 !! result
1165 <ul><li><dl><dd> d1
1166 </dd><dd> d2
1167 </dd></dl>
1168 </li></ul>
1169
1170 !! end
1171
1172
1173 !! test
1174 Definition Lists: Mixed Lists: Test 3
1175 !! input
1176 *::: d1
1177 *::: d2
1178 !! result
1179 <ul><li><dl><dd><dl><dd><dl><dd> d1
1180 </dd><dd> d2
1181 </dd></dl>
1182 </dd></dl>
1183 </dd></dl>
1184 </li></ul>
1185
1186 !! end
1187
1188
1189 !! test
1190 Definition Lists: Mixed Lists: Test 4
1191 !! input
1192 *;d1 :d2
1193 *;d3 :d4
1194 !! result
1195 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1196 </dd><dt>d3&#160;</dt><dd>d4
1197 </dd></dl>
1198 </li></ul>
1199
1200 !! end
1201
1202
1203 !! test
1204 Definition Lists: Mixed Lists: Test 5
1205 !! input
1206 *:d1
1207 *:: d2
1208 !! result
1209 <ul><li><dl><dd>d1
1210 <dl><dd> d2
1211 </dd></dl>
1212 </dd></dl>
1213 </li></ul>
1214
1215 !! end
1216
1217
1218 !! test
1219 Definition Lists: Mixed Lists: Test 6
1220 !! input
1221 #*:d1
1222 #*::: d3
1223 !! result
1224 <ol><li><ul><li><dl><dd>d1
1225 <dl><dd><dl><dd> d3
1226 </dd></dl>
1227 </dd></dl>
1228 </dd></dl>
1229 </li></ul>
1230 </li></ol>
1231
1232 !! end
1233
1234
1235 !! test
1236 Definition Lists: Mixed Lists: Test 7
1237 !! input
1238 :* d1
1239 :* d2
1240 !! result
1241 <dl><dd><ul><li> d1
1242 </li><li> d2
1243 </li></ul>
1244 </dd></dl>
1245
1246 !! end
1247
1248
1249 !! test
1250 Definition Lists: Mixed Lists: Test 8
1251 !! input
1252 :* d1
1253 ::* d2
1254 !! result
1255 <dl><dd><ul><li> d1
1256 </li></ul>
1257 <dl><dd><ul><li> d2
1258 </li></ul>
1259 </dd></dl>
1260 </dd></dl>
1261
1262 !! end
1263
1264
1265 !! test
1266 Definition Lists: Mixed Lists: Test 9
1267 !! input
1268 *;foo :bar
1269 !! result
1270 <ul><li><dl><dt>foo&#160;</dt><dd>bar
1271 </dd></dl>
1272 </li></ul>
1273
1274 !! end
1275
1276
1277 !! test
1278 Definition Lists: Mixed Lists: Test 10
1279 !! input
1280 *#;foo :bar
1281 !! result
1282 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
1283 </dd></dl>
1284 </li></ol>
1285 </li></ul>
1286
1287 !! end
1288
1289
1290 !! test
1291 Definition Lists: Mixed Lists: Test 11
1292 !! input
1293 *#*#;*;;foo :bar
1294 *#*#;boo :baz
1295 !! result
1296 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
1297 </dt></dl>
1298 </dd></dl>
1299 </li></ul>
1300 </dd></dl>
1301 <dl><dt>boo&#160;</dt><dd>baz
1302 </dd></dl>
1303 </li></ol>
1304 </li></ul>
1305 </li></ol>
1306 </li></ul>
1307
1308 !! end
1309
1310
1311 !! test
1312 Definition Lists: Weird Ones: Test 1
1313 !! input
1314 *#;*::;; foo : bar (who uses this?)
1315 !! result
1316 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
1317 </dt></dl>
1318 </dd></dl>
1319 </dd></dl>
1320 </dd></dl>
1321 </li></ul>
1322 </dd></dl>
1323 </li></ol>
1324 </li></ul>
1325
1326 !! end
1327
1328 ###
1329 ### External links
1330 ###
1331 !! test
1332 External links: non-bracketed
1333 !! input
1334 Non-bracketed: http://example.com
1335 !! result
1336 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
1337 </p>
1338 !! end
1339
1340 !! test
1341 External links: numbered
1342 !! input
1343 Numbered: [http://example.com]
1344 Numbered: [http://example.net]
1345 Numbered: [http://example.com]
1346 !! result
1347 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
1348 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
1349 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
1350 </p>
1351 !!end
1352
1353 !! test
1354 External links: specified text
1355 !! input
1356 Specified text: [http://example.com link]
1357 !! result
1358 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
1359 </p>
1360 !!end
1361
1362 !! test
1363 External links: trail
1364 !! input
1365 Linktrails should not work for external links: [http://example.com link]s
1366 !! result
1367 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
1368 </p>
1369 !! end
1370
1371 !! test
1372 External links: dollar sign in URL
1373 !! input
1374 http://example.com/1$2345
1375 !! result
1376 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
1377 </p>
1378 !! end
1379
1380 !! test
1381 External links: dollar sign in URL (named)
1382 !! input
1383 [http://example.com/1$2345]
1384 !! result
1385 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
1386 </p>
1387 !!end
1388
1389 !! test
1390 External links: open square bracket forbidden in URL (bug 4377)
1391 !! input
1392 http://example.com/1[2345
1393 !! result
1394 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
1395 </p>
1396 !! end
1397
1398 !! test
1399 External links: open square bracket forbidden in URL (named) (bug 4377)
1400 !! input
1401 [http://example.com/1[2345]
1402 !! result
1403 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
1404 </p>
1405 !!end
1406
1407 !! test
1408 External links: nowiki in URL link text (bug 6230)
1409 !!input
1410 [http://example.com/ <nowiki>''example site''</nowiki>]
1411 !! result
1412 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
1413 </p>
1414 !! end
1415
1416 !! test
1417 External links: newline forbidden in text (bug 6230 regression check)
1418 !! input
1419 [http://example.com/ first
1420 second]
1421 !! result
1422 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
1423 second]
1424 </p>
1425 !!end
1426
1427 !! test
1428 External links: protocol-relative URL in brackets
1429 !! input
1430 [//example.com/ Test]
1431 !! result
1432 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
1433 </p>
1434 !! end
1435
1436 !! test
1437 External links: protocol-relative URL in brackets without text
1438 !! input
1439 [//example.com]
1440 !! result
1441 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
1442 </p>
1443 !! end
1444
1445 !! test
1446 External links: protocol-relative URL in free text is left alone
1447 !! input
1448 //example.com/Foo
1449 !! result
1450 <p>//example.com/Foo
1451 </p>
1452 !!end
1453
1454 !! test
1455 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
1456 !! input
1457 foo//example.com/Foo
1458 !! result
1459 <p>foo//example.com/Foo
1460 </p>
1461 !! end
1462
1463 !! test
1464 External image
1465 !! input
1466 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
1467 !! result
1468 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
1469 </p>
1470 !! end
1471
1472 !! test
1473 External image from https
1474 !! input
1475 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
1476 !! result
1477 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
1478 </p>
1479 !! end
1480
1481 !! test
1482 Link to non-http image, no img tag
1483 !! input
1484 Link to non-http image, no img tag: ftp://example.com/test.jpg
1485 !! result
1486 <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>
1487 </p>
1488 !! end
1489
1490 !! test
1491 External links: terminating separator
1492 !! input
1493 Terminating separator: http://example.com/thing,
1494 !! result
1495 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
1496 </p>
1497 !! end
1498
1499 !! test
1500 External links: intervening separator
1501 !! input
1502 Intervening separator: http://example.com/1,2,3
1503 !! result
1504 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
1505 </p>
1506 !! end
1507
1508 !! test
1509 External links: old bug with URL in query
1510 !! input
1511 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
1512 !! result
1513 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
1514 </p>
1515 !! end
1516
1517 !! test
1518 External links: old URL-in-URL bug, mixed protocols
1519 !! input
1520 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
1521 !! result
1522 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
1523 </p>
1524 !!end
1525
1526 !! test
1527 External links: URL in text
1528 !! input
1529 URL in text: [http://example.com http://example.com]
1530 !! result
1531 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
1532 </p>
1533 !! end
1534
1535 !! test
1536 External links: Clickable images
1537 !! input
1538 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
1539 !! result
1540 <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>
1541 </p>
1542 !!end
1543
1544 !! test
1545 External links: raw ampersand
1546 !! input
1547 Old &amp; use: http://x&y
1548 !! result
1549 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
1550 </p>
1551 !! end
1552
1553 !! test
1554 External links: encoded ampersand
1555 !! input
1556 Old &amp; use: http://x&amp;y
1557 !! result
1558 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
1559 </p>
1560 !! end
1561
1562 !! test
1563 External links: encoded equals (bug 6102)
1564 !! input
1565 http://example.com/?foo&#61;bar
1566 !! result
1567 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
1568 </p>
1569 !! end
1570
1571 !! test
1572 External links: [raw ampersand]
1573 !! input
1574 Old &amp; use: [http://x&y]
1575 !! result
1576 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
1577 </p>
1578 !! end
1579
1580 !! test
1581 External links: [encoded ampersand]
1582 !! input
1583 Old &amp; use: [http://x&amp;y]
1584 !! result
1585 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
1586 </p>
1587 !! end
1588
1589 !! test
1590 External links: [encoded equals] (bug 6102)
1591 !! input
1592 [http://example.com/?foo&#61;bar]
1593 !! result
1594 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
1595 </p>
1596 !! end
1597
1598 !! test
1599 External links: [IDN ignored character reference in hostname; strip it right off]
1600 !! input
1601 [http://e&zwnj;xample.com/]
1602 !! result
1603 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
1604 </p>
1605 !! end
1606
1607 !! test
1608 External links: IDN ignored character reference in hostname; strip it right off
1609 !! input
1610 http://e&zwnj;xample.com/
1611 !! result
1612 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
1613 </p>
1614 !! end
1615
1616 !! test
1617 External links: www.jpeg.org (bug 554)
1618 !! input
1619 http://www.jpeg.org
1620 !!result
1621 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
1622 </p>
1623 !! end
1624
1625 !! test
1626 External links: URL within URL (original bug 2)
1627 !! input
1628 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
1629 !! result
1630 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
1631 </p>
1632 !! end
1633
1634 !! test
1635 BUG 361: URL inside bracketed URL
1636 !! input
1637 [http://www.example.com/foo http://www.example.com/bar]
1638 !! result
1639 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
1640 </p>
1641 !! end
1642
1643 !! test
1644 BUG 361: URL within URL, not bracketed
1645 !! input
1646 http://www.example.com/foo?=http://www.example.com/bar
1647 !! result
1648 <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>
1649 </p>
1650 !! end
1651
1652 !! test
1653 BUG 289: ">"-token in URL-tail
1654 !! input
1655 http://www.example.com/<hello>
1656 !! result
1657 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
1658 </p>
1659 !!end
1660
1661 !! test
1662 BUG 289: literal ">"-token in URL-tail
1663 !! input
1664 http://www.example.com/<b>html</b>
1665 !! result
1666 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
1667 </p>
1668 !!end
1669
1670 !! test
1671 BUG 289: ">"-token in bracketed URL
1672 !! input
1673 [http://www.example.com/<hello> stuff]
1674 !! result
1675 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
1676 </p>
1677 !!end
1678
1679 !! test
1680 BUG 289: literal ">"-token in bracketed URL
1681 !! input
1682 [http://www.example.com/<b>html</b> stuff]
1683 !! result
1684 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
1685 </p>
1686 !!end
1687
1688 !! test
1689 BUG 289: literal double quote at end of URL
1690 !! input
1691 http://www.example.com/"hello"
1692 !! result
1693 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
1694 </p>
1695 !!end
1696
1697 !! test
1698 BUG 289: literal double quote in bracketed URL
1699 !! input
1700 [http://www.example.com/"hello" stuff]
1701 !! result
1702 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
1703 </p>
1704 !!end
1705
1706 !! test
1707 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
1708 !! input
1709 [http://www.example.com test]
1710 !! result
1711 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
1712 </p>
1713 !! end
1714
1715 !! test
1716 External links: wiki links within external link (Bug 3695)
1717 !! input
1718 [http://example.com [[wikilink]] embedded in ext link]
1719 !! result
1720 <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>
1721 </p>
1722 !! end
1723
1724 !! test
1725 BUG 787: Links with one slash after the url protocol are invalid
1726 !! input
1727 http:/example.com
1728
1729 [http:/example.com title]
1730 !! result
1731 <p>http:/example.com
1732 </p><p>[http:/example.com title]
1733 </p>
1734 !! end
1735
1736 !! test
1737 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
1738 !! input
1739 ''[http://example.com text'']
1740 [http://example.com '''text]'''
1741 ''Something [http://example.com in italic'']
1742 ''Something [http://example.com mixed''''', even bold]'''
1743 '''''Now [http://example.com both''''']
1744 !! result
1745 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
1746 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
1747 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
1748 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
1749 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
1750 </p>
1751 !! end
1752
1753
1754 !! test
1755 Bug 4781: %26 in URL
1756 !! input
1757 http://www.example.com/?title=AT%26T
1758 !! result
1759 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
1760 </p>
1761 !! end
1762
1763 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
1764 # % is actually legal in HTML5. Any change in output would need testing though.
1765 !! test
1766 Bug 4781, 5267: %25 in URL
1767 !! input
1768 http://www.example.com/?title=100%25_Bran
1769 !! result
1770 <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>
1771 </p>
1772 !! end
1773
1774 !! test
1775 Bug 4781, 5267: %28, %29 in URL
1776 !! input
1777 http://www.example.com/?title=Ben-Hur_%281959_film%29
1778 !! result
1779 <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>
1780 </p>
1781 !! end
1782
1783
1784 !! test
1785 Bug 4781: %26 in autonumber URL
1786 !! input
1787 [http://www.example.com/?title=AT%26T]
1788 !! result
1789 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
1790 </p>
1791 !! end
1792
1793 !! test
1794 Bug 4781, 5267: %26 in autonumber URL
1795 !! input
1796 [http://www.example.com/?title=100%25_Bran]
1797 !! result
1798 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
1799 </p>
1800 !! end
1801
1802 !! test
1803 Bug 4781, 5267: %28, %29 in autonumber URL
1804 !! input
1805 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
1806 !! result
1807 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
1808 </p>
1809 !! end
1810
1811
1812 !! test
1813 Bug 4781: %26 in bracketed URL
1814 !! input
1815 [http://www.example.com/?title=AT%26T link]
1816 !! result
1817 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
1818 </p>
1819 !! end
1820
1821 !! test
1822 Bug 4781, 5267: %26 in bracketed URL
1823 !! input
1824 [http://www.example.com/?title=100%25_Bran link]
1825 !! result
1826 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
1827 </p>
1828 !! end
1829
1830 !! test
1831 Bug 4781, 5267: %28, %29 in bracketed URL
1832 !! input
1833 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
1834 !! result
1835 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
1836 </p>
1837 !! end
1838
1839 !! test
1840 External link containing double-single-quotes in text '' (bug 4598 sanity check)
1841 !! input
1842 Some [http://example.com/ pretty ''italics'' and stuff]!
1843 !! result
1844 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
1845 </p>
1846 !! end
1847
1848 !! test
1849 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
1850 !! input
1851 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
1852 !! result
1853 <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>
1854 </p>
1855 !! end
1856
1857 !! test
1858 External link containing double-single-quotes with no space separating the url from text in italics
1859 !! input
1860 [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]].]
1861 !! result
1862 <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>
1863 </p>
1864 !! end
1865
1866 !! test
1867 URL-encoding in URL functions (single parameter)
1868 !! input
1869 {{localurl:Some page|amp=&}}
1870 !! result
1871 <p>/index.php?title=Some_page&amp;amp=&amp;
1872 </p>
1873 !! end
1874
1875 !! test
1876 URL-encoding in URL functions (multiple parameters)
1877 !! input
1878 {{localurl:Some page|q=?&amp=&}}
1879 !! result
1880 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
1881 </p>
1882 !! end
1883
1884 !! test
1885 Brackets in urls
1886 !! input
1887 http://example.com/index.php?foozoid%5B%5D=bar
1888
1889 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
1890 !! result
1891 <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>
1892 </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>
1893 </p>
1894 !! end
1895
1896 !! test
1897 IPv6 urls (bug 21261)
1898 !! options
1899 disabled
1900 !! input
1901 http://[2404:130:0:1000::187:2]/index.php
1902 !! result
1903 <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>
1904 </p>
1905 !! end
1906
1907 ###
1908 ### Quotes
1909 ###
1910
1911 !! test
1912 Quotes
1913 !! input
1914 Normal text. '''Bold text.''' Normal text. ''Italic text.''
1915
1916 Normal text. '''''Bold italic text.''''' Normal text.
1917 !!result
1918 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
1919 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1920 </p>
1921 !! end
1922
1923
1924 !! test
1925 Unclosed and unmatched quotes
1926 !! input
1927 '''''Bold italic text '''with bold deactivated''' in between.'''''
1928
1929 '''''Bold italic text ''with italic deactivated'' in between.'''''
1930
1931 '''Bold text..
1932
1933 ..spanning two paragraphs (should not work).'''
1934
1935 '''Bold tag left open
1936
1937 ''Italic tag left open
1938
1939 Normal text.
1940
1941 <!-- Unmatching number of opening, closing tags: -->
1942 '''This year''''s election ''should'' beat '''last year''''s.
1943
1944 ''Tom'''s car is bigger than ''Susan'''s.
1945
1946 Plain ''italic'''s plain
1947 !! result
1948 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1949 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1950 </p><p><b>Bold text..</b>
1951 </p><p>..spanning two paragraphs (should not work).
1952 </p><p><b>Bold tag left open</b>
1953 </p><p><i>Italic tag left open</i>
1954 </p><p>Normal text.
1955 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1956 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1957 </p><p>Plain <i>italic'</i>s plain
1958 </p>
1959 !! end
1960
1961 ###
1962 ### Tables
1963 ###
1964 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1965 ###
1966
1967 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1968 # is the bare minimun required by the spec, see:
1969 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1970 !! test
1971 A table with no data.
1972 !! input
1973 {||}
1974 !! result
1975 !! end
1976
1977 # A table with nothing but a caption is invalid XHTML, we might want to render
1978 # this as <p>caption</p>
1979 !! test
1980 A table with nothing but a caption
1981 !! input
1982 {|
1983 |+ caption
1984 |}
1985 !! result
1986 <table>
1987 <caption> caption
1988 </caption><tr><td></td></tr></table>
1989
1990 !! end
1991
1992 !! test
1993 Simple table
1994 !! input
1995 {|
1996 | 1 || 2
1997 |-
1998 | 3 || 4
1999 |}
2000 !! result
2001 <table>
2002 <tr>
2003 <td> 1 </td>
2004 <td> 2
2005 </td></tr>
2006 <tr>
2007 <td> 3 </td>
2008 <td> 4
2009 </td></tr></table>
2010
2011 !! end
2012
2013 !! test
2014 Multiplication table
2015 !! input
2016 {| border="1" cellpadding="2"
2017 |+Multiplication table
2018 |-
2019 ! &times; !! 1 !! 2 !! 3
2020 |-
2021 ! 1
2022 | 1 || 2 || 3
2023 |-
2024 ! 2
2025 | 2 || 4 || 6
2026 |-
2027 ! 3
2028 | 3 || 6 || 9
2029 |-
2030 ! 4
2031 | 4 || 8 || 12
2032 |-
2033 ! 5
2034 | 5 || 10 || 15
2035 |}
2036 !! result
2037 <table border="1" cellpadding="2">
2038 <caption>Multiplication table
2039 </caption>
2040 <tr>
2041 <th> &#215; </th>
2042 <th> 1 </th>
2043 <th> 2 </th>
2044 <th> 3
2045 </th></tr>
2046 <tr>
2047 <th> 1
2048 </th>
2049 <td> 1 </td>
2050 <td> 2 </td>
2051 <td> 3
2052 </td></tr>
2053 <tr>
2054 <th> 2
2055 </th>
2056 <td> 2 </td>
2057 <td> 4 </td>
2058 <td> 6
2059 </td></tr>
2060 <tr>
2061 <th> 3
2062 </th>
2063 <td> 3 </td>
2064 <td> 6 </td>
2065 <td> 9
2066 </td></tr>
2067 <tr>
2068 <th> 4
2069 </th>
2070 <td> 4 </td>
2071 <td> 8 </td>
2072 <td> 12
2073 </td></tr>
2074 <tr>
2075 <th> 5
2076 </th>
2077 <td> 5 </td>
2078 <td> 10 </td>
2079 <td> 15
2080 </td></tr></table>
2081
2082 !! end
2083
2084 !! test
2085 Table rowspan
2086 !! input
2087 {| border=1
2088 | Cell 1, row 1
2089 |rowspan=2| Cell 2, row 1 (and 2)
2090 | Cell 3, row 1
2091 |-
2092 | Cell 1, row 2
2093 | Cell 3, row 2
2094 |}
2095 !! result
2096 <table border="1">
2097 <tr>
2098 <td> Cell 1, row 1
2099 </td>
2100 <td rowspan="2"> Cell 2, row 1 (and 2)
2101 </td>
2102 <td> Cell 3, row 1
2103 </td></tr>
2104 <tr>
2105 <td> Cell 1, row 2
2106 </td>
2107 <td> Cell 3, row 2
2108 </td></tr></table>
2109
2110 !! end
2111
2112 !! test
2113 Nested table
2114 !! input
2115 {| border=1
2116 | &alpha;
2117 |
2118 {| bgcolor=#ABCDEF border=2
2119 |nested
2120 |-
2121 |table
2122 |}
2123 |the original table again
2124 |}
2125 !! result
2126 <table border="1">
2127 <tr>
2128 <td> &#945;
2129 </td>
2130 <td>
2131 <table bgcolor="#ABCDEF" border="2">
2132 <tr>
2133 <td>nested
2134 </td></tr>
2135 <tr>
2136 <td>table
2137 </td></tr></table>
2138 </td>
2139 <td>the original table again
2140 </td></tr></table>
2141
2142 !! end
2143
2144 !! test
2145 Invalid attributes in table cell (bug 1830)
2146 !! input
2147 {|
2148 |Cell:|broken
2149 |}
2150 !! result
2151 <table>
2152 <tr>
2153 <td>broken
2154 </td></tr></table>
2155
2156 !! end
2157
2158
2159 !! test
2160 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
2161 !! input
2162 {|
2163 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
2164 !! result
2165 <table>
2166 <tr>
2167 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
2168 <td>]" onmouseover="alert(document.cookie)"&gt;test
2169 </td>
2170 </tr>
2171 </table>
2172
2173 !! end
2174
2175
2176 !! test
2177 Indented table markup mixed with indented pre content (proposed in bug 6200)
2178 !! input
2179 <table>
2180 <tr>
2181 <td>
2182 Text that should be rendered preformatted
2183 </td>
2184 </tr>
2185 </table>
2186 !! result
2187 <table>
2188 <tr>
2189 <td>
2190 <pre>Text that should be rendered preformatted
2191 </pre>
2192 </td>
2193 </tr>
2194 </table>
2195
2196 !! end
2197
2198
2199 ###
2200 ### Internal links
2201 ###
2202 !! test
2203 Plain link, capitalized
2204 !! input
2205 [[Main Page]]
2206 !! result
2207 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2208 </p>
2209 !! end
2210
2211 !! test
2212 Plain link, uncapitalized
2213 !! input
2214 [[main Page]]
2215 !! result
2216 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
2217 </p>
2218 !! end
2219
2220 !! test
2221 Piped link
2222 !! input
2223 [[Main Page|The Main Page]]
2224 !! result
2225 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
2226 </p>
2227 !! end
2228
2229 !! test
2230 Broken link
2231 !! input
2232 [[Zigzagzogzagzig]]
2233 !! result
2234 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
2235 </p>
2236 !! end
2237
2238 !! test
2239 Broken link with fragment
2240 !! input
2241 [[Zigzagzogzagzig#zug]]
2242 !! result
2243 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
2244 </p>
2245 !! end
2246
2247 !! test
2248 Special page link with fragment
2249 !! input
2250 [[Special:Version#anchor]]
2251 !! result
2252 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
2253 </p>
2254 !! end
2255
2256 !! test
2257 Nonexistent special page link with fragment
2258 !! input
2259 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
2260 !! result
2261 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
2262 </p>
2263 !! end
2264
2265 !! test
2266 Link with prefix
2267 !! input
2268 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
2269 !! result
2270 <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>
2271 </p>
2272 !! end
2273
2274 !! test
2275 Link with suffix
2276 !! input
2277 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
2278 !! result
2279 <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>!!!
2280 </p>
2281 !! end
2282
2283 !! test
2284 Link with 3 brackets
2285 !! input
2286 [[[main page]]]
2287 !! result
2288 <p>[[[main page]]]
2289 </p>
2290 !! end
2291
2292 !! test
2293 Piped link with 3 brackets
2294 !! input
2295 [[[main page|the main page]]]
2296 !! result
2297 <p>[[[main page|the main page]]]
2298 </p>
2299 !! end
2300
2301 !! test
2302 Link with multiple pipes
2303 !! input
2304 [[Main Page|The|Main|Page]]
2305 !! result
2306 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
2307 </p>
2308 !! end
2309
2310 !! test
2311 Link to namespaces
2312 !! input
2313 [[Talk:Parser testing]], [[Meta:Disclaimers]]
2314 !! result
2315 <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>
2316 </p>
2317 !! end
2318
2319 !! test
2320 Piped link to namespace
2321 !! input
2322 [[Meta:Disclaimers|The disclaimers]]
2323 !! result
2324 <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>
2325 </p>
2326 !! end
2327
2328 !! test
2329 Link containing }
2330 !! input
2331 [[Usually caused by a typo (oops}]]
2332 !! result
2333 <p>[[Usually caused by a typo (oops}]]
2334 </p>
2335 !! end
2336
2337 !! test
2338 Link containing % (not as a hex sequence)
2339 !! input
2340 [[7% Solution]]
2341 !! result
2342 <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>
2343 </p>
2344 !! end
2345
2346 !! test
2347 Link containing % as a single hex sequence interpreted to char
2348 !! input
2349 [[7%25 Solution]]
2350 !! result
2351 <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>
2352 </p>
2353 !!end
2354
2355 !! test
2356 Link containing % as a double hex sequence interpreted to hex sequence
2357 !! input
2358 [[7%2525 Solution]]
2359 !! result
2360 <p>[[7%2525 Solution]]
2361 </p>
2362 !!end
2363
2364 !! test
2365 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
2366 Example for such a section: == < ==
2367 !! input
2368 [[%23%3c]][[%23%3e]]
2369 !! result
2370 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
2371 </p>
2372 !! end
2373
2374 !! test
2375 Link containing "<#" and ">#" as a hex sequences
2376 !! input
2377 [[%3c%23]][[%3e%23]]
2378 !! result
2379 <p>[[%3c%23]][[%3e%23]]
2380 </p>
2381 !! end
2382
2383 !! test
2384 Link containing double-single-quotes '' (bug 4598)
2385 !! input
2386 [[Lista d''e paise d''o munno]]
2387 !! result
2388 <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>
2389 </p>
2390 !! end
2391
2392 !! test
2393 Link containing double-single-quotes '' in text (bug 4598 sanity check)
2394 !! input
2395 Some [[Link|pretty ''italics'' and stuff]]!
2396 !! result
2397 <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>!
2398 </p>
2399 !! end
2400
2401 !! test
2402 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
2403 !! input
2404 ''Some [[Link|pretty ''italics'' and stuff]]!
2405 !! result
2406 <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>
2407 </p>
2408 !! end
2409
2410 !! test
2411 Link with double quotes in title part (literal) and alternate part (interpreted)
2412 !! input
2413 [[File:Denys Savchenko ''Pentecoste''.jpg]]
2414
2415 [[''Pentecoste'']]
2416
2417 [[''Pentecoste''|Pentecoste]]
2418
2419 [[''Pentecoste''|''Pentecoste'']]
2420 !! result
2421 <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>
2422 </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>
2423 </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>
2424 </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>
2425 </p>
2426 !! end
2427
2428 !! test
2429 Plain link to URL
2430 !! input
2431 [[http://www.example.com]]
2432 !! result
2433 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
2434 </p>
2435 !! end
2436
2437 !! test
2438 Plain link to URL with link text
2439 !! input
2440 [[http://www.example.com Link text]]
2441 !! result
2442 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
2443 </p>
2444 !! end
2445
2446 !! test
2447 Plain link to protocol-relative URL
2448 !! input
2449 [[//www.example.com]]
2450 !! result
2451 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
2452 </p>
2453 !! end
2454
2455 !! test
2456 Plain link to protocol-relative URL with link text
2457 !! input
2458 [[//www.example.com Link text]]
2459 !! result
2460 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
2461 </p>
2462 !! end
2463
2464
2465 # I'm fairly sure the expected result here is wrong.
2466 # We want these to be URL links, not pseudo-pages with URLs for titles....
2467 # However the current output is also pretty screwy.
2468 #
2469 # ----
2470 # I'm changing it to match the current output--it arguably makes more
2471 # sense in the light of the test above. Old expected result was:
2472 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
2473 #</p>
2474 # But I think this test is bordering on "garbage in, garbage out" anyway.
2475 # -- wtm
2476 !! test
2477 Piped link to URL
2478 !! input
2479 Piped link to URL: [[http://www.example.com|an example URL]]
2480 !! result
2481 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
2482 </p>
2483 !! end
2484
2485 !! test
2486 BUG 2: [[page|http://url/]] should link to page, not http://url/
2487 !! input
2488 [[Main Page|http://url/]]
2489 !! result
2490 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
2491 </p>
2492 !! end
2493
2494 !! test
2495 BUG 337: Escaped self-links should be bold
2496 !! options
2497 title=[[Bug462]]
2498 !! input
2499 [[Bu&#103;462]] [[Bug462]]
2500 !! result
2501 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
2502 </p>
2503 !! end
2504
2505 !! test
2506 Self-link to section should not be bold
2507 !! options
2508 title=[[Main Page]]
2509 !! input
2510 [[Main Page#section]]
2511 !! result
2512 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
2513 </p>
2514 !! end
2515
2516 !! article
2517 00
2518 !! text
2519 This is 00.
2520 !! endarticle
2521
2522 !!test
2523 Self-link to numeric title
2524 !!options
2525 title=[[0]]
2526 !!input
2527 [[0]]
2528 !!result
2529 <p><strong class="selflink">0</strong>
2530 </p>
2531 !!end
2532
2533 !!test
2534 Link to numeric-equivalent title
2535 !!options
2536 title=[[0]]
2537 !!input
2538 [[00]]
2539 !!result
2540 <p><a href="/wiki/00" title="00">00</a>
2541 </p>
2542 !!end
2543
2544 !! test
2545 <nowiki> inside a link
2546 !! input
2547 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
2548 !! result
2549 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
2550 </p>
2551 !! end
2552
2553 !! test
2554 Non-breaking spaces in title
2555 !! input
2556 [[&nbsp; Main &nbsp; Page &nbsp;]]
2557 !! result
2558 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
2559 </p>
2560 !!end
2561
2562 !! test
2563 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
2564 !! options
2565 language=ca
2566 !! input
2567 '''[[Main Page]]'''
2568 !! result
2569 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
2570 </p>
2571 !! end
2572
2573 !! test
2574 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
2575 !! options
2576 language=ca
2577 !! input
2578 ''[[Main Page]]''
2579 !! result
2580 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
2581 </p>
2582 !! end
2583
2584 !! test
2585 Internal link with en linktrail: no apostrophes (bug 27473)
2586 !! options
2587 language=en
2588 !! input
2589 [[Something]]'nice
2590 !! result
2591 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
2592 </p>
2593 !! end
2594
2595 !! test
2596 Internal link with ca linktrail with apostrophes (bug 27473)
2597 !! options
2598 language=ca
2599 !! input
2600 [[Something]]'nice
2601 !! result
2602 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
2603 </p>
2604 !! end
2605
2606 !! test
2607 Internal link with kaa linktrail with apostrophes (bug 27473)
2608 !! options
2609 language=kaa
2610 !! input
2611 [[Something]]'nice
2612 !! result
2613 <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>
2614 </p>
2615 !! end
2616
2617 ###
2618 ### Interwiki links (see maintenance/interwiki.sql)
2619 ###
2620
2621 !! test
2622 Inline interwiki link
2623 !! input
2624 [[MeatBall:SoftSecurity]]
2625 !! result
2626 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
2627 </p>
2628 !! end
2629
2630 !! test
2631 Inline interwiki link with empty title (bug 2372)
2632 !! input
2633 [[MeatBall:]]
2634 !! result
2635 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
2636 </p>
2637 !! end
2638
2639 !! test
2640 Interwiki link encoding conversion (bug 1636)
2641 !! input
2642 *[[Wikipedia:ro:Olteni&#0355;a]]
2643 *[[Wikipedia:ro:Olteni&#355;a]]
2644 !! result
2645 <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>
2646 </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>
2647 </li></ul>
2648
2649 !! end
2650
2651 !! test
2652 Interwiki link with fragment (bug 2130)
2653 !! input
2654 [[MeatBall:SoftSecurity#foo]]
2655 !! result
2656 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
2657 </p>
2658 !! end
2659
2660 !! test
2661 Interlanguage link
2662 !! input
2663 Blah blah blah
2664 [[zh:Chinese]]
2665 !!result
2666 <p>Blah blah blah
2667 </p>
2668 !! end
2669
2670 !! test
2671 Double interlanguage link
2672 !! input
2673 Blah blah blah
2674 [[es:Spanish]]
2675 [[zh:Chinese]]
2676 !!result
2677 <p>Blah blah blah
2678 </p>
2679 !! end
2680
2681 !! test
2682 Interlanguage link, with prefix links
2683 !! options
2684 language=ln
2685 !! input
2686 Blah blah blah
2687 [[zh:Chinese]]
2688 !!result
2689 <p>Blah blah blah
2690 </p>
2691 !! end
2692
2693 !! test
2694 Double interlanguage link, with prefix links (bug 8897)
2695 !! options
2696 language=ln
2697 !! input
2698 Blah blah blah
2699 [[es:Spanish]]
2700 [[zh:Chinese]]
2701 !!result
2702 <p>Blah blah blah
2703 </p>
2704 !! end
2705
2706
2707 ##
2708 ## XHTML tidiness
2709 ###
2710
2711 !! test
2712 <br> to <br />
2713 !! input
2714 1<br>2<br />3
2715 !! result
2716 <p>1<br />2<br />3
2717 </p>
2718 !! end
2719
2720 !! test
2721 Incorrecly removing closing slashes from correctly formed XHTML
2722 !! input
2723 <br style="clear:both;" />
2724 !! result
2725 <p><br style="clear:both;" />
2726 </p>
2727 !! end
2728
2729 !! test
2730 Failing to transform badly formed HTML into correct XHTML
2731 !! input
2732 <br style="clear: left;">
2733 <br style="clear: right;">
2734 <br style="clear: both;">
2735 !! result
2736 <p><br style="clear: left;" />
2737 <br style="clear: right;" />
2738 <br style="clear: both;" />
2739 </p>
2740 !!end
2741
2742 !! test
2743 Horizontal ruler (should it add that extra space?)
2744 !! input
2745 <hr>
2746 <hr >
2747 foo <hr
2748 > bar
2749 !! result
2750 <hr />
2751 <hr />
2752 foo <hr /> bar
2753
2754 !! end
2755
2756 !! test
2757 Horizontal ruler -- 4+ dashes render hr
2758 !! input
2759 ----
2760 !! result
2761 <hr />
2762
2763 !! end
2764
2765 !! test
2766 Horizontal ruler -- eats additional dashes on the same line
2767 !! input
2768 ---------
2769 !! result
2770 <hr />
2771
2772 !! end
2773
2774 !! test
2775 Horizontal ruler -- does not collaps dashes on consecutive lines
2776 !! input
2777 ----
2778 ----
2779 !! result
2780 <hr />
2781 <hr />
2782
2783 !! end
2784
2785 !! test
2786 Horizontal ruler -- <4 dashes render as plain text
2787 !! input
2788 ---
2789 !! result
2790 <p>---
2791 </p>
2792 !! end
2793
2794 ###
2795 ### Block-level elements
2796 ###
2797 !! test
2798 Common list
2799 !! input
2800 *Common list
2801 * item 2
2802 *item 3
2803 !! result
2804 <ul><li>Common list
2805 </li><li> item 2
2806 </li><li>item 3
2807 </li></ul>
2808
2809 !! end
2810
2811 !! test
2812 Numbered list
2813 !! input
2814 #Numbered list
2815 #item 2
2816 # item 3
2817 !! result
2818 <ol><li>Numbered list
2819 </li><li>item 2
2820 </li><li> item 3
2821 </li></ol>
2822
2823 !! end
2824
2825 !! test
2826 Mixed list
2827 !! input
2828 *Mixed list
2829 *# with numbers
2830 ** and bullets
2831 *# and numbers
2832 *bullets again
2833 **bullet level 2
2834 ***bullet level 3
2835 ***#Number on level 4
2836 **bullet level 2
2837 **#Number on level 3
2838 **#Number on level 3
2839 *#number level 2
2840 *Level 1
2841 *** Level 3
2842 #** Level 3, but ordered
2843 !! result
2844 <ul><li>Mixed list
2845 <ol><li> with numbers
2846 </li></ol>
2847 <ul><li> and bullets
2848 </li></ul>
2849 <ol><li> and numbers
2850 </li></ol>
2851 </li><li>bullets again
2852 <ul><li>bullet level 2
2853 <ul><li>bullet level 3
2854 <ol><li>Number on level 4
2855 </li></ol>
2856 </li></ul>
2857 </li><li>bullet level 2
2858 <ol><li>Number on level 3
2859 </li><li>Number on level 3
2860 </li></ol>
2861 </li></ul>
2862 <ol><li>number level 2
2863 </li></ol>
2864 </li><li>Level 1
2865 <ul><li><ul><li> Level 3
2866 </li></ul>
2867 </li></ul>
2868 </li></ul>
2869 <ol><li><ul><li><ul><li> Level 3, but ordered
2870 </li></ul>
2871 </li></ul>
2872 </li></ol>
2873
2874 !! end
2875
2876 !! test
2877 Nested lists 1
2878 !! input
2879 *foo
2880 **bar
2881 !! result
2882 <ul><li>foo
2883 <ul><li>bar
2884 </li></ul>
2885 </li></ul>
2886
2887 !! end
2888
2889 !! test
2890 Nested lists 2
2891 !! input
2892 **foo
2893 *bar
2894 !! result
2895 <ul><li><ul><li>foo
2896 </li></ul>
2897 </li><li>bar
2898 </li></ul>
2899
2900 !! end
2901
2902 !! test
2903 Nested lists 3 (first element empty)
2904 !! input
2905 *
2906 **bar
2907 !! result
2908 <ul><li>
2909 <ul><li>bar
2910 </li></ul>
2911 </li></ul>
2912
2913 !! end
2914
2915 !! test
2916 Nested lists 4 (first element empty)
2917 !! input
2918 **
2919 *bar
2920 !! result
2921 <ul><li><ul><li>
2922 </li></ul>
2923 </li><li>bar
2924 </li></ul>
2925
2926 !! end
2927
2928 !! test
2929 Nested lists 5 (both elements empty)
2930 !! input
2931 **
2932 *
2933 !! result
2934 <ul><li><ul><li>
2935 </li></ul>
2936 </li><li>
2937 </li></ul>
2938
2939 !! end
2940
2941 !! test
2942 Nested lists 6 (both elements empty)
2943 !! input
2944 *
2945 **
2946 !! result
2947 <ul><li>
2948 <ul><li>
2949 </li></ul>
2950 </li></ul>
2951
2952 !! end
2953
2954 !! test
2955 Nested lists 7 (skip initial nesting levels)
2956 !! input
2957 *** foo
2958 !! result
2959 <ul><li><ul><li><ul><li> foo
2960 </li></ul>
2961 </li></ul>
2962 </li></ul>
2963
2964 !! end
2965
2966 !! test
2967 Nested lists 8 (multiple nesting transitions)
2968 !! input
2969 * foo
2970 *** bar
2971 ** baz
2972 * boo
2973 !! result
2974 <ul><li> foo
2975 <ul><li><ul><li> bar
2976 </li></ul>
2977 </li><li> baz
2978 </li></ul>
2979 </li><li> boo
2980 </li></ul>
2981
2982 !! end
2983
2984
2985 !! test
2986 List items are not parsed correctly following a <pre> block (bug 785)
2987 !! input
2988 * <pre>foo</pre>
2989 * <pre>bar</pre>
2990 * zar
2991 !! result
2992 <ul><li> <pre>foo</pre>
2993 </li><li> <pre>bar</pre>
2994 </li><li> zar
2995 </li></ul>
2996
2997 !! end
2998
2999 !! test
3000 List items from template
3001 !! input
3002
3003 {{inner list}}
3004 * item 2
3005
3006 * item 0
3007 {{inner list}}
3008 * item 2
3009
3010 * item 0
3011 * notSOL{{inner list}}
3012 * item 2
3013 !! result
3014 <ul><li> item 1
3015 </li><li> item 2
3016 </li></ul>
3017 <ul><li> item 0
3018 </li><li> item 1
3019 </li><li> item 2
3020 </li></ul>
3021 <ul><li> item 0
3022 </li><li> notSOL
3023 </li><li> item 1
3024 </li><li> item 2
3025 </li></ul>
3026
3027 !! end
3028
3029 !! test
3030 List interrupted by empty line or heading
3031 !! input
3032 * foo
3033
3034 ** bar
3035 == A heading ==
3036 * Another list item
3037 !! result
3038 <ul><li> foo
3039 </li></ul>
3040 <ul><li><ul><li> bar
3041 </li></ul>
3042 </li></ul>
3043 <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>
3044 <ul><li> Another list item
3045 </li></ul>
3046
3047 !!end
3048
3049
3050 ###
3051 ### Magic Words
3052 ###
3053
3054 !! test
3055 Magic Word: {{CURRENTDAY}}
3056 !! input
3057 {{CURRENTDAY}}
3058 !! result
3059 <p>1
3060 </p>
3061 !! end
3062
3063 !! test
3064 Magic Word: {{CURRENTDAY2}}
3065 !! input
3066 {{CURRENTDAY2}}
3067 !! result
3068 <p>01
3069 </p>
3070 !! end
3071
3072 !! test
3073 Magic Word: {{CURRENTDAYNAME}}
3074 !! input
3075 {{CURRENTDAYNAME}}
3076 !! result
3077 <p>Thursday
3078 </p>
3079 !! end
3080
3081 !! test
3082 Magic Word: {{CURRENTDOW}}
3083 !! input
3084 {{CURRENTDOW}}
3085 !! result
3086 <p>4
3087 </p>
3088 !! end
3089
3090 !! test
3091 Magic Word: {{CURRENTMONTH}}
3092 !! input
3093 {{CURRENTMONTH}}
3094 !! result
3095 <p>01
3096 </p>
3097 !! end
3098
3099 !! test
3100 Magic Word: {{CURRENTMONTHABBREV}}
3101 !! input
3102 {{CURRENTMONTHABBREV}}
3103 !! result
3104 <p>Jan
3105 </p>
3106 !! end
3107
3108 !! test
3109 Magic Word: {{CURRENTMONTHNAME}}
3110 !! input
3111 {{CURRENTMONTHNAME}}
3112 !! result
3113 <p>January
3114 </p>
3115 !! end
3116
3117 !! test
3118 Magic Word: {{CURRENTMONTHNAMEGEN}}
3119 !! input
3120 {{CURRENTMONTHNAMEGEN}}
3121 !! result
3122 <p>January
3123 </p>
3124 !! end
3125
3126 !! test
3127 Magic Word: {{CURRENTTIME}}
3128 !! input
3129 {{CURRENTTIME}}
3130 !! result
3131 <p>00:02
3132 </p>
3133 !! end
3134
3135 !! test
3136 Magic Word: {{CURRENTWEEK}} (@bug 4594)
3137 !! input
3138 {{CURRENTWEEK}}
3139 !! result
3140 <p>1
3141 </p>
3142 !! end
3143
3144 !! test
3145 Magic Word: {{CURRENTYEAR}}
3146 !! input
3147 {{CURRENTYEAR}}
3148 !! result
3149 <p>1970
3150 </p>
3151 !! end
3152
3153 !! test
3154 Magic Word: {{FULLPAGENAME}}
3155 !! options
3156 title=[[User:Ævar Arnfjörð Bjarmason]]
3157 !! input
3158 {{FULLPAGENAME}}
3159 !! result
3160 <p>User:Ævar Arnfjörð Bjarmason
3161 </p>
3162 !! end
3163
3164 !! test
3165 Magic Word: {{FULLPAGENAMEE}}
3166 !! options
3167 title=[[User:Ævar Arnfjörð Bjarmason]]
3168 !! input
3169 {{FULLPAGENAMEE}}
3170 !! result
3171 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
3172 </p>
3173 !! end
3174
3175 !! test
3176 Magic Word: {{NAMESPACE}}
3177 !! options
3178 title=[[User:Ævar Arnfjörð Bjarmason]]
3179 !! input
3180 {{NAMESPACE}}
3181 !! result
3182 <p>User
3183 </p>
3184 !! end
3185
3186 !! test
3187 Magic Word: {{NAMESPACEE}}
3188 !! options
3189 title=[[User:Ævar Arnfjörð Bjarmason]]
3190 !! input
3191 {{NAMESPACEE}}
3192 !! result
3193 <p>User
3194 </p>
3195 !! end
3196
3197 !! test
3198 Magic Word: {{NAMESPACENUMBER}}
3199 !! options
3200 title=[[User:Ævar Arnfjörð Bjarmason]]
3201 !! input
3202 {{NAMESPACENUMBER}}
3203 !! result
3204 <p>2
3205 </p>
3206 !! end
3207
3208 !! test
3209 Magic Word: {{NUMBEROFFILES}}
3210 !! input
3211 {{NUMBEROFFILES}}
3212 !! result
3213 <p>2
3214 </p>
3215 !! end
3216
3217 !! test
3218 Magic Word: {{PAGENAME}}
3219 !! options
3220 title=[[User:Ævar Arnfjörð Bjarmason]]
3221 !! input
3222 {{PAGENAME}}
3223 !! result
3224 <p>Ævar Arnfjörð Bjarmason
3225 </p>
3226 !! end
3227
3228 !! test
3229 Magic Word: {{PAGENAME}} with metacharacters
3230 !! options
3231 title=[['foo & bar = baz']]
3232 !! input
3233 ''{{PAGENAME}}''
3234 !! result
3235 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
3236 </p>
3237 !! end
3238
3239 !! test
3240 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
3241 !! options
3242 title=[[*RFC 1234 http://example.com/]]
3243 !! input
3244 {{PAGENAME}}
3245 !! result
3246 <p>&#42;RFC&#32;1234 http&#58;//example.com/
3247 </p>
3248 !! end
3249
3250 !! test
3251 Magic Word: {{PAGENAMEE}}
3252 !! options
3253 title=[[User:Ævar Arnfjörð Bjarmason]]
3254 !! input
3255 {{PAGENAMEE}}
3256 !! result
3257 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
3258 </p>
3259 !! end
3260
3261 !! test
3262 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
3263 !! options
3264 title=[[*RFC 1234 http://example.com/]]
3265 !! input
3266 {{PAGENAMEE}}
3267 !! result
3268 <p>&#42;RFC_1234_http&#58;//example.com/
3269 </p>
3270 !! end
3271
3272 !! test
3273 Magic Word: {{REVISIONID}}
3274 !! input
3275 {{REVISIONID}}
3276 !! result
3277 <p>1337
3278 </p>
3279 !! end
3280
3281 !! test
3282 Magic Word: {{SCRIPTPATH}}
3283 !! input
3284 {{SCRIPTPATH}}
3285 !! result
3286 <p>/
3287 </p>
3288 !! end
3289
3290 !! test
3291 Magic Word: {{SERVER}}
3292 !! input
3293 {{SERVER}}
3294 !! result
3295 <p><a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>
3296 </p>
3297 !! end
3298
3299 !! test
3300 Magic Word: {{SERVERNAME}}
3301 !! input
3302 {{SERVERNAME}}
3303 !! result
3304 <p>Britney-Spears
3305 </p>
3306 !! end
3307
3308 !! test
3309 Magic Word: {{SITENAME}}
3310 !! input
3311 {{SITENAME}}
3312 !! result
3313 <p>MediaWiki
3314 </p>
3315 !! end
3316
3317 !! test
3318 Namespace 1 {{ns:1}}
3319 !! input
3320 {{ns:1}}
3321 !! result
3322 <p>Talk
3323 </p>
3324 !! end
3325
3326 !! test
3327 Namespace 1 {{ns:01}}
3328 !! input
3329 {{ns:01}}
3330 !! result
3331 <p>Talk
3332 </p>
3333 !! end
3334
3335 !! test
3336 Namespace 0 {{ns:0}} (bug 4783)
3337 !! input
3338 {{ns:0}}
3339 !! result
3340
3341 !! end
3342
3343 !! test
3344 Namespace 0 {{ns:00}} (bug 4783)
3345 !! input
3346 {{ns:00}}
3347 !! result
3348
3349 !! end
3350
3351 !! test
3352 Namespace -1 {{ns:-1}}
3353 !! input
3354 {{ns:-1}}
3355 !! result
3356 <p>Special
3357 </p>
3358 !! end
3359
3360 !! test
3361 Namespace User {{ns:User}}
3362 !! input
3363 {{ns:User}}
3364 !! result
3365 <p>User
3366 </p>
3367 !! end
3368
3369 !! test
3370 Namespace User talk {{ns:User_talk}}
3371 !! input
3372 {{ns:User_talk}}
3373 !! result
3374 <p>User talk
3375 </p>
3376 !! end
3377
3378 !! test
3379 Namespace User talk {{ns:uSeR tAlK}}
3380 !! input
3381 {{ns:uSeR tAlK}}
3382 !! result
3383 <p>User talk
3384 </p>
3385 !! end
3386
3387 !! test
3388 Namespace File {{ns:File}}
3389 !! input
3390 {{ns:File}}
3391 !! result
3392 <p>File
3393 </p>
3394 !! end
3395
3396 !! test
3397 Namespace File {{ns:Image}}
3398 !! input
3399 {{ns:Image}}
3400 !! result
3401 <p>File
3402 </p>
3403 !! end
3404
3405 !! test
3406 Namespace (lang=de) Benutzer {{ns:User}}
3407 !! options
3408 language=de
3409 !! input
3410 {{ns:User}}
3411 !! result
3412 <p>Benutzer
3413 </p>
3414 !! end
3415
3416 !! test
3417 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
3418 !! options
3419 language=de
3420 !! input
3421 {{ns:3}}
3422 !! result
3423 <p>Benutzer Diskussion
3424 </p>
3425 !! end
3426
3427
3428 !! test
3429 Urlencode
3430 !! input
3431 {{urlencode:hi world?!}}
3432 {{urlencode:hi world?!|WIKI}}
3433 {{urlencode:hi world?!|PATH}}
3434 {{urlencode:hi world?!|QUERY}}
3435 !! result
3436 <p>hi+world%3F%21
3437 hi_world%3F!
3438 hi%20world%3F%21
3439 hi+world%3F%21
3440 </p>
3441 !! end
3442
3443 ###
3444 ### Magic links
3445 ###
3446 !! test
3447 Magic links: internal link to RFC (bug 479)
3448 !! input
3449 [[RFC 123]]
3450 !! result
3451 <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>
3452 </p>
3453 !! end
3454
3455 !! test
3456 Magic links: RFC (bug 479)
3457 !! input
3458 RFC 822
3459 !! result
3460 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc822">RFC 822</a>
3461 </p>
3462 !! end
3463
3464 !! test
3465 Magic links: ISBN (bug 1937)
3466 !! input
3467 ISBN 0-306-40615-2
3468 !! result
3469 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
3470 </p>
3471 !! end
3472
3473 !! test
3474 Magic links: PMID incorrectly converts space to underscore
3475 !! input
3476 PMID 1234
3477 !! result
3478 <p><a class="external mw-magiclink-pmid" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
3479 </p>
3480 !! end
3481
3482 ###
3483 ### Templates
3484 ####
3485
3486 !! test
3487 Nonexistent template
3488 !! input
3489 {{thistemplatedoesnotexist}}
3490 !! result
3491 <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>
3492 </p>
3493 !! end
3494
3495 !! article
3496 Template:test
3497 !! text
3498 This is a test template
3499 !! endarticle
3500
3501 !! test
3502 Simple template
3503 !! input
3504 {{test}}
3505 !! result
3506 <p>This is a test template
3507 </p>
3508 !! end
3509
3510 !! test
3511 Template with explicit namespace
3512 !! input
3513 {{Template:test}}
3514 !! result
3515 <p>This is a test template
3516 </p>
3517 !! end
3518
3519
3520 !! article
3521 Template:paramtest
3522 !! text
3523 This is a test template with parameter {{{param}}}
3524 !! endarticle
3525
3526 !! test
3527 Template parameter
3528 !! input
3529 {{paramtest|param=foo}}
3530 !! result
3531 <p>This is a test template with parameter foo
3532 </p>
3533 !! end
3534
3535 !! article
3536 Template:paramtestnum
3537 !! text
3538 [[{{{1}}}|{{{2}}}]]
3539 !! endarticle
3540
3541 !! test
3542 Template unnamed parameter
3543 !! input
3544 {{paramtestnum|Main Page|the main page}}
3545 !! result
3546 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
3547 </p>
3548 !! end
3549
3550 !! article
3551 Template:templatesimple
3552 !! text
3553 (test)
3554 !! endarticle
3555
3556 !! article
3557 Template:templateredirect
3558 !! text
3559 #redirect [[Template:templatesimple]]
3560 !! endarticle
3561
3562 !! article
3563 Template:templateasargtestnum
3564 !! text
3565 {{{{{1}}}}}
3566 !! endarticle
3567
3568 !! article
3569 Template:templateasargtest
3570 !! text
3571 {{template{{{templ}}}}}
3572 !! endarticle
3573
3574 !! article
3575 Template:templateasargtest2
3576 !! text
3577 {{{{{templ}}}}}
3578 !! endarticle
3579
3580 !! test
3581 Template with template name as unnamed argument
3582 !! input
3583 {{templateasargtestnum|templatesimple}}
3584 !! result
3585 <p>(test)
3586 </p>
3587 !! end
3588
3589 !! test
3590 Template with template name as argument
3591 !! input
3592 {{templateasargtest|templ=simple}}
3593 !! result
3594 <p>(test)
3595 </p>
3596 !! end
3597
3598 !! test
3599 Template with template name as argument (2)
3600 !! input
3601 {{templateasargtest2|templ=templatesimple}}
3602 !! result
3603 <p>(test)
3604 </p>
3605 !! end
3606
3607 !! article
3608 Template:templateasargtestdefault
3609 !! text
3610 {{{{{templ|templatesimple}}}}}
3611 !! endarticle
3612
3613 !! article
3614 Template:templa
3615 !! text
3616 '''templ'''
3617 !! endarticle
3618
3619 !! test
3620 Template with default value
3621 !! input
3622 {{templateasargtestdefault}}
3623 !! result
3624 <p>(test)
3625 </p>
3626 !! end
3627
3628 !! test
3629 Template with default value (value set)
3630 !! input
3631 {{templateasargtestdefault|templ=templa}}
3632 !! result
3633 <p><b>templ</b>
3634 </p>
3635 !! end
3636
3637 !! test
3638 Template redirect
3639 !! input
3640 {{templateredirect}}
3641 !! result
3642 <p>(test)
3643 </p>
3644 !! end
3645
3646 !! test
3647 Template with argument in separate line
3648 !! input
3649 {{ templateasargtest |
3650 templ = simple }}
3651 !! result
3652 <p>(test)
3653 </p>
3654 !! end
3655
3656 !! test
3657 Template with complex template as argument
3658 !! input
3659 {{paramtest|
3660 param ={{ templateasargtest |
3661 templ = simple }}}}
3662 !! result
3663 <p>This is a test template with parameter (test)
3664 </p>
3665 !! end
3666
3667 !! test
3668 Template with thumb image (with link in description)
3669 !! input
3670 {{paramtest|
3671 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
3672 !! result
3673 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>
3674
3675 !! end
3676
3677 !! article
3678 Template:complextemplate
3679 !! text
3680 {{{1}}} {{paramtest|
3681 param ={{{param}}}}}
3682 !! endarticle
3683
3684 !! test
3685 Template with complex arguments
3686 !! input
3687 {{complextemplate|
3688 param ={{ templateasargtest |
3689 templ = simple }}|[[Template:complextemplate|link]]}}
3690 !! result
3691 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
3692 </p>
3693 !! end
3694
3695 !! test
3696 BUG 553: link with two variables in a piped link
3697 !! input
3698 {|
3699 |[[{{{1}}}|{{{2}}}]]
3700 |}
3701 !! result
3702 <table>
3703 <tr>
3704 <td>[[{{{1}}}|{{{2}}}]]
3705 </td></tr></table>
3706
3707 !! end
3708
3709 !! test
3710 Magic variable as template parameter
3711 !! input
3712 {{paramtest|param={{SITENAME}}}}
3713 !! result
3714 <p>This is a test template with parameter MediaWiki
3715 </p>
3716 !! end
3717
3718 !! article
3719 Template:linktest
3720 !! text
3721 [[{{{param}}}|link]]
3722 !! endarticle
3723
3724 !! test
3725 Template parameter as link source
3726 !! input
3727 {{linktest|param=Main Page}}
3728 !! result
3729 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
3730 </p>
3731 !! end
3732
3733
3734 !!article
3735 Template:paramtest2
3736 !! text
3737 including another template, {{paramtest|param={{{arg}}}}}
3738 !! endarticle
3739
3740 !! test
3741 Template passing argument to another template
3742 !! input
3743 {{paramtest2|arg='hmm'}}
3744 !! result
3745 <p>including another template, This is a test template with parameter 'hmm'
3746 </p>
3747 !! end
3748
3749 !! article
3750 Template:Linktest2
3751 !! text
3752 Main Page
3753 !! endarticle
3754
3755 !! test
3756 Template as link source
3757 !! input
3758 [[{{linktest2}}]]
3759 !! result
3760 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3761 </p>
3762 !! end
3763
3764
3765 !! article
3766 Template:loop1
3767 !! text
3768 {{loop2}}
3769 !! endarticle
3770
3771 !! article
3772 Template:loop2
3773 !! text
3774 {{loop1}}
3775 !! endarticle
3776
3777 !! test
3778 Template infinite loop
3779 !! input
3780 {{loop1}}
3781 !! result
3782 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
3783 </p>
3784 !! end
3785
3786 !! test
3787 Template from main namespace
3788 !! input
3789 {{:Main Page}}
3790 !! result
3791 <p>blah blah
3792 </p>
3793 !! end
3794
3795 !! article
3796 Template:table
3797 !! text
3798 {|
3799 | 1 || 2
3800 |-
3801 | 3 || 4
3802 |}
3803 !! endarticle
3804
3805 !! test
3806 BUG 529: Template with table, not included at beginning of line
3807 !! input
3808 foo {{table}}
3809 !! result
3810 <p>foo
3811 </p>
3812 <table>
3813 <tr>
3814 <td> 1 </td>
3815 <td> 2
3816 </td></tr>
3817 <tr>
3818 <td> 3 </td>
3819 <td> 4
3820 </td></tr></table>
3821
3822 !! end
3823
3824 !! test
3825 BUG 523: Template shouldn't eat newline (or add an extra one before table)
3826 !! input
3827 foo
3828 {{table}}
3829 !! result
3830 <p>foo
3831 </p>
3832 <table>
3833 <tr>
3834 <td> 1 </td>
3835 <td> 2
3836 </td></tr>
3837 <tr>
3838 <td> 3 </td>
3839 <td> 4
3840 </td></tr></table>
3841
3842 !! end
3843
3844 !! test
3845 BUG 41: Template parameters shown as broken links
3846 !! input
3847 {{{parameter}}}
3848 !! result
3849 <p>{{{parameter}}}
3850 </p>
3851 !! end
3852
3853
3854 !! article
3855 Template:MSGNW test
3856 !! text
3857 ''None'' of '''this''' should be
3858 * interpreted
3859 but rather passed unmodified
3860 {{test}}
3861 !! endarticle
3862
3863 # hmm, fix this or just deprecate msgnw and document its behavior?
3864 !! test
3865 msgnw keyword
3866 !! options
3867 disabled
3868 !! input
3869 {{msgnw:MSGNW test}}
3870 !! result
3871 <p>''None'' of '''this''' should be
3872 * interpreted
3873 but rather passed unmodified
3874 {{test}}
3875 </p>
3876 !! end
3877
3878 !! test
3879 int keyword
3880 !! input
3881 {{int:youhavenewmessages|lots of money|not!}}
3882 !! result
3883 <p>You have lots of money (not!).
3884 </p>
3885 !! end
3886
3887 !! article
3888 Template:Includes
3889 !! text
3890 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
3891 !! endarticle
3892
3893 !! test
3894 <includeonly> and <noinclude> being included
3895 !! input
3896 {{Includes}}
3897 !! result
3898 <p>Foobar
3899 </p>
3900 !! end
3901
3902 !! article
3903 Template:Includes2
3904 !! text
3905 <onlyinclude>Foo</onlyinclude>bar
3906 !! endarticle
3907
3908 !! test
3909 <onlyinclude> being included
3910 !! input
3911 {{Includes2}}
3912 !! result
3913 <p>Foo
3914 </p>
3915 !! end
3916
3917
3918 !! article
3919 Template:Includes3
3920 !! text
3921 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
3922 !! endarticle
3923
3924 !! test
3925 <onlyinclude> and <includeonly> being included
3926 !! input
3927 {{Includes3}}
3928 !! result
3929 <p>Foo
3930 </p>
3931 !! end
3932
3933 !! test
3934 <includeonly> and <noinclude> on a page
3935 !! input
3936 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
3937 !! result
3938 <p>Foozar
3939 </p>
3940 !! end
3941
3942 !! test
3943 <onlyinclude> on a page
3944 !! input
3945 <onlyinclude>Foo</onlyinclude>bar
3946 !! result
3947 <p>Foobar
3948 </p>
3949 !! end
3950
3951 !! article
3952 Template:Includeonly section
3953 !! text
3954 <includeonly>
3955 ==Includeonly section==
3956 </includeonly>
3957 ==Section T-1==
3958 !!endarticle
3959
3960 !! test
3961 Bug 6563: Edit link generation for section shown by <includeonly>
3962 !! input
3963 {{includeonly section}}
3964 !! result
3965 <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>
3966 <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>
3967
3968 !! end
3969
3970 # Uses same input as the contents of [[Template:Includeonly section]]
3971 !! test
3972 Bug 6563: Section extraction for section shown by <includeonly>
3973 !! options
3974 section=T-2
3975 !! input
3976 <includeonly>
3977 ==Includeonly section==
3978 </includeonly>
3979 ==Section T-2==
3980 !! result
3981 ==Section T-2==
3982 !! end
3983
3984 !! test
3985 Bug 6563: Edit link generation for section suppressed by <includeonly>
3986 !! input
3987 <includeonly>
3988 ==Includeonly section==
3989 </includeonly>
3990 ==Section 1==
3991 !! result
3992 <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>
3993
3994 !! end
3995
3996 !! test
3997 Bug 6563: Section extraction for section suppressed by <includeonly>
3998 !! options
3999 section=1
4000 !! input
4001 <includeonly>
4002 ==Includeonly section==
4003 </includeonly>
4004 ==Section 1==
4005 !! result
4006 ==Section 1==
4007 !! end
4008
4009 ###
4010 ### Pre-save transform tests
4011 ###
4012 !! test
4013 pre-save transform: subst:
4014 !! options
4015 PST
4016 !! input
4017 {{subst:test}}
4018 !! result
4019 This is a test template
4020 !! end
4021
4022 !! test
4023 pre-save transform: normal template
4024 !! options
4025 PST
4026 !! input
4027 {{test}}
4028 !! result
4029 {{test}}
4030 !! end
4031
4032 !! test
4033 pre-save transform: nonexistent template
4034 !! options
4035 PST
4036 !! input
4037 {{thistemplatedoesnotexist}}
4038 !! result
4039 {{thistemplatedoesnotexist}}
4040 !! end
4041
4042
4043 !! test
4044 pre-save transform: subst magic variables
4045 !! options
4046 PST
4047 !! input
4048 {{subst:SITENAME}}
4049 !! result
4050 MediaWiki
4051 !! end
4052
4053 # This is bug 89, which I fixed. -- wtm
4054 !! test
4055 pre-save transform: subst: templates with parameters
4056 !! options
4057 pst
4058 !! input
4059 {{subst:paramtest|param="something else"}}
4060 !! result
4061 This is a test template with parameter "something else"
4062 !! end
4063
4064 !! article
4065 Template:nowikitest
4066 !! text
4067 <nowiki>'''not wiki'''</nowiki>
4068 !! endarticle
4069
4070 !! test
4071 pre-save transform: nowiki in subst (bug 1188)
4072 !! options
4073 pst
4074 !! input
4075 {{subst:nowikitest}}
4076 !! result
4077 <nowiki>'''not wiki'''</nowiki>
4078 !! end
4079
4080
4081 !! article
4082 Template:commenttest
4083 !! text
4084 This template has <!-- a comment --> in it.
4085 !! endarticle
4086
4087 !! test
4088 pre-save transform: comment in subst (bug 1936)
4089 !! options
4090 pst
4091 !! input
4092 {{subst:commenttest}}
4093 !! result
4094 This template has <!-- a comment --> in it.
4095 !! end
4096
4097 !! test
4098 pre-save transform: unclosed tag
4099 !! options
4100 pst noxml
4101 !! input
4102 <nowiki>'''not wiki'''
4103 !! result
4104 <nowiki>'''not wiki'''
4105 !! end
4106
4107 !! test
4108 pre-save transform: mixed tag case
4109 !! options
4110 pst noxml
4111 !! input
4112 <NOwiki>'''not wiki'''</noWIKI>
4113 !! result
4114 <NOwiki>'''not wiki'''</noWIKI>
4115 !! end
4116
4117 !! test
4118 pre-save transform: unclosed comment in <nowiki>
4119 !! options
4120 pst noxml
4121 !! input
4122 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
4123 !! result
4124 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
4125 !!end
4126
4127 !! article
4128 Template:dangerous
4129 !!text
4130 <span onmouseover="alert('crap')">Oh no</span>
4131 !!endarticle
4132
4133 !!test
4134 (confirming safety of fix for subst bug 1936)
4135 !! input
4136 {{Template:dangerous}}
4137 !! result
4138 <p><span>Oh no</span>
4139 </p>
4140 !! end
4141
4142 !! test
4143 pre-save transform: comment containing gallery (bug 5024)
4144 !! options
4145 pst
4146 !! input
4147 <!-- <gallery>data</gallery> -->
4148 !!result
4149 <!-- <gallery>data</gallery> -->
4150 !!end
4151
4152 !! test
4153 pre-save transform: comment containing extension
4154 !! options
4155 pst
4156 !! input
4157 <!-- <tag>data</tag> -->
4158 !!result
4159 <!-- <tag>data</tag> -->
4160 !!end
4161
4162 !! test
4163 pre-save transform: comment containing nowiki
4164 !! options
4165 pst
4166 !! input
4167 <!-- <nowiki>data</nowiki> -->
4168 !!result
4169 <!-- <nowiki>data</nowiki> -->
4170 !!end
4171
4172 !! test
4173 pre-save transform: <noinclude> in subst (bug 3298)
4174 !! options
4175 pst
4176 !! input
4177 {{subst:Includes}}
4178 !! result
4179 Foobar
4180 !! end
4181
4182 !! test
4183 pre-save transform: <onlyinclude> in subst (bug 3298)
4184 !! options
4185 pst
4186 !! input
4187 {{subst:Includes2}}
4188 !! result
4189 Foo
4190 !! end
4191
4192 !! article
4193 Template:SubstTest
4194 !!text
4195 {{<includeonly>subst:</includeonly>Includes}}
4196 !! endarticle
4197
4198 !! article
4199 Template:SafeSubstTest
4200 !! text
4201 {{<includeonly>safesubst:</includeonly>Includes}}
4202 !! endarticle
4203
4204 !! test
4205 bug 22297: safesubst: works during PST
4206 !! options
4207 pst
4208 !! input
4209 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
4210 !! result
4211 FoobarFoobar
4212 !! end
4213
4214 !! test
4215 bug 22297: safesubst: works during normal parse
4216 !! input
4217 {{SafeSubstTest}}
4218 !! result
4219 <p>Foobar
4220 </p>
4221 !! end
4222
4223 !! test:
4224 subst: does not work during normal parse
4225 !! input
4226 {{SubstTest}}
4227 !! result
4228 <p>{{subst:Includes}}
4229 </p>
4230 !! end
4231
4232 !! test
4233 pre-save transform: context links ("pipe trick")
4234 !! options
4235 pst
4236 !! input
4237 [[Article (context)|]]
4238 [[Bar:Article|]]
4239 [[:Bar:Article|]]
4240 [[Bar:Article (context)|]]
4241 [[:Bar:Article (context)|]]
4242 [[|Article]]
4243 [[|Article (context)]]
4244 [[Bar:X (Y) Z|]]
4245 [[:Bar:X (Y) Z|]]
4246 !! result
4247 [[Article (context)|Article]]
4248 [[Bar:Article|Article]]
4249 [[:Bar:Article|Article]]
4250 [[Bar:Article (context)|Article]]
4251 [[:Bar:Article (context)|Article]]
4252 [[Article]]
4253 [[Article (context)]]
4254 [[Bar:X (Y) Z|X (Y) Z]]
4255 [[:Bar:X (Y) Z|X (Y) Z]]
4256 !! end
4257
4258 !! test
4259 pre-save transform: context links ("pipe trick") with interwiki prefix
4260 !! options
4261 pst
4262 !! input
4263 [[interwiki:Article|]]
4264 [[:interwiki:Article|]]
4265 [[interwiki:Bar:Article|]]
4266 [[:interwiki:Bar:Article|]]
4267 !! result
4268 [[interwiki:Article|Article]]
4269 [[:interwiki:Article|Article]]
4270 [[interwiki:Bar:Article|Bar:Article]]
4271 [[:interwiki:Bar:Article|Bar:Article]]
4272 !! end
4273
4274 !! test
4275 pre-save transform: context links ("pipe trick") with parens in title
4276 !! options
4277 pst title=[[Somearticle (context)]]
4278 !! input
4279 [[|Article]]
4280 !! result
4281 [[Article (context)|Article]]
4282 !! end
4283
4284 !! test
4285 pre-save transform: context links ("pipe trick") with comma in title
4286 !! options
4287 pst title=[[Someplace, Somewhere]]
4288 !! input
4289 [[|Otherplace]]
4290 [[Otherplace, Elsewhere|]]
4291 [[Otherplace, Elsewhere, Anywhere|]]
4292 !! result
4293 [[Otherplace, Somewhere|Otherplace]]
4294 [[Otherplace, Elsewhere|Otherplace]]
4295 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
4296 !! end
4297
4298 !! test
4299 pre-save transform: context links ("pipe trick") with parens and comma
4300 !! options
4301 pst title=[[Someplace (IGNORED), Somewhere]]
4302 !! input
4303 [[|Otherplace]]
4304 [[Otherplace (place), Elsewhere|]]
4305 !! result
4306 [[Otherplace, Somewhere|Otherplace]]
4307 [[Otherplace (place), Elsewhere|Otherplace]]
4308 !! end
4309
4310 !! test
4311 pre-save transform: context links ("pipe trick") with comma and parens
4312 !! options
4313 pst title=[[Who, me? (context)]]
4314 !! input
4315 [[|Yes, you.]]
4316 [[Me, Myself, and I (1937 song)|]]
4317 !! result
4318 [[Yes, you. (context)|Yes, you.]]
4319 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
4320 !! end
4321
4322 !! test
4323 pre-save transform: context links ("pipe trick") with namespace
4324 !! options
4325 pst title=[[Ns:Somearticle]]
4326 !! input
4327 [[|Article]]
4328 !! result
4329 [[Ns:Article|Article]]
4330 !! end
4331
4332 !! test
4333 pre-save transform: context links ("pipe trick") with namespace and parens
4334 !! options
4335 pst title=[[Ns:Somearticle (context)]]
4336 !! input
4337 [[|Article]]
4338 !! result
4339 [[Ns:Article (context)|Article]]
4340 !! end
4341
4342 !! test
4343 pre-save transform: context links ("pipe trick") with namespace and comma
4344 !! options
4345 pst title=[[Ns:Somearticle, Context, Whatever]]
4346 !! input
4347 [[|Article]]
4348 !! result
4349 [[Ns:Article, Context, Whatever|Article]]
4350 !! end
4351
4352 !! test
4353 pre-save transform: context links ("pipe trick") with namespace, comma and parens
4354 !! options
4355 pst title=[[Ns:Somearticle, Context (context)]]
4356 !! input
4357 [[|Article]]
4358 !! result
4359 [[Ns:Article (context)|Article]]
4360 !! end
4361
4362 !! test
4363 pre-save transform: context links ("pipe trick") with namespace, parens and comma
4364 !! options
4365 pst title=[[Ns:Somearticle (IGNORED), Context]]
4366 !! input
4367 [[|Article]]
4368 !! result
4369 [[Ns:Article, Context|Article]]
4370 !! end
4371
4372 !! test
4373 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
4374 !! options
4375 pst
4376 !! input
4377 [[Article(context)|]]
4378 [[Bar:Article(context)|]]
4379 [[:Bar:Article(context)|]]
4380 [[|Article(context)]]
4381 [[Bar:X(Y)Z|]]
4382 [[:Bar:X(Y)Z|]]
4383 !! result
4384 [[Article(context)|Article]]
4385 [[Bar:Article(context)|Article]]
4386 [[:Bar:Article(context)|Article]]
4387 [[Article(context)]]
4388 [[Bar:X(Y)Z|X(Y)Z]]
4389 [[:Bar:X(Y)Z|X(Y)Z]]
4390 !! end
4391
4392 !! test
4393 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
4394 !! options
4395 pst
4396 !! input
4397 [[Article (context)|]]
4398 [[Bar:Article (context)|]]
4399 [[:Bar:Article (context)|]]
4400 [[|Article (context)]]
4401 [[Bar:X (Y) Z|]]
4402 [[:Bar:X (Y) Z|]]
4403 !! result
4404 [[Article (context)|Article]]
4405 [[Bar:Article (context)|Article]]
4406 [[:Bar:Article (context)|Article]]
4407 [[Article (context)]]
4408 [[Bar:X (Y) Z|X (Y) Z]]
4409 [[:Bar:X (Y) Z|X (Y) Z]]
4410 !! end
4411
4412 !! test
4413 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
4414 !! options
4415 pst
4416 !! input
4417 [[Article(context)|]]
4418 [[Bar:Article(context)|]]
4419 [[:Bar:Article(context)|]]
4420 [[|Article(context)]]
4421 [[Bar:X(Y)Z|]]
4422 [[:Bar:X(Y)Z|]]
4423 !! result
4424 [[Article(context)|Article]]
4425 [[Bar:Article(context)|Article]]
4426 [[:Bar:Article(context)|Article]]
4427 [[Article(context)]]
4428 [[Bar:X(Y)Z|X(Y)Z]]
4429 [[:Bar:X(Y)Z|X(Y)Z]]
4430 !! end
4431
4432 !! test
4433 pre-save transform: context links ("pipe trick") with commas (bug 21660)
4434 !! options
4435 pst
4436 !! input
4437 [[Article (context), context|]]
4438 [[Article (context),context|]]
4439 [[Bar:Article (context), context|]]
4440 [[Bar:Article (context),context|]]
4441 [[:Bar:Article (context), context|]]
4442 [[:Bar:Article (context),context|]]
4443 !! result
4444 [[Article (context), context|Article]]
4445 [[Article (context),context|Article]]
4446 [[Bar:Article (context), context|Article]]
4447 [[Bar:Article (context),context|Article]]
4448 [[:Bar:Article (context), context|Article]]
4449 [[:Bar:Article (context),context|Article]]
4450 !! end
4451
4452 !! test
4453 pre-save transform: trim trailing empty lines
4454 !! options
4455 pst
4456 !! input
4457 Empty lines are trimmed
4458
4459
4460
4461
4462 !! result
4463 Empty lines are trimmed
4464 !! end
4465
4466 !! test
4467 pre-save transform: Signature expansion
4468 !! options
4469 pst
4470 !! input
4471 * ~~~
4472 * <noinclude>~~~</noinclude>
4473 * <includeonly>~~~</includeonly>
4474 * <onlyinclude>~~~</onlyinclude>
4475 !! result
4476 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
4477 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
4478 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
4479 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
4480 !! end
4481
4482
4483 !! test
4484 pre-save transform: Signature expansion in nowiki tags (bug 93)
4485 !! options
4486 pst disabled
4487 !! input
4488 Shall not expand:
4489
4490 <nowiki>~~~~</nowiki>
4491
4492 <includeonly><nowiki>~~~~</nowiki></includeonly>
4493
4494 <noinclude><nowiki>~~~~</nowiki></noinclude>
4495
4496 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
4497
4498 {{subst:Foo}} shall be converted to FOO
4499
4500 As well as inside noinclude/onlyinclude
4501 <noinclude>{{subst:Foo}}</noinclude>
4502 <onlyinclude>{{subst:Foo}}</onlyinclude>
4503
4504 But not inside includeonly
4505 <includeonly>{{subst:Foo}}</includeonly>
4506 !! result
4507 Shall not expand:
4508
4509 <nowiki>~~~~</nowiki>
4510
4511 <includeonly><nowiki>~~~~</nowiki></includeonly>
4512
4513 <noinclude><nowiki>~~~~</nowiki></noinclude>
4514
4515 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
4516
4517 FOO shall be converted to FOO
4518
4519 As well as inside noinclude/onlyinclude
4520 <noinclude>FOO</noinclude>
4521 <onlyinclude>FOO</onlyinclude>
4522
4523 But not inside includeonly
4524 <includeonly>{{subst:Foo}}</includeonly>
4525 !! end
4526
4527 ###
4528 ### Message transform tests
4529 ###
4530 !! test
4531 message transform: magic variables
4532 !! options
4533 msg
4534 !! input
4535 {{SITENAME}}
4536 !! result
4537 MediaWiki
4538 !! end
4539
4540 !! test
4541 message transform: should not transform wiki markup
4542 !! options
4543 msg
4544 !! input
4545 ''test''
4546 !! result
4547 ''test''
4548 !! end
4549
4550 !! test
4551 message transform: <noinclude> in transcluded template (bug 4926)
4552 !! options
4553 msg
4554 !! input
4555 {{Includes}}
4556 !! result
4557 Foobar
4558 !! end
4559
4560 !! test
4561 message transform: <onlyinclude> in transcluded template (bug 4926)
4562 !! options
4563 msg
4564 !! input
4565 {{Includes2}}
4566 !! result
4567 Foo
4568 !! end
4569
4570 !! test
4571 {{#special:}} page name, known
4572 !! options
4573 msg
4574 !! input
4575 {{#special:Recentchanges}}
4576 !! result
4577 Special:RecentChanges
4578 !! end
4579
4580 !! test
4581 {{#special:}} page name with subpage, known
4582 !! options
4583 msg
4584 !! input
4585 {{#special:Recentchanges/param}}
4586 !! result
4587 Special:RecentChanges/param
4588 !! end
4589
4590 !! test
4591 {{#special:}} page name, unknown
4592 !! options
4593 msg
4594 !! input
4595 {{#special:foobarnonexistent}}
4596 !! result
4597 No such special page
4598 !! end
4599
4600 !! test
4601 {{#speciale:}} page name, known
4602 !! options
4603 msg
4604 !! input
4605 {{#speciale:Recentchanges}}
4606 !! result
4607 Special:RecentChanges
4608 !! end
4609
4610 !! test
4611 {{#speciale:}} page name with subpage, known
4612 !! options
4613 msg
4614 !! input
4615 {{#speciale:Recentchanges/param}}
4616 !! result
4617 Special:RecentChanges/param
4618 !! end
4619
4620 !! test
4621 {{#speciale:}} page name, unknown
4622 !! options
4623 msg
4624 !! input
4625 {{#speciale:foobarnonexistent}}
4626 !! result
4627 No_such_special_page
4628 !! end
4629
4630 ###
4631 ### Images
4632 ###
4633 !! test
4634 Simple image
4635 !! input
4636 [[Image:foobar.jpg]]
4637 !! result
4638 <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>
4639 </p>
4640 !! end
4641
4642 !! test
4643 Right-aligned image
4644 !! input
4645 [[Image:foobar.jpg|right]]
4646 !! result
4647 <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>
4648
4649 !! end
4650
4651 !! test
4652 Simple image (using File: namespace, now canonical)
4653 !! input
4654 [[File:foobar.jpg]]
4655 !! result
4656 <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>
4657 </p>
4658 !! end
4659
4660 !! test
4661 Image with caption
4662 !! input
4663 [[Image:foobar.jpg|right|Caption text]]
4664 !! result
4665 <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>
4666
4667 !! end
4668
4669 !! test
4670 Image with link parameter, wiki target
4671 !! input
4672 [[Image:foobar.jpg|link=Target page]]
4673 !! result
4674 <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>
4675 </p>
4676 !! end
4677
4678 !! test
4679 Image with link parameter, URL target
4680 !! input
4681 [[Image:foobar.jpg|link=http://example.com/]]
4682 !! result
4683 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4684 </p>
4685 !! end
4686
4687 !! test
4688 Image with link parameter, wgExternalLinkTarget
4689 !! input
4690 [[Image:foobar.jpg|link=http://example.com/]]
4691 !! config
4692 wgExternalLinkTarget='foobar'
4693 !! result
4694 <p><a href="http://example.com/" target="foobar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4695 </p>
4696 !! end
4697
4698 !! test
4699 Image with link parameter, wgExternalLinkTarget, unnamed parameter
4700 !! input
4701 [[Image:foobar.jpg|link=http://example.com/|Title]]
4702 !! config
4703 wgExternalLinkTarget='foobar'
4704 !! result
4705 <p><a href="http://example.com/" title="Title" target="foobar"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4706 </p>
4707 !! end
4708
4709 !! test
4710 Image with empty link parameter
4711 !! input
4712 [[Image:foobar.jpg|link=]]
4713 !! result
4714 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
4715 </p>
4716 !! end
4717
4718 !! test
4719 Image with link parameter (wiki target) and unnamed parameter
4720 !! input
4721 [[Image:foobar.jpg|link=Target page|Title]]
4722 !! result
4723 <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>
4724 </p>
4725 !! end
4726
4727 !! test
4728 Image with link parameter (URL target) and unnamed parameter
4729 !! input
4730 [[Image:foobar.jpg|link=http://example.com/|Title]]
4731 !! result
4732 <p><a href="http://example.com/" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4733 </p>
4734 !! end
4735
4736 !! test
4737 Thumbnail image with link parameter
4738 !! input
4739 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
4740 !! result
4741 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
4742
4743 !! end
4744
4745 !! test
4746 Image with frame and link
4747 !! input
4748 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
4749 !! result
4750 <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>
4751
4752 !! end
4753
4754 !! test
4755 Image with frame and link and explicit alt
4756 !! input
4757 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
4758 !! result
4759 <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>
4760
4761 !! end
4762
4763 !! test
4764 Image with wiki markup in implicit alt
4765 !! input
4766 [[Image:Foobar.jpg|testing '''bold''' in alt]]
4767 !! result
4768 <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>
4769 </p>
4770 !! end
4771
4772 !! test
4773 Image with wiki markup in explicit alt
4774 !! input
4775 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
4776 !! result
4777 <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>
4778 </p>
4779 !! end
4780
4781 !! test
4782 Link to image page- image page normally doesn't exists, hence edit link
4783 Add test with existing image page
4784 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
4785 !! input
4786 [[:Image:test]]
4787 !! result
4788 <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>
4789 </p>
4790 !! end
4791
4792 !! test
4793 bug 18784 Link to non-existent image page with caption should use caption as link text
4794 !! input
4795 [[:Image:test|caption]]
4796 !! result
4797 <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>
4798 </p>
4799 !! end
4800
4801 !! test
4802 Frameless image caption with a free URL
4803 !! input
4804 [[Image:foobar.jpg|http://example.com]]
4805 !! result
4806 <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>
4807 </p>
4808 !! end
4809
4810 !! test
4811 Thumbnail image caption with a free URL
4812 !! input
4813 [[Image:foobar.jpg|thumb|http://example.com]]
4814 !! result
4815 <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/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
4816
4817 !! end
4818
4819 !! test
4820 Thumbnail image caption with a free URL and explicit alt
4821 !! input
4822 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
4823 !! result
4824 <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/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
4825
4826 !! end
4827
4828 !! test
4829 BUG 1887: A ISBN with a thumbnail
4830 !! input
4831 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
4832 !! result
4833 <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/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
4834
4835 !! end
4836
4837 !! test
4838 BUG 1887: A RFC with a thumbnail
4839 !! input
4840 [[Image:foobar.jpg|thumb|This is RFC 12354]]
4841 !! result
4842 <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/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
4843
4844 !! end
4845
4846 !! test
4847 BUG 1887: A mailto link with a thumbnail
4848 !! input
4849 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
4850 !! result
4851 <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/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
4852
4853 !! end
4854
4855 # Pending resolution to bug 368
4856 !! test
4857 BUG 648: Frameless image caption with a link
4858 !! input
4859 [[Image:foobar.jpg|text with a [[link]] in it]]
4860 !! result
4861 <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>
4862 </p>
4863 !! end
4864
4865 !! test
4866 BUG 648: Frameless image caption with a link (suffix)
4867 !! input
4868 [[Image:foobar.jpg|text with a [[link]]foo in it]]
4869 !! result
4870 <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>
4871 </p>
4872 !! end
4873
4874 !! test
4875 BUG 648: Frameless image caption with an interwiki link
4876 !! input
4877 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
4878 !! result
4879 <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>
4880 </p>
4881 !! end
4882
4883 !! test
4884 BUG 648: Frameless image caption with a piped interwiki link
4885 !! input
4886 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
4887 !! result
4888 <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>
4889 </p>
4890 !! end
4891
4892 !! test
4893 Escape HTML special chars in image alt text
4894 !! input
4895 [[Image:foobar.jpg|& < > "]]
4896 !! result
4897 <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>
4898 </p>
4899 !! end
4900
4901 !! test
4902 BUG 499: Alt text should have &#1234;, not &amp;1234;
4903 !! input
4904 [[Image:foobar.jpg|&#9792;]]
4905 !! result
4906 <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>
4907 </p>
4908 !! end
4909
4910 !! test
4911 Broken image caption with link
4912 !! input
4913 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
4914 !! result
4915 <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.
4916 </p>
4917 !! end
4918
4919 !! test
4920 Image caption containing another image
4921 !! input
4922 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
4923 !! result
4924 <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/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>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>
4925
4926 !! end
4927
4928 !! test
4929 Image caption containing a newline
4930 !! input
4931 [[Image:Foobar.jpg|This
4932 *is some text]]
4933 !! result
4934 <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>
4935 </p>
4936 !!end
4937
4938
4939 !! test
4940 Bug 3090: External links other than http: in image captions
4941 !! input
4942 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
4943 !! result
4944 <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/3/3a/Foobar.jpg" width="200" height="23" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>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>
4945
4946 !! end
4947
4948 !! article
4949 File:Barfoo.jpg
4950 !! text
4951 #REDIRECT [[File:Barfoo.jpg]]
4952 !! endarticle
4953
4954 !! test
4955 Redirected image
4956 !! input
4957 [[Image:Barfoo.jpg]]
4958 !! result
4959 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
4960 </p>
4961 !! end
4962
4963 !! test
4964 Missing image with uploads disabled
4965 !! options
4966 wgEnableUploads=0
4967 !! input
4968 [[Image:Foobaz.jpg]]
4969 !! result
4970 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
4971 </p>
4972 !! end
4973
4974
4975 ###
4976 ### Subpages
4977 ###
4978 !! article
4979 Subpage test/subpage
4980 !! text
4981 foo
4982 !! endarticle
4983
4984 !! test
4985 Subpage link
4986 !! options
4987 subpage title=[[Subpage test]]
4988 !! input
4989 [[/subpage]]
4990 !! result
4991 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
4992 </p>
4993 !! end
4994
4995 !! test
4996 Subpage noslash link
4997 !! options
4998 subpage title=[[Subpage test]]
4999 !!input
5000 [[/subpage/]]
5001 !! result
5002 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
5003 </p>
5004 !! end
5005
5006 !! test
5007 Disabled subpages
5008 !! input
5009 [[/subpage]]
5010 !! result
5011 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
5012 </p>
5013 !! end
5014
5015 !! test
5016 BUG 561: {{/Subpage}}
5017 !! options
5018 subpage title=[[Page]]
5019 !! input
5020 {{/Subpage}}
5021 !! result
5022 <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>
5023 </p>
5024 !! end
5025
5026 ###
5027 ### Categories
5028 ###
5029 !! article
5030 Category:MediaWiki User's Guide
5031 !! text
5032 blah
5033 !! endarticle
5034
5035 !! test
5036 Link to category
5037 !! input
5038 [[:Category:MediaWiki User's Guide]]
5039 !! result
5040 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
5041 </p>
5042 !! end
5043
5044 !! test
5045 Simple category
5046 !! options
5047 cat
5048 !! input
5049 [[Category:MediaWiki User's Guide]]
5050 !! result
5051 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
5052 !! end
5053
5054 !! test
5055 PAGESINCATEGORY invalid title fatal (r33546 fix)
5056 !! input
5057 {{PAGESINCATEGORY:<bogus>}}
5058 !! result
5059 <p>0
5060 </p>
5061 !! end
5062
5063 ###
5064 ### Inter-language links
5065 ###
5066 !! test
5067 Inter-language links
5068 !! options
5069 ill
5070 !! input
5071 [[es:Alimento]]
5072 [[fr:Nourriture]]
5073 [[zh:&#39135;&#21697;]]
5074 !! result
5075 es:Alimento fr:Nourriture zh:食品
5076 !! end
5077
5078 ###
5079 ### Sections
5080 ###
5081 !! test
5082 Basic section headings
5083 !! input
5084 == Headline 1 ==
5085 Some text
5086
5087 ==Headline 2==
5088 More
5089 ===Smaller headline===
5090 Blah blah
5091 !! result
5092 <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>
5093 <p>Some text
5094 </p>
5095 <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>
5096 <p>More
5097 </p>
5098 <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>
5099 <p>Blah blah
5100 </p>
5101 !! end
5102
5103 !! test
5104 Section headings with TOC
5105 !! input
5106 == Headline 1 ==
5107 === Subheadline 1 ===
5108 ===== Skipping a level =====
5109 ====== Skipping a level ======
5110
5111 == Headline 2 ==
5112 Some text
5113 ===Another headline===
5114 !! result
5115 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5116 <ul>
5117 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
5118 <ul>
5119 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
5120 <ul>
5121 <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>
5122 <ul>
5123 <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>
5124 </ul>
5125 </li>
5126 </ul>
5127 </li>
5128 </ul>
5129 </li>
5130 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
5131 <ul>
5132 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
5133 </ul>
5134 </li>
5135 </ul>
5136 </td></tr></table>
5137 <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>
5138 <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>
5139 <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>
5140 <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>
5141 <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>
5142 <p>Some text
5143 </p>
5144 <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>
5145
5146 !! end
5147
5148 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
5149 !! test
5150 Handling of sections up to level 6 and beyond
5151 !! input
5152 = Level 1 Heading=
5153 == Level 2 Heading==
5154 === Level 3 Heading===
5155 ==== Level 4 Heading====
5156 ===== Level 5 Heading=====
5157 ====== Level 6 Heading======
5158 ======= Level 7 Heading=======
5159 ======== Level 8 Heading========
5160 ========= Level 9 Heading=========
5161 ========== Level 10 Heading==========
5162 !! result
5163 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5164 <ul>
5165 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
5166 <ul>
5167 <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>
5168 <ul>
5169 <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>
5170 <ul>
5171 <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>
5172 <ul>
5173 <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>
5174 <ul>
5175 <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>
5176 <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>
5177 <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>
5178 <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>
5179 <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>
5180 </ul>
5181 </li>
5182 </ul>
5183 </li>
5184 </ul>
5185 </li>
5186 </ul>
5187 </li>
5188 </ul>
5189 </li>
5190 </ul>
5191 </td></tr></table>
5192 <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>
5193 <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>
5194 <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>
5195 <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>
5196 <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>
5197 <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>
5198 <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>
5199 <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>
5200 <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>
5201 <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>
5202
5203 !! end
5204
5205 !! test
5206 TOC regression (bug 9764)
5207 !! input
5208 == title 1 ==
5209 === title 1.1 ===
5210 ==== title 1.1.1 ====
5211 === title 1.2 ===
5212 == title 2 ==
5213 === title 2.1 ===
5214 !! result
5215 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5216 <ul>
5217 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
5218 <ul>
5219 <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>
5220 <ul>
5221 <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>
5222 </ul>
5223 </li>
5224 <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>
5225 </ul>
5226 </li>
5227 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
5228 <ul>
5229 <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>
5230 </ul>
5231 </li>
5232 </ul>
5233 </td></tr></table>
5234 <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>
5235 <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>
5236 <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>
5237 <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>
5238 <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>
5239 <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>
5240
5241 !! end
5242
5243 !! test
5244 TOC with wgMaxTocLevel=3 (bug 6204)
5245 !! options
5246 wgMaxTocLevel=3
5247 !! input
5248 == title 1 ==
5249 === title 1.1 ===
5250 ==== title 1.1.1 ====
5251 === title 1.2 ===
5252 == title 2 ==
5253 === title 2.1 ===
5254 !! result
5255 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5256 <ul>
5257 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
5258 <ul>
5259 <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>
5260 <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>
5261 </ul>
5262 </li>
5263 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
5264 <ul>
5265 <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>
5266 </ul>
5267 </li>
5268 </ul>
5269 </td></tr></table>
5270 <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>
5271 <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>
5272 <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>
5273 <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>
5274 <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>
5275 <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>
5276
5277 !! end
5278
5279 !! test
5280 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
5281 !! options
5282 wgMaxTocLevel=3
5283 !! input
5284 ==Section 1==
5285 ===Section 1.1===
5286 ====Section 1.1.1====
5287 ====Section 1.1.1.1====
5288 ==Section 2==
5289 !! result
5290 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5291 <ul>
5292 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
5293 <ul>
5294 <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>
5295 </ul>
5296 </li>
5297 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
5298 </ul>
5299 </td></tr></table>
5300 <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>
5301 <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>
5302 <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>
5303 <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>
5304 <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>
5305
5306 !! end
5307
5308
5309 !! test
5310 Resolving duplicate section names
5311 !! input
5312 == Foo bar ==
5313 == Foo bar ==
5314 !! result
5315 <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>
5316 <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>
5317
5318 !! end
5319
5320 !! test
5321 Resolving duplicate section names with differing case (bug 10721)
5322 !! input
5323 == Foo bar ==
5324 == Foo Bar ==
5325 !! result
5326 <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>
5327 <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>
5328
5329 !! end
5330
5331 !! article
5332 Template:sections
5333 !! text
5334 ===Section 1===
5335 ==Section 2==
5336 !! endarticle
5337
5338 !! test
5339 Template with sections, __NOTOC__
5340 !! input
5341 __NOTOC__
5342 ==Section 0==
5343 {{sections}}
5344 ==Section 4==
5345 !! result
5346 <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>
5347 <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>
5348 <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>
5349 <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>
5350
5351 !! end
5352
5353 !! test
5354 __NOEDITSECTION__ keyword
5355 !! input
5356 __NOEDITSECTION__
5357 ==Section 1==
5358 ==Section 2==
5359 !! result
5360 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
5361 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
5362
5363 !! end
5364
5365 !! test
5366 Link inside a section heading
5367 !! input
5368 ==Section with a [[Main Page|link]] in it==
5369 !! result
5370 <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>
5371
5372 !! end
5373
5374 !! test
5375 TOC regression (bug 12077)
5376 !! input
5377 __TOC__
5378 == title 1 ==
5379 === title 1.1 ===
5380 == title 2 ==
5381 !! result
5382 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5383 <ul>
5384 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
5385 <ul>
5386 <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>
5387 </ul>
5388 </li>
5389 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
5390 </ul>
5391 </td></tr></table>
5392 <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>
5393 <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>
5394 <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>
5395
5396 !! end
5397
5398 !! test
5399 BUG 1219 URL next to image (good)
5400 !! input
5401 http://example.com [[Image:foobar.jpg]]
5402 !! result
5403 <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>
5404 </p>
5405 !!end
5406
5407 !! test
5408 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
5409 !! input
5410 ===
5411 The line above must have a trailing space!
5412 === <!--
5413 --> <!-- -->
5414 But just in case it doesn't...
5415 !! result
5416 <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>
5417 <p>The line above must have a trailing space!
5418 </p>
5419 <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>
5420 <p>But just in case it doesn't...
5421 </p>
5422 !! end
5423
5424 !! test
5425 Header with special characters (bug 25462)
5426 !! input
5427 The tooltips shall not show entities to the user (ie. be double escaped)
5428
5429 == text > text ==
5430 section 1
5431
5432 == text < text ==
5433 section 2
5434
5435 == text & text ==
5436 section 3
5437
5438 == text ' text ==
5439 section 4
5440
5441 == text " text ==
5442 section 5
5443 !! result
5444 <p>The tooltips shall not show entities to the user (ie. be double escaped)
5445 </p>
5446 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5447 <ul>
5448 <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>
5449 <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>
5450 <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>
5451 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
5452 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
5453 </ul>
5454 </td></tr></table>
5455 <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>
5456 <p>section 1
5457 </p>
5458 <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>
5459 <p>section 2
5460 </p>
5461 <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>
5462 <p>section 3
5463 </p>
5464 <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>
5465 <p>section 4
5466 </p>
5467 <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>
5468 <p>section 5
5469 </p>
5470 !! end
5471
5472 !! test
5473 BUG 1219 URL next to image (broken)
5474 !! input
5475 http://example.com[[Image:foobar.jpg]]
5476 !! result
5477 <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>
5478 </p>
5479 !!end
5480
5481 !! test
5482 Bug 1186 news: in the middle of text
5483 !! input
5484 http://en.wikinews.org/wiki/Wikinews:Workplace
5485 !! result
5486 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
5487 </p>
5488 !!end
5489
5490
5491 !! test
5492 Namespaced link must have a title
5493 !! input
5494 [[Project:]]
5495 !! result
5496 <p>[[Project:]]
5497 </p>
5498 !!end
5499
5500 !! test
5501 Namespaced link must have a title (bad fragment version)
5502 !! input
5503 [[Project:#fragment]]
5504 !! result
5505 <p>[[Project:#fragment]]
5506 </p>
5507 !!end
5508
5509
5510 !! test
5511 div with no attributes
5512 !! input
5513 <div>HTML rocks</div>
5514 !! result
5515 <div>HTML rocks</div>
5516
5517 !! end
5518
5519 !! test
5520 div with double-quoted attribute
5521 !! input
5522 <div id="rock">HTML rocks</div>
5523 !! result
5524 <div id="rock">HTML rocks</div>
5525
5526 !! end
5527
5528 !! test
5529 div with single-quoted attribute
5530 !! input
5531 <div id='rock'>HTML rocks</div>
5532 !! result
5533 <div id="rock">HTML rocks</div>
5534
5535 !! end
5536
5537 !! test
5538 div with unquoted attribute
5539 !! input
5540 <div id=rock>HTML rocks</div>
5541 !! result
5542 <div id="rock">HTML rocks</div>
5543
5544 !! end
5545
5546 !! test
5547 div with illegal double attributes
5548 !! input
5549 <div id="a" id="b">HTML rocks</div>
5550 !! result
5551 <div id="b">HTML rocks</div>
5552
5553 !!end
5554
5555 !! test
5556 HTML multiple attributes correction
5557 !! input
5558 <p class="error" class="awesome">Awesome!</p>
5559 !! result
5560 <p class="awesome">Awesome!</p>
5561
5562 !!end
5563
5564 !! test
5565 Table multiple attributes correction
5566 !! input
5567 {|
5568 !+ class="error" class="awesome"| status
5569 |}
5570 !! result
5571 <table>
5572 <tr>
5573 <th class="awesome"> status
5574 </th></tr></table>
5575
5576 !!end
5577
5578 !! test
5579 DIV IN UPPERCASE
5580 !! input
5581 <DIV ID="x">HTML ROCKS</DIV>
5582 !! result
5583 <div id="x">HTML ROCKS</div>
5584
5585 !!end
5586
5587
5588 !! test
5589 text with amp in the middle of nowhere
5590 !! input
5591 Remember AT&T?
5592 !!result
5593 <p>Remember AT&amp;T?
5594 </p>
5595 !! end
5596
5597 !! test
5598 text with character entity: eacute
5599 !! input
5600 I always thought &eacute; was a cute letter.
5601 !! result
5602 <p>I always thought &#233; was a cute letter.
5603 </p>
5604 !! end
5605
5606 !! test
5607 text with undefined character entity: xacute
5608 !! input
5609 I always thought &xacute; was a cute letter.
5610 !! result
5611 <p>I always thought &amp;xacute; was a cute letter.
5612 </p>
5613 !! end
5614
5615
5616 ###
5617 ### Media links
5618 ###
5619
5620 !! test
5621 Media link
5622 !! input
5623 [[Media:Foobar.jpg]]
5624 !! result
5625 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
5626 </p>
5627 !! end
5628
5629 !! test
5630 Media link with text
5631 !! input
5632 [[Media:Foobar.jpg|A neat file to look at]]
5633 !! result
5634 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
5635 </p>
5636 !! end
5637
5638 # FIXME: this is still bad HTML tag nesting
5639 !! test
5640 Media link with nasty text
5641 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
5642 !! input
5643 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
5644 !! result
5645 <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>
5646
5647 !! end
5648
5649 !! test
5650 Media link to nonexistent file (bug 1702)
5651 !! input
5652 [[Media:No such.jpg]]
5653 !! result
5654 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
5655 </p>
5656 !! end
5657
5658 !! test
5659 Image link to nonexistent file (bug 1850 - good)
5660 !! input
5661 [[Image:No such.jpg]]
5662 !! result
5663 <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>
5664 </p>
5665 !! end
5666
5667 !! test
5668 :Image link to nonexistent file (bug 1850 - bad)
5669 !! input
5670 [[:Image:No such.jpg]]
5671 !! result
5672 <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>
5673 </p>
5674 !! end
5675
5676
5677
5678 !! test
5679 Character reference normalization in link text (bug 1938)
5680 !! input
5681 [[Main Page|this&that]]
5682 !! result
5683 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
5684 </p>
5685 !!end
5686
5687 !! article
5688 אַ
5689 !! text
5690 Test for unicode normalization
5691
5692 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
5693 !! endarticle
5694
5695 !! test
5696 (bug 19451) Links should refer to the normalized form.
5697 !! input
5698 [[&#xFB2E;]]
5699 [[&#x5d0;&#x5b7;]]
5700 [[&#x5d0;ַ]]
5701 [[א&#x5b7;]]
5702 [[אַ]]
5703 !! result
5704 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
5705 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
5706 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
5707 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
5708 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
5709 </p>
5710 !! end
5711
5712 !! test
5713 Empty attribute crash test (bug 2067)
5714 !! input
5715 <font color="">foo</font>
5716 !! result
5717 <p><font color="">foo</font>
5718 </p>
5719 !! end
5720
5721 !! test
5722 Empty attribute crash test single-quotes (bug 2067)
5723 !! input
5724 <font color=''>foo</font>
5725 !! result
5726 <p><font color="">foo</font>
5727 </p>
5728 !! end
5729
5730 !! test
5731 Attribute test: equals, then nothing
5732 !! input
5733 <font color=>foo</font>
5734 !! result
5735 <p><font>foo</font>
5736 </p>
5737 !! end
5738
5739 !! test
5740 Attribute test: unquoted value
5741 !! input
5742 <font color=x>foo</font>
5743 !! result
5744 <p><font color="x">foo</font>
5745 </p>
5746 !! end
5747
5748 !! test
5749 Attribute test: unquoted but illegal value (hash)
5750 !! input
5751 <font color=#x>foo</font>
5752 !! result
5753 <p><font color="#x">foo</font>
5754 </p>
5755 !! end
5756
5757 !! test
5758 Attribute test: no value
5759 !! input
5760 <font color>foo</font>
5761 !! result
5762 <p><font color="color">foo</font>
5763 </p>
5764 !! end
5765
5766 !! test
5767 Bug 2095: link with three closing brackets
5768 !! input
5769 [[Main Page]]]
5770 !! result
5771 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
5772 </p>
5773 !! end
5774
5775 !! test
5776 Bug 2095: link with pipe and three closing brackets
5777 !! input
5778 [[Main Page|link]]]
5779 !! result
5780 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
5781 </p>
5782 !! end
5783
5784 !! test
5785 Bug 2095: link with pipe and three closing brackets, version 2
5786 !! input
5787 [[Main Page|[http://example.com/]]]
5788 !! result
5789 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
5790 </p>
5791 !! end
5792
5793
5794 ###
5795 ### Safety
5796 ###
5797
5798 !! article
5799 Template:Dangerous attribute
5800 !! text
5801 " onmouseover="alert(document.cookie)
5802 !! endarticle
5803
5804 !! article
5805 Template:Dangerous style attribute
5806 !! text
5807 border-size: expression(alert(document.cookie))
5808 !! endarticle
5809
5810 !! article
5811 Template:Div style
5812 !! text
5813 <div style="float: right; {{{1}}}">Magic div</div>
5814 !! endarticle
5815
5816 !! test
5817 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
5818 !! input
5819 <div title="{{test}}"></div>
5820 !! result
5821 <div title="This is a test template"></div>
5822
5823 !! end
5824
5825 !! test
5826 Bug 2304: HTML attribute safety (dangerous template; 2309)
5827 !! input
5828 <div title="{{dangerous attribute}}"></div>
5829 !! result
5830 <div title=""></div>
5831
5832 !! end
5833
5834 !! test
5835 Bug 2304: HTML attribute safety (dangerous style template; 2309)
5836 !! input
5837 <div style="{{dangerous style attribute}}"></div>
5838 !! result
5839 <div style="/* insecure input */"></div>
5840
5841 !! end
5842
5843 !! test
5844 Bug 2304: HTML attribute safety (safe parameter; 2309)
5845 !! input
5846 {{div style|width: 200px}}
5847 !! result
5848 <div style="float: right; width: 200px">Magic div</div>
5849
5850 !! end
5851
5852 !! test
5853 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
5854 !! input
5855 {{div style|width: expression(alert(document.cookie))}}
5856 !! result
5857 <div style="/* insecure input */">Magic div</div>
5858
5859 !! end
5860
5861 !! test
5862 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
5863 !! input
5864 {{div style|"><script>alert(document.cookie)</script>}}
5865 !! result
5866 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
5867
5868 !! end
5869
5870 !! test
5871 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
5872 !! input
5873 {{div style|" ><script>alert(document.cookie)</script>}}
5874 !! result
5875 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
5876
5877 !! end
5878
5879 !! test
5880 Bug 2304: HTML attribute safety (link)
5881 !! input
5882 <div title="[[Main Page]]"></div>
5883 !! result
5884 <div title="&#91;&#91;Main Page]]"></div>
5885
5886 !! end
5887
5888 !! test
5889 Bug 2304: HTML attribute safety (italics)
5890 !! input
5891 <div title="''foobar''"></div>
5892 !! result
5893 <div title="&#39;&#39;foobar&#39;&#39;"></div>
5894
5895 !! end
5896
5897 !! test
5898 Bug 2304: HTML attribute safety (bold)
5899 !! input
5900 <div title="'''foobar'''"></div>
5901 !! result
5902 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
5903
5904 !! end
5905
5906
5907 !! test
5908 Bug 2304: HTML attribute safety (ISBN)
5909 !! input
5910 <div title="ISBN 1234567890"></div>
5911 !! result
5912 <div title="&#73;SBN 1234567890"></div>
5913
5914 !! end
5915
5916 !! test
5917 Bug 2304: HTML attribute safety (RFC)
5918 !! input
5919 <div title="RFC 1234"></div>
5920 !! result
5921 <div title="&#82;FC 1234"></div>
5922
5923 !! end
5924
5925 !! test
5926 Bug 2304: HTML attribute safety (PMID)
5927 !! input
5928 <div title="PMID 1234567890"></div>
5929 !! result
5930 <div title="&#80;MID 1234567890"></div>
5931
5932 !! end
5933
5934 !! test
5935 Bug 2304: HTML attribute safety (web link)
5936 !! input
5937 <div title="http://example.com/"></div>
5938 !! result
5939 <div title="http&#58;//example.com/"></div>
5940
5941 !! end
5942
5943 !! test
5944 Bug 2304: HTML attribute safety (named web link)
5945 !! input
5946 <div title="[http://example.com/ link]"></div>
5947 !! result
5948 <div title="&#91;http&#58;//example.com/ link]"></div>
5949
5950 !! end
5951
5952 !! test
5953 Bug 3244: HTML attribute safety (extension; safe)
5954 !! input
5955 <div style="<nowiki>background:blue</nowiki>"></div>
5956 !! result
5957 <div style="background:blue"></div>
5958
5959 !! end
5960
5961 !! test
5962 Bug 3244: HTML attribute safety (extension; unsafe)
5963 !! input
5964 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
5965 !! result
5966 <div style="/* insecure input */"></div>
5967
5968 !! end
5969
5970 # More MSIE fun discovered by Tom Gilder
5971
5972 !! test
5973 MSIE CSS safety test: spurious slash
5974 !! input
5975 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
5976 !! result
5977 <div style="/* insecure input */">evil</div>
5978
5979 !! end
5980
5981 !! test
5982 MSIE CSS safety test: hex code
5983 !! input
5984 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
5985 !! result
5986 <div style="/* insecure input */">evil</div>
5987
5988 !! end
5989
5990 !! test
5991 MSIE CSS safety test: comment in url
5992 !! input
5993 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
5994 !! result
5995 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
5996
5997 !! end
5998
5999 !! test
6000 MSIE CSS safety test: comment in expression
6001 !! input
6002 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
6003 !! result
6004 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
6005
6006 !! end
6007
6008
6009 !! test
6010 Table attribute legitimate extension
6011 !! input
6012 {|
6013 !+ style="<nowiki>color:blue</nowiki>"| status
6014 |}
6015 !! result
6016 <table>
6017 <tr>
6018 <th style="color:blue"> status
6019 </th></tr></table>
6020
6021 !!end
6022
6023 !! test
6024 Table attribute safety
6025 !! input
6026 {|
6027 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
6028 |}
6029 !! result
6030 <table>
6031 <tr>
6032 <th style="/* insecure input */"> status
6033 </th></tr></table>
6034
6035 !! end
6036
6037 !! test
6038 CSS line continuation 1
6039 !! input
6040 <div style="background-image: u\&#10;rl(test.jpg);"></div>
6041 !! result
6042 <div style="/* insecure input */"></div>
6043
6044 !! end
6045
6046 !! test
6047 CSS line continuation 2
6048 !! input
6049 <div style="background-image: u\&#13;rl(test.jpg); "></div>
6050 !! result
6051 <div style="/* insecure input */"></div>
6052
6053 !! end
6054
6055 !! article
6056 Template:Identity
6057 !! text
6058 {{{1}}}
6059 !! endarticle
6060
6061 !! test
6062 Expansion of multi-line templates in attribute values (bug 6255)
6063 !! input
6064 <div style="background: {{identity|#00FF00}}">-</div>
6065 !! result
6066 <div style="background: #00FF00">-</div>
6067
6068 !! end
6069
6070
6071 !! test
6072 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
6073 !! input
6074 <div style="background:
6075 #00FF00">-</div>
6076 !! result
6077 <div style="background: #00FF00">-</div>
6078
6079 !! end
6080
6081 !! test
6082 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
6083 !! input
6084 <div style="background: &#10;#00FF00">-</div>
6085 !! result
6086 <div style="background: &#10;#00FF00">-</div>
6087
6088 !! end
6089
6090 ###
6091 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
6092 ###
6093 !! test
6094 Parser hook: empty input
6095 !! input
6096 <tag></tag>
6097 !! result
6098 <pre>
6099 string(0) ""
6100 array(0) {
6101 }
6102 </pre>
6103
6104 !! end
6105
6106 !! test
6107 Parser hook: empty input using terminated empty elements
6108 !! input
6109 <tag/>
6110 !! result
6111 <pre>
6112 NULL
6113 array(0) {
6114 }
6115 </pre>
6116
6117 !! end
6118
6119 !! test
6120 Parser hook: empty input using terminated empty elements (space before)
6121 !! input
6122 <tag />
6123 !! result
6124 <pre>
6125 NULL
6126 array(0) {
6127 }
6128 </pre>
6129
6130 !! end
6131
6132 !! test
6133 Parser hook: basic input
6134 !! input
6135 <tag>input</tag>
6136 !! result
6137 <pre>
6138 string(5) "input"
6139 array(0) {
6140 }
6141 </pre>
6142
6143 !! end
6144
6145
6146 !! test
6147 Parser hook: case insensitive
6148 !! input
6149 <TAG>input</TAG>
6150 !! result
6151 <pre>
6152 string(5) "input"
6153 array(0) {
6154 }
6155 </pre>
6156
6157 !! end
6158
6159
6160 !! test
6161 Parser hook: case insensitive, redux
6162 !! input
6163 <TaG>input</TAg>
6164 !! result
6165 <pre>
6166 string(5) "input"
6167 array(0) {
6168 }
6169 </pre>
6170
6171 !! end
6172
6173 !! test
6174 Parser hook: nested tags
6175 !! options
6176 noxml
6177 !! input
6178 <tag><tag></tag></tag>
6179 !! result
6180 <pre>
6181 string(5) "<tag>"
6182 array(0) {
6183 }
6184 </pre>&lt;/tag&gt;
6185
6186 !! end
6187
6188 !! test
6189 Parser hook: basic arguments
6190 !! input
6191 <tag width=200 height = "100" depth = '50' square></tag>
6192 !! result
6193 <pre>
6194 string(0) ""
6195 array(4) {
6196 ["width"]=>
6197 string(3) "200"
6198 ["height"]=>
6199 string(3) "100"
6200 ["depth"]=>
6201 string(2) "50"
6202 ["square"]=>
6203 string(6) "square"
6204 }
6205 </pre>
6206
6207 !! end
6208
6209 !! test
6210 Parser hook: argument containing a forward slash (bug 5344)
6211 !! input
6212 <tag filename='/tmp/bla'></tag>
6213 !! result
6214 <pre>
6215 string(0) ""
6216 array(1) {
6217 ["filename"]=>
6218 string(8) "/tmp/bla"
6219 }
6220 </pre>
6221
6222 !! end
6223
6224 !! test
6225 Parser hook: empty input using terminated empty elements (bug 2374)
6226 !! input
6227 <tag foo=bar/>text
6228 !! result
6229 <pre>
6230 NULL
6231 array(1) {
6232 ["foo"]=>
6233 string(3) "bar"
6234 }
6235 </pre>text
6236
6237 !! end
6238
6239 # </tag> should be output literally since there is no matching tag that begins it
6240 !! test
6241 Parser hook: basic arguments using terminated empty elements (bug 2374)
6242 !! input
6243 <tag width=200 height = "100" depth = '50' square/>
6244 other stuff
6245 </tag>
6246 !! result
6247 <pre>
6248 NULL
6249 array(4) {
6250 ["width"]=>
6251 string(3) "200"
6252 ["height"]=>
6253 string(3) "100"
6254 ["depth"]=>
6255 string(2) "50"
6256 ["square"]=>
6257 string(6) "square"
6258 }
6259 </pre>
6260 <p>other stuff
6261 &lt;/tag&gt;
6262 </p>
6263 !! end
6264
6265 ###
6266 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
6267 ###
6268
6269 !! test
6270 Parser hook: static parser hook not inside a comment
6271 !! input
6272 <statictag>hello, world</statictag>
6273 <statictag action=flush/>
6274 !! result
6275 <p>hello, world
6276 </p>
6277 !! end
6278
6279
6280 !! test
6281 Parser hook: static parser hook inside a comment
6282 !! input
6283 <!-- <statictag>hello, world</statictag> -->
6284 <statictag action=flush/>
6285 !! result
6286 <p><br />
6287 </p>
6288 !! end
6289
6290 # Nested template calls; this case was broken by Parser.php rev 1.506,
6291 # since reverted.
6292
6293 !! article
6294 Template:One-parameter
6295 !! text
6296 (My parameter is: {{{1}}})
6297 !! endarticle
6298
6299 !! article
6300 Template:Map-one-parameter
6301 !! text
6302 {{{{{1}}}|{{{2}}}}}
6303 !! endarticle
6304
6305 !! test
6306 Nested template calls
6307 !! input
6308 {{Map-one-parameter|One-parameter|param}}
6309 !! result
6310 <p>(My parameter is: param)
6311 </p>
6312 !! end
6313
6314
6315 ###
6316 ### Sanitizer
6317 ###
6318 !! test
6319 Sanitizer: Closing of open tags
6320 !! input
6321 <s></s><table></table>
6322 !! result
6323 <s></s><table></table>
6324
6325 !! end
6326
6327 !! test
6328 Sanitizer: Closing of open but not closed tags
6329 !! input
6330 <s>foo
6331 !! result
6332 <p><s>foo</s>
6333 </p>
6334 !! end
6335
6336 !! test
6337 Sanitizer: Closing of closed but not open tags
6338 !! input
6339 </s>
6340 !! result
6341 <p>&lt;/s&gt;
6342 </p>
6343 !! end
6344
6345 !! test
6346 Sanitizer: Closing of closed but not open table tags
6347 !! input
6348 Table not started</td></tr></table>
6349 !! result
6350 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
6351 </p>
6352 !! end
6353
6354 !! test
6355 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
6356 !! input
6357 <span id="æ: v">byte</span>[[#æ: v|backlink]]
6358 !! result
6359 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
6360 </p>
6361 !! end
6362
6363 !! test
6364 Sanitizer: Validating the contents of the id attribute (bug 4515)
6365 !! options
6366 disabled
6367 !! input
6368 <br id=9 />
6369 !! result
6370 Something, but definitely not <br id="9" />...
6371 !! end
6372
6373 !! test
6374 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
6375 !! options
6376 disabled
6377 !! input
6378 <br id="foo" /><br id="foo" />
6379 !! result
6380 Something need to be done. foo-2 ?
6381 !! end
6382
6383 !! test
6384 Language converter: output gets cut off unexpectedly (bug 5757)
6385 !! options
6386 language=zh
6387 !! input
6388 this bit is safe: }-
6389
6390 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
6391
6392 then we get cut off here: }-
6393
6394 all additional text is vanished
6395 !! result
6396 <p>this bit is safe: }-
6397 </p><p>but if we add a conversion instance: xxx
6398 </p><p>then we get cut off here: }-
6399 </p><p>all additional text is vanished
6400 </p>
6401 !! end
6402
6403 !! test
6404 Self closed html pairs (bug 5487)
6405 !! options
6406 !! input
6407 <center><font id="bug" />Centered text</center>
6408 <div><font id="bug2" />In div text</div>
6409 !! result
6410 <center>&lt;font id="bug" /&gt;Centered text</center>
6411 <div>&lt;font id="bug2" /&gt;In div text</div>
6412
6413 !! end
6414
6415 #
6416 #
6417 #
6418
6419 !! test
6420 Punctuation: nbsp before exclamation
6421 !! input
6422 C'est grave !
6423 !! result
6424 <p>C'est grave&#160;!
6425 </p>
6426 !! end
6427
6428 !! test
6429 Punctuation: CSS !important (bug 11874)
6430 !! input
6431 <div style="width:50% !important">important</div>
6432 !! result
6433 <div style="width:50% !important">important</div>
6434
6435 !!end
6436
6437 !! test
6438 Punctuation: CSS ! important (bug 11874; with space after)
6439 !! input
6440 <div style="width:50% ! important">important</div>
6441 !! result
6442 <div style="width:50% ! important">important</div>
6443
6444 !!end
6445
6446
6447 !! test
6448 HTML bullet list, closed tags (bug 5497)
6449 !! input
6450 <ul>
6451 <li>One</li>
6452 <li>Two</li>
6453 </ul>
6454 !! result
6455 <ul>
6456 <li>One</li>
6457 <li>Two</li>
6458 </ul>
6459
6460 !! end
6461
6462 !! test
6463 HTML bullet list, unclosed tags (bug 5497)
6464 !! options
6465 disabled
6466 !! input
6467 <ul>
6468 <li>One
6469 <li>Two
6470 </ul>
6471 !! result
6472 <ul>
6473 <li>One
6474 </li><li>Two
6475 </li></ul>
6476
6477 !! end
6478
6479 !! test
6480 HTML ordered list, closed tags (bug 5497)
6481 !! input
6482 <ol>
6483 <li>One</li>
6484 <li>Two</li>
6485 </ol>
6486 !! result
6487 <ol>
6488 <li>One</li>
6489 <li>Two</li>
6490 </ol>
6491
6492 !! end
6493
6494 !! test
6495 HTML ordered list, unclosed tags (bug 5497)
6496 !! options
6497 disabled
6498 !! input
6499 <ol>
6500 <li>One
6501 <li>Two
6502 </ol>
6503 !! result
6504 <ol>
6505 <li>One
6506 </li><li>Two
6507 </li></ol>
6508
6509 !! end
6510
6511 !! test
6512 HTML nested bullet list, closed tags (bug 5497)
6513 !! input
6514 <ul>
6515 <li>One</li>
6516 <li>Two:
6517 <ul>
6518 <li>Sub-one</li>
6519 <li>Sub-two</li>
6520 </ul>
6521 </li>
6522 </ul>
6523 !! result
6524 <ul>
6525 <li>One</li>
6526 <li>Two:
6527 <ul>
6528 <li>Sub-one</li>
6529 <li>Sub-two</li>
6530 </ul>
6531 </li>
6532 </ul>
6533
6534 !! end
6535
6536 !! test
6537 HTML nested bullet list, open tags (bug 5497)
6538 !! options
6539 disabled
6540 !! input
6541 <ul>
6542 <li>One
6543 <li>Two:
6544 <ul>
6545 <li>Sub-one
6546 <li>Sub-two
6547 </ul>
6548 </ul>
6549 !! result
6550 <ul>
6551 <li>One
6552 </li><li>Two:
6553 <ul>
6554 <li>Sub-one
6555 </li><li>Sub-two
6556 </li></ul>
6557 </li></ul>
6558
6559 !! end
6560
6561 !! test
6562 HTML nested ordered list, closed tags (bug 5497)
6563 !! input
6564 <ol>
6565 <li>One</li>
6566 <li>Two:
6567 <ol>
6568 <li>Sub-one</li>
6569 <li>Sub-two</li>
6570 </ol>
6571 </li>
6572 </ol>
6573 !! result
6574 <ol>
6575 <li>One</li>
6576 <li>Two:
6577 <ol>
6578 <li>Sub-one</li>
6579 <li>Sub-two</li>
6580 </ol>
6581 </li>
6582 </ol>
6583
6584 !! end
6585
6586 !! test
6587 HTML nested ordered list, open tags (bug 5497)
6588 !! options
6589 disabled
6590 !! input
6591 <ol>
6592 <li>One
6593 <li>Two:
6594 <ol>
6595 <li>Sub-one
6596 <li>Sub-two
6597 </ol>
6598 </ol>
6599 !! result
6600 <ol>
6601 <li>One
6602 </li><li>Two:
6603 <ol>
6604 <li>Sub-one
6605 </li><li>Sub-two
6606 </li></ol>
6607 </li></ol>
6608
6609 !! end
6610
6611 !! test
6612 HTML ordered list item with parameters oddity
6613 !! input
6614 <ol><li id="fragment">One</li></ol>
6615 !! result
6616 <ol><li id="fragment">One</li></ol>
6617
6618 !! end
6619
6620 !!test
6621 bug 5918: autonumbering
6622 !! input
6623 [http://first/] [http://second] [ftp://ftp]
6624
6625 ftp://inlineftp
6626
6627 [mailto:enclosed@mail.tld With target]
6628
6629 [mailto:enclosed@mail.tld]
6630
6631 mailto:inline@mail.tld
6632 !! result
6633 <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>
6634 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
6635 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
6636 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
6637 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
6638 </p>
6639 !! end
6640
6641
6642 #
6643 # Security and HTML correctness
6644 # From Nick Jenkins' fuzz testing
6645 #
6646
6647 !! test
6648 Fuzz testing: Parser13
6649 !! input
6650 {|
6651 | http://a|
6652 !! result
6653 <table>
6654 <tr>
6655 <td>
6656 </td>
6657 </tr>
6658 </table>
6659
6660 !! end
6661
6662 !! test
6663 Fuzz testing: Parser14
6664 !! input
6665 == onmouseover= ==
6666 http://__TOC__
6667 !! result
6668 <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>
6669 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6670 <ul>
6671 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
6672 </ul>
6673 </td></tr></table>
6674
6675 !! end
6676
6677 !! test
6678 Fuzz testing: Parser14-table
6679 !! input
6680 ==a==
6681 {| STYLE=__TOC__
6682 !! result
6683 <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>
6684 <table style="&#95;_TOC&#95;_">
6685 <tr><td></td></tr>
6686 </table>
6687
6688 !! end
6689
6690 # Known to produce bogus xml (extra </td>)
6691 !! test
6692 Fuzz testing: Parser16
6693 !! options
6694 noxml
6695 !! input
6696 {|
6697 !https://||||||
6698 !! result
6699 <table>
6700 <tr>
6701 <th>https://</th>
6702 <th></th>
6703 <th></th>
6704 <th>
6705 </td>
6706 </tr>
6707 </table>
6708
6709 !! end
6710
6711 !! test
6712 Fuzz testing: Parser21
6713 !! input
6714 {|
6715 ! irc://{{ftp://a" onmouseover="alert('hello world');"
6716 |
6717 !! result
6718 <table>
6719 <tr>
6720 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
6721 </th>
6722 <td>
6723 </td>
6724 </tr>
6725 </table>
6726
6727 !! end
6728
6729 !! test
6730 Fuzz testing: Parser22
6731 !! input
6732 http://===r:::https://b
6733
6734 {|
6735 !!result
6736 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
6737 </p>
6738 <table>
6739 <tr><td></td></tr>
6740 </table>
6741
6742 !! end
6743
6744 # Known to produce bad XML for now
6745 !! test
6746 Fuzz testing: Parser24
6747 !! options
6748 noxml
6749 !! input
6750 {|
6751 {{{|
6752 <u CLASS=
6753 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
6754 <br style="onmouseover='alert(document.cookie);' " />
6755
6756 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6757 |
6758 !! result
6759 <table>
6760 {{{|
6761 <u class="&#124;">}}}} &gt;
6762 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
6763
6764 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6765 <tr>
6766 <td></u>
6767 </td>
6768 </tr>
6769 </table>
6770
6771 !! end
6772
6773 # Note: the current result listed for this is not what the original one was,
6774 # but the original bug was JavaScript injection, which is fixed in any case.
6775 # It's not clear that the original result listed was any more correct than the
6776 # current one. Original result:
6777 # <p>{{{|
6778 # </p>
6779 # <li class="&#124;&#124;">
6780 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
6781 !!test
6782 Fuzz testing: Parser25 (bug 6055)
6783 !! input
6784 {{{
6785 |
6786 <LI CLASS=||
6787 >
6788 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
6789 !! result
6790 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
6791 </p>
6792 !! end
6793
6794 !!test
6795 Fuzz testing: URL adjacent extension (with space, clean)
6796 !! options
6797 !! input
6798 http://example.com <nowiki>junk</nowiki>
6799 !! result
6800 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
6801 </p>
6802 !!end
6803
6804 !!test
6805 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
6806 !! options
6807 !! input
6808 http://example.com<nowiki>junk</nowiki>
6809 !! result
6810 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
6811 </p>
6812 !!end
6813
6814 !!test
6815 Fuzz testing: URL adjacent extension (no space, dirty; pre)
6816 !! options
6817 !! input
6818 http://example.com<pre>junk</pre>
6819 !! result
6820 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
6821
6822 !!end
6823
6824 !!test
6825 Fuzz testing: image with bogus manual thumbnail
6826 !!input
6827 [[Image:foobar.jpg|thumbnail= ]]
6828 !!result
6829 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
6830
6831 !!end
6832
6833 !! test
6834 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
6835 !! input
6836 <pre dir="&#10;"></pre>
6837 !! result
6838 <pre dir="&#10;"></pre>
6839
6840 !! end
6841
6842 !! test
6843 Parsing optional HTML elements (Bug 6171)
6844 !! options
6845 !! input
6846 <table>
6847 <tr>
6848 <td> Some tabular data</td>
6849 <td> More tabular data ...
6850 <td> And yet som tabular data</td>
6851 </tr>
6852 </table>
6853 !! result
6854 <table>
6855 <tr>
6856 <td> Some tabular data</td>
6857 <td> More tabular data ...
6858 </td><td> And yet som tabular data</td>
6859 </tr>
6860 </table>
6861
6862 !! end
6863
6864 !! test
6865 Correct handling of <td>, <tr> (Bug 6171)
6866 !! options
6867 !! input
6868 <table>
6869 <tr>
6870 <td> Some tabular data</td>
6871 <td> More tabular data ...</td>
6872 <td> And yet som tabular data</td>
6873 </tr>
6874 </table>
6875 !! result
6876 <table>
6877 <tr>
6878 <td> Some tabular data</td>
6879 <td> More tabular data ...</td>
6880 <td> And yet som tabular data</td>
6881 </tr>
6882 </table>
6883
6884 !! end
6885
6886
6887 !! test
6888 Parsing crashing regression (fr:JavaScript)
6889 !! input
6890 </body></x>
6891 !! result
6892 <p>&lt;/body&gt;&lt;/x&gt;
6893 </p>
6894 !! end
6895
6896 !! test
6897 Inline wiki vs wiki block nesting
6898 !! input
6899 '''Bold paragraph
6900
6901 New wiki paragraph
6902 !! result
6903 <p><b>Bold paragraph</b>
6904 </p><p>New wiki paragraph
6905 </p>
6906 !! end
6907
6908 !! test
6909 Inline HTML vs wiki block nesting
6910 !! options
6911 disabled
6912 !! input
6913 <b>Bold paragraph
6914
6915 New wiki paragraph
6916 !! result
6917 <p><b>Bold paragraph</b>
6918 </p><p>New wiki paragraph
6919 </p>
6920 !! end
6921
6922 # Original result was this:
6923 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
6924 # </p>
6925 # While that might be marginally more intuitive, maybe, the six-apostrophe
6926 # construct is clearly pathological and the result stated here (which is what
6927 # the parser actually does) is about as reasonable as anything.
6928 !!test
6929 Mixing markup for italics and bold
6930 !! options
6931 !! input
6932 '''bold''''''bold''bolditalics'''''
6933 !! result
6934 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
6935 </p>
6936 !! end
6937
6938
6939 !! article
6940 Xyzzyx
6941 !! text
6942 Article for special page transclusion test
6943 !! endarticle
6944
6945 !! test
6946 Special page transclusion
6947 !! options
6948 !! input
6949 {{Special:Prefixindex/Xyzzyx}}
6950 !! result
6951 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6952
6953 !! end
6954
6955 !! test
6956 Special page transclusion twice (bug 5021)
6957 !! options
6958 !! input
6959 {{Special:Prefixindex/Xyzzyx}}
6960 {{Special:Prefixindex/Xyzzyx}}
6961 !! result
6962 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6963 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6964
6965 !! end
6966
6967 !! test
6968 Transclusion of default MediaWiki message
6969 !! input
6970 {{MediaWiki:Mainpage}}
6971 !!result
6972 <p>Main Page
6973 </p>
6974 !! end
6975
6976 !! test
6977 Transclusion of nonexistent MediaWiki message
6978 !! input
6979 {{MediaWiki:Mainpagexxx}}
6980 !!result
6981 <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>
6982 </p>
6983 !! end
6984
6985 !! test
6986 Transclusion of MediaWiki message with underscore
6987 !! input
6988 {{MediaWiki:history_short}}
6989 !! result
6990 <p>History
6991 </p>
6992 !! end
6993
6994 !! test
6995 Transclusion of MediaWiki message with space
6996 !! input
6997 {{MediaWiki:history short}}
6998 !! result
6999 <p>History
7000 </p>
7001 !! end
7002
7003 !! test
7004 Invalid header with following text
7005 !! input
7006 = x = y
7007 !! result
7008 <p>= x = y
7009 </p>
7010 !! end
7011
7012
7013 !! test
7014 Section extraction test (section 0)
7015 !! options
7016 section=0
7017 !! input
7018 start
7019 ==a==
7020 ===aa===
7021 ====aaa====
7022 ==b==
7023 ===ba===
7024 ===bb===
7025 ====bba====
7026 ===bc===
7027 ==c==
7028 ===ca===
7029 !! result
7030 start
7031 !! end
7032
7033 !! test
7034 Section extraction test (section 1)
7035 !! options
7036 section=1
7037 !! input
7038 start
7039 ==a==
7040 ===aa===
7041 ====aaa====
7042 ==b==
7043 ===ba===
7044 ===bb===
7045 ====bba====
7046 ===bc===
7047 ==c==
7048 ===ca===
7049 !! result
7050 ==a==
7051 ===aa===
7052 ====aaa====
7053 !! end
7054
7055 !! test
7056 Section extraction test (section 2)
7057 !! options
7058 section=2
7059 !! input
7060 start
7061 ==a==
7062 ===aa===
7063 ====aaa====
7064 ==b==
7065 ===ba===
7066 ===bb===
7067 ====bba====
7068 ===bc===
7069 ==c==
7070 ===ca===
7071 !! result
7072 ===aa===
7073 ====aaa====
7074 !! end
7075
7076 !! test
7077 Section extraction test (section 3)
7078 !! options
7079 section=3
7080 !! input
7081 start
7082 ==a==
7083 ===aa===
7084 ====aaa====
7085 ==b==
7086 ===ba===
7087 ===bb===
7088 ====bba====
7089 ===bc===
7090 ==c==
7091 ===ca===
7092 !! result
7093 ====aaa====
7094 !! end
7095
7096 !! test
7097 Section extraction test (section 4)
7098 !! options
7099 section=4
7100 !! input
7101 start
7102 ==a==
7103 ===aa===
7104 ====aaa====
7105 ==b==
7106 ===ba===
7107 ===bb===
7108 ====bba====
7109 ===bc===
7110 ==c==
7111 ===ca===
7112 !! result
7113 ==b==
7114 ===ba===
7115 ===bb===
7116 ====bba====
7117 ===bc===
7118 !! end
7119
7120 !! test
7121 Section extraction test (section 5)
7122 !! options
7123 section=5
7124 !! input
7125 start
7126 ==a==
7127 ===aa===
7128 ====aaa====
7129 ==b==
7130 ===ba===
7131 ===bb===
7132 ====bba====
7133 ===bc===
7134 ==c==
7135 ===ca===
7136 !! result
7137 ===ba===
7138 !! end
7139
7140 !! test
7141 Section extraction test (section 6)
7142 !! options
7143 section=6
7144 !! input
7145 start
7146 ==a==
7147 ===aa===
7148 ====aaa====
7149 ==b==
7150 ===ba===
7151 ===bb===
7152 ====bba====
7153 ===bc===
7154 ==c==
7155 ===ca===
7156 !! result
7157 ===bb===
7158 ====bba====
7159 !! end
7160
7161 !! test
7162 Section extraction test (section 7)
7163 !! options
7164 section=7
7165 !! input
7166 start
7167 ==a==
7168 ===aa===
7169 ====aaa====
7170 ==b==
7171 ===ba===
7172 ===bb===
7173 ====bba====
7174 ===bc===
7175 ==c==
7176 ===ca===
7177 !! result
7178 ====bba====
7179 !! end
7180
7181 !! test
7182 Section extraction test (section 8)
7183 !! options
7184 section=8
7185 !! input
7186 start
7187 ==a==
7188 ===aa===
7189 ====aaa====
7190 ==b==
7191 ===ba===
7192 ===bb===
7193 ====bba====
7194 ===bc===
7195 ==c==
7196 ===ca===
7197 !! result
7198 ===bc===
7199 !! end
7200
7201 !! test
7202 Section extraction test (section 9)
7203 !! options
7204 section=9
7205 !! input
7206 start
7207 ==a==
7208 ===aa===
7209 ====aaa====
7210 ==b==
7211 ===ba===
7212 ===bb===
7213 ====bba====
7214 ===bc===
7215 ==c==
7216 ===ca===
7217 !! result
7218 ==c==
7219 ===ca===
7220 !! end
7221
7222 !! test
7223 Section extraction test (section 10)
7224 !! options
7225 section=10
7226 !! input
7227 start
7228 ==a==
7229 ===aa===
7230 ====aaa====
7231 ==b==
7232 ===ba===
7233 ===bb===
7234 ====bba====
7235 ===bc===
7236 ==c==
7237 ===ca===
7238 !! result
7239 ===ca===
7240 !! end
7241
7242 !! test
7243 Section extraction test (nonexistent section 11)
7244 !! options
7245 section=11
7246 !! input
7247 start
7248 ==a==
7249 ===aa===
7250 ====aaa====
7251 ==b==
7252 ===ba===
7253 ===bb===
7254 ====bba====
7255 ===bc===
7256 ==c==
7257 ===ca===
7258 !! result
7259 !! end
7260
7261 !! test
7262 Section extraction test with bogus heading (section 1)
7263 !! options
7264 section=1
7265 !! input
7266 ==a==
7267 ==bogus== not a legal section
7268 ==b==
7269 !! result
7270 ==a==
7271 ==bogus== not a legal section
7272 !! end
7273
7274 !! test
7275 Section extraction test with bogus heading (section 2)
7276 !! options
7277 section=2
7278 !! input
7279 ==a==
7280 ==bogus== not a legal section
7281 ==b==
7282 !! result
7283 ==b==
7284 !! end
7285
7286 !! test
7287 Section extraction test with comment after heading (section 1)
7288 !! options
7289 section=1
7290 !! input
7291 ==a==
7292 ==b== <!-- -->
7293 ==c==
7294 !! result
7295 ==a==
7296 !! end
7297
7298 !! test
7299 Section extraction test with comment after heading (section 2)
7300 !! options
7301 section=2
7302 !! input
7303 ==a==
7304 ==b== <!-- -->
7305 ==c==
7306 !! result
7307 ==b== <!-- -->
7308 !! end
7309
7310 !! test
7311 Section extraction test with bogus <nowiki> heading (section 1)
7312 !! options
7313 section=1
7314 !! input
7315 ==a==
7316 ==bogus== <nowiki>not a legal section</nowiki>
7317 ==b==
7318 !! result
7319 ==a==
7320 ==bogus== <nowiki>not a legal section</nowiki>
7321 !! end
7322
7323 !! test
7324 Section extraction test with bogus <nowiki> heading (section 2)
7325 !! options
7326 section=2
7327 !! input
7328 ==a==
7329 ==bogus== <nowiki>not a legal section</nowiki>
7330 ==b==
7331 !! result
7332 ==b==
7333 !! end
7334
7335
7336 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
7337 # instead of respecting commented sections
7338 !! test
7339 Section extraction prefixed by comment (section 1)
7340 !! options
7341 section=1
7342 !! input
7343 <!-- -->==sec1==
7344 ==sec2==
7345 !!result
7346 ==sec2==
7347 !!end
7348
7349 !! test
7350 Section extraction prefixed by comment (section 2)
7351 !! options
7352 section=2
7353 !! input
7354 <!-- -->==sec1==
7355 ==sec2==
7356 !!result
7357
7358 !!end
7359
7360
7361 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
7362 # instead of respecting HTML-style headings
7363 !! test
7364 Section extraction, mixed wiki and html (section 1)
7365 !! options
7366 section=1
7367 !! input
7368 <h2>unmarked</h2>
7369 unmarked
7370 ==1==
7371 one
7372 ==2==
7373 two
7374 !! result
7375 ==1==
7376 one
7377 !! end
7378
7379 !! test
7380 Section extraction, mixed wiki and html (section 2)
7381 !! options
7382 section=2
7383 !! input
7384 <h2>unmarked</h2>
7385 unmarked
7386 ==1==
7387 one
7388 ==2==
7389 two
7390 !! result
7391 ==2==
7392 two
7393 !! end
7394
7395
7396 # Formerly testing for bug 3342
7397 !! test
7398 Section extraction, heading surrounded by <noinclude>
7399 !! options
7400 section=1
7401 !! input
7402 <noinclude>==unmarked==</noinclude>
7403 ==marked==
7404 !! result
7405 ==marked==
7406 !!end
7407
7408 # Test behaviour of bug 19910
7409 !! test
7410 Sectiion with all-equals
7411 !! options
7412 section=2
7413 !! input
7414 ===
7415 The line above must have a trailing space
7416 === <!--
7417 --> <!-- -->
7418 But just in case it doesn't...
7419 !! result
7420 === <!--
7421 --> <!-- -->
7422 But just in case it doesn't...
7423 !! end
7424
7425 !! test
7426 Section replacement test (section 0)
7427 !! options
7428 replace=0,"xxx"
7429 !! input
7430 start
7431 ==a==
7432 ===aa===
7433 ====aaa====
7434 ==b==
7435 ===ba===
7436 ===bb===
7437 ====bba====
7438 ===bc===
7439 ==c==
7440 ===ca===
7441 !! result
7442 xxx
7443
7444 ==a==
7445 ===aa===
7446 ====aaa====
7447 ==b==
7448 ===ba===
7449 ===bb===
7450 ====bba====
7451 ===bc===
7452 ==c==
7453 ===ca===
7454 !! end
7455
7456 !! test
7457 Section replacement test (section 1)
7458 !! options
7459 replace=1,"xxx"
7460 !! input
7461 start
7462 ==a==
7463 ===aa===
7464 ====aaa====
7465 ==b==
7466 ===ba===
7467 ===bb===
7468 ====bba====
7469 ===bc===
7470 ==c==
7471 ===ca===
7472 !! result
7473 start
7474 xxx
7475
7476 ==b==
7477 ===ba===
7478 ===bb===
7479 ====bba====
7480 ===bc===
7481 ==c==
7482 ===ca===
7483 !! end
7484
7485 !! test
7486 Section replacement test (section 2)
7487 !! options
7488 replace=2,"xxx"
7489 !! input
7490 start
7491 ==a==
7492 ===aa===
7493 ====aaa====
7494 ==b==
7495 ===ba===
7496 ===bb===
7497 ====bba====
7498 ===bc===
7499 ==c==
7500 ===ca===
7501 !! result
7502 start
7503 ==a==
7504 xxx
7505
7506 ==b==
7507 ===ba===
7508 ===bb===
7509 ====bba====
7510 ===bc===
7511 ==c==
7512 ===ca===
7513 !! end
7514
7515 !! test
7516 Section replacement test (section 3)
7517 !! options
7518 replace=3,"xxx"
7519 !! input
7520 start
7521 ==a==
7522 ===aa===
7523 ====aaa====
7524 ==b==
7525 ===ba===
7526 ===bb===
7527 ====bba====
7528 ===bc===
7529 ==c==
7530 ===ca===
7531 !! result
7532 start
7533 ==a==
7534 ===aa===
7535 xxx
7536
7537 ==b==
7538 ===ba===
7539 ===bb===
7540 ====bba====
7541 ===bc===
7542 ==c==
7543 ===ca===
7544 !! end
7545
7546 !! test
7547 Section replacement test (section 4)
7548 !! options
7549 replace=4,"xxx"
7550 !! input
7551 start
7552 ==a==
7553 ===aa===
7554 ====aaa====
7555 ==b==
7556 ===ba===
7557 ===bb===
7558 ====bba====
7559 ===bc===
7560 ==c==
7561 ===ca===
7562 !! result
7563 start
7564 ==a==
7565 ===aa===
7566 ====aaa====
7567 xxx
7568
7569 ==c==
7570 ===ca===
7571 !! end
7572
7573 !! test
7574 Section replacement test (section 5)
7575 !! options
7576 replace=5,"xxx"
7577 !! input
7578 start
7579 ==a==
7580 ===aa===
7581 ====aaa====
7582 ==b==
7583 ===ba===
7584 ===bb===
7585 ====bba====
7586 ===bc===
7587 ==c==
7588 ===ca===
7589 !! result
7590 start
7591 ==a==
7592 ===aa===
7593 ====aaa====
7594 ==b==
7595 xxx
7596
7597 ===bb===
7598 ====bba====
7599 ===bc===
7600 ==c==
7601 ===ca===
7602 !! end
7603
7604 !! test
7605 Section replacement test (section 6)
7606 !! options
7607 replace=6,"xxx"
7608 !! input
7609 start
7610 ==a==
7611 ===aa===
7612 ====aaa====
7613 ==b==
7614 ===ba===
7615 ===bb===
7616 ====bba====
7617 ===bc===
7618 ==c==
7619 ===ca===
7620 !! result
7621 start
7622 ==a==
7623 ===aa===
7624 ====aaa====
7625 ==b==
7626 ===ba===
7627 xxx
7628
7629 ===bc===
7630 ==c==
7631 ===ca===
7632 !! end
7633
7634 !! test
7635 Section replacement test (section 7)
7636 !! options
7637 replace=7,"xxx"
7638 !! input
7639 start
7640 ==a==
7641 ===aa===
7642 ====aaa====
7643 ==b==
7644 ===ba===
7645 ===bb===
7646 ====bba====
7647 ===bc===
7648 ==c==
7649 ===ca===
7650 !! result
7651 start
7652 ==a==
7653 ===aa===
7654 ====aaa====
7655 ==b==
7656 ===ba===
7657 ===bb===
7658 xxx
7659
7660 ===bc===
7661 ==c==
7662 ===ca===
7663 !! end
7664
7665 !! test
7666 Section replacement test (section 8)
7667 !! options
7668 replace=8,"xxx"
7669 !! input
7670 start
7671 ==a==
7672 ===aa===
7673 ====aaa====
7674 ==b==
7675 ===ba===
7676 ===bb===
7677 ====bba====
7678 ===bc===
7679 ==c==
7680 ===ca===
7681 !! result
7682 start
7683 ==a==
7684 ===aa===
7685 ====aaa====
7686 ==b==
7687 ===ba===
7688 ===bb===
7689 ====bba====
7690 xxx
7691
7692 ==c==
7693 ===ca===
7694 !!end
7695
7696 !! test
7697 Section replacement test (section 9)
7698 !! options
7699 replace=9,"xxx"
7700 !! input
7701 start
7702 ==a==
7703 ===aa===
7704 ====aaa====
7705 ==b==
7706 ===ba===
7707 ===bb===
7708 ====bba====
7709 ===bc===
7710 ==c==
7711 ===ca===
7712 !! result
7713 start
7714 ==a==
7715 ===aa===
7716 ====aaa====
7717 ==b==
7718 ===ba===
7719 ===bb===
7720 ====bba====
7721 ===bc===
7722 xxx
7723 !! end
7724
7725 !! test
7726 Section replacement test (section 10)
7727 !! options
7728 replace=10,"xxx"
7729 !! input
7730 start
7731 ==a==
7732 ===aa===
7733 ====aaa====
7734 ==b==
7735 ===ba===
7736 ===bb===
7737 ====bba====
7738 ===bc===
7739 ==c==
7740 ===ca===
7741 !! result
7742 start
7743 ==a==
7744 ===aa===
7745 ====aaa====
7746 ==b==
7747 ===ba===
7748 ===bb===
7749 ====bba====
7750 ===bc===
7751 ==c==
7752 xxx
7753 !! end
7754
7755 !! test
7756 Section replacement test with initial whitespace (bug 13728)
7757 !! options
7758 replace=2,"xxx"
7759 !! input
7760 Preformatted initial line
7761 ==a==
7762 ===a===
7763 !! result
7764 Preformatted initial line
7765 ==a==
7766 xxx
7767 !! end
7768
7769
7770 !! test
7771 Section extraction, heading followed by pre with 20 spaces (bug 6398)
7772 !! options
7773 section=1
7774 !! input
7775 ==a==
7776 a
7777 !! result
7778 ==a==
7779 a
7780 !! end
7781
7782 !! test
7783 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
7784 !! options
7785 section=1
7786 !! input
7787 ==a==
7788 a
7789 !! result
7790 ==a==
7791 a
7792 !! end
7793
7794
7795 !! test
7796 Section extraction, <pre> around bogus header (bug 10309)
7797 !! options
7798 noxml section=2
7799 !! input
7800 == Section One ==
7801 <pre>
7802 =======
7803 </pre>
7804
7805 == Section Two ==
7806 stuff
7807 !! result
7808 == Section Two ==
7809 stuff
7810 !! end
7811
7812 !! test
7813 Section replacement, <pre> around bogus header (bug 10309)
7814 !! options
7815 noxml replace=2,"xxx"
7816 !! input
7817 == Section One ==
7818 <pre>
7819 =======
7820 </pre>
7821
7822 == Section Two ==
7823 stuff
7824 !! result
7825 == Section One ==
7826 <pre>
7827 =======
7828 </pre>
7829
7830 xxx
7831 !! end
7832
7833
7834
7835 !! test
7836 Handling of &#x0A; in URLs
7837 !! input
7838 **irc://&#x0A;a
7839 !! result
7840 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
7841 </li></ul>
7842 </li></ul>
7843
7844 !!end
7845
7846 !! test
7847 5 quotes, code coverage +1 line
7848 !! input
7849 '''''
7850 !! result
7851 !! end
7852
7853 !! test
7854 Special:Search page linking.
7855 !! input
7856 {{Special:search}}
7857 !! result
7858 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
7859 </p>
7860 !! end
7861
7862 !! test
7863 Say the magic word
7864 !! input
7865 * {{PAGENAME}}
7866 * {{BASEPAGENAME}}
7867 * {{SUBPAGENAME}}
7868 * {{SUBPAGENAMEE}}
7869 * {{BASEPAGENAME}}
7870 * {{BASEPAGENAMEE}}
7871 * {{TALKPAGENAME}}
7872 * {{TALKPAGENAMEE}}
7873 * {{SUBJECTPAGENAME}}
7874 * {{SUBJECTPAGENAMEE}}
7875 * {{NAMESPACEE}}
7876 * {{NAMESPACE}}
7877 * {{TALKSPACE}}
7878 * {{TALKSPACEE}}
7879 * {{SUBJECTSPACE}}
7880 * {{SUBJECTSPACEE}}
7881 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
7882 !! result
7883 <ul><li> Parser test
7884 </li><li> Parser test
7885 </li><li> Parser test
7886 </li><li> Parser_test
7887 </li><li> Parser test
7888 </li><li> Parser_test
7889 </li><li> Talk:Parser test
7890 </li><li> Talk:Parser_test
7891 </li><li> Parser test
7892 </li><li> Parser_test
7893 </li><li>
7894 </li><li>
7895 </li><li> Talk
7896 </li><li> Talk
7897 </li><li>
7898 </li><li>
7899 </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>
7900 </li></ul>
7901
7902 !! end
7903 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
7904
7905 !! test
7906 Gallery
7907 !! input
7908 <gallery>
7909 image1.png |
7910 image2.gif|||||
7911
7912 image3|
7913 image4 |300px| centre
7914 image5.svg| http://///////
7915 [[x|xx]]]]
7916 * image6
7917 </gallery>
7918 !! result
7919 <ul class="gallery">
7920 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7921 <div style="height: 150px;">Image1.png</div>
7922 <div class="gallerytext">
7923 </div>
7924 </div></li>
7925 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7926 <div style="height: 150px;">Image2.gif</div>
7927 <div class="gallerytext">
7928 <p>||||
7929 </p>
7930 </div>
7931 </div></li>
7932 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7933 <div style="height: 150px;">Image3</div>
7934 <div class="gallerytext">
7935 </div>
7936 </div></li>
7937 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7938 <div style="height: 150px;">Image4</div>
7939 <div class="gallerytext">
7940 <p>300px| centre
7941 </p>
7942 </div>
7943 </div></li>
7944 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7945 <div style="height: 150px;">Image5.svg</div>
7946 <div class="gallerytext">
7947 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
7948 </p>
7949 </div>
7950 </div></li>
7951 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7952 <div style="height: 150px;">* image6</div>
7953 <div class="gallerytext">
7954 </div>
7955 </div></li>
7956 </ul>
7957
7958 !! end
7959
7960 !! test
7961 Gallery (with options)
7962 !! input
7963 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
7964 File:Nonexistant.jpg|caption
7965 File:Nonexistant.jpg
7966 image:foobar.jpg|some '''caption''' [[Main Page]]
7967 image:foobar.jpg
7968 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
7969 </gallery>
7970 !! result
7971 <ul class="gallery" style="max-width: 226px;_width: 226px;">
7972 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
7973 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7974 <div style="height: 70px;">Nonexistant.jpg</div>
7975 <div class="gallerytext">
7976 <p>caption
7977 </p>
7978 </div>
7979 </div></li>
7980 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7981 <div style="height: 70px;">Nonexistant.jpg</div>
7982 <div class="gallerytext">
7983 </div>
7984 </div></li>
7985 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7986 <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/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
7987 <div class="gallerytext">
7988 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7989 </p>
7990 </div>
7991 </div></li>
7992 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7993 <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/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
7994 <div class="gallerytext">
7995 </div>
7996 </div></li>
7997 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7998 <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/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
7999 <div class="gallerytext">
8000 <p>Blabla|blabla.
8001 </p>
8002 </div>
8003 </div></li>
8004 </ul>
8005
8006 !! end
8007
8008 !! test
8009 Gallery with wikitext inside caption
8010 !! input
8011 <gallery>
8012 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
8013 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
8014 </gallery>
8015 !! result
8016 <ul class="gallery">
8017 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8018 <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
8019 <div class="gallerytext">
8020 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/3/3a/Foobar.jpg" width="20" height="2" /></a>
8021 </p>
8022 </div>
8023 </div></li>
8024 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8025 <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
8026 <div class="gallerytext">
8027 <p>This is a test template
8028 </p>
8029 </div>
8030 </div></li>
8031 </ul>
8032
8033 !! end
8034
8035 !! test
8036 gallery (with showfilename option)
8037 !! input
8038 <gallery showfilename>
8039 File:Nonexistant.jpg|caption
8040 File:Nonexistant.jpg
8041 image:foobar.jpg|some '''caption''' [[Main Page]]
8042 File:Foobar.jpg
8043 </gallery>
8044 !! result
8045 <ul class="gallery">
8046 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8047 <div style="height: 150px;">Nonexistant.jpg</div>
8048 <div class="gallerytext">
8049 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
8050 caption
8051 </p>
8052 </div>
8053 </div></li>
8054 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8055 <div style="height: 150px;">Nonexistant.jpg</div>
8056 <div class="gallerytext">
8057 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
8058 </p>
8059 </div>
8060 </div></li>
8061 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8062 <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
8063 <div class="gallerytext">
8064 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
8065 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8066 </p>
8067 </div>
8068 </div></li>
8069 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8070 <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
8071 <div class="gallerytext">
8072 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
8073 </p>
8074 </div>
8075 </div></li>
8076 </ul>
8077
8078 !! end
8079
8080 !! test
8081 Gallery (with namespace-less filenames)
8082 !! input
8083 <gallery>
8084 File:Nonexistant.jpg
8085 Nonexistant.jpg
8086 image:foobar.jpg
8087 foobar.jpg
8088 </gallery>
8089 !! result
8090 <ul class="gallery">
8091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8092 <div style="height: 150px;">Nonexistant.jpg</div>
8093 <div class="gallerytext">
8094 </div>
8095 </div></li>
8096 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8097 <div style="height: 150px;">Nonexistant.jpg</div>
8098 <div class="gallerytext">
8099 </div>
8100 </div></li>
8101 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8102 <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
8103 <div class="gallerytext">
8104 </div>
8105 </div></li>
8106 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8107 <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
8108 <div class="gallerytext">
8109 </div>
8110 </div></li>
8111 </ul>
8112
8113 !! end
8114
8115 !! test
8116 HTML Hex character encoding (spells the word "JavaScript")
8117 !! input
8118 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
8119 !! result
8120 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
8121 </p>
8122 !! end
8123
8124 !! test
8125 HTML Hex character encoding bogus encoding (bug 26437 regression check)
8126 !! input
8127 &#xsee;&#XSEE;
8128 !! result
8129 <p>&amp;#xsee;&amp;#XSEE;
8130 </p>
8131 !! end
8132
8133 !! test
8134 HTML Hex character encoding mixed case
8135 !! input
8136 &#xEE;&#Xee;
8137 !! result
8138 <p>&#xee;&#xee;
8139 </p>
8140 !! end
8141
8142 !! test
8143 __FORCETOC__ override
8144 !! input
8145 __NEWSECTIONLINK__
8146 __FORCETOC__
8147 !! result
8148 <p><br />
8149 </p>
8150 !! end
8151
8152 !! test
8153 ISBN code coverage
8154 !! input
8155 ISBN 978-0-1234-56&#x20;789
8156 !! result
8157 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
8158 </p>
8159 !! end
8160
8161 !! test
8162 ISBN followed by 5 spaces
8163 !! input
8164 ISBN
8165 !! result
8166 <p>ISBN
8167 </p>
8168 !! end
8169
8170 !! test
8171 Double ISBN
8172 !! input
8173 ISBN ISBN 1234567890
8174 !! result
8175 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
8176 </p>
8177 !! end
8178
8179 !! test
8180 Bug 22905: <abbr> followed by ISBN followed by </a>
8181 !! input
8182 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
8183 !! result
8184 <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>
8185 </p>
8186 !! end
8187
8188 !! test
8189 Double RFC
8190 !! input
8191 RFC RFC 1234
8192 !! result
8193 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
8194 </p>
8195 !! end
8196
8197 !! test
8198 Double RFC with a wiki link
8199 !! input
8200 RFC [[RFC 1234]]
8201 !! result
8202 <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>
8203 </p>
8204 !! end
8205
8206 !! test
8207 RFC code coverage
8208 !! input
8209 RFC 983&#x20;987
8210 !! result
8211 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
8212 </p>
8213 !! end
8214
8215 !! test
8216 Centre-aligned image
8217 !! input
8218 [[Image:foobar.jpg|centre]]
8219 !! result
8220 <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>
8221
8222 !!end
8223
8224 !! test
8225 None-aligned image
8226 !! input
8227 [[Image:foobar.jpg|none]]
8228 !! result
8229 <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>
8230
8231 !!end
8232
8233 !! test
8234 Width + Height sized image (using px) (height is ignored)
8235 !! input
8236 [[Image:foobar.jpg|640x480px]]
8237 !! result
8238 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
8239 </p>
8240 !!end
8241
8242 !! test
8243 Width-sized image (using px, no following whitespace)
8244 !! input
8245 [[Image:foobar.jpg|640px]]
8246 !! result
8247 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
8248 </p>
8249 !!end
8250
8251 !! test
8252 Width-sized image (using px, with following whitespace - test regression from r39467)
8253 !! input
8254 [[Image:foobar.jpg|640px ]]
8255 !! result
8256 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
8257 </p>
8258 !!end
8259
8260 !! test
8261 Width-sized image (using px, with preceding whitespace - test regression from r39467)
8262 !! input
8263 [[Image:foobar.jpg| 640px]]
8264 !! result
8265 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
8266 </p>
8267 !!end
8268
8269 !! test
8270 Another italics / bold test
8271 !! input
8272 ''' ''x'
8273 !! result
8274 <pre>'<i> </i>x'
8275 </pre>
8276 !!end
8277
8278 # Note the results may be incorrect, as parserTest output included this:
8279 # XML error: Mismatched tag at byte 6120:
8280 # ...<dd> </dt></dl> </dd...
8281 !! test
8282 dt/dd/dl test
8283 !! options
8284 disabled
8285 !! input
8286 :;;;::
8287 !! result
8288 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
8289 </dd></dl>
8290 </dd></dl>
8291 </dt></dl>
8292 </dt></dl>
8293 </dt></dl>
8294 </dd></dl>
8295
8296 !!end
8297
8298
8299 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
8300 !! test
8301 Images with the "|" character in the comment
8302 !! input
8303 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
8304 !! result
8305 <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/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
8306
8307 !!end
8308
8309 !! test
8310 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
8311 !! input
8312 <html><script>alert(1);</script></html>
8313 !! result
8314 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
8315 </p>
8316 !! end
8317
8318 !! test
8319 HTML with raw HTML ($wgRawHtml==true)
8320 !! options
8321 rawhtml
8322 !! input
8323 <html><script>alert(1);</script></html>
8324 !! result
8325 <p><script>alert(1);</script>
8326 </p>
8327 !! end
8328
8329 !! test
8330 Parents of subpages, one level up
8331 !! options
8332 subpage title=[[Subpage test/L1/L2/L3]]
8333 !! input
8334 [[../|L2]]
8335 !! result
8336 <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>
8337 </p>
8338 !! end
8339
8340
8341 !! test
8342 Parents of subpages, one level up, not named
8343 !! options
8344 subpage title=[[Subpage test/L1/L2/L3]]
8345 !! input
8346 [[../]]
8347 !! result
8348 <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>
8349 </p>
8350 !! end
8351
8352
8353
8354 !! test
8355 Parents of subpages, two levels up
8356 !! options
8357 subpage title=[[Subpage test/L1/L2/L3]]
8358 !! input
8359 [[../../|L1]]2
8360
8361 [[../../|L1]]l
8362 !! result
8363 <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
8364 </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>
8365 </p>
8366 !! end
8367
8368 !! test
8369 Parents of subpages, two levels up, without trailing slash or name.
8370 !! options
8371 subpage title=[[Subpage test/L1/L2/L3]]
8372 !! input
8373 [[../..]]
8374 !! result
8375 <p>[[../..]]
8376 </p>
8377 !! end
8378
8379 !! test
8380 Parents of subpages, two levels up, with lots of extra trailing slashes.
8381 !! options
8382 subpage title=[[Subpage test/L1/L2/L3]]
8383 !! input
8384 [[../../////]]
8385 !! result
8386 <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>
8387 </p>
8388 !! end
8389
8390 !! test
8391 Definition list code coverage
8392 !! input
8393 ; title : def
8394 ; title : def
8395 ;title: def
8396 !! result
8397 <dl><dt> title &#160;</dt><dd> def
8398 </dd><dt> title&#160;</dt><dd> def
8399 </dd><dt>title</dt><dd> def
8400 </dd></dl>
8401
8402 !! end
8403
8404 !! test
8405 Don't fall for the self-closing div
8406 !! input
8407 <div>hello world</div/>
8408 !! result
8409 <div>hello world</div>
8410
8411 !! end
8412
8413 !! test
8414 MSGNW magic word
8415 !! input
8416 {{MSGNW:msg}}
8417 !! result
8418 <p>&#91;&#91;:Template:Msg&#93;&#93;
8419 </p>
8420 !! end
8421
8422 !! test
8423 RAW magic word
8424 !! input
8425 {{RAW:QUERTY}}
8426 !! result
8427 <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>
8428 </p>
8429 !! end
8430
8431 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
8432 !! test
8433 Always escape literal '>' in output, not just after '<'
8434 !! input
8435 ><>
8436 !! result
8437 <p>&gt;&lt;&gt;
8438 </p>
8439 !! end
8440
8441 !! test
8442 Template caching
8443 !! input
8444 {{Test}}
8445 {{Test}}
8446 !! result
8447 <p>This is a test template
8448 This is a test template
8449 </p>
8450 !! end
8451
8452
8453 !! article
8454 MediaWiki:Fake
8455 !! text
8456 ==header==
8457 !! endarticle
8458
8459 !! test
8460 Inclusion of !userCanEdit() content
8461 !! input
8462 {{MediaWiki:Fake}}
8463 !! result
8464 <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>
8465
8466 !! end
8467
8468
8469 !! test
8470 Out-of-order TOC heading levels
8471 !! input
8472 ==2==
8473 ======6======
8474 ===3===
8475 =1=
8476 =====5=====
8477 ==2==
8478 !! result
8479 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8480 <ul>
8481 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
8482 <ul>
8483 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
8484 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
8485 </ul>
8486 </li>
8487 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
8488 <ul>
8489 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
8490 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
8491 </ul>
8492 </li>
8493 </ul>
8494 </td></tr></table>
8495 <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>
8496 <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>
8497 <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>
8498 <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>
8499 <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>
8500 <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>
8501
8502 !! end
8503
8504
8505 !! test
8506 ISBN with a dummy number
8507 !! input
8508 ISBN ---
8509 !! result
8510 <p>ISBN ---
8511 </p>
8512 !! end
8513
8514
8515 !! test
8516 ISBN with space-delimited number
8517 !! input
8518 ISBN 92 9017 032 8
8519 !! result
8520 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
8521 </p>
8522 !! end
8523
8524
8525 !! test
8526 ISBN with multiple spaces, no number
8527 !! input
8528 ISBN foo
8529 !! result
8530 <p>ISBN foo
8531 </p>
8532 !! end
8533
8534
8535 !! test
8536 ISBN length
8537 !! input
8538 ISBN 123456789
8539
8540 ISBN 1234567890
8541
8542 ISBN 12345678901
8543 !! result
8544 <p>ISBN 123456789
8545 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
8546 </p><p>ISBN 12345678901
8547 </p>
8548 !! end
8549
8550
8551 !! test
8552 ISBN with trailing year (bug 8110)
8553 !! input
8554 ISBN 1-234-56789-0 - 2006
8555
8556 ISBN 1 234 56789 0 - 2006
8557 !! result
8558 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
8559 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
8560 </p>
8561 !! end
8562
8563
8564 !! test
8565 anchorencode
8566 !! input
8567 {{anchorencode:foo bar©#%n}}
8568 !! result
8569 <p>foo_bar.C2.A9.23.25n
8570 </p>
8571 !! end
8572
8573 !! test
8574 anchorencode trims spaces
8575 !! input
8576 {{anchorencode: __pretty__please__}}
8577 !! result
8578 <p>pretty_please
8579 </p>
8580 !! end
8581
8582 !! test
8583 anchorencode deals with links
8584 !! input
8585 {{anchorencode: [[hello|world]] [[hi]]}}
8586 !! result
8587 <p>world_hi
8588 </p>
8589 !! end
8590
8591 !! test
8592 anchorencode deals with templates
8593 !! input
8594 {{anchorencode: {{Foo}} }}
8595 !! result
8596 <p>FOO
8597 </p>
8598 !! end
8599
8600 !! test
8601 anchorencode encodes like the TOC generator: (bug 18431)
8602 !! input
8603 === _ +:.3A%3A&&amp;]] ===
8604 {{anchorencode: _ +:.3A%3A&&amp;]] }}
8605 __NOEDITSECTION__
8606 !! result
8607 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
8608 <p>.2B:.3A.253A.26.26.5D.5D
8609 </p>
8610 !! end
8611
8612 # Expected output in the following test is not necessarily expected (there
8613 # should probably be <p> tags inside the <blockquote> in the output) -- it's
8614 # only testing for well-formedness.
8615 !! test
8616 Bug 6200: blockquotes and paragraph formatting
8617 !! input
8618 <blockquote>
8619 foo
8620 </blockquote>
8621
8622 bar
8623
8624 baz
8625 !! result
8626 <blockquote>
8627 foo
8628 </blockquote>
8629 <p>bar
8630 </p>
8631 <pre>baz
8632 </pre>
8633 !! end
8634
8635 !! test
8636 Bug 8293: Use of center tag ruins paragraph formatting
8637 !! input
8638 <center>
8639 foo
8640 </center>
8641
8642 bar
8643
8644 baz
8645 !! result
8646 <center>
8647 <p>foo
8648 </p>
8649 </center>
8650 <p>bar
8651 </p>
8652 <pre>baz
8653 </pre>
8654 !! end
8655
8656
8657 ###
8658 ### Language variants related tests
8659 ###
8660 !! test
8661 Self-link in language variants
8662 !! options
8663 title=[[Dunav]] language=sr
8664 !! input
8665 Both [[Dunav]] and [[Дунав]] are names for this river.
8666 !! result
8667 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
8668 </p>
8669 !!end
8670
8671
8672 !! test
8673 Link to pages in language variants
8674 !! options
8675 language=sr
8676 !! input
8677 Main Page can be written as [[Маин Паге]]
8678 !! result
8679 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
8680 </p>
8681 !!end
8682
8683
8684 !! test
8685 Multiple links to pages in language variants
8686 !! options
8687 language=sr
8688 !! input
8689 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
8690 !! result
8691 <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>.
8692 </p>
8693 !!end
8694
8695
8696 !! test
8697 Simple template in language variants
8698 !! options
8699 language=sr
8700 !! input
8701 {{тест}}
8702 !! result
8703 <p>This is a test template
8704 </p>
8705 !! end
8706
8707
8708 !! test
8709 Template with explicit namespace in language variants
8710 !! options
8711 language=sr
8712 !! input
8713 {{Template:тест}}
8714 !! result
8715 <p>This is a test template
8716 </p>
8717 !! end
8718
8719
8720 !! test
8721 Basic test for template parameter in language variants
8722 !! options
8723 language=sr
8724 !! input
8725 {{парамтест|param=foo}}
8726 !! result
8727 <p>This is a test template with parameter foo
8728 </p>
8729 !! end
8730
8731
8732 !! test
8733 Simple category in language variants
8734 !! options
8735 language=sr cat
8736 !! input
8737 [[Category:МедиаWики Усер'с Гуиде]]
8738 !! result
8739 <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>
8740 !! end
8741
8742
8743 !! test
8744 Stripping -{}- tags (language variants)
8745 !! options
8746 language=sr
8747 !! input
8748 Latin proverb: -{Ne nuntium necare}-
8749 !! result
8750 <p>Latin proverb: Ne nuntium necare
8751 </p>
8752 !! end
8753
8754
8755 !! test
8756 Prevent conversion with -{}- tags (language variants)
8757 !! options
8758 language=sr variant=sr-ec
8759 !! input
8760 Latinski: -{Ne nuntium necare}-
8761 !! result
8762 <p>Латински: Ne nuntium necare
8763 </p>
8764 !! end
8765
8766
8767 !! test
8768 Prevent conversion of text with -{}- tags (language variants)
8769 !! options
8770 language=sr variant=sr-ec
8771 !! input
8772 Latinski: -{Ne nuntium necare}-
8773 !! result
8774 <p>Латински: Ne nuntium necare
8775 </p>
8776 !! end
8777
8778
8779 !! test
8780 Prevent conversion of links with -{}- tags (language variants)
8781 !! options
8782 language=sr variant=sr-ec
8783 !! input
8784 -{[[Main Page]]}-
8785 !! result
8786 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8787 </p>
8788 !! end
8789
8790
8791 !! test
8792 -{}- tags within headlines (within html for parserConvert())
8793 !! options
8794 language=sr variant=sr-ec
8795 !! input
8796 == -{Naslov}- ==
8797 !! result
8798 <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>
8799
8800 !! end
8801
8802
8803 !! test
8804 Explicit definition of language variant alternatives
8805 !! options
8806 language=zh variant=zh-tw
8807 !! input
8808 -{zh:China;zh-tw:Taiwan}-, not China
8809 !! result
8810 <p>Taiwan, not China
8811 </p>
8812 !! end
8813
8814
8815 !! test
8816 Explicit session-wise language variant mapping (A flag and - flag)
8817 !! options
8818 language=zh variant=zh-tw
8819 !! input
8820 Taiwan is not China.
8821 But -{A|zh:China;zh-tw:Taiwan}- is China,
8822 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
8823 and -{China}- is China.
8824 !! result
8825 <p>Taiwan is not China.
8826 But Taiwan is Taiwan,
8827 (This should be stripped!)
8828 and China is China.
8829 </p>
8830 !! end
8831
8832 !! test
8833 Explicit session-wise language variant mapping (H flag for hide)
8834 !! options
8835 language=zh variant=zh-tw
8836 !! input
8837 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
8838 Taiwan is China.
8839 !! result
8840 <p>(This should be stripped!)
8841 Taiwan is Taiwan.
8842 </p>
8843 !! end
8844
8845 !! test
8846 Adding explicit conversion rule for title (T flag)
8847 !! options
8848 language=zh variant=zh-tw showtitle
8849 !! input
8850 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8851 !! result
8852 Taiwan
8853 <p>Should be stripped!
8854 </p>
8855 !! end
8856
8857 !! test
8858 Testing that changing the language variant here in the tests actually works
8859 !! options
8860 language=zh variant=zh showtitle
8861 !! input
8862 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8863 !! result
8864 China
8865 <p>Should be stripped!
8866 </p>
8867 !! end
8868
8869 !! test
8870 Bug 24072: more test on conversion rule for title
8871 !! options
8872 language=zh variant=zh-tw showtitle
8873 !! input
8874 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8875 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
8876 !! result
8877 Taiwan
8878 <p>This should be stripped!
8879 This won't take interferes with the title rule.
8880 </p>
8881 !! end
8882
8883 !! test
8884 Raw output of variant escape tags (R flag)
8885 !! options
8886 language=zh variant=zh-tw
8887 !! input
8888 Raw: -{R|zh:China;zh-tw:Taiwan}-
8889 !! result
8890 <p>Raw: zh:China;zh-tw:Taiwan
8891 </p>
8892 !! end
8893
8894 !! test
8895 Nested using of manual convert syntax
8896 !! options
8897 language=zh variant=zh-hk
8898 !! input
8899 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
8900 !! result
8901 <p>Nested: Hello Hong Kong!
8902 </p>
8903 !! end
8904
8905 !! test
8906 Do not convert roman numbers to language variants
8907 !! options
8908 language=sr variant=sr-ec
8909 !! input
8910 Fridrih IV je car.
8911 !! result
8912 <p>Фридрих IV је цар.
8913 </p>
8914 !! end
8915
8916 !! test
8917 Unclosed language converter markup "-{"
8918 !! options
8919 language=sr
8920 !! input
8921 -{T|hello
8922 !! result
8923 <p>-{T|hello
8924 </p>
8925 !! end
8926
8927 !! test
8928 Don't convert raw rule "-{R|=&gt;}-" to "=>"
8929 !! options
8930 language=sr
8931 !! input
8932 -{R|=&gt;}-
8933 !! result
8934 <p>=&gt;
8935 </p>
8936 !!end
8937
8938 !!article
8939 Template:Bullet
8940 !!text
8941 * Bar
8942 !!endarticle
8943
8944 !! test
8945 Bug 529: Uncovered bullet
8946 !! input
8947 * Foo {{bullet}}
8948 !! result
8949 <ul><li> Foo
8950 </li><li> Bar
8951 </li></ul>
8952
8953 !! end
8954
8955 !! test
8956 Bug 529: Uncovered table already at line-start
8957 !! input
8958 x
8959
8960 {{table}}
8961 y
8962 !! result
8963 <p>x
8964 </p>
8965 <table>
8966 <tr>
8967 <td> 1 </td>
8968 <td> 2
8969 </td></tr>
8970 <tr>
8971 <td> 3 </td>
8972 <td> 4
8973 </td></tr></table>
8974 <p>y
8975 </p>
8976 !! end
8977
8978 !! test
8979 Bug 529: Uncovered bullet in parser function result
8980 !! input
8981 * Foo {{lc:{{bullet}} }}
8982 !! result
8983 <ul><li> Foo
8984 </li><li> bar
8985 </li></ul>
8986
8987 !! end
8988
8989 !! test
8990 Bug 5678: Double-parsed template argument
8991 !! input
8992 {{lc:{{{1}}}|hello}}
8993 !! result
8994 <p>{{{1}}}
8995 </p>
8996 !! end
8997
8998 !! test
8999 Bug 5678: Double-parsed template invocation
9000 !! input
9001 {{lc:{{paramtest {{!}} param = hello }} }}
9002 !! result
9003 <p>{{paramtest | param = hello }}
9004 </p>
9005 !! end
9006
9007 !! test
9008 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
9009 !! options
9010 language=cs
9011 title=[[Main Page]]
9012 !! input
9013 {{PRVNÍVELKÉ:ěščř}}
9014 {{prvnívelké:ěščř}}
9015 {{PRVNÍMALÉ:ěščř}}
9016 {{prvnímalé:ěščř}}
9017 {{MALÁ:ěščř}}
9018 {{malá:ěščř}}
9019 {{VELKÁ:ěščř}}
9020 {{velká:ěščř}}
9021 !! result
9022 <p>Ěščř
9023 Ěščř
9024 ěščř
9025 ěščř
9026 ěščř
9027 ěščř
9028 ĚŠČŘ
9029 ĚŠČŘ
9030 </p>
9031 !! end
9032
9033 !! test
9034 Morwen/13: Unclosed link followed by heading
9035 !! input
9036 [[link
9037 ==heading==
9038 !! result
9039 <p>[[link
9040 </p>
9041 <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>
9042
9043 !! end
9044
9045 !! test
9046 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
9047 !! input
9048 {{foo|
9049 =heading=
9050 !! result
9051 <p>{{foo|
9052 </p>
9053 <h1> <span class="mw-headline" id="heading">heading</span></h1>
9054
9055 !! end
9056
9057 !! test
9058 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
9059 !! input
9060 {{foo|
9061 ==heading==
9062 !! result
9063 <p>{{foo|
9064 </p>
9065 <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>
9066
9067 !! end
9068
9069 !! test
9070 Tildes in comments
9071 !! options
9072 pst
9073 !! input
9074 <!-- ~~~~ -->
9075 !! result
9076 <!-- ~~~~ -->
9077 !! end
9078
9079 !! test
9080 Paragraphs inside divs (no extra line breaks)
9081 !! input
9082 <div>Line one
9083
9084 Line two</div>
9085 !! result
9086 <div>Line one
9087 Line two</div>
9088
9089 !! end
9090
9091 !! test
9092 Paragraphs inside divs (extra line break on open)
9093 !! input
9094 <div>
9095 Line one
9096
9097 Line two</div>
9098 !! result
9099 <div>
9100 <p>Line one
9101 </p>
9102 Line two</div>
9103
9104 !! end
9105
9106 !! test
9107 Paragraphs inside divs (extra line break on close)
9108 !! input
9109 <div>Line one
9110
9111 Line two
9112 </div>
9113 !! result
9114 <div>Line one
9115 <p>Line two
9116 </p>
9117 </div>
9118
9119 !! end
9120
9121 !! test
9122 Paragraphs inside divs (extra line break on open and close)
9123 !! input
9124 <div>
9125 Line one
9126
9127 Line two
9128 </div>
9129 !! result
9130 <div>
9131 <p>Line one
9132 </p><p>Line two
9133 </p>
9134 </div>
9135
9136 !! end
9137
9138 !! test
9139 Nesting tags, paragraphs on lines which begin with <div>
9140 !! options
9141 disabled
9142 !! input
9143 <div></div><strong>A
9144 B</strong>
9145 !! result
9146 <div></div>
9147 <p><strong>A
9148 B</strong>
9149 </p>
9150 !! end
9151
9152 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
9153 !! test
9154 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
9155 !! options
9156 disabled
9157 !! input
9158 <blockquote>Line one
9159
9160 Line two</blockquote>
9161 !! result
9162 <blockquote>Line one
9163 Line two</blockquote>
9164
9165 !! end
9166
9167 !! test
9168 Bug 6200: paragraphs inside blockquotes (extra line break on open)
9169 !! options
9170 disabled
9171 !! input
9172 <blockquote>
9173 Line one
9174
9175 Line two</blockquote>
9176 !! result
9177 <blockquote>
9178 <p>Line one
9179 </p>
9180 Line two</blockquote>
9181
9182 !! end
9183
9184 !! test
9185 Bug 6200: paragraphs inside blockquotes (extra line break on close)
9186 !! options
9187 disabled
9188 !! input
9189 <blockquote>Line one
9190
9191 Line two
9192 </blockquote>
9193 !! result
9194 <blockquote>Line one
9195 <p>Line two
9196 </p>
9197 </blockquote>
9198
9199 !! end
9200
9201 !! test
9202 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
9203 !! options
9204 disabled
9205 !! input
9206 <blockquote>
9207 Line one
9208
9209 Line two
9210 </blockquote>
9211 !! result
9212 <blockquote>
9213 <p>Line one
9214 </p><p>Line two
9215 </p>
9216 </blockquote>
9217
9218 !! end
9219
9220 !! test
9221 Paragraphs inside blockquotes/divs (no extra line breaks)
9222 !! input
9223 <blockquote><div>Line one
9224
9225 Line two</div></blockquote>
9226 !! result
9227 <blockquote><div>Line one
9228 Line two</div></blockquote>
9229
9230 !! end
9231
9232 !! test
9233 Paragraphs inside blockquotes/divs (extra line break on open)
9234 !! input
9235 <blockquote><div>
9236 Line one
9237
9238 Line two</div></blockquote>
9239 !! result
9240 <blockquote><div>
9241 <p>Line one
9242 </p>
9243 Line two</div></blockquote>
9244
9245 !! end
9246
9247 !! test
9248 Paragraphs inside blockquotes/divs (extra line break on close)
9249 !! input
9250 <blockquote><div>Line one
9251
9252 Line two
9253 </div></blockquote>
9254 !! result
9255 <blockquote><div>Line one
9256 <p>Line two
9257 </p>
9258 </div></blockquote>
9259
9260 !! end
9261
9262 !! test
9263 Paragraphs inside blockquotes/divs (extra line break on open and close)
9264 !! input
9265 <blockquote><div>
9266 Line one
9267
9268 Line two
9269 </div></blockquote>
9270 !! result
9271 <blockquote><div>
9272 <p>Line one
9273 </p><p>Line two
9274 </p>
9275 </div></blockquote>
9276
9277 !! end
9278
9279 !! test
9280 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
9281 !! options
9282 wgLinkHolderBatchSize=0
9283 !! input
9284 [[meatball:1]]
9285 [[meatball:2]]
9286 [[meatball:3]]
9287 !! result
9288 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
9289 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
9290 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
9291 </p>
9292 !! end
9293
9294 !! test
9295 Free external link invading image caption
9296 !! input
9297 [[Image:Foobar.jpg|thumb|http://x|hello]]
9298 !! result
9299 <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/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
9300
9301 !! end
9302
9303 !! test
9304 Bug 15196: localised external link numbers
9305 !! options
9306 language=fa
9307 !! input
9308 [http://en.wikipedia.org/]
9309 !! result
9310 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
9311 </p>
9312 !! end
9313
9314 !! test
9315 Multibyte character in padleft
9316 !! input
9317 {{padleft:-Hello|7|Æ}}
9318 !! result
9319 <p>Æ-Hello
9320 </p>
9321 !! end
9322
9323 !! test
9324 Multibyte character in padright
9325 !! input
9326 {{padright:Hello-|7|Æ}}
9327 !! result
9328 <p>Hello-Æ
9329 </p>
9330 !! end
9331
9332 !! test
9333 Formatted date
9334 !! config
9335 wgUseDynamicDates=1
9336 !! input
9337 [[2009-03-24]]
9338 !! result
9339 <p><span class="mw-formatted-date" title="2009-03-24"><a href="/index.php?title=2009&amp;action=edit&amp;redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="/index.php?title=March_24&amp;action=edit&amp;redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span>
9340 </p>
9341 !!end
9342
9343 !!test
9344 formatdate parser function
9345 !!input
9346 {{#formatdate:2009-03-24}}
9347 !! result
9348 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
9349 </p>
9350 !! end
9351
9352 !!test
9353 formatdate parser function, with default format
9354 !!input
9355 {{#formatdate:2009-03-24|mdy}}
9356 !! result
9357 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
9358 </p>
9359 !! end
9360
9361 !! test
9362 Linked date with autoformatting disabled
9363 !! config
9364 wgUseDynamicDates=false
9365 !! input
9366 [[2009-03-24]]
9367 !! result
9368 <p><a href="/index.php?title=2009-03-24&amp;action=edit&amp;redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a>
9369 </p>
9370 !! end
9371
9372 !! test
9373 Spacing of numbers in formatted dates
9374 !! input
9375 {{#formatdate:January 15}}
9376 !! result
9377 <p><span class="mw-formatted-date" title="01-15">January 15</span>
9378 </p>
9379 !! end
9380
9381 !! test
9382 Spacing of numbers in formatted dates (linked)
9383 !! config
9384 wgUseDynamicDates=true
9385 !! input
9386 [[January 15]]
9387 !! result
9388 <p><span class="mw-formatted-date" title="01-15"><a href="/index.php?title=January_15&amp;action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
9389 </p>
9390 !! end
9391
9392 !! test
9393 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
9394 !! options
9395 language=nl title=[[MediaWiki:Common.css]]
9396 !! input
9397 {{#formatdate:2009-03-24|dmy}}
9398 !! result
9399 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
9400 </p>
9401 !! end
9402
9403 #
9404 #
9405 #
9406
9407 #
9408 # Edit comments
9409 #
9410
9411 !! test
9412 Edit comment with link
9413 !! options
9414 comment
9415 !! input
9416 I like the [[Main Page]] a lot
9417 !! result
9418 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
9419 !!end
9420
9421 !! test
9422 Edit comment with link and link text
9423 !! options
9424 comment
9425 !! input
9426 I like the [[Main Page|best pages]] a lot
9427 !! result
9428 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
9429 !!end
9430
9431 !! test
9432 Edit comment with link and link text with suffix
9433 !! options
9434 comment
9435 !! input
9436 I like the [[Main Page|best page]]s a lot
9437 !! result
9438 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
9439 !!end
9440
9441 !! test
9442 Edit comment with section link (non-local, eg in history list)
9443 !! options
9444 comment title=[[Main Page]]
9445 !! input
9446 /* External links */ removed bogus entries
9447 !! result
9448 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
9449 !!end
9450
9451 !! test
9452 Edit comment with section link and text before it (non-local, eg in history list)
9453 !! options
9454 comment title=[[Main Page]]
9455 !! input
9456 pre-comment text /* External links */ removed bogus entries
9457 !! result
9458 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>
9459 !!end
9460
9461 !! test
9462 Edit comment with section link (local, eg in diff view)
9463 !! options
9464 comment local title=[[Main Page]]
9465 !! input
9466 /* External links */ removed bogus entries
9467 !! result
9468 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
9469 !!end
9470
9471 !! test
9472 Edit comment with subpage link (bug 14080)
9473 !! options
9474 comment
9475 subpage
9476 title=[[Subpage test]]
9477 !! input
9478 Poked at a [[/subpage]] here...
9479 !! result
9480 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
9481 !!end
9482
9483 !! test
9484 Edit comment with subpage link and link text (bug 14080)
9485 !! options
9486 comment
9487 subpage
9488 title=[[Subpage test]]
9489 !! input
9490 Poked at a [[/subpage|neat little page]] here...
9491 !! result
9492 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
9493 !!end
9494
9495 !! test
9496 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
9497 !! options
9498 comment
9499 title=[[Subpage test]]
9500 !! input
9501 Poked at a [[/subpage]] here...
9502 !! result
9503 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...
9504 !!end
9505
9506 !! test
9507 Edit comment with bare anchor link (local, as on diff)
9508 !! options
9509 comment
9510 local
9511 title=[[Main Page]]
9512 !!input
9513 [[#section]]
9514 !! result
9515 <a href="#section">#section</a>
9516 !! end
9517
9518 !! test
9519 Edit comment with bare anchor link (non-local, as on history)
9520 !! options
9521 comment
9522 title=[[Main Page]]
9523 !!input
9524 [[#section]]
9525 !! result
9526 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
9527 !! end
9528
9529 !! test
9530 Anchor starting with underscore
9531 !!input
9532 [[#_ref|One]]
9533 !! result
9534 <p><a href="#_ref">One</a>
9535 </p>
9536 !! end
9537
9538 !! test
9539 Id starting with underscore
9540 !!input
9541 <div id="_ref"></div>
9542 !! result
9543 <div id="_ref"></div>
9544
9545 !! end
9546
9547 !! test
9548 Space normalisation on autocomment (bug 22784)
9549 !! options
9550 comment
9551 title=[[Main Page]]
9552 !!input
9553 /* __hello__world__ */
9554 !! result
9555 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
9556 !! end
9557
9558 !! test
9559 percent-encoding and + signs in comments (Bug 26410)
9560 !! options
9561 comment
9562 !!input
9563 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
9564 !! result
9565 <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>
9566 !! end
9567
9568 !! test
9569 Bad images - basic functionality
9570 !! options
9571 disabled
9572 !! input
9573 [[File:Bad.jpg]]
9574 !! result
9575 !! end
9576
9577 !! test
9578 Bad images - bug 16039: text after bad image disappears
9579 !! options
9580 disabled
9581 !! input
9582 Foo bar
9583 [[File:Bad.jpg]]
9584 Bar foo
9585 !! result
9586 <p>Foo bar
9587 </p><p>Bar foo
9588 </p>
9589 !! end
9590
9591 !! test
9592 Verify that displaytitle works (bug #22501) no displaytitle
9593 !! options
9594 showtitle
9595 !! config
9596 wgAllowDisplayTitle=true
9597 wgRestrictDisplayTitle=false
9598 !! input
9599 this is not the the title
9600 !! result
9601 Parser test
9602 <p>this is not the the title
9603 </p>
9604 !! end
9605
9606 !! test
9607 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
9608 !! options
9609 showtitle
9610 title=[[Screen]]
9611 !! config
9612 wgAllowDisplayTitle=true
9613 wgRestrictDisplayTitle=false
9614 !! input
9615 this is not the the title
9616 {{DISPLAYTITLE:whatever}}
9617 !! result
9618 whatever
9619 <p>this is not the the title
9620 </p>
9621 !! end
9622
9623 !! test
9624 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
9625 !! options
9626 showtitle
9627 title=[[Screen]]
9628 !! config
9629 wgAllowDisplayTitle=true
9630 wgRestrictDisplayTitle=true
9631 !! input
9632 this is not the the title
9633 {{DISPLAYTITLE:whatever}}
9634 !! result
9635 Screen
9636 <p>this is not the the title
9637 </p>
9638 !! end
9639
9640 !! test
9641 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
9642 !! options
9643 showtitle
9644 title=[[Screen]]
9645 !! config
9646 wgAllowDisplayTitle=true
9647 wgRestrictDisplayTitle=true
9648 !! input
9649 this is not the the title
9650 {{DISPLAYTITLE:screen}}
9651 !! result
9652 screen
9653 <p>this is not the the title
9654 </p>
9655 !! end
9656
9657 !! test
9658 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
9659 !! options
9660 showtitle
9661 title=[[Screen]]
9662 !! config
9663 wgAllowDisplayTitle=false
9664 !! input
9665 this is not the the title
9666 {{DISPLAYTITLE:screen}}
9667 !! result
9668 Screen
9669 <p>this is not the the title
9670 <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>
9671 </p>
9672 !! end
9673
9674 !! test
9675 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
9676 !! options
9677 showtitle
9678 title=[[Screen]]
9679 !! config
9680 wgAllowDisplayTitle=false
9681 !! input
9682 this is not the the title
9683 !! result
9684 Screen
9685 <p>this is not the the title
9686 </p>
9687 !! end
9688
9689 !! test
9690 preload: check <noinclude> and <includeonly>
9691 !! options
9692 preload
9693 !! input
9694 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
9695 !! result
9696 Hello kind world.
9697 !! end
9698
9699 !! test
9700 preload: check <onlyinclude>
9701 !! options
9702 preload
9703 !! input
9704 Goodbye <onlyinclude>Hello world</onlyinclude>
9705 !! result
9706 Hello world
9707 !! end
9708
9709 !! test
9710 preload: can pass tags through if we want to
9711 !! options
9712 preload
9713 !! input
9714 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
9715 !! result
9716 <includeonly>Hello world</includeonly>
9717 !! end
9718
9719 !! test
9720 preload: check that it doesn't try to do tricks
9721 !! options
9722 preload
9723 !! input
9724 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
9725 !! result
9726 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
9727 !! end
9728
9729 !! test
9730 Play a bit with r67090 and bug 3158
9731 !! options
9732 disabled
9733 !! input
9734 <div style="width:50% !important">&nbsp;</div>
9735 <div style="width:50%&nbsp;!important">&nbsp;</div>
9736 <div style="width:50%&#160;!important">&nbsp;</div>
9737 <div style="border : solid;">&nbsp;</div>
9738 !! result
9739 <div style="width:50% !important">&nbsp;</div>
9740 <div style="width:50% !important">&nbsp;</div>
9741 <div style="width:50% !important">&nbsp;</div>
9742 <div style="border&#160;: solid;">&nbsp;</div>
9743
9744 !! end
9745
9746 !! test
9747 HTML5 data attributes
9748 !! input
9749 <span data-foo="bar">Baz</span>
9750 <p data-abc-def_hij="">Quuz</p>
9751 !! result
9752 <p><span data-foo="bar">Baz</span>
9753 </p>
9754 <p data-abc-def_hij="">Quuz</p>
9755
9756 !! end
9757
9758 !! test
9759 percent-encoding and + signs in internal links (Bug 26410)
9760 !! input
9761 [[User:+%]] [[Page+title%]]
9762 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
9763 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
9764 [[%33%45]] [[%33%45+]]
9765 !! result
9766 <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>
9767 <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>
9768 <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>
9769 <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>
9770 </p>
9771 !! end
9772
9773 !! test
9774 Special characters in embedded file links (bug 27679)
9775 !! input
9776 [[File:Contains & ampersand.jpg]]
9777 [[File:Does not exist.jpg|Title with & ampersand]]
9778 !! result
9779 <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>
9780 <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>
9781 </p>
9782 !! end
9783
9784
9785 !! test
9786 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
9787 !! input
9788 Text&apos;s been normalized?
9789 !! result
9790 <p>Text&#39;s been normalized?
9791 </p>
9792 !! end
9793
9794 !! test
9795 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
9796 !! input
9797 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
9798 !! result
9799 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
9800 </p>
9801 !! end
9802
9803 !! test
9804 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
9805 !! input
9806 [http://www.example.org/ ideograms]
9807 !! result
9808 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
9809 </p>
9810 !! end
9811
9812 !! test
9813 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
9814 !! input
9815 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
9816 !! result
9817 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
9818 </p>
9819 !! end
9820
9821 !! article
9822 Mediawiki:loop1
9823 !! text
9824 {{Identical|A}}
9825 !! endarticle
9826
9827 !! article
9828 Mediawiki:loop2
9829 !! text
9830 {{Identical|B}}
9831 !! endarticle
9832
9833 !! article
9834 Template:Identical
9835 !! text
9836 {{int:loop1}}
9837 {{int:loop2}}
9838 !! endarticle
9839
9840 !! test
9841 Bug 31098 Template which includes system messages which includes the template
9842 !! input
9843 {{Identical}}
9844 !! result
9845 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
9846 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
9847 </p>
9848 !! end
9849
9850 !! test
9851 Deprecated presentational attributes are converted to css
9852 !! input
9853 {|
9854 | valign=top align=left width=100 height=25% | Asdf
9855 |}
9856 <ul type="disc"></ul>
9857 !! result
9858 <table>
9859 <tr>
9860 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
9861 </td></tr></table>
9862 <ul style="list-style-type: disc;"></ul>
9863
9864 !! end
9865
9866 !! test
9867 Bug31490 Turkish: ucfirst 'blah'
9868 !! options
9869 language=tr
9870 !! input
9871 {{ucfirst:blah}}
9872 !! result
9873 <p>Blah
9874 </p>
9875 !! end
9876
9877 !! test
9878 Bug31490 Turkish: ucfirst 'ix'
9879 !! options
9880 language=tr
9881 !! input
9882 {{ucfirst:ix}}
9883 !! result
9884 <p>İx
9885 </p>
9886 !! end
9887
9888 !! test
9889 Bug31490 Turkish: lcfirst 'BLAH'
9890 !! options
9891 language=tr
9892 !! input
9893 {{lcfirst:BLAH}}
9894 !! result
9895 <p>bLAH
9896 </p>
9897 !! end
9898
9899 !! test
9900 Bug31490 Turkish: ucfırst (with a dotless i)
9901 !! options
9902 language=tr
9903 !! input
9904 {{ucfırst:blah}}
9905 !! result
9906 <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>
9907 </p>
9908 !! end
9909
9910 !! test
9911 Bug31490 ucfırst (with a dotless i) with English language
9912 !! options
9913 language=en
9914 !! input
9915 {{ucfırst:blah}}
9916 !! result
9917 <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>
9918 </p>
9919 !! end
9920
9921 !! test
9922 Bug 26375: TOC with italics
9923 !! options
9924 title=[[Main Page]]
9925 !! input
9926 __TOC__
9927 == ''Lost'' episodes ==
9928 !! result
9929 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9930 <ul>
9931 <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>
9932 </ul>
9933 </td></tr></table>
9934 <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>
9935
9936 !! end
9937
9938 !! test
9939 Bug 26375: TOC with bold
9940 !! options
9941 title=[[Main Page]]
9942 !! input
9943 __TOC__
9944 == '''should be bold''' then normal text ==
9945 !! result
9946 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9947 <ul>
9948 <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>
9949 </ul>
9950 </td></tr></table>
9951 <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>
9952
9953 !! end
9954
9955 !! test
9956 Bug 33845: Headings become cursive in TOC when they contain an image
9957 !! options
9958 title=[[Main Page]]
9959 !! input
9960 __TOC__
9961 == Image [[Image:foobar.jpg]] ==
9962 !! result
9963 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9964 <ul>
9965 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
9966 </ul>
9967 </td></tr></table>
9968 <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>
9969
9970 !! end
9971
9972 !! test
9973 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
9974 !! options
9975 title=[[Main Page]]
9976 !! input
9977 __TOC__
9978 == <blockquote>Quote</blockquote> ==
9979 !! result
9980 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9981 <ul>
9982 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
9983 </ul>
9984 </td></tr></table>
9985 <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>
9986
9987 !! end
9988
9989 !! test
9990 Unclosed tags in TOC
9991 !! options
9992 title=[[Main Page]]
9993 !! input
9994 __TOC__
9995 == Proof: 2 < 3 ==
9996 <small>Hanc marginis exiguitas non caperet.</small>
9997 QED
9998 !! result
9999 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10000 <ul>
10001 <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>
10002 </ul>
10003 </td></tr></table>
10004 <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>
10005 <p><small>Hanc marginis exiguitas non caperet.</small>
10006 QED
10007 </p>
10008 !! end
10009
10010 !! test
10011 Multiple tags in TOC
10012 !! input
10013 __TOC__
10014 == <i>Foo</i> <b>Bar</b> ==
10015
10016 == <i>Foo</i> <blockquote>Bar</blockquote> ==
10017 !! result
10018 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10019 <ul>
10020 <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>
10021 <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>
10022 </ul>
10023 </td></tr></table>
10024 <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>
10025 <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>
10026
10027 !! end
10028
10029 !! test
10030 Tags with parameters in TOC
10031 !! input
10032 __TOC__
10033 == <sup class="in-h2">Hello</sup> ==
10034
10035 == <sup class="a > b">Evilbye</sup> ==
10036 !! result
10037 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10038 <ul>
10039 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
10040 <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>
10041 </ul>
10042 </td></tr></table>
10043 <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>
10044 <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>
10045
10046 !! end
10047
10048 !! article
10049 MediaWiki:Bug32057
10050 !! text
10051 == {{int:headline_sample}} ==
10052 !! endarticle
10053
10054 !! test
10055 Bug 32057: Title needed when expanding <h> nodes.
10056 !! options
10057 title=[[Main Page]]
10058 !! input
10059 {{int:Bug32057}}
10060 !! result
10061 <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>
10062
10063 !! end
10064
10065 !! test
10066 Strip marker in urlencode
10067 !! input
10068 {{urlencode:x<nowiki/>y}}
10069 {{urlencode:x<nowiki/>y|wiki}}
10070 {{urlencode:x<nowiki/>y|path}}
10071 !! result
10072 <p>xy
10073 xy
10074 xy
10075 </p>
10076 !! end
10077
10078 !! test
10079 Strip marker in lc
10080 !! input
10081 {{lc:x<nowiki/>y}}
10082 !! result
10083 <p>xy
10084 </p>
10085 !! end
10086
10087 !! test
10088 Strip marker in uc
10089 !! input
10090 {{uc:x<nowiki/>y}}
10091 !! result
10092 <p>XY
10093 </p>
10094 !! end
10095
10096 !! test
10097 Strip marker in formatNum
10098 !! input
10099 {{formatnum:1<nowiki/>2}}
10100 {{formatnum:1<nowiki/>2|R}}
10101 !! result
10102 <p>12
10103 12
10104 </p>
10105 !! end
10106
10107 !! test
10108 Strip marker in grammar
10109 !! options
10110 language=fi
10111 !! input
10112 {{grammar:elative|foo<nowiki/>bar}}
10113 !! result
10114 <p>foobarista
10115 </p>
10116 !! end
10117
10118 !! test
10119 Strip marker in padleft
10120 !! input
10121 {{padleft:|2|x<nowiki/>y}}
10122 !! result
10123 <p>xy
10124 </p>
10125 !! end
10126
10127 !! test
10128 Strip marker in padright
10129 !! input
10130 {{padright:|2|x<nowiki/>y}}
10131 !! result
10132 <p>xy
10133 </p>
10134 !! end
10135
10136 !! test
10137 Strip marker in anchorencode
10138 !! input
10139 {{anchorencode:x<nowiki/>y}}
10140 !! result
10141 <p>xy
10142 </p>
10143 !! end
10144
10145 !! test
10146 nowiki inside link inside heading (bug 18295)
10147 !! input
10148 ==[[foo|x<nowiki>y</nowiki>z]]==
10149 !! result
10150 <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>
10151
10152 !! end
10153
10154 !! test
10155 new support for bdi element (bug 31817)
10156 !! input
10157 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
10158 !! result
10159 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
10160
10161 !!end
10162
10163 !! test
10164 Ignore pipe between table row attributes
10165 !! input
10166 {|
10167 | quux
10168 |- id=foo | style='color: red'
10169 | bar
10170 |}
10171 !! result
10172 <table>
10173 <tr>
10174 <td> quux
10175 </td></tr>
10176 <tr id="foo" style="color: red">
10177 <td> bar
10178 </td></tr></table>
10179
10180 !! end
10181
10182 !!test
10183 Gallery override link with WikiLink (bug 34852)
10184 !! input
10185 <gallery>
10186 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
10187 </gallery>
10188 !! result
10189 <ul class="gallery">
10190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10191 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
10192 <div class="gallerytext">
10193 <p>caption
10194 </p>
10195 </div>
10196 </div></li>
10197 </ul>
10198
10199 !! end
10200
10201 !!test
10202 Gallery override link with absolute external link (bug 34852)
10203 !! input
10204 <gallery>
10205 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
10206 </gallery>
10207 !! result
10208 <ul class="gallery">
10209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10210 <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
10211 <div class="gallerytext">
10212 <p>caption
10213 </p>
10214 </div>
10215 </div></li>
10216 </ul>
10217
10218 !! end
10219
10220 !!test
10221 Gallery override link with malicious javascript (bug 34852)
10222 !! input
10223 <gallery>
10224 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
10225 </gallery>
10226 !! result
10227 <ul class="gallery">
10228 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10229 <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
10230 <div class="gallerytext">
10231 <p>caption
10232 </p>
10233 </div>
10234 </div></li>
10235 </ul>
10236
10237 !! end
10238
10239 !!test
10240 Language parser function
10241 !! input
10242 {{#language:ar}}
10243 !! result
10244 <p>العربية
10245 </p>
10246 !! end
10247
10248 !!test
10249 Padleft and padright as substr
10250 !! input
10251 {{padleft:|3|abcde}}
10252 {{padright:|3|abcde}}
10253 !! result
10254 <p>abc
10255 abc
10256 </p>
10257 !! end
10258
10259
10260 TODO:
10261 more images
10262 more tables
10263 character entities
10264 and much more
10265 Try for 100% code coverage