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