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