Merge "Make sure that SQLite uses no prefix"
[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
4561 !! article
4562 Template:MSGNW test
4563 !! text
4564 ''None'' of '''this''' should be
4565 * interpreted
4566 but rather passed unmodified
4567 {{test}}
4568 !! endarticle
4569
4570 # hmm, fix this or just deprecate msgnw and document its behavior?
4571 !! test
4572 msgnw keyword
4573 !! options
4574 disabled
4575 !! input
4576 {{msgnw:MSGNW test}}
4577 !! result
4578 <p>''None'' of '''this''' should be
4579 * interpreted
4580 but rather passed unmodified
4581 {{test}}
4582 </p>
4583 !! end
4584
4585 !! test
4586 int keyword
4587 !! input
4588 {{int:youhavenewmessages|lots of money|not!}}
4589 !! result
4590 <p>You have lots of money (not!).
4591 </p>
4592 !! end
4593
4594 !! article
4595 Template:Includes
4596 !! text
4597 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
4598 !! endarticle
4599
4600 !! test
4601 <includeonly> and <noinclude> being included
4602 !! input
4603 {{Includes}}
4604 !! result
4605 <p>Foobar
4606 </p>
4607 !! end
4608
4609 !! article
4610 Template:Includes2
4611 !! text
4612 <onlyinclude>Foo</onlyinclude>bar
4613 !! endarticle
4614
4615 !! test
4616 <onlyinclude> being included
4617 !! input
4618 {{Includes2}}
4619 !! result
4620 <p>Foo
4621 </p>
4622 !! end
4623
4624
4625 !! article
4626 Template:Includes3
4627 !! text
4628 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
4629 !! endarticle
4630
4631 !! test
4632 <onlyinclude> and <includeonly> being included
4633 !! input
4634 {{Includes3}}
4635 !! result
4636 <p>Foo
4637 </p>
4638 !! end
4639
4640 !! test
4641 <includeonly> and <noinclude> on a page
4642 !! input
4643 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
4644 !! result
4645 <p>Foozar
4646 </p>
4647 !! end
4648
4649 !! test
4650 <onlyinclude> on a page
4651 !! input
4652 <onlyinclude>Foo</onlyinclude>bar
4653 !! result
4654 <p>Foobar
4655 </p>
4656 !! end
4657
4658 !! article
4659 Template:Includeonly section
4660 !! text
4661 <includeonly>
4662 ==Includeonly section==
4663 </includeonly>
4664 ==Section T-1==
4665 !!endarticle
4666
4667 !! test
4668 Bug 6563: Edit link generation for section shown by <includeonly>
4669 !! input
4670 {{includeonly section}}
4671 !! result
4672 <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>
4673 <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>
4674
4675 !! end
4676
4677 # Uses same input as the contents of [[Template:Includeonly section]]
4678 !! test
4679 Bug 6563: Section extraction for section shown by <includeonly>
4680 !! options
4681 section=T-2
4682 !! input
4683 <includeonly>
4684 ==Includeonly section==
4685 </includeonly>
4686 ==Section T-2==
4687 !! result
4688 ==Section T-2==
4689 !! end
4690
4691 !! test
4692 Bug 6563: Edit link generation for section suppressed by <includeonly>
4693 !! input
4694 <includeonly>
4695 ==Includeonly section==
4696 </includeonly>
4697 ==Section 1==
4698 !! result
4699 <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>
4700
4701 !! end
4702
4703 !! test
4704 Bug 6563: Section extraction for section suppressed by <includeonly>
4705 !! options
4706 section=1
4707 !! input
4708 <includeonly>
4709 ==Includeonly section==
4710 </includeonly>
4711 ==Section 1==
4712 !! result
4713 ==Section 1==
4714 !! end
4715
4716 ###
4717 ### <includeonly> and <noinclude> in attributes
4718 ###
4719 !!test
4720 0. includeonly around the entire attribute
4721 !!input
4722 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
4723 !!result
4724 <p><span id="v2">bar</span>
4725 </p>
4726 !!end
4727
4728 !!test
4729 1. includeonly in html attr key
4730 !!input
4731 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
4732 !!result
4733 <p><span id="foo">bar</span>
4734 </p>
4735 !!end
4736
4737 !!test
4738 2. includeonly in html attr value
4739 !!input
4740 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
4741 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
4742 !!result
4743 <p><span id="v1">bar</span>
4744 <span id="v1">bar</span>
4745 </p>
4746 !!end
4747
4748 !!test
4749 3. includeonly in part of an attr value
4750 !!input
4751 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
4752 !!result
4753 <p><span style="color:red;">bar</span>
4754 </p>
4755 !!end
4756
4757 ###
4758 ### Testing parsing of templates where a template arg
4759 ### has the same name as the template itself.
4760 ###
4761
4762 !! article
4763 Template:quote
4764 !! text
4765 {{{quote|{{{1}}}}}}
4766 !! endarticle
4767
4768 !!test
4769 Templates: Template Name/Arg clash: 1. Use of positional param
4770 !!input
4771 {{quote|foo}}
4772 !!result
4773 <p>foo
4774 </p>
4775 !!end
4776
4777 !!test
4778 Templates: Template Name/Arg clash: 2. Use of named param
4779 !!input
4780 {{quote|quote=foo}}
4781 !!result
4782 <p>foo
4783 </p>
4784 !!end
4785
4786 !!test
4787 Templates: Template Name/Arg clash: 3. Use of named param with empty input
4788 !!input
4789 {{quote|quote}}
4790 !!result
4791 <p>quote
4792 </p>
4793 !!end
4794
4795 ###
4796 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
4797 ###
4798
4799 !!test
4800 Templates: 1. Simple use
4801 !!input
4802 {{echo|Foo}}
4803 !!result
4804 <p>Foo
4805 </p>
4806 !!end
4807
4808 !!test
4809 Templates: 2. Inside a block tag
4810 !!input
4811 <div>{{echo|Foo}}</div>
4812 !!result
4813 <div>Foo</div>
4814
4815 !!end
4816
4817 !!test
4818 Templates: P-wrapping: 1a. Templates on consecutive lines
4819 !!input
4820 {{echo|Foo}}
4821 {{echo|bar}}
4822 !!result
4823 <p>Foo
4824 bar
4825 </p>
4826 !!end
4827
4828 !!test
4829 Templates: P-wrapping: 1b. Templates on consecutive lines
4830 !!input
4831 Foo
4832
4833 {{echo|bar}}
4834 {{echo|baz}}
4835 !!result
4836 <p>Foo
4837 </p><p>bar
4838 baz
4839 </p>
4840 !!end
4841
4842 !!test
4843 Templates: P-wrapping: 1c. Templates on consecutive lines
4844 !!input
4845 {{echo|Foo}}
4846 {{echo|bar}} <div>baz</div>
4847 !!result
4848 <p>Foo
4849 </p>
4850 bar <div>baz</div>
4851
4852 !!end
4853
4854 !!test
4855 Templates: Inline Text: 1. Multiple tmeplate uses
4856 !!input
4857 {{echo|Foo}}bar{{echo|baz}}
4858 !!result
4859 <p>Foobarbaz
4860 </p>
4861 !!end
4862
4863 !!test
4864 Templates: Inline Text: 2. Back-to-back template uses
4865 !!input
4866 {{echo|Foo}}{{echo|bar}}
4867 !!result
4868 <p>Foobar
4869 </p>
4870 !!end
4871
4872 !!test
4873 Templates: Block Tags: 1. Multiple template uses
4874 !!input
4875 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
4876 !!result
4877 <div>Foo</div><div>bar</div><div>baz</div>
4878
4879 !!end
4880
4881 !!test
4882 Templates: Block Tags: 2. Back-to-back template uses
4883 !!input
4884 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
4885 !!result
4886 <div>Foo</div><div>bar</div>
4887
4888 !!end
4889
4890 !!test
4891 Templates: Links: 1. Simple example
4892 !!input
4893 {{echo|[[Foo|bar]]}}
4894 !!result
4895 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4896 </p>
4897 !!end
4898
4899 !!test
4900 Templates: Links: 2. Generation of link href
4901 !!input
4902 [[{{echo|Foo}}|bar]]
4903 !!result
4904 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4905 </p>
4906 !!end
4907
4908 !!test
4909 Templates: Links: 3. Generation of part of a link href
4910 !!input
4911 [[Fo{{echo|o}}|bar]]
4912 !!result
4913 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4914 </p>
4915 !!end
4916
4917 !!test
4918 Templates: Links: 4. Multiple templates generating link href
4919 !!input
4920 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
4921 !!result
4922 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
4923 </p>
4924 !!end
4925
4926 !!test
4927 Templates: Links: 5. Generation of link text
4928 !!input
4929 [[Foo|{{echo|bar}}]]
4930 !!result
4931 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4932 </p>
4933 !!end
4934
4935 !!test
4936 Templates: Links: 5. Nested templates (only outermost template should be marked)
4937 !!input
4938 {{echo|[[{{echo|Foo}}|bar]]}}
4939 !!result
4940 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
4941 </p>
4942 !!end
4943
4944 !!test
4945 Templates: HTML Tag: 1. Generation of HTML attr. key
4946 !!input
4947 <div {{echo|style}}="color:red;">foo</div>
4948 !!result
4949 <div style="color:red;">foo</div>
4950
4951 !!end
4952
4953 !!test
4954 Templates: HTML Tag: 2. Generation of HTML attr. value
4955 !!input
4956 <div style={{echo|'color:red;'}}>foo</div>
4957 !!result
4958 <div style="color:red;">foo</div>
4959
4960 !!end
4961
4962 !!test
4963 Templates: HTML Tag: 3. Generation of HTML attr key and value
4964 !!input
4965 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
4966 !!result
4967 <div style="color:red;">foo</div>
4968
4969 !!end
4970
4971 !!test
4972 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
4973 !!input
4974 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
4975 !!result
4976 <div title="This is a long title with just one piece templated">foo</div>
4977
4978 !!end
4979
4980 !!test
4981 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
4982 !!input
4983 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
4984 !!result
4985 <div title="This is a long title with just one piece templated">foo</div>
4986
4987 !!end
4988
4989 !!test
4990 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
4991 !!input
4992 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
4993 !!result
4994 <div title="This is a long title with just one piece templated">foo</div>
4995
4996 !!end
4997
4998 !!test
4999 Templates: HTML Tables: 1. Generating start of a HTML table
5000 !!input
5001 {{echo|<table><tr><td>foo</td>}}</tr></table>
5002 !!result
5003 <table><tr><td>foo</td></tr></table>
5004
5005 !!end
5006
5007 !!test
5008 Templates: HTML Tables: 2a. Generating middle of a HTML table
5009 !!input
5010 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5011 !!result
5012 <table><tr><td>foo</td></tr></table>
5013
5014 !!end
5015
5016 !!test
5017 Templates: HTML Tables: 2b. Generating middle of a HTML table
5018 !!input
5019 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5020 !!result
5021 <table><tr><td>foo</td></tr></table>
5022
5023 !!end
5024
5025 !!test
5026 Templates: HTML Tables: 3. Generating end of a HTML table
5027 !!input
5028 <table><tr>{{echo|<td>foo</td></tr></table>}}
5029 !!result
5030 <table><tr><td>foo</td></tr></table>
5031
5032 !!end
5033
5034 !!test
5035 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5036 !!input
5037 {{echo|<table>}}<tr><td>foo</td></tr></table>
5038 !!result
5039 <table><tr><td>foo</td></tr></table>
5040
5041 !!end
5042
5043 !!test
5044 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5045 !!input
5046 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5047 !!result
5048 <table><tr><td>foo</td></tr></table>
5049
5050 !!end
5051
5052 !!test
5053 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5054 !!input
5055 <table><tr>{{echo|<td>}}foo</td></tr></table>
5056 !!result
5057 <table><tr><td>foo</td></tr></table>
5058
5059 !!end
5060
5061 !!test
5062 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5063 !!input
5064 <table><tr><td>foo{{echo|</td>}}</tr></table>
5065 !!result
5066 <table><tr><td>foo</td></tr></table>
5067
5068 !!end
5069
5070 !!test
5071 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5072 !!input
5073 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5074 !!result
5075 <table><tr><td>foo</td></tr></table>
5076
5077 !!end
5078
5079 !!test
5080 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5081 !!input
5082 <table><tr><td>foo</td></tr>{{echo|</table>}}
5083 !!result
5084 <table><tr><td>foo</td></tr></table>
5085
5086 !!end
5087
5088 !!test
5089 Templates: Wiki Tables: 1. Fostering of entire template content
5090 !!input
5091 {|
5092 {{echo|a}}
5093 |}
5094 !!result
5095 <table>
5096 a
5097 <tr><td></td></tr></table>
5098
5099 !!end
5100
5101 !!test
5102 Templates: Wiki Tables: 2. Fostering of partial template content
5103 !!input
5104 {|
5105 {{echo|a
5106 <div>b</div>}}
5107 |}
5108 !!result
5109 <table>
5110 a
5111 <div>b</div>
5112 <tr><td></td></tr></table>
5113
5114 !!end
5115
5116 !!test
5117 Templates: Wiki Tables: 3. td-content via multiple templates
5118 !!input
5119 {|
5120 {{echo|{{pipe}}a}}{{echo|b}}
5121 |}
5122 !!result
5123 <table>
5124 <tr>
5125 <td>ab
5126 </td></tr></table>
5127
5128 !!end
5129
5130 !!test
5131 Templates: Lists: Multi-line list-items via templates
5132 !!input
5133 *{{echo|a {{nonexistent|
5134 unused}}}}
5135 *{{echo|b {{nonexistent|
5136 unused}}}}
5137 !!result
5138 <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>
5139 </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>
5140 </li></ul>
5141
5142 !!end
5143
5144 !!test
5145 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5146 !!input
5147 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5148 !!result
5149 <p><i>ab</i>c<i>d</i>e
5150 </p>
5151 !!end
5152
5153 !!test
5154 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5155 (PHP parser generates misnested html)
5156 !! options
5157 disabled
5158 !!input
5159 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5160 !!result
5161 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5162 !!end
5163
5164 !!test
5165 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5166 (PHP parser generates misnested html)
5167 !! options
5168 disabled
5169 !!input
5170 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5171 !!result
5172 <div><i>a</i></div>
5173 <div><i>b</i>c<i>d</i></div>
5174 <div>e</div>
5175 !!end
5176
5177 !!test
5178 Templates: Ugly nesting: 4. Divs opened/closed across templates
5179 !!input
5180 a<div>b{{echo|c</div>d}}e
5181 !!result
5182 a<div>bc</div>de
5183
5184 !!end
5185
5186 !!test
5187 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5188 (Parsoid-centric)
5189 !! options
5190 disabled
5191 !!input
5192 {|
5193 |{{echo|foo</table>}}
5194 |bar
5195 |}
5196 !!result
5197 <table data-parsoid="{&quot;src&quot;:&quot;{|\n|{{echo|foo&lt;/table&gt;}}\n|bar\n|}&quot;}" about="#mwt1" typeof="mw:Object/Template ">
5198 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5199 bar</span><span about="#mwt1">
5200 </span>
5201 !!end
5202
5203 !!test
5204 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5205 (Parsoid-centric)
5206 !! options
5207 disabled
5208 !!input
5209 <table>
5210 <tr>
5211 <td>
5212 <table>
5213 <tr>
5214 <td>1. {{echo|foo </table>}}</td>
5215 <td> bar </td>
5216 <td>2. {{echo|baz </table>}}</td>
5217 </tr>
5218 <tr>
5219 <td>abc</td>
5220 </tr>
5221 </table>
5222 </td>
5223 </tr>
5224 <tr>
5225 <td>xyz</td>
5226 </tr>
5227 </table>
5228 !!result
5229 <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">
5230 <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5231 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5232 <table data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5233 <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5234 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">1. foo </td></tr></tbody></table></td>
5235 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}"> bar </td>
5236 <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">2. baz </td></tr></tbody></table><span about="#mwt1">
5237 </span><span about="#mwt1">
5238
5239 abc</span><span about="#mwt1">
5240 </span><span about="#mwt1">
5241 </span><span about="#mwt1">
5242 </span><span about="#mwt1">
5243 </span><span about="#mwt1">
5244
5245 xyz</span><span about="#mwt1">
5246 </span><span about="#mwt1">
5247 </span>
5248 !!end
5249
5250 !!test
5251 Parser Functions: 1. Simple example
5252 !!input
5253 {{uc:foo}}
5254 !!result
5255 <p>FOO
5256 </p>
5257 !!end
5258
5259 !!test
5260 Parser Functions: 2. Nested use (only outermost should be marked up)
5261 !!input
5262 {{uc:{{lc:FOO}}}}
5263 !!result
5264 <p>FOO
5265 </p>
5266 !!end
5267
5268 ###
5269 ### Pre-save transform tests
5270 ###
5271 !! test
5272 pre-save transform: subst:
5273 !! options
5274 PST
5275 !! input
5276 {{subst:test}}
5277 !! result
5278 This is a test template
5279 !! end
5280
5281 !! test
5282 pre-save transform: normal template
5283 !! options
5284 PST
5285 !! input
5286 {{test}}
5287 !! result
5288 {{test}}
5289 !! end
5290
5291 !! test
5292 pre-save transform: nonexistent template
5293 !! options
5294 PST
5295 !! input
5296 {{thistemplatedoesnotexist}}
5297 !! result
5298 {{thistemplatedoesnotexist}}
5299 !! end
5300
5301
5302 !! test
5303 pre-save transform: subst magic variables
5304 !! options
5305 PST
5306 !! input
5307 {{subst:SITENAME}}
5308 !! result
5309 MediaWiki
5310 !! end
5311
5312 # This is bug 89, which I fixed. -- wtm
5313 !! test
5314 pre-save transform: subst: templates with parameters
5315 !! options
5316 pst
5317 !! input
5318 {{subst:paramtest|param="something else"}}
5319 !! result
5320 This is a test template with parameter "something else"
5321 !! end
5322
5323 !! article
5324 Template:nowikitest
5325 !! text
5326 <nowiki>'''not wiki'''</nowiki>
5327 !! endarticle
5328
5329 !! test
5330 pre-save transform: nowiki in subst (bug 1188)
5331 !! options
5332 pst
5333 !! input
5334 {{subst:nowikitest}}
5335 !! result
5336 <nowiki>'''not wiki'''</nowiki>
5337 !! end
5338
5339
5340 !! article
5341 Template:commenttest
5342 !! text
5343 This template has <!-- a comment --> in it.
5344 !! endarticle
5345
5346 !! test
5347 pre-save transform: comment in subst (bug 1936)
5348 !! options
5349 pst
5350 !! input
5351 {{subst:commenttest}}
5352 !! result
5353 This template has <!-- a comment --> in it.
5354 !! end
5355
5356 !! test
5357 pre-save transform: unclosed tag
5358 !! options
5359 pst noxml
5360 !! input
5361 <nowiki>'''not wiki'''
5362 !! result
5363 <nowiki>'''not wiki'''
5364 !! end
5365
5366 !! test
5367 pre-save transform: mixed tag case
5368 !! options
5369 pst noxml
5370 !! input
5371 <NOwiki>'''not wiki'''</noWIKI>
5372 !! result
5373 <NOwiki>'''not wiki'''</noWIKI>
5374 !! end
5375
5376 !! test
5377 pre-save transform: unclosed comment in <nowiki>
5378 !! options
5379 pst noxml
5380 !! input
5381 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5382 !! result
5383 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5384 !!end
5385
5386 !! article
5387 Template:dangerous
5388 !!text
5389 <span onmouseover="alert('crap')">Oh no</span>
5390 !!endarticle
5391
5392 !!test
5393 (confirming safety of fix for subst bug 1936)
5394 !! input
5395 {{Template:dangerous}}
5396 !! result
5397 <p><span>Oh no</span>
5398 </p>
5399 !! end
5400
5401 !! test
5402 pre-save transform: comment containing gallery (bug 5024)
5403 !! options
5404 pst
5405 !! input
5406 <!-- <gallery>data</gallery> -->
5407 !!result
5408 <!-- <gallery>data</gallery> -->
5409 !!end
5410
5411 !! test
5412 pre-save transform: comment containing extension
5413 !! options
5414 pst
5415 !! input
5416 <!-- <tag>data</tag> -->
5417 !!result
5418 <!-- <tag>data</tag> -->
5419 !!end
5420
5421 !! test
5422 pre-save transform: comment containing nowiki
5423 !! options
5424 pst
5425 !! input
5426 <!-- <nowiki>data</nowiki> -->
5427 !!result
5428 <!-- <nowiki>data</nowiki> -->
5429 !!end
5430
5431 !! test
5432 pre-save transform: <noinclude> in subst (bug 3298)
5433 !! options
5434 pst
5435 !! input
5436 {{subst:Includes}}
5437 !! result
5438 Foobar
5439 !! end
5440
5441 !! test
5442 pre-save transform: <onlyinclude> in subst (bug 3298)
5443 !! options
5444 pst
5445 !! input
5446 {{subst:Includes2}}
5447 !! result
5448 Foo
5449 !! end
5450
5451 !! article
5452 Template:SubstTest
5453 !!text
5454 {{<includeonly>subst:</includeonly>Includes}}
5455 !! endarticle
5456
5457 !! article
5458 Template:SafeSubstTest
5459 !! text
5460 {{<includeonly>safesubst:</includeonly>Includes}}
5461 !! endarticle
5462
5463 !! test
5464 bug 22297: safesubst: works during PST
5465 !! options
5466 pst
5467 !! input
5468 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
5469 !! result
5470 FoobarFoobar
5471 !! end
5472
5473 !! test
5474 bug 22297: safesubst: works during normal parse
5475 !! input
5476 {{SafeSubstTest}}
5477 !! result
5478 <p>Foobar
5479 </p>
5480 !! end
5481
5482 !! test:
5483 subst: does not work during normal parse
5484 !! input
5485 {{SubstTest}}
5486 !! result
5487 <p>{{subst:Includes}}
5488 </p>
5489 !! end
5490
5491 !! test
5492 pre-save transform: context links ("pipe trick")
5493 !! options
5494 pst
5495 !! input
5496 [[Article (context)|]]
5497 [[Bar:Article|]]
5498 [[:Bar:Article|]]
5499 [[Bar:Article (context)|]]
5500 [[:Bar:Article (context)|]]
5501 [[|Article]]
5502 [[|Article (context)]]
5503 [[Bar:X (Y) Z|]]
5504 [[:Bar:X (Y) Z|]]
5505 !! result
5506 [[Article (context)|Article]]
5507 [[Bar:Article|Article]]
5508 [[:Bar:Article|Article]]
5509 [[Bar:Article (context)|Article]]
5510 [[:Bar:Article (context)|Article]]
5511 [[Article]]
5512 [[Article (context)]]
5513 [[Bar:X (Y) Z|X (Y) Z]]
5514 [[:Bar:X (Y) Z|X (Y) Z]]
5515 !! end
5516
5517 !! test
5518 pre-save transform: context links ("pipe trick") with interwiki prefix
5519 !! options
5520 pst
5521 !! input
5522 [[interwiki:Article|]]
5523 [[:interwiki:Article|]]
5524 [[interwiki:Bar:Article|]]
5525 [[:interwiki:Bar:Article|]]
5526 !! result
5527 [[interwiki:Article|Article]]
5528 [[:interwiki:Article|Article]]
5529 [[interwiki:Bar:Article|Bar:Article]]
5530 [[:interwiki:Bar:Article|Bar:Article]]
5531 !! end
5532
5533 !! test
5534 pre-save transform: context links ("pipe trick") with parens in title
5535 !! options
5536 pst title=[[Somearticle (context)]]
5537 !! input
5538 [[|Article]]
5539 !! result
5540 [[Article (context)|Article]]
5541 !! end
5542
5543 !! test
5544 pre-save transform: context links ("pipe trick") with comma in title
5545 !! options
5546 pst title=[[Someplace, Somewhere]]
5547 !! input
5548 [[|Otherplace]]
5549 [[Otherplace, Elsewhere|]]
5550 [[Otherplace, Elsewhere, Anywhere|]]
5551 !! result
5552 [[Otherplace, Somewhere|Otherplace]]
5553 [[Otherplace, Elsewhere|Otherplace]]
5554 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
5555 !! end
5556
5557 !! test
5558 pre-save transform: context links ("pipe trick") with parens and comma
5559 !! options
5560 pst title=[[Someplace (IGNORED), Somewhere]]
5561 !! input
5562 [[|Otherplace]]
5563 [[Otherplace (place), Elsewhere|]]
5564 !! result
5565 [[Otherplace, Somewhere|Otherplace]]
5566 [[Otherplace (place), Elsewhere|Otherplace]]
5567 !! end
5568
5569 !! test
5570 pre-save transform: context links ("pipe trick") with comma and parens
5571 !! options
5572 pst title=[[Who, me? (context)]]
5573 !! input
5574 [[|Yes, you.]]
5575 [[Me, Myself, and I (1937 song)|]]
5576 !! result
5577 [[Yes, you. (context)|Yes, you.]]
5578 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
5579 !! end
5580
5581 !! test
5582 pre-save transform: context links ("pipe trick") with namespace
5583 !! options
5584 pst title=[[Ns:Somearticle]]
5585 !! input
5586 [[|Article]]
5587 !! result
5588 [[Ns:Article|Article]]
5589 !! end
5590
5591 !! test
5592 pre-save transform: context links ("pipe trick") with namespace and parens
5593 !! options
5594 pst title=[[Ns:Somearticle (context)]]
5595 !! input
5596 [[|Article]]
5597 !! result
5598 [[Ns:Article (context)|Article]]
5599 !! end
5600
5601 !! test
5602 pre-save transform: context links ("pipe trick") with namespace and comma
5603 !! options
5604 pst title=[[Ns:Somearticle, Context, Whatever]]
5605 !! input
5606 [[|Article]]
5607 !! result
5608 [[Ns:Article, Context, Whatever|Article]]
5609 !! end
5610
5611 !! test
5612 pre-save transform: context links ("pipe trick") with namespace, comma and parens
5613 !! options
5614 pst title=[[Ns:Somearticle, Context (context)]]
5615 !! input
5616 [[|Article]]
5617 !! result
5618 [[Ns:Article (context)|Article]]
5619 !! end
5620
5621 !! test
5622 pre-save transform: context links ("pipe trick") with namespace, parens and comma
5623 !! options
5624 pst title=[[Ns:Somearticle (IGNORED), Context]]
5625 !! input
5626 [[|Article]]
5627 !! result
5628 [[Ns:Article, Context|Article]]
5629 !! end
5630
5631 !! test
5632 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
5633 !! options
5634 pst
5635 !! input
5636 [[Article(context)|]]
5637 [[Bar:Article(context)|]]
5638 [[:Bar:Article(context)|]]
5639 [[|Article(context)]]
5640 [[Bar:X(Y)Z|]]
5641 [[:Bar:X(Y)Z|]]
5642 !! result
5643 [[Article(context)|Article]]
5644 [[Bar:Article(context)|Article]]
5645 [[:Bar:Article(context)|Article]]
5646 [[Article(context)]]
5647 [[Bar:X(Y)Z|X(Y)Z]]
5648 [[:Bar:X(Y)Z|X(Y)Z]]
5649 !! end
5650
5651 !! test
5652 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
5653 !! options
5654 pst
5655 !! input
5656 [[Article (context)|]]
5657 [[Bar:Article (context)|]]
5658 [[:Bar:Article (context)|]]
5659 [[|Article (context)]]
5660 [[Bar:X (Y) Z|]]
5661 [[:Bar:X (Y) Z|]]
5662 !! result
5663 [[Article (context)|Article]]
5664 [[Bar:Article (context)|Article]]
5665 [[:Bar:Article (context)|Article]]
5666 [[Article (context)]]
5667 [[Bar:X (Y) Z|X (Y) Z]]
5668 [[:Bar:X (Y) Z|X (Y) Z]]
5669 !! end
5670
5671 !! test
5672 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
5673 !! options
5674 pst
5675 !! input
5676 [[Article(context)|]]
5677 [[Bar:Article(context)|]]
5678 [[:Bar:Article(context)|]]
5679 [[|Article(context)]]
5680 [[Bar:X(Y)Z|]]
5681 [[:Bar:X(Y)Z|]]
5682 !! result
5683 [[Article(context)|Article]]
5684 [[Bar:Article(context)|Article]]
5685 [[:Bar:Article(context)|Article]]
5686 [[Article(context)]]
5687 [[Bar:X(Y)Z|X(Y)Z]]
5688 [[:Bar:X(Y)Z|X(Y)Z]]
5689 !! end
5690
5691 !! test
5692 pre-save transform: context links ("pipe trick") with commas (bug 21660)
5693 !! options
5694 pst
5695 !! input
5696 [[Article (context), context|]]
5697 [[Article (context),context|]]
5698 [[Bar:Article (context), context|]]
5699 [[Bar:Article (context),context|]]
5700 [[:Bar:Article (context), context|]]
5701 [[:Bar:Article (context),context|]]
5702 !! result
5703 [[Article (context), context|Article]]
5704 [[Article (context),context|Article]]
5705 [[Bar:Article (context), context|Article]]
5706 [[Bar:Article (context),context|Article]]
5707 [[:Bar:Article (context), context|Article]]
5708 [[:Bar:Article (context),context|Article]]
5709 !! end
5710
5711 !! test
5712 pre-save transform: trim trailing empty lines
5713 !! options
5714 pst
5715 !! input
5716 Empty lines are trimmed
5717
5718
5719
5720
5721 !! result
5722 Empty lines are trimmed
5723 !! end
5724
5725 !! test
5726 pre-save transform: Signature expansion
5727 !! options
5728 pst
5729 !! input
5730 * ~~~
5731 * <noinclude>~~~</noinclude>
5732 * <includeonly>~~~</includeonly>
5733 * <onlyinclude>~~~</onlyinclude>
5734 !! result
5735 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
5736 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
5737 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
5738 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
5739 !! end
5740
5741
5742 !! test
5743 pre-save transform: Signature expansion in nowiki tags (bug 93)
5744 !! options
5745 pst disabled
5746 !! input
5747 Shall not expand:
5748
5749 <nowiki>~~~~</nowiki>
5750
5751 <includeonly><nowiki>~~~~</nowiki></includeonly>
5752
5753 <noinclude><nowiki>~~~~</nowiki></noinclude>
5754
5755 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5756
5757 {{subst:Foo}} shall be converted to FOO
5758
5759 As well as inside noinclude/onlyinclude
5760 <noinclude>{{subst:Foo}}</noinclude>
5761 <onlyinclude>{{subst:Foo}}</onlyinclude>
5762
5763 But not inside includeonly
5764 <includeonly>{{subst:Foo}}</includeonly>
5765 !! result
5766 Shall not expand:
5767
5768 <nowiki>~~~~</nowiki>
5769
5770 <includeonly><nowiki>~~~~</nowiki></includeonly>
5771
5772 <noinclude><nowiki>~~~~</nowiki></noinclude>
5773
5774 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5775
5776 FOO shall be converted to FOO
5777
5778 As well as inside noinclude/onlyinclude
5779 <noinclude>FOO</noinclude>
5780 <onlyinclude>FOO</onlyinclude>
5781
5782 But not inside includeonly
5783 <includeonly>{{subst:Foo}}</includeonly>
5784 !! end
5785
5786 ###
5787 ### Message transform tests
5788 ###
5789 !! test
5790 message transform: magic variables
5791 !! options
5792 msg
5793 !! input
5794 {{SITENAME}}
5795 !! result
5796 MediaWiki
5797 !! end
5798
5799 !! test
5800 message transform: should not transform wiki markup
5801 !! options
5802 msg
5803 !! input
5804 ''test''
5805 !! result
5806 ''test''
5807 !! end
5808
5809 !! test
5810 message transform: <noinclude> in transcluded template (bug 4926)
5811 !! options
5812 msg
5813 !! input
5814 {{Includes}}
5815 !! result
5816 Foobar
5817 !! end
5818
5819 !! test
5820 message transform: <onlyinclude> in transcluded template (bug 4926)
5821 !! options
5822 msg
5823 !! input
5824 {{Includes2}}
5825 !! result
5826 Foo
5827 !! end
5828
5829 !! test
5830 {{#special:}} page name, known
5831 !! options
5832 msg
5833 !! input
5834 {{#special:Recentchanges}}
5835 !! result
5836 Special:RecentChanges
5837 !! end
5838
5839 !! test
5840 {{#special:}} page name with subpage, known
5841 !! options
5842 msg
5843 !! input
5844 {{#special:Recentchanges/param}}
5845 !! result
5846 Special:RecentChanges/param
5847 !! end
5848
5849 !! test
5850 {{#special:}} page name, unknown
5851 !! options
5852 msg
5853 !! input
5854 {{#special:foobarnonexistent}}
5855 !! result
5856 No such special page
5857 !! end
5858
5859 !! test
5860 {{#speciale:}} page name, known
5861 !! options
5862 msg
5863 !! input
5864 {{#speciale:Recentchanges}}
5865 !! result
5866 Special:RecentChanges
5867 !! end
5868
5869 !! test
5870 {{#speciale:}} page name with subpage, known
5871 !! options
5872 msg
5873 !! input
5874 {{#speciale:Recentchanges/param}}
5875 !! result
5876 Special:RecentChanges/param
5877 !! end
5878
5879 !! test
5880 {{#speciale:}} page name, unknown
5881 !! options
5882 msg
5883 !! input
5884 {{#speciale:foobarnonexistent}}
5885 !! result
5886 No_such_special_page
5887 !! end
5888
5889 ###
5890 ### Images
5891 ###
5892 !! test
5893 Simple image
5894 !! input
5895 [[Image:foobar.jpg]]
5896 !! result
5897 <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>
5898 </p>
5899 !! end
5900
5901 !! test
5902 Right-aligned image
5903 !! input
5904 [[Image:foobar.jpg|right]]
5905 !! result
5906 <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>
5907
5908 !! end
5909
5910 !! test
5911 Simple image (using File: namespace, now canonical)
5912 !! input
5913 [[File:foobar.jpg]]
5914 !! result
5915 <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>
5916 </p>
5917 !! end
5918
5919 !! test
5920 Image with caption
5921 !! input
5922 [[Image:foobar.jpg|right|Caption text]]
5923 !! result
5924 <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>
5925
5926 !! end
5927
5928 !! test
5929 Image with empty attribute
5930 !! input
5931 [[Image:foobar.jpg|right||Caption text]]
5932 !! result
5933 <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>
5934
5935 !! end
5936
5937 !! test
5938 Image with link tails
5939 !! input
5940 123[[Image:foobar.jpg]]456
5941 123[[Image:foobar.jpg|right]]456
5942 123[[Image:foobar.jpg|thumb]]456
5943 !! result
5944 <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
5945 </p>
5946 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
5947 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
5948
5949 !! end
5950
5951 !! test
5952 Image with multiple captions -- only last one is accepted
5953 !! input
5954 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
5955 !! result
5956 <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>
5957
5958 !! end
5959
5960 !! test
5961 Image with link parameter, wiki target
5962 !! input
5963 [[Image:foobar.jpg|link=Target page]]
5964 !! result
5965 <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>
5966 </p>
5967 !! end
5968
5969 !! test
5970 Image with link parameter, URL target
5971 !! input
5972 [[Image:foobar.jpg|link=http://example.com/]]
5973 !! result
5974 <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>
5975 </p>
5976 !! end
5977
5978 !! test
5979 Image with link parameter, wgExternalLinkTarget
5980 !! input
5981 [[Image:foobar.jpg|link=http://example.com/]]
5982 !! config
5983 wgExternalLinkTarget='foobar'
5984 !! result
5985 <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>
5986 </p>
5987 !! end
5988
5989 !! test
5990 Image with link parameter, wgNoFollowLinks set to false
5991 !! input
5992 [[Image:foobar.jpg|link=http://example.com/]]
5993 !! config
5994 wgNoFollowLinks=false
5995 !! result
5996 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
5997 </p>
5998 !! end
5999
6000 !! test
6001 Image with link parameter, wgNoFollowDomainExceptions
6002 !! input
6003 [[Image:foobar.jpg|link=http://example.com/]]
6004 !! config
6005 wgNoFollowDomainExceptions='example.com'
6006 !! result
6007 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6008 </p>
6009 !! end
6010
6011 !! test
6012 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6013 !! input
6014 [[Image:foobar.jpg|link=http://example.com/|Title]]
6015 !! config
6016 wgExternalLinkTarget='foobar'
6017 !! result
6018 <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>
6019 </p>
6020 !! end
6021
6022 !! test
6023 Image with empty link parameter
6024 !! input
6025 [[Image:foobar.jpg|link=]]
6026 !! result
6027 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6028 </p>
6029 !! end
6030
6031 !! test
6032 Image with link parameter (wiki target) and unnamed parameter
6033 !! input
6034 [[Image:foobar.jpg|link=Target page|Title]]
6035 !! result
6036 <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>
6037 </p>
6038 !! end
6039
6040 !! test
6041 Image with link parameter (URL target) and unnamed parameter
6042 !! input
6043 [[Image:foobar.jpg|link=http://example.com/|Title]]
6044 !! result
6045 <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>
6046 </p>
6047 !! end
6048
6049 !! test
6050 Thumbnail image with link parameter
6051 !! input
6052 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6053 !! result
6054 <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>
6055
6056 !! end
6057
6058 !! test
6059 Image with frame and link
6060 !! input
6061 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6062 !! result
6063 <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>
6064
6065 !! end
6066
6067 !! test
6068 Image with frame and link and explicit alt
6069 !! input
6070 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6071 !! result
6072 <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>
6073
6074 !! end
6075
6076 !! test
6077 Image with wiki markup in implicit alt
6078 !! input
6079 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6080 !! result
6081 <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>
6082 </p>
6083 !! end
6084
6085 !! test
6086 Image with wiki markup in explicit alt
6087 !! input
6088 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6089 !! result
6090 <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>
6091 </p>
6092 !! end
6093
6094 !! test
6095 Link to image page- image page normally doesn't exists, hence edit link
6096 Add test with existing image page
6097 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6098 !! input
6099 [[:Image:test]]
6100 !! result
6101 <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>
6102 </p>
6103 !! end
6104
6105 !! test
6106 bug 18784 Link to non-existent image page with caption should use caption as link text
6107 !! input
6108 [[:Image:test|caption]]
6109 !! result
6110 <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>
6111 </p>
6112 !! end
6113
6114 !! test
6115 Frameless image caption with a free URL
6116 !! input
6117 [[Image:foobar.jpg|http://example.com]]
6118 !! result
6119 <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>
6120 </p>
6121 !! end
6122
6123 !! test
6124 Thumbnail image caption with a free URL
6125 !! input
6126 [[Image:foobar.jpg|thumb|http://example.com]]
6127 !! result
6128 <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>
6129
6130 !! end
6131
6132 !! test
6133 Thumbnail image caption with a free URL and explicit alt
6134 !! input
6135 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6136 !! result
6137 <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>
6138
6139 !! end
6140
6141 !! test
6142 BUG 1887: A ISBN with a thumbnail
6143 !! input
6144 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6145 !! result
6146 <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>
6147
6148 !! end
6149
6150 !! test
6151 BUG 1887: A RFC with a thumbnail
6152 !! input
6153 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6154 !! result
6155 <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>
6156
6157 !! end
6158
6159 !! test
6160 BUG 1887: A mailto link with a thumbnail
6161 !! input
6162 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
6163 !! result
6164 <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>
6165
6166 !! end
6167
6168 # Pending resolution to bug 368
6169 !! test
6170 BUG 648: Frameless image caption with a link
6171 !! input
6172 [[Image:foobar.jpg|text with a [[link]] in it]]
6173 !! result
6174 <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>
6175 </p>
6176 !! end
6177
6178 !! test
6179 BUG 648: Frameless image caption with a link (suffix)
6180 !! input
6181 [[Image:foobar.jpg|text with a [[link]]foo in it]]
6182 !! result
6183 <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>
6184 </p>
6185 !! end
6186
6187 !! test
6188 BUG 648: Frameless image caption with an interwiki link
6189 !! input
6190 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
6191 !! result
6192 <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>
6193 </p>
6194 !! end
6195
6196 !! test
6197 BUG 648: Frameless image caption with a piped interwiki link
6198 !! input
6199 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
6200 !! result
6201 <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>
6202 </p>
6203 !! end
6204
6205 !! test
6206 Escape HTML special chars in image alt text
6207 !! input
6208 [[Image:foobar.jpg|& < > "]]
6209 !! result
6210 <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>
6211 </p>
6212 !! end
6213
6214 !! test
6215 BUG 499: Alt text should have &#1234;, not &amp;1234;
6216 !! input
6217 [[Image:foobar.jpg|&#9792;]]
6218 !! result
6219 <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>
6220 </p>
6221 !! end
6222
6223 !! test
6224 Broken image caption with link
6225 !! input
6226 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
6227 !! result
6228 <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.
6229 </p>
6230 !! end
6231
6232 !! test
6233 Image caption containing another image
6234 !! input
6235 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
6236 !! result
6237 <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>
6238
6239 !! end
6240
6241 !! test
6242 Image caption containing a newline
6243 !! input
6244 [[Image:Foobar.jpg|This
6245 *is some text]]
6246 !! result
6247 <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>
6248 </p>
6249 !!end
6250
6251
6252 !! test
6253 Bug 3090: External links other than http: in image captions
6254 !! input
6255 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
6256 !! result
6257 <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>
6258
6259 !! end
6260
6261 !! test
6262 Custom class
6263 !! input
6264 [[Image:foobar.jpg|a|class=b]]
6265 !! result
6266 <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>
6267 </p>
6268 !! end
6269
6270 !! article
6271 File:Barfoo.jpg
6272 !! text
6273 #REDIRECT [[File:Barfoo.jpg]]
6274 !! endarticle
6275
6276 !! test
6277 Redirected image
6278 !! input
6279 [[Image:Barfoo.jpg]]
6280 !! result
6281 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
6282 </p>
6283 !! end
6284
6285 !! test
6286 Missing image with uploads disabled
6287 !! options
6288 wgEnableUploads=0
6289 !! input
6290 [[Image:Foobaz.jpg]]
6291 !! result
6292 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
6293 </p>
6294 !! end
6295
6296
6297 ###
6298 ### Subpages
6299 ###
6300 !! article
6301 Subpage test/subpage
6302 !! text
6303 foo
6304 !! endarticle
6305
6306 !! test
6307 Subpage link
6308 !! options
6309 subpage title=[[Subpage test]]
6310 !! input
6311 [[/subpage]]
6312 !! result
6313 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
6314 </p>
6315 !! end
6316
6317 !! test
6318 Subpage noslash link
6319 !! options
6320 subpage title=[[Subpage test]]
6321 !!input
6322 [[/subpage/]]
6323 !! result
6324 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
6325 </p>
6326 !! end
6327
6328 !! test
6329 Disabled subpages
6330 !! input
6331 [[/subpage]]
6332 !! result
6333 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
6334 </p>
6335 !! end
6336
6337 !! test
6338 BUG 561: {{/Subpage}}
6339 !! options
6340 subpage title=[[Page]]
6341 !! input
6342 {{/Subpage}}
6343 !! result
6344 <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>
6345 </p>
6346 !! end
6347
6348 ###
6349 ### Categories
6350 ###
6351 !! article
6352 Category:MediaWiki User's Guide
6353 !! text
6354 blah
6355 !! endarticle
6356
6357 !! test
6358 Link to category
6359 !! input
6360 [[:Category:MediaWiki User's Guide]]
6361 !! result
6362 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
6363 </p>
6364 !! end
6365
6366 !! test
6367 Simple category
6368 !! options
6369 cat
6370 !! input
6371 [[Category:MediaWiki User's Guide]]
6372 !! result
6373 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6374 !! end
6375
6376 !! test
6377 PAGESINCATEGORY invalid title fatal (r33546 fix)
6378 !! input
6379 {{PAGESINCATEGORY:<bogus>}}
6380 !! result
6381 <p>0
6382 </p>
6383 !! end
6384
6385 !! test
6386 Category with different sort key
6387 !! options
6388 cat
6389 !! input
6390 [[Category:MediaWiki User's Guide|Foo]]
6391 !! result
6392 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6393 !! end
6394
6395 !! test
6396 Category with identical sort key
6397 !! options
6398 cat
6399 !! input
6400 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6401 !! result
6402 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6403 !! end
6404
6405 !! test
6406 Category with empty sort key
6407 !! options
6408 cat
6409 pst
6410 !! input
6411 [[Category:MediaWiki User's Guide|]]
6412 !! result
6413 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6414 !! end
6415
6416 !! test
6417 Category with empty sort key and parentheses
6418 !! options
6419 cat
6420 pst
6421 !! input
6422 [[Category:Foo (bar)|]]
6423 !! result
6424 [[Category:Foo (bar)|Foo]]
6425 !! end
6426
6427 !! test
6428 Category with link tail
6429 !! options
6430 cat
6431 pst
6432 !! input
6433 123[[Category:Foo]]456
6434 !! result
6435 123[[Category:Foo]]456
6436 !! end
6437
6438 !! test
6439 Category with template
6440 !! options
6441 cat
6442 pst
6443 !! input
6444 [[Category:{{echo|Foo}}]]
6445 !! result
6446 [[Category:{{echo|Foo}}]]
6447 !! end
6448
6449 !! test
6450 Category with template in sort key
6451 !! options
6452 cat
6453 pst
6454 !! input
6455 [[Category:Foo|{{echo|Bar}}]]
6456 !! result
6457 [[Category:Foo|{{echo|Bar}}]]
6458 !! end
6459
6460 !! test
6461 Category with template in sort key and title
6462 !! options
6463 cat
6464 pst
6465 !! input
6466 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
6467 !! result
6468 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
6469 !! end
6470
6471 !! test
6472 Category / paragraph interactions
6473 !! input
6474 Foo [[Category:Baz]] Bar
6475
6476 Foo [[Category:Baz]]
6477 Bar
6478
6479 Foo
6480 [[Category:Baz]]
6481 Bar
6482
6483 Foo
6484 [[Category:Baz]] Bar
6485
6486 Foo
6487 [[Category:Baz]]
6488 [[Category:Baz]]
6489 [[Category:Baz]]
6490 Bar
6491
6492 [[Category:Baz]]
6493 [[Category:Baz]]
6494 [[Category:Baz]]
6495
6496 [[Category:Baz]]
6497 {{echo|[[Category:Baz]]}}
6498 [[Category:Baz]]
6499 !! result
6500 <p>Foo Bar
6501 </p><p>Foo
6502 Bar
6503 </p><p>Foo
6504 Bar
6505 </p><p>Foo Bar
6506 </p><p>Foo
6507 Bar
6508 </p>
6509 !! end
6510
6511 ###
6512 ### Inter-language links
6513 ###
6514 !! test
6515 Inter-language links
6516 !! options
6517 ill
6518 !! input
6519 [[es:Alimento]]
6520 [[fr:Nourriture]]
6521 [[zh:&#39135;&#21697;]]
6522 !! result
6523 es:Alimento fr:Nourriture zh:食品
6524 !! end
6525
6526 !! test
6527 Duplicate interlanguage links (bug 24502)
6528 !! options
6529 ill
6530 !! input
6531 [[es:1]]
6532 [[es:2]]
6533 [[fr:1]]
6534 [[fr:2]]
6535 !! result
6536 es:1 fr:1
6537 !! end
6538
6539 ###
6540 ### Sections
6541 ###
6542 !! test
6543 Basic section headings
6544 !! input
6545 == Headline 1 ==
6546 Some text
6547
6548 ==Headline 2==
6549 More
6550 ===Smaller headline===
6551 Blah blah
6552 !! result
6553 <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>
6554 <p>Some text
6555 </p>
6556 <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>
6557 <p>More
6558 </p>
6559 <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>
6560 <p>Blah blah
6561 </p>
6562 !! end
6563
6564 !! test
6565 Section headings with TOC
6566 !! input
6567 == Headline 1 ==
6568 === Subheadline 1 ===
6569 ===== Skipping a level =====
6570 ====== Skipping a level ======
6571
6572 == Headline 2 ==
6573 Some text
6574 ===Another headline===
6575 !! result
6576 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6577 <ul>
6578 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
6579 <ul>
6580 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
6581 <ul>
6582 <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>
6583 <ul>
6584 <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>
6585 </ul>
6586 </li>
6587 </ul>
6588 </li>
6589 </ul>
6590 </li>
6591 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
6592 <ul>
6593 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
6594 </ul>
6595 </li>
6596 </ul>
6597 </td></tr></table>
6598 <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>
6599 <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>
6600 <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>
6601 <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>
6602 <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>
6603 <p>Some text
6604 </p>
6605 <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>
6606
6607 !! end
6608
6609 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
6610 !! test
6611 Handling of sections up to level 6 and beyond
6612 !! input
6613 = Level 1 Heading=
6614 == Level 2 Heading==
6615 === Level 3 Heading===
6616 ==== Level 4 Heading====
6617 ===== Level 5 Heading=====
6618 ====== Level 6 Heading======
6619 ======= Level 7 Heading=======
6620 ======== Level 8 Heading========
6621 ========= Level 9 Heading=========
6622 ========== Level 10 Heading==========
6623 !! result
6624 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6625 <ul>
6626 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
6627 <ul>
6628 <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>
6629 <ul>
6630 <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>
6631 <ul>
6632 <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>
6633 <ul>
6634 <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>
6635 <ul>
6636 <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>
6637 <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>
6638 <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>
6639 <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>
6640 <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>
6641 </ul>
6642 </li>
6643 </ul>
6644 </li>
6645 </ul>
6646 </li>
6647 </ul>
6648 </li>
6649 </ul>
6650 </li>
6651 </ul>
6652 </td></tr></table>
6653 <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>
6654 <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>
6655 <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>
6656 <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>
6657 <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>
6658 <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>
6659 <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>
6660 <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>
6661 <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>
6662 <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>
6663
6664 !! end
6665
6666 !! test
6667 TOC regression (bug 9764)
6668 !! input
6669 == title 1 ==
6670 === title 1.1 ===
6671 ==== title 1.1.1 ====
6672 === title 1.2 ===
6673 == title 2 ==
6674 === title 2.1 ===
6675 !! result
6676 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6677 <ul>
6678 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6679 <ul>
6680 <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>
6681 <ul>
6682 <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>
6683 </ul>
6684 </li>
6685 <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>
6686 </ul>
6687 </li>
6688 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6689 <ul>
6690 <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>
6691 </ul>
6692 </li>
6693 </ul>
6694 </td></tr></table>
6695 <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>
6696 <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>
6697 <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>
6698 <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>
6699 <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>
6700 <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>
6701
6702 !! end
6703
6704 !! test
6705 TOC with wgMaxTocLevel=3 (bug 6204)
6706 !! options
6707 wgMaxTocLevel=3
6708 !! input
6709 == title 1 ==
6710 === title 1.1 ===
6711 ==== title 1.1.1 ====
6712 === title 1.2 ===
6713 == title 2 ==
6714 === title 2.1 ===
6715 !! result
6716 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6717 <ul>
6718 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6719 <ul>
6720 <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>
6721 <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>
6722 </ul>
6723 </li>
6724 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6725 <ul>
6726 <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>
6727 </ul>
6728 </li>
6729 </ul>
6730 </td></tr></table>
6731 <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>
6732 <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>
6733 <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>
6734 <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>
6735 <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>
6736 <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>
6737
6738 !! end
6739
6740 !! test
6741 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
6742 !! options
6743 wgMaxTocLevel=3
6744 !! input
6745 ==Section 1==
6746 ===Section 1.1===
6747 ====Section 1.1.1====
6748 ====Section 1.1.1.1====
6749 ==Section 2==
6750 !! result
6751 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6752 <ul>
6753 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
6754 <ul>
6755 <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>
6756 </ul>
6757 </li>
6758 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
6759 </ul>
6760 </td></tr></table>
6761 <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>
6762 <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>
6763 <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>
6764 <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>
6765 <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>
6766
6767 !! end
6768
6769
6770 !! test
6771 Resolving duplicate section names
6772 !! input
6773 == Foo bar ==
6774 == Foo bar ==
6775 !! result
6776 <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>
6777 <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>
6778
6779 !! end
6780
6781 !! test
6782 Resolving duplicate section names with differing case (bug 10721)
6783 !! input
6784 == Foo bar ==
6785 == Foo Bar ==
6786 !! result
6787 <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>
6788 <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>
6789
6790 !! end
6791
6792 !! article
6793 Template:sections
6794 !! text
6795 ===Section 1===
6796 ==Section 2==
6797 !! endarticle
6798
6799 !! test
6800 Template with sections, __NOTOC__
6801 !! input
6802 __NOTOC__
6803 ==Section 0==
6804 {{sections}}
6805 ==Section 4==
6806 !! result
6807 <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>
6808 <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>
6809 <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>
6810 <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>
6811
6812 !! end
6813
6814 !! test
6815 __NOEDITSECTION__ keyword
6816 !! input
6817 __NOEDITSECTION__
6818 ==Section 1==
6819 ==Section 2==
6820 !! result
6821 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
6822 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
6823
6824 !! end
6825
6826 !! test
6827 Link inside a section heading
6828 !! input
6829 ==Section with a [[Main Page|link]] in it==
6830 !! result
6831 <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>
6832
6833 !! end
6834
6835 !! test
6836 TOC regression (bug 12077)
6837 !! input
6838 __TOC__
6839 == title 1 ==
6840 === title 1.1 ===
6841 == title 2 ==
6842 !! result
6843 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6844 <ul>
6845 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6846 <ul>
6847 <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>
6848 </ul>
6849 </li>
6850 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
6851 </ul>
6852 </td></tr></table>
6853 <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>
6854 <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>
6855 <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>
6856
6857 !! end
6858
6859 !! test
6860 BUG 1219 URL next to image (good)
6861 !! input
6862 http://example.com [[Image:foobar.jpg]]
6863 !! result
6864 <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>
6865 </p>
6866 !!end
6867
6868 !! test
6869 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
6870 !! input
6871 ===
6872 The line above must have a trailing space!
6873 === <!--
6874 --> <!-- -->
6875 But just in case it doesn't...
6876 !! result
6877 <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>
6878 <p>The line above must have a trailing space!
6879 </p>
6880 <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>
6881 <p>But just in case it doesn't...
6882 </p>
6883 !! end
6884
6885 !! test
6886 Header with special characters (bug 25462)
6887 !! input
6888 The tooltips shall not show entities to the user (ie. be double escaped)
6889
6890 == text > text ==
6891 section 1
6892
6893 == text < text ==
6894 section 2
6895
6896 == text & text ==
6897 section 3
6898
6899 == text ' text ==
6900 section 4
6901
6902 == text " text ==
6903 section 5
6904 !! result
6905 <p>The tooltips shall not show entities to the user (ie. be double escaped)
6906 </p>
6907 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6908 <ul>
6909 <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>
6910 <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>
6911 <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>
6912 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
6913 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
6914 </ul>
6915 </td></tr></table>
6916 <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>
6917 <p>section 1
6918 </p>
6919 <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>
6920 <p>section 2
6921 </p>
6922 <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>
6923 <p>section 3
6924 </p>
6925 <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>
6926 <p>section 4
6927 </p>
6928 <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>
6929 <p>section 5
6930 </p>
6931 !! end
6932
6933 !! test
6934 Headers with excess '=' characters
6935 (Are similar tests necessary beyond the 1st level?)
6936 !! input
6937 =foo==
6938 ==foo=
6939 =''italic'' heading==
6940 ==''italic'' heading=
6941 !! result
6942 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6943 <ul>
6944 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
6945 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
6946 <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>
6947 <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>
6948 </ul>
6949 </td></tr></table>
6950 <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>
6951 <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>
6952 <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>
6953 <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>
6954
6955 !! end
6956
6957 !! test
6958 BUG 1219 URL next to image (broken)
6959 !! input
6960 http://example.com[[Image:foobar.jpg]]
6961 !! result
6962 <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>
6963 </p>
6964 !!end
6965
6966 !! test
6967 Bug 1186 news: in the middle of text
6968 !! input
6969 http://en.wikinews.org/wiki/Wikinews:Workplace
6970 !! result
6971 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
6972 </p>
6973 !!end
6974
6975
6976 !! test
6977 Namespaced link must have a title
6978 !! input
6979 [[Project:]]
6980 !! result
6981 <p>[[Project:]]
6982 </p>
6983 !!end
6984
6985 !! test
6986 Namespaced link must have a title (bad fragment version)
6987 !! input
6988 [[Project:#fragment]]
6989 !! result
6990 <p>[[Project:#fragment]]
6991 </p>
6992 !!end
6993
6994
6995 !! test
6996 div with no attributes
6997 !! input
6998 <div>HTML rocks</div>
6999 !! result
7000 <div>HTML rocks</div>
7001
7002 !! end
7003
7004 !! test
7005 div with double-quoted attribute
7006 !! input
7007 <div id="rock">HTML rocks</div>
7008 !! result
7009 <div id="rock">HTML rocks</div>
7010
7011 !! end
7012
7013 !! test
7014 div with single-quoted attribute
7015 !! input
7016 <div id='rock'>HTML rocks</div>
7017 !! result
7018 <div id="rock">HTML rocks</div>
7019
7020 !! end
7021
7022 !! test
7023 div with unquoted attribute
7024 !! input
7025 <div id=rock>HTML rocks</div>
7026 !! result
7027 <div id="rock">HTML rocks</div>
7028
7029 !! end
7030
7031 !! test
7032 div with illegal double attributes
7033 !! input
7034 <div id="a" id="b">HTML rocks</div>
7035 !! result
7036 <div id="b">HTML rocks</div>
7037
7038 !!end
7039
7040 !! test
7041 HTML multiple attributes correction
7042 !! input
7043 <p class="error" class="awesome">Awesome!</p>
7044 !! result
7045 <p class="awesome">Awesome!</p>
7046
7047 !!end
7048
7049 !! test
7050 Table multiple attributes correction
7051 !! input
7052 {|
7053 !+ class="error" class="awesome"| status
7054 |}
7055 !! result
7056 <table>
7057 <tr>
7058 <th class="awesome"> status
7059 </th></tr></table>
7060
7061 !!end
7062
7063 !! test
7064 DIV IN UPPERCASE
7065 !! input
7066 <DIV ID="x">HTML ROCKS</DIV>
7067 !! result
7068 <div id="x">HTML ROCKS</div>
7069
7070 !!end
7071
7072
7073 !! test
7074 text with amp in the middle of nowhere
7075 !! input
7076 Remember AT&T?
7077 !!result
7078 <p>Remember AT&amp;T?
7079 </p>
7080 !! end
7081
7082 !! test
7083 text with character entity: eacute
7084 !! input
7085 I always thought &eacute; was a cute letter.
7086 !! result
7087 <p>I always thought &#233; was a cute letter.
7088 </p>
7089 !! end
7090
7091 !! test
7092 text with undefined character entity: xacute
7093 !! input
7094 I always thought &xacute; was a cute letter.
7095 !! result
7096 <p>I always thought &amp;xacute; was a cute letter.
7097 </p>
7098 !! end
7099
7100
7101 ###
7102 ### Media links
7103 ###
7104
7105 !! test
7106 Media link
7107 !! input
7108 [[Media:Foobar.jpg]]
7109 !! result
7110 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
7111 </p>
7112 !! end
7113
7114 !! test
7115 Media link with text
7116 !! input
7117 [[Media:Foobar.jpg|A neat file to look at]]
7118 !! result
7119 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
7120 </p>
7121 !! end
7122
7123 # FIXME: this is still bad HTML tag nesting
7124 !! test
7125 Media link with nasty text
7126 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
7127 !! input
7128 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
7129 !! result
7130 <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>
7131
7132 !! end
7133
7134 !! test
7135 Media link to nonexistent file (bug 1702)
7136 !! input
7137 [[Media:No such.jpg]]
7138 !! result
7139 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
7140 </p>
7141 !! end
7142
7143 !! test
7144 Image link to nonexistent file (bug 1850 - good)
7145 !! input
7146 [[Image:No such.jpg]]
7147 !! result
7148 <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>
7149 </p>
7150 !! end
7151
7152 !! test
7153 :Image link to nonexistent file (bug 1850 - bad)
7154 !! input
7155 [[:Image:No such.jpg]]
7156 !! result
7157 <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>
7158 </p>
7159 !! end
7160
7161
7162
7163 !! test
7164 Character reference normalization in link text (bug 1938)
7165 !! input
7166 [[Main Page|this&that]]
7167 !! result
7168 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
7169 </p>
7170 !!end
7171
7172 !! article
7173 אַ
7174 !! text
7175 Test for unicode normalization
7176
7177 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
7178 !! endarticle
7179
7180 !! test
7181 (bug 19451) Links should refer to the normalized form.
7182 !! input
7183 [[&#xFB2E;]]
7184 [[&#x5d0;&#x5b7;]]
7185 [[&#x5d0;ַ]]
7186 [[א&#x5b7;]]
7187 [[אַ]]
7188 !! result
7189 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
7190 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
7191 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
7192 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
7193 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
7194 </p>
7195 !! end
7196
7197 !! test
7198 Empty attribute crash test (bug 2067)
7199 !! input
7200 <font color="">foo</font>
7201 !! result
7202 <p><font color="">foo</font>
7203 </p>
7204 !! end
7205
7206 !! test
7207 Empty attribute crash test single-quotes (bug 2067)
7208 !! input
7209 <font color=''>foo</font>
7210 !! result
7211 <p><font color="">foo</font>
7212 </p>
7213 !! end
7214
7215 !! test
7216 Attribute test: equals, then nothing
7217 !! input
7218 <font color=>foo</font>
7219 !! result
7220 <p><font>foo</font>
7221 </p>
7222 !! end
7223
7224 !! test
7225 Attribute test: unquoted value
7226 !! input
7227 <font color=x>foo</font>
7228 !! result
7229 <p><font color="x">foo</font>
7230 </p>
7231 !! end
7232
7233 !! test
7234 Attribute test: unquoted but illegal value (hash)
7235 !! input
7236 <font color=#x>foo</font>
7237 !! result
7238 <p><font color="#x">foo</font>
7239 </p>
7240 !! end
7241
7242 !! test
7243 Attribute test: no value
7244 !! input
7245 <font color>foo</font>
7246 !! result
7247 <p><font color="color">foo</font>
7248 </p>
7249 !! end
7250
7251 !! test
7252 Bug 2095: link with three closing brackets
7253 !! input
7254 [[Main Page]]]
7255 !! result
7256 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
7257 </p>
7258 !! end
7259
7260 !! test
7261 Bug 2095: link with pipe and three closing brackets
7262 !! input
7263 [[Main Page|link]]]
7264 !! result
7265 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
7266 </p>
7267 !! end
7268
7269 !! test
7270 Bug 2095: link with pipe and three closing brackets, version 2
7271 !! input
7272 [[Main Page|[http://example.com/]]]
7273 !! result
7274 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
7275 </p>
7276 !! end
7277
7278
7279 ###
7280 ### Safety
7281 ###
7282
7283 !! article
7284 Template:Dangerous attribute
7285 !! text
7286 " onmouseover="alert(document.cookie)
7287 !! endarticle
7288
7289 !! article
7290 Template:Dangerous style attribute
7291 !! text
7292 border-size: expression(alert(document.cookie))
7293 !! endarticle
7294
7295 !! article
7296 Template:Div style
7297 !! text
7298 <div style="float: right; {{{1}}}">Magic div</div>
7299 !! endarticle
7300
7301 !! test
7302 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
7303 !! input
7304 <div title="{{test}}"></div>
7305 !! result
7306 <div title="This is a test template"></div>
7307
7308 !! end
7309
7310 !! test
7311 Bug 2304: HTML attribute safety (dangerous template; 2309)
7312 !! input
7313 <div title="{{dangerous attribute}}"></div>
7314 !! result
7315 <div title=""></div>
7316
7317 !! end
7318
7319 !! test
7320 Bug 2304: HTML attribute safety (dangerous style template; 2309)
7321 !! input
7322 <div style="{{dangerous style attribute}}"></div>
7323 !! result
7324 <div style="/* insecure input */"></div>
7325
7326 !! end
7327
7328 !! test
7329 Bug 2304: HTML attribute safety (safe parameter; 2309)
7330 !! input
7331 {{div style|width: 200px}}
7332 !! result
7333 <div style="float: right; width: 200px">Magic div</div>
7334
7335 !! end
7336
7337 !! test
7338 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
7339 !! input
7340 {{div style|width: expression(alert(document.cookie))}}
7341 !! result
7342 <div style="/* insecure input */">Magic div</div>
7343
7344 !! end
7345
7346 !! test
7347 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
7348 !! input
7349 {{div style|"><script>alert(document.cookie)</script>}}
7350 !! result
7351 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7352
7353 !! end
7354
7355 !! test
7356 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
7357 !! input
7358 {{div style|" ><script>alert(document.cookie)</script>}}
7359 !! result
7360 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7361
7362 !! end
7363
7364 !! test
7365 Bug 2304: HTML attribute safety (link)
7366 !! input
7367 <div title="[[Main Page]]"></div>
7368 !! result
7369 <div title="&#91;&#91;Main Page]]"></div>
7370
7371 !! end
7372
7373 !! test
7374 Bug 2304: HTML attribute safety (italics)
7375 !! input
7376 <div title="''foobar''"></div>
7377 !! result
7378 <div title="&#39;&#39;foobar&#39;&#39;"></div>
7379
7380 !! end
7381
7382 !! test
7383 Bug 2304: HTML attribute safety (bold)
7384 !! input
7385 <div title="'''foobar'''"></div>
7386 !! result
7387 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
7388
7389 !! end
7390
7391
7392 !! test
7393 Bug 2304: HTML attribute safety (ISBN)
7394 !! input
7395 <div title="ISBN 1234567890"></div>
7396 !! result
7397 <div title="&#73;SBN 1234567890"></div>
7398
7399 !! end
7400
7401 !! test
7402 Bug 2304: HTML attribute safety (RFC)
7403 !! input
7404 <div title="RFC 1234"></div>
7405 !! result
7406 <div title="&#82;FC 1234"></div>
7407
7408 !! end
7409
7410 !! test
7411 Bug 2304: HTML attribute safety (PMID)
7412 !! input
7413 <div title="PMID 1234567890"></div>
7414 !! result
7415 <div title="&#80;MID 1234567890"></div>
7416
7417 !! end
7418
7419 !! test
7420 Bug 2304: HTML attribute safety (web link)
7421 !! input
7422 <div title="http://example.com/"></div>
7423 !! result
7424 <div title="http&#58;//example.com/"></div>
7425
7426 !! end
7427
7428 !! test
7429 Bug 2304: HTML attribute safety (named web link)
7430 !! input
7431 <div title="[http://example.com/ link]"></div>
7432 !! result
7433 <div title="&#91;http&#58;//example.com/ link]"></div>
7434
7435 !! end
7436
7437 !! test
7438 Bug 3244: HTML attribute safety (extension; safe)
7439 !! input
7440 <div style="<nowiki>background:blue</nowiki>"></div>
7441 !! result
7442 <div style="background:blue"></div>
7443
7444 !! end
7445
7446 !! test
7447 Bug 3244: HTML attribute safety (extension; unsafe)
7448 !! input
7449 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
7450 !! result
7451 <div style="/* insecure input */"></div>
7452
7453 !! end
7454
7455 # More MSIE fun discovered by Tom Gilder
7456
7457 !! test
7458 MSIE CSS safety test: spurious slash
7459 !! input
7460 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
7461 !! result
7462 <div style="/* insecure input */">evil</div>
7463
7464 !! end
7465
7466 !! test
7467 MSIE CSS safety test: hex code
7468 !! input
7469 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
7470 !! result
7471 <div style="/* insecure input */">evil</div>
7472
7473 !! end
7474
7475 !! test
7476 MSIE CSS safety test: comment in url
7477 !! input
7478 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
7479 !! result
7480 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
7481
7482 !! end
7483
7484 !! test
7485 MSIE CSS safety test: comment in expression
7486 !! input
7487 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
7488 !! result
7489 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
7490
7491 !! end
7492
7493
7494 !! test
7495 Table attribute legitimate extension
7496 !! input
7497 {|
7498 !+ style="<nowiki>color:blue</nowiki>"| status
7499 |}
7500 !! result
7501 <table>
7502 <tr>
7503 <th style="color:blue"> status
7504 </th></tr></table>
7505
7506 !!end
7507
7508 !! test
7509 Table attribute safety
7510 !! input
7511 {|
7512 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
7513 |}
7514 !! result
7515 <table>
7516 <tr>
7517 <th style="/* insecure input */"> status
7518 </th></tr></table>
7519
7520 !! end
7521
7522 !! test
7523 CSS line continuation 1
7524 !! input
7525 <div style="background-image: u\&#10;rl(test.jpg);"></div>
7526 !! result
7527 <div style="/* insecure input */"></div>
7528
7529 !! end
7530
7531 !! test
7532 CSS line continuation 2
7533 !! input
7534 <div style="background-image: u\&#13;rl(test.jpg); "></div>
7535 !! result
7536 <div style="/* insecure input */"></div>
7537
7538 !! end
7539
7540 !! article
7541 Template:Identity
7542 !! text
7543 {{{1}}}
7544 !! endarticle
7545
7546 !! test
7547 Expansion of multi-line templates in attribute values (bug 6255)
7548 !! input
7549 <div style="background: {{identity|#00FF00}}">-</div>
7550 !! result
7551 <div style="background: #00FF00">-</div>
7552
7553 !! end
7554
7555
7556 !! test
7557 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
7558 !! input
7559 <div style="background:
7560 #00FF00">-</div>
7561 !! result
7562 <div style="background: #00FF00">-</div>
7563
7564 !! end
7565
7566 !! test
7567 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
7568 !! input
7569 <div style="background: &#10;#00FF00">-</div>
7570 !! result
7571 <div style="background: &#10;#00FF00">-</div>
7572
7573 !! end
7574
7575 ###
7576 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
7577 ###
7578 !! test
7579 Parser hook: empty input
7580 !! input
7581 <tag></tag>
7582 !! result
7583 <pre>
7584 ''
7585 array (
7586 )
7587 </pre>
7588
7589 !! end
7590
7591 !! test
7592 Parser hook: empty input using terminated empty elements
7593 !! input
7594 <tag/>
7595 !! result
7596 <pre>
7597 NULL
7598 array (
7599 )
7600 </pre>
7601
7602 !! end
7603
7604 !! test
7605 Parser hook: empty input using terminated empty elements (space before)
7606 !! input
7607 <tag />
7608 !! result
7609 <pre>
7610 NULL
7611 array (
7612 )
7613 </pre>
7614
7615 !! end
7616
7617 !! test
7618 Parser hook: basic input
7619 !! input
7620 <tag>input</tag>
7621 !! result
7622 <pre>
7623 'input'
7624 array (
7625 )
7626 </pre>
7627
7628 !! end
7629
7630
7631 !! test
7632 Parser hook: case insensitive
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, redux
7647 !! input
7648 <TaG>input</TAg>
7649 !! result
7650 <pre>
7651 'input'
7652 array (
7653 )
7654 </pre>
7655
7656 !! end
7657
7658 !! test
7659 Parser hook: nested tags
7660 !! options
7661 noxml
7662 !! input
7663 <tag><tag></tag></tag>
7664 !! result
7665 <pre>
7666 '<tag>'
7667 array (
7668 )
7669 </pre>&lt;/tag&gt;
7670
7671 !! end
7672
7673 !! test
7674 Parser hook: basic arguments
7675 !! input
7676 <tag width=200 height = "100" depth = '50' square></tag>
7677 !! result
7678 <pre>
7679 ''
7680 array (
7681 'width' => '200',
7682 'height' => '100',
7683 'depth' => '50',
7684 'square' => 'square',
7685 )
7686 </pre>
7687
7688 !! end
7689
7690 !! test
7691 Parser hook: argument containing a forward slash (bug 5344)
7692 !! input
7693 <tag filename='/tmp/bla'></tag>
7694 !! result
7695 <pre>
7696 ''
7697 array (
7698 'filename' => '/tmp/bla',
7699 )
7700 </pre>
7701
7702 !! end
7703
7704 !! test
7705 Parser hook: empty input using terminated empty elements (bug 2374)
7706 !! input
7707 <tag foo=bar/>text
7708 !! result
7709 <pre>
7710 NULL
7711 array (
7712 'foo' => 'bar',
7713 )
7714 </pre>text
7715
7716 !! end
7717
7718 # </tag> should be output literally since there is no matching tag that begins it
7719 !! test
7720 Parser hook: basic arguments using terminated empty elements (bug 2374)
7721 !! input
7722 <tag width=200 height = "100" depth = '50' square/>
7723 other stuff
7724 </tag>
7725 !! result
7726 <pre>
7727 NULL
7728 array (
7729 'width' => '200',
7730 'height' => '100',
7731 'depth' => '50',
7732 'square' => 'square',
7733 )
7734 </pre>
7735 <p>other stuff
7736 &lt;/tag&gt;
7737 </p>
7738 !! end
7739
7740 ###
7741 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
7742 ###
7743
7744 !! test
7745 Parser hook: static parser hook not inside a comment
7746 !! input
7747 <statictag>hello, world</statictag>
7748 <statictag action=flush/>
7749 !! result
7750 <p>hello, world
7751 </p>
7752 !! end
7753
7754
7755 !! test
7756 Parser hook: static parser hook inside a comment
7757 !! input
7758 <!-- <statictag>hello, world</statictag> -->
7759 <statictag action=flush/>
7760 !! result
7761 <p><br />
7762 </p>
7763 !! end
7764
7765 # Nested template calls; this case was broken by Parser.php rev 1.506,
7766 # since reverted.
7767
7768 !! article
7769 Template:One-parameter
7770 !! text
7771 (My parameter is: {{{1}}})
7772 !! endarticle
7773
7774 !! article
7775 Template:Map-one-parameter
7776 !! text
7777 {{{{{1}}}|{{{2}}}}}
7778 !! endarticle
7779
7780 !! test
7781 Nested template calls
7782 !! input
7783 {{Map-one-parameter|One-parameter|param}}
7784 !! result
7785 <p>(My parameter is: param)
7786 </p>
7787 !! end
7788
7789
7790 ###
7791 ### Sanitizer
7792 ###
7793 !! test
7794 Sanitizer: Closing of open tags
7795 !! input
7796 <s></s><table></table>
7797 !! result
7798 <s></s><table></table>
7799
7800 !! end
7801
7802 !! test
7803 Sanitizer: Closing of open but not closed tags
7804 !! input
7805 <s>foo
7806 !! result
7807 <p><s>foo</s>
7808 </p>
7809 !! end
7810
7811 !! test
7812 Sanitizer: Closing of closed but not open tags
7813 !! input
7814 </s>
7815 !! result
7816 <p>&lt;/s&gt;
7817 </p>
7818 !! end
7819
7820 !! test
7821 Sanitizer: Closing of closed but not open table tags
7822 !! input
7823 Table not started</td></tr></table>
7824 !! result
7825 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
7826 </p>
7827 !! end
7828
7829 !! test
7830 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
7831 !! input
7832 <span id="æ: v">byte</span>[[#æ: v|backlink]]
7833 !! result
7834 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
7835 </p>
7836 !! end
7837
7838 !! test
7839 Sanitizer: Validating the contents of the id attribute (bug 4515)
7840 !! options
7841 disabled
7842 !! input
7843 <br id=9 />
7844 !! result
7845 Something, but definitely not <br id="9" />...
7846 !! end
7847
7848 !! test
7849 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
7850 !! options
7851 disabled
7852 !! input
7853 <br id="foo" /><br id="foo" />
7854 !! result
7855 Something need to be done. foo-2 ?
7856 !! end
7857
7858 !! test
7859 Language converter: output gets cut off unexpectedly (bug 5757)
7860 !! options
7861 language=zh
7862 !! input
7863 this bit is safe: }-
7864
7865 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
7866
7867 then we get cut off here: }-
7868
7869 all additional text is vanished
7870 !! result
7871 <p>this bit is safe: }-
7872 </p><p>but if we add a conversion instance: xxx
7873 </p><p>then we get cut off here: }-
7874 </p><p>all additional text is vanished
7875 </p>
7876 !! end
7877
7878 !! test
7879 Self closed html pairs (bug 5487)
7880 !! options
7881 !! input
7882 <center><font id="bug" />Centered text</center>
7883 <div><font id="bug2" />In div text</div>
7884 !! result
7885 <center>&lt;font id="bug" /&gt;Centered text</center>
7886 <div>&lt;font id="bug2" /&gt;In div text</div>
7887
7888 !! end
7889
7890 #
7891 #
7892 #
7893
7894 !! test
7895 Punctuation: nbsp before exclamation
7896 !! input
7897 C'est grave !
7898 !! result
7899 <p>C'est grave&#160;!
7900 </p>
7901 !! end
7902
7903 !! test
7904 Punctuation: CSS !important (bug 11874)
7905 !! input
7906 <div style="width:50% !important">important</div>
7907 !! result
7908 <div style="width:50% !important">important</div>
7909
7910 !!end
7911
7912 !! test
7913 Punctuation: CSS ! important (bug 11874; with space after)
7914 !! input
7915 <div style="width:50% ! important">important</div>
7916 !! result
7917 <div style="width:50% ! important">important</div>
7918
7919 !!end
7920
7921
7922 !! test
7923 HTML bullet list, closed tags (bug 5497)
7924 !! input
7925 <ul>
7926 <li>One</li>
7927 <li>Two</li>
7928 </ul>
7929 !! result
7930 <ul>
7931 <li>One</li>
7932 <li>Two</li>
7933 </ul>
7934
7935 !! end
7936
7937 !! test
7938 HTML bullet list, unclosed tags (bug 5497)
7939 !! options
7940 disabled
7941 !! input
7942 <ul>
7943 <li>One
7944 <li>Two
7945 </ul>
7946 !! result
7947 <ul>
7948 <li>One
7949 </li><li>Two
7950 </li></ul>
7951
7952 !! end
7953
7954 !! test
7955 HTML ordered list, closed tags (bug 5497)
7956 !! input
7957 <ol>
7958 <li>One</li>
7959 <li>Two</li>
7960 </ol>
7961 !! result
7962 <ol>
7963 <li>One</li>
7964 <li>Two</li>
7965 </ol>
7966
7967 !! end
7968
7969 !! test
7970 HTML ordered list, unclosed tags (bug 5497)
7971 !! options
7972 disabled
7973 !! input
7974 <ol>
7975 <li>One
7976 <li>Two
7977 </ol>
7978 !! result
7979 <ol>
7980 <li>One
7981 </li><li>Two
7982 </li></ol>
7983
7984 !! end
7985
7986 !! test
7987 HTML nested bullet list, closed tags (bug 5497)
7988 !! input
7989 <ul>
7990 <li>One</li>
7991 <li>Two:
7992 <ul>
7993 <li>Sub-one</li>
7994 <li>Sub-two</li>
7995 </ul>
7996 </li>
7997 </ul>
7998 !! result
7999 <ul>
8000 <li>One</li>
8001 <li>Two:
8002 <ul>
8003 <li>Sub-one</li>
8004 <li>Sub-two</li>
8005 </ul>
8006 </li>
8007 </ul>
8008
8009 !! end
8010
8011 !! test
8012 HTML nested bullet list, open tags (bug 5497)
8013 !! options
8014 disabled
8015 !! input
8016 <ul>
8017 <li>One
8018 <li>Two:
8019 <ul>
8020 <li>Sub-one
8021 <li>Sub-two
8022 </ul>
8023 </ul>
8024 !! result
8025 <ul>
8026 <li>One
8027 </li><li>Two:
8028 <ul>
8029 <li>Sub-one
8030 </li><li>Sub-two
8031 </li></ul>
8032 </li></ul>
8033
8034 !! end
8035
8036 !! test
8037 HTML nested ordered list, closed tags (bug 5497)
8038 !! input
8039 <ol>
8040 <li>One</li>
8041 <li>Two:
8042 <ol>
8043 <li>Sub-one</li>
8044 <li>Sub-two</li>
8045 </ol>
8046 </li>
8047 </ol>
8048 !! result
8049 <ol>
8050 <li>One</li>
8051 <li>Two:
8052 <ol>
8053 <li>Sub-one</li>
8054 <li>Sub-two</li>
8055 </ol>
8056 </li>
8057 </ol>
8058
8059 !! end
8060
8061 !! test
8062 HTML nested ordered list, open tags (bug 5497)
8063 !! options
8064 disabled
8065 !! input
8066 <ol>
8067 <li>One
8068 <li>Two:
8069 <ol>
8070 <li>Sub-one
8071 <li>Sub-two
8072 </ol>
8073 </ol>
8074 !! result
8075 <ol>
8076 <li>One
8077 </li><li>Two:
8078 <ol>
8079 <li>Sub-one
8080 </li><li>Sub-two
8081 </li></ol>
8082 </li></ol>
8083
8084 !! end
8085
8086 !! test
8087 HTML ordered list item with parameters oddity
8088 !! input
8089 <ol><li id="fragment">One</li></ol>
8090 !! result
8091 <ol><li id="fragment">One</li></ol>
8092
8093 !! end
8094
8095 !!test
8096 bug 5918: autonumbering
8097 !! input
8098 [http://first/] [http://second] [ftp://ftp]
8099
8100 ftp://inlineftp
8101
8102 [mailto:enclosed@mail.tld With target]
8103
8104 [mailto:enclosed@mail.tld]
8105
8106 mailto:inline@mail.tld
8107 !! result
8108 <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>
8109 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
8110 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
8111 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
8112 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
8113 </p>
8114 !! end
8115
8116
8117 #
8118 # Security and HTML correctness
8119 # From Nick Jenkins' fuzz testing
8120 #
8121
8122 !! test
8123 Fuzz testing: Parser13
8124 !! input
8125 {|
8126 | http://a|
8127 !! result
8128 <table>
8129 <tr>
8130 <td>
8131 </td>
8132 </tr>
8133 </table>
8134
8135 !! end
8136
8137 !! test
8138 Fuzz testing: Parser14
8139 !! input
8140 == onmouseover= ==
8141 http://__TOC__
8142 !! result
8143 <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>
8144 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8145 <ul>
8146 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
8147 </ul>
8148 </td></tr></table>
8149
8150 !! end
8151
8152 !! test
8153 Fuzz testing: Parser14-table
8154 !! input
8155 ==a==
8156 {| STYLE=__TOC__
8157 !! result
8158 <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>
8159 <table style="&#95;_TOC&#95;_">
8160 <tr><td></td></tr>
8161 </table>
8162
8163 !! end
8164
8165 # Known to produce bogus xml (extra </td>)
8166 !! test
8167 Fuzz testing: Parser16
8168 !! options
8169 noxml
8170 !! input
8171 {|
8172 !https://||||||
8173 !! result
8174 <table>
8175 <tr>
8176 <th>https://</th>
8177 <th></th>
8178 <th></th>
8179 <th>
8180 </td>
8181 </tr>
8182 </table>
8183
8184 !! end
8185
8186 !! test
8187 Fuzz testing: Parser21
8188 !! input
8189 {|
8190 ! irc://{{ftp://a" onmouseover="alert('hello world');"
8191 |
8192 !! result
8193 <table>
8194 <tr>
8195 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
8196 </th>
8197 <td>
8198 </td>
8199 </tr>
8200 </table>
8201
8202 !! end
8203
8204 !! test
8205 Fuzz testing: Parser22
8206 !! input
8207 http://===r:::https://b
8208
8209 {|
8210 !!result
8211 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
8212 </p>
8213 <table>
8214 <tr><td></td></tr>
8215 </table>
8216
8217 !! end
8218
8219 # Known to produce bad XML for now
8220 !! test
8221 Fuzz testing: Parser24
8222 !! options
8223 noxml
8224 !! input
8225 {|
8226 {{{|
8227 <u CLASS=
8228 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
8229 <br style="onmouseover='alert(document.cookie);' " />
8230
8231 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8232 |
8233 !! result
8234 <table>
8235 {{{|
8236 <u class="&#124;">}}}} &gt;
8237 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
8238
8239 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8240 <tr>
8241 <td></u>
8242 </td>
8243 </tr>
8244 </table>
8245
8246 !! end
8247
8248 # Note: the current result listed for this is not what the original one was,
8249 # but the original bug was JavaScript injection, which is fixed in any case.
8250 # It's not clear that the original result listed was any more correct than the
8251 # current one. Original result:
8252 # <p>{{{|
8253 # </p>
8254 # <li class="&#124;&#124;">
8255 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8256 !!test
8257 Fuzz testing: Parser25 (bug 6055)
8258 !! input
8259 {{{
8260 |
8261 <LI CLASS=||
8262 >
8263 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
8264 !! result
8265 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8266 </p>
8267 !! end
8268
8269 !!test
8270 Fuzz testing: URL adjacent extension (with space, clean)
8271 !! options
8272 !! input
8273 http://example.com <nowiki>junk</nowiki>
8274 !! result
8275 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
8276 </p>
8277 !!end
8278
8279 !!test
8280 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
8281 !! options
8282 !! input
8283 http://example.com<nowiki>junk</nowiki>
8284 !! result
8285 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
8286 </p>
8287 !!end
8288
8289 !!test
8290 Fuzz testing: URL adjacent extension (no space, dirty; pre)
8291 !! options
8292 !! input
8293 http://example.com<pre>junk</pre>
8294 !! result
8295 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
8296
8297 !!end
8298
8299 !!test
8300 Fuzz testing: image with bogus manual thumbnail
8301 !!input
8302 [[Image:foobar.jpg|thumbnail= ]]
8303 !!result
8304 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
8305
8306 !!end
8307
8308 !! test
8309 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
8310 !! input
8311 <pre dir="&#10;"></pre>
8312 !! result
8313 <pre dir="&#10;"></pre>
8314
8315 !! end
8316
8317 !! test
8318 Parsing optional HTML elements (Bug 6171)
8319 !! options
8320 !! input
8321 <table>
8322 <tr>
8323 <td> Some tabular data</td>
8324 <td> More tabular data ...
8325 <td> And yet som tabular data</td>
8326 </tr>
8327 </table>
8328 !! result
8329 <table>
8330 <tr>
8331 <td> Some tabular data</td>
8332 <td> More tabular data ...
8333 </td><td> And yet som tabular data</td>
8334 </tr>
8335 </table>
8336
8337 !! end
8338
8339 !! test
8340 Correct handling of <td>, <tr> (Bug 6171)
8341 !! options
8342 !! input
8343 <table>
8344 <tr>
8345 <td> Some tabular data</td>
8346 <td> More tabular data ...</td>
8347 <td> And yet som tabular data</td>
8348 </tr>
8349 </table>
8350 !! result
8351 <table>
8352 <tr>
8353 <td> Some tabular data</td>
8354 <td> More tabular data ...</td>
8355 <td> And yet som tabular data</td>
8356 </tr>
8357 </table>
8358
8359 !! end
8360
8361
8362 !! test
8363 Parsing crashing regression (fr:JavaScript)
8364 !! input
8365 </body></x>
8366 !! result
8367 <p>&lt;/body&gt;&lt;/x&gt;
8368 </p>
8369 !! end
8370
8371 !! test
8372 Inline wiki vs wiki block nesting
8373 !! input
8374 '''Bold paragraph
8375
8376 New wiki paragraph
8377 !! result
8378 <p><b>Bold paragraph</b>
8379 </p><p>New wiki paragraph
8380 </p>
8381 !! end
8382
8383 !! test
8384 Inline HTML vs wiki block nesting
8385 !! options
8386 disabled
8387 !! input
8388 <b>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 # Original result was this:
8398 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
8399 # </p>
8400 # While that might be marginally more intuitive, maybe, the six-apostrophe
8401 # construct is clearly pathological and the result stated here (which is what
8402 # the parser actually does) is about as reasonable as anything.
8403 !!test
8404 Mixing markup for italics and bold
8405 !! options
8406 !! input
8407 '''bold''''''bold''bolditalics'''''
8408 !! result
8409 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
8410 </p>
8411 !! end
8412
8413
8414 !! article
8415 Xyzzyx
8416 !! text
8417 Article for special page transclusion test
8418 !! endarticle
8419
8420 !! test
8421 Special page transclusion
8422 !! options
8423 !! input
8424 {{Special:Prefixindex/Xyzzyx}}
8425 !! result
8426 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8427
8428 !! end
8429
8430 !! test
8431 Special page transclusion twice (bug 5021)
8432 !! options
8433 !! input
8434 {{Special:Prefixindex/Xyzzyx}}
8435 {{Special:Prefixindex/Xyzzyx}}
8436 !! result
8437 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8438 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8439
8440 !! end
8441
8442 !! test
8443 Transclusion of default MediaWiki message
8444 !! input
8445 {{MediaWiki:Mainpage}}
8446 !!result
8447 <p>Main Page
8448 </p>
8449 !! end
8450
8451 !! test
8452 Transclusion of nonexistent MediaWiki message
8453 !! input
8454 {{MediaWiki:Mainpagexxx}}
8455 !!result
8456 <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>
8457 </p>
8458 !! end
8459
8460 !! test
8461 Transclusion of MediaWiki message with underscore
8462 !! input
8463 {{MediaWiki:history_short}}
8464 !! result
8465 <p>History
8466 </p>
8467 !! end
8468
8469 !! test
8470 Transclusion of MediaWiki message with space
8471 !! input
8472 {{MediaWiki:history short}}
8473 !! result
8474 <p>History
8475 </p>
8476 !! end
8477
8478 !! test
8479 Invalid header with following text
8480 !! input
8481 = x = y
8482 !! result
8483 <p>= x = y
8484 </p>
8485 !! end
8486
8487
8488 !! test
8489 Section extraction test (section 0)
8490 !! options
8491 section=0
8492 !! input
8493 start
8494 ==a==
8495 ===aa===
8496 ====aaa====
8497 ==b==
8498 ===ba===
8499 ===bb===
8500 ====bba====
8501 ===bc===
8502 ==c==
8503 ===ca===
8504 !! result
8505 start
8506 !! end
8507
8508 !! test
8509 Section extraction test (section 1)
8510 !! options
8511 section=1
8512 !! input
8513 start
8514 ==a==
8515 ===aa===
8516 ====aaa====
8517 ==b==
8518 ===ba===
8519 ===bb===
8520 ====bba====
8521 ===bc===
8522 ==c==
8523 ===ca===
8524 !! result
8525 ==a==
8526 ===aa===
8527 ====aaa====
8528 !! end
8529
8530 !! test
8531 Section extraction test (section 2)
8532 !! options
8533 section=2
8534 !! input
8535 start
8536 ==a==
8537 ===aa===
8538 ====aaa====
8539 ==b==
8540 ===ba===
8541 ===bb===
8542 ====bba====
8543 ===bc===
8544 ==c==
8545 ===ca===
8546 !! result
8547 ===aa===
8548 ====aaa====
8549 !! end
8550
8551 !! test
8552 Section extraction test (section 3)
8553 !! options
8554 section=3
8555 !! input
8556 start
8557 ==a==
8558 ===aa===
8559 ====aaa====
8560 ==b==
8561 ===ba===
8562 ===bb===
8563 ====bba====
8564 ===bc===
8565 ==c==
8566 ===ca===
8567 !! result
8568 ====aaa====
8569 !! end
8570
8571 !! test
8572 Section extraction test (section 4)
8573 !! options
8574 section=4
8575 !! input
8576 start
8577 ==a==
8578 ===aa===
8579 ====aaa====
8580 ==b==
8581 ===ba===
8582 ===bb===
8583 ====bba====
8584 ===bc===
8585 ==c==
8586 ===ca===
8587 !! result
8588 ==b==
8589 ===ba===
8590 ===bb===
8591 ====bba====
8592 ===bc===
8593 !! end
8594
8595 !! test
8596 Section extraction test (section 5)
8597 !! options
8598 section=5
8599 !! input
8600 start
8601 ==a==
8602 ===aa===
8603 ====aaa====
8604 ==b==
8605 ===ba===
8606 ===bb===
8607 ====bba====
8608 ===bc===
8609 ==c==
8610 ===ca===
8611 !! result
8612 ===ba===
8613 !! end
8614
8615 !! test
8616 Section extraction test (section 6)
8617 !! options
8618 section=6
8619 !! input
8620 start
8621 ==a==
8622 ===aa===
8623 ====aaa====
8624 ==b==
8625 ===ba===
8626 ===bb===
8627 ====bba====
8628 ===bc===
8629 ==c==
8630 ===ca===
8631 !! result
8632 ===bb===
8633 ====bba====
8634 !! end
8635
8636 !! test
8637 Section extraction test (section 7)
8638 !! options
8639 section=7
8640 !! input
8641 start
8642 ==a==
8643 ===aa===
8644 ====aaa====
8645 ==b==
8646 ===ba===
8647 ===bb===
8648 ====bba====
8649 ===bc===
8650 ==c==
8651 ===ca===
8652 !! result
8653 ====bba====
8654 !! end
8655
8656 !! test
8657 Section extraction test (section 8)
8658 !! options
8659 section=8
8660 !! input
8661 start
8662 ==a==
8663 ===aa===
8664 ====aaa====
8665 ==b==
8666 ===ba===
8667 ===bb===
8668 ====bba====
8669 ===bc===
8670 ==c==
8671 ===ca===
8672 !! result
8673 ===bc===
8674 !! end
8675
8676 !! test
8677 Section extraction test (section 9)
8678 !! options
8679 section=9
8680 !! input
8681 start
8682 ==a==
8683 ===aa===
8684 ====aaa====
8685 ==b==
8686 ===ba===
8687 ===bb===
8688 ====bba====
8689 ===bc===
8690 ==c==
8691 ===ca===
8692 !! result
8693 ==c==
8694 ===ca===
8695 !! end
8696
8697 !! test
8698 Section extraction test (section 10)
8699 !! options
8700 section=10
8701 !! input
8702 start
8703 ==a==
8704 ===aa===
8705 ====aaa====
8706 ==b==
8707 ===ba===
8708 ===bb===
8709 ====bba====
8710 ===bc===
8711 ==c==
8712 ===ca===
8713 !! result
8714 ===ca===
8715 !! end
8716
8717 !! test
8718 Section extraction test (nonexistent section 11)
8719 !! options
8720 section=11
8721 !! input
8722 start
8723 ==a==
8724 ===aa===
8725 ====aaa====
8726 ==b==
8727 ===ba===
8728 ===bb===
8729 ====bba====
8730 ===bc===
8731 ==c==
8732 ===ca===
8733 !! result
8734 !! end
8735
8736 !! test
8737 Section extraction test with bogus heading (section 1)
8738 !! options
8739 section=1
8740 !! input
8741 ==a==
8742 ==bogus== not a legal section
8743 ==b==
8744 !! result
8745 ==a==
8746 ==bogus== not a legal section
8747 !! end
8748
8749 !! test
8750 Section extraction test with bogus heading (section 2)
8751 !! options
8752 section=2
8753 !! input
8754 ==a==
8755 ==bogus== not a legal section
8756 ==b==
8757 !! result
8758 ==b==
8759 !! end
8760
8761 !! test
8762 Section extraction test with comment after heading (section 1)
8763 !! options
8764 section=1
8765 !! input
8766 ==a==
8767 ==b== <!-- -->
8768 ==c==
8769 !! result
8770 ==a==
8771 !! end
8772
8773 !! test
8774 Section extraction test with comment after heading (section 2)
8775 !! options
8776 section=2
8777 !! input
8778 ==a==
8779 ==b== <!-- -->
8780 ==c==
8781 !! result
8782 ==b== <!-- -->
8783 !! end
8784
8785 !! test
8786 Section extraction test with bogus <nowiki> heading (section 1)
8787 !! options
8788 section=1
8789 !! input
8790 ==a==
8791 ==bogus== <nowiki>not a legal section</nowiki>
8792 ==b==
8793 !! result
8794 ==a==
8795 ==bogus== <nowiki>not a legal section</nowiki>
8796 !! end
8797
8798 !! test
8799 Section extraction test with bogus <nowiki> heading (section 2)
8800 !! options
8801 section=2
8802 !! input
8803 ==a==
8804 ==bogus== <nowiki>not a legal section</nowiki>
8805 ==b==
8806 !! result
8807 ==b==
8808 !! end
8809
8810
8811 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
8812 # instead of respecting commented sections
8813 !! test
8814 Section extraction prefixed by comment (section 1)
8815 !! options
8816 section=1
8817 !! input
8818 <!-- -->==sec1==
8819 ==sec2==
8820 !!result
8821 ==sec2==
8822 !!end
8823
8824 !! test
8825 Section extraction prefixed by comment (section 2)
8826 !! options
8827 section=2
8828 !! input
8829 <!-- -->==sec1==
8830 ==sec2==
8831 !!result
8832
8833 !!end
8834
8835
8836 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
8837 # instead of respecting HTML-style headings
8838 !! test
8839 Section extraction, mixed wiki and html (section 1)
8840 !! options
8841 section=1
8842 !! input
8843 <h2>unmarked</h2>
8844 unmarked
8845 ==1==
8846 one
8847 ==2==
8848 two
8849 !! result
8850 ==1==
8851 one
8852 !! end
8853
8854 !! test
8855 Section extraction, mixed wiki and html (section 2)
8856 !! options
8857 section=2
8858 !! input
8859 <h2>unmarked</h2>
8860 unmarked
8861 ==1==
8862 one
8863 ==2==
8864 two
8865 !! result
8866 ==2==
8867 two
8868 !! end
8869
8870
8871 # Formerly testing for bug 3342
8872 !! test
8873 Section extraction, heading surrounded by <noinclude>
8874 !! options
8875 section=1
8876 !! input
8877 <noinclude>==unmarked==</noinclude>
8878 ==marked==
8879 !! result
8880 ==marked==
8881 !!end
8882
8883 # Test behaviour of bug 19910
8884 !! test
8885 Sectiion with all-equals
8886 !! options
8887 section=2
8888 !! input
8889 ===
8890 The line above must have a trailing space
8891 === <!--
8892 --> <!-- -->
8893 But just in case it doesn't...
8894 !! result
8895 === <!--
8896 --> <!-- -->
8897 But just in case it doesn't...
8898 !! end
8899
8900 !! test
8901 Section replacement test (section 0)
8902 !! options
8903 replace=0,"xxx"
8904 !! input
8905 start
8906 ==a==
8907 ===aa===
8908 ====aaa====
8909 ==b==
8910 ===ba===
8911 ===bb===
8912 ====bba====
8913 ===bc===
8914 ==c==
8915 ===ca===
8916 !! result
8917 xxx
8918
8919 ==a==
8920 ===aa===
8921 ====aaa====
8922 ==b==
8923 ===ba===
8924 ===bb===
8925 ====bba====
8926 ===bc===
8927 ==c==
8928 ===ca===
8929 !! end
8930
8931 !! test
8932 Section replacement test (section 1)
8933 !! options
8934 replace=1,"xxx"
8935 !! input
8936 start
8937 ==a==
8938 ===aa===
8939 ====aaa====
8940 ==b==
8941 ===ba===
8942 ===bb===
8943 ====bba====
8944 ===bc===
8945 ==c==
8946 ===ca===
8947 !! result
8948 start
8949 xxx
8950
8951 ==b==
8952 ===ba===
8953 ===bb===
8954 ====bba====
8955 ===bc===
8956 ==c==
8957 ===ca===
8958 !! end
8959
8960 !! test
8961 Section replacement test (section 2)
8962 !! options
8963 replace=2,"xxx"
8964 !! input
8965 start
8966 ==a==
8967 ===aa===
8968 ====aaa====
8969 ==b==
8970 ===ba===
8971 ===bb===
8972 ====bba====
8973 ===bc===
8974 ==c==
8975 ===ca===
8976 !! result
8977 start
8978 ==a==
8979 xxx
8980
8981 ==b==
8982 ===ba===
8983 ===bb===
8984 ====bba====
8985 ===bc===
8986 ==c==
8987 ===ca===
8988 !! end
8989
8990 !! test
8991 Section replacement test (section 3)
8992 !! options
8993 replace=3,"xxx"
8994 !! input
8995 start
8996 ==a==
8997 ===aa===
8998 ====aaa====
8999 ==b==
9000 ===ba===
9001 ===bb===
9002 ====bba====
9003 ===bc===
9004 ==c==
9005 ===ca===
9006 !! result
9007 start
9008 ==a==
9009 ===aa===
9010 xxx
9011
9012 ==b==
9013 ===ba===
9014 ===bb===
9015 ====bba====
9016 ===bc===
9017 ==c==
9018 ===ca===
9019 !! end
9020
9021 !! test
9022 Section replacement test (section 4)
9023 !! options
9024 replace=4,"xxx"
9025 !! input
9026 start
9027 ==a==
9028 ===aa===
9029 ====aaa====
9030 ==b==
9031 ===ba===
9032 ===bb===
9033 ====bba====
9034 ===bc===
9035 ==c==
9036 ===ca===
9037 !! result
9038 start
9039 ==a==
9040 ===aa===
9041 ====aaa====
9042 xxx
9043
9044 ==c==
9045 ===ca===
9046 !! end
9047
9048 !! test
9049 Section replacement test (section 5)
9050 !! options
9051 replace=5,"xxx"
9052 !! input
9053 start
9054 ==a==
9055 ===aa===
9056 ====aaa====
9057 ==b==
9058 ===ba===
9059 ===bb===
9060 ====bba====
9061 ===bc===
9062 ==c==
9063 ===ca===
9064 !! result
9065 start
9066 ==a==
9067 ===aa===
9068 ====aaa====
9069 ==b==
9070 xxx
9071
9072 ===bb===
9073 ====bba====
9074 ===bc===
9075 ==c==
9076 ===ca===
9077 !! end
9078
9079 !! test
9080 Section replacement test (section 6)
9081 !! options
9082 replace=6,"xxx"
9083 !! input
9084 start
9085 ==a==
9086 ===aa===
9087 ====aaa====
9088 ==b==
9089 ===ba===
9090 ===bb===
9091 ====bba====
9092 ===bc===
9093 ==c==
9094 ===ca===
9095 !! result
9096 start
9097 ==a==
9098 ===aa===
9099 ====aaa====
9100 ==b==
9101 ===ba===
9102 xxx
9103
9104 ===bc===
9105 ==c==
9106 ===ca===
9107 !! end
9108
9109 !! test
9110 Section replacement test (section 7)
9111 !! options
9112 replace=7,"xxx"
9113 !! input
9114 start
9115 ==a==
9116 ===aa===
9117 ====aaa====
9118 ==b==
9119 ===ba===
9120 ===bb===
9121 ====bba====
9122 ===bc===
9123 ==c==
9124 ===ca===
9125 !! result
9126 start
9127 ==a==
9128 ===aa===
9129 ====aaa====
9130 ==b==
9131 ===ba===
9132 ===bb===
9133 xxx
9134
9135 ===bc===
9136 ==c==
9137 ===ca===
9138 !! end
9139
9140 !! test
9141 Section replacement test (section 8)
9142 !! options
9143 replace=8,"xxx"
9144 !! input
9145 start
9146 ==a==
9147 ===aa===
9148 ====aaa====
9149 ==b==
9150 ===ba===
9151 ===bb===
9152 ====bba====
9153 ===bc===
9154 ==c==
9155 ===ca===
9156 !! result
9157 start
9158 ==a==
9159 ===aa===
9160 ====aaa====
9161 ==b==
9162 ===ba===
9163 ===bb===
9164 ====bba====
9165 xxx
9166
9167 ==c==
9168 ===ca===
9169 !!end
9170
9171 !! test
9172 Section replacement test (section 9)
9173 !! options
9174 replace=9,"xxx"
9175 !! input
9176 start
9177 ==a==
9178 ===aa===
9179 ====aaa====
9180 ==b==
9181 ===ba===
9182 ===bb===
9183 ====bba====
9184 ===bc===
9185 ==c==
9186 ===ca===
9187 !! result
9188 start
9189 ==a==
9190 ===aa===
9191 ====aaa====
9192 ==b==
9193 ===ba===
9194 ===bb===
9195 ====bba====
9196 ===bc===
9197 xxx
9198 !! end
9199
9200 !! test
9201 Section replacement test (section 10)
9202 !! options
9203 replace=10,"xxx"
9204 !! input
9205 start
9206 ==a==
9207 ===aa===
9208 ====aaa====
9209 ==b==
9210 ===ba===
9211 ===bb===
9212 ====bba====
9213 ===bc===
9214 ==c==
9215 ===ca===
9216 !! result
9217 start
9218 ==a==
9219 ===aa===
9220 ====aaa====
9221 ==b==
9222 ===ba===
9223 ===bb===
9224 ====bba====
9225 ===bc===
9226 ==c==
9227 xxx
9228 !! end
9229
9230 !! test
9231 Section replacement test with initial whitespace (bug 13728)
9232 !! options
9233 replace=2,"xxx"
9234 !! input
9235 Preformatted initial line
9236 ==a==
9237 ===a===
9238 !! result
9239 Preformatted initial line
9240 ==a==
9241 xxx
9242 !! end
9243
9244
9245 !! test
9246 Section extraction, heading followed by pre with 20 spaces (bug 6398)
9247 !! options
9248 section=1
9249 !! input
9250 ==a==
9251 a
9252 !! result
9253 ==a==
9254 a
9255 !! end
9256
9257 !! test
9258 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
9259 !! options
9260 section=1
9261 !! input
9262 ==a==
9263 a
9264 !! result
9265 ==a==
9266 a
9267 !! end
9268
9269
9270 !! test
9271 Section extraction, <pre> around bogus header (bug 10309)
9272 !! options
9273 noxml section=2
9274 !! input
9275 == Section One ==
9276 <pre>
9277 =======
9278 </pre>
9279
9280 == Section Two ==
9281 stuff
9282 !! result
9283 == Section Two ==
9284 stuff
9285 !! end
9286
9287 !! test
9288 Section replacement, <pre> around bogus header (bug 10309)
9289 !! options
9290 noxml replace=2,"xxx"
9291 !! input
9292 == Section One ==
9293 <pre>
9294 =======
9295 </pre>
9296
9297 == Section Two ==
9298 stuff
9299 !! result
9300 == Section One ==
9301 <pre>
9302 =======
9303 </pre>
9304
9305 xxx
9306 !! end
9307
9308
9309
9310 !! test
9311 Handling of &#x0A; in URLs
9312 !! input
9313 **irc://&#x0A;a
9314 !! result
9315 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
9316 </li></ul>
9317 </li></ul>
9318
9319 !!end
9320
9321 !! test
9322 5 quotes, code coverage +1 line
9323 !! input
9324 '''''
9325 !! result
9326 !! end
9327
9328 !! test
9329 Special:Search page linking.
9330 !! input
9331 {{Special:search}}
9332 !! result
9333 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
9334 </p>
9335 !! end
9336
9337 !! test
9338 Say the magic word
9339 !! input
9340 * {{PAGENAME}}
9341 * {{BASEPAGENAME}}
9342 * {{SUBPAGENAME}}
9343 * {{SUBPAGENAMEE}}
9344 * {{BASEPAGENAME}}
9345 * {{BASEPAGENAMEE}}
9346 * {{TALKPAGENAME}}
9347 * {{TALKPAGENAMEE}}
9348 * {{SUBJECTPAGENAME}}
9349 * {{SUBJECTPAGENAMEE}}
9350 * {{NAMESPACEE}}
9351 * {{NAMESPACE}}
9352 * {{TALKSPACE}}
9353 * {{TALKSPACEE}}
9354 * {{SUBJECTSPACE}}
9355 * {{SUBJECTSPACEE}}
9356 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
9357 !! result
9358 <ul><li> Parser test
9359 </li><li> Parser test
9360 </li><li> Parser test
9361 </li><li> Parser_test
9362 </li><li> Parser test
9363 </li><li> Parser_test
9364 </li><li> Talk:Parser test
9365 </li><li> Talk:Parser_test
9366 </li><li> Parser test
9367 </li><li> Parser_test
9368 </li><li>
9369 </li><li>
9370 </li><li> Talk
9371 </li><li> Talk
9372 </li><li>
9373 </li><li>
9374 </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>
9375 </li></ul>
9376
9377 !! end
9378 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
9379
9380 !! test
9381 Gallery
9382 !! input
9383 <gallery>
9384 image1.png |
9385 image2.gif|||||
9386
9387 image3|
9388 image4 |300px| centre
9389 image5.svg| http://///////
9390 [[x|xx]]]]
9391 * image6
9392 </gallery>
9393 !! result
9394 <ul class="gallery">
9395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9396 <div style="height: 150px;">Image1.png</div>
9397 <div class="gallerytext">
9398 </div>
9399 </div></li>
9400 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9401 <div style="height: 150px;">Image2.gif</div>
9402 <div class="gallerytext">
9403 <p>||||
9404 </p>
9405 </div>
9406 </div></li>
9407 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9408 <div style="height: 150px;">Image3</div>
9409 <div class="gallerytext">
9410 </div>
9411 </div></li>
9412 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9413 <div style="height: 150px;">Image4</div>
9414 <div class="gallerytext">
9415 <p>300px| centre
9416 </p>
9417 </div>
9418 </div></li>
9419 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9420 <div style="height: 150px;">Image5.svg</div>
9421 <div class="gallerytext">
9422 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
9423 </p>
9424 </div>
9425 </div></li>
9426 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9427 <div style="height: 150px;">* image6</div>
9428 <div class="gallerytext">
9429 </div>
9430 </div></li>
9431 </ul>
9432
9433 !! end
9434
9435 !! test
9436 Gallery (with options)
9437 !! input
9438 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
9439 File:Nonexistant.jpg|caption
9440 File:Nonexistant.jpg
9441 image:foobar.jpg|some '''caption''' [[Main Page]]
9442 image:foobar.jpg
9443 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
9444 </gallery>
9445 !! result
9446 <ul class="gallery" style="max-width: 226px;_width: 226px;">
9447 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
9448 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9449 <div style="height: 70px;">Nonexistant.jpg</div>
9450 <div class="gallerytext">
9451 <p>caption
9452 </p>
9453 </div>
9454 </div></li>
9455 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9456 <div style="height: 70px;">Nonexistant.jpg</div>
9457 <div class="gallerytext">
9458 </div>
9459 </div></li>
9460 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9461 <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>
9462 <div class="gallerytext">
9463 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9464 </p>
9465 </div>
9466 </div></li>
9467 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9468 <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>
9469 <div class="gallerytext">
9470 </div>
9471 </div></li>
9472 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9473 <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>
9474 <div class="gallerytext">
9475 <p>Blabla|blabla.
9476 </p>
9477 </div>
9478 </div></li>
9479 </ul>
9480
9481 !! end
9482
9483 !! test
9484 Gallery with wikitext inside caption
9485 !! input
9486 <gallery>
9487 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
9488 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
9489 </gallery>
9490 !! result
9491 <ul class="gallery">
9492 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9493 <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>
9494 <div class="gallerytext">
9495 <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>
9496 </p>
9497 </div>
9498 </div></li>
9499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9500 <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>
9501 <div class="gallerytext">
9502 <p>This is a test template
9503 </p>
9504 </div>
9505 </div></li>
9506 </ul>
9507
9508 !! end
9509
9510 !! test
9511 gallery (with showfilename option)
9512 !! input
9513 <gallery showfilename>
9514 File:Nonexistant.jpg|caption
9515 File:Nonexistant.jpg
9516 image:foobar.jpg|some '''caption''' [[Main Page]]
9517 File:Foobar.jpg
9518 </gallery>
9519 !! result
9520 <ul class="gallery">
9521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9522 <div style="height: 150px;">Nonexistant.jpg</div>
9523 <div class="gallerytext">
9524 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9525 caption
9526 </p>
9527 </div>
9528 </div></li>
9529 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9530 <div style="height: 150px;">Nonexistant.jpg</div>
9531 <div class="gallerytext">
9532 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9533 </p>
9534 </div>
9535 </div></li>
9536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9537 <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>
9538 <div class="gallerytext">
9539 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9540 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9541 </p>
9542 </div>
9543 </div></li>
9544 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9545 <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>
9546 <div class="gallerytext">
9547 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9548 </p>
9549 </div>
9550 </div></li>
9551 </ul>
9552
9553 !! end
9554
9555 !! test
9556 Gallery (with namespace-less filenames)
9557 !! input
9558 <gallery>
9559 File:Nonexistant.jpg
9560 Nonexistant.jpg
9561 image:foobar.jpg
9562 foobar.jpg
9563 </gallery>
9564 !! result
9565 <ul class="gallery">
9566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9567 <div style="height: 150px;">Nonexistant.jpg</div>
9568 <div class="gallerytext">
9569 </div>
9570 </div></li>
9571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9572 <div style="height: 150px;">Nonexistant.jpg</div>
9573 <div class="gallerytext">
9574 </div>
9575 </div></li>
9576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9577 <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>
9578 <div class="gallerytext">
9579 </div>
9580 </div></li>
9581 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9582 <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>
9583 <div class="gallerytext">
9584 </div>
9585 </div></li>
9586 </ul>
9587
9588 !! end
9589
9590 !! test
9591 HTML Hex character encoding (spells the word "JavaScript")
9592 !! input
9593 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
9594 !! result
9595 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
9596 </p>
9597 !! end
9598
9599 !! test
9600 HTML Hex character encoding bogus encoding (bug 26437 regression check)
9601 !! input
9602 &#xsee;&#XSEE;
9603 !! result
9604 <p>&amp;#xsee;&amp;#XSEE;
9605 </p>
9606 !! end
9607
9608 !! test
9609 HTML Hex character encoding mixed case
9610 !! input
9611 &#xEE;&#Xee;
9612 !! result
9613 <p>&#xee;&#xee;
9614 </p>
9615 !! end
9616
9617 !! test
9618 __FORCETOC__ override
9619 !! input
9620 __NEWSECTIONLINK__
9621 __FORCETOC__
9622 !! result
9623 <p><br />
9624 </p>
9625 !! end
9626
9627 !! test
9628 ISBN code coverage
9629 !! input
9630 ISBN 978-0-1234-56&#x20;789
9631 !! result
9632 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
9633 </p>
9634 !! end
9635
9636 !! test
9637 ISBN followed by 5 spaces
9638 !! input
9639 ISBN
9640 !! result
9641 <p>ISBN
9642 </p>
9643 !! end
9644
9645 !! test
9646 Double ISBN
9647 !! input
9648 ISBN ISBN 1234567890
9649 !! result
9650 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9651 </p>
9652 !! end
9653
9654 !! test
9655 Bug 22905: <abbr> followed by ISBN followed by </a>
9656 !! input
9657 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
9658 !! result
9659 <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>
9660 </p>
9661 !! end
9662
9663 !! test
9664 Double RFC
9665 !! input
9666 RFC RFC 1234
9667 !! result
9668 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
9669 </p>
9670 !! end
9671
9672 !! test
9673 Double RFC with a wiki link
9674 !! input
9675 RFC [[RFC 1234]]
9676 !! result
9677 <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>
9678 </p>
9679 !! end
9680
9681 !! test
9682 RFC code coverage
9683 !! input
9684 RFC 983&#x20;987
9685 !! result
9686 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
9687 </p>
9688 !! end
9689
9690 !! test
9691 Centre-aligned image
9692 !! input
9693 [[Image:foobar.jpg|centre]]
9694 !! result
9695 <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>
9696
9697 !!end
9698
9699 !! test
9700 None-aligned image
9701 !! input
9702 [[Image:foobar.jpg|none]]
9703 !! result
9704 <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>
9705
9706 !!end
9707
9708 !! test
9709 Width + Height sized image (using px) (height is ignored)
9710 !! input
9711 [[Image:foobar.jpg|640x480px]]
9712 !! result
9713 <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>
9714 </p>
9715 !!end
9716
9717 !! test
9718 Width-sized image (using px, no following whitespace)
9719 !! input
9720 [[Image:foobar.jpg|640px]]
9721 !! result
9722 <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>
9723 </p>
9724 !!end
9725
9726 !! test
9727 Width-sized image (using px, with following whitespace - test regression from r39467)
9728 !! input
9729 [[Image:foobar.jpg|640px ]]
9730 !! result
9731 <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>
9732 </p>
9733 !!end
9734
9735 !! test
9736 Width-sized image (using px, with preceding whitespace - test regression from r39467)
9737 !! input
9738 [[Image:foobar.jpg| 640px]]
9739 !! result
9740 <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>
9741 </p>
9742 !!end
9743
9744 !! test
9745 Another italics / bold test
9746 !! input
9747 ''' ''x'
9748 !! result
9749 <pre>'<i> </i>x'
9750 </pre>
9751 !!end
9752
9753 # Note the results may be incorrect, as parserTest output included this:
9754 # XML error: Mismatched tag at byte 6120:
9755 # ...<dd> </dt></dl> </dd...
9756 !! test
9757 dt/dd/dl test
9758 !! options
9759 disabled
9760 !! input
9761 :;;;::
9762 !! result
9763 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
9764 </dd></dl>
9765 </dd></dl>
9766 </dt></dl>
9767 </dt></dl>
9768 </dt></dl>
9769 </dd></dl>
9770
9771 !!end
9772
9773
9774 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
9775 !! test
9776 Images with the "|" character in the comment
9777 !! input
9778 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
9779 !! result
9780 <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>
9781
9782 !!end
9783
9784 !! test
9785 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
9786 !! input
9787 <html><script>alert(1);</script></html>
9788 !! result
9789 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
9790 </p>
9791 !! end
9792
9793 !! test
9794 HTML with raw HTML ($wgRawHtml==true)
9795 !! options
9796 rawhtml
9797 !! input
9798 <html><script>alert(1);</script></html>
9799 !! result
9800 <p><script>alert(1);</script>
9801 </p>
9802 !! end
9803
9804 !! test
9805 Parents of subpages, one level up
9806 !! options
9807 subpage title=[[Subpage test/L1/L2/L3]]
9808 !! input
9809 [[../|L2]]
9810 !! result
9811 <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>
9812 </p>
9813 !! end
9814
9815
9816 !! test
9817 Parents of subpages, one level up, not named
9818 !! options
9819 subpage title=[[Subpage test/L1/L2/L3]]
9820 !! input
9821 [[../]]
9822 !! result
9823 <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>
9824 </p>
9825 !! end
9826
9827
9828
9829 !! test
9830 Parents of subpages, two levels up
9831 !! options
9832 subpage title=[[Subpage test/L1/L2/L3]]
9833 !! input
9834 [[../../|L1]]2
9835
9836 [[../../|L1]]l
9837 !! result
9838 <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
9839 </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>
9840 </p>
9841 !! end
9842
9843 !! test
9844 Parents of subpages, two levels up, without trailing slash or name.
9845 !! options
9846 subpage title=[[Subpage test/L1/L2/L3]]
9847 !! input
9848 [[../..]]
9849 !! result
9850 <p>[[../..]]
9851 </p>
9852 !! end
9853
9854 !! test
9855 Parents of subpages, two levels up, with lots of extra trailing slashes.
9856 !! options
9857 subpage title=[[Subpage test/L1/L2/L3]]
9858 !! input
9859 [[../../////]]
9860 !! result
9861 <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>
9862 </p>
9863 !! end
9864
9865 !! test
9866 Definition list code coverage
9867 !! input
9868 ; title : def
9869 ; title : def
9870 ;title: def
9871 !! result
9872 <dl><dt> title &#160;</dt><dd> def
9873 </dd><dt> title&#160;</dt><dd> def
9874 </dd><dt>title</dt><dd> def
9875 </dd></dl>
9876
9877 !! end
9878
9879 !! test
9880 Don't fall for the self-closing div
9881 !! input
9882 <div>hello world</div/>
9883 !! result
9884 <div>hello world</div>
9885
9886 !! end
9887
9888 !! test
9889 MSGNW magic word
9890 !! input
9891 {{MSGNW:msg}}
9892 !! result
9893 <p>&#91;&#91;:Template:Msg&#93;&#93;
9894 </p>
9895 !! end
9896
9897 !! test
9898 RAW magic word
9899 !! input
9900 {{RAW:QUERTY}}
9901 !! result
9902 <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>
9903 </p>
9904 !! end
9905
9906 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
9907 !! test
9908 Always escape literal '>' in output, not just after '<'
9909 !! input
9910 ><>
9911 !! result
9912 <p>&gt;&lt;&gt;
9913 </p>
9914 !! end
9915
9916 !! test
9917 Template caching
9918 !! input
9919 {{Test}}
9920 {{Test}}
9921 !! result
9922 <p>This is a test template
9923 This is a test template
9924 </p>
9925 !! end
9926
9927
9928 !! article
9929 MediaWiki:Fake
9930 !! text
9931 ==header==
9932 !! endarticle
9933
9934 !! test
9935 Inclusion of !userCanEdit() content
9936 !! input
9937 {{MediaWiki:Fake}}
9938 !! result
9939 <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>
9940
9941 !! end
9942
9943
9944 !! test
9945 Out-of-order TOC heading levels
9946 !! input
9947 ==2==
9948 ======6======
9949 ===3===
9950 =1=
9951 =====5=====
9952 ==2==
9953 !! result
9954 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9955 <ul>
9956 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
9957 <ul>
9958 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
9959 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
9960 </ul>
9961 </li>
9962 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
9963 <ul>
9964 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
9965 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
9966 </ul>
9967 </li>
9968 </ul>
9969 </td></tr></table>
9970 <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>
9971 <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>
9972 <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>
9973 <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>
9974 <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>
9975 <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>
9976
9977 !! end
9978
9979
9980 !! test
9981 ISBN with a dummy number
9982 !! input
9983 ISBN ---
9984 !! result
9985 <p>ISBN ---
9986 </p>
9987 !! end
9988
9989
9990 !! test
9991 ISBN with space-delimited number
9992 !! input
9993 ISBN 92 9017 032 8
9994 !! result
9995 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
9996 </p>
9997 !! end
9998
9999
10000 !! test
10001 ISBN with multiple spaces, no number
10002 !! input
10003 ISBN foo
10004 !! result
10005 <p>ISBN foo
10006 </p>
10007 !! end
10008
10009
10010 !! test
10011 ISBN length
10012 !! input
10013 ISBN 123456789
10014
10015 ISBN 1234567890
10016
10017 ISBN 12345678901
10018 !! result
10019 <p>ISBN 123456789
10020 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10021 </p><p>ISBN 12345678901
10022 </p>
10023 !! end
10024
10025
10026 !! test
10027 ISBN with trailing year (bug 8110)
10028 !! input
10029 ISBN 1-234-56789-0 - 2006
10030
10031 ISBN 1 234 56789 0 - 2006
10032 !! result
10033 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10034 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10035 </p>
10036 !! end
10037
10038
10039 !! test
10040 anchorencode
10041 !! input
10042 {{anchorencode:foo bar©#%n}}
10043 !! result
10044 <p>foo_bar.C2.A9.23.25n
10045 </p>
10046 !! end
10047
10048 !! test
10049 anchorencode trims spaces
10050 !! input
10051 {{anchorencode: __pretty__please__}}
10052 !! result
10053 <p>pretty_please
10054 </p>
10055 !! end
10056
10057 !! test
10058 anchorencode deals with links
10059 !! input
10060 {{anchorencode: [[hello|world]] [[hi]]}}
10061 !! result
10062 <p>world_hi
10063 </p>
10064 !! end
10065
10066 !! test
10067 anchorencode deals with templates
10068 !! input
10069 {{anchorencode: {{Foo}} }}
10070 !! result
10071 <p>FOO
10072 </p>
10073 !! end
10074
10075 !! test
10076 anchorencode encodes like the TOC generator: (bug 18431)
10077 !! input
10078 === _ +:.3A%3A&&amp;]] ===
10079 {{anchorencode: _ +:.3A%3A&&amp;]] }}
10080 __NOEDITSECTION__
10081 !! result
10082 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
10083 <p>.2B:.3A.253A.26.26.5D.5D
10084 </p>
10085 !! end
10086
10087 # Expected output in the following test is not necessarily expected (there
10088 # should probably be <p> tags inside the <blockquote> in the output) -- it's
10089 # only testing for well-formedness.
10090 !! test
10091 Bug 6200: blockquotes and paragraph formatting
10092 !! input
10093 <blockquote>
10094 foo
10095 </blockquote>
10096
10097 bar
10098
10099 baz
10100 !! result
10101 <blockquote>
10102 foo
10103 </blockquote>
10104 <p>bar
10105 </p>
10106 <pre>baz
10107 </pre>
10108 !! end
10109
10110 !! test
10111 Bug 8293: Use of center tag ruins paragraph formatting
10112 !! input
10113 <center>
10114 foo
10115 </center>
10116
10117 bar
10118
10119 baz
10120 !! result
10121 <center>
10122 <p>foo
10123 </p>
10124 </center>
10125 <p>bar
10126 </p>
10127 <pre>baz
10128 </pre>
10129 !! end
10130
10131
10132 ###
10133 ### Language variants related tests
10134 ###
10135 !! test
10136 Self-link in language variants
10137 !! options
10138 title=[[Dunav]] language=sr
10139 !! input
10140 Both [[Dunav]] and [[Дунав]] are names for this river.
10141 !! result
10142 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
10143 </p>
10144 !!end
10145
10146
10147 !! test
10148 Link to pages in language variants
10149 !! options
10150 language=sr
10151 !! input
10152 Main Page can be written as [[Маин Паге]]
10153 !! result
10154 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
10155 </p>
10156 !!end
10157
10158
10159 !! test
10160 Multiple links to pages in language variants
10161 !! options
10162 language=sr
10163 !! input
10164 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
10165 !! result
10166 <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>.
10167 </p>
10168 !!end
10169
10170
10171 !! test
10172 Simple template in language variants
10173 !! options
10174 language=sr
10175 !! input
10176 {{тест}}
10177 !! result
10178 <p>This is a test template
10179 </p>
10180 !! end
10181
10182
10183 !! test
10184 Template with explicit namespace in language variants
10185 !! options
10186 language=sr
10187 !! input
10188 {{Template:тест}}
10189 !! result
10190 <p>This is a test template
10191 </p>
10192 !! end
10193
10194
10195 !! test
10196 Basic test for template parameter in language variants
10197 !! options
10198 language=sr
10199 !! input
10200 {{парамтест|param=foo}}
10201 !! result
10202 <p>This is a test template with parameter foo
10203 </p>
10204 !! end
10205
10206
10207 !! test
10208 Simple category in language variants
10209 !! options
10210 language=sr cat
10211 !! input
10212 [[Category:МедиаWики Усер'с Гуиде]]
10213 !! result
10214 <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>
10215 !! end
10216
10217
10218 !! test
10219 Stripping -{}- tags (language variants)
10220 !! options
10221 language=sr
10222 !! input
10223 Latin proverb: -{Ne nuntium necare}-
10224 !! result
10225 <p>Latin proverb: Ne nuntium necare
10226 </p>
10227 !! end
10228
10229
10230 !! test
10231 Prevent conversion with -{}- tags (language variants)
10232 !! options
10233 language=sr variant=sr-ec
10234 !! input
10235 Latinski: -{Ne nuntium necare}-
10236 !! result
10237 <p>Латински: Ne nuntium necare
10238 </p>
10239 !! end
10240
10241
10242 !! test
10243 Prevent conversion of text with -{}- tags (language variants)
10244 !! options
10245 language=sr variant=sr-ec
10246 !! input
10247 Latinski: -{Ne nuntium necare}-
10248 !! result
10249 <p>Латински: Ne nuntium necare
10250 </p>
10251 !! end
10252
10253
10254 !! test
10255 Prevent conversion of links with -{}- tags (language variants)
10256 !! options
10257 language=sr variant=sr-ec
10258 !! input
10259 -{[[Main Page]]}-
10260 !! result
10261 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10262 </p>
10263 !! end
10264
10265
10266 !! test
10267 -{}- tags within headlines (within html for parserConvert())
10268 !! options
10269 language=sr variant=sr-ec
10270 !! input
10271 == -{Naslov}- ==
10272 !! result
10273 <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>
10274
10275 !! end
10276
10277
10278 !! test
10279 Explicit definition of language variant alternatives
10280 !! options
10281 language=zh variant=zh-tw
10282 !! input
10283 -{zh:China;zh-tw:Taiwan}-, not China
10284 !! result
10285 <p>Taiwan, not China
10286 </p>
10287 !! end
10288
10289
10290 !! test
10291 Explicit session-wise language variant mapping (A flag and - flag)
10292 !! options
10293 language=zh variant=zh-tw
10294 !! input
10295 Taiwan is not China.
10296 But -{A|zh:China;zh-tw:Taiwan}- is China,
10297 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
10298 and -{China}- is China.
10299 !! result
10300 <p>Taiwan is not China.
10301 But Taiwan is Taiwan,
10302 (This should be stripped!)
10303 and China is China.
10304 </p>
10305 !! end
10306
10307 !! test
10308 Explicit session-wise language variant mapping (H flag for hide)
10309 !! options
10310 language=zh variant=zh-tw
10311 !! input
10312 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
10313 Taiwan is China.
10314 !! result
10315 <p>(This should be stripped!)
10316 Taiwan is Taiwan.
10317 </p>
10318 !! end
10319
10320 !! test
10321 Adding explicit conversion rule for title (T flag)
10322 !! options
10323 language=zh variant=zh-tw showtitle
10324 !! input
10325 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10326 !! result
10327 Taiwan
10328 <p>Should be stripped!
10329 </p>
10330 !! end
10331
10332 !! test
10333 Testing that changing the language variant here in the tests actually works
10334 !! options
10335 language=zh variant=zh showtitle
10336 !! input
10337 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10338 !! result
10339 China
10340 <p>Should be stripped!
10341 </p>
10342 !! end
10343
10344 !! test
10345 Bug 24072: more test on conversion rule for title
10346 !! options
10347 language=zh variant=zh-tw showtitle
10348 !! input
10349 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10350 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
10351 !! result
10352 Taiwan
10353 <p>This should be stripped!
10354 This won't take interferes with the title rule.
10355 </p>
10356 !! end
10357
10358 !! test
10359 Raw output of variant escape tags (R flag)
10360 !! options
10361 language=zh variant=zh-tw
10362 !! input
10363 Raw: -{R|zh:China;zh-tw:Taiwan}-
10364 !! result
10365 <p>Raw: zh:China;zh-tw:Taiwan
10366 </p>
10367 !! end
10368
10369 !! test
10370 Nested using of manual convert syntax
10371 !! options
10372 language=zh variant=zh-hk
10373 !! input
10374 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
10375 !! result
10376 <p>Nested: Hello Hong Kong!
10377 </p>
10378 !! end
10379
10380 !! test
10381 Do not convert roman numbers to language variants
10382 !! options
10383 language=sr variant=sr-ec
10384 !! input
10385 Fridrih IV je car.
10386 !! result
10387 <p>Фридрих IV је цар.
10388 </p>
10389 !! end
10390
10391 !! test
10392 Unclosed language converter markup "-{"
10393 !! options
10394 language=sr
10395 !! input
10396 -{T|hello
10397 !! result
10398 <p>-{T|hello
10399 </p>
10400 !! end
10401
10402 !! test
10403 Don't convert raw rule "-{R|=&gt;}-" to "=>"
10404 !! options
10405 language=sr
10406 !! input
10407 -{R|=&gt;}-
10408 !! result
10409 <p>=&gt;
10410 </p>
10411 !!end
10412
10413 !!article
10414 Template:Bullet
10415 !!text
10416 * Bar
10417 !!endarticle
10418
10419 !! test
10420 Bug 529: Uncovered bullet
10421 !! input
10422 * Foo {{bullet}}
10423 !! result
10424 <ul><li> Foo
10425 </li><li> Bar
10426 </li></ul>
10427
10428 !! end
10429
10430 # Plain MediaWiki does not remove empty lists, but tidy actually does.
10431 # Templates in Wikipedia rely on this behavior, as tidy has always been
10432 # enabled there. These tests are normally run *without* tidy, so specify the
10433 # full output here.
10434 # To test realistic parsing behavior, apply a tidy-like transformation to both
10435 # the expected output and your parser's output.
10436 !! test
10437 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
10438 !! input
10439 ******* Foo {{bullet}}
10440 !! result
10441 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
10442 </li></ul>
10443 </li></ul>
10444 </li></ul>
10445 </li></ul>
10446 </li></ul>
10447 </li></ul>
10448 </li><li> Bar
10449 </li></ul>
10450
10451 !! end
10452
10453 !! test
10454 Bug 529: Uncovered table already at line-start
10455 !! input
10456 x
10457
10458 {{table}}
10459 y
10460 !! result
10461 <p>x
10462 </p>
10463 <table>
10464 <tr>
10465 <td> 1 </td>
10466 <td> 2
10467 </td></tr>
10468 <tr>
10469 <td> 3 </td>
10470 <td> 4
10471 </td></tr></table>
10472 <p>y
10473 </p>
10474 !! end
10475
10476 !! test
10477 Bug 529: Uncovered bullet in parser function result
10478 !! input
10479 * Foo {{lc:{{bullet}} }}
10480 !! result
10481 <ul><li> Foo
10482 </li><li> bar
10483 </li></ul>
10484
10485 !! end
10486
10487 !! test
10488 Bug 5678: Double-parsed template argument
10489 !! input
10490 {{lc:{{{1}}}|hello}}
10491 !! result
10492 <p>{{{1}}}
10493 </p>
10494 !! end
10495
10496 !! test
10497 Bug 5678: Double-parsed template invocation
10498 !! input
10499 {{lc:{{paramtest {{!}} param = hello }} }}
10500 !! result
10501 <p>{{paramtest | param = hello }}
10502 </p>
10503 !! end
10504
10505 !! test
10506 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
10507 !! options
10508 language=cs
10509 title=[[Main Page]]
10510 !! input
10511 {{PRVNÍVELKÉ:ěščř}}
10512 {{prvnívelké:ěščř}}
10513 {{PRVNÍMALÉ:ěščř}}
10514 {{prvnímalé:ěščř}}
10515 {{MALÁ:ěščř}}
10516 {{malá:ěščř}}
10517 {{VELKÁ:ěščř}}
10518 {{velká:ěščř}}
10519 !! result
10520 <p>Ěščř
10521 Ěščř
10522 ěščř
10523 ěščř
10524 ěščř
10525 ěščř
10526 ĚŠČŘ
10527 ĚŠČŘ
10528 </p>
10529 !! end
10530
10531 !! test
10532 Morwen/13: Unclosed link followed by heading
10533 !! input
10534 [[link
10535 ==heading==
10536 !! result
10537 <p>[[link
10538 </p>
10539 <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>
10540
10541 !! end
10542
10543 !! test
10544 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
10545 !! input
10546 {{foo|
10547 =heading=
10548 !! result
10549 <p>{{foo|
10550 </p>
10551 <h1> <span class="mw-headline" id="heading">heading</span></h1>
10552
10553 !! end
10554
10555 !! test
10556 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
10557 !! input
10558 {{foo|
10559 ==heading==
10560 !! result
10561 <p>{{foo|
10562 </p>
10563 <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>
10564
10565 !! end
10566
10567 !! test
10568 Tildes in comments
10569 !! options
10570 pst
10571 !! input
10572 <!-- ~~~~ -->
10573 !! result
10574 <!-- ~~~~ -->
10575 !! end
10576
10577 !! test
10578 Paragraphs inside divs (no extra line breaks)
10579 !! input
10580 <div>Line one
10581
10582 Line two</div>
10583 !! result
10584 <div>Line one
10585 Line two</div>
10586
10587 !! end
10588
10589 !! test
10590 Paragraphs inside divs (extra line break on open)
10591 !! input
10592 <div>
10593 Line one
10594
10595 Line two</div>
10596 !! result
10597 <div>
10598 <p>Line one
10599 </p>
10600 Line two</div>
10601
10602 !! end
10603
10604 !! test
10605 Paragraphs inside divs (extra line break on close)
10606 !! input
10607 <div>Line one
10608
10609 Line two
10610 </div>
10611 !! result
10612 <div>Line one
10613 <p>Line two
10614 </p>
10615 </div>
10616
10617 !! end
10618
10619 !! test
10620 Paragraphs inside divs (extra line break on open and close)
10621 !! input
10622 <div>
10623 Line one
10624
10625 Line two
10626 </div>
10627 !! result
10628 <div>
10629 <p>Line one
10630 </p><p>Line two
10631 </p>
10632 </div>
10633
10634 !! end
10635
10636 !! test
10637 Nesting tags, paragraphs on lines which begin with <div>
10638 !! options
10639 disabled
10640 !! input
10641 <div></div><strong>A
10642 B</strong>
10643 !! result
10644 <div></div>
10645 <p><strong>A
10646 B</strong>
10647 </p>
10648 !! end
10649
10650 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
10651 !! test
10652 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
10653 !! options
10654 disabled
10655 !! input
10656 <blockquote>Line one
10657
10658 Line two</blockquote>
10659 !! result
10660 <blockquote>Line one
10661 Line two</blockquote>
10662
10663 !! end
10664
10665 !! test
10666 Bug 6200: paragraphs inside blockquotes (extra line break on open)
10667 !! options
10668 disabled
10669 !! input
10670 <blockquote>
10671 Line one
10672
10673 Line two</blockquote>
10674 !! result
10675 <blockquote>
10676 <p>Line one
10677 </p>
10678 Line two</blockquote>
10679
10680 !! end
10681
10682 !! test
10683 Bug 6200: paragraphs inside blockquotes (extra line break on close)
10684 !! options
10685 disabled
10686 !! input
10687 <blockquote>Line one
10688
10689 Line two
10690 </blockquote>
10691 !! result
10692 <blockquote>Line one
10693 <p>Line two
10694 </p>
10695 </blockquote>
10696
10697 !! end
10698
10699 !! test
10700 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
10701 !! options
10702 disabled
10703 !! input
10704 <blockquote>
10705 Line one
10706
10707 Line two
10708 </blockquote>
10709 !! result
10710 <blockquote>
10711 <p>Line one
10712 </p><p>Line two
10713 </p>
10714 </blockquote>
10715
10716 !! end
10717
10718 !! test
10719 Paragraphs inside blockquotes/divs (no extra line breaks)
10720 !! input
10721 <blockquote><div>Line one
10722
10723 Line two</div></blockquote>
10724 !! result
10725 <blockquote><div>Line one
10726 Line two</div></blockquote>
10727
10728 !! end
10729
10730 !! test
10731 Paragraphs inside blockquotes/divs (extra line break on open)
10732 !! input
10733 <blockquote><div>
10734 Line one
10735
10736 Line two</div></blockquote>
10737 !! result
10738 <blockquote><div>
10739 <p>Line one
10740 </p>
10741 Line two</div></blockquote>
10742
10743 !! end
10744
10745 !! test
10746 Paragraphs inside blockquotes/divs (extra line break on close)
10747 !! input
10748 <blockquote><div>Line one
10749
10750 Line two
10751 </div></blockquote>
10752 !! result
10753 <blockquote><div>Line one
10754 <p>Line two
10755 </p>
10756 </div></blockquote>
10757
10758 !! end
10759
10760 !! test
10761 Paragraphs inside blockquotes/divs (extra line break on open and close)
10762 !! input
10763 <blockquote><div>
10764 Line one
10765
10766 Line two
10767 </div></blockquote>
10768 !! result
10769 <blockquote><div>
10770 <p>Line one
10771 </p><p>Line two
10772 </p>
10773 </div></blockquote>
10774
10775 !! end
10776
10777 !! test
10778 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
10779 !! options
10780 wgLinkHolderBatchSize=0
10781 !! input
10782 [[meatball:1]]
10783 [[meatball:2]]
10784 [[meatball:3]]
10785 !! result
10786 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
10787 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
10788 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
10789 </p>
10790 !! end
10791
10792 !! test
10793 Free external link invading image caption
10794 !! input
10795 [[Image:Foobar.jpg|thumb|http://x|hello]]
10796 !! result
10797 <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>
10798
10799 !! end
10800
10801 !! test
10802 Bug 15196: localised external link numbers
10803 !! options
10804 language=fa
10805 !! input
10806 [http://en.wikipedia.org/]
10807 !! result
10808 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
10809 </p>
10810 !! end
10811
10812 !! test
10813 Multibyte character in padleft
10814 !! input
10815 {{padleft:-Hello|7|Æ}}
10816 !! result
10817 <p>Æ-Hello
10818 </p>
10819 !! end
10820
10821 !! test
10822 Multibyte character in padright
10823 !! input
10824 {{padright:Hello-|7|Æ}}
10825 !! result
10826 <p>Hello-Æ
10827 </p>
10828 !! end
10829
10830 !! test
10831 Formatted date
10832 !! config
10833 wgUseDynamicDates=1
10834 !! input
10835 [[2009-03-24]]
10836 !! result
10837 <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>
10838 </p>
10839 !!end
10840
10841 !!test
10842 formatdate parser function
10843 !!input
10844 {{#formatdate:2009-03-24}}
10845 !! result
10846 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
10847 </p>
10848 !! end
10849
10850 !!test
10851 formatdate parser function, with default format
10852 !!input
10853 {{#formatdate:2009-03-24|mdy}}
10854 !! result
10855 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
10856 </p>
10857 !! end
10858
10859 !! test
10860 Linked date with autoformatting disabled
10861 !! config
10862 wgUseDynamicDates=false
10863 !! input
10864 [[2009-03-24]]
10865 !! result
10866 <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>
10867 </p>
10868 !! end
10869
10870 !! test
10871 Spacing of numbers in formatted dates
10872 !! input
10873 {{#formatdate:January 15}}
10874 !! result
10875 <p><span class="mw-formatted-date" title="01-15">January 15</span>
10876 </p>
10877 !! end
10878
10879 !! test
10880 Spacing of numbers in formatted dates (linked)
10881 !! config
10882 wgUseDynamicDates=true
10883 !! input
10884 [[January 15]]
10885 !! result
10886 <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>
10887 </p>
10888 !! end
10889
10890 !! test
10891 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
10892 !! options
10893 language=nl title=[[MediaWiki:Common.css]]
10894 !! input
10895 {{#formatdate:2009-03-24|dmy}}
10896 !! result
10897 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
10898 </p>
10899 !! end
10900
10901 #
10902 #
10903 #
10904
10905 #
10906 # Edit comments
10907 #
10908
10909 !! test
10910 Edit comment with link
10911 !! options
10912 comment
10913 !! input
10914 I like the [[Main Page]] a lot
10915 !! result
10916 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
10917 !!end
10918
10919 !! test
10920 Edit comment with link and link text
10921 !! options
10922 comment
10923 !! input
10924 I like the [[Main Page|best pages]] a lot
10925 !! result
10926 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10927 !!end
10928
10929 !! test
10930 Edit comment with link and link text with suffix
10931 !! options
10932 comment
10933 !! input
10934 I like the [[Main Page|best page]]s a lot
10935 !! result
10936 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10937 !!end
10938
10939 !! test
10940 Edit comment with section link (non-local, eg in history list)
10941 !! options
10942 comment title=[[Main Page]]
10943 !! input
10944 /* External links */ removed bogus entries
10945 !! result
10946 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10947 !!end
10948
10949 !! test
10950 Edit comment with section link and text before it (non-local, eg in history list)
10951 !! options
10952 comment title=[[Main Page]]
10953 !! input
10954 pre-comment text /* External links */ removed bogus entries
10955 !! result
10956 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>
10957 !!end
10958
10959 !! test
10960 Edit comment with section link (local, eg in diff view)
10961 !! options
10962 comment local title=[[Main Page]]
10963 !! input
10964 /* External links */ removed bogus entries
10965 !! result
10966 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10967 !!end
10968
10969 !! test
10970 Edit comment with subpage link (bug 14080)
10971 !! options
10972 comment
10973 subpage
10974 title=[[Subpage test]]
10975 !! input
10976 Poked at a [[/subpage]] here...
10977 !! result
10978 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
10979 !!end
10980
10981 !! test
10982 Edit comment with subpage link and link text (bug 14080)
10983 !! options
10984 comment
10985 subpage
10986 title=[[Subpage test]]
10987 !! input
10988 Poked at a [[/subpage|neat little page]] here...
10989 !! result
10990 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
10991 !!end
10992
10993 !! test
10994 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
10995 !! options
10996 comment
10997 title=[[Subpage test]]
10998 !! input
10999 Poked at a [[/subpage]] here...
11000 !! result
11001 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...
11002 !!end
11003
11004 !! test
11005 Edit comment with bare anchor link (local, as on diff)
11006 !! options
11007 comment
11008 local
11009 title=[[Main Page]]
11010 !!input
11011 [[#section]]
11012 !! result
11013 <a href="#section">#section</a>
11014 !! end
11015
11016 !! test
11017 Edit comment with bare anchor link (non-local, as on history)
11018 !! options
11019 comment
11020 title=[[Main Page]]
11021 !!input
11022 [[#section]]
11023 !! result
11024 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
11025 !! end
11026
11027 !! test
11028 Anchor starting with underscore
11029 !!input
11030 [[#_ref|One]]
11031 !! result
11032 <p><a href="#_ref">One</a>
11033 </p>
11034 !! end
11035
11036 !! test
11037 Id starting with underscore
11038 !!input
11039 <div id="_ref"></div>
11040 !! result
11041 <div id="_ref"></div>
11042
11043 !! end
11044
11045 !! test
11046 Space normalisation on autocomment (bug 22784)
11047 !! options
11048 comment
11049 title=[[Main Page]]
11050 !!input
11051 /* __hello__world__ */
11052 !! result
11053 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
11054 !! end
11055
11056 !! test
11057 percent-encoding and + signs in comments (Bug 26410)
11058 !! options
11059 comment
11060 !!input
11061 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
11062 !! result
11063 <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>
11064 !! end
11065
11066 !! test
11067 Bad images - basic functionality
11068 !! options
11069 disabled
11070 !! input
11071 [[File:Bad.jpg]]
11072 !! result
11073 !! end
11074
11075 !! test
11076 Bad images - bug 16039: text after bad image disappears
11077 !! options
11078 disabled
11079 !! input
11080 Foo bar
11081 [[File:Bad.jpg]]
11082 Bar foo
11083 !! result
11084 <p>Foo bar
11085 </p><p>Bar foo
11086 </p>
11087 !! end
11088
11089 !! test
11090 Verify that displaytitle works (bug #22501) no displaytitle
11091 !! options
11092 showtitle
11093 !! config
11094 wgAllowDisplayTitle=true
11095 wgRestrictDisplayTitle=false
11096 !! input
11097 this is not the the title
11098 !! result
11099 Parser test
11100 <p>this is not the the title
11101 </p>
11102 !! end
11103
11104 !! test
11105 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
11106 !! options
11107 showtitle
11108 title=[[Screen]]
11109 !! config
11110 wgAllowDisplayTitle=true
11111 wgRestrictDisplayTitle=false
11112 !! input
11113 this is not the the title
11114 {{DISPLAYTITLE:whatever}}
11115 !! result
11116 whatever
11117 <p>this is not the the title
11118 </p>
11119 !! end
11120
11121 !! test
11122 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
11123 !! options
11124 showtitle
11125 title=[[Screen]]
11126 !! config
11127 wgAllowDisplayTitle=true
11128 wgRestrictDisplayTitle=true
11129 !! input
11130 this is not the the title
11131 {{DISPLAYTITLE:whatever}}
11132 !! result
11133 Screen
11134 <p>this is not the the title
11135 </p>
11136 !! end
11137
11138 !! test
11139 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
11140 !! options
11141 showtitle
11142 title=[[Screen]]
11143 !! config
11144 wgAllowDisplayTitle=true
11145 wgRestrictDisplayTitle=true
11146 !! input
11147 this is not the the title
11148 {{DISPLAYTITLE:screen}}
11149 !! result
11150 screen
11151 <p>this is not the the title
11152 </p>
11153 !! end
11154
11155 !! test
11156 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
11157 !! options
11158 showtitle
11159 title=[[Screen]]
11160 !! config
11161 wgAllowDisplayTitle=false
11162 !! input
11163 this is not the the title
11164 {{DISPLAYTITLE:screen}}
11165 !! result
11166 Screen
11167 <p>this is not the the title
11168 <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>
11169 </p>
11170 !! end
11171
11172 !! test
11173 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
11174 !! options
11175 showtitle
11176 title=[[Screen]]
11177 !! config
11178 wgAllowDisplayTitle=false
11179 !! input
11180 this is not the the title
11181 !! result
11182 Screen
11183 <p>this is not the the title
11184 </p>
11185 !! end
11186
11187 !! test
11188 preload: check <noinclude> and <includeonly>
11189 !! options
11190 preload
11191 !! input
11192 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
11193 !! result
11194 Hello kind world.
11195 !! end
11196
11197 !! test
11198 preload: check <onlyinclude>
11199 !! options
11200 preload
11201 !! input
11202 Goodbye <onlyinclude>Hello world</onlyinclude>
11203 !! result
11204 Hello world
11205 !! end
11206
11207 !! test
11208 preload: can pass tags through if we want to
11209 !! options
11210 preload
11211 !! input
11212 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
11213 !! result
11214 <includeonly>Hello world</includeonly>
11215 !! end
11216
11217 !! test
11218 preload: check that it doesn't try to do tricks
11219 !! options
11220 preload
11221 !! input
11222 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11223 !! result
11224 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11225 !! end
11226
11227 !! test
11228 Play a bit with r67090 and bug 3158
11229 !! options
11230 disabled
11231 !! input
11232 <div style="width:50% !important">&nbsp;</div>
11233 <div style="width:50%&nbsp;!important">&nbsp;</div>
11234 <div style="width:50%&#160;!important">&nbsp;</div>
11235 <div style="border : solid;">&nbsp;</div>
11236 !! result
11237 <div style="width:50% !important">&nbsp;</div>
11238 <div style="width:50% !important">&nbsp;</div>
11239 <div style="width:50% !important">&nbsp;</div>
11240 <div style="border&#160;: solid;">&nbsp;</div>
11241
11242 !! end
11243
11244 !! test
11245 HTML5 data attributes
11246 !! input
11247 <span data-foo="bar">Baz</span>
11248 <p data-abc-def_hij="">Quuz</p>
11249 !! result
11250 <p><span data-foo="bar">Baz</span>
11251 </p>
11252 <p data-abc-def_hij="">Quuz</p>
11253
11254 !! end
11255
11256 !! test
11257 percent-encoding and + signs in internal links (Bug 26410)
11258 !! input
11259 [[User:+%]] [[Page+title%]]
11260 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
11261 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
11262 [[%33%45]] [[%33%45+]]
11263 !! result
11264 <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>
11265 <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>
11266 <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>
11267 <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>
11268 </p>
11269 !! end
11270
11271 !! test
11272 Special characters in embedded file links (bug 27679)
11273 !! input
11274 [[File:Contains & ampersand.jpg]]
11275 [[File:Does not exist.jpg|Title with & ampersand]]
11276 !! result
11277 <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>
11278 <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>
11279 </p>
11280 !! end
11281
11282
11283 !! test
11284 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
11285 !! input
11286 Text&apos;s been normalized?
11287 !! result
11288 <p>Text&#39;s been normalized?
11289 </p>
11290 !! end
11291
11292 !! test
11293 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
11294 !! input
11295 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
11296 !! result
11297 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
11298 </p>
11299 !! end
11300
11301 !! test
11302 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
11303 !! input
11304 [http://www.example.org/ ideograms]
11305 !! result
11306 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
11307 </p>
11308 !! end
11309
11310 !! test
11311 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
11312 !! input
11313 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
11314 !! result
11315 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
11316 </p>
11317 !! end
11318
11319 !! article
11320 Mediawiki:loop1
11321 !! text
11322 {{Identical|A}}
11323 !! endarticle
11324
11325 !! article
11326 Mediawiki:loop2
11327 !! text
11328 {{Identical|B}}
11329 !! endarticle
11330
11331 !! article
11332 Template:Identical
11333 !! text
11334 {{int:loop1}}
11335 {{int:loop2}}
11336 !! endarticle
11337
11338 !! test
11339 Bug 31098 Template which includes system messages which includes the template
11340 !! input
11341 {{Identical}}
11342 !! result
11343 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11344 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11345 </p>
11346 !! end
11347
11348 !! test
11349 Deprecated presentational attributes are converted to css
11350 !! input
11351 {|
11352 | valign=top align=left width=100 height=25% | Asdf
11353 |}
11354 <ul type="disc"></ul>
11355 !! result
11356 <table>
11357 <tr>
11358 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
11359 </td></tr></table>
11360 <ul style="list-style-type: disc;"></ul>
11361
11362 !! end
11363
11364 !! test
11365 Bug31490 Turkish: ucfirst 'blah'
11366 !! options
11367 language=tr
11368 !! input
11369 {{ucfirst:blah}}
11370 !! result
11371 <p>Blah
11372 </p>
11373 !! end
11374
11375 !! test
11376 Bug31490 Turkish: ucfirst 'ix'
11377 !! options
11378 language=tr
11379 !! input
11380 {{ucfirst:ix}}
11381 !! result
11382 <p>İx
11383 </p>
11384 !! end
11385
11386 !! test
11387 Bug31490 Turkish: lcfirst 'BLAH'
11388 !! options
11389 language=tr
11390 !! input
11391 {{lcfirst:BLAH}}
11392 !! result
11393 <p>bLAH
11394 </p>
11395 !! end
11396
11397 !! test
11398 Bug31490 Turkish: ucfırst (with a dotless i)
11399 !! options
11400 language=tr
11401 !! input
11402 {{ucfırst:blah}}
11403 !! result
11404 <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>
11405 </p>
11406 !! end
11407
11408 !! test
11409 Bug31490 ucfırst (with a dotless i) with English language
11410 !! options
11411 language=en
11412 !! input
11413 {{ucfırst:blah}}
11414 !! result
11415 <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>
11416 </p>
11417 !! end
11418
11419 !! test
11420 Bug 26375: TOC with italics
11421 !! options
11422 title=[[Main Page]]
11423 !! input
11424 __TOC__
11425 == ''Lost'' episodes ==
11426 !! result
11427 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11428 <ul>
11429 <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>
11430 </ul>
11431 </td></tr></table>
11432 <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>
11433
11434 !! end
11435
11436 !! test
11437 Bug 26375: TOC with bold
11438 !! options
11439 title=[[Main Page]]
11440 !! input
11441 __TOC__
11442 == '''should be bold''' then normal text ==
11443 !! result
11444 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11445 <ul>
11446 <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>
11447 </ul>
11448 </td></tr></table>
11449 <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>
11450
11451 !! end
11452
11453 !! test
11454 Bug 33845: Headings become cursive in TOC when they contain an image
11455 !! options
11456 title=[[Main Page]]
11457 !! input
11458 __TOC__
11459 == Image [[Image:foobar.jpg]] ==
11460 !! result
11461 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11462 <ul>
11463 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
11464 </ul>
11465 </td></tr></table>
11466 <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>
11467
11468 !! end
11469
11470 !! test
11471 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
11472 !! options
11473 title=[[Main Page]]
11474 !! input
11475 __TOC__
11476 == <blockquote>Quote</blockquote> ==
11477 !! result
11478 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11479 <ul>
11480 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
11481 </ul>
11482 </td></tr></table>
11483 <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>
11484
11485 !! end
11486
11487 !! test
11488 Unclosed tags in TOC
11489 !! options
11490 title=[[Main Page]]
11491 !! input
11492 __TOC__
11493 == Proof: 2 < 3 ==
11494 <small>Hanc marginis exiguitas non caperet.</small>
11495 QED
11496 !! result
11497 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11498 <ul>
11499 <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>
11500 </ul>
11501 </td></tr></table>
11502 <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>
11503 <p><small>Hanc marginis exiguitas non caperet.</small>
11504 QED
11505 </p>
11506 !! end
11507
11508 !! test
11509 Multiple tags in TOC
11510 !! input
11511 __TOC__
11512 == <i>Foo</i> <b>Bar</b> ==
11513
11514 == <i>Foo</i> <blockquote>Bar</blockquote> ==
11515 !! result
11516 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11517 <ul>
11518 <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>
11519 <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>
11520 </ul>
11521 </td></tr></table>
11522 <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>
11523 <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>
11524
11525 !! end
11526
11527 !! test
11528 Tags with parameters in TOC
11529 !! input
11530 __TOC__
11531 == <sup class="in-h2">Hello</sup> ==
11532
11533 == <sup class="a > b">Evilbye</sup> ==
11534 !! result
11535 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11536 <ul>
11537 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
11538 <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>
11539 </ul>
11540 </td></tr></table>
11541 <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>
11542 <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>
11543
11544 !! end
11545
11546 !! test
11547 span tags with directionality in TOC
11548 !! input
11549 __TOC__
11550 == <span dir="ltr">C++</span> ==
11551
11552 == <span dir="rtl">זבנג!</span> ==
11553
11554 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
11555
11556 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
11557
11558 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
11559 !! result
11560 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11561 <ul>
11562 <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>
11563 <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>
11564 <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>
11565 <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>
11566 <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>
11567 </ul>
11568 </td></tr></table>
11569 <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>
11570 <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>
11571 <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>
11572 <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>
11573 <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>
11574
11575 !! end
11576
11577 !! article
11578 MediaWiki:Bug32057
11579 !! text
11580 == {{int:headline_sample}} ==
11581 !! endarticle
11582
11583 !! test
11584 Bug 32057: Title needed when expanding <h> nodes.
11585 !! options
11586 title=[[Main Page]]
11587 !! input
11588 {{int:Bug32057}}
11589 !! result
11590 <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>
11591
11592 !! end
11593
11594 !! test
11595 Strip marker in urlencode
11596 !! input
11597 {{urlencode:x<nowiki/>y}}
11598 {{urlencode:x<nowiki/>y|wiki}}
11599 {{urlencode:x<nowiki/>y|path}}
11600 !! result
11601 <p>xy
11602 xy
11603 xy
11604 </p>
11605 !! end
11606
11607 !! test
11608 Strip marker in lc
11609 !! input
11610 {{lc:x<nowiki/>y}}
11611 !! result
11612 <p>xy
11613 </p>
11614 !! end
11615
11616 !! test
11617 Strip marker in uc
11618 !! input
11619 {{uc:x<nowiki/>y}}
11620 !! result
11621 <p>XY
11622 </p>
11623 !! end
11624
11625 !! test
11626 Strip marker in formatNum
11627 !! input
11628 {{formatnum:1<nowiki/>2}}
11629 {{formatnum:1<nowiki/>2|R}}
11630 !! result
11631 <p>12
11632 12
11633 </p>
11634 !! end
11635
11636 !! test
11637 Strip marker in grammar
11638 !! options
11639 language=fi
11640 !! input
11641 {{grammar:elative|foo<nowiki/>bar}}
11642 !! result
11643 <p>foobarista
11644 </p>
11645 !! end
11646
11647 !! test
11648 Strip marker in padleft
11649 !! input
11650 {{padleft:|2|x<nowiki/>y}}
11651 !! result
11652 <p>xy
11653 </p>
11654 !! end
11655
11656 !! test
11657 Strip marker in padright
11658 !! input
11659 {{padright:|2|x<nowiki/>y}}
11660 !! result
11661 <p>xy
11662 </p>
11663 !! end
11664
11665 !! test
11666 Strip marker in anchorencode
11667 !! input
11668 {{anchorencode:x<nowiki/>y}}
11669 !! result
11670 <p>xy
11671 </p>
11672 !! end
11673
11674 !! test
11675 nowiki inside link inside heading (bug 18295)
11676 !! input
11677 ==[[foo|x<nowiki>y</nowiki>z]]==
11678 !! result
11679 <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>
11680
11681 !! end
11682
11683 !! test
11684 new support for bdi element (bug 31817)
11685 !! input
11686 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11687 !! result
11688 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11689
11690 !!end
11691
11692 !! test
11693 Ignore pipe between table row attributes
11694 !! input
11695 {|
11696 | quux
11697 |- id=foo | style='color: red'
11698 | bar
11699 |}
11700 !! result
11701 <table>
11702 <tr>
11703 <td> quux
11704 </td></tr>
11705 <tr id="foo" style="color: red">
11706 <td> bar
11707 </td></tr></table>
11708
11709 !! end
11710
11711 !!test
11712 Gallery override link with WikiLink (bug 34852)
11713 !! input
11714 <gallery>
11715 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
11716 </gallery>
11717 !! result
11718 <ul class="gallery">
11719 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11720 <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>
11721 <div class="gallerytext">
11722 <p>caption
11723 </p>
11724 </div>
11725 </div></li>
11726 </ul>
11727
11728 !! end
11729
11730 !!test
11731 Gallery override link with absolute external link (bug 34852)
11732 !! input
11733 <gallery>
11734 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
11735 </gallery>
11736 !! result
11737 <ul class="gallery">
11738 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11739 <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>
11740 <div class="gallerytext">
11741 <p>caption
11742 </p>
11743 </div>
11744 </div></li>
11745 </ul>
11746
11747 !! end
11748
11749 !!test
11750 Gallery override link with malicious javascript (bug 34852)
11751 !! input
11752 <gallery>
11753 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
11754 </gallery>
11755 !! result
11756 <ul class="gallery">
11757 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11758 <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>
11759 <div class="gallerytext">
11760 <p>caption
11761 </p>
11762 </div>
11763 </div></li>
11764 </ul>
11765
11766 !! end
11767
11768 !!test
11769 Language parser function
11770 !! input
11771 {{#language:ar}}
11772 !! result
11773 <p>العربية
11774 </p>
11775 !! end
11776
11777 !!test
11778 Padleft and padright as substr
11779 !! input
11780 {{padleft:|3|abcde}}
11781 {{padright:|3|abcde}}
11782 !! result
11783 <p>abc
11784 abc
11785 </p>
11786 !! end
11787
11788 !!test
11789 Bug 34939 - Case insensitive link parsing ([HttP://])
11790 !! input
11791 [HttP://MediaWiki.Org/]
11792 !! result
11793 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
11794 </p>
11795 !! end
11796
11797 !!test
11798 Bug 34939 - Case insensitive link parsing ([HttP:// title])
11799 !! input
11800 [HttP://MediaWiki.Org/ MediaWiki]
11801 !! result
11802 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
11803 </p>
11804 !! end
11805
11806 !!test
11807 Bug 34939 - Case insensitive link parsing (HttP://)
11808 !! input
11809 HttP://MediaWiki.Org/
11810 !! result
11811 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
11812 </p>
11813 !! end
11814
11815 ###
11816 ### Parsoids-specific tests
11817 ### Parsoid-PHP parser incompatibilities
11818 ###
11819 !!test
11820 1. SOL-sensitive wikitext tokens as template-args
11821 !!options
11822 disabled
11823 !!input
11824 {{echo|*a}}
11825 {{echo|#a}}
11826 {{echo|:a}}
11827 !!result
11828 <p>*a
11829 #a
11830 :a
11831 </p>
11832 !!end
11833
11834 #### The following section of tests are primarily to test
11835 #### wikitext escaping capabilities of Parsoid.
11836 #### A lot of the tests are disabled for the PHP parser either
11837 #### because of minor newline diffs or other reasons.
11838 #### As Parsoid serializer can handle newlines and other HTML
11839 #### more robustly, some of these tests might get reenabled
11840 #### for the PHP parser.
11841
11842 #### --------------- Headings ---------------
11843 #### 0. Unnested
11844 #### 1. Nested inside html <h1>=foo=</h1>
11845 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
11846 #### 3. Nested inside html with wikitext split by html tags
11847 #### 4. No escape needed
11848 #### 5. Empty headings <h1></h1>
11849 #### 6. Heading chars in SOL context
11850 #### ----------------------------------------
11851 !! test
11852 Headings: 0. Unnested
11853 !! input
11854 <nowiki>=foo=</nowiki>
11855
11856 <nowiki>=foo</nowiki>''a''=
11857 !! result
11858 <p>=foo=
11859 </p><p>=foo<i>a</i>=
11860 </p>
11861 !!end
11862
11863 !! test
11864 Headings: 1. Nested inside html
11865 !! options
11866 disabled
11867 !! input
11868 =<nowiki>=foo=</nowiki>=
11869 ==<nowiki>=foo=</nowiki>==
11870 ===<nowiki>=foo=</nowiki>===
11871 ====<nowiki>=foo=</nowiki>====
11872 =====<nowiki>=foo=</nowiki>=====
11873 ======<nowiki>=foo=</nowiki>======
11874 !! result
11875 <h1>=foo=</h1>
11876 <h2>=foo=</h2>
11877 <h3>=foo=</h3>
11878 <h4>=foo=</h4>
11879 <h5>=foo=</h5>
11880 <h6>=foo=</h6>
11881 !!end
11882
11883 !! test
11884 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
11885 !! options
11886 disabled
11887 !! input
11888 =foo=
11889 <nowiki>*bar</nowiki>
11890 =foo=
11891 =bar
11892 =foo=
11893 <nowiki>=bar=</nowiki>
11894 !! result
11895 <h1>foo</h1>*bar
11896 <h1>foo</h1>=bar
11897 <h1>foo</h1>=bar=
11898 !!end
11899
11900 !! test
11901 Headings: 3. Nested inside html with wikitext split by html tags
11902 !! options
11903 disabled
11904 !! input
11905 =<nowiki>=</nowiki>'''bold'''foo==
11906 !! result
11907 <h1>=<b>bold</b>foo=</h1>
11908 !!end
11909
11910 !! test
11911 Headings: 4. No escaping needed (testing just h1 and h2)
11912 !! options
11913 disabled
11914 !! input
11915 ==foo=
11916 =foo==
11917 ===foo==
11918 ==foo===
11919 =''=''foo==
11920 ===
11921 !! result
11922 <h1>=foo</h1>
11923 <h1>foo=</h1>
11924 <h2>=foo</h2>
11925 <h2>foo=</h2>
11926 <h1><i>=</i>foo=</h1>
11927 <h1>=</h1>
11928 !!end
11929
11930 !! test
11931 Headings: 5. Empty headings
11932 !! options
11933 disabled
11934 !! input
11935 =<nowiki></nowiki>=
11936 ==<nowiki></nowiki>==
11937 ===<nowiki></nowiki>===
11938 ====<nowiki></nowiki>====
11939 =====<nowiki></nowiki>=====
11940 ======<nowiki></nowiki>======
11941 !! result
11942 <h1></h1>
11943 <h2></h2>
11944 <h3></h3>
11945 <h4></h4>
11946 <h5></h5>
11947 <h6></h6>
11948 !!end
11949
11950 !! test
11951 Headings: 6. Heading chars in SOL context
11952 !! options
11953 disabled
11954 !! input
11955 <!--cmt--><nowiki>=h1=</nowiki>
11956 !! result
11957 <p><!--cmt-->=h1=
11958 </p>
11959 !!end
11960
11961 #### --------------- Lists ---------------
11962 #### 0. Outside nests (*foo, etc.)
11963 #### 1. Nested inside html <ul><li>*foo</li></ul>
11964 #### 2. Inside definition lists
11965 #### 3. Only bullets at start should be escaped
11966 #### 4. No escapes needed
11967 #### 5. No unnecessary escapes
11968 #### 6. Escape bullets in SOL position
11969 #### 7. Escape bullets in a multi-line context
11970 #### ----------------------------------------
11971
11972 !! test
11973 Lists: 0. Outside nests
11974 !! input
11975 <nowiki>*foo</nowiki>
11976
11977 <nowiki>#foo</nowiki>
11978 !! result
11979 <p>*foo
11980 </p><p>#foo
11981 </p>
11982 !!end
11983
11984 !! test
11985 Lists: 1. Nested inside html
11986 !! input
11987 *<nowiki>*foo</nowiki>
11988
11989 *<nowiki>#foo</nowiki>
11990
11991 *<nowiki>:foo</nowiki>
11992
11993 *<nowiki>;foo</nowiki>
11994
11995 #<nowiki>*foo</nowiki>
11996
11997 #<nowiki>#foo</nowiki>
11998
11999 #<nowiki>:foo</nowiki>
12000
12001 #<nowiki>;foo</nowiki>
12002 !! result
12003 <ul><li>*foo
12004 </li></ul>
12005 <ul><li>#foo
12006 </li></ul>
12007 <ul><li>:foo
12008 </li></ul>
12009 <ul><li>;foo
12010 </li></ul>
12011 <ol><li>*foo
12012 </li></ol>
12013 <ol><li>#foo
12014 </li></ol>
12015 <ol><li>:foo
12016 </li></ol>
12017 <ol><li>;foo
12018 </li></ol>
12019
12020 !!end
12021
12022 !! test
12023 Lists: 2. Inside definition lists
12024 !! input
12025 ;<nowiki>;foo</nowiki>
12026
12027 ;<nowiki>:foo</nowiki>
12028
12029 ;<nowiki>:foo</nowiki>
12030 :bar
12031
12032 :<nowiki>:foo</nowiki>
12033 !! result
12034 <dl><dt>;foo
12035 </dt></dl>
12036 <dl><dt>:foo
12037 </dt></dl>
12038 <dl><dt>:foo
12039 </dt><dd>bar
12040 </dd></dl>
12041 <dl><dd>:foo
12042 </dd></dl>
12043
12044 !!end
12045
12046 !! test
12047 Lists: 3. Only bullets at start of text should be escaped
12048 !! input
12049 *<nowiki>*foo*bar</nowiki>
12050
12051 *<nowiki>*foo</nowiki>''it''*bar
12052 !! result
12053 <ul><li>*foo*bar
12054 </li></ul>
12055 <ul><li>*foo<i>it</i>*bar
12056 </li></ul>
12057
12058 !!end
12059
12060 !! test
12061 Lists: 4. No escapes needed
12062 !! options
12063 disabled
12064 !! input
12065 *foo*bar
12066
12067 *''foo''*bar
12068
12069 *[[Foo]]: bar
12070 !! result
12071 <ul><li>foo*bar
12072 </li></ul>
12073 <ul><li><i>foo</i>*bar
12074 </li></ul>
12075 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
12076 </li></ul>
12077 !!end
12078
12079 !! test
12080 Lists: 5. No unnecessary escapes
12081 !! input
12082 * bar <span><nowiki>[[foo]]</nowiki></span>
12083
12084 *=bar <span><nowiki>[[foo]]</nowiki></span>
12085
12086 *[[bar <span><nowiki>[[foo]]</nowiki></span>
12087
12088 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12089
12090 *=bar <span>foo]]</span>=
12091 !! result
12092 <ul><li> bar <span>[[foo]]</span>
12093 </li></ul>
12094 <ul><li>=bar <span>[[foo]]</span>
12095 </li></ul>
12096 <ul><li>[[bar <span>[[foo]]</span>
12097 </li></ul>
12098 <ul><li>]]bar <span>[[foo]]</span>
12099 </li></ul>
12100 <ul><li>=bar <span>foo]]</span>=
12101 </li></ul>
12102
12103 !!end
12104
12105 !! test
12106 Lists: 6. Escape bullets in SOL position
12107 !! options
12108 disabled
12109 !! input
12110 <!--cmt--><nowiki>*foo</nowiki>
12111 !! result
12112 <p><!--cmt-->*foo
12113 </p>
12114 !!end
12115
12116 !! test
12117 Lists: 7. Escape bullets in a multi-line context
12118 !! input
12119 <nowiki>a
12120 *b</nowiki>
12121 !! result
12122 <p>a
12123 *b
12124 </p>
12125 !!end
12126
12127 #### --------------- HRs ---------------
12128 #### 1. Single line
12129 #### -----------------------------------
12130
12131 !! test
12132 HRs: 1. Single line
12133 !! options
12134 disabled
12135 !! input
12136 ----
12137 <nowiki>----</nowiki>
12138 ----
12139 <nowiki>=foo=</nowiki>
12140 ----
12141 <nowiki>*foo</nowiki>
12142 !! result
12143 <hr/>----
12144 <hr/>=foo=
12145 <hr/>*foo
12146 !! end
12147
12148 #### --------------- Tables ---------------
12149 #### 1a. Simple example
12150 #### 1b. No escaping needed (!foo)
12151 #### 1c. No escaping needed (|foo)
12152 #### 1d. No escaping needed (|}foo)
12153 ####
12154 #### 2a. Nested in td (<td>foo|bar</td>)
12155 #### 2b. Nested in td (<td>foo||bar</td>)
12156 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
12157 ####
12158 #### 3a. Nested in th (<th>foo!bar</th>)
12159 #### 3b. Nested in th (<th>foo!!bar</th>)
12160 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
12161 ####
12162 #### 4a. Escape -
12163 #### 4b. Escape +
12164 #### 4c. No escaping needed
12165 #### --------------------------------------
12166
12167 !! test
12168 Tables: 1a. Simple example
12169 !! input
12170 <nowiki>{|
12171 |}</nowiki>
12172 !! result
12173 <p>{|
12174 |}
12175 </p>
12176 !! end
12177
12178 !! test
12179 Tables: 1b. No escaping needed
12180 !! input
12181 !foo
12182 !! result
12183 <p>!foo
12184 </p>
12185 !! end
12186
12187 !! test
12188 Tables: 1c. No escaping needed
12189 !! input
12190 |foo
12191 !! result
12192 <p>|foo
12193 </p>
12194 !! end
12195
12196 !! test
12197 Tables: 1d. No escaping needed
12198 !! input
12199 |}foo
12200 !! result
12201 <p>|}foo
12202 </p>
12203 !! end
12204
12205 !! test
12206 Tables: 2a. Nested in td
12207 !! options
12208 disabled
12209 !! input
12210 {|
12211 |<nowiki>foo|bar</nowiki>
12212 |}
12213 !! result
12214 <table>
12215 <tr><td>foo|bar
12216 </td></tr></table>
12217
12218 !! end
12219
12220 !! test
12221 Tables: 2b. Nested in td
12222 !! options
12223 disabled
12224 !! input
12225 {|
12226 |<nowiki>foo||bar</nowiki>
12227 |''it''<nowiki>foo||bar</nowiki>
12228 |}
12229 !! result
12230 <table>
12231 <tr><td>foo||bar
12232 </td><td><i>it</i>foo||bar
12233 </td></tr></table>
12234
12235 !! end
12236
12237 !! test
12238 Tables: 2c. Nested in td -- no escaping needed
12239 !! options
12240 disabled
12241 !! input
12242 {|
12243 |foo!!bar
12244 |}
12245 !! result
12246 <table>
12247 <tr><td>foo!!bar
12248 </td></tr></table>
12249
12250 !! end
12251
12252 !! test
12253 Tables: 3a. Nested in th
12254 !! options
12255 disabled
12256 !! input
12257 {|
12258 !foo!bar
12259 |}
12260 !! result
12261 <table>
12262 <tr><th>foo!bar
12263 </th></tr></table>
12264
12265 !! end
12266
12267 !! test
12268 Tables: 3b. Nested in th
12269 !! options
12270 disabled
12271 !! input
12272 {|
12273 !<nowiki>foo!!bar</nowiki>
12274 |}
12275 !! result
12276 <table>
12277 <tr><th>foo!!bar
12278 </th></tr></table>
12279
12280 !! end
12281
12282 !! test
12283 Tables: 3c. Nested in th -- no escaping needed
12284 !! options
12285 disabled
12286 !! input
12287 {|
12288 !foo||bar
12289 |}
12290 !! result
12291 <table>
12292 <tr><th>foo||bar
12293 </th></tr></table>
12294
12295 !! end
12296
12297 !! test
12298 Tables: 4a. Escape -
12299 !! options
12300 disabled
12301 !! input
12302 {|
12303 |-
12304 !-bar
12305 |-
12306 |<nowiki>-bar</nowiki>
12307 |}
12308 !! result
12309 <table><tbody>
12310 <tr><th>-bar</th></tr>
12311 <tr><td>-bar</td></tr>
12312 </tbody></table>
12313 !! end
12314
12315 !! test
12316 Tables: 4b. Escape +
12317 !! options
12318 disabled
12319 !! input
12320 {|
12321 |-
12322 !+bar
12323 |-
12324 |<nowiki>+bar</nowiki>
12325 |}
12326 !! result
12327 <table><tbody>
12328 <tr><th>+bar</th></tr>
12329 <tr><td>+bar</td></tr>
12330 </tbody></table>
12331 !! end
12332
12333 !! test
12334 Tables: 4c. No escaping needed
12335 !! options
12336 disabled
12337 !! input
12338 {|
12339 |-
12340 |foo-bar
12341 |foo+bar
12342 |-
12343 |''foo''-bar
12344 |''foo''+bar
12345 |}
12346 !! result
12347 <table><tbody>
12348 <tr><td>foo-bar</td><td>foo+bar</td></tr>
12349 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
12350 </tbody></table>
12351 !! end
12352
12353 #### --------------- Links ---------------
12354 #### 1. Quote marks in link text
12355 #### 2. Wikilinks: Escapes needed
12356 #### 3. Wikilinks: No escapes needed
12357 #### 4. Extlinks: Escapes needed
12358 #### 5. Extlinks: No escapes needed
12359 #### --------------------------------------
12360 !! test
12361 Links 1. Quote marks in link text
12362 !! options
12363 disabled
12364 !! input
12365 [[Foo|<nowiki>Foo''boo''</nowiki>]]
12366 !! result
12367 <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>
12368 !! end
12369
12370 !! test
12371 Links 2. WikiLinks: Escapes needed
12372 !! options
12373 disabled
12374 !! input
12375 [[Foo|<nowiki>[Foobar]</nowiki>]]
12376 [[Foo|<nowiki>Foobar]</nowiki>]]
12377 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
12378 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
12379 [[Foo|<nowiki>[[Bar]]</nowiki>]]
12380 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
12381 [[Foo|<nowiki>|Bar</nowiki>]]
12382 !! result
12383 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
12384 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
12385 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
12386 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
12387 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
12388 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
12389 <a href="Foo" rel="mw:WikiLink">|Bar</a>
12390 !! end
12391
12392 !! test
12393 Links 3. WikiLinks: No escapes needed
12394 !! options
12395 disabled
12396 !! input
12397 [[Foo|[Foobar]]
12398 [[Foo|foo|bar]]
12399 !! result
12400 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
12401 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
12402 !! end
12403
12404 !! test
12405 Links 4. ExtLinks: Escapes needed
12406 !! options
12407 disabled
12408 !! input
12409 [http://google.com <nowiki>[google]</nowiki>]
12410 [http://google.com <nowiki>google]</nowiki>]
12411 !! result
12412 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
12413 <a href="http://google.com" rel="mw:ExtLink">google]</a>
12414 !! end
12415
12416 !! test
12417 Links 5. ExtLinks: No escapes needed
12418 !! options
12419 disabled
12420 !! input
12421 [http://google.com [google]
12422 !! result
12423 <a href="http://google.com" rel="mw:ExtLink">[google</a>
12424 !! end
12425
12426 #### --------------- Quotes ---------------
12427 #### 1. Quotes inside <b> and <i>
12428 #### 2. Link fragments separated by <i> and <b> tags
12429 #### 3. Link fragments inside <i> and <b>
12430 #### --------------------------------------
12431 !! test
12432 1. Quotes inside <b> and <i>
12433 !! input
12434 ''<nowiki>'foo'</nowiki>''
12435 ''<nowiki>''foo''</nowiki>''
12436 ''<nowiki>'''foo'''</nowiki>''
12437 '''<nowiki>'foo'</nowiki>'''
12438 '''<nowiki>''foo''</nowiki>'''
12439 '''<nowiki>'''foo'''</nowiki>'''
12440 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
12441 !! result
12442 <p><i>'foo'</i>
12443 <i>''foo''</i>
12444 <i>'''foo'''</i>
12445 <b>'foo'</b>
12446 <b>''foo''</b>
12447 <b>'''foo'''</b>
12448 <b>foo'<i>bar'</i>baz</b>
12449 </p>
12450 !! end
12451
12452 !! test
12453 2. Link fragments separated by <i> and <b> tags
12454 !! input
12455 [[''foo''<nowiki>hello]]</nowiki>
12456
12457 [['''foo'''<nowiki>hello]]</nowiki>
12458 !! result
12459 <p>[[<i>foo</i>hello]]
12460 </p><p>[[<b>foo</b>hello]]
12461 </p>
12462 !! end
12463
12464 !! test
12465 2. Link fragments inside <i> and <b>
12466 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
12467 this is one of the shortcomings of this format)
12468 !! input
12469 ''[[foo''<nowiki>]]</nowiki>
12470
12471 '''[[foo'''<nowiki>]]</nowiki>
12472 !! result
12473 <p><i>[[foo</i>]]
12474 </p><p><b>[[foo</b>]]
12475 </p>
12476 !! end
12477
12478 #### --------------- Paragraphs ---------------
12479 #### 1. No unnecessary escapes
12480 #### --------------------------------------
12481
12482 !! test
12483 1. No unnecessary escapes
12484 !! input
12485 bar <span><nowiki>[[foo]]</nowiki></span>
12486
12487 =bar <span><nowiki>[[foo]]</nowiki></span>
12488
12489 [[bar <span><nowiki>[[foo]]</nowiki></span>
12490
12491 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12492
12493 <nowiki>=bar </nowiki><span>foo]]</span>=
12494 !! result
12495 <p>bar <span>[[foo]]</span>
12496 </p><p>=bar <span>[[foo]]</span>
12497 </p><p>[[bar <span>[[foo]]</span>
12498 </p><p>]]bar <span>[[foo]]</span>
12499 </p><p>=bar <span>foo]]</span>=
12500 </p>
12501 !!end
12502
12503 #### --------------- PRE ------------------
12504 #### 1. Leading space in SOL context should be escaped
12505 #### --------------------------------------
12506 !! test
12507 1. Leading space in SOL context should be escaped
12508 !! options
12509 disabled
12510 !! input
12511 <nowiki> foo</nowiki>
12512 <!--cmt--><nowiki> foo</nowiki>
12513 !! result
12514 <p> foo
12515 <!--cmt--> foo
12516 </p>
12517 !! end
12518
12519 #### --------------- HTML tags ---------------
12520 #### 1. a tags
12521 #### 2. other tags
12522 #### 3. multi-line html tag
12523 #### --------------------------------------
12524 !! test
12525 1. a tags
12526 !! options
12527 disabled
12528 !! input
12529 <a href="http://google.com">google</a>
12530 !! result
12531 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
12532 !! end
12533
12534 !! test
12535 2. other tags
12536 !! input
12537 <nowiki><div>foo</div>
12538 <div style="color:red">foo</div></nowiki>
12539 !! result
12540 <p>&lt;div&gt;foo&lt;/div&gt;
12541 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
12542 </p>
12543 !! end
12544
12545 !! test
12546 3. multi-line html tag
12547 !! input
12548 <nowiki><div
12549 >foo</div
12550 ></nowiki>
12551 !! result
12552 <p>&lt;div
12553 &gt;foo&lt;/div
12554 &gt;
12555 </p>
12556 !! end
12557
12558 #### --------------- Others ---------------
12559 !! test
12560 Escaping nowikis
12561 !! input
12562 &lt;nowiki&gt;foo&lt;/nowiki&gt;
12563 !! result
12564 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
12565 </p>
12566 !! end
12567
12568 TODO:
12569 more images
12570 more tables
12571 character entities
12572 and much more
12573 Try for 100% code coverage