support for HTML5/Microdata elements
[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
7201 !! test
7202 text with amp in the middle of nowhere
7203 !! input
7204 Remember AT&T?
7205 !!result
7206 <p>Remember AT&amp;T?
7207 </p>
7208 !! end
7209
7210 !! test
7211 text with character entity: eacute
7212 !! input
7213 I always thought &eacute; was a cute letter.
7214 !! result
7215 <p>I always thought &#233; was a cute letter.
7216 </p>
7217 !! end
7218
7219 !! test
7220 text with undefined character entity: xacute
7221 !! input
7222 I always thought &xacute; was a cute letter.
7223 !! result
7224 <p>I always thought &amp;xacute; was a cute letter.
7225 </p>
7226 !! end
7227
7228
7229 ###
7230 ### Media links
7231 ###
7232
7233 !! test
7234 Media link
7235 !! input
7236 [[Media:Foobar.jpg]]
7237 !! result
7238 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
7239 </p>
7240 !! end
7241
7242 !! test
7243 Media link with text
7244 !! input
7245 [[Media:Foobar.jpg|A neat file to look at]]
7246 !! result
7247 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
7248 </p>
7249 !! end
7250
7251 # FIXME: this is still bad HTML tag nesting
7252 !! test
7253 Media link with nasty text
7254 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
7255 !! input
7256 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
7257 !! result
7258 <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>
7259
7260 !! end
7261
7262 !! test
7263 Media link to nonexistent file (bug 1702)
7264 !! input
7265 [[Media:No such.jpg]]
7266 !! result
7267 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
7268 </p>
7269 !! end
7270
7271 !! test
7272 Image link to nonexistent file (bug 1850 - good)
7273 !! input
7274 [[Image:No such.jpg]]
7275 !! result
7276 <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>
7277 </p>
7278 !! end
7279
7280 !! test
7281 :Image link to nonexistent file (bug 1850 - bad)
7282 !! input
7283 [[:Image:No such.jpg]]
7284 !! result
7285 <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>
7286 </p>
7287 !! end
7288
7289
7290
7291 !! test
7292 Character reference normalization in link text (bug 1938)
7293 !! input
7294 [[Main Page|this&that]]
7295 !! result
7296 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
7297 </p>
7298 !!end
7299
7300 !! article
7301 אַ
7302 !! text
7303 Test for unicode normalization
7304
7305 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
7306 !! endarticle
7307
7308 !! test
7309 (bug 19451) Links should refer to the normalized form.
7310 !! input
7311 [[&#xFB2E;]]
7312 [[&#x5d0;&#x5b7;]]
7313 [[&#x5d0;ַ]]
7314 [[א&#x5b7;]]
7315 [[אַ]]
7316 !! result
7317 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
7318 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
7319 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
7320 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
7321 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
7322 </p>
7323 !! end
7324
7325 !! test
7326 Empty attribute crash test (bug 2067)
7327 !! input
7328 <font color="">foo</font>
7329 !! result
7330 <p><font color="">foo</font>
7331 </p>
7332 !! end
7333
7334 !! test
7335 Empty attribute crash test single-quotes (bug 2067)
7336 !! input
7337 <font color=''>foo</font>
7338 !! result
7339 <p><font color="">foo</font>
7340 </p>
7341 !! end
7342
7343 !! test
7344 Attribute test: equals, then nothing
7345 !! input
7346 <font color=>foo</font>
7347 !! result
7348 <p><font>foo</font>
7349 </p>
7350 !! end
7351
7352 !! test
7353 Attribute test: unquoted value
7354 !! input
7355 <font color=x>foo</font>
7356 !! result
7357 <p><font color="x">foo</font>
7358 </p>
7359 !! end
7360
7361 !! test
7362 Attribute test: unquoted but illegal value (hash)
7363 !! input
7364 <font color=#x>foo</font>
7365 !! result
7366 <p><font color="#x">foo</font>
7367 </p>
7368 !! end
7369
7370 !! test
7371 Attribute test: no value
7372 !! input
7373 <font color>foo</font>
7374 !! result
7375 <p><font color="color">foo</font>
7376 </p>
7377 !! end
7378
7379 !! test
7380 Bug 2095: link with three closing brackets
7381 !! input
7382 [[Main Page]]]
7383 !! result
7384 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
7385 </p>
7386 !! end
7387
7388 !! test
7389 Bug 2095: link with pipe and three closing brackets
7390 !! input
7391 [[Main Page|link]]]
7392 !! result
7393 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
7394 </p>
7395 !! end
7396
7397 !! test
7398 Bug 2095: link with pipe and three closing brackets, version 2
7399 !! input
7400 [[Main Page|[http://example.com/]]]
7401 !! result
7402 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
7403 </p>
7404 !! end
7405
7406
7407 ###
7408 ### Safety
7409 ###
7410
7411 !! article
7412 Template:Dangerous attribute
7413 !! text
7414 " onmouseover="alert(document.cookie)
7415 !! endarticle
7416
7417 !! article
7418 Template:Dangerous style attribute
7419 !! text
7420 border-size: expression(alert(document.cookie))
7421 !! endarticle
7422
7423 !! article
7424 Template:Div style
7425 !! text
7426 <div style="float: right; {{{1}}}">Magic div</div>
7427 !! endarticle
7428
7429 !! test
7430 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
7431 !! input
7432 <div title="{{test}}"></div>
7433 !! result
7434 <div title="This is a test template"></div>
7435
7436 !! end
7437
7438 !! test
7439 Bug 2304: HTML attribute safety (dangerous template; 2309)
7440 !! input
7441 <div title="{{dangerous attribute}}"></div>
7442 !! result
7443 <div title=""></div>
7444
7445 !! end
7446
7447 !! test
7448 Bug 2304: HTML attribute safety (dangerous style template; 2309)
7449 !! input
7450 <div style="{{dangerous style attribute}}"></div>
7451 !! result
7452 <div style="/* insecure input */"></div>
7453
7454 !! end
7455
7456 !! test
7457 Bug 2304: HTML attribute safety (safe parameter; 2309)
7458 !! input
7459 {{div style|width: 200px}}
7460 !! result
7461 <div style="float: right; width: 200px">Magic div</div>
7462
7463 !! end
7464
7465 !! test
7466 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
7467 !! input
7468 {{div style|width: expression(alert(document.cookie))}}
7469 !! result
7470 <div style="/* insecure input */">Magic div</div>
7471
7472 !! end
7473
7474 !! test
7475 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
7476 !! input
7477 {{div style|"><script>alert(document.cookie)</script>}}
7478 !! result
7479 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7480
7481 !! end
7482
7483 !! test
7484 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
7485 !! input
7486 {{div style|" ><script>alert(document.cookie)</script>}}
7487 !! result
7488 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7489
7490 !! end
7491
7492 !! test
7493 Bug 2304: HTML attribute safety (link)
7494 !! input
7495 <div title="[[Main Page]]"></div>
7496 !! result
7497 <div title="&#91;&#91;Main Page]]"></div>
7498
7499 !! end
7500
7501 !! test
7502 Bug 2304: HTML attribute safety (italics)
7503 !! input
7504 <div title="''foobar''"></div>
7505 !! result
7506 <div title="&#39;&#39;foobar&#39;&#39;"></div>
7507
7508 !! end
7509
7510 !! test
7511 Bug 2304: HTML attribute safety (bold)
7512 !! input
7513 <div title="'''foobar'''"></div>
7514 !! result
7515 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
7516
7517 !! end
7518
7519
7520 !! test
7521 Bug 2304: HTML attribute safety (ISBN)
7522 !! input
7523 <div title="ISBN 1234567890"></div>
7524 !! result
7525 <div title="&#73;SBN 1234567890"></div>
7526
7527 !! end
7528
7529 !! test
7530 Bug 2304: HTML attribute safety (RFC)
7531 !! input
7532 <div title="RFC 1234"></div>
7533 !! result
7534 <div title="&#82;FC 1234"></div>
7535
7536 !! end
7537
7538 !! test
7539 Bug 2304: HTML attribute safety (PMID)
7540 !! input
7541 <div title="PMID 1234567890"></div>
7542 !! result
7543 <div title="&#80;MID 1234567890"></div>
7544
7545 !! end
7546
7547 !! test
7548 Bug 2304: HTML attribute safety (web link)
7549 !! input
7550 <div title="http://example.com/"></div>
7551 !! result
7552 <div title="http&#58;//example.com/"></div>
7553
7554 !! end
7555
7556 !! test
7557 Bug 2304: HTML attribute safety (named web link)
7558 !! input
7559 <div title="[http://example.com/ link]"></div>
7560 !! result
7561 <div title="&#91;http&#58;//example.com/ link]"></div>
7562
7563 !! end
7564
7565 !! test
7566 Bug 3244: HTML attribute safety (extension; safe)
7567 !! input
7568 <div style="<nowiki>background:blue</nowiki>"></div>
7569 !! result
7570 <div style="background:blue"></div>
7571
7572 !! end
7573
7574 !! test
7575 Bug 3244: HTML attribute safety (extension; unsafe)
7576 !! input
7577 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
7578 !! result
7579 <div style="/* insecure input */"></div>
7580
7581 !! end
7582
7583 # More MSIE fun discovered by Tom Gilder
7584
7585 !! test
7586 MSIE CSS safety test: spurious slash
7587 !! input
7588 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
7589 !! result
7590 <div style="/* insecure input */">evil</div>
7591
7592 !! end
7593
7594 !! test
7595 MSIE CSS safety test: hex code
7596 !! input
7597 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
7598 !! result
7599 <div style="/* insecure input */">evil</div>
7600
7601 !! end
7602
7603 !! test
7604 MSIE CSS safety test: comment in url
7605 !! input
7606 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
7607 !! result
7608 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
7609
7610 !! end
7611
7612 !! test
7613 MSIE CSS safety test: comment in expression
7614 !! input
7615 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
7616 !! result
7617 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
7618
7619 !! end
7620
7621
7622 !! test
7623 Table attribute legitimate extension
7624 !! input
7625 {|
7626 !+ style="<nowiki>color:blue</nowiki>"| status
7627 |}
7628 !! result
7629 <table>
7630 <tr>
7631 <th style="color:blue"> status
7632 </th></tr></table>
7633
7634 !!end
7635
7636 !! test
7637 Table attribute safety
7638 !! input
7639 {|
7640 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
7641 |}
7642 !! result
7643 <table>
7644 <tr>
7645 <th style="/* insecure input */"> status
7646 </th></tr></table>
7647
7648 !! end
7649
7650 !! test
7651 CSS line continuation 1
7652 !! input
7653 <div style="background-image: u\&#10;rl(test.jpg);"></div>
7654 !! result
7655 <div style="/* insecure input */"></div>
7656
7657 !! end
7658
7659 !! test
7660 CSS line continuation 2
7661 !! input
7662 <div style="background-image: u\&#13;rl(test.jpg); "></div>
7663 !! result
7664 <div style="/* insecure input */"></div>
7665
7666 !! end
7667
7668 !! article
7669 Template:Identity
7670 !! text
7671 {{{1}}}
7672 !! endarticle
7673
7674 !! test
7675 Expansion of multi-line templates in attribute values (bug 6255)
7676 !! input
7677 <div style="background: {{identity|#00FF00}}">-</div>
7678 !! result
7679 <div style="background: #00FF00">-</div>
7680
7681 !! end
7682
7683
7684 !! test
7685 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
7686 !! input
7687 <div style="background:
7688 #00FF00">-</div>
7689 !! result
7690 <div style="background: #00FF00">-</div>
7691
7692 !! end
7693
7694 !! test
7695 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
7696 !! input
7697 <div style="background: &#10;#00FF00">-</div>
7698 !! result
7699 <div style="background: &#10;#00FF00">-</div>
7700
7701 !! end
7702
7703 ###
7704 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
7705 ###
7706 !! test
7707 Parser hook: empty input
7708 !! input
7709 <tag></tag>
7710 !! result
7711 <pre>
7712 ''
7713 array (
7714 )
7715 </pre>
7716
7717 !! end
7718
7719 !! test
7720 Parser hook: empty input using terminated empty elements
7721 !! input
7722 <tag/>
7723 !! result
7724 <pre>
7725 NULL
7726 array (
7727 )
7728 </pre>
7729
7730 !! end
7731
7732 !! test
7733 Parser hook: empty input using terminated empty elements (space before)
7734 !! input
7735 <tag />
7736 !! result
7737 <pre>
7738 NULL
7739 array (
7740 )
7741 </pre>
7742
7743 !! end
7744
7745 !! test
7746 Parser hook: basic input
7747 !! input
7748 <tag>input</tag>
7749 !! result
7750 <pre>
7751 'input'
7752 array (
7753 )
7754 </pre>
7755
7756 !! end
7757
7758
7759 !! test
7760 Parser hook: case insensitive
7761 !! input
7762 <TAG>input</TAG>
7763 !! result
7764 <pre>
7765 'input'
7766 array (
7767 )
7768 </pre>
7769
7770 !! end
7771
7772
7773 !! test
7774 Parser hook: case insensitive, redux
7775 !! input
7776 <TaG>input</TAg>
7777 !! result
7778 <pre>
7779 'input'
7780 array (
7781 )
7782 </pre>
7783
7784 !! end
7785
7786 !! test
7787 Parser hook: nested tags
7788 !! options
7789 noxml
7790 !! input
7791 <tag><tag></tag></tag>
7792 !! result
7793 <pre>
7794 '<tag>'
7795 array (
7796 )
7797 </pre>&lt;/tag&gt;
7798
7799 !! end
7800
7801 !! test
7802 Parser hook: basic arguments
7803 !! input
7804 <tag width=200 height = "100" depth = '50' square></tag>
7805 !! result
7806 <pre>
7807 ''
7808 array (
7809 'width' => '200',
7810 'height' => '100',
7811 'depth' => '50',
7812 'square' => 'square',
7813 )
7814 </pre>
7815
7816 !! end
7817
7818 !! test
7819 Parser hook: argument containing a forward slash (bug 5344)
7820 !! input
7821 <tag filename='/tmp/bla'></tag>
7822 !! result
7823 <pre>
7824 ''
7825 array (
7826 'filename' => '/tmp/bla',
7827 )
7828 </pre>
7829
7830 !! end
7831
7832 !! test
7833 Parser hook: empty input using terminated empty elements (bug 2374)
7834 !! input
7835 <tag foo=bar/>text
7836 !! result
7837 <pre>
7838 NULL
7839 array (
7840 'foo' => 'bar',
7841 )
7842 </pre>text
7843
7844 !! end
7845
7846 # </tag> should be output literally since there is no matching tag that begins it
7847 !! test
7848 Parser hook: basic arguments using terminated empty elements (bug 2374)
7849 !! input
7850 <tag width=200 height = "100" depth = '50' square/>
7851 other stuff
7852 </tag>
7853 !! result
7854 <pre>
7855 NULL
7856 array (
7857 'width' => '200',
7858 'height' => '100',
7859 'depth' => '50',
7860 'square' => 'square',
7861 )
7862 </pre>
7863 <p>other stuff
7864 &lt;/tag&gt;
7865 </p>
7866 !! end
7867
7868 ###
7869 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
7870 ###
7871
7872 !! test
7873 Parser hook: static parser hook not inside a comment
7874 !! input
7875 <statictag>hello, world</statictag>
7876 <statictag action=flush/>
7877 !! result
7878 <p>hello, world
7879 </p>
7880 !! end
7881
7882
7883 !! test
7884 Parser hook: static parser hook inside a comment
7885 !! input
7886 <!-- <statictag>hello, world</statictag> -->
7887 <statictag action=flush/>
7888 !! result
7889 <p><br />
7890 </p>
7891 !! end
7892
7893 # Nested template calls; this case was broken by Parser.php rev 1.506,
7894 # since reverted.
7895
7896 !! article
7897 Template:One-parameter
7898 !! text
7899 (My parameter is: {{{1}}})
7900 !! endarticle
7901
7902 !! article
7903 Template:Map-one-parameter
7904 !! text
7905 {{{{{1}}}|{{{2}}}}}
7906 !! endarticle
7907
7908 !! test
7909 Nested template calls
7910 !! input
7911 {{Map-one-parameter|One-parameter|param}}
7912 !! result
7913 <p>(My parameter is: param)
7914 </p>
7915 !! end
7916
7917
7918 ###
7919 ### Sanitizer
7920 ###
7921 !! test
7922 Sanitizer: Closing of open tags
7923 !! input
7924 <s></s><table></table>
7925 !! result
7926 <s></s><table></table>
7927
7928 !! end
7929
7930 !! test
7931 Sanitizer: Closing of open but not closed tags
7932 !! input
7933 <s>foo
7934 !! result
7935 <p><s>foo</s>
7936 </p>
7937 !! end
7938
7939 !! test
7940 Sanitizer: Closing of closed but not open tags
7941 !! input
7942 </s>
7943 !! result
7944 <p>&lt;/s&gt;
7945 </p>
7946 !! end
7947
7948 !! test
7949 Sanitizer: Closing of closed but not open table tags
7950 !! input
7951 Table not started</td></tr></table>
7952 !! result
7953 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
7954 </p>
7955 !! end
7956
7957 !! test
7958 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
7959 !! input
7960 <span id="æ: v">byte</span>[[#æ: v|backlink]]
7961 !! result
7962 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
7963 </p>
7964 !! end
7965
7966 !! test
7967 Sanitizer: Validating the contents of the id attribute (bug 4515)
7968 !! options
7969 disabled
7970 !! input
7971 <br id=9 />
7972 !! result
7973 Something, but definitely not <br id="9" />...
7974 !! end
7975
7976 !! test
7977 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
7978 !! options
7979 disabled
7980 !! input
7981 <br id="foo" /><br id="foo" />
7982 !! result
7983 Something need to be done. foo-2 ?
7984 !! end
7985
7986 !! test
7987 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
7988 !! input
7989 <div itemscope>
7990 <meta itemprop="hello" content="world">
7991 <meta http-equiv="refresh" content="5">
7992 <meta itemprop="hello" http-equiv="refresh" content="5">
7993 <link itemprop="hello" href="{{SERVER}}">
7994 <link rel="stylesheet" href="{{SERVER}}">
7995 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
7996 </div>
7997 !! result
7998 <div itemscope="itemscope">
7999 <p> <meta itemprop="hello" content="world" />
8000 &lt;meta http-equiv="refresh" content="5"&gt;
8001 <meta itemprop="hello" content="5" />
8002 </p>
8003 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8004 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>"&gt;
8005 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8006 </div>
8007
8008 !! end
8009
8010 !! test
8011 Language converter: output gets cut off unexpectedly (bug 5757)
8012 !! options
8013 language=zh
8014 !! input
8015 this bit is safe: }-
8016
8017 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8018
8019 then we get cut off here: }-
8020
8021 all additional text is vanished
8022 !! result
8023 <p>this bit is safe: }-
8024 </p><p>but if we add a conversion instance: xxx
8025 </p><p>then we get cut off here: }-
8026 </p><p>all additional text is vanished
8027 </p>
8028 !! end
8029
8030 !! test
8031 Self closed html pairs (bug 5487)
8032 !! options
8033 !! input
8034 <center><font id="bug" />Centered text</center>
8035 <div><font id="bug2" />In div text</div>
8036 !! result
8037 <center>&lt;font id="bug" /&gt;Centered text</center>
8038 <div>&lt;font id="bug2" /&gt;In div text</div>
8039
8040 !! end
8041
8042 #
8043 #
8044 #
8045
8046 !! test
8047 Punctuation: nbsp before exclamation
8048 !! input
8049 C'est grave !
8050 !! result
8051 <p>C'est grave&#160;!
8052 </p>
8053 !! end
8054
8055 !! test
8056 Punctuation: CSS !important (bug 11874)
8057 !! input
8058 <div style="width:50% !important">important</div>
8059 !! result
8060 <div style="width:50% !important">important</div>
8061
8062 !!end
8063
8064 !! test
8065 Punctuation: CSS ! important (bug 11874; with space after)
8066 !! input
8067 <div style="width:50% ! important">important</div>
8068 !! result
8069 <div style="width:50% ! important">important</div>
8070
8071 !!end
8072
8073
8074 !! test
8075 HTML bullet list, closed tags (bug 5497)
8076 !! input
8077 <ul>
8078 <li>One</li>
8079 <li>Two</li>
8080 </ul>
8081 !! result
8082 <ul>
8083 <li>One</li>
8084 <li>Two</li>
8085 </ul>
8086
8087 !! end
8088
8089 !! test
8090 HTML bullet list, unclosed tags (bug 5497)
8091 !! options
8092 disabled
8093 !! input
8094 <ul>
8095 <li>One
8096 <li>Two
8097 </ul>
8098 !! result
8099 <ul>
8100 <li>One
8101 </li><li>Two
8102 </li></ul>
8103
8104 !! end
8105
8106 !! test
8107 HTML ordered list, closed tags (bug 5497)
8108 !! input
8109 <ol>
8110 <li>One</li>
8111 <li>Two</li>
8112 </ol>
8113 !! result
8114 <ol>
8115 <li>One</li>
8116 <li>Two</li>
8117 </ol>
8118
8119 !! end
8120
8121 !! test
8122 HTML ordered list, unclosed tags (bug 5497)
8123 !! options
8124 disabled
8125 !! input
8126 <ol>
8127 <li>One
8128 <li>Two
8129 </ol>
8130 !! result
8131 <ol>
8132 <li>One
8133 </li><li>Two
8134 </li></ol>
8135
8136 !! end
8137
8138 !! test
8139 HTML nested bullet list, closed tags (bug 5497)
8140 !! input
8141 <ul>
8142 <li>One</li>
8143 <li>Two:
8144 <ul>
8145 <li>Sub-one</li>
8146 <li>Sub-two</li>
8147 </ul>
8148 </li>
8149 </ul>
8150 !! result
8151 <ul>
8152 <li>One</li>
8153 <li>Two:
8154 <ul>
8155 <li>Sub-one</li>
8156 <li>Sub-two</li>
8157 </ul>
8158 </li>
8159 </ul>
8160
8161 !! end
8162
8163 !! test
8164 HTML nested bullet list, open tags (bug 5497)
8165 !! options
8166 disabled
8167 !! input
8168 <ul>
8169 <li>One
8170 <li>Two:
8171 <ul>
8172 <li>Sub-one
8173 <li>Sub-two
8174 </ul>
8175 </ul>
8176 !! result
8177 <ul>
8178 <li>One
8179 </li><li>Two:
8180 <ul>
8181 <li>Sub-one
8182 </li><li>Sub-two
8183 </li></ul>
8184 </li></ul>
8185
8186 !! end
8187
8188 !! test
8189 HTML nested ordered list, closed tags (bug 5497)
8190 !! input
8191 <ol>
8192 <li>One</li>
8193 <li>Two:
8194 <ol>
8195 <li>Sub-one</li>
8196 <li>Sub-two</li>
8197 </ol>
8198 </li>
8199 </ol>
8200 !! result
8201 <ol>
8202 <li>One</li>
8203 <li>Two:
8204 <ol>
8205 <li>Sub-one</li>
8206 <li>Sub-two</li>
8207 </ol>
8208 </li>
8209 </ol>
8210
8211 !! end
8212
8213 !! test
8214 HTML nested ordered list, open tags (bug 5497)
8215 !! options
8216 disabled
8217 !! input
8218 <ol>
8219 <li>One
8220 <li>Two:
8221 <ol>
8222 <li>Sub-one
8223 <li>Sub-two
8224 </ol>
8225 </ol>
8226 !! result
8227 <ol>
8228 <li>One
8229 </li><li>Two:
8230 <ol>
8231 <li>Sub-one
8232 </li><li>Sub-two
8233 </li></ol>
8234 </li></ol>
8235
8236 !! end
8237
8238 !! test
8239 HTML ordered list item with parameters oddity
8240 !! input
8241 <ol><li id="fragment">One</li></ol>
8242 !! result
8243 <ol><li id="fragment">One</li></ol>
8244
8245 !! end
8246
8247 !!test
8248 bug 5918: autonumbering
8249 !! input
8250 [http://first/] [http://second] [ftp://ftp]
8251
8252 ftp://inlineftp
8253
8254 [mailto:enclosed@mail.tld With target]
8255
8256 [mailto:enclosed@mail.tld]
8257
8258 mailto:inline@mail.tld
8259 !! result
8260 <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>
8261 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
8262 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
8263 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
8264 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
8265 </p>
8266 !! end
8267
8268
8269 #
8270 # Security and HTML correctness
8271 # From Nick Jenkins' fuzz testing
8272 #
8273
8274 !! test
8275 Fuzz testing: Parser13
8276 !! input
8277 {|
8278 | http://a|
8279 !! result
8280 <table>
8281 <tr>
8282 <td>
8283 </td>
8284 </tr>
8285 </table>
8286
8287 !! end
8288
8289 !! test
8290 Fuzz testing: Parser14
8291 !! input
8292 == onmouseover= ==
8293 http://__TOC__
8294 !! result
8295 <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>
8296 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8297 <ul>
8298 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
8299 </ul>
8300 </td></tr></table>
8301
8302 !! end
8303
8304 !! test
8305 Fuzz testing: Parser14-table
8306 !! input
8307 ==a==
8308 {| STYLE=__TOC__
8309 !! result
8310 <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>
8311 <table style="&#95;_TOC&#95;_">
8312 <tr><td></td></tr>
8313 </table>
8314
8315 !! end
8316
8317 # Known to produce bogus xml (extra </td>)
8318 !! test
8319 Fuzz testing: Parser16
8320 !! options
8321 noxml
8322 !! input
8323 {|
8324 !https://||||||
8325 !! result
8326 <table>
8327 <tr>
8328 <th>https://</th>
8329 <th></th>
8330 <th></th>
8331 <th>
8332 </td>
8333 </tr>
8334 </table>
8335
8336 !! end
8337
8338 !! test
8339 Fuzz testing: Parser21
8340 !! input
8341 {|
8342 ! irc://{{ftp://a" onmouseover="alert('hello world');"
8343 |
8344 !! result
8345 <table>
8346 <tr>
8347 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
8348 </th>
8349 <td>
8350 </td>
8351 </tr>
8352 </table>
8353
8354 !! end
8355
8356 !! test
8357 Fuzz testing: Parser22
8358 !! input
8359 http://===r:::https://b
8360
8361 {|
8362 !!result
8363 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
8364 </p>
8365 <table>
8366 <tr><td></td></tr>
8367 </table>
8368
8369 !! end
8370
8371 # Known to produce bad XML for now
8372 !! test
8373 Fuzz testing: Parser24
8374 !! options
8375 noxml
8376 !! input
8377 {|
8378 {{{|
8379 <u CLASS=
8380 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
8381 <br style="onmouseover='alert(document.cookie);' " />
8382
8383 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8384 |
8385 !! result
8386 <table>
8387 {{{|
8388 <u class="&#124;">}}}} &gt;
8389 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
8390
8391 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8392 <tr>
8393 <td></u>
8394 </td>
8395 </tr>
8396 </table>
8397
8398 !! end
8399
8400 # Note: the current result listed for this is not what the original one was,
8401 # but the original bug was JavaScript injection, which is fixed in any case.
8402 # It's not clear that the original result listed was any more correct than the
8403 # current one. Original result:
8404 # <p>{{{|
8405 # </p>
8406 # <li class="&#124;&#124;">
8407 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8408 !!test
8409 Fuzz testing: Parser25 (bug 6055)
8410 !! input
8411 {{{
8412 |
8413 <LI CLASS=||
8414 >
8415 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
8416 !! result
8417 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8418 </p>
8419 !! end
8420
8421 !!test
8422 Fuzz testing: URL adjacent extension (with space, clean)
8423 !! options
8424 !! input
8425 http://example.com <nowiki>junk</nowiki>
8426 !! result
8427 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
8428 </p>
8429 !!end
8430
8431 !!test
8432 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
8433 !! options
8434 !! input
8435 http://example.com<nowiki>junk</nowiki>
8436 !! result
8437 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
8438 </p>
8439 !!end
8440
8441 !!test
8442 Fuzz testing: URL adjacent extension (no space, dirty; pre)
8443 !! options
8444 !! input
8445 http://example.com<pre>junk</pre>
8446 !! result
8447 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
8448
8449 !!end
8450
8451 !!test
8452 Fuzz testing: image with bogus manual thumbnail
8453 !!input
8454 [[Image:foobar.jpg|thumbnail= ]]
8455 !!result
8456 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
8457
8458 !!end
8459
8460 !! test
8461 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
8462 !! input
8463 <pre dir="&#10;"></pre>
8464 !! result
8465 <pre dir="&#10;"></pre>
8466
8467 !! end
8468
8469 !! test
8470 Parsing optional HTML elements (Bug 6171)
8471 !! options
8472 !! input
8473 <table>
8474 <tr>
8475 <td> Some tabular data</td>
8476 <td> More tabular data ...
8477 <td> And yet som tabular data</td>
8478 </tr>
8479 </table>
8480 !! result
8481 <table>
8482 <tr>
8483 <td> Some tabular data</td>
8484 <td> More tabular data ...
8485 </td><td> And yet som tabular data</td>
8486 </tr>
8487 </table>
8488
8489 !! end
8490
8491 !! test
8492 Correct handling of <td>, <tr> (Bug 6171)
8493 !! options
8494 !! input
8495 <table>
8496 <tr>
8497 <td> Some tabular data</td>
8498 <td> More tabular data ...</td>
8499 <td> And yet som tabular data</td>
8500 </tr>
8501 </table>
8502 !! result
8503 <table>
8504 <tr>
8505 <td> Some tabular data</td>
8506 <td> More tabular data ...</td>
8507 <td> And yet som tabular data</td>
8508 </tr>
8509 </table>
8510
8511 !! end
8512
8513
8514 !! test
8515 Parsing crashing regression (fr:JavaScript)
8516 !! input
8517 </body></x>
8518 !! result
8519 <p>&lt;/body&gt;&lt;/x&gt;
8520 </p>
8521 !! end
8522
8523 !! test
8524 Inline wiki vs wiki block nesting
8525 !! input
8526 '''Bold paragraph
8527
8528 New wiki paragraph
8529 !! result
8530 <p><b>Bold paragraph</b>
8531 </p><p>New wiki paragraph
8532 </p>
8533 !! end
8534
8535 !! test
8536 Inline HTML vs wiki block nesting
8537 !! options
8538 disabled
8539 !! input
8540 <b>Bold paragraph
8541
8542 New wiki paragraph
8543 !! result
8544 <p><b>Bold paragraph</b>
8545 </p><p>New wiki paragraph
8546 </p>
8547 !! end
8548
8549 # Original result was this:
8550 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
8551 # </p>
8552 # While that might be marginally more intuitive, maybe, the six-apostrophe
8553 # construct is clearly pathological and the result stated here (which is what
8554 # the parser actually does) is about as reasonable as anything.
8555 !!test
8556 Mixing markup for italics and bold
8557 !! options
8558 !! input
8559 '''bold''''''bold''bolditalics'''''
8560 !! result
8561 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
8562 </p>
8563 !! end
8564
8565
8566 !! article
8567 Xyzzyx
8568 !! text
8569 Article for special page transclusion test
8570 !! endarticle
8571
8572 !! test
8573 Special page transclusion
8574 !! options
8575 !! input
8576 {{Special:Prefixindex/Xyzzyx}}
8577 !! result
8578 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8579
8580 !! end
8581
8582 !! test
8583 Special page transclusion twice (bug 5021)
8584 !! options
8585 !! input
8586 {{Special:Prefixindex/Xyzzyx}}
8587 {{Special:Prefixindex/Xyzzyx}}
8588 !! result
8589 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8590 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8591
8592 !! end
8593
8594 !! test
8595 Transclusion of default MediaWiki message
8596 !! input
8597 {{MediaWiki:Mainpage}}
8598 !!result
8599 <p>Main Page
8600 </p>
8601 !! end
8602
8603 !! test
8604 Transclusion of nonexistent MediaWiki message
8605 !! input
8606 {{MediaWiki:Mainpagexxx}}
8607 !!result
8608 <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>
8609 </p>
8610 !! end
8611
8612 !! test
8613 Transclusion of MediaWiki message with underscore
8614 !! input
8615 {{MediaWiki:history_short}}
8616 !! result
8617 <p>History
8618 </p>
8619 !! end
8620
8621 !! test
8622 Transclusion of MediaWiki message with space
8623 !! input
8624 {{MediaWiki:history short}}
8625 !! result
8626 <p>History
8627 </p>
8628 !! end
8629
8630 !! test
8631 Invalid header with following text
8632 !! input
8633 = x = y
8634 !! result
8635 <p>= x = y
8636 </p>
8637 !! end
8638
8639
8640 !! test
8641 Section extraction test (section 0)
8642 !! options
8643 section=0
8644 !! input
8645 start
8646 ==a==
8647 ===aa===
8648 ====aaa====
8649 ==b==
8650 ===ba===
8651 ===bb===
8652 ====bba====
8653 ===bc===
8654 ==c==
8655 ===ca===
8656 !! result
8657 start
8658 !! end
8659
8660 !! test
8661 Section extraction test (section 1)
8662 !! options
8663 section=1
8664 !! input
8665 start
8666 ==a==
8667 ===aa===
8668 ====aaa====
8669 ==b==
8670 ===ba===
8671 ===bb===
8672 ====bba====
8673 ===bc===
8674 ==c==
8675 ===ca===
8676 !! result
8677 ==a==
8678 ===aa===
8679 ====aaa====
8680 !! end
8681
8682 !! test
8683 Section extraction test (section 2)
8684 !! options
8685 section=2
8686 !! input
8687 start
8688 ==a==
8689 ===aa===
8690 ====aaa====
8691 ==b==
8692 ===ba===
8693 ===bb===
8694 ====bba====
8695 ===bc===
8696 ==c==
8697 ===ca===
8698 !! result
8699 ===aa===
8700 ====aaa====
8701 !! end
8702
8703 !! test
8704 Section extraction test (section 3)
8705 !! options
8706 section=3
8707 !! input
8708 start
8709 ==a==
8710 ===aa===
8711 ====aaa====
8712 ==b==
8713 ===ba===
8714 ===bb===
8715 ====bba====
8716 ===bc===
8717 ==c==
8718 ===ca===
8719 !! result
8720 ====aaa====
8721 !! end
8722
8723 !! test
8724 Section extraction test (section 4)
8725 !! options
8726 section=4
8727 !! input
8728 start
8729 ==a==
8730 ===aa===
8731 ====aaa====
8732 ==b==
8733 ===ba===
8734 ===bb===
8735 ====bba====
8736 ===bc===
8737 ==c==
8738 ===ca===
8739 !! result
8740 ==b==
8741 ===ba===
8742 ===bb===
8743 ====bba====
8744 ===bc===
8745 !! end
8746
8747 !! test
8748 Section extraction test (section 5)
8749 !! options
8750 section=5
8751 !! input
8752 start
8753 ==a==
8754 ===aa===
8755 ====aaa====
8756 ==b==
8757 ===ba===
8758 ===bb===
8759 ====bba====
8760 ===bc===
8761 ==c==
8762 ===ca===
8763 !! result
8764 ===ba===
8765 !! end
8766
8767 !! test
8768 Section extraction test (section 6)
8769 !! options
8770 section=6
8771 !! input
8772 start
8773 ==a==
8774 ===aa===
8775 ====aaa====
8776 ==b==
8777 ===ba===
8778 ===bb===
8779 ====bba====
8780 ===bc===
8781 ==c==
8782 ===ca===
8783 !! result
8784 ===bb===
8785 ====bba====
8786 !! end
8787
8788 !! test
8789 Section extraction test (section 7)
8790 !! options
8791 section=7
8792 !! input
8793 start
8794 ==a==
8795 ===aa===
8796 ====aaa====
8797 ==b==
8798 ===ba===
8799 ===bb===
8800 ====bba====
8801 ===bc===
8802 ==c==
8803 ===ca===
8804 !! result
8805 ====bba====
8806 !! end
8807
8808 !! test
8809 Section extraction test (section 8)
8810 !! options
8811 section=8
8812 !! input
8813 start
8814 ==a==
8815 ===aa===
8816 ====aaa====
8817 ==b==
8818 ===ba===
8819 ===bb===
8820 ====bba====
8821 ===bc===
8822 ==c==
8823 ===ca===
8824 !! result
8825 ===bc===
8826 !! end
8827
8828 !! test
8829 Section extraction test (section 9)
8830 !! options
8831 section=9
8832 !! input
8833 start
8834 ==a==
8835 ===aa===
8836 ====aaa====
8837 ==b==
8838 ===ba===
8839 ===bb===
8840 ====bba====
8841 ===bc===
8842 ==c==
8843 ===ca===
8844 !! result
8845 ==c==
8846 ===ca===
8847 !! end
8848
8849 !! test
8850 Section extraction test (section 10)
8851 !! options
8852 section=10
8853 !! input
8854 start
8855 ==a==
8856 ===aa===
8857 ====aaa====
8858 ==b==
8859 ===ba===
8860 ===bb===
8861 ====bba====
8862 ===bc===
8863 ==c==
8864 ===ca===
8865 !! result
8866 ===ca===
8867 !! end
8868
8869 !! test
8870 Section extraction test (nonexistent section 11)
8871 !! options
8872 section=11
8873 !! input
8874 start
8875 ==a==
8876 ===aa===
8877 ====aaa====
8878 ==b==
8879 ===ba===
8880 ===bb===
8881 ====bba====
8882 ===bc===
8883 ==c==
8884 ===ca===
8885 !! result
8886 !! end
8887
8888 !! test
8889 Section extraction test with bogus heading (section 1)
8890 !! options
8891 section=1
8892 !! input
8893 ==a==
8894 ==bogus== not a legal section
8895 ==b==
8896 !! result
8897 ==a==
8898 ==bogus== not a legal section
8899 !! end
8900
8901 !! test
8902 Section extraction test with bogus heading (section 2)
8903 !! options
8904 section=2
8905 !! input
8906 ==a==
8907 ==bogus== not a legal section
8908 ==b==
8909 !! result
8910 ==b==
8911 !! end
8912
8913 !! test
8914 Section extraction test with comment after heading (section 1)
8915 !! options
8916 section=1
8917 !! input
8918 ==a==
8919 ==b== <!-- -->
8920 ==c==
8921 !! result
8922 ==a==
8923 !! end
8924
8925 !! test
8926 Section extraction test with comment after heading (section 2)
8927 !! options
8928 section=2
8929 !! input
8930 ==a==
8931 ==b== <!-- -->
8932 ==c==
8933 !! result
8934 ==b== <!-- -->
8935 !! end
8936
8937 !! test
8938 Section extraction test with bogus <nowiki> heading (section 1)
8939 !! options
8940 section=1
8941 !! input
8942 ==a==
8943 ==bogus== <nowiki>not a legal section</nowiki>
8944 ==b==
8945 !! result
8946 ==a==
8947 ==bogus== <nowiki>not a legal section</nowiki>
8948 !! end
8949
8950 !! test
8951 Section extraction test with bogus <nowiki> heading (section 2)
8952 !! options
8953 section=2
8954 !! input
8955 ==a==
8956 ==bogus== <nowiki>not a legal section</nowiki>
8957 ==b==
8958 !! result
8959 ==b==
8960 !! end
8961
8962
8963 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
8964 # instead of respecting commented sections
8965 !! test
8966 Section extraction prefixed by comment (section 1)
8967 !! options
8968 section=1
8969 !! input
8970 <!-- -->==sec1==
8971 ==sec2==
8972 !!result
8973 ==sec2==
8974 !!end
8975
8976 !! test
8977 Section extraction prefixed by comment (section 2)
8978 !! options
8979 section=2
8980 !! input
8981 <!-- -->==sec1==
8982 ==sec2==
8983 !!result
8984
8985 !!end
8986
8987
8988 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
8989 # instead of respecting HTML-style headings
8990 !! test
8991 Section extraction, mixed wiki and html (section 1)
8992 !! options
8993 section=1
8994 !! input
8995 <h2>unmarked</h2>
8996 unmarked
8997 ==1==
8998 one
8999 ==2==
9000 two
9001 !! result
9002 ==1==
9003 one
9004 !! end
9005
9006 !! test
9007 Section extraction, mixed wiki and html (section 2)
9008 !! options
9009 section=2
9010 !! input
9011 <h2>unmarked</h2>
9012 unmarked
9013 ==1==
9014 one
9015 ==2==
9016 two
9017 !! result
9018 ==2==
9019 two
9020 !! end
9021
9022
9023 # Formerly testing for bug 3342
9024 !! test
9025 Section extraction, heading surrounded by <noinclude>
9026 !! options
9027 section=1
9028 !! input
9029 <noinclude>==unmarked==</noinclude>
9030 ==marked==
9031 !! result
9032 ==marked==
9033 !!end
9034
9035 # Test behaviour of bug 19910
9036 !! test
9037 Sectiion with all-equals
9038 !! options
9039 section=2
9040 !! input
9041 ===
9042 The line above must have a trailing space
9043 === <!--
9044 --> <!-- -->
9045 But just in case it doesn't...
9046 !! result
9047 === <!--
9048 --> <!-- -->
9049 But just in case it doesn't...
9050 !! end
9051
9052 !! test
9053 Section replacement test (section 0)
9054 !! options
9055 replace=0,"xxx"
9056 !! input
9057 start
9058 ==a==
9059 ===aa===
9060 ====aaa====
9061 ==b==
9062 ===ba===
9063 ===bb===
9064 ====bba====
9065 ===bc===
9066 ==c==
9067 ===ca===
9068 !! result
9069 xxx
9070
9071 ==a==
9072 ===aa===
9073 ====aaa====
9074 ==b==
9075 ===ba===
9076 ===bb===
9077 ====bba====
9078 ===bc===
9079 ==c==
9080 ===ca===
9081 !! end
9082
9083 !! test
9084 Section replacement test (section 1)
9085 !! options
9086 replace=1,"xxx"
9087 !! input
9088 start
9089 ==a==
9090 ===aa===
9091 ====aaa====
9092 ==b==
9093 ===ba===
9094 ===bb===
9095 ====bba====
9096 ===bc===
9097 ==c==
9098 ===ca===
9099 !! result
9100 start
9101 xxx
9102
9103 ==b==
9104 ===ba===
9105 ===bb===
9106 ====bba====
9107 ===bc===
9108 ==c==
9109 ===ca===
9110 !! end
9111
9112 !! test
9113 Section replacement test (section 2)
9114 !! options
9115 replace=2,"xxx"
9116 !! input
9117 start
9118 ==a==
9119 ===aa===
9120 ====aaa====
9121 ==b==
9122 ===ba===
9123 ===bb===
9124 ====bba====
9125 ===bc===
9126 ==c==
9127 ===ca===
9128 !! result
9129 start
9130 ==a==
9131 xxx
9132
9133 ==b==
9134 ===ba===
9135 ===bb===
9136 ====bba====
9137 ===bc===
9138 ==c==
9139 ===ca===
9140 !! end
9141
9142 !! test
9143 Section replacement test (section 3)
9144 !! options
9145 replace=3,"xxx"
9146 !! input
9147 start
9148 ==a==
9149 ===aa===
9150 ====aaa====
9151 ==b==
9152 ===ba===
9153 ===bb===
9154 ====bba====
9155 ===bc===
9156 ==c==
9157 ===ca===
9158 !! result
9159 start
9160 ==a==
9161 ===aa===
9162 xxx
9163
9164 ==b==
9165 ===ba===
9166 ===bb===
9167 ====bba====
9168 ===bc===
9169 ==c==
9170 ===ca===
9171 !! end
9172
9173 !! test
9174 Section replacement test (section 4)
9175 !! options
9176 replace=4,"xxx"
9177 !! input
9178 start
9179 ==a==
9180 ===aa===
9181 ====aaa====
9182 ==b==
9183 ===ba===
9184 ===bb===
9185 ====bba====
9186 ===bc===
9187 ==c==
9188 ===ca===
9189 !! result
9190 start
9191 ==a==
9192 ===aa===
9193 ====aaa====
9194 xxx
9195
9196 ==c==
9197 ===ca===
9198 !! end
9199
9200 !! test
9201 Section replacement test (section 5)
9202 !! options
9203 replace=5,"xxx"
9204 !! input
9205 start
9206 ==a==
9207 ===aa===
9208 ====aaa====
9209 ==b==
9210 ===ba===
9211 ===bb===
9212 ====bba====
9213 ===bc===
9214 ==c==
9215 ===ca===
9216 !! result
9217 start
9218 ==a==
9219 ===aa===
9220 ====aaa====
9221 ==b==
9222 xxx
9223
9224 ===bb===
9225 ====bba====
9226 ===bc===
9227 ==c==
9228 ===ca===
9229 !! end
9230
9231 !! test
9232 Section replacement test (section 6)
9233 !! options
9234 replace=6,"xxx"
9235 !! input
9236 start
9237 ==a==
9238 ===aa===
9239 ====aaa====
9240 ==b==
9241 ===ba===
9242 ===bb===
9243 ====bba====
9244 ===bc===
9245 ==c==
9246 ===ca===
9247 !! result
9248 start
9249 ==a==
9250 ===aa===
9251 ====aaa====
9252 ==b==
9253 ===ba===
9254 xxx
9255
9256 ===bc===
9257 ==c==
9258 ===ca===
9259 !! end
9260
9261 !! test
9262 Section replacement test (section 7)
9263 !! options
9264 replace=7,"xxx"
9265 !! input
9266 start
9267 ==a==
9268 ===aa===
9269 ====aaa====
9270 ==b==
9271 ===ba===
9272 ===bb===
9273 ====bba====
9274 ===bc===
9275 ==c==
9276 ===ca===
9277 !! result
9278 start
9279 ==a==
9280 ===aa===
9281 ====aaa====
9282 ==b==
9283 ===ba===
9284 ===bb===
9285 xxx
9286
9287 ===bc===
9288 ==c==
9289 ===ca===
9290 !! end
9291
9292 !! test
9293 Section replacement test (section 8)
9294 !! options
9295 replace=8,"xxx"
9296 !! input
9297 start
9298 ==a==
9299 ===aa===
9300 ====aaa====
9301 ==b==
9302 ===ba===
9303 ===bb===
9304 ====bba====
9305 ===bc===
9306 ==c==
9307 ===ca===
9308 !! result
9309 start
9310 ==a==
9311 ===aa===
9312 ====aaa====
9313 ==b==
9314 ===ba===
9315 ===bb===
9316 ====bba====
9317 xxx
9318
9319 ==c==
9320 ===ca===
9321 !!end
9322
9323 !! test
9324 Section replacement test (section 9)
9325 !! options
9326 replace=9,"xxx"
9327 !! input
9328 start
9329 ==a==
9330 ===aa===
9331 ====aaa====
9332 ==b==
9333 ===ba===
9334 ===bb===
9335 ====bba====
9336 ===bc===
9337 ==c==
9338 ===ca===
9339 !! result
9340 start
9341 ==a==
9342 ===aa===
9343 ====aaa====
9344 ==b==
9345 ===ba===
9346 ===bb===
9347 ====bba====
9348 ===bc===
9349 xxx
9350 !! end
9351
9352 !! test
9353 Section replacement test (section 10)
9354 !! options
9355 replace=10,"xxx"
9356 !! input
9357 start
9358 ==a==
9359 ===aa===
9360 ====aaa====
9361 ==b==
9362 ===ba===
9363 ===bb===
9364 ====bba====
9365 ===bc===
9366 ==c==
9367 ===ca===
9368 !! result
9369 start
9370 ==a==
9371 ===aa===
9372 ====aaa====
9373 ==b==
9374 ===ba===
9375 ===bb===
9376 ====bba====
9377 ===bc===
9378 ==c==
9379 xxx
9380 !! end
9381
9382 !! test
9383 Section replacement test with initial whitespace (bug 13728)
9384 !! options
9385 replace=2,"xxx"
9386 !! input
9387 Preformatted initial line
9388 ==a==
9389 ===a===
9390 !! result
9391 Preformatted initial line
9392 ==a==
9393 xxx
9394 !! end
9395
9396
9397 !! test
9398 Section extraction, heading followed by pre with 20 spaces (bug 6398)
9399 !! options
9400 section=1
9401 !! input
9402 ==a==
9403 a
9404 !! result
9405 ==a==
9406 a
9407 !! end
9408
9409 !! test
9410 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
9411 !! options
9412 section=1
9413 !! input
9414 ==a==
9415 a
9416 !! result
9417 ==a==
9418 a
9419 !! end
9420
9421
9422 !! test
9423 Section extraction, <pre> around bogus header (bug 10309)
9424 !! options
9425 noxml section=2
9426 !! input
9427 == Section One ==
9428 <pre>
9429 =======
9430 </pre>
9431
9432 == Section Two ==
9433 stuff
9434 !! result
9435 == Section Two ==
9436 stuff
9437 !! end
9438
9439 !! test
9440 Section replacement, <pre> around bogus header (bug 10309)
9441 !! options
9442 noxml replace=2,"xxx"
9443 !! input
9444 == Section One ==
9445 <pre>
9446 =======
9447 </pre>
9448
9449 == Section Two ==
9450 stuff
9451 !! result
9452 == Section One ==
9453 <pre>
9454 =======
9455 </pre>
9456
9457 xxx
9458 !! end
9459
9460
9461
9462 !! test
9463 Handling of &#x0A; in URLs
9464 !! input
9465 **irc://&#x0A;a
9466 !! result
9467 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
9468 </li></ul>
9469 </li></ul>
9470
9471 !!end
9472
9473 !! test
9474 5 quotes, code coverage +1 line
9475 !! input
9476 '''''
9477 !! result
9478 !! end
9479
9480 !! test
9481 Special:Search page linking.
9482 !! input
9483 {{Special:search}}
9484 !! result
9485 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
9486 </p>
9487 !! end
9488
9489 !! test
9490 Say the magic word
9491 !! input
9492 * {{PAGENAME}}
9493 * {{BASEPAGENAME}}
9494 * {{SUBPAGENAME}}
9495 * {{SUBPAGENAMEE}}
9496 * {{BASEPAGENAME}}
9497 * {{BASEPAGENAMEE}}
9498 * {{TALKPAGENAME}}
9499 * {{TALKPAGENAMEE}}
9500 * {{SUBJECTPAGENAME}}
9501 * {{SUBJECTPAGENAMEE}}
9502 * {{NAMESPACEE}}
9503 * {{NAMESPACE}}
9504 * {{TALKSPACE}}
9505 * {{TALKSPACEE}}
9506 * {{SUBJECTSPACE}}
9507 * {{SUBJECTSPACEE}}
9508 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
9509 !! result
9510 <ul><li> Parser test
9511 </li><li> Parser test
9512 </li><li> Parser test
9513 </li><li> Parser_test
9514 </li><li> Parser test
9515 </li><li> Parser_test
9516 </li><li> Talk:Parser test
9517 </li><li> Talk:Parser_test
9518 </li><li> Parser test
9519 </li><li> Parser_test
9520 </li><li>
9521 </li><li>
9522 </li><li> Talk
9523 </li><li> Talk
9524 </li><li>
9525 </li><li>
9526 </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>
9527 </li></ul>
9528
9529 !! end
9530 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
9531
9532 !! test
9533 Gallery
9534 !! input
9535 <gallery>
9536 image1.png |
9537 image2.gif|||||
9538
9539 image3|
9540 image4 |300px| centre
9541 image5.svg| http://///////
9542 [[x|xx]]]]
9543 * image6
9544 </gallery>
9545 !! result
9546 <ul class="gallery">
9547 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9548 <div style="height: 150px;">Image1.png</div>
9549 <div class="gallerytext">
9550 </div>
9551 </div></li>
9552 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9553 <div style="height: 150px;">Image2.gif</div>
9554 <div class="gallerytext">
9555 <p>||||
9556 </p>
9557 </div>
9558 </div></li>
9559 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9560 <div style="height: 150px;">Image3</div>
9561 <div class="gallerytext">
9562 </div>
9563 </div></li>
9564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9565 <div style="height: 150px;">Image4</div>
9566 <div class="gallerytext">
9567 <p>300px| centre
9568 </p>
9569 </div>
9570 </div></li>
9571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9572 <div style="height: 150px;">Image5.svg</div>
9573 <div class="gallerytext">
9574 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
9575 </p>
9576 </div>
9577 </div></li>
9578 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9579 <div style="height: 150px;">* image6</div>
9580 <div class="gallerytext">
9581 </div>
9582 </div></li>
9583 </ul>
9584
9585 !! end
9586
9587 !! test
9588 Gallery (with options)
9589 !! input
9590 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
9591 File:Nonexistant.jpg|caption
9592 File:Nonexistant.jpg
9593 image:foobar.jpg|some '''caption''' [[Main Page]]
9594 image:foobar.jpg
9595 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
9596 </gallery>
9597 !! result
9598 <ul class="gallery" style="max-width: 226px;_width: 226px;">
9599 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
9600 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9601 <div style="height: 70px;">Nonexistant.jpg</div>
9602 <div class="gallerytext">
9603 <p>caption
9604 </p>
9605 </div>
9606 </div></li>
9607 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9608 <div style="height: 70px;">Nonexistant.jpg</div>
9609 <div class="gallerytext">
9610 </div>
9611 </div></li>
9612 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9613 <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>
9614 <div class="gallerytext">
9615 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9616 </p>
9617 </div>
9618 </div></li>
9619 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9620 <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>
9621 <div class="gallerytext">
9622 </div>
9623 </div></li>
9624 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9625 <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>
9626 <div class="gallerytext">
9627 <p>Blabla|blabla.
9628 </p>
9629 </div>
9630 </div></li>
9631 </ul>
9632
9633 !! end
9634
9635 !! test
9636 Gallery with wikitext inside caption
9637 !! input
9638 <gallery>
9639 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
9640 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
9641 </gallery>
9642 !! result
9643 <ul class="gallery">
9644 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9645 <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>
9646 <div class="gallerytext">
9647 <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>
9648 </p>
9649 </div>
9650 </div></li>
9651 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9652 <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>
9653 <div class="gallerytext">
9654 <p>This is a test template
9655 </p>
9656 </div>
9657 </div></li>
9658 </ul>
9659
9660 !! end
9661
9662 !! test
9663 gallery (with showfilename option)
9664 !! input
9665 <gallery showfilename>
9666 File:Nonexistant.jpg|caption
9667 File:Nonexistant.jpg
9668 image:foobar.jpg|some '''caption''' [[Main Page]]
9669 File:Foobar.jpg
9670 </gallery>
9671 !! result
9672 <ul class="gallery">
9673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9674 <div style="height: 150px;">Nonexistant.jpg</div>
9675 <div class="gallerytext">
9676 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9677 caption
9678 </p>
9679 </div>
9680 </div></li>
9681 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9682 <div style="height: 150px;">Nonexistant.jpg</div>
9683 <div class="gallerytext">
9684 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9685 </p>
9686 </div>
9687 </div></li>
9688 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9689 <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>
9690 <div class="gallerytext">
9691 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9692 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9693 </p>
9694 </div>
9695 </div></li>
9696 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9697 <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>
9698 <div class="gallerytext">
9699 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9700 </p>
9701 </div>
9702 </div></li>
9703 </ul>
9704
9705 !! end
9706
9707 !! test
9708 Gallery (with namespace-less filenames)
9709 !! input
9710 <gallery>
9711 File:Nonexistant.jpg
9712 Nonexistant.jpg
9713 image:foobar.jpg
9714 foobar.jpg
9715 </gallery>
9716 !! result
9717 <ul class="gallery">
9718 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9719 <div style="height: 150px;">Nonexistant.jpg</div>
9720 <div class="gallerytext">
9721 </div>
9722 </div></li>
9723 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9724 <div style="height: 150px;">Nonexistant.jpg</div>
9725 <div class="gallerytext">
9726 </div>
9727 </div></li>
9728 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9729 <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>
9730 <div class="gallerytext">
9731 </div>
9732 </div></li>
9733 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9734 <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>
9735 <div class="gallerytext">
9736 </div>
9737 </div></li>
9738 </ul>
9739
9740 !! end
9741
9742 !! test
9743 HTML Hex character encoding (spells the word "JavaScript")
9744 !! input
9745 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
9746 !! result
9747 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
9748 </p>
9749 !! end
9750
9751 !! test
9752 HTML Hex character encoding bogus encoding (bug 26437 regression check)
9753 !! input
9754 &#xsee;&#XSEE;
9755 !! result
9756 <p>&amp;#xsee;&amp;#XSEE;
9757 </p>
9758 !! end
9759
9760 !! test
9761 HTML Hex character encoding mixed case
9762 !! input
9763 &#xEE;&#Xee;
9764 !! result
9765 <p>&#xee;&#xee;
9766 </p>
9767 !! end
9768
9769 !! test
9770 __FORCETOC__ override
9771 !! input
9772 __NEWSECTIONLINK__
9773 __FORCETOC__
9774 !! result
9775 <p><br />
9776 </p>
9777 !! end
9778
9779 !! test
9780 ISBN code coverage
9781 !! input
9782 ISBN 978-0-1234-56&#x20;789
9783 !! result
9784 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
9785 </p>
9786 !! end
9787
9788 !! test
9789 ISBN followed by 5 spaces
9790 !! input
9791 ISBN
9792 !! result
9793 <p>ISBN
9794 </p>
9795 !! end
9796
9797 !! test
9798 Double ISBN
9799 !! input
9800 ISBN ISBN 1234567890
9801 !! result
9802 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9803 </p>
9804 !! end
9805
9806 !! test
9807 Bug 22905: <abbr> followed by ISBN followed by </a>
9808 !! input
9809 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
9810 !! result
9811 <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>
9812 </p>
9813 !! end
9814
9815 !! test
9816 Double RFC
9817 !! input
9818 RFC RFC 1234
9819 !! result
9820 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
9821 </p>
9822 !! end
9823
9824 !! test
9825 Double RFC with a wiki link
9826 !! input
9827 RFC [[RFC 1234]]
9828 !! result
9829 <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>
9830 </p>
9831 !! end
9832
9833 !! test
9834 RFC code coverage
9835 !! input
9836 RFC 983&#x20;987
9837 !! result
9838 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
9839 </p>
9840 !! end
9841
9842 !! test
9843 Centre-aligned image
9844 !! input
9845 [[Image:foobar.jpg|centre]]
9846 !! result
9847 <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>
9848
9849 !!end
9850
9851 !! test
9852 None-aligned image
9853 !! input
9854 [[Image:foobar.jpg|none]]
9855 !! result
9856 <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>
9857
9858 !!end
9859
9860 !! test
9861 Width + Height sized image (using px) (height is ignored)
9862 !! input
9863 [[Image:foobar.jpg|640x480px]]
9864 !! result
9865 <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>
9866 </p>
9867 !!end
9868
9869 !! test
9870 Width-sized image (using px, no following whitespace)
9871 !! input
9872 [[Image:foobar.jpg|640px]]
9873 !! result
9874 <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>
9875 </p>
9876 !!end
9877
9878 !! test
9879 Width-sized image (using px, with following whitespace - test regression from r39467)
9880 !! input
9881 [[Image:foobar.jpg|640px ]]
9882 !! result
9883 <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>
9884 </p>
9885 !!end
9886
9887 !! test
9888 Width-sized image (using px, with preceding whitespace - test regression from r39467)
9889 !! input
9890 [[Image:foobar.jpg| 640px]]
9891 !! result
9892 <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>
9893 </p>
9894 !!end
9895
9896 !! test
9897 Another italics / bold test
9898 !! input
9899 ''' ''x'
9900 !! result
9901 <pre>'<i> </i>x'
9902 </pre>
9903 !!end
9904
9905 # Note the results may be incorrect, as parserTest output included this:
9906 # XML error: Mismatched tag at byte 6120:
9907 # ...<dd> </dt></dl> </dd...
9908 !! test
9909 dt/dd/dl test
9910 !! options
9911 disabled
9912 !! input
9913 :;;;::
9914 !! result
9915 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
9916 </dd></dl>
9917 </dd></dl>
9918 </dt></dl>
9919 </dt></dl>
9920 </dt></dl>
9921 </dd></dl>
9922
9923 !!end
9924
9925
9926 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
9927 !! test
9928 Images with the "|" character in the comment
9929 !! input
9930 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
9931 !! result
9932 <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>
9933
9934 !!end
9935
9936 !! test
9937 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
9938 !! input
9939 <html><script>alert(1);</script></html>
9940 !! result
9941 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
9942 </p>
9943 !! end
9944
9945 !! test
9946 HTML with raw HTML ($wgRawHtml==true)
9947 !! options
9948 rawhtml
9949 !! input
9950 <html><script>alert(1);</script></html>
9951 !! result
9952 <p><script>alert(1);</script>
9953 </p>
9954 !! end
9955
9956 !! test
9957 Parents of subpages, one level up
9958 !! options
9959 subpage title=[[Subpage test/L1/L2/L3]]
9960 !! input
9961 [[../|L2]]
9962 !! result
9963 <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>
9964 </p>
9965 !! end
9966
9967
9968 !! test
9969 Parents of subpages, one level up, not named
9970 !! options
9971 subpage title=[[Subpage test/L1/L2/L3]]
9972 !! input
9973 [[../]]
9974 !! result
9975 <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>
9976 </p>
9977 !! end
9978
9979
9980
9981 !! test
9982 Parents of subpages, two levels up
9983 !! options
9984 subpage title=[[Subpage test/L1/L2/L3]]
9985 !! input
9986 [[../../|L1]]2
9987
9988 [[../../|L1]]l
9989 !! result
9990 <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
9991 </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>
9992 </p>
9993 !! end
9994
9995 !! test
9996 Parents of subpages, two levels up, without trailing slash or name.
9997 !! options
9998 subpage title=[[Subpage test/L1/L2/L3]]
9999 !! input
10000 [[../..]]
10001 !! result
10002 <p>[[../..]]
10003 </p>
10004 !! end
10005
10006 !! test
10007 Parents of subpages, two levels up, with lots of extra trailing slashes.
10008 !! options
10009 subpage title=[[Subpage test/L1/L2/L3]]
10010 !! input
10011 [[../../////]]
10012 !! result
10013 <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>
10014 </p>
10015 !! end
10016
10017 !! test
10018 Definition list code coverage
10019 !! input
10020 ; title : def
10021 ; title : def
10022 ;title: def
10023 !! result
10024 <dl><dt> title &#160;</dt><dd> def
10025 </dd><dt> title&#160;</dt><dd> def
10026 </dd><dt>title</dt><dd> def
10027 </dd></dl>
10028
10029 !! end
10030
10031 !! test
10032 Don't fall for the self-closing div
10033 !! input
10034 <div>hello world</div/>
10035 !! result
10036 <div>hello world</div>
10037
10038 !! end
10039
10040 !! test
10041 MSGNW magic word
10042 !! input
10043 {{MSGNW:msg}}
10044 !! result
10045 <p>&#91;&#91;:Template:Msg&#93;&#93;
10046 </p>
10047 !! end
10048
10049 !! test
10050 RAW magic word
10051 !! input
10052 {{RAW:QUERTY}}
10053 !! result
10054 <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>
10055 </p>
10056 !! end
10057
10058 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10059 !! test
10060 Always escape literal '>' in output, not just after '<'
10061 !! input
10062 ><>
10063 !! result
10064 <p>&gt;&lt;&gt;
10065 </p>
10066 !! end
10067
10068 !! test
10069 Template caching
10070 !! input
10071 {{Test}}
10072 {{Test}}
10073 !! result
10074 <p>This is a test template
10075 This is a test template
10076 </p>
10077 !! end
10078
10079
10080 !! article
10081 MediaWiki:Fake
10082 !! text
10083 ==header==
10084 !! endarticle
10085
10086 !! test
10087 Inclusion of !userCanEdit() content
10088 !! input
10089 {{MediaWiki:Fake}}
10090 !! result
10091 <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>
10092
10093 !! end
10094
10095
10096 !! test
10097 Out-of-order TOC heading levels
10098 !! input
10099 ==2==
10100 ======6======
10101 ===3===
10102 =1=
10103 =====5=====
10104 ==2==
10105 !! result
10106 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10107 <ul>
10108 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10109 <ul>
10110 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10111 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10112 </ul>
10113 </li>
10114 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10115 <ul>
10116 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10117 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10118 </ul>
10119 </li>
10120 </ul>
10121 </td></tr></table>
10122 <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>
10123 <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>
10124 <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>
10125 <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>
10126 <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>
10127 <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>
10128
10129 !! end
10130
10131
10132 !! test
10133 ISBN with a dummy number
10134 !! input
10135 ISBN ---
10136 !! result
10137 <p>ISBN ---
10138 </p>
10139 !! end
10140
10141
10142 !! test
10143 ISBN with space-delimited number
10144 !! input
10145 ISBN 92 9017 032 8
10146 !! result
10147 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10148 </p>
10149 !! end
10150
10151
10152 !! test
10153 ISBN with multiple spaces, no number
10154 !! input
10155 ISBN foo
10156 !! result
10157 <p>ISBN foo
10158 </p>
10159 !! end
10160
10161
10162 !! test
10163 ISBN length
10164 !! input
10165 ISBN 123456789
10166
10167 ISBN 1234567890
10168
10169 ISBN 12345678901
10170 !! result
10171 <p>ISBN 123456789
10172 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10173 </p><p>ISBN 12345678901
10174 </p>
10175 !! end
10176
10177
10178 !! test
10179 ISBN with trailing year (bug 8110)
10180 !! input
10181 ISBN 1-234-56789-0 - 2006
10182
10183 ISBN 1 234 56789 0 - 2006
10184 !! result
10185 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10186 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10187 </p>
10188 !! end
10189
10190
10191 !! test
10192 anchorencode
10193 !! input
10194 {{anchorencode:foo bar©#%n}}
10195 !! result
10196 <p>foo_bar.C2.A9.23.25n
10197 </p>
10198 !! end
10199
10200 !! test
10201 anchorencode trims spaces
10202 !! input
10203 {{anchorencode: __pretty__please__}}
10204 !! result
10205 <p>pretty_please
10206 </p>
10207 !! end
10208
10209 !! test
10210 anchorencode deals with links
10211 !! input
10212 {{anchorencode: [[hello|world]] [[hi]]}}
10213 !! result
10214 <p>world_hi
10215 </p>
10216 !! end
10217
10218 !! test
10219 anchorencode deals with templates
10220 !! input
10221 {{anchorencode: {{Foo}} }}
10222 !! result
10223 <p>FOO
10224 </p>
10225 !! end
10226
10227 !! test
10228 anchorencode encodes like the TOC generator: (bug 18431)
10229 !! input
10230 === _ +:.3A%3A&&amp;]] ===
10231 {{anchorencode: _ +:.3A%3A&&amp;]] }}
10232 __NOEDITSECTION__
10233 !! result
10234 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
10235 <p>.2B:.3A.253A.26.26.5D.5D
10236 </p>
10237 !! end
10238
10239 # Expected output in the following test is not necessarily expected (there
10240 # should probably be <p> tags inside the <blockquote> in the output) -- it's
10241 # only testing for well-formedness.
10242 !! test
10243 Bug 6200: blockquotes and paragraph formatting
10244 !! input
10245 <blockquote>
10246 foo
10247 </blockquote>
10248
10249 bar
10250
10251 baz
10252 !! result
10253 <blockquote>
10254 foo
10255 </blockquote>
10256 <p>bar
10257 </p>
10258 <pre>baz
10259 </pre>
10260 !! end
10261
10262 !! test
10263 Bug 8293: Use of center tag ruins paragraph formatting
10264 !! input
10265 <center>
10266 foo
10267 </center>
10268
10269 bar
10270
10271 baz
10272 !! result
10273 <center>
10274 <p>foo
10275 </p>
10276 </center>
10277 <p>bar
10278 </p>
10279 <pre>baz
10280 </pre>
10281 !! end
10282
10283
10284 ###
10285 ### Language variants related tests
10286 ###
10287 !! test
10288 Self-link in language variants
10289 !! options
10290 title=[[Dunav]] language=sr
10291 !! input
10292 Both [[Dunav]] and [[Дунав]] are names for this river.
10293 !! result
10294 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
10295 </p>
10296 !!end
10297
10298
10299 !! test
10300 Link to pages in language variants
10301 !! options
10302 language=sr
10303 !! input
10304 Main Page can be written as [[Маин Паге]]
10305 !! result
10306 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
10307 </p>
10308 !!end
10309
10310
10311 !! test
10312 Multiple links to pages in language variants
10313 !! options
10314 language=sr
10315 !! input
10316 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
10317 !! result
10318 <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>.
10319 </p>
10320 !!end
10321
10322
10323 !! test
10324 Simple template in language variants
10325 !! options
10326 language=sr
10327 !! input
10328 {{тест}}
10329 !! result
10330 <p>This is a test template
10331 </p>
10332 !! end
10333
10334
10335 !! test
10336 Template with explicit namespace in language variants
10337 !! options
10338 language=sr
10339 !! input
10340 {{Template:тест}}
10341 !! result
10342 <p>This is a test template
10343 </p>
10344 !! end
10345
10346
10347 !! test
10348 Basic test for template parameter in language variants
10349 !! options
10350 language=sr
10351 !! input
10352 {{парамтест|param=foo}}
10353 !! result
10354 <p>This is a test template with parameter foo
10355 </p>
10356 !! end
10357
10358
10359 !! test
10360 Simple category in language variants
10361 !! options
10362 language=sr cat
10363 !! input
10364 [[Category:МедиаWики Усер'с Гуиде]]
10365 !! result
10366 <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>
10367 !! end
10368
10369
10370 !! test
10371 Stripping -{}- tags (language variants)
10372 !! options
10373 language=sr
10374 !! input
10375 Latin proverb: -{Ne nuntium necare}-
10376 !! result
10377 <p>Latin proverb: Ne nuntium necare
10378 </p>
10379 !! end
10380
10381
10382 !! test
10383 Prevent conversion with -{}- tags (language variants)
10384 !! options
10385 language=sr variant=sr-ec
10386 !! input
10387 Latinski: -{Ne nuntium necare}-
10388 !! result
10389 <p>Латински: Ne nuntium necare
10390 </p>
10391 !! end
10392
10393
10394 !! test
10395 Prevent conversion of text with -{}- tags (language variants)
10396 !! options
10397 language=sr variant=sr-ec
10398 !! input
10399 Latinski: -{Ne nuntium necare}-
10400 !! result
10401 <p>Латински: Ne nuntium necare
10402 </p>
10403 !! end
10404
10405
10406 !! test
10407 Prevent conversion of links with -{}- tags (language variants)
10408 !! options
10409 language=sr variant=sr-ec
10410 !! input
10411 -{[[Main Page]]}-
10412 !! result
10413 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10414 </p>
10415 !! end
10416
10417
10418 !! test
10419 -{}- tags within headlines (within html for parserConvert())
10420 !! options
10421 language=sr variant=sr-ec
10422 !! input
10423 == -{Naslov}- ==
10424 !! result
10425 <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>
10426
10427 !! end
10428
10429
10430 !! test
10431 Explicit definition of language variant alternatives
10432 !! options
10433 language=zh variant=zh-tw
10434 !! input
10435 -{zh:China;zh-tw:Taiwan}-, not China
10436 !! result
10437 <p>Taiwan, not China
10438 </p>
10439 !! end
10440
10441
10442 !! test
10443 Explicit session-wise language variant mapping (A flag and - flag)
10444 !! options
10445 language=zh variant=zh-tw
10446 !! input
10447 Taiwan is not China.
10448 But -{A|zh:China;zh-tw:Taiwan}- is China,
10449 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
10450 and -{China}- is China.
10451 !! result
10452 <p>Taiwan is not China.
10453 But Taiwan is Taiwan,
10454 (This should be stripped!)
10455 and China is China.
10456 </p>
10457 !! end
10458
10459 !! test
10460 Explicit session-wise language variant mapping (H flag for hide)
10461 !! options
10462 language=zh variant=zh-tw
10463 !! input
10464 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
10465 Taiwan is China.
10466 !! result
10467 <p>(This should be stripped!)
10468 Taiwan is Taiwan.
10469 </p>
10470 !! end
10471
10472 !! test
10473 Adding explicit conversion rule for title (T flag)
10474 !! options
10475 language=zh variant=zh-tw showtitle
10476 !! input
10477 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10478 !! result
10479 Taiwan
10480 <p>Should be stripped!
10481 </p>
10482 !! end
10483
10484 !! test
10485 Testing that changing the language variant here in the tests actually works
10486 !! options
10487 language=zh variant=zh showtitle
10488 !! input
10489 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10490 !! result
10491 China
10492 <p>Should be stripped!
10493 </p>
10494 !! end
10495
10496 !! test
10497 Bug 24072: more test on conversion rule for title
10498 !! options
10499 language=zh variant=zh-tw showtitle
10500 !! input
10501 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10502 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
10503 !! result
10504 Taiwan
10505 <p>This should be stripped!
10506 This won't take interferes with the title rule.
10507 </p>
10508 !! end
10509
10510 !! test
10511 Raw output of variant escape tags (R flag)
10512 !! options
10513 language=zh variant=zh-tw
10514 !! input
10515 Raw: -{R|zh:China;zh-tw:Taiwan}-
10516 !! result
10517 <p>Raw: zh:China;zh-tw:Taiwan
10518 </p>
10519 !! end
10520
10521 !! test
10522 Nested using of manual convert syntax
10523 !! options
10524 language=zh variant=zh-hk
10525 !! input
10526 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
10527 !! result
10528 <p>Nested: Hello Hong Kong!
10529 </p>
10530 !! end
10531
10532 !! test
10533 Do not convert roman numbers to language variants
10534 !! options
10535 language=sr variant=sr-ec
10536 !! input
10537 Fridrih IV je car.
10538 !! result
10539 <p>Фридрих IV је цар.
10540 </p>
10541 !! end
10542
10543 !! test
10544 Unclosed language converter markup "-{"
10545 !! options
10546 language=sr
10547 !! input
10548 -{T|hello
10549 !! result
10550 <p>-{T|hello
10551 </p>
10552 !! end
10553
10554 !! test
10555 Don't convert raw rule "-{R|=&gt;}-" to "=>"
10556 !! options
10557 language=sr
10558 !! input
10559 -{R|=&gt;}-
10560 !! result
10561 <p>=&gt;
10562 </p>
10563 !!end
10564
10565 !!article
10566 Template:Bullet
10567 !!text
10568 * Bar
10569 !!endarticle
10570
10571 !! test
10572 Bug 529: Uncovered bullet
10573 !! input
10574 * Foo {{bullet}}
10575 !! result
10576 <ul><li> Foo
10577 </li><li> Bar
10578 </li></ul>
10579
10580 !! end
10581
10582 # Plain MediaWiki does not remove empty lists, but tidy actually does.
10583 # Templates in Wikipedia rely on this behavior, as tidy has always been
10584 # enabled there. These tests are normally run *without* tidy, so specify the
10585 # full output here.
10586 # To test realistic parsing behavior, apply a tidy-like transformation to both
10587 # the expected output and your parser's output.
10588 !! test
10589 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
10590 !! input
10591 ******* Foo {{bullet}}
10592 !! result
10593 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
10594 </li></ul>
10595 </li></ul>
10596 </li></ul>
10597 </li></ul>
10598 </li></ul>
10599 </li></ul>
10600 </li><li> Bar
10601 </li></ul>
10602
10603 !! end
10604
10605 !! test
10606 Bug 529: Uncovered table already at line-start
10607 !! input
10608 x
10609
10610 {{table}}
10611 y
10612 !! result
10613 <p>x
10614 </p>
10615 <table>
10616 <tr>
10617 <td> 1 </td>
10618 <td> 2
10619 </td></tr>
10620 <tr>
10621 <td> 3 </td>
10622 <td> 4
10623 </td></tr></table>
10624 <p>y
10625 </p>
10626 !! end
10627
10628 !! test
10629 Bug 529: Uncovered bullet in parser function result
10630 !! input
10631 * Foo {{lc:{{bullet}} }}
10632 !! result
10633 <ul><li> Foo
10634 </li><li> bar
10635 </li></ul>
10636
10637 !! end
10638
10639 !! test
10640 Bug 5678: Double-parsed template argument
10641 !! input
10642 {{lc:{{{1}}}|hello}}
10643 !! result
10644 <p>{{{1}}}
10645 </p>
10646 !! end
10647
10648 !! test
10649 Bug 5678: Double-parsed template invocation
10650 !! input
10651 {{lc:{{paramtest {{!}} param = hello }} }}
10652 !! result
10653 <p>{{paramtest | param = hello }}
10654 </p>
10655 !! end
10656
10657 !! test
10658 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
10659 !! options
10660 language=cs
10661 title=[[Main Page]]
10662 !! input
10663 {{PRVNÍVELKÉ:ěščř}}
10664 {{prvnívelké:ěščř}}
10665 {{PRVNÍMALÉ:ěščř}}
10666 {{prvnímalé:ěščř}}
10667 {{MALÁ:ěščř}}
10668 {{malá:ěščř}}
10669 {{VELKÁ:ěščř}}
10670 {{velká:ěščř}}
10671 !! result
10672 <p>Ěščř
10673 Ěščř
10674 ěščř
10675 ěščř
10676 ěščř
10677 ěščř
10678 ĚŠČŘ
10679 ĚŠČŘ
10680 </p>
10681 !! end
10682
10683 !! test
10684 Morwen/13: Unclosed link followed by heading
10685 !! input
10686 [[link
10687 ==heading==
10688 !! result
10689 <p>[[link
10690 </p>
10691 <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>
10692
10693 !! end
10694
10695 !! test
10696 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
10697 !! input
10698 {{foo|
10699 =heading=
10700 !! result
10701 <p>{{foo|
10702 </p>
10703 <h1> <span class="mw-headline" id="heading">heading</span></h1>
10704
10705 !! end
10706
10707 !! test
10708 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
10709 !! input
10710 {{foo|
10711 ==heading==
10712 !! result
10713 <p>{{foo|
10714 </p>
10715 <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>
10716
10717 !! end
10718
10719 !! test
10720 Tildes in comments
10721 !! options
10722 pst
10723 !! input
10724 <!-- ~~~~ -->
10725 !! result
10726 <!-- ~~~~ -->
10727 !! end
10728
10729 !! test
10730 Paragraphs inside divs (no extra line breaks)
10731 !! input
10732 <div>Line one
10733
10734 Line two</div>
10735 !! result
10736 <div>Line one
10737 Line two</div>
10738
10739 !! end
10740
10741 !! test
10742 Paragraphs inside divs (extra line break on open)
10743 !! input
10744 <div>
10745 Line one
10746
10747 Line two</div>
10748 !! result
10749 <div>
10750 <p>Line one
10751 </p>
10752 Line two</div>
10753
10754 !! end
10755
10756 !! test
10757 Paragraphs inside divs (extra line break on close)
10758 !! input
10759 <div>Line one
10760
10761 Line two
10762 </div>
10763 !! result
10764 <div>Line one
10765 <p>Line two
10766 </p>
10767 </div>
10768
10769 !! end
10770
10771 !! test
10772 Paragraphs inside divs (extra line break on open and close)
10773 !! input
10774 <div>
10775 Line one
10776
10777 Line two
10778 </div>
10779 !! result
10780 <div>
10781 <p>Line one
10782 </p><p>Line two
10783 </p>
10784 </div>
10785
10786 !! end
10787
10788 !! test
10789 Nesting tags, paragraphs on lines which begin with <div>
10790 !! options
10791 disabled
10792 !! input
10793 <div></div><strong>A
10794 B</strong>
10795 !! result
10796 <div></div>
10797 <p><strong>A
10798 B</strong>
10799 </p>
10800 !! end
10801
10802 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
10803 !! test
10804 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
10805 !! options
10806 disabled
10807 !! input
10808 <blockquote>Line one
10809
10810 Line two</blockquote>
10811 !! result
10812 <blockquote>Line one
10813 Line two</blockquote>
10814
10815 !! end
10816
10817 !! test
10818 Bug 6200: paragraphs inside blockquotes (extra line break on open)
10819 !! options
10820 disabled
10821 !! input
10822 <blockquote>
10823 Line one
10824
10825 Line two</blockquote>
10826 !! result
10827 <blockquote>
10828 <p>Line one
10829 </p>
10830 Line two</blockquote>
10831
10832 !! end
10833
10834 !! test
10835 Bug 6200: paragraphs inside blockquotes (extra line break on close)
10836 !! options
10837 disabled
10838 !! input
10839 <blockquote>Line one
10840
10841 Line two
10842 </blockquote>
10843 !! result
10844 <blockquote>Line one
10845 <p>Line two
10846 </p>
10847 </blockquote>
10848
10849 !! end
10850
10851 !! test
10852 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
10853 !! options
10854 disabled
10855 !! input
10856 <blockquote>
10857 Line one
10858
10859 Line two
10860 </blockquote>
10861 !! result
10862 <blockquote>
10863 <p>Line one
10864 </p><p>Line two
10865 </p>
10866 </blockquote>
10867
10868 !! end
10869
10870 !! test
10871 Paragraphs inside blockquotes/divs (no extra line breaks)
10872 !! input
10873 <blockquote><div>Line one
10874
10875 Line two</div></blockquote>
10876 !! result
10877 <blockquote><div>Line one
10878 Line two</div></blockquote>
10879
10880 !! end
10881
10882 !! test
10883 Paragraphs inside blockquotes/divs (extra line break on open)
10884 !! input
10885 <blockquote><div>
10886 Line one
10887
10888 Line two</div></blockquote>
10889 !! result
10890 <blockquote><div>
10891 <p>Line one
10892 </p>
10893 Line two</div></blockquote>
10894
10895 !! end
10896
10897 !! test
10898 Paragraphs inside blockquotes/divs (extra line break on close)
10899 !! input
10900 <blockquote><div>Line one
10901
10902 Line two
10903 </div></blockquote>
10904 !! result
10905 <blockquote><div>Line one
10906 <p>Line two
10907 </p>
10908 </div></blockquote>
10909
10910 !! end
10911
10912 !! test
10913 Paragraphs inside blockquotes/divs (extra line break on open and close)
10914 !! input
10915 <blockquote><div>
10916 Line one
10917
10918 Line two
10919 </div></blockquote>
10920 !! result
10921 <blockquote><div>
10922 <p>Line one
10923 </p><p>Line two
10924 </p>
10925 </div></blockquote>
10926
10927 !! end
10928
10929 !! test
10930 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
10931 !! options
10932 wgLinkHolderBatchSize=0
10933 !! input
10934 [[meatball:1]]
10935 [[meatball:2]]
10936 [[meatball:3]]
10937 !! result
10938 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
10939 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
10940 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
10941 </p>
10942 !! end
10943
10944 !! test
10945 Free external link invading image caption
10946 !! input
10947 [[Image:Foobar.jpg|thumb|http://x|hello]]
10948 !! result
10949 <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>
10950
10951 !! end
10952
10953 !! test
10954 Bug 15196: localised external link numbers
10955 !! options
10956 language=fa
10957 !! input
10958 [http://en.wikipedia.org/]
10959 !! result
10960 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
10961 </p>
10962 !! end
10963
10964 !! test
10965 Multibyte character in padleft
10966 !! input
10967 {{padleft:-Hello|7|Æ}}
10968 !! result
10969 <p>Æ-Hello
10970 </p>
10971 !! end
10972
10973 !! test
10974 Multibyte character in padright
10975 !! input
10976 {{padright:Hello-|7|Æ}}
10977 !! result
10978 <p>Hello-Æ
10979 </p>
10980 !! end
10981
10982 !! test
10983 Formatted date
10984 !! config
10985 wgUseDynamicDates=1
10986 !! input
10987 [[2009-03-24]]
10988 !! result
10989 <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>
10990 </p>
10991 !!end
10992
10993 !!test
10994 formatdate parser function
10995 !!input
10996 {{#formatdate:2009-03-24}}
10997 !! result
10998 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
10999 </p>
11000 !! end
11001
11002 !!test
11003 formatdate parser function, with default format
11004 !!input
11005 {{#formatdate:2009-03-24|mdy}}
11006 !! result
11007 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11008 </p>
11009 !! end
11010
11011 !! test
11012 Linked date with autoformatting disabled
11013 !! config
11014 wgUseDynamicDates=false
11015 !! input
11016 [[2009-03-24]]
11017 !! result
11018 <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>
11019 </p>
11020 !! end
11021
11022 !! test
11023 Spacing of numbers in formatted dates
11024 !! input
11025 {{#formatdate:January 15}}
11026 !! result
11027 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11028 </p>
11029 !! end
11030
11031 !! test
11032 Spacing of numbers in formatted dates (linked)
11033 !! config
11034 wgUseDynamicDates=true
11035 !! input
11036 [[January 15]]
11037 !! result
11038 <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>
11039 </p>
11040 !! end
11041
11042 !! test
11043 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
11044 !! options
11045 language=nl title=[[MediaWiki:Common.css]]
11046 !! input
11047 {{#formatdate:2009-03-24|dmy}}
11048 !! result
11049 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11050 </p>
11051 !! end
11052
11053 #
11054 #
11055 #
11056
11057 #
11058 # Edit comments
11059 #
11060
11061 !! test
11062 Edit comment with link
11063 !! options
11064 comment
11065 !! input
11066 I like the [[Main Page]] a lot
11067 !! result
11068 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11069 !!end
11070
11071 !! test
11072 Edit comment with link and link text
11073 !! options
11074 comment
11075 !! input
11076 I like the [[Main Page|best pages]] a lot
11077 !! result
11078 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11079 !!end
11080
11081 !! test
11082 Edit comment with link and link text with suffix
11083 !! options
11084 comment
11085 !! input
11086 I like the [[Main Page|best page]]s a lot
11087 !! result
11088 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11089 !!end
11090
11091 !! test
11092 Edit comment with section link (non-local, eg in history list)
11093 !! options
11094 comment title=[[Main Page]]
11095 !! input
11096 /* External links */ removed bogus entries
11097 !! result
11098 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11099 !!end
11100
11101 !! test
11102 Edit comment with section link and text before it (non-local, eg in history list)
11103 !! options
11104 comment title=[[Main Page]]
11105 !! input
11106 pre-comment text /* External links */ removed bogus entries
11107 !! result
11108 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>
11109 !!end
11110
11111 !! test
11112 Edit comment with section link (local, eg in diff view)
11113 !! options
11114 comment local title=[[Main Page]]
11115 !! input
11116 /* External links */ removed bogus entries
11117 !! result
11118 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11119 !!end
11120
11121 !! test
11122 Edit comment with subpage link (bug 14080)
11123 !! options
11124 comment
11125 subpage
11126 title=[[Subpage test]]
11127 !! input
11128 Poked at a [[/subpage]] here...
11129 !! result
11130 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11131 !!end
11132
11133 !! test
11134 Edit comment with subpage link and link text (bug 14080)
11135 !! options
11136 comment
11137 subpage
11138 title=[[Subpage test]]
11139 !! input
11140 Poked at a [[/subpage|neat little page]] here...
11141 !! result
11142 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
11143 !!end
11144
11145 !! test
11146 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
11147 !! options
11148 comment
11149 title=[[Subpage test]]
11150 !! input
11151 Poked at a [[/subpage]] here...
11152 !! result
11153 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...
11154 !!end
11155
11156 !! test
11157 Edit comment with bare anchor link (local, as on diff)
11158 !! options
11159 comment
11160 local
11161 title=[[Main Page]]
11162 !!input
11163 [[#section]]
11164 !! result
11165 <a href="#section">#section</a>
11166 !! end
11167
11168 !! test
11169 Edit comment with bare anchor link (non-local, as on history)
11170 !! options
11171 comment
11172 title=[[Main Page]]
11173 !!input
11174 [[#section]]
11175 !! result
11176 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
11177 !! end
11178
11179 !! test
11180 Anchor starting with underscore
11181 !!input
11182 [[#_ref|One]]
11183 !! result
11184 <p><a href="#_ref">One</a>
11185 </p>
11186 !! end
11187
11188 !! test
11189 Id starting with underscore
11190 !!input
11191 <div id="_ref"></div>
11192 !! result
11193 <div id="_ref"></div>
11194
11195 !! end
11196
11197 !! test
11198 Space normalisation on autocomment (bug 22784)
11199 !! options
11200 comment
11201 title=[[Main Page]]
11202 !!input
11203 /* __hello__world__ */
11204 !! result
11205 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
11206 !! end
11207
11208 !! test
11209 percent-encoding and + signs in comments (Bug 26410)
11210 !! options
11211 comment
11212 !!input
11213 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
11214 !! result
11215 <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>
11216 !! end
11217
11218 !! test
11219 Bad images - basic functionality
11220 !! options
11221 disabled
11222 !! input
11223 [[File:Bad.jpg]]
11224 !! result
11225 !! end
11226
11227 !! test
11228 Bad images - bug 16039: text after bad image disappears
11229 !! options
11230 disabled
11231 !! input
11232 Foo bar
11233 [[File:Bad.jpg]]
11234 Bar foo
11235 !! result
11236 <p>Foo bar
11237 </p><p>Bar foo
11238 </p>
11239 !! end
11240
11241 !! test
11242 Verify that displaytitle works (bug #22501) no displaytitle
11243 !! options
11244 showtitle
11245 !! config
11246 wgAllowDisplayTitle=true
11247 wgRestrictDisplayTitle=false
11248 !! input
11249 this is not the the title
11250 !! result
11251 Parser test
11252 <p>this is not the the title
11253 </p>
11254 !! end
11255
11256 !! test
11257 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
11258 !! options
11259 showtitle
11260 title=[[Screen]]
11261 !! config
11262 wgAllowDisplayTitle=true
11263 wgRestrictDisplayTitle=false
11264 !! input
11265 this is not the the title
11266 {{DISPLAYTITLE:whatever}}
11267 !! result
11268 whatever
11269 <p>this is not the the title
11270 </p>
11271 !! end
11272
11273 !! test
11274 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
11275 !! options
11276 showtitle
11277 title=[[Screen]]
11278 !! config
11279 wgAllowDisplayTitle=true
11280 wgRestrictDisplayTitle=true
11281 !! input
11282 this is not the the title
11283 {{DISPLAYTITLE:whatever}}
11284 !! result
11285 Screen
11286 <p>this is not the the title
11287 </p>
11288 !! end
11289
11290 !! test
11291 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
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:screen}}
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) AllowDisplayTitle=false
11309 !! options
11310 showtitle
11311 title=[[Screen]]
11312 !! config
11313 wgAllowDisplayTitle=false
11314 !! input
11315 this is not the the title
11316 {{DISPLAYTITLE:screen}}
11317 !! result
11318 Screen
11319 <p>this is not the the title
11320 <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>
11321 </p>
11322 !! end
11323
11324 !! test
11325 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
11326 !! options
11327 showtitle
11328 title=[[Screen]]
11329 !! config
11330 wgAllowDisplayTitle=false
11331 !! input
11332 this is not the the title
11333 !! result
11334 Screen
11335 <p>this is not the the title
11336 </p>
11337 !! end
11338
11339 !! test
11340 preload: check <noinclude> and <includeonly>
11341 !! options
11342 preload
11343 !! input
11344 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
11345 !! result
11346 Hello kind world.
11347 !! end
11348
11349 !! test
11350 preload: check <onlyinclude>
11351 !! options
11352 preload
11353 !! input
11354 Goodbye <onlyinclude>Hello world</onlyinclude>
11355 !! result
11356 Hello world
11357 !! end
11358
11359 !! test
11360 preload: can pass tags through if we want to
11361 !! options
11362 preload
11363 !! input
11364 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
11365 !! result
11366 <includeonly>Hello world</includeonly>
11367 !! end
11368
11369 !! test
11370 preload: check that it doesn't try to do tricks
11371 !! options
11372 preload
11373 !! input
11374 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11375 !! result
11376 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11377 !! end
11378
11379 !! test
11380 Play a bit with r67090 and bug 3158
11381 !! options
11382 disabled
11383 !! input
11384 <div style="width:50% !important">&nbsp;</div>
11385 <div style="width:50%&nbsp;!important">&nbsp;</div>
11386 <div style="width:50%&#160;!important">&nbsp;</div>
11387 <div style="border : solid;">&nbsp;</div>
11388 !! result
11389 <div style="width:50% !important">&nbsp;</div>
11390 <div style="width:50% !important">&nbsp;</div>
11391 <div style="width:50% !important">&nbsp;</div>
11392 <div style="border&#160;: solid;">&nbsp;</div>
11393
11394 !! end
11395
11396 !! test
11397 HTML5 data attributes
11398 !! input
11399 <span data-foo="bar">Baz</span>
11400 <p data-abc-def_hij="">Quuz</p>
11401 !! result
11402 <p><span data-foo="bar">Baz</span>
11403 </p>
11404 <p data-abc-def_hij="">Quuz</p>
11405
11406 !! end
11407
11408 !! test
11409 percent-encoding and + signs in internal links (Bug 26410)
11410 !! input
11411 [[User:+%]] [[Page+title%]]
11412 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
11413 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
11414 [[%33%45]] [[%33%45+]]
11415 !! result
11416 <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>
11417 <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>
11418 <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>
11419 <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>
11420 </p>
11421 !! end
11422
11423 !! test
11424 Special characters in embedded file links (bug 27679)
11425 !! input
11426 [[File:Contains & ampersand.jpg]]
11427 [[File:Does not exist.jpg|Title with & ampersand]]
11428 !! result
11429 <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>
11430 <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>
11431 </p>
11432 !! end
11433
11434
11435 !! test
11436 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
11437 !! input
11438 Text&apos;s been normalized?
11439 !! result
11440 <p>Text&#39;s been normalized?
11441 </p>
11442 !! end
11443
11444 !! test
11445 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
11446 !! input
11447 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
11448 !! result
11449 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
11450 </p>
11451 !! end
11452
11453 !! test
11454 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
11455 !! input
11456 [http://www.example.org/ ideograms]
11457 !! result
11458 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
11459 </p>
11460 !! end
11461
11462 !! test
11463 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
11464 !! input
11465 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
11466 !! result
11467 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
11468 </p>
11469 !! end
11470
11471 !! article
11472 Mediawiki:loop1
11473 !! text
11474 {{Identical|A}}
11475 !! endarticle
11476
11477 !! article
11478 Mediawiki:loop2
11479 !! text
11480 {{Identical|B}}
11481 !! endarticle
11482
11483 !! article
11484 Template:Identical
11485 !! text
11486 {{int:loop1}}
11487 {{int:loop2}}
11488 !! endarticle
11489
11490 !! test
11491 Bug 31098 Template which includes system messages which includes the template
11492 !! input
11493 {{Identical}}
11494 !! result
11495 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11496 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11497 </p>
11498 !! end
11499
11500 !! test
11501 Deprecated presentational attributes are converted to css
11502 !! input
11503 {|
11504 | valign=top align=left width=100 height=25% | Asdf
11505 |}
11506 <ul type="disc"></ul>
11507 !! result
11508 <table>
11509 <tr>
11510 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
11511 </td></tr></table>
11512 <ul style="list-style-type: disc;"></ul>
11513
11514 !! end
11515
11516 !! test
11517 Bug31490 Turkish: ucfirst 'blah'
11518 !! options
11519 language=tr
11520 !! input
11521 {{ucfirst:blah}}
11522 !! result
11523 <p>Blah
11524 </p>
11525 !! end
11526
11527 !! test
11528 Bug31490 Turkish: ucfirst 'ix'
11529 !! options
11530 language=tr
11531 !! input
11532 {{ucfirst:ix}}
11533 !! result
11534 <p>İx
11535 </p>
11536 !! end
11537
11538 !! test
11539 Bug31490 Turkish: lcfirst 'BLAH'
11540 !! options
11541 language=tr
11542 !! input
11543 {{lcfirst:BLAH}}
11544 !! result
11545 <p>bLAH
11546 </p>
11547 !! end
11548
11549 !! test
11550 Bug31490 Turkish: ucfırst (with a dotless i)
11551 !! options
11552 language=tr
11553 !! input
11554 {{ucfırst:blah}}
11555 !! result
11556 <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>
11557 </p>
11558 !! end
11559
11560 !! test
11561 Bug31490 ucfırst (with a dotless i) with English language
11562 !! options
11563 language=en
11564 !! input
11565 {{ucfırst:blah}}
11566 !! result
11567 <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>
11568 </p>
11569 !! end
11570
11571 !! test
11572 Bug 26375: TOC with italics
11573 !! options
11574 title=[[Main Page]]
11575 !! input
11576 __TOC__
11577 == ''Lost'' episodes ==
11578 !! result
11579 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11580 <ul>
11581 <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>
11582 </ul>
11583 </td></tr></table>
11584 <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>
11585
11586 !! end
11587
11588 !! test
11589 Bug 26375: TOC with bold
11590 !! options
11591 title=[[Main Page]]
11592 !! input
11593 __TOC__
11594 == '''should be bold''' then normal text ==
11595 !! result
11596 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11597 <ul>
11598 <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>
11599 </ul>
11600 </td></tr></table>
11601 <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>
11602
11603 !! end
11604
11605 !! test
11606 Bug 33845: Headings become cursive in TOC when they contain an image
11607 !! options
11608 title=[[Main Page]]
11609 !! input
11610 __TOC__
11611 == Image [[Image:foobar.jpg]] ==
11612 !! result
11613 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11614 <ul>
11615 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
11616 </ul>
11617 </td></tr></table>
11618 <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>
11619
11620 !! end
11621
11622 !! test
11623 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
11624 !! options
11625 title=[[Main Page]]
11626 !! input
11627 __TOC__
11628 == <blockquote>Quote</blockquote> ==
11629 !! result
11630 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11631 <ul>
11632 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
11633 </ul>
11634 </td></tr></table>
11635 <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>
11636
11637 !! end
11638
11639 !! test
11640 Unclosed tags in TOC
11641 !! options
11642 title=[[Main Page]]
11643 !! input
11644 __TOC__
11645 == Proof: 2 < 3 ==
11646 <small>Hanc marginis exiguitas non caperet.</small>
11647 QED
11648 !! result
11649 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11650 <ul>
11651 <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>
11652 </ul>
11653 </td></tr></table>
11654 <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>
11655 <p><small>Hanc marginis exiguitas non caperet.</small>
11656 QED
11657 </p>
11658 !! end
11659
11660 !! test
11661 Multiple tags in TOC
11662 !! input
11663 __TOC__
11664 == <i>Foo</i> <b>Bar</b> ==
11665
11666 == <i>Foo</i> <blockquote>Bar</blockquote> ==
11667 !! result
11668 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11669 <ul>
11670 <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>
11671 <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>
11672 </ul>
11673 </td></tr></table>
11674 <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>
11675 <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>
11676
11677 !! end
11678
11679 !! test
11680 Tags with parameters in TOC
11681 !! input
11682 __TOC__
11683 == <sup class="in-h2">Hello</sup> ==
11684
11685 == <sup class="a > b">Evilbye</sup> ==
11686 !! result
11687 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11688 <ul>
11689 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
11690 <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>
11691 </ul>
11692 </td></tr></table>
11693 <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>
11694 <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>
11695
11696 !! end
11697
11698 !! test
11699 span tags with directionality in TOC
11700 !! input
11701 __TOC__
11702 == <span dir="ltr">C++</span> ==
11703
11704 == <span dir="rtl">זבנג!</span> ==
11705
11706 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
11707
11708 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
11709
11710 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
11711 !! result
11712 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11713 <ul>
11714 <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>
11715 <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>
11716 <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>
11717 <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>
11718 <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>
11719 </ul>
11720 </td></tr></table>
11721 <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>
11722 <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>
11723 <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>
11724 <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>
11725 <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>
11726
11727 !! end
11728
11729 !! article
11730 MediaWiki:Bug32057
11731 !! text
11732 == {{int:headline_sample}} ==
11733 !! endarticle
11734
11735 !! test
11736 Bug 32057: Title needed when expanding <h> nodes.
11737 !! options
11738 title=[[Main Page]]
11739 !! input
11740 {{int:Bug32057}}
11741 !! result
11742 <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>
11743
11744 !! end
11745
11746 !! test
11747 Strip marker in urlencode
11748 !! input
11749 {{urlencode:x<nowiki/>y}}
11750 {{urlencode:x<nowiki/>y|wiki}}
11751 {{urlencode:x<nowiki/>y|path}}
11752 !! result
11753 <p>xy
11754 xy
11755 xy
11756 </p>
11757 !! end
11758
11759 !! test
11760 Strip marker in lc
11761 !! input
11762 {{lc:x<nowiki/>y}}
11763 !! result
11764 <p>xy
11765 </p>
11766 !! end
11767
11768 !! test
11769 Strip marker in uc
11770 !! input
11771 {{uc:x<nowiki/>y}}
11772 !! result
11773 <p>XY
11774 </p>
11775 !! end
11776
11777 !! test
11778 Strip marker in formatNum
11779 !! input
11780 {{formatnum:1<nowiki/>2}}
11781 {{formatnum:1<nowiki/>2|R}}
11782 !! result
11783 <p>12
11784 12
11785 </p>
11786 !! end
11787
11788 !! test
11789 Strip marker in grammar
11790 !! options
11791 language=fi
11792 !! input
11793 {{grammar:elative|foo<nowiki/>bar}}
11794 !! result
11795 <p>foobarista
11796 </p>
11797 !! end
11798
11799 !! test
11800 Strip marker in padleft
11801 !! input
11802 {{padleft:|2|x<nowiki/>y}}
11803 !! result
11804 <p>xy
11805 </p>
11806 !! end
11807
11808 !! test
11809 Strip marker in padright
11810 !! input
11811 {{padright:|2|x<nowiki/>y}}
11812 !! result
11813 <p>xy
11814 </p>
11815 !! end
11816
11817 !! test
11818 Strip marker in anchorencode
11819 !! input
11820 {{anchorencode:x<nowiki/>y}}
11821 !! result
11822 <p>xy
11823 </p>
11824 !! end
11825
11826 !! test
11827 nowiki inside link inside heading (bug 18295)
11828 !! input
11829 ==[[foo|x<nowiki>y</nowiki>z]]==
11830 !! result
11831 <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>
11832
11833 !! end
11834
11835 !! test
11836 new support for bdi element (bug 31817)
11837 !! input
11838 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11839 !! result
11840 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11841
11842 !!end
11843
11844 !! test
11845 Ignore pipe between table row attributes
11846 !! input
11847 {|
11848 | quux
11849 |- id=foo | style='color: red'
11850 | bar
11851 |}
11852 !! result
11853 <table>
11854 <tr>
11855 <td> quux
11856 </td></tr>
11857 <tr id="foo" style="color: red">
11858 <td> bar
11859 </td></tr></table>
11860
11861 !! end
11862
11863 !!test
11864 Gallery override link with WikiLink (bug 34852)
11865 !! input
11866 <gallery>
11867 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
11868 </gallery>
11869 !! result
11870 <ul class="gallery">
11871 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11872 <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>
11873 <div class="gallerytext">
11874 <p>caption
11875 </p>
11876 </div>
11877 </div></li>
11878 </ul>
11879
11880 !! end
11881
11882 !!test
11883 Gallery override link with absolute external link (bug 34852)
11884 !! input
11885 <gallery>
11886 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
11887 </gallery>
11888 !! result
11889 <ul class="gallery">
11890 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11891 <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>
11892 <div class="gallerytext">
11893 <p>caption
11894 </p>
11895 </div>
11896 </div></li>
11897 </ul>
11898
11899 !! end
11900
11901 !!test
11902 Gallery override link with malicious javascript (bug 34852)
11903 !! input
11904 <gallery>
11905 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
11906 </gallery>
11907 !! result
11908 <ul class="gallery">
11909 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11910 <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>
11911 <div class="gallerytext">
11912 <p>caption
11913 </p>
11914 </div>
11915 </div></li>
11916 </ul>
11917
11918 !! end
11919
11920 !!test
11921 Language parser function
11922 !! input
11923 {{#language:ar}}
11924 !! result
11925 <p>العربية
11926 </p>
11927 !! end
11928
11929 !!test
11930 Padleft and padright as substr
11931 !! input
11932 {{padleft:|3|abcde}}
11933 {{padright:|3|abcde}}
11934 !! result
11935 <p>abc
11936 abc
11937 </p>
11938 !! end
11939
11940 !!test
11941 Bug 34939 - Case insensitive link parsing ([HttP://])
11942 !! input
11943 [HttP://MediaWiki.Org/]
11944 !! result
11945 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
11946 </p>
11947 !! end
11948
11949 !!test
11950 Bug 34939 - Case insensitive link parsing ([HttP:// title])
11951 !! input
11952 [HttP://MediaWiki.Org/ MediaWiki]
11953 !! result
11954 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
11955 </p>
11956 !! end
11957
11958 !!test
11959 Bug 34939 - Case insensitive link parsing (HttP://)
11960 !! input
11961 HttP://MediaWiki.Org/
11962 !! result
11963 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
11964 </p>
11965 !! end
11966
11967 ###
11968 ### Parsoids-specific tests
11969 ### Parsoid-PHP parser incompatibilities
11970 ###
11971 !!test
11972 1. SOL-sensitive wikitext tokens as template-args
11973 !!options
11974 disabled
11975 !!input
11976 {{echo|*a}}
11977 {{echo|#a}}
11978 {{echo|:a}}
11979 !!result
11980 <p>*a
11981 #a
11982 :a
11983 </p>
11984 !!end
11985
11986 #### The following section of tests are primarily to test
11987 #### wikitext escaping capabilities of Parsoid.
11988 #### A lot of the tests are disabled for the PHP parser either
11989 #### because of minor newline diffs or other reasons.
11990 #### As Parsoid serializer can handle newlines and other HTML
11991 #### more robustly, some of these tests might get reenabled
11992 #### for the PHP parser.
11993
11994 #### --------------- Headings ---------------
11995 #### 0. Unnested
11996 #### 1. Nested inside html <h1>=foo=</h1>
11997 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
11998 #### 3. Nested inside html with wikitext split by html tags
11999 #### 4. No escape needed
12000 #### 5. Empty headings <h1></h1>
12001 #### 6. Heading chars in SOL context
12002 #### ----------------------------------------
12003 !! test
12004 Headings: 0. Unnested
12005 !! input
12006 <nowiki>=foo=</nowiki>
12007
12008 <nowiki>=foo</nowiki>''a''=
12009 !! result
12010 <p>=foo=
12011 </p><p>=foo<i>a</i>=
12012 </p>
12013 !!end
12014
12015 !! test
12016 Headings: 1. Nested inside html
12017 !! options
12018 disabled
12019 !! input
12020 =<nowiki>=foo=</nowiki>=
12021 ==<nowiki>=foo=</nowiki>==
12022 ===<nowiki>=foo=</nowiki>===
12023 ====<nowiki>=foo=</nowiki>====
12024 =====<nowiki>=foo=</nowiki>=====
12025 ======<nowiki>=foo=</nowiki>======
12026 !! result
12027 <h1>=foo=</h1>
12028 <h2>=foo=</h2>
12029 <h3>=foo=</h3>
12030 <h4>=foo=</h4>
12031 <h5>=foo=</h5>
12032 <h6>=foo=</h6>
12033 !!end
12034
12035 !! test
12036 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12037 !! options
12038 disabled
12039 !! input
12040 =foo=
12041 <nowiki>*bar</nowiki>
12042 =foo=
12043 =bar
12044 =foo=
12045 <nowiki>=bar=</nowiki>
12046 !! result
12047 <h1>foo</h1>*bar
12048 <h1>foo</h1>=bar
12049 <h1>foo</h1>=bar=
12050 !!end
12051
12052 !! test
12053 Headings: 3. Nested inside html with wikitext split by html tags
12054 !! options
12055 disabled
12056 !! input
12057 =<nowiki>=</nowiki>'''bold'''foo==
12058 !! result
12059 <h1>=<b>bold</b>foo=</h1>
12060 !!end
12061
12062 !! test
12063 Headings: 4. No escaping needed (testing just h1 and h2)
12064 !! options
12065 disabled
12066 !! input
12067 ==foo=
12068 =foo==
12069 ===foo==
12070 ==foo===
12071 =''=''foo==
12072 ===
12073 !! result
12074 <h1>=foo</h1>
12075 <h1>foo=</h1>
12076 <h2>=foo</h2>
12077 <h2>foo=</h2>
12078 <h1><i>=</i>foo=</h1>
12079 <h1>=</h1>
12080 !!end
12081
12082 !! test
12083 Headings: 5. Empty headings
12084 !! options
12085 disabled
12086 !! input
12087 =<nowiki></nowiki>=
12088 ==<nowiki></nowiki>==
12089 ===<nowiki></nowiki>===
12090 ====<nowiki></nowiki>====
12091 =====<nowiki></nowiki>=====
12092 ======<nowiki></nowiki>======
12093 !! result
12094 <h1></h1>
12095 <h2></h2>
12096 <h3></h3>
12097 <h4></h4>
12098 <h5></h5>
12099 <h6></h6>
12100 !!end
12101
12102 !! test
12103 Headings: 6. Heading chars in SOL context
12104 !! options
12105 disabled
12106 !! input
12107 <!--cmt--><nowiki>=h1=</nowiki>
12108 !! result
12109 <p><!--cmt-->=h1=
12110 </p>
12111 !!end
12112
12113 #### --------------- Lists ---------------
12114 #### 0. Outside nests (*foo, etc.)
12115 #### 1. Nested inside html <ul><li>*foo</li></ul>
12116 #### 2. Inside definition lists
12117 #### 3. Only bullets at start should be escaped
12118 #### 4. No escapes needed
12119 #### 5. No unnecessary escapes
12120 #### 6. Escape bullets in SOL position
12121 #### 7. Escape bullets in a multi-line context
12122 #### ----------------------------------------
12123
12124 !! test
12125 Lists: 0. Outside nests
12126 !! input
12127 <nowiki>*foo</nowiki>
12128
12129 <nowiki>#foo</nowiki>
12130 !! result
12131 <p>*foo
12132 </p><p>#foo
12133 </p>
12134 !!end
12135
12136 !! test
12137 Lists: 1. Nested inside html
12138 !! input
12139 *<nowiki>*foo</nowiki>
12140
12141 *<nowiki>#foo</nowiki>
12142
12143 *<nowiki>:foo</nowiki>
12144
12145 *<nowiki>;foo</nowiki>
12146
12147 #<nowiki>*foo</nowiki>
12148
12149 #<nowiki>#foo</nowiki>
12150
12151 #<nowiki>:foo</nowiki>
12152
12153 #<nowiki>;foo</nowiki>
12154 !! result
12155 <ul><li>*foo
12156 </li></ul>
12157 <ul><li>#foo
12158 </li></ul>
12159 <ul><li>:foo
12160 </li></ul>
12161 <ul><li>;foo
12162 </li></ul>
12163 <ol><li>*foo
12164 </li></ol>
12165 <ol><li>#foo
12166 </li></ol>
12167 <ol><li>:foo
12168 </li></ol>
12169 <ol><li>;foo
12170 </li></ol>
12171
12172 !!end
12173
12174 !! test
12175 Lists: 2. Inside definition lists
12176 !! input
12177 ;<nowiki>;foo</nowiki>
12178
12179 ;<nowiki>:foo</nowiki>
12180
12181 ;<nowiki>:foo</nowiki>
12182 :bar
12183
12184 :<nowiki>:foo</nowiki>
12185 !! result
12186 <dl><dt>;foo
12187 </dt></dl>
12188 <dl><dt>:foo
12189 </dt></dl>
12190 <dl><dt>:foo
12191 </dt><dd>bar
12192 </dd></dl>
12193 <dl><dd>:foo
12194 </dd></dl>
12195
12196 !!end
12197
12198 !! test
12199 Lists: 3. Only bullets at start of text should be escaped
12200 !! input
12201 *<nowiki>*foo*bar</nowiki>
12202
12203 *<nowiki>*foo</nowiki>''it''*bar
12204 !! result
12205 <ul><li>*foo*bar
12206 </li></ul>
12207 <ul><li>*foo<i>it</i>*bar
12208 </li></ul>
12209
12210 !!end
12211
12212 !! test
12213 Lists: 4. No escapes needed
12214 !! options
12215 disabled
12216 !! input
12217 *foo*bar
12218
12219 *''foo''*bar
12220
12221 *[[Foo]]: bar
12222 !! result
12223 <ul><li>foo*bar
12224 </li></ul>
12225 <ul><li><i>foo</i>*bar
12226 </li></ul>
12227 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
12228 </li></ul>
12229 !!end
12230
12231 !! test
12232 Lists: 5. No unnecessary escapes
12233 !! input
12234 * bar <span><nowiki>[[foo]]</nowiki></span>
12235
12236 *=bar <span><nowiki>[[foo]]</nowiki></span>
12237
12238 *[[bar <span><nowiki>[[foo]]</nowiki></span>
12239
12240 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12241
12242 *=bar <span>foo]]</span>=
12243 !! result
12244 <ul><li> bar <span>[[foo]]</span>
12245 </li></ul>
12246 <ul><li>=bar <span>[[foo]]</span>
12247 </li></ul>
12248 <ul><li>[[bar <span>[[foo]]</span>
12249 </li></ul>
12250 <ul><li>]]bar <span>[[foo]]</span>
12251 </li></ul>
12252 <ul><li>=bar <span>foo]]</span>=
12253 </li></ul>
12254
12255 !!end
12256
12257 !! test
12258 Lists: 6. Escape bullets in SOL position
12259 !! options
12260 disabled
12261 !! input
12262 <!--cmt--><nowiki>*foo</nowiki>
12263 !! result
12264 <p><!--cmt-->*foo
12265 </p>
12266 !!end
12267
12268 !! test
12269 Lists: 7. Escape bullets in a multi-line context
12270 !! input
12271 <nowiki>a
12272 *b</nowiki>
12273 !! result
12274 <p>a
12275 *b
12276 </p>
12277 !!end
12278
12279 #### --------------- HRs ---------------
12280 #### 1. Single line
12281 #### -----------------------------------
12282
12283 !! test
12284 HRs: 1. Single line
12285 !! options
12286 disabled
12287 !! input
12288 ----
12289 <nowiki>----</nowiki>
12290 ----
12291 <nowiki>=foo=</nowiki>
12292 ----
12293 <nowiki>*foo</nowiki>
12294 !! result
12295 <hr/>----
12296 <hr/>=foo=
12297 <hr/>*foo
12298 !! end
12299
12300 #### --------------- Tables ---------------
12301 #### 1a. Simple example
12302 #### 1b. No escaping needed (!foo)
12303 #### 1c. No escaping needed (|foo)
12304 #### 1d. No escaping needed (|}foo)
12305 ####
12306 #### 2a. Nested in td (<td>foo|bar</td>)
12307 #### 2b. Nested in td (<td>foo||bar</td>)
12308 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
12309 ####
12310 #### 3a. Nested in th (<th>foo!bar</th>)
12311 #### 3b. Nested in th (<th>foo!!bar</th>)
12312 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
12313 ####
12314 #### 4a. Escape -
12315 #### 4b. Escape +
12316 #### 4c. No escaping needed
12317 #### --------------------------------------
12318
12319 !! test
12320 Tables: 1a. Simple example
12321 !! input
12322 <nowiki>{|
12323 |}</nowiki>
12324 !! result
12325 <p>{|
12326 |}
12327 </p>
12328 !! end
12329
12330 !! test
12331 Tables: 1b. No escaping needed
12332 !! input
12333 !foo
12334 !! result
12335 <p>!foo
12336 </p>
12337 !! end
12338
12339 !! test
12340 Tables: 1c. No escaping needed
12341 !! input
12342 |foo
12343 !! result
12344 <p>|foo
12345 </p>
12346 !! end
12347
12348 !! test
12349 Tables: 1d. No escaping needed
12350 !! input
12351 |}foo
12352 !! result
12353 <p>|}foo
12354 </p>
12355 !! end
12356
12357 !! test
12358 Tables: 2a. Nested in td
12359 !! options
12360 disabled
12361 !! input
12362 {|
12363 |<nowiki>foo|bar</nowiki>
12364 |}
12365 !! result
12366 <table>
12367 <tr><td>foo|bar
12368 </td></tr></table>
12369
12370 !! end
12371
12372 !! test
12373 Tables: 2b. Nested in td
12374 !! options
12375 disabled
12376 !! input
12377 {|
12378 |<nowiki>foo||bar</nowiki>
12379 |''it''<nowiki>foo||bar</nowiki>
12380 |}
12381 !! result
12382 <table>
12383 <tr><td>foo||bar
12384 </td><td><i>it</i>foo||bar
12385 </td></tr></table>
12386
12387 !! end
12388
12389 !! test
12390 Tables: 2c. Nested in td -- no escaping needed
12391 !! options
12392 disabled
12393 !! input
12394 {|
12395 |foo!!bar
12396 |}
12397 !! result
12398 <table>
12399 <tr><td>foo!!bar
12400 </td></tr></table>
12401
12402 !! end
12403
12404 !! test
12405 Tables: 3a. Nested in th
12406 !! options
12407 disabled
12408 !! input
12409 {|
12410 !foo!bar
12411 |}
12412 !! result
12413 <table>
12414 <tr><th>foo!bar
12415 </th></tr></table>
12416
12417 !! end
12418
12419 !! test
12420 Tables: 3b. Nested in th
12421 !! options
12422 disabled
12423 !! input
12424 {|
12425 !<nowiki>foo!!bar</nowiki>
12426 |}
12427 !! result
12428 <table>
12429 <tr><th>foo!!bar
12430 </th></tr></table>
12431
12432 !! end
12433
12434 !! test
12435 Tables: 3c. Nested in th -- no escaping needed
12436 !! options
12437 disabled
12438 !! input
12439 {|
12440 !foo||bar
12441 |}
12442 !! result
12443 <table>
12444 <tr><th>foo||bar
12445 </th></tr></table>
12446
12447 !! end
12448
12449 !! test
12450 Tables: 4a. Escape -
12451 !! options
12452 disabled
12453 !! input
12454 {|
12455 |-
12456 !-bar
12457 |-
12458 |<nowiki>-bar</nowiki>
12459 |}
12460 !! result
12461 <table><tbody>
12462 <tr><th>-bar</th></tr>
12463 <tr><td>-bar</td></tr>
12464 </tbody></table>
12465 !! end
12466
12467 !! test
12468 Tables: 4b. Escape +
12469 !! options
12470 disabled
12471 !! input
12472 {|
12473 |-
12474 !+bar
12475 |-
12476 |<nowiki>+bar</nowiki>
12477 |}
12478 !! result
12479 <table><tbody>
12480 <tr><th>+bar</th></tr>
12481 <tr><td>+bar</td></tr>
12482 </tbody></table>
12483 !! end
12484
12485 !! test
12486 Tables: 4c. No escaping needed
12487 !! options
12488 disabled
12489 !! input
12490 {|
12491 |-
12492 |foo-bar
12493 |foo+bar
12494 |-
12495 |''foo''-bar
12496 |''foo''+bar
12497 |}
12498 !! result
12499 <table><tbody>
12500 <tr><td>foo-bar</td><td>foo+bar</td></tr>
12501 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
12502 </tbody></table>
12503 !! end
12504
12505 #### --------------- Links ---------------
12506 #### 1. Quote marks in link text
12507 #### 2. Wikilinks: Escapes needed
12508 #### 3. Wikilinks: No escapes needed
12509 #### 4. Extlinks: Escapes needed
12510 #### 5. Extlinks: No escapes needed
12511 #### --------------------------------------
12512 !! test
12513 Links 1. Quote marks in link text
12514 !! options
12515 disabled
12516 !! input
12517 [[Foo|<nowiki>Foo''boo''</nowiki>]]
12518 !! result
12519 <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>
12520 !! end
12521
12522 !! test
12523 Links 2. WikiLinks: Escapes needed
12524 !! options
12525 disabled
12526 !! input
12527 [[Foo|<nowiki>[Foobar]</nowiki>]]
12528 [[Foo|<nowiki>Foobar]</nowiki>]]
12529 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
12530 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
12531 [[Foo|<nowiki>[[Bar]]</nowiki>]]
12532 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
12533 [[Foo|<nowiki>|Bar</nowiki>]]
12534 !! result
12535 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
12536 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
12537 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
12538 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
12539 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
12540 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
12541 <a href="Foo" rel="mw:WikiLink">|Bar</a>
12542 !! end
12543
12544 !! test
12545 Links 3. WikiLinks: No escapes needed
12546 !! options
12547 disabled
12548 !! input
12549 [[Foo|[Foobar]]
12550 [[Foo|foo|bar]]
12551 !! result
12552 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
12553 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
12554 !! end
12555
12556 !! test
12557 Links 4. ExtLinks: Escapes needed
12558 !! options
12559 disabled
12560 !! input
12561 [http://google.com <nowiki>[google]</nowiki>]
12562 [http://google.com <nowiki>google]</nowiki>]
12563 !! result
12564 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
12565 <a href="http://google.com" rel="mw:ExtLink">google]</a>
12566 !! end
12567
12568 !! test
12569 Links 5. ExtLinks: No escapes needed
12570 !! options
12571 disabled
12572 !! input
12573 [http://google.com [google]
12574 !! result
12575 <a href="http://google.com" rel="mw:ExtLink">[google</a>
12576 !! end
12577
12578 #### --------------- Quotes ---------------
12579 #### 1. Quotes inside <b> and <i>
12580 #### 2. Link fragments separated by <i> and <b> tags
12581 #### 3. Link fragments inside <i> and <b>
12582 #### --------------------------------------
12583 !! test
12584 1. Quotes inside <b> and <i>
12585 !! input
12586 ''<nowiki>'foo'</nowiki>''
12587 ''<nowiki>''foo''</nowiki>''
12588 ''<nowiki>'''foo'''</nowiki>''
12589 '''<nowiki>'foo'</nowiki>'''
12590 '''<nowiki>''foo''</nowiki>'''
12591 '''<nowiki>'''foo'''</nowiki>'''
12592 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
12593 !! result
12594 <p><i>'foo'</i>
12595 <i>''foo''</i>
12596 <i>'''foo'''</i>
12597 <b>'foo'</b>
12598 <b>''foo''</b>
12599 <b>'''foo'''</b>
12600 <b>foo'<i>bar'</i>baz</b>
12601 </p>
12602 !! end
12603
12604 !! test
12605 2. Link fragments separated by <i> and <b> tags
12606 !! input
12607 [[''foo''<nowiki>hello]]</nowiki>
12608
12609 [['''foo'''<nowiki>hello]]</nowiki>
12610 !! result
12611 <p>[[<i>foo</i>hello]]
12612 </p><p>[[<b>foo</b>hello]]
12613 </p>
12614 !! end
12615
12616 !! test
12617 2. Link fragments inside <i> and <b>
12618 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
12619 this is one of the shortcomings of this format)
12620 !! input
12621 ''[[foo''<nowiki>]]</nowiki>
12622
12623 '''[[foo'''<nowiki>]]</nowiki>
12624 !! result
12625 <p><i>[[foo</i>]]
12626 </p><p><b>[[foo</b>]]
12627 </p>
12628 !! end
12629
12630 #### --------------- Paragraphs ---------------
12631 #### 1. No unnecessary escapes
12632 #### --------------------------------------
12633
12634 !! test
12635 1. No unnecessary escapes
12636 !! input
12637 bar <span><nowiki>[[foo]]</nowiki></span>
12638
12639 =bar <span><nowiki>[[foo]]</nowiki></span>
12640
12641 [[bar <span><nowiki>[[foo]]</nowiki></span>
12642
12643 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12644
12645 <nowiki>=bar </nowiki><span>foo]]</span>=
12646 !! result
12647 <p>bar <span>[[foo]]</span>
12648 </p><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>
12653 !!end
12654
12655 #### --------------- PRE ------------------
12656 #### 1. Leading space in SOL context should be escaped
12657 #### --------------------------------------
12658 !! test
12659 1. Leading space in SOL context should be escaped
12660 !! options
12661 disabled
12662 !! input
12663 <nowiki> foo</nowiki>
12664 <!--cmt--><nowiki> foo</nowiki>
12665 !! result
12666 <p> foo
12667 <!--cmt--> foo
12668 </p>
12669 !! end
12670
12671 #### --------------- HTML tags ---------------
12672 #### 1. a tags
12673 #### 2. other tags
12674 #### 3. multi-line html tag
12675 #### --------------------------------------
12676 !! test
12677 1. a tags
12678 !! options
12679 disabled
12680 !! input
12681 <a href="http://google.com">google</a>
12682 !! result
12683 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
12684 !! end
12685
12686 !! test
12687 2. other tags
12688 !! input
12689 <nowiki><div>foo</div>
12690 <div style="color:red">foo</div></nowiki>
12691 !! result
12692 <p>&lt;div&gt;foo&lt;/div&gt;
12693 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
12694 </p>
12695 !! end
12696
12697 !! test
12698 3. multi-line html tag
12699 !! input
12700 <nowiki><div
12701 >foo</div
12702 ></nowiki>
12703 !! result
12704 <p>&lt;div
12705 &gt;foo&lt;/div
12706 &gt;
12707 </p>
12708 !! end
12709
12710 #### --------------- Others ---------------
12711 !! test
12712 Escaping nowikis
12713 !! input
12714 &lt;nowiki&gt;foo&lt;/nowiki&gt;
12715 !! result
12716 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
12717 </p>
12718 !! end
12719
12720 TODO:
12721 more images
12722 more tables
12723 character entities
12724 and much more
12725 Try for 100% code coverage