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