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