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