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