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