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