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