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