Use American English spelling for behavior
[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 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Parsing an URL
169 !! input
170 http://fr.wikipedia.org/wiki/🍺
171 <!-- EasterEgg we love beer, better be able be able to link to it -->
172 !! result
173 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
174 </p>
175 !! end
176
177 !! test
178 Simple list
179 !! input
180 * Item 1
181 * Item 2
182 !! result
183 <ul><li> Item 1
184 </li><li> Item 2
185 </li></ul>
186
187 !! end
188
189 !! test
190 Italics and bold
191 !! input
192 * plain
193 * plain''italic''plain
194 * plain''italic''plain''italic''plain
195 * plain'''bold'''plain
196 * plain'''bold'''plain'''bold'''plain
197 * plain''italic''plain'''bold'''plain
198 * plain'''bold'''plain''italic''plain
199 * plain''italic'''bold-italic'''italic''plain
200 * plain'''bold''bold-italic''bold'''plain
201 * plain'''''bold-italic'''italic''plain
202 * plain'''''bold-italic''bold'''plain
203 * plain''italic'''bold-italic'''''plain
204 * plain'''bold''bold-italic'''''plain
205 * plain l'''italic''plain
206 * plain l''''bold''' plain
207 !! result
208 <ul><li> plain
209 </li><li> plain<i>italic</i>plain
210 </li><li> plain<i>italic</i>plain<i>italic</i>plain
211 </li><li> plain<b>bold</b>plain
212 </li><li> plain<b>bold</b>plain<b>bold</b>plain
213 </li><li> plain<i>italic</i>plain<b>bold</b>plain
214 </li><li> plain<b>bold</b>plain<i>italic</i>plain
215 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
216 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
217 </li><li> plain<i><b>bold-italic</b>italic</i>plain
218 </li><li> plain<b><i>bold-italic</i>bold</b>plain
219 </li><li> plain<i>italic<b>bold-italic</b></i>plain
220 </li><li> plain<b>bold<i>bold-italic</i></b>plain
221 </li><li> plain l'<i>italic</i>plain
222 </li><li> plain l'<b>bold</b> plain
223 </li></ul>
224
225 !! end
226
227 ###
228 ### 2-quote opening sequence tests
229 ###
230 !! test
231 Italics and bold: 2-quote opening sequence: (2,2)
232 !! input
233 ''foo''
234 !! result
235 <p><i>foo</i>
236 </p>
237 !!end
238
239
240 !! test
241 Italics and bold: 2-quote opening sequence: (2,3)
242 !! input
243 ''foo'''
244 !! result
245 <p><i>foo'</i>
246 </p>
247 !!end
248
249
250 !! test
251 Italics and bold: 2-quote opening sequence: (2,4)
252 !! input
253 ''foo''''
254 !! result
255 <p><i>foo''</i>
256 </p>
257 !!end
258
259
260 !! test
261 Italics and bold: 2-quote opening sequence: (2,5)
262 !! input
263 ''foo'''''
264 !! result
265 <p><i>foo</i>
266 </p>
267 !!end
268
269
270 ###
271 ### 3-quote opening sequence tests
272 ###
273
274 !! test
275 Italics and bold: 3-quote opening sequence: (3,2)
276 !! input
277 '''foo''
278 !! result
279 <p>'<i>foo</i>
280 </p>
281 !!end
282
283
284 !! test
285 Italics and bold: 3-quote opening sequence: (3,3)
286 !! input
287 '''foo'''
288 !! result
289 <p><b>foo</b>
290 </p>
291 !!end
292
293
294 !! test
295 Italics and bold: 3-quote opening sequence: (3,4)
296 !! input
297 '''foo''''
298 !! result
299 <p><b>foo'</b>
300 </p>
301 !!end
302
303
304 !! test
305 Italics and bold: 3-quote opening sequence: (3,5)
306 !! input
307 '''foo'''''
308 !! result
309 <p><b>foo</b>
310 </p>
311 !!end
312
313
314 ###
315 ### 4-quote opening sequence tests
316 ###
317
318 !! test
319 Italics and bold: 4-quote opening sequence: (4,2)
320 !! input
321 ''''foo''
322 !! result
323 <p>''<i>foo</i>
324 </p>
325 !!end
326
327
328 !! test
329 Italics and bold: 4-quote opening sequence: (4,3)
330 !! input
331 ''''foo'''
332 !! result
333 <p>'<b>foo</b>
334 </p>
335 !!end
336
337
338 !! test
339 Italics and bold: 4-quote opening sequence: (4,4)
340 !! input
341 ''''foo''''
342 !! result
343 <p>'<b>foo'</b>
344 </p>
345 !!end
346
347
348 !! test
349 Italics and bold: 4-quote opening sequence: (4,5)
350 !! input
351 ''''foo'''''
352 !! result
353 <p>'<b>foo</b>
354 </p>
355 !!end
356
357
358 ###
359 ### 5-quote opening sequence tests
360 ###
361
362 !! test
363 Italics and bold: 5-quote opening sequence: (5,2)
364 !! input
365 '''''foo''
366 !! result
367 <p><b><i>foo</i></b>
368 </p>
369 !!end
370
371
372 !! test
373 Italics and bold: 5-quote opening sequence: (5,3)
374 !! input
375 '''''foo'''
376 !! result
377 <p><i><b>foo</b></i>
378 </p>
379 !!end
380
381
382 !! test
383 Italics and bold: 5-quote opening sequence: (5,4)
384 !! input
385 '''''foo''''
386 !! result
387 <p><i><b>foo'</b></i>
388 </p>
389 !!end
390
391
392 !! test
393 Italics and bold: 5-quote opening sequence: (5,5)
394 !! input
395 '''''foo'''''
396 !! result
397 <p><i><b>foo</b></i>
398 </p>
399 !!end
400
401 ###
402 ### multiple quote sequences in a line
403 ###
404 !! test
405 Italics and bold: multiple quote sequences: (2,4,2)
406 !! input
407 ''foo''''bar''
408 !! result
409 <p><i>foo'<b>bar</b></i>
410 </p>
411 !!end
412
413
414 !! test
415 Italics and bold: multiple quote sequences: (2,4,3)
416 !! input
417 ''foo''''bar'''
418 !! result
419 <p><i>foo'<b>bar</b></i>
420 </p>
421 !!end
422
423
424 !! test
425 Italics and bold: multiple quote sequences: (2,4,4)
426 !! input
427 ''foo''''bar''''
428 !! result
429 <p><i>foo'<b>bar'</b></i>
430 </p>
431 !!end
432
433
434 !! test
435 Italics and bold: multiple quote sequences: (3,4,2)
436 !! input
437 '''foo''''bar''
438 !! result
439 <p><b>foo'</b>bar
440 </p>
441 !!end
442
443
444 !! test
445 Italics and bold: multiple quote sequences: (3,4,3)
446 !! input
447 '''foo''''bar'''
448 !! result
449 <p><b>foo'</b>bar
450 </p>
451 !!end
452
453 ###
454 ### other quote tests
455 ###
456 !! test
457 Italics and bold: other quote tests: (2,3,5)
458 !! input
459 ''this is about '''foo's family'''''
460 !! result
461 <p><i>this is about <b>foo's family</b></i>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: other quote tests: (2,(3,3),2)
468 !! input
469 ''this is about '''foo's''' family''
470 !! result
471 <p><i>this is about <b>foo's</b> family</i>
472 </p>
473 !!end
474
475
476 !! test
477 Italics and bold: other quote tests: (3,2,3,2)
478 !! input
479 '''this is about ''foo'''s family''
480 !! result
481 <p><b>this is about <i>foo</i></b><i>s family</i>
482 </p>
483 !!end
484
485
486 !! test
487 Italics and bold: other quote tests: (3,2,3,3)
488 !! input
489 '''this is about ''foo'''s family'''
490 !! result
491 <p>'<i>this is about </i>foo<b>s family</b>
492 </p>
493 !!end
494
495
496 !! test
497 Italics and bold: other quote tests: (3,(2,2),3)
498 !! input
499 '''this is about ''foo's'' family'''
500 !! result
501 <p><b>this is about <i>foo's</i> family</b>
502 </p>
503 !!end
504
505
506 !! test
507 Italicized possessive
508 !! input
509 The ''[[Main Page]]'''s talk page.
510 !! result
511 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
512 </p>
513 !! end
514
515 ###
516 ### <nowiki> test cases
517 ###
518
519 !! test
520 <nowiki> unordered list
521 !! input
522 <nowiki>* This is not an unordered list item.</nowiki>
523 !! result
524 <p>* This is not an unordered list item.
525 </p>
526 !! end
527
528 !! test
529 <nowiki> spacing
530 !! input
531 <nowiki>Lorem ipsum dolor
532
533 sed abit.
534 sed nullum.
535
536 :and a colon
537 </nowiki>
538 !! result
539 <p>Lorem ipsum dolor
540
541 sed abit.
542 sed nullum.
543
544 :and a colon
545
546 </p>
547 !! end
548
549 !! test
550 nowiki 3
551 !! input
552 :There is not nowiki.
553 :There is <nowiki>nowiki</nowiki>.
554
555 #There is not nowiki.
556 #There is <nowiki>nowiki</nowiki>.
557
558 *There is not nowiki.
559 *There is <nowiki>nowiki</nowiki>.
560 !! result
561 <dl><dd>There is not nowiki.
562 </dd><dd>There is nowiki.
563 </dd></dl>
564 <ol><li>There is not nowiki.
565 </li><li>There is nowiki.
566 </li></ol>
567 <ul><li>There is not nowiki.
568 </li><li>There is nowiki.
569 </li></ul>
570
571 !! end
572
573 !! test
574 Entities inside <nowiki>
575 !! input
576 <nowiki>&lt;</nowiki>
577 !! result
578 <p>&lt;
579 </p>
580 !! end
581
582
583 ###
584 ### Comments
585 ###
586 !! test
587 Comments and Indent-Pre
588 !! input
589 <!-- comment 1 --> asdf
590
591 <!-- comment 1 --> asdf
592 <!-- comment 2 -->
593
594 <!-- comment 1 --> asdf
595 <!-- comment 2 -->xyz
596
597 <!-- comment 1 --> asdf
598 <!-- comment 2 --> xyz
599 !! result
600 <pre>asdf
601 </pre>
602 <pre>asdf
603 </pre>
604 <pre>asdf
605 </pre>
606 <p>xyz
607 </p>
608 <pre>asdf
609 xyz
610 </pre>
611 !! end
612
613 !! test
614 Comment test 2a
615 !! input
616 asdf
617 <!-- comment 1 -->
618 jkl
619 !! result
620 <p>asdf
621 jkl
622 </p>
623 !! end
624
625 !! test
626 Comment test 2b
627 !! input
628 asdf
629 <!-- comment 1 -->
630
631 jkl
632 !! result
633 <p>asdf
634 </p><p>jkl
635 </p>
636 !! end
637
638 !! test
639 Comment test 3
640 !! input
641 asdf
642 <!-- comment 1 -->
643 <!-- comment 2 -->
644 jkl
645 !! result
646 <p>asdf
647 jkl
648 </p>
649 !! end
650
651 !! test
652 Comment test 4
653 !! input
654 asdf<!-- comment 1 -->jkl
655 !! result
656 <p>asdfjkl
657 </p>
658 !! end
659
660 !! test
661 Comment spacing
662 !! input
663 a
664 <!-- foo --> b <!-- bar -->
665 c
666 !! result
667 <p>a
668 </p>
669 <pre> b
670 </pre>
671 <p>c
672 </p>
673 !! end
674
675 !! test
676 Comment whitespace
677 !! input
678 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
679 !! result
680
681 !! end
682
683 !! test
684 Comment semantics and delimiters
685 !! input
686 <!-- --><!----><!-----><!------>
687 !! result
688
689 !! end
690
691 !! test
692 Comment semantics and delimiters, redux
693 !! input
694 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
695 -- foo -- funky huh? ... -->
696 !! result
697
698 !! end
699
700 !! test
701 Comment semantics and delimiters: directors cut
702 !! input
703 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
704 everything starting with < followed by !-- until the first -- and > we see,
705 that wouldn't be valid XML however, since in XML -- has to terminate a comment
706 -->-->
707 !! result
708 <p>--&gt;
709 </p>
710 !! end
711
712 !! test
713 Comment semantics: nesting
714 !! input
715 <!--<!-- no, we're not going to do anything fancy here -->-->
716 !! result
717 <p>--&gt;
718 </p>
719 !! end
720
721 !! test
722 Comment semantics: unclosed comment at end
723 !! input
724 <!--This comment will run out to the end of the document
725 !! result
726
727 !! end
728
729 !! test
730 Comment in template title
731 !! input
732 {{f<!---->oo}}
733 !! result
734 <p>FOO
735 </p>
736 !! end
737
738 !! test
739 Comment on its own line post-expand
740 !! input
741 a
742 {{blank}}<!---->
743 b
744 !! result
745 <p>a
746 </p><p>b
747 </p>
748 !! end
749
750 !! test
751 Comment on its own line post-expand with non-significant whitespace
752 !! input
753 a
754 {{blank}} <!---->
755 b
756 !! result
757 <p>a
758 </p><p>b
759 </p>
760 !! end
761
762 ###
763 ### paragraph wraping tests
764 ###
765 !! test
766 No block tags
767 !! input
768 a
769
770 b
771 !! result
772 <p>a
773 </p><p>b
774 </p>
775 !! end
776 !! test
777 Block tag on one line
778 !! input
779 a <div>foo</div>
780
781 b
782 !! result
783 a <div>foo</div>
784 <p>b
785 </p>
786 !! end
787
788 !! test
789 Block tag on both lines
790 !! input
791 a <div>foo</div>
792
793 b <div>foo</div>
794 !! result
795 a <div>foo</div>
796 b <div>foo</div>
797
798 !! end
799
800 !! test
801 Multiple lines without block tags
802 !! input
803 <div>foo</div> a
804 b
805 c
806 d<!--foo--> e
807 x <div>foo</div> z
808 !! result
809 <div>foo</div> a
810 <p>b
811 c
812 d e
813 </p>
814 x <div>foo</div> z
815
816 !! end
817
818 !! test
819 Empty lines between block tags to test open p-tags are closed between the block tags
820 !! input
821 <div></div>
822
823
824 <div></div>a
825
826 b
827 !! result
828 <div></div>
829 <p><br />
830 </p>
831 <div></div>a
832 <p>b
833 </p>
834 !! end
835
836 ###
837 ### Preformatted text
838 ###
839 !! test
840 Preformatted text
841 !! input
842 This is some
843 Preformatted text
844 With ''italic''
845 And '''bold'''
846 And a [[Main Page|link]]
847 !! result
848 <pre>This is some
849 Preformatted text
850 With <i>italic</i>
851 And <b>bold</b>
852 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
853 </pre>
854 !! end
855
856 !! test
857 Ident preformatting with inline content
858 !! input
859 a
860 ''b''
861 !! result
862 <pre>a
863 <i>b</i>
864 </pre>
865 !! end
866
867 !! test
868 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
869 !! input
870 <pre><nowiki>
871 <b>
872 <cite>
873 <em>
874 </nowiki></pre>
875 !! result
876 <pre>
877 &lt;b&gt;
878 &lt;cite&gt;
879 &lt;em&gt;
880 </pre>
881
882 !! end
883
884 !! test
885 Regression with preformatted in <center>
886 !! input
887 <center>
888 Blah
889 </center>
890 !! result
891 <center>
892 <pre>Blah
893 </pre>
894 </center>
895
896 !! end
897
898 # Expected output in the following test is not really expected (there should be
899 # <pre> in the output) -- it's only testing for well-formedness.
900 !! test
901 Bug 6200: Preformatted in <blockquote>
902 !! input
903 <blockquote>
904 Blah
905 </blockquote>
906 !! result
907 <blockquote>
908 Blah
909 </blockquote>
910
911 !! end
912
913 !! test
914 <pre> with attributes (bug 3202)
915 !! input
916 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
917 !! result
918 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
919
920 !! end
921
922 !! test
923 <pre> with width attribute (bug 3202)
924 !! input
925 <pre width="8">Narrow screen goodies</pre>
926 !! result
927 <pre width="8">Narrow screen goodies</pre>
928
929 !! end
930
931 !! test
932 <pre> with forbidden attribute (bug 3202)
933 !! input
934 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
935 !! result
936 <pre width="8">Narrow screen goodies</pre>
937
938 !! end
939
940 !! test
941 Entities inside <pre>
942 !! input
943 <pre>&lt;</pre>
944 !! result
945 <pre>&lt;</pre>
946
947 !! end
948
949 !! test
950 <pre> with forbidden attribute values (bug 3202)
951 !! input
952 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
953 !! result
954 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
955
956 !! end
957
958 !! test
959 <nowiki> inside <pre> (bug 13238)
960 !! input
961 <pre>
962 <nowiki>
963 </pre>
964 <pre>
965 <nowiki></nowiki>
966 </pre>
967 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
968 !! result
969 <pre>
970 &lt;nowiki&gt;
971 </pre>
972 <pre>
973
974 </pre>
975 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
976
977 !! end
978
979 !! test
980 <nowiki> and <pre> preference (first one wins)
981 !! input
982 <pre>
983 <nowiki>
984 </pre>
985 </nowiki>
986 </pre>
987
988 <nowiki>
989 <pre>
990 <nowiki>
991 </pre>
992 </nowiki>
993 </pre>
994
995 !! result
996 <pre>
997 &lt;nowiki&gt;
998 </pre>
999 <p>&lt;/nowiki&gt;
1000 &lt;/pre&gt;
1001 </p><p>
1002 &lt;pre&gt;
1003 &lt;nowiki&gt;
1004 &lt;/pre&gt;
1005
1006 &lt;/pre&gt;
1007 </p>
1008 !! end
1009
1010 !! test
1011 </pre> inside nowiki
1012 !! input
1013 <nowiki></pre></nowiki>
1014 !! result
1015 <p>&lt;/pre&gt;
1016 </p>
1017 !! end
1018
1019 !!test
1020 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1021 !!input
1022 {{echo|}}
1023 !!result
1024
1025 !!end
1026
1027 !!test
1028 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1029 !!input
1030 {{echo|
1031 foo}}
1032 !!result
1033 <p>foo
1034 </p>
1035 !!end
1036
1037 !! test
1038 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1039 !! input
1040 {{echo|a
1041 b}}
1042 !!result
1043 <pre>a
1044 </pre>
1045 <p>b
1046 </p>
1047 !!end
1048
1049 !! test
1050 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1051 !! input
1052 {{echo|a
1053 b
1054 c
1055 d
1056 e
1057 }}
1058 !!result
1059 <pre>a
1060 </pre>
1061 <p>b
1062 c
1063 </p>
1064 <pre>d
1065 </pre>
1066 <p>e
1067 </p>
1068 !!end
1069
1070 !!test
1071 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1072 !!input
1073 {{echo| foo}}
1074
1075 {{echo| foo}}{{echo| bar}}
1076
1077 {{echo| foo}}
1078 {{echo| bar}}
1079
1080 {{echo|<!--cmt--> foo}}
1081
1082 <!--cmt-->{{echo| foo}}
1083
1084 {{echo|{{echo| }}bar}}
1085 !!result
1086 <pre>foo
1087 </pre>
1088 <pre>foo bar
1089 </pre>
1090 <pre>foo
1091 bar
1092 </pre>
1093 <pre>foo
1094 </pre>
1095 <pre>foo
1096 </pre>
1097 <pre>bar
1098 </pre>
1099 !!end
1100
1101 !! test
1102 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1103 !! input
1104 {{echo| }}a
1105
1106 {{echo|
1107 }}a
1108
1109 {{echo|
1110 b}}
1111
1112 {{echo|a
1113 }}b
1114
1115 {{echo|a
1116 }} b
1117 !!result
1118 <pre>a
1119 </pre>
1120 <p><br />
1121 </p>
1122 <pre>a
1123 </pre>
1124 <p><br />
1125 </p>
1126 <pre>b
1127 </pre>
1128 <p>a
1129 </p>
1130 <pre>b
1131 </pre>
1132 <p>a
1133 </p>
1134 <pre>b
1135 </pre>
1136 !!end
1137
1138 !! test
1139 Templates: Single-line variant of parameter whitespace stripping test
1140 !! input
1141 {{echo| a}}
1142
1143 {{echo|1= a}}
1144
1145 {{echo|{{echo| a}}}}
1146
1147 {{echo|1={{echo| a}}}}
1148 !! result
1149 <pre>a
1150 </pre>
1151 <p>a
1152 </p>
1153 <pre>a
1154 </pre>
1155 <p>a
1156 </p>
1157 !! end
1158
1159 !! test
1160 Templates: Strip whitespace from named parameters, but not positional ones
1161 !! input
1162 {{echo|
1163 foo}}
1164
1165 {{echo|
1166 * foo}}
1167
1168 {{echo| 1 =
1169 foo}}
1170
1171 {{echo| 1 =
1172 * foo}}
1173 !! result
1174 <pre>foo
1175 </pre>
1176 <p><br />
1177 </p>
1178 <ul><li> foo
1179 </li></ul>
1180 <p>foo
1181 </p>
1182 <ul><li> foo
1183 </li></ul>
1184
1185 !! end
1186
1187 ###
1188 ### Parsoid-centric tests for testing RT edge cases for pre
1189 ###
1190
1191 !!test
1192 1a. Indent-Pre and Comments
1193 !!input
1194 a
1195 <!--a-->
1196 c
1197 !!result
1198 <pre>a
1199 </pre>
1200 <p>c
1201 </p>
1202 !!end
1203
1204 !!test
1205 1b. Indent-Pre and Comments
1206 !!input
1207 a
1208 <!--a-->
1209 c
1210 !!result
1211 <pre>a
1212 </pre>
1213 <p>c
1214 </p>
1215 !!end
1216
1217 !!test
1218 1c. Indent-Pre and Comments
1219 !!input
1220 <!--a--> a
1221
1222 <!--a--> a
1223 !!result
1224 <pre> a
1225 </pre>
1226 <pre> a
1227 </pre>
1228 !!end
1229
1230 !!test
1231 2a. Indent-Pre and tables
1232 !!input
1233 {|
1234 |-
1235 !h1!!h2
1236 |foo||bar
1237 |}
1238 !!result
1239 <table>
1240
1241 <tr>
1242 <th>h1</th>
1243 <th>h2
1244 </th>
1245 <td>foo</td>
1246 <td>bar
1247 </td></tr></table>
1248
1249 !!end
1250
1251 !!test
1252 2b. Indent-Pre and tables
1253 !!input
1254 {|
1255 |-
1256 |foo
1257 |}
1258 !!result
1259 <table>
1260
1261 <tr>
1262 <td>foo
1263 </td></tr></table>
1264
1265 !!end
1266
1267 !!test
1268 2c. Indent-Pre and tables (bug 42252)
1269 !!input
1270 {|
1271 |+ foo
1272 ! | bar
1273 |}
1274 !!result
1275 <table>
1276 <caption> foo
1277 </caption>
1278 <tr>
1279 <th> bar
1280 </th></tr></table>
1281
1282 !!end
1283
1284 !!test
1285 3a. Indent-Pre and block tags (single-line html)
1286 !!input
1287 <p> foo </p>
1288 <div> foo </div>
1289 <span> foo </span>
1290 !!result
1291 <p> foo </p>
1292 <div> foo </div>
1293 <pre><span> foo </span>
1294 </pre>
1295 !!end
1296
1297 !!test
1298 3b. Indent-Pre and block tags (pre-content on separate line)
1299 !!input
1300 <p>
1301 foo
1302 </p>
1303
1304 <div>
1305 foo
1306 </div>
1307
1308 <center>
1309 foo
1310 </center>
1311
1312 <blockquote>
1313 foo
1314 </blockquote>
1315
1316 <table><tr><td>
1317 foo
1318 </td></tr></table>
1319
1320 <ul><li>
1321 foo
1322 </li></ul>
1323
1324 !!result
1325 <p>
1326 foo
1327 </p>
1328 <div>
1329 <pre>foo
1330 </pre>
1331 </div>
1332 <center>
1333 <pre>foo
1334 </pre>
1335 </center>
1336 <blockquote>
1337 foo
1338 </blockquote>
1339 <table><tr><td>
1340 <pre>foo
1341 </pre>
1342 </td></tr></table>
1343 <ul><li>
1344 foo
1345 </li></ul>
1346
1347 !!end
1348
1349 !!test
1350 4. Multiple spaces at start-of-line
1351 !!input
1352 <p> foo </p>
1353 foo
1354 {|
1355 |foo
1356 |}
1357 !!result
1358 <p> foo </p>
1359 <pre> foo
1360 </pre>
1361 <table>
1362 <tr>
1363 <td>foo
1364 </td></tr></table>
1365
1366 !!end
1367
1368 !! test
1369 5. White-space in indent-pre
1370 NOTE: the white-space char on 2nd line is significant
1371 !! input
1372 a<br/>
1373
1374 b
1375 !! result
1376 <pre>a<br />
1377
1378 b
1379 </pre>
1380 !! end
1381
1382 ###
1383 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1384 ###
1385
1386 !!test
1387 HTML-pre: 1. embedded newlines
1388 !!input
1389 <pre>foo</pre>
1390
1391 <pre>
1392 foo
1393 </pre>
1394
1395 <pre>
1396
1397 foo
1398 </pre>
1399
1400 <pre>
1401
1402
1403 foo
1404 </pre>
1405 !!result
1406 <pre>foo</pre>
1407 <pre>
1408 foo
1409 </pre>
1410 <pre>
1411
1412 foo
1413 </pre>
1414 <pre>
1415
1416
1417 foo
1418 </pre>
1419
1420 !!end
1421
1422 !!test
1423 HTML-pre: 2: indented text
1424 !!input
1425 <pre>
1426 foo
1427 </pre>
1428 !!result
1429 <pre>
1430 foo
1431 </pre>
1432
1433 !!end
1434
1435 !!test
1436 HTML-pre: 3: other wikitext
1437 !!input
1438 <pre>
1439 * foo
1440 # bar
1441 = no-h =
1442 '' no-italic ''
1443 [[ NoLink ]]
1444 </pre>
1445 !!result
1446 <pre>
1447 * foo
1448 # bar
1449 = no-h =
1450 '' no-italic ''
1451 [[ NoLink ]]
1452 </pre>
1453
1454 !!end
1455
1456 ###
1457 ### Definition lists
1458 ###
1459 !! test
1460 Simple definition
1461 !! input
1462 ; name : Definition
1463 !! result
1464 <dl><dt> name&#160;</dt><dd> Definition
1465 </dd></dl>
1466
1467 !! end
1468
1469 !! test
1470 Definition list for indentation only
1471 !! input
1472 : Indented text
1473 !! result
1474 <dl><dd> Indented text
1475 </dd></dl>
1476
1477 !! end
1478
1479 !! test
1480 Definition list with no space
1481 !! input
1482 ;name:Definition
1483 !! result
1484 <dl><dt>name</dt><dd>Definition
1485 </dd></dl>
1486
1487 !!end
1488
1489 !! test
1490 Definition list with URL link
1491 !! input
1492 ; http://example.com/ : definition
1493 !! result
1494 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1495 </dd></dl>
1496
1497 !! end
1498
1499 !! test
1500 Definition list with bracketed URL link
1501 !! input
1502 ;[http://www.example.com/ Example]:Something about it
1503 !! result
1504 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1505 </dd></dl>
1506
1507 !! end
1508
1509 !! test
1510 Definition list with wikilink containing colon
1511 !! input
1512 ; [[Help:FAQ]]: The least-read page on Wikipedia
1513 !! result
1514 <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
1515 </dd></dl>
1516
1517 !! end
1518
1519 # At Brion's and JeLuF's insistence... :)
1520 !! test
1521 Definition list with news link containing colon
1522 !! input
1523 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1524 !! result
1525 <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!
1526 </dd></dl>
1527
1528 !! end
1529
1530 !! test
1531 Malformed definition list with colon
1532 !! input
1533 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1534 !! result
1535 <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
1536 </dt></dl>
1537
1538 !! end
1539
1540 !! test
1541 Definition lists: colon in external link text
1542 !! input
1543 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1544 !! result
1545 <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
1546 </dd></dl>
1547
1548 !! end
1549
1550 !! test
1551 Definition lists: colon in HTML attribute
1552 !! input
1553 ;<b style="display: inline">bold</b>
1554 !! result
1555 <dl><dt><b style="display: inline">bold</b>
1556 </dt></dl>
1557
1558 !! end
1559
1560 !! test
1561 Definition lists: self-closed tag
1562 !! input
1563 ;one<br/>two : two-line fun
1564 !! result
1565 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1566 </dd></dl>
1567
1568 !! end
1569
1570 !! test
1571 Bug 11748: Literal closing tags
1572 !! input
1573 <dl>
1574 <dt>test 1</dt>
1575 <dd>test test test test test</dd>
1576 <dt>test 2</dt>
1577 <dd>test test test test test</dd>
1578 </dl>
1579 !! result
1580 <dl>
1581 <dt>test 1</dt>
1582 <dd>test test test test test</dd>
1583 <dt>test 2</dt>
1584 <dd>test test test test test</dd>
1585 </dl>
1586
1587 !! end
1588
1589 !! test
1590 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1591 !! input
1592 <ul><li>
1593 ; term : description
1594 * unordered
1595 </li>
1596 </ul>
1597 !! result
1598 <ul><li>
1599 <dl><dt> term&#160;</dt><dd> description
1600 </dd></dl>
1601 <ul><li> unordered
1602 </li></ul>
1603 </li>
1604 </ul>
1605
1606 !! end
1607
1608 !! test
1609
1610 Definition list with empty definition and following paragraph
1611 !! input
1612 ; term:
1613 Paragraph text
1614 !! result
1615 <dl><dt> term</dt><dd>
1616 </dd></dl>
1617 <p>Paragraph text
1618 </p>
1619 !! end
1620
1621 !! test
1622 Nested definition lists using html syntax
1623 !! input
1624 <dl><dd>
1625 <dl>
1626 <dd>Foo</dd>
1627 </dl>
1628 </dd></dl>
1629 !! result
1630 <dl><dd>
1631 <dl>
1632 <dd>Foo</dd>
1633 </dl>
1634 </dd></dl>
1635
1636 !! end
1637
1638 !! test
1639 Definition Lists: No nesting: Multiple dd's
1640 !! input
1641 ;x
1642 :a
1643 :b
1644 !! result
1645 <dl><dt>x
1646 </dt><dd>a
1647 </dd><dd>b
1648 </dd></dl>
1649
1650 !! end
1651
1652 !! test
1653 Definition Lists: Indentation: Regular
1654 !! input
1655 :i1
1656 ::i2
1657 :::i3
1658 !! result
1659 <dl><dd>i1
1660 <dl><dd>i2
1661 <dl><dd>i3
1662 </dd></dl>
1663 </dd></dl>
1664 </dd></dl>
1665
1666 !! end
1667
1668 !! test
1669 Definition Lists: Indentation: Missing 1st level
1670 !! input
1671 ::i2
1672 :::i3
1673 !! result
1674 <dl><dd><dl><dd>i2
1675 <dl><dd>i3
1676 </dd></dl>
1677 </dd></dl>
1678 </dd></dl>
1679
1680 !! end
1681
1682 !! test
1683 Definition Lists: Indentation: Multi-level indent
1684 !! input
1685 :::i3
1686 !! result
1687 <dl><dd><dl><dd><dl><dd>i3
1688 </dd></dl>
1689 </dd></dl>
1690 </dd></dl>
1691
1692 !! end
1693
1694 !! test
1695 Definition Lists: Hacky use to indent tables
1696 !! input
1697 ::{|
1698 |foo
1699 |bar
1700 |}
1701 this text
1702 should be left alone
1703 !! result
1704 <dl><dd><dl><dd><table>
1705 <tr>
1706 <td>foo
1707 </td>
1708 <td>bar
1709 </td></tr></table></dd></dl></dd></dl>
1710 <p>this text
1711 should be left alone
1712 </p>
1713 !! end
1714 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1715 ## as an empty dt item. It also ignores all but the last ";" when followed
1716 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1717 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1718 ## ";"s.
1719 ##
1720 ## Ex: ";;t2 ::d2" is transformed into:
1721 ##
1722 ## <dl>
1723 ## <dt>t2 </dt>
1724 ## <dd>
1725 ## <dl>
1726 ## <dt></dt>
1727 ## <dd>d2</dd>
1728 ## </dl>
1729 ## </dd>
1730 ## </dl>
1731 ##
1732 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1733 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1734 ##
1735 ## <dl>
1736 ## <dt>
1737 ## <dl>
1738 ## <dt>t2 </dt>
1739 ## <dd>:d2</dd>
1740 ## </dl>
1741 ## </dt>
1742 ## </dl>
1743 ##
1744 ## All Parsoid only definition list tests have this difference.
1745 ##
1746 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1747 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1748
1749 !! test
1750 Table / list interaction: indented table with lists in table contents
1751 !! input
1752 :{|
1753 |-
1754 | a
1755 * b
1756 |-
1757 | c
1758 * d
1759 |}
1760 !! result
1761 <dl><dd><table>
1762
1763 <tr>
1764 <td> a
1765 <ul><li> b
1766 </li></ul>
1767 </td></tr>
1768 <tr>
1769 <td> c
1770 <ul><li> d
1771 </li></ul>
1772 </td></tr></table></dd></dl>
1773
1774 !! end
1775
1776 !!test
1777 Table / list interaction: lists nested in tables nested in indented lists
1778 !!input
1779 :{|
1780 |
1781 :a
1782 :b
1783 |
1784 *c
1785 *d
1786 |}
1787
1788 *e
1789 *f
1790 !!result
1791 <dl><dd><table>
1792 <tr>
1793 <td>
1794 <dl><dd>a
1795 </dd><dd>b
1796 </dd></dl>
1797 </td>
1798 <td>
1799 <ul><li>c
1800 </li><li>d
1801 </li></ul>
1802 </td></tr></table></dd></dl>
1803 <ul><li>e
1804 </li><li>f
1805 </li></ul>
1806
1807 !!end
1808
1809 !! test
1810 Definition Lists: Nesting: Multi-level (Parsoid only)
1811 !! options
1812 parsoid
1813 !! input
1814 ;t1 :d1
1815 ;;t2 ::d2
1816 ;;;t3 :::d3
1817 !! result
1818 <dl>
1819 <dt>t1 </dt>
1820 <dd>d1</dd>
1821 <dt>
1822 <dl>
1823 <dt>t2 </dt>
1824 <dd>:d2</dd>
1825 <dt>
1826 <dl>
1827 <dt>t3 </dt>
1828 <dd>::d3</dd>
1829 </dl>
1830 </dt>
1831 </dl>
1832 </dt>
1833 </dl>
1834
1835
1836 !! end
1837
1838
1839 !! test
1840 Definition Lists: Nesting: Test 2 (Parsoid only)
1841 !! options
1842 parsoid
1843 !! input
1844 ;t1
1845 ::d2
1846 !! result
1847 <dl>
1848 <dt>t1</dt>
1849 <dd>
1850 <dl>
1851 <dd>d2</dd>
1852 </dl>
1853 </dd>
1854 </dl>
1855
1856 !! end
1857
1858
1859 !! test
1860 Definition Lists: Nesting: Test 3 (Parsoid only)
1861 !! options
1862 parsoid
1863 !! input
1864 :;t1
1865 ::::d2
1866 !! result
1867 <dl>
1868 <dd>
1869 <dl>
1870 <dt>t1</dt>
1871 <dd>
1872 <dl>
1873 <dd>
1874 <dl>
1875 <dd>d2</dd>
1876 </dl>
1877 </dd>
1878 </dl>
1879 </dd>
1880 </dl>
1881 </dd>
1882 </dl>
1883
1884 !! end
1885
1886
1887 !! test
1888 Definition Lists: Nesting: Test 4
1889 !! input
1890 ::;t3
1891 :::d3
1892 !! result
1893 <dl><dd><dl><dd><dl><dt>t3
1894 </dt><dd>d3
1895 </dd></dl>
1896 </dd></dl>
1897 </dd></dl>
1898
1899 !! end
1900
1901
1902 !! test
1903 Definition Lists: Mixed Lists: Test 1
1904 !! input
1905 :;* foo
1906 ::* bar
1907 :; baz
1908 !! result
1909 <dl><dd><dl><dt><ul><li> foo
1910 </li><li> bar
1911 </li></ul>
1912 </dt></dl>
1913 <dl><dt> baz
1914 </dt></dl>
1915 </dd></dl>
1916
1917 !! end
1918
1919
1920 !! test
1921 Definition Lists: Mixed Lists: Test 2
1922 !! input
1923 *: d1
1924 *: d2
1925 !! result
1926 <ul><li><dl><dd> d1
1927 </dd><dd> d2
1928 </dd></dl>
1929 </li></ul>
1930
1931 !! end
1932
1933
1934 !! test
1935 Definition Lists: Mixed Lists: Test 3
1936 !! input
1937 *::: d1
1938 *::: d2
1939 !! result
1940 <ul><li><dl><dd><dl><dd><dl><dd> d1
1941 </dd><dd> d2
1942 </dd></dl>
1943 </dd></dl>
1944 </dd></dl>
1945 </li></ul>
1946
1947 !! end
1948
1949
1950 !! test
1951 Definition Lists: Mixed Lists: Test 4
1952 !! input
1953 *;d1 :d2
1954 *;d3 :d4
1955 !! result
1956 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1957 </dd><dt>d3&#160;</dt><dd>d4
1958 </dd></dl>
1959 </li></ul>
1960
1961 !! end
1962
1963
1964 !! test
1965 Definition Lists: Mixed Lists: Test 5
1966 !! input
1967 *:d1
1968 *:: d2
1969 !! result
1970 <ul><li><dl><dd>d1
1971 <dl><dd> d2
1972 </dd></dl>
1973 </dd></dl>
1974 </li></ul>
1975
1976 !! end
1977
1978
1979 !! test
1980 Definition Lists: Mixed Lists: Test 6
1981 !! input
1982 #*:d1
1983 #*::: d3
1984 !! result
1985 <ol><li><ul><li><dl><dd>d1
1986 <dl><dd><dl><dd> d3
1987 </dd></dl>
1988 </dd></dl>
1989 </dd></dl>
1990 </li></ul>
1991 </li></ol>
1992
1993 !! end
1994
1995
1996 !! test
1997 Definition Lists: Mixed Lists: Test 7
1998 !! input
1999 :* d1
2000 :* d2
2001 !! result
2002 <dl><dd><ul><li> d1
2003 </li><li> d2
2004 </li></ul>
2005 </dd></dl>
2006
2007 !! end
2008
2009
2010 !! test
2011 Definition Lists: Mixed Lists: Test 8
2012 !! input
2013 :* d1
2014 ::* d2
2015 !! result
2016 <dl><dd><ul><li> d1
2017 </li></ul>
2018 <dl><dd><ul><li> d2
2019 </li></ul>
2020 </dd></dl>
2021 </dd></dl>
2022
2023 !! end
2024
2025
2026 !! test
2027 Definition Lists: Mixed Lists: Test 9
2028 !! input
2029 *;foo :bar
2030 !! result
2031 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2032 </dd></dl>
2033 </li></ul>
2034
2035 !! end
2036
2037
2038 !! test
2039 Definition Lists: Mixed Lists: Test 10
2040 !! input
2041 *#;foo :bar
2042 !! result
2043 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2044 </dd></dl>
2045 </li></ol>
2046 </li></ul>
2047
2048 !! end
2049
2050
2051 !! test
2052 Definition Lists: Mixed Lists: Test 11
2053 !! input
2054 *#*#;*;;foo :bar
2055 *#*#;boo :baz
2056 !! result
2057 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2058 </dt></dl>
2059 </dd></dl>
2060 </li></ul>
2061 </dd></dl>
2062 <dl><dt>boo&#160;</dt><dd>baz
2063 </dd></dl>
2064 </li></ol>
2065 </li></ul>
2066 </li></ol>
2067 </li></ul>
2068
2069 !! end
2070
2071
2072 !! test
2073 Definition Lists: Weird Ones: Test 1
2074 !! input
2075 *#;*::;; foo : bar (who uses this?)
2076 !! result
2077 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2078 </dt></dl>
2079 </dd></dl>
2080 </dd></dl>
2081 </dd></dl>
2082 </li></ul>
2083 </dd></dl>
2084 </li></ol>
2085 </li></ul>
2086
2087 !! end
2088
2089 ###
2090 ### External links
2091 ###
2092 !! test
2093 External links: non-bracketed
2094 !! input
2095 Non-bracketed: http://example.com
2096 !! result
2097 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2098 </p>
2099 !! end
2100
2101 !! test
2102 External links: numbered
2103 !! input
2104 Numbered: [http://example.com]
2105 Numbered: [http://example.net]
2106 Numbered: [http://example.com]
2107 !! result
2108 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2109 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2110 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2111 </p>
2112 !!end
2113
2114 !! test
2115 External links: specified text
2116 !! input
2117 Specified text: [http://example.com link]
2118 !! result
2119 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2120 </p>
2121 !!end
2122
2123 !! test
2124 External links: trail
2125 !! input
2126 Linktrails should not work for external links: [http://example.com link]s
2127 !! result
2128 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2129 </p>
2130 !! end
2131
2132 !! test
2133 External links: dollar sign in URL
2134 !! input
2135 http://example.com/1$2345
2136 !! result
2137 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2138 </p>
2139 !! end
2140
2141 !! test
2142 External links: dollar sign in URL (named)
2143 !! input
2144 [http://example.com/1$2345]
2145 !! result
2146 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2147 </p>
2148 !!end
2149
2150 !! test
2151 External links: open square bracket forbidden in URL (bug 4377)
2152 !! input
2153 http://example.com/1[2345
2154 !! result
2155 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2156 </p>
2157 !! end
2158
2159 !! test
2160 External links: open square bracket forbidden in URL (named) (bug 4377)
2161 !! input
2162 [http://example.com/1[2345]
2163 !! result
2164 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2165 </p>
2166 !!end
2167
2168 !! test
2169 External links: nowiki in URL link text (bug 6230)
2170 !!input
2171 [http://example.com/ <nowiki>''example site''</nowiki>]
2172 !! result
2173 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2174 </p>
2175 !! end
2176
2177 !! test
2178 External links: newline forbidden in text (bug 6230 regression check)
2179 !! input
2180 [http://example.com/ first
2181 second]
2182 !! result
2183 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2184 second]
2185 </p>
2186 !!end
2187
2188 !! test
2189 External links: Pipe char between url and text
2190 !! input
2191 [http://example.com | link]
2192 !! result
2193 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2194 </p>
2195 !!end
2196
2197 !! test
2198 External links: protocol-relative URL in brackets
2199 !! input
2200 [//example.com/ Test]
2201 !! result
2202 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2203 </p>
2204 !! end
2205
2206 !! test
2207 External links: protocol-relative URL in brackets without text
2208 !! input
2209 [//example.com]
2210 !! result
2211 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2212 </p>
2213 !! end
2214
2215 !! test
2216 External links: protocol-relative URL in free text is left alone
2217 !! input
2218 //example.com/Foo
2219 !! result
2220 <p>//example.com/Foo
2221 </p>
2222 !!end
2223
2224 !! test
2225 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2226 !! input
2227 foo//example.com/Foo
2228 !! result
2229 <p>foo//example.com/Foo
2230 </p>
2231 !! end
2232
2233 !! test
2234 External image
2235 !! input
2236 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2237 !! result
2238 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2239 </p>
2240 !! end
2241
2242 !! test
2243 External image from https
2244 !! input
2245 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2246 !! result
2247 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2248 </p>
2249 !! end
2250
2251 !! test
2252 Link to non-http image, no img tag
2253 !! input
2254 Link to non-http image, no img tag: ftp://example.com/test.jpg
2255 !! result
2256 <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>
2257 </p>
2258 !! end
2259
2260 !! test
2261 External links: terminating separator
2262 !! input
2263 Terminating separator: http://example.com/thing,
2264 !! result
2265 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2266 </p>
2267 !! end
2268
2269 !! test
2270 External links: intervening separator
2271 !! input
2272 Intervening separator: http://example.com/1,2,3
2273 !! result
2274 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2275 </p>
2276 !! end
2277
2278 !! test
2279 External links: old bug with URL in query
2280 !! input
2281 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2282 !! result
2283 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2284 </p>
2285 !! end
2286
2287 !! test
2288 External links: old URL-in-URL bug, mixed protocols
2289 !! input
2290 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2291 !! result
2292 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2293 </p>
2294 !!end
2295
2296 !! test
2297 External links: URL in text
2298 !! input
2299 URL in text: [http://example.com http://example.com]
2300 !! result
2301 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2302 </p>
2303 !! end
2304
2305 !! test
2306 External links: Clickable images
2307 !! input
2308 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2309 !! result
2310 <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>
2311 </p>
2312 !!end
2313
2314 !! test
2315 External links: raw ampersand
2316 !! input
2317 Old &amp; use: http://x&y
2318 !! result
2319 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2320 </p>
2321 !! end
2322
2323 !! test
2324 External links: encoded ampersand
2325 !! input
2326 Old &amp; use: http://x&amp;y
2327 !! result
2328 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2329 </p>
2330 !! end
2331
2332 !! test
2333 External links: encoded equals (bug 6102)
2334 !! input
2335 http://example.com/?foo&#61;bar
2336 !! result
2337 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2338 </p>
2339 !! end
2340
2341 !! test
2342 External links: [raw ampersand]
2343 !! input
2344 Old &amp; use: [http://x&y]
2345 !! result
2346 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2347 </p>
2348 !! end
2349
2350 !! test
2351 External links: [encoded ampersand]
2352 !! input
2353 Old &amp; use: [http://x&amp;y]
2354 !! result
2355 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2356 </p>
2357 !! end
2358
2359 !! test
2360 External links: [encoded equals] (bug 6102)
2361 !! input
2362 [http://example.com/?foo&#61;bar]
2363 !! result
2364 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2365 </p>
2366 !! end
2367
2368 !! test
2369 External links: [IDN ignored character reference in hostname; strip it right off]
2370 !! input
2371 [http://e&zwnj;xample.com/]
2372 !! result
2373 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2374 </p>
2375 !! end
2376
2377 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2378 # Where an external link could easily circumvent the sanitization of the text of
2379 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2380 # test demands a higher standard. That's a bit strange.
2381 #
2382 # Example:
2383 #
2384 # http://e‌xample.com -> [http://example.com|http://example.com]
2385 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2386 #
2387 # The first example is sanitized, but the second is not. Any security benefits
2388 # from this production are trivial to circumvent. Either remove this test and
2389 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2390 # the test accordingly.
2391 #
2392 # All our love,
2393 # The Parsoid team.
2394 !! test
2395 External links: IDN ignored character reference in hostname; strip it right off
2396 !! input
2397 http://e&zwnj;xample.com/
2398 !! result
2399 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2400 </p>
2401 !! end
2402
2403 !! test
2404 External links: www.jpeg.org (bug 554)
2405 !! input
2406 http://www.jpeg.org
2407 !!result
2408 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2409 </p>
2410 !! end
2411
2412 !! test
2413 External links: URL within URL (original bug 2)
2414 !! input
2415 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2416 !! result
2417 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2418 </p>
2419 !! end
2420
2421 !! test
2422 BUG 361: URL inside bracketed URL
2423 !! input
2424 [http://www.example.com/foo http://www.example.com/bar]
2425 !! result
2426 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2427 </p>
2428 !! end
2429
2430 !! test
2431 BUG 361: URL within URL, not bracketed
2432 !! input
2433 http://www.example.com/foo?=http://www.example.com/bar
2434 !! result
2435 <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>
2436 </p>
2437 !! end
2438
2439 !! test
2440 BUG 289: ">"-token in URL-tail
2441 !! input
2442 http://www.example.com/<hello>
2443 !! result
2444 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2445 </p>
2446 !!end
2447
2448 !! test
2449 BUG 289: literal ">"-token in URL-tail
2450 !! input
2451 http://www.example.com/<b>html</b>
2452 !! result
2453 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2454 </p>
2455 !!end
2456
2457 !! test
2458 BUG 289: ">"-token in bracketed URL
2459 !! input
2460 [http://www.example.com/<hello> stuff]
2461 !! result
2462 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2463 </p>
2464 !!end
2465
2466 !! test
2467 BUG 289: literal ">"-token in bracketed URL
2468 !! input
2469 [http://www.example.com/<b>html</b> stuff]
2470 !! result
2471 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2472 </p>
2473 !!end
2474
2475 !! test
2476 BUG 289: literal double quote at end of URL
2477 !! input
2478 http://www.example.com/"hello"
2479 !! result
2480 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2481 </p>
2482 !!end
2483
2484 !! test
2485 BUG 289: literal double quote in bracketed URL
2486 !! input
2487 [http://www.example.com/"hello" stuff]
2488 !! result
2489 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2490 </p>
2491 !!end
2492
2493 !! test
2494 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2495 !! input
2496 [http://www.example.com test]
2497 !! result
2498 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2499 </p>
2500 !! end
2501
2502 !! test
2503 External links: link text with spaces
2504 !! input
2505 [http://www.example.com a b c]
2506 [http://www.example.com ''a'' ''b'']
2507 !! result
2508 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2509 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2510 </p>
2511 !! end
2512
2513 !! test
2514 External links: wiki links within external link (Bug 3695)
2515 !! input
2516 [http://example.com [[wikilink]] embedded in ext link]
2517 !! result
2518 <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>
2519 </p>
2520 !! end
2521
2522 !! test
2523 BUG 787: Links with one slash after the url protocol are invalid
2524 !! input
2525 http:/example.com
2526
2527 [http:/example.com title]
2528 !! result
2529 <p>http:/example.com
2530 </p><p>[http:/example.com title]
2531 </p>
2532 !! end
2533
2534 !! test
2535 Bracketed external links with template-generated invalid target
2536 !! input
2537 [{{echo|http:/example.com}} title]
2538 !! result
2539 <p>[http:/example.com title]
2540 </p>
2541 !! end
2542
2543 !! test
2544 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2545 !! input
2546 ''[http://example.com text'']
2547 [http://example.com '''text]'''
2548 ''Something [http://example.com in italic'']
2549 ''Something [http://example.com mixed''''', even bold]'''
2550 '''''Now [http://example.com both''''']
2551 !! result
2552 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2553 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2554 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2555 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2556 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2557 </p>
2558 !! end
2559
2560
2561 !! test
2562 Bug 4781: %26 in URL
2563 !! input
2564 http://www.example.com/?title=AT%26T
2565 !! result
2566 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2567 </p>
2568 !! end
2569
2570 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2571 # % is actually legal in HTML5. Any change in output would need testing though.
2572 !! test
2573 Bug 4781, 5267: %25 in URL
2574 !! input
2575 http://www.example.com/?title=100%25_Bran
2576 !! result
2577 <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>
2578 </p>
2579 !! end
2580
2581 !! test
2582 Bug 4781, 5267: %28, %29 in URL
2583 !! input
2584 http://www.example.com/?title=Ben-Hur_%281959_film%29
2585 !! result
2586 <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>
2587 </p>
2588 !! end
2589
2590
2591 !! test
2592 Bug 4781: %26 in autonumber URL
2593 !! input
2594 [http://www.example.com/?title=AT%26T]
2595 !! result
2596 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2597 </p>
2598 !! end
2599
2600 !! test
2601 Bug 4781, 5267: %26 in autonumber URL
2602 !! input
2603 [http://www.example.com/?title=100%25_Bran]
2604 !! result
2605 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2606 </p>
2607 !! end
2608
2609 !! test
2610 Bug 4781, 5267: %28, %29 in autonumber URL
2611 !! input
2612 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2613 !! result
2614 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2615 </p>
2616 !! end
2617
2618
2619 !! test
2620 Bug 4781: %26 in bracketed URL
2621 !! input
2622 [http://www.example.com/?title=AT%26T link]
2623 !! result
2624 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2625 </p>
2626 !! end
2627
2628 !! test
2629 Bug 4781, 5267: %26 in bracketed URL
2630 !! input
2631 [http://www.example.com/?title=100%25_Bran link]
2632 !! result
2633 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2634 </p>
2635 !! end
2636
2637 !! test
2638 Bug 4781, 5267: %28, %29 in bracketed URL
2639 !! input
2640 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2641 !! result
2642 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2643 </p>
2644 !! end
2645
2646 !! test
2647 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2648 !! input
2649 Some [http://example.com/ pretty ''italics'' and stuff]!
2650 !! result
2651 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2652 </p>
2653 !! end
2654
2655 !! test
2656 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2657 !! input
2658 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2659 !! result
2660 <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>
2661 </p>
2662 !! end
2663
2664 !! test
2665 External link containing double-single-quotes with no space separating the url from text in italics
2666 !! input
2667 [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]].]
2668 !! result
2669 <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>
2670 </p>
2671 !! end
2672
2673 !! test
2674 URL-encoding in URL functions (single parameter)
2675 !! input
2676 {{localurl:Some page|amp=&}}
2677 !! result
2678 <p>/index.php?title=Some_page&amp;amp=&amp;
2679 </p>
2680 !! end
2681
2682 !! test
2683 URL-encoding in URL functions (multiple parameters)
2684 !! input
2685 {{localurl:Some page|q=?&amp=&}}
2686 !! result
2687 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2688 </p>
2689 !! end
2690
2691 !! test
2692 Brackets in urls
2693 !! input
2694 http://example.com/index.php?foozoid%5B%5D=bar
2695
2696 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2697 !! result
2698 <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>
2699 </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>
2700 </p>
2701 !! end
2702
2703 !! test
2704 IPv6 urls (bug 21261)
2705 !! options
2706 disabled
2707 !! input
2708 http://[2404:130:0:1000::187:2]/index.php
2709 !! result
2710 <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>
2711 </p>
2712 !! end
2713
2714 !! test
2715 Non-extlinks in brackets
2716 !! input
2717 [foo]
2718 [foo bar]
2719 [foo ''bar'']
2720 [fool's] errand
2721 [fool's errand]
2722 [{{echo|foo}}]
2723 [{{echo|foo}} bar]
2724 [{{echo|foo}} ''bar'']
2725 [{{echo|foo}}l's] errand
2726 [{{echo|foo}}l's errand]
2727 [url={{echo|foo}}]
2728 [url=http://example.com]
2729 !! result
2730 <p>[foo]
2731 [foo bar]
2732 [foo <i>bar</i>]
2733 [fool's] errand
2734 [fool's errand]
2735 [foo]
2736 [foo bar]
2737 [foo <i>bar</i>]
2738 [fool's] errand
2739 [fool's errand]
2740 [url=foo]
2741 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
2742 </p>
2743 !! end
2744
2745 ###
2746 ### Quotes
2747 ###
2748
2749 !! test
2750 Quotes
2751 !! input
2752 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2753
2754 Normal text. '''''Bold italic text.''''' Normal text.
2755 !!result
2756 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2757 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2758 </p>
2759 !! end
2760
2761
2762 !! test
2763 Unclosed and unmatched quotes
2764 !! input
2765 '''''Bold italic text '''with bold deactivated''' in between.'''''
2766
2767 '''''Bold italic text ''with italic deactivated'' in between.'''''
2768
2769 '''Bold text..
2770
2771 ..spanning two paragraphs (should not work).'''
2772
2773 '''Bold tag left open
2774
2775 ''Italic tag left open
2776
2777 Normal text.
2778
2779 <!-- Unmatching number of opening, closing tags: -->
2780 '''This year''''s election ''should'' beat '''last year''''s.
2781
2782 ''Tom'''s car is bigger than ''Susan'''s.
2783
2784 Plain ''italic'''s plain
2785 !! result
2786 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2787 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2788 </p><p><b>Bold text..</b>
2789 </p><p>..spanning two paragraphs (should not work).
2790 </p><p><b>Bold tag left open</b>
2791 </p><p><i>Italic tag left open</i>
2792 </p><p>Normal text.
2793 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2794 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2795 </p><p>Plain <i>italic'</i>s plain
2796 </p>
2797 !! end
2798
2799 ###
2800 ### Tables
2801 ###
2802 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2803 ###
2804
2805 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2806 # is the bare minimun required by the spec, see:
2807 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2808 !! test
2809 A table with no data.
2810 !! input
2811 {||}
2812 !! result
2813 !! end
2814
2815 # A table with nothing but a caption is invalid XHTML, we might want to render
2816 # this as <p>caption</p>
2817 !! test
2818 A table with nothing but a caption
2819 !! input
2820 {|
2821 |+ caption
2822 |}
2823 !! result
2824 <table>
2825 <caption> caption
2826 </caption><tr><td></td></tr></table>
2827
2828 !! end
2829
2830 !! test
2831 A table with caption with default-spaced attributes and a table row
2832 !! input
2833 {|
2834 |+ style="color: red;" | caption1
2835 |-
2836 | foo
2837 |}
2838 !! result
2839 <table>
2840 <caption style="color: red;"> caption1
2841 </caption>
2842 <tr>
2843 <td> foo
2844 </td></tr></table>
2845
2846 !! end
2847
2848 !! test
2849 A table with captions with non-default spaced attributes and a table row
2850 !! input
2851 {|
2852 |+style="color: red;"|caption2
2853 |+ style="color: red;"| caption3
2854 |-
2855 | foo
2856 |}
2857 !! result
2858 <table>
2859 <caption style="color: red;">caption2
2860 </caption>
2861 <caption style="color: red;"> caption3
2862 </caption>
2863 <tr>
2864 <td> foo
2865 </td></tr></table>
2866
2867 !! end
2868
2869 !! test
2870 Table td-cell syntax variations
2871 !! input
2872 {|
2873 | foo bar foo | baz
2874 | foo bar foo || baz
2875 | style='color:red;' | baz
2876 | style='color:red;' || baz
2877 |}
2878 !! result
2879 <table>
2880 <tr>
2881 <td> baz
2882 </td>
2883 <td> foo bar foo </td>
2884 <td> baz
2885 </td>
2886 <td style="color:red;"> baz
2887 </td>
2888 <td> style='color:red;' </td>
2889 <td> baz
2890 </td></tr></table>
2891
2892 !! end
2893
2894 !! test
2895 Simple table
2896 !! input
2897 {|
2898 | 1 || 2
2899 |-
2900 | 3 || 4
2901 |}
2902 !! result
2903 <table>
2904 <tr>
2905 <td> 1 </td>
2906 <td> 2
2907 </td></tr>
2908 <tr>
2909 <td> 3 </td>
2910 <td> 4
2911 </td></tr></table>
2912
2913 !! end
2914
2915 !! test
2916 Simple table but with multiple dashes for row wikitext
2917 !! input
2918 {|
2919 | foo
2920 |-----
2921 | bar
2922 |}
2923 !! result
2924 <table>
2925 <tr>
2926 <td> foo
2927 </td></tr>
2928 <tr>
2929 <td> bar
2930 </td></tr></table>
2931
2932 !! end
2933 !! test
2934 Multiplication table
2935 !! input
2936 {| border="1" cellpadding="2"
2937 |+Multiplication table
2938 |-
2939 ! &times; !! 1 !! 2 !! 3
2940 |-
2941 ! 1
2942 | 1 || 2 || 3
2943 |-
2944 ! 2
2945 | 2 || 4 || 6
2946 |-
2947 ! 3
2948 | 3 || 6 || 9
2949 |-
2950 ! 4
2951 | 4 || 8 || 12
2952 |-
2953 ! 5
2954 | 5 || 10 || 15
2955 |}
2956 !! result
2957 <table border="1" cellpadding="2">
2958 <caption>Multiplication table
2959 </caption>
2960 <tr>
2961 <th> &#215; </th>
2962 <th> 1 </th>
2963 <th> 2 </th>
2964 <th> 3
2965 </th></tr>
2966 <tr>
2967 <th> 1
2968 </th>
2969 <td> 1 </td>
2970 <td> 2 </td>
2971 <td> 3
2972 </td></tr>
2973 <tr>
2974 <th> 2
2975 </th>
2976 <td> 2 </td>
2977 <td> 4 </td>
2978 <td> 6
2979 </td></tr>
2980 <tr>
2981 <th> 3
2982 </th>
2983 <td> 3 </td>
2984 <td> 6 </td>
2985 <td> 9
2986 </td></tr>
2987 <tr>
2988 <th> 4
2989 </th>
2990 <td> 4 </td>
2991 <td> 8 </td>
2992 <td> 12
2993 </td></tr>
2994 <tr>
2995 <th> 5
2996 </th>
2997 <td> 5 </td>
2998 <td> 10 </td>
2999 <td> 15
3000 </td></tr></table>
3001
3002 !! end
3003
3004 !! test
3005 Accept "||" in table headings
3006 !! input
3007 {|
3008 !h1 || h2
3009 |}
3010 !! result
3011 <table>
3012 <tr>
3013 <th>h1 </th>
3014 <th> h2
3015 </th></tr></table>
3016
3017 !! end
3018
3019 !! test
3020 Accept "||" in indented table headings
3021 !! input
3022 :{|
3023 !h1 || h2
3024 |}
3025 !! result
3026 <dl><dd><table>
3027 <tr>
3028 <th>h1 </th>
3029 <th> h2
3030 </th></tr></table></dd></dl>
3031
3032 !! end
3033
3034 !! test
3035 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3036 !! input
3037 {|
3038 !| h1
3039 || a
3040 |}
3041 !! result
3042 <table>
3043 <tr>
3044 <th> h1
3045 </th>
3046 <td> a
3047 </td></tr></table>
3048
3049 !! end
3050
3051 !!test
3052 Accept "| !" at start of line in tables (ignore !-attribute)
3053 !!input
3054 {|
3055 |-
3056 | !style="color:red" | bar
3057 |}
3058 !!result
3059 <table>
3060
3061 <tr>
3062 <td> bar
3063 </td></tr></table>
3064
3065 !!end
3066
3067 !!test
3068 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3069 !!input
3070 {|
3071 |-
3072 |style='color:red;'|+1
3073 |style='color:blue;'|-1
3074 |-
3075 | 1 || 2 || 3
3076 | 1 ||+2 ||-3
3077 |-
3078 | +1
3079 | -1
3080 |}
3081 !!result
3082 <table>
3083
3084 <tr>
3085 <td style="color:red;">+1
3086 </td>
3087 <td style="color:blue;">-1
3088 </td></tr>
3089 <tr>
3090 <td> 1 </td>
3091 <td> 2 </td>
3092 <td> 3
3093 </td>
3094 <td> 1 </td>
3095 <td>+2 </td>
3096 <td>-3
3097 </td></tr>
3098 <tr>
3099 <td> +1
3100 </td>
3101 <td> -1
3102 </td></tr></table>
3103
3104 !!end
3105
3106 !! test
3107 Table rowspan
3108 !! input
3109 {| border=1
3110 | Cell 1, row 1
3111 |rowspan=2| Cell 2, row 1 (and 2)
3112 | Cell 3, row 1
3113 |-
3114 | Cell 1, row 2
3115 | Cell 3, row 2
3116 |}
3117 !! result
3118 <table border="1">
3119 <tr>
3120 <td> Cell 1, row 1
3121 </td>
3122 <td rowspan="2"> Cell 2, row 1 (and 2)
3123 </td>
3124 <td> Cell 3, row 1
3125 </td></tr>
3126 <tr>
3127 <td> Cell 1, row 2
3128 </td>
3129 <td> Cell 3, row 2
3130 </td></tr></table>
3131
3132 !! end
3133
3134 !! test
3135 Nested table
3136 !! input
3137 {| border=1
3138 | &alpha;
3139 |
3140 {| bgcolor=#ABCDEF border=2
3141 |nested
3142 |-
3143 |table
3144 |}
3145 |the original table again
3146 |}
3147 !! result
3148 <table border="1">
3149 <tr>
3150 <td> &#945;
3151 </td>
3152 <td>
3153 <table bgcolor="#ABCDEF" border="2">
3154 <tr>
3155 <td>nested
3156 </td></tr>
3157 <tr>
3158 <td>table
3159 </td></tr></table>
3160 </td>
3161 <td>the original table again
3162 </td></tr></table>
3163
3164 !! end
3165
3166 !! test
3167 Invalid attributes in table cell (bug 1830)
3168 !! input
3169 {|
3170 |Cell:|broken
3171 |}
3172 !! result
3173 <table>
3174 <tr>
3175 <td>broken
3176 </td></tr></table>
3177
3178 !! end
3179
3180
3181 !! test
3182 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3183 !! input
3184 {|
3185 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3186 !! result
3187 <table>
3188 <tr>
3189 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3190 <td>]" onmouseover="alert(document.cookie)"&gt;test
3191 </td>
3192 </tr>
3193 </table>
3194
3195 !! end
3196
3197
3198 !! test
3199 Indented table markup mixed with indented pre content (proposed in bug 6200)
3200 !! input
3201 <table>
3202 <tr>
3203 <td>
3204 Text that should be rendered preformatted
3205 </td>
3206 </tr>
3207 </table>
3208 !! result
3209 <table>
3210 <tr>
3211 <td>
3212 <pre>Text that should be rendered preformatted
3213 </pre>
3214 </td>
3215 </tr>
3216 </table>
3217
3218 !! end
3219
3220 !! test
3221 Template-generated table cell attributes and cell content
3222 !! input
3223 {|
3224 |{{table_attribs}}
3225 |}
3226 !! result
3227 <table>
3228 <tr>
3229 <td style="color: red"> Foo
3230 </td></tr></table>
3231
3232 !! end
3233
3234 !! test
3235 Table with row followed by newlines and table heading
3236 !! input
3237 {|
3238 |-
3239
3240 ! foo
3241 |}
3242 !! result
3243 <table>
3244
3245
3246 <tr>
3247 <th> foo
3248 </th></tr></table>
3249
3250 !! end
3251
3252 # FIXME: Preserve the attribute properly (with an empty string as value) in
3253 # the PHP parser. Parsoid implements the behavior below.
3254 !! test
3255 Table attributes with empty value
3256 !! options
3257 disabled
3258 !! input
3259 {|
3260 | style=| hello
3261 |}
3262 !! result
3263 <table>
3264 <tr>
3265 <td style=""> hello
3266 </td></tr></table>
3267
3268 !! end
3269
3270 !! test
3271 Wikitext table with a lot of comments
3272 !! input
3273 {|
3274 <!-- c0 -->
3275 | foo
3276 <!-- c1 -->
3277 |- <!-- c2 -->
3278 <!-- c3 -->
3279 |<!-- c4 -->
3280 <!-- c5 -->
3281 |}
3282 !! result
3283 <table>
3284 <tr>
3285 <td> foo
3286 </td></tr>
3287 <tr>
3288 <td>
3289 </td></tr></table>
3290
3291 !! end
3292
3293 ###
3294 ### Internal links
3295 ###
3296 !! test
3297 Plain link, capitalized
3298 !! input
3299 [[Main Page]]
3300 !! result
3301 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3302 </p>
3303 !! end
3304
3305 !! test
3306 Plain link, uncapitalized
3307 !! input
3308 [[main Page]]
3309 !! result
3310 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3311 </p>
3312 !! end
3313
3314 !! test
3315 Piped link
3316 !! input
3317 [[Main Page|The Main Page]]
3318 !! result
3319 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3320 </p>
3321 !! end
3322
3323 !! test
3324 Broken link
3325 !! input
3326 [[Zigzagzogzagzig]]
3327 !! result
3328 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3329 </p>
3330 !! end
3331
3332 !! test
3333 Broken link with fragment
3334 !! input
3335 [[Zigzagzogzagzig#zug]]
3336 !! result
3337 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3338 </p>
3339 !! end
3340
3341 !! test
3342 Special page link with fragment
3343 !! input
3344 [[Special:Version#anchor]]
3345 !! result
3346 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3347 </p>
3348 !! end
3349
3350 !! test
3351 Nonexistent special page link with fragment
3352 !! input
3353 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3354 !! result
3355 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3356 </p>
3357 !! end
3358
3359 !! test
3360 Link with prefix
3361 !! input
3362 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3363 !! result
3364 <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>
3365 </p>
3366 !! end
3367
3368 !! test
3369 Link with suffix
3370 !! input
3371 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3372 !! result
3373 <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>!!!
3374 </p>
3375 !! end
3376
3377 !! article
3378 prefixed article
3379 !! text
3380 Some text
3381 !! endarticle
3382
3383 !! test
3384 Bug 43661: Piped links with identical prefixes
3385 !! input
3386 [[prefixed article|prefixed articles with spaces]]
3387
3388 [[prefixed article|prefixed articlesaoeu]]
3389
3390 [[Main Page|Main Page test]]
3391 !! result
3392 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3393 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3394 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3395 </p>
3396 !! end
3397
3398
3399 !! test
3400 Link with HTML entity in suffix / tail
3401 !! input
3402 [[Main Page]]&quot;, [[Main Page]]&#97;
3403 !! result
3404 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3405 </p>
3406 !! end
3407
3408 !! test
3409 Link with 3 brackets
3410 !! input
3411 [[[main page]]]
3412 !! result
3413 <p>[[[main page]]]
3414 </p>
3415 !! end
3416
3417 !! test
3418 Piped link with 3 brackets
3419 !! input
3420 [[[main page|the main page]]]
3421 !! result
3422 <p>[[[main page|the main page]]]
3423 </p>
3424 !! end
3425
3426 !! test
3427 Link with multiple pipes
3428 !! input
3429 [[Main Page|The|Main|Page]]
3430 !! result
3431 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3432 </p>
3433 !! end
3434
3435 !! test
3436 Link to namespaces
3437 !! input
3438 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3439 !! result
3440 <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>
3441 </p>
3442 !! end
3443
3444 !! test
3445 Piped link to namespace
3446 !! input
3447 [[Meta:Disclaimers|The disclaimers]]
3448 !! result
3449 <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>
3450 </p>
3451 !! end
3452
3453 !! test
3454 Link containing }
3455 !! input
3456 [[Usually caused by a typo (oops}]]
3457 !! result
3458 <p>[[Usually caused by a typo (oops}]]
3459 </p>
3460 !! end
3461
3462 !! test
3463 Link containing % (not as a hex sequence)
3464 !! input
3465 [[7% Solution]]
3466 !! result
3467 <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>
3468 </p>
3469 !! end
3470
3471 !! test
3472 Link containing % as a single hex sequence interpreted to char
3473 !! input
3474 [[7%25 Solution]]
3475 !! result
3476 <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>
3477 </p>
3478 !!end
3479
3480 !! test
3481 Link containing % as a double hex sequence interpreted to hex sequence
3482 !! input
3483 [[7%2525 Solution]]
3484 !! result
3485 <p>[[7%2525 Solution]]
3486 </p>
3487 !!end
3488
3489 !! test
3490 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3491 Example for such a section: == < ==
3492 !! input
3493 [[%23%3c]][[%23%3e]]
3494 !! result
3495 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3496 </p>
3497 !! end
3498
3499 !! test
3500 Link containing "<#" and ">#" as a hex sequences
3501 !! input
3502 [[%3c%23]][[%3e%23]]
3503 !! result
3504 <p>[[%3c%23]][[%3e%23]]
3505 </p>
3506 !! end
3507
3508 !! test
3509 Link containing double-single-quotes '' (bug 4598)
3510 !! input
3511 [[Lista d''e paise d''o munno]]
3512 !! result
3513 <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>
3514 </p>
3515 !! end
3516
3517 !! test
3518 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3519 !! input
3520 Some [[Link|pretty ''italics'' and stuff]]!
3521 !! result
3522 <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>!
3523 </p>
3524 !! end
3525
3526 !! test
3527 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3528 !! input
3529 ''Some [[Link|pretty ''italics'' and stuff]]!
3530 !! result
3531 <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>
3532 </p>
3533 !! end
3534
3535 !! test
3536 Link with double quotes in title part (literal) and alternate part (interpreted)
3537 !! input
3538 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3539
3540 [[''Pentecoste'']]
3541
3542 [[''Pentecoste''|Pentecoste]]
3543
3544 [[''Pentecoste''|''Pentecoste'']]
3545 !! result
3546 <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>
3547 </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>
3548 </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>
3549 </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>
3550 </p>
3551 !! end
3552
3553 !! test
3554 Broken image links with HTML captions (bug 39700)
3555 !! input
3556 [[File:Nonexistent|<script></script>]]
3557 [[File:Nonexistent|100px|<script></script>]]
3558 [[File:Nonexistent|&lt;]]
3559 [[File:Nonexistent|a<i>b</i>c]]
3560 !! result
3561 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3562 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3563 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3564 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3565 </p>
3566 !! end
3567
3568 !! test
3569 Plain link to URL
3570 !! input
3571 [[http://www.example.com]]
3572 !! result
3573 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3574 </p>
3575 !! end
3576
3577 !! test
3578 Plain link to URL with link text
3579 !! input
3580 [[http://www.example.com Link text]]
3581 !! result
3582 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3583 </p>
3584 !! end
3585
3586 !! test
3587 Plain link to protocol-relative URL
3588 !! input
3589 [[//www.example.com]]
3590 !! result
3591 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3592 </p>
3593 !! end
3594
3595 !! test
3596 Plain link to protocol-relative URL with link text
3597 !! input
3598 [[//www.example.com Link text]]
3599 !! result
3600 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3601 </p>
3602 !! end
3603
3604 !! test
3605 Plain link to page with question mark in title
3606 !! input
3607 [[A?b]]
3608
3609 [[A?b|Baz]]
3610 !! result
3611 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3612 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3613 </p>
3614 !! end
3615
3616
3617 # I'm fairly sure the expected result here is wrong.
3618 # We want these to be URL links, not pseudo-pages with URLs for titles....
3619 # However the current output is also pretty screwy.
3620 #
3621 # ----
3622 # I'm changing it to match the current output--it arguably makes more
3623 # sense in the light of the test above. Old expected result was:
3624 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3625 #</p>
3626 # But I think this test is bordering on "garbage in, garbage out" anyway.
3627 # -- wtm
3628 !! test
3629 Piped link to URL
3630 !! input
3631 Piped link to URL: [[http://www.example.com|an example URL]]
3632 !! result
3633 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3634 </p>
3635 !! end
3636
3637 !! test
3638 BUG 2: [[page|http://url/]] should link to page, not http://url/
3639 !! input
3640 [[Main Page|http://url/]]
3641 !! result
3642 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3643 </p>
3644 !! end
3645
3646 !! test
3647 BUG 337: Escaped self-links should be bold
3648 !! options
3649 title=[[Bug462]]
3650 !! input
3651 [[Bu&#103;462]] [[Bug462]]
3652 !! result
3653 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3654 </p>
3655 !! end
3656
3657 !! test
3658 Self-link to section should not be bold
3659 !! options
3660 title=[[Main Page]]
3661 !! input
3662 [[Main Page#section]]
3663 !! result
3664 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3665 </p>
3666 !! end
3667
3668 !! article
3669 00
3670 !! text
3671 This is 00.
3672 !! endarticle
3673
3674 !!test
3675 Self-link to numeric title
3676 !!options
3677 title=[[0]]
3678 !!input
3679 [[0]]
3680 !!result
3681 <p><strong class="selflink">0</strong>
3682 </p>
3683 !!end
3684
3685 !!test
3686 Link to numeric-equivalent title
3687 !!options
3688 title=[[0]]
3689 !!input
3690 [[00]]
3691 !!result
3692 <p><a href="/wiki/00" title="00">00</a>
3693 </p>
3694 !!end
3695
3696 !! test
3697 <nowiki> inside a link
3698 !! input
3699 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3700 !! result
3701 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3702 </p>
3703 !! end
3704
3705 !! test
3706 Non-breaking spaces in title
3707 !! input
3708 [[&nbsp; Main &nbsp; Page &nbsp;]]
3709 !! result
3710 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3711 </p>
3712 !!end
3713
3714 !! test
3715 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3716 !! options
3717 language=ca
3718 !! input
3719 '''[[Main Page]]'''
3720 !! result
3721 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3722 </p>
3723 !! end
3724
3725 !! test
3726 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3727 !! options
3728 language=ca
3729 !! input
3730 ''[[Main Page]]''
3731 !! result
3732 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3733 </p>
3734 !! end
3735
3736 !! test
3737 Internal link with en linktrail: no apostrophes (bug 27473)
3738 !! options
3739 language=en
3740 !! input
3741 [[Something]]'nice
3742 !! result
3743 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3744 </p>
3745 !! end
3746
3747 !! test
3748 Internal link with ca linktrail with apostrophes (bug 27473)
3749 !! options
3750 language=ca
3751 !! input
3752 [[Something]]'nice
3753 !! result
3754 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3755 </p>
3756 !! end
3757
3758 !! test
3759 Internal link with kaa linktrail with apostrophes (bug 27473)
3760 !! options
3761 language=kaa
3762 !! input
3763 [[Something]]'nice
3764 !! result
3765 <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>
3766 </p>
3767 !! end
3768
3769 !! test
3770 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
3771 !! input
3772 [[Foo| bar]]
3773
3774 [[Foo| ''bar'']]
3775
3776 [http://wp.org foo]
3777
3778 [http://wp.org ''foo'']
3779 !! result
3780 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
3781 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
3782 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
3783 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
3784 </p>
3785 !! end
3786
3787 ###
3788 ### Interwiki links (see maintenance/interwiki.sql)
3789 ###
3790
3791 !! test
3792 Inline interwiki link
3793 !! input
3794 [[MeatBall:SoftSecurity]]
3795 !! result
3796 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3797 </p>
3798 !! end
3799
3800 !! test
3801 Inline interwiki link with empty title (bug 2372)
3802 !! input
3803 [[MeatBall:]]
3804 !! result
3805 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3806 </p>
3807 !! end
3808
3809 !! test
3810 Interwiki link encoding conversion (bug 1636)
3811 !! input
3812 *[[Wikipedia:ro:Olteni&#0355;a]]
3813 *[[Wikipedia:ro:Olteni&#355;a]]
3814 !! result
3815 <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>
3816 </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>
3817 </li></ul>
3818
3819 !! end
3820
3821 !! test
3822 Interwiki link with fragment (bug 2130)
3823 !! input
3824 [[MeatBall:SoftSecurity#foo]]
3825 !! result
3826 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3827 </p>
3828 !! end
3829
3830 !! test
3831 Interlanguage link
3832 !! input
3833 Blah blah blah
3834 [[zh:Chinese]]
3835 !!result
3836 <p>Blah blah blah
3837 </p>
3838 !! end
3839
3840 !! test
3841 Double interlanguage link
3842 !! input
3843 Blah blah blah
3844 [[es:Spanish]]
3845 [[zh:Chinese]]
3846 !!result
3847 <p>Blah blah blah
3848 </p>
3849 !! end
3850
3851 !! test
3852 Interlanguage link, with prefix links
3853 !! options
3854 language=ln
3855 !! input
3856 Blah blah blah
3857 [[zh:Chinese]]
3858 !!result
3859 <p>Blah blah blah
3860 </p>
3861 !! end
3862
3863 !! test
3864 Double interlanguage link, with prefix links (bug 8897)
3865 !! options
3866 language=ln
3867 !! input
3868 Blah blah blah
3869 [[es:Spanish]]
3870 [[zh:Chinese]]
3871 !!result
3872 <p>Blah blah blah
3873 </p>
3874 !! end
3875
3876 !! test
3877 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3878 !! options
3879 language=ln
3880 !! input
3881 [[WW&nbsp;II]]
3882 !!result
3883 <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>
3884 </p>
3885 !! end
3886
3887 ##
3888 ## XHTML tidiness
3889 ###
3890
3891 !! test
3892 <br> to <br />
3893 !! input
3894 1<br>2<br />3
3895 !! result
3896 <p>1<br />2<br />3
3897 </p>
3898 !! end
3899
3900 !! test
3901 Broken br tag sanitization
3902 !! input
3903 </br>
3904 !! result
3905 <p>&lt;/br&gt;
3906 </p>
3907 !! end
3908
3909 !! test
3910 Incorrecly removing closing slashes from correctly formed XHTML
3911 !! input
3912 <br style="clear:both;" />
3913 !! result
3914 <p><br style="clear:both;" />
3915 </p>
3916 !! end
3917
3918 !! test
3919 Failing to transform badly formed HTML into correct XHTML
3920 !! input
3921 <br style="clear: left;">
3922 <br style="clear: right;">
3923 <br style="clear: both;">
3924 !! result
3925 <p><br style="clear: left;" />
3926 <br style="clear: right;" />
3927 <br style="clear: both;" />
3928 </p>
3929 !!end
3930
3931 !! test
3932 Handling html with a div self-closing tag
3933 !! input
3934 <div title />
3935 <div title/>
3936 <div title/ >
3937 <div title=bar />
3938 <div title=bar/>
3939 <div title=bar/ >
3940 !! result
3941 <p>&lt;div title /&gt;
3942 &lt;div title/&gt;
3943 </p>
3944 <div>
3945 <p>&lt;div title=bar /&gt;
3946 &lt;div title=bar/&gt;
3947 </p>
3948 <div title="bar/"></div>
3949 </div>
3950
3951 !! end
3952
3953 !! test
3954 Handling html with a br self-closing tag
3955 !! input
3956 <br title />
3957 <br title/>
3958 <br title/ >
3959 <br title=bar />
3960 <br title=bar/>
3961 <br title=bar/ >
3962 !! result
3963 <p><br title="title" />
3964 <br title="title" />
3965 <br />
3966 <br title="bar" />
3967 <br title="bar" />
3968 <br title="bar/" />
3969 </p>
3970 !! end
3971
3972 !! test
3973 Horizontal ruler (should it add that extra space?)
3974 !! input
3975 <hr>
3976 <hr >
3977 foo <hr
3978 > bar
3979 !! result
3980 <hr />
3981 <hr />
3982 foo <hr /> bar
3983
3984 !! end
3985
3986 !! test
3987 Horizontal ruler -- 4+ dashes render hr
3988 !! input
3989 ----
3990 !! result
3991 <hr />
3992
3993 !! end
3994
3995 !! test
3996 Horizontal ruler -- eats additional dashes on the same line
3997 !! input
3998 ---------
3999 !! result
4000 <hr />
4001
4002 !! end
4003
4004 !! test
4005 Horizontal ruler -- does not collaps dashes on consecutive lines
4006 !! input
4007 ----
4008 ----
4009 !! result
4010 <hr />
4011 <hr />
4012
4013 !! end
4014
4015 !! test
4016 Horizontal ruler -- <4 dashes render as plain text
4017 !! input
4018 ---
4019 !! result
4020 <p>---
4021 </p>
4022 !! end
4023
4024 !! test
4025 Horizontal ruler -- Supports content following dashes on same line
4026 !! input
4027 ---- Foo
4028 !! result
4029 <hr /> Foo
4030
4031 !! end
4032
4033 ###
4034 ### Block-level elements
4035 ###
4036 !! test
4037 Common list
4038 !! input
4039 *Common list
4040 * item 2
4041 *item 3
4042 !! result
4043 <ul><li>Common list
4044 </li><li> item 2
4045 </li><li>item 3
4046 </li></ul>
4047
4048 !! end
4049
4050 !! test
4051 Numbered list
4052 !! input
4053 #Numbered list
4054 #item 2
4055 # item 3
4056 !! result
4057 <ol><li>Numbered list
4058 </li><li>item 2
4059 </li><li> item 3
4060 </li></ol>
4061
4062 !! end
4063
4064 !! test
4065 Mixed list
4066 !! input
4067 *Mixed list
4068 *# with numbers
4069 ** and bullets
4070 *# and numbers
4071 *bullets again
4072 **bullet level 2
4073 ***bullet level 3
4074 ***#Number on level 4
4075 **bullet level 2
4076 **#Number on level 3
4077 **#Number on level 3
4078 *#number level 2
4079 *Level 1
4080 *** Level 3
4081 #** Level 3, but ordered
4082 !! result
4083 <ul><li>Mixed list
4084 <ol><li> with numbers
4085 </li></ol>
4086 <ul><li> and bullets
4087 </li></ul>
4088 <ol><li> and numbers
4089 </li></ol>
4090 </li><li>bullets again
4091 <ul><li>bullet level 2
4092 <ul><li>bullet level 3
4093 <ol><li>Number on level 4
4094 </li></ol>
4095 </li></ul>
4096 </li><li>bullet level 2
4097 <ol><li>Number on level 3
4098 </li><li>Number on level 3
4099 </li></ol>
4100 </li></ul>
4101 <ol><li>number level 2
4102 </li></ol>
4103 </li><li>Level 1
4104 <ul><li><ul><li> Level 3
4105 </li></ul>
4106 </li></ul>
4107 </li></ul>
4108 <ol><li><ul><li><ul><li> Level 3, but ordered
4109 </li></ul>
4110 </li></ul>
4111 </li></ol>
4112
4113 !! end
4114
4115 !! test
4116 Nested lists 1
4117 !! input
4118 *foo
4119 **bar
4120 !! result
4121 <ul><li>foo
4122 <ul><li>bar
4123 </li></ul>
4124 </li></ul>
4125
4126 !! end
4127
4128 !! test
4129 Nested lists 2
4130 !! input
4131 **foo
4132 *bar
4133 !! result
4134 <ul><li><ul><li>foo
4135 </li></ul>
4136 </li><li>bar
4137 </li></ul>
4138
4139 !! end
4140
4141 !! test
4142 Nested lists 3 (first element empty)
4143 !! input
4144 *
4145 **bar
4146 !! result
4147 <ul><li>
4148 <ul><li>bar
4149 </li></ul>
4150 </li></ul>
4151
4152 !! end
4153
4154 !! test
4155 Nested lists 4 (first element empty)
4156 !! input
4157 **
4158 *bar
4159 !! result
4160 <ul><li><ul><li>
4161 </li></ul>
4162 </li><li>bar
4163 </li></ul>
4164
4165 !! end
4166
4167 !! test
4168 Nested lists 5 (both elements empty)
4169 !! input
4170 **
4171 *
4172 !! result
4173 <ul><li><ul><li>
4174 </li></ul>
4175 </li><li>
4176 </li></ul>
4177
4178 !! end
4179
4180 !! test
4181 Nested lists 6 (both elements empty)
4182 !! input
4183 *
4184 **
4185 !! result
4186 <ul><li>
4187 <ul><li>
4188 </li></ul>
4189 </li></ul>
4190
4191 !! end
4192
4193 !! test
4194 Nested lists 7 (skip initial nesting levels)
4195 !! input
4196 *** foo
4197 !! result
4198 <ul><li><ul><li><ul><li> foo
4199 </li></ul>
4200 </li></ul>
4201 </li></ul>
4202
4203 !! end
4204
4205 !! test
4206 Nested lists 8 (multiple nesting transitions)
4207 !! input
4208 * foo
4209 *** bar
4210 ** baz
4211 * boo
4212 !! result
4213 <ul><li> foo
4214 <ul><li><ul><li> bar
4215 </li></ul>
4216 </li><li> baz
4217 </li></ul>
4218 </li><li> boo
4219 </li></ul>
4220
4221 !! end
4222
4223 !! test
4224 1. Lists with start-of-line-transparent tokens before bullets: Comments
4225 !! input
4226 *foo
4227 *<!--cmt-->bar
4228 <!--cmt-->*baz
4229 !! result
4230 <ul><li>foo
4231 </li><li>bar
4232 </li><li>baz
4233 </li></ul>
4234
4235 !! end
4236
4237 !! test
4238 2. Lists with start-of-line-transparent tokens before bullets: Template close
4239 !! input
4240 *foo {{echo|bar
4241 }}*baz
4242 !! result
4243 <ul><li>foo bar
4244 </li><li>baz
4245 </li></ul>
4246
4247 !! end
4248
4249 !! test
4250 Unbalanced closing block tags break a list
4251 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4252 !! options
4253 disabled
4254 !! input
4255 <div>
4256 *a</div><div>
4257 *b</div>
4258 !! result
4259 <div>
4260 <ul><li>a
4261 </li></ul></div><div>
4262 <ul><li>b
4263 </li></ul></div>
4264 !! end
4265
4266 !! test
4267 Unbalanced closing non-block tags don't break a list
4268 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4269 !! options
4270 disabled
4271 !! input
4272 <span>
4273 *a</span><span>
4274 *b</span>
4275 !! result
4276 <p><span></span>
4277 </p>
4278 <ul><li>a<span></span>
4279 </li><li>b
4280 </li></ul>
4281 !! end
4282
4283 !! test
4284 Unclosed formatting tags that straddle lists are closed and reopened
4285 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4286 !! options
4287 disabled
4288 !! input
4289 # <s> a
4290 # b </s>
4291 !! result
4292 <ol><li> <s> a </s>
4293 </li><li> <s> b </s>
4294 </li></ol>
4295 !! end
4296
4297 !!test
4298 List embedded in a non-block tag
4299 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4300 !! options
4301 parsoid
4302 !!input
4303 <small>
4304 * foo
4305 </small>
4306 !!result
4307 <p><small></small></p>
4308 <small>
4309 <ul>
4310 <li> foo</li>
4311 </ul>
4312 </small>
4313 <p><small></small></p>
4314 !!end
4315
4316 !! test
4317 List items are not parsed correctly following a <pre> block (bug 785)
4318 !! input
4319 * <pre>foo</pre>
4320 * <pre>bar</pre>
4321 * zar
4322 !! result
4323 <ul><li> <pre>foo</pre>
4324 </li><li> <pre>bar</pre>
4325 </li><li> zar
4326 </li></ul>
4327
4328 !! end
4329
4330 !! test
4331 List items from template
4332 !! input
4333
4334 {{inner list}}
4335 * item 2
4336
4337 * item 0
4338 {{inner list}}
4339 * item 2
4340
4341 * item 0
4342 * notSOL{{inner list}}
4343 * item 2
4344 !! result
4345 <ul><li> item 1
4346 </li><li> item 2
4347 </li></ul>
4348 <ul><li> item 0
4349 </li><li> item 1
4350 </li><li> item 2
4351 </li></ul>
4352 <ul><li> item 0
4353 </li><li> notSOL
4354 </li><li> item 1
4355 </li><li> item 2
4356 </li></ul>
4357
4358 !! end
4359
4360 !! test
4361 List interrupted by empty line or heading
4362 !! input
4363 * foo
4364
4365 ** bar
4366 == A heading ==
4367 * Another list item
4368 !! result
4369 <ul><li> foo
4370 </li></ul>
4371 <ul><li><ul><li> bar
4372 </li></ul>
4373 </li></ul>
4374 <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>
4375 <ul><li> Another list item
4376 </li></ul>
4377
4378 !!end
4379
4380 !!test
4381 Multiple list tags generated by templates
4382 !!input
4383 {{echo|<li>}}a
4384 {{echo|<li>}}b
4385 {{echo|<li>}}c
4386 !!result
4387 <li>a
4388 <li>b
4389 <li>c</li>
4390 </li>
4391 </li>
4392
4393 !!end
4394
4395 ###
4396 ### Magic Words
4397 ###
4398
4399 !! test
4400 Magic Word: {{CURRENTDAY}}
4401 !! input
4402 {{CURRENTDAY}}
4403 !! result
4404 <p>1
4405 </p>
4406 !! end
4407
4408 !! test
4409 Magic Word: {{CURRENTDAY2}}
4410 !! input
4411 {{CURRENTDAY2}}
4412 !! result
4413 <p>01
4414 </p>
4415 !! end
4416
4417 !! test
4418 Magic Word: {{CURRENTDAYNAME}}
4419 !! input
4420 {{CURRENTDAYNAME}}
4421 !! result
4422 <p>Thursday
4423 </p>
4424 !! end
4425
4426 !! test
4427 Magic Word: {{CURRENTDOW}}
4428 !! input
4429 {{CURRENTDOW}}
4430 !! result
4431 <p>4
4432 </p>
4433 !! end
4434
4435 !! test
4436 Magic Word: {{CURRENTMONTH}}
4437 !! input
4438 {{CURRENTMONTH}}
4439 !! result
4440 <p>01
4441 </p>
4442 !! end
4443
4444 !! test
4445 Magic Word: {{CURRENTMONTHABBREV}}
4446 !! input
4447 {{CURRENTMONTHABBREV}}
4448 !! result
4449 <p>Jan
4450 </p>
4451 !! end
4452
4453 !! test
4454 Magic Word: {{CURRENTMONTHNAME}}
4455 !! input
4456 {{CURRENTMONTHNAME}}
4457 !! result
4458 <p>January
4459 </p>
4460 !! end
4461
4462 !! test
4463 Magic Word: {{CURRENTMONTHNAMEGEN}}
4464 !! input
4465 {{CURRENTMONTHNAMEGEN}}
4466 !! result
4467 <p>January
4468 </p>
4469 !! end
4470
4471 !! test
4472 Magic Word: {{CURRENTTIME}}
4473 !! input
4474 {{CURRENTTIME}}
4475 !! result
4476 <p>00:02
4477 </p>
4478 !! end
4479
4480 !! test
4481 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4482 !! input
4483 {{CURRENTWEEK}}
4484 !! result
4485 <p>1
4486 </p>
4487 !! end
4488
4489 !! test
4490 Magic Word: {{CURRENTYEAR}}
4491 !! input
4492 {{CURRENTYEAR}}
4493 !! result
4494 <p>1970
4495 </p>
4496 !! end
4497
4498 !! test
4499 Magic Word: {{FULLPAGENAME}}
4500 !! options
4501 title=[[User:Ævar Arnfjörð Bjarmason]]
4502 !! input
4503 {{FULLPAGENAME}}
4504 !! result
4505 <p>User:Ævar Arnfjörð Bjarmason
4506 </p>
4507 !! end
4508
4509 !! test
4510 Magic Word: {{FULLPAGENAMEE}}
4511 !! options
4512 title=[[User:Ævar Arnfjörð Bjarmason]]
4513 !! input
4514 {{FULLPAGENAMEE}}
4515 !! result
4516 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4517 </p>
4518 !! end
4519
4520 !! test
4521 Magic Word: {{NAMESPACE}}
4522 !! options
4523 title=[[User:Ævar Arnfjörð Bjarmason]]
4524 !! input
4525 {{NAMESPACE}}
4526 !! result
4527 <p>User
4528 </p>
4529 !! end
4530
4531 !! test
4532 Magic Word: {{NAMESPACEE}}
4533 !! options
4534 title=[[User:Ævar Arnfjörð Bjarmason]]
4535 !! input
4536 {{NAMESPACEE}}
4537 !! result
4538 <p>User
4539 </p>
4540 !! end
4541
4542 !! test
4543 Magic Word: {{NAMESPACENUMBER}}
4544 !! options
4545 title=[[User:Ævar Arnfjörð Bjarmason]]
4546 !! input
4547 {{NAMESPACENUMBER}}
4548 !! result
4549 <p>2
4550 </p>
4551 !! end
4552
4553 !! test
4554 Magic Word: {{NUMBEROFFILES}}
4555 !! input
4556 {{NUMBEROFFILES}}
4557 !! result
4558 <p>2
4559 </p>
4560 !! end
4561
4562 !! test
4563 Magic Word: {{PAGENAME}}
4564 !! options
4565 title=[[User:Ævar Arnfjörð Bjarmason]]
4566 !! input
4567 {{PAGENAME}}
4568 !! result
4569 <p>Ævar Arnfjörð Bjarmason
4570 </p>
4571 !! end
4572
4573 !! test
4574 Magic Word: {{PAGENAME}} with metacharacters
4575 !! options
4576 title=[['foo & bar = baz']]
4577 !! input
4578 ''{{PAGENAME}}''
4579 !! result
4580 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4581 </p>
4582 !! end
4583
4584 !! test
4585 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4586 !! options
4587 title=[[*RFC 1234 http://example.com/]]
4588 !! input
4589 {{PAGENAME}}
4590 !! result
4591 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4592 </p>
4593 !! end
4594
4595 !! test
4596 Magic Word: {{PAGENAMEE}}
4597 !! options
4598 title=[[User:Ævar Arnfjörð Bjarmason]]
4599 !! input
4600 {{PAGENAMEE}}
4601 !! result
4602 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4603 </p>
4604 !! end
4605
4606 !! test
4607 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4608 !! options
4609 title=[[*RFC 1234 http://example.com/]]
4610 !! input
4611 {{PAGENAMEE}}
4612 !! result
4613 <p>&#42;RFC_1234_http&#58;//example.com/
4614 </p>
4615 !! end
4616
4617 !! test
4618 Magic Word: {{REVISIONID}}
4619 !! input
4620 {{REVISIONID}}
4621 !! result
4622 <p>1337
4623 </p>
4624 !! end
4625
4626 !! test
4627 Magic Word: {{SCRIPTPATH}}
4628 !! input
4629 {{SCRIPTPATH}}
4630 !! result
4631 <p>/
4632 </p>
4633 !! end
4634
4635 !! test
4636 Magic Word: {{SERVER}}
4637 !! input
4638 {{SERVER}}
4639 !! result
4640 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4641 </p>
4642 !! end
4643
4644 !! test
4645 Magic Word: {{SERVERNAME}}
4646 !! input
4647 {{SERVERNAME}}
4648 !! result
4649 <p>example.org
4650 </p>
4651 !! end
4652
4653 !! test
4654 Magic Word: {{SITENAME}}
4655 !! input
4656 {{SITENAME}}
4657 !! result
4658 <p>MediaWiki
4659 </p>
4660 !! end
4661
4662 !! test
4663 Namespace 1 {{ns:1}}
4664 !! input
4665 {{ns:1}}
4666 !! result
4667 <p>Talk
4668 </p>
4669 !! end
4670
4671 !! test
4672 Namespace 1 {{ns:01}}
4673 !! input
4674 {{ns:01}}
4675 !! result
4676 <p>Talk
4677 </p>
4678 !! end
4679
4680 !! test
4681 Namespace 0 {{ns:0}} (bug 4783)
4682 !! input
4683 {{ns:0}}
4684 !! result
4685
4686 !! end
4687
4688 !! test
4689 Namespace 0 {{ns:00}} (bug 4783)
4690 !! input
4691 {{ns:00}}
4692 !! result
4693
4694 !! end
4695
4696 !! test
4697 Namespace -1 {{ns:-1}}
4698 !! input
4699 {{ns:-1}}
4700 !! result
4701 <p>Special
4702 </p>
4703 !! end
4704
4705 !! test
4706 Namespace User {{ns:User}}
4707 !! input
4708 {{ns:User}}
4709 !! result
4710 <p>User
4711 </p>
4712 !! end
4713
4714 !! test
4715 Namespace User talk {{ns:User_talk}}
4716 !! input
4717 {{ns:User_talk}}
4718 !! result
4719 <p>User talk
4720 </p>
4721 !! end
4722
4723 !! test
4724 Namespace User talk {{ns:uSeR tAlK}}
4725 !! input
4726 {{ns:uSeR tAlK}}
4727 !! result
4728 <p>User talk
4729 </p>
4730 !! end
4731
4732 !! test
4733 Namespace File {{ns:File}}
4734 !! input
4735 {{ns:File}}
4736 !! result
4737 <p>File
4738 </p>
4739 !! end
4740
4741 !! test
4742 Namespace File {{ns:Image}}
4743 !! input
4744 {{ns:Image}}
4745 !! result
4746 <p>File
4747 </p>
4748 !! end
4749
4750 !! test
4751 Namespace (lang=de) Benutzer {{ns:User}}
4752 !! options
4753 language=de
4754 !! input
4755 {{ns:User}}
4756 !! result
4757 <p>Benutzer
4758 </p>
4759 !! end
4760
4761 !! test
4762 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4763 !! options
4764 language=de
4765 !! input
4766 {{ns:3}}
4767 !! result
4768 <p>Benutzer Diskussion
4769 </p>
4770 !! end
4771
4772
4773 !! test
4774 Urlencode
4775 !! input
4776 {{urlencode:hi world?!}}
4777 {{urlencode:hi world?!|WIKI}}
4778 {{urlencode:hi world?!|PATH}}
4779 {{urlencode:hi world?!|QUERY}}
4780 !! result
4781 <p>hi+world%3F%21
4782 hi_world%3F!
4783 hi%20world%3F%21
4784 hi+world%3F%21
4785 </p>
4786 !! end
4787
4788 ###
4789 ### Magic links
4790 ###
4791 !! test
4792 Magic links: internal link to RFC (bug 479)
4793 !! input
4794 [[RFC 123]]
4795 !! result
4796 <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>
4797 </p>
4798 !! end
4799
4800 !! test
4801 Magic links: RFC (bug 479)
4802 !! input
4803 RFC 822
4804 !! result
4805 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4806 </p>
4807 !! end
4808
4809 !! test
4810 Magic links: ISBN (bug 1937)
4811 !! input
4812 ISBN 0-306-40615-2
4813 !! result
4814 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4815 </p>
4816 !! end
4817
4818 !! test
4819 Magic links: PMID incorrectly converts space to underscore
4820 !! input
4821 PMID 1234
4822 !! result
4823 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4824 </p>
4825 !! end
4826
4827 ###
4828 ### Templates
4829 ####
4830
4831 !! test
4832 Nonexistent template
4833 !! input
4834 {{thistemplatedoesnotexist}}
4835 !! result
4836 <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>
4837 </p>
4838 !! end
4839
4840 !! test
4841 Template with invalid target containing tags
4842 !! input
4843 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4844 !! result
4845 <p>{{a<b>b</b>|foo|a=b|a = b}}
4846 </p>
4847 !! end
4848
4849 !! test
4850 Template with invalid target containing unclosed tag
4851 !! input
4852 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4853 !! result
4854 <p>{{a<b>|foo|a=b|a = b}}</b>
4855 </p>
4856 !! end
4857
4858 !! article
4859 Template:test
4860 !! text
4861 This is a test template
4862 !! endarticle
4863
4864 !! test
4865 Simple template
4866 !! input
4867 {{test}}
4868 !! result
4869 <p>This is a test template
4870 </p>
4871 !! end
4872
4873 !! test
4874 Template with explicit namespace
4875 !! input
4876 {{Template:test}}
4877 !! result
4878 <p>This is a test template
4879 </p>
4880 !! end
4881
4882
4883 !! article
4884 Template:paramtest
4885 !! text
4886 This is a test template with parameter {{{param}}}
4887 !! endarticle
4888
4889 !! test
4890 Template parameter
4891 !! input
4892 {{paramtest|param=foo}}
4893 !! result
4894 <p>This is a test template with parameter foo
4895 </p>
4896 !! end
4897
4898 !! article
4899 Template:paramtestnum
4900 !! text
4901 [[{{{1}}}|{{{2}}}]]
4902 !! endarticle
4903
4904 !! test
4905 Template unnamed parameter
4906 !! input
4907 {{paramtestnum|Main Page|the main page}}
4908 !! result
4909 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4910 </p>
4911 !! end
4912
4913 !! article
4914 Template:templatesimple
4915 !! text
4916 (test)
4917 !! endarticle
4918
4919 !! article
4920 Template:templateredirect
4921 !! text
4922 #redirect [[Template:templatesimple]]
4923 !! endarticle
4924
4925 !! article
4926 Template:templateasargtestnum
4927 !! text
4928 {{{{{1}}}}}
4929 !! endarticle
4930
4931 !! article
4932 Template:templateasargtest
4933 !! text
4934 {{template{{{templ}}}}}
4935 !! endarticle
4936
4937 !! article
4938 Template:templateasargtest2
4939 !! text
4940 {{{{{templ}}}}}
4941 !! endarticle
4942
4943 !! test
4944 Template with template name as unnamed argument
4945 !! input
4946 {{templateasargtestnum|templatesimple}}
4947 !! result
4948 <p>(test)
4949 </p>
4950 !! end
4951
4952 !! test
4953 Template with template name as argument
4954 !! input
4955 {{templateasargtest|templ=simple}}
4956 !! result
4957 <p>(test)
4958 </p>
4959 !! end
4960
4961 !! test
4962 Template with template name as argument (2)
4963 !! input
4964 {{templateasargtest2|templ=templatesimple}}
4965 !! result
4966 <p>(test)
4967 </p>
4968 !! end
4969
4970 !! article
4971 Template:templateasargtestdefault
4972 !! text
4973 {{{{{templ|templatesimple}}}}}
4974 !! endarticle
4975
4976 !! article
4977 Template:templa
4978 !! text
4979 '''templ'''
4980 !! endarticle
4981
4982 !! test
4983 Template with default value
4984 !! input
4985 {{templateasargtestdefault}}
4986 !! result
4987 <p>(test)
4988 </p>
4989 !! end
4990
4991 !! test
4992 Template with default value (value set)
4993 !! input
4994 {{templateasargtestdefault|templ=templa}}
4995 !! result
4996 <p><b>templ</b>
4997 </p>
4998 !! end
4999
5000 !! test
5001 Template redirect
5002 !! input
5003 {{templateredirect}}
5004 !! result
5005 <p>(test)
5006 </p>
5007 !! end
5008
5009 !! test
5010 Template with argument in separate line
5011 !! input
5012 {{ templateasargtest |
5013 templ = simple }}
5014 !! result
5015 <p>(test)
5016 </p>
5017 !! end
5018
5019 !! test
5020 Template with complex template as argument
5021 !! input
5022 {{paramtest|
5023 param ={{ templateasargtest |
5024 templ = simple }}}}
5025 !! result
5026 <p>This is a test template with parameter (test)
5027 </p>
5028 !! end
5029
5030 !! test
5031 Template with thumb image (with link in description)
5032 !! input
5033 {{paramtest|
5034 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5035 !! result
5036 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>
5037
5038 !! end
5039
5040 !! article
5041 Template:complextemplate
5042 !! text
5043 {{{1}}} {{paramtest|
5044 param ={{{param}}}}}
5045 !! endarticle
5046
5047 !! test
5048 Template with complex arguments
5049 !! input
5050 {{complextemplate|
5051 param ={{ templateasargtest |
5052 templ = simple }}|[[Template:complextemplate|link]]}}
5053 !! result
5054 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5055 </p>
5056 !! end
5057
5058 !! test
5059 BUG 553: link with two variables in a piped link
5060 !! input
5061 {|
5062 |[[{{{1}}}|{{{2}}}]]
5063 |}
5064 !! result
5065 <table>
5066 <tr>
5067 <td>[[{{{1}}}|{{{2}}}]]
5068 </td></tr></table>
5069
5070 !! end
5071
5072 !! test
5073 Magic variable as template parameter
5074 !! input
5075 {{paramtest|param={{SITENAME}}}}
5076 !! result
5077 <p>This is a test template with parameter MediaWiki
5078 </p>
5079 !! end
5080
5081 !! article
5082 Template:linktest
5083 !! text
5084 [[{{{param}}}|link]]
5085 !! endarticle
5086
5087 !! test
5088 Template parameter as link source
5089 !! input
5090 {{linktest|param=Main Page}}
5091 !! result
5092 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5093 </p>
5094 !! end
5095
5096 !!test
5097 Template-generated attribute string (k='v')
5098 !!input
5099 <span {{attr_str|id|v1}}>bar</span>
5100 !!result
5101 <p><span id="v1">bar</span>
5102 </p>
5103 !!end
5104
5105 !!article
5106 Template:paramtest2
5107 !! text
5108 including another template, {{paramtest|param={{{arg}}}}}
5109 !! endarticle
5110
5111 !! test
5112 Template passing argument to another template
5113 !! input
5114 {{paramtest2|arg='hmm'}}
5115 !! result
5116 <p>including another template, This is a test template with parameter 'hmm'
5117 </p>
5118 !! end
5119
5120 !! article
5121 Template:Linktest2
5122 !! text
5123 Main Page
5124 !! endarticle
5125
5126 !! test
5127 Template as link source
5128 !! input
5129 [[{{linktest2}}]]
5130
5131 [[{{linktest2}}|Main Page]]
5132
5133 [[{{linktest2}}]]Page
5134 !! result
5135 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5136 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5137 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5138 </p>
5139 !! end
5140
5141
5142 !! article
5143 Template:loop1
5144 !! text
5145 {{loop2}}
5146 !! endarticle
5147
5148 !! article
5149 Template:loop2
5150 !! text
5151 {{loop1}}
5152 !! endarticle
5153
5154 !! test
5155 Template infinite loop
5156 !! input
5157 {{loop1}}
5158 !! result
5159 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5160 </p>
5161 !! end
5162
5163 !! test
5164 Template from main namespace
5165 !! input
5166 {{:Main Page}}
5167 !! result
5168 <p>blah blah
5169 </p>
5170 !! end
5171
5172 !! article
5173 Template:table
5174 !! text
5175 {|
5176 | 1 || 2
5177 |-
5178 | 3 || 4
5179 |}
5180 !! endarticle
5181
5182 !! test
5183 BUG 529: Template with table, not included at beginning of line
5184 !! input
5185 foo {{table}}
5186 !! result
5187 <p>foo
5188 </p>
5189 <table>
5190 <tr>
5191 <td> 1 </td>
5192 <td> 2
5193 </td></tr>
5194 <tr>
5195 <td> 3 </td>
5196 <td> 4
5197 </td></tr></table>
5198
5199 !! end
5200
5201 !! test
5202 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5203 !! input
5204 foo
5205 {{table}}
5206 !! result
5207 <p>foo
5208 </p>
5209 <table>
5210 <tr>
5211 <td> 1 </td>
5212 <td> 2
5213 </td></tr>
5214 <tr>
5215 <td> 3 </td>
5216 <td> 4
5217 </td></tr></table>
5218
5219 !! end
5220
5221 !! test
5222 BUG 41: Template parameters shown as broken links
5223 !! input
5224 {{{parameter}}}
5225 !! result
5226 <p>{{{parameter}}}
5227 </p>
5228 !! end
5229
5230 !! test
5231 Template with targets containing wikilinks
5232 !! input
5233 {{[[foo]]}}
5234
5235 {{[[{{echo|foo}}]]}}
5236
5237 {{{{echo|[[foo}}]]}}
5238 !! result
5239 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5240 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5241 </p><p>{{[[foo}}]]
5242 </p>
5243 !! end
5244
5245 !! article
5246 Template:MSGNW test
5247 !! text
5248 ''None'' of '''this''' should be
5249 * interpreted
5250 but rather passed unmodified
5251 {{test}}
5252 !! endarticle
5253
5254 # hmm, fix this or just deprecate msgnw and document its behavior?
5255 !! test
5256 msgnw keyword
5257 !! options
5258 disabled
5259 !! input
5260 {{msgnw:MSGNW test}}
5261 !! result
5262 <p>''None'' of '''this''' should be
5263 * interpreted
5264 but rather passed unmodified
5265 {{test}}
5266 </p>
5267 !! end
5268
5269 !! test
5270 int keyword
5271 !! input
5272 {{int:youhavenewmessages|lots of money|not!}}
5273 !! result
5274 <p>You have lots of money (not!).
5275 </p>
5276 !! end
5277
5278 !! article
5279 Template:Includes
5280 !! text
5281 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5282 !! endarticle
5283
5284 !! test
5285 <includeonly> and <noinclude> being included
5286 !! input
5287 {{Includes}}
5288 !! result
5289 <p>Foobar
5290 </p>
5291 !! end
5292
5293 !! article
5294 Template:Includes2
5295 !! text
5296 <onlyinclude>Foo</onlyinclude>bar
5297 !! endarticle
5298
5299 !! test
5300 <onlyinclude> being included
5301 !! input
5302 {{Includes2}}
5303 !! result
5304 <p>Foo
5305 </p>
5306 !! end
5307
5308
5309 !! article
5310 Template:Includes3
5311 !! text
5312 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5313 !! endarticle
5314
5315 !! test
5316 <onlyinclude> and <includeonly> being included
5317 !! input
5318 {{Includes3}}
5319 !! result
5320 <p>Foo
5321 </p>
5322 !! end
5323
5324 !! test
5325 <includeonly> and <noinclude> on a page
5326 !! input
5327 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5328 !! result
5329 <p>Foozar
5330 </p>
5331 !! end
5332
5333 !! test
5334 Un-closed <noinclude>
5335 !! input
5336 <noinclude>
5337 !! result
5338 !! end
5339
5340 !! test
5341 <onlyinclude> on a page
5342 !! input
5343 <onlyinclude>Foo</onlyinclude>bar
5344 !! result
5345 <p>Foobar
5346 </p>
5347 !! end
5348
5349 !! test
5350 Un-closed <onlyinclude>
5351 !! input
5352 <onlyinclude>
5353 !! result
5354 !! end
5355
5356 !!test
5357 Self-closed noinclude, includeonly, onlyinclude tags
5358 !!input
5359 <noinclude />
5360 <includeonly />
5361 <onlyinclude />
5362 !!result
5363 <p><br />
5364 </p>
5365 !!end
5366
5367 !!test
5368 Unbalanced includeonly and noinclude tags
5369 !!input
5370 {|
5371 |a</noinclude>
5372 |b</noinclude></noinclude>
5373 |c</noinclude></includeonly>
5374 |d</includeonly></includeonly>
5375 |}
5376 !!result
5377 <table>
5378 <tr>
5379 <td>a
5380 </td>
5381 <td>b
5382 </td>
5383 <td>c&lt;/includeonly&gt;
5384 </td>
5385 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5386 </td></tr></table>
5387
5388 !!end
5389
5390 !! article
5391 Template:Includeonly section
5392 !! text
5393 <includeonly>
5394 ==Includeonly section==
5395 </includeonly>
5396 ==Section T-1==
5397 !!endarticle
5398
5399 !! test
5400 Bug 6563: Edit link generation for section shown by <includeonly>
5401 !! input
5402 {{includeonly section}}
5403 !! result
5404 <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>
5405 <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>
5406
5407 !! end
5408
5409 # Uses same input as the contents of [[Template:Includeonly section]]
5410 !! test
5411 Bug 6563: Section extraction for section shown by <includeonly>
5412 !! options
5413 section=T-2
5414 !! input
5415 <includeonly>
5416 ==Includeonly section==
5417 </includeonly>
5418 ==Section T-2==
5419 !! result
5420 ==Section T-2==
5421 !! end
5422
5423 !! test
5424 Bug 6563: Edit link generation for section suppressed by <includeonly>
5425 !! input
5426 <includeonly>
5427 ==Includeonly section==
5428 </includeonly>
5429 ==Section 1==
5430 !! result
5431 <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>
5432
5433 !! end
5434
5435 !! test
5436 Bug 6563: Section extraction for section suppressed by <includeonly>
5437 !! options
5438 section=1
5439 !! input
5440 <includeonly>
5441 ==Includeonly section==
5442 </includeonly>
5443 ==Section 1==
5444 !! result
5445 ==Section 1==
5446 !! end
5447
5448 !! test
5449 Un-closed <includeonly>
5450 !! input
5451 <includeonly>
5452 !! result
5453 !! end
5454
5455 ###
5456 ### <includeonly> and <noinclude> in attributes
5457 ###
5458 !!test
5459 0. includeonly around the entire attribute
5460 !!input
5461 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5462 !!result
5463 <p><span id="v2">bar</span>
5464 </p>
5465 !!end
5466
5467 !!test
5468 1. includeonly in html attr key
5469 !!input
5470 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5471 !!result
5472 <p><span id="foo">bar</span>
5473 </p>
5474 !!end
5475
5476 !!test
5477 2. includeonly in html attr value
5478 !!input
5479 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5480 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5481 !!result
5482 <p><span id="v1">bar</span>
5483 <span id="v1">bar</span>
5484 </p>
5485 !!end
5486
5487 !!test
5488 3. includeonly in part of an attr value
5489 !!input
5490 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5491 !!result
5492 <p><span style="color:red;">bar</span>
5493 </p>
5494 !!end
5495
5496 ###
5497 ### Testing parsing of templates where a template arg
5498 ### has the same name as the template itself.
5499 ###
5500
5501 !! article
5502 Template:quote
5503 !! text
5504 {{{quote|{{{1}}}}}}
5505 !! endarticle
5506
5507 !!test
5508 Templates: Template Name/Arg clash: 1. Use of positional param
5509 !!input
5510 {{quote|foo}}
5511 !!result
5512 <p>foo
5513 </p>
5514 !!end
5515
5516 !!test
5517 Templates: Template Name/Arg clash: 2. Use of named param
5518 !!input
5519 {{quote|quote=foo}}
5520 !!result
5521 <p>foo
5522 </p>
5523 !!end
5524
5525 !!test
5526 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5527 !!input
5528 {{quote|quote}}
5529 !!result
5530 <p>quote
5531 </p>
5532 !!end
5533
5534 ###
5535 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5536 ###
5537
5538 !!test
5539 Templates: 1. Simple use
5540 !!input
5541 {{echo|Foo}}
5542 !!result
5543 <p>Foo
5544 </p>
5545 !!end
5546
5547 !!test
5548 Templates: 2. Inside a block tag
5549 !!input
5550 <div>{{echo|Foo}}</div>
5551 !!result
5552 <div>Foo</div>
5553
5554 !!end
5555
5556 !!test
5557 Templates: P-wrapping: 1a. Templates on consecutive lines
5558 !!input
5559 {{echo|Foo}}
5560 {{echo|bar}}
5561 !!result
5562 <p>Foo
5563 bar
5564 </p>
5565 !!end
5566
5567 !!test
5568 Templates: P-wrapping: 1b. Templates on consecutive lines
5569 !!input
5570 Foo
5571
5572 {{echo|bar}}
5573 {{echo|baz}}
5574 !!result
5575 <p>Foo
5576 </p><p>bar
5577 baz
5578 </p>
5579 !!end
5580
5581 !!test
5582 Templates: P-wrapping: 1c. Templates on consecutive lines
5583 !!input
5584 {{echo|Foo}}
5585 {{echo|bar}} <div>baz</div>
5586 !!result
5587 <p>Foo
5588 </p>
5589 bar <div>baz</div>
5590
5591 !!end
5592
5593 !!test
5594 Templates: Inline Text: 1. Multiple tmeplate uses
5595 !!input
5596 {{echo|Foo}}bar{{echo|baz}}
5597 !!result
5598 <p>Foobarbaz
5599 </p>
5600 !!end
5601
5602 !!test
5603 Templates: Inline Text: 2. Back-to-back template uses
5604 !!input
5605 {{echo|Foo}}{{echo|bar}}
5606 !!result
5607 <p>Foobar
5608 </p>
5609 !!end
5610
5611 !!test
5612 Templates: Block Tags: 1. Multiple template uses
5613 !!input
5614 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5615 !!result
5616 <div>Foo</div><div>bar</div><div>baz</div>
5617
5618 !!end
5619
5620 !!test
5621 Templates: Block Tags: 2. Back-to-back template uses
5622 !!input
5623 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5624 !!result
5625 <div>Foo</div><div>bar</div>
5626
5627 !!end
5628
5629 !!test
5630 Templates: Links: 1. Simple example
5631 !!input
5632 {{echo|[[Foo|bar]]}}
5633 !!result
5634 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5635 </p>
5636 !!end
5637
5638 !!test
5639 Templates: Links: 2. Generation of link href
5640 !!input
5641 [[{{echo|Foo}}|bar]]
5642 !!result
5643 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5644 </p>
5645 !!end
5646
5647 !!test
5648 Templates: Links: 3. Generation of part of a link href
5649 !!input
5650 [[Fo{{echo|o}}|bar]]
5651
5652 [[Foo{{echo|bar}}]]
5653
5654 [[Foo{{echo|bar}}baz]]
5655
5656 [[Foo{{echo|bar}}|bar]]
5657
5658 [[:Foo{{echo|bar}}]]
5659
5660 [[:Foo{{echo|bar}}|bar]]
5661 !!result
5662 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5663 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5664 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5665 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5666 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5667 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5668 </p>
5669 !!end
5670
5671 !!test
5672 Templates: Links: 4. Multiple templates generating link href
5673 !!input
5674 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5675 !!result
5676 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5677 </p>
5678 !!end
5679
5680 !!test
5681 Templates: Links: 5. Generation of link text
5682 !!input
5683 [[Foo|{{echo|bar}}]]
5684 !!result
5685 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5686 </p>
5687 !!end
5688
5689 !!test
5690 Templates: Links: 5. Nested templates (only outermost template should be marked)
5691 !!input
5692 {{echo|[[{{echo|Foo}}|bar]]}}
5693 !!result
5694 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5695 </p>
5696 !!end
5697
5698 !!test
5699 Templates: HTML Tag: 1. Generation of HTML attr. key
5700 !!input
5701 <div {{echo|style}}="color:red;">foo</div>
5702 !!result
5703 <div style="color:red;">foo</div>
5704
5705 !!end
5706
5707 !!test
5708 Templates: HTML Tag: 2. Generation of HTML attr. value
5709 !!input
5710 <div style={{echo|'color:red;'}}>foo</div>
5711 !!result
5712 <div style="color:red;">foo</div>
5713
5714 !!end
5715
5716 !!test
5717 Templates: HTML Tag: 3. Generation of HTML attr key and value
5718 !!input
5719 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5720 !!result
5721 <div style="color:red;">foo</div>
5722
5723 !!end
5724
5725 !!test
5726 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5727 !!input
5728 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5729 !!result
5730 <div title="This is a long title with just one piece templated">foo</div>
5731
5732 !!end
5733
5734 !!test
5735 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5736 !!input
5737 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5738 !!result
5739 <div title="This is a long title with just one piece templated">foo</div>
5740
5741 !!end
5742
5743 !!test
5744 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5745 !!input
5746 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
5747 !!result
5748 <div title="This is a long title with just one piece templated">foo</div>
5749
5750 !!end
5751
5752 !!test
5753 Templates: HTML Tables: 1. Generating start of a HTML table
5754 !!input
5755 {{echo|<table><tr><td>foo</td>}}</tr></table>
5756 !!result
5757 <table><tr><td>foo</td></tr></table>
5758
5759 !!end
5760
5761 !!test
5762 Templates: HTML Tables: 2a. Generating middle of a HTML table
5763 !!input
5764 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5765 !!result
5766 <table><tr><td>foo</td></tr></table>
5767
5768 !!end
5769
5770 !!test
5771 Templates: HTML Tables: 2b. Generating middle of a HTML table
5772 !!input
5773 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5774 !!result
5775 <table><tr><td>foo</td></tr></table>
5776
5777 !!end
5778
5779 !!test
5780 Templates: HTML Tables: 3. Generating end of a HTML table
5781 !!input
5782 <table><tr>{{echo|<td>foo</td></tr></table>}}
5783 !!result
5784 <table><tr><td>foo</td></tr></table>
5785
5786 !!end
5787
5788 !!test
5789 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5790 !!input
5791 {{echo|<table>}}<tr><td>foo</td></tr></table>
5792 !!result
5793 <table><tr><td>foo</td></tr></table>
5794
5795 !!end
5796
5797 !!test
5798 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5799 !!input
5800 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5801 !!result
5802 <table><tr><td>foo</td></tr></table>
5803
5804 !!end
5805
5806 !!test
5807 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5808 !!input
5809 <table><tr>{{echo|<td>}}foo</td></tr></table>
5810 !!result
5811 <table><tr><td>foo</td></tr></table>
5812
5813 !!end
5814
5815 !!test
5816 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5817 !!input
5818 <table><tr><td>foo{{echo|</td>}}</tr></table>
5819 !!result
5820 <table><tr><td>foo</td></tr></table>
5821
5822 !!end
5823
5824 !!test
5825 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5826 !!input
5827 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5828 !!result
5829 <table><tr><td>foo</td></tr></table>
5830
5831 !!end
5832
5833 !!test
5834 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5835 !!input
5836 <table><tr><td>foo</td></tr>{{echo|</table>}}
5837 !!result
5838 <table><tr><td>foo</td></tr></table>
5839
5840 !!end
5841
5842 !!test
5843 Templates: Wiki Tables: 1a. Fostering of entire template content
5844 !!input
5845 {|
5846 {{echo|a}}
5847 |}
5848 !!result
5849 <table>
5850 a
5851 <tr><td></td></tr></table>
5852
5853 !!end
5854
5855 !!test
5856 Templates: Wiki Tables: 1b. Fostering of entire template content
5857 !!input
5858 {|
5859 {{echo|<div>}}
5860 foo
5861 {{echo|</div>}}
5862 |}
5863 !!result
5864 <table>
5865 <div>
5866 <p>foo
5867 </p>
5868 </div>
5869 <tr><td></td></tr></table>
5870
5871 !!end
5872
5873 !!test
5874 Templates: Wiki Tables: 2. Fostering of partial template content
5875 !!input
5876 {|
5877 {{echo|a
5878 <div>b</div>}}
5879 |}
5880 !!result
5881 <table>
5882 a
5883 <div>b</div>
5884 <tr><td></td></tr></table>
5885
5886 !!end
5887
5888 !!test
5889 Templates: Wiki Tables: 3. td-content via multiple templates
5890 !!input
5891 {|
5892 {{echo|{{pipe}}a}}{{echo|b}}
5893 |}
5894 !!result
5895 <table>
5896 <tr>
5897 <td>ab
5898 </td></tr></table>
5899
5900 !!end
5901
5902 !!test
5903 Templates: Wiki Tables: 4. Templated tags, no content
5904 !!input
5905 {{tbl-start}}
5906 {{tbl-end}}
5907 !!result
5908 <table>
5909 <tr><td></td></tr></table>
5910
5911 !!end
5912
5913 !!test
5914 Templates: Wiki Tables: 5. Templated tags, regular td-tags
5915 !!input
5916 {{tbl-start}}
5917 |foo
5918 {{tbl-end}}
5919 !!result
5920 <table>
5921 <tr>
5922 <td>foo
5923 </td></tr></table>
5924
5925 !!end
5926
5927 !!test
5928 Templates: Wiki Tables: 6. Templated tags, templated td-tags
5929 !!input
5930 {{tbl-start}}
5931 {{!}}foo
5932 {{tbl-end}}
5933 !!result
5934 <table>
5935 <tr>
5936 <td>foo
5937 </td></tr></table>
5938
5939 !!end
5940
5941 !!test
5942 Templates: Lists: Multi-line list-items via templates
5943 !!input
5944 *{{echo|a {{nonexistent|
5945 unused}}}}
5946 *{{echo|b {{nonexistent|
5947 unused}}}}
5948 !!result
5949 <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>
5950 </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>
5951 </li></ul>
5952
5953 !!end
5954
5955 !!test
5956 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5957 !!input
5958 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5959 !!result
5960 <p><i>ab</i>c<i>d</i>e
5961 </p>
5962 !!end
5963
5964 !!test
5965 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5966 (PHP parser generates misnested html)
5967 !! options
5968 disabled
5969 !!input
5970 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5971 !!result
5972 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5973 !!end
5974
5975 !!test
5976 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5977 (PHP parser generates misnested html)
5978 !! options
5979 disabled
5980 !!input
5981 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5982 !!result
5983 <div><i>a</i></div>
5984 <div><i>b</i>c<i>d</i></div>
5985 <div>e</div>
5986 !!end
5987
5988 !!test
5989 Templates: Ugly nesting: 4. Divs opened/closed across templates
5990 !!input
5991 a<div>b{{echo|c</div>d}}e
5992 !!result
5993 a<div>bc</div>de
5994
5995 !!end
5996
5997 !!test
5998 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5999 (Parsoid-centric)
6000 !! options
6001 parsoid
6002 !!input
6003 {|
6004 |{{echo|foo</table>}}
6005 |bar
6006 |}
6007 !!result
6008 <table about="#mwt1" typeof="mw:Object/Template ">
6009 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6010 bar</span><span about="#mwt1">
6011 </span>
6012 !!end
6013
6014 !!test
6015 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6016 (Parsoid-centric)
6017 !! options
6018 parsoid
6019 !!input
6020 <table>
6021 <tr>
6022 <td>
6023 <table>
6024 <tr>
6025 <td>1. {{echo|foo </table>}}</td>
6026 <td> bar </td>
6027 <td>2. {{echo|baz </table>}}</td>
6028 </tr>
6029 <tr>
6030 <td>abc</td>
6031 </tr>
6032 </table>
6033 </td>
6034 </tr>
6035 <tr>
6036 <td>xyz</td>
6037 </tr>
6038 </table>
6039 !!result
6040 <table about="#mwt1" typeof="mw:Object/Template">
6041 <tbody><tr >
6042 <td >
6043 <table >
6044 <tbody><tr >
6045 <td >1. foo </td></tr></tbody></table></td>
6046 <td > bar </td>
6047 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6048 </span><span about="#mwt1">
6049
6050 abc</span><span about="#mwt1">
6051 </span><span about="#mwt1">
6052 </span><span about="#mwt1">
6053 </span><span about="#mwt1">
6054 </span><span about="#mwt1">
6055
6056 xyz</span><span about="#mwt1">
6057 </span><span about="#mwt1">
6058 </span>
6059 !!end
6060
6061 !! test
6062 Templates: Ugly templates: 3. newline-only template parameter
6063 !! input
6064 foo {{echo|
6065 }}
6066 !! result
6067 <p>foo
6068 </p>
6069 !! end
6070
6071 # This looks like a bug: a single newline triggers p/br for some reason.
6072 !! test
6073 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6074 !! input
6075 {{echo|
6076 }}
6077 !! result
6078 <p><br />
6079 </p>
6080 !! end
6081
6082
6083 !!test
6084 Parser Functions: 1. Simple example
6085 !!input
6086 {{uc:foo}}
6087 !!result
6088 <p>FOO
6089 </p>
6090 !!end
6091
6092 !!test
6093 Parser Functions: 2. Nested use (only outermost should be marked up)
6094 !!input
6095 {{uc:{{lc:FOO}}}}
6096 !!result
6097 <p>FOO
6098 </p>
6099 !!end
6100
6101 ###
6102 ### Pre-save transform tests
6103 ###
6104 !! test
6105 pre-save transform: subst:
6106 !! options
6107 PST
6108 !! input
6109 {{subst:test}}
6110 !! result
6111 This is a test template
6112 !! end
6113
6114 !! test
6115 pre-save transform: normal template
6116 !! options
6117 PST
6118 !! input
6119 {{test}}
6120 !! result
6121 {{test}}
6122 !! end
6123
6124 !! test
6125 pre-save transform: nonexistent template
6126 !! options
6127 PST
6128 !! input
6129 {{thistemplatedoesnotexist}}
6130 !! result
6131 {{thistemplatedoesnotexist}}
6132 !! end
6133
6134
6135 !! test
6136 pre-save transform: subst magic variables
6137 !! options
6138 PST
6139 !! input
6140 {{subst:SITENAME}}
6141 !! result
6142 MediaWiki
6143 !! end
6144
6145 # This is bug 89, which I fixed. -- wtm
6146 !! test
6147 pre-save transform: subst: templates with parameters
6148 !! options
6149 pst
6150 !! input
6151 {{subst:paramtest|param="something else"}}
6152 !! result
6153 This is a test template with parameter "something else"
6154 !! end
6155
6156 !! article
6157 Template:nowikitest
6158 !! text
6159 <nowiki>'''not wiki'''</nowiki>
6160 !! endarticle
6161
6162 !! test
6163 pre-save transform: nowiki in subst (bug 1188)
6164 !! options
6165 pst
6166 !! input
6167 {{subst:nowikitest}}
6168 !! result
6169 <nowiki>'''not wiki'''</nowiki>
6170 !! end
6171
6172
6173 !! article
6174 Template:commenttest
6175 !! text
6176 This template has <!-- a comment --> in it.
6177 !! endarticle
6178
6179 !! test
6180 pre-save transform: comment in subst (bug 1936)
6181 !! options
6182 pst
6183 !! input
6184 {{subst:commenttest}}
6185 !! result
6186 This template has <!-- a comment --> in it.
6187 !! end
6188
6189 !! test
6190 pre-save transform: unclosed tag
6191 !! options
6192 pst noxml
6193 !! input
6194 <nowiki>'''not wiki'''
6195 !! result
6196 <nowiki>'''not wiki'''
6197 !! end
6198
6199 !! test
6200 pre-save transform: mixed tag case
6201 !! options
6202 pst noxml
6203 !! input
6204 <NOwiki>'''not wiki'''</noWIKI>
6205 !! result
6206 <NOwiki>'''not wiki'''</noWIKI>
6207 !! end
6208
6209 !! test
6210 pre-save transform: unclosed comment in <nowiki>
6211 !! options
6212 pst noxml
6213 !! input
6214 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6215 !! result
6216 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6217 !!end
6218
6219 !! article
6220 Template:dangerous
6221 !!text
6222 <span onmouseover="alert('crap')">Oh no</span>
6223 !!endarticle
6224
6225 !!test
6226 (confirming safety of fix for subst bug 1936)
6227 !! input
6228 {{Template:dangerous}}
6229 !! result
6230 <p><span>Oh no</span>
6231 </p>
6232 !! end
6233
6234 !! test
6235 pre-save transform: comment containing gallery (bug 5024)
6236 !! options
6237 pst
6238 !! input
6239 <!-- <gallery>data</gallery> -->
6240 !!result
6241 <!-- <gallery>data</gallery> -->
6242 !!end
6243
6244 !! test
6245 pre-save transform: comment containing extension
6246 !! options
6247 pst
6248 !! input
6249 <!-- <tag>data</tag> -->
6250 !!result
6251 <!-- <tag>data</tag> -->
6252 !!end
6253
6254 !! test
6255 pre-save transform: comment containing nowiki
6256 !! options
6257 pst
6258 !! input
6259 <!-- <nowiki>data</nowiki> -->
6260 !!result
6261 <!-- <nowiki>data</nowiki> -->
6262 !!end
6263
6264 !! test
6265 pre-save transform: <noinclude> in subst (bug 3298)
6266 !! options
6267 pst
6268 !! input
6269 {{subst:Includes}}
6270 !! result
6271 Foobar
6272 !! end
6273
6274 !! test
6275 pre-save transform: <onlyinclude> in subst (bug 3298)
6276 !! options
6277 pst
6278 !! input
6279 {{subst:Includes2}}
6280 !! result
6281 Foo
6282 !! end
6283
6284 !! article
6285 Template:SubstTest
6286 !!text
6287 {{<includeonly>subst:</includeonly>Includes}}
6288 !! endarticle
6289
6290 !! article
6291 Template:SafeSubstTest
6292 !! text
6293 {{<includeonly>safesubst:</includeonly>Includes}}
6294 !! endarticle
6295
6296 !! test
6297 bug 22297: safesubst: works during PST
6298 !! options
6299 pst
6300 !! input
6301 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6302 !! result
6303 FoobarFoobar
6304 !! end
6305
6306 !! test
6307 bug 22297: safesubst: works during normal parse
6308 !! input
6309 {{SafeSubstTest}}
6310 !! result
6311 <p>Foobar
6312 </p>
6313 !! end
6314
6315 !! test:
6316 subst: does not work during normal parse
6317 !! input
6318 {{SubstTest}}
6319 !! result
6320 <p>{{subst:Includes}}
6321 </p>
6322 !! end
6323
6324 !! test
6325 pre-save transform: context links ("pipe trick")
6326 !! options
6327 pst
6328 !! input
6329 [[Article (context)|]]
6330 [[Bar:Article|]]
6331 [[:Bar:Article|]]
6332 [[Bar:Article (context)|]]
6333 [[:Bar:Article (context)|]]
6334 [[|Article]]
6335 [[|Article (context)]]
6336 [[Bar:X (Y) Z|]]
6337 [[:Bar:X (Y) Z|]]
6338 !! result
6339 [[Article (context)|Article]]
6340 [[Bar:Article|Article]]
6341 [[:Bar:Article|Article]]
6342 [[Bar:Article (context)|Article]]
6343 [[:Bar:Article (context)|Article]]
6344 [[Article]]
6345 [[Article (context)]]
6346 [[Bar:X (Y) Z|X (Y) Z]]
6347 [[:Bar:X (Y) Z|X (Y) Z]]
6348 !! end
6349
6350 !! test
6351 pre-save transform: context links ("pipe trick") with interwiki prefix
6352 !! options
6353 pst
6354 !! input
6355 [[interwiki:Article|]]
6356 [[:interwiki:Article|]]
6357 [[interwiki:Bar:Article|]]
6358 [[:interwiki:Bar:Article|]]
6359 !! result
6360 [[interwiki:Article|Article]]
6361 [[:interwiki:Article|Article]]
6362 [[interwiki:Bar:Article|Bar:Article]]
6363 [[:interwiki:Bar:Article|Bar:Article]]
6364 !! end
6365
6366 !! test
6367 pre-save transform: context links ("pipe trick") with parens in title
6368 !! options
6369 pst title=[[Somearticle (context)]]
6370 !! input
6371 [[|Article]]
6372 !! result
6373 [[Article (context)|Article]]
6374 !! end
6375
6376 !! test
6377 pre-save transform: context links ("pipe trick") with comma in title
6378 !! options
6379 pst title=[[Someplace, Somewhere]]
6380 !! input
6381 [[|Otherplace]]
6382 [[Otherplace, Elsewhere|]]
6383 [[Otherplace, Elsewhere, Anywhere|]]
6384 !! result
6385 [[Otherplace, Somewhere|Otherplace]]
6386 [[Otherplace, Elsewhere|Otherplace]]
6387 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6388 !! end
6389
6390 !! test
6391 pre-save transform: context links ("pipe trick") with parens and comma
6392 !! options
6393 pst title=[[Someplace (IGNORED), Somewhere]]
6394 !! input
6395 [[|Otherplace]]
6396 [[Otherplace (place), Elsewhere|]]
6397 !! result
6398 [[Otherplace, Somewhere|Otherplace]]
6399 [[Otherplace (place), Elsewhere|Otherplace]]
6400 !! end
6401
6402 !! test
6403 pre-save transform: context links ("pipe trick") with comma and parens
6404 !! options
6405 pst title=[[Who, me? (context)]]
6406 !! input
6407 [[|Yes, you.]]
6408 [[Me, Myself, and I (1937 song)|]]
6409 !! result
6410 [[Yes, you. (context)|Yes, you.]]
6411 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6412 !! end
6413
6414 !! test
6415 pre-save transform: context links ("pipe trick") with namespace
6416 !! options
6417 pst title=[[Ns:Somearticle]]
6418 !! input
6419 [[|Article]]
6420 !! result
6421 [[Ns:Article|Article]]
6422 !! end
6423
6424 !! test
6425 pre-save transform: context links ("pipe trick") with namespace and parens
6426 !! options
6427 pst title=[[Ns:Somearticle (context)]]
6428 !! input
6429 [[|Article]]
6430 !! result
6431 [[Ns:Article (context)|Article]]
6432 !! end
6433
6434 !! test
6435 pre-save transform: context links ("pipe trick") with namespace and comma
6436 !! options
6437 pst title=[[Ns:Somearticle, Context, Whatever]]
6438 !! input
6439 [[|Article]]
6440 !! result
6441 [[Ns:Article, Context, Whatever|Article]]
6442 !! end
6443
6444 !! test
6445 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6446 !! options
6447 pst title=[[Ns:Somearticle, Context (context)]]
6448 !! input
6449 [[|Article]]
6450 !! result
6451 [[Ns:Article (context)|Article]]
6452 !! end
6453
6454 !! test
6455 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6456 !! options
6457 pst title=[[Ns:Somearticle (IGNORED), Context]]
6458 !! input
6459 [[|Article]]
6460 !! result
6461 [[Ns:Article, Context|Article]]
6462 !! end
6463
6464 !! test
6465 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6466 !! options
6467 pst
6468 !! input
6469 [[Article(context)|]]
6470 [[Bar:Article(context)|]]
6471 [[:Bar:Article(context)|]]
6472 [[|Article(context)]]
6473 [[Bar:X(Y)Z|]]
6474 [[:Bar:X(Y)Z|]]
6475 !! result
6476 [[Article(context)|Article]]
6477 [[Bar:Article(context)|Article]]
6478 [[:Bar:Article(context)|Article]]
6479 [[Article(context)]]
6480 [[Bar:X(Y)Z|X(Y)Z]]
6481 [[:Bar:X(Y)Z|X(Y)Z]]
6482 !! end
6483
6484 !! test
6485 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6486 !! options
6487 pst
6488 !! input
6489 [[Article (context)|]]
6490 [[Bar:Article (context)|]]
6491 [[:Bar:Article (context)|]]
6492 [[|Article (context)]]
6493 [[Bar:X (Y) Z|]]
6494 [[:Bar:X (Y) Z|]]
6495 !! result
6496 [[Article (context)|Article]]
6497 [[Bar:Article (context)|Article]]
6498 [[:Bar:Article (context)|Article]]
6499 [[Article (context)]]
6500 [[Bar:X (Y) Z|X (Y) Z]]
6501 [[:Bar:X (Y) Z|X (Y) Z]]
6502 !! end
6503
6504 !! test
6505 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6506 !! options
6507 pst
6508 !! input
6509 [[Article(context)|]]
6510 [[Bar:Article(context)|]]
6511 [[:Bar:Article(context)|]]
6512 [[|Article(context)]]
6513 [[Bar:X(Y)Z|]]
6514 [[:Bar:X(Y)Z|]]
6515 !! result
6516 [[Article(context)|Article]]
6517 [[Bar:Article(context)|Article]]
6518 [[:Bar:Article(context)|Article]]
6519 [[Article(context)]]
6520 [[Bar:X(Y)Z|X(Y)Z]]
6521 [[:Bar:X(Y)Z|X(Y)Z]]
6522 !! end
6523
6524 !! test
6525 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6526 !! options
6527 pst
6528 !! input
6529 [[Article (context), context|]]
6530 [[Article (context),context|]]
6531 [[Bar:Article (context), context|]]
6532 [[Bar:Article (context),context|]]
6533 [[:Bar:Article (context), context|]]
6534 [[:Bar:Article (context),context|]]
6535 !! result
6536 [[Article (context), context|Article]]
6537 [[Article (context),context|Article]]
6538 [[Bar:Article (context), context|Article]]
6539 [[Bar:Article (context),context|Article]]
6540 [[:Bar:Article (context), context|Article]]
6541 [[:Bar:Article (context),context|Article]]
6542 !! end
6543
6544 !! test
6545 pre-save transform: trim trailing empty lines
6546 !! options
6547 pst
6548 !! input
6549 Empty lines are trimmed
6550
6551
6552
6553
6554 !! result
6555 Empty lines are trimmed
6556 !! end
6557
6558 !! test
6559 pre-save transform: Signature expansion
6560 !! options
6561 pst
6562 !! input
6563 * ~~~
6564 * <noinclude>~~~</noinclude>
6565 * <includeonly>~~~</includeonly>
6566 * <onlyinclude>~~~</onlyinclude>
6567 !! result
6568 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6569 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6570 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6571 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6572 !! end
6573
6574
6575 !! test
6576 pre-save transform: Signature expansion in nowiki tags (bug 93)
6577 !! options
6578 pst disabled
6579 !! input
6580 Shall not expand:
6581
6582 <nowiki>~~~~</nowiki>
6583
6584 <includeonly><nowiki>~~~~</nowiki></includeonly>
6585
6586 <noinclude><nowiki>~~~~</nowiki></noinclude>
6587
6588 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6589
6590 {{subst:Foo}} shall be converted to FOO
6591
6592 As well as inside noinclude/onlyinclude
6593 <noinclude>{{subst:Foo}}</noinclude>
6594 <onlyinclude>{{subst:Foo}}</onlyinclude>
6595
6596 But not inside includeonly
6597 <includeonly>{{subst:Foo}}</includeonly>
6598 !! result
6599 Shall not expand:
6600
6601 <nowiki>~~~~</nowiki>
6602
6603 <includeonly><nowiki>~~~~</nowiki></includeonly>
6604
6605 <noinclude><nowiki>~~~~</nowiki></noinclude>
6606
6607 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6608
6609 FOO shall be converted to FOO
6610
6611 As well as inside noinclude/onlyinclude
6612 <noinclude>FOO</noinclude>
6613 <onlyinclude>FOO</onlyinclude>
6614
6615 But not inside includeonly
6616 <includeonly>{{subst:Foo}}</includeonly>
6617 !! end
6618
6619 ###
6620 ### Message transform tests
6621 ###
6622 !! test
6623 message transform: magic variables
6624 !! options
6625 msg
6626 !! input
6627 {{SITENAME}}
6628 !! result
6629 MediaWiki
6630 !! end
6631
6632 !! test
6633 message transform: should not transform wiki markup
6634 !! options
6635 msg
6636 !! input
6637 ''test''
6638 !! result
6639 ''test''
6640 !! end
6641
6642 !! test
6643 message transform: <noinclude> in transcluded template (bug 4926)
6644 !! options
6645 msg
6646 !! input
6647 {{Includes}}
6648 !! result
6649 Foobar
6650 !! end
6651
6652 !! test
6653 message transform: <onlyinclude> in transcluded template (bug 4926)
6654 !! options
6655 msg
6656 !! input
6657 {{Includes2}}
6658 !! result
6659 Foo
6660 !! end
6661
6662 !! test
6663 {{#special:}} page name, known
6664 !! options
6665 msg
6666 !! input
6667 {{#special:Recentchanges}}
6668 !! result
6669 Special:RecentChanges
6670 !! end
6671
6672 !! test
6673 {{#special:}} page name with subpage, known
6674 !! options
6675 msg
6676 !! input
6677 {{#special:Recentchanges/param}}
6678 !! result
6679 Special:RecentChanges/param
6680 !! end
6681
6682 !! test
6683 {{#special:}} page name, unknown
6684 !! options
6685 msg
6686 !! input
6687 {{#special:foobarnonexistent}}
6688 !! result
6689 No such special page
6690 !! end
6691
6692 !! test
6693 {{#speciale:}} page name, known
6694 !! options
6695 msg
6696 !! input
6697 {{#speciale:Recentchanges}}
6698 !! result
6699 Special:RecentChanges
6700 !! end
6701
6702 !! test
6703 {{#speciale:}} page name with subpage, known
6704 !! options
6705 msg
6706 !! input
6707 {{#speciale:Recentchanges/param}}
6708 !! result
6709 Special:RecentChanges/param
6710 !! end
6711
6712 !! test
6713 {{#speciale:}} page name, unknown
6714 !! options
6715 msg
6716 !! input
6717 {{#speciale:foobarnonexistent}}
6718 !! result
6719 No_such_special_page
6720 !! end
6721
6722 ###
6723 ### Images
6724 ###
6725 !! test
6726 Simple image
6727 !! input
6728 [[Image:foobar.jpg]]
6729 !! result
6730 <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>
6731 </p>
6732 !! end
6733
6734 !! test
6735 Right-aligned image
6736 !! input
6737 [[Image:foobar.jpg|right]]
6738 !! result
6739 <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>
6740
6741 !! end
6742
6743 !! test
6744 Simple image (using File: namespace, now canonical)
6745 !! input
6746 [[File:foobar.jpg]]
6747 !! result
6748 <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>
6749 </p>
6750 !! end
6751
6752 !! test
6753 Image with caption
6754 !! input
6755 [[Image:foobar.jpg|right|Caption text]]
6756 !! result
6757 <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>
6758
6759 !! end
6760
6761 !! test
6762 Image with empty attribute
6763 !! input
6764 [[Image:foobar.jpg|right||Caption text]]
6765 !! result
6766 <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>
6767
6768 !! end
6769
6770 !! test
6771 Image with link tails
6772 !! input
6773 123[[Image:foobar.jpg]]456
6774 123[[Image:foobar.jpg|right]]456
6775 123[[Image:foobar.jpg|thumb]]456
6776 !! result
6777 <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
6778 </p>
6779 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
6780 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
6781
6782 !! end
6783
6784 !! test
6785 Image with multiple captions -- only last one is accepted
6786 !! input
6787 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6788 !! result
6789 <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>
6790
6791 !! end
6792
6793 !! test
6794 Image with width attribute at different positions
6795 !! input
6796 [[Image:foobar.jpg|200px|right|Caption]]
6797 [[Image:foobar.jpg|right|200px|Caption]]
6798 [[Image:foobar.jpg|right|Caption|200px]]
6799 !! result
6800 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" 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>
6801 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" 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>
6802 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" 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>
6803
6804 !! end
6805
6806 !! test
6807 Image with link parameter, wiki target
6808 !! input
6809 [[Image:foobar.jpg|link=Target page]]
6810 !! result
6811 <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>
6812 </p>
6813 !! end
6814
6815 !! test
6816 Image with link parameter, URL target
6817 !! input
6818 [[Image:foobar.jpg|link=http://example.com/]]
6819 !! result
6820 <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>
6821 </p>
6822 !! end
6823
6824 !! test
6825 Image with link parameter, wgExternalLinkTarget
6826 !! input
6827 [[Image:foobar.jpg|link=http://example.com/]]
6828 !! config
6829 wgExternalLinkTarget='foobar'
6830 !! result
6831 <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>
6832 </p>
6833 !! end
6834
6835 !! test
6836 Image with link parameter, wgNoFollowLinks set to false
6837 !! input
6838 [[Image:foobar.jpg|link=http://example.com/]]
6839 !! config
6840 wgNoFollowLinks=false
6841 !! result
6842 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6843 </p>
6844 !! end
6845
6846 !! test
6847 Image with link parameter, wgNoFollowDomainExceptions
6848 !! input
6849 [[Image:foobar.jpg|link=http://example.com/]]
6850 !! config
6851 wgNoFollowDomainExceptions='example.com'
6852 !! result
6853 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6854 </p>
6855 !! end
6856
6857 !! test
6858 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6859 !! input
6860 [[Image:foobar.jpg|link=http://example.com/|Title]]
6861 !! config
6862 wgExternalLinkTarget='foobar'
6863 !! result
6864 <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>
6865 </p>
6866 !! end
6867
6868 !! test
6869 Image with empty link parameter
6870 !! input
6871 [[Image:foobar.jpg|link=]]
6872 !! result
6873 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6874 </p>
6875 !! end
6876
6877 !! test
6878 Image with link parameter (wiki target) and unnamed parameter
6879 !! input
6880 [[Image:foobar.jpg|link=Target page|Title]]
6881 !! result
6882 <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>
6883 </p>
6884 !! end
6885
6886 !! test
6887 Image with link parameter (URL target) and unnamed parameter
6888 !! input
6889 [[Image:foobar.jpg|link=http://example.com/|Title]]
6890 !! result
6891 <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>
6892 </p>
6893 !! end
6894
6895 !! test
6896 Thumbnail image with link parameter
6897 !! input
6898 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6899 !! result
6900 <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>
6901
6902 !! end
6903
6904 !! test
6905 Image with frame and link
6906 !! input
6907 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6908 !! result
6909 <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>
6910
6911 !! end
6912
6913 !! test
6914 Image with frame and link and explicit alt
6915 !! input
6916 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6917 !! result
6918 <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>
6919
6920 !! end
6921
6922 !! test
6923 Image with wiki markup in implicit alt
6924 !! input
6925 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6926 !! result
6927 <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>
6928 </p>
6929 !! end
6930
6931 !! test
6932 Image with wiki markup in explicit alt
6933 !! input
6934 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6935 !! result
6936 <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>
6937 </p>
6938 !! end
6939
6940 !! test
6941 Link to image page- image page normally doesn't exists, hence edit link
6942 Add test with existing image page
6943 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6944 !! input
6945 [[:Image:test]]
6946 !! result
6947 <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>
6948 </p>
6949 !! end
6950
6951 !! test
6952 bug 18784 Link to non-existent image page with caption should use caption as link text
6953 !! input
6954 [[:Image:test|caption]]
6955 !! result
6956 <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>
6957 </p>
6958 !! end
6959
6960 !! test
6961 Frameless image caption with a free URL
6962 !! input
6963 [[Image:foobar.jpg|http://example.com]]
6964 !! result
6965 <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>
6966 </p>
6967 !! end
6968
6969 !! test
6970 Thumbnail image caption with a free URL
6971 !! input
6972 [[Image:foobar.jpg|thumb|http://example.com]]
6973 !! result
6974 <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>
6975
6976 !! end
6977
6978 !! test
6979 Thumbnail image caption with a free URL and explicit alt
6980 !! input
6981 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6982 !! result
6983 <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>
6984
6985 !! end
6986
6987 !! test
6988 BUG 1887: A ISBN with a thumbnail
6989 !! input
6990 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6991 !! result
6992 <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>
6993
6994 !! end
6995
6996 !! test
6997 BUG 1887: A RFC with a thumbnail
6998 !! input
6999 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7000 !! result
7001 <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" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7002
7003 !! end
7004
7005 !! test
7006 BUG 1887: A mailto link with a thumbnail
7007 !! input
7008 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7009 !! result
7010 <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>
7011
7012 !! end
7013
7014 # Pending resolution to bug 368
7015 !! test
7016 BUG 648: Frameless image caption with a link
7017 !! input
7018 [[Image:foobar.jpg|text with a [[link]] in it]]
7019 !! result
7020 <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>
7021 </p>
7022 !! end
7023
7024 !! test
7025 BUG 648: Frameless image caption with a link (suffix)
7026 !! input
7027 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7028 !! result
7029 <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>
7030 </p>
7031 !! end
7032
7033 !! test
7034 BUG 648: Frameless image caption with an interwiki link
7035 !! input
7036 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7037 !! result
7038 <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>
7039 </p>
7040 !! end
7041
7042 !! test
7043 BUG 648: Frameless image caption with a piped interwiki link
7044 !! input
7045 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7046 !! result
7047 <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>
7048 </p>
7049 !! end
7050
7051 !! test
7052 Escape HTML special chars in image alt text
7053 !! input
7054 [[Image:foobar.jpg|& < > "]]
7055 !! result
7056 <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>
7057 </p>
7058 !! end
7059
7060 !! test
7061 BUG 499: Alt text should have &#1234;, not &amp;1234;
7062 !! input
7063 [[Image:foobar.jpg|&#9792;]]
7064 !! result
7065 <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>
7066 </p>
7067 !! end
7068
7069 !! test
7070 Broken image caption with link
7071 !! input
7072 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7073 !! result
7074 <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.
7075 </p>
7076 !! end
7077
7078 !! test
7079 Image caption containing another image
7080 !! input
7081 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7082 !! result
7083 <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>
7084
7085 !! end
7086
7087 !! test
7088 Image caption containing a newline
7089 !! input
7090 [[Image:Foobar.jpg|This
7091 *is some text]]
7092 !! result
7093 <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>
7094 </p>
7095 !!end
7096
7097 !!test
7098 Parsoid: Image caption containing leading space
7099 (The leading space should not trigger nowiki escaping in wt2wt mode)
7100 !! input
7101 [[Image:Foobar.jpg|thumb| bar]]
7102 !! result
7103 <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>bar</div></div></div>
7104
7105 !!end
7106
7107 !! test
7108 Bug 3090: External links other than http: in image captions
7109 !! input
7110 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7111 !! result
7112 <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>
7113
7114 !! end
7115
7116 !! test
7117 Custom class
7118 !! input
7119 [[Image:foobar.jpg|a|class=b]]
7120 !! result
7121 <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>
7122 </p>
7123 !! end
7124
7125 !! test
7126 Localized image handling (1).
7127 !! options
7128 language=es
7129 !! input
7130 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7131 !! result
7132 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7133
7134 !! end
7135
7136 !! test
7137 Localized image handling (2).
7138 !! options
7139 language=es
7140 !! input
7141 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7142 !! result
7143 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><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/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7144
7145 !! end
7146
7147 !! test
7148 "border", "frameless" and "class" attributes on an image.
7149 !! input
7150 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7151 !! result
7152 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" 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>
7153 </p>
7154 !! end
7155
7156 !! article
7157 File:Barfoo.jpg
7158 !! text
7159 #REDIRECT [[File:Barfoo.jpg]]
7160 !! endarticle
7161
7162 !! test
7163 Redirected image
7164 !! input
7165 [[Image:Barfoo.jpg]]
7166 !! result
7167 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7168 </p>
7169 !! end
7170
7171 !! test
7172 Missing image with uploads disabled
7173 !! options
7174 wgEnableUploads=0
7175 !! input
7176 [[Image:Foobaz.jpg]]
7177 !! result
7178 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7179 </p>
7180 !! end
7181
7182
7183 ###
7184 ### Subpages
7185 ###
7186 !! article
7187 Subpage test/subpage
7188 !! text
7189 foo
7190 !! endarticle
7191
7192 !! test
7193 Subpage link
7194 !! options
7195 subpage title=[[Subpage test]]
7196 !! input
7197 [[/subpage]]
7198 !! result
7199 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7200 </p>
7201 !! end
7202
7203 !! test
7204 Subpage noslash link
7205 !! options
7206 subpage title=[[Subpage test]]
7207 !!input
7208 [[/subpage/]]
7209 !! result
7210 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7211 </p>
7212 !! end
7213
7214 !! test
7215 Disabled subpages
7216 !! input
7217 [[/subpage]]
7218 !! result
7219 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7220 </p>
7221 !! end
7222
7223 !! test
7224 BUG 561: {{/Subpage}}
7225 !! options
7226 subpage title=[[Page]]
7227 !! input
7228 {{/Subpage}}
7229 !! result
7230 <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>
7231 </p>
7232 !! end
7233
7234 ###
7235 ### Categories
7236 ###
7237 !! article
7238 Category:MediaWiki User's Guide
7239 !! text
7240 blah
7241 !! endarticle
7242
7243 !! test
7244 Link to category
7245 !! input
7246 [[:Category:MediaWiki User's Guide]]
7247 !! result
7248 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7249 </p>
7250 !! end
7251
7252 !! test
7253 Simple category
7254 !! options
7255 cat
7256 !! input
7257 [[Category:MediaWiki User's Guide]]
7258 !! result
7259 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7260 !! end
7261
7262 !! test
7263 PAGESINCATEGORY invalid title fatal (r33546 fix)
7264 !! input
7265 {{PAGESINCATEGORY:<bogus>}}
7266 !! result
7267 <p>0
7268 </p>
7269 !! end
7270
7271 !! test
7272 Category with different sort key
7273 !! options
7274 cat
7275 !! input
7276 [[Category:MediaWiki User's Guide|Foo]]
7277 !! result
7278 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7279 !! end
7280
7281 !! test
7282 Category with identical sort key
7283 !! options
7284 cat
7285 !! input
7286 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7287 !! result
7288 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7289 !! end
7290
7291 !! test
7292 Category with empty sort key
7293 !! options
7294 cat
7295 pst
7296 !! input
7297 [[Category:MediaWiki User's Guide|]]
7298 !! result
7299 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7300 !! end
7301
7302 !! test
7303 Category with empty sort key and parentheses
7304 !! options
7305 cat
7306 pst
7307 !! input
7308 [[Category:Foo (bar)|]]
7309 !! result
7310 [[Category:Foo (bar)|Foo]]
7311 !! end
7312
7313 !! test
7314 Category with link tail
7315 !! options
7316 cat
7317 pst
7318 !! input
7319 123[[Category:Foo]]456
7320 !! result
7321 123[[Category:Foo]]456
7322 !! end
7323
7324 !! test
7325 Category with template
7326 !! options
7327 cat
7328 pst
7329 !! input
7330 [[Category:{{echo|Foo}}]]
7331 !! result
7332 [[Category:{{echo|Foo}}]]
7333 !! end
7334
7335 !! test
7336 Category with template in sort key
7337 !! options
7338 cat
7339 pst
7340 !! input
7341 [[Category:Foo|{{echo|Bar}}]]
7342 !! result
7343 [[Category:Foo|{{echo|Bar}}]]
7344 !! end
7345
7346 !! test
7347 Category with template in sort key and title
7348 !! options
7349 cat
7350 pst
7351 !! input
7352 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7353 !! result
7354 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7355 !! end
7356
7357 !! test
7358 Category / paragraph interactions
7359 !! input
7360 Foo [[Category:Baz]] Bar
7361
7362 Foo [[Category:Baz]]
7363 Bar
7364
7365 Foo
7366 [[Category:Baz]]
7367 Bar
7368
7369 Foo
7370 [[Category:Baz]] Bar
7371
7372 Foo
7373 [[Category:Baz]]
7374 [[Category:Baz]]
7375 [[Category:Baz]]
7376 Bar
7377
7378 [[Category:Baz]]
7379 [[Category:Baz]]
7380 [[Category:Baz]]
7381
7382 [[Category:Baz]]
7383 {{echo|[[Category:Baz]]}}
7384 [[Category:Baz]]
7385 !! result
7386 <p>Foo Bar
7387 </p><p>Foo
7388 Bar
7389 </p><p>Foo
7390 Bar
7391 </p><p>Foo Bar
7392 </p><p>Foo
7393 Bar
7394 </p>
7395 !! end
7396
7397 ###
7398 ### Inter-language links
7399 ###
7400 !! test
7401 Inter-language links
7402 !! options
7403 ill
7404 !! input
7405 [[es:Alimento]]
7406 [[fr:Nourriture]]
7407 [[zh:&#39135;&#21697;]]
7408 !! result
7409 es:Alimento fr:Nourriture zh:食品
7410 !! end
7411
7412 !! test
7413 Duplicate interlanguage links (bug 24502)
7414 !! options
7415 ill
7416 !! input
7417 [[es:1]]
7418 [[es:2]]
7419 [[fr:1]]
7420 [[fr:2]]
7421 !! result
7422 es:1 fr:1
7423 !! end
7424
7425 ###
7426 ### Sections
7427 ###
7428 !! test
7429 Basic section headings
7430 !! input
7431 == Headline 1 ==
7432 Some text
7433
7434 ==Headline 2==
7435 More
7436 ===Smaller headline===
7437 Blah blah
7438 !! result
7439 <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>
7440 <p>Some text
7441 </p>
7442 <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>
7443 <p>More
7444 </p>
7445 <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>
7446 <p>Blah blah
7447 </p>
7448 !! end
7449
7450 !! test
7451 Section headings with TOC
7452 !! input
7453 == Headline 1 ==
7454 === Subheadline 1 ===
7455 ===== Skipping a level =====
7456 ====== Skipping a level ======
7457
7458 == Headline 2 ==
7459 Some text
7460 ===Another headline===
7461 !! result
7462 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7463 <ul>
7464 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7465 <ul>
7466 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7467 <ul>
7468 <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>
7469 <ul>
7470 <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>
7471 </ul>
7472 </li>
7473 </ul>
7474 </li>
7475 </ul>
7476 </li>
7477 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7478 <ul>
7479 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7480 </ul>
7481 </li>
7482 </ul>
7483 </td></tr></table>
7484 <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>
7485 <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>
7486 <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>
7487 <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>
7488 <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>
7489 <p>Some text
7490 </p>
7491 <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>
7492
7493 !! end
7494
7495 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7496 !! test
7497 Handling of sections up to level 6 and beyond
7498 !! input
7499 = Level 1 Heading=
7500 == Level 2 Heading==
7501 === Level 3 Heading===
7502 ==== Level 4 Heading====
7503 ===== Level 5 Heading=====
7504 ====== Level 6 Heading======
7505 ======= Level 7 Heading=======
7506 ======== Level 8 Heading========
7507 ========= Level 9 Heading=========
7508 ========== Level 10 Heading==========
7509 !! result
7510 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7511 <ul>
7512 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7513 <ul>
7514 <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>
7515 <ul>
7516 <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>
7517 <ul>
7518 <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>
7519 <ul>
7520 <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>
7521 <ul>
7522 <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>
7523 <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>
7524 <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>
7525 <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>
7526 <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>
7527 </ul>
7528 </li>
7529 </ul>
7530 </li>
7531 </ul>
7532 </li>
7533 </ul>
7534 </li>
7535 </ul>
7536 </li>
7537 </ul>
7538 </td></tr></table>
7539 <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>
7540 <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>
7541 <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>
7542 <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>
7543 <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>
7544 <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>
7545 <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>
7546 <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>
7547 <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>
7548 <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>
7549
7550 !! end
7551
7552 !! test
7553 TOC regression (bug 9764)
7554 !! input
7555 == title 1 ==
7556 === title 1.1 ===
7557 ==== title 1.1.1 ====
7558 === title 1.2 ===
7559 == title 2 ==
7560 === title 2.1 ===
7561 !! result
7562 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7563 <ul>
7564 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7565 <ul>
7566 <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>
7567 <ul>
7568 <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>
7569 </ul>
7570 </li>
7571 <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>
7572 </ul>
7573 </li>
7574 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7575 <ul>
7576 <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>
7577 </ul>
7578 </li>
7579 </ul>
7580 </td></tr></table>
7581 <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>
7582 <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>
7583 <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>
7584 <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>
7585 <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>
7586 <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>
7587
7588 !! end
7589
7590 !! test
7591 TOC with wgMaxTocLevel=3 (bug 6204)
7592 !! options
7593 wgMaxTocLevel=3
7594 !! input
7595 == title 1 ==
7596 === title 1.1 ===
7597 ==== title 1.1.1 ====
7598 === title 1.2 ===
7599 == title 2 ==
7600 === title 2.1 ===
7601 !! result
7602 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7603 <ul>
7604 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7605 <ul>
7606 <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>
7607 <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>
7608 </ul>
7609 </li>
7610 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7611 <ul>
7612 <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>
7613 </ul>
7614 </li>
7615 </ul>
7616 </td></tr></table>
7617 <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>
7618 <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>
7619 <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>
7620 <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>
7621 <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>
7622 <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>
7623
7624 !! end
7625
7626 !! test
7627 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7628 !! options
7629 wgMaxTocLevel=3
7630 !! input
7631 ==Section 1==
7632 ===Section 1.1===
7633 ====Section 1.1.1====
7634 ====Section 1.1.1.1====
7635 ==Section 2==
7636 !! result
7637 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7638 <ul>
7639 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7640 <ul>
7641 <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>
7642 </ul>
7643 </li>
7644 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7645 </ul>
7646 </td></tr></table>
7647 <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>
7648 <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>
7649 <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>
7650 <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>
7651 <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>
7652
7653 !! end
7654
7655
7656 !! test
7657 Resolving duplicate section names
7658 !! input
7659 == Foo bar ==
7660 == Foo bar ==
7661 !! result
7662 <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>
7663 <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>
7664
7665 !! end
7666
7667 !! test
7668 Resolving duplicate section names with differing case (bug 10721)
7669 !! input
7670 == Foo bar ==
7671 == Foo Bar ==
7672 !! result
7673 <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>
7674 <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>
7675
7676 !! end
7677
7678 !! article
7679 Template:sections
7680 !! text
7681 ===Section 1===
7682 ==Section 2==
7683 !! endarticle
7684
7685 !! test
7686 Template with sections, __NOTOC__
7687 !! input
7688 __NOTOC__
7689 ==Section 0==
7690 {{sections}}
7691 ==Section 4==
7692 !! result
7693 <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>
7694 <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>
7695 <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>
7696 <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>
7697
7698 !! end
7699
7700 !! test
7701 __NOEDITSECTION__ keyword
7702 !! input
7703 __NOEDITSECTION__
7704 ==Section 1==
7705 ==Section 2==
7706 !! result
7707 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7708 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7709
7710 !! end
7711
7712 !! test
7713 Link inside a section heading
7714 !! input
7715 ==Section with a [[Main Page|link]] in it==
7716 !! result
7717 <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>
7718
7719 !! end
7720
7721 !! test
7722 TOC regression (bug 12077)
7723 !! input
7724 __TOC__
7725 == title 1 ==
7726 === title 1.1 ===
7727 == title 2 ==
7728 !! result
7729 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7730 <ul>
7731 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7732 <ul>
7733 <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>
7734 </ul>
7735 </li>
7736 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7737 </ul>
7738 </td></tr></table>
7739 <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>
7740 <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>
7741 <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>
7742
7743 !! end
7744
7745 !! test
7746 BUG 1219 URL next to image (good)
7747 !! input
7748 http://example.com [[Image:foobar.jpg]]
7749 !! result
7750 <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>
7751 </p>
7752 !!end
7753
7754 !! test
7755 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
7756 !! input
7757 ===
7758 The line above must have a trailing space!
7759 === <!--
7760 --> <!-- -->
7761 But just in case it doesn't...
7762 !! result
7763 <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>
7764 <p>The line above must have a trailing space!
7765 </p>
7766 <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>
7767 <p>But just in case it doesn't...
7768 </p>
7769 !! end
7770
7771 !! test
7772 Header with special characters (bug 25462)
7773 !! input
7774 The tooltips shall not show entities to the user (ie. be double escaped)
7775
7776 == text > text ==
7777 section 1
7778
7779 == text < text ==
7780 section 2
7781
7782 == text & text ==
7783 section 3
7784
7785 == text ' text ==
7786 section 4
7787
7788 == text " text ==
7789 section 5
7790 !! result
7791 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7792 </p>
7793 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7794 <ul>
7795 <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>
7796 <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>
7797 <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>
7798 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7799 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7800 </ul>
7801 </td></tr></table>
7802 <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>
7803 <p>section 1
7804 </p>
7805 <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>
7806 <p>section 2
7807 </p>
7808 <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>
7809 <p>section 3
7810 </p>
7811 <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>
7812 <p>section 4
7813 </p>
7814 <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>
7815 <p>section 5
7816 </p>
7817 !! end
7818
7819 !! test
7820 Headers with excess '=' characters
7821 (Are similar tests necessary beyond the 1st level?)
7822 !! input
7823 =foo==
7824 ==foo=
7825 =''italic'' heading==
7826 ==''italic'' heading=
7827 !! result
7828 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7829 <ul>
7830 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7831 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7832 <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>
7833 <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>
7834 </ul>
7835 </td></tr></table>
7836 <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>
7837 <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>
7838 <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>
7839 <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>
7840
7841 !! end
7842
7843 !! test
7844 BUG 1219 URL next to image (broken)
7845 !! input
7846 http://example.com[[Image:foobar.jpg]]
7847 !! result
7848 <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>
7849 </p>
7850 !!end
7851
7852 !! test
7853 Bug 1186 news: in the middle of text
7854 !! input
7855 http://en.wikinews.org/wiki/Wikinews:Workplace
7856 !! result
7857 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7858 </p>
7859 !!end
7860
7861
7862 !! test
7863 Namespaced link must have a title
7864 !! input
7865 [[Project:]]
7866 !! result
7867 <p>[[Project:]]
7868 </p>
7869 !!end
7870
7871 !! test
7872 Namespaced link must have a title (bad fragment version)
7873 !! input
7874 [[Project:#fragment]]
7875 !! result
7876 <p>[[Project:#fragment]]
7877 </p>
7878 !!end
7879
7880
7881 ###
7882 ### HTML tags and HTML attributes
7883 ###
7884
7885 !! test
7886 div with no attributes
7887 !! input
7888 <div>HTML rocks</div>
7889 !! result
7890 <div>HTML rocks</div>
7891
7892 !! end
7893
7894 !! test
7895 div with double-quoted attribute
7896 !! input
7897 <div id="rock">HTML rocks</div>
7898 !! result
7899 <div id="rock">HTML rocks</div>
7900
7901 !! end
7902
7903 !! test
7904 div with single-quoted attribute
7905 !! input
7906 <div id='rock'>HTML rocks</div>
7907 !! result
7908 <div id="rock">HTML rocks</div>
7909
7910 !! end
7911
7912 !! test
7913 div with unquoted attribute
7914 !! input
7915 <div id=rock>HTML rocks</div>
7916 !! result
7917 <div id="rock">HTML rocks</div>
7918
7919 !! end
7920
7921 !! test
7922 div with illegal double attributes
7923 !! input
7924 <div id="a" id="b">HTML rocks</div>
7925 !! result
7926 <div id="b">HTML rocks</div>
7927
7928 !!end
7929
7930 # FIXME: produce empty string instead of "class" in the PHP parser, following
7931 # the HTML5 spec.
7932 !! test
7933 div with empty attribute value, space before equals
7934 !! options
7935 disabled
7936 !! input
7937 <div class =>HTML rocks</div>
7938 !! result
7939 <div class="">HTML rocks</div>
7940
7941 !! end
7942
7943 # The PHP parser escapes the opening brace to &#123; for some reason, so
7944 # disabled this test for it.
7945 !! test
7946 div with braces in attribute value
7947 !! options
7948 disabled
7949 !! input
7950 <div title="{}">Foo</div>
7951 !! result
7952 <div title="{}">Foo</div>
7953 !! end
7954
7955 # This it very inconsistent in the PHP parser: it returns
7956 # class="class" if there is a space between the name and the equal sign (see
7957 # 'div with empty attribute value, space before equals'), but strips the
7958 # attribute completely if the space is missing. We hope that not much content
7959 # depends on this, so are implementing the behavior below in Parsoid for
7960 # consistencies' sake. Disabled for the PHP parser.
7961 # FIXME: fix this behavior in the PHP parser?
7962 !! test
7963 div with empty attribute value, no space before equals
7964 !! options
7965 disabled
7966 !! input
7967 <div class=>HTML rocks</div>
7968 !! result
7969 <div class="">HTML rocks</div>
7970
7971 !! end
7972
7973 !! test
7974 HTML multiple attributes correction
7975 !! input
7976 <p class="error" class="awesome">Awesome!</p>
7977 !! result
7978 <p class="awesome">Awesome!</p>
7979
7980 !!end
7981
7982 !! test
7983 Table multiple attributes correction
7984 !! input
7985 {|
7986 !+ class="error" class="awesome"| status
7987 |}
7988 !! result
7989 <table>
7990 <tr>
7991 <th class="awesome"> status
7992 </th></tr></table>
7993
7994 !!end
7995
7996 !! test
7997 DIV IN UPPERCASE
7998 !! input
7999 <DIV ID="x">HTML ROCKS</DIV>
8000 !! result
8001 <div id="x">HTML ROCKS</div>
8002
8003 !!end
8004
8005 !! test
8006 Non-ASCII pseudo-tags are rendered as text
8007 !! input
8008 <khyô>
8009 !! result
8010 <p>&lt;khyô&gt;
8011 </p>
8012 !! end
8013
8014 !! test
8015 Pseudo-tag with URL 'name' renders as url link
8016 !! input
8017 <http://example.com/>
8018 !! result
8019 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8020 </p>
8021 !! end
8022
8023 !! test
8024 text with amp in the middle of nowhere
8025 !! input
8026 Remember AT&T?
8027 !!result
8028 <p>Remember AT&amp;T?
8029 </p>
8030 !! end
8031
8032 !! test
8033 text with character entity: eacute
8034 !! input
8035 I always thought &eacute; was a cute letter.
8036 !! result
8037 <p>I always thought &#233; was a cute letter.
8038 </p>
8039 !! end
8040
8041 !! test
8042 text with entity-escaped character entity-like string: eacute
8043 !! input
8044 I always thought &amp;eacute; was a cute letter.
8045 !! result
8046 <p>I always thought &amp;eacute; was a cute letter.
8047 </p>
8048 !! end
8049
8050 !! test
8051 text with undefined character entity: xacute
8052 !! input
8053 I always thought &xacute; was a cute letter.
8054 !! result
8055 <p>I always thought &amp;xacute; was a cute letter.
8056 </p>
8057 !! end
8058
8059
8060 ###
8061 ### Media links
8062 ###
8063
8064 !! test
8065 Media link
8066 !! input
8067 [[Media:Foobar.jpg]]
8068 !! result
8069 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8070 </p>
8071 !! end
8072
8073 !! test
8074 Media link with text
8075 !! input
8076 [[Media:Foobar.jpg|A neat file to look at]]
8077 !! result
8078 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8079 </p>
8080 !! end
8081
8082 # FIXME: this is still bad HTML tag nesting
8083 !! test
8084 Media link with nasty text
8085 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8086 !! input
8087 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8088 !! result
8089 <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>
8090
8091 !! end
8092
8093 !! test
8094 Media link to nonexistent file (bug 1702)
8095 !! input
8096 [[Media:No such.jpg]]
8097 !! result
8098 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8099 </p>
8100 !! end
8101
8102 !! test
8103 Image link to nonexistent file (bug 1850 - good)
8104 !! input
8105 [[Image:No such.jpg]]
8106 !! result
8107 <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>
8108 </p>
8109 !! end
8110
8111 !! test
8112 :Image link to nonexistent file (bug 1850 - bad)
8113 !! input
8114 [[:Image:No such.jpg]]
8115 !! result
8116 <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>
8117 </p>
8118 !! end
8119
8120
8121
8122 !! test
8123 Character reference normalization in link text (bug 1938)
8124 !! input
8125 [[Main Page|this&that]]
8126 !! result
8127 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8128 </p>
8129 !!end
8130
8131 !! article
8132 אַ
8133 !! text
8134 Test for unicode normalization
8135
8136 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8137 !! endarticle
8138
8139 !! test
8140 (bug 19451) Links should refer to the normalized form.
8141 !! input
8142 [[&#xFB2E;]]
8143 [[&#x5d0;&#x5b7;]]
8144 [[&#x5d0;ַ]]
8145 [[א&#x5b7;]]
8146 [[אַ]]
8147 !! result
8148 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8149 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8150 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8151 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8152 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8153 </p>
8154 !! end
8155
8156 !! test
8157 Empty attribute crash test (bug 2067)
8158 !! input
8159 <font color="">foo</font>
8160 !! result
8161 <p><font color="">foo</font>
8162 </p>
8163 !! end
8164
8165 !! test
8166 Empty attribute crash test single-quotes (bug 2067)
8167 !! input
8168 <font color=''>foo</font>
8169 !! result
8170 <p><font color="">foo</font>
8171 </p>
8172 !! end
8173
8174 !! test
8175 Attribute test: equals, then nothing
8176 !! input
8177 <font color=>foo</font>
8178 !! result
8179 <p><font>foo</font>
8180 </p>
8181 !! end
8182
8183 !! test
8184 Attribute test: unquoted value
8185 !! input
8186 <font color=x>foo</font>
8187 !! result
8188 <p><font color="x">foo</font>
8189 </p>
8190 !! end
8191
8192 !! test
8193 Attribute test: unquoted but illegal value (hash)
8194 !! input
8195 <font color=#x>foo</font>
8196 !! result
8197 <p><font color="#x">foo</font>
8198 </p>
8199 !! end
8200
8201 !! test
8202 Attribute test: no value
8203 !! input
8204 <font color>foo</font>
8205 !! result
8206 <p><font color="color">foo</font>
8207 </p>
8208 !! end
8209
8210 !! test
8211 Bug 2095: link with three closing brackets
8212 !! input
8213 [[Main Page]]]
8214 !! result
8215 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8216 </p>
8217 !! end
8218
8219 !! test
8220 Bug 2095: link with pipe and three closing brackets
8221 !! input
8222 [[Main Page|link]]]
8223 !! result
8224 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8225 </p>
8226 !! end
8227
8228 !! test
8229 Bug 2095: link with pipe and three closing brackets, version 2
8230 !! input
8231 [[Main Page|[http://example.com/]]]
8232 !! result
8233 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8234 </p>
8235 !! end
8236
8237
8238 ###
8239 ### Safety
8240 ###
8241
8242 !! article
8243 Template:Dangerous attribute
8244 !! text
8245 " onmouseover="alert(document.cookie)
8246 !! endarticle
8247
8248 !! article
8249 Template:Dangerous style attribute
8250 !! text
8251 border-size: expression(alert(document.cookie))
8252 !! endarticle
8253
8254 !! article
8255 Template:Div style
8256 !! text
8257 <div style="float: right; {{{1}}}">Magic div</div>
8258 !! endarticle
8259
8260 !! test
8261 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8262 !! input
8263 <div title="{{test}}"></div>
8264 !! result
8265 <div title="This is a test template"></div>
8266
8267 !! end
8268
8269 !! test
8270 Bug 2304: HTML attribute safety (dangerous template; 2309)
8271 !! input
8272 <div title="{{dangerous attribute}}"></div>
8273 !! result
8274 <div title=""></div>
8275
8276 !! end
8277
8278 !! test
8279 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8280 !! input
8281 <div style="{{dangerous style attribute}}"></div>
8282 !! result
8283 <div style="/* insecure input */"></div>
8284
8285 !! end
8286
8287 !! test
8288 Bug 2304: HTML attribute safety (safe parameter; 2309)
8289 !! input
8290 {{div style|width: 200px}}
8291 !! result
8292 <div style="float: right; width: 200px">Magic div</div>
8293
8294 !! end
8295
8296 !! test
8297 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8298 !! input
8299 {{div style|width: expression(alert(document.cookie))}}
8300 !! result
8301 <div style="/* insecure input */">Magic div</div>
8302
8303 !! end
8304
8305 !! test
8306 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8307 !! input
8308 {{div style|"><script>alert(document.cookie)</script>}}
8309 !! result
8310 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8311
8312 !! end
8313
8314 !! test
8315 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8316 !! input
8317 {{div style|" ><script>alert(document.cookie)</script>}}
8318 !! result
8319 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8320
8321 !! end
8322
8323 !! test
8324 Bug 2304: HTML attribute safety (link)
8325 !! input
8326 <div title="[[Main Page]]"></div>
8327 !! result
8328 <div title="&#91;&#91;Main Page]]"></div>
8329
8330 !! end
8331
8332 !! test
8333 Bug 2304: HTML attribute safety (italics)
8334 !! input
8335 <div title="''foobar''"></div>
8336 !! result
8337 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8338
8339 !! end
8340
8341 !! test
8342 Bug 2304: HTML attribute safety (bold)
8343 !! input
8344 <div title="'''foobar'''"></div>
8345 !! result
8346 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8347
8348 !! end
8349
8350
8351 !! test
8352 Bug 2304: HTML attribute safety (ISBN)
8353 !! input
8354 <div title="ISBN 1234567890"></div>
8355 !! result
8356 <div title="&#73;SBN 1234567890"></div>
8357
8358 !! end
8359
8360 !! test
8361 Bug 2304: HTML attribute safety (RFC)
8362 !! input
8363 <div title="RFC 1234"></div>
8364 !! result
8365 <div title="&#82;FC 1234"></div>
8366
8367 !! end
8368
8369 !! test
8370 Bug 2304: HTML attribute safety (PMID)
8371 !! input
8372 <div title="PMID 1234567890"></div>
8373 !! result
8374 <div title="&#80;MID 1234567890"></div>
8375
8376 !! end
8377
8378 !! test
8379 Bug 2304: HTML attribute safety (web link)
8380 !! input
8381 <div title="http://example.com/"></div>
8382 !! result
8383 <div title="http&#58;//example.com/"></div>
8384
8385 !! end
8386
8387 !! test
8388 Bug 2304: HTML attribute safety (named web link)
8389 !! input
8390 <div title="[http://example.com/ link]"></div>
8391 !! result
8392 <div title="&#91;http&#58;//example.com/ link]"></div>
8393
8394 !! end
8395
8396 !! test
8397 Bug 3244: HTML attribute safety (extension; safe)
8398 !! input
8399 <div style="<nowiki>background:blue</nowiki>"></div>
8400 !! result
8401 <div style="background:blue"></div>
8402
8403 !! end
8404
8405 !! test
8406 Bug 3244: HTML attribute safety (extension; unsafe)
8407 !! input
8408 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8409 !! result
8410 <div style="/* insecure input */"></div>
8411
8412 !! end
8413
8414 # More MSIE fun discovered by Tom Gilder
8415
8416 !! test
8417 MSIE CSS safety test: spurious slash
8418 !! input
8419 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8420 !! result
8421 <div style="/* insecure input */">evil</div>
8422
8423 !! end
8424
8425 !! test
8426 MSIE CSS safety test: hex code
8427 !! input
8428 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8429 !! result
8430 <div style="/* insecure input */">evil</div>
8431
8432 !! end
8433
8434 !! test
8435 MSIE CSS safety test: comment in url
8436 !! input
8437 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8438 !! result
8439 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8440
8441 !! end
8442
8443 !! test
8444 MSIE CSS safety test: comment in expression
8445 !! input
8446 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8447 !! result
8448 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8449
8450 !! end
8451
8452
8453 !! test
8454 Table attribute legitimate extension
8455 !! input
8456 {|
8457 !+ style="<nowiki>color:blue</nowiki>"| status
8458 |}
8459 !! result
8460 <table>
8461 <tr>
8462 <th style="color:blue"> status
8463 </th></tr></table>
8464
8465 !!end
8466
8467 !! test
8468 Table attribute safety
8469 !! input
8470 {|
8471 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8472 |}
8473 !! result
8474 <table>
8475 <tr>
8476 <th style="/* insecure input */"> status
8477 </th></tr></table>
8478
8479 !! end
8480
8481 !! test
8482 CSS line continuation 1
8483 !! input
8484 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8485 !! result
8486 <div style="/* insecure input */"></div>
8487
8488 !! end
8489
8490 !! test
8491 CSS line continuation 2
8492 !! input
8493 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8494 !! result
8495 <div style="/* insecure input */"></div>
8496
8497 !! end
8498
8499 !! article
8500 Template:Identity
8501 !! text
8502 {{{1}}}
8503 !! endarticle
8504
8505 !! test
8506 Expansion of multi-line templates in attribute values (bug 6255)
8507 !! input
8508 <div style="background: {{identity|#00FF00}}">-</div>
8509 !! result
8510 <div style="background: #00FF00">-</div>
8511
8512 !! end
8513
8514
8515 !! test
8516 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8517 !! input
8518 <div style="background:
8519 #00FF00">-</div>
8520 !! result
8521 <div style="background: #00FF00">-</div>
8522
8523 !! end
8524
8525 !! test
8526 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8527 !! input
8528 <div style="background: &#10;#00FF00">-</div>
8529 !! result
8530 <div style="background: &#10;#00FF00">-</div>
8531
8532 !! end
8533
8534 ###
8535 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8536 ###
8537 !! test
8538 Parser hook: empty input
8539 !! input
8540 <tag></tag>
8541 !! result
8542 <pre>
8543 ''
8544 array (
8545 )
8546 </pre>
8547
8548 !! end
8549
8550 !! test
8551 Parser hook: empty input using terminated empty elements
8552 !! input
8553 <tag/>
8554 !! result
8555 <pre>
8556 NULL
8557 array (
8558 )
8559 </pre>
8560
8561 !! end
8562
8563 !! test
8564 Parser hook: empty input using terminated empty elements (space before)
8565 !! input
8566 <tag />
8567 !! result
8568 <pre>
8569 NULL
8570 array (
8571 )
8572 </pre>
8573
8574 !! end
8575
8576 !! test
8577 Parser hook: basic input
8578 !! input
8579 <tag>input</tag>
8580 !! result
8581 <pre>
8582 'input'
8583 array (
8584 )
8585 </pre>
8586
8587 !! end
8588
8589
8590 !! test
8591 Parser hook: case insensitive
8592 !! input
8593 <TAG>input</TAG>
8594 !! result
8595 <pre>
8596 'input'
8597 array (
8598 )
8599 </pre>
8600
8601 !! end
8602
8603
8604 !! test
8605 Parser hook: case insensitive, redux
8606 !! input
8607 <TaG>input</TAg>
8608 !! result
8609 <pre>
8610 'input'
8611 array (
8612 )
8613 </pre>
8614
8615 !! end
8616
8617 !! test
8618 Parser hook: nested tags
8619 !! options
8620 noxml
8621 !! input
8622 <tag><tag></tag></tag>
8623 !! result
8624 <pre>
8625 '<tag>'
8626 array (
8627 )
8628 </pre>&lt;/tag&gt;
8629
8630 !! end
8631
8632 !! test
8633 Parser hook: basic arguments
8634 !! input
8635 <tag width=200 height = "100" depth = '50' square></tag>
8636 !! result
8637 <pre>
8638 ''
8639 array (
8640 'width' => '200',
8641 'height' => '100',
8642 'depth' => '50',
8643 'square' => 'square',
8644 )
8645 </pre>
8646
8647 !! end
8648
8649 !! test
8650 Parser hook: argument containing a forward slash (bug 5344)
8651 !! input
8652 <tag filename='/tmp/bla'></tag>
8653 !! result
8654 <pre>
8655 ''
8656 array (
8657 'filename' => '/tmp/bla',
8658 )
8659 </pre>
8660
8661 !! end
8662
8663 !! test
8664 Parser hook: empty input using terminated empty elements (bug 2374)
8665 !! input
8666 <tag foo=bar/>text
8667 !! result
8668 <pre>
8669 NULL
8670 array (
8671 'foo' => 'bar',
8672 )
8673 </pre>text
8674
8675 !! end
8676
8677 # </tag> should be output literally since there is no matching tag that begins it
8678 !! test
8679 Parser hook: basic arguments using terminated empty elements (bug 2374)
8680 !! input
8681 <tag width=200 height = "100" depth = '50' square/>
8682 other stuff
8683 </tag>
8684 !! result
8685 <pre>
8686 NULL
8687 array (
8688 'width' => '200',
8689 'height' => '100',
8690 'depth' => '50',
8691 'square' => 'square',
8692 )
8693 </pre>
8694 <p>other stuff
8695 &lt;/tag&gt;
8696 </p>
8697 !! end
8698
8699 ###
8700 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8701 ###
8702
8703 !! test
8704 Parser hook: static parser hook not inside a comment
8705 !! input
8706 <statictag>hello, world</statictag>
8707 <statictag action=flush/>
8708 !! result
8709 <p>hello, world
8710 </p>
8711 !! end
8712
8713
8714 !! test
8715 Parser hook: static parser hook inside a comment
8716 !! input
8717 <!-- <statictag>hello, world</statictag> -->
8718 <statictag action=flush/>
8719 !! result
8720 <p><br />
8721 </p>
8722 !! end
8723
8724 # Nested template calls; this case was broken by Parser.php rev 1.506,
8725 # since reverted.
8726
8727 !! article
8728 Template:One-parameter
8729 !! text
8730 (My parameter is: {{{1}}})
8731 !! endarticle
8732
8733 !! article
8734 Template:Map-one-parameter
8735 !! text
8736 {{{{{1}}}|{{{2}}}}}
8737 !! endarticle
8738
8739 !! test
8740 Nested template calls
8741 !! input
8742 {{Map-one-parameter|One-parameter|param}}
8743 !! result
8744 <p>(My parameter is: param)
8745 </p>
8746 !! end
8747
8748
8749 ###
8750 ### Sanitizer
8751 ###
8752 !! test
8753 Sanitizer: Closing of open tags
8754 !! input
8755 <s></s><table></table>
8756 !! result
8757 <s></s><table></table>
8758
8759 !! end
8760
8761 !! test
8762 Sanitizer: Closing of open but not closed tags
8763 !! input
8764 <s>foo
8765 !! result
8766 <p><s>foo</s>
8767 </p>
8768 !! end
8769
8770 !! test
8771 Sanitizer: Closing of closed but not open tags
8772 !! input
8773 </s>
8774 !! result
8775 <p>&lt;/s&gt;
8776 </p>
8777 !! end
8778
8779 !! test
8780 Sanitizer: Closing of closed but not open table tags
8781 !! input
8782 Table not started</td></tr></table>
8783 !! result
8784 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8785 </p>
8786 !! end
8787
8788 !! test
8789 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8790 !! input
8791 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8792 !! result
8793 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8794 </p>
8795 !! end
8796
8797 !! test
8798 Sanitizer: Validating the contents of the id attribute (bug 4515)
8799 !! options
8800 disabled
8801 !! input
8802 <br id=9 />
8803 !! result
8804 Something, but definitely not <br id="9" />...
8805 !! end
8806
8807 !! test
8808 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8809 !! options
8810 disabled
8811 !! input
8812 <br id="foo" /><br id="foo" />
8813 !! result
8814 Something need to be done. foo-2 ?
8815 !! end
8816
8817 !! test
8818 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8819 !! input
8820 <div itemscope>
8821 <meta itemprop="hello" content="world">
8822 <meta http-equiv="refresh" content="5">
8823 <meta itemprop="hello" http-equiv="refresh" content="5">
8824 <link itemprop="hello" href="{{SERVER}}">
8825 <link rel="stylesheet" href="{{SERVER}}">
8826 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8827 </div>
8828 !! result
8829 <div itemscope="itemscope">
8830 <p> <meta itemprop="hello" content="world" />
8831 &lt;meta http-equiv="refresh" content="5"&gt;
8832 <meta itemprop="hello" content="5" />
8833 </p>
8834 <link itemprop="hello" href="http&#58;//example.org" />
8835 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
8836 <link itemprop="hello" href="http&#58;//example.org" />
8837 </div>
8838
8839 !! end
8840
8841 !! test
8842 Language converter: output gets cut off unexpectedly (bug 5757)
8843 !! options
8844 language=zh
8845 !! input
8846 this bit is safe: }-
8847
8848 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8849
8850 then we get cut off here: }-
8851
8852 all additional text is vanished
8853 !! result
8854 <p>this bit is safe: }-
8855 </p><p>but if we add a conversion instance: xxx
8856 </p><p>then we get cut off here: }-
8857 </p><p>all additional text is vanished
8858 </p>
8859 !! end
8860
8861 !! test
8862 Self closed html pairs (bug 5487)
8863 !! options
8864 !! input
8865 <center><font id="bug" />Centered text</center>
8866 <div><font id="bug2" />In div text</div>
8867 !! result
8868 <center>&lt;font id="bug" /&gt;Centered text</center>
8869 <div>&lt;font id="bug2" /&gt;In div text</div>
8870
8871 !! end
8872
8873 #
8874 #
8875 #
8876
8877 !! test
8878 Punctuation: nbsp before exclamation
8879 !! input
8880 C'est grave !
8881 !! result
8882 <p>C'est grave&#160;!
8883 </p>
8884 !! end
8885
8886 !! test
8887 Punctuation: CSS !important (bug 11874)
8888 !! input
8889 <div style="width:50% !important">important</div>
8890 !! result
8891 <div style="width:50% !important">important</div>
8892
8893 !!end
8894
8895 !! test
8896 Punctuation: CSS ! important (bug 11874; with space after)
8897 !! input
8898 <div style="width:50% ! important">important</div>
8899 !! result
8900 <div style="width:50% ! important">important</div>
8901
8902 !!end
8903
8904
8905 !! test
8906 HTML bullet list, closed tags (bug 5497)
8907 !! input
8908 <ul>
8909 <li>One</li>
8910 <li>Two</li>
8911 </ul>
8912 !! result
8913 <ul>
8914 <li>One</li>
8915 <li>Two</li>
8916 </ul>
8917
8918 !! end
8919
8920 !! test
8921 HTML bullet list, unclosed tags (bug 5497)
8922 !! options
8923 disabled
8924 !! input
8925 <ul>
8926 <li>One
8927 <li>Two
8928 </ul>
8929 !! result
8930 <ul>
8931 <li>One
8932 </li><li>Two
8933 </li></ul>
8934
8935 !! end
8936
8937 !! test
8938 HTML ordered list, closed tags (bug 5497)
8939 !! input
8940 <ol>
8941 <li>One</li>
8942 <li>Two</li>
8943 </ol>
8944 !! result
8945 <ol>
8946 <li>One</li>
8947 <li>Two</li>
8948 </ol>
8949
8950 !! end
8951
8952 !! test
8953 HTML ordered list, unclosed tags (bug 5497)
8954 !! options
8955 disabled
8956 !! input
8957 <ol>
8958 <li>One
8959 <li>Two
8960 </ol>
8961 !! result
8962 <ol>
8963 <li>One
8964 </li><li>Two
8965 </li></ol>
8966
8967 !! end
8968
8969 !! test
8970 HTML nested bullet list, closed tags (bug 5497)
8971 !! input
8972 <ul>
8973 <li>One</li>
8974 <li>Two:
8975 <ul>
8976 <li>Sub-one</li>
8977 <li>Sub-two</li>
8978 </ul>
8979 </li>
8980 </ul>
8981 !! result
8982 <ul>
8983 <li>One</li>
8984 <li>Two:
8985 <ul>
8986 <li>Sub-one</li>
8987 <li>Sub-two</li>
8988 </ul>
8989 </li>
8990 </ul>
8991
8992 !! end
8993
8994 !! test
8995 HTML nested bullet list, open tags (bug 5497)
8996 !! options
8997 disabled
8998 !! input
8999 <ul>
9000 <li>One
9001 <li>Two:
9002 <ul>
9003 <li>Sub-one
9004 <li>Sub-two
9005 </ul>
9006 </ul>
9007 !! result
9008 <ul>
9009 <li>One
9010 </li><li>Two:
9011 <ul>
9012 <li>Sub-one
9013 </li><li>Sub-two
9014 </li></ul>
9015 </li></ul>
9016
9017 !! end
9018
9019 !! test
9020 HTML nested ordered list, closed tags (bug 5497)
9021 !! input
9022 <ol>
9023 <li>One</li>
9024 <li>Two:
9025 <ol>
9026 <li>Sub-one</li>
9027 <li>Sub-two</li>
9028 </ol>
9029 </li>
9030 </ol>
9031 !! result
9032 <ol>
9033 <li>One</li>
9034 <li>Two:
9035 <ol>
9036 <li>Sub-one</li>
9037 <li>Sub-two</li>
9038 </ol>
9039 </li>
9040 </ol>
9041
9042 !! end
9043
9044 !! test
9045 HTML nested ordered list, open tags (bug 5497)
9046 !! options
9047 disabled
9048 !! input
9049 <ol>
9050 <li>One
9051 <li>Two:
9052 <ol>
9053 <li>Sub-one
9054 <li>Sub-two
9055 </ol>
9056 </ol>
9057 !! result
9058 <ol>
9059 <li>One
9060 </li><li>Two:
9061 <ol>
9062 <li>Sub-one
9063 </li><li>Sub-two
9064 </li></ol>
9065 </li></ol>
9066
9067 !! end
9068
9069 !! test
9070 HTML ordered list item with parameters oddity
9071 !! input
9072 <ol><li id="fragment">One</li></ol>
9073 !! result
9074 <ol><li id="fragment">One</li></ol>
9075
9076 !! end
9077
9078 !!test
9079 bug 5918: autonumbering
9080 !! input
9081 [http://first/] [http://second] [ftp://ftp]
9082
9083 ftp://inlineftp
9084
9085 [mailto:enclosed@mail.tld With target]
9086
9087 [mailto:enclosed@mail.tld]
9088
9089 mailto:inline@mail.tld
9090 !! result
9091 <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>
9092 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9093 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9094 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9095 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9096 </p>
9097 !! end
9098
9099
9100 #
9101 # Security and HTML correctness
9102 # From Nick Jenkins' fuzz testing
9103 #
9104
9105 !! test
9106 Fuzz testing: Parser13
9107 !! input
9108 {|
9109 | http://a|
9110 !! result
9111 <table>
9112 <tr>
9113 <td>
9114 </td>
9115 </tr>
9116 </table>
9117
9118 !! end
9119
9120 !! test
9121 Fuzz testing: Parser14
9122 !! input
9123 == onmouseover= ==
9124 http://__TOC__
9125 !! result
9126 <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>
9127 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9128 <ul>
9129 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9130 </ul>
9131 </td></tr></table>
9132
9133 !! end
9134
9135 !! test
9136 Fuzz testing: Parser14-table
9137 !! input
9138 ==a==
9139 {| STYLE=__TOC__
9140 !! result
9141 <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>
9142 <table style="&#95;_TOC&#95;_">
9143 <tr><td></td></tr>
9144 </table>
9145
9146 !! end
9147
9148 # Known to produce bogus xml (extra </td>)
9149 !! test
9150 Fuzz testing: Parser16
9151 !! options
9152 noxml
9153 !! input
9154 {|
9155 !https://||||||
9156 !! result
9157 <table>
9158 <tr>
9159 <th>https://</th>
9160 <th></th>
9161 <th></th>
9162 <th>
9163 </td>
9164 </tr>
9165 </table>
9166
9167 !! end
9168
9169 !! test
9170 Fuzz testing: Parser21
9171 !! input
9172 {|
9173 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9174 |
9175 !! result
9176 <table>
9177 <tr>
9178 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9179 </th>
9180 <td>
9181 </td>
9182 </tr>
9183 </table>
9184
9185 !! end
9186
9187 !! test
9188 Fuzz testing: Parser22
9189 !! input
9190 http://===r:::https://b
9191
9192 {|
9193 !!result
9194 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9195 </p>
9196 <table>
9197 <tr><td></td></tr>
9198 </table>
9199
9200 !! end
9201
9202 # Known to produce bad XML for now
9203 !! test
9204 Fuzz testing: Parser24
9205 !! options
9206 noxml
9207 !! input
9208 {|
9209 {{{|
9210 <u CLASS=
9211 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9212 <br style="onmouseover='alert(document.cookie);' " />
9213
9214 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9215 |
9216 !! result
9217 <table>
9218 {{{|
9219 <u class="&#124;">}}}} &gt;
9220 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9221
9222 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9223 <tr>
9224 <td></u>
9225 </td>
9226 </tr>
9227 </table>
9228
9229 !! end
9230
9231 # Note: the current result listed for this is not what the original one was,
9232 # but the original bug was JavaScript injection, which is fixed in any case.
9233 # It's not clear that the original result listed was any more correct than the
9234 # current one. Original result:
9235 # <p>{{{|
9236 # </p>
9237 # <li class="&#124;&#124;">
9238 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9239 !!test
9240 Fuzz testing: Parser25 (bug 6055)
9241 !! input
9242 {{{
9243 |
9244 <LI CLASS=||
9245 >
9246 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9247 !! result
9248 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9249 </p>
9250 !! end
9251
9252 !!test
9253 Fuzz testing: URL adjacent extension (with space, clean)
9254 !! options
9255 !! input
9256 http://example.com <nowiki>junk</nowiki>
9257 !! result
9258 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9259 </p>
9260 !!end
9261
9262 !!test
9263 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9264 !! options
9265 !! input
9266 http://example.com<nowiki>junk</nowiki>
9267 !! result
9268 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9269 </p>
9270 !!end
9271
9272 !!test
9273 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9274 !! options
9275 !! input
9276 http://example.com<pre>junk</pre>
9277 !! result
9278 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9279
9280 !!end
9281
9282 !!test
9283 Fuzz testing: image with bogus manual thumbnail
9284 !!input
9285 [[Image:foobar.jpg|thumbnail= ]]
9286 !!result
9287 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9288
9289 !!end
9290
9291 !! test
9292 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9293 !! input
9294 <pre dir="&#10;"></pre>
9295 !! result
9296 <pre dir="&#10;"></pre>
9297
9298 !! end
9299
9300 !! test
9301 Parsing optional HTML elements (Bug 6171)
9302 !! options
9303 !! input
9304 <table>
9305 <tr>
9306 <td> Some tabular data</td>
9307 <td> More tabular data ...
9308 <td> And yet som tabular data</td>
9309 </tr>
9310 </table>
9311 !! result
9312 <table>
9313 <tr>
9314 <td> Some tabular data</td>
9315 <td> More tabular data ...
9316 </td><td> And yet som tabular data</td>
9317 </tr>
9318 </table>
9319
9320 !! end
9321
9322 !! test
9323 Correct handling of <td>, <tr> (Bug 6171)
9324 !! options
9325 !! input
9326 <table>
9327 <tr>
9328 <td> Some tabular data</td>
9329 <td> More tabular data ...</td>
9330 <td> And yet som tabular data</td>
9331 </tr>
9332 </table>
9333 !! result
9334 <table>
9335 <tr>
9336 <td> Some tabular data</td>
9337 <td> More tabular data ...</td>
9338 <td> And yet som tabular data</td>
9339 </tr>
9340 </table>
9341
9342 !! end
9343
9344
9345 !! test
9346 Parsing crashing regression (fr:JavaScript)
9347 !! input
9348 </body></x>
9349 !! result
9350 <p>&lt;/body&gt;&lt;/x&gt;
9351 </p>
9352 !! end
9353
9354 !! test
9355 Inline wiki vs wiki block nesting
9356 !! input
9357 '''Bold paragraph
9358
9359 New wiki paragraph
9360 !! result
9361 <p><b>Bold paragraph</b>
9362 </p><p>New wiki paragraph
9363 </p>
9364 !! end
9365
9366 !! test
9367 Inline HTML vs wiki block nesting
9368 !! options
9369 disabled
9370 !! input
9371 <b>Bold paragraph
9372
9373 New wiki paragraph
9374 !! result
9375 <p><b>Bold paragraph</b>
9376 </p><p>New wiki paragraph
9377 </p>
9378 !! end
9379
9380 # Original result was this:
9381 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9382 # </p>
9383 # While that might be marginally more intuitive, maybe, the six-apostrophe
9384 # construct is clearly pathological and the result stated here (which is what
9385 # the parser actually does) is about as reasonable as anything.
9386 !!test
9387 Mixing markup for italics and bold
9388 !! options
9389 !! input
9390 '''bold''''''bold''bolditalics'''''
9391 !! result
9392 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9393 </p>
9394 !! end
9395
9396
9397 !! article
9398 Xyzzyx
9399 !! text
9400 Article for special page transclusion test
9401 !! endarticle
9402
9403 !! test
9404 Special page transclusion
9405 !! options
9406 !! input
9407 {{Special:Prefixindex/Xyzzyx}}
9408 !! result
9409 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9410
9411 !! end
9412
9413 !! test
9414 Special page transclusion twice (bug 5021)
9415 !! options
9416 !! input
9417 {{Special:Prefixindex/Xyzzyx}}
9418 {{Special:Prefixindex/Xyzzyx}}
9419 !! result
9420 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9421 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9422
9423 !! end
9424
9425 !! test
9426 Transclusion of default MediaWiki message
9427 !! input
9428 {{MediaWiki:Mainpage}}
9429 !!result
9430 <p>Main Page
9431 </p>
9432 !! end
9433
9434 !! test
9435 Transclusion of nonexistent MediaWiki message
9436 !! input
9437 {{MediaWiki:Mainpagexxx}}
9438 !!result
9439 <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>
9440 </p>
9441 !! end
9442
9443 !! test
9444 Transclusion of MediaWiki message with underscore
9445 !! input
9446 {{MediaWiki:history_short}}
9447 !! result
9448 <p>History
9449 </p>
9450 !! end
9451
9452 !! test
9453 Transclusion of MediaWiki message with space
9454 !! input
9455 {{MediaWiki:history short}}
9456 !! result
9457 <p>History
9458 </p>
9459 !! end
9460
9461 !! test
9462 Invalid header with following text
9463 !! input
9464 = x = y
9465 !! result
9466 <p>= x = y
9467 </p>
9468 !! end
9469
9470
9471 !! test
9472 Section extraction test (section 0)
9473 !! options
9474 section=0
9475 !! input
9476 start
9477 ==a==
9478 ===aa===
9479 ====aaa====
9480 ==b==
9481 ===ba===
9482 ===bb===
9483 ====bba====
9484 ===bc===
9485 ==c==
9486 ===ca===
9487 !! result
9488 start
9489 !! end
9490
9491 !! test
9492 Section extraction test (section 1)
9493 !! options
9494 section=1
9495 !! input
9496 start
9497 ==a==
9498 ===aa===
9499 ====aaa====
9500 ==b==
9501 ===ba===
9502 ===bb===
9503 ====bba====
9504 ===bc===
9505 ==c==
9506 ===ca===
9507 !! result
9508 ==a==
9509 ===aa===
9510 ====aaa====
9511 !! end
9512
9513 !! test
9514 Section extraction test (section 2)
9515 !! options
9516 section=2
9517 !! input
9518 start
9519 ==a==
9520 ===aa===
9521 ====aaa====
9522 ==b==
9523 ===ba===
9524 ===bb===
9525 ====bba====
9526 ===bc===
9527 ==c==
9528 ===ca===
9529 !! result
9530 ===aa===
9531 ====aaa====
9532 !! end
9533
9534 !! test
9535 Section extraction test (section 3)
9536 !! options
9537 section=3
9538 !! input
9539 start
9540 ==a==
9541 ===aa===
9542 ====aaa====
9543 ==b==
9544 ===ba===
9545 ===bb===
9546 ====bba====
9547 ===bc===
9548 ==c==
9549 ===ca===
9550 !! result
9551 ====aaa====
9552 !! end
9553
9554 !! test
9555 Section extraction test (section 4)
9556 !! options
9557 section=4
9558 !! input
9559 start
9560 ==a==
9561 ===aa===
9562 ====aaa====
9563 ==b==
9564 ===ba===
9565 ===bb===
9566 ====bba====
9567 ===bc===
9568 ==c==
9569 ===ca===
9570 !! result
9571 ==b==
9572 ===ba===
9573 ===bb===
9574 ====bba====
9575 ===bc===
9576 !! end
9577
9578 !! test
9579 Section extraction test (section 5)
9580 !! options
9581 section=5
9582 !! input
9583 start
9584 ==a==
9585 ===aa===
9586 ====aaa====
9587 ==b==
9588 ===ba===
9589 ===bb===
9590 ====bba====
9591 ===bc===
9592 ==c==
9593 ===ca===
9594 !! result
9595 ===ba===
9596 !! end
9597
9598 !! test
9599 Section extraction test (section 6)
9600 !! options
9601 section=6
9602 !! input
9603 start
9604 ==a==
9605 ===aa===
9606 ====aaa====
9607 ==b==
9608 ===ba===
9609 ===bb===
9610 ====bba====
9611 ===bc===
9612 ==c==
9613 ===ca===
9614 !! result
9615 ===bb===
9616 ====bba====
9617 !! end
9618
9619 !! test
9620 Section extraction test (section 7)
9621 !! options
9622 section=7
9623 !! input
9624 start
9625 ==a==
9626 ===aa===
9627 ====aaa====
9628 ==b==
9629 ===ba===
9630 ===bb===
9631 ====bba====
9632 ===bc===
9633 ==c==
9634 ===ca===
9635 !! result
9636 ====bba====
9637 !! end
9638
9639 !! test
9640 Section extraction test (section 8)
9641 !! options
9642 section=8
9643 !! input
9644 start
9645 ==a==
9646 ===aa===
9647 ====aaa====
9648 ==b==
9649 ===ba===
9650 ===bb===
9651 ====bba====
9652 ===bc===
9653 ==c==
9654 ===ca===
9655 !! result
9656 ===bc===
9657 !! end
9658
9659 !! test
9660 Section extraction test (section 9)
9661 !! options
9662 section=9
9663 !! input
9664 start
9665 ==a==
9666 ===aa===
9667 ====aaa====
9668 ==b==
9669 ===ba===
9670 ===bb===
9671 ====bba====
9672 ===bc===
9673 ==c==
9674 ===ca===
9675 !! result
9676 ==c==
9677 ===ca===
9678 !! end
9679
9680 !! test
9681 Section extraction test (section 10)
9682 !! options
9683 section=10
9684 !! input
9685 start
9686 ==a==
9687 ===aa===
9688 ====aaa====
9689 ==b==
9690 ===ba===
9691 ===bb===
9692 ====bba====
9693 ===bc===
9694 ==c==
9695 ===ca===
9696 !! result
9697 ===ca===
9698 !! end
9699
9700 !! test
9701 Section extraction test (nonexistent section 11)
9702 !! options
9703 section=11
9704 !! input
9705 start
9706 ==a==
9707 ===aa===
9708 ====aaa====
9709 ==b==
9710 ===ba===
9711 ===bb===
9712 ====bba====
9713 ===bc===
9714 ==c==
9715 ===ca===
9716 !! result
9717 !! end
9718
9719 !! test
9720 Section extraction test with bogus heading (section 1)
9721 !! options
9722 section=1
9723 !! input
9724 ==a==
9725 ==bogus== not a legal section
9726 ==b==
9727 !! result
9728 ==a==
9729 ==bogus== not a legal section
9730 !! end
9731
9732 !! test
9733 Section extraction test with bogus heading (section 2)
9734 !! options
9735 section=2
9736 !! input
9737 ==a==
9738 ==bogus== not a legal section
9739 ==b==
9740 !! result
9741 ==b==
9742 !! end
9743
9744 !! test
9745 Section extraction test with comment after heading (section 1)
9746 !! options
9747 section=1
9748 !! input
9749 ==a==
9750 ==b== <!-- -->
9751 ==c==
9752 !! result
9753 ==a==
9754 !! end
9755
9756 !! test
9757 Section extraction test with comment after heading (section 2)
9758 !! options
9759 section=2
9760 !! input
9761 ==a==
9762 ==b== <!-- -->
9763 ==c==
9764 !! result
9765 ==b== <!-- -->
9766 !! end
9767
9768 !! test
9769 Section extraction test with bogus <nowiki> heading (section 1)
9770 !! options
9771 section=1
9772 !! input
9773 ==a==
9774 ==bogus== <nowiki>not a legal section</nowiki>
9775 ==b==
9776 !! result
9777 ==a==
9778 ==bogus== <nowiki>not a legal section</nowiki>
9779 !! end
9780
9781 !! test
9782 Section extraction test with bogus <nowiki> heading (section 2)
9783 !! options
9784 section=2
9785 !! input
9786 ==a==
9787 ==bogus== <nowiki>not a legal section</nowiki>
9788 ==b==
9789 !! result
9790 ==b==
9791 !! end
9792
9793
9794 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9795 # instead of respecting commented sections
9796 !! test
9797 Section extraction prefixed by comment (section 1)
9798 !! options
9799 section=1
9800 !! input
9801 <!-- -->==sec1==
9802 ==sec2==
9803 !!result
9804 ==sec2==
9805 !!end
9806
9807 !! test
9808 Section extraction prefixed by comment (section 2)
9809 !! options
9810 section=2
9811 !! input
9812 <!-- -->==sec1==
9813 ==sec2==
9814 !!result
9815
9816 !!end
9817
9818
9819 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9820 # instead of respecting HTML-style headings
9821 !! test
9822 Section extraction, mixed wiki and html (section 1)
9823 !! options
9824 section=1
9825 !! input
9826 <h2>unmarked</h2>
9827 unmarked
9828 ==1==
9829 one
9830 ==2==
9831 two
9832 !! result
9833 ==1==
9834 one
9835 !! end
9836
9837 !! test
9838 Section extraction, mixed wiki and html (section 2)
9839 !! options
9840 section=2
9841 !! input
9842 <h2>unmarked</h2>
9843 unmarked
9844 ==1==
9845 one
9846 ==2==
9847 two
9848 !! result
9849 ==2==
9850 two
9851 !! end
9852
9853
9854 # Formerly testing for bug 3342
9855 !! test
9856 Section extraction, heading surrounded by <noinclude>
9857 !! options
9858 section=1
9859 !! input
9860 <noinclude>==unmarked==</noinclude>
9861 ==marked==
9862 !! result
9863 ==marked==
9864 !!end
9865
9866 # Test behavior of bug 19910
9867 !! test
9868 Sectiion with all-equals
9869 !! options
9870 section=2
9871 !! input
9872 ===
9873 The line above must have a trailing space
9874 === <!--
9875 --> <!-- -->
9876 But just in case it doesn't...
9877 !! result
9878 === <!--
9879 --> <!-- -->
9880 But just in case it doesn't...
9881 !! end
9882
9883 !! test
9884 Section replacement test (section 0)
9885 !! options
9886 replace=0,"xxx"
9887 !! input
9888 start
9889 ==a==
9890 ===aa===
9891 ====aaa====
9892 ==b==
9893 ===ba===
9894 ===bb===
9895 ====bba====
9896 ===bc===
9897 ==c==
9898 ===ca===
9899 !! result
9900 xxx
9901
9902 ==a==
9903 ===aa===
9904 ====aaa====
9905 ==b==
9906 ===ba===
9907 ===bb===
9908 ====bba====
9909 ===bc===
9910 ==c==
9911 ===ca===
9912 !! end
9913
9914 !! test
9915 Section replacement test (section 1)
9916 !! options
9917 replace=1,"xxx"
9918 !! input
9919 start
9920 ==a==
9921 ===aa===
9922 ====aaa====
9923 ==b==
9924 ===ba===
9925 ===bb===
9926 ====bba====
9927 ===bc===
9928 ==c==
9929 ===ca===
9930 !! result
9931 start
9932 xxx
9933
9934 ==b==
9935 ===ba===
9936 ===bb===
9937 ====bba====
9938 ===bc===
9939 ==c==
9940 ===ca===
9941 !! end
9942
9943 !! test
9944 Section replacement test (section 2)
9945 !! options
9946 replace=2,"xxx"
9947 !! input
9948 start
9949 ==a==
9950 ===aa===
9951 ====aaa====
9952 ==b==
9953 ===ba===
9954 ===bb===
9955 ====bba====
9956 ===bc===
9957 ==c==
9958 ===ca===
9959 !! result
9960 start
9961 ==a==
9962 xxx
9963
9964 ==b==
9965 ===ba===
9966 ===bb===
9967 ====bba====
9968 ===bc===
9969 ==c==
9970 ===ca===
9971 !! end
9972
9973 !! test
9974 Section replacement test (section 3)
9975 !! options
9976 replace=3,"xxx"
9977 !! input
9978 start
9979 ==a==
9980 ===aa===
9981 ====aaa====
9982 ==b==
9983 ===ba===
9984 ===bb===
9985 ====bba====
9986 ===bc===
9987 ==c==
9988 ===ca===
9989 !! result
9990 start
9991 ==a==
9992 ===aa===
9993 xxx
9994
9995 ==b==
9996 ===ba===
9997 ===bb===
9998 ====bba====
9999 ===bc===
10000 ==c==
10001 ===ca===
10002 !! end
10003
10004 !! test
10005 Section replacement test (section 4)
10006 !! options
10007 replace=4,"xxx"
10008 !! input
10009 start
10010 ==a==
10011 ===aa===
10012 ====aaa====
10013 ==b==
10014 ===ba===
10015 ===bb===
10016 ====bba====
10017 ===bc===
10018 ==c==
10019 ===ca===
10020 !! result
10021 start
10022 ==a==
10023 ===aa===
10024 ====aaa====
10025 xxx
10026
10027 ==c==
10028 ===ca===
10029 !! end
10030
10031 !! test
10032 Section replacement test (section 5)
10033 !! options
10034 replace=5,"xxx"
10035 !! input
10036 start
10037 ==a==
10038 ===aa===
10039 ====aaa====
10040 ==b==
10041 ===ba===
10042 ===bb===
10043 ====bba====
10044 ===bc===
10045 ==c==
10046 ===ca===
10047 !! result
10048 start
10049 ==a==
10050 ===aa===
10051 ====aaa====
10052 ==b==
10053 xxx
10054
10055 ===bb===
10056 ====bba====
10057 ===bc===
10058 ==c==
10059 ===ca===
10060 !! end
10061
10062 !! test
10063 Section replacement test (section 6)
10064 !! options
10065 replace=6,"xxx"
10066 !! input
10067 start
10068 ==a==
10069 ===aa===
10070 ====aaa====
10071 ==b==
10072 ===ba===
10073 ===bb===
10074 ====bba====
10075 ===bc===
10076 ==c==
10077 ===ca===
10078 !! result
10079 start
10080 ==a==
10081 ===aa===
10082 ====aaa====
10083 ==b==
10084 ===ba===
10085 xxx
10086
10087 ===bc===
10088 ==c==
10089 ===ca===
10090 !! end
10091
10092 !! test
10093 Section replacement test (section 7)
10094 !! options
10095 replace=7,"xxx"
10096 !! input
10097 start
10098 ==a==
10099 ===aa===
10100 ====aaa====
10101 ==b==
10102 ===ba===
10103 ===bb===
10104 ====bba====
10105 ===bc===
10106 ==c==
10107 ===ca===
10108 !! result
10109 start
10110 ==a==
10111 ===aa===
10112 ====aaa====
10113 ==b==
10114 ===ba===
10115 ===bb===
10116 xxx
10117
10118 ===bc===
10119 ==c==
10120 ===ca===
10121 !! end
10122
10123 !! test
10124 Section replacement test (section 8)
10125 !! options
10126 replace=8,"xxx"
10127 !! input
10128 start
10129 ==a==
10130 ===aa===
10131 ====aaa====
10132 ==b==
10133 ===ba===
10134 ===bb===
10135 ====bba====
10136 ===bc===
10137 ==c==
10138 ===ca===
10139 !! result
10140 start
10141 ==a==
10142 ===aa===
10143 ====aaa====
10144 ==b==
10145 ===ba===
10146 ===bb===
10147 ====bba====
10148 xxx
10149
10150 ==c==
10151 ===ca===
10152 !!end
10153
10154 !! test
10155 Section replacement test (section 9)
10156 !! options
10157 replace=9,"xxx"
10158 !! input
10159 start
10160 ==a==
10161 ===aa===
10162 ====aaa====
10163 ==b==
10164 ===ba===
10165 ===bb===
10166 ====bba====
10167 ===bc===
10168 ==c==
10169 ===ca===
10170 !! result
10171 start
10172 ==a==
10173 ===aa===
10174 ====aaa====
10175 ==b==
10176 ===ba===
10177 ===bb===
10178 ====bba====
10179 ===bc===
10180 xxx
10181 !! end
10182
10183 !! test
10184 Section replacement test (section 10)
10185 !! options
10186 replace=10,"xxx"
10187 !! input
10188 start
10189 ==a==
10190 ===aa===
10191 ====aaa====
10192 ==b==
10193 ===ba===
10194 ===bb===
10195 ====bba====
10196 ===bc===
10197 ==c==
10198 ===ca===
10199 !! result
10200 start
10201 ==a==
10202 ===aa===
10203 ====aaa====
10204 ==b==
10205 ===ba===
10206 ===bb===
10207 ====bba====
10208 ===bc===
10209 ==c==
10210 xxx
10211 !! end
10212
10213 !! test
10214 Section replacement test with initial whitespace (bug 13728)
10215 !! options
10216 replace=2,"xxx"
10217 !! input
10218 Preformatted initial line
10219 ==a==
10220 ===a===
10221 !! result
10222 Preformatted initial line
10223 ==a==
10224 xxx
10225 !! end
10226
10227
10228 !! test
10229 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10230 !! options
10231 section=1
10232 !! input
10233 ==a==
10234 a
10235 !! result
10236 ==a==
10237 a
10238 !! end
10239
10240 !! test
10241 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10242 !! options
10243 section=1
10244 !! input
10245 ==a==
10246 a
10247 !! result
10248 ==a==
10249 a
10250 !! end
10251
10252
10253 !! test
10254 Section extraction, <pre> around bogus header (bug 10309)
10255 !! options
10256 noxml section=2
10257 !! input
10258 == Section One ==
10259 <pre>
10260 =======
10261 </pre>
10262
10263 == Section Two ==
10264 stuff
10265 !! result
10266 == Section Two ==
10267 stuff
10268 !! end
10269
10270 !! test
10271 Section replacement, <pre> around bogus header (bug 10309)
10272 !! options
10273 noxml replace=2,"xxx"
10274 !! input
10275 == Section One ==
10276 <pre>
10277 =======
10278 </pre>
10279
10280 == Section Two ==
10281 stuff
10282 !! result
10283 == Section One ==
10284 <pre>
10285 =======
10286 </pre>
10287
10288 xxx
10289 !! end
10290
10291
10292
10293 !! test
10294 Handling of &#x0A; in URLs
10295 !! input
10296 **irc://&#x0A;a
10297 !! result
10298 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10299 </li></ul>
10300 </li></ul>
10301
10302 !!end
10303
10304 !! test
10305 5 quotes, code coverage +1 line
10306 !! input
10307 '''''
10308 !! result
10309 !! end
10310
10311 !! test
10312 Special:Search page linking.
10313 !! input
10314 {{Special:search}}
10315 !! result
10316 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10317 </p>
10318 !! end
10319
10320 !! test
10321 Say the magic word
10322 !! input
10323 * {{PAGENAME}}
10324 * {{BASEPAGENAME}}
10325 * {{SUBPAGENAME}}
10326 * {{SUBPAGENAMEE}}
10327 * {{BASEPAGENAME}}
10328 * {{BASEPAGENAMEE}}
10329 * {{TALKPAGENAME}}
10330 * {{TALKPAGENAMEE}}
10331 * {{SUBJECTPAGENAME}}
10332 * {{SUBJECTPAGENAMEE}}
10333 * {{NAMESPACEE}}
10334 * {{NAMESPACE}}
10335 * {{TALKSPACE}}
10336 * {{TALKSPACEE}}
10337 * {{SUBJECTSPACE}}
10338 * {{SUBJECTSPACEE}}
10339 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10340 !! result
10341 <ul><li> Parser test
10342 </li><li> Parser test
10343 </li><li> Parser test
10344 </li><li> Parser_test
10345 </li><li> Parser test
10346 </li><li> Parser_test
10347 </li><li> Talk:Parser test
10348 </li><li> Talk:Parser_test
10349 </li><li> Parser test
10350 </li><li> Parser_test
10351 </li><li>
10352 </li><li>
10353 </li><li> Talk
10354 </li><li> Talk
10355 </li><li>
10356 </li><li>
10357 </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>
10358 </li></ul>
10359
10360 !! end
10361 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10362
10363 !! test
10364 Gallery
10365 !! input
10366 <gallery>
10367 image1.png |
10368 image2.gif|||||
10369
10370 image3|
10371 image4 |300px| centre
10372 image5.svg| http://///////
10373 [[x|xx]]]]
10374 * image6
10375 </gallery>
10376 !! result
10377 <ul class="gallery">
10378 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10379 <div style="height: 150px;">Image1.png</div>
10380 <div class="gallerytext">
10381 </div>
10382 </div></li>
10383 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10384 <div style="height: 150px;">Image2.gif</div>
10385 <div class="gallerytext">
10386 <p>||||
10387 </p>
10388 </div>
10389 </div></li>
10390 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10391 <div style="height: 150px;">Image3</div>
10392 <div class="gallerytext">
10393 </div>
10394 </div></li>
10395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10396 <div style="height: 150px;">Image4</div>
10397 <div class="gallerytext">
10398 <p>300px| centre
10399 </p>
10400 </div>
10401 </div></li>
10402 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10403 <div style="height: 150px;">Image5.svg</div>
10404 <div class="gallerytext">
10405 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10406 </p>
10407 </div>
10408 </div></li>
10409 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10410 <div style="height: 150px;">* image6</div>
10411 <div class="gallerytext">
10412 </div>
10413 </div></li>
10414 </ul>
10415
10416 !! end
10417
10418 !! test
10419 Gallery (with options)
10420 !! input
10421 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10422 File:Nonexistant.jpg|caption
10423 File:Nonexistant.jpg
10424 image:foobar.jpg|some '''caption''' [[Main Page]]
10425 image:foobar.jpg
10426 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10427 </gallery>
10428 !! result
10429 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10430 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10431 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10432 <div style="height: 70px;">Nonexistant.jpg</div>
10433 <div class="gallerytext">
10434 <p>caption
10435 </p>
10436 </div>
10437 </div></li>
10438 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10439 <div style="height: 70px;">Nonexistant.jpg</div>
10440 <div class="gallerytext">
10441 </div>
10442 </div></li>
10443 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10444 <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>
10445 <div class="gallerytext">
10446 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10447 </p>
10448 </div>
10449 </div></li>
10450 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10451 <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>
10452 <div class="gallerytext">
10453 </div>
10454 </div></li>
10455 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10456 <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>
10457 <div class="gallerytext">
10458 <p>Blabla|blabla.
10459 </p>
10460 </div>
10461 </div></li>
10462 </ul>
10463
10464 !! end
10465
10466 !! test
10467 Gallery with wikitext inside caption
10468 !! input
10469 <gallery>
10470 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10471 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10472 </gallery>
10473 !! result
10474 <ul class="gallery">
10475 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10476 <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>
10477 <div class="gallerytext">
10478 <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>
10479 </p>
10480 </div>
10481 </div></li>
10482 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10483 <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>
10484 <div class="gallerytext">
10485 <p>This is a test template
10486 </p>
10487 </div>
10488 </div></li>
10489 </ul>
10490
10491 !! end
10492
10493 !! test
10494 gallery (with showfilename option)
10495 !! input
10496 <gallery showfilename>
10497 File:Nonexistant.jpg|caption
10498 File:Nonexistant.jpg
10499 image:foobar.jpg|some '''caption''' [[Main Page]]
10500 File:Foobar.jpg
10501 </gallery>
10502 !! result
10503 <ul class="gallery">
10504 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10505 <div style="height: 150px;">Nonexistant.jpg</div>
10506 <div class="gallerytext">
10507 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10508 caption
10509 </p>
10510 </div>
10511 </div></li>
10512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10513 <div style="height: 150px;">Nonexistant.jpg</div>
10514 <div class="gallerytext">
10515 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10516 </p>
10517 </div>
10518 </div></li>
10519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10520 <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>
10521 <div class="gallerytext">
10522 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10523 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10524 </p>
10525 </div>
10526 </div></li>
10527 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10528 <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>
10529 <div class="gallerytext">
10530 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10531 </p>
10532 </div>
10533 </div></li>
10534 </ul>
10535
10536 !! end
10537
10538 !! test
10539 Gallery (with namespace-less filenames)
10540 !! input
10541 <gallery>
10542 File:Nonexistant.jpg
10543 Nonexistant.jpg
10544 image:foobar.jpg
10545 foobar.jpg
10546 </gallery>
10547 !! result
10548 <ul class="gallery">
10549 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10550 <div style="height: 150px;">Nonexistant.jpg</div>
10551 <div class="gallerytext">
10552 </div>
10553 </div></li>
10554 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10555 <div style="height: 150px;">Nonexistant.jpg</div>
10556 <div class="gallerytext">
10557 </div>
10558 </div></li>
10559 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10560 <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>
10561 <div class="gallerytext">
10562 </div>
10563 </div></li>
10564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10565 <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>
10566 <div class="gallerytext">
10567 </div>
10568 </div></li>
10569 </ul>
10570
10571 !! end
10572
10573 !! test
10574 HTML Hex character encoding (spells the word "JavaScript")
10575 !! input
10576 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10577 !! result
10578 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10579 </p>
10580 !! end
10581
10582 !! test
10583 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10584 !! input
10585 &#xsee;&#XSEE;
10586 !! result
10587 <p>&amp;#xsee;&amp;#XSEE;
10588 </p>
10589 !! end
10590
10591 !! test
10592 HTML Hex character encoding mixed case
10593 !! input
10594 &#xEE;&#Xee;
10595 !! result
10596 <p>&#xee;&#xee;
10597 </p>
10598 !! end
10599
10600 !! test
10601 __FORCETOC__ override
10602 !! input
10603 __NEWSECTIONLINK__
10604 __FORCETOC__
10605 !! result
10606 <p><br />
10607 </p>
10608 !! end
10609
10610 !! test
10611 ISBN code coverage
10612 !! input
10613 ISBN 978-0-1234-56&#x20;789
10614 !! result
10615 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10616 </p>
10617 !! end
10618
10619 !! test
10620 ISBN followed by 5 spaces
10621 !! input
10622 ISBN
10623 !! result
10624 <p>ISBN
10625 </p>
10626 !! end
10627
10628 !! test
10629 Double ISBN
10630 !! input
10631 ISBN ISBN 1234567890
10632 !! result
10633 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10634 </p>
10635 !! end
10636
10637 !! test
10638 Bug 22905: <abbr> followed by ISBN followed by </a>
10639 !! input
10640 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10641 !! result
10642 <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>
10643 </p>
10644 !! end
10645
10646 !! test
10647 Double RFC
10648 !! input
10649 RFC RFC 1234
10650 !! result
10651 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10652 </p>
10653 !! end
10654
10655 !! test
10656 Double RFC with a wiki link
10657 !! input
10658 RFC [[RFC 1234]]
10659 !! result
10660 <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>
10661 </p>
10662 !! end
10663
10664 !! test
10665 RFC code coverage
10666 !! input
10667 RFC 983&#x20;987
10668 !! result
10669 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10670 </p>
10671 !! end
10672
10673 !! test
10674 Centre-aligned image
10675 !! input
10676 [[Image:foobar.jpg|centre]]
10677 !! result
10678 <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>
10679
10680 !!end
10681
10682 !! test
10683 None-aligned image
10684 !! input
10685 [[Image:foobar.jpg|none]]
10686 !! result
10687 <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>
10688
10689 !!end
10690
10691 !! test
10692 Width + Height sized image (using px) (height is ignored)
10693 !! input
10694 [[Image:foobar.jpg|640x480px]]
10695 !! result
10696 <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>
10697 </p>
10698 !!end
10699
10700 !! test
10701 Width-sized image (using px, no following whitespace)
10702 !! input
10703 [[Image:foobar.jpg|640px]]
10704 !! result
10705 <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>
10706 </p>
10707 !!end
10708
10709 !! test
10710 Width-sized image (using px, with following whitespace - test regression from r39467)
10711 !! input
10712 [[Image:foobar.jpg|640px ]]
10713 !! result
10714 <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>
10715 </p>
10716 !!end
10717
10718 !! test
10719 Width-sized image (using px, with preceding whitespace - test regression from r39467)
10720 !! input
10721 [[Image:foobar.jpg| 640px]]
10722 !! result
10723 <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>
10724 </p>
10725 !!end
10726
10727 !! test
10728 Another italics / bold test
10729 !! input
10730 ''' ''x'
10731 !! result
10732 <pre>'<i> </i>x'
10733 </pre>
10734 !!end
10735
10736 # Note the results may be incorrect, as parserTest output included this:
10737 # XML error: Mismatched tag at byte 6120:
10738 # ...<dd> </dt></dl> </dd...
10739 !! test
10740 dt/dd/dl test
10741 !! options
10742 disabled
10743 !! input
10744 :;;;::
10745 !! result
10746 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10747 </dd></dl>
10748 </dd></dl>
10749 </dt></dl>
10750 </dt></dl>
10751 </dt></dl>
10752 </dd></dl>
10753
10754 !!end
10755
10756
10757 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10758 !! test
10759 Images with the "|" character in the comment
10760 !! input
10761 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10762 !! result
10763 <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>
10764
10765 !!end
10766
10767 !! test
10768 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10769 !! input
10770 <html><script>alert(1);</script></html>
10771 !! result
10772 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10773 </p>
10774 !! end
10775
10776 !! test
10777 HTML with raw HTML ($wgRawHtml==true)
10778 !! options
10779 rawhtml
10780 !! input
10781 <html><script>alert(1);</script></html>
10782 !! result
10783 <p><script>alert(1);</script>
10784 </p>
10785 !! end
10786
10787 !! test
10788 Parents of subpages, one level up
10789 !! options
10790 subpage title=[[Subpage test/L1/L2/L3]]
10791 !! input
10792 [[../|L2]]
10793 !! result
10794 <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>
10795 </p>
10796 !! end
10797
10798
10799 !! test
10800 Parents of subpages, one level up, not named
10801 !! options
10802 subpage title=[[Subpage test/L1/L2/L3]]
10803 !! input
10804 [[../]]
10805 !! result
10806 <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>
10807 </p>
10808 !! end
10809
10810
10811
10812 !! test
10813 Parents of subpages, two levels up
10814 !! options
10815 subpage title=[[Subpage test/L1/L2/L3]]
10816 !! input
10817 [[../../|L1]]2
10818
10819 [[../../|L1]]l
10820 !! result
10821 <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
10822 </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>
10823 </p>
10824 !! end
10825
10826 !! test
10827 Parents of subpages, two levels up, without trailing slash or name.
10828 !! options
10829 subpage title=[[Subpage test/L1/L2/L3]]
10830 !! input
10831 [[../..]]
10832 !! result
10833 <p>[[../..]]
10834 </p>
10835 !! end
10836
10837 !! test
10838 Parents of subpages, two levels up, with lots of extra trailing slashes.
10839 !! options
10840 subpage title=[[Subpage test/L1/L2/L3]]
10841 !! input
10842 [[../../////]]
10843 !! result
10844 <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>
10845 </p>
10846 !! end
10847
10848 !! test
10849 Definition list code coverage
10850 !! input
10851 ; title : def
10852 ; title : def
10853 ;title: def
10854 !! result
10855 <dl><dt> title &#160;</dt><dd> def
10856 </dd><dt> title&#160;</dt><dd> def
10857 </dd><dt>title</dt><dd> def
10858 </dd></dl>
10859
10860 !! end
10861
10862 !! test
10863 Don't fall for the self-closing div
10864 !! input
10865 <div>hello world</div/>
10866 !! result
10867 <div>hello world</div>
10868
10869 !! end
10870
10871 !! test
10872 MSGNW magic word
10873 !! input
10874 {{MSGNW:msg}}
10875 !! result
10876 <p>&#91;&#91;:Template:Msg&#93;&#93;
10877 </p>
10878 !! end
10879
10880 !! test
10881 RAW magic word
10882 !! input
10883 {{RAW:QUERTY}}
10884 !! result
10885 <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>
10886 </p>
10887 !! end
10888
10889 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10890 !! test
10891 Always escape literal '>' in output, not just after '<'
10892 !! input
10893 ><>
10894 !! result
10895 <p>&gt;&lt;&gt;
10896 </p>
10897 !! end
10898
10899 !! test
10900 Template caching
10901 !! input
10902 {{Test}}
10903 {{Test}}
10904 !! result
10905 <p>This is a test template
10906 This is a test template
10907 </p>
10908 !! end
10909
10910
10911 !! article
10912 MediaWiki:Fake
10913 !! text
10914 ==header==
10915 !! endarticle
10916
10917 !! test
10918 Inclusion of !userCanEdit() content
10919 !! input
10920 {{MediaWiki:Fake}}
10921 !! result
10922 <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>
10923
10924 !! end
10925
10926
10927 !! test
10928 Out-of-order TOC heading levels
10929 !! input
10930 ==2==
10931 ======6======
10932 ===3===
10933 =1=
10934 =====5=====
10935 ==2==
10936 !! result
10937 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10938 <ul>
10939 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10940 <ul>
10941 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10942 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10943 </ul>
10944 </li>
10945 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10946 <ul>
10947 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10948 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10949 </ul>
10950 </li>
10951 </ul>
10952 </td></tr></table>
10953 <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>
10954 <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>
10955 <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>
10956 <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>
10957 <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>
10958 <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>
10959
10960 !! end
10961
10962
10963 !! test
10964 ISBN with a dummy number
10965 !! input
10966 ISBN ---
10967 !! result
10968 <p>ISBN ---
10969 </p>
10970 !! end
10971
10972
10973 !! test
10974 ISBN with space-delimited number
10975 !! input
10976 ISBN 92 9017 032 8
10977 !! result
10978 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10979 </p>
10980 !! end
10981
10982
10983 !! test
10984 ISBN with multiple spaces, no number
10985 !! input
10986 ISBN foo
10987 !! result
10988 <p>ISBN foo
10989 </p>
10990 !! end
10991
10992
10993 !! test
10994 ISBN length
10995 !! input
10996 ISBN 123456789
10997
10998 ISBN 1234567890
10999
11000 ISBN 12345678901
11001 !! result
11002 <p>ISBN 123456789
11003 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11004 </p><p>ISBN 12345678901
11005 </p>
11006 !! end
11007
11008
11009 !! test
11010 ISBN with trailing year (bug 8110)
11011 !! input
11012 ISBN 1-234-56789-0 - 2006
11013
11014 ISBN 1 234 56789 0 - 2006
11015 !! result
11016 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11017 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11018 </p>
11019 !! end
11020
11021
11022 !! test
11023 anchorencode
11024 !! input
11025 {{anchorencode:foo bar©#%n}}
11026 !! result
11027 <p>foo_bar.C2.A9.23.25n
11028 </p>
11029 !! end
11030
11031 !! test
11032 anchorencode trims spaces
11033 !! input
11034 {{anchorencode: __pretty__please__}}
11035 !! result
11036 <p>pretty_please
11037 </p>
11038 !! end
11039
11040 !! test
11041 anchorencode deals with links
11042 !! input
11043 {{anchorencode: [[hello|world]] [[hi]]}}
11044 !! result
11045 <p>world_hi
11046 </p>
11047 !! end
11048
11049 !! test
11050 anchorencode deals with templates
11051 !! input
11052 {{anchorencode: {{Foo}} }}
11053 !! result
11054 <p>FOO
11055 </p>
11056 !! end
11057
11058 !! test
11059 anchorencode encodes like the TOC generator: (bug 18431)
11060 !! input
11061 === _ +:.3A%3A&&amp;]] ===
11062 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11063 __NOEDITSECTION__
11064 !! result
11065 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
11066 <p>.2B:.3A.253A.26.26.5D.5D
11067 </p>
11068 !! end
11069
11070 # Expected output in the following test is not necessarily expected (there
11071 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11072 # only testing for well-formedness.
11073 !! test
11074 Bug 6200: blockquotes and paragraph formatting
11075 !! input
11076 <blockquote>
11077 foo
11078 </blockquote>
11079
11080 bar
11081
11082 baz
11083 !! result
11084 <blockquote>
11085 foo
11086 </blockquote>
11087 <p>bar
11088 </p>
11089 <pre>baz
11090 </pre>
11091 !! end
11092
11093 !! test
11094 Bug 8293: Use of center tag ruins paragraph formatting
11095 !! input
11096 <center>
11097 foo
11098 </center>
11099
11100 bar
11101
11102 baz
11103 !! result
11104 <center>
11105 <p>foo
11106 </p>
11107 </center>
11108 <p>bar
11109 </p>
11110 <pre>baz
11111 </pre>
11112 !! end
11113
11114
11115 ###
11116 ### Language variants related tests
11117 ###
11118 !! test
11119 Self-link in language variants
11120 !! options
11121 title=[[Dunav]] language=sr
11122 !! input
11123 Both [[Dunav]] and [[Дунав]] are names for this river.
11124 !! result
11125 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11126 </p>
11127 !!end
11128
11129 !! article
11130 Дуна
11131 !! text
11132 content
11133 !! endarticle
11134
11135 !! test
11136 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11137 !! options
11138 title=[[Duna]] language=sr
11139 !! input
11140 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11141 !! result
11142 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
11143 </p>
11144 !! end
11145
11146 !! test
11147 Link to pages in language variants
11148 !! options
11149 language=sr
11150 !! input
11151 Main Page can be written as [[Маин Паге]]
11152 !! result
11153 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11154 </p>
11155 !!end
11156
11157
11158 !! test
11159 Multiple links to pages in language variants
11160 !! options
11161 language=sr
11162 !! input
11163 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11164 !! result
11165 <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>.
11166 </p>
11167 !!end
11168
11169
11170 !! test
11171 Simple template in language variants
11172 !! options
11173 language=sr
11174 !! input
11175 {{тест}}
11176 !! result
11177 <p>This is a test template
11178 </p>
11179 !! end
11180
11181
11182 !! test
11183 Template with explicit namespace in language variants
11184 !! options
11185 language=sr
11186 !! input
11187 {{Template:тест}}
11188 !! result
11189 <p>This is a test template
11190 </p>
11191 !! end
11192
11193
11194 !! test
11195 Basic test for template parameter in language variants
11196 !! options
11197 language=sr
11198 !! input
11199 {{парамтест|param=foo}}
11200 !! result
11201 <p>This is a test template with parameter foo
11202 </p>
11203 !! end
11204
11205
11206 !! test
11207 Simple category in language variants
11208 !! options
11209 language=sr cat
11210 !! input
11211 [[Category:МедиаWики Усер'с Гуиде]]
11212 !! result
11213 <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>
11214 !! end
11215
11216
11217 !! article
11218 Category:分类
11219 !! text
11220 blah
11221 !! endarticle
11222
11223 !! article
11224 Category:分類
11225 !! text
11226 blah
11227 !! endarticle
11228
11229 !! test
11230 Don't convert blue categorylinks to another variant (bug 33210)
11231 !! options
11232 language=zh cat
11233 !! input
11234 [[A]][[Category:分类]]
11235 !! result
11236 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11237 !! end
11238
11239
11240 !! test
11241 Stripping -{}- tags (language variants)
11242 !! options
11243 language=sr
11244 !! input
11245 Latin proverb: -{Ne nuntium necare}-
11246 !! result
11247 <p>Latin proverb: Ne nuntium necare
11248 </p>
11249 !! end
11250
11251
11252 !! test
11253 Prevent conversion with -{}- tags (language variants)
11254 !! options
11255 language=sr variant=sr-ec
11256 !! input
11257 Latinski: -{Ne nuntium necare}-
11258 !! result
11259 <p>Латински: Ne nuntium necare
11260 </p>
11261 !! end
11262
11263
11264 !! test
11265 Prevent conversion of text with -{}- tags (language variants)
11266 !! options
11267 language=sr variant=sr-ec
11268 !! input
11269 Latinski: -{Ne nuntium necare}-
11270 !! result
11271 <p>Латински: Ne nuntium necare
11272 </p>
11273 !! end
11274
11275
11276 !! test
11277 Prevent conversion of links with -{}- tags (language variants)
11278 !! options
11279 language=sr variant=sr-ec
11280 !! input
11281 -{[[Main Page]]}-
11282 !! result
11283 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11284 </p>
11285 !! end
11286
11287
11288 !! test
11289 -{}- tags within headlines (within html for parserConvert())
11290 !! options
11291 language=sr variant=sr-ec
11292 !! input
11293 == -{Naslov}- ==
11294 !! result
11295 <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>
11296
11297 !! end
11298
11299
11300 !! test
11301 Explicit definition of language variant alternatives
11302 !! options
11303 language=zh variant=zh-tw
11304 !! input
11305 -{zh:China;zh-tw:Taiwan}-, not China
11306 !! result
11307 <p>Taiwan, not China
11308 </p>
11309 !! end
11310
11311
11312 !! test
11313 Conversion around HTML tags
11314 !! options
11315 language=sr variant=sr-ec
11316 !! input
11317 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11318 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11319 !! result
11320 <p>
11321 <span title="ЛаCтин">ски</span>
11322 </p>
11323 !! end
11324
11325
11326 !! test
11327 Explicit session-wise language variant mapping (A flag and - flag)
11328 !! options
11329 language=zh variant=zh-tw
11330 !! input
11331 Taiwan is not China.
11332 But -{A|zh:China;zh-tw:Taiwan}- is China,
11333 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11334 and -{China}- is China.
11335 !! result
11336 <p>Taiwan is not China.
11337 But Taiwan is Taiwan,
11338 (This should be stripped!)
11339 and China is China.
11340 </p>
11341 !! end
11342
11343 !! test
11344 Explicit session-wise language variant mapping (H flag for hide)
11345 !! options
11346 language=zh variant=zh-tw
11347 !! input
11348 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11349 Taiwan is China.
11350 !! result
11351 <p>(This should be stripped!)
11352 Taiwan is Taiwan.
11353 </p>
11354 !! end
11355
11356 !! test
11357 Adding explicit conversion rule for title (T flag)
11358 !! options
11359 language=zh variant=zh-tw showtitle
11360 !! input
11361 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11362 !! result
11363 Taiwan
11364 <p>Should be stripped!
11365 </p>
11366 !! end
11367
11368 !! test
11369 Testing that changing the language variant here in the tests actually works
11370 !! options
11371 language=zh variant=zh showtitle
11372 !! input
11373 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11374 !! result
11375 China
11376 <p>Should be stripped!
11377 </p>
11378 !! end
11379
11380 !! test
11381 Recursive conversion of alt and title attrs shouldn't clear converter state
11382 !! options
11383 language=zh variant=zh-cn showtitle
11384 !! input
11385 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11386 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11387 !! result
11388 China
11389 <p>
11390 Should be stripped<span title="Exclamation">!</span>
11391 </p>
11392 !! end
11393
11394 !! test
11395 Bug 24072: more test on conversion rule for title
11396 !! options
11397 language=zh variant=zh-tw showtitle
11398 !! input
11399 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11400 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11401 !! result
11402 Taiwan
11403 <p>This should be stripped!
11404 This won't take interferes with the title rule.
11405 </p>
11406 !! end
11407
11408 !! test
11409 Raw output of variant escape tags (R flag)
11410 !! options
11411 language=zh variant=zh-tw
11412 !! input
11413 Raw: -{R|zh:China;zh-tw:Taiwan}-
11414 !! result
11415 <p>Raw: zh:China;zh-tw:Taiwan
11416 </p>
11417 !! end
11418
11419 !! test
11420 Nested using of manual convert syntax
11421 !! options
11422 language=zh variant=zh-hk
11423 !! input
11424 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11425 !! result
11426 <p>Nested: Hello Hong Kong!
11427 </p>
11428 !! end
11429
11430 !! test
11431 Proper conversion of text in external links
11432 !! options
11433 language=sr variant=sr-ec
11434 !! input
11435 http://www.google.com
11436 gopher://www.google.com
11437 [http://www.google.com http://www.google.com]
11438 [gopher://www.google.com gopher://www.google.com]
11439 [https://www.google.com irc://www.google.com]
11440 [ftp://www.google.com www.google.com/ftp://dir]
11441 [//www.google.com www.google.com]
11442 !! result
11443 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11444 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11445 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11446 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11447 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11448 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11449 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11450 </p>
11451 !! end
11452
11453 !! test
11454 Do not convert roman numbers to language variants
11455 !! options
11456 language=sr variant=sr-ec
11457 !! input
11458 Fridrih IV je car.
11459 !! result
11460 <p>Фридрих IV је цар.
11461 </p>
11462 !! end
11463
11464 !! test
11465 Unclosed language converter markup "-{"
11466 !! options
11467 language=sr
11468 !! input
11469 -{T|hello
11470 !! result
11471 <p>-{T|hello
11472 </p>
11473 !! end
11474
11475 !! test
11476 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11477 !! options
11478 language=sr
11479 !! input
11480 -{R|=&gt;}-
11481 !! result
11482 <p>=&gt;
11483 </p>
11484 !!end
11485
11486 !!article
11487 Template:Bullet
11488 !!text
11489 * Bar
11490 !!endarticle
11491
11492 !! test
11493 Bug 529: Uncovered bullet
11494 !! input
11495 * Foo {{bullet}}
11496 !! result
11497 <ul><li> Foo
11498 </li><li> Bar
11499 </li></ul>
11500
11501 !! end
11502
11503 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11504 # Templates in Wikipedia rely on this behavior, as tidy has always been
11505 # enabled there. These tests are normally run *without* tidy, so specify the
11506 # full output here.
11507 # To test realistic parsing behavior, apply a tidy-like transformation to both
11508 # the expected output and your parser's output.
11509 !! test
11510 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11511 !! input
11512 ******* Foo {{bullet}}
11513 !! result
11514 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11515 </li></ul>
11516 </li></ul>
11517 </li></ul>
11518 </li></ul>
11519 </li></ul>
11520 </li></ul>
11521 </li><li> Bar
11522 </li></ul>
11523
11524 !! end
11525
11526 !! test
11527 Bug 529: Uncovered table already at line-start
11528 !! input
11529 x
11530
11531 {{table}}
11532 y
11533 !! result
11534 <p>x
11535 </p>
11536 <table>
11537 <tr>
11538 <td> 1 </td>
11539 <td> 2
11540 </td></tr>
11541 <tr>
11542 <td> 3 </td>
11543 <td> 4
11544 </td></tr></table>
11545 <p>y
11546 </p>
11547 !! end
11548
11549 !! test
11550 Bug 529: Uncovered bullet in parser function result
11551 !! input
11552 * Foo {{lc:{{bullet}} }}
11553 !! result
11554 <ul><li> Foo
11555 </li><li> bar
11556 </li></ul>
11557
11558 !! end
11559
11560 !! test
11561 Bug 5678: Double-parsed template argument
11562 !! input
11563 {{lc:{{{1}}}|hello}}
11564 !! result
11565 <p>{{{1}}}
11566 </p>
11567 !! end
11568
11569 !! test
11570 Bug 5678: Double-parsed template invocation
11571 !! input
11572 {{lc:{{paramtest {{!}} param = hello }} }}
11573 !! result
11574 <p>{{paramtest | param = hello }}
11575 </p>
11576 !! end
11577
11578 !! test
11579 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11580 !! options
11581 language=cs
11582 title=[[Main Page]]
11583 !! input
11584 {{PRVNÍVELKÉ:ěščř}}
11585 {{prvnívelké:ěščř}}
11586 {{PRVNÍMALÉ:ěščř}}
11587 {{prvnímalé:ěščř}}
11588 {{MALÁ:ěščř}}
11589 {{malá:ěščř}}
11590 {{VELKÁ:ěščř}}
11591 {{velká:ěščř}}
11592 !! result
11593 <p>Ěščř
11594 Ěščř
11595 ěščř
11596 ěščř
11597 ěščř
11598 ěščř
11599 ĚŠČŘ
11600 ĚŠČŘ
11601 </p>
11602 !! end
11603
11604 !! test
11605 Morwen/13: Unclosed link followed by heading
11606 !! input
11607 [[link
11608 ==heading==
11609 !! result
11610 <p>[[link
11611 </p>
11612 <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>
11613
11614 !! end
11615
11616 !! test
11617 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11618 !! input
11619 {{foo|
11620 =heading=
11621 !! result
11622 <p>{{foo|
11623 </p>
11624 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11625
11626 !! end
11627
11628 !! test
11629 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11630 !! input
11631 {{foo|
11632 ==heading==
11633 !! result
11634 <p>{{foo|
11635 </p>
11636 <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>
11637
11638 !! end
11639
11640 !! test
11641 Tildes in comments
11642 !! options
11643 pst
11644 !! input
11645 <!-- ~~~~ -->
11646 !! result
11647 <!-- ~~~~ -->
11648 !! end
11649
11650 !! test
11651 Paragraphs inside divs (no extra line breaks)
11652 !! input
11653 <div>Line one
11654
11655 Line two</div>
11656 !! result
11657 <div>Line one
11658 Line two</div>
11659
11660 !! end
11661
11662 !! test
11663 Paragraphs inside divs (extra line break on open)
11664 !! input
11665 <div>
11666 Line one
11667
11668 Line two</div>
11669 !! result
11670 <div>
11671 <p>Line one
11672 </p>
11673 Line two</div>
11674
11675 !! end
11676
11677 !! test
11678 Paragraphs inside divs (extra line break on close)
11679 !! input
11680 <div>Line one
11681
11682 Line two
11683 </div>
11684 !! result
11685 <div>Line one
11686 <p>Line two
11687 </p>
11688 </div>
11689
11690 !! end
11691
11692 !! test
11693 Paragraphs inside divs (extra line break on open and close)
11694 !! input
11695 <div>
11696 Line one
11697
11698 Line two
11699 </div>
11700 !! result
11701 <div>
11702 <p>Line one
11703 </p><p>Line two
11704 </p>
11705 </div>
11706
11707 !! end
11708
11709 !! test
11710 Nesting tags, paragraphs on lines which begin with <div>
11711 !! options
11712 disabled
11713 !! input
11714 <div></div><strong>A
11715 B</strong>
11716 !! result
11717 <div></div>
11718 <p><strong>A
11719 B</strong>
11720 </p>
11721 !! end
11722
11723 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11724 !! test
11725 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11726 !! options
11727 disabled
11728 !! input
11729 <blockquote>Line one
11730
11731 Line two</blockquote>
11732 !! result
11733 <blockquote>Line one
11734 Line two</blockquote>
11735
11736 !! end
11737
11738 !! test
11739 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11740 !! options
11741 disabled
11742 !! input
11743 <blockquote>
11744 Line one
11745
11746 Line two</blockquote>
11747 !! result
11748 <blockquote>
11749 <p>Line one
11750 </p>
11751 Line two</blockquote>
11752
11753 !! end
11754
11755 !! test
11756 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11757 !! options
11758 disabled
11759 !! input
11760 <blockquote>Line one
11761
11762 Line two
11763 </blockquote>
11764 !! result
11765 <blockquote>Line one
11766 <p>Line two
11767 </p>
11768 </blockquote>
11769
11770 !! end
11771
11772 !! test
11773 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11774 !! options
11775 disabled
11776 !! input
11777 <blockquote>
11778 Line one
11779
11780 Line two
11781 </blockquote>
11782 !! result
11783 <blockquote>
11784 <p>Line one
11785 </p><p>Line two
11786 </p>
11787 </blockquote>
11788
11789 !! end
11790
11791 !! test
11792 Paragraphs inside blockquotes/divs (no extra line breaks)
11793 !! input
11794 <blockquote><div>Line one
11795
11796 Line two</div></blockquote>
11797 !! result
11798 <blockquote><div>Line one
11799 Line two</div></blockquote>
11800
11801 !! end
11802
11803 !! test
11804 Paragraphs inside blockquotes/divs (extra line break on open)
11805 !! input
11806 <blockquote><div>
11807 Line one
11808
11809 Line two</div></blockquote>
11810 !! result
11811 <blockquote><div>
11812 <p>Line one
11813 </p>
11814 Line two</div></blockquote>
11815
11816 !! end
11817
11818 !! test
11819 Paragraphs inside blockquotes/divs (extra line break on close)
11820 !! input
11821 <blockquote><div>Line one
11822
11823 Line two
11824 </div></blockquote>
11825 !! result
11826 <blockquote><div>Line one
11827 <p>Line two
11828 </p>
11829 </div></blockquote>
11830
11831 !! end
11832
11833 !! test
11834 Paragraphs inside blockquotes/divs (extra line break on open and close)
11835 !! input
11836 <blockquote><div>
11837 Line one
11838
11839 Line two
11840 </div></blockquote>
11841 !! result
11842 <blockquote><div>
11843 <p>Line one
11844 </p><p>Line two
11845 </p>
11846 </div></blockquote>
11847
11848 !! end
11849
11850 !! test
11851 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11852 !! options
11853 wgLinkHolderBatchSize=0
11854 !! input
11855 [[meatball:1]]
11856 [[meatball:2]]
11857 [[meatball:3]]
11858 !! result
11859 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11860 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11861 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11862 </p>
11863 !! end
11864
11865 !! test
11866 Free external link invading image caption
11867 !! input
11868 [[Image:Foobar.jpg|thumb|http://x|hello]]
11869 !! result
11870 <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>
11871
11872 !! end
11873
11874 !! test
11875 Bug 15196: localised external link numbers
11876 !! options
11877 language=fa
11878 !! input
11879 [http://en.wikipedia.org/]
11880 !! result
11881 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11882 </p>
11883 !! end
11884
11885 !! test
11886 Multibyte character in padleft
11887 !! input
11888 {{padleft:-Hello|7|Æ}}
11889 !! result
11890 <p>Æ-Hello
11891 </p>
11892 !! end
11893
11894 !! test
11895 Multibyte character in padright
11896 !! input
11897 {{padright:Hello-|7|Æ}}
11898 !! result
11899 <p>Hello-Æ
11900 </p>
11901 !! end
11902
11903 !!test
11904 formatdate parser function
11905 !!input
11906 {{#formatdate:2009-03-24}}
11907 !! result
11908 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11909 </p>
11910 !! end
11911
11912 !!test
11913 formatdate parser function, with default format
11914 !!input
11915 {{#formatdate:2009-03-24|mdy}}
11916 !! result
11917 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11918 </p>
11919 !! end
11920
11921 !! test
11922 Spacing of numbers in formatted dates
11923 !! input
11924 {{#formatdate:January 15}}
11925 !! result
11926 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11927 </p>
11928 !! end
11929
11930 !! test
11931 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
11932 !! options
11933 language=nl title=[[MediaWiki:Common.css]]
11934 !! input
11935 {{#formatdate:2009-03-24|dmy}}
11936 !! result
11937 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11938 </p>
11939 !! end
11940
11941 #
11942 #
11943 #
11944
11945 #
11946 # Edit comments
11947 #
11948
11949 !! test
11950 Edit comment with link
11951 !! options
11952 comment
11953 !! input
11954 I like the [[Main Page]] a lot
11955 !! result
11956 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11957 !!end
11958
11959 !! test
11960 Edit comment with link and link text
11961 !! options
11962 comment
11963 !! input
11964 I like the [[Main Page|best pages]] a lot
11965 !! result
11966 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11967 !!end
11968
11969 !! test
11970 Edit comment with link and link text with suffix
11971 !! options
11972 comment
11973 !! input
11974 I like the [[Main Page|best page]]s a lot
11975 !! result
11976 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11977 !!end
11978
11979 !! test
11980 Edit comment with section link (non-local, eg in history list)
11981 !! options
11982 comment title=[[Main Page]]
11983 !! input
11984 /* External links */ removed bogus entries
11985 !! result
11986 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11987 !!end
11988
11989 !! test
11990 Edit comment with section link and text before it (non-local, eg in history list)
11991 !! options
11992 comment title=[[Main Page]]
11993 !! input
11994 pre-comment text /* External links */ removed bogus entries
11995 !! result
11996 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>
11997 !!end
11998
11999 !! test
12000 Edit comment with section link (local, eg in diff view)
12001 !! options
12002 comment local title=[[Main Page]]
12003 !! input
12004 /* External links */ removed bogus entries
12005 !! result
12006 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12007 !!end
12008
12009 !! test
12010 Edit comment with subpage link (bug 14080)
12011 !! options
12012 comment
12013 subpage
12014 title=[[Subpage test]]
12015 !! input
12016 Poked at a [[/subpage]] here...
12017 !! result
12018 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12019 !!end
12020
12021 !! test
12022 Edit comment with subpage link and link text (bug 14080)
12023 !! options
12024 comment
12025 subpage
12026 title=[[Subpage test]]
12027 !! input
12028 Poked at a [[/subpage|neat little page]] here...
12029 !! result
12030 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12031 !!end
12032
12033 !! test
12034 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12035 !! options
12036 comment
12037 title=[[Subpage test]]
12038 !! input
12039 Poked at a [[/subpage]] here...
12040 !! result
12041 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...
12042 !!end
12043
12044 !! test
12045 Edit comment with bare anchor link (local, as on diff)
12046 !! options
12047 comment
12048 local
12049 title=[[Main Page]]
12050 !!input
12051 [[#section]]
12052 !! result
12053 <a href="#section">#section</a>
12054 !! end
12055
12056 !! test
12057 Edit comment with bare anchor link (non-local, as on history)
12058 !! options
12059 comment
12060 title=[[Main Page]]
12061 !!input
12062 [[#section]]
12063 !! result
12064 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12065 !! end
12066
12067 !! test
12068 Anchor starting with underscore
12069 !!input
12070 [[#_ref|One]]
12071 !! result
12072 <p><a href="#_ref">One</a>
12073 </p>
12074 !! end
12075
12076 !! test
12077 Id starting with underscore
12078 !!input
12079 <div id="_ref"></div>
12080 !! result
12081 <div id="_ref"></div>
12082
12083 !! end
12084
12085 !! test
12086 Space normalisation on autocomment (bug 22784)
12087 !! options
12088 comment
12089 title=[[Main Page]]
12090 !!input
12091 /* __hello__world__ */
12092 !! result
12093 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12094 !! end
12095
12096 !! test
12097 percent-encoding and + signs in comments (Bug 26410)
12098 !! options
12099 comment
12100 !!input
12101 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12102 !! result
12103 <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>
12104 !! end
12105
12106 !! test
12107 Bad images - basic functionality
12108 !! options
12109 disabled
12110 !! input
12111 [[File:Bad.jpg]]
12112 !! result
12113 !! end
12114
12115 !! test
12116 Bad images - bug 16039: text after bad image disappears
12117 !! options
12118 disabled
12119 !! input
12120 Foo bar
12121 [[File:Bad.jpg]]
12122 Bar foo
12123 !! result
12124 <p>Foo bar
12125 </p><p>Bar foo
12126 </p>
12127 !! end
12128
12129 !! test
12130 Verify that displaytitle works (bug #22501) no displaytitle
12131 !! options
12132 showtitle
12133 !! config
12134 wgAllowDisplayTitle=true
12135 wgRestrictDisplayTitle=false
12136 !! input
12137 this is not the the title
12138 !! result
12139 Parser test
12140 <p>this is not the the title
12141 </p>
12142 !! end
12143
12144 !! test
12145 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12146 !! options
12147 showtitle
12148 title=[[Screen]]
12149 !! config
12150 wgAllowDisplayTitle=true
12151 wgRestrictDisplayTitle=false
12152 !! input
12153 this is not the the title
12154 {{DISPLAYTITLE:whatever}}
12155 !! result
12156 whatever
12157 <p>this is not the the title
12158 </p>
12159 !! end
12160
12161 !! test
12162 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12163 !! options
12164 showtitle
12165 title=[[Screen]]
12166 !! config
12167 wgAllowDisplayTitle=true
12168 wgRestrictDisplayTitle=true
12169 !! input
12170 this is not the the title
12171 {{DISPLAYTITLE:whatever}}
12172 !! result
12173 Screen
12174 <p>this is not the the title
12175 </p>
12176 !! end
12177
12178 !! test
12179 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12180 !! options
12181 showtitle
12182 title=[[Screen]]
12183 !! config
12184 wgAllowDisplayTitle=true
12185 wgRestrictDisplayTitle=true
12186 !! input
12187 this is not the the title
12188 {{DISPLAYTITLE:screen}}
12189 !! result
12190 screen
12191 <p>this is not the the title
12192 </p>
12193 !! end
12194
12195 !! test
12196 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12197 !! options
12198 showtitle
12199 title=[[Screen]]
12200 !! config
12201 wgAllowDisplayTitle=false
12202 !! input
12203 this is not the the title
12204 {{DISPLAYTITLE:screen}}
12205 !! result
12206 Screen
12207 <p>this is not the the title
12208 <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>
12209 </p>
12210 !! end
12211
12212 !! test
12213 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12214 !! options
12215 showtitle
12216 title=[[Screen]]
12217 !! config
12218 wgAllowDisplayTitle=false
12219 !! input
12220 this is not the the title
12221 !! result
12222 Screen
12223 <p>this is not the the title
12224 </p>
12225 !! end
12226
12227 !! test
12228 preload: check <noinclude> and <includeonly>
12229 !! options
12230 preload
12231 !! input
12232 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12233 !! result
12234 Hello kind world.
12235 !! end
12236
12237 !! test
12238 preload: check <onlyinclude>
12239 !! options
12240 preload
12241 !! input
12242 Goodbye <onlyinclude>Hello world</onlyinclude>
12243 !! result
12244 Hello world
12245 !! end
12246
12247 !! test
12248 preload: can pass tags through if we want to
12249 !! options
12250 preload
12251 !! input
12252 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12253 !! result
12254 <includeonly>Hello world</includeonly>
12255 !! end
12256
12257 !! test
12258 preload: check that it doesn't try to do tricks
12259 !! options
12260 preload
12261 !! input
12262 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12263 !! result
12264 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12265 !! end
12266
12267 !! test
12268 Play a bit with r67090 and bug 3158
12269 !! options
12270 disabled
12271 !! input
12272 <div style="width:50% !important">&nbsp;</div>
12273 <div style="width:50%&nbsp;!important">&nbsp;</div>
12274 <div style="width:50%&#160;!important">&nbsp;</div>
12275 <div style="border : solid;">&nbsp;</div>
12276 !! result
12277 <div style="width:50% !important">&nbsp;</div>
12278 <div style="width:50% !important">&nbsp;</div>
12279 <div style="width:50% !important">&nbsp;</div>
12280 <div style="border&#160;: solid;">&nbsp;</div>
12281
12282 !! end
12283
12284 !! test
12285 HTML5 data attributes
12286 !! input
12287 <span data-foo="bar">Baz</span>
12288 <p data-abc-def_hij="">Quuz</p>
12289 !! result
12290 <p><span data-foo="bar">Baz</span>
12291 </p>
12292 <p data-abc-def_hij="">Quuz</p>
12293
12294 !! end
12295
12296 !! test
12297 percent-encoding and + signs in internal links (Bug 26410)
12298 !! input
12299 [[User:+%]] [[Page+title%]]
12300 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12301 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12302 [[%33%45]] [[%33%45+]]
12303 !! result
12304 <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>
12305 <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>
12306 <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>
12307 <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>
12308 </p>
12309 !! end
12310
12311 !! test
12312 Special characters in embedded file links (bug 27679)
12313 !! input
12314 [[File:Contains & ampersand.jpg]]
12315 [[File:Does not exist.jpg|Title with & ampersand]]
12316 !! result
12317 <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>
12318 <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>
12319 </p>
12320 !! end
12321
12322
12323 !! test
12324 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12325 !! input
12326 Text&apos;s been normalized?
12327 !! result
12328 <p>Text&#39;s been normalized?
12329 </p>
12330 !! end
12331
12332 !! test
12333 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12334 !! input
12335 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12336 !! result
12337 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12338 </p>
12339 !! end
12340
12341 !! test
12342 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12343 !! input
12344 [http://www.example.org/ ideograms]
12345 !! result
12346 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12347 </p>
12348 !! end
12349
12350 !! test
12351 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12352 !! input
12353 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12354 !! result
12355 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12356 </p>
12357 !! end
12358
12359 !! article
12360 Mediawiki:loop1
12361 !! text
12362 {{Identical|A}}
12363 !! endarticle
12364
12365 !! article
12366 Mediawiki:loop2
12367 !! text
12368 {{Identical|B}}
12369 !! endarticle
12370
12371 !! article
12372 Template:Identical
12373 !! text
12374 {{int:loop1}}
12375 {{int:loop2}}
12376 !! endarticle
12377
12378 !! test
12379 Bug 31098 Template which includes system messages which includes the template
12380 !! input
12381 {{Identical}}
12382 !! result
12383 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12384 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12385 </p>
12386 !! end
12387
12388 !! test
12389 Bug31490 Turkish: ucfirst 'blah'
12390 !! options
12391 language=tr
12392 !! input
12393 {{ucfirst:blah}}
12394 !! result
12395 <p>Blah
12396 </p>
12397 !! end
12398
12399 !! test
12400 Bug31490 Turkish: ucfirst 'ix'
12401 !! options
12402 language=tr
12403 !! input
12404 {{ucfirst:ix}}
12405 !! result
12406 <p>İx
12407 </p>
12408 !! end
12409
12410 !! test
12411 Bug31490 Turkish: lcfirst 'BLAH'
12412 !! options
12413 language=tr
12414 !! input
12415 {{lcfirst:BLAH}}
12416 !! result
12417 <p>bLAH
12418 </p>
12419 !! end
12420
12421 !! test
12422 Bug31490 Turkish: ucfırst (with a dotless i)
12423 !! options
12424 language=tr
12425 !! input
12426 {{ucfırst:blah}}
12427 !! result
12428 <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>
12429 </p>
12430 !! end
12431
12432 !! test
12433 Bug31490 ucfırst (with a dotless i) with English language
12434 !! options
12435 language=en
12436 !! input
12437 {{ucfırst:blah}}
12438 !! result
12439 <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>
12440 </p>
12441 !! end
12442
12443 !! test
12444 Bug 26375: TOC with italics
12445 !! options
12446 title=[[Main Page]]
12447 !! input
12448 __TOC__
12449 == ''Lost'' episodes ==
12450 !! result
12451 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12452 <ul>
12453 <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>
12454 </ul>
12455 </td></tr></table>
12456 <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>
12457
12458 !! end
12459
12460 !! test
12461 Bug 26375: TOC with bold
12462 !! options
12463 title=[[Main Page]]
12464 !! input
12465 __TOC__
12466 == '''should be bold''' then normal text ==
12467 !! result
12468 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12469 <ul>
12470 <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>
12471 </ul>
12472 </td></tr></table>
12473 <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>
12474
12475 !! end
12476
12477 !! test
12478 Bug 33845: Headings become cursive in TOC when they contain an image
12479 !! options
12480 title=[[Main Page]]
12481 !! input
12482 __TOC__
12483 == Image [[Image:foobar.jpg]] ==
12484 !! result
12485 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12486 <ul>
12487 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12488 </ul>
12489 </td></tr></table>
12490 <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>
12491
12492 !! end
12493
12494 !! test
12495 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12496 !! options
12497 title=[[Main Page]]
12498 !! input
12499 __TOC__
12500 == <blockquote>Quote</blockquote> ==
12501 !! result
12502 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12503 <ul>
12504 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12505 </ul>
12506 </td></tr></table>
12507 <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>
12508
12509 !! end
12510
12511 !! test
12512 Unclosed tags in TOC
12513 !! options
12514 title=[[Main Page]]
12515 !! input
12516 __TOC__
12517 == Proof: 2 < 3 ==
12518 <small>Hanc marginis exiguitas non caperet.</small>
12519 QED
12520 !! result
12521 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12522 <ul>
12523 <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>
12524 </ul>
12525 </td></tr></table>
12526 <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>
12527 <p><small>Hanc marginis exiguitas non caperet.</small>
12528 QED
12529 </p>
12530 !! end
12531
12532 !! test
12533 Multiple tags in TOC
12534 !! input
12535 __TOC__
12536 == <i>Foo</i> <b>Bar</b> ==
12537
12538 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12539 !! result
12540 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12541 <ul>
12542 <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>
12543 <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>
12544 </ul>
12545 </td></tr></table>
12546 <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>
12547 <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>
12548
12549 !! end
12550
12551 !! test
12552 Tags with parameters in TOC
12553 !! input
12554 __TOC__
12555 == <sup class="in-h2">Hello</sup> ==
12556
12557 == <sup class="a > b">Evilbye</sup> ==
12558 !! result
12559 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12560 <ul>
12561 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12562 <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>
12563 </ul>
12564 </td></tr></table>
12565 <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>
12566 <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>
12567
12568 !! end
12569
12570 !! test
12571 span tags with directionality in TOC
12572 !! input
12573 __TOC__
12574 == <span dir="ltr">C++</span> ==
12575
12576 == <span dir="rtl">זבנג!</span> ==
12577
12578 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12579
12580 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12581
12582 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12583 !! result
12584 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12585 <ul>
12586 <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>
12587 <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>
12588 <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>
12589 <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>
12590 <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>
12591 </ul>
12592 </td></tr></table>
12593 <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>
12594 <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>
12595 <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>
12596 <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>
12597 <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>
12598
12599 !! end
12600
12601 !! article
12602 MediaWiki:Bug32057
12603 !! text
12604 == {{int:headline_sample}} ==
12605 !! endarticle
12606
12607 !! test
12608 Bug 32057: Title needed when expanding <h> nodes.
12609 !! options
12610 title=[[Main Page]]
12611 !! input
12612 {{int:Bug32057}}
12613 !! result
12614 <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>
12615
12616 !! end
12617
12618 !! test
12619 Strip marker in urlencode
12620 !! input
12621 {{urlencode:x<nowiki/>y}}
12622 {{urlencode:x<nowiki/>y|wiki}}
12623 {{urlencode:x<nowiki/>y|path}}
12624 !! result
12625 <p>xy
12626 xy
12627 xy
12628 </p>
12629 !! end
12630
12631 !! test
12632 Strip marker in lc
12633 !! input
12634 {{lc:x<nowiki/>y}}
12635 !! result
12636 <p>xy
12637 </p>
12638 !! end
12639
12640 !! test
12641 Strip marker in uc
12642 !! input
12643 {{uc:x<nowiki/>y}}
12644 !! result
12645 <p>XY
12646 </p>
12647 !! end
12648
12649 !! test
12650 Strip marker in formatNum
12651 !! input
12652 {{formatnum:1<nowiki/>2}}
12653 {{formatnum:1<nowiki/>2|R}}
12654 !! result
12655 <p>12
12656 12
12657 </p>
12658 !! end
12659
12660 !! test
12661 Check noCommafy in formatNum
12662 !! options
12663 language=be-tarask
12664 !! input
12665 {{formatnum:123456.78}}
12666 {{formatnum:123456.78|NOSEP}}
12667 !! result
12668 <p>123 456,78
12669 123456.78
12670 </p>
12671 !! end
12672
12673 !! test
12674 Strip marker in grammar
12675 !! options
12676 language=fi
12677 !! input
12678 {{grammar:elative|foo<nowiki/>bar}}
12679 !! result
12680 <p>foobarista
12681 </p>
12682 !! end
12683
12684 !! test
12685 Strip marker in padleft
12686 !! input
12687 {{padleft:|2|x<nowiki/>y}}
12688 !! result
12689 <p>xy
12690 </p>
12691 !! end
12692
12693 !! test
12694 Strip marker in padright
12695 !! input
12696 {{padright:|2|x<nowiki/>y}}
12697 !! result
12698 <p>xy
12699 </p>
12700 !! end
12701
12702 !! test
12703 Strip marker in anchorencode
12704 !! input
12705 {{anchorencode:x<nowiki/>y}}
12706 !! result
12707 <p>xy
12708 </p>
12709 !! end
12710
12711 !! test
12712 nowiki inside link inside heading (bug 18295)
12713 !! input
12714 ==[[foo|x<nowiki>y</nowiki>z]]==
12715 !! result
12716 <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>
12717
12718 !! end
12719
12720 !! test
12721 new support for bdi element (bug 31817)
12722 !! input
12723 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12724 !! result
12725 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12726
12727 !!end
12728
12729 !! test
12730 Ignore pipe between table row attributes
12731 !! input
12732 {|
12733 | quux
12734 |- id=foo | style='color: red'
12735 | bar
12736 |}
12737 !! result
12738 <table>
12739 <tr>
12740 <td> quux
12741 </td></tr>
12742 <tr id="foo" style="color: red">
12743 <td> bar
12744 </td></tr></table>
12745
12746 !! end
12747
12748 !!test
12749 Gallery override link with WikiLink (bug 34852)
12750 !! input
12751 <gallery>
12752 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12753 </gallery>
12754 !! result
12755 <ul class="gallery">
12756 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12757 <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>
12758 <div class="gallerytext">
12759 <p>caption
12760 </p>
12761 </div>
12762 </div></li>
12763 </ul>
12764
12765 !! end
12766
12767 !!test
12768 Gallery override link with absolute external link (bug 34852)
12769 !! input
12770 <gallery>
12771 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12772 </gallery>
12773 !! result
12774 <ul class="gallery">
12775 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12776 <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>
12777 <div class="gallerytext">
12778 <p>caption
12779 </p>
12780 </div>
12781 </div></li>
12782 </ul>
12783
12784 !! end
12785
12786 !!test
12787 Gallery override link with malicious javascript (bug 34852)
12788 !! input
12789 <gallery>
12790 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12791 </gallery>
12792 !! result
12793 <ul class="gallery">
12794 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12795 <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>
12796 <div class="gallerytext">
12797 <p>caption
12798 </p>
12799 </div>
12800 </div></li>
12801 </ul>
12802
12803 !! end
12804
12805 !!test
12806 Gallery with invalid title as link (bug 43964)
12807 !! input
12808 <gallery>
12809 File:foobar.jpg|link=<
12810 </gallery>
12811 !! result
12812 <ul class="gallery">
12813 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12814 <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>
12815 <div class="gallerytext">
12816 </div>
12817 </div></li>
12818 </ul>
12819
12820 !! end
12821
12822 !!test
12823 Language parser function
12824 !! input
12825 {{#language:ar}}
12826 !! result
12827 <p>العربية
12828 </p>
12829 !! end
12830
12831 !!test
12832 Padleft and padright as substr
12833 !! input
12834 {{padleft:|3|abcde}}
12835 {{padright:|3|abcde}}
12836 !! result
12837 <p>abc
12838 abc
12839 </p>
12840 !! end
12841
12842 !!test
12843 Bug 34939 - Case insensitive link parsing ([HttP://])
12844 !! input
12845 [HttP://MediaWiki.Org/]
12846 !! result
12847 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12848 </p>
12849 !! end
12850
12851 !!test
12852 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12853 !! input
12854 [HttP://MediaWiki.Org/ MediaWiki]
12855 !! result
12856 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12857 </p>
12858 !! end
12859
12860 !!test
12861 Bug 34939 - Case insensitive link parsing (HttP://)
12862 !! input
12863 HttP://MediaWiki.Org/
12864 !! result
12865 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12866 </p>
12867 !! end
12868
12869 ###
12870 ### Parsoids-specific tests
12871 ### Parsoid-PHP parser incompatibilities
12872 ###
12873 !!test
12874 1. SOL-sensitive wikitext tokens as template-args
12875 !!options
12876 disabled
12877 !!input
12878 {{echo|*a}}
12879 {{echo|#a}}
12880 {{echo|:a}}
12881 !!result
12882 <p>*a
12883 #a
12884 :a
12885 </p>
12886 !!end
12887
12888 #### The following section of tests are primarily to test
12889 #### wikitext escaping capabilities of Parsoid.
12890 #### A lot of the tests are disabled for the PHP parser either
12891 #### because of minor newline diffs or other reasons.
12892 #### As Parsoid serializer can handle newlines and other HTML
12893 #### more robustly, some of these tests might get reenabled
12894 #### for the PHP parser.
12895
12896 #### --------------- Headings ---------------
12897 #### 0. Unnested
12898 #### 1. Nested inside html <h1>=foo=</h1>
12899 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12900 #### 3. Nested inside html with wikitext split by html tags
12901 #### 4. No escape needed
12902 #### 5. Empty headings <h1></h1>
12903 #### 6. Heading chars in SOL context
12904 #### ----------------------------------------
12905 !! test
12906 Headings: 0. Unnested
12907 !! input
12908 <nowiki>=foo=</nowiki>
12909
12910 <nowiki>=foo</nowiki>''a''=
12911 !! result
12912 <p>=foo=
12913 </p><p>=foo<i>a</i>=
12914 </p>
12915 !!end
12916
12917 !! test
12918 Headings: 1. Nested inside html
12919 !! options
12920 disabled
12921 !! input
12922 =<nowiki>=foo=</nowiki>=
12923 ==<nowiki>=foo=</nowiki>==
12924 ===<nowiki>=foo=</nowiki>===
12925 ====<nowiki>=foo=</nowiki>====
12926 =====<nowiki>=foo=</nowiki>=====
12927 ======<nowiki>=foo=</nowiki>======
12928 !! result
12929 <h1>=foo=</h1>
12930 <h2>=foo=</h2>
12931 <h3>=foo=</h3>
12932 <h4>=foo=</h4>
12933 <h5>=foo=</h5>
12934 <h6>=foo=</h6>
12935 !!end
12936
12937 !! test
12938 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12939 !! options
12940 disabled
12941 !! input
12942 =foo=
12943 <nowiki>*bar</nowiki>
12944 =foo=
12945 =bar
12946 =foo=
12947 <nowiki>=bar=</nowiki>
12948 !! result
12949 <h1>foo</h1>*bar
12950 <h1>foo</h1>=bar
12951 <h1>foo</h1>=bar=
12952 !!end
12953
12954 !! test
12955 Headings: 3. Nested inside html with wikitext split by html tags
12956 !! options
12957 disabled
12958 !! input
12959 =<nowiki>=</nowiki>'''bold'''foo==
12960 !! result
12961 <h1>=<b>bold</b>foo=</h1>
12962 !!end
12963
12964 !! test
12965 Headings: 4. No escaping needed (testing just h1 and h2)
12966 !! options
12967 disabled
12968 !! input
12969 ==foo=
12970 =foo==
12971 ===foo==
12972 ==foo===
12973 =''=''foo==
12974 ===
12975 !! result
12976 <h1>=foo</h1>
12977 <h1>foo=</h1>
12978 <h2>=foo</h2>
12979 <h2>foo=</h2>
12980 <h1><i>=</i>foo=</h1>
12981 <h1>=</h1>
12982 !!end
12983
12984 !! test
12985 Headings: 5. Empty headings
12986 !! options
12987 disabled
12988 !! input
12989 =<nowiki></nowiki>=
12990 ==<nowiki></nowiki>==
12991 ===<nowiki></nowiki>===
12992 ====<nowiki></nowiki>====
12993 =====<nowiki></nowiki>=====
12994 ======<nowiki></nowiki>======
12995 !! result
12996 <h1></h1>
12997 <h2></h2>
12998 <h3></h3>
12999 <h4></h4>
13000 <h5></h5>
13001 <h6></h6>
13002 !!end
13003
13004 !! test
13005 Headings: 6. Heading chars in SOL context
13006 !! options
13007 disabled
13008 !! input
13009 <!--cmt--><nowiki>=h1=</nowiki>
13010 !! result
13011 <p><!--cmt-->=h1=
13012 </p>
13013 !!end
13014
13015 #### --------------- Lists ---------------
13016 #### 0. Outside nests (*foo, etc.)
13017 #### 1. Nested inside html <ul><li>*foo</li></ul>
13018 #### 2. Inside definition lists
13019 #### 3. Only bullets at start should be escaped
13020 #### 4. No escapes needed
13021 #### 5. No unnecessary escapes
13022 #### 6. Escape bullets in SOL position
13023 #### 7. Escape bullets in a multi-line context
13024 #### ----------------------------------------
13025
13026 !! test
13027 Lists: 0. Outside nests
13028 !! input
13029 <nowiki>*foo</nowiki>
13030
13031 <nowiki>#foo</nowiki>
13032 !! result
13033 <p>*foo
13034 </p><p>#foo
13035 </p>
13036 !!end
13037
13038 !! test
13039 Lists: 1. Nested inside html
13040 !! input
13041 *<nowiki>*foo</nowiki>
13042
13043 *<nowiki>#foo</nowiki>
13044
13045 *<nowiki>:foo</nowiki>
13046
13047 *<nowiki>;foo</nowiki>
13048
13049 #<nowiki>*foo</nowiki>
13050
13051 #<nowiki>#foo</nowiki>
13052
13053 #<nowiki>:foo</nowiki>
13054
13055 #<nowiki>;foo</nowiki>
13056 !! result
13057 <ul><li>*foo
13058 </li></ul>
13059 <ul><li>#foo
13060 </li></ul>
13061 <ul><li>:foo
13062 </li></ul>
13063 <ul><li>;foo
13064 </li></ul>
13065 <ol><li>*foo
13066 </li></ol>
13067 <ol><li>#foo
13068 </li></ol>
13069 <ol><li>:foo
13070 </li></ol>
13071 <ol><li>;foo
13072 </li></ol>
13073
13074 !!end
13075
13076 !! test
13077 Lists: 2. Inside definition lists
13078 !! input
13079 ;<nowiki>;foo</nowiki>
13080
13081 ;<nowiki>:foo</nowiki>
13082
13083 ;<nowiki>:foo</nowiki>
13084 :bar
13085
13086 :<nowiki>:foo</nowiki>
13087 !! result
13088 <dl><dt>;foo
13089 </dt></dl>
13090 <dl><dt>:foo
13091 </dt></dl>
13092 <dl><dt>:foo
13093 </dt><dd>bar
13094 </dd></dl>
13095 <dl><dd>:foo
13096 </dd></dl>
13097
13098 !!end
13099
13100 !! test
13101 Lists: 3. Only bullets at start of text should be escaped
13102 !! input
13103 *<nowiki>*foo*bar</nowiki>
13104
13105 *<nowiki>*foo</nowiki>''it''*bar
13106 !! result
13107 <ul><li>*foo*bar
13108 </li></ul>
13109 <ul><li>*foo<i>it</i>*bar
13110 </li></ul>
13111
13112 !!end
13113
13114 !! test
13115 Lists: 4. No escapes needed
13116 !! options
13117 disabled
13118 !! input
13119 *foo*bar
13120
13121 *''foo''*bar
13122
13123 *[[Foo]]: bar
13124 !! result
13125 <ul><li>foo*bar
13126 </li></ul>
13127 <ul><li><i>foo</i>*bar
13128 </li></ul>
13129 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13130 </li></ul>
13131 !!end
13132
13133 !! test
13134 Lists: 5. No unnecessary escapes
13135 !! input
13136 * bar <span><nowiki>[[foo]]</nowiki></span>
13137
13138 *=bar <span><nowiki>[[foo]]</nowiki></span>
13139
13140 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13141
13142 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13143
13144 *=bar <span>foo]]</span>=
13145 !! result
13146 <ul><li> bar <span>[[foo]]</span>
13147 </li></ul>
13148 <ul><li>=bar <span>[[foo]]</span>
13149 </li></ul>
13150 <ul><li>[[bar <span>[[foo]]</span>
13151 </li></ul>
13152 <ul><li>]]bar <span>[[foo]]</span>
13153 </li></ul>
13154 <ul><li>=bar <span>foo]]</span>=
13155 </li></ul>
13156
13157 !!end
13158
13159 !! test
13160 Lists: 6. Escape bullets in SOL position
13161 !! options
13162 disabled
13163 !! input
13164 <!--cmt--><nowiki>*foo</nowiki>
13165 !! result
13166 <p><!--cmt-->*foo
13167 </p>
13168 !!end
13169
13170 !! test
13171 Lists: 7. Escape bullets in a multi-line context
13172 !! input
13173 <nowiki>a
13174 *b</nowiki>
13175 !! result
13176 <p>a
13177 *b
13178 </p>
13179 !!end
13180
13181 #### --------------- HRs ---------------
13182 #### 1. Single line
13183 #### -----------------------------------
13184
13185 !! test
13186 HRs: 1. Single line
13187 !! options
13188 disabled
13189 !! input
13190 ----
13191 <nowiki>----</nowiki>
13192 ----
13193 <nowiki>=foo=</nowiki>
13194 ----
13195 <nowiki>*foo</nowiki>
13196 !! result
13197 <hr/>----
13198 <hr/>=foo=
13199 <hr/>*foo
13200 !! end
13201
13202 #### --------------- Tables ---------------
13203 #### 1a. Simple example
13204 #### 1b. No escaping needed (!foo)
13205 #### 1c. No escaping needed (|foo)
13206 #### 1d. No escaping needed (|}foo)
13207 ####
13208 #### 2a. Nested in td (<td>foo|bar</td>)
13209 #### 2b. Nested in td (<td>foo||bar</td>)
13210 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13211 ####
13212 #### 3a. Nested in th (<th>foo!bar</th>)
13213 #### 3b. Nested in th (<th>foo!!bar</th>)
13214 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13215 ####
13216 #### 4a. Escape -
13217 #### 4b. Escape +
13218 #### 4c. No escaping needed
13219 #### --------------------------------------
13220
13221 !! test
13222 Tables: 1a. Simple example
13223 !! input
13224 <nowiki>{|
13225 |}</nowiki>
13226 !! result
13227 <p>{|
13228 |}
13229 </p>
13230 !! end
13231
13232 !! test
13233 Tables: 1b. No escaping needed
13234 !! input
13235 !foo
13236 !! result
13237 <p>!foo
13238 </p>
13239 !! end
13240
13241 !! test
13242 Tables: 1c. No escaping needed
13243 !! input
13244 |foo
13245 !! result
13246 <p>|foo
13247 </p>
13248 !! end
13249
13250 !! test
13251 Tables: 1d. No escaping needed
13252 !! input
13253 |}foo
13254 !! result
13255 <p>|}foo
13256 </p>
13257 !! end
13258
13259 !! test
13260 Tables: 2a. Nested in td
13261 !! options
13262 disabled
13263 !! input
13264 {|
13265 |<nowiki>foo|bar</nowiki>
13266 |}
13267 !! result
13268 <table>
13269 <tr><td>foo|bar
13270 </td></tr></table>
13271
13272 !! end
13273
13274 !! test
13275 Tables: 2b. Nested in td
13276 !! options
13277 disabled
13278 !! input
13279 {|
13280 |<nowiki>foo||bar</nowiki>
13281 |''it''<nowiki>foo||bar</nowiki>
13282 |}
13283 !! result
13284 <table>
13285 <tr><td>foo||bar
13286 </td><td><i>it</i>foo||bar
13287 </td></tr></table>
13288
13289 !! end
13290
13291 !! test
13292 Tables: 2c. Nested in td -- no escaping needed
13293 !! options
13294 disabled
13295 !! input
13296 {|
13297 |foo!!bar
13298 |}
13299 !! result
13300 <table>
13301 <tr><td>foo!!bar
13302 </td></tr></table>
13303
13304 !! end
13305
13306 !! test
13307 Tables: 3a. Nested in th
13308 !! options
13309 disabled
13310 !! input
13311 {|
13312 !foo!bar
13313 |}
13314 !! result
13315 <table>
13316 <tr><th>foo!bar
13317 </th></tr></table>
13318
13319 !! end
13320
13321 !! test
13322 Tables: 3b. Nested in th
13323 !! options
13324 disabled
13325 !! input
13326 {|
13327 !<nowiki>foo!!bar</nowiki>
13328 |}
13329 !! result
13330 <table>
13331 <tr><th>foo!!bar
13332 </th></tr></table>
13333
13334 !! end
13335
13336 !! test
13337 Tables: 3c. Nested in th -- no escaping needed
13338 !! options
13339 disabled
13340 !! input
13341 {|
13342 !foo||bar
13343 |}
13344 !! result
13345 <table>
13346 <tr><th>foo||bar
13347 </th></tr></table>
13348
13349 !! end
13350
13351 !! test
13352 Tables: 4a. Escape -
13353 !! options
13354 disabled
13355 !! input
13356 {|
13357 |-
13358 !-bar
13359 |-
13360 |<nowiki>-bar</nowiki>
13361 |}
13362 !! result
13363 <table><tbody>
13364 <tr><th>-bar</th></tr>
13365 <tr><td>-bar</td></tr>
13366 </tbody></table>
13367 !! end
13368
13369 !! test
13370 Tables: 4b. Escape +
13371 !! options
13372 disabled
13373 !! input
13374 {|
13375 |-
13376 !+bar
13377 |-
13378 |<nowiki>+bar</nowiki>
13379 |}
13380 !! result
13381 <table><tbody>
13382 <tr><th>+bar</th></tr>
13383 <tr><td>+bar</td></tr>
13384 </tbody></table>
13385 !! end
13386
13387 !! test
13388 Tables: 4c. No escaping needed
13389 !! options
13390 disabled
13391 !! input
13392 {|
13393 |-
13394 |foo-bar
13395 |foo+bar
13396 |-
13397 |''foo''-bar
13398 |''foo''+bar
13399 |}
13400 !! result
13401 <table><tbody>
13402 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13403 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13404 </tbody></table>
13405 !! end
13406
13407 !! test
13408 Tables: 4d. No escaping needed
13409 !! input
13410 {|
13411 ||+1
13412 ||-2
13413 |}
13414 !! result
13415 <table>
13416 <tr>
13417 <td>+1
13418 </td>
13419 <td>-2
13420 </td></tr></table>
13421
13422 !! end
13423
13424 #### --------------- Links ---------------
13425 #### 1. Quote marks in link text
13426 #### 2. Wikilinks: Escapes needed
13427 #### 3. Wikilinks: No escapes needed
13428 #### 4. Extlinks: Escapes needed
13429 #### 5. Extlinks: No escapes needed
13430 #### --------------------------------------
13431 !! test
13432 Links 1. Quote marks in link text
13433 !! options
13434 disabled
13435 !! input
13436 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13437 !! result
13438 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13439 !! end
13440
13441 !! test
13442 Links 2. WikiLinks: Escapes needed
13443 !! options
13444 disabled
13445 !! input
13446 [[Foo|<nowiki>[Foobar]</nowiki>]]
13447 [[Foo|<nowiki>Foobar]</nowiki>]]
13448 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13449 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13450 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13451 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13452 [[Foo|<nowiki>|Bar</nowiki>]]
13453 !! result
13454 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13455 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13456 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13457 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13458 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13459 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13460 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13461 !! end
13462
13463 !! test
13464 Links 3. WikiLinks: No escapes needed
13465 !! options
13466 disabled
13467 !! input
13468 [[Foo|[Foobar]]
13469 [[Foo|foo|bar]]
13470 !! result
13471 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13472 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13473 !! end
13474
13475 !! test
13476 Links 4. ExtLinks: Escapes needed
13477 !! options
13478 disabled
13479 !! input
13480 [http://google.com <nowiki>[google]</nowiki>]
13481 [http://google.com <nowiki>google]</nowiki>]
13482 !! result
13483 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13484 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13485 !! end
13486
13487 !! test
13488 Links 5. ExtLinks: No escapes needed
13489 !! options
13490 disabled
13491 !! input
13492 [http://google.com [google]
13493 !! result
13494 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13495 !! end
13496
13497 #### --------------- Quotes ---------------
13498 #### 1. Quotes inside <b> and <i>
13499 #### 2. Link fragments separated by <i> and <b> tags
13500 #### 3. Link fragments inside <i> and <b>
13501 #### --------------------------------------
13502 !! test
13503 1. Quotes inside <b> and <i>
13504 !! input
13505 ''<nowiki>'foo'</nowiki>''
13506 ''<nowiki>''foo''</nowiki>''
13507 ''<nowiki>'''foo'''</nowiki>''
13508 '''<nowiki>'foo'</nowiki>'''
13509 '''<nowiki>''foo''</nowiki>'''
13510 '''<nowiki>'''foo'''</nowiki>'''
13511 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13512 !! result
13513 <p><i>'foo'</i>
13514 <i>''foo''</i>
13515 <i>'''foo'''</i>
13516 <b>'foo'</b>
13517 <b>''foo''</b>
13518 <b>'''foo'''</b>
13519 <b>foo'<i>bar'</i>baz</b>
13520 </p>
13521 !! end
13522
13523 !! test
13524 2. Link fragments separated by <i> and <b> tags
13525 !! input
13526 [[''foo''<nowiki>hello]]</nowiki>
13527
13528 [['''foo'''<nowiki>hello]]</nowiki>
13529 !! result
13530 <p>[[<i>foo</i>hello]]
13531 </p><p>[[<b>foo</b>hello]]
13532 </p>
13533 !! end
13534
13535 !! test
13536 2. Link fragments inside <i> and <b>
13537 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13538 this is one of the shortcomings of this format)
13539 !! input
13540 ''[[foo''<nowiki>]]</nowiki>
13541
13542 '''[[foo'''<nowiki>]]</nowiki>
13543 !! result
13544 <p><i>[[foo</i>]]
13545 </p><p><b>[[foo</b>]]
13546 </p>
13547 !! end
13548
13549 #### --------------- Paragraphs ---------------
13550 #### 1. No unnecessary escapes
13551 #### --------------------------------------
13552
13553 !! test
13554 1. No unnecessary escapes
13555 !! input
13556 bar <span><nowiki>[[foo]]</nowiki></span>
13557
13558 =bar <span><nowiki>[[foo]]</nowiki></span>
13559
13560 [[bar <span><nowiki>[[foo]]</nowiki></span>
13561
13562 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13563
13564 <nowiki>=bar </nowiki><span>foo]]</span>=
13565 !! result
13566 <p>bar <span>[[foo]]</span>
13567 </p><p>=bar <span>[[foo]]</span>
13568 </p><p>[[bar <span>[[foo]]</span>
13569 </p><p>]]bar <span>[[foo]]</span>
13570 </p><p>=bar <span>foo]]</span>=
13571 </p>
13572 !!end
13573
13574 #### --------------- PRE ------------------
13575 #### 1. Leading space in SOL context should be escaped
13576 #### --------------------------------------
13577 !! test
13578 1. Leading space in SOL context should be escaped
13579 !! options
13580 disabled
13581 !! input
13582 <nowiki> foo</nowiki>
13583 <!--cmt--><nowiki> foo</nowiki>
13584 !! result
13585 <p> foo
13586 <!--cmt--> foo
13587 </p>
13588 !! end
13589
13590 #### --------------- HTML tags ---------------
13591 #### 1. a tags
13592 #### 2. other tags
13593 #### 3. multi-line html tag
13594 #### --------------------------------------
13595 !! test
13596 1. a tags
13597 !! options
13598 disabled
13599 !! input
13600 <a href="http://google.com">google</a>
13601 !! result
13602 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13603 !! end
13604
13605 !! test
13606 2. other tags
13607 !! input
13608 <nowiki><div>foo</div>
13609 <div style="color:red">foo</div></nowiki>
13610 !! result
13611 <p>&lt;div&gt;foo&lt;/div&gt;
13612 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13613 </p>
13614 !! end
13615
13616 !! test
13617 3. multi-line html tag
13618 !! input
13619 <nowiki><div
13620 >foo</div
13621 ></nowiki>
13622 !! result
13623 <p>&lt;div
13624 &gt;foo&lt;/div
13625 &gt;
13626 </p>
13627 !! end
13628
13629 #### --------------- Others ---------------
13630 !! test
13631 Escaping nowikis
13632 !! input
13633 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13634 !! result
13635 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13636 </p>
13637 !! end
13638
13639 !! test
13640 Tag-like HTML structures are passed through as text
13641 !! input
13642 <x y>
13643
13644 <x.y>
13645
13646 <x-y>
13647
13648 1>2
13649
13650 x<y
13651
13652 a>b
13653
13654 1<d e>f
13655 !! result
13656 <p>&lt;x y&gt;
13657 </p><p>&lt;x.y&gt;
13658 </p><p>&lt;x-y&gt;
13659 </p><p>1&gt;2
13660 </p><p>x&lt;y
13661 </p><p>a&gt;b
13662 </p><p>1&lt;d e&gt;f
13663 </p>
13664 !! end
13665
13666
13667 # This fails in the PHP parser (see bug 40670,
13668 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13669 !! test
13670 Tag names followed by punctuation should not be recognized as tags
13671 !! options
13672 disabled
13673 !! input
13674 <s.ome> text
13675 !! result
13676 <p>&lt;s.ome&gt text
13677 </p>
13678 !! end
13679
13680 !! test
13681 HTML tag with necessary entities in attributes
13682 !! input
13683 <span title="&amp;amp;">foo</span>
13684 !! result
13685 <p><span title="&amp;amp;">foo</span>
13686 </p>
13687 !! end
13688
13689 !! test
13690 HTML tag with 'unnecessary' entity encoding in attributes
13691 !! input
13692 <span title="&amp;">foo</span>
13693 !! result
13694 <p><span title="&amp;">foo</span>
13695 </p>
13696 !! end
13697
13698 !! test
13699 HTML tag with broken attribute value quoting
13700 !! input
13701 <span title="Hello world>Foo</span>
13702 !! result
13703 <p><span>Foo</span>
13704 </p>
13705 !! end
13706
13707 !! test
13708 Parsoid-only: HTML tag with broken attribute value quoting
13709 !! options
13710 parsoid
13711 !! input
13712 <span title="Hello world>Foo</span>
13713 !! result
13714 <p><span title="Hello world">Foo</span>
13715 </p>
13716 !! end
13717
13718 !! test
13719 Table with broken attribute value quoting
13720 !! input
13721 {|
13722 | title="Hello world|Foo
13723 |}
13724 !! result
13725 <table>
13726 <tr>
13727 <td>Foo
13728 </td></tr></table>
13729
13730 !! end
13731
13732 !! test
13733 Table with broken attribute value quoting on consecutive lines
13734 !! input
13735 {|
13736 | title="Hello world|Foo
13737 | style="color:red|Bar
13738 |}
13739 !! result
13740 <table>
13741 <tr>
13742 <td>Foo
13743 </td>
13744 <td>Bar
13745 </td></tr></table>
13746
13747 !! end
13748
13749 !! test
13750 Parsoid-only: Table with broken attribute value quoting on consecutive lines
13751 !! options
13752 parsoid
13753 !! input
13754 {|
13755 | title="Hello world|Foo
13756 | style="color:red|Bar
13757 |}
13758 !! result
13759 <table>
13760 <tr>
13761 <td title="Hello world">Foo
13762 </td><td style="color: red">Bar
13763 </td></tr></table>
13764
13765 !! end
13766
13767 !!test
13768 Accept empty td cell attribute
13769 !!input
13770 {|
13771 | align="center" | foo || |
13772 |}
13773 !!result
13774 <table>
13775 <tr>
13776 <td align="center"> foo </td>
13777 <td>
13778 </td></tr></table>
13779
13780 !!end
13781
13782 !!test
13783 Non-empty attributes in th-cells
13784 !!input
13785 {|
13786 ! Foo !! style="color: red" | Bar
13787 |}
13788 !!result
13789 <table>
13790 <tr>
13791 <th> Foo </th>
13792 <th style="color: red"> Bar
13793 </th></tr></table>
13794
13795 !!end
13796
13797 !!test
13798 Accept empty attributes in th-cells
13799 !!input
13800 {|
13801 !| foo !!| bar
13802 |}
13803 !!result
13804 <table>
13805 <tr>
13806 <th> foo </th>
13807 <th> bar
13808 </th></tr></table>
13809
13810 !!end
13811
13812 !!test
13813 Empty table rows go away
13814 !!input
13815 {|
13816 | Hello
13817 | there
13818 |- class="foo"
13819 |-
13820 |}
13821 !! result
13822 <table>
13823 <tr>
13824 <td> Hello
13825 </td>
13826 <td> there
13827 </td></tr>
13828
13829 </table>
13830
13831 !! end
13832
13833 TODO:
13834 more images
13835 more tables
13836 character entities
13837 and much more
13838 Try for 100% code coverage