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