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