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