Add 'parsoid' option to parserTests.txt.
[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: wiki links within external link (Bug 3695)
2504 !! input
2505 [http://example.com [[wikilink]] embedded in ext link]
2506 !! result
2507 <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>
2508 </p>
2509 !! end
2510
2511 !! test
2512 BUG 787: Links with one slash after the url protocol are invalid
2513 !! input
2514 http:/example.com
2515
2516 [http:/example.com title]
2517 !! result
2518 <p>http:/example.com
2519 </p><p>[http:/example.com title]
2520 </p>
2521 !! end
2522
2523 !! test
2524 Bracketed external links with template-generated invalid target
2525 !! input
2526 [{{echo|http:/example.com}} title]
2527 !! result
2528 <p>[http:/example.com title]
2529 </p>
2530 !! end
2531
2532 !! test
2533 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2534 !! input
2535 ''[http://example.com text'']
2536 [http://example.com '''text]'''
2537 ''Something [http://example.com in italic'']
2538 ''Something [http://example.com mixed''''', even bold]'''
2539 '''''Now [http://example.com both''''']
2540 !! result
2541 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2542 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2543 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2544 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2545 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2546 </p>
2547 !! end
2548
2549
2550 !! test
2551 Bug 4781: %26 in URL
2552 !! input
2553 http://www.example.com/?title=AT%26T
2554 !! result
2555 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2556 </p>
2557 !! end
2558
2559 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2560 # % is actually legal in HTML5. Any change in output would need testing though.
2561 !! test
2562 Bug 4781, 5267: %25 in URL
2563 !! input
2564 http://www.example.com/?title=100%25_Bran
2565 !! result
2566 <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>
2567 </p>
2568 !! end
2569
2570 !! test
2571 Bug 4781, 5267: %28, %29 in URL
2572 !! input
2573 http://www.example.com/?title=Ben-Hur_%281959_film%29
2574 !! result
2575 <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>
2576 </p>
2577 !! end
2578
2579
2580 !! test
2581 Bug 4781: %26 in autonumber URL
2582 !! input
2583 [http://www.example.com/?title=AT%26T]
2584 !! result
2585 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2586 </p>
2587 !! end
2588
2589 !! test
2590 Bug 4781, 5267: %26 in autonumber URL
2591 !! input
2592 [http://www.example.com/?title=100%25_Bran]
2593 !! result
2594 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2595 </p>
2596 !! end
2597
2598 !! test
2599 Bug 4781, 5267: %28, %29 in autonumber URL
2600 !! input
2601 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2602 !! result
2603 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2604 </p>
2605 !! end
2606
2607
2608 !! test
2609 Bug 4781: %26 in bracketed URL
2610 !! input
2611 [http://www.example.com/?title=AT%26T link]
2612 !! result
2613 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2614 </p>
2615 !! end
2616
2617 !! test
2618 Bug 4781, 5267: %26 in bracketed URL
2619 !! input
2620 [http://www.example.com/?title=100%25_Bran link]
2621 !! result
2622 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2623 </p>
2624 !! end
2625
2626 !! test
2627 Bug 4781, 5267: %28, %29 in bracketed URL
2628 !! input
2629 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2630 !! result
2631 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2632 </p>
2633 !! end
2634
2635 !! test
2636 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2637 !! input
2638 Some [http://example.com/ pretty ''italics'' and stuff]!
2639 !! result
2640 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2641 </p>
2642 !! end
2643
2644 !! test
2645 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2646 !! input
2647 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2648 !! result
2649 <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>
2650 </p>
2651 !! end
2652
2653 !! test
2654 External link containing double-single-quotes with no space separating the url from text in italics
2655 !! input
2656 [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]].]
2657 !! result
2658 <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>
2659 </p>
2660 !! end
2661
2662 !!test
2663 Text in square brackets that is not a link should parse as text
2664 !!input
2665 [foo]
2666 [{{echo|foo}}]
2667 [url={{echo|foo}}]
2668 [url=http://example.com]
2669 !!result
2670 <p>[foo]
2671 [foo]
2672 [url=foo]
2673 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
2674 </p>
2675 !!end
2676
2677 !! test
2678 URL-encoding in URL functions (single parameter)
2679 !! input
2680 {{localurl:Some page|amp=&}}
2681 !! result
2682 <p>/index.php?title=Some_page&amp;amp=&amp;
2683 </p>
2684 !! end
2685
2686 !! test
2687 URL-encoding in URL functions (multiple parameters)
2688 !! input
2689 {{localurl:Some page|q=?&amp=&}}
2690 !! result
2691 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2692 </p>
2693 !! end
2694
2695 !! test
2696 Brackets in urls
2697 !! input
2698 http://example.com/index.php?foozoid%5B%5D=bar
2699
2700 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2701 !! result
2702 <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>
2703 </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>
2704 </p>
2705 !! end
2706
2707 !! test
2708 IPv6 urls (bug 21261)
2709 !! options
2710 disabled
2711 !! input
2712 http://[2404:130:0:1000::187:2]/index.php
2713 !! result
2714 <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>
2715 </p>
2716 !! end
2717
2718 !! test
2719 Non-extlinks in brackets
2720 !! input
2721 [foo]
2722 [foo bar]
2723 [foo ''bar'']
2724 [fool's] errand
2725 [fool's errand]
2726 [{{echo|foo}}]
2727 [{{echo|foo}} bar]
2728 [{{echo|foo}} ''bar'']
2729 [{{echo|foo}}l's] errand
2730 [{{echo|foo}}l's errand]
2731 !! result
2732 <p>[foo]
2733 [foo bar]
2734 [foo <i>bar</i>]
2735 [fool's] errand
2736 [fool's errand]
2737 [foo]
2738 [foo bar]
2739 [foo <i>bar</i>]
2740 [fool's] errand
2741 [fool's errand]
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: 1. 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: 2. Fostering of partial template content
5857 !!input
5858 {|
5859 {{echo|a
5860 <div>b</div>}}
5861 |}
5862 !!result
5863 <table>
5864 a
5865 <div>b</div>
5866 <tr><td></td></tr></table>
5867
5868 !!end
5869
5870 !!test
5871 Templates: Wiki Tables: 3. td-content via multiple templates
5872 !!input
5873 {|
5874 {{echo|{{pipe}}a}}{{echo|b}}
5875 |}
5876 !!result
5877 <table>
5878 <tr>
5879 <td>ab
5880 </td></tr></table>
5881
5882 !!end
5883
5884 !!test
5885 Templates: Wiki Tables: 4. Templated tags, no content
5886 !!input
5887 {{tbl-start}}
5888 {{tbl-end}}
5889 !!result
5890 <table>
5891 <tr><td></td></tr></table>
5892
5893 !!end
5894
5895 !!test
5896 Templates: Wiki Tables: 4. Templated tags, regular td-tags
5897 !!input
5898 {{tbl-start}}
5899 |foo
5900 {{tbl-end}}
5901 !!result
5902 <table>
5903 <tr>
5904 <td>foo
5905 </td></tr></table>
5906
5907 !!end
5908
5909 !!test
5910 Templates: Wiki Tables: 4. Templated tags, templated td-tags
5911 !!input
5912 {{tbl-start}}
5913 {{!}}foo
5914 {{tbl-end}}
5915 !!result
5916 <table>
5917 <tr>
5918 <td>foo
5919 </td></tr></table>
5920
5921 !!end
5922
5923 !!test
5924 Templates: Lists: Multi-line list-items via templates
5925 !!input
5926 *{{echo|a {{nonexistent|
5927 unused}}}}
5928 *{{echo|b {{nonexistent|
5929 unused}}}}
5930 !!result
5931 <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>
5932 </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>
5933 </li></ul>
5934
5935 !!end
5936
5937 !!test
5938 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5939 !!input
5940 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5941 !!result
5942 <p><i>ab</i>c<i>d</i>e
5943 </p>
5944 !!end
5945
5946 !!test
5947 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5948 (PHP parser generates misnested html)
5949 !! options
5950 disabled
5951 !!input
5952 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5953 !!result
5954 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5955 !!end
5956
5957 !!test
5958 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5959 (PHP parser generates misnested html)
5960 !! options
5961 disabled
5962 !!input
5963 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5964 !!result
5965 <div><i>a</i></div>
5966 <div><i>b</i>c<i>d</i></div>
5967 <div>e</div>
5968 !!end
5969
5970 !!test
5971 Templates: Ugly nesting: 4. Divs opened/closed across templates
5972 !!input
5973 a<div>b{{echo|c</div>d}}e
5974 !!result
5975 a<div>bc</div>de
5976
5977 !!end
5978
5979 !!test
5980 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5981 (Parsoid-centric)
5982 !! options
5983 parsoid
5984 !!input
5985 {|
5986 |{{echo|foo</table>}}
5987 |bar
5988 |}
5989 !!result
5990 <table about="#mwt1" typeof="mw:Object/Template ">
5991 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5992 bar</span><span about="#mwt1">
5993 </span>
5994 !!end
5995
5996 !!test
5997 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5998 (Parsoid-centric)
5999 !! options
6000 parsoid
6001 !!input
6002 <table>
6003 <tr>
6004 <td>
6005 <table>
6006 <tr>
6007 <td>1. {{echo|foo </table>}}</td>
6008 <td> bar </td>
6009 <td>2. {{echo|baz </table>}}</td>
6010 </tr>
6011 <tr>
6012 <td>abc</td>
6013 </tr>
6014 </table>
6015 </td>
6016 </tr>
6017 <tr>
6018 <td>xyz</td>
6019 </tr>
6020 </table>
6021 !!result
6022 <table about="#mwt1" typeof="mw:Object/Template">
6023 <tbody><tr >
6024 <td >
6025 <table >
6026 <tbody><tr >
6027 <td >1. foo </td></tr></tbody></table></td>
6028 <td > bar </td>
6029 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6030 </span><span about="#mwt1">
6031
6032 abc</span><span about="#mwt1">
6033 </span><span about="#mwt1">
6034 </span><span about="#mwt1">
6035 </span><span about="#mwt1">
6036 </span><span about="#mwt1">
6037
6038 xyz</span><span about="#mwt1">
6039 </span><span about="#mwt1">
6040 </span>
6041 !!end
6042
6043 !! test
6044 Templates: Ugly templates: 3. newline-only template parameter
6045 !! input
6046 foo {{echo|
6047 }}
6048 !! result
6049 <p>foo
6050 </p>
6051 !! end
6052
6053 # This looks like a bug: a single newline triggers p/br for some reason.
6054 !! test
6055 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6056 !! input
6057 {{echo|
6058 }}
6059 !! result
6060 <p><br />
6061 </p>
6062 !! end
6063
6064
6065 !!test
6066 Parser Functions: 1. Simple example
6067 !!input
6068 {{uc:foo}}
6069 !!result
6070 <p>FOO
6071 </p>
6072 !!end
6073
6074 !!test
6075 Parser Functions: 2. Nested use (only outermost should be marked up)
6076 !!input
6077 {{uc:{{lc:FOO}}}}
6078 !!result
6079 <p>FOO
6080 </p>
6081 !!end
6082
6083 ###
6084 ### Pre-save transform tests
6085 ###
6086 !! test
6087 pre-save transform: subst:
6088 !! options
6089 PST
6090 !! input
6091 {{subst:test}}
6092 !! result
6093 This is a test template
6094 !! end
6095
6096 !! test
6097 pre-save transform: normal template
6098 !! options
6099 PST
6100 !! input
6101 {{test}}
6102 !! result
6103 {{test}}
6104 !! end
6105
6106 !! test
6107 pre-save transform: nonexistent template
6108 !! options
6109 PST
6110 !! input
6111 {{thistemplatedoesnotexist}}
6112 !! result
6113 {{thistemplatedoesnotexist}}
6114 !! end
6115
6116
6117 !! test
6118 pre-save transform: subst magic variables
6119 !! options
6120 PST
6121 !! input
6122 {{subst:SITENAME}}
6123 !! result
6124 MediaWiki
6125 !! end
6126
6127 # This is bug 89, which I fixed. -- wtm
6128 !! test
6129 pre-save transform: subst: templates with parameters
6130 !! options
6131 pst
6132 !! input
6133 {{subst:paramtest|param="something else"}}
6134 !! result
6135 This is a test template with parameter "something else"
6136 !! end
6137
6138 !! article
6139 Template:nowikitest
6140 !! text
6141 <nowiki>'''not wiki'''</nowiki>
6142 !! endarticle
6143
6144 !! test
6145 pre-save transform: nowiki in subst (bug 1188)
6146 !! options
6147 pst
6148 !! input
6149 {{subst:nowikitest}}
6150 !! result
6151 <nowiki>'''not wiki'''</nowiki>
6152 !! end
6153
6154
6155 !! article
6156 Template:commenttest
6157 !! text
6158 This template has <!-- a comment --> in it.
6159 !! endarticle
6160
6161 !! test
6162 pre-save transform: comment in subst (bug 1936)
6163 !! options
6164 pst
6165 !! input
6166 {{subst:commenttest}}
6167 !! result
6168 This template has <!-- a comment --> in it.
6169 !! end
6170
6171 !! test
6172 pre-save transform: unclosed tag
6173 !! options
6174 pst noxml
6175 !! input
6176 <nowiki>'''not wiki'''
6177 !! result
6178 <nowiki>'''not wiki'''
6179 !! end
6180
6181 !! test
6182 pre-save transform: mixed tag case
6183 !! options
6184 pst noxml
6185 !! input
6186 <NOwiki>'''not wiki'''</noWIKI>
6187 !! result
6188 <NOwiki>'''not wiki'''</noWIKI>
6189 !! end
6190
6191 !! test
6192 pre-save transform: unclosed comment in <nowiki>
6193 !! options
6194 pst noxml
6195 !! input
6196 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6197 !! result
6198 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6199 !!end
6200
6201 !! article
6202 Template:dangerous
6203 !!text
6204 <span onmouseover="alert('crap')">Oh no</span>
6205 !!endarticle
6206
6207 !!test
6208 (confirming safety of fix for subst bug 1936)
6209 !! input
6210 {{Template:dangerous}}
6211 !! result
6212 <p><span>Oh no</span>
6213 </p>
6214 !! end
6215
6216 !! test
6217 pre-save transform: comment containing gallery (bug 5024)
6218 !! options
6219 pst
6220 !! input
6221 <!-- <gallery>data</gallery> -->
6222 !!result
6223 <!-- <gallery>data</gallery> -->
6224 !!end
6225
6226 !! test
6227 pre-save transform: comment containing extension
6228 !! options
6229 pst
6230 !! input
6231 <!-- <tag>data</tag> -->
6232 !!result
6233 <!-- <tag>data</tag> -->
6234 !!end
6235
6236 !! test
6237 pre-save transform: comment containing nowiki
6238 !! options
6239 pst
6240 !! input
6241 <!-- <nowiki>data</nowiki> -->
6242 !!result
6243 <!-- <nowiki>data</nowiki> -->
6244 !!end
6245
6246 !! test
6247 pre-save transform: <noinclude> in subst (bug 3298)
6248 !! options
6249 pst
6250 !! input
6251 {{subst:Includes}}
6252 !! result
6253 Foobar
6254 !! end
6255
6256 !! test
6257 pre-save transform: <onlyinclude> in subst (bug 3298)
6258 !! options
6259 pst
6260 !! input
6261 {{subst:Includes2}}
6262 !! result
6263 Foo
6264 !! end
6265
6266 !! article
6267 Template:SubstTest
6268 !!text
6269 {{<includeonly>subst:</includeonly>Includes}}
6270 !! endarticle
6271
6272 !! article
6273 Template:SafeSubstTest
6274 !! text
6275 {{<includeonly>safesubst:</includeonly>Includes}}
6276 !! endarticle
6277
6278 !! test
6279 bug 22297: safesubst: works during PST
6280 !! options
6281 pst
6282 !! input
6283 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6284 !! result
6285 FoobarFoobar
6286 !! end
6287
6288 !! test
6289 bug 22297: safesubst: works during normal parse
6290 !! input
6291 {{SafeSubstTest}}
6292 !! result
6293 <p>Foobar
6294 </p>
6295 !! end
6296
6297 !! test:
6298 subst: does not work during normal parse
6299 !! input
6300 {{SubstTest}}
6301 !! result
6302 <p>{{subst:Includes}}
6303 </p>
6304 !! end
6305
6306 !! test
6307 pre-save transform: context links ("pipe trick")
6308 !! options
6309 pst
6310 !! input
6311 [[Article (context)|]]
6312 [[Bar:Article|]]
6313 [[:Bar:Article|]]
6314 [[Bar:Article (context)|]]
6315 [[:Bar:Article (context)|]]
6316 [[|Article]]
6317 [[|Article (context)]]
6318 [[Bar:X (Y) Z|]]
6319 [[:Bar:X (Y) Z|]]
6320 !! result
6321 [[Article (context)|Article]]
6322 [[Bar:Article|Article]]
6323 [[:Bar:Article|Article]]
6324 [[Bar:Article (context)|Article]]
6325 [[:Bar:Article (context)|Article]]
6326 [[Article]]
6327 [[Article (context)]]
6328 [[Bar:X (Y) Z|X (Y) Z]]
6329 [[:Bar:X (Y) Z|X (Y) Z]]
6330 !! end
6331
6332 !! test
6333 pre-save transform: context links ("pipe trick") with interwiki prefix
6334 !! options
6335 pst
6336 !! input
6337 [[interwiki:Article|]]
6338 [[:interwiki:Article|]]
6339 [[interwiki:Bar:Article|]]
6340 [[:interwiki:Bar:Article|]]
6341 !! result
6342 [[interwiki:Article|Article]]
6343 [[:interwiki:Article|Article]]
6344 [[interwiki:Bar:Article|Bar:Article]]
6345 [[:interwiki:Bar:Article|Bar:Article]]
6346 !! end
6347
6348 !! test
6349 pre-save transform: context links ("pipe trick") with parens in title
6350 !! options
6351 pst title=[[Somearticle (context)]]
6352 !! input
6353 [[|Article]]
6354 !! result
6355 [[Article (context)|Article]]
6356 !! end
6357
6358 !! test
6359 pre-save transform: context links ("pipe trick") with comma in title
6360 !! options
6361 pst title=[[Someplace, Somewhere]]
6362 !! input
6363 [[|Otherplace]]
6364 [[Otherplace, Elsewhere|]]
6365 [[Otherplace, Elsewhere, Anywhere|]]
6366 !! result
6367 [[Otherplace, Somewhere|Otherplace]]
6368 [[Otherplace, Elsewhere|Otherplace]]
6369 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6370 !! end
6371
6372 !! test
6373 pre-save transform: context links ("pipe trick") with parens and comma
6374 !! options
6375 pst title=[[Someplace (IGNORED), Somewhere]]
6376 !! input
6377 [[|Otherplace]]
6378 [[Otherplace (place), Elsewhere|]]
6379 !! result
6380 [[Otherplace, Somewhere|Otherplace]]
6381 [[Otherplace (place), Elsewhere|Otherplace]]
6382 !! end
6383
6384 !! test
6385 pre-save transform: context links ("pipe trick") with comma and parens
6386 !! options
6387 pst title=[[Who, me? (context)]]
6388 !! input
6389 [[|Yes, you.]]
6390 [[Me, Myself, and I (1937 song)|]]
6391 !! result
6392 [[Yes, you. (context)|Yes, you.]]
6393 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6394 !! end
6395
6396 !! test
6397 pre-save transform: context links ("pipe trick") with namespace
6398 !! options
6399 pst title=[[Ns:Somearticle]]
6400 !! input
6401 [[|Article]]
6402 !! result
6403 [[Ns:Article|Article]]
6404 !! end
6405
6406 !! test
6407 pre-save transform: context links ("pipe trick") with namespace and parens
6408 !! options
6409 pst title=[[Ns:Somearticle (context)]]
6410 !! input
6411 [[|Article]]
6412 !! result
6413 [[Ns:Article (context)|Article]]
6414 !! end
6415
6416 !! test
6417 pre-save transform: context links ("pipe trick") with namespace and comma
6418 !! options
6419 pst title=[[Ns:Somearticle, Context, Whatever]]
6420 !! input
6421 [[|Article]]
6422 !! result
6423 [[Ns:Article, Context, Whatever|Article]]
6424 !! end
6425
6426 !! test
6427 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6428 !! options
6429 pst title=[[Ns:Somearticle, Context (context)]]
6430 !! input
6431 [[|Article]]
6432 !! result
6433 [[Ns:Article (context)|Article]]
6434 !! end
6435
6436 !! test
6437 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6438 !! options
6439 pst title=[[Ns:Somearticle (IGNORED), Context]]
6440 !! input
6441 [[|Article]]
6442 !! result
6443 [[Ns:Article, Context|Article]]
6444 !! end
6445
6446 !! test
6447 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6448 !! options
6449 pst
6450 !! input
6451 [[Article(context)|]]
6452 [[Bar:Article(context)|]]
6453 [[:Bar:Article(context)|]]
6454 [[|Article(context)]]
6455 [[Bar:X(Y)Z|]]
6456 [[:Bar:X(Y)Z|]]
6457 !! result
6458 [[Article(context)|Article]]
6459 [[Bar:Article(context)|Article]]
6460 [[:Bar:Article(context)|Article]]
6461 [[Article(context)]]
6462 [[Bar:X(Y)Z|X(Y)Z]]
6463 [[:Bar:X(Y)Z|X(Y)Z]]
6464 !! end
6465
6466 !! test
6467 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6468 !! options
6469 pst
6470 !! input
6471 [[Article (context)|]]
6472 [[Bar:Article (context)|]]
6473 [[:Bar:Article (context)|]]
6474 [[|Article (context)]]
6475 [[Bar:X (Y) Z|]]
6476 [[:Bar:X (Y) Z|]]
6477 !! result
6478 [[Article (context)|Article]]
6479 [[Bar:Article (context)|Article]]
6480 [[:Bar:Article (context)|Article]]
6481 [[Article (context)]]
6482 [[Bar:X (Y) Z|X (Y) Z]]
6483 [[:Bar:X (Y) Z|X (Y) Z]]
6484 !! end
6485
6486 !! test
6487 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6488 !! options
6489 pst
6490 !! input
6491 [[Article(context)|]]
6492 [[Bar:Article(context)|]]
6493 [[:Bar:Article(context)|]]
6494 [[|Article(context)]]
6495 [[Bar:X(Y)Z|]]
6496 [[:Bar:X(Y)Z|]]
6497 !! result
6498 [[Article(context)|Article]]
6499 [[Bar:Article(context)|Article]]
6500 [[:Bar:Article(context)|Article]]
6501 [[Article(context)]]
6502 [[Bar:X(Y)Z|X(Y)Z]]
6503 [[:Bar:X(Y)Z|X(Y)Z]]
6504 !! end
6505
6506 !! test
6507 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6508 !! options
6509 pst
6510 !! input
6511 [[Article (context), context|]]
6512 [[Article (context),context|]]
6513 [[Bar:Article (context), context|]]
6514 [[Bar:Article (context),context|]]
6515 [[:Bar:Article (context), context|]]
6516 [[:Bar:Article (context),context|]]
6517 !! result
6518 [[Article (context), context|Article]]
6519 [[Article (context),context|Article]]
6520 [[Bar:Article (context), context|Article]]
6521 [[Bar:Article (context),context|Article]]
6522 [[:Bar:Article (context), context|Article]]
6523 [[:Bar:Article (context),context|Article]]
6524 !! end
6525
6526 !! test
6527 pre-save transform: trim trailing empty lines
6528 !! options
6529 pst
6530 !! input
6531 Empty lines are trimmed
6532
6533
6534
6535
6536 !! result
6537 Empty lines are trimmed
6538 !! end
6539
6540 !! test
6541 pre-save transform: Signature expansion
6542 !! options
6543 pst
6544 !! input
6545 * ~~~
6546 * <noinclude>~~~</noinclude>
6547 * <includeonly>~~~</includeonly>
6548 * <onlyinclude>~~~</onlyinclude>
6549 !! result
6550 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6551 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6552 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6553 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6554 !! end
6555
6556
6557 !! test
6558 pre-save transform: Signature expansion in nowiki tags (bug 93)
6559 !! options
6560 pst disabled
6561 !! input
6562 Shall not expand:
6563
6564 <nowiki>~~~~</nowiki>
6565
6566 <includeonly><nowiki>~~~~</nowiki></includeonly>
6567
6568 <noinclude><nowiki>~~~~</nowiki></noinclude>
6569
6570 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6571
6572 {{subst:Foo}} shall be converted to FOO
6573
6574 As well as inside noinclude/onlyinclude
6575 <noinclude>{{subst:Foo}}</noinclude>
6576 <onlyinclude>{{subst:Foo}}</onlyinclude>
6577
6578 But not inside includeonly
6579 <includeonly>{{subst:Foo}}</includeonly>
6580 !! result
6581 Shall not expand:
6582
6583 <nowiki>~~~~</nowiki>
6584
6585 <includeonly><nowiki>~~~~</nowiki></includeonly>
6586
6587 <noinclude><nowiki>~~~~</nowiki></noinclude>
6588
6589 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6590
6591 FOO shall be converted to FOO
6592
6593 As well as inside noinclude/onlyinclude
6594 <noinclude>FOO</noinclude>
6595 <onlyinclude>FOO</onlyinclude>
6596
6597 But not inside includeonly
6598 <includeonly>{{subst:Foo}}</includeonly>
6599 !! end
6600
6601 ###
6602 ### Message transform tests
6603 ###
6604 !! test
6605 message transform: magic variables
6606 !! options
6607 msg
6608 !! input
6609 {{SITENAME}}
6610 !! result
6611 MediaWiki
6612 !! end
6613
6614 !! test
6615 message transform: should not transform wiki markup
6616 !! options
6617 msg
6618 !! input
6619 ''test''
6620 !! result
6621 ''test''
6622 !! end
6623
6624 !! test
6625 message transform: <noinclude> in transcluded template (bug 4926)
6626 !! options
6627 msg
6628 !! input
6629 {{Includes}}
6630 !! result
6631 Foobar
6632 !! end
6633
6634 !! test
6635 message transform: <onlyinclude> in transcluded template (bug 4926)
6636 !! options
6637 msg
6638 !! input
6639 {{Includes2}}
6640 !! result
6641 Foo
6642 !! end
6643
6644 !! test
6645 {{#special:}} page name, known
6646 !! options
6647 msg
6648 !! input
6649 {{#special:Recentchanges}}
6650 !! result
6651 Special:RecentChanges
6652 !! end
6653
6654 !! test
6655 {{#special:}} page name with subpage, known
6656 !! options
6657 msg
6658 !! input
6659 {{#special:Recentchanges/param}}
6660 !! result
6661 Special:RecentChanges/param
6662 !! end
6663
6664 !! test
6665 {{#special:}} page name, unknown
6666 !! options
6667 msg
6668 !! input
6669 {{#special:foobarnonexistent}}
6670 !! result
6671 No such special page
6672 !! end
6673
6674 !! test
6675 {{#speciale:}} page name, known
6676 !! options
6677 msg
6678 !! input
6679 {{#speciale:Recentchanges}}
6680 !! result
6681 Special:RecentChanges
6682 !! end
6683
6684 !! test
6685 {{#speciale:}} page name with subpage, known
6686 !! options
6687 msg
6688 !! input
6689 {{#speciale:Recentchanges/param}}
6690 !! result
6691 Special:RecentChanges/param
6692 !! end
6693
6694 !! test
6695 {{#speciale:}} page name, unknown
6696 !! options
6697 msg
6698 !! input
6699 {{#speciale:foobarnonexistent}}
6700 !! result
6701 No_such_special_page
6702 !! end
6703
6704 ###
6705 ### Images
6706 ###
6707 !! test
6708 Simple image
6709 !! input
6710 [[Image:foobar.jpg]]
6711 !! result
6712 <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>
6713 </p>
6714 !! end
6715
6716 !! test
6717 Right-aligned image
6718 !! input
6719 [[Image:foobar.jpg|right]]
6720 !! result
6721 <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>
6722
6723 !! end
6724
6725 !! test
6726 Simple image (using File: namespace, now canonical)
6727 !! input
6728 [[File: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 Image with caption
6736 !! input
6737 [[Image:foobar.jpg|right|Caption text]]
6738 !! result
6739 <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>
6740
6741 !! end
6742
6743 !! test
6744 Image with empty attribute
6745 !! input
6746 [[Image:foobar.jpg|right||Caption text]]
6747 !! result
6748 <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>
6749
6750 !! end
6751
6752 !! test
6753 Image with link tails
6754 !! input
6755 123[[Image:foobar.jpg]]456
6756 123[[Image:foobar.jpg|right]]456
6757 123[[Image:foobar.jpg|thumb]]456
6758 !! result
6759 <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
6760 </p>
6761 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
6762 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
6763
6764 !! end
6765
6766 !! test
6767 Image with multiple captions -- only last one is accepted
6768 !! input
6769 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6770 !! result
6771 <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>
6772
6773 !! end
6774
6775 !! test
6776 Image with width attribute at different positions
6777 !! input
6778 [[Image:foobar.jpg|200px|right|Caption]]
6779 [[Image:foobar.jpg|right|200px|Caption]]
6780 [[Image:foobar.jpg|right|Caption|200px]]
6781 !! result
6782 <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>
6783 <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>
6784 <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>
6785
6786 !! end
6787
6788 !! test
6789 Image with link parameter, wiki target
6790 !! input
6791 [[Image:foobar.jpg|link=Target page]]
6792 !! result
6793 <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>
6794 </p>
6795 !! end
6796
6797 !! test
6798 Image with link parameter, URL target
6799 !! input
6800 [[Image:foobar.jpg|link=http://example.com/]]
6801 !! result
6802 <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>
6803 </p>
6804 !! end
6805
6806 !! test
6807 Image with link parameter, wgExternalLinkTarget
6808 !! input
6809 [[Image:foobar.jpg|link=http://example.com/]]
6810 !! config
6811 wgExternalLinkTarget='foobar'
6812 !! result
6813 <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>
6814 </p>
6815 !! end
6816
6817 !! test
6818 Image with link parameter, wgNoFollowLinks set to false
6819 !! input
6820 [[Image:foobar.jpg|link=http://example.com/]]
6821 !! config
6822 wgNoFollowLinks=false
6823 !! result
6824 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6825 </p>
6826 !! end
6827
6828 !! test
6829 Image with link parameter, wgNoFollowDomainExceptions
6830 !! input
6831 [[Image:foobar.jpg|link=http://example.com/]]
6832 !! config
6833 wgNoFollowDomainExceptions='example.com'
6834 !! result
6835 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6836 </p>
6837 !! end
6838
6839 !! test
6840 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6841 !! input
6842 [[Image:foobar.jpg|link=http://example.com/|Title]]
6843 !! config
6844 wgExternalLinkTarget='foobar'
6845 !! result
6846 <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>
6847 </p>
6848 !! end
6849
6850 !! test
6851 Image with empty link parameter
6852 !! input
6853 [[Image:foobar.jpg|link=]]
6854 !! result
6855 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6856 </p>
6857 !! end
6858
6859 !! test
6860 Image with link parameter (wiki target) and unnamed parameter
6861 !! input
6862 [[Image:foobar.jpg|link=Target page|Title]]
6863 !! result
6864 <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>
6865 </p>
6866 !! end
6867
6868 !! test
6869 Image with link parameter (URL target) and unnamed parameter
6870 !! input
6871 [[Image:foobar.jpg|link=http://example.com/|Title]]
6872 !! result
6873 <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>
6874 </p>
6875 !! end
6876
6877 !! test
6878 Thumbnail image with link parameter
6879 !! input
6880 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6881 !! result
6882 <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>
6883
6884 !! end
6885
6886 !! test
6887 Image with frame and link
6888 !! input
6889 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6890 !! result
6891 <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>
6892
6893 !! end
6894
6895 !! test
6896 Image with frame and link and explicit alt
6897 !! input
6898 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6899 !! result
6900 <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>
6901
6902 !! end
6903
6904 !! test
6905 Image with wiki markup in implicit alt
6906 !! input
6907 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6908 !! result
6909 <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>
6910 </p>
6911 !! end
6912
6913 !! test
6914 Image with wiki markup in explicit alt
6915 !! input
6916 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6917 !! result
6918 <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>
6919 </p>
6920 !! end
6921
6922 !! test
6923 Link to image page- image page normally doesn't exists, hence edit link
6924 Add test with existing image page
6925 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6926 !! input
6927 [[:Image:test]]
6928 !! result
6929 <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>
6930 </p>
6931 !! end
6932
6933 !! test
6934 bug 18784 Link to non-existent image page with caption should use caption as link text
6935 !! input
6936 [[:Image:test|caption]]
6937 !! result
6938 <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>
6939 </p>
6940 !! end
6941
6942 !! test
6943 Frameless image caption with a free URL
6944 !! input
6945 [[Image:foobar.jpg|http://example.com]]
6946 !! result
6947 <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>
6948 </p>
6949 !! end
6950
6951 !! test
6952 Thumbnail image caption with a free URL
6953 !! input
6954 [[Image:foobar.jpg|thumb|http://example.com]]
6955 !! result
6956 <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>
6957
6958 !! end
6959
6960 !! test
6961 Thumbnail image caption with a free URL and explicit alt
6962 !! input
6963 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6964 !! result
6965 <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>
6966
6967 !! end
6968
6969 !! test
6970 BUG 1887: A ISBN with a thumbnail
6971 !! input
6972 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
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 href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
6975
6976 !! end
6977
6978 !! test
6979 BUG 1887: A RFC with a thumbnail
6980 !! input
6981 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6982 !! result
6983 <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>
6984
6985 !! end
6986
6987 !! test
6988 BUG 1887: A mailto link with a thumbnail
6989 !! input
6990 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
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>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
6993
6994 !! end
6995
6996 # Pending resolution to bug 368
6997 !! test
6998 BUG 648: Frameless image caption with a link
6999 !! input
7000 [[Image:foobar.jpg|text with a [[link]] in it]]
7001 !! result
7002 <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>
7003 </p>
7004 !! end
7005
7006 !! test
7007 BUG 648: Frameless image caption with a link (suffix)
7008 !! input
7009 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7010 !! result
7011 <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>
7012 </p>
7013 !! end
7014
7015 !! test
7016 BUG 648: Frameless image caption with an interwiki link
7017 !! input
7018 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7019 !! result
7020 <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>
7021 </p>
7022 !! end
7023
7024 !! test
7025 BUG 648: Frameless image caption with a piped interwiki link
7026 !! input
7027 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7028 !! result
7029 <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>
7030 </p>
7031 !! end
7032
7033 !! test
7034 Escape HTML special chars in image alt text
7035 !! input
7036 [[Image:foobar.jpg|& < > "]]
7037 !! result
7038 <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>
7039 </p>
7040 !! end
7041
7042 !! test
7043 BUG 499: Alt text should have &#1234;, not &amp;1234;
7044 !! input
7045 [[Image:foobar.jpg|&#9792;]]
7046 !! result
7047 <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>
7048 </p>
7049 !! end
7050
7051 !! test
7052 Broken image caption with link
7053 !! input
7054 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7055 !! result
7056 <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.
7057 </p>
7058 !! end
7059
7060 !! test
7061 Image caption containing another image
7062 !! input
7063 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7064 !! result
7065 <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>
7066
7067 !! end
7068
7069 !! test
7070 Image caption containing a newline
7071 !! input
7072 [[Image:Foobar.jpg|This
7073 *is some text]]
7074 !! result
7075 <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>
7076 </p>
7077 !!end
7078
7079 !!test
7080 Parsoid: Image caption containing leading space
7081 (The leading space should not trigger nowiki escaping in wt2wt mode)
7082 !! input
7083 [[Image:Foobar.jpg|thumb| bar]]
7084 !! result
7085 <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>
7086
7087 !!end
7088
7089 !! test
7090 Bug 3090: External links other than http: in image captions
7091 !! input
7092 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7093 !! result
7094 <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>
7095
7096 !! end
7097
7098 !! test
7099 Custom class
7100 !! input
7101 [[Image:foobar.jpg|a|class=b]]
7102 !! result
7103 <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>
7104 </p>
7105 !! end
7106
7107 !! test
7108 Localized image handling (1).
7109 !! options
7110 language=es
7111 !! input
7112 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7113 !! result
7114 <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>
7115
7116 !! end
7117
7118 !! test
7119 Localized image handling (2).
7120 !! options
7121 language=es
7122 !! input
7123 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7124 !! result
7125 <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>
7126
7127 !! end
7128
7129 !! test
7130 "border", "frameless" and "class" attributes on an image.
7131 !! input
7132 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7133 !! result
7134 <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>
7135 </p>
7136 !! end
7137
7138 !! article
7139 File:Barfoo.jpg
7140 !! text
7141 #REDIRECT [[File:Barfoo.jpg]]
7142 !! endarticle
7143
7144 !! test
7145 Redirected image
7146 !! input
7147 [[Image:Barfoo.jpg]]
7148 !! result
7149 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7150 </p>
7151 !! end
7152
7153 !! test
7154 Missing image with uploads disabled
7155 !! options
7156 wgEnableUploads=0
7157 !! input
7158 [[Image:Foobaz.jpg]]
7159 !! result
7160 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7161 </p>
7162 !! end
7163
7164
7165 ###
7166 ### Subpages
7167 ###
7168 !! article
7169 Subpage test/subpage
7170 !! text
7171 foo
7172 !! endarticle
7173
7174 !! test
7175 Subpage link
7176 !! options
7177 subpage title=[[Subpage test]]
7178 !! input
7179 [[/subpage]]
7180 !! result
7181 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7182 </p>
7183 !! end
7184
7185 !! test
7186 Subpage noslash link
7187 !! options
7188 subpage title=[[Subpage test]]
7189 !!input
7190 [[/subpage/]]
7191 !! result
7192 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7193 </p>
7194 !! end
7195
7196 !! test
7197 Disabled subpages
7198 !! input
7199 [[/subpage]]
7200 !! result
7201 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7202 </p>
7203 !! end
7204
7205 !! test
7206 BUG 561: {{/Subpage}}
7207 !! options
7208 subpage title=[[Page]]
7209 !! input
7210 {{/Subpage}}
7211 !! result
7212 <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>
7213 </p>
7214 !! end
7215
7216 ###
7217 ### Categories
7218 ###
7219 !! article
7220 Category:MediaWiki User's Guide
7221 !! text
7222 blah
7223 !! endarticle
7224
7225 !! test
7226 Link to category
7227 !! input
7228 [[:Category:MediaWiki User's Guide]]
7229 !! result
7230 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7231 </p>
7232 !! end
7233
7234 !! test
7235 Simple category
7236 !! options
7237 cat
7238 !! input
7239 [[Category:MediaWiki User's Guide]]
7240 !! result
7241 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7242 !! end
7243
7244 !! test
7245 PAGESINCATEGORY invalid title fatal (r33546 fix)
7246 !! input
7247 {{PAGESINCATEGORY:<bogus>}}
7248 !! result
7249 <p>0
7250 </p>
7251 !! end
7252
7253 !! test
7254 Category with different sort key
7255 !! options
7256 cat
7257 !! input
7258 [[Category:MediaWiki User's Guide|Foo]]
7259 !! result
7260 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7261 !! end
7262
7263 !! test
7264 Category with identical sort key
7265 !! options
7266 cat
7267 !! input
7268 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7269 !! result
7270 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7271 !! end
7272
7273 !! test
7274 Category with empty sort key
7275 !! options
7276 cat
7277 pst
7278 !! input
7279 [[Category:MediaWiki User's Guide|]]
7280 !! result
7281 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7282 !! end
7283
7284 !! test
7285 Category with empty sort key and parentheses
7286 !! options
7287 cat
7288 pst
7289 !! input
7290 [[Category:Foo (bar)|]]
7291 !! result
7292 [[Category:Foo (bar)|Foo]]
7293 !! end
7294
7295 !! test
7296 Category with link tail
7297 !! options
7298 cat
7299 pst
7300 !! input
7301 123[[Category:Foo]]456
7302 !! result
7303 123[[Category:Foo]]456
7304 !! end
7305
7306 !! test
7307 Category with template
7308 !! options
7309 cat
7310 pst
7311 !! input
7312 [[Category:{{echo|Foo}}]]
7313 !! result
7314 [[Category:{{echo|Foo}}]]
7315 !! end
7316
7317 !! test
7318 Category with template in sort key
7319 !! options
7320 cat
7321 pst
7322 !! input
7323 [[Category:Foo|{{echo|Bar}}]]
7324 !! result
7325 [[Category:Foo|{{echo|Bar}}]]
7326 !! end
7327
7328 !! test
7329 Category with template in sort key and title
7330 !! options
7331 cat
7332 pst
7333 !! input
7334 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7335 !! result
7336 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7337 !! end
7338
7339 !! test
7340 Category / paragraph interactions
7341 !! input
7342 Foo [[Category:Baz]] Bar
7343
7344 Foo [[Category:Baz]]
7345 Bar
7346
7347 Foo
7348 [[Category:Baz]]
7349 Bar
7350
7351 Foo
7352 [[Category:Baz]] Bar
7353
7354 Foo
7355 [[Category:Baz]]
7356 [[Category:Baz]]
7357 [[Category:Baz]]
7358 Bar
7359
7360 [[Category:Baz]]
7361 [[Category:Baz]]
7362 [[Category:Baz]]
7363
7364 [[Category:Baz]]
7365 {{echo|[[Category:Baz]]}}
7366 [[Category:Baz]]
7367 !! result
7368 <p>Foo Bar
7369 </p><p>Foo
7370 Bar
7371 </p><p>Foo
7372 Bar
7373 </p><p>Foo Bar
7374 </p><p>Foo
7375 Bar
7376 </p>
7377 !! end
7378
7379 ###
7380 ### Inter-language links
7381 ###
7382 !! test
7383 Inter-language links
7384 !! options
7385 ill
7386 !! input
7387 [[es:Alimento]]
7388 [[fr:Nourriture]]
7389 [[zh:&#39135;&#21697;]]
7390 !! result
7391 es:Alimento fr:Nourriture zh:食品
7392 !! end
7393
7394 !! test
7395 Duplicate interlanguage links (bug 24502)
7396 !! options
7397 ill
7398 !! input
7399 [[es:1]]
7400 [[es:2]]
7401 [[fr:1]]
7402 [[fr:2]]
7403 !! result
7404 es:1 fr:1
7405 !! end
7406
7407 ###
7408 ### Sections
7409 ###
7410 !! test
7411 Basic section headings
7412 !! input
7413 == Headline 1 ==
7414 Some text
7415
7416 ==Headline 2==
7417 More
7418 ===Smaller headline===
7419 Blah blah
7420 !! result
7421 <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>
7422 <p>Some text
7423 </p>
7424 <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>
7425 <p>More
7426 </p>
7427 <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>
7428 <p>Blah blah
7429 </p>
7430 !! end
7431
7432 !! test
7433 Section headings with TOC
7434 !! input
7435 == Headline 1 ==
7436 === Subheadline 1 ===
7437 ===== Skipping a level =====
7438 ====== Skipping a level ======
7439
7440 == Headline 2 ==
7441 Some text
7442 ===Another headline===
7443 !! result
7444 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7445 <ul>
7446 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7447 <ul>
7448 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7449 <ul>
7450 <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>
7451 <ul>
7452 <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>
7453 </ul>
7454 </li>
7455 </ul>
7456 </li>
7457 </ul>
7458 </li>
7459 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7460 <ul>
7461 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7462 </ul>
7463 </li>
7464 </ul>
7465 </td></tr></table>
7466 <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>
7467 <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>
7468 <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>
7469 <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>
7470 <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>
7471 <p>Some text
7472 </p>
7473 <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>
7474
7475 !! end
7476
7477 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7478 !! test
7479 Handling of sections up to level 6 and beyond
7480 !! input
7481 = Level 1 Heading=
7482 == Level 2 Heading==
7483 === Level 3 Heading===
7484 ==== Level 4 Heading====
7485 ===== Level 5 Heading=====
7486 ====== Level 6 Heading======
7487 ======= Level 7 Heading=======
7488 ======== Level 8 Heading========
7489 ========= Level 9 Heading=========
7490 ========== Level 10 Heading==========
7491 !! result
7492 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7493 <ul>
7494 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7495 <ul>
7496 <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>
7497 <ul>
7498 <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>
7499 <ul>
7500 <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>
7501 <ul>
7502 <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>
7503 <ul>
7504 <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>
7505 <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>
7506 <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>
7507 <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>
7508 <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>
7509 </ul>
7510 </li>
7511 </ul>
7512 </li>
7513 </ul>
7514 </li>
7515 </ul>
7516 </li>
7517 </ul>
7518 </li>
7519 </ul>
7520 </td></tr></table>
7521 <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>
7522 <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>
7523 <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>
7524 <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>
7525 <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>
7526 <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>
7527 <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>
7528 <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>
7529 <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>
7530 <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>
7531
7532 !! end
7533
7534 !! test
7535 TOC regression (bug 9764)
7536 !! input
7537 == title 1 ==
7538 === title 1.1 ===
7539 ==== title 1.1.1 ====
7540 === title 1.2 ===
7541 == title 2 ==
7542 === title 2.1 ===
7543 !! result
7544 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7545 <ul>
7546 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7547 <ul>
7548 <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>
7549 <ul>
7550 <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>
7551 </ul>
7552 </li>
7553 <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>
7554 </ul>
7555 </li>
7556 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7557 <ul>
7558 <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>
7559 </ul>
7560 </li>
7561 </ul>
7562 </td></tr></table>
7563 <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>
7564 <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>
7565 <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>
7566 <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>
7567 <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>
7568 <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>
7569
7570 !! end
7571
7572 !! test
7573 TOC with wgMaxTocLevel=3 (bug 6204)
7574 !! options
7575 wgMaxTocLevel=3
7576 !! input
7577 == title 1 ==
7578 === title 1.1 ===
7579 ==== title 1.1.1 ====
7580 === title 1.2 ===
7581 == title 2 ==
7582 === title 2.1 ===
7583 !! result
7584 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7585 <ul>
7586 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7587 <ul>
7588 <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>
7589 <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>
7590 </ul>
7591 </li>
7592 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7593 <ul>
7594 <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>
7595 </ul>
7596 </li>
7597 </ul>
7598 </td></tr></table>
7599 <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>
7600 <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>
7601 <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>
7602 <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>
7603 <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>
7604 <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>
7605
7606 !! end
7607
7608 !! test
7609 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7610 !! options
7611 wgMaxTocLevel=3
7612 !! input
7613 ==Section 1==
7614 ===Section 1.1===
7615 ====Section 1.1.1====
7616 ====Section 1.1.1.1====
7617 ==Section 2==
7618 !! result
7619 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7620 <ul>
7621 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7622 <ul>
7623 <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>
7624 </ul>
7625 </li>
7626 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7627 </ul>
7628 </td></tr></table>
7629 <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>
7630 <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>
7631 <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>
7632 <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>
7633 <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>
7634
7635 !! end
7636
7637
7638 !! test
7639 Resolving duplicate section names
7640 !! input
7641 == Foo bar ==
7642 == Foo bar ==
7643 !! result
7644 <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>
7645 <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>
7646
7647 !! end
7648
7649 !! test
7650 Resolving duplicate section names with differing case (bug 10721)
7651 !! input
7652 == Foo bar ==
7653 == Foo Bar ==
7654 !! result
7655 <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>
7656 <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>
7657
7658 !! end
7659
7660 !! article
7661 Template:sections
7662 !! text
7663 ===Section 1===
7664 ==Section 2==
7665 !! endarticle
7666
7667 !! test
7668 Template with sections, __NOTOC__
7669 !! input
7670 __NOTOC__
7671 ==Section 0==
7672 {{sections}}
7673 ==Section 4==
7674 !! result
7675 <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>
7676 <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>
7677 <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>
7678 <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>
7679
7680 !! end
7681
7682 !! test
7683 __NOEDITSECTION__ keyword
7684 !! input
7685 __NOEDITSECTION__
7686 ==Section 1==
7687 ==Section 2==
7688 !! result
7689 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7690 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7691
7692 !! end
7693
7694 !! test
7695 Link inside a section heading
7696 !! input
7697 ==Section with a [[Main Page|link]] in it==
7698 !! result
7699 <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>
7700
7701 !! end
7702
7703 !! test
7704 TOC regression (bug 12077)
7705 !! input
7706 __TOC__
7707 == title 1 ==
7708 === title 1.1 ===
7709 == title 2 ==
7710 !! result
7711 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7712 <ul>
7713 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7714 <ul>
7715 <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>
7716 </ul>
7717 </li>
7718 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7719 </ul>
7720 </td></tr></table>
7721 <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>
7722 <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>
7723 <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>
7724
7725 !! end
7726
7727 !! test
7728 BUG 1219 URL next to image (good)
7729 !! input
7730 http://example.com [[Image:foobar.jpg]]
7731 !! result
7732 <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>
7733 </p>
7734 !!end
7735
7736 !! test
7737 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
7738 !! input
7739 ===
7740 The line above must have a trailing space!
7741 === <!--
7742 --> <!-- -->
7743 But just in case it doesn't...
7744 !! result
7745 <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>
7746 <p>The line above must have a trailing space!
7747 </p>
7748 <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>
7749 <p>But just in case it doesn't...
7750 </p>
7751 !! end
7752
7753 !! test
7754 Header with special characters (bug 25462)
7755 !! input
7756 The tooltips shall not show entities to the user (ie. be double escaped)
7757
7758 == text > text ==
7759 section 1
7760
7761 == text < text ==
7762 section 2
7763
7764 == text & text ==
7765 section 3
7766
7767 == text ' text ==
7768 section 4
7769
7770 == text " text ==
7771 section 5
7772 !! result
7773 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7774 </p>
7775 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7776 <ul>
7777 <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>
7778 <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>
7779 <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>
7780 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7781 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7782 </ul>
7783 </td></tr></table>
7784 <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>
7785 <p>section 1
7786 </p>
7787 <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>
7788 <p>section 2
7789 </p>
7790 <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>
7791 <p>section 3
7792 </p>
7793 <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>
7794 <p>section 4
7795 </p>
7796 <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>
7797 <p>section 5
7798 </p>
7799 !! end
7800
7801 !! test
7802 Headers with excess '=' characters
7803 (Are similar tests necessary beyond the 1st level?)
7804 !! input
7805 =foo==
7806 ==foo=
7807 =''italic'' heading==
7808 ==''italic'' heading=
7809 !! result
7810 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7811 <ul>
7812 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7813 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7814 <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>
7815 <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>
7816 </ul>
7817 </td></tr></table>
7818 <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>
7819 <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>
7820 <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>
7821 <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>
7822
7823 !! end
7824
7825 !! test
7826 BUG 1219 URL next to image (broken)
7827 !! input
7828 http://example.com[[Image:foobar.jpg]]
7829 !! result
7830 <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>
7831 </p>
7832 !!end
7833
7834 !! test
7835 Bug 1186 news: in the middle of text
7836 !! input
7837 http://en.wikinews.org/wiki/Wikinews:Workplace
7838 !! result
7839 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7840 </p>
7841 !!end
7842
7843
7844 !! test
7845 Namespaced link must have a title
7846 !! input
7847 [[Project:]]
7848 !! result
7849 <p>[[Project:]]
7850 </p>
7851 !!end
7852
7853 !! test
7854 Namespaced link must have a title (bad fragment version)
7855 !! input
7856 [[Project:#fragment]]
7857 !! result
7858 <p>[[Project:#fragment]]
7859 </p>
7860 !!end
7861
7862
7863 ###
7864 ### HTML tags and HTML attributes
7865 ###
7866
7867 !! test
7868 div with no attributes
7869 !! input
7870 <div>HTML rocks</div>
7871 !! result
7872 <div>HTML rocks</div>
7873
7874 !! end
7875
7876 !! test
7877 div with double-quoted attribute
7878 !! input
7879 <div id="rock">HTML rocks</div>
7880 !! result
7881 <div id="rock">HTML rocks</div>
7882
7883 !! end
7884
7885 !! test
7886 div with single-quoted attribute
7887 !! input
7888 <div id='rock'>HTML rocks</div>
7889 !! result
7890 <div id="rock">HTML rocks</div>
7891
7892 !! end
7893
7894 !! test
7895 div with unquoted 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 illegal double attributes
7905 !! input
7906 <div id="a" id="b">HTML rocks</div>
7907 !! result
7908 <div id="b">HTML rocks</div>
7909
7910 !!end
7911
7912 # FIXME: produce empty string instead of "class" in the PHP parser, following
7913 # the HTML5 spec.
7914 !! test
7915 div with empty attribute value, space before equals
7916 !! options
7917 disabled
7918 !! input
7919 <div class =>HTML rocks</div>
7920 !! result
7921 <div class="">HTML rocks</div>
7922
7923 !! end
7924
7925 # The PHP parser escapes the opening brace to &#123; for some reason, so
7926 # disabled this test for it.
7927 !! test
7928 div with braces in attribute value
7929 !! options
7930 disabled
7931 !! input
7932 <div title="{}">Foo</div>
7933 !! result
7934 <div title="{}">Foo</div>
7935 !! end
7936
7937 # This it very inconsistent in the PHP parser: it returns
7938 # class="class" if there is a space between the name and the equal sign (see
7939 # 'div with empty attribute value, space before equals'), but strips the
7940 # attribute completely if the space is missing. We hope that not much content
7941 # depends on this, so are implementing the behavior below in Parsoid for
7942 # consistencies' sake. Disabled for the PHP parser.
7943 # FIXME: fix this behavior in the PHP parser?
7944 !! test
7945 div with empty attribute value, no space before equals
7946 !! options
7947 disabled
7948 !! input
7949 <div class=>HTML rocks</div>
7950 !! result
7951 <div class="">HTML rocks</div>
7952
7953 !! end
7954
7955 !! test
7956 HTML multiple attributes correction
7957 !! input
7958 <p class="error" class="awesome">Awesome!</p>
7959 !! result
7960 <p class="awesome">Awesome!</p>
7961
7962 !!end
7963
7964 !! test
7965 Table multiple attributes correction
7966 !! input
7967 {|
7968 !+ class="error" class="awesome"| status
7969 |}
7970 !! result
7971 <table>
7972 <tr>
7973 <th class="awesome"> status
7974 </th></tr></table>
7975
7976 !!end
7977
7978 !! test
7979 DIV IN UPPERCASE
7980 !! input
7981 <DIV ID="x">HTML ROCKS</DIV>
7982 !! result
7983 <div id="x">HTML ROCKS</div>
7984
7985 !!end
7986
7987 !! test
7988 Non-ASCII pseudo-tags are rendered as text
7989 !! input
7990 <khyô>
7991 !! result
7992 <p>&lt;khyô&gt;
7993 </p>
7994 !! end
7995
7996 !! test
7997 Pseudo-tag with URL 'name' renders as url link
7998 !! input
7999 <http://example.com/>
8000 !! result
8001 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8002 </p>
8003 !! end
8004
8005 !! test
8006 text with amp in the middle of nowhere
8007 !! input
8008 Remember AT&T?
8009 !!result
8010 <p>Remember AT&amp;T?
8011 </p>
8012 !! end
8013
8014 !! test
8015 text with character entity: eacute
8016 !! input
8017 I always thought &eacute; was a cute letter.
8018 !! result
8019 <p>I always thought &#233; was a cute letter.
8020 </p>
8021 !! end
8022
8023 !! test
8024 text with entity-escaped character entity-like string: eacute
8025 !! input
8026 I always thought &amp;eacute; was a cute letter.
8027 !! result
8028 <p>I always thought &amp;eacute; was a cute letter.
8029 </p>
8030 !! end
8031
8032 !! test
8033 text with undefined character entity: xacute
8034 !! input
8035 I always thought &xacute; was a cute letter.
8036 !! result
8037 <p>I always thought &amp;xacute; was a cute letter.
8038 </p>
8039 !! end
8040
8041
8042 ###
8043 ### Media links
8044 ###
8045
8046 !! test
8047 Media link
8048 !! input
8049 [[Media:Foobar.jpg]]
8050 !! result
8051 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8052 </p>
8053 !! end
8054
8055 !! test
8056 Media link with text
8057 !! input
8058 [[Media:Foobar.jpg|A neat file to look at]]
8059 !! result
8060 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8061 </p>
8062 !! end
8063
8064 # FIXME: this is still bad HTML tag nesting
8065 !! test
8066 Media link with nasty text
8067 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8068 !! input
8069 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8070 !! result
8071 <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>
8072
8073 !! end
8074
8075 !! test
8076 Media link to nonexistent file (bug 1702)
8077 !! input
8078 [[Media:No such.jpg]]
8079 !! result
8080 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8081 </p>
8082 !! end
8083
8084 !! test
8085 Image link to nonexistent file (bug 1850 - good)
8086 !! input
8087 [[Image:No such.jpg]]
8088 !! result
8089 <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>
8090 </p>
8091 !! end
8092
8093 !! test
8094 :Image link to nonexistent file (bug 1850 - bad)
8095 !! input
8096 [[:Image:No such.jpg]]
8097 !! result
8098 <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>
8099 </p>
8100 !! end
8101
8102
8103
8104 !! test
8105 Character reference normalization in link text (bug 1938)
8106 !! input
8107 [[Main Page|this&that]]
8108 !! result
8109 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8110 </p>
8111 !!end
8112
8113 !! article
8114 אַ
8115 !! text
8116 Test for unicode normalization
8117
8118 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8119 !! endarticle
8120
8121 !! test
8122 (bug 19451) Links should refer to the normalized form.
8123 !! input
8124 [[&#xFB2E;]]
8125 [[&#x5d0;&#x5b7;]]
8126 [[&#x5d0;ַ]]
8127 [[א&#x5b7;]]
8128 [[אַ]]
8129 !! result
8130 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8131 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8132 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8133 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8134 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8135 </p>
8136 !! end
8137
8138 !! test
8139 Empty attribute crash test (bug 2067)
8140 !! input
8141 <font color="">foo</font>
8142 !! result
8143 <p><font color="">foo</font>
8144 </p>
8145 !! end
8146
8147 !! test
8148 Empty attribute crash test single-quotes (bug 2067)
8149 !! input
8150 <font color=''>foo</font>
8151 !! result
8152 <p><font color="">foo</font>
8153 </p>
8154 !! end
8155
8156 !! test
8157 Attribute test: equals, then nothing
8158 !! input
8159 <font color=>foo</font>
8160 !! result
8161 <p><font>foo</font>
8162 </p>
8163 !! end
8164
8165 !! test
8166 Attribute test: unquoted value
8167 !! input
8168 <font color=x>foo</font>
8169 !! result
8170 <p><font color="x">foo</font>
8171 </p>
8172 !! end
8173
8174 !! test
8175 Attribute test: unquoted but illegal value (hash)
8176 !! input
8177 <font color=#x>foo</font>
8178 !! result
8179 <p><font color="#x">foo</font>
8180 </p>
8181 !! end
8182
8183 !! test
8184 Attribute test: no value
8185 !! input
8186 <font color>foo</font>
8187 !! result
8188 <p><font color="color">foo</font>
8189 </p>
8190 !! end
8191
8192 !! test
8193 Bug 2095: link with three closing brackets
8194 !! input
8195 [[Main Page]]]
8196 !! result
8197 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8198 </p>
8199 !! end
8200
8201 !! test
8202 Bug 2095: link with pipe and three closing brackets
8203 !! input
8204 [[Main Page|link]]]
8205 !! result
8206 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8207 </p>
8208 !! end
8209
8210 !! test
8211 Bug 2095: link with pipe and three closing brackets, version 2
8212 !! input
8213 [[Main Page|[http://example.com/]]]
8214 !! result
8215 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8216 </p>
8217 !! end
8218
8219
8220 ###
8221 ### Safety
8222 ###
8223
8224 !! article
8225 Template:Dangerous attribute
8226 !! text
8227 " onmouseover="alert(document.cookie)
8228 !! endarticle
8229
8230 !! article
8231 Template:Dangerous style attribute
8232 !! text
8233 border-size: expression(alert(document.cookie))
8234 !! endarticle
8235
8236 !! article
8237 Template:Div style
8238 !! text
8239 <div style="float: right; {{{1}}}">Magic div</div>
8240 !! endarticle
8241
8242 !! test
8243 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8244 !! input
8245 <div title="{{test}}"></div>
8246 !! result
8247 <div title="This is a test template"></div>
8248
8249 !! end
8250
8251 !! test
8252 Bug 2304: HTML attribute safety (dangerous template; 2309)
8253 !! input
8254 <div title="{{dangerous attribute}}"></div>
8255 !! result
8256 <div title=""></div>
8257
8258 !! end
8259
8260 !! test
8261 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8262 !! input
8263 <div style="{{dangerous style attribute}}"></div>
8264 !! result
8265 <div style="/* insecure input */"></div>
8266
8267 !! end
8268
8269 !! test
8270 Bug 2304: HTML attribute safety (safe parameter; 2309)
8271 !! input
8272 {{div style|width: 200px}}
8273 !! result
8274 <div style="float: right; width: 200px">Magic div</div>
8275
8276 !! end
8277
8278 !! test
8279 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8280 !! input
8281 {{div style|width: expression(alert(document.cookie))}}
8282 !! result
8283 <div style="/* insecure input */">Magic div</div>
8284
8285 !! end
8286
8287 !! test
8288 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8289 !! input
8290 {{div style|"><script>alert(document.cookie)</script>}}
8291 !! result
8292 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8293
8294 !! end
8295
8296 !! test
8297 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8298 !! input
8299 {{div style|" ><script>alert(document.cookie)</script>}}
8300 !! result
8301 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8302
8303 !! end
8304
8305 !! test
8306 Bug 2304: HTML attribute safety (link)
8307 !! input
8308 <div title="[[Main Page]]"></div>
8309 !! result
8310 <div title="&#91;&#91;Main Page]]"></div>
8311
8312 !! end
8313
8314 !! test
8315 Bug 2304: HTML attribute safety (italics)
8316 !! input
8317 <div title="''foobar''"></div>
8318 !! result
8319 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8320
8321 !! end
8322
8323 !! test
8324 Bug 2304: HTML attribute safety (bold)
8325 !! input
8326 <div title="'''foobar'''"></div>
8327 !! result
8328 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8329
8330 !! end
8331
8332
8333 !! test
8334 Bug 2304: HTML attribute safety (ISBN)
8335 !! input
8336 <div title="ISBN 1234567890"></div>
8337 !! result
8338 <div title="&#73;SBN 1234567890"></div>
8339
8340 !! end
8341
8342 !! test
8343 Bug 2304: HTML attribute safety (RFC)
8344 !! input
8345 <div title="RFC 1234"></div>
8346 !! result
8347 <div title="&#82;FC 1234"></div>
8348
8349 !! end
8350
8351 !! test
8352 Bug 2304: HTML attribute safety (PMID)
8353 !! input
8354 <div title="PMID 1234567890"></div>
8355 !! result
8356 <div title="&#80;MID 1234567890"></div>
8357
8358 !! end
8359
8360 !! test
8361 Bug 2304: HTML attribute safety (web link)
8362 !! input
8363 <div title="http://example.com/"></div>
8364 !! result
8365 <div title="http&#58;//example.com/"></div>
8366
8367 !! end
8368
8369 !! test
8370 Bug 2304: HTML attribute safety (named web link)
8371 !! input
8372 <div title="[http://example.com/ link]"></div>
8373 !! result
8374 <div title="&#91;http&#58;//example.com/ link]"></div>
8375
8376 !! end
8377
8378 !! test
8379 Bug 3244: HTML attribute safety (extension; safe)
8380 !! input
8381 <div style="<nowiki>background:blue</nowiki>"></div>
8382 !! result
8383 <div style="background:blue"></div>
8384
8385 !! end
8386
8387 !! test
8388 Bug 3244: HTML attribute safety (extension; unsafe)
8389 !! input
8390 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8391 !! result
8392 <div style="/* insecure input */"></div>
8393
8394 !! end
8395
8396 # More MSIE fun discovered by Tom Gilder
8397
8398 !! test
8399 MSIE CSS safety test: spurious slash
8400 !! input
8401 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8402 !! result
8403 <div style="/* insecure input */">evil</div>
8404
8405 !! end
8406
8407 !! test
8408 MSIE CSS safety test: hex code
8409 !! input
8410 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8411 !! result
8412 <div style="/* insecure input */">evil</div>
8413
8414 !! end
8415
8416 !! test
8417 MSIE CSS safety test: comment in url
8418 !! input
8419 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8420 !! result
8421 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8422
8423 !! end
8424
8425 !! test
8426 MSIE CSS safety test: comment in expression
8427 !! input
8428 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8429 !! result
8430 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8431
8432 !! end
8433
8434
8435 !! test
8436 Table attribute legitimate extension
8437 !! input
8438 {|
8439 !+ style="<nowiki>color:blue</nowiki>"| status
8440 |}
8441 !! result
8442 <table>
8443 <tr>
8444 <th style="color:blue"> status
8445 </th></tr></table>
8446
8447 !!end
8448
8449 !! test
8450 Table attribute safety
8451 !! input
8452 {|
8453 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8454 |}
8455 !! result
8456 <table>
8457 <tr>
8458 <th style="/* insecure input */"> status
8459 </th></tr></table>
8460
8461 !! end
8462
8463 !! test
8464 CSS line continuation 1
8465 !! input
8466 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8467 !! result
8468 <div style="/* insecure input */"></div>
8469
8470 !! end
8471
8472 !! test
8473 CSS line continuation 2
8474 !! input
8475 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8476 !! result
8477 <div style="/* insecure input */"></div>
8478
8479 !! end
8480
8481 !! article
8482 Template:Identity
8483 !! text
8484 {{{1}}}
8485 !! endarticle
8486
8487 !! test
8488 Expansion of multi-line templates in attribute values (bug 6255)
8489 !! input
8490 <div style="background: {{identity|#00FF00}}">-</div>
8491 !! result
8492 <div style="background: #00FF00">-</div>
8493
8494 !! end
8495
8496
8497 !! test
8498 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8499 !! input
8500 <div style="background:
8501 #00FF00">-</div>
8502 !! result
8503 <div style="background: #00FF00">-</div>
8504
8505 !! end
8506
8507 !! test
8508 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8509 !! input
8510 <div style="background: &#10;#00FF00">-</div>
8511 !! result
8512 <div style="background: &#10;#00FF00">-</div>
8513
8514 !! end
8515
8516 ###
8517 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8518 ###
8519 !! test
8520 Parser hook: empty input
8521 !! input
8522 <tag></tag>
8523 !! result
8524 <pre>
8525 ''
8526 array (
8527 )
8528 </pre>
8529
8530 !! end
8531
8532 !! test
8533 Parser hook: empty input using terminated empty elements
8534 !! input
8535 <tag/>
8536 !! result
8537 <pre>
8538 NULL
8539 array (
8540 )
8541 </pre>
8542
8543 !! end
8544
8545 !! test
8546 Parser hook: empty input using terminated empty elements (space before)
8547 !! input
8548 <tag />
8549 !! result
8550 <pre>
8551 NULL
8552 array (
8553 )
8554 </pre>
8555
8556 !! end
8557
8558 !! test
8559 Parser hook: basic input
8560 !! input
8561 <tag>input</tag>
8562 !! result
8563 <pre>
8564 'input'
8565 array (
8566 )
8567 </pre>
8568
8569 !! end
8570
8571
8572 !! test
8573 Parser hook: case insensitive
8574 !! input
8575 <TAG>input</TAG>
8576 !! result
8577 <pre>
8578 'input'
8579 array (
8580 )
8581 </pre>
8582
8583 !! end
8584
8585
8586 !! test
8587 Parser hook: case insensitive, redux
8588 !! input
8589 <TaG>input</TAg>
8590 !! result
8591 <pre>
8592 'input'
8593 array (
8594 )
8595 </pre>
8596
8597 !! end
8598
8599 !! test
8600 Parser hook: nested tags
8601 !! options
8602 noxml
8603 !! input
8604 <tag><tag></tag></tag>
8605 !! result
8606 <pre>
8607 '<tag>'
8608 array (
8609 )
8610 </pre>&lt;/tag&gt;
8611
8612 !! end
8613
8614 !! test
8615 Parser hook: basic arguments
8616 !! input
8617 <tag width=200 height = "100" depth = '50' square></tag>
8618 !! result
8619 <pre>
8620 ''
8621 array (
8622 'width' => '200',
8623 'height' => '100',
8624 'depth' => '50',
8625 'square' => 'square',
8626 )
8627 </pre>
8628
8629 !! end
8630
8631 !! test
8632 Parser hook: argument containing a forward slash (bug 5344)
8633 !! input
8634 <tag filename='/tmp/bla'></tag>
8635 !! result
8636 <pre>
8637 ''
8638 array (
8639 'filename' => '/tmp/bla',
8640 )
8641 </pre>
8642
8643 !! end
8644
8645 !! test
8646 Parser hook: empty input using terminated empty elements (bug 2374)
8647 !! input
8648 <tag foo=bar/>text
8649 !! result
8650 <pre>
8651 NULL
8652 array (
8653 'foo' => 'bar',
8654 )
8655 </pre>text
8656
8657 !! end
8658
8659 # </tag> should be output literally since there is no matching tag that begins it
8660 !! test
8661 Parser hook: basic arguments using terminated empty elements (bug 2374)
8662 !! input
8663 <tag width=200 height = "100" depth = '50' square/>
8664 other stuff
8665 </tag>
8666 !! result
8667 <pre>
8668 NULL
8669 array (
8670 'width' => '200',
8671 'height' => '100',
8672 'depth' => '50',
8673 'square' => 'square',
8674 )
8675 </pre>
8676 <p>other stuff
8677 &lt;/tag&gt;
8678 </p>
8679 !! end
8680
8681 ###
8682 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8683 ###
8684
8685 !! test
8686 Parser hook: static parser hook not inside a comment
8687 !! input
8688 <statictag>hello, world</statictag>
8689 <statictag action=flush/>
8690 !! result
8691 <p>hello, world
8692 </p>
8693 !! end
8694
8695
8696 !! test
8697 Parser hook: static parser hook inside a comment
8698 !! input
8699 <!-- <statictag>hello, world</statictag> -->
8700 <statictag action=flush/>
8701 !! result
8702 <p><br />
8703 </p>
8704 !! end
8705
8706 # Nested template calls; this case was broken by Parser.php rev 1.506,
8707 # since reverted.
8708
8709 !! article
8710 Template:One-parameter
8711 !! text
8712 (My parameter is: {{{1}}})
8713 !! endarticle
8714
8715 !! article
8716 Template:Map-one-parameter
8717 !! text
8718 {{{{{1}}}|{{{2}}}}}
8719 !! endarticle
8720
8721 !! test
8722 Nested template calls
8723 !! input
8724 {{Map-one-parameter|One-parameter|param}}
8725 !! result
8726 <p>(My parameter is: param)
8727 </p>
8728 !! end
8729
8730
8731 ###
8732 ### Sanitizer
8733 ###
8734 !! test
8735 Sanitizer: Closing of open tags
8736 !! input
8737 <s></s><table></table>
8738 !! result
8739 <s></s><table></table>
8740
8741 !! end
8742
8743 !! test
8744 Sanitizer: Closing of open but not closed tags
8745 !! input
8746 <s>foo
8747 !! result
8748 <p><s>foo</s>
8749 </p>
8750 !! end
8751
8752 !! test
8753 Sanitizer: Closing of closed but not open tags
8754 !! input
8755 </s>
8756 !! result
8757 <p>&lt;/s&gt;
8758 </p>
8759 !! end
8760
8761 !! test
8762 Sanitizer: Closing of closed but not open table tags
8763 !! input
8764 Table not started</td></tr></table>
8765 !! result
8766 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8767 </p>
8768 !! end
8769
8770 !! test
8771 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8772 !! input
8773 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8774 !! result
8775 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8776 </p>
8777 !! end
8778
8779 !! test
8780 Sanitizer: Validating the contents of the id attribute (bug 4515)
8781 !! options
8782 disabled
8783 !! input
8784 <br id=9 />
8785 !! result
8786 Something, but definitely not <br id="9" />...
8787 !! end
8788
8789 !! test
8790 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8791 !! options
8792 disabled
8793 !! input
8794 <br id="foo" /><br id="foo" />
8795 !! result
8796 Something need to be done. foo-2 ?
8797 !! end
8798
8799 !! test
8800 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8801 !! input
8802 <div itemscope>
8803 <meta itemprop="hello" content="world">
8804 <meta http-equiv="refresh" content="5">
8805 <meta itemprop="hello" http-equiv="refresh" content="5">
8806 <link itemprop="hello" href="{{SERVER}}">
8807 <link rel="stylesheet" href="{{SERVER}}">
8808 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8809 </div>
8810 !! result
8811 <div itemscope="itemscope">
8812 <p> <meta itemprop="hello" content="world" />
8813 &lt;meta http-equiv="refresh" content="5"&gt;
8814 <meta itemprop="hello" content="5" />
8815 </p>
8816 <link itemprop="hello" href="http&#58;//example.org" />
8817 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
8818 <link itemprop="hello" href="http&#58;//example.org" />
8819 </div>
8820
8821 !! end
8822
8823 !! test
8824 Language converter: output gets cut off unexpectedly (bug 5757)
8825 !! options
8826 language=zh
8827 !! input
8828 this bit is safe: }-
8829
8830 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8831
8832 then we get cut off here: }-
8833
8834 all additional text is vanished
8835 !! result
8836 <p>this bit is safe: }-
8837 </p><p>but if we add a conversion instance: xxx
8838 </p><p>then we get cut off here: }-
8839 </p><p>all additional text is vanished
8840 </p>
8841 !! end
8842
8843 !! test
8844 Self closed html pairs (bug 5487)
8845 !! options
8846 !! input
8847 <center><font id="bug" />Centered text</center>
8848 <div><font id="bug2" />In div text</div>
8849 !! result
8850 <center>&lt;font id="bug" /&gt;Centered text</center>
8851 <div>&lt;font id="bug2" /&gt;In div text</div>
8852
8853 !! end
8854
8855 #
8856 #
8857 #
8858
8859 !! test
8860 Punctuation: nbsp before exclamation
8861 !! input
8862 C'est grave !
8863 !! result
8864 <p>C'est grave&#160;!
8865 </p>
8866 !! end
8867
8868 !! test
8869 Punctuation: CSS !important (bug 11874)
8870 !! input
8871 <div style="width:50% !important">important</div>
8872 !! result
8873 <div style="width:50% !important">important</div>
8874
8875 !!end
8876
8877 !! test
8878 Punctuation: CSS ! important (bug 11874; with space after)
8879 !! input
8880 <div style="width:50% ! important">important</div>
8881 !! result
8882 <div style="width:50% ! important">important</div>
8883
8884 !!end
8885
8886
8887 !! test
8888 HTML bullet list, closed tags (bug 5497)
8889 !! input
8890 <ul>
8891 <li>One</li>
8892 <li>Two</li>
8893 </ul>
8894 !! result
8895 <ul>
8896 <li>One</li>
8897 <li>Two</li>
8898 </ul>
8899
8900 !! end
8901
8902 !! test
8903 HTML bullet list, unclosed tags (bug 5497)
8904 !! options
8905 disabled
8906 !! input
8907 <ul>
8908 <li>One
8909 <li>Two
8910 </ul>
8911 !! result
8912 <ul>
8913 <li>One
8914 </li><li>Two
8915 </li></ul>
8916
8917 !! end
8918
8919 !! test
8920 HTML ordered list, closed tags (bug 5497)
8921 !! input
8922 <ol>
8923 <li>One</li>
8924 <li>Two</li>
8925 </ol>
8926 !! result
8927 <ol>
8928 <li>One</li>
8929 <li>Two</li>
8930 </ol>
8931
8932 !! end
8933
8934 !! test
8935 HTML ordered list, unclosed tags (bug 5497)
8936 !! options
8937 disabled
8938 !! input
8939 <ol>
8940 <li>One
8941 <li>Two
8942 </ol>
8943 !! result
8944 <ol>
8945 <li>One
8946 </li><li>Two
8947 </li></ol>
8948
8949 !! end
8950
8951 !! test
8952 HTML nested bullet list, closed tags (bug 5497)
8953 !! input
8954 <ul>
8955 <li>One</li>
8956 <li>Two:
8957 <ul>
8958 <li>Sub-one</li>
8959 <li>Sub-two</li>
8960 </ul>
8961 </li>
8962 </ul>
8963 !! result
8964 <ul>
8965 <li>One</li>
8966 <li>Two:
8967 <ul>
8968 <li>Sub-one</li>
8969 <li>Sub-two</li>
8970 </ul>
8971 </li>
8972 </ul>
8973
8974 !! end
8975
8976 !! test
8977 HTML nested bullet list, open tags (bug 5497)
8978 !! options
8979 disabled
8980 !! input
8981 <ul>
8982 <li>One
8983 <li>Two:
8984 <ul>
8985 <li>Sub-one
8986 <li>Sub-two
8987 </ul>
8988 </ul>
8989 !! result
8990 <ul>
8991 <li>One
8992 </li><li>Two:
8993 <ul>
8994 <li>Sub-one
8995 </li><li>Sub-two
8996 </li></ul>
8997 </li></ul>
8998
8999 !! end
9000
9001 !! test
9002 HTML nested ordered list, closed tags (bug 5497)
9003 !! input
9004 <ol>
9005 <li>One</li>
9006 <li>Two:
9007 <ol>
9008 <li>Sub-one</li>
9009 <li>Sub-two</li>
9010 </ol>
9011 </li>
9012 </ol>
9013 !! result
9014 <ol>
9015 <li>One</li>
9016 <li>Two:
9017 <ol>
9018 <li>Sub-one</li>
9019 <li>Sub-two</li>
9020 </ol>
9021 </li>
9022 </ol>
9023
9024 !! end
9025
9026 !! test
9027 HTML nested ordered list, open tags (bug 5497)
9028 !! options
9029 disabled
9030 !! input
9031 <ol>
9032 <li>One
9033 <li>Two:
9034 <ol>
9035 <li>Sub-one
9036 <li>Sub-two
9037 </ol>
9038 </ol>
9039 !! result
9040 <ol>
9041 <li>One
9042 </li><li>Two:
9043 <ol>
9044 <li>Sub-one
9045 </li><li>Sub-two
9046 </li></ol>
9047 </li></ol>
9048
9049 !! end
9050
9051 !! test
9052 HTML ordered list item with parameters oddity
9053 !! input
9054 <ol><li id="fragment">One</li></ol>
9055 !! result
9056 <ol><li id="fragment">One</li></ol>
9057
9058 !! end
9059
9060 !!test
9061 bug 5918: autonumbering
9062 !! input
9063 [http://first/] [http://second] [ftp://ftp]
9064
9065 ftp://inlineftp
9066
9067 [mailto:enclosed@mail.tld With target]
9068
9069 [mailto:enclosed@mail.tld]
9070
9071 mailto:inline@mail.tld
9072 !! result
9073 <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>
9074 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9075 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9076 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9077 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9078 </p>
9079 !! end
9080
9081
9082 #
9083 # Security and HTML correctness
9084 # From Nick Jenkins' fuzz testing
9085 #
9086
9087 !! test
9088 Fuzz testing: Parser13
9089 !! input
9090 {|
9091 | http://a|
9092 !! result
9093 <table>
9094 <tr>
9095 <td>
9096 </td>
9097 </tr>
9098 </table>
9099
9100 !! end
9101
9102 !! test
9103 Fuzz testing: Parser14
9104 !! input
9105 == onmouseover= ==
9106 http://__TOC__
9107 !! result
9108 <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>
9109 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9110 <ul>
9111 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9112 </ul>
9113 </td></tr></table>
9114
9115 !! end
9116
9117 !! test
9118 Fuzz testing: Parser14-table
9119 !! input
9120 ==a==
9121 {| STYLE=__TOC__
9122 !! result
9123 <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>
9124 <table style="&#95;_TOC&#95;_">
9125 <tr><td></td></tr>
9126 </table>
9127
9128 !! end
9129
9130 # Known to produce bogus xml (extra </td>)
9131 !! test
9132 Fuzz testing: Parser16
9133 !! options
9134 noxml
9135 !! input
9136 {|
9137 !https://||||||
9138 !! result
9139 <table>
9140 <tr>
9141 <th>https://</th>
9142 <th></th>
9143 <th></th>
9144 <th>
9145 </td>
9146 </tr>
9147 </table>
9148
9149 !! end
9150
9151 !! test
9152 Fuzz testing: Parser21
9153 !! input
9154 {|
9155 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9156 |
9157 !! result
9158 <table>
9159 <tr>
9160 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9161 </th>
9162 <td>
9163 </td>
9164 </tr>
9165 </table>
9166
9167 !! end
9168
9169 !! test
9170 Fuzz testing: Parser22
9171 !! input
9172 http://===r:::https://b
9173
9174 {|
9175 !!result
9176 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9177 </p>
9178 <table>
9179 <tr><td></td></tr>
9180 </table>
9181
9182 !! end
9183
9184 # Known to produce bad XML for now
9185 !! test
9186 Fuzz testing: Parser24
9187 !! options
9188 noxml
9189 !! input
9190 {|
9191 {{{|
9192 <u CLASS=
9193 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9194 <br style="onmouseover='alert(document.cookie);' " />
9195
9196 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9197 |
9198 !! result
9199 <table>
9200 {{{|
9201 <u class="&#124;">}}}} &gt;
9202 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9203
9204 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9205 <tr>
9206 <td></u>
9207 </td>
9208 </tr>
9209 </table>
9210
9211 !! end
9212
9213 # Note: the current result listed for this is not what the original one was,
9214 # but the original bug was JavaScript injection, which is fixed in any case.
9215 # It's not clear that the original result listed was any more correct than the
9216 # current one. Original result:
9217 # <p>{{{|
9218 # </p>
9219 # <li class="&#124;&#124;">
9220 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9221 !!test
9222 Fuzz testing: Parser25 (bug 6055)
9223 !! input
9224 {{{
9225 |
9226 <LI CLASS=||
9227 >
9228 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9229 !! result
9230 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9231 </p>
9232 !! end
9233
9234 !!test
9235 Fuzz testing: URL adjacent extension (with space, clean)
9236 !! options
9237 !! input
9238 http://example.com <nowiki>junk</nowiki>
9239 !! result
9240 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9241 </p>
9242 !!end
9243
9244 !!test
9245 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9246 !! options
9247 !! input
9248 http://example.com<nowiki>junk</nowiki>
9249 !! result
9250 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9251 </p>
9252 !!end
9253
9254 !!test
9255 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9256 !! options
9257 !! input
9258 http://example.com<pre>junk</pre>
9259 !! result
9260 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9261
9262 !!end
9263
9264 !!test
9265 Fuzz testing: image with bogus manual thumbnail
9266 !!input
9267 [[Image:foobar.jpg|thumbnail= ]]
9268 !!result
9269 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9270
9271 !!end
9272
9273 !! test
9274 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9275 !! input
9276 <pre dir="&#10;"></pre>
9277 !! result
9278 <pre dir="&#10;"></pre>
9279
9280 !! end
9281
9282 !! test
9283 Parsing optional HTML elements (Bug 6171)
9284 !! options
9285 !! input
9286 <table>
9287 <tr>
9288 <td> Some tabular data</td>
9289 <td> More tabular data ...
9290 <td> And yet som tabular data</td>
9291 </tr>
9292 </table>
9293 !! result
9294 <table>
9295 <tr>
9296 <td> Some tabular data</td>
9297 <td> More tabular data ...
9298 </td><td> And yet som tabular data</td>
9299 </tr>
9300 </table>
9301
9302 !! end
9303
9304 !! test
9305 Correct handling of <td>, <tr> (Bug 6171)
9306 !! options
9307 !! input
9308 <table>
9309 <tr>
9310 <td> Some tabular data</td>
9311 <td> More tabular data ...</td>
9312 <td> And yet som tabular data</td>
9313 </tr>
9314 </table>
9315 !! result
9316 <table>
9317 <tr>
9318 <td> Some tabular data</td>
9319 <td> More tabular data ...</td>
9320 <td> And yet som tabular data</td>
9321 </tr>
9322 </table>
9323
9324 !! end
9325
9326
9327 !! test
9328 Parsing crashing regression (fr:JavaScript)
9329 !! input
9330 </body></x>
9331 !! result
9332 <p>&lt;/body&gt;&lt;/x&gt;
9333 </p>
9334 !! end
9335
9336 !! test
9337 Inline wiki vs wiki block nesting
9338 !! input
9339 '''Bold paragraph
9340
9341 New wiki paragraph
9342 !! result
9343 <p><b>Bold paragraph</b>
9344 </p><p>New wiki paragraph
9345 </p>
9346 !! end
9347
9348 !! test
9349 Inline HTML vs wiki block nesting
9350 !! options
9351 disabled
9352 !! input
9353 <b>Bold paragraph
9354
9355 New wiki paragraph
9356 !! result
9357 <p><b>Bold paragraph</b>
9358 </p><p>New wiki paragraph
9359 </p>
9360 !! end
9361
9362 # Original result was this:
9363 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9364 # </p>
9365 # While that might be marginally more intuitive, maybe, the six-apostrophe
9366 # construct is clearly pathological and the result stated here (which is what
9367 # the parser actually does) is about as reasonable as anything.
9368 !!test
9369 Mixing markup for italics and bold
9370 !! options
9371 !! input
9372 '''bold''''''bold''bolditalics'''''
9373 !! result
9374 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9375 </p>
9376 !! end
9377
9378
9379 !! article
9380 Xyzzyx
9381 !! text
9382 Article for special page transclusion test
9383 !! endarticle
9384
9385 !! test
9386 Special page transclusion
9387 !! options
9388 !! input
9389 {{Special:Prefixindex/Xyzzyx}}
9390 !! result
9391 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9392
9393 !! end
9394
9395 !! test
9396 Special page transclusion twice (bug 5021)
9397 !! options
9398 !! input
9399 {{Special:Prefixindex/Xyzzyx}}
9400 {{Special:Prefixindex/Xyzzyx}}
9401 !! result
9402 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9403 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9404
9405 !! end
9406
9407 !! test
9408 Transclusion of default MediaWiki message
9409 !! input
9410 {{MediaWiki:Mainpage}}
9411 !!result
9412 <p>Main Page
9413 </p>
9414 !! end
9415
9416 !! test
9417 Transclusion of nonexistent MediaWiki message
9418 !! input
9419 {{MediaWiki:Mainpagexxx}}
9420 !!result
9421 <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>
9422 </p>
9423 !! end
9424
9425 !! test
9426 Transclusion of MediaWiki message with underscore
9427 !! input
9428 {{MediaWiki:history_short}}
9429 !! result
9430 <p>History
9431 </p>
9432 !! end
9433
9434 !! test
9435 Transclusion of MediaWiki message with space
9436 !! input
9437 {{MediaWiki:history short}}
9438 !! result
9439 <p>History
9440 </p>
9441 !! end
9442
9443 !! test
9444 Invalid header with following text
9445 !! input
9446 = x = y
9447 !! result
9448 <p>= x = y
9449 </p>
9450 !! end
9451
9452
9453 !! test
9454 Section extraction test (section 0)
9455 !! options
9456 section=0
9457 !! input
9458 start
9459 ==a==
9460 ===aa===
9461 ====aaa====
9462 ==b==
9463 ===ba===
9464 ===bb===
9465 ====bba====
9466 ===bc===
9467 ==c==
9468 ===ca===
9469 !! result
9470 start
9471 !! end
9472
9473 !! test
9474 Section extraction test (section 1)
9475 !! options
9476 section=1
9477 !! input
9478 start
9479 ==a==
9480 ===aa===
9481 ====aaa====
9482 ==b==
9483 ===ba===
9484 ===bb===
9485 ====bba====
9486 ===bc===
9487 ==c==
9488 ===ca===
9489 !! result
9490 ==a==
9491 ===aa===
9492 ====aaa====
9493 !! end
9494
9495 !! test
9496 Section extraction test (section 2)
9497 !! options
9498 section=2
9499 !! input
9500 start
9501 ==a==
9502 ===aa===
9503 ====aaa====
9504 ==b==
9505 ===ba===
9506 ===bb===
9507 ====bba====
9508 ===bc===
9509 ==c==
9510 ===ca===
9511 !! result
9512 ===aa===
9513 ====aaa====
9514 !! end
9515
9516 !! test
9517 Section extraction test (section 3)
9518 !! options
9519 section=3
9520 !! input
9521 start
9522 ==a==
9523 ===aa===
9524 ====aaa====
9525 ==b==
9526 ===ba===
9527 ===bb===
9528 ====bba====
9529 ===bc===
9530 ==c==
9531 ===ca===
9532 !! result
9533 ====aaa====
9534 !! end
9535
9536 !! test
9537 Section extraction test (section 4)
9538 !! options
9539 section=4
9540 !! input
9541 start
9542 ==a==
9543 ===aa===
9544 ====aaa====
9545 ==b==
9546 ===ba===
9547 ===bb===
9548 ====bba====
9549 ===bc===
9550 ==c==
9551 ===ca===
9552 !! result
9553 ==b==
9554 ===ba===
9555 ===bb===
9556 ====bba====
9557 ===bc===
9558 !! end
9559
9560 !! test
9561 Section extraction test (section 5)
9562 !! options
9563 section=5
9564 !! input
9565 start
9566 ==a==
9567 ===aa===
9568 ====aaa====
9569 ==b==
9570 ===ba===
9571 ===bb===
9572 ====bba====
9573 ===bc===
9574 ==c==
9575 ===ca===
9576 !! result
9577 ===ba===
9578 !! end
9579
9580 !! test
9581 Section extraction test (section 6)
9582 !! options
9583 section=6
9584 !! input
9585 start
9586 ==a==
9587 ===aa===
9588 ====aaa====
9589 ==b==
9590 ===ba===
9591 ===bb===
9592 ====bba====
9593 ===bc===
9594 ==c==
9595 ===ca===
9596 !! result
9597 ===bb===
9598 ====bba====
9599 !! end
9600
9601 !! test
9602 Section extraction test (section 7)
9603 !! options
9604 section=7
9605 !! input
9606 start
9607 ==a==
9608 ===aa===
9609 ====aaa====
9610 ==b==
9611 ===ba===
9612 ===bb===
9613 ====bba====
9614 ===bc===
9615 ==c==
9616 ===ca===
9617 !! result
9618 ====bba====
9619 !! end
9620
9621 !! test
9622 Section extraction test (section 8)
9623 !! options
9624 section=8
9625 !! input
9626 start
9627 ==a==
9628 ===aa===
9629 ====aaa====
9630 ==b==
9631 ===ba===
9632 ===bb===
9633 ====bba====
9634 ===bc===
9635 ==c==
9636 ===ca===
9637 !! result
9638 ===bc===
9639 !! end
9640
9641 !! test
9642 Section extraction test (section 9)
9643 !! options
9644 section=9
9645 !! input
9646 start
9647 ==a==
9648 ===aa===
9649 ====aaa====
9650 ==b==
9651 ===ba===
9652 ===bb===
9653 ====bba====
9654 ===bc===
9655 ==c==
9656 ===ca===
9657 !! result
9658 ==c==
9659 ===ca===
9660 !! end
9661
9662 !! test
9663 Section extraction test (section 10)
9664 !! options
9665 section=10
9666 !! input
9667 start
9668 ==a==
9669 ===aa===
9670 ====aaa====
9671 ==b==
9672 ===ba===
9673 ===bb===
9674 ====bba====
9675 ===bc===
9676 ==c==
9677 ===ca===
9678 !! result
9679 ===ca===
9680 !! end
9681
9682 !! test
9683 Section extraction test (nonexistent section 11)
9684 !! options
9685 section=11
9686 !! input
9687 start
9688 ==a==
9689 ===aa===
9690 ====aaa====
9691 ==b==
9692 ===ba===
9693 ===bb===
9694 ====bba====
9695 ===bc===
9696 ==c==
9697 ===ca===
9698 !! result
9699 !! end
9700
9701 !! test
9702 Section extraction test with bogus heading (section 1)
9703 !! options
9704 section=1
9705 !! input
9706 ==a==
9707 ==bogus== not a legal section
9708 ==b==
9709 !! result
9710 ==a==
9711 ==bogus== not a legal section
9712 !! end
9713
9714 !! test
9715 Section extraction test with bogus heading (section 2)
9716 !! options
9717 section=2
9718 !! input
9719 ==a==
9720 ==bogus== not a legal section
9721 ==b==
9722 !! result
9723 ==b==
9724 !! end
9725
9726 !! test
9727 Section extraction test with comment after heading (section 1)
9728 !! options
9729 section=1
9730 !! input
9731 ==a==
9732 ==b== <!-- -->
9733 ==c==
9734 !! result
9735 ==a==
9736 !! end
9737
9738 !! test
9739 Section extraction test with comment after heading (section 2)
9740 !! options
9741 section=2
9742 !! input
9743 ==a==
9744 ==b== <!-- -->
9745 ==c==
9746 !! result
9747 ==b== <!-- -->
9748 !! end
9749
9750 !! test
9751 Section extraction test with bogus <nowiki> heading (section 1)
9752 !! options
9753 section=1
9754 !! input
9755 ==a==
9756 ==bogus== <nowiki>not a legal section</nowiki>
9757 ==b==
9758 !! result
9759 ==a==
9760 ==bogus== <nowiki>not a legal section</nowiki>
9761 !! end
9762
9763 !! test
9764 Section extraction test with bogus <nowiki> heading (section 2)
9765 !! options
9766 section=2
9767 !! input
9768 ==a==
9769 ==bogus== <nowiki>not a legal section</nowiki>
9770 ==b==
9771 !! result
9772 ==b==
9773 !! end
9774
9775
9776 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9777 # instead of respecting commented sections
9778 !! test
9779 Section extraction prefixed by comment (section 1)
9780 !! options
9781 section=1
9782 !! input
9783 <!-- -->==sec1==
9784 ==sec2==
9785 !!result
9786 ==sec2==
9787 !!end
9788
9789 !! test
9790 Section extraction prefixed by comment (section 2)
9791 !! options
9792 section=2
9793 !! input
9794 <!-- -->==sec1==
9795 ==sec2==
9796 !!result
9797
9798 !!end
9799
9800
9801 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9802 # instead of respecting HTML-style headings
9803 !! test
9804 Section extraction, mixed wiki and html (section 1)
9805 !! options
9806 section=1
9807 !! input
9808 <h2>unmarked</h2>
9809 unmarked
9810 ==1==
9811 one
9812 ==2==
9813 two
9814 !! result
9815 ==1==
9816 one
9817 !! end
9818
9819 !! test
9820 Section extraction, mixed wiki and html (section 2)
9821 !! options
9822 section=2
9823 !! input
9824 <h2>unmarked</h2>
9825 unmarked
9826 ==1==
9827 one
9828 ==2==
9829 two
9830 !! result
9831 ==2==
9832 two
9833 !! end
9834
9835
9836 # Formerly testing for bug 3342
9837 !! test
9838 Section extraction, heading surrounded by <noinclude>
9839 !! options
9840 section=1
9841 !! input
9842 <noinclude>==unmarked==</noinclude>
9843 ==marked==
9844 !! result
9845 ==marked==
9846 !!end
9847
9848 # Test behaviour of bug 19910
9849 !! test
9850 Sectiion with all-equals
9851 !! options
9852 section=2
9853 !! input
9854 ===
9855 The line above must have a trailing space
9856 === <!--
9857 --> <!-- -->
9858 But just in case it doesn't...
9859 !! result
9860 === <!--
9861 --> <!-- -->
9862 But just in case it doesn't...
9863 !! end
9864
9865 !! test
9866 Section replacement test (section 0)
9867 !! options
9868 replace=0,"xxx"
9869 !! input
9870 start
9871 ==a==
9872 ===aa===
9873 ====aaa====
9874 ==b==
9875 ===ba===
9876 ===bb===
9877 ====bba====
9878 ===bc===
9879 ==c==
9880 ===ca===
9881 !! result
9882 xxx
9883
9884 ==a==
9885 ===aa===
9886 ====aaa====
9887 ==b==
9888 ===ba===
9889 ===bb===
9890 ====bba====
9891 ===bc===
9892 ==c==
9893 ===ca===
9894 !! end
9895
9896 !! test
9897 Section replacement test (section 1)
9898 !! options
9899 replace=1,"xxx"
9900 !! input
9901 start
9902 ==a==
9903 ===aa===
9904 ====aaa====
9905 ==b==
9906 ===ba===
9907 ===bb===
9908 ====bba====
9909 ===bc===
9910 ==c==
9911 ===ca===
9912 !! result
9913 start
9914 xxx
9915
9916 ==b==
9917 ===ba===
9918 ===bb===
9919 ====bba====
9920 ===bc===
9921 ==c==
9922 ===ca===
9923 !! end
9924
9925 !! test
9926 Section replacement test (section 2)
9927 !! options
9928 replace=2,"xxx"
9929 !! input
9930 start
9931 ==a==
9932 ===aa===
9933 ====aaa====
9934 ==b==
9935 ===ba===
9936 ===bb===
9937 ====bba====
9938 ===bc===
9939 ==c==
9940 ===ca===
9941 !! result
9942 start
9943 ==a==
9944 xxx
9945
9946 ==b==
9947 ===ba===
9948 ===bb===
9949 ====bba====
9950 ===bc===
9951 ==c==
9952 ===ca===
9953 !! end
9954
9955 !! test
9956 Section replacement test (section 3)
9957 !! options
9958 replace=3,"xxx"
9959 !! input
9960 start
9961 ==a==
9962 ===aa===
9963 ====aaa====
9964 ==b==
9965 ===ba===
9966 ===bb===
9967 ====bba====
9968 ===bc===
9969 ==c==
9970 ===ca===
9971 !! result
9972 start
9973 ==a==
9974 ===aa===
9975 xxx
9976
9977 ==b==
9978 ===ba===
9979 ===bb===
9980 ====bba====
9981 ===bc===
9982 ==c==
9983 ===ca===
9984 !! end
9985
9986 !! test
9987 Section replacement test (section 4)
9988 !! options
9989 replace=4,"xxx"
9990 !! input
9991 start
9992 ==a==
9993 ===aa===
9994 ====aaa====
9995 ==b==
9996 ===ba===
9997 ===bb===
9998 ====bba====
9999 ===bc===
10000 ==c==
10001 ===ca===
10002 !! result
10003 start
10004 ==a==
10005 ===aa===
10006 ====aaa====
10007 xxx
10008
10009 ==c==
10010 ===ca===
10011 !! end
10012
10013 !! test
10014 Section replacement test (section 5)
10015 !! options
10016 replace=5,"xxx"
10017 !! input
10018 start
10019 ==a==
10020 ===aa===
10021 ====aaa====
10022 ==b==
10023 ===ba===
10024 ===bb===
10025 ====bba====
10026 ===bc===
10027 ==c==
10028 ===ca===
10029 !! result
10030 start
10031 ==a==
10032 ===aa===
10033 ====aaa====
10034 ==b==
10035 xxx
10036
10037 ===bb===
10038 ====bba====
10039 ===bc===
10040 ==c==
10041 ===ca===
10042 !! end
10043
10044 !! test
10045 Section replacement test (section 6)
10046 !! options
10047 replace=6,"xxx"
10048 !! input
10049 start
10050 ==a==
10051 ===aa===
10052 ====aaa====
10053 ==b==
10054 ===ba===
10055 ===bb===
10056 ====bba====
10057 ===bc===
10058 ==c==
10059 ===ca===
10060 !! result
10061 start
10062 ==a==
10063 ===aa===
10064 ====aaa====
10065 ==b==
10066 ===ba===
10067 xxx
10068
10069 ===bc===
10070 ==c==
10071 ===ca===
10072 !! end
10073
10074 !! test
10075 Section replacement test (section 7)
10076 !! options
10077 replace=7,"xxx"
10078 !! input
10079 start
10080 ==a==
10081 ===aa===
10082 ====aaa====
10083 ==b==
10084 ===ba===
10085 ===bb===
10086 ====bba====
10087 ===bc===
10088 ==c==
10089 ===ca===
10090 !! result
10091 start
10092 ==a==
10093 ===aa===
10094 ====aaa====
10095 ==b==
10096 ===ba===
10097 ===bb===
10098 xxx
10099
10100 ===bc===
10101 ==c==
10102 ===ca===
10103 !! end
10104
10105 !! test
10106 Section replacement test (section 8)
10107 !! options
10108 replace=8,"xxx"
10109 !! input
10110 start
10111 ==a==
10112 ===aa===
10113 ====aaa====
10114 ==b==
10115 ===ba===
10116 ===bb===
10117 ====bba====
10118 ===bc===
10119 ==c==
10120 ===ca===
10121 !! result
10122 start
10123 ==a==
10124 ===aa===
10125 ====aaa====
10126 ==b==
10127 ===ba===
10128 ===bb===
10129 ====bba====
10130 xxx
10131
10132 ==c==
10133 ===ca===
10134 !!end
10135
10136 !! test
10137 Section replacement test (section 9)
10138 !! options
10139 replace=9,"xxx"
10140 !! input
10141 start
10142 ==a==
10143 ===aa===
10144 ====aaa====
10145 ==b==
10146 ===ba===
10147 ===bb===
10148 ====bba====
10149 ===bc===
10150 ==c==
10151 ===ca===
10152 !! result
10153 start
10154 ==a==
10155 ===aa===
10156 ====aaa====
10157 ==b==
10158 ===ba===
10159 ===bb===
10160 ====bba====
10161 ===bc===
10162 xxx
10163 !! end
10164
10165 !! test
10166 Section replacement test (section 10)
10167 !! options
10168 replace=10,"xxx"
10169 !! input
10170 start
10171 ==a==
10172 ===aa===
10173 ====aaa====
10174 ==b==
10175 ===ba===
10176 ===bb===
10177 ====bba====
10178 ===bc===
10179 ==c==
10180 ===ca===
10181 !! result
10182 start
10183 ==a==
10184 ===aa===
10185 ====aaa====
10186 ==b==
10187 ===ba===
10188 ===bb===
10189 ====bba====
10190 ===bc===
10191 ==c==
10192 xxx
10193 !! end
10194
10195 !! test
10196 Section replacement test with initial whitespace (bug 13728)
10197 !! options
10198 replace=2,"xxx"
10199 !! input
10200 Preformatted initial line
10201 ==a==
10202 ===a===
10203 !! result
10204 Preformatted initial line
10205 ==a==
10206 xxx
10207 !! end
10208
10209
10210 !! test
10211 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10212 !! options
10213 section=1
10214 !! input
10215 ==a==
10216 a
10217 !! result
10218 ==a==
10219 a
10220 !! end
10221
10222 !! test
10223 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10224 !! options
10225 section=1
10226 !! input
10227 ==a==
10228 a
10229 !! result
10230 ==a==
10231 a
10232 !! end
10233
10234
10235 !! test
10236 Section extraction, <pre> around bogus header (bug 10309)
10237 !! options
10238 noxml section=2
10239 !! input
10240 == Section One ==
10241 <pre>
10242 =======
10243 </pre>
10244
10245 == Section Two ==
10246 stuff
10247 !! result
10248 == Section Two ==
10249 stuff
10250 !! end
10251
10252 !! test
10253 Section replacement, <pre> around bogus header (bug 10309)
10254 !! options
10255 noxml replace=2,"xxx"
10256 !! input
10257 == Section One ==
10258 <pre>
10259 =======
10260 </pre>
10261
10262 == Section Two ==
10263 stuff
10264 !! result
10265 == Section One ==
10266 <pre>
10267 =======
10268 </pre>
10269
10270 xxx
10271 !! end
10272
10273
10274
10275 !! test
10276 Handling of &#x0A; in URLs
10277 !! input
10278 **irc://&#x0A;a
10279 !! result
10280 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10281 </li></ul>
10282 </li></ul>
10283
10284 !!end
10285
10286 !! test
10287 5 quotes, code coverage +1 line
10288 !! input
10289 '''''
10290 !! result
10291 !! end
10292
10293 !! test
10294 Special:Search page linking.
10295 !! input
10296 {{Special:search}}
10297 !! result
10298 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10299 </p>
10300 !! end
10301
10302 !! test
10303 Say the magic word
10304 !! input
10305 * {{PAGENAME}}
10306 * {{BASEPAGENAME}}
10307 * {{SUBPAGENAME}}
10308 * {{SUBPAGENAMEE}}
10309 * {{BASEPAGENAME}}
10310 * {{BASEPAGENAMEE}}
10311 * {{TALKPAGENAME}}
10312 * {{TALKPAGENAMEE}}
10313 * {{SUBJECTPAGENAME}}
10314 * {{SUBJECTPAGENAMEE}}
10315 * {{NAMESPACEE}}
10316 * {{NAMESPACE}}
10317 * {{TALKSPACE}}
10318 * {{TALKSPACEE}}
10319 * {{SUBJECTSPACE}}
10320 * {{SUBJECTSPACEE}}
10321 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10322 !! result
10323 <ul><li> Parser test
10324 </li><li> Parser test
10325 </li><li> Parser test
10326 </li><li> Parser_test
10327 </li><li> Parser test
10328 </li><li> Parser_test
10329 </li><li> Talk:Parser test
10330 </li><li> Talk:Parser_test
10331 </li><li> Parser test
10332 </li><li> Parser_test
10333 </li><li>
10334 </li><li>
10335 </li><li> Talk
10336 </li><li> Talk
10337 </li><li>
10338 </li><li>
10339 </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>
10340 </li></ul>
10341
10342 !! end
10343 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10344
10345 !! test
10346 Gallery
10347 !! input
10348 <gallery>
10349 image1.png |
10350 image2.gif|||||
10351
10352 image3|
10353 image4 |300px| centre
10354 image5.svg| http://///////
10355 [[x|xx]]]]
10356 * image6
10357 </gallery>
10358 !! result
10359 <ul class="gallery">
10360 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10361 <div style="height: 150px;">Image1.png</div>
10362 <div class="gallerytext">
10363 </div>
10364 </div></li>
10365 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10366 <div style="height: 150px;">Image2.gif</div>
10367 <div class="gallerytext">
10368 <p>||||
10369 </p>
10370 </div>
10371 </div></li>
10372 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10373 <div style="height: 150px;">Image3</div>
10374 <div class="gallerytext">
10375 </div>
10376 </div></li>
10377 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10378 <div style="height: 150px;">Image4</div>
10379 <div class="gallerytext">
10380 <p>300px| centre
10381 </p>
10382 </div>
10383 </div></li>
10384 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10385 <div style="height: 150px;">Image5.svg</div>
10386 <div class="gallerytext">
10387 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10388 </p>
10389 </div>
10390 </div></li>
10391 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10392 <div style="height: 150px;">* image6</div>
10393 <div class="gallerytext">
10394 </div>
10395 </div></li>
10396 </ul>
10397
10398 !! end
10399
10400 !! test
10401 Gallery (with options)
10402 !! input
10403 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10404 File:Nonexistant.jpg|caption
10405 File:Nonexistant.jpg
10406 image:foobar.jpg|some '''caption''' [[Main Page]]
10407 image:foobar.jpg
10408 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10409 </gallery>
10410 !! result
10411 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10412 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10413 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10414 <div style="height: 70px;">Nonexistant.jpg</div>
10415 <div class="gallerytext">
10416 <p>caption
10417 </p>
10418 </div>
10419 </div></li>
10420 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10421 <div style="height: 70px;">Nonexistant.jpg</div>
10422 <div class="gallerytext">
10423 </div>
10424 </div></li>
10425 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10426 <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>
10427 <div class="gallerytext">
10428 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10429 </p>
10430 </div>
10431 </div></li>
10432 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10433 <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>
10434 <div class="gallerytext">
10435 </div>
10436 </div></li>
10437 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10438 <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>
10439 <div class="gallerytext">
10440 <p>Blabla|blabla.
10441 </p>
10442 </div>
10443 </div></li>
10444 </ul>
10445
10446 !! end
10447
10448 !! test
10449 Gallery with wikitext inside caption
10450 !! input
10451 <gallery>
10452 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10453 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10454 </gallery>
10455 !! result
10456 <ul class="gallery">
10457 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10458 <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>
10459 <div class="gallerytext">
10460 <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>
10461 </p>
10462 </div>
10463 </div></li>
10464 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10465 <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>
10466 <div class="gallerytext">
10467 <p>This is a test template
10468 </p>
10469 </div>
10470 </div></li>
10471 </ul>
10472
10473 !! end
10474
10475 !! test
10476 gallery (with showfilename option)
10477 !! input
10478 <gallery showfilename>
10479 File:Nonexistant.jpg|caption
10480 File:Nonexistant.jpg
10481 image:foobar.jpg|some '''caption''' [[Main Page]]
10482 File:Foobar.jpg
10483 </gallery>
10484 !! result
10485 <ul class="gallery">
10486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10487 <div style="height: 150px;">Nonexistant.jpg</div>
10488 <div class="gallerytext">
10489 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10490 caption
10491 </p>
10492 </div>
10493 </div></li>
10494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10495 <div style="height: 150px;">Nonexistant.jpg</div>
10496 <div class="gallerytext">
10497 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10498 </p>
10499 </div>
10500 </div></li>
10501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10502 <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>
10503 <div class="gallerytext">
10504 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10505 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10506 </p>
10507 </div>
10508 </div></li>
10509 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10510 <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>
10511 <div class="gallerytext">
10512 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10513 </p>
10514 </div>
10515 </div></li>
10516 </ul>
10517
10518 !! end
10519
10520 !! test
10521 Gallery (with namespace-less filenames)
10522 !! input
10523 <gallery>
10524 File:Nonexistant.jpg
10525 Nonexistant.jpg
10526 image:foobar.jpg
10527 foobar.jpg
10528 </gallery>
10529 !! result
10530 <ul class="gallery">
10531 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10532 <div style="height: 150px;">Nonexistant.jpg</div>
10533 <div class="gallerytext">
10534 </div>
10535 </div></li>
10536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10537 <div style="height: 150px;">Nonexistant.jpg</div>
10538 <div class="gallerytext">
10539 </div>
10540 </div></li>
10541 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10542 <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>
10543 <div class="gallerytext">
10544 </div>
10545 </div></li>
10546 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10547 <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>
10548 <div class="gallerytext">
10549 </div>
10550 </div></li>
10551 </ul>
10552
10553 !! end
10554
10555 !! test
10556 HTML Hex character encoding (spells the word "JavaScript")
10557 !! input
10558 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10559 !! result
10560 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10561 </p>
10562 !! end
10563
10564 !! test
10565 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10566 !! input
10567 &#xsee;&#XSEE;
10568 !! result
10569 <p>&amp;#xsee;&amp;#XSEE;
10570 </p>
10571 !! end
10572
10573 !! test
10574 HTML Hex character encoding mixed case
10575 !! input
10576 &#xEE;&#Xee;
10577 !! result
10578 <p>&#xee;&#xee;
10579 </p>
10580 !! end
10581
10582 !! test
10583 __FORCETOC__ override
10584 !! input
10585 __NEWSECTIONLINK__
10586 __FORCETOC__
10587 !! result
10588 <p><br />
10589 </p>
10590 !! end
10591
10592 !! test
10593 ISBN code coverage
10594 !! input
10595 ISBN 978-0-1234-56&#x20;789
10596 !! result
10597 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10598 </p>
10599 !! end
10600
10601 !! test
10602 ISBN followed by 5 spaces
10603 !! input
10604 ISBN
10605 !! result
10606 <p>ISBN
10607 </p>
10608 !! end
10609
10610 !! test
10611 Double ISBN
10612 !! input
10613 ISBN ISBN 1234567890
10614 !! result
10615 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10616 </p>
10617 !! end
10618
10619 !! test
10620 Bug 22905: <abbr> followed by ISBN followed by </a>
10621 !! input
10622 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10623 !! result
10624 <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>
10625 </p>
10626 !! end
10627
10628 !! test
10629 Double RFC
10630 !! input
10631 RFC RFC 1234
10632 !! result
10633 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10634 </p>
10635 !! end
10636
10637 !! test
10638 Double RFC with a wiki link
10639 !! input
10640 RFC [[RFC 1234]]
10641 !! result
10642 <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>
10643 </p>
10644 !! end
10645
10646 !! test
10647 RFC code coverage
10648 !! input
10649 RFC 983&#x20;987
10650 !! result
10651 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10652 </p>
10653 !! end
10654
10655 !! test
10656 Centre-aligned image
10657 !! input
10658 [[Image:foobar.jpg|centre]]
10659 !! result
10660 <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>
10661
10662 !!end
10663
10664 !! test
10665 None-aligned image
10666 !! input
10667 [[Image:foobar.jpg|none]]
10668 !! result
10669 <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>
10670
10671 !!end
10672
10673 !! test
10674 Width + Height sized image (using px) (height is ignored)
10675 !! input
10676 [[Image:foobar.jpg|640x480px]]
10677 !! result
10678 <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>
10679 </p>
10680 !!end
10681
10682 !! test
10683 Width-sized image (using px, no following whitespace)
10684 !! input
10685 [[Image:foobar.jpg|640px]]
10686 !! result
10687 <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>
10688 </p>
10689 !!end
10690
10691 !! test
10692 Width-sized image (using px, with following whitespace - test regression from r39467)
10693 !! input
10694 [[Image:foobar.jpg|640px ]]
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, with preceding whitespace - test regression from r39467)
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 Another italics / bold test
10711 !! input
10712 ''' ''x'
10713 !! result
10714 <pre>'<i> </i>x'
10715 </pre>
10716 !!end
10717
10718 # Note the results may be incorrect, as parserTest output included this:
10719 # XML error: Mismatched tag at byte 6120:
10720 # ...<dd> </dt></dl> </dd...
10721 !! test
10722 dt/dd/dl test
10723 !! options
10724 disabled
10725 !! input
10726 :;;;::
10727 !! result
10728 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10729 </dd></dl>
10730 </dd></dl>
10731 </dt></dl>
10732 </dt></dl>
10733 </dt></dl>
10734 </dd></dl>
10735
10736 !!end
10737
10738
10739 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10740 !! test
10741 Images with the "|" character in the comment
10742 !! input
10743 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10744 !! result
10745 <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>
10746
10747 !!end
10748
10749 !! test
10750 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10751 !! input
10752 <html><script>alert(1);</script></html>
10753 !! result
10754 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10755 </p>
10756 !! end
10757
10758 !! test
10759 HTML with raw HTML ($wgRawHtml==true)
10760 !! options
10761 rawhtml
10762 !! input
10763 <html><script>alert(1);</script></html>
10764 !! result
10765 <p><script>alert(1);</script>
10766 </p>
10767 !! end
10768
10769 !! test
10770 Parents of subpages, one level up
10771 !! options
10772 subpage title=[[Subpage test/L1/L2/L3]]
10773 !! input
10774 [[../|L2]]
10775 !! result
10776 <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>
10777 </p>
10778 !! end
10779
10780
10781 !! test
10782 Parents of subpages, one level up, not named
10783 !! options
10784 subpage title=[[Subpage test/L1/L2/L3]]
10785 !! input
10786 [[../]]
10787 !! result
10788 <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>
10789 </p>
10790 !! end
10791
10792
10793
10794 !! test
10795 Parents of subpages, two levels up
10796 !! options
10797 subpage title=[[Subpage test/L1/L2/L3]]
10798 !! input
10799 [[../../|L1]]2
10800
10801 [[../../|L1]]l
10802 !! result
10803 <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
10804 </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>
10805 </p>
10806 !! end
10807
10808 !! test
10809 Parents of subpages, two levels up, without trailing slash or name.
10810 !! options
10811 subpage title=[[Subpage test/L1/L2/L3]]
10812 !! input
10813 [[../..]]
10814 !! result
10815 <p>[[../..]]
10816 </p>
10817 !! end
10818
10819 !! test
10820 Parents of subpages, two levels up, with lots of extra trailing slashes.
10821 !! options
10822 subpage title=[[Subpage test/L1/L2/L3]]
10823 !! input
10824 [[../../////]]
10825 !! result
10826 <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>
10827 </p>
10828 !! end
10829
10830 !! test
10831 Definition list code coverage
10832 !! input
10833 ; title : def
10834 ; title : def
10835 ;title: def
10836 !! result
10837 <dl><dt> title &#160;</dt><dd> def
10838 </dd><dt> title&#160;</dt><dd> def
10839 </dd><dt>title</dt><dd> def
10840 </dd></dl>
10841
10842 !! end
10843
10844 !! test
10845 Don't fall for the self-closing div
10846 !! input
10847 <div>hello world</div/>
10848 !! result
10849 <div>hello world</div>
10850
10851 !! end
10852
10853 !! test
10854 MSGNW magic word
10855 !! input
10856 {{MSGNW:msg}}
10857 !! result
10858 <p>&#91;&#91;:Template:Msg&#93;&#93;
10859 </p>
10860 !! end
10861
10862 !! test
10863 RAW magic word
10864 !! input
10865 {{RAW:QUERTY}}
10866 !! result
10867 <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>
10868 </p>
10869 !! end
10870
10871 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10872 !! test
10873 Always escape literal '>' in output, not just after '<'
10874 !! input
10875 ><>
10876 !! result
10877 <p>&gt;&lt;&gt;
10878 </p>
10879 !! end
10880
10881 !! test
10882 Template caching
10883 !! input
10884 {{Test}}
10885 {{Test}}
10886 !! result
10887 <p>This is a test template
10888 This is a test template
10889 </p>
10890 !! end
10891
10892
10893 !! article
10894 MediaWiki:Fake
10895 !! text
10896 ==header==
10897 !! endarticle
10898
10899 !! test
10900 Inclusion of !userCanEdit() content
10901 !! input
10902 {{MediaWiki:Fake}}
10903 !! result
10904 <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>
10905
10906 !! end
10907
10908
10909 !! test
10910 Out-of-order TOC heading levels
10911 !! input
10912 ==2==
10913 ======6======
10914 ===3===
10915 =1=
10916 =====5=====
10917 ==2==
10918 !! result
10919 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10920 <ul>
10921 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10922 <ul>
10923 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10924 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10925 </ul>
10926 </li>
10927 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10928 <ul>
10929 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10930 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10931 </ul>
10932 </li>
10933 </ul>
10934 </td></tr></table>
10935 <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>
10936 <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>
10937 <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>
10938 <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>
10939 <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>
10940 <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>
10941
10942 !! end
10943
10944
10945 !! test
10946 ISBN with a dummy number
10947 !! input
10948 ISBN ---
10949 !! result
10950 <p>ISBN ---
10951 </p>
10952 !! end
10953
10954
10955 !! test
10956 ISBN with space-delimited number
10957 !! input
10958 ISBN 92 9017 032 8
10959 !! result
10960 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10961 </p>
10962 !! end
10963
10964
10965 !! test
10966 ISBN with multiple spaces, no number
10967 !! input
10968 ISBN foo
10969 !! result
10970 <p>ISBN foo
10971 </p>
10972 !! end
10973
10974
10975 !! test
10976 ISBN length
10977 !! input
10978 ISBN 123456789
10979
10980 ISBN 1234567890
10981
10982 ISBN 12345678901
10983 !! result
10984 <p>ISBN 123456789
10985 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10986 </p><p>ISBN 12345678901
10987 </p>
10988 !! end
10989
10990
10991 !! test
10992 ISBN with trailing year (bug 8110)
10993 !! input
10994 ISBN 1-234-56789-0 - 2006
10995
10996 ISBN 1 234 56789 0 - 2006
10997 !! result
10998 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10999 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11000 </p>
11001 !! end
11002
11003
11004 !! test
11005 anchorencode
11006 !! input
11007 {{anchorencode:foo bar©#%n}}
11008 !! result
11009 <p>foo_bar.C2.A9.23.25n
11010 </p>
11011 !! end
11012
11013 !! test
11014 anchorencode trims spaces
11015 !! input
11016 {{anchorencode: __pretty__please__}}
11017 !! result
11018 <p>pretty_please
11019 </p>
11020 !! end
11021
11022 !! test
11023 anchorencode deals with links
11024 !! input
11025 {{anchorencode: [[hello|world]] [[hi]]}}
11026 !! result
11027 <p>world_hi
11028 </p>
11029 !! end
11030
11031 !! test
11032 anchorencode deals with templates
11033 !! input
11034 {{anchorencode: {{Foo}} }}
11035 !! result
11036 <p>FOO
11037 </p>
11038 !! end
11039
11040 !! test
11041 anchorencode encodes like the TOC generator: (bug 18431)
11042 !! input
11043 === _ +:.3A%3A&&amp;]] ===
11044 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11045 __NOEDITSECTION__
11046 !! result
11047 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
11048 <p>.2B:.3A.253A.26.26.5D.5D
11049 </p>
11050 !! end
11051
11052 # Expected output in the following test is not necessarily expected (there
11053 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11054 # only testing for well-formedness.
11055 !! test
11056 Bug 6200: blockquotes and paragraph formatting
11057 !! input
11058 <blockquote>
11059 foo
11060 </blockquote>
11061
11062 bar
11063
11064 baz
11065 !! result
11066 <blockquote>
11067 foo
11068 </blockquote>
11069 <p>bar
11070 </p>
11071 <pre>baz
11072 </pre>
11073 !! end
11074
11075 !! test
11076 Bug 8293: Use of center tag ruins paragraph formatting
11077 !! input
11078 <center>
11079 foo
11080 </center>
11081
11082 bar
11083
11084 baz
11085 !! result
11086 <center>
11087 <p>foo
11088 </p>
11089 </center>
11090 <p>bar
11091 </p>
11092 <pre>baz
11093 </pre>
11094 !! end
11095
11096
11097 ###
11098 ### Language variants related tests
11099 ###
11100 !! test
11101 Self-link in language variants
11102 !! options
11103 title=[[Dunav]] language=sr
11104 !! input
11105 Both [[Dunav]] and [[Дунав]] are names for this river.
11106 !! result
11107 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11108 </p>
11109 !!end
11110
11111 !! article
11112 Дуна
11113 !! text
11114 content
11115 !! endarticle
11116
11117 !! test
11118 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11119 !! options
11120 title=[[Duna]] language=sr
11121 !! input
11122 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11123 !! result
11124 <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.
11125 </p>
11126 !! end
11127
11128 !! test
11129 Link to pages in language variants
11130 !! options
11131 language=sr
11132 !! input
11133 Main Page can be written as [[Маин Паге]]
11134 !! result
11135 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11136 </p>
11137 !!end
11138
11139
11140 !! test
11141 Multiple links to pages in language variants
11142 !! options
11143 language=sr
11144 !! input
11145 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11146 !! result
11147 <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>.
11148 </p>
11149 !!end
11150
11151
11152 !! test
11153 Simple template in language variants
11154 !! options
11155 language=sr
11156 !! input
11157 {{тест}}
11158 !! result
11159 <p>This is a test template
11160 </p>
11161 !! end
11162
11163
11164 !! test
11165 Template with explicit namespace in language variants
11166 !! options
11167 language=sr
11168 !! input
11169 {{Template:тест}}
11170 !! result
11171 <p>This is a test template
11172 </p>
11173 !! end
11174
11175
11176 !! test
11177 Basic test for template parameter in language variants
11178 !! options
11179 language=sr
11180 !! input
11181 {{парамтест|param=foo}}
11182 !! result
11183 <p>This is a test template with parameter foo
11184 </p>
11185 !! end
11186
11187
11188 !! test
11189 Simple category in language variants
11190 !! options
11191 language=sr cat
11192 !! input
11193 [[Category:МедиаWики Усер'с Гуиде]]
11194 !! result
11195 <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>
11196 !! end
11197
11198
11199 !! article
11200 Category:分类
11201 !! text
11202 blah
11203 !! endarticle
11204
11205 !! article
11206 Category:分類
11207 !! text
11208 blah
11209 !! endarticle
11210
11211 !! test
11212 Don't convert blue categorylinks to another variant (bug 33210)
11213 !! options
11214 language=zh cat
11215 !! input
11216 [[A]][[Category:分类]]
11217 !! result
11218 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11219 !! end
11220
11221
11222 !! test
11223 Stripping -{}- tags (language variants)
11224 !! options
11225 language=sr
11226 !! input
11227 Latin proverb: -{Ne nuntium necare}-
11228 !! result
11229 <p>Latin proverb: Ne nuntium necare
11230 </p>
11231 !! end
11232
11233
11234 !! test
11235 Prevent conversion with -{}- tags (language variants)
11236 !! options
11237 language=sr variant=sr-ec
11238 !! input
11239 Latinski: -{Ne nuntium necare}-
11240 !! result
11241 <p>Латински: Ne nuntium necare
11242 </p>
11243 !! end
11244
11245
11246 !! test
11247 Prevent conversion of text with -{}- tags (language variants)
11248 !! options
11249 language=sr variant=sr-ec
11250 !! input
11251 Latinski: -{Ne nuntium necare}-
11252 !! result
11253 <p>Латински: Ne nuntium necare
11254 </p>
11255 !! end
11256
11257
11258 !! test
11259 Prevent conversion of links with -{}- tags (language variants)
11260 !! options
11261 language=sr variant=sr-ec
11262 !! input
11263 -{[[Main Page]]}-
11264 !! result
11265 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11266 </p>
11267 !! end
11268
11269
11270 !! test
11271 -{}- tags within headlines (within html for parserConvert())
11272 !! options
11273 language=sr variant=sr-ec
11274 !! input
11275 == -{Naslov}- ==
11276 !! result
11277 <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>
11278
11279 !! end
11280
11281
11282 !! test
11283 Explicit definition of language variant alternatives
11284 !! options
11285 language=zh variant=zh-tw
11286 !! input
11287 -{zh:China;zh-tw:Taiwan}-, not China
11288 !! result
11289 <p>Taiwan, not China
11290 </p>
11291 !! end
11292
11293
11294 !! test
11295 Conversion around HTML tags
11296 !! options
11297 language=sr variant=sr-ec
11298 !! input
11299 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11300 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11301 !! result
11302 <p>
11303 <span title="ЛаCтин">ски</span>
11304 </p>
11305 !! end
11306
11307
11308 !! test
11309 Explicit session-wise language variant mapping (A flag and - flag)
11310 !! options
11311 language=zh variant=zh-tw
11312 !! input
11313 Taiwan is not China.
11314 But -{A|zh:China;zh-tw:Taiwan}- is China,
11315 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11316 and -{China}- is China.
11317 !! result
11318 <p>Taiwan is not China.
11319 But Taiwan is Taiwan,
11320 (This should be stripped!)
11321 and China is China.
11322 </p>
11323 !! end
11324
11325 !! test
11326 Explicit session-wise language variant mapping (H flag for hide)
11327 !! options
11328 language=zh variant=zh-tw
11329 !! input
11330 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11331 Taiwan is China.
11332 !! result
11333 <p>(This should be stripped!)
11334 Taiwan is Taiwan.
11335 </p>
11336 !! end
11337
11338 !! test
11339 Adding explicit conversion rule for title (T flag)
11340 !! options
11341 language=zh variant=zh-tw showtitle
11342 !! input
11343 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11344 !! result
11345 Taiwan
11346 <p>Should be stripped!
11347 </p>
11348 !! end
11349
11350 !! test
11351 Testing that changing the language variant here in the tests actually works
11352 !! options
11353 language=zh variant=zh showtitle
11354 !! input
11355 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11356 !! result
11357 China
11358 <p>Should be stripped!
11359 </p>
11360 !! end
11361
11362 !! test
11363 Recursive conversion of alt and title attrs shouldn't clear converter state
11364 !! options
11365 language=zh variant=zh-cn showtitle
11366 !! input
11367 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11368 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11369 !! result
11370 China
11371 <p>
11372 Should be stripped<span title="Exclamation">!</span>
11373 </p>
11374 !! end
11375
11376 !! test
11377 Bug 24072: more test on conversion rule for title
11378 !! options
11379 language=zh variant=zh-tw showtitle
11380 !! input
11381 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11382 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11383 !! result
11384 Taiwan
11385 <p>This should be stripped!
11386 This won't take interferes with the title rule.
11387 </p>
11388 !! end
11389
11390 !! test
11391 Raw output of variant escape tags (R flag)
11392 !! options
11393 language=zh variant=zh-tw
11394 !! input
11395 Raw: -{R|zh:China;zh-tw:Taiwan}-
11396 !! result
11397 <p>Raw: zh:China;zh-tw:Taiwan
11398 </p>
11399 !! end
11400
11401 !! test
11402 Nested using of manual convert syntax
11403 !! options
11404 language=zh variant=zh-hk
11405 !! input
11406 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11407 !! result
11408 <p>Nested: Hello Hong Kong!
11409 </p>
11410 !! end
11411
11412 !! test
11413 Proper conversion of text in external links
11414 !! options
11415 language=sr variant=sr-ec
11416 !! input
11417 http://www.google.com
11418 gopher://www.google.com
11419 [http://www.google.com http://www.google.com]
11420 [gopher://www.google.com gopher://www.google.com]
11421 [https://www.google.com irc://www.google.com]
11422 [ftp://www.google.com www.google.com/ftp://dir]
11423 [//www.google.com www.google.com]
11424 !! result
11425 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11426 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11427 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11428 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11429 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11430 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11431 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11432 </p>
11433 !! end
11434
11435 !! test
11436 Do not convert roman numbers to language variants
11437 !! options
11438 language=sr variant=sr-ec
11439 !! input
11440 Fridrih IV je car.
11441 !! result
11442 <p>Фридрих IV је цар.
11443 </p>
11444 !! end
11445
11446 !! test
11447 Unclosed language converter markup "-{"
11448 !! options
11449 language=sr
11450 !! input
11451 -{T|hello
11452 !! result
11453 <p>-{T|hello
11454 </p>
11455 !! end
11456
11457 !! test
11458 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11459 !! options
11460 language=sr
11461 !! input
11462 -{R|=&gt;}-
11463 !! result
11464 <p>=&gt;
11465 </p>
11466 !!end
11467
11468 !!article
11469 Template:Bullet
11470 !!text
11471 * Bar
11472 !!endarticle
11473
11474 !! test
11475 Bug 529: Uncovered bullet
11476 !! input
11477 * Foo {{bullet}}
11478 !! result
11479 <ul><li> Foo
11480 </li><li> Bar
11481 </li></ul>
11482
11483 !! end
11484
11485 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11486 # Templates in Wikipedia rely on this behavior, as tidy has always been
11487 # enabled there. These tests are normally run *without* tidy, so specify the
11488 # full output here.
11489 # To test realistic parsing behavior, apply a tidy-like transformation to both
11490 # the expected output and your parser's output.
11491 !! test
11492 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11493 !! input
11494 ******* Foo {{bullet}}
11495 !! result
11496 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11497 </li></ul>
11498 </li></ul>
11499 </li></ul>
11500 </li></ul>
11501 </li></ul>
11502 </li></ul>
11503 </li><li> Bar
11504 </li></ul>
11505
11506 !! end
11507
11508 !! test
11509 Bug 529: Uncovered table already at line-start
11510 !! input
11511 x
11512
11513 {{table}}
11514 y
11515 !! result
11516 <p>x
11517 </p>
11518 <table>
11519 <tr>
11520 <td> 1 </td>
11521 <td> 2
11522 </td></tr>
11523 <tr>
11524 <td> 3 </td>
11525 <td> 4
11526 </td></tr></table>
11527 <p>y
11528 </p>
11529 !! end
11530
11531 !! test
11532 Bug 529: Uncovered bullet in parser function result
11533 !! input
11534 * Foo {{lc:{{bullet}} }}
11535 !! result
11536 <ul><li> Foo
11537 </li><li> bar
11538 </li></ul>
11539
11540 !! end
11541
11542 !! test
11543 Bug 5678: Double-parsed template argument
11544 !! input
11545 {{lc:{{{1}}}|hello}}
11546 !! result
11547 <p>{{{1}}}
11548 </p>
11549 !! end
11550
11551 !! test
11552 Bug 5678: Double-parsed template invocation
11553 !! input
11554 {{lc:{{paramtest {{!}} param = hello }} }}
11555 !! result
11556 <p>{{paramtest | param = hello }}
11557 </p>
11558 !! end
11559
11560 !! test
11561 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11562 !! options
11563 language=cs
11564 title=[[Main Page]]
11565 !! input
11566 {{PRVNÍVELKÉ:ěščř}}
11567 {{prvnívelké:ěščř}}
11568 {{PRVNÍMALÉ:ěščř}}
11569 {{prvnímalé:ěščř}}
11570 {{MALÁ:ěščř}}
11571 {{malá:ěščř}}
11572 {{VELKÁ:ěščř}}
11573 {{velká:ěščř}}
11574 !! result
11575 <p>Ěščř
11576 Ěščř
11577 ěščř
11578 ěščř
11579 ěščř
11580 ěščř
11581 ĚŠČŘ
11582 ĚŠČŘ
11583 </p>
11584 !! end
11585
11586 !! test
11587 Morwen/13: Unclosed link followed by heading
11588 !! input
11589 [[link
11590 ==heading==
11591 !! result
11592 <p>[[link
11593 </p>
11594 <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>
11595
11596 !! end
11597
11598 !! test
11599 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11600 !! input
11601 {{foo|
11602 =heading=
11603 !! result
11604 <p>{{foo|
11605 </p>
11606 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11607
11608 !! end
11609
11610 !! test
11611 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11612 !! input
11613 {{foo|
11614 ==heading==
11615 !! result
11616 <p>{{foo|
11617 </p>
11618 <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>
11619
11620 !! end
11621
11622 !! test
11623 Tildes in comments
11624 !! options
11625 pst
11626 !! input
11627 <!-- ~~~~ -->
11628 !! result
11629 <!-- ~~~~ -->
11630 !! end
11631
11632 !! test
11633 Paragraphs inside divs (no extra line breaks)
11634 !! input
11635 <div>Line one
11636
11637 Line two</div>
11638 !! result
11639 <div>Line one
11640 Line two</div>
11641
11642 !! end
11643
11644 !! test
11645 Paragraphs inside divs (extra line break on open)
11646 !! input
11647 <div>
11648 Line one
11649
11650 Line two</div>
11651 !! result
11652 <div>
11653 <p>Line one
11654 </p>
11655 Line two</div>
11656
11657 !! end
11658
11659 !! test
11660 Paragraphs inside divs (extra line break on close)
11661 !! input
11662 <div>Line one
11663
11664 Line two
11665 </div>
11666 !! result
11667 <div>Line one
11668 <p>Line two
11669 </p>
11670 </div>
11671
11672 !! end
11673
11674 !! test
11675 Paragraphs inside divs (extra line break on open and close)
11676 !! input
11677 <div>
11678 Line one
11679
11680 Line two
11681 </div>
11682 !! result
11683 <div>
11684 <p>Line one
11685 </p><p>Line two
11686 </p>
11687 </div>
11688
11689 !! end
11690
11691 !! test
11692 Nesting tags, paragraphs on lines which begin with <div>
11693 !! options
11694 disabled
11695 !! input
11696 <div></div><strong>A
11697 B</strong>
11698 !! result
11699 <div></div>
11700 <p><strong>A
11701 B</strong>
11702 </p>
11703 !! end
11704
11705 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11706 !! test
11707 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11708 !! options
11709 disabled
11710 !! input
11711 <blockquote>Line one
11712
11713 Line two</blockquote>
11714 !! result
11715 <blockquote>Line one
11716 Line two</blockquote>
11717
11718 !! end
11719
11720 !! test
11721 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11722 !! options
11723 disabled
11724 !! input
11725 <blockquote>
11726 Line one
11727
11728 Line two</blockquote>
11729 !! result
11730 <blockquote>
11731 <p>Line one
11732 </p>
11733 Line two</blockquote>
11734
11735 !! end
11736
11737 !! test
11738 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11739 !! options
11740 disabled
11741 !! input
11742 <blockquote>Line one
11743
11744 Line two
11745 </blockquote>
11746 !! result
11747 <blockquote>Line one
11748 <p>Line two
11749 </p>
11750 </blockquote>
11751
11752 !! end
11753
11754 !! test
11755 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11756 !! options
11757 disabled
11758 !! input
11759 <blockquote>
11760 Line one
11761
11762 Line two
11763 </blockquote>
11764 !! result
11765 <blockquote>
11766 <p>Line one
11767 </p><p>Line two
11768 </p>
11769 </blockquote>
11770
11771 !! end
11772
11773 !! test
11774 Paragraphs inside blockquotes/divs (no extra line breaks)
11775 !! input
11776 <blockquote><div>Line one
11777
11778 Line two</div></blockquote>
11779 !! result
11780 <blockquote><div>Line one
11781 Line two</div></blockquote>
11782
11783 !! end
11784
11785 !! test
11786 Paragraphs inside blockquotes/divs (extra line break on open)
11787 !! input
11788 <blockquote><div>
11789 Line one
11790
11791 Line two</div></blockquote>
11792 !! result
11793 <blockquote><div>
11794 <p>Line one
11795 </p>
11796 Line two</div></blockquote>
11797
11798 !! end
11799
11800 !! test
11801 Paragraphs inside blockquotes/divs (extra line break on close)
11802 !! input
11803 <blockquote><div>Line one
11804
11805 Line two
11806 </div></blockquote>
11807 !! result
11808 <blockquote><div>Line one
11809 <p>Line two
11810 </p>
11811 </div></blockquote>
11812
11813 !! end
11814
11815 !! test
11816 Paragraphs inside blockquotes/divs (extra line break on open and close)
11817 !! input
11818 <blockquote><div>
11819 Line one
11820
11821 Line two
11822 </div></blockquote>
11823 !! result
11824 <blockquote><div>
11825 <p>Line one
11826 </p><p>Line two
11827 </p>
11828 </div></blockquote>
11829
11830 !! end
11831
11832 !! test
11833 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11834 !! options
11835 wgLinkHolderBatchSize=0
11836 !! input
11837 [[meatball:1]]
11838 [[meatball:2]]
11839 [[meatball:3]]
11840 !! result
11841 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11842 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11843 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11844 </p>
11845 !! end
11846
11847 !! test
11848 Free external link invading image caption
11849 !! input
11850 [[Image:Foobar.jpg|thumb|http://x|hello]]
11851 !! result
11852 <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>
11853
11854 !! end
11855
11856 !! test
11857 Bug 15196: localised external link numbers
11858 !! options
11859 language=fa
11860 !! input
11861 [http://en.wikipedia.org/]
11862 !! result
11863 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11864 </p>
11865 !! end
11866
11867 !! test
11868 Multibyte character in padleft
11869 !! input
11870 {{padleft:-Hello|7|Æ}}
11871 !! result
11872 <p>Æ-Hello
11873 </p>
11874 !! end
11875
11876 !! test
11877 Multibyte character in padright
11878 !! input
11879 {{padright:Hello-|7|Æ}}
11880 !! result
11881 <p>Hello-Æ
11882 </p>
11883 !! end
11884
11885 !!test
11886 formatdate parser function
11887 !!input
11888 {{#formatdate:2009-03-24}}
11889 !! result
11890 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11891 </p>
11892 !! end
11893
11894 !!test
11895 formatdate parser function, with default format
11896 !!input
11897 {{#formatdate:2009-03-24|mdy}}
11898 !! result
11899 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11900 </p>
11901 !! end
11902
11903 !! test
11904 Spacing of numbers in formatted dates
11905 !! input
11906 {{#formatdate:January 15}}
11907 !! result
11908 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11909 </p>
11910 !! end
11911
11912 !! test
11913 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
11914 !! options
11915 language=nl title=[[MediaWiki:Common.css]]
11916 !! input
11917 {{#formatdate:2009-03-24|dmy}}
11918 !! result
11919 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11920 </p>
11921 !! end
11922
11923 #
11924 #
11925 #
11926
11927 #
11928 # Edit comments
11929 #
11930
11931 !! test
11932 Edit comment with link
11933 !! options
11934 comment
11935 !! input
11936 I like the [[Main Page]] a lot
11937 !! result
11938 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11939 !!end
11940
11941 !! test
11942 Edit comment with link and link text
11943 !! options
11944 comment
11945 !! input
11946 I like the [[Main Page|best pages]] a lot
11947 !! result
11948 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11949 !!end
11950
11951 !! test
11952 Edit comment with link and link text with suffix
11953 !! options
11954 comment
11955 !! input
11956 I like the [[Main Page|best page]]s a lot
11957 !! result
11958 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11959 !!end
11960
11961 !! test
11962 Edit comment with section link (non-local, eg in history list)
11963 !! options
11964 comment title=[[Main Page]]
11965 !! input
11966 /* External links */ removed bogus entries
11967 !! result
11968 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11969 !!end
11970
11971 !! test
11972 Edit comment with section link and text before it (non-local, eg in history list)
11973 !! options
11974 comment title=[[Main Page]]
11975 !! input
11976 pre-comment text /* External links */ removed bogus entries
11977 !! result
11978 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>
11979 !!end
11980
11981 !! test
11982 Edit comment with section link (local, eg in diff view)
11983 !! options
11984 comment local title=[[Main Page]]
11985 !! input
11986 /* External links */ removed bogus entries
11987 !! result
11988 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11989 !!end
11990
11991 !! test
11992 Edit comment with subpage link (bug 14080)
11993 !! options
11994 comment
11995 subpage
11996 title=[[Subpage test]]
11997 !! input
11998 Poked at a [[/subpage]] here...
11999 !! result
12000 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12001 !!end
12002
12003 !! test
12004 Edit comment with subpage link and link text (bug 14080)
12005 !! options
12006 comment
12007 subpage
12008 title=[[Subpage test]]
12009 !! input
12010 Poked at a [[/subpage|neat little page]] here...
12011 !! result
12012 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12013 !!end
12014
12015 !! test
12016 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12017 !! options
12018 comment
12019 title=[[Subpage test]]
12020 !! input
12021 Poked at a [[/subpage]] here...
12022 !! result
12023 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...
12024 !!end
12025
12026 !! test
12027 Edit comment with bare anchor link (local, as on diff)
12028 !! options
12029 comment
12030 local
12031 title=[[Main Page]]
12032 !!input
12033 [[#section]]
12034 !! result
12035 <a href="#section">#section</a>
12036 !! end
12037
12038 !! test
12039 Edit comment with bare anchor link (non-local, as on history)
12040 !! options
12041 comment
12042 title=[[Main Page]]
12043 !!input
12044 [[#section]]
12045 !! result
12046 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12047 !! end
12048
12049 !! test
12050 Anchor starting with underscore
12051 !!input
12052 [[#_ref|One]]
12053 !! result
12054 <p><a href="#_ref">One</a>
12055 </p>
12056 !! end
12057
12058 !! test
12059 Id starting with underscore
12060 !!input
12061 <div id="_ref"></div>
12062 !! result
12063 <div id="_ref"></div>
12064
12065 !! end
12066
12067 !! test
12068 Space normalisation on autocomment (bug 22784)
12069 !! options
12070 comment
12071 title=[[Main Page]]
12072 !!input
12073 /* __hello__world__ */
12074 !! result
12075 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12076 !! end
12077
12078 !! test
12079 percent-encoding and + signs in comments (Bug 26410)
12080 !! options
12081 comment
12082 !!input
12083 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12084 !! result
12085 <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>
12086 !! end
12087
12088 !! test
12089 Bad images - basic functionality
12090 !! options
12091 disabled
12092 !! input
12093 [[File:Bad.jpg]]
12094 !! result
12095 !! end
12096
12097 !! test
12098 Bad images - bug 16039: text after bad image disappears
12099 !! options
12100 disabled
12101 !! input
12102 Foo bar
12103 [[File:Bad.jpg]]
12104 Bar foo
12105 !! result
12106 <p>Foo bar
12107 </p><p>Bar foo
12108 </p>
12109 !! end
12110
12111 !! test
12112 Verify that displaytitle works (bug #22501) no displaytitle
12113 !! options
12114 showtitle
12115 !! config
12116 wgAllowDisplayTitle=true
12117 wgRestrictDisplayTitle=false
12118 !! input
12119 this is not the the title
12120 !! result
12121 Parser test
12122 <p>this is not the the title
12123 </p>
12124 !! end
12125
12126 !! test
12127 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12128 !! options
12129 showtitle
12130 title=[[Screen]]
12131 !! config
12132 wgAllowDisplayTitle=true
12133 wgRestrictDisplayTitle=false
12134 !! input
12135 this is not the the title
12136 {{DISPLAYTITLE:whatever}}
12137 !! result
12138 whatever
12139 <p>this is not the the title
12140 </p>
12141 !! end
12142
12143 !! test
12144 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12145 !! options
12146 showtitle
12147 title=[[Screen]]
12148 !! config
12149 wgAllowDisplayTitle=true
12150 wgRestrictDisplayTitle=true
12151 !! input
12152 this is not the the title
12153 {{DISPLAYTITLE:whatever}}
12154 !! result
12155 Screen
12156 <p>this is not the the title
12157 </p>
12158 !! end
12159
12160 !! test
12161 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12162 !! options
12163 showtitle
12164 title=[[Screen]]
12165 !! config
12166 wgAllowDisplayTitle=true
12167 wgRestrictDisplayTitle=true
12168 !! input
12169 this is not the the title
12170 {{DISPLAYTITLE:screen}}
12171 !! result
12172 screen
12173 <p>this is not the the title
12174 </p>
12175 !! end
12176
12177 !! test
12178 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12179 !! options
12180 showtitle
12181 title=[[Screen]]
12182 !! config
12183 wgAllowDisplayTitle=false
12184 !! input
12185 this is not the the title
12186 {{DISPLAYTITLE:screen}}
12187 !! result
12188 Screen
12189 <p>this is not the the title
12190 <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>
12191 </p>
12192 !! end
12193
12194 !! test
12195 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12196 !! options
12197 showtitle
12198 title=[[Screen]]
12199 !! config
12200 wgAllowDisplayTitle=false
12201 !! input
12202 this is not the the title
12203 !! result
12204 Screen
12205 <p>this is not the the title
12206 </p>
12207 !! end
12208
12209 !! test
12210 preload: check <noinclude> and <includeonly>
12211 !! options
12212 preload
12213 !! input
12214 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12215 !! result
12216 Hello kind world.
12217 !! end
12218
12219 !! test
12220 preload: check <onlyinclude>
12221 !! options
12222 preload
12223 !! input
12224 Goodbye <onlyinclude>Hello world</onlyinclude>
12225 !! result
12226 Hello world
12227 !! end
12228
12229 !! test
12230 preload: can pass tags through if we want to
12231 !! options
12232 preload
12233 !! input
12234 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12235 !! result
12236 <includeonly>Hello world</includeonly>
12237 !! end
12238
12239 !! test
12240 preload: check that it doesn't try to do tricks
12241 !! options
12242 preload
12243 !! input
12244 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12245 !! result
12246 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12247 !! end
12248
12249 !! test
12250 Play a bit with r67090 and bug 3158
12251 !! options
12252 disabled
12253 !! input
12254 <div style="width:50% !important">&nbsp;</div>
12255 <div style="width:50%&nbsp;!important">&nbsp;</div>
12256 <div style="width:50%&#160;!important">&nbsp;</div>
12257 <div style="border : solid;">&nbsp;</div>
12258 !! result
12259 <div style="width:50% !important">&nbsp;</div>
12260 <div style="width:50% !important">&nbsp;</div>
12261 <div style="width:50% !important">&nbsp;</div>
12262 <div style="border&#160;: solid;">&nbsp;</div>
12263
12264 !! end
12265
12266 !! test
12267 HTML5 data attributes
12268 !! input
12269 <span data-foo="bar">Baz</span>
12270 <p data-abc-def_hij="">Quuz</p>
12271 !! result
12272 <p><span data-foo="bar">Baz</span>
12273 </p>
12274 <p data-abc-def_hij="">Quuz</p>
12275
12276 !! end
12277
12278 !! test
12279 percent-encoding and + signs in internal links (Bug 26410)
12280 !! input
12281 [[User:+%]] [[Page+title%]]
12282 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12283 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12284 [[%33%45]] [[%33%45+]]
12285 !! result
12286 <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>
12287 <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>
12288 <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>
12289 <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>
12290 </p>
12291 !! end
12292
12293 !! test
12294 Special characters in embedded file links (bug 27679)
12295 !! input
12296 [[File:Contains & ampersand.jpg]]
12297 [[File:Does not exist.jpg|Title with & ampersand]]
12298 !! result
12299 <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>
12300 <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>
12301 </p>
12302 !! end
12303
12304
12305 !! test
12306 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12307 !! input
12308 Text&apos;s been normalized?
12309 !! result
12310 <p>Text&#39;s been normalized?
12311 </p>
12312 !! end
12313
12314 !! test
12315 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12316 !! input
12317 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12318 !! result
12319 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12320 </p>
12321 !! end
12322
12323 !! test
12324 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12325 !! input
12326 [http://www.example.org/ ideograms]
12327 !! result
12328 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12329 </p>
12330 !! end
12331
12332 !! test
12333 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12334 !! input
12335 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12336 !! result
12337 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12338 </p>
12339 !! end
12340
12341 !! article
12342 Mediawiki:loop1
12343 !! text
12344 {{Identical|A}}
12345 !! endarticle
12346
12347 !! article
12348 Mediawiki:loop2
12349 !! text
12350 {{Identical|B}}
12351 !! endarticle
12352
12353 !! article
12354 Template:Identical
12355 !! text
12356 {{int:loop1}}
12357 {{int:loop2}}
12358 !! endarticle
12359
12360 !! test
12361 Bug 31098 Template which includes system messages which includes the template
12362 !! input
12363 {{Identical}}
12364 !! result
12365 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12366 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12367 </p>
12368 !! end
12369
12370 !! test
12371 Bug31490 Turkish: ucfirst 'blah'
12372 !! options
12373 language=tr
12374 !! input
12375 {{ucfirst:blah}}
12376 !! result
12377 <p>Blah
12378 </p>
12379 !! end
12380
12381 !! test
12382 Bug31490 Turkish: ucfirst 'ix'
12383 !! options
12384 language=tr
12385 !! input
12386 {{ucfirst:ix}}
12387 !! result
12388 <p>İx
12389 </p>
12390 !! end
12391
12392 !! test
12393 Bug31490 Turkish: lcfirst 'BLAH'
12394 !! options
12395 language=tr
12396 !! input
12397 {{lcfirst:BLAH}}
12398 !! result
12399 <p>bLAH
12400 </p>
12401 !! end
12402
12403 !! test
12404 Bug31490 Turkish: ucfırst (with a dotless i)
12405 !! options
12406 language=tr
12407 !! input
12408 {{ucfırst:blah}}
12409 !! result
12410 <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>
12411 </p>
12412 !! end
12413
12414 !! test
12415 Bug31490 ucfırst (with a dotless i) with English language
12416 !! options
12417 language=en
12418 !! input
12419 {{ucfırst:blah}}
12420 !! result
12421 <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>
12422 </p>
12423 !! end
12424
12425 !! test
12426 Bug 26375: TOC with italics
12427 !! options
12428 title=[[Main Page]]
12429 !! input
12430 __TOC__
12431 == ''Lost'' episodes ==
12432 !! result
12433 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12434 <ul>
12435 <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>
12436 </ul>
12437 </td></tr></table>
12438 <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>
12439
12440 !! end
12441
12442 !! test
12443 Bug 26375: TOC with bold
12444 !! options
12445 title=[[Main Page]]
12446 !! input
12447 __TOC__
12448 == '''should be bold''' then normal text ==
12449 !! result
12450 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12451 <ul>
12452 <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>
12453 </ul>
12454 </td></tr></table>
12455 <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>
12456
12457 !! end
12458
12459 !! test
12460 Bug 33845: Headings become cursive in TOC when they contain an image
12461 !! options
12462 title=[[Main Page]]
12463 !! input
12464 __TOC__
12465 == Image [[Image:foobar.jpg]] ==
12466 !! result
12467 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12468 <ul>
12469 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12470 </ul>
12471 </td></tr></table>
12472 <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>
12473
12474 !! end
12475
12476 !! test
12477 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12478 !! options
12479 title=[[Main Page]]
12480 !! input
12481 __TOC__
12482 == <blockquote>Quote</blockquote> ==
12483 !! result
12484 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12485 <ul>
12486 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12487 </ul>
12488 </td></tr></table>
12489 <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>
12490
12491 !! end
12492
12493 !! test
12494 Unclosed tags in TOC
12495 !! options
12496 title=[[Main Page]]
12497 !! input
12498 __TOC__
12499 == Proof: 2 < 3 ==
12500 <small>Hanc marginis exiguitas non caperet.</small>
12501 QED
12502 !! result
12503 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12504 <ul>
12505 <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>
12506 </ul>
12507 </td></tr></table>
12508 <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>
12509 <p><small>Hanc marginis exiguitas non caperet.</small>
12510 QED
12511 </p>
12512 !! end
12513
12514 !! test
12515 Multiple tags in TOC
12516 !! input
12517 __TOC__
12518 == <i>Foo</i> <b>Bar</b> ==
12519
12520 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12521 !! result
12522 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12523 <ul>
12524 <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>
12525 <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>
12526 </ul>
12527 </td></tr></table>
12528 <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>
12529 <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>
12530
12531 !! end
12532
12533 !! test
12534 Tags with parameters in TOC
12535 !! input
12536 __TOC__
12537 == <sup class="in-h2">Hello</sup> ==
12538
12539 == <sup class="a > b">Evilbye</sup> ==
12540 !! result
12541 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12542 <ul>
12543 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12544 <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>
12545 </ul>
12546 </td></tr></table>
12547 <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>
12548 <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>
12549
12550 !! end
12551
12552 !! test
12553 span tags with directionality in TOC
12554 !! input
12555 __TOC__
12556 == <span dir="ltr">C++</span> ==
12557
12558 == <span dir="rtl">זבנג!</span> ==
12559
12560 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12561
12562 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12563
12564 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12565 !! result
12566 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12567 <ul>
12568 <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>
12569 <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>
12570 <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>
12571 <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>
12572 <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>
12573 </ul>
12574 </td></tr></table>
12575 <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>
12576 <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>
12577 <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>
12578 <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>
12579 <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>
12580
12581 !! end
12582
12583 !! article
12584 MediaWiki:Bug32057
12585 !! text
12586 == {{int:headline_sample}} ==
12587 !! endarticle
12588
12589 !! test
12590 Bug 32057: Title needed when expanding <h> nodes.
12591 !! options
12592 title=[[Main Page]]
12593 !! input
12594 {{int:Bug32057}}
12595 !! result
12596 <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>
12597
12598 !! end
12599
12600 !! test
12601 Strip marker in urlencode
12602 !! input
12603 {{urlencode:x<nowiki/>y}}
12604 {{urlencode:x<nowiki/>y|wiki}}
12605 {{urlencode:x<nowiki/>y|path}}
12606 !! result
12607 <p>xy
12608 xy
12609 xy
12610 </p>
12611 !! end
12612
12613 !! test
12614 Strip marker in lc
12615 !! input
12616 {{lc:x<nowiki/>y}}
12617 !! result
12618 <p>xy
12619 </p>
12620 !! end
12621
12622 !! test
12623 Strip marker in uc
12624 !! input
12625 {{uc:x<nowiki/>y}}
12626 !! result
12627 <p>XY
12628 </p>
12629 !! end
12630
12631 !! test
12632 Strip marker in formatNum
12633 !! input
12634 {{formatnum:1<nowiki/>2}}
12635 {{formatnum:1<nowiki/>2|R}}
12636 !! result
12637 <p>12
12638 12
12639 </p>
12640 !! end
12641
12642 !! test
12643 Check noCommafy in formatNum
12644 !! options
12645 language=be-tarask
12646 !! input
12647 {{formatnum:123456.78}}
12648 {{formatnum:123456.78|NOSEP}}
12649 !! result
12650 <p>123 456,78
12651 123456.78
12652 </p>
12653 !! end
12654
12655 !! test
12656 Strip marker in grammar
12657 !! options
12658 language=fi
12659 !! input
12660 {{grammar:elative|foo<nowiki/>bar}}
12661 !! result
12662 <p>foobarista
12663 </p>
12664 !! end
12665
12666 !! test
12667 Strip marker in padleft
12668 !! input
12669 {{padleft:|2|x<nowiki/>y}}
12670 !! result
12671 <p>xy
12672 </p>
12673 !! end
12674
12675 !! test
12676 Strip marker in padright
12677 !! input
12678 {{padright:|2|x<nowiki/>y}}
12679 !! result
12680 <p>xy
12681 </p>
12682 !! end
12683
12684 !! test
12685 Strip marker in anchorencode
12686 !! input
12687 {{anchorencode:x<nowiki/>y}}
12688 !! result
12689 <p>xy
12690 </p>
12691 !! end
12692
12693 !! test
12694 nowiki inside link inside heading (bug 18295)
12695 !! input
12696 ==[[foo|x<nowiki>y</nowiki>z]]==
12697 !! result
12698 <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>
12699
12700 !! end
12701
12702 !! test
12703 new support for bdi element (bug 31817)
12704 !! input
12705 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12706 !! result
12707 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12708
12709 !!end
12710
12711 !! test
12712 Ignore pipe between table row attributes
12713 !! input
12714 {|
12715 | quux
12716 |- id=foo | style='color: red'
12717 | bar
12718 |}
12719 !! result
12720 <table>
12721 <tr>
12722 <td> quux
12723 </td></tr>
12724 <tr id="foo" style="color: red">
12725 <td> bar
12726 </td></tr></table>
12727
12728 !! end
12729
12730 !!test
12731 Gallery override link with WikiLink (bug 34852)
12732 !! input
12733 <gallery>
12734 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12735 </gallery>
12736 !! result
12737 <ul class="gallery">
12738 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12739 <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>
12740 <div class="gallerytext">
12741 <p>caption
12742 </p>
12743 </div>
12744 </div></li>
12745 </ul>
12746
12747 !! end
12748
12749 !!test
12750 Gallery override link with absolute external link (bug 34852)
12751 !! input
12752 <gallery>
12753 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12754 </gallery>
12755 !! result
12756 <ul class="gallery">
12757 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12758 <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>
12759 <div class="gallerytext">
12760 <p>caption
12761 </p>
12762 </div>
12763 </div></li>
12764 </ul>
12765
12766 !! end
12767
12768 !!test
12769 Gallery override link with malicious javascript (bug 34852)
12770 !! input
12771 <gallery>
12772 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12773 </gallery>
12774 !! result
12775 <ul class="gallery">
12776 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12777 <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>
12778 <div class="gallerytext">
12779 <p>caption
12780 </p>
12781 </div>
12782 </div></li>
12783 </ul>
12784
12785 !! end
12786
12787 !!test
12788 Gallery with invalid title as link (bug 43964)
12789 !! input
12790 <gallery>
12791 File:foobar.jpg|link=<
12792 </gallery>
12793 !! result
12794 <ul class="gallery">
12795 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12796 <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>
12797 <div class="gallerytext">
12798 </div>
12799 </div></li>
12800 </ul>
12801
12802 !! end
12803
12804 !!test
12805 Language parser function
12806 !! input
12807 {{#language:ar}}
12808 !! result
12809 <p>العربية
12810 </p>
12811 !! end
12812
12813 !!test
12814 Padleft and padright as substr
12815 !! input
12816 {{padleft:|3|abcde}}
12817 {{padright:|3|abcde}}
12818 !! result
12819 <p>abc
12820 abc
12821 </p>
12822 !! end
12823
12824 !!test
12825 Bug 34939 - Case insensitive link parsing ([HttP://])
12826 !! input
12827 [HttP://MediaWiki.Org/]
12828 !! result
12829 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12830 </p>
12831 !! end
12832
12833 !!test
12834 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12835 !! input
12836 [HttP://MediaWiki.Org/ MediaWiki]
12837 !! result
12838 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
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 free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12848 </p>
12849 !! end
12850
12851 ###
12852 ### Parsoids-specific tests
12853 ### Parsoid-PHP parser incompatibilities
12854 ###
12855 !!test
12856 1. SOL-sensitive wikitext tokens as template-args
12857 !!options
12858 disabled
12859 !!input
12860 {{echo|*a}}
12861 {{echo|#a}}
12862 {{echo|:a}}
12863 !!result
12864 <p>*a
12865 #a
12866 :a
12867 </p>
12868 !!end
12869
12870 #### The following section of tests are primarily to test
12871 #### wikitext escaping capabilities of Parsoid.
12872 #### A lot of the tests are disabled for the PHP parser either
12873 #### because of minor newline diffs or other reasons.
12874 #### As Parsoid serializer can handle newlines and other HTML
12875 #### more robustly, some of these tests might get reenabled
12876 #### for the PHP parser.
12877
12878 #### --------------- Headings ---------------
12879 #### 0. Unnested
12880 #### 1. Nested inside html <h1>=foo=</h1>
12881 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12882 #### 3. Nested inside html with wikitext split by html tags
12883 #### 4. No escape needed
12884 #### 5. Empty headings <h1></h1>
12885 #### 6. Heading chars in SOL context
12886 #### ----------------------------------------
12887 !! test
12888 Headings: 0. Unnested
12889 !! input
12890 <nowiki>=foo=</nowiki>
12891
12892 <nowiki>=foo</nowiki>''a''=
12893 !! result
12894 <p>=foo=
12895 </p><p>=foo<i>a</i>=
12896 </p>
12897 !!end
12898
12899 !! test
12900 Headings: 1. Nested inside html
12901 !! options
12902 disabled
12903 !! input
12904 =<nowiki>=foo=</nowiki>=
12905 ==<nowiki>=foo=</nowiki>==
12906 ===<nowiki>=foo=</nowiki>===
12907 ====<nowiki>=foo=</nowiki>====
12908 =====<nowiki>=foo=</nowiki>=====
12909 ======<nowiki>=foo=</nowiki>======
12910 !! result
12911 <h1>=foo=</h1>
12912 <h2>=foo=</h2>
12913 <h3>=foo=</h3>
12914 <h4>=foo=</h4>
12915 <h5>=foo=</h5>
12916 <h6>=foo=</h6>
12917 !!end
12918
12919 !! test
12920 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12921 !! options
12922 disabled
12923 !! input
12924 =foo=
12925 <nowiki>*bar</nowiki>
12926 =foo=
12927 =bar
12928 =foo=
12929 <nowiki>=bar=</nowiki>
12930 !! result
12931 <h1>foo</h1>*bar
12932 <h1>foo</h1>=bar
12933 <h1>foo</h1>=bar=
12934 !!end
12935
12936 !! test
12937 Headings: 3. Nested inside html with wikitext split by html tags
12938 !! options
12939 disabled
12940 !! input
12941 =<nowiki>=</nowiki>'''bold'''foo==
12942 !! result
12943 <h1>=<b>bold</b>foo=</h1>
12944 !!end
12945
12946 !! test
12947 Headings: 4. No escaping needed (testing just h1 and h2)
12948 !! options
12949 disabled
12950 !! input
12951 ==foo=
12952 =foo==
12953 ===foo==
12954 ==foo===
12955 =''=''foo==
12956 ===
12957 !! result
12958 <h1>=foo</h1>
12959 <h1>foo=</h1>
12960 <h2>=foo</h2>
12961 <h2>foo=</h2>
12962 <h1><i>=</i>foo=</h1>
12963 <h1>=</h1>
12964 !!end
12965
12966 !! test
12967 Headings: 5. Empty headings
12968 !! options
12969 disabled
12970 !! input
12971 =<nowiki></nowiki>=
12972 ==<nowiki></nowiki>==
12973 ===<nowiki></nowiki>===
12974 ====<nowiki></nowiki>====
12975 =====<nowiki></nowiki>=====
12976 ======<nowiki></nowiki>======
12977 !! result
12978 <h1></h1>
12979 <h2></h2>
12980 <h3></h3>
12981 <h4></h4>
12982 <h5></h5>
12983 <h6></h6>
12984 !!end
12985
12986 !! test
12987 Headings: 6. Heading chars in SOL context
12988 !! options
12989 disabled
12990 !! input
12991 <!--cmt--><nowiki>=h1=</nowiki>
12992 !! result
12993 <p><!--cmt-->=h1=
12994 </p>
12995 !!end
12996
12997 #### --------------- Lists ---------------
12998 #### 0. Outside nests (*foo, etc.)
12999 #### 1. Nested inside html <ul><li>*foo</li></ul>
13000 #### 2. Inside definition lists
13001 #### 3. Only bullets at start should be escaped
13002 #### 4. No escapes needed
13003 #### 5. No unnecessary escapes
13004 #### 6. Escape bullets in SOL position
13005 #### 7. Escape bullets in a multi-line context
13006 #### ----------------------------------------
13007
13008 !! test
13009 Lists: 0. Outside nests
13010 !! input
13011 <nowiki>*foo</nowiki>
13012
13013 <nowiki>#foo</nowiki>
13014 !! result
13015 <p>*foo
13016 </p><p>#foo
13017 </p>
13018 !!end
13019
13020 !! test
13021 Lists: 1. Nested inside html
13022 !! input
13023 *<nowiki>*foo</nowiki>
13024
13025 *<nowiki>#foo</nowiki>
13026
13027 *<nowiki>:foo</nowiki>
13028
13029 *<nowiki>;foo</nowiki>
13030
13031 #<nowiki>*foo</nowiki>
13032
13033 #<nowiki>#foo</nowiki>
13034
13035 #<nowiki>:foo</nowiki>
13036
13037 #<nowiki>;foo</nowiki>
13038 !! result
13039 <ul><li>*foo
13040 </li></ul>
13041 <ul><li>#foo
13042 </li></ul>
13043 <ul><li>:foo
13044 </li></ul>
13045 <ul><li>;foo
13046 </li></ul>
13047 <ol><li>*foo
13048 </li></ol>
13049 <ol><li>#foo
13050 </li></ol>
13051 <ol><li>:foo
13052 </li></ol>
13053 <ol><li>;foo
13054 </li></ol>
13055
13056 !!end
13057
13058 !! test
13059 Lists: 2. Inside definition lists
13060 !! input
13061 ;<nowiki>;foo</nowiki>
13062
13063 ;<nowiki>:foo</nowiki>
13064
13065 ;<nowiki>:foo</nowiki>
13066 :bar
13067
13068 :<nowiki>:foo</nowiki>
13069 !! result
13070 <dl><dt>;foo
13071 </dt></dl>
13072 <dl><dt>:foo
13073 </dt></dl>
13074 <dl><dt>:foo
13075 </dt><dd>bar
13076 </dd></dl>
13077 <dl><dd>:foo
13078 </dd></dl>
13079
13080 !!end
13081
13082 !! test
13083 Lists: 3. Only bullets at start of text should be escaped
13084 !! input
13085 *<nowiki>*foo*bar</nowiki>
13086
13087 *<nowiki>*foo</nowiki>''it''*bar
13088 !! result
13089 <ul><li>*foo*bar
13090 </li></ul>
13091 <ul><li>*foo<i>it</i>*bar
13092 </li></ul>
13093
13094 !!end
13095
13096 !! test
13097 Lists: 4. No escapes needed
13098 !! options
13099 disabled
13100 !! input
13101 *foo*bar
13102
13103 *''foo''*bar
13104
13105 *[[Foo]]: bar
13106 !! result
13107 <ul><li>foo*bar
13108 </li></ul>
13109 <ul><li><i>foo</i>*bar
13110 </li></ul>
13111 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13112 </li></ul>
13113 !!end
13114
13115 !! test
13116 Lists: 5. No unnecessary escapes
13117 !! input
13118 * bar <span><nowiki>[[foo]]</nowiki></span>
13119
13120 *=bar <span><nowiki>[[foo]]</nowiki></span>
13121
13122 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13123
13124 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13125
13126 *=bar <span>foo]]</span>=
13127 !! result
13128 <ul><li> bar <span>[[foo]]</span>
13129 </li></ul>
13130 <ul><li>=bar <span>[[foo]]</span>
13131 </li></ul>
13132 <ul><li>[[bar <span>[[foo]]</span>
13133 </li></ul>
13134 <ul><li>]]bar <span>[[foo]]</span>
13135 </li></ul>
13136 <ul><li>=bar <span>foo]]</span>=
13137 </li></ul>
13138
13139 !!end
13140
13141 !! test
13142 Lists: 6. Escape bullets in SOL position
13143 !! options
13144 disabled
13145 !! input
13146 <!--cmt--><nowiki>*foo</nowiki>
13147 !! result
13148 <p><!--cmt-->*foo
13149 </p>
13150 !!end
13151
13152 !! test
13153 Lists: 7. Escape bullets in a multi-line context
13154 !! input
13155 <nowiki>a
13156 *b</nowiki>
13157 !! result
13158 <p>a
13159 *b
13160 </p>
13161 !!end
13162
13163 #### --------------- HRs ---------------
13164 #### 1. Single line
13165 #### -----------------------------------
13166
13167 !! test
13168 HRs: 1. Single line
13169 !! options
13170 disabled
13171 !! input
13172 ----
13173 <nowiki>----</nowiki>
13174 ----
13175 <nowiki>=foo=</nowiki>
13176 ----
13177 <nowiki>*foo</nowiki>
13178 !! result
13179 <hr/>----
13180 <hr/>=foo=
13181 <hr/>*foo
13182 !! end
13183
13184 #### --------------- Tables ---------------
13185 #### 1a. Simple example
13186 #### 1b. No escaping needed (!foo)
13187 #### 1c. No escaping needed (|foo)
13188 #### 1d. No escaping needed (|}foo)
13189 ####
13190 #### 2a. Nested in td (<td>foo|bar</td>)
13191 #### 2b. Nested in td (<td>foo||bar</td>)
13192 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13193 ####
13194 #### 3a. Nested in th (<th>foo!bar</th>)
13195 #### 3b. Nested in th (<th>foo!!bar</th>)
13196 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13197 ####
13198 #### 4a. Escape -
13199 #### 4b. Escape +
13200 #### 4c. No escaping needed
13201 #### --------------------------------------
13202
13203 !! test
13204 Tables: 1a. Simple example
13205 !! input
13206 <nowiki>{|
13207 |}</nowiki>
13208 !! result
13209 <p>{|
13210 |}
13211 </p>
13212 !! end
13213
13214 !! test
13215 Tables: 1b. No escaping needed
13216 !! input
13217 !foo
13218 !! result
13219 <p>!foo
13220 </p>
13221 !! end
13222
13223 !! test
13224 Tables: 1c. No escaping needed
13225 !! input
13226 |foo
13227 !! result
13228 <p>|foo
13229 </p>
13230 !! end
13231
13232 !! test
13233 Tables: 1d. No escaping needed
13234 !! input
13235 |}foo
13236 !! result
13237 <p>|}foo
13238 </p>
13239 !! end
13240
13241 !! test
13242 Tables: 2a. Nested in td
13243 !! options
13244 disabled
13245 !! input
13246 {|
13247 |<nowiki>foo|bar</nowiki>
13248 |}
13249 !! result
13250 <table>
13251 <tr><td>foo|bar
13252 </td></tr></table>
13253
13254 !! end
13255
13256 !! test
13257 Tables: 2b. Nested in td
13258 !! options
13259 disabled
13260 !! input
13261 {|
13262 |<nowiki>foo||bar</nowiki>
13263 |''it''<nowiki>foo||bar</nowiki>
13264 |}
13265 !! result
13266 <table>
13267 <tr><td>foo||bar
13268 </td><td><i>it</i>foo||bar
13269 </td></tr></table>
13270
13271 !! end
13272
13273 !! test
13274 Tables: 2c. Nested in td -- no escaping needed
13275 !! options
13276 disabled
13277 !! input
13278 {|
13279 |foo!!bar
13280 |}
13281 !! result
13282 <table>
13283 <tr><td>foo!!bar
13284 </td></tr></table>
13285
13286 !! end
13287
13288 !! test
13289 Tables: 3a. Nested in th
13290 !! options
13291 disabled
13292 !! input
13293 {|
13294 !foo!bar
13295 |}
13296 !! result
13297 <table>
13298 <tr><th>foo!bar
13299 </th></tr></table>
13300
13301 !! end
13302
13303 !! test
13304 Tables: 3b. Nested in th
13305 !! options
13306 disabled
13307 !! input
13308 {|
13309 !<nowiki>foo!!bar</nowiki>
13310 |}
13311 !! result
13312 <table>
13313 <tr><th>foo!!bar
13314 </th></tr></table>
13315
13316 !! end
13317
13318 !! test
13319 Tables: 3c. Nested in th -- no escaping needed
13320 !! options
13321 disabled
13322 !! input
13323 {|
13324 !foo||bar
13325 |}
13326 !! result
13327 <table>
13328 <tr><th>foo||bar
13329 </th></tr></table>
13330
13331 !! end
13332
13333 !! test
13334 Tables: 4a. Escape -
13335 !! options
13336 disabled
13337 !! input
13338 {|
13339 |-
13340 !-bar
13341 |-
13342 |<nowiki>-bar</nowiki>
13343 |}
13344 !! result
13345 <table><tbody>
13346 <tr><th>-bar</th></tr>
13347 <tr><td>-bar</td></tr>
13348 </tbody></table>
13349 !! end
13350
13351 !! test
13352 Tables: 4b. 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: 4c. No escaping needed
13371 !! options
13372 disabled
13373 !! input
13374 {|
13375 |-
13376 |foo-bar
13377 |foo+bar
13378 |-
13379 |''foo''-bar
13380 |''foo''+bar
13381 |}
13382 !! result
13383 <table><tbody>
13384 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13385 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13386 </tbody></table>
13387 !! end
13388
13389 !! test
13390 Tables: 4d. No escaping needed
13391 !! input
13392 {|
13393 ||+1
13394 ||-2
13395 |}
13396 !! result
13397 <table>
13398 <tr>
13399 <td>+1
13400 </td>
13401 <td>-2
13402 </td></tr></table>
13403
13404 !! end
13405
13406 #### --------------- Links ---------------
13407 #### 1. Quote marks in link text
13408 #### 2. Wikilinks: Escapes needed
13409 #### 3. Wikilinks: No escapes needed
13410 #### 4. Extlinks: Escapes needed
13411 #### 5. Extlinks: No escapes needed
13412 #### --------------------------------------
13413 !! test
13414 Links 1. Quote marks in link text
13415 !! options
13416 disabled
13417 !! input
13418 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13419 !! result
13420 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13421 !! end
13422
13423 !! test
13424 Links 2. WikiLinks: Escapes needed
13425 !! options
13426 disabled
13427 !! input
13428 [[Foo|<nowiki>[Foobar]</nowiki>]]
13429 [[Foo|<nowiki>Foobar]</nowiki>]]
13430 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13431 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13432 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13433 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13434 [[Foo|<nowiki>|Bar</nowiki>]]
13435 !! result
13436 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13437 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13438 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13439 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13440 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13441 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13442 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13443 !! end
13444
13445 !! test
13446 Links 3. WikiLinks: No escapes needed
13447 !! options
13448 disabled
13449 !! input
13450 [[Foo|[Foobar]]
13451 [[Foo|foo|bar]]
13452 !! result
13453 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13454 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13455 !! end
13456
13457 !! test
13458 Links 4. ExtLinks: Escapes needed
13459 !! options
13460 disabled
13461 !! input
13462 [http://google.com <nowiki>[google]</nowiki>]
13463 [http://google.com <nowiki>google]</nowiki>]
13464 !! result
13465 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13466 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13467 !! end
13468
13469 !! test
13470 Links 5. ExtLinks: No escapes needed
13471 !! options
13472 disabled
13473 !! input
13474 [http://google.com [google]
13475 !! result
13476 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13477 !! end
13478
13479 #### --------------- Quotes ---------------
13480 #### 1. Quotes inside <b> and <i>
13481 #### 2. Link fragments separated by <i> and <b> tags
13482 #### 3. Link fragments inside <i> and <b>
13483 #### --------------------------------------
13484 !! test
13485 1. Quotes inside <b> and <i>
13486 !! input
13487 ''<nowiki>'foo'</nowiki>''
13488 ''<nowiki>''foo''</nowiki>''
13489 ''<nowiki>'''foo'''</nowiki>''
13490 '''<nowiki>'foo'</nowiki>'''
13491 '''<nowiki>''foo''</nowiki>'''
13492 '''<nowiki>'''foo'''</nowiki>'''
13493 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13494 !! result
13495 <p><i>'foo'</i>
13496 <i>''foo''</i>
13497 <i>'''foo'''</i>
13498 <b>'foo'</b>
13499 <b>''foo''</b>
13500 <b>'''foo'''</b>
13501 <b>foo'<i>bar'</i>baz</b>
13502 </p>
13503 !! end
13504
13505 !! test
13506 2. Link fragments separated by <i> and <b> tags
13507 !! input
13508 [[''foo''<nowiki>hello]]</nowiki>
13509
13510 [['''foo'''<nowiki>hello]]</nowiki>
13511 !! result
13512 <p>[[<i>foo</i>hello]]
13513 </p><p>[[<b>foo</b>hello]]
13514 </p>
13515 !! end
13516
13517 !! test
13518 2. Link fragments inside <i> and <b>
13519 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13520 this is one of the shortcomings of this format)
13521 !! input
13522 ''[[foo''<nowiki>]]</nowiki>
13523
13524 '''[[foo'''<nowiki>]]</nowiki>
13525 !! result
13526 <p><i>[[foo</i>]]
13527 </p><p><b>[[foo</b>]]
13528 </p>
13529 !! end
13530
13531 #### --------------- Paragraphs ---------------
13532 #### 1. No unnecessary escapes
13533 #### --------------------------------------
13534
13535 !! test
13536 1. No unnecessary escapes
13537 !! input
13538 bar <span><nowiki>[[foo]]</nowiki></span>
13539
13540 =bar <span><nowiki>[[foo]]</nowiki></span>
13541
13542 [[bar <span><nowiki>[[foo]]</nowiki></span>
13543
13544 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13545
13546 <nowiki>=bar </nowiki><span>foo]]</span>=
13547 !! result
13548 <p>bar <span>[[foo]]</span>
13549 </p><p>=bar <span>[[foo]]</span>
13550 </p><p>[[bar <span>[[foo]]</span>
13551 </p><p>]]bar <span>[[foo]]</span>
13552 </p><p>=bar <span>foo]]</span>=
13553 </p>
13554 !!end
13555
13556 #### --------------- PRE ------------------
13557 #### 1. Leading space in SOL context should be escaped
13558 #### --------------------------------------
13559 !! test
13560 1. Leading space in SOL context should be escaped
13561 !! options
13562 disabled
13563 !! input
13564 <nowiki> foo</nowiki>
13565 <!--cmt--><nowiki> foo</nowiki>
13566 !! result
13567 <p> foo
13568 <!--cmt--> foo
13569 </p>
13570 !! end
13571
13572 #### --------------- HTML tags ---------------
13573 #### 1. a tags
13574 #### 2. other tags
13575 #### 3. multi-line html tag
13576 #### --------------------------------------
13577 !! test
13578 1. a tags
13579 !! options
13580 disabled
13581 !! input
13582 <a href="http://google.com">google</a>
13583 !! result
13584 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13585 !! end
13586
13587 !! test
13588 2. other tags
13589 !! input
13590 <nowiki><div>foo</div>
13591 <div style="color:red">foo</div></nowiki>
13592 !! result
13593 <p>&lt;div&gt;foo&lt;/div&gt;
13594 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13595 </p>
13596 !! end
13597
13598 !! test
13599 3. multi-line html tag
13600 !! input
13601 <nowiki><div
13602 >foo</div
13603 ></nowiki>
13604 !! result
13605 <p>&lt;div
13606 &gt;foo&lt;/div
13607 &gt;
13608 </p>
13609 !! end
13610
13611 #### --------------- Others ---------------
13612 !! test
13613 Escaping nowikis
13614 !! input
13615 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13616 !! result
13617 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13618 </p>
13619 !! end
13620
13621 !! test
13622 Tag-like HTML structures are passed through as text
13623 !! input
13624 <x y>
13625
13626 <x.y>
13627
13628 <x-y>
13629
13630 1>2
13631
13632 x<y
13633
13634 a>b
13635
13636 1<d e>f
13637 !! result
13638 <p>&lt;x y&gt;
13639 </p><p>&lt;x.y&gt;
13640 </p><p>&lt;x-y&gt;
13641 </p><p>1&gt;2
13642 </p><p>x&lt;y
13643 </p><p>a&gt;b
13644 </p><p>1&lt;d e&gt;f
13645 </p>
13646 !! end
13647
13648
13649 # This fails in the PHP parser (see bug 40670,
13650 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13651 !! test
13652 Tag names followed by punctuation should not be recognized as tags
13653 !! options
13654 disabled
13655 !! input
13656 <s.ome> text
13657 !! result
13658 <p>&lt;s.ome&gt text
13659 </p>
13660 !! end
13661
13662 !! test
13663 HTML tag with necessary entities in attributes
13664 !! input
13665 <span title="&amp;amp;">foo</span>
13666 !! result
13667 <p><span title="&amp;amp;">foo</span>
13668 </p>
13669 !! end
13670
13671 !! test
13672 HTML tag with 'unnecessary' entity encoding in attributes
13673 !! input
13674 <span title="&amp;">foo</span>
13675 !! result
13676 <p><span title="&amp;">foo</span>
13677 </p>
13678 !! end
13679
13680 !! test
13681 HTML tag with broken attribute value quoting
13682 !! input
13683 <span title="Hello world>Foo</span>
13684 !! result
13685 <p><span>Foo</span>
13686 </p>
13687 !! end
13688
13689 !! test
13690 Parsoid-only: HTML tag with broken attribute value quoting
13691 !! options
13692 parsoid
13693 !! input
13694 <span title="Hello world>Foo</span>
13695 !! result
13696 <p><span title="Hello world">Foo</span>
13697 </p>
13698 !! end
13699
13700 !! test
13701 Table with broken attribute value quoting
13702 !! input
13703 {|
13704 | title="Hello world|Foo
13705 |}
13706 !! result
13707 <table>
13708 <tr>
13709 <td>Foo
13710 </td></tr></table>
13711
13712 !! end
13713
13714 !! test
13715 Table with broken attribute value quoting on consecutive lines
13716 !! input
13717 {|
13718 | title="Hello world|Foo
13719 | style="color:red|Bar
13720 |}
13721 !! result
13722 <table>
13723 <tr>
13724 <td>Foo
13725 </td>
13726 <td>Bar
13727 </td></tr></table>
13728
13729 !! end
13730
13731 !! test
13732 Parsoid-only: Table with broken attribute value quoting on consecutive lines
13733 !! options
13734 parsoid
13735 !! input
13736 {|
13737 | title="Hello world|Foo
13738 | style="color:red|Bar
13739 |}
13740 !! result
13741 <table>
13742 <tr>
13743 <td title="Hello world">Foo
13744 </td><td style="color: red">Bar
13745 </td></tr></table>
13746
13747 !! end
13748
13749 !!test
13750 Accept empty td cell attribute
13751 !!input
13752 {|
13753 | align="center" | foo || |
13754 |}
13755 !!result
13756 <table>
13757 <tr>
13758 <td align="center"> foo </td>
13759 <td>
13760 </td></tr></table>
13761
13762 !!end
13763
13764 !!test
13765 Non-empty attributes in th-cells
13766 !!input
13767 {|
13768 ! Foo !! style="color: red" | Bar
13769 |}
13770 !!result
13771 <table>
13772 <tr>
13773 <th> Foo </th>
13774 <th style="color: red"> Bar
13775 </th></tr></table>
13776
13777 !!end
13778
13779 !!test
13780 Accept empty attributes in th-cells
13781 !!input
13782 {|
13783 !| foo !!| bar
13784 |}
13785 !!result
13786 <table>
13787 <tr>
13788 <th> foo </th>
13789 <th> bar
13790 </th></tr></table>
13791
13792 !!end
13793
13794 !!test
13795 Empty table rows go away
13796 !!input
13797 {|
13798 | Hello
13799 | there
13800 |- class="foo"
13801 |-
13802 |}
13803 !! result
13804 <table>
13805 <tr>
13806 <td> Hello
13807 </td>
13808 <td> there
13809 </td></tr>
13810
13811 </table>
13812
13813 !! end
13814
13815 TODO:
13816 more images
13817 more tables
13818 character entities
13819 and much more
13820 Try for 100% code coverage