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