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