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