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