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