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