Merge "Correcting system message linksearch-text"
[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 ###
6221 ### Inter-language links
6222 ###
6223 !! test
6224 Inter-language links
6225 !! options
6226 ill
6227 !! input
6228 [[es:Alimento]]
6229 [[fr:Nourriture]]
6230 [[zh:&#39135;&#21697;]]
6231 !! result
6232 es:Alimento fr:Nourriture zh:食品
6233 !! end
6234
6235 !! test
6236 Duplicate interlanguage links (bug 24502)
6237 !! options
6238 ill
6239 !! input
6240 [[es:1]]
6241 [[es:2]]
6242 [[fr:1]]
6243 [[fr:2]]
6244 !! result
6245 es:1 fr:1
6246 !! end
6247
6248 ###
6249 ### Sections
6250 ###
6251 !! test
6252 Basic section headings
6253 !! input
6254 == Headline 1 ==
6255 Some text
6256
6257 ==Headline 2==
6258 More
6259 ===Smaller headline===
6260 Blah blah
6261 !! result
6262 <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>
6263 <p>Some text
6264 </p>
6265 <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>
6266 <p>More
6267 </p>
6268 <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>
6269 <p>Blah blah
6270 </p>
6271 !! end
6272
6273 !! test
6274 Section headings with TOC
6275 !! input
6276 == Headline 1 ==
6277 === Subheadline 1 ===
6278 ===== Skipping a level =====
6279 ====== Skipping a level ======
6280
6281 == Headline 2 ==
6282 Some text
6283 ===Another headline===
6284 !! result
6285 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6286 <ul>
6287 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
6288 <ul>
6289 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
6290 <ul>
6291 <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>
6292 <ul>
6293 <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>
6294 </ul>
6295 </li>
6296 </ul>
6297 </li>
6298 </ul>
6299 </li>
6300 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
6301 <ul>
6302 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
6303 </ul>
6304 </li>
6305 </ul>
6306 </td></tr></table>
6307 <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>
6308 <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>
6309 <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>
6310 <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>
6311 <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>
6312 <p>Some text
6313 </p>
6314 <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>
6315
6316 !! end
6317
6318 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
6319 !! test
6320 Handling of sections up to level 6 and beyond
6321 !! input
6322 = Level 1 Heading=
6323 == Level 2 Heading==
6324 === Level 3 Heading===
6325 ==== Level 4 Heading====
6326 ===== Level 5 Heading=====
6327 ====== Level 6 Heading======
6328 ======= Level 7 Heading=======
6329 ======== Level 8 Heading========
6330 ========= Level 9 Heading=========
6331 ========== Level 10 Heading==========
6332 !! result
6333 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6334 <ul>
6335 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
6336 <ul>
6337 <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>
6338 <ul>
6339 <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>
6340 <ul>
6341 <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>
6342 <ul>
6343 <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>
6344 <ul>
6345 <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>
6346 <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>
6347 <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>
6348 <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>
6349 <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>
6350 </ul>
6351 </li>
6352 </ul>
6353 </li>
6354 </ul>
6355 </li>
6356 </ul>
6357 </li>
6358 </ul>
6359 </li>
6360 </ul>
6361 </td></tr></table>
6362 <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>
6363 <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>
6364 <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>
6365 <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>
6366 <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>
6367 <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>
6368 <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>
6369 <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>
6370 <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>
6371 <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>
6372
6373 !! end
6374
6375 !! test
6376 TOC regression (bug 9764)
6377 !! input
6378 == title 1 ==
6379 === title 1.1 ===
6380 ==== title 1.1.1 ====
6381 === title 1.2 ===
6382 == title 2 ==
6383 === title 2.1 ===
6384 !! result
6385 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6386 <ul>
6387 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6388 <ul>
6389 <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>
6390 <ul>
6391 <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>
6392 </ul>
6393 </li>
6394 <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>
6395 </ul>
6396 </li>
6397 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6398 <ul>
6399 <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>
6400 </ul>
6401 </li>
6402 </ul>
6403 </td></tr></table>
6404 <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>
6405 <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>
6406 <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>
6407 <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>
6408 <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>
6409 <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>
6410
6411 !! end
6412
6413 !! test
6414 TOC with wgMaxTocLevel=3 (bug 6204)
6415 !! options
6416 wgMaxTocLevel=3
6417 !! input
6418 == title 1 ==
6419 === title 1.1 ===
6420 ==== title 1.1.1 ====
6421 === title 1.2 ===
6422 == title 2 ==
6423 === title 2.1 ===
6424 !! result
6425 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6426 <ul>
6427 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6428 <ul>
6429 <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>
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 and two level four headings (bug 6204)
6451 !! options
6452 wgMaxTocLevel=3
6453 !! input
6454 ==Section 1==
6455 ===Section 1.1===
6456 ====Section 1.1.1====
6457 ====Section 1.1.1.1====
6458 ==Section 2==
6459 !! result
6460 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6461 <ul>
6462 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
6463 <ul>
6464 <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>
6465 </ul>
6466 </li>
6467 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
6468 </ul>
6469 </td></tr></table>
6470 <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>
6471 <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>
6472 <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>
6473 <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>
6474 <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>
6475
6476 !! end
6477
6478
6479 !! test
6480 Resolving duplicate section names
6481 !! input
6482 == Foo bar ==
6483 == Foo bar ==
6484 !! result
6485 <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>
6486 <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>
6487
6488 !! end
6489
6490 !! test
6491 Resolving duplicate section names with differing case (bug 10721)
6492 !! input
6493 == Foo bar ==
6494 == Foo Bar ==
6495 !! result
6496 <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>
6497 <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>
6498
6499 !! end
6500
6501 !! article
6502 Template:sections
6503 !! text
6504 ===Section 1===
6505 ==Section 2==
6506 !! endarticle
6507
6508 !! test
6509 Template with sections, __NOTOC__
6510 !! input
6511 __NOTOC__
6512 ==Section 0==
6513 {{sections}}
6514 ==Section 4==
6515 !! result
6516 <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>
6517 <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>
6518 <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>
6519 <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>
6520
6521 !! end
6522
6523 !! test
6524 __NOEDITSECTION__ keyword
6525 !! input
6526 __NOEDITSECTION__
6527 ==Section 1==
6528 ==Section 2==
6529 !! result
6530 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
6531 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
6532
6533 !! end
6534
6535 !! test
6536 Link inside a section heading
6537 !! input
6538 ==Section with a [[Main Page|link]] in it==
6539 !! result
6540 <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>
6541
6542 !! end
6543
6544 !! test
6545 TOC regression (bug 12077)
6546 !! input
6547 __TOC__
6548 == title 1 ==
6549 === title 1.1 ===
6550 == title 2 ==
6551 !! result
6552 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6553 <ul>
6554 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6555 <ul>
6556 <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>
6557 </ul>
6558 </li>
6559 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
6560 </ul>
6561 </td></tr></table>
6562 <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>
6563 <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>
6564 <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>
6565
6566 !! end
6567
6568 !! test
6569 BUG 1219 URL next to image (good)
6570 !! input
6571 http://example.com [[Image:foobar.jpg]]
6572 !! result
6573 <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>
6574 </p>
6575 !!end
6576
6577 !! test
6578 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
6579 !! input
6580 ===
6581 The line above must have a trailing space!
6582 === <!--
6583 --> <!-- -->
6584 But just in case it doesn't...
6585 !! result
6586 <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>
6587 <p>The line above must have a trailing space!
6588 </p>
6589 <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>
6590 <p>But just in case it doesn't...
6591 </p>
6592 !! end
6593
6594 !! test
6595 Header with special characters (bug 25462)
6596 !! input
6597 The tooltips shall not show entities to the user (ie. be double escaped)
6598
6599 == text > text ==
6600 section 1
6601
6602 == text < text ==
6603 section 2
6604
6605 == text & text ==
6606 section 3
6607
6608 == text ' text ==
6609 section 4
6610
6611 == text " text ==
6612 section 5
6613 !! result
6614 <p>The tooltips shall not show entities to the user (ie. be double escaped)
6615 </p>
6616 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6617 <ul>
6618 <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>
6619 <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>
6620 <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>
6621 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
6622 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
6623 </ul>
6624 </td></tr></table>
6625 <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>
6626 <p>section 1
6627 </p>
6628 <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>
6629 <p>section 2
6630 </p>
6631 <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>
6632 <p>section 3
6633 </p>
6634 <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>
6635 <p>section 4
6636 </p>
6637 <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>
6638 <p>section 5
6639 </p>
6640 !! end
6641
6642 !! test
6643 Headers with excess '=' characters
6644 (Are similar tests necessary beyond the 1st level?)
6645 !! input
6646 =foo==
6647 ==foo=
6648 =''italic'' heading==
6649 ==''italic'' heading=
6650 !! result
6651 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6652 <ul>
6653 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
6654 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
6655 <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>
6656 <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>
6657 </ul>
6658 </td></tr></table>
6659 <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>
6660 <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>
6661 <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>
6662 <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>
6663
6664 !! end
6665
6666 !! test
6667 BUG 1219 URL next to image (broken)
6668 !! input
6669 http://example.com[[Image:foobar.jpg]]
6670 !! result
6671 <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>
6672 </p>
6673 !!end
6674
6675 !! test
6676 Bug 1186 news: in the middle of text
6677 !! input
6678 http://en.wikinews.org/wiki/Wikinews:Workplace
6679 !! result
6680 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
6681 </p>
6682 !!end
6683
6684
6685 !! test
6686 Namespaced link must have a title
6687 !! input
6688 [[Project:]]
6689 !! result
6690 <p>[[Project:]]
6691 </p>
6692 !!end
6693
6694 !! test
6695 Namespaced link must have a title (bad fragment version)
6696 !! input
6697 [[Project:#fragment]]
6698 !! result
6699 <p>[[Project:#fragment]]
6700 </p>
6701 !!end
6702
6703
6704 !! test
6705 div with no attributes
6706 !! input
6707 <div>HTML rocks</div>
6708 !! result
6709 <div>HTML rocks</div>
6710
6711 !! end
6712
6713 !! test
6714 div with double-quoted attribute
6715 !! input
6716 <div id="rock">HTML rocks</div>
6717 !! result
6718 <div id="rock">HTML rocks</div>
6719
6720 !! end
6721
6722 !! test
6723 div with single-quoted attribute
6724 !! input
6725 <div id='rock'>HTML rocks</div>
6726 !! result
6727 <div id="rock">HTML rocks</div>
6728
6729 !! end
6730
6731 !! test
6732 div with unquoted attribute
6733 !! input
6734 <div id=rock>HTML rocks</div>
6735 !! result
6736 <div id="rock">HTML rocks</div>
6737
6738 !! end
6739
6740 !! test
6741 div with illegal double attributes
6742 !! input
6743 <div id="a" id="b">HTML rocks</div>
6744 !! result
6745 <div id="b">HTML rocks</div>
6746
6747 !!end
6748
6749 !! test
6750 HTML multiple attributes correction
6751 !! input
6752 <p class="error" class="awesome">Awesome!</p>
6753 !! result
6754 <p class="awesome">Awesome!</p>
6755
6756 !!end
6757
6758 !! test
6759 Table multiple attributes correction
6760 !! input
6761 {|
6762 !+ class="error" class="awesome"| status
6763 |}
6764 !! result
6765 <table>
6766 <tr>
6767 <th class="awesome"> status
6768 </th></tr></table>
6769
6770 !!end
6771
6772 !! test
6773 DIV IN UPPERCASE
6774 !! input
6775 <DIV ID="x">HTML ROCKS</DIV>
6776 !! result
6777 <div id="x">HTML ROCKS</div>
6778
6779 !!end
6780
6781
6782 !! test
6783 text with amp in the middle of nowhere
6784 !! input
6785 Remember AT&T?
6786 !!result
6787 <p>Remember AT&amp;T?
6788 </p>
6789 !! end
6790
6791 !! test
6792 text with character entity: eacute
6793 !! input
6794 I always thought &eacute; was a cute letter.
6795 !! result
6796 <p>I always thought &#233; was a cute letter.
6797 </p>
6798 !! end
6799
6800 !! test
6801 text with undefined character entity: xacute
6802 !! input
6803 I always thought &xacute; was a cute letter.
6804 !! result
6805 <p>I always thought &amp;xacute; was a cute letter.
6806 </p>
6807 !! end
6808
6809
6810 ###
6811 ### Media links
6812 ###
6813
6814 !! test
6815 Media link
6816 !! input
6817 [[Media:Foobar.jpg]]
6818 !! result
6819 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
6820 </p>
6821 !! end
6822
6823 !! test
6824 Media link with text
6825 !! input
6826 [[Media:Foobar.jpg|A neat file to look at]]
6827 !! result
6828 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
6829 </p>
6830 !! end
6831
6832 # FIXME: this is still bad HTML tag nesting
6833 !! test
6834 Media link with nasty text
6835 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
6836 !! input
6837 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
6838 !! result
6839 <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>
6840
6841 !! end
6842
6843 !! test
6844 Media link to nonexistent file (bug 1702)
6845 !! input
6846 [[Media:No such.jpg]]
6847 !! result
6848 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
6849 </p>
6850 !! end
6851
6852 !! test
6853 Image link to nonexistent file (bug 1850 - good)
6854 !! input
6855 [[Image:No such.jpg]]
6856 !! result
6857 <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>
6858 </p>
6859 !! end
6860
6861 !! test
6862 :Image link to nonexistent file (bug 1850 - bad)
6863 !! input
6864 [[:Image:No such.jpg]]
6865 !! result
6866 <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>
6867 </p>
6868 !! end
6869
6870
6871
6872 !! test
6873 Character reference normalization in link text (bug 1938)
6874 !! input
6875 [[Main Page|this&that]]
6876 !! result
6877 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
6878 </p>
6879 !!end
6880
6881 !! article
6882 אַ
6883 !! text
6884 Test for unicode normalization
6885
6886 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
6887 !! endarticle
6888
6889 !! test
6890 (bug 19451) Links should refer to the normalized form.
6891 !! input
6892 [[&#xFB2E;]]
6893 [[&#x5d0;&#x5b7;]]
6894 [[&#x5d0;ַ]]
6895 [[א&#x5b7;]]
6896 [[אַ]]
6897 !! result
6898 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
6899 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
6900 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
6901 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
6902 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
6903 </p>
6904 !! end
6905
6906 !! test
6907 Empty attribute crash test (bug 2067)
6908 !! input
6909 <font color="">foo</font>
6910 !! result
6911 <p><font color="">foo</font>
6912 </p>
6913 !! end
6914
6915 !! test
6916 Empty attribute crash test single-quotes (bug 2067)
6917 !! input
6918 <font color=''>foo</font>
6919 !! result
6920 <p><font color="">foo</font>
6921 </p>
6922 !! end
6923
6924 !! test
6925 Attribute test: equals, then nothing
6926 !! input
6927 <font color=>foo</font>
6928 !! result
6929 <p><font>foo</font>
6930 </p>
6931 !! end
6932
6933 !! test
6934 Attribute test: unquoted value
6935 !! input
6936 <font color=x>foo</font>
6937 !! result
6938 <p><font color="x">foo</font>
6939 </p>
6940 !! end
6941
6942 !! test
6943 Attribute test: unquoted but illegal value (hash)
6944 !! input
6945 <font color=#x>foo</font>
6946 !! result
6947 <p><font color="#x">foo</font>
6948 </p>
6949 !! end
6950
6951 !! test
6952 Attribute test: no value
6953 !! input
6954 <font color>foo</font>
6955 !! result
6956 <p><font color="color">foo</font>
6957 </p>
6958 !! end
6959
6960 !! test
6961 Bug 2095: link with three closing brackets
6962 !! input
6963 [[Main Page]]]
6964 !! result
6965 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
6966 </p>
6967 !! end
6968
6969 !! test
6970 Bug 2095: link with pipe and three closing brackets
6971 !! input
6972 [[Main Page|link]]]
6973 !! result
6974 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
6975 </p>
6976 !! end
6977
6978 !! test
6979 Bug 2095: link with pipe and three closing brackets, version 2
6980 !! input
6981 [[Main Page|[http://example.com/]]]
6982 !! result
6983 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
6984 </p>
6985 !! end
6986
6987
6988 ###
6989 ### Safety
6990 ###
6991
6992 !! article
6993 Template:Dangerous attribute
6994 !! text
6995 " onmouseover="alert(document.cookie)
6996 !! endarticle
6997
6998 !! article
6999 Template:Dangerous style attribute
7000 !! text
7001 border-size: expression(alert(document.cookie))
7002 !! endarticle
7003
7004 !! article
7005 Template:Div style
7006 !! text
7007 <div style="float: right; {{{1}}}">Magic div</div>
7008 !! endarticle
7009
7010 !! test
7011 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
7012 !! input
7013 <div title="{{test}}"></div>
7014 !! result
7015 <div title="This is a test template"></div>
7016
7017 !! end
7018
7019 !! test
7020 Bug 2304: HTML attribute safety (dangerous template; 2309)
7021 !! input
7022 <div title="{{dangerous attribute}}"></div>
7023 !! result
7024 <div title=""></div>
7025
7026 !! end
7027
7028 !! test
7029 Bug 2304: HTML attribute safety (dangerous style template; 2309)
7030 !! input
7031 <div style="{{dangerous style attribute}}"></div>
7032 !! result
7033 <div style="/* insecure input */"></div>
7034
7035 !! end
7036
7037 !! test
7038 Bug 2304: HTML attribute safety (safe parameter; 2309)
7039 !! input
7040 {{div style|width: 200px}}
7041 !! result
7042 <div style="float: right; width: 200px">Magic div</div>
7043
7044 !! end
7045
7046 !! test
7047 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
7048 !! input
7049 {{div style|width: expression(alert(document.cookie))}}
7050 !! result
7051 <div style="/* insecure input */">Magic div</div>
7052
7053 !! end
7054
7055 !! test
7056 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
7057 !! input
7058 {{div style|"><script>alert(document.cookie)</script>}}
7059 !! result
7060 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7061
7062 !! end
7063
7064 !! test
7065 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
7066 !! input
7067 {{div style|" ><script>alert(document.cookie)</script>}}
7068 !! result
7069 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7070
7071 !! end
7072
7073 !! test
7074 Bug 2304: HTML attribute safety (link)
7075 !! input
7076 <div title="[[Main Page]]"></div>
7077 !! result
7078 <div title="&#91;&#91;Main Page]]"></div>
7079
7080 !! end
7081
7082 !! test
7083 Bug 2304: HTML attribute safety (italics)
7084 !! input
7085 <div title="''foobar''"></div>
7086 !! result
7087 <div title="&#39;&#39;foobar&#39;&#39;"></div>
7088
7089 !! end
7090
7091 !! test
7092 Bug 2304: HTML attribute safety (bold)
7093 !! input
7094 <div title="'''foobar'''"></div>
7095 !! result
7096 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
7097
7098 !! end
7099
7100
7101 !! test
7102 Bug 2304: HTML attribute safety (ISBN)
7103 !! input
7104 <div title="ISBN 1234567890"></div>
7105 !! result
7106 <div title="&#73;SBN 1234567890"></div>
7107
7108 !! end
7109
7110 !! test
7111 Bug 2304: HTML attribute safety (RFC)
7112 !! input
7113 <div title="RFC 1234"></div>
7114 !! result
7115 <div title="&#82;FC 1234"></div>
7116
7117 !! end
7118
7119 !! test
7120 Bug 2304: HTML attribute safety (PMID)
7121 !! input
7122 <div title="PMID 1234567890"></div>
7123 !! result
7124 <div title="&#80;MID 1234567890"></div>
7125
7126 !! end
7127
7128 !! test
7129 Bug 2304: HTML attribute safety (web link)
7130 !! input
7131 <div title="http://example.com/"></div>
7132 !! result
7133 <div title="http&#58;//example.com/"></div>
7134
7135 !! end
7136
7137 !! test
7138 Bug 2304: HTML attribute safety (named web link)
7139 !! input
7140 <div title="[http://example.com/ link]"></div>
7141 !! result
7142 <div title="&#91;http&#58;//example.com/ link]"></div>
7143
7144 !! end
7145
7146 !! test
7147 Bug 3244: HTML attribute safety (extension; safe)
7148 !! input
7149 <div style="<nowiki>background:blue</nowiki>"></div>
7150 !! result
7151 <div style="background:blue"></div>
7152
7153 !! end
7154
7155 !! test
7156 Bug 3244: HTML attribute safety (extension; unsafe)
7157 !! input
7158 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
7159 !! result
7160 <div style="/* insecure input */"></div>
7161
7162 !! end
7163
7164 # More MSIE fun discovered by Tom Gilder
7165
7166 !! test
7167 MSIE CSS safety test: spurious slash
7168 !! input
7169 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
7170 !! result
7171 <div style="/* insecure input */">evil</div>
7172
7173 !! end
7174
7175 !! test
7176 MSIE CSS safety test: hex code
7177 !! input
7178 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
7179 !! result
7180 <div style="/* insecure input */">evil</div>
7181
7182 !! end
7183
7184 !! test
7185 MSIE CSS safety test: comment in url
7186 !! input
7187 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
7188 !! result
7189 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
7190
7191 !! end
7192
7193 !! test
7194 MSIE CSS safety test: comment in expression
7195 !! input
7196 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
7197 !! result
7198 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
7199
7200 !! end
7201
7202
7203 !! test
7204 Table attribute legitimate extension
7205 !! input
7206 {|
7207 !+ style="<nowiki>color:blue</nowiki>"| status
7208 |}
7209 !! result
7210 <table>
7211 <tr>
7212 <th style="color:blue"> status
7213 </th></tr></table>
7214
7215 !!end
7216
7217 !! test
7218 Table attribute safety
7219 !! input
7220 {|
7221 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
7222 |}
7223 !! result
7224 <table>
7225 <tr>
7226 <th style="/* insecure input */"> status
7227 </th></tr></table>
7228
7229 !! end
7230
7231 !! test
7232 CSS line continuation 1
7233 !! input
7234 <div style="background-image: u\&#10;rl(test.jpg);"></div>
7235 !! result
7236 <div style="/* insecure input */"></div>
7237
7238 !! end
7239
7240 !! test
7241 CSS line continuation 2
7242 !! input
7243 <div style="background-image: u\&#13;rl(test.jpg); "></div>
7244 !! result
7245 <div style="/* insecure input */"></div>
7246
7247 !! end
7248
7249 !! article
7250 Template:Identity
7251 !! text
7252 {{{1}}}
7253 !! endarticle
7254
7255 !! test
7256 Expansion of multi-line templates in attribute values (bug 6255)
7257 !! input
7258 <div style="background: {{identity|#00FF00}}">-</div>
7259 !! result
7260 <div style="background: #00FF00">-</div>
7261
7262 !! end
7263
7264
7265 !! test
7266 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
7267 !! input
7268 <div style="background:
7269 #00FF00">-</div>
7270 !! result
7271 <div style="background: #00FF00">-</div>
7272
7273 !! end
7274
7275 !! test
7276 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
7277 !! input
7278 <div style="background: &#10;#00FF00">-</div>
7279 !! result
7280 <div style="background: &#10;#00FF00">-</div>
7281
7282 !! end
7283
7284 ###
7285 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
7286 ###
7287 !! test
7288 Parser hook: empty input
7289 !! input
7290 <tag></tag>
7291 !! result
7292 <pre>
7293 ''
7294 array (
7295 )
7296 </pre>
7297
7298 !! end
7299
7300 !! test
7301 Parser hook: empty input using terminated empty elements
7302 !! input
7303 <tag/>
7304 !! result
7305 <pre>
7306 NULL
7307 array (
7308 )
7309 </pre>
7310
7311 !! end
7312
7313 !! test
7314 Parser hook: empty input using terminated empty elements (space before)
7315 !! input
7316 <tag />
7317 !! result
7318 <pre>
7319 NULL
7320 array (
7321 )
7322 </pre>
7323
7324 !! end
7325
7326 !! test
7327 Parser hook: basic input
7328 !! input
7329 <tag>input</tag>
7330 !! result
7331 <pre>
7332 'input'
7333 array (
7334 )
7335 </pre>
7336
7337 !! end
7338
7339
7340 !! test
7341 Parser hook: case insensitive
7342 !! input
7343 <TAG>input</TAG>
7344 !! result
7345 <pre>
7346 'input'
7347 array (
7348 )
7349 </pre>
7350
7351 !! end
7352
7353
7354 !! test
7355 Parser hook: case insensitive, redux
7356 !! input
7357 <TaG>input</TAg>
7358 !! result
7359 <pre>
7360 'input'
7361 array (
7362 )
7363 </pre>
7364
7365 !! end
7366
7367 !! test
7368 Parser hook: nested tags
7369 !! options
7370 noxml
7371 !! input
7372 <tag><tag></tag></tag>
7373 !! result
7374 <pre>
7375 '<tag>'
7376 array (
7377 )
7378 </pre>&lt;/tag&gt;
7379
7380 !! end
7381
7382 !! test
7383 Parser hook: basic arguments
7384 !! input
7385 <tag width=200 height = "100" depth = '50' square></tag>
7386 !! result
7387 <pre>
7388 ''
7389 array (
7390 'width' => '200',
7391 'height' => '100',
7392 'depth' => '50',
7393 'square' => 'square',
7394 )
7395 </pre>
7396
7397 !! end
7398
7399 !! test
7400 Parser hook: argument containing a forward slash (bug 5344)
7401 !! input
7402 <tag filename='/tmp/bla'></tag>
7403 !! result
7404 <pre>
7405 ''
7406 array (
7407 'filename' => '/tmp/bla',
7408 )
7409 </pre>
7410
7411 !! end
7412
7413 !! test
7414 Parser hook: empty input using terminated empty elements (bug 2374)
7415 !! input
7416 <tag foo=bar/>text
7417 !! result
7418 <pre>
7419 NULL
7420 array (
7421 'foo' => 'bar',
7422 )
7423 </pre>text
7424
7425 !! end
7426
7427 # </tag> should be output literally since there is no matching tag that begins it
7428 !! test
7429 Parser hook: basic arguments using terminated empty elements (bug 2374)
7430 !! input
7431 <tag width=200 height = "100" depth = '50' square/>
7432 other stuff
7433 </tag>
7434 !! result
7435 <pre>
7436 NULL
7437 array (
7438 'width' => '200',
7439 'height' => '100',
7440 'depth' => '50',
7441 'square' => 'square',
7442 )
7443 </pre>
7444 <p>other stuff
7445 &lt;/tag&gt;
7446 </p>
7447 !! end
7448
7449 ###
7450 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
7451 ###
7452
7453 !! test
7454 Parser hook: static parser hook not inside a comment
7455 !! input
7456 <statictag>hello, world</statictag>
7457 <statictag action=flush/>
7458 !! result
7459 <p>hello, world
7460 </p>
7461 !! end
7462
7463
7464 !! test
7465 Parser hook: static parser hook inside a comment
7466 !! input
7467 <!-- <statictag>hello, world</statictag> -->
7468 <statictag action=flush/>
7469 !! result
7470 <p><br />
7471 </p>
7472 !! end
7473
7474 # Nested template calls; this case was broken by Parser.php rev 1.506,
7475 # since reverted.
7476
7477 !! article
7478 Template:One-parameter
7479 !! text
7480 (My parameter is: {{{1}}})
7481 !! endarticle
7482
7483 !! article
7484 Template:Map-one-parameter
7485 !! text
7486 {{{{{1}}}|{{{2}}}}}
7487 !! endarticle
7488
7489 !! test
7490 Nested template calls
7491 !! input
7492 {{Map-one-parameter|One-parameter|param}}
7493 !! result
7494 <p>(My parameter is: param)
7495 </p>
7496 !! end
7497
7498
7499 ###
7500 ### Sanitizer
7501 ###
7502 !! test
7503 Sanitizer: Closing of open tags
7504 !! input
7505 <s></s><table></table>
7506 !! result
7507 <s></s><table></table>
7508
7509 !! end
7510
7511 !! test
7512 Sanitizer: Closing of open but not closed tags
7513 !! input
7514 <s>foo
7515 !! result
7516 <p><s>foo</s>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Sanitizer: Closing of closed but not open tags
7522 !! input
7523 </s>
7524 !! result
7525 <p>&lt;/s&gt;
7526 </p>
7527 !! end
7528
7529 !! test
7530 Sanitizer: Closing of closed but not open table tags
7531 !! input
7532 Table not started</td></tr></table>
7533 !! result
7534 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
7535 </p>
7536 !! end
7537
7538 !! test
7539 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
7540 !! input
7541 <span id="æ: v">byte</span>[[#æ: v|backlink]]
7542 !! result
7543 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
7544 </p>
7545 !! end
7546
7547 !! test
7548 Sanitizer: Validating the contents of the id attribute (bug 4515)
7549 !! options
7550 disabled
7551 !! input
7552 <br id=9 />
7553 !! result
7554 Something, but definitely not <br id="9" />...
7555 !! end
7556
7557 !! test
7558 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
7559 !! options
7560 disabled
7561 !! input
7562 <br id="foo" /><br id="foo" />
7563 !! result
7564 Something need to be done. foo-2 ?
7565 !! end
7566
7567 !! test
7568 Language converter: output gets cut off unexpectedly (bug 5757)
7569 !! options
7570 language=zh
7571 !! input
7572 this bit is safe: }-
7573
7574 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
7575
7576 then we get cut off here: }-
7577
7578 all additional text is vanished
7579 !! result
7580 <p>this bit is safe: }-
7581 </p><p>but if we add a conversion instance: xxx
7582 </p><p>then we get cut off here: }-
7583 </p><p>all additional text is vanished
7584 </p>
7585 !! end
7586
7587 !! test
7588 Self closed html pairs (bug 5487)
7589 !! options
7590 !! input
7591 <center><font id="bug" />Centered text</center>
7592 <div><font id="bug2" />In div text</div>
7593 !! result
7594 <center>&lt;font id="bug" /&gt;Centered text</center>
7595 <div>&lt;font id="bug2" /&gt;In div text</div>
7596
7597 !! end
7598
7599 #
7600 #
7601 #
7602
7603 !! test
7604 Punctuation: nbsp before exclamation
7605 !! input
7606 C'est grave !
7607 !! result
7608 <p>C'est grave&#160;!
7609 </p>
7610 !! end
7611
7612 !! test
7613 Punctuation: CSS !important (bug 11874)
7614 !! input
7615 <div style="width:50% !important">important</div>
7616 !! result
7617 <div style="width:50% !important">important</div>
7618
7619 !!end
7620
7621 !! test
7622 Punctuation: CSS ! important (bug 11874; with space after)
7623 !! input
7624 <div style="width:50% ! important">important</div>
7625 !! result
7626 <div style="width:50% ! important">important</div>
7627
7628 !!end
7629
7630
7631 !! test
7632 HTML bullet list, closed tags (bug 5497)
7633 !! input
7634 <ul>
7635 <li>One</li>
7636 <li>Two</li>
7637 </ul>
7638 !! result
7639 <ul>
7640 <li>One</li>
7641 <li>Two</li>
7642 </ul>
7643
7644 !! end
7645
7646 !! test
7647 HTML bullet list, unclosed tags (bug 5497)
7648 !! options
7649 disabled
7650 !! input
7651 <ul>
7652 <li>One
7653 <li>Two
7654 </ul>
7655 !! result
7656 <ul>
7657 <li>One
7658 </li><li>Two
7659 </li></ul>
7660
7661 !! end
7662
7663 !! test
7664 HTML ordered list, closed tags (bug 5497)
7665 !! input
7666 <ol>
7667 <li>One</li>
7668 <li>Two</li>
7669 </ol>
7670 !! result
7671 <ol>
7672 <li>One</li>
7673 <li>Two</li>
7674 </ol>
7675
7676 !! end
7677
7678 !! test
7679 HTML ordered list, unclosed tags (bug 5497)
7680 !! options
7681 disabled
7682 !! input
7683 <ol>
7684 <li>One
7685 <li>Two
7686 </ol>
7687 !! result
7688 <ol>
7689 <li>One
7690 </li><li>Two
7691 </li></ol>
7692
7693 !! end
7694
7695 !! test
7696 HTML nested bullet list, closed tags (bug 5497)
7697 !! input
7698 <ul>
7699 <li>One</li>
7700 <li>Two:
7701 <ul>
7702 <li>Sub-one</li>
7703 <li>Sub-two</li>
7704 </ul>
7705 </li>
7706 </ul>
7707 !! result
7708 <ul>
7709 <li>One</li>
7710 <li>Two:
7711 <ul>
7712 <li>Sub-one</li>
7713 <li>Sub-two</li>
7714 </ul>
7715 </li>
7716 </ul>
7717
7718 !! end
7719
7720 !! test
7721 HTML nested bullet list, open tags (bug 5497)
7722 !! options
7723 disabled
7724 !! input
7725 <ul>
7726 <li>One
7727 <li>Two:
7728 <ul>
7729 <li>Sub-one
7730 <li>Sub-two
7731 </ul>
7732 </ul>
7733 !! result
7734 <ul>
7735 <li>One
7736 </li><li>Two:
7737 <ul>
7738 <li>Sub-one
7739 </li><li>Sub-two
7740 </li></ul>
7741 </li></ul>
7742
7743 !! end
7744
7745 !! test
7746 HTML nested ordered list, closed tags (bug 5497)
7747 !! input
7748 <ol>
7749 <li>One</li>
7750 <li>Two:
7751 <ol>
7752 <li>Sub-one</li>
7753 <li>Sub-two</li>
7754 </ol>
7755 </li>
7756 </ol>
7757 !! result
7758 <ol>
7759 <li>One</li>
7760 <li>Two:
7761 <ol>
7762 <li>Sub-one</li>
7763 <li>Sub-two</li>
7764 </ol>
7765 </li>
7766 </ol>
7767
7768 !! end
7769
7770 !! test
7771 HTML nested ordered list, open tags (bug 5497)
7772 !! options
7773 disabled
7774 !! input
7775 <ol>
7776 <li>One
7777 <li>Two:
7778 <ol>
7779 <li>Sub-one
7780 <li>Sub-two
7781 </ol>
7782 </ol>
7783 !! result
7784 <ol>
7785 <li>One
7786 </li><li>Two:
7787 <ol>
7788 <li>Sub-one
7789 </li><li>Sub-two
7790 </li></ol>
7791 </li></ol>
7792
7793 !! end
7794
7795 !! test
7796 HTML ordered list item with parameters oddity
7797 !! input
7798 <ol><li id="fragment">One</li></ol>
7799 !! result
7800 <ol><li id="fragment">One</li></ol>
7801
7802 !! end
7803
7804 !!test
7805 bug 5918: autonumbering
7806 !! input
7807 [http://first/] [http://second] [ftp://ftp]
7808
7809 ftp://inlineftp
7810
7811 [mailto:enclosed@mail.tld With target]
7812
7813 [mailto:enclosed@mail.tld]
7814
7815 mailto:inline@mail.tld
7816 !! result
7817 <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>
7818 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
7819 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
7820 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
7821 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
7822 </p>
7823 !! end
7824
7825
7826 #
7827 # Security and HTML correctness
7828 # From Nick Jenkins' fuzz testing
7829 #
7830
7831 !! test
7832 Fuzz testing: Parser13
7833 !! input
7834 {|
7835 | http://a|
7836 !! result
7837 <table>
7838 <tr>
7839 <td>
7840 </td>
7841 </tr>
7842 </table>
7843
7844 !! end
7845
7846 !! test
7847 Fuzz testing: Parser14
7848 !! input
7849 == onmouseover= ==
7850 http://__TOC__
7851 !! result
7852 <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>
7853 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7854 <ul>
7855 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
7856 </ul>
7857 </td></tr></table>
7858
7859 !! end
7860
7861 !! test
7862 Fuzz testing: Parser14-table
7863 !! input
7864 ==a==
7865 {| STYLE=__TOC__
7866 !! result
7867 <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>
7868 <table style="&#95;_TOC&#95;_">
7869 <tr><td></td></tr>
7870 </table>
7871
7872 !! end
7873
7874 # Known to produce bogus xml (extra </td>)
7875 !! test
7876 Fuzz testing: Parser16
7877 !! options
7878 noxml
7879 !! input
7880 {|
7881 !https://||||||
7882 !! result
7883 <table>
7884 <tr>
7885 <th>https://</th>
7886 <th></th>
7887 <th></th>
7888 <th>
7889 </td>
7890 </tr>
7891 </table>
7892
7893 !! end
7894
7895 !! test
7896 Fuzz testing: Parser21
7897 !! input
7898 {|
7899 ! irc://{{ftp://a" onmouseover="alert('hello world');"
7900 |
7901 !! result
7902 <table>
7903 <tr>
7904 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
7905 </th>
7906 <td>
7907 </td>
7908 </tr>
7909 </table>
7910
7911 !! end
7912
7913 !! test
7914 Fuzz testing: Parser22
7915 !! input
7916 http://===r:::https://b
7917
7918 {|
7919 !!result
7920 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
7921 </p>
7922 <table>
7923 <tr><td></td></tr>
7924 </table>
7925
7926 !! end
7927
7928 # Known to produce bad XML for now
7929 !! test
7930 Fuzz testing: Parser24
7931 !! options
7932 noxml
7933 !! input
7934 {|
7935 {{{|
7936 <u CLASS=
7937 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
7938 <br style="onmouseover='alert(document.cookie);' " />
7939
7940 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
7941 |
7942 !! result
7943 <table>
7944 {{{|
7945 <u class="&#124;">}}}} &gt;
7946 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
7947
7948 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
7949 <tr>
7950 <td></u>
7951 </td>
7952 </tr>
7953 </table>
7954
7955 !! end
7956
7957 # Note: the current result listed for this is not what the original one was,
7958 # but the original bug was JavaScript injection, which is fixed in any case.
7959 # It's not clear that the original result listed was any more correct than the
7960 # current one. Original result:
7961 # <p>{{{|
7962 # </p>
7963 # <li class="&#124;&#124;">
7964 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
7965 !!test
7966 Fuzz testing: Parser25 (bug 6055)
7967 !! input
7968 {{{
7969 |
7970 <LI CLASS=||
7971 >
7972 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
7973 !! result
7974 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
7975 </p>
7976 !! end
7977
7978 !!test
7979 Fuzz testing: URL adjacent extension (with space, clean)
7980 !! options
7981 !! input
7982 http://example.com <nowiki>junk</nowiki>
7983 !! result
7984 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
7985 </p>
7986 !!end
7987
7988 !!test
7989 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
7990 !! options
7991 !! input
7992 http://example.com<nowiki>junk</nowiki>
7993 !! result
7994 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
7995 </p>
7996 !!end
7997
7998 !!test
7999 Fuzz testing: URL adjacent extension (no space, dirty; pre)
8000 !! options
8001 !! input
8002 http://example.com<pre>junk</pre>
8003 !! result
8004 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
8005
8006 !!end
8007
8008 !!test
8009 Fuzz testing: image with bogus manual thumbnail
8010 !!input
8011 [[Image:foobar.jpg|thumbnail= ]]
8012 !!result
8013 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
8014
8015 !!end
8016
8017 !! test
8018 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
8019 !! input
8020 <pre dir="&#10;"></pre>
8021 !! result
8022 <pre dir="&#10;"></pre>
8023
8024 !! end
8025
8026 !! test
8027 Parsing optional HTML elements (Bug 6171)
8028 !! options
8029 !! input
8030 <table>
8031 <tr>
8032 <td> Some tabular data</td>
8033 <td> More tabular data ...
8034 <td> And yet som tabular data</td>
8035 </tr>
8036 </table>
8037 !! result
8038 <table>
8039 <tr>
8040 <td> Some tabular data</td>
8041 <td> More tabular data ...
8042 </td><td> And yet som tabular data</td>
8043 </tr>
8044 </table>
8045
8046 !! end
8047
8048 !! test
8049 Correct handling of <td>, <tr> (Bug 6171)
8050 !! options
8051 !! input
8052 <table>
8053 <tr>
8054 <td> Some tabular data</td>
8055 <td> More tabular data ...</td>
8056 <td> And yet som tabular data</td>
8057 </tr>
8058 </table>
8059 !! result
8060 <table>
8061 <tr>
8062 <td> Some tabular data</td>
8063 <td> More tabular data ...</td>
8064 <td> And yet som tabular data</td>
8065 </tr>
8066 </table>
8067
8068 !! end
8069
8070
8071 !! test
8072 Parsing crashing regression (fr:JavaScript)
8073 !! input
8074 </body></x>
8075 !! result
8076 <p>&lt;/body&gt;&lt;/x&gt;
8077 </p>
8078 !! end
8079
8080 !! test
8081 Inline wiki vs wiki block nesting
8082 !! input
8083 '''Bold paragraph
8084
8085 New wiki paragraph
8086 !! result
8087 <p><b>Bold paragraph</b>
8088 </p><p>New wiki paragraph
8089 </p>
8090 !! end
8091
8092 !! test
8093 Inline HTML vs wiki block nesting
8094 !! options
8095 disabled
8096 !! input
8097 <b>Bold paragraph
8098
8099 New wiki paragraph
8100 !! result
8101 <p><b>Bold paragraph</b>
8102 </p><p>New wiki paragraph
8103 </p>
8104 !! end
8105
8106 # Original result was this:
8107 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
8108 # </p>
8109 # While that might be marginally more intuitive, maybe, the six-apostrophe
8110 # construct is clearly pathological and the result stated here (which is what
8111 # the parser actually does) is about as reasonable as anything.
8112 !!test
8113 Mixing markup for italics and bold
8114 !! options
8115 !! input
8116 '''bold''''''bold''bolditalics'''''
8117 !! result
8118 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
8119 </p>
8120 !! end
8121
8122
8123 !! article
8124 Xyzzyx
8125 !! text
8126 Article for special page transclusion test
8127 !! endarticle
8128
8129 !! test
8130 Special page transclusion
8131 !! options
8132 !! input
8133 {{Special:Prefixindex/Xyzzyx}}
8134 !! result
8135 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8136
8137 !! end
8138
8139 !! test
8140 Special page transclusion twice (bug 5021)
8141 !! options
8142 !! input
8143 {{Special:Prefixindex/Xyzzyx}}
8144 {{Special:Prefixindex/Xyzzyx}}
8145 !! result
8146 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8147 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8148
8149 !! end
8150
8151 !! test
8152 Transclusion of default MediaWiki message
8153 !! input
8154 {{MediaWiki:Mainpage}}
8155 !!result
8156 <p>Main Page
8157 </p>
8158 !! end
8159
8160 !! test
8161 Transclusion of nonexistent MediaWiki message
8162 !! input
8163 {{MediaWiki:Mainpagexxx}}
8164 !!result
8165 <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>
8166 </p>
8167 !! end
8168
8169 !! test
8170 Transclusion of MediaWiki message with underscore
8171 !! input
8172 {{MediaWiki:history_short}}
8173 !! result
8174 <p>History
8175 </p>
8176 !! end
8177
8178 !! test
8179 Transclusion of MediaWiki message with space
8180 !! input
8181 {{MediaWiki:history short}}
8182 !! result
8183 <p>History
8184 </p>
8185 !! end
8186
8187 !! test
8188 Invalid header with following text
8189 !! input
8190 = x = y
8191 !! result
8192 <p>= x = y
8193 </p>
8194 !! end
8195
8196
8197 !! test
8198 Section extraction test (section 0)
8199 !! options
8200 section=0
8201 !! input
8202 start
8203 ==a==
8204 ===aa===
8205 ====aaa====
8206 ==b==
8207 ===ba===
8208 ===bb===
8209 ====bba====
8210 ===bc===
8211 ==c==
8212 ===ca===
8213 !! result
8214 start
8215 !! end
8216
8217 !! test
8218 Section extraction test (section 1)
8219 !! options
8220 section=1
8221 !! input
8222 start
8223 ==a==
8224 ===aa===
8225 ====aaa====
8226 ==b==
8227 ===ba===
8228 ===bb===
8229 ====bba====
8230 ===bc===
8231 ==c==
8232 ===ca===
8233 !! result
8234 ==a==
8235 ===aa===
8236 ====aaa====
8237 !! end
8238
8239 !! test
8240 Section extraction test (section 2)
8241 !! options
8242 section=2
8243 !! input
8244 start
8245 ==a==
8246 ===aa===
8247 ====aaa====
8248 ==b==
8249 ===ba===
8250 ===bb===
8251 ====bba====
8252 ===bc===
8253 ==c==
8254 ===ca===
8255 !! result
8256 ===aa===
8257 ====aaa====
8258 !! end
8259
8260 !! test
8261 Section extraction test (section 3)
8262 !! options
8263 section=3
8264 !! input
8265 start
8266 ==a==
8267 ===aa===
8268 ====aaa====
8269 ==b==
8270 ===ba===
8271 ===bb===
8272 ====bba====
8273 ===bc===
8274 ==c==
8275 ===ca===
8276 !! result
8277 ====aaa====
8278 !! end
8279
8280 !! test
8281 Section extraction test (section 4)
8282 !! options
8283 section=4
8284 !! input
8285 start
8286 ==a==
8287 ===aa===
8288 ====aaa====
8289 ==b==
8290 ===ba===
8291 ===bb===
8292 ====bba====
8293 ===bc===
8294 ==c==
8295 ===ca===
8296 !! result
8297 ==b==
8298 ===ba===
8299 ===bb===
8300 ====bba====
8301 ===bc===
8302 !! end
8303
8304 !! test
8305 Section extraction test (section 5)
8306 !! options
8307 section=5
8308 !! input
8309 start
8310 ==a==
8311 ===aa===
8312 ====aaa====
8313 ==b==
8314 ===ba===
8315 ===bb===
8316 ====bba====
8317 ===bc===
8318 ==c==
8319 ===ca===
8320 !! result
8321 ===ba===
8322 !! end
8323
8324 !! test
8325 Section extraction test (section 6)
8326 !! options
8327 section=6
8328 !! input
8329 start
8330 ==a==
8331 ===aa===
8332 ====aaa====
8333 ==b==
8334 ===ba===
8335 ===bb===
8336 ====bba====
8337 ===bc===
8338 ==c==
8339 ===ca===
8340 !! result
8341 ===bb===
8342 ====bba====
8343 !! end
8344
8345 !! test
8346 Section extraction test (section 7)
8347 !! options
8348 section=7
8349 !! input
8350 start
8351 ==a==
8352 ===aa===
8353 ====aaa====
8354 ==b==
8355 ===ba===
8356 ===bb===
8357 ====bba====
8358 ===bc===
8359 ==c==
8360 ===ca===
8361 !! result
8362 ====bba====
8363 !! end
8364
8365 !! test
8366 Section extraction test (section 8)
8367 !! options
8368 section=8
8369 !! input
8370 start
8371 ==a==
8372 ===aa===
8373 ====aaa====
8374 ==b==
8375 ===ba===
8376 ===bb===
8377 ====bba====
8378 ===bc===
8379 ==c==
8380 ===ca===
8381 !! result
8382 ===bc===
8383 !! end
8384
8385 !! test
8386 Section extraction test (section 9)
8387 !! options
8388 section=9
8389 !! input
8390 start
8391 ==a==
8392 ===aa===
8393 ====aaa====
8394 ==b==
8395 ===ba===
8396 ===bb===
8397 ====bba====
8398 ===bc===
8399 ==c==
8400 ===ca===
8401 !! result
8402 ==c==
8403 ===ca===
8404 !! end
8405
8406 !! test
8407 Section extraction test (section 10)
8408 !! options
8409 section=10
8410 !! input
8411 start
8412 ==a==
8413 ===aa===
8414 ====aaa====
8415 ==b==
8416 ===ba===
8417 ===bb===
8418 ====bba====
8419 ===bc===
8420 ==c==
8421 ===ca===
8422 !! result
8423 ===ca===
8424 !! end
8425
8426 !! test
8427 Section extraction test (nonexistent section 11)
8428 !! options
8429 section=11
8430 !! input
8431 start
8432 ==a==
8433 ===aa===
8434 ====aaa====
8435 ==b==
8436 ===ba===
8437 ===bb===
8438 ====bba====
8439 ===bc===
8440 ==c==
8441 ===ca===
8442 !! result
8443 !! end
8444
8445 !! test
8446 Section extraction test with bogus heading (section 1)
8447 !! options
8448 section=1
8449 !! input
8450 ==a==
8451 ==bogus== not a legal section
8452 ==b==
8453 !! result
8454 ==a==
8455 ==bogus== not a legal section
8456 !! end
8457
8458 !! test
8459 Section extraction test with bogus heading (section 2)
8460 !! options
8461 section=2
8462 !! input
8463 ==a==
8464 ==bogus== not a legal section
8465 ==b==
8466 !! result
8467 ==b==
8468 !! end
8469
8470 !! test
8471 Section extraction test with comment after heading (section 1)
8472 !! options
8473 section=1
8474 !! input
8475 ==a==
8476 ==b== <!-- -->
8477 ==c==
8478 !! result
8479 ==a==
8480 !! end
8481
8482 !! test
8483 Section extraction test with comment after heading (section 2)
8484 !! options
8485 section=2
8486 !! input
8487 ==a==
8488 ==b== <!-- -->
8489 ==c==
8490 !! result
8491 ==b== <!-- -->
8492 !! end
8493
8494 !! test
8495 Section extraction test with bogus <nowiki> heading (section 1)
8496 !! options
8497 section=1
8498 !! input
8499 ==a==
8500 ==bogus== <nowiki>not a legal section</nowiki>
8501 ==b==
8502 !! result
8503 ==a==
8504 ==bogus== <nowiki>not a legal section</nowiki>
8505 !! end
8506
8507 !! test
8508 Section extraction test with bogus <nowiki> heading (section 2)
8509 !! options
8510 section=2
8511 !! input
8512 ==a==
8513 ==bogus== <nowiki>not a legal section</nowiki>
8514 ==b==
8515 !! result
8516 ==b==
8517 !! end
8518
8519
8520 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
8521 # instead of respecting commented sections
8522 !! test
8523 Section extraction prefixed by comment (section 1)
8524 !! options
8525 section=1
8526 !! input
8527 <!-- -->==sec1==
8528 ==sec2==
8529 !!result
8530 ==sec2==
8531 !!end
8532
8533 !! test
8534 Section extraction prefixed by comment (section 2)
8535 !! options
8536 section=2
8537 !! input
8538 <!-- -->==sec1==
8539 ==sec2==
8540 !!result
8541
8542 !!end
8543
8544
8545 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
8546 # instead of respecting HTML-style headings
8547 !! test
8548 Section extraction, mixed wiki and html (section 1)
8549 !! options
8550 section=1
8551 !! input
8552 <h2>unmarked</h2>
8553 unmarked
8554 ==1==
8555 one
8556 ==2==
8557 two
8558 !! result
8559 ==1==
8560 one
8561 !! end
8562
8563 !! test
8564 Section extraction, mixed wiki and html (section 2)
8565 !! options
8566 section=2
8567 !! input
8568 <h2>unmarked</h2>
8569 unmarked
8570 ==1==
8571 one
8572 ==2==
8573 two
8574 !! result
8575 ==2==
8576 two
8577 !! end
8578
8579
8580 # Formerly testing for bug 3342
8581 !! test
8582 Section extraction, heading surrounded by <noinclude>
8583 !! options
8584 section=1
8585 !! input
8586 <noinclude>==unmarked==</noinclude>
8587 ==marked==
8588 !! result
8589 ==marked==
8590 !!end
8591
8592 # Test behaviour of bug 19910
8593 !! test
8594 Sectiion with all-equals
8595 !! options
8596 section=2
8597 !! input
8598 ===
8599 The line above must have a trailing space
8600 === <!--
8601 --> <!-- -->
8602 But just in case it doesn't...
8603 !! result
8604 === <!--
8605 --> <!-- -->
8606 But just in case it doesn't...
8607 !! end
8608
8609 !! test
8610 Section replacement test (section 0)
8611 !! options
8612 replace=0,"xxx"
8613 !! input
8614 start
8615 ==a==
8616 ===aa===
8617 ====aaa====
8618 ==b==
8619 ===ba===
8620 ===bb===
8621 ====bba====
8622 ===bc===
8623 ==c==
8624 ===ca===
8625 !! result
8626 xxx
8627
8628 ==a==
8629 ===aa===
8630 ====aaa====
8631 ==b==
8632 ===ba===
8633 ===bb===
8634 ====bba====
8635 ===bc===
8636 ==c==
8637 ===ca===
8638 !! end
8639
8640 !! test
8641 Section replacement test (section 1)
8642 !! options
8643 replace=1,"xxx"
8644 !! input
8645 start
8646 ==a==
8647 ===aa===
8648 ====aaa====
8649 ==b==
8650 ===ba===
8651 ===bb===
8652 ====bba====
8653 ===bc===
8654 ==c==
8655 ===ca===
8656 !! result
8657 start
8658 xxx
8659
8660 ==b==
8661 ===ba===
8662 ===bb===
8663 ====bba====
8664 ===bc===
8665 ==c==
8666 ===ca===
8667 !! end
8668
8669 !! test
8670 Section replacement test (section 2)
8671 !! options
8672 replace=2,"xxx"
8673 !! input
8674 start
8675 ==a==
8676 ===aa===
8677 ====aaa====
8678 ==b==
8679 ===ba===
8680 ===bb===
8681 ====bba====
8682 ===bc===
8683 ==c==
8684 ===ca===
8685 !! result
8686 start
8687 ==a==
8688 xxx
8689
8690 ==b==
8691 ===ba===
8692 ===bb===
8693 ====bba====
8694 ===bc===
8695 ==c==
8696 ===ca===
8697 !! end
8698
8699 !! test
8700 Section replacement test (section 3)
8701 !! options
8702 replace=3,"xxx"
8703 !! input
8704 start
8705 ==a==
8706 ===aa===
8707 ====aaa====
8708 ==b==
8709 ===ba===
8710 ===bb===
8711 ====bba====
8712 ===bc===
8713 ==c==
8714 ===ca===
8715 !! result
8716 start
8717 ==a==
8718 ===aa===
8719 xxx
8720
8721 ==b==
8722 ===ba===
8723 ===bb===
8724 ====bba====
8725 ===bc===
8726 ==c==
8727 ===ca===
8728 !! end
8729
8730 !! test
8731 Section replacement test (section 4)
8732 !! options
8733 replace=4,"xxx"
8734 !! input
8735 start
8736 ==a==
8737 ===aa===
8738 ====aaa====
8739 ==b==
8740 ===ba===
8741 ===bb===
8742 ====bba====
8743 ===bc===
8744 ==c==
8745 ===ca===
8746 !! result
8747 start
8748 ==a==
8749 ===aa===
8750 ====aaa====
8751 xxx
8752
8753 ==c==
8754 ===ca===
8755 !! end
8756
8757 !! test
8758 Section replacement test (section 5)
8759 !! options
8760 replace=5,"xxx"
8761 !! input
8762 start
8763 ==a==
8764 ===aa===
8765 ====aaa====
8766 ==b==
8767 ===ba===
8768 ===bb===
8769 ====bba====
8770 ===bc===
8771 ==c==
8772 ===ca===
8773 !! result
8774 start
8775 ==a==
8776 ===aa===
8777 ====aaa====
8778 ==b==
8779 xxx
8780
8781 ===bb===
8782 ====bba====
8783 ===bc===
8784 ==c==
8785 ===ca===
8786 !! end
8787
8788 !! test
8789 Section replacement test (section 6)
8790 !! options
8791 replace=6,"xxx"
8792 !! input
8793 start
8794 ==a==
8795 ===aa===
8796 ====aaa====
8797 ==b==
8798 ===ba===
8799 ===bb===
8800 ====bba====
8801 ===bc===
8802 ==c==
8803 ===ca===
8804 !! result
8805 start
8806 ==a==
8807 ===aa===
8808 ====aaa====
8809 ==b==
8810 ===ba===
8811 xxx
8812
8813 ===bc===
8814 ==c==
8815 ===ca===
8816 !! end
8817
8818 !! test
8819 Section replacement test (section 7)
8820 !! options
8821 replace=7,"xxx"
8822 !! input
8823 start
8824 ==a==
8825 ===aa===
8826 ====aaa====
8827 ==b==
8828 ===ba===
8829 ===bb===
8830 ====bba====
8831 ===bc===
8832 ==c==
8833 ===ca===
8834 !! result
8835 start
8836 ==a==
8837 ===aa===
8838 ====aaa====
8839 ==b==
8840 ===ba===
8841 ===bb===
8842 xxx
8843
8844 ===bc===
8845 ==c==
8846 ===ca===
8847 !! end
8848
8849 !! test
8850 Section replacement test (section 8)
8851 !! options
8852 replace=8,"xxx"
8853 !! input
8854 start
8855 ==a==
8856 ===aa===
8857 ====aaa====
8858 ==b==
8859 ===ba===
8860 ===bb===
8861 ====bba====
8862 ===bc===
8863 ==c==
8864 ===ca===
8865 !! result
8866 start
8867 ==a==
8868 ===aa===
8869 ====aaa====
8870 ==b==
8871 ===ba===
8872 ===bb===
8873 ====bba====
8874 xxx
8875
8876 ==c==
8877 ===ca===
8878 !!end
8879
8880 !! test
8881 Section replacement test (section 9)
8882 !! options
8883 replace=9,"xxx"
8884 !! input
8885 start
8886 ==a==
8887 ===aa===
8888 ====aaa====
8889 ==b==
8890 ===ba===
8891 ===bb===
8892 ====bba====
8893 ===bc===
8894 ==c==
8895 ===ca===
8896 !! result
8897 start
8898 ==a==
8899 ===aa===
8900 ====aaa====
8901 ==b==
8902 ===ba===
8903 ===bb===
8904 ====bba====
8905 ===bc===
8906 xxx
8907 !! end
8908
8909 !! test
8910 Section replacement test (section 10)
8911 !! options
8912 replace=10,"xxx"
8913 !! input
8914 start
8915 ==a==
8916 ===aa===
8917 ====aaa====
8918 ==b==
8919 ===ba===
8920 ===bb===
8921 ====bba====
8922 ===bc===
8923 ==c==
8924 ===ca===
8925 !! result
8926 start
8927 ==a==
8928 ===aa===
8929 ====aaa====
8930 ==b==
8931 ===ba===
8932 ===bb===
8933 ====bba====
8934 ===bc===
8935 ==c==
8936 xxx
8937 !! end
8938
8939 !! test
8940 Section replacement test with initial whitespace (bug 13728)
8941 !! options
8942 replace=2,"xxx"
8943 !! input
8944 Preformatted initial line
8945 ==a==
8946 ===a===
8947 !! result
8948 Preformatted initial line
8949 ==a==
8950 xxx
8951 !! end
8952
8953
8954 !! test
8955 Section extraction, heading followed by pre with 20 spaces (bug 6398)
8956 !! options
8957 section=1
8958 !! input
8959 ==a==
8960 a
8961 !! result
8962 ==a==
8963 a
8964 !! end
8965
8966 !! test
8967 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
8968 !! options
8969 section=1
8970 !! input
8971 ==a==
8972 a
8973 !! result
8974 ==a==
8975 a
8976 !! end
8977
8978
8979 !! test
8980 Section extraction, <pre> around bogus header (bug 10309)
8981 !! options
8982 noxml section=2
8983 !! input
8984 == Section One ==
8985 <pre>
8986 =======
8987 </pre>
8988
8989 == Section Two ==
8990 stuff
8991 !! result
8992 == Section Two ==
8993 stuff
8994 !! end
8995
8996 !! test
8997 Section replacement, <pre> around bogus header (bug 10309)
8998 !! options
8999 noxml replace=2,"xxx"
9000 !! input
9001 == Section One ==
9002 <pre>
9003 =======
9004 </pre>
9005
9006 == Section Two ==
9007 stuff
9008 !! result
9009 == Section One ==
9010 <pre>
9011 =======
9012 </pre>
9013
9014 xxx
9015 !! end
9016
9017
9018
9019 !! test
9020 Handling of &#x0A; in URLs
9021 !! input
9022 **irc://&#x0A;a
9023 !! result
9024 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
9025 </li></ul>
9026 </li></ul>
9027
9028 !!end
9029
9030 !! test
9031 5 quotes, code coverage +1 line
9032 !! input
9033 '''''
9034 !! result
9035 !! end
9036
9037 !! test
9038 Special:Search page linking.
9039 !! input
9040 {{Special:search}}
9041 !! result
9042 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
9043 </p>
9044 !! end
9045
9046 !! test
9047 Say the magic word
9048 !! input
9049 * {{PAGENAME}}
9050 * {{BASEPAGENAME}}
9051 * {{SUBPAGENAME}}
9052 * {{SUBPAGENAMEE}}
9053 * {{BASEPAGENAME}}
9054 * {{BASEPAGENAMEE}}
9055 * {{TALKPAGENAME}}
9056 * {{TALKPAGENAMEE}}
9057 * {{SUBJECTPAGENAME}}
9058 * {{SUBJECTPAGENAMEE}}
9059 * {{NAMESPACEE}}
9060 * {{NAMESPACE}}
9061 * {{TALKSPACE}}
9062 * {{TALKSPACEE}}
9063 * {{SUBJECTSPACE}}
9064 * {{SUBJECTSPACEE}}
9065 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
9066 !! result
9067 <ul><li> Parser test
9068 </li><li> Parser test
9069 </li><li> Parser test
9070 </li><li> Parser_test
9071 </li><li> Parser test
9072 </li><li> Parser_test
9073 </li><li> Talk:Parser test
9074 </li><li> Talk:Parser_test
9075 </li><li> Parser test
9076 </li><li> Parser_test
9077 </li><li>
9078 </li><li>
9079 </li><li> Talk
9080 </li><li> Talk
9081 </li><li>
9082 </li><li>
9083 </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>
9084 </li></ul>
9085
9086 !! end
9087 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
9088
9089 !! test
9090 Gallery
9091 !! input
9092 <gallery>
9093 image1.png |
9094 image2.gif|||||
9095
9096 image3|
9097 image4 |300px| centre
9098 image5.svg| http://///////
9099 [[x|xx]]]]
9100 * image6
9101 </gallery>
9102 !! result
9103 <ul class="gallery">
9104 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9105 <div style="height: 150px;">Image1.png</div>
9106 <div class="gallerytext">
9107 </div>
9108 </div></li>
9109 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9110 <div style="height: 150px;">Image2.gif</div>
9111 <div class="gallerytext">
9112 <p>||||
9113 </p>
9114 </div>
9115 </div></li>
9116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9117 <div style="height: 150px;">Image3</div>
9118 <div class="gallerytext">
9119 </div>
9120 </div></li>
9121 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9122 <div style="height: 150px;">Image4</div>
9123 <div class="gallerytext">
9124 <p>300px| centre
9125 </p>
9126 </div>
9127 </div></li>
9128 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9129 <div style="height: 150px;">Image5.svg</div>
9130 <div class="gallerytext">
9131 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
9132 </p>
9133 </div>
9134 </div></li>
9135 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9136 <div style="height: 150px;">* image6</div>
9137 <div class="gallerytext">
9138 </div>
9139 </div></li>
9140 </ul>
9141
9142 !! end
9143
9144 !! test
9145 Gallery (with options)
9146 !! input
9147 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
9148 File:Nonexistant.jpg|caption
9149 File:Nonexistant.jpg
9150 image:foobar.jpg|some '''caption''' [[Main Page]]
9151 image:foobar.jpg
9152 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
9153 </gallery>
9154 !! result
9155 <ul class="gallery" style="max-width: 226px;_width: 226px;">
9156 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
9157 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9158 <div style="height: 70px;">Nonexistant.jpg</div>
9159 <div class="gallerytext">
9160 <p>caption
9161 </p>
9162 </div>
9163 </div></li>
9164 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9165 <div style="height: 70px;">Nonexistant.jpg</div>
9166 <div class="gallerytext">
9167 </div>
9168 </div></li>
9169 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9170 <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>
9171 <div class="gallerytext">
9172 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9173 </p>
9174 </div>
9175 </div></li>
9176 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9177 <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>
9178 <div class="gallerytext">
9179 </div>
9180 </div></li>
9181 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9182 <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>
9183 <div class="gallerytext">
9184 <p>Blabla|blabla.
9185 </p>
9186 </div>
9187 </div></li>
9188 </ul>
9189
9190 !! end
9191
9192 !! test
9193 Gallery with wikitext inside caption
9194 !! input
9195 <gallery>
9196 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
9197 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
9198 </gallery>
9199 !! result
9200 <ul class="gallery">
9201 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9202 <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>
9203 <div class="gallerytext">
9204 <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>
9205 </p>
9206 </div>
9207 </div></li>
9208 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9209 <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>
9210 <div class="gallerytext">
9211 <p>This is a test template
9212 </p>
9213 </div>
9214 </div></li>
9215 </ul>
9216
9217 !! end
9218
9219 !! test
9220 gallery (with showfilename option)
9221 !! input
9222 <gallery showfilename>
9223 File:Nonexistant.jpg|caption
9224 File:Nonexistant.jpg
9225 image:foobar.jpg|some '''caption''' [[Main Page]]
9226 File:Foobar.jpg
9227 </gallery>
9228 !! result
9229 <ul class="gallery">
9230 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9231 <div style="height: 150px;">Nonexistant.jpg</div>
9232 <div class="gallerytext">
9233 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9234 caption
9235 </p>
9236 </div>
9237 </div></li>
9238 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9239 <div style="height: 150px;">Nonexistant.jpg</div>
9240 <div class="gallerytext">
9241 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9242 </p>
9243 </div>
9244 </div></li>
9245 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9246 <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>
9247 <div class="gallerytext">
9248 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9249 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9250 </p>
9251 </div>
9252 </div></li>
9253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9254 <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>
9255 <div class="gallerytext">
9256 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9257 </p>
9258 </div>
9259 </div></li>
9260 </ul>
9261
9262 !! end
9263
9264 !! test
9265 Gallery (with namespace-less filenames)
9266 !! input
9267 <gallery>
9268 File:Nonexistant.jpg
9269 Nonexistant.jpg
9270 image:foobar.jpg
9271 foobar.jpg
9272 </gallery>
9273 !! result
9274 <ul class="gallery">
9275 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9276 <div style="height: 150px;">Nonexistant.jpg</div>
9277 <div class="gallerytext">
9278 </div>
9279 </div></li>
9280 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9281 <div style="height: 150px;">Nonexistant.jpg</div>
9282 <div class="gallerytext">
9283 </div>
9284 </div></li>
9285 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9286 <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>
9287 <div class="gallerytext">
9288 </div>
9289 </div></li>
9290 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9291 <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>
9292 <div class="gallerytext">
9293 </div>
9294 </div></li>
9295 </ul>
9296
9297 !! end
9298
9299 !! test
9300 HTML Hex character encoding (spells the word "JavaScript")
9301 !! input
9302 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
9303 !! result
9304 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
9305 </p>
9306 !! end
9307
9308 !! test
9309 HTML Hex character encoding bogus encoding (bug 26437 regression check)
9310 !! input
9311 &#xsee;&#XSEE;
9312 !! result
9313 <p>&amp;#xsee;&amp;#XSEE;
9314 </p>
9315 !! end
9316
9317 !! test
9318 HTML Hex character encoding mixed case
9319 !! input
9320 &#xEE;&#Xee;
9321 !! result
9322 <p>&#xee;&#xee;
9323 </p>
9324 !! end
9325
9326 !! test
9327 __FORCETOC__ override
9328 !! input
9329 __NEWSECTIONLINK__
9330 __FORCETOC__
9331 !! result
9332 <p><br />
9333 </p>
9334 !! end
9335
9336 !! test
9337 ISBN code coverage
9338 !! input
9339 ISBN 978-0-1234-56&#x20;789
9340 !! result
9341 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
9342 </p>
9343 !! end
9344
9345 !! test
9346 ISBN followed by 5 spaces
9347 !! input
9348 ISBN
9349 !! result
9350 <p>ISBN
9351 </p>
9352 !! end
9353
9354 !! test
9355 Double ISBN
9356 !! input
9357 ISBN ISBN 1234567890
9358 !! result
9359 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9360 </p>
9361 !! end
9362
9363 !! test
9364 Bug 22905: <abbr> followed by ISBN followed by </a>
9365 !! input
9366 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
9367 !! result
9368 <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>
9369 </p>
9370 !! end
9371
9372 !! test
9373 Double RFC
9374 !! input
9375 RFC RFC 1234
9376 !! result
9377 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
9378 </p>
9379 !! end
9380
9381 !! test
9382 Double RFC with a wiki link
9383 !! input
9384 RFC [[RFC 1234]]
9385 !! result
9386 <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>
9387 </p>
9388 !! end
9389
9390 !! test
9391 RFC code coverage
9392 !! input
9393 RFC 983&#x20;987
9394 !! result
9395 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
9396 </p>
9397 !! end
9398
9399 !! test
9400 Centre-aligned image
9401 !! input
9402 [[Image:foobar.jpg|centre]]
9403 !! result
9404 <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>
9405
9406 !!end
9407
9408 !! test
9409 None-aligned image
9410 !! input
9411 [[Image:foobar.jpg|none]]
9412 !! result
9413 <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>
9414
9415 !!end
9416
9417 !! test
9418 Width + Height sized image (using px) (height is ignored)
9419 !! input
9420 [[Image:foobar.jpg|640x480px]]
9421 !! result
9422 <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>
9423 </p>
9424 !!end
9425
9426 !! test
9427 Width-sized image (using px, no following whitespace)
9428 !! input
9429 [[Image:foobar.jpg|640px]]
9430 !! result
9431 <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>
9432 </p>
9433 !!end
9434
9435 !! test
9436 Width-sized image (using px, with following whitespace - test regression from r39467)
9437 !! input
9438 [[Image:foobar.jpg|640px ]]
9439 !! result
9440 <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>
9441 </p>
9442 !!end
9443
9444 !! test
9445 Width-sized image (using px, with preceding whitespace - test regression from r39467)
9446 !! input
9447 [[Image:foobar.jpg| 640px]]
9448 !! result
9449 <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>
9450 </p>
9451 !!end
9452
9453 !! test
9454 Another italics / bold test
9455 !! input
9456 ''' ''x'
9457 !! result
9458 <pre>'<i> </i>x'
9459 </pre>
9460 !!end
9461
9462 # Note the results may be incorrect, as parserTest output included this:
9463 # XML error: Mismatched tag at byte 6120:
9464 # ...<dd> </dt></dl> </dd...
9465 !! test
9466 dt/dd/dl test
9467 !! options
9468 disabled
9469 !! input
9470 :;;;::
9471 !! result
9472 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
9473 </dd></dl>
9474 </dd></dl>
9475 </dt></dl>
9476 </dt></dl>
9477 </dt></dl>
9478 </dd></dl>
9479
9480 !!end
9481
9482
9483 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
9484 !! test
9485 Images with the "|" character in the comment
9486 !! input
9487 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
9488 !! result
9489 <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>
9490
9491 !!end
9492
9493 !! test
9494 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
9495 !! input
9496 <html><script>alert(1);</script></html>
9497 !! result
9498 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
9499 </p>
9500 !! end
9501
9502 !! test
9503 HTML with raw HTML ($wgRawHtml==true)
9504 !! options
9505 rawhtml
9506 !! input
9507 <html><script>alert(1);</script></html>
9508 !! result
9509 <p><script>alert(1);</script>
9510 </p>
9511 !! end
9512
9513 !! test
9514 Parents of subpages, one level up
9515 !! options
9516 subpage title=[[Subpage test/L1/L2/L3]]
9517 !! input
9518 [[../|L2]]
9519 !! result
9520 <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>
9521 </p>
9522 !! end
9523
9524
9525 !! test
9526 Parents of subpages, one level up, not named
9527 !! options
9528 subpage title=[[Subpage test/L1/L2/L3]]
9529 !! input
9530 [[../]]
9531 !! result
9532 <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>
9533 </p>
9534 !! end
9535
9536
9537
9538 !! test
9539 Parents of subpages, two levels up
9540 !! options
9541 subpage title=[[Subpage test/L1/L2/L3]]
9542 !! input
9543 [[../../|L1]]2
9544
9545 [[../../|L1]]l
9546 !! result
9547 <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
9548 </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>
9549 </p>
9550 !! end
9551
9552 !! test
9553 Parents of subpages, two levels up, without trailing slash or name.
9554 !! options
9555 subpage title=[[Subpage test/L1/L2/L3]]
9556 !! input
9557 [[../..]]
9558 !! result
9559 <p>[[../..]]
9560 </p>
9561 !! end
9562
9563 !! test
9564 Parents of subpages, two levels up, with lots of extra trailing slashes.
9565 !! options
9566 subpage title=[[Subpage test/L1/L2/L3]]
9567 !! input
9568 [[../../////]]
9569 !! result
9570 <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>
9571 </p>
9572 !! end
9573
9574 !! test
9575 Definition list code coverage
9576 !! input
9577 ; title : def
9578 ; title : def
9579 ;title: def
9580 !! result
9581 <dl><dt> title &#160;</dt><dd> def
9582 </dd><dt> title&#160;</dt><dd> def
9583 </dd><dt>title</dt><dd> def
9584 </dd></dl>
9585
9586 !! end
9587
9588 !! test
9589 Don't fall for the self-closing div
9590 !! input
9591 <div>hello world</div/>
9592 !! result
9593 <div>hello world</div>
9594
9595 !! end
9596
9597 !! test
9598 MSGNW magic word
9599 !! input
9600 {{MSGNW:msg}}
9601 !! result
9602 <p>&#91;&#91;:Template:Msg&#93;&#93;
9603 </p>
9604 !! end
9605
9606 !! test
9607 RAW magic word
9608 !! input
9609 {{RAW:QUERTY}}
9610 !! result
9611 <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>
9612 </p>
9613 !! end
9614
9615 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
9616 !! test
9617 Always escape literal '>' in output, not just after '<'
9618 !! input
9619 ><>
9620 !! result
9621 <p>&gt;&lt;&gt;
9622 </p>
9623 !! end
9624
9625 !! test
9626 Template caching
9627 !! input
9628 {{Test}}
9629 {{Test}}
9630 !! result
9631 <p>This is a test template
9632 This is a test template
9633 </p>
9634 !! end
9635
9636
9637 !! article
9638 MediaWiki:Fake
9639 !! text
9640 ==header==
9641 !! endarticle
9642
9643 !! test
9644 Inclusion of !userCanEdit() content
9645 !! input
9646 {{MediaWiki:Fake}}
9647 !! result
9648 <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>
9649
9650 !! end
9651
9652
9653 !! test
9654 Out-of-order TOC heading levels
9655 !! input
9656 ==2==
9657 ======6======
9658 ===3===
9659 =1=
9660 =====5=====
9661 ==2==
9662 !! result
9663 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9664 <ul>
9665 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
9666 <ul>
9667 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
9668 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
9669 </ul>
9670 </li>
9671 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
9672 <ul>
9673 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
9674 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
9675 </ul>
9676 </li>
9677 </ul>
9678 </td></tr></table>
9679 <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>
9680 <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>
9681 <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>
9682 <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>
9683 <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>
9684 <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>
9685
9686 !! end
9687
9688
9689 !! test
9690 ISBN with a dummy number
9691 !! input
9692 ISBN ---
9693 !! result
9694 <p>ISBN ---
9695 </p>
9696 !! end
9697
9698
9699 !! test
9700 ISBN with space-delimited number
9701 !! input
9702 ISBN 92 9017 032 8
9703 !! result
9704 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
9705 </p>
9706 !! end
9707
9708
9709 !! test
9710 ISBN with multiple spaces, no number
9711 !! input
9712 ISBN foo
9713 !! result
9714 <p>ISBN foo
9715 </p>
9716 !! end
9717
9718
9719 !! test
9720 ISBN length
9721 !! input
9722 ISBN 123456789
9723
9724 ISBN 1234567890
9725
9726 ISBN 12345678901
9727 !! result
9728 <p>ISBN 123456789
9729 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9730 </p><p>ISBN 12345678901
9731 </p>
9732 !! end
9733
9734
9735 !! test
9736 ISBN with trailing year (bug 8110)
9737 !! input
9738 ISBN 1-234-56789-0 - 2006
9739
9740 ISBN 1 234 56789 0 - 2006
9741 !! result
9742 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
9743 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
9744 </p>
9745 !! end
9746
9747
9748 !! test
9749 anchorencode
9750 !! input
9751 {{anchorencode:foo bar©#%n}}
9752 !! result
9753 <p>foo_bar.C2.A9.23.25n
9754 </p>
9755 !! end
9756
9757 !! test
9758 anchorencode trims spaces
9759 !! input
9760 {{anchorencode: __pretty__please__}}
9761 !! result
9762 <p>pretty_please
9763 </p>
9764 !! end
9765
9766 !! test
9767 anchorencode deals with links
9768 !! input
9769 {{anchorencode: [[hello|world]] [[hi]]}}
9770 !! result
9771 <p>world_hi
9772 </p>
9773 !! end
9774
9775 !! test
9776 anchorencode deals with templates
9777 !! input
9778 {{anchorencode: {{Foo}} }}
9779 !! result
9780 <p>FOO
9781 </p>
9782 !! end
9783
9784 !! test
9785 anchorencode encodes like the TOC generator: (bug 18431)
9786 !! input
9787 === _ +:.3A%3A&&amp;]] ===
9788 {{anchorencode: _ +:.3A%3A&&amp;]] }}
9789 __NOEDITSECTION__
9790 !! result
9791 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
9792 <p>.2B:.3A.253A.26.26.5D.5D
9793 </p>
9794 !! end
9795
9796 # Expected output in the following test is not necessarily expected (there
9797 # should probably be <p> tags inside the <blockquote> in the output) -- it's
9798 # only testing for well-formedness.
9799 !! test
9800 Bug 6200: blockquotes and paragraph formatting
9801 !! input
9802 <blockquote>
9803 foo
9804 </blockquote>
9805
9806 bar
9807
9808 baz
9809 !! result
9810 <blockquote>
9811 foo
9812 </blockquote>
9813 <p>bar
9814 </p>
9815 <pre>baz
9816 </pre>
9817 !! end
9818
9819 !! test
9820 Bug 8293: Use of center tag ruins paragraph formatting
9821 !! input
9822 <center>
9823 foo
9824 </center>
9825
9826 bar
9827
9828 baz
9829 !! result
9830 <center>
9831 <p>foo
9832 </p>
9833 </center>
9834 <p>bar
9835 </p>
9836 <pre>baz
9837 </pre>
9838 !! end
9839
9840
9841 ###
9842 ### Language variants related tests
9843 ###
9844 !! test
9845 Self-link in language variants
9846 !! options
9847 title=[[Dunav]] language=sr
9848 !! input
9849 Both [[Dunav]] and [[Дунав]] are names for this river.
9850 !! result
9851 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
9852 </p>
9853 !!end
9854
9855
9856 !! test
9857 Link to pages in language variants
9858 !! options
9859 language=sr
9860 !! input
9861 Main Page can be written as [[Маин Паге]]
9862 !! result
9863 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
9864 </p>
9865 !!end
9866
9867
9868 !! test
9869 Multiple links to pages in language variants
9870 !! options
9871 language=sr
9872 !! input
9873 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
9874 !! result
9875 <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>.
9876 </p>
9877 !!end
9878
9879
9880 !! test
9881 Simple template in language variants
9882 !! options
9883 language=sr
9884 !! input
9885 {{тест}}
9886 !! result
9887 <p>This is a test template
9888 </p>
9889 !! end
9890
9891
9892 !! test
9893 Template with explicit namespace in language variants
9894 !! options
9895 language=sr
9896 !! input
9897 {{Template:тест}}
9898 !! result
9899 <p>This is a test template
9900 </p>
9901 !! end
9902
9903
9904 !! test
9905 Basic test for template parameter in language variants
9906 !! options
9907 language=sr
9908 !! input
9909 {{парамтест|param=foo}}
9910 !! result
9911 <p>This is a test template with parameter foo
9912 </p>
9913 !! end
9914
9915
9916 !! test
9917 Simple category in language variants
9918 !! options
9919 language=sr cat
9920 !! input
9921 [[Category:МедиаWики Усер'с Гуиде]]
9922 !! result
9923 <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>
9924 !! end
9925
9926
9927 !! test
9928 Stripping -{}- tags (language variants)
9929 !! options
9930 language=sr
9931 !! input
9932 Latin proverb: -{Ne nuntium necare}-
9933 !! result
9934 <p>Latin proverb: Ne nuntium necare
9935 </p>
9936 !! end
9937
9938
9939 !! test
9940 Prevent conversion with -{}- tags (language variants)
9941 !! options
9942 language=sr variant=sr-ec
9943 !! input
9944 Latinski: -{Ne nuntium necare}-
9945 !! result
9946 <p>Латински: Ne nuntium necare
9947 </p>
9948 !! end
9949
9950
9951 !! test
9952 Prevent conversion of text with -{}- tags (language variants)
9953 !! options
9954 language=sr variant=sr-ec
9955 !! input
9956 Latinski: -{Ne nuntium necare}-
9957 !! result
9958 <p>Латински: Ne nuntium necare
9959 </p>
9960 !! end
9961
9962
9963 !! test
9964 Prevent conversion of links with -{}- tags (language variants)
9965 !! options
9966 language=sr variant=sr-ec
9967 !! input
9968 -{[[Main Page]]}-
9969 !! result
9970 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9971 </p>
9972 !! end
9973
9974
9975 !! test
9976 -{}- tags within headlines (within html for parserConvert())
9977 !! options
9978 language=sr variant=sr-ec
9979 !! input
9980 == -{Naslov}- ==
9981 !! result
9982 <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>
9983
9984 !! end
9985
9986
9987 !! test
9988 Explicit definition of language variant alternatives
9989 !! options
9990 language=zh variant=zh-tw
9991 !! input
9992 -{zh:China;zh-tw:Taiwan}-, not China
9993 !! result
9994 <p>Taiwan, not China
9995 </p>
9996 !! end
9997
9998
9999 !! test
10000 Explicit session-wise language variant mapping (A flag and - flag)
10001 !! options
10002 language=zh variant=zh-tw
10003 !! input
10004 Taiwan is not China.
10005 But -{A|zh:China;zh-tw:Taiwan}- is China,
10006 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
10007 and -{China}- is China.
10008 !! result
10009 <p>Taiwan is not China.
10010 But Taiwan is Taiwan,
10011 (This should be stripped!)
10012 and China is China.
10013 </p>
10014 !! end
10015
10016 !! test
10017 Explicit session-wise language variant mapping (H flag for hide)
10018 !! options
10019 language=zh variant=zh-tw
10020 !! input
10021 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
10022 Taiwan is China.
10023 !! result
10024 <p>(This should be stripped!)
10025 Taiwan is Taiwan.
10026 </p>
10027 !! end
10028
10029 !! test
10030 Adding explicit conversion rule for title (T flag)
10031 !! options
10032 language=zh variant=zh-tw showtitle
10033 !! input
10034 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10035 !! result
10036 Taiwan
10037 <p>Should be stripped!
10038 </p>
10039 !! end
10040
10041 !! test
10042 Testing that changing the language variant here in the tests actually works
10043 !! options
10044 language=zh variant=zh showtitle
10045 !! input
10046 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10047 !! result
10048 China
10049 <p>Should be stripped!
10050 </p>
10051 !! end
10052
10053 !! test
10054 Bug 24072: more test on conversion rule for title
10055 !! options
10056 language=zh variant=zh-tw showtitle
10057 !! input
10058 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10059 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
10060 !! result
10061 Taiwan
10062 <p>This should be stripped!
10063 This won't take interferes with the title rule.
10064 </p>
10065 !! end
10066
10067 !! test
10068 Raw output of variant escape tags (R flag)
10069 !! options
10070 language=zh variant=zh-tw
10071 !! input
10072 Raw: -{R|zh:China;zh-tw:Taiwan}-
10073 !! result
10074 <p>Raw: zh:China;zh-tw:Taiwan
10075 </p>
10076 !! end
10077
10078 !! test
10079 Nested using of manual convert syntax
10080 !! options
10081 language=zh variant=zh-hk
10082 !! input
10083 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
10084 !! result
10085 <p>Nested: Hello Hong Kong!
10086 </p>
10087 !! end
10088
10089 !! test
10090 Do not convert roman numbers to language variants
10091 !! options
10092 language=sr variant=sr-ec
10093 !! input
10094 Fridrih IV je car.
10095 !! result
10096 <p>Фридрих IV је цар.
10097 </p>
10098 !! end
10099
10100 !! test
10101 Unclosed language converter markup "-{"
10102 !! options
10103 language=sr
10104 !! input
10105 -{T|hello
10106 !! result
10107 <p>-{T|hello
10108 </p>
10109 !! end
10110
10111 !! test
10112 Don't convert raw rule "-{R|=&gt;}-" to "=>"
10113 !! options
10114 language=sr
10115 !! input
10116 -{R|=&gt;}-
10117 !! result
10118 <p>=&gt;
10119 </p>
10120 !!end
10121
10122 !!article
10123 Template:Bullet
10124 !!text
10125 * Bar
10126 !!endarticle
10127
10128 !! test
10129 Bug 529: Uncovered bullet
10130 !! input
10131 * Foo {{bullet}}
10132 !! result
10133 <ul><li> Foo
10134 </li><li> Bar
10135 </li></ul>
10136
10137 !! end
10138
10139 !! test
10140 Bug 529: Uncovered table already at line-start
10141 !! input
10142 x
10143
10144 {{table}}
10145 y
10146 !! result
10147 <p>x
10148 </p>
10149 <table>
10150 <tr>
10151 <td> 1 </td>
10152 <td> 2
10153 </td></tr>
10154 <tr>
10155 <td> 3 </td>
10156 <td> 4
10157 </td></tr></table>
10158 <p>y
10159 </p>
10160 !! end
10161
10162 !! test
10163 Bug 529: Uncovered bullet in parser function result
10164 !! input
10165 * Foo {{lc:{{bullet}} }}
10166 !! result
10167 <ul><li> Foo
10168 </li><li> bar
10169 </li></ul>
10170
10171 !! end
10172
10173 !! test
10174 Bug 5678: Double-parsed template argument
10175 !! input
10176 {{lc:{{{1}}}|hello}}
10177 !! result
10178 <p>{{{1}}}
10179 </p>
10180 !! end
10181
10182 !! test
10183 Bug 5678: Double-parsed template invocation
10184 !! input
10185 {{lc:{{paramtest {{!}} param = hello }} }}
10186 !! result
10187 <p>{{paramtest | param = hello }}
10188 </p>
10189 !! end
10190
10191 !! test
10192 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
10193 !! options
10194 language=cs
10195 title=[[Main Page]]
10196 !! input
10197 {{PRVNÍVELKÉ:ěščř}}
10198 {{prvnívelké:ěščř}}
10199 {{PRVNÍMALÉ:ěščř}}
10200 {{prvnímalé:ěščř}}
10201 {{MALÁ:ěščř}}
10202 {{malá:ěščř}}
10203 {{VELKÁ:ěščř}}
10204 {{velká:ěščř}}
10205 !! result
10206 <p>Ěščř
10207 Ěščř
10208 ěščř
10209 ěščř
10210 ěščř
10211 ěščř
10212 ĚŠČŘ
10213 ĚŠČŘ
10214 </p>
10215 !! end
10216
10217 !! test
10218 Morwen/13: Unclosed link followed by heading
10219 !! input
10220 [[link
10221 ==heading==
10222 !! result
10223 <p>[[link
10224 </p>
10225 <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>
10226
10227 !! end
10228
10229 !! test
10230 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
10231 !! input
10232 {{foo|
10233 =heading=
10234 !! result
10235 <p>{{foo|
10236 </p>
10237 <h1> <span class="mw-headline" id="heading">heading</span></h1>
10238
10239 !! end
10240
10241 !! test
10242 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
10243 !! input
10244 {{foo|
10245 ==heading==
10246 !! result
10247 <p>{{foo|
10248 </p>
10249 <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>
10250
10251 !! end
10252
10253 !! test
10254 Tildes in comments
10255 !! options
10256 pst
10257 !! input
10258 <!-- ~~~~ -->
10259 !! result
10260 <!-- ~~~~ -->
10261 !! end
10262
10263 !! test
10264 Paragraphs inside divs (no extra line breaks)
10265 !! input
10266 <div>Line one
10267
10268 Line two</div>
10269 !! result
10270 <div>Line one
10271 Line two</div>
10272
10273 !! end
10274
10275 !! test
10276 Paragraphs inside divs (extra line break on open)
10277 !! input
10278 <div>
10279 Line one
10280
10281 Line two</div>
10282 !! result
10283 <div>
10284 <p>Line one
10285 </p>
10286 Line two</div>
10287
10288 !! end
10289
10290 !! test
10291 Paragraphs inside divs (extra line break on close)
10292 !! input
10293 <div>Line one
10294
10295 Line two
10296 </div>
10297 !! result
10298 <div>Line one
10299 <p>Line two
10300 </p>
10301 </div>
10302
10303 !! end
10304
10305 !! test
10306 Paragraphs inside divs (extra line break on open and close)
10307 !! input
10308 <div>
10309 Line one
10310
10311 Line two
10312 </div>
10313 !! result
10314 <div>
10315 <p>Line one
10316 </p><p>Line two
10317 </p>
10318 </div>
10319
10320 !! end
10321
10322 !! test
10323 Nesting tags, paragraphs on lines which begin with <div>
10324 !! options
10325 disabled
10326 !! input
10327 <div></div><strong>A
10328 B</strong>
10329 !! result
10330 <div></div>
10331 <p><strong>A
10332 B</strong>
10333 </p>
10334 !! end
10335
10336 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
10337 !! test
10338 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
10339 !! options
10340 disabled
10341 !! input
10342 <blockquote>Line one
10343
10344 Line two</blockquote>
10345 !! result
10346 <blockquote>Line one
10347 Line two</blockquote>
10348
10349 !! end
10350
10351 !! test
10352 Bug 6200: paragraphs inside blockquotes (extra line break on open)
10353 !! options
10354 disabled
10355 !! input
10356 <blockquote>
10357 Line one
10358
10359 Line two</blockquote>
10360 !! result
10361 <blockquote>
10362 <p>Line one
10363 </p>
10364 Line two</blockquote>
10365
10366 !! end
10367
10368 !! test
10369 Bug 6200: paragraphs inside blockquotes (extra line break on close)
10370 !! options
10371 disabled
10372 !! input
10373 <blockquote>Line one
10374
10375 Line two
10376 </blockquote>
10377 !! result
10378 <blockquote>Line one
10379 <p>Line two
10380 </p>
10381 </blockquote>
10382
10383 !! end
10384
10385 !! test
10386 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
10387 !! options
10388 disabled
10389 !! input
10390 <blockquote>
10391 Line one
10392
10393 Line two
10394 </blockquote>
10395 !! result
10396 <blockquote>
10397 <p>Line one
10398 </p><p>Line two
10399 </p>
10400 </blockquote>
10401
10402 !! end
10403
10404 !! test
10405 Paragraphs inside blockquotes/divs (no extra line breaks)
10406 !! input
10407 <blockquote><div>Line one
10408
10409 Line two</div></blockquote>
10410 !! result
10411 <blockquote><div>Line one
10412 Line two</div></blockquote>
10413
10414 !! end
10415
10416 !! test
10417 Paragraphs inside blockquotes/divs (extra line break on open)
10418 !! input
10419 <blockquote><div>
10420 Line one
10421
10422 Line two</div></blockquote>
10423 !! result
10424 <blockquote><div>
10425 <p>Line one
10426 </p>
10427 Line two</div></blockquote>
10428
10429 !! end
10430
10431 !! test
10432 Paragraphs inside blockquotes/divs (extra line break on close)
10433 !! input
10434 <blockquote><div>Line one
10435
10436 Line two
10437 </div></blockquote>
10438 !! result
10439 <blockquote><div>Line one
10440 <p>Line two
10441 </p>
10442 </div></blockquote>
10443
10444 !! end
10445
10446 !! test
10447 Paragraphs inside blockquotes/divs (extra line break on open and close)
10448 !! input
10449 <blockquote><div>
10450 Line one
10451
10452 Line two
10453 </div></blockquote>
10454 !! result
10455 <blockquote><div>
10456 <p>Line one
10457 </p><p>Line two
10458 </p>
10459 </div></blockquote>
10460
10461 !! end
10462
10463 !! test
10464 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
10465 !! options
10466 wgLinkHolderBatchSize=0
10467 !! input
10468 [[meatball:1]]
10469 [[meatball:2]]
10470 [[meatball:3]]
10471 !! result
10472 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
10473 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
10474 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
10475 </p>
10476 !! end
10477
10478 !! test
10479 Free external link invading image caption
10480 !! input
10481 [[Image:Foobar.jpg|thumb|http://x|hello]]
10482 !! result
10483 <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>
10484
10485 !! end
10486
10487 !! test
10488 Bug 15196: localised external link numbers
10489 !! options
10490 language=fa
10491 !! input
10492 [http://en.wikipedia.org/]
10493 !! result
10494 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
10495 </p>
10496 !! end
10497
10498 !! test
10499 Multibyte character in padleft
10500 !! input
10501 {{padleft:-Hello|7|Æ}}
10502 !! result
10503 <p>Æ-Hello
10504 </p>
10505 !! end
10506
10507 !! test
10508 Multibyte character in padright
10509 !! input
10510 {{padright:Hello-|7|Æ}}
10511 !! result
10512 <p>Hello-Æ
10513 </p>
10514 !! end
10515
10516 !! test
10517 Formatted date
10518 !! config
10519 wgUseDynamicDates=1
10520 !! input
10521 [[2009-03-24]]
10522 !! result
10523 <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>
10524 </p>
10525 !!end
10526
10527 !!test
10528 formatdate parser function
10529 !!input
10530 {{#formatdate:2009-03-24}}
10531 !! result
10532 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
10533 </p>
10534 !! end
10535
10536 !!test
10537 formatdate parser function, with default format
10538 !!input
10539 {{#formatdate:2009-03-24|mdy}}
10540 !! result
10541 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
10542 </p>
10543 !! end
10544
10545 !! test
10546 Linked date with autoformatting disabled
10547 !! config
10548 wgUseDynamicDates=false
10549 !! input
10550 [[2009-03-24]]
10551 !! result
10552 <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>
10553 </p>
10554 !! end
10555
10556 !! test
10557 Spacing of numbers in formatted dates
10558 !! input
10559 {{#formatdate:January 15}}
10560 !! result
10561 <p><span class="mw-formatted-date" title="01-15">January 15</span>
10562 </p>
10563 !! end
10564
10565 !! test
10566 Spacing of numbers in formatted dates (linked)
10567 !! config
10568 wgUseDynamicDates=true
10569 !! input
10570 [[January 15]]
10571 !! result
10572 <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>
10573 </p>
10574 !! end
10575
10576 !! test
10577 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
10578 !! options
10579 language=nl title=[[MediaWiki:Common.css]]
10580 !! input
10581 {{#formatdate:2009-03-24|dmy}}
10582 !! result
10583 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
10584 </p>
10585 !! end
10586
10587 #
10588 #
10589 #
10590
10591 #
10592 # Edit comments
10593 #
10594
10595 !! test
10596 Edit comment with link
10597 !! options
10598 comment
10599 !! input
10600 I like the [[Main Page]] a lot
10601 !! result
10602 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
10603 !!end
10604
10605 !! test
10606 Edit comment with link and link text
10607 !! options
10608 comment
10609 !! input
10610 I like the [[Main Page|best pages]] a lot
10611 !! result
10612 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10613 !!end
10614
10615 !! test
10616 Edit comment with link and link text with suffix
10617 !! options
10618 comment
10619 !! input
10620 I like the [[Main Page|best page]]s a lot
10621 !! result
10622 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10623 !!end
10624
10625 !! test
10626 Edit comment with section link (non-local, eg in history list)
10627 !! options
10628 comment title=[[Main Page]]
10629 !! input
10630 /* External links */ removed bogus entries
10631 !! result
10632 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10633 !!end
10634
10635 !! test
10636 Edit comment with section link and text before it (non-local, eg in history list)
10637 !! options
10638 comment title=[[Main Page]]
10639 !! input
10640 pre-comment text /* External links */ removed bogus entries
10641 !! result
10642 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>
10643 !!end
10644
10645 !! test
10646 Edit comment with section link (local, eg in diff view)
10647 !! options
10648 comment local title=[[Main Page]]
10649 !! input
10650 /* External links */ removed bogus entries
10651 !! result
10652 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10653 !!end
10654
10655 !! test
10656 Edit comment with subpage link (bug 14080)
10657 !! options
10658 comment
10659 subpage
10660 title=[[Subpage test]]
10661 !! input
10662 Poked at a [[/subpage]] here...
10663 !! result
10664 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
10665 !!end
10666
10667 !! test
10668 Edit comment with subpage link and link text (bug 14080)
10669 !! options
10670 comment
10671 subpage
10672 title=[[Subpage test]]
10673 !! input
10674 Poked at a [[/subpage|neat little page]] here...
10675 !! result
10676 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
10677 !!end
10678
10679 !! test
10680 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
10681 !! options
10682 comment
10683 title=[[Subpage test]]
10684 !! input
10685 Poked at a [[/subpage]] here...
10686 !! result
10687 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...
10688 !!end
10689
10690 !! test
10691 Edit comment with bare anchor link (local, as on diff)
10692 !! options
10693 comment
10694 local
10695 title=[[Main Page]]
10696 !!input
10697 [[#section]]
10698 !! result
10699 <a href="#section">#section</a>
10700 !! end
10701
10702 !! test
10703 Edit comment with bare anchor link (non-local, as on history)
10704 !! options
10705 comment
10706 title=[[Main Page]]
10707 !!input
10708 [[#section]]
10709 !! result
10710 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
10711 !! end
10712
10713 !! test
10714 Anchor starting with underscore
10715 !!input
10716 [[#_ref|One]]
10717 !! result
10718 <p><a href="#_ref">One</a>
10719 </p>
10720 !! end
10721
10722 !! test
10723 Id starting with underscore
10724 !!input
10725 <div id="_ref"></div>
10726 !! result
10727 <div id="_ref"></div>
10728
10729 !! end
10730
10731 !! test
10732 Space normalisation on autocomment (bug 22784)
10733 !! options
10734 comment
10735 title=[[Main Page]]
10736 !!input
10737 /* __hello__world__ */
10738 !! result
10739 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
10740 !! end
10741
10742 !! test
10743 percent-encoding and + signs in comments (Bug 26410)
10744 !! options
10745 comment
10746 !!input
10747 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
10748 !! result
10749 <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>
10750 !! end
10751
10752 !! test
10753 Bad images - basic functionality
10754 !! options
10755 disabled
10756 !! input
10757 [[File:Bad.jpg]]
10758 !! result
10759 !! end
10760
10761 !! test
10762 Bad images - bug 16039: text after bad image disappears
10763 !! options
10764 disabled
10765 !! input
10766 Foo bar
10767 [[File:Bad.jpg]]
10768 Bar foo
10769 !! result
10770 <p>Foo bar
10771 </p><p>Bar foo
10772 </p>
10773 !! end
10774
10775 !! test
10776 Verify that displaytitle works (bug #22501) no displaytitle
10777 !! options
10778 showtitle
10779 !! config
10780 wgAllowDisplayTitle=true
10781 wgRestrictDisplayTitle=false
10782 !! input
10783 this is not the the title
10784 !! result
10785 Parser test
10786 <p>this is not the the title
10787 </p>
10788 !! end
10789
10790 !! test
10791 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
10792 !! options
10793 showtitle
10794 title=[[Screen]]
10795 !! config
10796 wgAllowDisplayTitle=true
10797 wgRestrictDisplayTitle=false
10798 !! input
10799 this is not the the title
10800 {{DISPLAYTITLE:whatever}}
10801 !! result
10802 whatever
10803 <p>this is not the the title
10804 </p>
10805 !! end
10806
10807 !! test
10808 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
10809 !! options
10810 showtitle
10811 title=[[Screen]]
10812 !! config
10813 wgAllowDisplayTitle=true
10814 wgRestrictDisplayTitle=true
10815 !! input
10816 this is not the the title
10817 {{DISPLAYTITLE:whatever}}
10818 !! result
10819 Screen
10820 <p>this is not the the title
10821 </p>
10822 !! end
10823
10824 !! test
10825 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
10826 !! options
10827 showtitle
10828 title=[[Screen]]
10829 !! config
10830 wgAllowDisplayTitle=true
10831 wgRestrictDisplayTitle=true
10832 !! input
10833 this is not the the title
10834 {{DISPLAYTITLE:screen}}
10835 !! result
10836 screen
10837 <p>this is not the the title
10838 </p>
10839 !! end
10840
10841 !! test
10842 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
10843 !! options
10844 showtitle
10845 title=[[Screen]]
10846 !! config
10847 wgAllowDisplayTitle=false
10848 !! input
10849 this is not the the title
10850 {{DISPLAYTITLE:screen}}
10851 !! result
10852 Screen
10853 <p>this is not the the title
10854 <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>
10855 </p>
10856 !! end
10857
10858 !! test
10859 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
10860 !! options
10861 showtitle
10862 title=[[Screen]]
10863 !! config
10864 wgAllowDisplayTitle=false
10865 !! input
10866 this is not the the title
10867 !! result
10868 Screen
10869 <p>this is not the the title
10870 </p>
10871 !! end
10872
10873 !! test
10874 preload: check <noinclude> and <includeonly>
10875 !! options
10876 preload
10877 !! input
10878 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
10879 !! result
10880 Hello kind world.
10881 !! end
10882
10883 !! test
10884 preload: check <onlyinclude>
10885 !! options
10886 preload
10887 !! input
10888 Goodbye <onlyinclude>Hello world</onlyinclude>
10889 !! result
10890 Hello world
10891 !! end
10892
10893 !! test
10894 preload: can pass tags through if we want to
10895 !! options
10896 preload
10897 !! input
10898 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
10899 !! result
10900 <includeonly>Hello world</includeonly>
10901 !! end
10902
10903 !! test
10904 preload: check that it doesn't try to do tricks
10905 !! options
10906 preload
10907 !! input
10908 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
10909 !! result
10910 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
10911 !! end
10912
10913 !! test
10914 Play a bit with r67090 and bug 3158
10915 !! options
10916 disabled
10917 !! input
10918 <div style="width:50% !important">&nbsp;</div>
10919 <div style="width:50%&nbsp;!important">&nbsp;</div>
10920 <div style="width:50%&#160;!important">&nbsp;</div>
10921 <div style="border : solid;">&nbsp;</div>
10922 !! result
10923 <div style="width:50% !important">&nbsp;</div>
10924 <div style="width:50% !important">&nbsp;</div>
10925 <div style="width:50% !important">&nbsp;</div>
10926 <div style="border&#160;: solid;">&nbsp;</div>
10927
10928 !! end
10929
10930 !! test
10931 HTML5 data attributes
10932 !! input
10933 <span data-foo="bar">Baz</span>
10934 <p data-abc-def_hij="">Quuz</p>
10935 !! result
10936 <p><span data-foo="bar">Baz</span>
10937 </p>
10938 <p data-abc-def_hij="">Quuz</p>
10939
10940 !! end
10941
10942 !! test
10943 percent-encoding and + signs in internal links (Bug 26410)
10944 !! input
10945 [[User:+%]] [[Page+title%]]
10946 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
10947 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
10948 [[%33%45]] [[%33%45+]]
10949 !! result
10950 <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>
10951 <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>
10952 <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>
10953 <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>
10954 </p>
10955 !! end
10956
10957 !! test
10958 Special characters in embedded file links (bug 27679)
10959 !! input
10960 [[File:Contains & ampersand.jpg]]
10961 [[File:Does not exist.jpg|Title with & ampersand]]
10962 !! result
10963 <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>
10964 <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>
10965 </p>
10966 !! end
10967
10968
10969 !! test
10970 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
10971 !! input
10972 Text&apos;s been normalized?
10973 !! result
10974 <p>Text&#39;s been normalized?
10975 </p>
10976 !! end
10977
10978 !! test
10979 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
10980 !! input
10981 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
10982 !! result
10983 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
10984 </p>
10985 !! end
10986
10987 !! test
10988 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
10989 !! input
10990 [http://www.example.org/ ideograms]
10991 !! result
10992 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
10993 </p>
10994 !! end
10995
10996 !! test
10997 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
10998 !! input
10999 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
11000 !! result
11001 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
11002 </p>
11003 !! end
11004
11005 !! article
11006 Mediawiki:loop1
11007 !! text
11008 {{Identical|A}}
11009 !! endarticle
11010
11011 !! article
11012 Mediawiki:loop2
11013 !! text
11014 {{Identical|B}}
11015 !! endarticle
11016
11017 !! article
11018 Template:Identical
11019 !! text
11020 {{int:loop1}}
11021 {{int:loop2}}
11022 !! endarticle
11023
11024 !! test
11025 Bug 31098 Template which includes system messages which includes the template
11026 !! input
11027 {{Identical}}
11028 !! result
11029 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11030 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11031 </p>
11032 !! end
11033
11034 !! test
11035 Deprecated presentational attributes are converted to css
11036 !! input
11037 {|
11038 | valign=top align=left width=100 height=25% | Asdf
11039 |}
11040 <ul type="disc"></ul>
11041 !! result
11042 <table>
11043 <tr>
11044 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
11045 </td></tr></table>
11046 <ul style="list-style-type: disc;"></ul>
11047
11048 !! end
11049
11050 !! test
11051 Bug31490 Turkish: ucfirst 'blah'
11052 !! options
11053 language=tr
11054 !! input
11055 {{ucfirst:blah}}
11056 !! result
11057 <p>Blah
11058 </p>
11059 !! end
11060
11061 !! test
11062 Bug31490 Turkish: ucfirst 'ix'
11063 !! options
11064 language=tr
11065 !! input
11066 {{ucfirst:ix}}
11067 !! result
11068 <p>İx
11069 </p>
11070 !! end
11071
11072 !! test
11073 Bug31490 Turkish: lcfirst 'BLAH'
11074 !! options
11075 language=tr
11076 !! input
11077 {{lcfirst:BLAH}}
11078 !! result
11079 <p>bLAH
11080 </p>
11081 !! end
11082
11083 !! test
11084 Bug31490 Turkish: ucfırst (with a dotless i)
11085 !! options
11086 language=tr
11087 !! input
11088 {{ucfırst:blah}}
11089 !! result
11090 <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>
11091 </p>
11092 !! end
11093
11094 !! test
11095 Bug31490 ucfırst (with a dotless i) with English language
11096 !! options
11097 language=en
11098 !! input
11099 {{ucfırst:blah}}
11100 !! result
11101 <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>
11102 </p>
11103 !! end
11104
11105 !! test
11106 Bug 26375: TOC with italics
11107 !! options
11108 title=[[Main Page]]
11109 !! input
11110 __TOC__
11111 == ''Lost'' episodes ==
11112 !! result
11113 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11114 <ul>
11115 <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>
11116 </ul>
11117 </td></tr></table>
11118 <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>
11119
11120 !! end
11121
11122 !! test
11123 Bug 26375: TOC with bold
11124 !! options
11125 title=[[Main Page]]
11126 !! input
11127 __TOC__
11128 == '''should be bold''' then normal text ==
11129 !! result
11130 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11131 <ul>
11132 <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>
11133 </ul>
11134 </td></tr></table>
11135 <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>
11136
11137 !! end
11138
11139 !! test
11140 Bug 33845: Headings become cursive in TOC when they contain an image
11141 !! options
11142 title=[[Main Page]]
11143 !! input
11144 __TOC__
11145 == Image [[Image:foobar.jpg]] ==
11146 !! result
11147 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11148 <ul>
11149 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
11150 </ul>
11151 </td></tr></table>
11152 <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>
11153
11154 !! end
11155
11156 !! test
11157 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
11158 !! options
11159 title=[[Main Page]]
11160 !! input
11161 __TOC__
11162 == <blockquote>Quote</blockquote> ==
11163 !! result
11164 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11165 <ul>
11166 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
11167 </ul>
11168 </td></tr></table>
11169 <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>
11170
11171 !! end
11172
11173 !! test
11174 Unclosed tags in TOC
11175 !! options
11176 title=[[Main Page]]
11177 !! input
11178 __TOC__
11179 == Proof: 2 < 3 ==
11180 <small>Hanc marginis exiguitas non caperet.</small>
11181 QED
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="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</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: Proof: 2 &lt; 3">edit</a>]</span> <span class="mw-headline" id="Proof:_2_.3C_3"> Proof: 2 &lt; 3 </span></h2>
11189 <p><small>Hanc marginis exiguitas non caperet.</small>
11190 QED
11191 </p>
11192 !! end
11193
11194 !! test
11195 Multiple tags in TOC
11196 !! input
11197 __TOC__
11198 == <i>Foo</i> <b>Bar</b> ==
11199
11200 == <i>Foo</i> <blockquote>Bar</blockquote> ==
11201 !! result
11202 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11203 <ul>
11204 <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>
11205 <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>
11206 </ul>
11207 </td></tr></table>
11208 <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>
11209 <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>
11210
11211 !! end
11212
11213 !! test
11214 Tags with parameters in TOC
11215 !! input
11216 __TOC__
11217 == <sup class="in-h2">Hello</sup> ==
11218
11219 == <sup class="a > b">Evilbye</sup> ==
11220 !! result
11221 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11222 <ul>
11223 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
11224 <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>
11225 </ul>
11226 </td></tr></table>
11227 <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>
11228 <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>
11229
11230 !! end
11231
11232 !! test
11233 span tags with directionality in TOC
11234 !! input
11235 __TOC__
11236 == <span dir="ltr">C++</span> ==
11237
11238 == <span dir="rtl">זבנג!</span> ==
11239
11240 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
11241
11242 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
11243
11244 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
11245 !! result
11246 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11247 <ul>
11248 <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>
11249 <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>
11250 <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>
11251 <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>
11252 <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>
11253 </ul>
11254 </td></tr></table>
11255 <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>
11256 <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>
11257 <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>
11258 <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>
11259 <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>
11260
11261 !! end
11262
11263 !! article
11264 MediaWiki:Bug32057
11265 !! text
11266 == {{int:headline_sample}} ==
11267 !! endarticle
11268
11269 !! test
11270 Bug 32057: Title needed when expanding <h> nodes.
11271 !! options
11272 title=[[Main Page]]
11273 !! input
11274 {{int:Bug32057}}
11275 !! result
11276 <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>
11277
11278 !! end
11279
11280 !! test
11281 Strip marker in urlencode
11282 !! input
11283 {{urlencode:x<nowiki/>y}}
11284 {{urlencode:x<nowiki/>y|wiki}}
11285 {{urlencode:x<nowiki/>y|path}}
11286 !! result
11287 <p>xy
11288 xy
11289 xy
11290 </p>
11291 !! end
11292
11293 !! test
11294 Strip marker in lc
11295 !! input
11296 {{lc:x<nowiki/>y}}
11297 !! result
11298 <p>xy
11299 </p>
11300 !! end
11301
11302 !! test
11303 Strip marker in uc
11304 !! input
11305 {{uc:x<nowiki/>y}}
11306 !! result
11307 <p>XY
11308 </p>
11309 !! end
11310
11311 !! test
11312 Strip marker in formatNum
11313 !! input
11314 {{formatnum:1<nowiki/>2}}
11315 {{formatnum:1<nowiki/>2|R}}
11316 !! result
11317 <p>12
11318 12
11319 </p>
11320 !! end
11321
11322 !! test
11323 Strip marker in grammar
11324 !! options
11325 language=fi
11326 !! input
11327 {{grammar:elative|foo<nowiki/>bar}}
11328 !! result
11329 <p>foobarista
11330 </p>
11331 !! end
11332
11333 !! test
11334 Strip marker in padleft
11335 !! input
11336 {{padleft:|2|x<nowiki/>y}}
11337 !! result
11338 <p>xy
11339 </p>
11340 !! end
11341
11342 !! test
11343 Strip marker in padright
11344 !! input
11345 {{padright:|2|x<nowiki/>y}}
11346 !! result
11347 <p>xy
11348 </p>
11349 !! end
11350
11351 !! test
11352 Strip marker in anchorencode
11353 !! input
11354 {{anchorencode:x<nowiki/>y}}
11355 !! result
11356 <p>xy
11357 </p>
11358 !! end
11359
11360 !! test
11361 nowiki inside link inside heading (bug 18295)
11362 !! input
11363 ==[[foo|x<nowiki>y</nowiki>z]]==
11364 !! result
11365 <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>
11366
11367 !! end
11368
11369 !! test
11370 new support for bdi element (bug 31817)
11371 !! input
11372 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11373 !! result
11374 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11375
11376 !!end
11377
11378 !! test
11379 Ignore pipe between table row attributes
11380 !! input
11381 {|
11382 | quux
11383 |- id=foo | style='color: red'
11384 | bar
11385 |}
11386 !! result
11387 <table>
11388 <tr>
11389 <td> quux
11390 </td></tr>
11391 <tr id="foo" style="color: red">
11392 <td> bar
11393 </td></tr></table>
11394
11395 !! end
11396
11397 !!test
11398 Gallery override link with WikiLink (bug 34852)
11399 !! input
11400 <gallery>
11401 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
11402 </gallery>
11403 !! result
11404 <ul class="gallery">
11405 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11406 <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>
11407 <div class="gallerytext">
11408 <p>caption
11409 </p>
11410 </div>
11411 </div></li>
11412 </ul>
11413
11414 !! end
11415
11416 !!test
11417 Gallery override link with absolute external link (bug 34852)
11418 !! input
11419 <gallery>
11420 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
11421 </gallery>
11422 !! result
11423 <ul class="gallery">
11424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11425 <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>
11426 <div class="gallerytext">
11427 <p>caption
11428 </p>
11429 </div>
11430 </div></li>
11431 </ul>
11432
11433 !! end
11434
11435 !!test
11436 Gallery override link with malicious javascript (bug 34852)
11437 !! input
11438 <gallery>
11439 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
11440 </gallery>
11441 !! result
11442 <ul class="gallery">
11443 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11444 <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>
11445 <div class="gallerytext">
11446 <p>caption
11447 </p>
11448 </div>
11449 </div></li>
11450 </ul>
11451
11452 !! end
11453
11454 !!test
11455 Language parser function
11456 !! input
11457 {{#language:ar}}
11458 !! result
11459 <p>العربية
11460 </p>
11461 !! end
11462
11463 !!test
11464 Padleft and padright as substr
11465 !! input
11466 {{padleft:|3|abcde}}
11467 {{padright:|3|abcde}}
11468 !! result
11469 <p>abc
11470 abc
11471 </p>
11472 !! end
11473
11474 !!test
11475 Bug 34939 - Case insensitive link parsing ([HttP://])
11476 !! input
11477 [HttP://MediaWiki.Org/]
11478 !! result
11479 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
11480 </p>
11481 !! end
11482
11483 !!test
11484 Bug 34939 - Case insensitive link parsing ([HttP:// title])
11485 !! input
11486 [HttP://MediaWiki.Org/ MediaWiki]
11487 !! result
11488 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
11489 </p>
11490 !! end
11491
11492 !!test
11493 Bug 34939 - Case insensitive link parsing (HttP://)
11494 !! input
11495 HttP://MediaWiki.Org/
11496 !! result
11497 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
11498 </p>
11499 !! end
11500
11501 ###
11502 ### Parsoids-specific tests
11503 ### Parsoid-PHP parser incompatibilities
11504 ###
11505 !!test
11506 1. SOL-sensitive wikitext tokens as template-args
11507 !!options
11508 disabled
11509 !!input
11510 {{echo|*a}}
11511 {{echo|#a}}
11512 {{echo|:a}}
11513 !!result
11514 <p>*a
11515 #a
11516 :a
11517 </p>
11518 !!end
11519
11520 #### The following section of tests are primarily to test
11521 #### wikitext escaping capabilities of Parsoid.
11522 #### A lot of the tests are disabled for the PHP parser either
11523 #### because of minor newline diffs or other reasons.
11524 #### As Parsoid serializer can handle newlines and other HTML
11525 #### more robustly, some of these tests might get reenabled
11526 #### for the PHP parser.
11527
11528 #### --------------- Headings ---------------
11529 #### 0. Unnested
11530 #### 1. Nested inside html <h1>=foo=</h1>
11531 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
11532 #### 3. Nested inside html with wikitext split by html tags
11533 #### 4. No escape needed
11534 #### 5. Empty headings <h1></h1>
11535 #### 6. Heading chars in SOL context
11536 #### ----------------------------------------
11537 !! test
11538 Headings: 0. Unnested
11539 !! input
11540 <nowiki>=foo=</nowiki>
11541
11542 <nowiki>=foo</nowiki>''a''=
11543 !! result
11544 <p>=foo=
11545 </p><p>=foo<i>a</i>=
11546 </p>
11547 !!end
11548
11549 !! test
11550 Headings: 1. Nested inside html
11551 !! options
11552 disabled
11553 !! input
11554 =<nowiki>=foo=</nowiki>=
11555 ==<nowiki>=foo=</nowiki>==
11556 ===<nowiki>=foo=</nowiki>===
11557 ====<nowiki>=foo=</nowiki>====
11558 =====<nowiki>=foo=</nowiki>=====
11559 ======<nowiki>=foo=</nowiki>======
11560 !! result
11561 <h1>=foo=</h1>
11562 <h2>=foo=</h2>
11563 <h3>=foo=</h3>
11564 <h4>=foo=</h4>
11565 <h5>=foo=</h5>
11566 <h6>=foo=</h6>
11567 !!end
11568
11569 !! test
11570 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
11571 !! options
11572 disabled
11573 !! input
11574 =foo=
11575 <nowiki>*bar</nowiki>
11576 =foo=
11577 =bar
11578 =foo=
11579 <nowiki>=bar=</nowiki>
11580 !! result
11581 <h1>foo</h1>*bar
11582 <h1>foo</h1>=bar
11583 <h1>foo</h1>=bar=
11584 !!end
11585
11586 !! test
11587 Headings: 3. Nested inside html with wikitext split by html tags
11588 !! options
11589 disabled
11590 !! input
11591 =<nowiki>=</nowiki>'''bold'''foo==
11592 !! result
11593 <h1>=<b>bold</b>foo=</h1>
11594 !!end
11595
11596 !! test
11597 Headings: 4. No escaping needed (testing just h1 and h2)
11598 !! options
11599 disabled
11600 !! input
11601 ==foo=
11602 =foo==
11603 ===foo==
11604 ==foo===
11605 =''=''foo==
11606 ===
11607 !! result
11608 <h1>=foo</h1>
11609 <h1>foo=</h1>
11610 <h2>=foo</h2>
11611 <h2>foo=</h2>
11612 <h1><i>=</i>foo=</h1>
11613 <h1>=</h1>
11614 !!end
11615
11616 !! test
11617 Headings: 5. Empty headings
11618 !! options
11619 disabled
11620 !! input
11621 =<nowiki></nowiki>=
11622 ==<nowiki></nowiki>==
11623 ===<nowiki></nowiki>===
11624 ====<nowiki></nowiki>====
11625 =====<nowiki></nowiki>=====
11626 ======<nowiki></nowiki>======
11627 !! result
11628 <h1></h1>
11629 <h2></h2>
11630 <h3></h3>
11631 <h4></h4>
11632 <h5></h5>
11633 <h6></h6>
11634 !!end
11635
11636 !! test
11637 Headings: 6. Heading chars in SOL context
11638 !! options
11639 disabled
11640 !! input
11641 <!--cmt--><nowiki>=h1=</nowiki>
11642 !! result
11643 <p><!--cmt-->=h1=
11644 </p>
11645 !!end
11646
11647 #### --------------- Lists ---------------
11648 #### 0. Outside nests (*foo, etc.)
11649 #### 1. Nested inside html <ul><li>*foo</li></ul>
11650 #### 2. Inside definition lists
11651 #### 3. Only bullets at start should be escaped
11652 #### 4. No escapes needed
11653 #### 5. No unnecessary escapes
11654 #### 6. Escape bullets in SOL position
11655 #### 7. Escape bullets in a multi-line context
11656 #### ----------------------------------------
11657
11658 !! test
11659 Lists: 0. Outside nests
11660 !! input
11661 <nowiki>*foo</nowiki>
11662
11663 <nowiki>#foo</nowiki>
11664 !! result
11665 <p>*foo
11666 </p><p>#foo
11667 </p>
11668 !!end
11669
11670 !! test
11671 Lists: 1. Nested inside html
11672 !! input
11673 *<nowiki>*foo</nowiki>
11674
11675 *<nowiki>#foo</nowiki>
11676
11677 *<nowiki>:foo</nowiki>
11678
11679 *<nowiki>;foo</nowiki>
11680
11681 #<nowiki>*foo</nowiki>
11682
11683 #<nowiki>#foo</nowiki>
11684
11685 #<nowiki>:foo</nowiki>
11686
11687 #<nowiki>;foo</nowiki>
11688 !! result
11689 <ul><li>*foo
11690 </li></ul>
11691 <ul><li>#foo
11692 </li></ul>
11693 <ul><li>:foo
11694 </li></ul>
11695 <ul><li>;foo
11696 </li></ul>
11697 <ol><li>*foo
11698 </li></ol>
11699 <ol><li>#foo
11700 </li></ol>
11701 <ol><li>:foo
11702 </li></ol>
11703 <ol><li>;foo
11704 </li></ol>
11705
11706 !!end
11707
11708 !! test
11709 Lists: 2. Inside definition lists
11710 !! input
11711 ;<nowiki>;foo</nowiki>
11712
11713 ;<nowiki>:foo</nowiki>
11714
11715 ;<nowiki>:foo</nowiki>
11716 :bar
11717
11718 :<nowiki>:foo</nowiki>
11719 !! result
11720 <dl><dt>;foo
11721 </dt></dl>
11722 <dl><dt>:foo
11723 </dt></dl>
11724 <dl><dt>:foo
11725 </dt><dd>bar
11726 </dd></dl>
11727 <dl><dd>:foo
11728 </dd></dl>
11729
11730 !!end
11731
11732 !! test
11733 Lists: 3. Only bullets at start of text should be escaped
11734 !! input
11735 *<nowiki>*foo*bar</nowiki>
11736
11737 *<nowiki>*foo</nowiki>''it''*bar
11738 !! result
11739 <ul><li>*foo*bar
11740 </li></ul>
11741 <ul><li>*foo<i>it</i>*bar
11742 </li></ul>
11743
11744 !!end
11745
11746 !! test
11747 Lists: 4. No escapes needed
11748 !! options
11749 disabled
11750 !! input
11751 *foo*bar
11752
11753 *''foo''*bar
11754
11755 *[[Foo]]: bar
11756 !! result
11757 <ul><li>foo*bar
11758 </li></ul>
11759 <ul><li><i>foo</i>*bar
11760 </li></ul>
11761 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
11762 </li></ul>
11763 !!end
11764
11765 !! test
11766 Lists: 5. No unnecessary escapes
11767 !! input
11768 * bar <span><nowiki>[[foo]]</nowiki></span>
11769
11770 *=bar <span><nowiki>[[foo]]</nowiki></span>
11771
11772 *[[bar <span><nowiki>[[foo]]</nowiki></span>
11773
11774 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
11775
11776 *=bar <span>foo]]</span>=
11777 !! result
11778 <ul><li> bar <span>[[foo]]</span>
11779 </li></ul>
11780 <ul><li>=bar <span>[[foo]]</span>
11781 </li></ul>
11782 <ul><li>[[bar <span>[[foo]]</span>
11783 </li></ul>
11784 <ul><li>]]bar <span>[[foo]]</span>
11785 </li></ul>
11786 <ul><li>=bar <span>foo]]</span>=
11787 </li></ul>
11788
11789 !!end
11790
11791 !! test
11792 Lists: 6. Escape bullets in SOL position
11793 !! options
11794 disabled
11795 !! input
11796 <!--cmt--><nowiki>*foo</nowiki>
11797 !! result
11798 <p><!--cmt-->*foo
11799 </p>
11800 !!end
11801
11802 !! test
11803 Lists: 7. Escape bullets in a multi-line context
11804 !! input
11805 <nowiki>a
11806 *b</nowiki>
11807 !! result
11808 <p>a
11809 *b
11810 </p>
11811 !!end
11812
11813 #### --------------- HRs ---------------
11814 #### 1. Single line
11815 #### -----------------------------------
11816
11817 !! test
11818 HRs: 1. Single line
11819 !! options
11820 disabled
11821 !! input
11822 ----
11823 <nowiki>----</nowiki>
11824 ----
11825 <nowiki>=foo=</nowiki>
11826 ----
11827 <nowiki>*foo</nowiki>
11828 !! result
11829 <hr/>----
11830 <hr/>=foo=
11831 <hr/>*foo
11832 !! end
11833
11834 #### --------------- Tables ---------------
11835 #### 1a. Simple example
11836 #### 1b. No escaping needed (!foo)
11837 #### 1c. No escaping needed (|foo)
11838 #### 1d. No escaping needed (|}foo)
11839 ####
11840 #### 2a. Nested in td (<td>foo|bar</td>)
11841 #### 2b. Nested in td (<td>foo||bar</td>)
11842 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
11843 ####
11844 #### 3a. Nested in th (<th>foo!bar</th>)
11845 #### 3b. Nested in th (<th>foo!!bar</th>)
11846 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
11847 ####
11848 #### 4a. Escape -
11849 #### 4b. Escape +
11850 #### 4c. No escaping needed
11851 #### --------------------------------------
11852
11853 !! test
11854 Tables: 1a. Simple example
11855 !! input
11856 <nowiki>{|
11857 |}</nowiki>
11858 !! result
11859 <p>{|
11860 |}
11861 </p>
11862 !! end
11863
11864 !! test
11865 Tables: 1b. No escaping needed
11866 !! input
11867 !foo
11868 !! result
11869 <p>!foo
11870 </p>
11871 !! end
11872
11873 !! test
11874 Tables: 1c. No escaping needed
11875 !! input
11876 |foo
11877 !! result
11878 <p>|foo
11879 </p>
11880 !! end
11881
11882 !! test
11883 Tables: 1d. No escaping needed
11884 !! input
11885 |}foo
11886 !! result
11887 <p>|}foo
11888 </p>
11889 !! end
11890
11891 !! test
11892 Tables: 2a. Nested in td
11893 !! options
11894 disabled
11895 !! input
11896 {|
11897 |<nowiki>foo|bar</nowiki>
11898 |}
11899 !! result
11900 <table>
11901 <tr><td>foo|bar
11902 </td></tr></table>
11903
11904 !! end
11905
11906 !! test
11907 Tables: 2b. Nested in td
11908 !! options
11909 disabled
11910 !! input
11911 {|
11912 |<nowiki>foo||bar</nowiki>
11913 |''it''<nowiki>foo||bar</nowiki>
11914 |}
11915 !! result
11916 <table>
11917 <tr><td>foo||bar
11918 </td><td><i>it</i>foo||bar
11919 </td></tr></table>
11920
11921 !! end
11922
11923 !! test
11924 Tables: 2c. Nested in td -- no escaping needed
11925 !! options
11926 disabled
11927 !! input
11928 {|
11929 |foo!!bar
11930 |}
11931 !! result
11932 <table>
11933 <tr><td>foo!!bar
11934 </td></tr></table>
11935
11936 !! end
11937
11938 !! test
11939 Tables: 3a. Nested in th
11940 !! options
11941 disabled
11942 !! input
11943 {|
11944 !foo!bar
11945 |}
11946 !! result
11947 <table>
11948 <tr><th>foo!bar
11949 </th></tr></table>
11950
11951 !! end
11952
11953 !! test
11954 Tables: 3b. Nested in th
11955 !! options
11956 disabled
11957 !! input
11958 {|
11959 !<nowiki>foo!!bar</nowiki>
11960 |}
11961 !! result
11962 <table>
11963 <tr><th>foo!!bar
11964 </th></tr></table>
11965
11966 !! end
11967
11968 !! test
11969 Tables: 3c. Nested in th -- no escaping needed
11970 !! options
11971 disabled
11972 !! input
11973 {|
11974 !foo||bar
11975 |}
11976 !! result
11977 <table>
11978 <tr><th>foo||bar
11979 </th></tr></table>
11980
11981 !! end
11982
11983 !! test
11984 Tables: 4a. Escape -
11985 !! options
11986 disabled
11987 !! input
11988 {|
11989 |-
11990 !-bar
11991 |-
11992 |<nowiki>-bar</nowiki>
11993 |}
11994 !! result
11995 <table><tbody>
11996 <tr><th>-bar</th></tr>
11997 <tr><td>-bar</td></tr>
11998 </tbody></table>
11999 !! end
12000
12001 !! test
12002 Tables: 4b. Escape +
12003 !! options
12004 disabled
12005 !! input
12006 {|
12007 |-
12008 !+bar
12009 |-
12010 |<nowiki>+bar</nowiki>
12011 |}
12012 !! result
12013 <table><tbody>
12014 <tr><th>+bar</th></tr>
12015 <tr><td>+bar</td></tr>
12016 </tbody></table>
12017 !! end
12018
12019 !! test
12020 Tables: 4c. No escaping needed
12021 !! options
12022 disabled
12023 !! input
12024 {|
12025 |-
12026 |foo-bar
12027 |foo+bar
12028 |-
12029 |''foo''-bar
12030 |''foo''+bar
12031 |}
12032 !! result
12033 <table><tbody>
12034 <tr><td>foo-bar</td><td>foo+bar</td></tr>
12035 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
12036 </tbody></table>
12037 !! end
12038
12039 #### --------------- Links ---------------
12040 #### 1. Quote marks in link text
12041 #### 2. Wikilinks: Escapes needed
12042 #### 3. Wikilinks: No escapes needed
12043 #### 4. Extlinks: Escapes needed
12044 #### 5. Extlinks: No escapes needed
12045 #### --------------------------------------
12046 !! test
12047 Links 1. Quote marks in link text
12048 !! options
12049 disabled
12050 !! input
12051 [[Foo|<nowiki>Foo''boo''</nowiki>]]
12052 !! result
12053 <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>
12054 !! end
12055
12056 !! test
12057 Links 2. WikiLinks: Escapes needed
12058 !! options
12059 disabled
12060 !! input
12061 [[Foo|<nowiki>[Foobar]</nowiki>]]
12062 [[Foo|<nowiki>Foobar]</nowiki>]]
12063 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
12064 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
12065 [[Foo|<nowiki>[[Bar]]</nowiki>]]
12066 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
12067 [[Foo|<nowiki>|Bar</nowiki>]]
12068 !! result
12069 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
12070 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
12071 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
12072 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
12073 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
12074 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
12075 <a href="Foo" rel="mw:WikiLink">|Bar</a>
12076 !! end
12077
12078 !! test
12079 Links 3. WikiLinks: No escapes needed
12080 !! options
12081 disabled
12082 !! input
12083 [[Foo|[Foobar]]
12084 [[Foo|foo|bar]]
12085 !! result
12086 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
12087 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
12088 !! end
12089
12090 !! test
12091 Links 4. ExtLinks: Escapes needed
12092 !! options
12093 disabled
12094 !! input
12095 [http://google.com <nowiki>[google]</nowiki>]
12096 [http://google.com <nowiki>google]</nowiki>]
12097 !! result
12098 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
12099 <a href="http://google.com" rel="mw:ExtLink">google]</a>
12100 !! end
12101
12102 !! test
12103 Links 5. ExtLinks: No escapes needed
12104 !! options
12105 disabled
12106 !! input
12107 [http://google.com [google]
12108 !! result
12109 <a href="http://google.com" rel="mw:ExtLink">[google</a>
12110 !! end
12111
12112 #### --------------- Quotes ---------------
12113 #### 1. Quotes inside <b> and <i>
12114 #### 2. Link fragments separated by <i> and <b> tags
12115 #### 3. Link fragments inside <i> and <b>
12116 #### --------------------------------------
12117 !! test
12118 1. Quotes inside <b> and <i>
12119 !! input
12120 ''<nowiki>'foo'</nowiki>''
12121 ''<nowiki>''foo''</nowiki>''
12122 ''<nowiki>'''foo'''</nowiki>''
12123 '''<nowiki>'foo'</nowiki>'''
12124 '''<nowiki>''foo''</nowiki>'''
12125 '''<nowiki>'''foo'''</nowiki>'''
12126 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
12127 !! result
12128 <p><i>'foo'</i>
12129 <i>''foo''</i>
12130 <i>'''foo'''</i>
12131 <b>'foo'</b>
12132 <b>''foo''</b>
12133 <b>'''foo'''</b>
12134 <b>foo'<i>bar'</i>baz</b>
12135 </p>
12136 !! end
12137
12138 !! test
12139 2. Link fragments separated by <i> and <b> tags
12140 !! input
12141 [[''foo''<nowiki>hello]]</nowiki>
12142
12143 [['''foo'''<nowiki>hello]]</nowiki>
12144 !! result
12145 <p>[[<i>foo</i>hello]]
12146 </p><p>[[<b>foo</b>hello]]
12147 </p>
12148 !! end
12149
12150 !! test
12151 2. Link fragments inside <i> and <b>
12152 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
12153 this is one of the shortcomings of this format)
12154 !! input
12155 ''[[foo''<nowiki>]]</nowiki>
12156
12157 '''[[foo'''<nowiki>]]</nowiki>
12158 !! result
12159 <p><i>[[foo</i>]]
12160 </p><p><b>[[foo</b>]]
12161 </p>
12162 !! end
12163
12164 #### --------------- Paragraphs ---------------
12165 #### 1. No unnecessary escapes
12166 #### --------------------------------------
12167
12168 !! test
12169 1. No unnecessary escapes
12170 !! input
12171 bar <span><nowiki>[[foo]]</nowiki></span>
12172
12173 =bar <span><nowiki>[[foo]]</nowiki></span>
12174
12175 [[bar <span><nowiki>[[foo]]</nowiki></span>
12176
12177 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12178
12179 <nowiki>=bar </nowiki><span>foo]]</span>=
12180 !! result
12181 <p>bar <span>[[foo]]</span>
12182 </p><p>=bar <span>[[foo]]</span>
12183 </p><p>[[bar <span>[[foo]]</span>
12184 </p><p>]]bar <span>[[foo]]</span>
12185 </p><p>=bar <span>foo]]</span>=
12186 </p>
12187 !!end
12188
12189 #### --------------- PRE ------------------
12190 #### 1. Leading space in SOL context should be escaped
12191 #### --------------------------------------
12192 !! test
12193 1. Leading space in SOL context should be escaped
12194 !! options
12195 disabled
12196 !! input
12197 <nowiki> foo</nowiki>
12198 <!--cmt--><nowiki> foo</nowiki>
12199 !! result
12200 <p> foo
12201 <!--cmt--> foo
12202 </p>
12203 !! end
12204
12205 #### --------------- HTML tags ---------------
12206 #### 1. a tags
12207 #### 2. other tags
12208 #### 3. multi-line html tag
12209 #### --------------------------------------
12210 !! test
12211 1. a tags
12212 !! options
12213 disabled
12214 !! input
12215 <a href="http://google.com">google</a>
12216 !! result
12217 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
12218 !! end
12219
12220 !! test
12221 2. other tags
12222 !! input
12223 <nowiki><div>foo</div>
12224 <div style="color:red">foo</div></nowiki>
12225 !! result
12226 <p>&lt;div&gt;foo&lt;/div&gt;
12227 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
12228 </p>
12229 !! end
12230
12231 !! test
12232 3. multi-line html tag
12233 !! input
12234 <nowiki><div
12235 >foo</div
12236 ></nowiki>
12237 !! result
12238 <p>&lt;div
12239 &gt;foo&lt;/div
12240 &gt;
12241 </p>
12242 !! end
12243
12244 #### --------------- Others ---------------
12245 !! test
12246 Escaping nowikis
12247 !! input
12248 &lt;nowiki&gt;foo&lt;/nowiki&gt;
12249 !! result
12250 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
12251 </p>
12252 !! end
12253
12254 TODO:
12255 more images
12256 more tables
12257 character entities
12258 and much more
12259 Try for 100% code coverage