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