Merge "Update jQuery to 1.8.2"
[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 in html attr key
4330 !!input
4331 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
4332 !!result
4333 <p><span id="foo">bar</span>
4334 </p>
4335 !!end
4336
4337 !!test
4338 2. includeonly in html attr value
4339 !!input
4340 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
4341 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
4342 !!result
4343 <p><span id="v1">bar</span>
4344 <span id="v1">bar</span>
4345 </p>
4346 !!end
4347
4348 !!test
4349 3. includeonly in part of an attr value
4350 !!input
4351 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
4352 !!result
4353 <p><span style="color:red;">bar</span>
4354 </p>
4355 !!end
4356
4357 ###
4358 ### Testing parsing of templates where a template arg
4359 ### has the same name as the template itself.
4360 ###
4361
4362 !! article
4363 Template:quote
4364 !! text
4365 {{{quote|{{{1}}}}}}
4366 !! endarticle
4367
4368 !!test
4369 Templates: Template Name/Arg clash: 1. Use of positional param
4370 !!input
4371 {{quote|foo}}
4372 !!result
4373 <p>foo
4374 </p>
4375 !!end
4376
4377 !!test
4378 Templates: Template Name/Arg clash: 2. Use of named param
4379 !!input
4380 {{quote|quote=foo}}
4381 !!result
4382 <p>foo
4383 </p>
4384 !!end
4385
4386 !!test
4387 Templates: Template Name/Arg clash: 3. Use of named param with empty input
4388 !!input
4389 {{quote|quote}}
4390 !!result
4391 <p>quote
4392 </p>
4393 !!end
4394
4395 ###
4396 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
4397 ###
4398
4399 !!test
4400 Templates: 1. Simple use
4401 !!input
4402 {{echo|Foo}}
4403 !!result
4404 <p>Foo
4405 </p>
4406 !!end
4407
4408 !!test
4409 Templates: 2. Inside a block tag
4410 !!input
4411 <div>{{echo|Foo}}</div>
4412 !!result
4413 <div>Foo</div>
4414
4415 !!end
4416
4417 !!test
4418 Templates: P-wrapping: 1a. Templates on consecutive lines
4419 !!input
4420 {{echo|Foo}}
4421 {{echo|bar}}
4422 !!result
4423 <p>Foo
4424 bar
4425 </p>
4426 !!end
4427
4428 !!test
4429 Templates: P-wrapping: 1b. Templates on consecutive lines
4430 !!input
4431 Foo
4432
4433 {{echo|bar}}
4434 {{echo|baz}}
4435 !!result
4436 <p>Foo
4437 </p><p>bar
4438 baz
4439 </p>
4440 !!end
4441
4442 !!test
4443 Templates: P-wrapping: 1c. Templates on consecutive lines
4444 !!input
4445 {{echo|Foo}}
4446 {{echo|bar}} <div>baz</div>
4447 !!result
4448 <p>Foo
4449 </p>
4450 bar <div>baz</div>
4451
4452 !!end
4453
4454 !!test
4455 Templates: Inline Text: 1. Multiple tmeplate uses
4456 !!input
4457 {{echo|Foo}}bar{{echo|baz}}
4458 !!result
4459 <p>Foobarbaz
4460 </p>
4461 !!end
4462
4463 !!test
4464 Templates: Inline Text: 2. Back-to-back template uses
4465 !!input
4466 {{echo|Foo}}{{echo|bar}}
4467 !!result
4468 <p>Foobar
4469 </p>
4470 !!end
4471
4472 !!test
4473 Templates: Block Tags: 1. Multiple template uses
4474 !!input
4475 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
4476 !!result
4477 <div>Foo</div><div>bar</div><div>baz</div>
4478
4479 !!end
4480
4481 !!test
4482 Templates: Block Tags: 2. Back-to-back template uses
4483 !!input
4484 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
4485 !!result
4486 <div>Foo</div><div>bar</div>
4487
4488 !!end
4489
4490 !!test
4491 Templates: Links: 1. Simple example
4492 !!input
4493 {{echo|[[Foo|bar]]}}
4494 !!result
4495 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4496 </p>
4497 !!end
4498
4499 !!test
4500 Templates: Links: 2. Generation of link href
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: 3. Generation of part of a link href
4510 !!input
4511 [[Fo{{echo|o}}|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: 4. Multiple templates generating link href
4519 !!input
4520 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
4521 !!result
4522 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
4523 </p>
4524 !!end
4525
4526 !!test
4527 Templates: Links: 5. Generation of link text
4528 !!input
4529 [[Foo|{{echo|bar}}]]
4530 !!result
4531 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4532 </p>
4533 !!end
4534
4535 !!test
4536 Templates: Links: 5. Nested templates (only outermost template should be marked)
4537 !!input
4538 {{echo|[[{{echo|Foo}}|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: HTML Tag: 1. Generation of HTML attr. key
4546 !!input
4547 <div {{echo|style}}="color:red;">foo</div>
4548 !!result
4549 <div style="color:red;">foo</div>
4550
4551 !!end
4552
4553 !!test
4554 Templates: HTML Tag: 2. Generation of HTML attr. value
4555 !!input
4556 <div style={{echo|'color:red;'}}>foo</div>
4557 !!result
4558 <div style="color:red;">foo</div>
4559
4560 !!end
4561
4562 !!test
4563 Templates: HTML Tag: 3. Generation of HTML attr key and value
4564 !!input
4565 <div {{echo|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: 4. Generation of starting piece of HTML attr value
4573 !!input
4574 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
4575 !!result
4576 <div title="This is a long title with just one piece templated">foo</div>
4577
4578 !!end
4579
4580 !!test
4581 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
4582 !!input
4583 <div title="This is a long title with just {{echo|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: 6. Generation of end piece of HTML attr value
4591 !!input
4592 <div title="This is a long title with just one piece {{echo|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: Tables: 1. Generating start of a HTML table
4600 !!input
4601 {{echo|<table><tr><td>foo</td>}}</tr></table>
4602 !!result
4603 <table><tr><td>foo</td></tr></table>
4604
4605 !!end
4606
4607 !!test
4608 Templates: Tables: 2a. Generating middle of a HTML table
4609 !!input
4610 <table><tr>{{echo|<td>foo</td>}}</tr></table>
4611 !!result
4612 <table><tr><td>foo</td></tr></table>
4613
4614 !!end
4615
4616 !!test
4617 Templates: Tables: 2b. Generating middle of a HTML table
4618 !!input
4619 <table>{{echo|<tr><td>foo</td></tr>}}</table>
4620 !!result
4621 <table><tr><td>foo</td></tr></table>
4622
4623 !!end
4624
4625 !!test
4626 Templates: Tables: 3. Generating end of a HTML table
4627 !!input
4628 <table><tr>{{echo|<td>foo</td></tr></table>}}
4629 !!result
4630 <table><tr><td>foo</td></tr></table>
4631
4632 !!end
4633
4634 !!test
4635 Templates: Tables: 4a. Generating a single tag of a HTML table
4636 !!input
4637 {{echo|<table>}}<tr><td>foo</td></tr></table>
4638 !!result
4639 <table><tr><td>foo</td></tr></table>
4640
4641 !!end
4642
4643 !!test
4644 Templates: Tables: 4b. Generating a single tag of a HTML table
4645 !!input
4646 <table>{{echo|<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: 4c. Generating a single tag of a HTML table
4654 !!input
4655 <table><tr>{{echo|<td>}}foo</td></tr></table>
4656 !!result
4657 <table><tr><td>foo</td></tr></table>
4658
4659 !!end
4660
4661 !!test
4662 Templates: Tables: 4d. Generating a single tag of a HTML table
4663 !!input
4664 <table><tr><td>foo{{echo|</td>}}</tr></table>
4665 !!result
4666 <table><tr><td>foo</td></tr></table>
4667
4668 !!end
4669
4670 !!test
4671 Templates: Tables: 4e. Generating a single tag of a HTML table
4672 !!input
4673 <table><tr><td>foo</td>{{echo|</tr>}}</table>
4674 !!result
4675 <table><tr><td>foo</td></tr></table>
4676
4677 !!end
4678
4679 !!test
4680 Templates: Tables: 4f. Generating a single tag of a HTML table
4681 !!input
4682 <table><tr><td>foo</td></tr>{{echo|</table>}}
4683 !!result
4684 <table><tr><td>foo</td></tr></table>
4685
4686 !!end
4687
4688 !!test
4689 Parser Functions: 1. Simple example
4690 !!input
4691 {{uc:foo}}
4692 !!result
4693 <p>FOO
4694 </p>
4695 !!end
4696
4697 !!test
4698 Parser Functions: 2. Nested use (only outermost should be marked up)
4699 !!input
4700 {{uc:{{lc:FOO}}}}
4701 !!result
4702 <p>FOO
4703 </p>
4704 !!end
4705
4706 ###
4707 ### Pre-save transform tests
4708 ###
4709 !! test
4710 pre-save transform: subst:
4711 !! options
4712 PST
4713 !! input
4714 {{subst:test}}
4715 !! result
4716 This is a test template
4717 !! end
4718
4719 !! test
4720 pre-save transform: normal template
4721 !! options
4722 PST
4723 !! input
4724 {{test}}
4725 !! result
4726 {{test}}
4727 !! end
4728
4729 !! test
4730 pre-save transform: nonexistent template
4731 !! options
4732 PST
4733 !! input
4734 {{thistemplatedoesnotexist}}
4735 !! result
4736 {{thistemplatedoesnotexist}}
4737 !! end
4738
4739
4740 !! test
4741 pre-save transform: subst magic variables
4742 !! options
4743 PST
4744 !! input
4745 {{subst:SITENAME}}
4746 !! result
4747 MediaWiki
4748 !! end
4749
4750 # This is bug 89, which I fixed. -- wtm
4751 !! test
4752 pre-save transform: subst: templates with parameters
4753 !! options
4754 pst
4755 !! input
4756 {{subst:paramtest|param="something else"}}
4757 !! result
4758 This is a test template with parameter "something else"
4759 !! end
4760
4761 !! article
4762 Template:nowikitest
4763 !! text
4764 <nowiki>'''not wiki'''</nowiki>
4765 !! endarticle
4766
4767 !! test
4768 pre-save transform: nowiki in subst (bug 1188)
4769 !! options
4770 pst
4771 !! input
4772 {{subst:nowikitest}}
4773 !! result
4774 <nowiki>'''not wiki'''</nowiki>
4775 !! end
4776
4777
4778 !! article
4779 Template:commenttest
4780 !! text
4781 This template has <!-- a comment --> in it.
4782 !! endarticle
4783
4784 !! test
4785 pre-save transform: comment in subst (bug 1936)
4786 !! options
4787 pst
4788 !! input
4789 {{subst:commenttest}}
4790 !! result
4791 This template has <!-- a comment --> in it.
4792 !! end
4793
4794 !! test
4795 pre-save transform: unclosed tag
4796 !! options
4797 pst noxml
4798 !! input
4799 <nowiki>'''not wiki'''
4800 !! result
4801 <nowiki>'''not wiki'''
4802 !! end
4803
4804 !! test
4805 pre-save transform: mixed tag case
4806 !! options
4807 pst noxml
4808 !! input
4809 <NOwiki>'''not wiki'''</noWIKI>
4810 !! result
4811 <NOwiki>'''not wiki'''</noWIKI>
4812 !! end
4813
4814 !! test
4815 pre-save transform: unclosed comment in <nowiki>
4816 !! options
4817 pst noxml
4818 !! input
4819 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
4820 !! result
4821 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
4822 !!end
4823
4824 !! article
4825 Template:dangerous
4826 !!text
4827 <span onmouseover="alert('crap')">Oh no</span>
4828 !!endarticle
4829
4830 !!test
4831 (confirming safety of fix for subst bug 1936)
4832 !! input
4833 {{Template:dangerous}}
4834 !! result
4835 <p><span>Oh no</span>
4836 </p>
4837 !! end
4838
4839 !! test
4840 pre-save transform: comment containing gallery (bug 5024)
4841 !! options
4842 pst
4843 !! input
4844 <!-- <gallery>data</gallery> -->
4845 !!result
4846 <!-- <gallery>data</gallery> -->
4847 !!end
4848
4849 !! test
4850 pre-save transform: comment containing extension
4851 !! options
4852 pst
4853 !! input
4854 <!-- <tag>data</tag> -->
4855 !!result
4856 <!-- <tag>data</tag> -->
4857 !!end
4858
4859 !! test
4860 pre-save transform: comment containing nowiki
4861 !! options
4862 pst
4863 !! input
4864 <!-- <nowiki>data</nowiki> -->
4865 !!result
4866 <!-- <nowiki>data</nowiki> -->
4867 !!end
4868
4869 !! test
4870 pre-save transform: <noinclude> in subst (bug 3298)
4871 !! options
4872 pst
4873 !! input
4874 {{subst:Includes}}
4875 !! result
4876 Foobar
4877 !! end
4878
4879 !! test
4880 pre-save transform: <onlyinclude> in subst (bug 3298)
4881 !! options
4882 pst
4883 !! input
4884 {{subst:Includes2}}
4885 !! result
4886 Foo
4887 !! end
4888
4889 !! article
4890 Template:SubstTest
4891 !!text
4892 {{<includeonly>subst:</includeonly>Includes}}
4893 !! endarticle
4894
4895 !! article
4896 Template:SafeSubstTest
4897 !! text
4898 {{<includeonly>safesubst:</includeonly>Includes}}
4899 !! endarticle
4900
4901 !! test
4902 bug 22297: safesubst: works during PST
4903 !! options
4904 pst
4905 !! input
4906 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
4907 !! result
4908 FoobarFoobar
4909 !! end
4910
4911 !! test
4912 bug 22297: safesubst: works during normal parse
4913 !! input
4914 {{SafeSubstTest}}
4915 !! result
4916 <p>Foobar
4917 </p>
4918 !! end
4919
4920 !! test:
4921 subst: does not work during normal parse
4922 !! input
4923 {{SubstTest}}
4924 !! result
4925 <p>{{subst:Includes}}
4926 </p>
4927 !! end
4928
4929 !! test
4930 pre-save transform: context links ("pipe trick")
4931 !! options
4932 pst
4933 !! input
4934 [[Article (context)|]]
4935 [[Bar:Article|]]
4936 [[:Bar:Article|]]
4937 [[Bar:Article (context)|]]
4938 [[:Bar:Article (context)|]]
4939 [[|Article]]
4940 [[|Article (context)]]
4941 [[Bar:X (Y) Z|]]
4942 [[:Bar:X (Y) Z|]]
4943 !! result
4944 [[Article (context)|Article]]
4945 [[Bar:Article|Article]]
4946 [[:Bar:Article|Article]]
4947 [[Bar:Article (context)|Article]]
4948 [[:Bar:Article (context)|Article]]
4949 [[Article]]
4950 [[Article (context)]]
4951 [[Bar:X (Y) Z|X (Y) Z]]
4952 [[:Bar:X (Y) Z|X (Y) Z]]
4953 !! end
4954
4955 !! test
4956 pre-save transform: context links ("pipe trick") with interwiki prefix
4957 !! options
4958 pst
4959 !! input
4960 [[interwiki:Article|]]
4961 [[:interwiki:Article|]]
4962 [[interwiki:Bar:Article|]]
4963 [[:interwiki:Bar:Article|]]
4964 !! result
4965 [[interwiki:Article|Article]]
4966 [[:interwiki:Article|Article]]
4967 [[interwiki:Bar:Article|Bar:Article]]
4968 [[:interwiki:Bar:Article|Bar:Article]]
4969 !! end
4970
4971 !! test
4972 pre-save transform: context links ("pipe trick") with parens in title
4973 !! options
4974 pst title=[[Somearticle (context)]]
4975 !! input
4976 [[|Article]]
4977 !! result
4978 [[Article (context)|Article]]
4979 !! end
4980
4981 !! test
4982 pre-save transform: context links ("pipe trick") with comma in title
4983 !! options
4984 pst title=[[Someplace, Somewhere]]
4985 !! input
4986 [[|Otherplace]]
4987 [[Otherplace, Elsewhere|]]
4988 [[Otherplace, Elsewhere, Anywhere|]]
4989 !! result
4990 [[Otherplace, Somewhere|Otherplace]]
4991 [[Otherplace, Elsewhere|Otherplace]]
4992 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
4993 !! end
4994
4995 !! test
4996 pre-save transform: context links ("pipe trick") with parens and comma
4997 !! options
4998 pst title=[[Someplace (IGNORED), Somewhere]]
4999 !! input
5000 [[|Otherplace]]
5001 [[Otherplace (place), Elsewhere|]]
5002 !! result
5003 [[Otherplace, Somewhere|Otherplace]]
5004 [[Otherplace (place), Elsewhere|Otherplace]]
5005 !! end
5006
5007 !! test
5008 pre-save transform: context links ("pipe trick") with comma and parens
5009 !! options
5010 pst title=[[Who, me? (context)]]
5011 !! input
5012 [[|Yes, you.]]
5013 [[Me, Myself, and I (1937 song)|]]
5014 !! result
5015 [[Yes, you. (context)|Yes, you.]]
5016 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
5017 !! end
5018
5019 !! test
5020 pre-save transform: context links ("pipe trick") with namespace
5021 !! options
5022 pst title=[[Ns:Somearticle]]
5023 !! input
5024 [[|Article]]
5025 !! result
5026 [[Ns:Article|Article]]
5027 !! end
5028
5029 !! test
5030 pre-save transform: context links ("pipe trick") with namespace and parens
5031 !! options
5032 pst title=[[Ns:Somearticle (context)]]
5033 !! input
5034 [[|Article]]
5035 !! result
5036 [[Ns:Article (context)|Article]]
5037 !! end
5038
5039 !! test
5040 pre-save transform: context links ("pipe trick") with namespace and comma
5041 !! options
5042 pst title=[[Ns:Somearticle, Context, Whatever]]
5043 !! input
5044 [[|Article]]
5045 !! result
5046 [[Ns:Article, Context, Whatever|Article]]
5047 !! end
5048
5049 !! test
5050 pre-save transform: context links ("pipe trick") with namespace, comma and parens
5051 !! options
5052 pst title=[[Ns:Somearticle, Context (context)]]
5053 !! input
5054 [[|Article]]
5055 !! result
5056 [[Ns:Article (context)|Article]]
5057 !! end
5058
5059 !! test
5060 pre-save transform: context links ("pipe trick") with namespace, parens and comma
5061 !! options
5062 pst title=[[Ns:Somearticle (IGNORED), Context]]
5063 !! input
5064 [[|Article]]
5065 !! result
5066 [[Ns:Article, Context|Article]]
5067 !! end
5068
5069 !! test
5070 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
5071 !! options
5072 pst
5073 !! input
5074 [[Article(context)|]]
5075 [[Bar:Article(context)|]]
5076 [[:Bar:Article(context)|]]
5077 [[|Article(context)]]
5078 [[Bar:X(Y)Z|]]
5079 [[:Bar:X(Y)Z|]]
5080 !! result
5081 [[Article(context)|Article]]
5082 [[Bar:Article(context)|Article]]
5083 [[:Bar:Article(context)|Article]]
5084 [[Article(context)]]
5085 [[Bar:X(Y)Z|X(Y)Z]]
5086 [[:Bar:X(Y)Z|X(Y)Z]]
5087 !! end
5088
5089 !! test
5090 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
5091 !! options
5092 pst
5093 !! input
5094 [[Article (context)|]]
5095 [[Bar:Article (context)|]]
5096 [[:Bar:Article (context)|]]
5097 [[|Article (context)]]
5098 [[Bar:X (Y) Z|]]
5099 [[:Bar:X (Y) Z|]]
5100 !! result
5101 [[Article (context)|Article]]
5102 [[Bar:Article (context)|Article]]
5103 [[:Bar:Article (context)|Article]]
5104 [[Article (context)]]
5105 [[Bar:X (Y) Z|X (Y) Z]]
5106 [[:Bar:X (Y) Z|X (Y) Z]]
5107 !! end
5108
5109 !! test
5110 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
5111 !! options
5112 pst
5113 !! input
5114 [[Article(context)|]]
5115 [[Bar:Article(context)|]]
5116 [[:Bar:Article(context)|]]
5117 [[|Article(context)]]
5118 [[Bar:X(Y)Z|]]
5119 [[:Bar:X(Y)Z|]]
5120 !! result
5121 [[Article(context)|Article]]
5122 [[Bar:Article(context)|Article]]
5123 [[:Bar:Article(context)|Article]]
5124 [[Article(context)]]
5125 [[Bar:X(Y)Z|X(Y)Z]]
5126 [[:Bar:X(Y)Z|X(Y)Z]]
5127 !! end
5128
5129 !! test
5130 pre-save transform: context links ("pipe trick") with commas (bug 21660)
5131 !! options
5132 pst
5133 !! input
5134 [[Article (context), context|]]
5135 [[Article (context),context|]]
5136 [[Bar:Article (context), context|]]
5137 [[Bar:Article (context),context|]]
5138 [[:Bar:Article (context), context|]]
5139 [[:Bar:Article (context),context|]]
5140 !! result
5141 [[Article (context), context|Article]]
5142 [[Article (context),context|Article]]
5143 [[Bar:Article (context), context|Article]]
5144 [[Bar:Article (context),context|Article]]
5145 [[:Bar:Article (context), context|Article]]
5146 [[:Bar:Article (context),context|Article]]
5147 !! end
5148
5149 !! test
5150 pre-save transform: trim trailing empty lines
5151 !! options
5152 pst
5153 !! input
5154 Empty lines are trimmed
5155
5156
5157
5158
5159 !! result
5160 Empty lines are trimmed
5161 !! end
5162
5163 !! test
5164 pre-save transform: Signature expansion
5165 !! options
5166 pst
5167 !! input
5168 * ~~~
5169 * <noinclude>~~~</noinclude>
5170 * <includeonly>~~~</includeonly>
5171 * <onlyinclude>~~~</onlyinclude>
5172 !! result
5173 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
5174 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
5175 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
5176 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
5177 !! end
5178
5179
5180 !! test
5181 pre-save transform: Signature expansion in nowiki tags (bug 93)
5182 !! options
5183 pst disabled
5184 !! input
5185 Shall not expand:
5186
5187 <nowiki>~~~~</nowiki>
5188
5189 <includeonly><nowiki>~~~~</nowiki></includeonly>
5190
5191 <noinclude><nowiki>~~~~</nowiki></noinclude>
5192
5193 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5194
5195 {{subst:Foo}} shall be converted to FOO
5196
5197 As well as inside noinclude/onlyinclude
5198 <noinclude>{{subst:Foo}}</noinclude>
5199 <onlyinclude>{{subst:Foo}}</onlyinclude>
5200
5201 But not inside includeonly
5202 <includeonly>{{subst:Foo}}</includeonly>
5203 !! result
5204 Shall not expand:
5205
5206 <nowiki>~~~~</nowiki>
5207
5208 <includeonly><nowiki>~~~~</nowiki></includeonly>
5209
5210 <noinclude><nowiki>~~~~</nowiki></noinclude>
5211
5212 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5213
5214 FOO shall be converted to FOO
5215
5216 As well as inside noinclude/onlyinclude
5217 <noinclude>FOO</noinclude>
5218 <onlyinclude>FOO</onlyinclude>
5219
5220 But not inside includeonly
5221 <includeonly>{{subst:Foo}}</includeonly>
5222 !! end
5223
5224 ###
5225 ### Message transform tests
5226 ###
5227 !! test
5228 message transform: magic variables
5229 !! options
5230 msg
5231 !! input
5232 {{SITENAME}}
5233 !! result
5234 MediaWiki
5235 !! end
5236
5237 !! test
5238 message transform: should not transform wiki markup
5239 !! options
5240 msg
5241 !! input
5242 ''test''
5243 !! result
5244 ''test''
5245 !! end
5246
5247 !! test
5248 message transform: <noinclude> in transcluded template (bug 4926)
5249 !! options
5250 msg
5251 !! input
5252 {{Includes}}
5253 !! result
5254 Foobar
5255 !! end
5256
5257 !! test
5258 message transform: <onlyinclude> in transcluded template (bug 4926)
5259 !! options
5260 msg
5261 !! input
5262 {{Includes2}}
5263 !! result
5264 Foo
5265 !! end
5266
5267 !! test
5268 {{#special:}} page name, known
5269 !! options
5270 msg
5271 !! input
5272 {{#special:Recentchanges}}
5273 !! result
5274 Special:RecentChanges
5275 !! end
5276
5277 !! test
5278 {{#special:}} page name with subpage, known
5279 !! options
5280 msg
5281 !! input
5282 {{#special:Recentchanges/param}}
5283 !! result
5284 Special:RecentChanges/param
5285 !! end
5286
5287 !! test
5288 {{#special:}} page name, unknown
5289 !! options
5290 msg
5291 !! input
5292 {{#special:foobarnonexistent}}
5293 !! result
5294 No such special page
5295 !! end
5296
5297 !! test
5298 {{#speciale:}} page name, known
5299 !! options
5300 msg
5301 !! input
5302 {{#speciale:Recentchanges}}
5303 !! result
5304 Special:RecentChanges
5305 !! end
5306
5307 !! test
5308 {{#speciale:}} page name with subpage, known
5309 !! options
5310 msg
5311 !! input
5312 {{#speciale:Recentchanges/param}}
5313 !! result
5314 Special:RecentChanges/param
5315 !! end
5316
5317 !! test
5318 {{#speciale:}} page name, unknown
5319 !! options
5320 msg
5321 !! input
5322 {{#speciale:foobarnonexistent}}
5323 !! result
5324 No_such_special_page
5325 !! end
5326
5327 ###
5328 ### Images
5329 ###
5330 !! test
5331 Simple image
5332 !! input
5333 [[Image:foobar.jpg]]
5334 !! result
5335 <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>
5336 </p>
5337 !! end
5338
5339 !! test
5340 Right-aligned image
5341 !! input
5342 [[Image:foobar.jpg|right]]
5343 !! result
5344 <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>
5345
5346 !! end
5347
5348 !! test
5349 Simple image (using File: namespace, now canonical)
5350 !! input
5351 [[File:foobar.jpg]]
5352 !! result
5353 <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>
5354 </p>
5355 !! end
5356
5357 !! test
5358 Image with caption
5359 !! input
5360 [[Image:foobar.jpg|right|Caption text]]
5361 !! result
5362 <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>
5363
5364 !! end
5365
5366 !! test
5367 Image with link parameter, wiki target
5368 !! input
5369 [[Image:foobar.jpg|link=Target page]]
5370 !! result
5371 <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>
5372 </p>
5373 !! end
5374
5375 !! test
5376 Image with link parameter, URL target
5377 !! input
5378 [[Image:foobar.jpg|link=http://example.com/]]
5379 !! result
5380 <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>
5381 </p>
5382 !! end
5383
5384 !! test
5385 Image with link parameter, wgExternalLinkTarget
5386 !! input
5387 [[Image:foobar.jpg|link=http://example.com/]]
5388 !! config
5389 wgExternalLinkTarget='foobar'
5390 !! result
5391 <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>
5392 </p>
5393 !! end
5394
5395 !! test
5396 Image with link parameter, wgNoFollowLinks set to false
5397 !! input
5398 [[Image:foobar.jpg|link=http://example.com/]]
5399 !! config
5400 wgNoFollowLinks=false
5401 !! result
5402 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
5403 </p>
5404 !! end
5405
5406 !! test
5407 Image with link parameter, wgNoFollowDomainExceptions
5408 !! input
5409 [[Image:foobar.jpg|link=http://example.com/]]
5410 !! config
5411 wgNoFollowDomainExceptions='example.com'
5412 !! result
5413 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
5414 </p>
5415 !! end
5416
5417 !! test
5418 Image with link parameter, wgExternalLinkTarget, unnamed parameter
5419 !! input
5420 [[Image:foobar.jpg|link=http://example.com/|Title]]
5421 !! config
5422 wgExternalLinkTarget='foobar'
5423 !! result
5424 <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>
5425 </p>
5426 !! end
5427
5428 !! test
5429 Image with empty link parameter
5430 !! input
5431 [[Image:foobar.jpg|link=]]
5432 !! result
5433 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
5434 </p>
5435 !! end
5436
5437 !! test
5438 Image with link parameter (wiki target) and unnamed parameter
5439 !! input
5440 [[Image:foobar.jpg|link=Target page|Title]]
5441 !! result
5442 <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>
5443 </p>
5444 !! end
5445
5446 !! test
5447 Image with link parameter (URL target) and unnamed parameter
5448 !! input
5449 [[Image:foobar.jpg|link=http://example.com/|Title]]
5450 !! result
5451 <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>
5452 </p>
5453 !! end
5454
5455 !! test
5456 Thumbnail image with link parameter
5457 !! input
5458 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
5459 !! result
5460 <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>
5461
5462 !! end
5463
5464 !! test
5465 Image with frame and link
5466 !! input
5467 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
5468 !! result
5469 <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>
5470
5471 !! end
5472
5473 !! test
5474 Image with frame and link and explicit alt
5475 !! input
5476 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
5477 !! result
5478 <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>
5479
5480 !! end
5481
5482 !! test
5483 Image with wiki markup in implicit alt
5484 !! input
5485 [[Image:Foobar.jpg|testing '''bold''' in alt]]
5486 !! result
5487 <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>
5488 </p>
5489 !! end
5490
5491 !! test
5492 Image with wiki markup in explicit alt
5493 !! input
5494 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
5495 !! result
5496 <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>
5497 </p>
5498 !! end
5499
5500 !! test
5501 Link to image page- image page normally doesn't exists, hence edit link
5502 Add test with existing image page
5503 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
5504 !! input
5505 [[:Image:test]]
5506 !! result
5507 <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>
5508 </p>
5509 !! end
5510
5511 !! test
5512 bug 18784 Link to non-existent image page with caption should use caption as link text
5513 !! input
5514 [[:Image:test|caption]]
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)">caption</a>
5517 </p>
5518 !! end
5519
5520 !! test
5521 Frameless image caption with a free URL
5522 !! input
5523 [[Image:foobar.jpg|http://example.com]]
5524 !! result
5525 <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>
5526 </p>
5527 !! end
5528
5529 !! test
5530 Thumbnail image caption with a free URL
5531 !! input
5532 [[Image:foobar.jpg|thumb|http://example.com]]
5533 !! result
5534 <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>
5535
5536 !! end
5537
5538 !! test
5539 Thumbnail image caption with a free URL and explicit alt
5540 !! input
5541 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
5542 !! result
5543 <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>
5544
5545 !! end
5546
5547 !! test
5548 BUG 1887: A ISBN with a thumbnail
5549 !! input
5550 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
5551 !! result
5552 <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>
5553
5554 !! end
5555
5556 !! test
5557 BUG 1887: A RFC with a thumbnail
5558 !! input
5559 [[Image:foobar.jpg|thumb|This is RFC 12354]]
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>This is <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
5562
5563 !! end
5564
5565 !! test
5566 BUG 1887: A mailto link with a thumbnail
5567 !! input
5568 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
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>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
5571
5572 !! end
5573
5574 # Pending resolution to bug 368
5575 !! test
5576 BUG 648: Frameless image caption with a link
5577 !! input
5578 [[Image:foobar.jpg|text with a [[link]] in it]]
5579 !! result
5580 <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>
5581 </p>
5582 !! end
5583
5584 !! test
5585 BUG 648: Frameless image caption with a link (suffix)
5586 !! input
5587 [[Image:foobar.jpg|text with a [[link]]foo in it]]
5588 !! result
5589 <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>
5590 </p>
5591 !! end
5592
5593 !! test
5594 BUG 648: Frameless image caption with an interwiki link
5595 !! input
5596 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
5597 !! result
5598 <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>
5599 </p>
5600 !! end
5601
5602 !! test
5603 BUG 648: Frameless image caption with a piped interwiki link
5604 !! input
5605 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
5606 !! result
5607 <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>
5608 </p>
5609 !! end
5610
5611 !! test
5612 Escape HTML special chars in image alt text
5613 !! input
5614 [[Image:foobar.jpg|& < > "]]
5615 !! result
5616 <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>
5617 </p>
5618 !! end
5619
5620 !! test
5621 BUG 499: Alt text should have &#1234;, not &amp;1234;
5622 !! input
5623 [[Image:foobar.jpg|&#9792;]]
5624 !! result
5625 <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>
5626 </p>
5627 !! end
5628
5629 !! test
5630 Broken image caption with link
5631 !! input
5632 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
5633 !! result
5634 <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.
5635 </p>
5636 !! end
5637
5638 !! test
5639 Image caption containing another image
5640 !! input
5641 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
5642 !! result
5643 <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>
5644
5645 !! end
5646
5647 !! test
5648 Image caption containing a newline
5649 !! input
5650 [[Image:Foobar.jpg|This
5651 *is some text]]
5652 !! result
5653 <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>
5654 </p>
5655 !!end
5656
5657
5658 !! test
5659 Bug 3090: External links other than http: in image captions
5660 !! input
5661 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
5662 !! result
5663 <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>
5664
5665 !! end
5666
5667 !! test
5668 Custom class
5669 !! input
5670 [[Image:foobar.jpg|a|class=b]]
5671 !! result
5672 <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>
5673 </p>
5674 !! end
5675
5676 !! article
5677 File:Barfoo.jpg
5678 !! text
5679 #REDIRECT [[File:Barfoo.jpg]]
5680 !! endarticle
5681
5682 !! test
5683 Redirected image
5684 !! input
5685 [[Image:Barfoo.jpg]]
5686 !! result
5687 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
5688 </p>
5689 !! end
5690
5691 !! test
5692 Missing image with uploads disabled
5693 !! options
5694 wgEnableUploads=0
5695 !! input
5696 [[Image:Foobaz.jpg]]
5697 !! result
5698 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
5699 </p>
5700 !! end
5701
5702
5703 ###
5704 ### Subpages
5705 ###
5706 !! article
5707 Subpage test/subpage
5708 !! text
5709 foo
5710 !! endarticle
5711
5712 !! test
5713 Subpage link
5714 !! options
5715 subpage title=[[Subpage test]]
5716 !! input
5717 [[/subpage]]
5718 !! result
5719 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
5720 </p>
5721 !! end
5722
5723 !! test
5724 Subpage noslash link
5725 !! options
5726 subpage title=[[Subpage test]]
5727 !!input
5728 [[/subpage/]]
5729 !! result
5730 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
5731 </p>
5732 !! end
5733
5734 !! test
5735 Disabled subpages
5736 !! input
5737 [[/subpage]]
5738 !! result
5739 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
5740 </p>
5741 !! end
5742
5743 !! test
5744 BUG 561: {{/Subpage}}
5745 !! options
5746 subpage title=[[Page]]
5747 !! input
5748 {{/Subpage}}
5749 !! result
5750 <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>
5751 </p>
5752 !! end
5753
5754 ###
5755 ### Categories
5756 ###
5757 !! article
5758 Category:MediaWiki User's Guide
5759 !! text
5760 blah
5761 !! endarticle
5762
5763 !! test
5764 Link to category
5765 !! input
5766 [[:Category:MediaWiki User's Guide]]
5767 !! result
5768 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
5769 </p>
5770 !! end
5771
5772 !! test
5773 Simple category
5774 !! options
5775 cat
5776 !! input
5777 [[Category:MediaWiki User's Guide]]
5778 !! result
5779 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
5780 !! end
5781
5782 !! test
5783 PAGESINCATEGORY invalid title fatal (r33546 fix)
5784 !! input
5785 {{PAGESINCATEGORY:<bogus>}}
5786 !! result
5787 <p>0
5788 </p>
5789 !! end
5790
5791 !! test
5792 Category with different sort key
5793 !! options
5794 cat
5795 !! input
5796 [[Category:MediaWiki User's Guide|Foo]]
5797 !! result
5798 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
5799 !! end
5800
5801 !! test
5802 Category with identical sort key
5803 !! options
5804 cat
5805 !! input
5806 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
5807 !! result
5808 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
5809 !! end
5810
5811 !! test
5812 Category with empty sort key
5813 !! options
5814 cat
5815 pst
5816 !! input
5817 [[Category:MediaWiki User's Guide|]]
5818 !! result
5819 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
5820 !! end
5821
5822 !! test
5823 Category with empty sort key and parentheses
5824 !! options
5825 cat
5826 pst
5827 !! input
5828 [[Category:Foo (bar)|]]
5829 !! result
5830 [[Category:Foo (bar)|Foo]]
5831 !! end
5832
5833 ###
5834 ### Inter-language links
5835 ###
5836 !! test
5837 Inter-language links
5838 !! options
5839 ill
5840 !! input
5841 [[es:Alimento]]
5842 [[fr:Nourriture]]
5843 [[zh:&#39135;&#21697;]]
5844 !! result
5845 es:Alimento fr:Nourriture zh:食品
5846 !! end
5847
5848 !! test
5849 Duplicate interlanguage links (bug 24502)
5850 !! options
5851 ill
5852 !! input
5853 [[es:1]]
5854 [[es:2]]
5855 [[fr:1]]
5856 [[fr:2]]
5857 !! result
5858 es:1 fr:1
5859 !! end
5860
5861 ###
5862 ### Sections
5863 ###
5864 !! test
5865 Basic section headings
5866 !! input
5867 == Headline 1 ==
5868 Some text
5869
5870 ==Headline 2==
5871 More
5872 ===Smaller headline===
5873 Blah blah
5874 !! result
5875 <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>
5876 <p>Some text
5877 </p>
5878 <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>
5879 <p>More
5880 </p>
5881 <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>
5882 <p>Blah blah
5883 </p>
5884 !! end
5885
5886 !! test
5887 Section headings with TOC
5888 !! input
5889 == Headline 1 ==
5890 === Subheadline 1 ===
5891 ===== Skipping a level =====
5892 ====== Skipping a level ======
5893
5894 == Headline 2 ==
5895 Some text
5896 ===Another headline===
5897 !! result
5898 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5899 <ul>
5900 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
5901 <ul>
5902 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
5903 <ul>
5904 <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>
5905 <ul>
5906 <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>
5907 </ul>
5908 </li>
5909 </ul>
5910 </li>
5911 </ul>
5912 </li>
5913 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
5914 <ul>
5915 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
5916 </ul>
5917 </li>
5918 </ul>
5919 </td></tr></table>
5920 <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>
5921 <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>
5922 <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>
5923 <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>
5924 <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>
5925 <p>Some text
5926 </p>
5927 <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>
5928
5929 !! end
5930
5931 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
5932 !! test
5933 Handling of sections up to level 6 and beyond
5934 !! input
5935 = Level 1 Heading=
5936 == Level 2 Heading==
5937 === Level 3 Heading===
5938 ==== Level 4 Heading====
5939 ===== Level 5 Heading=====
5940 ====== Level 6 Heading======
5941 ======= Level 7 Heading=======
5942 ======== Level 8 Heading========
5943 ========= Level 9 Heading=========
5944 ========== Level 10 Heading==========
5945 !! result
5946 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5947 <ul>
5948 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
5949 <ul>
5950 <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>
5951 <ul>
5952 <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>
5953 <ul>
5954 <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>
5955 <ul>
5956 <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>
5957 <ul>
5958 <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>
5959 <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>
5960 <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>
5961 <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>
5962 <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>
5963 </ul>
5964 </li>
5965 </ul>
5966 </li>
5967 </ul>
5968 </li>
5969 </ul>
5970 </li>
5971 </ul>
5972 </li>
5973 </ul>
5974 </td></tr></table>
5975 <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>
5976 <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>
5977 <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>
5978 <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>
5979 <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>
5980 <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>
5981 <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>
5982 <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>
5983 <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>
5984 <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>
5985
5986 !! end
5987
5988 !! test
5989 TOC regression (bug 9764)
5990 !! input
5991 == title 1 ==
5992 === title 1.1 ===
5993 ==== title 1.1.1 ====
5994 === title 1.2 ===
5995 == title 2 ==
5996 === title 2.1 ===
5997 !! result
5998 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5999 <ul>
6000 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6001 <ul>
6002 <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>
6003 <ul>
6004 <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>
6005 </ul>
6006 </li>
6007 <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>
6008 </ul>
6009 </li>
6010 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6011 <ul>
6012 <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>
6013 </ul>
6014 </li>
6015 </ul>
6016 </td></tr></table>
6017 <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>
6018 <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>
6019 <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>
6020 <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>
6021 <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>
6022 <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>
6023
6024 !! end
6025
6026 !! test
6027 TOC with wgMaxTocLevel=3 (bug 6204)
6028 !! options
6029 wgMaxTocLevel=3
6030 !! input
6031 == title 1 ==
6032 === title 1.1 ===
6033 ==== title 1.1.1 ====
6034 === title 1.2 ===
6035 == title 2 ==
6036 === title 2.1 ===
6037 !! result
6038 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6039 <ul>
6040 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6041 <ul>
6042 <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>
6043 <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>
6044 </ul>
6045 </li>
6046 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6047 <ul>
6048 <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>
6049 </ul>
6050 </li>
6051 </ul>
6052 </td></tr></table>
6053 <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>
6054 <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>
6055 <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>
6056 <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>
6057 <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>
6058 <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>
6059
6060 !! end
6061
6062 !! test
6063 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
6064 !! options
6065 wgMaxTocLevel=3
6066 !! input
6067 ==Section 1==
6068 ===Section 1.1===
6069 ====Section 1.1.1====
6070 ====Section 1.1.1.1====
6071 ==Section 2==
6072 !! result
6073 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6074 <ul>
6075 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
6076 <ul>
6077 <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>
6078 </ul>
6079 </li>
6080 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
6081 </ul>
6082 </td></tr></table>
6083 <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>
6084 <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>
6085 <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>
6086 <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>
6087 <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>
6088
6089 !! end
6090
6091
6092 !! test
6093 Resolving duplicate section names
6094 !! input
6095 == Foo bar ==
6096 == Foo bar ==
6097 !! result
6098 <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>
6099 <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>
6100
6101 !! end
6102
6103 !! test
6104 Resolving duplicate section names with differing case (bug 10721)
6105 !! input
6106 == Foo bar ==
6107 == Foo Bar ==
6108 !! result
6109 <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>
6110 <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>
6111
6112 !! end
6113
6114 !! article
6115 Template:sections
6116 !! text
6117 ===Section 1===
6118 ==Section 2==
6119 !! endarticle
6120
6121 !! test
6122 Template with sections, __NOTOC__
6123 !! input
6124 __NOTOC__
6125 ==Section 0==
6126 {{sections}}
6127 ==Section 4==
6128 !! result
6129 <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>
6130 <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>
6131 <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>
6132 <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>
6133
6134 !! end
6135
6136 !! test
6137 __NOEDITSECTION__ keyword
6138 !! input
6139 __NOEDITSECTION__
6140 ==Section 1==
6141 ==Section 2==
6142 !! result
6143 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
6144 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
6145
6146 !! end
6147
6148 !! test
6149 Link inside a section heading
6150 !! input
6151 ==Section with a [[Main Page|link]] in it==
6152 !! result
6153 <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>
6154
6155 !! end
6156
6157 !! test
6158 TOC regression (bug 12077)
6159 !! input
6160 __TOC__
6161 == title 1 ==
6162 === title 1.1 ===
6163 == title 2 ==
6164 !! result
6165 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6166 <ul>
6167 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6168 <ul>
6169 <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>
6170 </ul>
6171 </li>
6172 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
6173 </ul>
6174 </td></tr></table>
6175 <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>
6176 <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>
6177 <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>
6178
6179 !! end
6180
6181 !! test
6182 BUG 1219 URL next to image (good)
6183 !! input
6184 http://example.com [[Image:foobar.jpg]]
6185 !! result
6186 <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>
6187 </p>
6188 !!end
6189
6190 !! test
6191 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
6192 !! input
6193 ===
6194 The line above must have a trailing space!
6195 === <!--
6196 --> <!-- -->
6197 But just in case it doesn't...
6198 !! result
6199 <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>
6200 <p>The line above must have a trailing space!
6201 </p>
6202 <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>
6203 <p>But just in case it doesn't...
6204 </p>
6205 !! end
6206
6207 !! test
6208 Header with special characters (bug 25462)
6209 !! input
6210 The tooltips shall not show entities to the user (ie. be double escaped)
6211
6212 == text > text ==
6213 section 1
6214
6215 == text < text ==
6216 section 2
6217
6218 == text & text ==
6219 section 3
6220
6221 == text ' text ==
6222 section 4
6223
6224 == text " text ==
6225 section 5
6226 !! result
6227 <p>The tooltips shall not show entities to the user (ie. be double escaped)
6228 </p>
6229 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6230 <ul>
6231 <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>
6232 <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>
6233 <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>
6234 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
6235 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
6236 </ul>
6237 </td></tr></table>
6238 <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>
6239 <p>section 1
6240 </p>
6241 <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>
6242 <p>section 2
6243 </p>
6244 <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>
6245 <p>section 3
6246 </p>
6247 <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>
6248 <p>section 4
6249 </p>
6250 <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>
6251 <p>section 5
6252 </p>
6253 !! end
6254
6255 !! test
6256 Headers with excess '=' characters
6257 (Are similar tests necessary beyond the 1st level?)
6258 !! input
6259 =foo==
6260 ==foo=
6261 =''italic'' heading==
6262 ==''italic'' heading=
6263 !! result
6264 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6265 <ul>
6266 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
6267 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
6268 <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>
6269 <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>
6270 </ul>
6271 </td></tr></table>
6272 <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>
6273 <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>
6274 <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>
6275 <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>
6276
6277 !! end
6278
6279 !! test
6280 BUG 1219 URL next to image (broken)
6281 !! input
6282 http://example.com[[Image:foobar.jpg]]
6283 !! result
6284 <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>
6285 </p>
6286 !!end
6287
6288 !! test
6289 Bug 1186 news: in the middle of text
6290 !! input
6291 http://en.wikinews.org/wiki/Wikinews:Workplace
6292 !! result
6293 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
6294 </p>
6295 !!end
6296
6297
6298 !! test
6299 Namespaced link must have a title
6300 !! input
6301 [[Project:]]
6302 !! result
6303 <p>[[Project:]]
6304 </p>
6305 !!end
6306
6307 !! test
6308 Namespaced link must have a title (bad fragment version)
6309 !! input
6310 [[Project:#fragment]]
6311 !! result
6312 <p>[[Project:#fragment]]
6313 </p>
6314 !!end
6315
6316
6317 !! test
6318 div with no attributes
6319 !! input
6320 <div>HTML rocks</div>
6321 !! result
6322 <div>HTML rocks</div>
6323
6324 !! end
6325
6326 !! test
6327 div with double-quoted attribute
6328 !! input
6329 <div id="rock">HTML rocks</div>
6330 !! result
6331 <div id="rock">HTML rocks</div>
6332
6333 !! end
6334
6335 !! test
6336 div with single-quoted attribute
6337 !! input
6338 <div id='rock'>HTML rocks</div>
6339 !! result
6340 <div id="rock">HTML rocks</div>
6341
6342 !! end
6343
6344 !! test
6345 div with unquoted attribute
6346 !! input
6347 <div id=rock>HTML rocks</div>
6348 !! result
6349 <div id="rock">HTML rocks</div>
6350
6351 !! end
6352
6353 !! test
6354 div with illegal double attributes
6355 !! input
6356 <div id="a" id="b">HTML rocks</div>
6357 !! result
6358 <div id="b">HTML rocks</div>
6359
6360 !!end
6361
6362 !! test
6363 HTML multiple attributes correction
6364 !! input
6365 <p class="error" class="awesome">Awesome!</p>
6366 !! result
6367 <p class="awesome">Awesome!</p>
6368
6369 !!end
6370
6371 !! test
6372 Table multiple attributes correction
6373 !! input
6374 {|
6375 !+ class="error" class="awesome"| status
6376 |}
6377 !! result
6378 <table>
6379 <tr>
6380 <th class="awesome"> status
6381 </th></tr></table>
6382
6383 !!end
6384
6385 !! test
6386 DIV IN UPPERCASE
6387 !! input
6388 <DIV ID="x">HTML ROCKS</DIV>
6389 !! result
6390 <div id="x">HTML ROCKS</div>
6391
6392 !!end
6393
6394
6395 !! test
6396 text with amp in the middle of nowhere
6397 !! input
6398 Remember AT&T?
6399 !!result
6400 <p>Remember AT&amp;T?
6401 </p>
6402 !! end
6403
6404 !! test
6405 text with character entity: eacute
6406 !! input
6407 I always thought &eacute; was a cute letter.
6408 !! result
6409 <p>I always thought &#233; was a cute letter.
6410 </p>
6411 !! end
6412
6413 !! test
6414 text with undefined character entity: xacute
6415 !! input
6416 I always thought &xacute; was a cute letter.
6417 !! result
6418 <p>I always thought &amp;xacute; was a cute letter.
6419 </p>
6420 !! end
6421
6422
6423 ###
6424 ### Media links
6425 ###
6426
6427 !! test
6428 Media link
6429 !! input
6430 [[Media:Foobar.jpg]]
6431 !! result
6432 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
6433 </p>
6434 !! end
6435
6436 !! test
6437 Media link with text
6438 !! input
6439 [[Media:Foobar.jpg|A neat file to look at]]
6440 !! result
6441 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
6442 </p>
6443 !! end
6444
6445 # FIXME: this is still bad HTML tag nesting
6446 !! test
6447 Media link with nasty text
6448 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
6449 !! input
6450 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
6451 !! result
6452 <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>
6453
6454 !! end
6455
6456 !! test
6457 Media link to nonexistent file (bug 1702)
6458 !! input
6459 [[Media:No such.jpg]]
6460 !! result
6461 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
6462 </p>
6463 !! end
6464
6465 !! test
6466 Image link to nonexistent file (bug 1850 - good)
6467 !! input
6468 [[Image:No such.jpg]]
6469 !! result
6470 <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>
6471 </p>
6472 !! end
6473
6474 !! test
6475 :Image link to nonexistent file (bug 1850 - bad)
6476 !! input
6477 [[:Image:No such.jpg]]
6478 !! result
6479 <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>
6480 </p>
6481 !! end
6482
6483
6484
6485 !! test
6486 Character reference normalization in link text (bug 1938)
6487 !! input
6488 [[Main Page|this&that]]
6489 !! result
6490 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
6491 </p>
6492 !!end
6493
6494 !! article
6495 אַ
6496 !! text
6497 Test for unicode normalization
6498
6499 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
6500 !! endarticle
6501
6502 !! test
6503 (bug 19451) Links should refer to the normalized form.
6504 !! input
6505 [[&#xFB2E;]]
6506 [[&#x5d0;&#x5b7;]]
6507 [[&#x5d0;ַ]]
6508 [[א&#x5b7;]]
6509 [[אַ]]
6510 !! result
6511 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
6512 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
6513 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
6514 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
6515 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
6516 </p>
6517 !! end
6518
6519 !! test
6520 Empty attribute crash test (bug 2067)
6521 !! input
6522 <font color="">foo</font>
6523 !! result
6524 <p><font color="">foo</font>
6525 </p>
6526 !! end
6527
6528 !! test
6529 Empty attribute crash test single-quotes (bug 2067)
6530 !! input
6531 <font color=''>foo</font>
6532 !! result
6533 <p><font color="">foo</font>
6534 </p>
6535 !! end
6536
6537 !! test
6538 Attribute test: equals, then nothing
6539 !! input
6540 <font color=>foo</font>
6541 !! result
6542 <p><font>foo</font>
6543 </p>
6544 !! end
6545
6546 !! test
6547 Attribute test: unquoted value
6548 !! input
6549 <font color=x>foo</font>
6550 !! result
6551 <p><font color="x">foo</font>
6552 </p>
6553 !! end
6554
6555 !! test
6556 Attribute test: unquoted but illegal value (hash)
6557 !! input
6558 <font color=#x>foo</font>
6559 !! result
6560 <p><font color="#x">foo</font>
6561 </p>
6562 !! end
6563
6564 !! test
6565 Attribute test: no value
6566 !! input
6567 <font color>foo</font>
6568 !! result
6569 <p><font color="color">foo</font>
6570 </p>
6571 !! end
6572
6573 !! test
6574 Bug 2095: link with three closing brackets
6575 !! input
6576 [[Main Page]]]
6577 !! result
6578 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
6579 </p>
6580 !! end
6581
6582 !! test
6583 Bug 2095: link with pipe and three closing brackets
6584 !! input
6585 [[Main Page|link]]]
6586 !! result
6587 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
6588 </p>
6589 !! end
6590
6591 !! test
6592 Bug 2095: link with pipe and three closing brackets, version 2
6593 !! input
6594 [[Main Page|[http://example.com/]]]
6595 !! result
6596 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
6597 </p>
6598 !! end
6599
6600
6601 ###
6602 ### Safety
6603 ###
6604
6605 !! article
6606 Template:Dangerous attribute
6607 !! text
6608 " onmouseover="alert(document.cookie)
6609 !! endarticle
6610
6611 !! article
6612 Template:Dangerous style attribute
6613 !! text
6614 border-size: expression(alert(document.cookie))
6615 !! endarticle
6616
6617 !! article
6618 Template:Div style
6619 !! text
6620 <div style="float: right; {{{1}}}">Magic div</div>
6621 !! endarticle
6622
6623 !! test
6624 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
6625 !! input
6626 <div title="{{test}}"></div>
6627 !! result
6628 <div title="This is a test template"></div>
6629
6630 !! end
6631
6632 !! test
6633 Bug 2304: HTML attribute safety (dangerous template; 2309)
6634 !! input
6635 <div title="{{dangerous attribute}}"></div>
6636 !! result
6637 <div title=""></div>
6638
6639 !! end
6640
6641 !! test
6642 Bug 2304: HTML attribute safety (dangerous style template; 2309)
6643 !! input
6644 <div style="{{dangerous style attribute}}"></div>
6645 !! result
6646 <div style="/* insecure input */"></div>
6647
6648 !! end
6649
6650 !! test
6651 Bug 2304: HTML attribute safety (safe parameter; 2309)
6652 !! input
6653 {{div style|width: 200px}}
6654 !! result
6655 <div style="float: right; width: 200px">Magic div</div>
6656
6657 !! end
6658
6659 !! test
6660 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
6661 !! input
6662 {{div style|width: expression(alert(document.cookie))}}
6663 !! result
6664 <div style="/* insecure input */">Magic div</div>
6665
6666 !! end
6667
6668 !! test
6669 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
6670 !! input
6671 {{div style|"><script>alert(document.cookie)</script>}}
6672 !! result
6673 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
6674
6675 !! end
6676
6677 !! test
6678 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
6679 !! input
6680 {{div style|" ><script>alert(document.cookie)</script>}}
6681 !! result
6682 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
6683
6684 !! end
6685
6686 !! test
6687 Bug 2304: HTML attribute safety (link)
6688 !! input
6689 <div title="[[Main Page]]"></div>
6690 !! result
6691 <div title="&#91;&#91;Main Page]]"></div>
6692
6693 !! end
6694
6695 !! test
6696 Bug 2304: HTML attribute safety (italics)
6697 !! input
6698 <div title="''foobar''"></div>
6699 !! result
6700 <div title="&#39;&#39;foobar&#39;&#39;"></div>
6701
6702 !! end
6703
6704 !! test
6705 Bug 2304: HTML attribute safety (bold)
6706 !! input
6707 <div title="'''foobar'''"></div>
6708 !! result
6709 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
6710
6711 !! end
6712
6713
6714 !! test
6715 Bug 2304: HTML attribute safety (ISBN)
6716 !! input
6717 <div title="ISBN 1234567890"></div>
6718 !! result
6719 <div title="&#73;SBN 1234567890"></div>
6720
6721 !! end
6722
6723 !! test
6724 Bug 2304: HTML attribute safety (RFC)
6725 !! input
6726 <div title="RFC 1234"></div>
6727 !! result
6728 <div title="&#82;FC 1234"></div>
6729
6730 !! end
6731
6732 !! test
6733 Bug 2304: HTML attribute safety (PMID)
6734 !! input
6735 <div title="PMID 1234567890"></div>
6736 !! result
6737 <div title="&#80;MID 1234567890"></div>
6738
6739 !! end
6740
6741 !! test
6742 Bug 2304: HTML attribute safety (web link)
6743 !! input
6744 <div title="http://example.com/"></div>
6745 !! result
6746 <div title="http&#58;//example.com/"></div>
6747
6748 !! end
6749
6750 !! test
6751 Bug 2304: HTML attribute safety (named web link)
6752 !! input
6753 <div title="[http://example.com/ link]"></div>
6754 !! result
6755 <div title="&#91;http&#58;//example.com/ link]"></div>
6756
6757 !! end
6758
6759 !! test
6760 Bug 3244: HTML attribute safety (extension; safe)
6761 !! input
6762 <div style="<nowiki>background:blue</nowiki>"></div>
6763 !! result
6764 <div style="background:blue"></div>
6765
6766 !! end
6767
6768 !! test
6769 Bug 3244: HTML attribute safety (extension; unsafe)
6770 !! input
6771 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
6772 !! result
6773 <div style="/* insecure input */"></div>
6774
6775 !! end
6776
6777 # More MSIE fun discovered by Tom Gilder
6778
6779 !! test
6780 MSIE CSS safety test: spurious slash
6781 !! input
6782 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
6783 !! result
6784 <div style="/* insecure input */">evil</div>
6785
6786 !! end
6787
6788 !! test
6789 MSIE CSS safety test: hex code
6790 !! input
6791 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
6792 !! result
6793 <div style="/* insecure input */">evil</div>
6794
6795 !! end
6796
6797 !! test
6798 MSIE CSS safety test: comment in url
6799 !! input
6800 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
6801 !! result
6802 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
6803
6804 !! end
6805
6806 !! test
6807 MSIE CSS safety test: comment in expression
6808 !! input
6809 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
6810 !! result
6811 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
6812
6813 !! end
6814
6815
6816 !! test
6817 Table attribute legitimate extension
6818 !! input
6819 {|
6820 !+ style="<nowiki>color:blue</nowiki>"| status
6821 |}
6822 !! result
6823 <table>
6824 <tr>
6825 <th style="color:blue"> status
6826 </th></tr></table>
6827
6828 !!end
6829
6830 !! test
6831 Table attribute safety
6832 !! input
6833 {|
6834 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
6835 |}
6836 !! result
6837 <table>
6838 <tr>
6839 <th style="/* insecure input */"> status
6840 </th></tr></table>
6841
6842 !! end
6843
6844 !! test
6845 CSS line continuation 1
6846 !! input
6847 <div style="background-image: u\&#10;rl(test.jpg);"></div>
6848 !! result
6849 <div style="/* insecure input */"></div>
6850
6851 !! end
6852
6853 !! test
6854 CSS line continuation 2
6855 !! input
6856 <div style="background-image: u\&#13;rl(test.jpg); "></div>
6857 !! result
6858 <div style="/* insecure input */"></div>
6859
6860 !! end
6861
6862 !! article
6863 Template:Identity
6864 !! text
6865 {{{1}}}
6866 !! endarticle
6867
6868 !! test
6869 Expansion of multi-line templates in attribute values (bug 6255)
6870 !! input
6871 <div style="background: {{identity|#00FF00}}">-</div>
6872 !! result
6873 <div style="background: #00FF00">-</div>
6874
6875 !! end
6876
6877
6878 !! test
6879 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
6880 !! input
6881 <div style="background:
6882 #00FF00">-</div>
6883 !! result
6884 <div style="background: #00FF00">-</div>
6885
6886 !! end
6887
6888 !! test
6889 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
6890 !! input
6891 <div style="background: &#10;#00FF00">-</div>
6892 !! result
6893 <div style="background: &#10;#00FF00">-</div>
6894
6895 !! end
6896
6897 ###
6898 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
6899 ###
6900 !! test
6901 Parser hook: empty input
6902 !! input
6903 <tag></tag>
6904 !! result
6905 <pre>
6906 string(0) ""
6907 array(0) {
6908 }
6909 </pre>
6910
6911 !! end
6912
6913 !! test
6914 Parser hook: empty input using terminated empty elements
6915 !! input
6916 <tag/>
6917 !! result
6918 <pre>
6919 NULL
6920 array(0) {
6921 }
6922 </pre>
6923
6924 !! end
6925
6926 !! test
6927 Parser hook: empty input using terminated empty elements (space before)
6928 !! input
6929 <tag />
6930 !! result
6931 <pre>
6932 NULL
6933 array(0) {
6934 }
6935 </pre>
6936
6937 !! end
6938
6939 !! test
6940 Parser hook: basic input
6941 !! input
6942 <tag>input</tag>
6943 !! result
6944 <pre>
6945 string(5) "input"
6946 array(0) {
6947 }
6948 </pre>
6949
6950 !! end
6951
6952
6953 !! test
6954 Parser hook: case insensitive
6955 !! input
6956 <TAG>input</TAG>
6957 !! result
6958 <pre>
6959 string(5) "input"
6960 array(0) {
6961 }
6962 </pre>
6963
6964 !! end
6965
6966
6967 !! test
6968 Parser hook: case insensitive, redux
6969 !! input
6970 <TaG>input</TAg>
6971 !! result
6972 <pre>
6973 string(5) "input"
6974 array(0) {
6975 }
6976 </pre>
6977
6978 !! end
6979
6980 !! test
6981 Parser hook: nested tags
6982 !! options
6983 noxml
6984 !! input
6985 <tag><tag></tag></tag>
6986 !! result
6987 <pre>
6988 string(5) "<tag>"
6989 array(0) {
6990 }
6991 </pre>&lt;/tag&gt;
6992
6993 !! end
6994
6995 !! test
6996 Parser hook: basic arguments
6997 !! input
6998 <tag width=200 height = "100" depth = '50' square></tag>
6999 !! result
7000 <pre>
7001 string(0) ""
7002 array(4) {
7003 ["width"]=>
7004 string(3) "200"
7005 ["height"]=>
7006 string(3) "100"
7007 ["depth"]=>
7008 string(2) "50"
7009 ["square"]=>
7010 string(6) "square"
7011 }
7012 </pre>
7013
7014 !! end
7015
7016 !! test
7017 Parser hook: argument containing a forward slash (bug 5344)
7018 !! input
7019 <tag filename='/tmp/bla'></tag>
7020 !! result
7021 <pre>
7022 string(0) ""
7023 array(1) {
7024 ["filename"]=>
7025 string(8) "/tmp/bla"
7026 }
7027 </pre>
7028
7029 !! end
7030
7031 !! test
7032 Parser hook: empty input using terminated empty elements (bug 2374)
7033 !! input
7034 <tag foo=bar/>text
7035 !! result
7036 <pre>
7037 NULL
7038 array(1) {
7039 ["foo"]=>
7040 string(3) "bar"
7041 }
7042 </pre>text
7043
7044 !! end
7045
7046 # </tag> should be output literally since there is no matching tag that begins it
7047 !! test
7048 Parser hook: basic arguments using terminated empty elements (bug 2374)
7049 !! input
7050 <tag width=200 height = "100" depth = '50' square/>
7051 other stuff
7052 </tag>
7053 !! result
7054 <pre>
7055 NULL
7056 array(4) {
7057 ["width"]=>
7058 string(3) "200"
7059 ["height"]=>
7060 string(3) "100"
7061 ["depth"]=>
7062 string(2) "50"
7063 ["square"]=>
7064 string(6) "square"
7065 }
7066 </pre>
7067 <p>other stuff
7068 &lt;/tag&gt;
7069 </p>
7070 !! end
7071
7072 ###
7073 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
7074 ###
7075
7076 !! test
7077 Parser hook: static parser hook not inside a comment
7078 !! input
7079 <statictag>hello, world</statictag>
7080 <statictag action=flush/>
7081 !! result
7082 <p>hello, world
7083 </p>
7084 !! end
7085
7086
7087 !! test
7088 Parser hook: static parser hook inside a comment
7089 !! input
7090 <!-- <statictag>hello, world</statictag> -->
7091 <statictag action=flush/>
7092 !! result
7093 <p><br />
7094 </p>
7095 !! end
7096
7097 # Nested template calls; this case was broken by Parser.php rev 1.506,
7098 # since reverted.
7099
7100 !! article
7101 Template:One-parameter
7102 !! text
7103 (My parameter is: {{{1}}})
7104 !! endarticle
7105
7106 !! article
7107 Template:Map-one-parameter
7108 !! text
7109 {{{{{1}}}|{{{2}}}}}
7110 !! endarticle
7111
7112 !! test
7113 Nested template calls
7114 !! input
7115 {{Map-one-parameter|One-parameter|param}}
7116 !! result
7117 <p>(My parameter is: param)
7118 </p>
7119 !! end
7120
7121
7122 ###
7123 ### Sanitizer
7124 ###
7125 !! test
7126 Sanitizer: Closing of open tags
7127 !! input
7128 <s></s><table></table>
7129 !! result
7130 <s></s><table></table>
7131
7132 !! end
7133
7134 !! test
7135 Sanitizer: Closing of open but not closed tags
7136 !! input
7137 <s>foo
7138 !! result
7139 <p><s>foo</s>
7140 </p>
7141 !! end
7142
7143 !! test
7144 Sanitizer: Closing of closed but not open tags
7145 !! input
7146 </s>
7147 !! result
7148 <p>&lt;/s&gt;
7149 </p>
7150 !! end
7151
7152 !! test
7153 Sanitizer: Closing of closed but not open table tags
7154 !! input
7155 Table not started</td></tr></table>
7156 !! result
7157 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
7158 </p>
7159 !! end
7160
7161 !! test
7162 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
7163 !! input
7164 <span id="æ: v">byte</span>[[#æ: v|backlink]]
7165 !! result
7166 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
7167 </p>
7168 !! end
7169
7170 !! test
7171 Sanitizer: Validating the contents of the id attribute (bug 4515)
7172 !! options
7173 disabled
7174 !! input
7175 <br id=9 />
7176 !! result
7177 Something, but definitely not <br id="9" />...
7178 !! end
7179
7180 !! test
7181 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
7182 !! options
7183 disabled
7184 !! input
7185 <br id="foo" /><br id="foo" />
7186 !! result
7187 Something need to be done. foo-2 ?
7188 !! end
7189
7190 !! test
7191 Language converter: output gets cut off unexpectedly (bug 5757)
7192 !! options
7193 language=zh
7194 !! input
7195 this bit is safe: }-
7196
7197 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
7198
7199 then we get cut off here: }-
7200
7201 all additional text is vanished
7202 !! result
7203 <p>this bit is safe: }-
7204 </p><p>but if we add a conversion instance: xxx
7205 </p><p>then we get cut off here: }-
7206 </p><p>all additional text is vanished
7207 </p>
7208 !! end
7209
7210 !! test
7211 Self closed html pairs (bug 5487)
7212 !! options
7213 !! input
7214 <center><font id="bug" />Centered text</center>
7215 <div><font id="bug2" />In div text</div>
7216 !! result
7217 <center>&lt;font id="bug" /&gt;Centered text</center>
7218 <div>&lt;font id="bug2" /&gt;In div text</div>
7219
7220 !! end
7221
7222 #
7223 #
7224 #
7225
7226 !! test
7227 Punctuation: nbsp before exclamation
7228 !! input
7229 C'est grave !
7230 !! result
7231 <p>C'est grave&#160;!
7232 </p>
7233 !! end
7234
7235 !! test
7236 Punctuation: CSS !important (bug 11874)
7237 !! input
7238 <div style="width:50% !important">important</div>
7239 !! result
7240 <div style="width:50% !important">important</div>
7241
7242 !!end
7243
7244 !! test
7245 Punctuation: CSS ! important (bug 11874; with space after)
7246 !! input
7247 <div style="width:50% ! important">important</div>
7248 !! result
7249 <div style="width:50% ! important">important</div>
7250
7251 !!end
7252
7253
7254 !! test
7255 HTML bullet list, closed tags (bug 5497)
7256 !! input
7257 <ul>
7258 <li>One</li>
7259 <li>Two</li>
7260 </ul>
7261 !! result
7262 <ul>
7263 <li>One</li>
7264 <li>Two</li>
7265 </ul>
7266
7267 !! end
7268
7269 !! test
7270 HTML bullet list, unclosed tags (bug 5497)
7271 !! options
7272 disabled
7273 !! input
7274 <ul>
7275 <li>One
7276 <li>Two
7277 </ul>
7278 !! result
7279 <ul>
7280 <li>One
7281 </li><li>Two
7282 </li></ul>
7283
7284 !! end
7285
7286 !! test
7287 HTML ordered list, closed tags (bug 5497)
7288 !! input
7289 <ol>
7290 <li>One</li>
7291 <li>Two</li>
7292 </ol>
7293 !! result
7294 <ol>
7295 <li>One</li>
7296 <li>Two</li>
7297 </ol>
7298
7299 !! end
7300
7301 !! test
7302 HTML ordered list, unclosed tags (bug 5497)
7303 !! options
7304 disabled
7305 !! input
7306 <ol>
7307 <li>One
7308 <li>Two
7309 </ol>
7310 !! result
7311 <ol>
7312 <li>One
7313 </li><li>Two
7314 </li></ol>
7315
7316 !! end
7317
7318 !! test
7319 HTML nested bullet list, closed tags (bug 5497)
7320 !! input
7321 <ul>
7322 <li>One</li>
7323 <li>Two:
7324 <ul>
7325 <li>Sub-one</li>
7326 <li>Sub-two</li>
7327 </ul>
7328 </li>
7329 </ul>
7330 !! result
7331 <ul>
7332 <li>One</li>
7333 <li>Two:
7334 <ul>
7335 <li>Sub-one</li>
7336 <li>Sub-two</li>
7337 </ul>
7338 </li>
7339 </ul>
7340
7341 !! end
7342
7343 !! test
7344 HTML nested bullet list, open tags (bug 5497)
7345 !! options
7346 disabled
7347 !! input
7348 <ul>
7349 <li>One
7350 <li>Two:
7351 <ul>
7352 <li>Sub-one
7353 <li>Sub-two
7354 </ul>
7355 </ul>
7356 !! result
7357 <ul>
7358 <li>One
7359 </li><li>Two:
7360 <ul>
7361 <li>Sub-one
7362 </li><li>Sub-two
7363 </li></ul>
7364 </li></ul>
7365
7366 !! end
7367
7368 !! test
7369 HTML nested ordered list, closed tags (bug 5497)
7370 !! input
7371 <ol>
7372 <li>One</li>
7373 <li>Two:
7374 <ol>
7375 <li>Sub-one</li>
7376 <li>Sub-two</li>
7377 </ol>
7378 </li>
7379 </ol>
7380 !! result
7381 <ol>
7382 <li>One</li>
7383 <li>Two:
7384 <ol>
7385 <li>Sub-one</li>
7386 <li>Sub-two</li>
7387 </ol>
7388 </li>
7389 </ol>
7390
7391 !! end
7392
7393 !! test
7394 HTML nested ordered list, open tags (bug 5497)
7395 !! options
7396 disabled
7397 !! input
7398 <ol>
7399 <li>One
7400 <li>Two:
7401 <ol>
7402 <li>Sub-one
7403 <li>Sub-two
7404 </ol>
7405 </ol>
7406 !! result
7407 <ol>
7408 <li>One
7409 </li><li>Two:
7410 <ol>
7411 <li>Sub-one
7412 </li><li>Sub-two
7413 </li></ol>
7414 </li></ol>
7415
7416 !! end
7417
7418 !! test
7419 HTML ordered list item with parameters oddity
7420 !! input
7421 <ol><li id="fragment">One</li></ol>
7422 !! result
7423 <ol><li id="fragment">One</li></ol>
7424
7425 !! end
7426
7427 !!test
7428 bug 5918: autonumbering
7429 !! input
7430 [http://first/] [http://second] [ftp://ftp]
7431
7432 ftp://inlineftp
7433
7434 [mailto:enclosed@mail.tld With target]
7435
7436 [mailto:enclosed@mail.tld]
7437
7438 mailto:inline@mail.tld
7439 !! result
7440 <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>
7441 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
7442 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
7443 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
7444 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
7445 </p>
7446 !! end
7447
7448
7449 #
7450 # Security and HTML correctness
7451 # From Nick Jenkins' fuzz testing
7452 #
7453
7454 !! test
7455 Fuzz testing: Parser13
7456 !! input
7457 {|
7458 | http://a|
7459 !! result
7460 <table>
7461 <tr>
7462 <td>
7463 </td>
7464 </tr>
7465 </table>
7466
7467 !! end
7468
7469 !! test
7470 Fuzz testing: Parser14
7471 !! input
7472 == onmouseover= ==
7473 http://__TOC__
7474 !! result
7475 <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>
7476 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7477 <ul>
7478 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
7479 </ul>
7480 </td></tr></table>
7481
7482 !! end
7483
7484 !! test
7485 Fuzz testing: Parser14-table
7486 !! input
7487 ==a==
7488 {| STYLE=__TOC__
7489 !! result
7490 <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>
7491 <table style="&#95;_TOC&#95;_">
7492 <tr><td></td></tr>
7493 </table>
7494
7495 !! end
7496
7497 # Known to produce bogus xml (extra </td>)
7498 !! test
7499 Fuzz testing: Parser16
7500 !! options
7501 noxml
7502 !! input
7503 {|
7504 !https://||||||
7505 !! result
7506 <table>
7507 <tr>
7508 <th>https://</th>
7509 <th></th>
7510 <th></th>
7511 <th>
7512 </td>
7513 </tr>
7514 </table>
7515
7516 !! end
7517
7518 !! test
7519 Fuzz testing: Parser21
7520 !! input
7521 {|
7522 ! irc://{{ftp://a" onmouseover="alert('hello world');"
7523 |
7524 !! result
7525 <table>
7526 <tr>
7527 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
7528 </th>
7529 <td>
7530 </td>
7531 </tr>
7532 </table>
7533
7534 !! end
7535
7536 !! test
7537 Fuzz testing: Parser22
7538 !! input
7539 http://===r:::https://b
7540
7541 {|
7542 !!result
7543 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
7544 </p>
7545 <table>
7546 <tr><td></td></tr>
7547 </table>
7548
7549 !! end
7550
7551 # Known to produce bad XML for now
7552 !! test
7553 Fuzz testing: Parser24
7554 !! options
7555 noxml
7556 !! input
7557 {|
7558 {{{|
7559 <u CLASS=
7560 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
7561 <br style="onmouseover='alert(document.cookie);' " />
7562
7563 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
7564 |
7565 !! result
7566 <table>
7567 {{{|
7568 <u class="&#124;">}}}} &gt;
7569 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
7570
7571 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
7572 <tr>
7573 <td></u>
7574 </td>
7575 </tr>
7576 </table>
7577
7578 !! end
7579
7580 # Note: the current result listed for this is not what the original one was,
7581 # but the original bug was JavaScript injection, which is fixed in any case.
7582 # It's not clear that the original result listed was any more correct than the
7583 # current one. Original result:
7584 # <p>{{{|
7585 # </p>
7586 # <li class="&#124;&#124;">
7587 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
7588 !!test
7589 Fuzz testing: Parser25 (bug 6055)
7590 !! input
7591 {{{
7592 |
7593 <LI CLASS=||
7594 >
7595 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
7596 !! result
7597 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
7598 </p>
7599 !! end
7600
7601 !!test
7602 Fuzz testing: URL adjacent extension (with space, clean)
7603 !! options
7604 !! input
7605 http://example.com <nowiki>junk</nowiki>
7606 !! result
7607 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
7608 </p>
7609 !!end
7610
7611 !!test
7612 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
7613 !! options
7614 !! input
7615 http://example.com<nowiki>junk</nowiki>
7616 !! result
7617 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
7618 </p>
7619 !!end
7620
7621 !!test
7622 Fuzz testing: URL adjacent extension (no space, dirty; pre)
7623 !! options
7624 !! input
7625 http://example.com<pre>junk</pre>
7626 !! result
7627 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
7628
7629 !!end
7630
7631 !!test
7632 Fuzz testing: image with bogus manual thumbnail
7633 !!input
7634 [[Image:foobar.jpg|thumbnail= ]]
7635 !!result
7636 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
7637
7638 !!end
7639
7640 !! test
7641 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
7642 !! input
7643 <pre dir="&#10;"></pre>
7644 !! result
7645 <pre dir="&#10;"></pre>
7646
7647 !! end
7648
7649 !! test
7650 Parsing optional HTML elements (Bug 6171)
7651 !! options
7652 !! input
7653 <table>
7654 <tr>
7655 <td> Some tabular data</td>
7656 <td> More tabular data ...
7657 <td> And yet som tabular data</td>
7658 </tr>
7659 </table>
7660 !! result
7661 <table>
7662 <tr>
7663 <td> Some tabular data</td>
7664 <td> More tabular data ...
7665 </td><td> And yet som tabular data</td>
7666 </tr>
7667 </table>
7668
7669 !! end
7670
7671 !! test
7672 Correct handling of <td>, <tr> (Bug 6171)
7673 !! options
7674 !! input
7675 <table>
7676 <tr>
7677 <td> Some tabular data</td>
7678 <td> More tabular data ...</td>
7679 <td> And yet som tabular data</td>
7680 </tr>
7681 </table>
7682 !! result
7683 <table>
7684 <tr>
7685 <td> Some tabular data</td>
7686 <td> More tabular data ...</td>
7687 <td> And yet som tabular data</td>
7688 </tr>
7689 </table>
7690
7691 !! end
7692
7693
7694 !! test
7695 Parsing crashing regression (fr:JavaScript)
7696 !! input
7697 </body></x>
7698 !! result
7699 <p>&lt;/body&gt;&lt;/x&gt;
7700 </p>
7701 !! end
7702
7703 !! test
7704 Inline wiki vs wiki block nesting
7705 !! input
7706 '''Bold paragraph
7707
7708 New wiki paragraph
7709 !! result
7710 <p><b>Bold paragraph</b>
7711 </p><p>New wiki paragraph
7712 </p>
7713 !! end
7714
7715 !! test
7716 Inline HTML vs wiki block nesting
7717 !! options
7718 disabled
7719 !! input
7720 <b>Bold paragraph
7721
7722 New wiki paragraph
7723 !! result
7724 <p><b>Bold paragraph</b>
7725 </p><p>New wiki paragraph
7726 </p>
7727 !! end
7728
7729 # Original result was this:
7730 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
7731 # </p>
7732 # While that might be marginally more intuitive, maybe, the six-apostrophe
7733 # construct is clearly pathological and the result stated here (which is what
7734 # the parser actually does) is about as reasonable as anything.
7735 !!test
7736 Mixing markup for italics and bold
7737 !! options
7738 !! input
7739 '''bold''''''bold''bolditalics'''''
7740 !! result
7741 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
7742 </p>
7743 !! end
7744
7745
7746 !! article
7747 Xyzzyx
7748 !! text
7749 Article for special page transclusion test
7750 !! endarticle
7751
7752 !! test
7753 Special page transclusion
7754 !! options
7755 !! input
7756 {{Special:Prefixindex/Xyzzyx}}
7757 !! result
7758 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7759
7760 !! end
7761
7762 !! test
7763 Special page transclusion twice (bug 5021)
7764 !! options
7765 !! input
7766 {{Special:Prefixindex/Xyzzyx}}
7767 {{Special:Prefixindex/Xyzzyx}}
7768 !! result
7769 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7770 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7771
7772 !! end
7773
7774 !! test
7775 Transclusion of default MediaWiki message
7776 !! input
7777 {{MediaWiki:Mainpage}}
7778 !!result
7779 <p>Main Page
7780 </p>
7781 !! end
7782
7783 !! test
7784 Transclusion of nonexistent MediaWiki message
7785 !! input
7786 {{MediaWiki:Mainpagexxx}}
7787 !!result
7788 <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>
7789 </p>
7790 !! end
7791
7792 !! test
7793 Transclusion of MediaWiki message with underscore
7794 !! input
7795 {{MediaWiki:history_short}}
7796 !! result
7797 <p>History
7798 </p>
7799 !! end
7800
7801 !! test
7802 Transclusion of MediaWiki message with space
7803 !! input
7804 {{MediaWiki:history short}}
7805 !! result
7806 <p>History
7807 </p>
7808 !! end
7809
7810 !! test
7811 Invalid header with following text
7812 !! input
7813 = x = y
7814 !! result
7815 <p>= x = y
7816 </p>
7817 !! end
7818
7819
7820 !! test
7821 Section extraction test (section 0)
7822 !! options
7823 section=0
7824 !! input
7825 start
7826 ==a==
7827 ===aa===
7828 ====aaa====
7829 ==b==
7830 ===ba===
7831 ===bb===
7832 ====bba====
7833 ===bc===
7834 ==c==
7835 ===ca===
7836 !! result
7837 start
7838 !! end
7839
7840 !! test
7841 Section extraction test (section 1)
7842 !! options
7843 section=1
7844 !! input
7845 start
7846 ==a==
7847 ===aa===
7848 ====aaa====
7849 ==b==
7850 ===ba===
7851 ===bb===
7852 ====bba====
7853 ===bc===
7854 ==c==
7855 ===ca===
7856 !! result
7857 ==a==
7858 ===aa===
7859 ====aaa====
7860 !! end
7861
7862 !! test
7863 Section extraction test (section 2)
7864 !! options
7865 section=2
7866 !! input
7867 start
7868 ==a==
7869 ===aa===
7870 ====aaa====
7871 ==b==
7872 ===ba===
7873 ===bb===
7874 ====bba====
7875 ===bc===
7876 ==c==
7877 ===ca===
7878 !! result
7879 ===aa===
7880 ====aaa====
7881 !! end
7882
7883 !! test
7884 Section extraction test (section 3)
7885 !! options
7886 section=3
7887 !! input
7888 start
7889 ==a==
7890 ===aa===
7891 ====aaa====
7892 ==b==
7893 ===ba===
7894 ===bb===
7895 ====bba====
7896 ===bc===
7897 ==c==
7898 ===ca===
7899 !! result
7900 ====aaa====
7901 !! end
7902
7903 !! test
7904 Section extraction test (section 4)
7905 !! options
7906 section=4
7907 !! input
7908 start
7909 ==a==
7910 ===aa===
7911 ====aaa====
7912 ==b==
7913 ===ba===
7914 ===bb===
7915 ====bba====
7916 ===bc===
7917 ==c==
7918 ===ca===
7919 !! result
7920 ==b==
7921 ===ba===
7922 ===bb===
7923 ====bba====
7924 ===bc===
7925 !! end
7926
7927 !! test
7928 Section extraction test (section 5)
7929 !! options
7930 section=5
7931 !! input
7932 start
7933 ==a==
7934 ===aa===
7935 ====aaa====
7936 ==b==
7937 ===ba===
7938 ===bb===
7939 ====bba====
7940 ===bc===
7941 ==c==
7942 ===ca===
7943 !! result
7944 ===ba===
7945 !! end
7946
7947 !! test
7948 Section extraction test (section 6)
7949 !! options
7950 section=6
7951 !! input
7952 start
7953 ==a==
7954 ===aa===
7955 ====aaa====
7956 ==b==
7957 ===ba===
7958 ===bb===
7959 ====bba====
7960 ===bc===
7961 ==c==
7962 ===ca===
7963 !! result
7964 ===bb===
7965 ====bba====
7966 !! end
7967
7968 !! test
7969 Section extraction test (section 7)
7970 !! options
7971 section=7
7972 !! input
7973 start
7974 ==a==
7975 ===aa===
7976 ====aaa====
7977 ==b==
7978 ===ba===
7979 ===bb===
7980 ====bba====
7981 ===bc===
7982 ==c==
7983 ===ca===
7984 !! result
7985 ====bba====
7986 !! end
7987
7988 !! test
7989 Section extraction test (section 8)
7990 !! options
7991 section=8
7992 !! input
7993 start
7994 ==a==
7995 ===aa===
7996 ====aaa====
7997 ==b==
7998 ===ba===
7999 ===bb===
8000 ====bba====
8001 ===bc===
8002 ==c==
8003 ===ca===
8004 !! result
8005 ===bc===
8006 !! end
8007
8008 !! test
8009 Section extraction test (section 9)
8010 !! options
8011 section=9
8012 !! input
8013 start
8014 ==a==
8015 ===aa===
8016 ====aaa====
8017 ==b==
8018 ===ba===
8019 ===bb===
8020 ====bba====
8021 ===bc===
8022 ==c==
8023 ===ca===
8024 !! result
8025 ==c==
8026 ===ca===
8027 !! end
8028
8029 !! test
8030 Section extraction test (section 10)
8031 !! options
8032 section=10
8033 !! input
8034 start
8035 ==a==
8036 ===aa===
8037 ====aaa====
8038 ==b==
8039 ===ba===
8040 ===bb===
8041 ====bba====
8042 ===bc===
8043 ==c==
8044 ===ca===
8045 !! result
8046 ===ca===
8047 !! end
8048
8049 !! test
8050 Section extraction test (nonexistent section 11)
8051 !! options
8052 section=11
8053 !! input
8054 start
8055 ==a==
8056 ===aa===
8057 ====aaa====
8058 ==b==
8059 ===ba===
8060 ===bb===
8061 ====bba====
8062 ===bc===
8063 ==c==
8064 ===ca===
8065 !! result
8066 !! end
8067
8068 !! test
8069 Section extraction test with bogus heading (section 1)
8070 !! options
8071 section=1
8072 !! input
8073 ==a==
8074 ==bogus== not a legal section
8075 ==b==
8076 !! result
8077 ==a==
8078 ==bogus== not a legal section
8079 !! end
8080
8081 !! test
8082 Section extraction test with bogus heading (section 2)
8083 !! options
8084 section=2
8085 !! input
8086 ==a==
8087 ==bogus== not a legal section
8088 ==b==
8089 !! result
8090 ==b==
8091 !! end
8092
8093 !! test
8094 Section extraction test with comment after heading (section 1)
8095 !! options
8096 section=1
8097 !! input
8098 ==a==
8099 ==b== <!-- -->
8100 ==c==
8101 !! result
8102 ==a==
8103 !! end
8104
8105 !! test
8106 Section extraction test with comment after heading (section 2)
8107 !! options
8108 section=2
8109 !! input
8110 ==a==
8111 ==b== <!-- -->
8112 ==c==
8113 !! result
8114 ==b== <!-- -->
8115 !! end
8116
8117 !! test
8118 Section extraction test with bogus <nowiki> heading (section 1)
8119 !! options
8120 section=1
8121 !! input
8122 ==a==
8123 ==bogus== <nowiki>not a legal section</nowiki>
8124 ==b==
8125 !! result
8126 ==a==
8127 ==bogus== <nowiki>not a legal section</nowiki>
8128 !! end
8129
8130 !! test
8131 Section extraction test with bogus <nowiki> heading (section 2)
8132 !! options
8133 section=2
8134 !! input
8135 ==a==
8136 ==bogus== <nowiki>not a legal section</nowiki>
8137 ==b==
8138 !! result
8139 ==b==
8140 !! end
8141
8142
8143 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
8144 # instead of respecting commented sections
8145 !! test
8146 Section extraction prefixed by comment (section 1)
8147 !! options
8148 section=1
8149 !! input
8150 <!-- -->==sec1==
8151 ==sec2==
8152 !!result
8153 ==sec2==
8154 !!end
8155
8156 !! test
8157 Section extraction prefixed by comment (section 2)
8158 !! options
8159 section=2
8160 !! input
8161 <!-- -->==sec1==
8162 ==sec2==
8163 !!result
8164
8165 !!end
8166
8167
8168 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
8169 # instead of respecting HTML-style headings
8170 !! test
8171 Section extraction, mixed wiki and html (section 1)
8172 !! options
8173 section=1
8174 !! input
8175 <h2>unmarked</h2>
8176 unmarked
8177 ==1==
8178 one
8179 ==2==
8180 two
8181 !! result
8182 ==1==
8183 one
8184 !! end
8185
8186 !! test
8187 Section extraction, mixed wiki and html (section 2)
8188 !! options
8189 section=2
8190 !! input
8191 <h2>unmarked</h2>
8192 unmarked
8193 ==1==
8194 one
8195 ==2==
8196 two
8197 !! result
8198 ==2==
8199 two
8200 !! end
8201
8202
8203 # Formerly testing for bug 3342
8204 !! test
8205 Section extraction, heading surrounded by <noinclude>
8206 !! options
8207 section=1
8208 !! input
8209 <noinclude>==unmarked==</noinclude>
8210 ==marked==
8211 !! result
8212 ==marked==
8213 !!end
8214
8215 # Test behaviour of bug 19910
8216 !! test
8217 Sectiion with all-equals
8218 !! options
8219 section=2
8220 !! input
8221 ===
8222 The line above must have a trailing space
8223 === <!--
8224 --> <!-- -->
8225 But just in case it doesn't...
8226 !! result
8227 === <!--
8228 --> <!-- -->
8229 But just in case it doesn't...
8230 !! end
8231
8232 !! test
8233 Section replacement test (section 0)
8234 !! options
8235 replace=0,"xxx"
8236 !! input
8237 start
8238 ==a==
8239 ===aa===
8240 ====aaa====
8241 ==b==
8242 ===ba===
8243 ===bb===
8244 ====bba====
8245 ===bc===
8246 ==c==
8247 ===ca===
8248 !! result
8249 xxx
8250
8251 ==a==
8252 ===aa===
8253 ====aaa====
8254 ==b==
8255 ===ba===
8256 ===bb===
8257 ====bba====
8258 ===bc===
8259 ==c==
8260 ===ca===
8261 !! end
8262
8263 !! test
8264 Section replacement test (section 1)
8265 !! options
8266 replace=1,"xxx"
8267 !! input
8268 start
8269 ==a==
8270 ===aa===
8271 ====aaa====
8272 ==b==
8273 ===ba===
8274 ===bb===
8275 ====bba====
8276 ===bc===
8277 ==c==
8278 ===ca===
8279 !! result
8280 start
8281 xxx
8282
8283 ==b==
8284 ===ba===
8285 ===bb===
8286 ====bba====
8287 ===bc===
8288 ==c==
8289 ===ca===
8290 !! end
8291
8292 !! test
8293 Section replacement test (section 2)
8294 !! options
8295 replace=2,"xxx"
8296 !! input
8297 start
8298 ==a==
8299 ===aa===
8300 ====aaa====
8301 ==b==
8302 ===ba===
8303 ===bb===
8304 ====bba====
8305 ===bc===
8306 ==c==
8307 ===ca===
8308 !! result
8309 start
8310 ==a==
8311 xxx
8312
8313 ==b==
8314 ===ba===
8315 ===bb===
8316 ====bba====
8317 ===bc===
8318 ==c==
8319 ===ca===
8320 !! end
8321
8322 !! test
8323 Section replacement test (section 3)
8324 !! options
8325 replace=3,"xxx"
8326 !! input
8327 start
8328 ==a==
8329 ===aa===
8330 ====aaa====
8331 ==b==
8332 ===ba===
8333 ===bb===
8334 ====bba====
8335 ===bc===
8336 ==c==
8337 ===ca===
8338 !! result
8339 start
8340 ==a==
8341 ===aa===
8342 xxx
8343
8344 ==b==
8345 ===ba===
8346 ===bb===
8347 ====bba====
8348 ===bc===
8349 ==c==
8350 ===ca===
8351 !! end
8352
8353 !! test
8354 Section replacement test (section 4)
8355 !! options
8356 replace=4,"xxx"
8357 !! input
8358 start
8359 ==a==
8360 ===aa===
8361 ====aaa====
8362 ==b==
8363 ===ba===
8364 ===bb===
8365 ====bba====
8366 ===bc===
8367 ==c==
8368 ===ca===
8369 !! result
8370 start
8371 ==a==
8372 ===aa===
8373 ====aaa====
8374 xxx
8375
8376 ==c==
8377 ===ca===
8378 !! end
8379
8380 !! test
8381 Section replacement test (section 5)
8382 !! options
8383 replace=5,"xxx"
8384 !! input
8385 start
8386 ==a==
8387 ===aa===
8388 ====aaa====
8389 ==b==
8390 ===ba===
8391 ===bb===
8392 ====bba====
8393 ===bc===
8394 ==c==
8395 ===ca===
8396 !! result
8397 start
8398 ==a==
8399 ===aa===
8400 ====aaa====
8401 ==b==
8402 xxx
8403
8404 ===bb===
8405 ====bba====
8406 ===bc===
8407 ==c==
8408 ===ca===
8409 !! end
8410
8411 !! test
8412 Section replacement test (section 6)
8413 !! options
8414 replace=6,"xxx"
8415 !! input
8416 start
8417 ==a==
8418 ===aa===
8419 ====aaa====
8420 ==b==
8421 ===ba===
8422 ===bb===
8423 ====bba====
8424 ===bc===
8425 ==c==
8426 ===ca===
8427 !! result
8428 start
8429 ==a==
8430 ===aa===
8431 ====aaa====
8432 ==b==
8433 ===ba===
8434 xxx
8435
8436 ===bc===
8437 ==c==
8438 ===ca===
8439 !! end
8440
8441 !! test
8442 Section replacement test (section 7)
8443 !! options
8444 replace=7,"xxx"
8445 !! input
8446 start
8447 ==a==
8448 ===aa===
8449 ====aaa====
8450 ==b==
8451 ===ba===
8452 ===bb===
8453 ====bba====
8454 ===bc===
8455 ==c==
8456 ===ca===
8457 !! result
8458 start
8459 ==a==
8460 ===aa===
8461 ====aaa====
8462 ==b==
8463 ===ba===
8464 ===bb===
8465 xxx
8466
8467 ===bc===
8468 ==c==
8469 ===ca===
8470 !! end
8471
8472 !! test
8473 Section replacement test (section 8)
8474 !! options
8475 replace=8,"xxx"
8476 !! input
8477 start
8478 ==a==
8479 ===aa===
8480 ====aaa====
8481 ==b==
8482 ===ba===
8483 ===bb===
8484 ====bba====
8485 ===bc===
8486 ==c==
8487 ===ca===
8488 !! result
8489 start
8490 ==a==
8491 ===aa===
8492 ====aaa====
8493 ==b==
8494 ===ba===
8495 ===bb===
8496 ====bba====
8497 xxx
8498
8499 ==c==
8500 ===ca===
8501 !!end
8502
8503 !! test
8504 Section replacement test (section 9)
8505 !! options
8506 replace=9,"xxx"
8507 !! input
8508 start
8509 ==a==
8510 ===aa===
8511 ====aaa====
8512 ==b==
8513 ===ba===
8514 ===bb===
8515 ====bba====
8516 ===bc===
8517 ==c==
8518 ===ca===
8519 !! result
8520 start
8521 ==a==
8522 ===aa===
8523 ====aaa====
8524 ==b==
8525 ===ba===
8526 ===bb===
8527 ====bba====
8528 ===bc===
8529 xxx
8530 !! end
8531
8532 !! test
8533 Section replacement test (section 10)
8534 !! options
8535 replace=10,"xxx"
8536 !! input
8537 start
8538 ==a==
8539 ===aa===
8540 ====aaa====
8541 ==b==
8542 ===ba===
8543 ===bb===
8544 ====bba====
8545 ===bc===
8546 ==c==
8547 ===ca===
8548 !! result
8549 start
8550 ==a==
8551 ===aa===
8552 ====aaa====
8553 ==b==
8554 ===ba===
8555 ===bb===
8556 ====bba====
8557 ===bc===
8558 ==c==
8559 xxx
8560 !! end
8561
8562 !! test
8563 Section replacement test with initial whitespace (bug 13728)
8564 !! options
8565 replace=2,"xxx"
8566 !! input
8567 Preformatted initial line
8568 ==a==
8569 ===a===
8570 !! result
8571 Preformatted initial line
8572 ==a==
8573 xxx
8574 !! end
8575
8576
8577 !! test
8578 Section extraction, heading followed by pre with 20 spaces (bug 6398)
8579 !! options
8580 section=1
8581 !! input
8582 ==a==
8583 a
8584 !! result
8585 ==a==
8586 a
8587 !! end
8588
8589 !! test
8590 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
8591 !! options
8592 section=1
8593 !! input
8594 ==a==
8595 a
8596 !! result
8597 ==a==
8598 a
8599 !! end
8600
8601
8602 !! test
8603 Section extraction, <pre> around bogus header (bug 10309)
8604 !! options
8605 noxml section=2
8606 !! input
8607 == Section One ==
8608 <pre>
8609 =======
8610 </pre>
8611
8612 == Section Two ==
8613 stuff
8614 !! result
8615 == Section Two ==
8616 stuff
8617 !! end
8618
8619 !! test
8620 Section replacement, <pre> around bogus header (bug 10309)
8621 !! options
8622 noxml replace=2,"xxx"
8623 !! input
8624 == Section One ==
8625 <pre>
8626 =======
8627 </pre>
8628
8629 == Section Two ==
8630 stuff
8631 !! result
8632 == Section One ==
8633 <pre>
8634 =======
8635 </pre>
8636
8637 xxx
8638 !! end
8639
8640
8641
8642 !! test
8643 Handling of &#x0A; in URLs
8644 !! input
8645 **irc://&#x0A;a
8646 !! result
8647 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
8648 </li></ul>
8649 </li></ul>
8650
8651 !!end
8652
8653 !! test
8654 5 quotes, code coverage +1 line
8655 !! input
8656 '''''
8657 !! result
8658 !! end
8659
8660 !! test
8661 Special:Search page linking.
8662 !! input
8663 {{Special:search}}
8664 !! result
8665 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
8666 </p>
8667 !! end
8668
8669 !! test
8670 Say the magic word
8671 !! input
8672 * {{PAGENAME}}
8673 * {{BASEPAGENAME}}
8674 * {{SUBPAGENAME}}
8675 * {{SUBPAGENAMEE}}
8676 * {{BASEPAGENAME}}
8677 * {{BASEPAGENAMEE}}
8678 * {{TALKPAGENAME}}
8679 * {{TALKPAGENAMEE}}
8680 * {{SUBJECTPAGENAME}}
8681 * {{SUBJECTPAGENAMEE}}
8682 * {{NAMESPACEE}}
8683 * {{NAMESPACE}}
8684 * {{TALKSPACE}}
8685 * {{TALKSPACEE}}
8686 * {{SUBJECTSPACE}}
8687 * {{SUBJECTSPACEE}}
8688 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
8689 !! result
8690 <ul><li> Parser test
8691 </li><li> Parser test
8692 </li><li> Parser test
8693 </li><li> Parser_test
8694 </li><li> Parser test
8695 </li><li> Parser_test
8696 </li><li> Talk:Parser test
8697 </li><li> Talk:Parser_test
8698 </li><li> Parser test
8699 </li><li> Parser_test
8700 </li><li>
8701 </li><li>
8702 </li><li> Talk
8703 </li><li> Talk
8704 </li><li>
8705 </li><li>
8706 </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>
8707 </li></ul>
8708
8709 !! end
8710 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
8711
8712 !! test
8713 Gallery
8714 !! input
8715 <gallery>
8716 image1.png |
8717 image2.gif|||||
8718
8719 image3|
8720 image4 |300px| centre
8721 image5.svg| http://///////
8722 [[x|xx]]]]
8723 * image6
8724 </gallery>
8725 !! result
8726 <ul class="gallery">
8727 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8728 <div style="height: 150px;">Image1.png</div>
8729 <div class="gallerytext">
8730 </div>
8731 </div></li>
8732 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8733 <div style="height: 150px;">Image2.gif</div>
8734 <div class="gallerytext">
8735 <p>||||
8736 </p>
8737 </div>
8738 </div></li>
8739 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8740 <div style="height: 150px;">Image3</div>
8741 <div class="gallerytext">
8742 </div>
8743 </div></li>
8744 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8745 <div style="height: 150px;">Image4</div>
8746 <div class="gallerytext">
8747 <p>300px| centre
8748 </p>
8749 </div>
8750 </div></li>
8751 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8752 <div style="height: 150px;">Image5.svg</div>
8753 <div class="gallerytext">
8754 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
8755 </p>
8756 </div>
8757 </div></li>
8758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8759 <div style="height: 150px;">* image6</div>
8760 <div class="gallerytext">
8761 </div>
8762 </div></li>
8763 </ul>
8764
8765 !! end
8766
8767 !! test
8768 Gallery (with options)
8769 !! input
8770 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
8771 File:Nonexistant.jpg|caption
8772 File:Nonexistant.jpg
8773 image:foobar.jpg|some '''caption''' [[Main Page]]
8774 image:foobar.jpg
8775 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
8776 </gallery>
8777 !! result
8778 <ul class="gallery" style="max-width: 226px;_width: 226px;">
8779 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
8780 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8781 <div style="height: 70px;">Nonexistant.jpg</div>
8782 <div class="gallerytext">
8783 <p>caption
8784 </p>
8785 </div>
8786 </div></li>
8787 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8788 <div style="height: 70px;">Nonexistant.jpg</div>
8789 <div class="gallerytext">
8790 </div>
8791 </div></li>
8792 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8793 <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>
8794 <div class="gallerytext">
8795 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8796 </p>
8797 </div>
8798 </div></li>
8799 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8800 <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>
8801 <div class="gallerytext">
8802 </div>
8803 </div></li>
8804 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8805 <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>
8806 <div class="gallerytext">
8807 <p>Blabla|blabla.
8808 </p>
8809 </div>
8810 </div></li>
8811 </ul>
8812
8813 !! end
8814
8815 !! test
8816 Gallery with wikitext inside caption
8817 !! input
8818 <gallery>
8819 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
8820 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
8821 </gallery>
8822 !! result
8823 <ul class="gallery">
8824 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8825 <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>
8826 <div class="gallerytext">
8827 <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>
8828 </p>
8829 </div>
8830 </div></li>
8831 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8832 <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>
8833 <div class="gallerytext">
8834 <p>This is a test template
8835 </p>
8836 </div>
8837 </div></li>
8838 </ul>
8839
8840 !! end
8841
8842 !! test
8843 gallery (with showfilename option)
8844 !! input
8845 <gallery showfilename>
8846 File:Nonexistant.jpg|caption
8847 File:Nonexistant.jpg
8848 image:foobar.jpg|some '''caption''' [[Main Page]]
8849 File:Foobar.jpg
8850 </gallery>
8851 !! result
8852 <ul class="gallery">
8853 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8854 <div style="height: 150px;">Nonexistant.jpg</div>
8855 <div class="gallerytext">
8856 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
8857 caption
8858 </p>
8859 </div>
8860 </div></li>
8861 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8862 <div style="height: 150px;">Nonexistant.jpg</div>
8863 <div class="gallerytext">
8864 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
8865 </p>
8866 </div>
8867 </div></li>
8868 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8869 <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>
8870 <div class="gallerytext">
8871 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
8872 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8873 </p>
8874 </div>
8875 </div></li>
8876 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8877 <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>
8878 <div class="gallerytext">
8879 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
8880 </p>
8881 </div>
8882 </div></li>
8883 </ul>
8884
8885 !! end
8886
8887 !! test
8888 Gallery (with namespace-less filenames)
8889 !! input
8890 <gallery>
8891 File:Nonexistant.jpg
8892 Nonexistant.jpg
8893 image:foobar.jpg
8894 foobar.jpg
8895 </gallery>
8896 !! result
8897 <ul class="gallery">
8898 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8899 <div style="height: 150px;">Nonexistant.jpg</div>
8900 <div class="gallerytext">
8901 </div>
8902 </div></li>
8903 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8904 <div style="height: 150px;">Nonexistant.jpg</div>
8905 <div class="gallerytext">
8906 </div>
8907 </div></li>
8908 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8909 <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>
8910 <div class="gallerytext">
8911 </div>
8912 </div></li>
8913 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8914 <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>
8915 <div class="gallerytext">
8916 </div>
8917 </div></li>
8918 </ul>
8919
8920 !! end
8921
8922 !! test
8923 HTML Hex character encoding (spells the word "JavaScript")
8924 !! input
8925 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
8926 !! result
8927 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
8928 </p>
8929 !! end
8930
8931 !! test
8932 HTML Hex character encoding bogus encoding (bug 26437 regression check)
8933 !! input
8934 &#xsee;&#XSEE;
8935 !! result
8936 <p>&amp;#xsee;&amp;#XSEE;
8937 </p>
8938 !! end
8939
8940 !! test
8941 HTML Hex character encoding mixed case
8942 !! input
8943 &#xEE;&#Xee;
8944 !! result
8945 <p>&#xee;&#xee;
8946 </p>
8947 !! end
8948
8949 !! test
8950 __FORCETOC__ override
8951 !! input
8952 __NEWSECTIONLINK__
8953 __FORCETOC__
8954 !! result
8955 <p><br />
8956 </p>
8957 !! end
8958
8959 !! test
8960 ISBN code coverage
8961 !! input
8962 ISBN 978-0-1234-56&#x20;789
8963 !! result
8964 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
8965 </p>
8966 !! end
8967
8968 !! test
8969 ISBN followed by 5 spaces
8970 !! input
8971 ISBN
8972 !! result
8973 <p>ISBN
8974 </p>
8975 !! end
8976
8977 !! test
8978 Double ISBN
8979 !! input
8980 ISBN ISBN 1234567890
8981 !! result
8982 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
8983 </p>
8984 !! end
8985
8986 !! test
8987 Bug 22905: <abbr> followed by ISBN followed by </a>
8988 !! input
8989 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
8990 !! result
8991 <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>
8992 </p>
8993 !! end
8994
8995 !! test
8996 Double RFC
8997 !! input
8998 RFC RFC 1234
8999 !! result
9000 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
9001 </p>
9002 !! end
9003
9004 !! test
9005 Double RFC with a wiki link
9006 !! input
9007 RFC [[RFC 1234]]
9008 !! result
9009 <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>
9010 </p>
9011 !! end
9012
9013 !! test
9014 RFC code coverage
9015 !! input
9016 RFC 983&#x20;987
9017 !! result
9018 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
9019 </p>
9020 !! end
9021
9022 !! test
9023 Centre-aligned image
9024 !! input
9025 [[Image:foobar.jpg|centre]]
9026 !! result
9027 <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>
9028
9029 !!end
9030
9031 !! test
9032 None-aligned image
9033 !! input
9034 [[Image:foobar.jpg|none]]
9035 !! result
9036 <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>
9037
9038 !!end
9039
9040 !! test
9041 Width + Height sized image (using px) (height is ignored)
9042 !! input
9043 [[Image:foobar.jpg|640x480px]]
9044 !! result
9045 <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>
9046 </p>
9047 !!end
9048
9049 !! test
9050 Width-sized image (using px, no following whitespace)
9051 !! input
9052 [[Image:foobar.jpg|640px]]
9053 !! result
9054 <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>
9055 </p>
9056 !!end
9057
9058 !! test
9059 Width-sized image (using px, with following whitespace - test regression from r39467)
9060 !! input
9061 [[Image:foobar.jpg|640px ]]
9062 !! result
9063 <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>
9064 </p>
9065 !!end
9066
9067 !! test
9068 Width-sized image (using px, with preceding whitespace - test regression from r39467)
9069 !! input
9070 [[Image:foobar.jpg| 640px]]
9071 !! result
9072 <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>
9073 </p>
9074 !!end
9075
9076 !! test
9077 Another italics / bold test
9078 !! input
9079 ''' ''x'
9080 !! result
9081 <pre>'<i> </i>x'
9082 </pre>
9083 !!end
9084
9085 # Note the results may be incorrect, as parserTest output included this:
9086 # XML error: Mismatched tag at byte 6120:
9087 # ...<dd> </dt></dl> </dd...
9088 !! test
9089 dt/dd/dl test
9090 !! options
9091 disabled
9092 !! input
9093 :;;;::
9094 !! result
9095 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
9096 </dd></dl>
9097 </dd></dl>
9098 </dt></dl>
9099 </dt></dl>
9100 </dt></dl>
9101 </dd></dl>
9102
9103 !!end
9104
9105
9106 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
9107 !! test
9108 Images with the "|" character in the comment
9109 !! input
9110 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
9111 !! result
9112 <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>
9113
9114 !!end
9115
9116 !! test
9117 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
9118 !! input
9119 <html><script>alert(1);</script></html>
9120 !! result
9121 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
9122 </p>
9123 !! end
9124
9125 !! test
9126 HTML with raw HTML ($wgRawHtml==true)
9127 !! options
9128 rawhtml
9129 !! input
9130 <html><script>alert(1);</script></html>
9131 !! result
9132 <p><script>alert(1);</script>
9133 </p>
9134 !! end
9135
9136 !! test
9137 Parents of subpages, one level up
9138 !! options
9139 subpage title=[[Subpage test/L1/L2/L3]]
9140 !! input
9141 [[../|L2]]
9142 !! result
9143 <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>
9144 </p>
9145 !! end
9146
9147
9148 !! test
9149 Parents of subpages, one level up, not named
9150 !! options
9151 subpage title=[[Subpage test/L1/L2/L3]]
9152 !! input
9153 [[../]]
9154 !! result
9155 <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>
9156 </p>
9157 !! end
9158
9159
9160
9161 !! test
9162 Parents of subpages, two levels up
9163 !! options
9164 subpage title=[[Subpage test/L1/L2/L3]]
9165 !! input
9166 [[../../|L1]]2
9167
9168 [[../../|L1]]l
9169 !! result
9170 <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
9171 </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>
9172 </p>
9173 !! end
9174
9175 !! test
9176 Parents of subpages, two levels up, without trailing slash or name.
9177 !! options
9178 subpage title=[[Subpage test/L1/L2/L3]]
9179 !! input
9180 [[../..]]
9181 !! result
9182 <p>[[../..]]
9183 </p>
9184 !! end
9185
9186 !! test
9187 Parents of subpages, two levels up, with lots of extra trailing slashes.
9188 !! options
9189 subpage title=[[Subpage test/L1/L2/L3]]
9190 !! input
9191 [[../../////]]
9192 !! result
9193 <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>
9194 </p>
9195 !! end
9196
9197 !! test
9198 Definition list code coverage
9199 !! input
9200 ; title : def
9201 ; title : def
9202 ;title: def
9203 !! result
9204 <dl><dt> title &#160;</dt><dd> def
9205 </dd><dt> title&#160;</dt><dd> def
9206 </dd><dt>title</dt><dd> def
9207 </dd></dl>
9208
9209 !! end
9210
9211 !! test
9212 Don't fall for the self-closing div
9213 !! input
9214 <div>hello world</div/>
9215 !! result
9216 <div>hello world</div>
9217
9218 !! end
9219
9220 !! test
9221 MSGNW magic word
9222 !! input
9223 {{MSGNW:msg}}
9224 !! result
9225 <p>&#91;&#91;:Template:Msg&#93;&#93;
9226 </p>
9227 !! end
9228
9229 !! test
9230 RAW magic word
9231 !! input
9232 {{RAW:QUERTY}}
9233 !! result
9234 <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>
9235 </p>
9236 !! end
9237
9238 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
9239 !! test
9240 Always escape literal '>' in output, not just after '<'
9241 !! input
9242 ><>
9243 !! result
9244 <p>&gt;&lt;&gt;
9245 </p>
9246 !! end
9247
9248 !! test
9249 Template caching
9250 !! input
9251 {{Test}}
9252 {{Test}}
9253 !! result
9254 <p>This is a test template
9255 This is a test template
9256 </p>
9257 !! end
9258
9259
9260 !! article
9261 MediaWiki:Fake
9262 !! text
9263 ==header==
9264 !! endarticle
9265
9266 !! test
9267 Inclusion of !userCanEdit() content
9268 !! input
9269 {{MediaWiki:Fake}}
9270 !! result
9271 <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>
9272
9273 !! end
9274
9275
9276 !! test
9277 Out-of-order TOC heading levels
9278 !! input
9279 ==2==
9280 ======6======
9281 ===3===
9282 =1=
9283 =====5=====
9284 ==2==
9285 !! result
9286 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9287 <ul>
9288 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
9289 <ul>
9290 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
9291 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
9292 </ul>
9293 </li>
9294 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
9295 <ul>
9296 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
9297 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
9298 </ul>
9299 </li>
9300 </ul>
9301 </td></tr></table>
9302 <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>
9303 <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>
9304 <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>
9305 <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>
9306 <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>
9307 <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>
9308
9309 !! end
9310
9311
9312 !! test
9313 ISBN with a dummy number
9314 !! input
9315 ISBN ---
9316 !! result
9317 <p>ISBN ---
9318 </p>
9319 !! end
9320
9321
9322 !! test
9323 ISBN with space-delimited number
9324 !! input
9325 ISBN 92 9017 032 8
9326 !! result
9327 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
9328 </p>
9329 !! end
9330
9331
9332 !! test
9333 ISBN with multiple spaces, no number
9334 !! input
9335 ISBN foo
9336 !! result
9337 <p>ISBN foo
9338 </p>
9339 !! end
9340
9341
9342 !! test
9343 ISBN length
9344 !! input
9345 ISBN 123456789
9346
9347 ISBN 1234567890
9348
9349 ISBN 12345678901
9350 !! result
9351 <p>ISBN 123456789
9352 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9353 </p><p>ISBN 12345678901
9354 </p>
9355 !! end
9356
9357
9358 !! test
9359 ISBN with trailing year (bug 8110)
9360 !! input
9361 ISBN 1-234-56789-0 - 2006
9362
9363 ISBN 1 234 56789 0 - 2006
9364 !! result
9365 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
9366 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
9367 </p>
9368 !! end
9369
9370
9371 !! test
9372 anchorencode
9373 !! input
9374 {{anchorencode:foo bar©#%n}}
9375 !! result
9376 <p>foo_bar.C2.A9.23.25n
9377 </p>
9378 !! end
9379
9380 !! test
9381 anchorencode trims spaces
9382 !! input
9383 {{anchorencode: __pretty__please__}}
9384 !! result
9385 <p>pretty_please
9386 </p>
9387 !! end
9388
9389 !! test
9390 anchorencode deals with links
9391 !! input
9392 {{anchorencode: [[hello|world]] [[hi]]}}
9393 !! result
9394 <p>world_hi
9395 </p>
9396 !! end
9397
9398 !! test
9399 anchorencode deals with templates
9400 !! input
9401 {{anchorencode: {{Foo}} }}
9402 !! result
9403 <p>FOO
9404 </p>
9405 !! end
9406
9407 !! test
9408 anchorencode encodes like the TOC generator: (bug 18431)
9409 !! input
9410 === _ +:.3A%3A&&amp;]] ===
9411 {{anchorencode: _ +:.3A%3A&&amp;]] }}
9412 __NOEDITSECTION__
9413 !! result
9414 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
9415 <p>.2B:.3A.253A.26.26.5D.5D
9416 </p>
9417 !! end
9418
9419 # Expected output in the following test is not necessarily expected (there
9420 # should probably be <p> tags inside the <blockquote> in the output) -- it's
9421 # only testing for well-formedness.
9422 !! test
9423 Bug 6200: blockquotes and paragraph formatting
9424 !! input
9425 <blockquote>
9426 foo
9427 </blockquote>
9428
9429 bar
9430
9431 baz
9432 !! result
9433 <blockquote>
9434 foo
9435 </blockquote>
9436 <p>bar
9437 </p>
9438 <pre>baz
9439 </pre>
9440 !! end
9441
9442 !! test
9443 Bug 8293: Use of center tag ruins paragraph formatting
9444 !! input
9445 <center>
9446 foo
9447 </center>
9448
9449 bar
9450
9451 baz
9452 !! result
9453 <center>
9454 <p>foo
9455 </p>
9456 </center>
9457 <p>bar
9458 </p>
9459 <pre>baz
9460 </pre>
9461 !! end
9462
9463
9464 ###
9465 ### Language variants related tests
9466 ###
9467 !! test
9468 Self-link in language variants
9469 !! options
9470 title=[[Dunav]] language=sr
9471 !! input
9472 Both [[Dunav]] and [[Дунав]] are names for this river.
9473 !! result
9474 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
9475 </p>
9476 !!end
9477
9478
9479 !! test
9480 Link to pages in language variants
9481 !! options
9482 language=sr
9483 !! input
9484 Main Page can be written as [[Маин Паге]]
9485 !! result
9486 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
9487 </p>
9488 !!end
9489
9490
9491 !! test
9492 Multiple links to pages in language variants
9493 !! options
9494 language=sr
9495 !! input
9496 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
9497 !! result
9498 <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>.
9499 </p>
9500 !!end
9501
9502
9503 !! test
9504 Simple template in language variants
9505 !! options
9506 language=sr
9507 !! input
9508 {{тест}}
9509 !! result
9510 <p>This is a test template
9511 </p>
9512 !! end
9513
9514
9515 !! test
9516 Template with explicit namespace in language variants
9517 !! options
9518 language=sr
9519 !! input
9520 {{Template:тест}}
9521 !! result
9522 <p>This is a test template
9523 </p>
9524 !! end
9525
9526
9527 !! test
9528 Basic test for template parameter in language variants
9529 !! options
9530 language=sr
9531 !! input
9532 {{парамтест|param=foo}}
9533 !! result
9534 <p>This is a test template with parameter foo
9535 </p>
9536 !! end
9537
9538
9539 !! test
9540 Simple category in language variants
9541 !! options
9542 language=sr cat
9543 !! input
9544 [[Category:МедиаWики Усер'с Гуиде]]
9545 !! result
9546 <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>
9547 !! end
9548
9549
9550 !! test
9551 Stripping -{}- tags (language variants)
9552 !! options
9553 language=sr
9554 !! input
9555 Latin proverb: -{Ne nuntium necare}-
9556 !! result
9557 <p>Latin proverb: Ne nuntium necare
9558 </p>
9559 !! end
9560
9561
9562 !! test
9563 Prevent conversion with -{}- tags (language variants)
9564 !! options
9565 language=sr variant=sr-ec
9566 !! input
9567 Latinski: -{Ne nuntium necare}-
9568 !! result
9569 <p>Латински: Ne nuntium necare
9570 </p>
9571 !! end
9572
9573
9574 !! test
9575 Prevent conversion of text with -{}- tags (language variants)
9576 !! options
9577 language=sr variant=sr-ec
9578 !! input
9579 Latinski: -{Ne nuntium necare}-
9580 !! result
9581 <p>Латински: Ne nuntium necare
9582 </p>
9583 !! end
9584
9585
9586 !! test
9587 Prevent conversion of links with -{}- tags (language variants)
9588 !! options
9589 language=sr variant=sr-ec
9590 !! input
9591 -{[[Main Page]]}-
9592 !! result
9593 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9594 </p>
9595 !! end
9596
9597
9598 !! test
9599 -{}- tags within headlines (within html for parserConvert())
9600 !! options
9601 language=sr variant=sr-ec
9602 !! input
9603 == -{Naslov}- ==
9604 !! result
9605 <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>
9606
9607 !! end
9608
9609
9610 !! test
9611 Explicit definition of language variant alternatives
9612 !! options
9613 language=zh variant=zh-tw
9614 !! input
9615 -{zh:China;zh-tw:Taiwan}-, not China
9616 !! result
9617 <p>Taiwan, not China
9618 </p>
9619 !! end
9620
9621
9622 !! test
9623 Explicit session-wise language variant mapping (A flag and - flag)
9624 !! options
9625 language=zh variant=zh-tw
9626 !! input
9627 Taiwan is not China.
9628 But -{A|zh:China;zh-tw:Taiwan}- is China,
9629 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
9630 and -{China}- is China.
9631 !! result
9632 <p>Taiwan is not China.
9633 But Taiwan is Taiwan,
9634 (This should be stripped!)
9635 and China is China.
9636 </p>
9637 !! end
9638
9639 !! test
9640 Explicit session-wise language variant mapping (H flag for hide)
9641 !! options
9642 language=zh variant=zh-tw
9643 !! input
9644 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
9645 Taiwan is China.
9646 !! result
9647 <p>(This should be stripped!)
9648 Taiwan is Taiwan.
9649 </p>
9650 !! end
9651
9652 !! test
9653 Adding explicit conversion rule for title (T flag)
9654 !! options
9655 language=zh variant=zh-tw showtitle
9656 !! input
9657 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9658 !! result
9659 Taiwan
9660 <p>Should be stripped!
9661 </p>
9662 !! end
9663
9664 !! test
9665 Testing that changing the language variant here in the tests actually works
9666 !! options
9667 language=zh variant=zh showtitle
9668 !! input
9669 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9670 !! result
9671 China
9672 <p>Should be stripped!
9673 </p>
9674 !! end
9675
9676 !! test
9677 Bug 24072: more test on conversion rule for title
9678 !! options
9679 language=zh variant=zh-tw showtitle
9680 !! input
9681 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9682 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
9683 !! result
9684 Taiwan
9685 <p>This should be stripped!
9686 This won't take interferes with the title rule.
9687 </p>
9688 !! end
9689
9690 !! test
9691 Raw output of variant escape tags (R flag)
9692 !! options
9693 language=zh variant=zh-tw
9694 !! input
9695 Raw: -{R|zh:China;zh-tw:Taiwan}-
9696 !! result
9697 <p>Raw: zh:China;zh-tw:Taiwan
9698 </p>
9699 !! end
9700
9701 !! test
9702 Nested using of manual convert syntax
9703 !! options
9704 language=zh variant=zh-hk
9705 !! input
9706 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
9707 !! result
9708 <p>Nested: Hello Hong Kong!
9709 </p>
9710 !! end
9711
9712 !! test
9713 Do not convert roman numbers to language variants
9714 !! options
9715 language=sr variant=sr-ec
9716 !! input
9717 Fridrih IV je car.
9718 !! result
9719 <p>Фридрих IV је цар.
9720 </p>
9721 !! end
9722
9723 !! test
9724 Unclosed language converter markup "-{"
9725 !! options
9726 language=sr
9727 !! input
9728 -{T|hello
9729 !! result
9730 <p>-{T|hello
9731 </p>
9732 !! end
9733
9734 !! test
9735 Don't convert raw rule "-{R|=&gt;}-" to "=>"
9736 !! options
9737 language=sr
9738 !! input
9739 -{R|=&gt;}-
9740 !! result
9741 <p>=&gt;
9742 </p>
9743 !!end
9744
9745 !!article
9746 Template:Bullet
9747 !!text
9748 * Bar
9749 !!endarticle
9750
9751 !! test
9752 Bug 529: Uncovered bullet
9753 !! input
9754 * Foo {{bullet}}
9755 !! result
9756 <ul><li> Foo
9757 </li><li> Bar
9758 </li></ul>
9759
9760 !! end
9761
9762 !! test
9763 Bug 529: Uncovered table already at line-start
9764 !! input
9765 x
9766
9767 {{table}}
9768 y
9769 !! result
9770 <p>x
9771 </p>
9772 <table>
9773 <tr>
9774 <td> 1 </td>
9775 <td> 2
9776 </td></tr>
9777 <tr>
9778 <td> 3 </td>
9779 <td> 4
9780 </td></tr></table>
9781 <p>y
9782 </p>
9783 !! end
9784
9785 !! test
9786 Bug 529: Uncovered bullet in parser function result
9787 !! input
9788 * Foo {{lc:{{bullet}} }}
9789 !! result
9790 <ul><li> Foo
9791 </li><li> bar
9792 </li></ul>
9793
9794 !! end
9795
9796 !! test
9797 Bug 5678: Double-parsed template argument
9798 !! input
9799 {{lc:{{{1}}}|hello}}
9800 !! result
9801 <p>{{{1}}}
9802 </p>
9803 !! end
9804
9805 !! test
9806 Bug 5678: Double-parsed template invocation
9807 !! input
9808 {{lc:{{paramtest {{!}} param = hello }} }}
9809 !! result
9810 <p>{{paramtest | param = hello }}
9811 </p>
9812 !! end
9813
9814 !! test
9815 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
9816 !! options
9817 language=cs
9818 title=[[Main Page]]
9819 !! input
9820 {{PRVNÍVELKÉ:ěščř}}
9821 {{prvnívelké:ěščř}}
9822 {{PRVNÍMALÉ:ěščř}}
9823 {{prvnímalé:ěščř}}
9824 {{MALÁ:ěščř}}
9825 {{malá:ěščř}}
9826 {{VELKÁ:ěščř}}
9827 {{velká:ěščř}}
9828 !! result
9829 <p>Ěščř
9830 Ěščř
9831 ěščř
9832 ěščř
9833 ěščř
9834 ěščř
9835 ĚŠČŘ
9836 ĚŠČŘ
9837 </p>
9838 !! end
9839
9840 !! test
9841 Morwen/13: Unclosed link followed by heading
9842 !! input
9843 [[link
9844 ==heading==
9845 !! result
9846 <p>[[link
9847 </p>
9848 <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>
9849
9850 !! end
9851
9852 !! test
9853 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
9854 !! input
9855 {{foo|
9856 =heading=
9857 !! result
9858 <p>{{foo|
9859 </p>
9860 <h1> <span class="mw-headline" id="heading">heading</span></h1>
9861
9862 !! end
9863
9864 !! test
9865 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
9866 !! input
9867 {{foo|
9868 ==heading==
9869 !! result
9870 <p>{{foo|
9871 </p>
9872 <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>
9873
9874 !! end
9875
9876 !! test
9877 Tildes in comments
9878 !! options
9879 pst
9880 !! input
9881 <!-- ~~~~ -->
9882 !! result
9883 <!-- ~~~~ -->
9884 !! end
9885
9886 !! test
9887 Paragraphs inside divs (no extra line breaks)
9888 !! input
9889 <div>Line one
9890
9891 Line two</div>
9892 !! result
9893 <div>Line one
9894 Line two</div>
9895
9896 !! end
9897
9898 !! test
9899 Paragraphs inside divs (extra line break on open)
9900 !! input
9901 <div>
9902 Line one
9903
9904 Line two</div>
9905 !! result
9906 <div>
9907 <p>Line one
9908 </p>
9909 Line two</div>
9910
9911 !! end
9912
9913 !! test
9914 Paragraphs inside divs (extra line break on close)
9915 !! input
9916 <div>Line one
9917
9918 Line two
9919 </div>
9920 !! result
9921 <div>Line one
9922 <p>Line two
9923 </p>
9924 </div>
9925
9926 !! end
9927
9928 !! test
9929 Paragraphs inside divs (extra line break on open and close)
9930 !! input
9931 <div>
9932 Line one
9933
9934 Line two
9935 </div>
9936 !! result
9937 <div>
9938 <p>Line one
9939 </p><p>Line two
9940 </p>
9941 </div>
9942
9943 !! end
9944
9945 !! test
9946 Nesting tags, paragraphs on lines which begin with <div>
9947 !! options
9948 disabled
9949 !! input
9950 <div></div><strong>A
9951 B</strong>
9952 !! result
9953 <div></div>
9954 <p><strong>A
9955 B</strong>
9956 </p>
9957 !! end
9958
9959 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
9960 !! test
9961 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
9962 !! options
9963 disabled
9964 !! input
9965 <blockquote>Line one
9966
9967 Line two</blockquote>
9968 !! result
9969 <blockquote>Line one
9970 Line two</blockquote>
9971
9972 !! end
9973
9974 !! test
9975 Bug 6200: paragraphs inside blockquotes (extra line break on open)
9976 !! options
9977 disabled
9978 !! input
9979 <blockquote>
9980 Line one
9981
9982 Line two</blockquote>
9983 !! result
9984 <blockquote>
9985 <p>Line one
9986 </p>
9987 Line two</blockquote>
9988
9989 !! end
9990
9991 !! test
9992 Bug 6200: paragraphs inside blockquotes (extra line break on close)
9993 !! options
9994 disabled
9995 !! input
9996 <blockquote>Line one
9997
9998 Line two
9999 </blockquote>
10000 !! result
10001 <blockquote>Line one
10002 <p>Line two
10003 </p>
10004 </blockquote>
10005
10006 !! end
10007
10008 !! test
10009 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
10010 !! options
10011 disabled
10012 !! input
10013 <blockquote>
10014 Line one
10015
10016 Line two
10017 </blockquote>
10018 !! result
10019 <blockquote>
10020 <p>Line one
10021 </p><p>Line two
10022 </p>
10023 </blockquote>
10024
10025 !! end
10026
10027 !! test
10028 Paragraphs inside blockquotes/divs (no extra line breaks)
10029 !! input
10030 <blockquote><div>Line one
10031
10032 Line two</div></blockquote>
10033 !! result
10034 <blockquote><div>Line one
10035 Line two</div></blockquote>
10036
10037 !! end
10038
10039 !! test
10040 Paragraphs inside blockquotes/divs (extra line break on open)
10041 !! input
10042 <blockquote><div>
10043 Line one
10044
10045 Line two</div></blockquote>
10046 !! result
10047 <blockquote><div>
10048 <p>Line one
10049 </p>
10050 Line two</div></blockquote>
10051
10052 !! end
10053
10054 !! test
10055 Paragraphs inside blockquotes/divs (extra line break on close)
10056 !! input
10057 <blockquote><div>Line one
10058
10059 Line two
10060 </div></blockquote>
10061 !! result
10062 <blockquote><div>Line one
10063 <p>Line two
10064 </p>
10065 </div></blockquote>
10066
10067 !! end
10068
10069 !! test
10070 Paragraphs inside blockquotes/divs (extra line break on open and close)
10071 !! input
10072 <blockquote><div>
10073 Line one
10074
10075 Line two
10076 </div></blockquote>
10077 !! result
10078 <blockquote><div>
10079 <p>Line one
10080 </p><p>Line two
10081 </p>
10082 </div></blockquote>
10083
10084 !! end
10085
10086 !! test
10087 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
10088 !! options
10089 wgLinkHolderBatchSize=0
10090 !! input
10091 [[meatball:1]]
10092 [[meatball:2]]
10093 [[meatball:3]]
10094 !! result
10095 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
10096 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
10097 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
10098 </p>
10099 !! end
10100
10101 !! test
10102 Free external link invading image caption
10103 !! input
10104 [[Image:Foobar.jpg|thumb|http://x|hello]]
10105 !! result
10106 <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>
10107
10108 !! end
10109
10110 !! test
10111 Bug 15196: localised external link numbers
10112 !! options
10113 language=fa
10114 !! input
10115 [http://en.wikipedia.org/]
10116 !! result
10117 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
10118 </p>
10119 !! end
10120
10121 !! test
10122 Multibyte character in padleft
10123 !! input
10124 {{padleft:-Hello|7|Æ}}
10125 !! result
10126 <p>Æ-Hello
10127 </p>
10128 !! end
10129
10130 !! test
10131 Multibyte character in padright
10132 !! input
10133 {{padright:Hello-|7|Æ}}
10134 !! result
10135 <p>Hello-Æ
10136 </p>
10137 !! end
10138
10139 !! test
10140 Formatted date
10141 !! config
10142 wgUseDynamicDates=1
10143 !! input
10144 [[2009-03-24]]
10145 !! result
10146 <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>
10147 </p>
10148 !!end
10149
10150 !!test
10151 formatdate parser function
10152 !!input
10153 {{#formatdate:2009-03-24}}
10154 !! result
10155 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
10156 </p>
10157 !! end
10158
10159 !!test
10160 formatdate parser function, with default format
10161 !!input
10162 {{#formatdate:2009-03-24|mdy}}
10163 !! result
10164 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
10165 </p>
10166 !! end
10167
10168 !! test
10169 Linked date with autoformatting disabled
10170 !! config
10171 wgUseDynamicDates=false
10172 !! input
10173 [[2009-03-24]]
10174 !! result
10175 <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>
10176 </p>
10177 !! end
10178
10179 !! test
10180 Spacing of numbers in formatted dates
10181 !! input
10182 {{#formatdate:January 15}}
10183 !! result
10184 <p><span class="mw-formatted-date" title="01-15">January 15</span>
10185 </p>
10186 !! end
10187
10188 !! test
10189 Spacing of numbers in formatted dates (linked)
10190 !! config
10191 wgUseDynamicDates=true
10192 !! input
10193 [[January 15]]
10194 !! result
10195 <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>
10196 </p>
10197 !! end
10198
10199 !! test
10200 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
10201 !! options
10202 language=nl title=[[MediaWiki:Common.css]]
10203 !! input
10204 {{#formatdate:2009-03-24|dmy}}
10205 !! result
10206 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
10207 </p>
10208 !! end
10209
10210 #
10211 #
10212 #
10213
10214 #
10215 # Edit comments
10216 #
10217
10218 !! test
10219 Edit comment with link
10220 !! options
10221 comment
10222 !! input
10223 I like the [[Main Page]] a lot
10224 !! result
10225 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
10226 !!end
10227
10228 !! test
10229 Edit comment with link and link text
10230 !! options
10231 comment
10232 !! input
10233 I like the [[Main Page|best pages]] a lot
10234 !! result
10235 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10236 !!end
10237
10238 !! test
10239 Edit comment with link and link text with suffix
10240 !! options
10241 comment
10242 !! input
10243 I like the [[Main Page|best page]]s a lot
10244 !! result
10245 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10246 !!end
10247
10248 !! test
10249 Edit comment with section link (non-local, eg in history list)
10250 !! options
10251 comment title=[[Main Page]]
10252 !! input
10253 /* External links */ removed bogus entries
10254 !! result
10255 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10256 !!end
10257
10258 !! test
10259 Edit comment with section link and text before it (non-local, eg in history list)
10260 !! options
10261 comment title=[[Main Page]]
10262 !! input
10263 pre-comment text /* External links */ removed bogus entries
10264 !! result
10265 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>
10266 !!end
10267
10268 !! test
10269 Edit comment with section link (local, eg in diff view)
10270 !! options
10271 comment local title=[[Main Page]]
10272 !! input
10273 /* External links */ removed bogus entries
10274 !! result
10275 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10276 !!end
10277
10278 !! test
10279 Edit comment with subpage link (bug 14080)
10280 !! options
10281 comment
10282 subpage
10283 title=[[Subpage test]]
10284 !! input
10285 Poked at a [[/subpage]] here...
10286 !! result
10287 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
10288 !!end
10289
10290 !! test
10291 Edit comment with subpage link and link text (bug 14080)
10292 !! options
10293 comment
10294 subpage
10295 title=[[Subpage test]]
10296 !! input
10297 Poked at a [[/subpage|neat little page]] here...
10298 !! result
10299 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
10300 !!end
10301
10302 !! test
10303 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
10304 !! options
10305 comment
10306 title=[[Subpage test]]
10307 !! input
10308 Poked at a [[/subpage]] here...
10309 !! result
10310 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...
10311 !!end
10312
10313 !! test
10314 Edit comment with bare anchor link (local, as on diff)
10315 !! options
10316 comment
10317 local
10318 title=[[Main Page]]
10319 !!input
10320 [[#section]]
10321 !! result
10322 <a href="#section">#section</a>
10323 !! end
10324
10325 !! test
10326 Edit comment with bare anchor link (non-local, as on history)
10327 !! options
10328 comment
10329 title=[[Main Page]]
10330 !!input
10331 [[#section]]
10332 !! result
10333 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
10334 !! end
10335
10336 !! test
10337 Anchor starting with underscore
10338 !!input
10339 [[#_ref|One]]
10340 !! result
10341 <p><a href="#_ref">One</a>
10342 </p>
10343 !! end
10344
10345 !! test
10346 Id starting with underscore
10347 !!input
10348 <div id="_ref"></div>
10349 !! result
10350 <div id="_ref"></div>
10351
10352 !! end
10353
10354 !! test
10355 Space normalisation on autocomment (bug 22784)
10356 !! options
10357 comment
10358 title=[[Main Page]]
10359 !!input
10360 /* __hello__world__ */
10361 !! result
10362 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
10363 !! end
10364
10365 !! test
10366 percent-encoding and + signs in comments (Bug 26410)
10367 !! options
10368 comment
10369 !!input
10370 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
10371 !! result
10372 <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>
10373 !! end
10374
10375 !! test
10376 Bad images - basic functionality
10377 !! options
10378 disabled
10379 !! input
10380 [[File:Bad.jpg]]
10381 !! result
10382 !! end
10383
10384 !! test
10385 Bad images - bug 16039: text after bad image disappears
10386 !! options
10387 disabled
10388 !! input
10389 Foo bar
10390 [[File:Bad.jpg]]
10391 Bar foo
10392 !! result
10393 <p>Foo bar
10394 </p><p>Bar foo
10395 </p>
10396 !! end
10397
10398 !! test
10399 Verify that displaytitle works (bug #22501) no displaytitle
10400 !! options
10401 showtitle
10402 !! config
10403 wgAllowDisplayTitle=true
10404 wgRestrictDisplayTitle=false
10405 !! input
10406 this is not the the title
10407 !! result
10408 Parser test
10409 <p>this is not the the title
10410 </p>
10411 !! end
10412
10413 !! test
10414 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
10415 !! options
10416 showtitle
10417 title=[[Screen]]
10418 !! config
10419 wgAllowDisplayTitle=true
10420 wgRestrictDisplayTitle=false
10421 !! input
10422 this is not the the title
10423 {{DISPLAYTITLE:whatever}}
10424 !! result
10425 whatever
10426 <p>this is not the the title
10427 </p>
10428 !! end
10429
10430 !! test
10431 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
10432 !! options
10433 showtitle
10434 title=[[Screen]]
10435 !! config
10436 wgAllowDisplayTitle=true
10437 wgRestrictDisplayTitle=true
10438 !! input
10439 this is not the the title
10440 {{DISPLAYTITLE:whatever}}
10441 !! result
10442 Screen
10443 <p>this is not the the title
10444 </p>
10445 !! end
10446
10447 !! test
10448 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
10449 !! options
10450 showtitle
10451 title=[[Screen]]
10452 !! config
10453 wgAllowDisplayTitle=true
10454 wgRestrictDisplayTitle=true
10455 !! input
10456 this is not the the title
10457 {{DISPLAYTITLE:screen}}
10458 !! result
10459 screen
10460 <p>this is not the the title
10461 </p>
10462 !! end
10463
10464 !! test
10465 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
10466 !! options
10467 showtitle
10468 title=[[Screen]]
10469 !! config
10470 wgAllowDisplayTitle=false
10471 !! input
10472 this is not the the title
10473 {{DISPLAYTITLE:screen}}
10474 !! result
10475 Screen
10476 <p>this is not the the title
10477 <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>
10478 </p>
10479 !! end
10480
10481 !! test
10482 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
10483 !! options
10484 showtitle
10485 title=[[Screen]]
10486 !! config
10487 wgAllowDisplayTitle=false
10488 !! input
10489 this is not the the title
10490 !! result
10491 Screen
10492 <p>this is not the the title
10493 </p>
10494 !! end
10495
10496 !! test
10497 preload: check <noinclude> and <includeonly>
10498 !! options
10499 preload
10500 !! input
10501 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
10502 !! result
10503 Hello kind world.
10504 !! end
10505
10506 !! test
10507 preload: check <onlyinclude>
10508 !! options
10509 preload
10510 !! input
10511 Goodbye <onlyinclude>Hello world</onlyinclude>
10512 !! result
10513 Hello world
10514 !! end
10515
10516 !! test
10517 preload: can pass tags through if we want to
10518 !! options
10519 preload
10520 !! input
10521 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
10522 !! result
10523 <includeonly>Hello world</includeonly>
10524 !! end
10525
10526 !! test
10527 preload: check that it doesn't try to do tricks
10528 !! options
10529 preload
10530 !! input
10531 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
10532 !! result
10533 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
10534 !! end
10535
10536 !! test
10537 Play a bit with r67090 and bug 3158
10538 !! options
10539 disabled
10540 !! input
10541 <div style="width:50% !important">&nbsp;</div>
10542 <div style="width:50%&nbsp;!important">&nbsp;</div>
10543 <div style="width:50%&#160;!important">&nbsp;</div>
10544 <div style="border : solid;">&nbsp;</div>
10545 !! result
10546 <div style="width:50% !important">&nbsp;</div>
10547 <div style="width:50% !important">&nbsp;</div>
10548 <div style="width:50% !important">&nbsp;</div>
10549 <div style="border&#160;: solid;">&nbsp;</div>
10550
10551 !! end
10552
10553 !! test
10554 HTML5 data attributes
10555 !! input
10556 <span data-foo="bar">Baz</span>
10557 <p data-abc-def_hij="">Quuz</p>
10558 !! result
10559 <p><span data-foo="bar">Baz</span>
10560 </p>
10561 <p data-abc-def_hij="">Quuz</p>
10562
10563 !! end
10564
10565 !! test
10566 percent-encoding and + signs in internal links (Bug 26410)
10567 !! input
10568 [[User:+%]] [[Page+title%]]
10569 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
10570 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
10571 [[%33%45]] [[%33%45+]]
10572 !! result
10573 <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>
10574 <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>
10575 <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>
10576 <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>
10577 </p>
10578 !! end
10579
10580 !! test
10581 Special characters in embedded file links (bug 27679)
10582 !! input
10583 [[File:Contains & ampersand.jpg]]
10584 [[File:Does not exist.jpg|Title with & ampersand]]
10585 !! result
10586 <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>
10587 <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>
10588 </p>
10589 !! end
10590
10591
10592 !! test
10593 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
10594 !! input
10595 Text&apos;s been normalized?
10596 !! result
10597 <p>Text&#39;s been normalized?
10598 </p>
10599 !! end
10600
10601 !! test
10602 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
10603 !! input
10604 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
10605 !! result
10606 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
10607 </p>
10608 !! end
10609
10610 !! test
10611 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
10612 !! input
10613 [http://www.example.org/ ideograms]
10614 !! result
10615 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
10616 </p>
10617 !! end
10618
10619 !! test
10620 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
10621 !! input
10622 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
10623 !! result
10624 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
10625 </p>
10626 !! end
10627
10628 !! article
10629 Mediawiki:loop1
10630 !! text
10631 {{Identical|A}}
10632 !! endarticle
10633
10634 !! article
10635 Mediawiki:loop2
10636 !! text
10637 {{Identical|B}}
10638 !! endarticle
10639
10640 !! article
10641 Template:Identical
10642 !! text
10643 {{int:loop1}}
10644 {{int:loop2}}
10645 !! endarticle
10646
10647 !! test
10648 Bug 31098 Template which includes system messages which includes the template
10649 !! input
10650 {{Identical}}
10651 !! result
10652 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
10653 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
10654 </p>
10655 !! end
10656
10657 !! test
10658 Deprecated presentational attributes are converted to css
10659 !! input
10660 {|
10661 | valign=top align=left width=100 height=25% | Asdf
10662 |}
10663 <ul type="disc"></ul>
10664 !! result
10665 <table>
10666 <tr>
10667 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
10668 </td></tr></table>
10669 <ul style="list-style-type: disc;"></ul>
10670
10671 !! end
10672
10673 !! test
10674 Bug31490 Turkish: ucfirst 'blah'
10675 !! options
10676 language=tr
10677 !! input
10678 {{ucfirst:blah}}
10679 !! result
10680 <p>Blah
10681 </p>
10682 !! end
10683
10684 !! test
10685 Bug31490 Turkish: ucfirst 'ix'
10686 !! options
10687 language=tr
10688 !! input
10689 {{ucfirst:ix}}
10690 !! result
10691 <p>İx
10692 </p>
10693 !! end
10694
10695 !! test
10696 Bug31490 Turkish: lcfirst 'BLAH'
10697 !! options
10698 language=tr
10699 !! input
10700 {{lcfirst:BLAH}}
10701 !! result
10702 <p>bLAH
10703 </p>
10704 !! end
10705
10706 !! test
10707 Bug31490 Turkish: ucfırst (with a dotless i)
10708 !! options
10709 language=tr
10710 !! input
10711 {{ucfırst:blah}}
10712 !! result
10713 <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>
10714 </p>
10715 !! end
10716
10717 !! test
10718 Bug31490 ucfırst (with a dotless i) with English language
10719 !! options
10720 language=en
10721 !! input
10722 {{ucfırst:blah}}
10723 !! result
10724 <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>
10725 </p>
10726 !! end
10727
10728 !! test
10729 Bug 26375: TOC with italics
10730 !! options
10731 title=[[Main Page]]
10732 !! input
10733 __TOC__
10734 == ''Lost'' episodes ==
10735 !! result
10736 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10737 <ul>
10738 <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>
10739 </ul>
10740 </td></tr></table>
10741 <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>
10742
10743 !! end
10744
10745 !! test
10746 Bug 26375: TOC with bold
10747 !! options
10748 title=[[Main Page]]
10749 !! input
10750 __TOC__
10751 == '''should be bold''' then normal text ==
10752 !! result
10753 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10754 <ul>
10755 <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>
10756 </ul>
10757 </td></tr></table>
10758 <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>
10759
10760 !! end
10761
10762 !! test
10763 Bug 33845: Headings become cursive in TOC when they contain an image
10764 !! options
10765 title=[[Main Page]]
10766 !! input
10767 __TOC__
10768 == Image [[Image:foobar.jpg]] ==
10769 !! result
10770 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10771 <ul>
10772 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
10773 </ul>
10774 </td></tr></table>
10775 <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>
10776
10777 !! end
10778
10779 !! test
10780 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
10781 !! options
10782 title=[[Main Page]]
10783 !! input
10784 __TOC__
10785 == <blockquote>Quote</blockquote> ==
10786 !! result
10787 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10788 <ul>
10789 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
10790 </ul>
10791 </td></tr></table>
10792 <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>
10793
10794 !! end
10795
10796 !! test
10797 Unclosed tags in TOC
10798 !! options
10799 title=[[Main Page]]
10800 !! input
10801 __TOC__
10802 == Proof: 2 < 3 ==
10803 <small>Hanc marginis exiguitas non caperet.</small>
10804 QED
10805 !! result
10806 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10807 <ul>
10808 <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>
10809 </ul>
10810 </td></tr></table>
10811 <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>
10812 <p><small>Hanc marginis exiguitas non caperet.</small>
10813 QED
10814 </p>
10815 !! end
10816
10817 !! test
10818 Multiple tags in TOC
10819 !! input
10820 __TOC__
10821 == <i>Foo</i> <b>Bar</b> ==
10822
10823 == <i>Foo</i> <blockquote>Bar</blockquote> ==
10824 !! result
10825 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10826 <ul>
10827 <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>
10828 <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>
10829 </ul>
10830 </td></tr></table>
10831 <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>
10832 <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>
10833
10834 !! end
10835
10836 !! test
10837 Tags with parameters in TOC
10838 !! input
10839 __TOC__
10840 == <sup class="in-h2">Hello</sup> ==
10841
10842 == <sup class="a > b">Evilbye</sup> ==
10843 !! result
10844 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10845 <ul>
10846 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
10847 <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>
10848 </ul>
10849 </td></tr></table>
10850 <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>
10851 <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>
10852
10853 !! end
10854
10855 !! test
10856 span tags with directionality in TOC
10857 !! input
10858 __TOC__
10859 == <span dir="ltr">C++</span> ==
10860
10861 == <span dir="rtl">זבנג!</span> ==
10862
10863 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
10864
10865 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
10866
10867 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
10868 !! result
10869 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10870 <ul>
10871 <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>
10872 <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>
10873 <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>
10874 <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>
10875 <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>
10876 </ul>
10877 </td></tr></table>
10878 <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>
10879 <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>
10880 <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>
10881 <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>
10882 <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>
10883
10884 !! end
10885
10886 !! article
10887 MediaWiki:Bug32057
10888 !! text
10889 == {{int:headline_sample}} ==
10890 !! endarticle
10891
10892 !! test
10893 Bug 32057: Title needed when expanding <h> nodes.
10894 !! options
10895 title=[[Main Page]]
10896 !! input
10897 {{int:Bug32057}}
10898 !! result
10899 <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>
10900
10901 !! end
10902
10903 !! test
10904 Strip marker in urlencode
10905 !! input
10906 {{urlencode:x<nowiki/>y}}
10907 {{urlencode:x<nowiki/>y|wiki}}
10908 {{urlencode:x<nowiki/>y|path}}
10909 !! result
10910 <p>xy
10911 xy
10912 xy
10913 </p>
10914 !! end
10915
10916 !! test
10917 Strip marker in lc
10918 !! input
10919 {{lc:x<nowiki/>y}}
10920 !! result
10921 <p>xy
10922 </p>
10923 !! end
10924
10925 !! test
10926 Strip marker in uc
10927 !! input
10928 {{uc:x<nowiki/>y}}
10929 !! result
10930 <p>XY
10931 </p>
10932 !! end
10933
10934 !! test
10935 Strip marker in formatNum
10936 !! input
10937 {{formatnum:1<nowiki/>2}}
10938 {{formatnum:1<nowiki/>2|R}}
10939 !! result
10940 <p>12
10941 12
10942 </p>
10943 !! end
10944
10945 !! test
10946 Strip marker in grammar
10947 !! options
10948 language=fi
10949 !! input
10950 {{grammar:elative|foo<nowiki/>bar}}
10951 !! result
10952 <p>foobarista
10953 </p>
10954 !! end
10955
10956 !! test
10957 Strip marker in padleft
10958 !! input
10959 {{padleft:|2|x<nowiki/>y}}
10960 !! result
10961 <p>xy
10962 </p>
10963 !! end
10964
10965 !! test
10966 Strip marker in padright
10967 !! input
10968 {{padright:|2|x<nowiki/>y}}
10969 !! result
10970 <p>xy
10971 </p>
10972 !! end
10973
10974 !! test
10975 Strip marker in anchorencode
10976 !! input
10977 {{anchorencode:x<nowiki/>y}}
10978 !! result
10979 <p>xy
10980 </p>
10981 !! end
10982
10983 !! test
10984 nowiki inside link inside heading (bug 18295)
10985 !! input
10986 ==[[foo|x<nowiki>y</nowiki>z]]==
10987 !! result
10988 <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>
10989
10990 !! end
10991
10992 !! test
10993 new support for bdi element (bug 31817)
10994 !! input
10995 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
10996 !! result
10997 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
10998
10999 !!end
11000
11001 !! test
11002 Ignore pipe between table row attributes
11003 !! input
11004 {|
11005 | quux
11006 |- id=foo | style='color: red'
11007 | bar
11008 |}
11009 !! result
11010 <table>
11011 <tr>
11012 <td> quux
11013 </td></tr>
11014 <tr id="foo" style="color: red">
11015 <td> bar
11016 </td></tr></table>
11017
11018 !! end
11019
11020 !!test
11021 Gallery override link with WikiLink (bug 34852)
11022 !! input
11023 <gallery>
11024 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
11025 </gallery>
11026 !! result
11027 <ul class="gallery">
11028 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11029 <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>
11030 <div class="gallerytext">
11031 <p>caption
11032 </p>
11033 </div>
11034 </div></li>
11035 </ul>
11036
11037 !! end
11038
11039 !!test
11040 Gallery override link with absolute external link (bug 34852)
11041 !! input
11042 <gallery>
11043 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
11044 </gallery>
11045 !! result
11046 <ul class="gallery">
11047 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11048 <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>
11049 <div class="gallerytext">
11050 <p>caption
11051 </p>
11052 </div>
11053 </div></li>
11054 </ul>
11055
11056 !! end
11057
11058 !!test
11059 Gallery override link with malicious javascript (bug 34852)
11060 !! input
11061 <gallery>
11062 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
11063 </gallery>
11064 !! result
11065 <ul class="gallery">
11066 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11067 <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>
11068 <div class="gallerytext">
11069 <p>caption
11070 </p>
11071 </div>
11072 </div></li>
11073 </ul>
11074
11075 !! end
11076
11077 !!test
11078 Language parser function
11079 !! input
11080 {{#language:ar}}
11081 !! result
11082 <p>العربية
11083 </p>
11084 !! end
11085
11086 !!test
11087 Padleft and padright as substr
11088 !! input
11089 {{padleft:|3|abcde}}
11090 {{padright:|3|abcde}}
11091 !! result
11092 <p>abc
11093 abc
11094 </p>
11095 !! end
11096
11097 !!test
11098 Bug 34939 - Case insensitive link parsing ([HttP://])
11099 !! input
11100 [HttP://MediaWiki.Org/]
11101 !! result
11102 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
11103 </p>
11104 !! end
11105
11106 !!test
11107 Bug 34939 - Case insensitive link parsing ([HttP:// title])
11108 !! input
11109 [HttP://MediaWiki.Org/ MediaWiki]
11110 !! result
11111 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
11112 </p>
11113 !! end
11114
11115 !!test
11116 Bug 34939 - Case insensitive link parsing (HttP://)
11117 !! input
11118 HttP://MediaWiki.Org/
11119 !! result
11120 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
11121 </p>
11122 !! end
11123
11124 ###
11125 ### Parsoids-specific tests
11126 ### Parsoid-PHP parser incompatibilities
11127 ###
11128
11129 !!test
11130 1. includeonly around the entire attribute
11131 !!options
11132 disabled
11133 !!input
11134 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11135 !!result
11136 <p><span>bar</span>
11137 </p>
11138 !!end
11139
11140 !!test
11141 2. template around the entire attribute
11142 !!options
11143 disabled
11144 !!input
11145 <span {{echo|id="v1"}}>bar</span>
11146 !!result
11147 <p><span>bar</span>
11148 </p>
11149 !!end
11150
11151 !!test
11152 3. SOL-sensitive wikitext tokens as template-args
11153 !!options
11154 disabled
11155 !!input
11156 {{echo|*a}}
11157 {{echo|#a}}
11158 {{echo|:a}}
11159 !!result
11160 <p>*a
11161 #a
11162 :a
11163 </p>
11164 !!end
11165
11166 TODO:
11167 more images
11168 more tables
11169 character entities
11170 and much more
11171 Try for 100% code coverage