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