Merge "Some additional test cases for Parsoid."
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # showtitle make the first line the title
25 # comment run through Linker::formatComment() instead of main parser
26 # local format section links in edit comment text as local links
27 #
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
31
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
38
39 !!article
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
44
45 !! article
46 Template:Blank
47 !! text
48 !! endarticle
49
50 !! article
51 Template:pipe
52 !! text
53 |
54 !! endarticle
55
56 !!article
57 MediaWiki:bad image list
58 !!text
59 * [[File:Bad.jpg]] except [[Nasty page]]
60 !!endarticle
61
62 !! article
63 Template:inner list
64 !! text
65 * item 1
66 !! endarticle
67
68 !! article
69 Template:tbl-start
70 !! text
71 {|
72 !! endarticle
73
74 !! article
75 Template:tbl-end
76 !! text
77 |}
78 !! endarticle
79
80 !! article
81 Template:!
82 !! text
83 |
84 !! endarticle
85
86 !! article
87 Template:echo
88 !! text
89 {{{1}}}
90 !! endarticle
91
92 !! article
93 Template:echo_with_span
94 !! text
95 <span>{{{1}}}</span>
96 !! endarticle
97
98 !! article
99 Template:echo_with_div
100 !! text
101 <div>{{{1}}}</div>
102 !! endarticle
103
104 !! article
105 Template:attr_str
106 !! text
107 {{{1}}}="{{{2}}}"
108 !! endarticle
109
110 !! article
111 Template:table_attribs
112 !! text
113 <noinclude>
114 |</noinclude>style="color: red"| Foo
115 !! endarticle
116
117 !! article
118 A?b
119 !! text
120 Weirdo titles!
121 !! endarticle
122
123 ###
124 ### Basic tests
125 ###
126 !! test
127 Blank input
128 !! input
129 !! result
130 !! end
131
132
133 !! test
134 Simple paragraph
135 !! input
136 This is a simple paragraph.
137 !! result
138 <p>This is a simple paragraph.
139 </p>
140 !! end
141
142 !! test
143 Paragraphs with extra newline spacing
144 !! input
145 foo
146
147 bar
148
149
150 baz
151
152
153
154 booz
155 !! result
156 <p>foo
157 </p><p>bar
158 </p><p><br />
159 baz
160 </p><p><br />
161 </p><p>booz
162 </p>
163 !! end
164
165 !! test
166 Parsing an URL
167 !! input
168 http://fr.wikipedia.org/wiki/🍺
169 <!-- EasterEgg we love beer, better be able be able to link to it -->
170 !! result
171 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
172 </p>
173 !! end
174
175 !! test
176 Simple list
177 !! input
178 * Item 1
179 * Item 2
180 !! result
181 <ul><li> Item 1
182 </li><li> Item 2
183 </li></ul>
184
185 !! end
186
187 !! test
188 Italics and bold
189 !! input
190 * plain
191 * plain''italic''plain
192 * plain''italic''plain''italic''plain
193 * plain'''bold'''plain
194 * plain'''bold'''plain'''bold'''plain
195 * plain''italic''plain'''bold'''plain
196 * plain'''bold'''plain''italic''plain
197 * plain''italic'''bold-italic'''italic''plain
198 * plain'''bold''bold-italic''bold'''plain
199 * plain'''''bold-italic'''italic''plain
200 * plain'''''bold-italic''bold'''plain
201 * plain''italic'''bold-italic'''''plain
202 * plain'''bold''bold-italic'''''plain
203 * plain l'''italic''plain
204 * plain l''''bold''' plain
205 !! result
206 <ul><li> plain
207 </li><li> plain<i>italic</i>plain
208 </li><li> plain<i>italic</i>plain<i>italic</i>plain
209 </li><li> plain<b>bold</b>plain
210 </li><li> plain<b>bold</b>plain<b>bold</b>plain
211 </li><li> plain<i>italic</i>plain<b>bold</b>plain
212 </li><li> plain<b>bold</b>plain<i>italic</i>plain
213 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
214 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
215 </li><li> plain<i><b>bold-italic</b>italic</i>plain
216 </li><li> plain<b><i>bold-italic</i>bold</b>plain
217 </li><li> plain<i>italic<b>bold-italic</b></i>plain
218 </li><li> plain<b>bold<i>bold-italic</i></b>plain
219 </li><li> plain l'<i>italic</i>plain
220 </li><li> plain l'<b>bold</b> plain
221 </li></ul>
222
223 !! end
224
225 ###
226 ### 2-quote opening sequence tests
227 ###
228 !! test
229 Italics and bold: 2-quote opening sequence: (2,2)
230 !! input
231 ''foo''
232 !! result
233 <p><i>foo</i>
234 </p>
235 !!end
236
237
238 !! test
239 Italics and bold: 2-quote opening sequence: (2,3)
240 !! input
241 ''foo'''
242 !! result
243 <p><i>foo'</i>
244 </p>
245 !!end
246
247
248 !! test
249 Italics and bold: 2-quote opening sequence: (2,4)
250 !! input
251 ''foo''''
252 !! result
253 <p><i>foo''</i>
254 </p>
255 !!end
256
257
258 !! test
259 Italics and bold: 2-quote opening sequence: (2,5)
260 !! input
261 ''foo'''''
262 !! result
263 <p><i>foo</i>
264 </p>
265 !!end
266
267
268 ###
269 ### 3-quote opening sequence tests
270 ###
271
272 !! test
273 Italics and bold: 3-quote opening sequence: (3,2)
274 !! input
275 '''foo''
276 !! result
277 <p>'<i>foo</i>
278 </p>
279 !!end
280
281
282 !! test
283 Italics and bold: 3-quote opening sequence: (3,3)
284 !! input
285 '''foo'''
286 !! result
287 <p><b>foo</b>
288 </p>
289 !!end
290
291
292 !! test
293 Italics and bold: 3-quote opening sequence: (3,4)
294 !! input
295 '''foo''''
296 !! result
297 <p><b>foo'</b>
298 </p>
299 !!end
300
301
302 !! test
303 Italics and bold: 3-quote opening sequence: (3,5)
304 !! input
305 '''foo'''''
306 !! result
307 <p><b>foo</b>
308 </p>
309 !!end
310
311
312 ###
313 ### 4-quote opening sequence tests
314 ###
315
316 !! test
317 Italics and bold: 4-quote opening sequence: (4,2)
318 !! input
319 ''''foo''
320 !! result
321 <p>''<i>foo</i>
322 </p>
323 !!end
324
325
326 !! test
327 Italics and bold: 4-quote opening sequence: (4,3)
328 !! input
329 ''''foo'''
330 !! result
331 <p>'<b>foo</b>
332 </p>
333 !!end
334
335
336 !! test
337 Italics and bold: 4-quote opening sequence: (4,4)
338 !! input
339 ''''foo''''
340 !! result
341 <p>'<b>foo'</b>
342 </p>
343 !!end
344
345
346 !! test
347 Italics and bold: 4-quote opening sequence: (4,5)
348 !! input
349 ''''foo'''''
350 !! result
351 <p>'<b>foo</b>
352 </p>
353 !!end
354
355
356 ###
357 ### 5-quote opening sequence tests
358 ###
359
360 !! test
361 Italics and bold: 5-quote opening sequence: (5,2)
362 !! input
363 '''''foo''
364 !! result
365 <p><b><i>foo</i></b>
366 </p>
367 !!end
368
369
370 !! test
371 Italics and bold: 5-quote opening sequence: (5,3)
372 !! input
373 '''''foo'''
374 !! result
375 <p><i><b>foo</b></i>
376 </p>
377 !!end
378
379
380 !! test
381 Italics and bold: 5-quote opening sequence: (5,4)
382 !! input
383 '''''foo''''
384 !! result
385 <p><i><b>foo'</b></i>
386 </p>
387 !!end
388
389
390 !! test
391 Italics and bold: 5-quote opening sequence: (5,5)
392 !! input
393 '''''foo'''''
394 !! result
395 <p><i><b>foo</b></i>
396 </p>
397 !!end
398
399 ###
400 ### multiple quote sequences in a line
401 ###
402 !! test
403 Italics and bold: multiple quote sequences: (2,4,2)
404 !! input
405 ''foo''''bar''
406 !! result
407 <p><i>foo'<b>bar</b></i>
408 </p>
409 !!end
410
411
412 !! test
413 Italics and bold: multiple quote sequences: (2,4,3)
414 !! input
415 ''foo''''bar'''
416 !! result
417 <p><i>foo'<b>bar</b></i>
418 </p>
419 !!end
420
421
422 !! test
423 Italics and bold: multiple quote sequences: (2,4,4)
424 !! input
425 ''foo''''bar''''
426 !! result
427 <p><i>foo'<b>bar'</b></i>
428 </p>
429 !!end
430
431
432 !! test
433 Italics and bold: multiple quote sequences: (3,4,2)
434 !! input
435 '''foo''''bar''
436 !! result
437 <p><b>foo'</b>bar
438 </p>
439 !!end
440
441
442 !! test
443 Italics and bold: multiple quote sequences: (3,4,3)
444 !! input
445 '''foo''''bar'''
446 !! result
447 <p><b>foo'</b>bar
448 </p>
449 !!end
450
451 ###
452 ### other quote tests
453 ###
454 !! test
455 Italics and bold: other quote tests: (2,3,5)
456 !! input
457 ''this is about '''foo's family'''''
458 !! result
459 <p><i>this is about <b>foo's family</b></i>
460 </p>
461 !!end
462
463
464 !! test
465 Italics and bold: other quote tests: (2,(3,3),2)
466 !! input
467 ''this is about '''foo's''' family''
468 !! result
469 <p><i>this is about <b>foo's</b> family</i>
470 </p>
471 !!end
472
473
474 !! test
475 Italics and bold: other quote tests: (3,2,3,2)
476 !! input
477 '''this is about ''foo'''s family''
478 !! result
479 <p><b>this is about <i>foo</i></b><i>s family</i>
480 </p>
481 !!end
482
483
484 !! test
485 Italics and bold: other quote tests: (3,2,3,3)
486 !! input
487 '''this is about ''foo'''s family'''
488 !! result
489 <p>'<i>this is about </i>foo<b>s family</b>
490 </p>
491 !!end
492
493
494 !! test
495 Italics and bold: other quote tests: (3,(2,2),3)
496 !! input
497 '''this is about ''foo's'' family'''
498 !! result
499 <p><b>this is about <i>foo's</i> family</b>
500 </p>
501 !!end
502
503
504 !! test
505 Italicized possessive
506 !! input
507 The ''[[Main Page]]'''s talk page.
508 !! result
509 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
510 </p>
511 !! end
512
513 ###
514 ### <nowiki> test cases
515 ###
516
517 !! test
518 <nowiki> unordered list
519 !! input
520 <nowiki>* This is not an unordered list item.</nowiki>
521 !! result
522 <p>* This is not an unordered list item.
523 </p>
524 !! end
525
526 !! test
527 <nowiki> spacing
528 !! input
529 <nowiki>Lorem ipsum dolor
530
531 sed abit.
532 sed nullum.
533
534 :and a colon
535 </nowiki>
536 !! result
537 <p>Lorem ipsum dolor
538
539 sed abit.
540 sed nullum.
541
542 :and a colon
543
544 </p>
545 !! end
546
547 !! test
548 nowiki 3
549 !! input
550 :There is not nowiki.
551 :There is <nowiki>nowiki</nowiki>.
552
553 #There is not nowiki.
554 #There is <nowiki>nowiki</nowiki>.
555
556 *There is not nowiki.
557 *There is <nowiki>nowiki</nowiki>.
558 !! result
559 <dl><dd>There is not nowiki.
560 </dd><dd>There is nowiki.
561 </dd></dl>
562 <ol><li>There is not nowiki.
563 </li><li>There is nowiki.
564 </li></ol>
565 <ul><li>There is not nowiki.
566 </li><li>There is nowiki.
567 </li></ul>
568
569 !! end
570
571 !! test
572 Entities inside <nowiki>
573 !! input
574 <nowiki>&lt;</nowiki>
575 !! result
576 <p>&lt;
577 </p>
578 !! end
579
580
581 ###
582 ### Comments
583 ###
584 !! test
585 Comments and Indent-Pre
586 !! input
587 <!-- comment 1 --> asdf
588
589 <!-- comment 1 --> asdf
590 <!-- comment 2 -->
591
592 <!-- comment 1 --> asdf
593 <!-- comment 2 -->xyz
594
595 <!-- comment 1 --> asdf
596 <!-- comment 2 --> xyz
597 !! result
598 <pre>asdf
599 </pre>
600 <pre>asdf
601 </pre>
602 <pre>asdf
603 </pre>
604 <p>xyz
605 </p>
606 <pre>asdf
607 xyz
608 </pre>
609 !! end
610
611 !! test
612 Comment test 2a
613 !! input
614 asdf
615 <!-- comment 1 -->
616 jkl
617 !! result
618 <p>asdf
619 jkl
620 </p>
621 !! end
622
623 !! test
624 Comment test 2b
625 !! input
626 asdf
627 <!-- comment 1 -->
628
629 jkl
630 !! result
631 <p>asdf
632 </p><p>jkl
633 </p>
634 !! end
635
636 !! test
637 Comment test 3
638 !! input
639 asdf
640 <!-- comment 1 -->
641 <!-- comment 2 -->
642 jkl
643 !! result
644 <p>asdf
645 jkl
646 </p>
647 !! end
648
649 !! test
650 Comment test 4
651 !! input
652 asdf<!-- comment 1 -->jkl
653 !! result
654 <p>asdfjkl
655 </p>
656 !! end
657
658 !! test
659 Comment spacing
660 !! input
661 a
662 <!-- foo --> b <!-- bar -->
663 c
664 !! result
665 <p>a
666 </p>
667 <pre> b
668 </pre>
669 <p>c
670 </p>
671 !! end
672
673 !! test
674 Comment whitespace
675 !! input
676 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
677 !! result
678
679 !! end
680
681 !! test
682 Comment semantics and delimiters
683 !! input
684 <!-- --><!----><!-----><!------>
685 !! result
686
687 !! end
688
689 !! test
690 Comment semantics and delimiters, redux
691 !! input
692 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
693 -- foo -- funky huh? ... -->
694 !! result
695
696 !! end
697
698 !! test
699 Comment semantics and delimiters: directors cut
700 !! input
701 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
702 everything starting with < followed by !-- until the first -- and > we see,
703 that wouldn't be valid XML however, since in XML -- has to terminate a comment
704 -->-->
705 !! result
706 <p>--&gt;
707 </p>
708 !! end
709
710 !! test
711 Comment semantics: nesting
712 !! input
713 <!--<!-- no, we're not going to do anything fancy here -->-->
714 !! result
715 <p>--&gt;
716 </p>
717 !! end
718
719 !! test
720 Comment semantics: unclosed comment at end
721 !! input
722 <!--This comment will run out to the end of the document
723 !! result
724
725 !! end
726
727 !! test
728 Comment in template title
729 !! input
730 {{f<!---->oo}}
731 !! result
732 <p>FOO
733 </p>
734 !! end
735
736 !! test
737 Comment on its own line post-expand
738 !! input
739 a
740 {{blank}}<!---->
741 b
742 !! result
743 <p>a
744 </p><p>b
745 </p>
746 !! end
747
748 !! test
749 Comment on its own line post-expand with non-significant whitespace
750 !! input
751 a
752 {{blank}} <!---->
753 b
754 !! result
755 <p>a
756 </p><p>b
757 </p>
758 !! end
759
760 ###
761 ### paragraph wraping tests
762 ###
763 !! test
764 No block tags
765 !! input
766 a
767
768 b
769 !! result
770 <p>a
771 </p><p>b
772 </p>
773 !! end
774 !! test
775 Block tag on one line
776 !! input
777 a <div>foo</div>
778
779 b
780 !! result
781 a <div>foo</div>
782 <p>b
783 </p>
784 !! end
785
786 !! test
787 Block tag on both lines
788 !! input
789 a <div>foo</div>
790
791 b <div>foo</div>
792 !! result
793 a <div>foo</div>
794 b <div>foo</div>
795
796 !! end
797
798 !! test
799 Multiple lines without block tags
800 !! input
801 <div>foo</div> a
802 b
803 c
804 d<!--foo--> e
805 x <div>foo</div> z
806 !! result
807 <div>foo</div> a
808 <p>b
809 c
810 d e
811 </p>
812 x <div>foo</div> z
813
814 !! end
815
816 !! test
817 Empty lines between block tags to test open p-tags are closed between the block tags
818 !! input
819 <div></div>
820
821
822 <div></div>a
823
824 b
825 !! result
826 <div></div>
827 <p><br />
828 </p>
829 <div></div>a
830 <p>b
831 </p>
832 !! end
833
834 ###
835 ### Preformatted text
836 ###
837 !! test
838 Preformatted text
839 !! input
840 This is some
841 Preformatted text
842 With ''italic''
843 And '''bold'''
844 And a [[Main Page|link]]
845 !! result
846 <pre>This is some
847 Preformatted text
848 With <i>italic</i>
849 And <b>bold</b>
850 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
851 </pre>
852 !! end
853
854 !! test
855 Ident preformatting with inline content
856 !! input
857 a
858 ''b''
859 !! result
860 <pre>a
861 <i>b</i>
862 </pre>
863 !! end
864
865 !! test
866 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
867 !! input
868 <pre><nowiki>
869 <b>
870 <cite>
871 <em>
872 </nowiki></pre>
873 !! result
874 <pre>
875 &lt;b&gt;
876 &lt;cite&gt;
877 &lt;em&gt;
878 </pre>
879
880 !! end
881
882 !! test
883 Regression with preformatted in <center>
884 !! input
885 <center>
886 Blah
887 </center>
888 !! result
889 <center>
890 <pre>Blah
891 </pre>
892 </center>
893
894 !! end
895
896 # Expected output in the following test is not really expected (there should be
897 # <pre> in the output) -- it's only testing for well-formedness.
898 !! test
899 Bug 6200: Preformatted in <blockquote>
900 !! input
901 <blockquote>
902 Blah
903 </blockquote>
904 !! result
905 <blockquote>
906 Blah
907 </blockquote>
908
909 !! end
910
911 !! test
912 <pre> with attributes (bug 3202)
913 !! input
914 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
915 !! result
916 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
917
918 !! end
919
920 !! test
921 <pre> with width attribute (bug 3202)
922 !! input
923 <pre width="8">Narrow screen goodies</pre>
924 !! result
925 <pre width="8">Narrow screen goodies</pre>
926
927 !! end
928
929 !! test
930 <pre> with forbidden attribute (bug 3202)
931 !! input
932 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
933 !! result
934 <pre width="8">Narrow screen goodies</pre>
935
936 !! end
937
938 !! test
939 Entities inside <pre>
940 !! input
941 <pre>&lt;</pre>
942 !! result
943 <pre>&lt;</pre>
944
945 !! end
946
947 !! test
948 <pre> with forbidden attribute values (bug 3202)
949 !! input
950 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
951 !! result
952 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
953
954 !! end
955
956 !! test
957 <nowiki> inside <pre> (bug 13238)
958 !! input
959 <pre>
960 <nowiki>
961 </pre>
962 <pre>
963 <nowiki></nowiki>
964 </pre>
965 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
966 !! result
967 <pre>
968 &lt;nowiki&gt;
969 </pre>
970 <pre>
971
972 </pre>
973 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
974
975 !! end
976
977 !! test
978 <nowiki> and <pre> preference (first one wins)
979 !! input
980 <pre>
981 <nowiki>
982 </pre>
983 </nowiki>
984 </pre>
985
986 <nowiki>
987 <pre>
988 <nowiki>
989 </pre>
990 </nowiki>
991 </pre>
992
993 !! result
994 <pre>
995 &lt;nowiki&gt;
996 </pre>
997 <p>&lt;/nowiki&gt;
998 &lt;/pre&gt;
999 </p><p>
1000 &lt;pre&gt;
1001 &lt;nowiki&gt;
1002 &lt;/pre&gt;
1003
1004 &lt;/pre&gt;
1005 </p>
1006 !! end
1007
1008 !! test
1009 </pre> inside nowiki
1010 !! input
1011 <nowiki></pre></nowiki>
1012 !! result
1013 <p>&lt;/pre&gt;
1014 </p>
1015 !! end
1016
1017 !!test
1018 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1019 !!input
1020 {{echo|}}
1021 !!result
1022
1023 !!end
1024
1025 !!test
1026 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1027 !!input
1028 {{echo|
1029 foo}}
1030 !!result
1031 <p>foo
1032 </p>
1033 !!end
1034
1035 !! test
1036 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1037 !! input
1038 {{echo|a
1039 b}}
1040 !!result
1041 <pre>a
1042 </pre>
1043 <p>b
1044 </p>
1045 !!end
1046
1047 !! test
1048 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1049 !! input
1050 {{echo|a
1051 b
1052 c
1053 d
1054 e
1055 }}
1056 !!result
1057 <pre>a
1058 </pre>
1059 <p>b
1060 c
1061 </p>
1062 <pre>d
1063 </pre>
1064 <p>e
1065 </p>
1066 !!end
1067
1068 !!test
1069 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1070 !!input
1071 {{echo| foo}}
1072
1073 {{echo| foo}}{{echo| bar}}
1074
1075 {{echo| foo}}
1076 {{echo| bar}}
1077
1078 {{echo|<!--cmt--> foo}}
1079
1080 <!--cmt-->{{echo| foo}}
1081
1082 {{echo|{{echo| }}bar}}
1083 !!result
1084 <pre>foo
1085 </pre>
1086 <pre>foo bar
1087 </pre>
1088 <pre>foo
1089 bar
1090 </pre>
1091 <pre>foo
1092 </pre>
1093 <pre>foo
1094 </pre>
1095 <pre>bar
1096 </pre>
1097 !!end
1098
1099 !! test
1100 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1101 !! input
1102 {{echo| }}a
1103
1104 {{echo|
1105 }}a
1106
1107 {{echo|
1108 b}}
1109
1110 {{echo|a
1111 }}b
1112
1113 {{echo|a
1114 }} b
1115 !!result
1116 <pre>a
1117 </pre>
1118 <p><br />
1119 </p>
1120 <pre>a
1121 </pre>
1122 <p><br />
1123 </p>
1124 <pre>b
1125 </pre>
1126 <p>a
1127 </p>
1128 <pre>b
1129 </pre>
1130 <p>a
1131 </p>
1132 <pre>b
1133 </pre>
1134 !!end
1135
1136 !! test
1137 Templates: Single-line variant of parameter whitespace stripping test
1138 !! input
1139 {{echo| a}}
1140
1141 {{echo|1= a}}
1142
1143 {{echo|{{echo| a}}}}
1144
1145 {{echo|1={{echo| a}}}}
1146 !! result
1147 <pre>a
1148 </pre>
1149 <p>a
1150 </p>
1151 <pre>a
1152 </pre>
1153 <p>a
1154 </p>
1155 !! end
1156
1157 !! test
1158 Templates: Strip whitespace from named parameters, but not positional ones
1159 !! input
1160 {{echo|
1161 foo}}
1162
1163 {{echo|
1164 * foo}}
1165
1166 {{echo| 1 =
1167 foo}}
1168
1169 {{echo| 1 =
1170 * foo}}
1171 !! result
1172 <pre>foo
1173 </pre>
1174 <p><br />
1175 </p>
1176 <ul><li> foo
1177 </li></ul>
1178 <p>foo
1179 </p>
1180 <ul><li> foo
1181 </li></ul>
1182
1183 !! end
1184
1185 ###
1186 ### Parsoid-centric tests for testing RT edge cases for pre
1187 ###
1188
1189 !!test
1190 1a. Indent-Pre and Comments
1191 !!input
1192 a
1193 <!--a-->
1194 c
1195 !!result
1196 <pre>a
1197 </pre>
1198 <p>c
1199 </p>
1200 !!end
1201
1202 !!test
1203 1b. Indent-Pre and Comments
1204 !!input
1205 a
1206 <!--a-->
1207 c
1208 !!result
1209 <pre>a
1210 </pre>
1211 <p>c
1212 </p>
1213 !!end
1214
1215 !!test
1216 1c. Indent-Pre and Comments
1217 !!input
1218 <!--a--> a
1219
1220 <!--a--> a
1221 !!result
1222 <pre> a
1223 </pre>
1224 <pre> a
1225 </pre>
1226 !!end
1227
1228 !!test
1229 2a. Indent-Pre and tables
1230 !!input
1231 {|
1232 |-
1233 !h1!!h2
1234 |foo||bar
1235 |}
1236 !!result
1237 <table>
1238
1239 <tr>
1240 <th>h1</th>
1241 <th>h2
1242 </th>
1243 <td>foo</td>
1244 <td>bar
1245 </td></tr></table>
1246
1247 !!end
1248
1249 !!test
1250 2b. Indent-Pre and tables
1251 !!input
1252 {|
1253 |-
1254 |foo
1255 |}
1256 !!result
1257 <table>
1258
1259 <tr>
1260 <td>foo
1261 </td></tr></table>
1262
1263 !!end
1264
1265 !!test
1266 2c. Indent-Pre and tables (bug 42252)
1267 !!input
1268 {|
1269 |+ foo
1270 ! | bar
1271 |}
1272 !!result
1273 <table>
1274 <caption> foo
1275 </caption>
1276 <tr>
1277 <th> bar
1278 </th></tr></table>
1279
1280 !!end
1281
1282 !!test
1283 3a. Indent-Pre and block tags (single-line html)
1284 !!input
1285 <p> foo </p>
1286 <div> foo </div>
1287 <span> foo </span>
1288 !!result
1289 <p> foo </p>
1290 <div> foo </div>
1291 <pre><span> foo </span>
1292 </pre>
1293 !!end
1294
1295 !!test
1296 3b. Indent-Pre and block tags (pre-content on separate line)
1297 !!input
1298 <p>
1299 foo
1300 </p>
1301
1302 <div>
1303 foo
1304 </div>
1305
1306 <center>
1307 foo
1308 </center>
1309
1310 <blockquote>
1311 foo
1312 </blockquote>
1313
1314 <table><tr><td>
1315 foo
1316 </td></tr></table>
1317
1318 <ul><li>
1319 foo
1320 </li></ul>
1321
1322 !!result
1323 <p>
1324 foo
1325 </p>
1326 <div>
1327 <pre>foo
1328 </pre>
1329 </div>
1330 <center>
1331 <pre>foo
1332 </pre>
1333 </center>
1334 <blockquote>
1335 foo
1336 </blockquote>
1337 <table><tr><td>
1338 <pre>foo
1339 </pre>
1340 </td></tr></table>
1341 <ul><li>
1342 foo
1343 </li></ul>
1344
1345 !!end
1346
1347 !!test
1348 4. Multiple spaces at start-of-line
1349 !!input
1350 <p> foo </p>
1351 foo
1352 {|
1353 |foo
1354 |}
1355 !!result
1356 <p> foo </p>
1357 <pre> foo
1358 </pre>
1359 <table>
1360 <tr>
1361 <td>foo
1362 </td></tr></table>
1363
1364 !!end
1365
1366 !! test
1367 5. White-space in indent-pre
1368 NOTE: the white-space char on 2nd line is significant
1369 !! input
1370 a<br/>
1371
1372 b
1373 !! result
1374 <pre>a<br />
1375
1376 b
1377 </pre>
1378 !! end
1379
1380 ###
1381 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1382 ###
1383
1384 !!test
1385 HTML-pre: 1. embedded newlines
1386 !!input
1387 <pre>foo</pre>
1388
1389 <pre>
1390 foo
1391 </pre>
1392
1393 <pre>
1394
1395 foo
1396 </pre>
1397
1398 <pre>
1399
1400
1401 foo
1402 </pre>
1403 !!result
1404 <pre>foo</pre>
1405 <pre>
1406 foo
1407 </pre>
1408 <pre>
1409
1410 foo
1411 </pre>
1412 <pre>
1413
1414
1415 foo
1416 </pre>
1417
1418 !!end
1419
1420 !!test
1421 HTML-pre: 2: indented text
1422 !!input
1423 <pre>
1424 foo
1425 </pre>
1426 !!result
1427 <pre>
1428 foo
1429 </pre>
1430
1431 !!end
1432
1433 !!test
1434 HTML-pre: 3: other wikitext
1435 !!input
1436 <pre>
1437 * foo
1438 # bar
1439 = no-h =
1440 '' no-italic ''
1441 [[ NoLink ]]
1442 </pre>
1443 !!result
1444 <pre>
1445 * foo
1446 # bar
1447 = no-h =
1448 '' no-italic ''
1449 [[ NoLink ]]
1450 </pre>
1451
1452 !!end
1453
1454 ###
1455 ### Definition lists
1456 ###
1457 !! test
1458 Simple definition
1459 !! input
1460 ; name : Definition
1461 !! result
1462 <dl><dt> name&#160;</dt><dd> Definition
1463 </dd></dl>
1464
1465 !! end
1466
1467 !! test
1468 Definition list for indentation only
1469 !! input
1470 : Indented text
1471 !! result
1472 <dl><dd> Indented text
1473 </dd></dl>
1474
1475 !! end
1476
1477 !! test
1478 Definition list with no space
1479 !! input
1480 ;name:Definition
1481 !! result
1482 <dl><dt>name</dt><dd>Definition
1483 </dd></dl>
1484
1485 !!end
1486
1487 !! test
1488 Definition list with URL link
1489 !! input
1490 ; http://example.com/ : definition
1491 !! result
1492 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1493 </dd></dl>
1494
1495 !! end
1496
1497 !! test
1498 Definition list with bracketed URL link
1499 !! input
1500 ;[http://www.example.com/ Example]:Something about it
1501 !! result
1502 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1503 </dd></dl>
1504
1505 !! end
1506
1507 !! test
1508 Definition list with wikilink containing colon
1509 !! input
1510 ; [[Help:FAQ]]: The least-read page on Wikipedia
1511 !! result
1512 <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
1513 </dd></dl>
1514
1515 !! end
1516
1517 # At Brion's and JeLuF's insistence... :)
1518 !! test
1519 Definition list with news link containing colon
1520 !! input
1521 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1522 !! result
1523 <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!
1524 </dd></dl>
1525
1526 !! end
1527
1528 !! test
1529 Malformed definition list with colon
1530 !! input
1531 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1532 !! result
1533 <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
1534 </dt></dl>
1535
1536 !! end
1537
1538 !! test
1539 Definition lists: colon in external link text
1540 !! input
1541 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1542 !! result
1543 <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
1544 </dd></dl>
1545
1546 !! end
1547
1548 !! test
1549 Definition lists: colon in HTML attribute
1550 !! input
1551 ;<b style="display: inline">bold</b>
1552 !! result
1553 <dl><dt><b style="display: inline">bold</b>
1554 </dt></dl>
1555
1556 !! end
1557
1558 !! test
1559 Definition lists: self-closed tag
1560 !! input
1561 ;one<br/>two : two-line fun
1562 !! result
1563 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1564 </dd></dl>
1565
1566 !! end
1567
1568 !! test
1569 Bug 11748: Literal closing tags
1570 !! input
1571 <dl>
1572 <dt>test 1</dt>
1573 <dd>test test test test test</dd>
1574 <dt>test 2</dt>
1575 <dd>test test test test test</dd>
1576 </dl>
1577 !! result
1578 <dl>
1579 <dt>test 1</dt>
1580 <dd>test test test test test</dd>
1581 <dt>test 2</dt>
1582 <dd>test test test test test</dd>
1583 </dl>
1584
1585 !! end
1586
1587 !! test
1588 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1589 !! input
1590 <ul><li>
1591 ; term : description
1592 * unordered
1593 </li>
1594 </ul>
1595 !! result
1596 <ul><li>
1597 <dl><dt> term&#160;</dt><dd> description
1598 </dd></dl>
1599 <ul><li> unordered
1600 </li></ul>
1601 </li>
1602 </ul>
1603
1604 !! end
1605
1606 !! test
1607
1608 Definition list with empty definition and following paragraph
1609 !! input
1610 ; term:
1611 Paragraph text
1612 !! result
1613 <dl><dt> term</dt><dd>
1614 </dd></dl>
1615 <p>Paragraph text
1616 </p>
1617 !! end
1618
1619 !! test
1620 Nested definition lists using html syntax
1621 !! input
1622 <dl><dd>
1623 <dl>
1624 <dd>Foo</dd>
1625 </dl>
1626 </dd></dl>
1627 !! result
1628 <dl><dd>
1629 <dl>
1630 <dd>Foo</dd>
1631 </dl>
1632 </dd></dl>
1633
1634 !! end
1635
1636 !! test
1637 Definition Lists: No nesting: Multiple dd's
1638 !! input
1639 ;x
1640 :a
1641 :b
1642 !! result
1643 <dl><dt>x
1644 </dt><dd>a
1645 </dd><dd>b
1646 </dd></dl>
1647
1648 !! end
1649
1650 !! test
1651 Definition Lists: Indentation: Regular
1652 !! input
1653 :i1
1654 ::i2
1655 :::i3
1656 !! result
1657 <dl><dd>i1
1658 <dl><dd>i2
1659 <dl><dd>i3
1660 </dd></dl>
1661 </dd></dl>
1662 </dd></dl>
1663
1664 !! end
1665
1666 !! test
1667 Definition Lists: Indentation: Missing 1st level
1668 !! input
1669 ::i2
1670 :::i3
1671 !! result
1672 <dl><dd><dl><dd>i2
1673 <dl><dd>i3
1674 </dd></dl>
1675 </dd></dl>
1676 </dd></dl>
1677
1678 !! end
1679
1680 !! test
1681 Definition Lists: Indentation: Multi-level indent
1682 !! input
1683 :::i3
1684 !! result
1685 <dl><dd><dl><dd><dl><dd>i3
1686 </dd></dl>
1687 </dd></dl>
1688 </dd></dl>
1689
1690 !! end
1691
1692 !! test
1693 Definition Lists: Hacky use to indent tables
1694 !! input
1695 ::{|
1696 |foo
1697 |bar
1698 |}
1699 this text
1700 should be left alone
1701 !! result
1702 <dl><dd><dl><dd><table>
1703 <tr>
1704 <td>foo
1705 </td>
1706 <td>bar
1707 </td></tr></table></dd></dl></dd></dl>
1708 <p>this text
1709 should be left alone
1710 </p>
1711 !! end
1712 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1713 ## as an empty dt item. It also ignores all but the last ";" when followed
1714 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1715 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1716 ## ";"s.
1717 ##
1718 ## Ex: ";;t2 ::d2" is transformed into:
1719 ##
1720 ## <dl>
1721 ## <dt>t2 </dt>
1722 ## <dd>
1723 ## <dl>
1724 ## <dt></dt>
1725 ## <dd>d2</dd>
1726 ## </dl>
1727 ## </dd>
1728 ## </dl>
1729 ##
1730 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1731 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1732 ##
1733 ## <dl>
1734 ## <dt>
1735 ## <dl>
1736 ## <dt>t2 </dt>
1737 ## <dd>:d2</dd>
1738 ## </dl>
1739 ## </dt>
1740 ## </dl>
1741 ##
1742 ## All Parsoid only definition list tests have this difference.
1743 ##
1744 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1745 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1746
1747 !! test
1748 Table / list interaction: indented table with lists in table contents
1749 !! input
1750 :{|
1751 |-
1752 | a
1753 * b
1754 |-
1755 | c
1756 * d
1757 |}
1758 !! result
1759 <dl><dd><table>
1760
1761 <tr>
1762 <td> a
1763 <ul><li> b
1764 </li></ul>
1765 </td></tr>
1766 <tr>
1767 <td> c
1768 <ul><li> d
1769 </li></ul>
1770 </td></tr></table></dd></dl>
1771
1772 !! end
1773
1774 !!test
1775 Table / list interaction: lists nested in tables nested in indented lists
1776 !!input
1777 :{|
1778 |
1779 :a
1780 :b
1781 |
1782 *c
1783 *d
1784 |}
1785
1786 *e
1787 *f
1788 !!result
1789 <dl><dd><table>
1790 <tr>
1791 <td>
1792 <dl><dd>a
1793 </dd><dd>b
1794 </dd></dl>
1795 </td>
1796 <td>
1797 <ul><li>c
1798 </li><li>d
1799 </li></ul>
1800 </td></tr></table></dd></dl>
1801 <ul><li>e
1802 </li><li>f
1803 </li></ul>
1804
1805 !!end
1806
1807 !! test
1808 Definition Lists: Nesting: Multi-level (Parsoid only)
1809 !! options
1810 disabled
1811 !! input
1812 ;t1 :d1
1813 ;;t2 ::d2
1814 ;;;t3 :::d3
1815 !! result
1816 <dl>
1817 <dt>t1 </dt>
1818 <dd>d1</dd>
1819 <dt>
1820 <dl>
1821 <dt>t2 </dt>
1822 <dd>:d2</dd>
1823 <dt>
1824 <dl>
1825 <dt>t3 </dt>
1826 <dd>::d3</dd>
1827 </dl>
1828 </dt>
1829 </dl>
1830 </dt>
1831 </dl>
1832
1833
1834 !! end
1835
1836
1837 !! test
1838 Definition Lists: Nesting: Test 2 (Parsoid only)
1839 !! options
1840 disabled
1841 !! input
1842 ;t1
1843 ::d2
1844 !! result
1845 <dl>
1846 <dt>t1</dt>
1847 <dd>
1848 <dl>
1849 <dd>d2</dd>
1850 </dl>
1851 </dd>
1852 </dl>
1853
1854 !! end
1855
1856
1857 !! test
1858 Definition Lists: Nesting: Test 3 (Parsoid only)
1859 !! options
1860 disabled
1861 !! input
1862 :;t1
1863 ::::d2
1864 !! result
1865 <dl>
1866 <dd>
1867 <dl>
1868 <dt>t1</dt>
1869 <dd>
1870 <dl>
1871 <dd>
1872 <dl>
1873 <dd>d2</dd>
1874 </dl>
1875 </dd>
1876 </dl>
1877 </dd>
1878 </dl>
1879 </dd>
1880 </dl>
1881
1882 !! end
1883
1884
1885 !! test
1886 Definition Lists: Nesting: Test 4
1887 !! input
1888 ::;t3
1889 :::d3
1890 !! result
1891 <dl><dd><dl><dd><dl><dt>t3
1892 </dt><dd>d3
1893 </dd></dl>
1894 </dd></dl>
1895 </dd></dl>
1896
1897 !! end
1898
1899
1900 !! test
1901 Definition Lists: Mixed Lists: Test 1
1902 !! input
1903 :;* foo
1904 ::* bar
1905 :; baz
1906 !! result
1907 <dl><dd><dl><dt><ul><li> foo
1908 </li><li> bar
1909 </li></ul>
1910 </dt></dl>
1911 <dl><dt> baz
1912 </dt></dl>
1913 </dd></dl>
1914
1915 !! end
1916
1917
1918 !! test
1919 Definition Lists: Mixed Lists: Test 2
1920 !! input
1921 *: d1
1922 *: d2
1923 !! result
1924 <ul><li><dl><dd> d1
1925 </dd><dd> d2
1926 </dd></dl>
1927 </li></ul>
1928
1929 !! end
1930
1931
1932 !! test
1933 Definition Lists: Mixed Lists: Test 3
1934 !! input
1935 *::: d1
1936 *::: d2
1937 !! result
1938 <ul><li><dl><dd><dl><dd><dl><dd> d1
1939 </dd><dd> d2
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943 </li></ul>
1944
1945 !! end
1946
1947
1948 !! test
1949 Definition Lists: Mixed Lists: Test 4
1950 !! input
1951 *;d1 :d2
1952 *;d3 :d4
1953 !! result
1954 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1955 </dd><dt>d3&#160;</dt><dd>d4
1956 </dd></dl>
1957 </li></ul>
1958
1959 !! end
1960
1961
1962 !! test
1963 Definition Lists: Mixed Lists: Test 5
1964 !! input
1965 *:d1
1966 *:: d2
1967 !! result
1968 <ul><li><dl><dd>d1
1969 <dl><dd> d2
1970 </dd></dl>
1971 </dd></dl>
1972 </li></ul>
1973
1974 !! end
1975
1976
1977 !! test
1978 Definition Lists: Mixed Lists: Test 6
1979 !! input
1980 #*:d1
1981 #*::: d3
1982 !! result
1983 <ol><li><ul><li><dl><dd>d1
1984 <dl><dd><dl><dd> d3
1985 </dd></dl>
1986 </dd></dl>
1987 </dd></dl>
1988 </li></ul>
1989 </li></ol>
1990
1991 !! end
1992
1993
1994 !! test
1995 Definition Lists: Mixed Lists: Test 7
1996 !! input
1997 :* d1
1998 :* d2
1999 !! result
2000 <dl><dd><ul><li> d1
2001 </li><li> d2
2002 </li></ul>
2003 </dd></dl>
2004
2005 !! end
2006
2007
2008 !! test
2009 Definition Lists: Mixed Lists: Test 8
2010 !! input
2011 :* d1
2012 ::* d2
2013 !! result
2014 <dl><dd><ul><li> d1
2015 </li></ul>
2016 <dl><dd><ul><li> d2
2017 </li></ul>
2018 </dd></dl>
2019 </dd></dl>
2020
2021 !! end
2022
2023
2024 !! test
2025 Definition Lists: Mixed Lists: Test 9
2026 !! input
2027 *;foo :bar
2028 !! result
2029 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2030 </dd></dl>
2031 </li></ul>
2032
2033 !! end
2034
2035
2036 !! test
2037 Definition Lists: Mixed Lists: Test 10
2038 !! input
2039 *#;foo :bar
2040 !! result
2041 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2042 </dd></dl>
2043 </li></ol>
2044 </li></ul>
2045
2046 !! end
2047
2048
2049 !! test
2050 Definition Lists: Mixed Lists: Test 11
2051 !! input
2052 *#*#;*;;foo :bar
2053 *#*#;boo :baz
2054 !! result
2055 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2056 </dt></dl>
2057 </dd></dl>
2058 </li></ul>
2059 </dd></dl>
2060 <dl><dt>boo&#160;</dt><dd>baz
2061 </dd></dl>
2062 </li></ol>
2063 </li></ul>
2064 </li></ol>
2065 </li></ul>
2066
2067 !! end
2068
2069
2070 !! test
2071 Definition Lists: Weird Ones: Test 1
2072 !! input
2073 *#;*::;; foo : bar (who uses this?)
2074 !! result
2075 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2076 </dt></dl>
2077 </dd></dl>
2078 </dd></dl>
2079 </dd></dl>
2080 </li></ul>
2081 </dd></dl>
2082 </li></ol>
2083 </li></ul>
2084
2085 !! end
2086
2087 ###
2088 ### External links
2089 ###
2090 !! test
2091 External links: non-bracketed
2092 !! input
2093 Non-bracketed: http://example.com
2094 !! result
2095 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2096 </p>
2097 !! end
2098
2099 !! test
2100 External links: numbered
2101 !! input
2102 Numbered: [http://example.com]
2103 Numbered: [http://example.net]
2104 Numbered: [http://example.com]
2105 !! result
2106 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2107 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2108 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2109 </p>
2110 !!end
2111
2112 !! test
2113 External links: specified text
2114 !! input
2115 Specified text: [http://example.com link]
2116 !! result
2117 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2118 </p>
2119 !!end
2120
2121 !! test
2122 External links: trail
2123 !! input
2124 Linktrails should not work for external links: [http://example.com link]s
2125 !! result
2126 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2127 </p>
2128 !! end
2129
2130 !! test
2131 External links: dollar sign in URL
2132 !! input
2133 http://example.com/1$2345
2134 !! result
2135 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2136 </p>
2137 !! end
2138
2139 !! test
2140 External links: dollar sign in URL (named)
2141 !! input
2142 [http://example.com/1$2345]
2143 !! result
2144 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2145 </p>
2146 !!end
2147
2148 !! test
2149 External links: open square bracket forbidden in URL (bug 4377)
2150 !! input
2151 http://example.com/1[2345
2152 !! result
2153 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2154 </p>
2155 !! end
2156
2157 !! test
2158 External links: open square bracket forbidden in URL (named) (bug 4377)
2159 !! input
2160 [http://example.com/1[2345]
2161 !! result
2162 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2163 </p>
2164 !!end
2165
2166 !! test
2167 External links: nowiki in URL link text (bug 6230)
2168 !!input
2169 [http://example.com/ <nowiki>''example site''</nowiki>]
2170 !! result
2171 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2172 </p>
2173 !! end
2174
2175 !! test
2176 External links: newline forbidden in text (bug 6230 regression check)
2177 !! input
2178 [http://example.com/ first
2179 second]
2180 !! result
2181 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2182 second]
2183 </p>
2184 !!end
2185
2186 !! test
2187 External links: Pipe char between url and text
2188 !! input
2189 [http://example.com | link]
2190 !! result
2191 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2192 </p>
2193 !!end
2194
2195 !! test
2196 External links: protocol-relative URL in brackets
2197 !! input
2198 [//example.com/ Test]
2199 !! result
2200 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2201 </p>
2202 !! end
2203
2204 !! test
2205 External links: protocol-relative URL in brackets without text
2206 !! input
2207 [//example.com]
2208 !! result
2209 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2210 </p>
2211 !! end
2212
2213 !! test
2214 External links: protocol-relative URL in free text is left alone
2215 !! input
2216 //example.com/Foo
2217 !! result
2218 <p>//example.com/Foo
2219 </p>
2220 !!end
2221
2222 !! test
2223 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2224 !! input
2225 foo//example.com/Foo
2226 !! result
2227 <p>foo//example.com/Foo
2228 </p>
2229 !! end
2230
2231 !! test
2232 External image
2233 !! input
2234 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2235 !! result
2236 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2237 </p>
2238 !! end
2239
2240 !! test
2241 External image from https
2242 !! input
2243 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2244 !! result
2245 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2246 </p>
2247 !! end
2248
2249 !! test
2250 Link to non-http image, no img tag
2251 !! input
2252 Link to non-http image, no img tag: ftp://example.com/test.jpg
2253 !! result
2254 <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>
2255 </p>
2256 !! end
2257
2258 !! test
2259 External links: terminating separator
2260 !! input
2261 Terminating separator: http://example.com/thing,
2262 !! result
2263 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2264 </p>
2265 !! end
2266
2267 !! test
2268 External links: intervening separator
2269 !! input
2270 Intervening separator: http://example.com/1,2,3
2271 !! result
2272 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2273 </p>
2274 !! end
2275
2276 !! test
2277 External links: old bug with URL in query
2278 !! input
2279 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2280 !! result
2281 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2282 </p>
2283 !! end
2284
2285 !! test
2286 External links: old URL-in-URL bug, mixed protocols
2287 !! input
2288 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2289 !! result
2290 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2291 </p>
2292 !!end
2293
2294 !! test
2295 External links: URL in text
2296 !! input
2297 URL in text: [http://example.com http://example.com]
2298 !! result
2299 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2300 </p>
2301 !! end
2302
2303 !! test
2304 External links: Clickable images
2305 !! input
2306 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2307 !! result
2308 <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>
2309 </p>
2310 !!end
2311
2312 !! test
2313 External links: raw ampersand
2314 !! input
2315 Old &amp; use: http://x&y
2316 !! result
2317 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2318 </p>
2319 !! end
2320
2321 !! test
2322 External links: encoded ampersand
2323 !! input
2324 Old &amp; use: http://x&amp;y
2325 !! result
2326 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2327 </p>
2328 !! end
2329
2330 !! test
2331 External links: encoded equals (bug 6102)
2332 !! input
2333 http://example.com/?foo&#61;bar
2334 !! result
2335 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2336 </p>
2337 !! end
2338
2339 !! test
2340 External links: [raw ampersand]
2341 !! input
2342 Old &amp; use: [http://x&y]
2343 !! result
2344 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2345 </p>
2346 !! end
2347
2348 !! test
2349 External links: [encoded ampersand]
2350 !! input
2351 Old &amp; use: [http://x&amp;y]
2352 !! result
2353 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2354 </p>
2355 !! end
2356
2357 !! test
2358 External links: [encoded equals] (bug 6102)
2359 !! input
2360 [http://example.com/?foo&#61;bar]
2361 !! result
2362 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2363 </p>
2364 !! end
2365
2366 !! test
2367 External links: [IDN ignored character reference in hostname; strip it right off]
2368 !! input
2369 [http://e&zwnj;xample.com/]
2370 !! result
2371 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2372 </p>
2373 !! end
2374
2375 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2376 # Where an external link could easily circumvent the sanitization of the text of
2377 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2378 # test demands a higher standard. That's a bit strange.
2379 #
2380 # Example:
2381 #
2382 # http://e‌xample.com -> [http://example.com|http://example.com]
2383 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2384 #
2385 # The first example is sanitized, but the second is not. Any security benefits
2386 # from this production are trivial to circumvent. Either remove this test and
2387 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2388 # the test accordingly.
2389 #
2390 # All our love,
2391 # The Parsoid team.
2392 !! test
2393 External links: IDN ignored character reference in hostname; strip it right off
2394 !! input
2395 http://e&zwnj;xample.com/
2396 !! result
2397 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2398 </p>
2399 !! end
2400
2401 !! test
2402 External links: www.jpeg.org (bug 554)
2403 !! input
2404 http://www.jpeg.org
2405 !!result
2406 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2407 </p>
2408 !! end
2409
2410 !! test
2411 External links: URL within URL (original bug 2)
2412 !! input
2413 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2414 !! result
2415 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2416 </p>
2417 !! end
2418
2419 !! test
2420 BUG 361: URL inside bracketed URL
2421 !! input
2422 [http://www.example.com/foo http://www.example.com/bar]
2423 !! result
2424 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2425 </p>
2426 !! end
2427
2428 !! test
2429 BUG 361: URL within URL, not bracketed
2430 !! input
2431 http://www.example.com/foo?=http://www.example.com/bar
2432 !! result
2433 <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>
2434 </p>
2435 !! end
2436
2437 !! test
2438 BUG 289: ">"-token in URL-tail
2439 !! input
2440 http://www.example.com/<hello>
2441 !! result
2442 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2443 </p>
2444 !!end
2445
2446 !! test
2447 BUG 289: literal ">"-token in URL-tail
2448 !! input
2449 http://www.example.com/<b>html</b>
2450 !! result
2451 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2452 </p>
2453 !!end
2454
2455 !! test
2456 BUG 289: ">"-token in bracketed URL
2457 !! input
2458 [http://www.example.com/<hello> stuff]
2459 !! result
2460 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2461 </p>
2462 !!end
2463
2464 !! test
2465 BUG 289: literal ">"-token in bracketed URL
2466 !! input
2467 [http://www.example.com/<b>html</b> stuff]
2468 !! result
2469 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2470 </p>
2471 !!end
2472
2473 !! test
2474 BUG 289: literal double quote at end of URL
2475 !! input
2476 http://www.example.com/"hello"
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2479 </p>
2480 !!end
2481
2482 !! test
2483 BUG 289: literal double quote in bracketed URL
2484 !! input
2485 [http://www.example.com/"hello" stuff]
2486 !! result
2487 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2488 </p>
2489 !!end
2490
2491 !! test
2492 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2493 !! input
2494 [http://www.example.com test]
2495 !! result
2496 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2497 </p>
2498 !! end
2499
2500 !! test
2501 External links: wiki links within external link (Bug 3695)
2502 !! input
2503 [http://example.com [[wikilink]] embedded in ext link]
2504 !! result
2505 <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>
2506 </p>
2507 !! end
2508
2509 !! test
2510 BUG 787: Links with one slash after the url protocol are invalid
2511 !! input
2512 http:/example.com
2513
2514 [http:/example.com title]
2515 !! result
2516 <p>http:/example.com
2517 </p><p>[http:/example.com title]
2518 </p>
2519 !! end
2520
2521 !! test
2522 Bracketed external links with template-generated invalid target
2523 !! input
2524 [{{echo|http:/example.com}} title]
2525 !! result
2526 <p>[http:/example.com title]
2527 </p>
2528 !! end
2529
2530 !! test
2531 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2532 !! input
2533 ''[http://example.com text'']
2534 [http://example.com '''text]'''
2535 ''Something [http://example.com in italic'']
2536 ''Something [http://example.com mixed''''', even bold]'''
2537 '''''Now [http://example.com both''''']
2538 !! result
2539 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2540 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2541 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2542 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2543 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2544 </p>
2545 !! end
2546
2547
2548 !! test
2549 Bug 4781: %26 in URL
2550 !! input
2551 http://www.example.com/?title=AT%26T
2552 !! result
2553 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2554 </p>
2555 !! end
2556
2557 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2558 # % is actually legal in HTML5. Any change in output would need testing though.
2559 !! test
2560 Bug 4781, 5267: %25 in URL
2561 !! input
2562 http://www.example.com/?title=100%25_Bran
2563 !! result
2564 <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>
2565 </p>
2566 !! end
2567
2568 !! test
2569 Bug 4781, 5267: %28, %29 in URL
2570 !! input
2571 http://www.example.com/?title=Ben-Hur_%281959_film%29
2572 !! result
2573 <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>
2574 </p>
2575 !! end
2576
2577
2578 !! test
2579 Bug 4781: %26 in autonumber URL
2580 !! input
2581 [http://www.example.com/?title=AT%26T]
2582 !! result
2583 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2584 </p>
2585 !! end
2586
2587 !! test
2588 Bug 4781, 5267: %26 in autonumber URL
2589 !! input
2590 [http://www.example.com/?title=100%25_Bran]
2591 !! result
2592 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2593 </p>
2594 !! end
2595
2596 !! test
2597 Bug 4781, 5267: %28, %29 in autonumber URL
2598 !! input
2599 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2600 !! result
2601 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2602 </p>
2603 !! end
2604
2605
2606 !! test
2607 Bug 4781: %26 in bracketed URL
2608 !! input
2609 [http://www.example.com/?title=AT%26T link]
2610 !! result
2611 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2612 </p>
2613 !! end
2614
2615 !! test
2616 Bug 4781, 5267: %26 in bracketed URL
2617 !! input
2618 [http://www.example.com/?title=100%25_Bran link]
2619 !! result
2620 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2621 </p>
2622 !! end
2623
2624 !! test
2625 Bug 4781, 5267: %28, %29 in bracketed URL
2626 !! input
2627 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2628 !! result
2629 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2630 </p>
2631 !! end
2632
2633 !! test
2634 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2635 !! input
2636 Some [http://example.com/ pretty ''italics'' and stuff]!
2637 !! result
2638 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2639 </p>
2640 !! end
2641
2642 !! test
2643 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2644 !! input
2645 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2646 !! result
2647 <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>
2648 </p>
2649 !! end
2650
2651 !! test
2652 External link containing double-single-quotes with no space separating the url from text in italics
2653 !! input
2654 [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]].]
2655 !! result
2656 <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>
2657 </p>
2658 !! end
2659
2660 !!test
2661 Text in square brackets that is not a link should parse as text
2662 !!input
2663 [foo]
2664 [{{echo|foo}}]
2665 [url={{echo|foo}}]
2666 [url=http://example.com]
2667 !!result
2668 <p>[foo]
2669 [foo]
2670 [url=foo]
2671 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
2672 </p>
2673 !!end
2674
2675 !! test
2676 URL-encoding in URL functions (single parameter)
2677 !! input
2678 {{localurl:Some page|amp=&}}
2679 !! result
2680 <p>/index.php?title=Some_page&amp;amp=&amp;
2681 </p>
2682 !! end
2683
2684 !! test
2685 URL-encoding in URL functions (multiple parameters)
2686 !! input
2687 {{localurl:Some page|q=?&amp=&}}
2688 !! result
2689 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2690 </p>
2691 !! end
2692
2693 !! test
2694 Brackets in urls
2695 !! input
2696 http://example.com/index.php?foozoid%5B%5D=bar
2697
2698 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2699 !! result
2700 <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>
2701 </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>
2702 </p>
2703 !! end
2704
2705 !! test
2706 IPv6 urls (bug 21261)
2707 !! options
2708 disabled
2709 !! input
2710 http://[2404:130:0:1000::187:2]/index.php
2711 !! result
2712 <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>
2713 </p>
2714 !! end
2715
2716 !! test
2717 Non-extlinks in brackets
2718 !! input
2719 [foo]
2720 [foo bar]
2721 [foo ''bar'']
2722 [fool's] errand
2723 [fool's errand]
2724 [{{echo|foo}}]
2725 [{{echo|foo}} bar]
2726 [{{echo|foo}} ''bar'']
2727 [{{echo|foo}}l's] errand
2728 [{{echo|foo}}l's errand]
2729 !! result
2730 <p>[foo]
2731 [foo bar]
2732 [foo <i>bar</i>]
2733 [fool's] errand
2734 [fool's errand]
2735 [foo]
2736 [foo bar]
2737 [foo <i>bar</i>]
2738 [fool's] errand
2739 [fool's errand]
2740 </p>
2741 !! end
2742
2743 ###
2744 ### Quotes
2745 ###
2746
2747 !! test
2748 Quotes
2749 !! input
2750 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2751
2752 Normal text. '''''Bold italic text.''''' Normal text.
2753 !!result
2754 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2755 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2756 </p>
2757 !! end
2758
2759
2760 !! test
2761 Unclosed and unmatched quotes
2762 !! input
2763 '''''Bold italic text '''with bold deactivated''' in between.'''''
2764
2765 '''''Bold italic text ''with italic deactivated'' in between.'''''
2766
2767 '''Bold text..
2768
2769 ..spanning two paragraphs (should not work).'''
2770
2771 '''Bold tag left open
2772
2773 ''Italic tag left open
2774
2775 Normal text.
2776
2777 <!-- Unmatching number of opening, closing tags: -->
2778 '''This year''''s election ''should'' beat '''last year''''s.
2779
2780 ''Tom'''s car is bigger than ''Susan'''s.
2781
2782 Plain ''italic'''s plain
2783 !! result
2784 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2785 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2786 </p><p><b>Bold text..</b>
2787 </p><p>..spanning two paragraphs (should not work).
2788 </p><p><b>Bold tag left open</b>
2789 </p><p><i>Italic tag left open</i>
2790 </p><p>Normal text.
2791 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2792 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2793 </p><p>Plain <i>italic'</i>s plain
2794 </p>
2795 !! end
2796
2797 ###
2798 ### Tables
2799 ###
2800 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2801 ###
2802
2803 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2804 # is the bare minimun required by the spec, see:
2805 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2806 !! test
2807 A table with no data.
2808 !! input
2809 {||}
2810 !! result
2811 !! end
2812
2813 # A table with nothing but a caption is invalid XHTML, we might want to render
2814 # this as <p>caption</p>
2815 !! test
2816 A table with nothing but a caption
2817 !! input
2818 {|
2819 |+ caption
2820 |}
2821 !! result
2822 <table>
2823 <caption> caption
2824 </caption><tr><td></td></tr></table>
2825
2826 !! end
2827
2828 !! test
2829 A table with caption with default-spaced attributes and a table row
2830 !! input
2831 {|
2832 |+ style="color: red;" | caption1
2833 |-
2834 | foo
2835 |}
2836 !! result
2837 <table>
2838 <caption style="color: red;"> caption1
2839 </caption>
2840 <tr>
2841 <td> foo
2842 </td></tr></table>
2843
2844 !! end
2845
2846 !! test
2847 A table with captions with non-default spaced attributes and a table row
2848 !! input
2849 {|
2850 |+style="color: red;"|caption2
2851 |+ style="color: red;"| caption3
2852 |-
2853 | foo
2854 |}
2855 !! result
2856 <table>
2857 <caption style="color: red;">caption2
2858 </caption>
2859 <caption style="color: red;"> caption3
2860 </caption>
2861 <tr>
2862 <td> foo
2863 </td></tr></table>
2864
2865 !! end
2866
2867 !! test
2868 Table td-cell syntax variations
2869 !! input
2870 {|
2871 | foo bar foo | baz
2872 | foo bar foo || baz
2873 | style='color:red;' | baz
2874 | style='color:red;' || baz
2875 |}
2876 !! result
2877 <table>
2878 <tr>
2879 <td> baz
2880 </td>
2881 <td> foo bar foo </td>
2882 <td> baz
2883 </td>
2884 <td style="color:red;"> baz
2885 </td>
2886 <td> style='color:red;' </td>
2887 <td> baz
2888 </td></tr></table>
2889
2890 !! end
2891
2892 !! test
2893 Simple table
2894 !! input
2895 {|
2896 | 1 || 2
2897 |-
2898 | 3 || 4
2899 |}
2900 !! result
2901 <table>
2902 <tr>
2903 <td> 1 </td>
2904 <td> 2
2905 </td></tr>
2906 <tr>
2907 <td> 3 </td>
2908 <td> 4
2909 </td></tr></table>
2910
2911 !! end
2912
2913 !! test
2914 Simple table but with multiple dashes for row wikitext
2915 !! input
2916 {|
2917 | foo
2918 |-----
2919 | bar
2920 |}
2921 !! result
2922 <table>
2923 <tr>
2924 <td> foo
2925 </td></tr>
2926 <tr>
2927 <td> bar
2928 </td></tr></table>
2929
2930 !! end
2931 !! test
2932 Multiplication table
2933 !! input
2934 {| border="1" cellpadding="2"
2935 |+Multiplication table
2936 |-
2937 ! &times; !! 1 !! 2 !! 3
2938 |-
2939 ! 1
2940 | 1 || 2 || 3
2941 |-
2942 ! 2
2943 | 2 || 4 || 6
2944 |-
2945 ! 3
2946 | 3 || 6 || 9
2947 |-
2948 ! 4
2949 | 4 || 8 || 12
2950 |-
2951 ! 5
2952 | 5 || 10 || 15
2953 |}
2954 !! result
2955 <table border="1" cellpadding="2">
2956 <caption>Multiplication table
2957 </caption>
2958 <tr>
2959 <th> &#215; </th>
2960 <th> 1 </th>
2961 <th> 2 </th>
2962 <th> 3
2963 </th></tr>
2964 <tr>
2965 <th> 1
2966 </th>
2967 <td> 1 </td>
2968 <td> 2 </td>
2969 <td> 3
2970 </td></tr>
2971 <tr>
2972 <th> 2
2973 </th>
2974 <td> 2 </td>
2975 <td> 4 </td>
2976 <td> 6
2977 </td></tr>
2978 <tr>
2979 <th> 3
2980 </th>
2981 <td> 3 </td>
2982 <td> 6 </td>
2983 <td> 9
2984 </td></tr>
2985 <tr>
2986 <th> 4
2987 </th>
2988 <td> 4 </td>
2989 <td> 8 </td>
2990 <td> 12
2991 </td></tr>
2992 <tr>
2993 <th> 5
2994 </th>
2995 <td> 5 </td>
2996 <td> 10 </td>
2997 <td> 15
2998 </td></tr></table>
2999
3000 !! end
3001
3002 !! test
3003 Accept "||" in table headings
3004 !! input
3005 {|
3006 !h1 || h2
3007 |}
3008 !! result
3009 <table>
3010 <tr>
3011 <th>h1 </th>
3012 <th> h2
3013 </th></tr></table>
3014
3015 !! end
3016
3017 !! test
3018 Accept "||" in indented table headings
3019 !! input
3020 :{|
3021 !h1 || h2
3022 |}
3023 !! result
3024 <dl><dd><table>
3025 <tr>
3026 <th>h1 </th>
3027 <th> h2
3028 </th></tr></table></dd></dl>
3029
3030 !! end
3031
3032 !! test
3033 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3034 !! input
3035 {|
3036 !| h1
3037 || a
3038 |}
3039 !! result
3040 <table>
3041 <tr>
3042 <th> h1
3043 </th>
3044 <td> a
3045 </td></tr></table>
3046
3047 !! end
3048
3049 !!test
3050 Accept "| !" at start of line in tables (ignore !-attribute)
3051 !!input
3052 {|
3053 |-
3054 | !style="color:red" | bar
3055 |}
3056 !!result
3057 <table>
3058
3059 <tr>
3060 <td> bar
3061 </td></tr></table>
3062
3063 !!end
3064
3065 !!test
3066 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 +/-
3067 !!input
3068 {|
3069 |-
3070 |style='color:red;'|+1
3071 |style='color:blue;'|-1
3072 |-
3073 | 1 || 2 || 3
3074 | 1 ||+2 ||-3
3075 |-
3076 | +1
3077 | -1
3078 |}
3079 !!result
3080 <table>
3081
3082 <tr>
3083 <td style="color:red;">+1
3084 </td>
3085 <td style="color:blue;">-1
3086 </td></tr>
3087 <tr>
3088 <td> 1 </td>
3089 <td> 2 </td>
3090 <td> 3
3091 </td>
3092 <td> 1 </td>
3093 <td>+2 </td>
3094 <td>-3
3095 </td></tr>
3096 <tr>
3097 <td> +1
3098 </td>
3099 <td> -1
3100 </td></tr></table>
3101
3102 !!end
3103
3104 !! test
3105 Table rowspan
3106 !! input
3107 {| border=1
3108 | Cell 1, row 1
3109 |rowspan=2| Cell 2, row 1 (and 2)
3110 | Cell 3, row 1
3111 |-
3112 | Cell 1, row 2
3113 | Cell 3, row 2
3114 |}
3115 !! result
3116 <table border="1">
3117 <tr>
3118 <td> Cell 1, row 1
3119 </td>
3120 <td rowspan="2"> Cell 2, row 1 (and 2)
3121 </td>
3122 <td> Cell 3, row 1
3123 </td></tr>
3124 <tr>
3125 <td> Cell 1, row 2
3126 </td>
3127 <td> Cell 3, row 2
3128 </td></tr></table>
3129
3130 !! end
3131
3132 !! test
3133 Nested table
3134 !! input
3135 {| border=1
3136 | &alpha;
3137 |
3138 {| bgcolor=#ABCDEF border=2
3139 |nested
3140 |-
3141 |table
3142 |}
3143 |the original table again
3144 |}
3145 !! result
3146 <table border="1">
3147 <tr>
3148 <td> &#945;
3149 </td>
3150 <td>
3151 <table bgcolor="#ABCDEF" border="2">
3152 <tr>
3153 <td>nested
3154 </td></tr>
3155 <tr>
3156 <td>table
3157 </td></tr></table>
3158 </td>
3159 <td>the original table again
3160 </td></tr></table>
3161
3162 !! end
3163
3164 !! test
3165 Invalid attributes in table cell (bug 1830)
3166 !! input
3167 {|
3168 |Cell:|broken
3169 |}
3170 !! result
3171 <table>
3172 <tr>
3173 <td>broken
3174 </td></tr></table>
3175
3176 !! end
3177
3178
3179 !! test
3180 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3181 !! input
3182 {|
3183 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3184 !! result
3185 <table>
3186 <tr>
3187 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3188 <td>]" onmouseover="alert(document.cookie)"&gt;test
3189 </td>
3190 </tr>
3191 </table>
3192
3193 !! end
3194
3195
3196 !! test
3197 Indented table markup mixed with indented pre content (proposed in bug 6200)
3198 !! input
3199 <table>
3200 <tr>
3201 <td>
3202 Text that should be rendered preformatted
3203 </td>
3204 </tr>
3205 </table>
3206 !! result
3207 <table>
3208 <tr>
3209 <td>
3210 <pre>Text that should be rendered preformatted
3211 </pre>
3212 </td>
3213 </tr>
3214 </table>
3215
3216 !! end
3217
3218 !! test
3219 Template-generated table cell attributes and cell content
3220 !! input
3221 {|
3222 |{{table_attribs}}
3223 |}
3224 !! result
3225 <table>
3226 <tr>
3227 <td style="color: red"> Foo
3228 </td></tr></table>
3229
3230 !! end
3231
3232 !! test
3233 Table with row followed by newlines and table heading
3234 !! input
3235 {|
3236 |-
3237
3238 ! foo
3239 |}
3240 !! result
3241 <table>
3242
3243
3244 <tr>
3245 <th> foo
3246 </th></tr></table>
3247
3248 !! end
3249
3250 # FIXME: Preserve the attribute properly (with an empty string as value) in
3251 # the PHP parser. Parsoid implements the behavior below.
3252 !! test
3253 Table attributes with empty value
3254 !! options
3255 disabled
3256 !! input
3257 {|
3258 | style=| hello
3259 |}
3260 !! result
3261 <table>
3262 <tr>
3263 <td style=""> hello
3264 </td></tr></table>
3265
3266 !! end
3267
3268 !! test
3269 Wikitext table with a lot of comments
3270 !! input
3271 {|
3272 <!-- c0 -->
3273 | foo
3274 <!-- c1 -->
3275 |- <!-- c2 -->
3276 <!-- c3 -->
3277 |<!-- c4 -->
3278 <!-- c5 -->
3279 |}
3280 !! result
3281 <table>
3282 <tr>
3283 <td> foo
3284 </td></tr>
3285 <tr>
3286 <td>
3287 </td></tr></table>
3288
3289 !! end
3290
3291 ###
3292 ### Internal links
3293 ###
3294 !! test
3295 Plain link, capitalized
3296 !! input
3297 [[Main Page]]
3298 !! result
3299 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3300 </p>
3301 !! end
3302
3303 !! test
3304 Plain link, uncapitalized
3305 !! input
3306 [[main Page]]
3307 !! result
3308 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3309 </p>
3310 !! end
3311
3312 !! test
3313 Piped link
3314 !! input
3315 [[Main Page|The Main Page]]
3316 !! result
3317 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3318 </p>
3319 !! end
3320
3321 !! test
3322 Broken link
3323 !! input
3324 [[Zigzagzogzagzig]]
3325 !! result
3326 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3327 </p>
3328 !! end
3329
3330 !! test
3331 Broken link with fragment
3332 !! input
3333 [[Zigzagzogzagzig#zug]]
3334 !! result
3335 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3336 </p>
3337 !! end
3338
3339 !! test
3340 Special page link with fragment
3341 !! input
3342 [[Special:Version#anchor]]
3343 !! result
3344 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3345 </p>
3346 !! end
3347
3348 !! test
3349 Nonexistent special page link with fragment
3350 !! input
3351 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3352 !! result
3353 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3354 </p>
3355 !! end
3356
3357 !! test
3358 Link with prefix
3359 !! input
3360 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3361 !! result
3362 <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>
3363 </p>
3364 !! end
3365
3366 !! test
3367 Link with suffix
3368 !! input
3369 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3370 !! result
3371 <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>!!!
3372 </p>
3373 !! end
3374
3375 !! article
3376 prefixed article
3377 !! text
3378 Some text
3379 !! endarticle
3380
3381 !! test
3382 Bug 43661: Piped links with identical prefixes
3383 !! input
3384 [[prefixed article|prefixed articles with spaces]]
3385
3386 [[prefixed article|prefixed articlesaoeu]]
3387
3388 [[Main Page|Main Page test]]
3389 !! result
3390 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3391 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3392 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3393 </p>
3394 !! end
3395
3396
3397 !! test
3398 Link with HTML entity in suffix / tail
3399 !! input
3400 [[Main Page]]&quot;, [[Main Page]]&#97;
3401 !! result
3402 <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;
3403 </p>
3404 !! end
3405
3406 !! test
3407 Link with 3 brackets
3408 !! input
3409 [[[main page]]]
3410 !! result
3411 <p>[[[main page]]]
3412 </p>
3413 !! end
3414
3415 !! test
3416 Piped link with 3 brackets
3417 !! input
3418 [[[main page|the main page]]]
3419 !! result
3420 <p>[[[main page|the main page]]]
3421 </p>
3422 !! end
3423
3424 !! test
3425 Link with multiple pipes
3426 !! input
3427 [[Main Page|The|Main|Page]]
3428 !! result
3429 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3430 </p>
3431 !! end
3432
3433 !! test
3434 Link to namespaces
3435 !! input
3436 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3437 !! result
3438 <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>
3439 </p>
3440 !! end
3441
3442 !! test
3443 Piped link to namespace
3444 !! input
3445 [[Meta:Disclaimers|The disclaimers]]
3446 !! result
3447 <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>
3448 </p>
3449 !! end
3450
3451 !! test
3452 Link containing }
3453 !! input
3454 [[Usually caused by a typo (oops}]]
3455 !! result
3456 <p>[[Usually caused by a typo (oops}]]
3457 </p>
3458 !! end
3459
3460 !! test
3461 Link containing % (not as a hex sequence)
3462 !! input
3463 [[7% Solution]]
3464 !! result
3465 <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>
3466 </p>
3467 !! end
3468
3469 !! test
3470 Link containing % as a single hex sequence interpreted to char
3471 !! input
3472 [[7%25 Solution]]
3473 !! result
3474 <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>
3475 </p>
3476 !!end
3477
3478 !! test
3479 Link containing % as a double hex sequence interpreted to hex sequence
3480 !! input
3481 [[7%2525 Solution]]
3482 !! result
3483 <p>[[7%2525 Solution]]
3484 </p>
3485 !!end
3486
3487 !! test
3488 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3489 Example for such a section: == < ==
3490 !! input
3491 [[%23%3c]][[%23%3e]]
3492 !! result
3493 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3494 </p>
3495 !! end
3496
3497 !! test
3498 Link containing "<#" and ">#" as a hex sequences
3499 !! input
3500 [[%3c%23]][[%3e%23]]
3501 !! result
3502 <p>[[%3c%23]][[%3e%23]]
3503 </p>
3504 !! end
3505
3506 !! test
3507 Link containing double-single-quotes '' (bug 4598)
3508 !! input
3509 [[Lista d''e paise d''o munno]]
3510 !! result
3511 <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>
3512 </p>
3513 !! end
3514
3515 !! test
3516 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3517 !! input
3518 Some [[Link|pretty ''italics'' and stuff]]!
3519 !! result
3520 <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>!
3521 </p>
3522 !! end
3523
3524 !! test
3525 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3526 !! input
3527 ''Some [[Link|pretty ''italics'' and stuff]]!
3528 !! result
3529 <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>
3530 </p>
3531 !! end
3532
3533 !! test
3534 Link with double quotes in title part (literal) and alternate part (interpreted)
3535 !! input
3536 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3537
3538 [[''Pentecoste'']]
3539
3540 [[''Pentecoste''|Pentecoste]]
3541
3542 [[''Pentecoste''|''Pentecoste'']]
3543 !! result
3544 <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>
3545 </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>
3546 </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>
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)"><i>Pentecoste</i></a>
3548 </p>
3549 !! end
3550
3551 !! test
3552 Broken image links with HTML captions (bug 39700)
3553 !! input
3554 [[File:Nonexistent|<script></script>]]
3555 [[File:Nonexistent|100px|<script></script>]]
3556 [[File:Nonexistent|&lt;]]
3557 [[File:Nonexistent|a<i>b</i>c]]
3558 !! result
3559 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3560 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3561 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3562 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3563 </p>
3564 !! end
3565
3566 !! test
3567 Plain link to URL
3568 !! input
3569 [[http://www.example.com]]
3570 !! result
3571 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3572 </p>
3573 !! end
3574
3575 !! test
3576 Plain link to URL with link text
3577 !! input
3578 [[http://www.example.com Link text]]
3579 !! result
3580 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3581 </p>
3582 !! end
3583
3584 !! test
3585 Plain link to protocol-relative URL
3586 !! input
3587 [[//www.example.com]]
3588 !! result
3589 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3590 </p>
3591 !! end
3592
3593 !! test
3594 Plain link to protocol-relative URL with link text
3595 !! input
3596 [[//www.example.com Link text]]
3597 !! result
3598 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3599 </p>
3600 !! end
3601
3602 !! test
3603 Plain link to page with question mark in title
3604 !! input
3605 [[A?b]]
3606
3607 [[A?b|Baz]]
3608 !! result
3609 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3610 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3611 </p>
3612 !! end
3613
3614
3615 # I'm fairly sure the expected result here is wrong.
3616 # We want these to be URL links, not pseudo-pages with URLs for titles....
3617 # However the current output is also pretty screwy.
3618 #
3619 # ----
3620 # I'm changing it to match the current output--it arguably makes more
3621 # sense in the light of the test above. Old expected result was:
3622 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3623 #</p>
3624 # But I think this test is bordering on "garbage in, garbage out" anyway.
3625 # -- wtm
3626 !! test
3627 Piped link to URL
3628 !! input
3629 Piped link to URL: [[http://www.example.com|an example URL]]
3630 !! result
3631 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3632 </p>
3633 !! end
3634
3635 !! test
3636 BUG 2: [[page|http://url/]] should link to page, not http://url/
3637 !! input
3638 [[Main Page|http://url/]]
3639 !! result
3640 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3641 </p>
3642 !! end
3643
3644 !! test
3645 BUG 337: Escaped self-links should be bold
3646 !! options
3647 title=[[Bug462]]
3648 !! input
3649 [[Bu&#103;462]] [[Bug462]]
3650 !! result
3651 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3652 </p>
3653 !! end
3654
3655 !! test
3656 Self-link to section should not be bold
3657 !! options
3658 title=[[Main Page]]
3659 !! input
3660 [[Main Page#section]]
3661 !! result
3662 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3663 </p>
3664 !! end
3665
3666 !! article
3667 00
3668 !! text
3669 This is 00.
3670 !! endarticle
3671
3672 !!test
3673 Self-link to numeric title
3674 !!options
3675 title=[[0]]
3676 !!input
3677 [[0]]
3678 !!result
3679 <p><strong class="selflink">0</strong>
3680 </p>
3681 !!end
3682
3683 !!test
3684 Link to numeric-equivalent title
3685 !!options
3686 title=[[0]]
3687 !!input
3688 [[00]]
3689 !!result
3690 <p><a href="/wiki/00" title="00">00</a>
3691 </p>
3692 !!end
3693
3694 !! test
3695 <nowiki> inside a link
3696 !! input
3697 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3698 !! result
3699 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3700 </p>
3701 !! end
3702
3703 !! test
3704 Non-breaking spaces in title
3705 !! input
3706 [[&nbsp; Main &nbsp; Page &nbsp;]]
3707 !! result
3708 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3709 </p>
3710 !!end
3711
3712 !! test
3713 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3714 !! options
3715 language=ca
3716 !! input
3717 '''[[Main Page]]'''
3718 !! result
3719 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3720 </p>
3721 !! end
3722
3723 !! test
3724 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3725 !! options
3726 language=ca
3727 !! input
3728 ''[[Main Page]]''
3729 !! result
3730 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3731 </p>
3732 !! end
3733
3734 !! test
3735 Internal link with en linktrail: no apostrophes (bug 27473)
3736 !! options
3737 language=en
3738 !! input
3739 [[Something]]'nice
3740 !! result
3741 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3742 </p>
3743 !! end
3744
3745 !! test
3746 Internal link with ca linktrail with apostrophes (bug 27473)
3747 !! options
3748 language=ca
3749 !! input
3750 [[Something]]'nice
3751 !! result
3752 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3753 </p>
3754 !! end
3755
3756 !! test
3757 Internal link with kaa linktrail with apostrophes (bug 27473)
3758 !! options
3759 language=kaa
3760 !! input
3761 [[Something]]'nice
3762 !! result
3763 <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>
3764 </p>
3765 !! end
3766
3767 !! test
3768 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
3769 !! input
3770 [[Foo| bar]]
3771
3772 [[Foo| ''bar'']]
3773
3774 [http://wp.org foo]
3775
3776 [http://wp.org ''foo'']
3777 !! result
3778 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
3779 </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>
3780 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
3781 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
3782 </p>
3783 !! end
3784
3785 ###
3786 ### Interwiki links (see maintenance/interwiki.sql)
3787 ###
3788
3789 !! test
3790 Inline interwiki link
3791 !! input
3792 [[MeatBall:SoftSecurity]]
3793 !! result
3794 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3795 </p>
3796 !! end
3797
3798 !! test
3799 Inline interwiki link with empty title (bug 2372)
3800 !! input
3801 [[MeatBall:]]
3802 !! result
3803 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3804 </p>
3805 !! end
3806
3807 !! test
3808 Interwiki link encoding conversion (bug 1636)
3809 !! input
3810 *[[Wikipedia:ro:Olteni&#0355;a]]
3811 *[[Wikipedia:ro:Olteni&#355;a]]
3812 !! result
3813 <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>
3814 </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>
3815 </li></ul>
3816
3817 !! end
3818
3819 !! test
3820 Interwiki link with fragment (bug 2130)
3821 !! input
3822 [[MeatBall:SoftSecurity#foo]]
3823 !! result
3824 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3825 </p>
3826 !! end
3827
3828 !! test
3829 Interlanguage link
3830 !! input
3831 Blah blah blah
3832 [[zh:Chinese]]
3833 !!result
3834 <p>Blah blah blah
3835 </p>
3836 !! end
3837
3838 !! test
3839 Double interlanguage link
3840 !! input
3841 Blah blah blah
3842 [[es:Spanish]]
3843 [[zh:Chinese]]
3844 !!result
3845 <p>Blah blah blah
3846 </p>
3847 !! end
3848
3849 !! test
3850 Interlanguage link, with prefix links
3851 !! options
3852 language=ln
3853 !! input
3854 Blah blah blah
3855 [[zh:Chinese]]
3856 !!result
3857 <p>Blah blah blah
3858 </p>
3859 !! end
3860
3861 !! test
3862 Double interlanguage link, with prefix links (bug 8897)
3863 !! options
3864 language=ln
3865 !! input
3866 Blah blah blah
3867 [[es:Spanish]]
3868 [[zh:Chinese]]
3869 !!result
3870 <p>Blah blah blah
3871 </p>
3872 !! end
3873
3874 !! test
3875 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3876 !! options
3877 language=ln
3878 !! input
3879 [[WW&nbsp;II]]
3880 !!result
3881 <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>
3882 </p>
3883 !! end
3884
3885 ##
3886 ## XHTML tidiness
3887 ###
3888
3889 !! test
3890 <br> to <br />
3891 !! input
3892 1<br>2<br />3
3893 !! result
3894 <p>1<br />2<br />3
3895 </p>
3896 !! end
3897
3898 !! test
3899 Broken br tag sanitization
3900 !! input
3901 </br>
3902 !! result
3903 <p>&lt;/br&gt;
3904 </p>
3905 !! end
3906
3907 !! test
3908 Incorrecly removing closing slashes from correctly formed XHTML
3909 !! input
3910 <br style="clear:both;" />
3911 !! result
3912 <p><br style="clear:both;" />
3913 </p>
3914 !! end
3915
3916 !! test
3917 Failing to transform badly formed HTML into correct XHTML
3918 !! input
3919 <br style="clear: left;">
3920 <br style="clear: right;">
3921 <br style="clear: both;">
3922 !! result
3923 <p><br style="clear: left;" />
3924 <br style="clear: right;" />
3925 <br style="clear: both;" />
3926 </p>
3927 !!end
3928
3929 !! test
3930 Handling html with a div self-closing tag
3931 !! input
3932 <div title />
3933 <div title/>
3934 <div title/ >
3935 <div title=bar />
3936 <div title=bar/>
3937 <div title=bar/ >
3938 !! result
3939 <p>&lt;div title /&gt;
3940 &lt;div title/&gt;
3941 </p>
3942 <div>
3943 <p>&lt;div title=bar /&gt;
3944 &lt;div title=bar/&gt;
3945 </p>
3946 <div title="bar/"></div>
3947 </div>
3948
3949 !! end
3950
3951 !! test
3952 Handling html with a br self-closing tag
3953 !! input
3954 <br title />
3955 <br title/>
3956 <br title/ >
3957 <br title=bar />
3958 <br title=bar/>
3959 <br title=bar/ >
3960 !! result
3961 <p><br title="title" />
3962 <br title="title" />
3963 <br />
3964 <br title="bar" />
3965 <br title="bar" />
3966 <br title="bar/" />
3967 </p>
3968 !! end
3969
3970 !! test
3971 Horizontal ruler (should it add that extra space?)
3972 !! input
3973 <hr>
3974 <hr >
3975 foo <hr
3976 > bar
3977 !! result
3978 <hr />
3979 <hr />
3980 foo <hr /> bar
3981
3982 !! end
3983
3984 !! test
3985 Horizontal ruler -- 4+ dashes render hr
3986 !! input
3987 ----
3988 !! result
3989 <hr />
3990
3991 !! end
3992
3993 !! test
3994 Horizontal ruler -- eats additional dashes on the same line
3995 !! input
3996 ---------
3997 !! result
3998 <hr />
3999
4000 !! end
4001
4002 !! test
4003 Horizontal ruler -- does not collaps dashes on consecutive lines
4004 !! input
4005 ----
4006 ----
4007 !! result
4008 <hr />
4009 <hr />
4010
4011 !! end
4012
4013 !! test
4014 Horizontal ruler -- <4 dashes render as plain text
4015 !! input
4016 ---
4017 !! result
4018 <p>---
4019 </p>
4020 !! end
4021
4022 !! test
4023 Horizontal ruler -- Supports content following dashes on same line
4024 !! input
4025 ---- Foo
4026 !! result
4027 <hr /> Foo
4028
4029 !! end
4030
4031 ###
4032 ### Block-level elements
4033 ###
4034 !! test
4035 Common list
4036 !! input
4037 *Common list
4038 * item 2
4039 *item 3
4040 !! result
4041 <ul><li>Common list
4042 </li><li> item 2
4043 </li><li>item 3
4044 </li></ul>
4045
4046 !! end
4047
4048 !! test
4049 Numbered list
4050 !! input
4051 #Numbered list
4052 #item 2
4053 # item 3
4054 !! result
4055 <ol><li>Numbered list
4056 </li><li>item 2
4057 </li><li> item 3
4058 </li></ol>
4059
4060 !! end
4061
4062 !! test
4063 Mixed list
4064 !! input
4065 *Mixed list
4066 *# with numbers
4067 ** and bullets
4068 *# and numbers
4069 *bullets again
4070 **bullet level 2
4071 ***bullet level 3
4072 ***#Number on level 4
4073 **bullet level 2
4074 **#Number on level 3
4075 **#Number on level 3
4076 *#number level 2
4077 *Level 1
4078 *** Level 3
4079 #** Level 3, but ordered
4080 !! result
4081 <ul><li>Mixed list
4082 <ol><li> with numbers
4083 </li></ol>
4084 <ul><li> and bullets
4085 </li></ul>
4086 <ol><li> and numbers
4087 </li></ol>
4088 </li><li>bullets again
4089 <ul><li>bullet level 2
4090 <ul><li>bullet level 3
4091 <ol><li>Number on level 4
4092 </li></ol>
4093 </li></ul>
4094 </li><li>bullet level 2
4095 <ol><li>Number on level 3
4096 </li><li>Number on level 3
4097 </li></ol>
4098 </li></ul>
4099 <ol><li>number level 2
4100 </li></ol>
4101 </li><li>Level 1
4102 <ul><li><ul><li> Level 3
4103 </li></ul>
4104 </li></ul>
4105 </li></ul>
4106 <ol><li><ul><li><ul><li> Level 3, but ordered
4107 </li></ul>
4108 </li></ul>
4109 </li></ol>
4110
4111 !! end
4112
4113 !! test
4114 Nested lists 1
4115 !! input
4116 *foo
4117 **bar
4118 !! result
4119 <ul><li>foo
4120 <ul><li>bar
4121 </li></ul>
4122 </li></ul>
4123
4124 !! end
4125
4126 !! test
4127 Nested lists 2
4128 !! input
4129 **foo
4130 *bar
4131 !! result
4132 <ul><li><ul><li>foo
4133 </li></ul>
4134 </li><li>bar
4135 </li></ul>
4136
4137 !! end
4138
4139 !! test
4140 Nested lists 3 (first element empty)
4141 !! input
4142 *
4143 **bar
4144 !! result
4145 <ul><li>
4146 <ul><li>bar
4147 </li></ul>
4148 </li></ul>
4149
4150 !! end
4151
4152 !! test
4153 Nested lists 4 (first element empty)
4154 !! input
4155 **
4156 *bar
4157 !! result
4158 <ul><li><ul><li>
4159 </li></ul>
4160 </li><li>bar
4161 </li></ul>
4162
4163 !! end
4164
4165 !! test
4166 Nested lists 5 (both elements empty)
4167 !! input
4168 **
4169 *
4170 !! result
4171 <ul><li><ul><li>
4172 </li></ul>
4173 </li><li>
4174 </li></ul>
4175
4176 !! end
4177
4178 !! test
4179 Nested lists 6 (both elements empty)
4180 !! input
4181 *
4182 **
4183 !! result
4184 <ul><li>
4185 <ul><li>
4186 </li></ul>
4187 </li></ul>
4188
4189 !! end
4190
4191 !! test
4192 Nested lists 7 (skip initial nesting levels)
4193 !! input
4194 *** foo
4195 !! result
4196 <ul><li><ul><li><ul><li> foo
4197 </li></ul>
4198 </li></ul>
4199 </li></ul>
4200
4201 !! end
4202
4203 !! test
4204 Nested lists 8 (multiple nesting transitions)
4205 !! input
4206 * foo
4207 *** bar
4208 ** baz
4209 * boo
4210 !! result
4211 <ul><li> foo
4212 <ul><li><ul><li> bar
4213 </li></ul>
4214 </li><li> baz
4215 </li></ul>
4216 </li><li> boo
4217 </li></ul>
4218
4219 !! end
4220
4221 !! test
4222 1. Lists with start-of-line-transparent tokens before bullets: Comments
4223 !! input
4224 *foo
4225 *<!--cmt-->bar
4226 <!--cmt-->*baz
4227 !! result
4228 <ul><li>foo
4229 </li><li>bar
4230 </li><li>baz
4231 </li></ul>
4232
4233 !! end
4234
4235 !! test
4236 2. Lists with start-of-line-transparent tokens before bullets: Template close
4237 !! input
4238 *foo {{echo|bar
4239 }}*baz
4240 !! result
4241 <ul><li>foo bar
4242 </li><li>baz
4243 </li></ul>
4244
4245 !! end
4246
4247 !! test
4248 Unbalanced closing block tags break a list
4249 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4250 !! options
4251 disabled
4252 !! input
4253 <div>
4254 *a</div><div>
4255 *b</div>
4256 !! result
4257 <div>
4258 <ul><li>a
4259 </li></ul></div><div>
4260 <ul><li>b
4261 </li></ul></div>
4262 !! end
4263
4264 !! test
4265 Unbalanced closing non-block tags don't break a list
4266 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4267 !! options
4268 disabled
4269 !! input
4270 <span>
4271 *a</span><span>
4272 *b</span>
4273 !! result
4274 <p><span></span>
4275 </p>
4276 <ul><li>a<span></span>
4277 </li><li>b
4278 </li></ul>
4279 !! end
4280
4281 !! test
4282 Unclosed formatting tags that straddle lists are closed and reopened
4283 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4284 !! options
4285 disabled
4286 !! input
4287 # <s> a
4288 # b </s>
4289 !! result
4290 <ol><li> <s> a </s>
4291 </li><li> <s> b </s>
4292 </li></ol>
4293 !! end
4294
4295 !!test
4296 List embedded in a non-block tag
4297 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4298 !! options
4299 disabled
4300 !!input
4301 <small>
4302 * foo
4303 </small>
4304 !!result
4305 <p><small></small></p>
4306 <small>
4307 <ul>
4308 <li> foo</li>
4309 </ul>
4310 </small>
4311 <p><small></small></p>
4312 !!end
4313
4314 !! test
4315 List items are not parsed correctly following a <pre> block (bug 785)
4316 !! input
4317 * <pre>foo</pre>
4318 * <pre>bar</pre>
4319 * zar
4320 !! result
4321 <ul><li> <pre>foo</pre>
4322 </li><li> <pre>bar</pre>
4323 </li><li> zar
4324 </li></ul>
4325
4326 !! end
4327
4328 !! test
4329 List items from template
4330 !! input
4331
4332 {{inner list}}
4333 * item 2
4334
4335 * item 0
4336 {{inner list}}
4337 * item 2
4338
4339 * item 0
4340 * notSOL{{inner list}}
4341 * item 2
4342 !! result
4343 <ul><li> item 1
4344 </li><li> item 2
4345 </li></ul>
4346 <ul><li> item 0
4347 </li><li> item 1
4348 </li><li> item 2
4349 </li></ul>
4350 <ul><li> item 0
4351 </li><li> notSOL
4352 </li><li> item 1
4353 </li><li> item 2
4354 </li></ul>
4355
4356 !! end
4357
4358 !! test
4359 List interrupted by empty line or heading
4360 !! input
4361 * foo
4362
4363 ** bar
4364 == A heading ==
4365 * Another list item
4366 !! result
4367 <ul><li> foo
4368 </li></ul>
4369 <ul><li><ul><li> bar
4370 </li></ul>
4371 </li></ul>
4372 <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>
4373 <ul><li> Another list item
4374 </li></ul>
4375
4376 !!end
4377
4378 !!test
4379 Multiple list tags generated by templates
4380 !!input
4381 {{echo|<li>}}a
4382 {{echo|<li>}}b
4383 {{echo|<li>}}c
4384 !!result
4385 <li>a
4386 <li>b
4387 <li>c</li>
4388 </li>
4389 </li>
4390
4391 !!end
4392
4393 ###
4394 ### Magic Words
4395 ###
4396
4397 !! test
4398 Magic Word: {{CURRENTDAY}}
4399 !! input
4400 {{CURRENTDAY}}
4401 !! result
4402 <p>1
4403 </p>
4404 !! end
4405
4406 !! test
4407 Magic Word: {{CURRENTDAY2}}
4408 !! input
4409 {{CURRENTDAY2}}
4410 !! result
4411 <p>01
4412 </p>
4413 !! end
4414
4415 !! test
4416 Magic Word: {{CURRENTDAYNAME}}
4417 !! input
4418 {{CURRENTDAYNAME}}
4419 !! result
4420 <p>Thursday
4421 </p>
4422 !! end
4423
4424 !! test
4425 Magic Word: {{CURRENTDOW}}
4426 !! input
4427 {{CURRENTDOW}}
4428 !! result
4429 <p>4
4430 </p>
4431 !! end
4432
4433 !! test
4434 Magic Word: {{CURRENTMONTH}}
4435 !! input
4436 {{CURRENTMONTH}}
4437 !! result
4438 <p>01
4439 </p>
4440 !! end
4441
4442 !! test
4443 Magic Word: {{CURRENTMONTHABBREV}}
4444 !! input
4445 {{CURRENTMONTHABBREV}}
4446 !! result
4447 <p>Jan
4448 </p>
4449 !! end
4450
4451 !! test
4452 Magic Word: {{CURRENTMONTHNAME}}
4453 !! input
4454 {{CURRENTMONTHNAME}}
4455 !! result
4456 <p>January
4457 </p>
4458 !! end
4459
4460 !! test
4461 Magic Word: {{CURRENTMONTHNAMEGEN}}
4462 !! input
4463 {{CURRENTMONTHNAMEGEN}}
4464 !! result
4465 <p>January
4466 </p>
4467 !! end
4468
4469 !! test
4470 Magic Word: {{CURRENTTIME}}
4471 !! input
4472 {{CURRENTTIME}}
4473 !! result
4474 <p>00:02
4475 </p>
4476 !! end
4477
4478 !! test
4479 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4480 !! input
4481 {{CURRENTWEEK}}
4482 !! result
4483 <p>1
4484 </p>
4485 !! end
4486
4487 !! test
4488 Magic Word: {{CURRENTYEAR}}
4489 !! input
4490 {{CURRENTYEAR}}
4491 !! result
4492 <p>1970
4493 </p>
4494 !! end
4495
4496 !! test
4497 Magic Word: {{FULLPAGENAME}}
4498 !! options
4499 title=[[User:Ævar Arnfjörð Bjarmason]]
4500 !! input
4501 {{FULLPAGENAME}}
4502 !! result
4503 <p>User:Ævar Arnfjörð Bjarmason
4504 </p>
4505 !! end
4506
4507 !! test
4508 Magic Word: {{FULLPAGENAMEE}}
4509 !! options
4510 title=[[User:Ævar Arnfjörð Bjarmason]]
4511 !! input
4512 {{FULLPAGENAMEE}}
4513 !! result
4514 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4515 </p>
4516 !! end
4517
4518 !! test
4519 Magic Word: {{NAMESPACE}}
4520 !! options
4521 title=[[User:Ævar Arnfjörð Bjarmason]]
4522 !! input
4523 {{NAMESPACE}}
4524 !! result
4525 <p>User
4526 </p>
4527 !! end
4528
4529 !! test
4530 Magic Word: {{NAMESPACEE}}
4531 !! options
4532 title=[[User:Ævar Arnfjörð Bjarmason]]
4533 !! input
4534 {{NAMESPACEE}}
4535 !! result
4536 <p>User
4537 </p>
4538 !! end
4539
4540 !! test
4541 Magic Word: {{NAMESPACENUMBER}}
4542 !! options
4543 title=[[User:Ævar Arnfjörð Bjarmason]]
4544 !! input
4545 {{NAMESPACENUMBER}}
4546 !! result
4547 <p>2
4548 </p>
4549 !! end
4550
4551 !! test
4552 Magic Word: {{NUMBEROFFILES}}
4553 !! input
4554 {{NUMBEROFFILES}}
4555 !! result
4556 <p>2
4557 </p>
4558 !! end
4559
4560 !! test
4561 Magic Word: {{PAGENAME}}
4562 !! options
4563 title=[[User:Ævar Arnfjörð Bjarmason]]
4564 !! input
4565 {{PAGENAME}}
4566 !! result
4567 <p>Ævar Arnfjörð Bjarmason
4568 </p>
4569 !! end
4570
4571 !! test
4572 Magic Word: {{PAGENAME}} with metacharacters
4573 !! options
4574 title=[['foo & bar = baz']]
4575 !! input
4576 ''{{PAGENAME}}''
4577 !! result
4578 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4579 </p>
4580 !! end
4581
4582 !! test
4583 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4584 !! options
4585 title=[[*RFC 1234 http://example.com/]]
4586 !! input
4587 {{PAGENAME}}
4588 !! result
4589 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4590 </p>
4591 !! end
4592
4593 !! test
4594 Magic Word: {{PAGENAMEE}}
4595 !! options
4596 title=[[User:Ævar Arnfjörð Bjarmason]]
4597 !! input
4598 {{PAGENAMEE}}
4599 !! result
4600 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4601 </p>
4602 !! end
4603
4604 !! test
4605 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4606 !! options
4607 title=[[*RFC 1234 http://example.com/]]
4608 !! input
4609 {{PAGENAMEE}}
4610 !! result
4611 <p>&#42;RFC_1234_http&#58;//example.com/
4612 </p>
4613 !! end
4614
4615 !! test
4616 Magic Word: {{REVISIONID}}
4617 !! input
4618 {{REVISIONID}}
4619 !! result
4620 <p>1337
4621 </p>
4622 !! end
4623
4624 !! test
4625 Magic Word: {{SCRIPTPATH}}
4626 !! input
4627 {{SCRIPTPATH}}
4628 !! result
4629 <p>/
4630 </p>
4631 !! end
4632
4633 !! test
4634 Magic Word: {{SERVER}}
4635 !! input
4636 {{SERVER}}
4637 !! result
4638 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4639 </p>
4640 !! end
4641
4642 !! test
4643 Magic Word: {{SERVERNAME}}
4644 !! input
4645 {{SERVERNAME}}
4646 !! result
4647 <p>example.org
4648 </p>
4649 !! end
4650
4651 !! test
4652 Magic Word: {{SITENAME}}
4653 !! input
4654 {{SITENAME}}
4655 !! result
4656 <p>MediaWiki
4657 </p>
4658 !! end
4659
4660 !! test
4661 Namespace 1 {{ns:1}}
4662 !! input
4663 {{ns:1}}
4664 !! result
4665 <p>Talk
4666 </p>
4667 !! end
4668
4669 !! test
4670 Namespace 1 {{ns:01}}
4671 !! input
4672 {{ns:01}}
4673 !! result
4674 <p>Talk
4675 </p>
4676 !! end
4677
4678 !! test
4679 Namespace 0 {{ns:0}} (bug 4783)
4680 !! input
4681 {{ns:0}}
4682 !! result
4683
4684 !! end
4685
4686 !! test
4687 Namespace 0 {{ns:00}} (bug 4783)
4688 !! input
4689 {{ns:00}}
4690 !! result
4691
4692 !! end
4693
4694 !! test
4695 Namespace -1 {{ns:-1}}
4696 !! input
4697 {{ns:-1}}
4698 !! result
4699 <p>Special
4700 </p>
4701 !! end
4702
4703 !! test
4704 Namespace User {{ns:User}}
4705 !! input
4706 {{ns:User}}
4707 !! result
4708 <p>User
4709 </p>
4710 !! end
4711
4712 !! test
4713 Namespace User talk {{ns:User_talk}}
4714 !! input
4715 {{ns:User_talk}}
4716 !! result
4717 <p>User talk
4718 </p>
4719 !! end
4720
4721 !! test
4722 Namespace User talk {{ns:uSeR tAlK}}
4723 !! input
4724 {{ns:uSeR tAlK}}
4725 !! result
4726 <p>User talk
4727 </p>
4728 !! end
4729
4730 !! test
4731 Namespace File {{ns:File}}
4732 !! input
4733 {{ns:File}}
4734 !! result
4735 <p>File
4736 </p>
4737 !! end
4738
4739 !! test
4740 Namespace File {{ns:Image}}
4741 !! input
4742 {{ns:Image}}
4743 !! result
4744 <p>File
4745 </p>
4746 !! end
4747
4748 !! test
4749 Namespace (lang=de) Benutzer {{ns:User}}
4750 !! options
4751 language=de
4752 !! input
4753 {{ns:User}}
4754 !! result
4755 <p>Benutzer
4756 </p>
4757 !! end
4758
4759 !! test
4760 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4761 !! options
4762 language=de
4763 !! input
4764 {{ns:3}}
4765 !! result
4766 <p>Benutzer Diskussion
4767 </p>
4768 !! end
4769
4770
4771 !! test
4772 Urlencode
4773 !! input
4774 {{urlencode:hi world?!}}
4775 {{urlencode:hi world?!|WIKI}}
4776 {{urlencode:hi world?!|PATH}}
4777 {{urlencode:hi world?!|QUERY}}
4778 !! result
4779 <p>hi+world%3F%21
4780 hi_world%3F!
4781 hi%20world%3F%21
4782 hi+world%3F%21
4783 </p>
4784 !! end
4785
4786 ###
4787 ### Magic links
4788 ###
4789 !! test
4790 Magic links: internal link to RFC (bug 479)
4791 !! input
4792 [[RFC 123]]
4793 !! result
4794 <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>
4795 </p>
4796 !! end
4797
4798 !! test
4799 Magic links: RFC (bug 479)
4800 !! input
4801 RFC 822
4802 !! result
4803 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4804 </p>
4805 !! end
4806
4807 !! test
4808 Magic links: ISBN (bug 1937)
4809 !! input
4810 ISBN 0-306-40615-2
4811 !! result
4812 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4813 </p>
4814 !! end
4815
4816 !! test
4817 Magic links: PMID incorrectly converts space to underscore
4818 !! input
4819 PMID 1234
4820 !! result
4821 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4822 </p>
4823 !! end
4824
4825 ###
4826 ### Templates
4827 ####
4828
4829 !! test
4830 Nonexistent template
4831 !! input
4832 {{thistemplatedoesnotexist}}
4833 !! result
4834 <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>
4835 </p>
4836 !! end
4837
4838 !! test
4839 Template with invalid target containing tags
4840 !! input
4841 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4842 !! result
4843 <p>{{a<b>b</b>|foo|a=b|a = b}}
4844 </p>
4845 !! end
4846
4847 !! test
4848 Template with invalid target containing unclosed tag
4849 !! input
4850 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4851 !! result
4852 <p>{{a<b>|foo|a=b|a = b}}</b>
4853 </p>
4854 !! end
4855
4856 !! article
4857 Template:test
4858 !! text
4859 This is a test template
4860 !! endarticle
4861
4862 !! test
4863 Simple template
4864 !! input
4865 {{test}}
4866 !! result
4867 <p>This is a test template
4868 </p>
4869 !! end
4870
4871 !! test
4872 Template with explicit namespace
4873 !! input
4874 {{Template:test}}
4875 !! result
4876 <p>This is a test template
4877 </p>
4878 !! end
4879
4880
4881 !! article
4882 Template:paramtest
4883 !! text
4884 This is a test template with parameter {{{param}}}
4885 !! endarticle
4886
4887 !! test
4888 Template parameter
4889 !! input
4890 {{paramtest|param=foo}}
4891 !! result
4892 <p>This is a test template with parameter foo
4893 </p>
4894 !! end
4895
4896 !! article
4897 Template:paramtestnum
4898 !! text
4899 [[{{{1}}}|{{{2}}}]]
4900 !! endarticle
4901
4902 !! test
4903 Template unnamed parameter
4904 !! input
4905 {{paramtestnum|Main Page|the main page}}
4906 !! result
4907 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4908 </p>
4909 !! end
4910
4911 !! article
4912 Template:templatesimple
4913 !! text
4914 (test)
4915 !! endarticle
4916
4917 !! article
4918 Template:templateredirect
4919 !! text
4920 #redirect [[Template:templatesimple]]
4921 !! endarticle
4922
4923 !! article
4924 Template:templateasargtestnum
4925 !! text
4926 {{{{{1}}}}}
4927 !! endarticle
4928
4929 !! article
4930 Template:templateasargtest
4931 !! text
4932 {{template{{{templ}}}}}
4933 !! endarticle
4934
4935 !! article
4936 Template:templateasargtest2
4937 !! text
4938 {{{{{templ}}}}}
4939 !! endarticle
4940
4941 !! test
4942 Template with template name as unnamed argument
4943 !! input
4944 {{templateasargtestnum|templatesimple}}
4945 !! result
4946 <p>(test)
4947 </p>
4948 !! end
4949
4950 !! test
4951 Template with template name as argument
4952 !! input
4953 {{templateasargtest|templ=simple}}
4954 !! result
4955 <p>(test)
4956 </p>
4957 !! end
4958
4959 !! test
4960 Template with template name as argument (2)
4961 !! input
4962 {{templateasargtest2|templ=templatesimple}}
4963 !! result
4964 <p>(test)
4965 </p>
4966 !! end
4967
4968 !! article
4969 Template:templateasargtestdefault
4970 !! text
4971 {{{{{templ|templatesimple}}}}}
4972 !! endarticle
4973
4974 !! article
4975 Template:templa
4976 !! text
4977 '''templ'''
4978 !! endarticle
4979
4980 !! test
4981 Template with default value
4982 !! input
4983 {{templateasargtestdefault}}
4984 !! result
4985 <p>(test)
4986 </p>
4987 !! end
4988
4989 !! test
4990 Template with default value (value set)
4991 !! input
4992 {{templateasargtestdefault|templ=templa}}
4993 !! result
4994 <p><b>templ</b>
4995 </p>
4996 !! end
4997
4998 !! test
4999 Template redirect
5000 !! input
5001 {{templateredirect}}
5002 !! result
5003 <p>(test)
5004 </p>
5005 !! end
5006
5007 !! test
5008 Template with argument in separate line
5009 !! input
5010 {{ templateasargtest |
5011 templ = simple }}
5012 !! result
5013 <p>(test)
5014 </p>
5015 !! end
5016
5017 !! test
5018 Template with complex template as argument
5019 !! input
5020 {{paramtest|
5021 param ={{ templateasargtest |
5022 templ = simple }}}}
5023 !! result
5024 <p>This is a test template with parameter (test)
5025 </p>
5026 !! end
5027
5028 !! test
5029 Template with thumb image (with link in description)
5030 !! input
5031 {{paramtest|
5032 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5033 !! result
5034 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>
5035
5036 !! end
5037
5038 !! article
5039 Template:complextemplate
5040 !! text
5041 {{{1}}} {{paramtest|
5042 param ={{{param}}}}}
5043 !! endarticle
5044
5045 !! test
5046 Template with complex arguments
5047 !! input
5048 {{complextemplate|
5049 param ={{ templateasargtest |
5050 templ = simple }}|[[Template:complextemplate|link]]}}
5051 !! result
5052 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5053 </p>
5054 !! end
5055
5056 !! test
5057 BUG 553: link with two variables in a piped link
5058 !! input
5059 {|
5060 |[[{{{1}}}|{{{2}}}]]
5061 |}
5062 !! result
5063 <table>
5064 <tr>
5065 <td>[[{{{1}}}|{{{2}}}]]
5066 </td></tr></table>
5067
5068 !! end
5069
5070 !! test
5071 Magic variable as template parameter
5072 !! input
5073 {{paramtest|param={{SITENAME}}}}
5074 !! result
5075 <p>This is a test template with parameter MediaWiki
5076 </p>
5077 !! end
5078
5079 !! article
5080 Template:linktest
5081 !! text
5082 [[{{{param}}}|link]]
5083 !! endarticle
5084
5085 !! test
5086 Template parameter as link source
5087 !! input
5088 {{linktest|param=Main Page}}
5089 !! result
5090 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5091 </p>
5092 !! end
5093
5094 !!test
5095 Template-generated attribute string (k='v')
5096 !!input
5097 <span {{attr_str|id|v1}}>bar</span>
5098 !!result
5099 <p><span id="v1">bar</span>
5100 </p>
5101 !!end
5102
5103 !!article
5104 Template:paramtest2
5105 !! text
5106 including another template, {{paramtest|param={{{arg}}}}}
5107 !! endarticle
5108
5109 !! test
5110 Template passing argument to another template
5111 !! input
5112 {{paramtest2|arg='hmm'}}
5113 !! result
5114 <p>including another template, This is a test template with parameter 'hmm'
5115 </p>
5116 !! end
5117
5118 !! article
5119 Template:Linktest2
5120 !! text
5121 Main Page
5122 !! endarticle
5123
5124 !! test
5125 Template as link source
5126 !! input
5127 [[{{linktest2}}]]
5128
5129 [[{{linktest2}}|Main Page]]
5130
5131 [[{{linktest2}}]]Page
5132 !! result
5133 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5134 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5135 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5136 </p>
5137 !! end
5138
5139
5140 !! article
5141 Template:loop1
5142 !! text
5143 {{loop2}}
5144 !! endarticle
5145
5146 !! article
5147 Template:loop2
5148 !! text
5149 {{loop1}}
5150 !! endarticle
5151
5152 !! test
5153 Template infinite loop
5154 !! input
5155 {{loop1}}
5156 !! result
5157 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5158 </p>
5159 !! end
5160
5161 !! test
5162 Template from main namespace
5163 !! input
5164 {{:Main Page}}
5165 !! result
5166 <p>blah blah
5167 </p>
5168 !! end
5169
5170 !! article
5171 Template:table
5172 !! text
5173 {|
5174 | 1 || 2
5175 |-
5176 | 3 || 4
5177 |}
5178 !! endarticle
5179
5180 !! test
5181 BUG 529: Template with table, not included at beginning of line
5182 !! input
5183 foo {{table}}
5184 !! result
5185 <p>foo
5186 </p>
5187 <table>
5188 <tr>
5189 <td> 1 </td>
5190 <td> 2
5191 </td></tr>
5192 <tr>
5193 <td> 3 </td>
5194 <td> 4
5195 </td></tr></table>
5196
5197 !! end
5198
5199 !! test
5200 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5201 !! input
5202 foo
5203 {{table}}
5204 !! result
5205 <p>foo
5206 </p>
5207 <table>
5208 <tr>
5209 <td> 1 </td>
5210 <td> 2
5211 </td></tr>
5212 <tr>
5213 <td> 3 </td>
5214 <td> 4
5215 </td></tr></table>
5216
5217 !! end
5218
5219 !! test
5220 BUG 41: Template parameters shown as broken links
5221 !! input
5222 {{{parameter}}}
5223 !! result
5224 <p>{{{parameter}}}
5225 </p>
5226 !! end
5227
5228 !! test
5229 Template with targets containing wikilinks
5230 !! input
5231 {{[[foo]]}}
5232
5233 {{[[{{echo|foo}}]]}}
5234
5235 {{{{echo|[[foo}}]]}}
5236 !! result
5237 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5238 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5239 </p><p>{{[[foo}}]]
5240 </p>
5241 !! end
5242
5243 !! article
5244 Template:MSGNW test
5245 !! text
5246 ''None'' of '''this''' should be
5247 * interpreted
5248 but rather passed unmodified
5249 {{test}}
5250 !! endarticle
5251
5252 # hmm, fix this or just deprecate msgnw and document its behavior?
5253 !! test
5254 msgnw keyword
5255 !! options
5256 disabled
5257 !! input
5258 {{msgnw:MSGNW test}}
5259 !! result
5260 <p>''None'' of '''this''' should be
5261 * interpreted
5262 but rather passed unmodified
5263 {{test}}
5264 </p>
5265 !! end
5266
5267 !! test
5268 int keyword
5269 !! input
5270 {{int:youhavenewmessages|lots of money|not!}}
5271 !! result
5272 <p>You have lots of money (not!).
5273 </p>
5274 !! end
5275
5276 !! article
5277 Template:Includes
5278 !! text
5279 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5280 !! endarticle
5281
5282 !! test
5283 <includeonly> and <noinclude> being included
5284 !! input
5285 {{Includes}}
5286 !! result
5287 <p>Foobar
5288 </p>
5289 !! end
5290
5291 !! article
5292 Template:Includes2
5293 !! text
5294 <onlyinclude>Foo</onlyinclude>bar
5295 !! endarticle
5296
5297 !! test
5298 <onlyinclude> being included
5299 !! input
5300 {{Includes2}}
5301 !! result
5302 <p>Foo
5303 </p>
5304 !! end
5305
5306
5307 !! article
5308 Template:Includes3
5309 !! text
5310 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5311 !! endarticle
5312
5313 !! test
5314 <onlyinclude> and <includeonly> being included
5315 !! input
5316 {{Includes3}}
5317 !! result
5318 <p>Foo
5319 </p>
5320 !! end
5321
5322 !! test
5323 <includeonly> and <noinclude> on a page
5324 !! input
5325 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5326 !! result
5327 <p>Foozar
5328 </p>
5329 !! end
5330
5331 !! test
5332 Un-closed <noinclude>
5333 !! input
5334 <noinclude>
5335 !! result
5336 !! end
5337
5338 !! test
5339 <onlyinclude> on a page
5340 !! input
5341 <onlyinclude>Foo</onlyinclude>bar
5342 !! result
5343 <p>Foobar
5344 </p>
5345 !! end
5346
5347 !! test
5348 Un-closed <onlyinclude>
5349 !! input
5350 <onlyinclude>
5351 !! result
5352 !! end
5353
5354 !!test
5355 Self-closed noinclude, includeonly, onlyinclude tags
5356 !!input
5357 <noinclude />
5358 <includeonly />
5359 <onlyinclude />
5360 !!result
5361 <p><br />
5362 </p>
5363 !!end
5364
5365 !!test
5366 Unbalanced includeonly and noinclude tags
5367 !!input
5368 {|
5369 |a</noinclude>
5370 |b</noinclude></noinclude>
5371 |c</noinclude></includeonly>
5372 |d</includeonly></includeonly>
5373 |}
5374 !!result
5375 <table>
5376 <tr>
5377 <td>a
5378 </td>
5379 <td>b
5380 </td>
5381 <td>c&lt;/includeonly&gt;
5382 </td>
5383 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5384 </td></tr></table>
5385
5386 !!end
5387
5388 !! article
5389 Template:Includeonly section
5390 !! text
5391 <includeonly>
5392 ==Includeonly section==
5393 </includeonly>
5394 ==Section T-1==
5395 !!endarticle
5396
5397 !! test
5398 Bug 6563: Edit link generation for section shown by <includeonly>
5399 !! input
5400 {{includeonly section}}
5401 !! result
5402 <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>
5403 <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>
5404
5405 !! end
5406
5407 # Uses same input as the contents of [[Template:Includeonly section]]
5408 !! test
5409 Bug 6563: Section extraction for section shown by <includeonly>
5410 !! options
5411 section=T-2
5412 !! input
5413 <includeonly>
5414 ==Includeonly section==
5415 </includeonly>
5416 ==Section T-2==
5417 !! result
5418 ==Section T-2==
5419 !! end
5420
5421 !! test
5422 Bug 6563: Edit link generation for section suppressed by <includeonly>
5423 !! input
5424 <includeonly>
5425 ==Includeonly section==
5426 </includeonly>
5427 ==Section 1==
5428 !! result
5429 <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>
5430
5431 !! end
5432
5433 !! test
5434 Bug 6563: Section extraction for section suppressed by <includeonly>
5435 !! options
5436 section=1
5437 !! input
5438 <includeonly>
5439 ==Includeonly section==
5440 </includeonly>
5441 ==Section 1==
5442 !! result
5443 ==Section 1==
5444 !! end
5445
5446 !! test
5447 Un-closed <includeonly>
5448 !! input
5449 <includeonly>
5450 !! result
5451 !! end
5452
5453 ###
5454 ### <includeonly> and <noinclude> in attributes
5455 ###
5456 !!test
5457 0. includeonly around the entire attribute
5458 !!input
5459 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5460 !!result
5461 <p><span id="v2">bar</span>
5462 </p>
5463 !!end
5464
5465 !!test
5466 1. includeonly in html attr key
5467 !!input
5468 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5469 !!result
5470 <p><span id="foo">bar</span>
5471 </p>
5472 !!end
5473
5474 !!test
5475 2. includeonly in html attr value
5476 !!input
5477 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5478 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5479 !!result
5480 <p><span id="v1">bar</span>
5481 <span id="v1">bar</span>
5482 </p>
5483 !!end
5484
5485 !!test
5486 3. includeonly in part of an attr value
5487 !!input
5488 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5489 !!result
5490 <p><span style="color:red;">bar</span>
5491 </p>
5492 !!end
5493
5494 ###
5495 ### Testing parsing of templates where a template arg
5496 ### has the same name as the template itself.
5497 ###
5498
5499 !! article
5500 Template:quote
5501 !! text
5502 {{{quote|{{{1}}}}}}
5503 !! endarticle
5504
5505 !!test
5506 Templates: Template Name/Arg clash: 1. Use of positional param
5507 !!input
5508 {{quote|foo}}
5509 !!result
5510 <p>foo
5511 </p>
5512 !!end
5513
5514 !!test
5515 Templates: Template Name/Arg clash: 2. Use of named param
5516 !!input
5517 {{quote|quote=foo}}
5518 !!result
5519 <p>foo
5520 </p>
5521 !!end
5522
5523 !!test
5524 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5525 !!input
5526 {{quote|quote}}
5527 !!result
5528 <p>quote
5529 </p>
5530 !!end
5531
5532 ###
5533 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5534 ###
5535
5536 !!test
5537 Templates: 1. Simple use
5538 !!input
5539 {{echo|Foo}}
5540 !!result
5541 <p>Foo
5542 </p>
5543 !!end
5544
5545 !!test
5546 Templates: 2. Inside a block tag
5547 !!input
5548 <div>{{echo|Foo}}</div>
5549 !!result
5550 <div>Foo</div>
5551
5552 !!end
5553
5554 !!test
5555 Templates: P-wrapping: 1a. Templates on consecutive lines
5556 !!input
5557 {{echo|Foo}}
5558 {{echo|bar}}
5559 !!result
5560 <p>Foo
5561 bar
5562 </p>
5563 !!end
5564
5565 !!test
5566 Templates: P-wrapping: 1b. Templates on consecutive lines
5567 !!input
5568 Foo
5569
5570 {{echo|bar}}
5571 {{echo|baz}}
5572 !!result
5573 <p>Foo
5574 </p><p>bar
5575 baz
5576 </p>
5577 !!end
5578
5579 !!test
5580 Templates: P-wrapping: 1c. Templates on consecutive lines
5581 !!input
5582 {{echo|Foo}}
5583 {{echo|bar}} <div>baz</div>
5584 !!result
5585 <p>Foo
5586 </p>
5587 bar <div>baz</div>
5588
5589 !!end
5590
5591 !!test
5592 Templates: Inline Text: 1. Multiple tmeplate uses
5593 !!input
5594 {{echo|Foo}}bar{{echo|baz}}
5595 !!result
5596 <p>Foobarbaz
5597 </p>
5598 !!end
5599
5600 !!test
5601 Templates: Inline Text: 2. Back-to-back template uses
5602 !!input
5603 {{echo|Foo}}{{echo|bar}}
5604 !!result
5605 <p>Foobar
5606 </p>
5607 !!end
5608
5609 !!test
5610 Templates: Block Tags: 1. Multiple template uses
5611 !!input
5612 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5613 !!result
5614 <div>Foo</div><div>bar</div><div>baz</div>
5615
5616 !!end
5617
5618 !!test
5619 Templates: Block Tags: 2. Back-to-back template uses
5620 !!input
5621 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5622 !!result
5623 <div>Foo</div><div>bar</div>
5624
5625 !!end
5626
5627 !!test
5628 Templates: Links: 1. Simple example
5629 !!input
5630 {{echo|[[Foo|bar]]}}
5631 !!result
5632 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5633 </p>
5634 !!end
5635
5636 !!test
5637 Templates: Links: 2. Generation of link href
5638 !!input
5639 [[{{echo|Foo}}|bar]]
5640 !!result
5641 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5642 </p>
5643 !!end
5644
5645 !!test
5646 Templates: Links: 3. Generation of part of a link href
5647 !!input
5648 [[Fo{{echo|o}}|bar]]
5649
5650 [[Foo{{echo|bar}}]]
5651
5652 [[Foo{{echo|bar}}baz]]
5653
5654 [[Foo{{echo|bar}}|bar]]
5655
5656 [[:Foo{{echo|bar}}]]
5657
5658 [[:Foo{{echo|bar}}|bar]]
5659 !!result
5660 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5661 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5662 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5663 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5664 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</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>
5667 !!end
5668
5669 !!test
5670 Templates: Links: 4. Multiple templates generating link href
5671 !!input
5672 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5673 !!result
5674 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5675 </p>
5676 !!end
5677
5678 !!test
5679 Templates: Links: 5. Generation of link text
5680 !!input
5681 [[Foo|{{echo|bar}}]]
5682 !!result
5683 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5684 </p>
5685 !!end
5686
5687 !!test
5688 Templates: Links: 5. Nested templates (only outermost template should be marked)
5689 !!input
5690 {{echo|[[{{echo|Foo}}|bar]]}}
5691 !!result
5692 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5693 </p>
5694 !!end
5695
5696 !!test
5697 Templates: HTML Tag: 1. Generation of HTML attr. key
5698 !!input
5699 <div {{echo|style}}="color:red;">foo</div>
5700 !!result
5701 <div style="color:red;">foo</div>
5702
5703 !!end
5704
5705 !!test
5706 Templates: HTML Tag: 2. Generation of HTML attr. value
5707 !!input
5708 <div style={{echo|'color:red;'}}>foo</div>
5709 !!result
5710 <div style="color:red;">foo</div>
5711
5712 !!end
5713
5714 !!test
5715 Templates: HTML Tag: 3. Generation of HTML attr key and value
5716 !!input
5717 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5718 !!result
5719 <div style="color:red;">foo</div>
5720
5721 !!end
5722
5723 !!test
5724 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5725 !!input
5726 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5727 !!result
5728 <div title="This is a long title with just one piece templated">foo</div>
5729
5730 !!end
5731
5732 !!test
5733 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5734 !!input
5735 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5736 !!result
5737 <div title="This is a long title with just one piece templated">foo</div>
5738
5739 !!end
5740
5741 !!test
5742 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5743 !!input
5744 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
5745 !!result
5746 <div title="This is a long title with just one piece templated">foo</div>
5747
5748 !!end
5749
5750 !!test
5751 Templates: HTML Tables: 1. Generating start of a HTML table
5752 !!input
5753 {{echo|<table><tr><td>foo</td>}}</tr></table>
5754 !!result
5755 <table><tr><td>foo</td></tr></table>
5756
5757 !!end
5758
5759 !!test
5760 Templates: HTML Tables: 2a. Generating middle of a HTML table
5761 !!input
5762 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5763 !!result
5764 <table><tr><td>foo</td></tr></table>
5765
5766 !!end
5767
5768 !!test
5769 Templates: HTML Tables: 2b. Generating middle of a HTML table
5770 !!input
5771 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5772 !!result
5773 <table><tr><td>foo</td></tr></table>
5774
5775 !!end
5776
5777 !!test
5778 Templates: HTML Tables: 3. Generating end of a HTML table
5779 !!input
5780 <table><tr>{{echo|<td>foo</td></tr></table>}}
5781 !!result
5782 <table><tr><td>foo</td></tr></table>
5783
5784 !!end
5785
5786 !!test
5787 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5788 !!input
5789 {{echo|<table>}}<tr><td>foo</td></tr></table>
5790 !!result
5791 <table><tr><td>foo</td></tr></table>
5792
5793 !!end
5794
5795 !!test
5796 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5797 !!input
5798 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5799 !!result
5800 <table><tr><td>foo</td></tr></table>
5801
5802 !!end
5803
5804 !!test
5805 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5806 !!input
5807 <table><tr>{{echo|<td>}}foo</td></tr></table>
5808 !!result
5809 <table><tr><td>foo</td></tr></table>
5810
5811 !!end
5812
5813 !!test
5814 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5815 !!input
5816 <table><tr><td>foo{{echo|</td>}}</tr></table>
5817 !!result
5818 <table><tr><td>foo</td></tr></table>
5819
5820 !!end
5821
5822 !!test
5823 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5824 !!input
5825 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5826 !!result
5827 <table><tr><td>foo</td></tr></table>
5828
5829 !!end
5830
5831 !!test
5832 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5833 !!input
5834 <table><tr><td>foo</td></tr>{{echo|</table>}}
5835 !!result
5836 <table><tr><td>foo</td></tr></table>
5837
5838 !!end
5839
5840 !!test
5841 Templates: Wiki Tables: 1. Fostering of entire template content
5842 !!input
5843 {|
5844 {{echo|a}}
5845 |}
5846 !!result
5847 <table>
5848 a
5849 <tr><td></td></tr></table>
5850
5851 !!end
5852
5853 !!test
5854 Templates: Wiki Tables: 2. Fostering of partial template content
5855 !!input
5856 {|
5857 {{echo|a
5858 <div>b</div>}}
5859 |}
5860 !!result
5861 <table>
5862 a
5863 <div>b</div>
5864 <tr><td></td></tr></table>
5865
5866 !!end
5867
5868 !!test
5869 Templates: Wiki Tables: 3. td-content via multiple templates
5870 !!input
5871 {|
5872 {{echo|{{pipe}}a}}{{echo|b}}
5873 |}
5874 !!result
5875 <table>
5876 <tr>
5877 <td>ab
5878 </td></tr></table>
5879
5880 !!end
5881
5882 !!test
5883 Templates: Wiki Tables: 4. Templated tags, no content
5884 !!input
5885 {{tbl-start}}
5886 {{tbl-end}}
5887 !!result
5888 <table>
5889 <tr><td></td></tr></table>
5890
5891 !!end
5892
5893 !!test
5894 Templates: Wiki Tables: 4. Templated tags, regular td-tags
5895 !!input
5896 {{tbl-start}}
5897 |foo
5898 {{tbl-end}}
5899 !!result
5900 <table>
5901 <tr>
5902 <td>foo
5903 </td></tr></table>
5904
5905 !!end
5906
5907 !!test
5908 Templates: Wiki Tables: 4. Templated tags, templated td-tags
5909 !!input
5910 {{tbl-start}}
5911 {{!}}foo
5912 {{tbl-end}}
5913 !!result
5914 <table>
5915 <tr>
5916 <td>foo
5917 </td></tr></table>
5918
5919 !!end
5920
5921 !!test
5922 Templates: Lists: Multi-line list-items via templates
5923 !!input
5924 *{{echo|a {{nonexistent|
5925 unused}}}}
5926 *{{echo|b {{nonexistent|
5927 unused}}}}
5928 !!result
5929 <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>
5930 </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>
5931 </li></ul>
5932
5933 !!end
5934
5935 !!test
5936 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5937 !!input
5938 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5939 !!result
5940 <p><i>ab</i>c<i>d</i>e
5941 </p>
5942 !!end
5943
5944 !!test
5945 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5946 (PHP parser generates misnested html)
5947 !! options
5948 disabled
5949 !!input
5950 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5951 !!result
5952 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5953 !!end
5954
5955 !!test
5956 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5957 (PHP parser generates misnested html)
5958 !! options
5959 disabled
5960 !!input
5961 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5962 !!result
5963 <div><i>a</i></div>
5964 <div><i>b</i>c<i>d</i></div>
5965 <div>e</div>
5966 !!end
5967
5968 !!test
5969 Templates: Ugly nesting: 4. Divs opened/closed across templates
5970 !!input
5971 a<div>b{{echo|c</div>d}}e
5972 !!result
5973 a<div>bc</div>de
5974
5975 !!end
5976
5977 !!test
5978 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5979 (Parsoid-centric)
5980 !! options
5981 disabled
5982 !!input
5983 {|
5984 |{{echo|foo</table>}}
5985 |bar
5986 |}
5987 !!result
5988 <table about="#mwt1" typeof="mw:Object/Template ">
5989 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5990 bar</span><span about="#mwt1">
5991 </span>
5992 !!end
5993
5994 !!test
5995 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5996 (Parsoid-centric)
5997 !! options
5998 disabled
5999 !!input
6000 <table>
6001 <tr>
6002 <td>
6003 <table>
6004 <tr>
6005 <td>1. {{echo|foo </table>}}</td>
6006 <td> bar </td>
6007 <td>2. {{echo|baz </table>}}</td>
6008 </tr>
6009 <tr>
6010 <td>abc</td>
6011 </tr>
6012 </table>
6013 </td>
6014 </tr>
6015 <tr>
6016 <td>xyz</td>
6017 </tr>
6018 </table>
6019 !!result
6020 <table about="#mwt1" typeof="mw:Object/Template">
6021 <tbody><tr >
6022 <td >
6023 <table >
6024 <tbody><tr >
6025 <td >1. foo </td></tr></tbody></table></td>
6026 <td > bar </td>
6027 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6028 </span><span about="#mwt1">
6029
6030 abc</span><span about="#mwt1">
6031 </span><span about="#mwt1">
6032 </span><span about="#mwt1">
6033 </span><span about="#mwt1">
6034 </span><span about="#mwt1">
6035
6036 xyz</span><span about="#mwt1">
6037 </span><span about="#mwt1">
6038 </span>
6039 !!end
6040
6041 !! test
6042 Templates: Ugly templates: 3. newline-only template parameter
6043 !! input
6044 foo {{echo|
6045 }}
6046 !! result
6047 <p>foo
6048 </p>
6049 !! end
6050
6051 # This looks like a bug: a single newline triggers p/br for some reason.
6052 !! test
6053 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6054 !! input
6055 {{echo|
6056 }}
6057 !! result
6058 <p><br />
6059 </p>
6060 !! end
6061
6062
6063 !!test
6064 Parser Functions: 1. Simple example
6065 !!input
6066 {{uc:foo}}
6067 !!result
6068 <p>FOO
6069 </p>
6070 !!end
6071
6072 !!test
6073 Parser Functions: 2. Nested use (only outermost should be marked up)
6074 !!input
6075 {{uc:{{lc:FOO}}}}
6076 !!result
6077 <p>FOO
6078 </p>
6079 !!end
6080
6081 ###
6082 ### Pre-save transform tests
6083 ###
6084 !! test
6085 pre-save transform: subst:
6086 !! options
6087 PST
6088 !! input
6089 {{subst:test}}
6090 !! result
6091 This is a test template
6092 !! end
6093
6094 !! test
6095 pre-save transform: normal template
6096 !! options
6097 PST
6098 !! input
6099 {{test}}
6100 !! result
6101 {{test}}
6102 !! end
6103
6104 !! test
6105 pre-save transform: nonexistent template
6106 !! options
6107 PST
6108 !! input
6109 {{thistemplatedoesnotexist}}
6110 !! result
6111 {{thistemplatedoesnotexist}}
6112 !! end
6113
6114
6115 !! test
6116 pre-save transform: subst magic variables
6117 !! options
6118 PST
6119 !! input
6120 {{subst:SITENAME}}
6121 !! result
6122 MediaWiki
6123 !! end
6124
6125 # This is bug 89, which I fixed. -- wtm
6126 !! test
6127 pre-save transform: subst: templates with parameters
6128 !! options
6129 pst
6130 !! input
6131 {{subst:paramtest|param="something else"}}
6132 !! result
6133 This is a test template with parameter "something else"
6134 !! end
6135
6136 !! article
6137 Template:nowikitest
6138 !! text
6139 <nowiki>'''not wiki'''</nowiki>
6140 !! endarticle
6141
6142 !! test
6143 pre-save transform: nowiki in subst (bug 1188)
6144 !! options
6145 pst
6146 !! input
6147 {{subst:nowikitest}}
6148 !! result
6149 <nowiki>'''not wiki'''</nowiki>
6150 !! end
6151
6152
6153 !! article
6154 Template:commenttest
6155 !! text
6156 This template has <!-- a comment --> in it.
6157 !! endarticle
6158
6159 !! test
6160 pre-save transform: comment in subst (bug 1936)
6161 !! options
6162 pst
6163 !! input
6164 {{subst:commenttest}}
6165 !! result
6166 This template has <!-- a comment --> in it.
6167 !! end
6168
6169 !! test
6170 pre-save transform: unclosed tag
6171 !! options
6172 pst noxml
6173 !! input
6174 <nowiki>'''not wiki'''
6175 !! result
6176 <nowiki>'''not wiki'''
6177 !! end
6178
6179 !! test
6180 pre-save transform: mixed tag case
6181 !! options
6182 pst noxml
6183 !! input
6184 <NOwiki>'''not wiki'''</noWIKI>
6185 !! result
6186 <NOwiki>'''not wiki'''</noWIKI>
6187 !! end
6188
6189 !! test
6190 pre-save transform: unclosed comment in <nowiki>
6191 !! options
6192 pst noxml
6193 !! input
6194 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6195 !! result
6196 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6197 !!end
6198
6199 !! article
6200 Template:dangerous
6201 !!text
6202 <span onmouseover="alert('crap')">Oh no</span>
6203 !!endarticle
6204
6205 !!test
6206 (confirming safety of fix for subst bug 1936)
6207 !! input
6208 {{Template:dangerous}}
6209 !! result
6210 <p><span>Oh no</span>
6211 </p>
6212 !! end
6213
6214 !! test
6215 pre-save transform: comment containing gallery (bug 5024)
6216 !! options
6217 pst
6218 !! input
6219 <!-- <gallery>data</gallery> -->
6220 !!result
6221 <!-- <gallery>data</gallery> -->
6222 !!end
6223
6224 !! test
6225 pre-save transform: comment containing extension
6226 !! options
6227 pst
6228 !! input
6229 <!-- <tag>data</tag> -->
6230 !!result
6231 <!-- <tag>data</tag> -->
6232 !!end
6233
6234 !! test
6235 pre-save transform: comment containing nowiki
6236 !! options
6237 pst
6238 !! input
6239 <!-- <nowiki>data</nowiki> -->
6240 !!result
6241 <!-- <nowiki>data</nowiki> -->
6242 !!end
6243
6244 !! test
6245 pre-save transform: <noinclude> in subst (bug 3298)
6246 !! options
6247 pst
6248 !! input
6249 {{subst:Includes}}
6250 !! result
6251 Foobar
6252 !! end
6253
6254 !! test
6255 pre-save transform: <onlyinclude> in subst (bug 3298)
6256 !! options
6257 pst
6258 !! input
6259 {{subst:Includes2}}
6260 !! result
6261 Foo
6262 !! end
6263
6264 !! article
6265 Template:SubstTest
6266 !!text
6267 {{<includeonly>subst:</includeonly>Includes}}
6268 !! endarticle
6269
6270 !! article
6271 Template:SafeSubstTest
6272 !! text
6273 {{<includeonly>safesubst:</includeonly>Includes}}
6274 !! endarticle
6275
6276 !! test
6277 bug 22297: safesubst: works during PST
6278 !! options
6279 pst
6280 !! input
6281 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6282 !! result
6283 FoobarFoobar
6284 !! end
6285
6286 !! test
6287 bug 22297: safesubst: works during normal parse
6288 !! input
6289 {{SafeSubstTest}}
6290 !! result
6291 <p>Foobar
6292 </p>
6293 !! end
6294
6295 !! test:
6296 subst: does not work during normal parse
6297 !! input
6298 {{SubstTest}}
6299 !! result
6300 <p>{{subst:Includes}}
6301 </p>
6302 !! end
6303
6304 !! test
6305 pre-save transform: context links ("pipe trick")
6306 !! options
6307 pst
6308 !! input
6309 [[Article (context)|]]
6310 [[Bar:Article|]]
6311 [[:Bar:Article|]]
6312 [[Bar:Article (context)|]]
6313 [[:Bar:Article (context)|]]
6314 [[|Article]]
6315 [[|Article (context)]]
6316 [[Bar:X (Y) Z|]]
6317 [[:Bar:X (Y) Z|]]
6318 !! result
6319 [[Article (context)|Article]]
6320 [[Bar:Article|Article]]
6321 [[:Bar:Article|Article]]
6322 [[Bar:Article (context)|Article]]
6323 [[:Bar:Article (context)|Article]]
6324 [[Article]]
6325 [[Article (context)]]
6326 [[Bar:X (Y) Z|X (Y) Z]]
6327 [[:Bar:X (Y) Z|X (Y) Z]]
6328 !! end
6329
6330 !! test
6331 pre-save transform: context links ("pipe trick") with interwiki prefix
6332 !! options
6333 pst
6334 !! input
6335 [[interwiki:Article|]]
6336 [[:interwiki:Article|]]
6337 [[interwiki:Bar:Article|]]
6338 [[:interwiki:Bar:Article|]]
6339 !! result
6340 [[interwiki:Article|Article]]
6341 [[:interwiki:Article|Article]]
6342 [[interwiki:Bar:Article|Bar:Article]]
6343 [[:interwiki:Bar:Article|Bar:Article]]
6344 !! end
6345
6346 !! test
6347 pre-save transform: context links ("pipe trick") with parens in title
6348 !! options
6349 pst title=[[Somearticle (context)]]
6350 !! input
6351 [[|Article]]
6352 !! result
6353 [[Article (context)|Article]]
6354 !! end
6355
6356 !! test
6357 pre-save transform: context links ("pipe trick") with comma in title
6358 !! options
6359 pst title=[[Someplace, Somewhere]]
6360 !! input
6361 [[|Otherplace]]
6362 [[Otherplace, Elsewhere|]]
6363 [[Otherplace, Elsewhere, Anywhere|]]
6364 !! result
6365 [[Otherplace, Somewhere|Otherplace]]
6366 [[Otherplace, Elsewhere|Otherplace]]
6367 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6368 !! end
6369
6370 !! test
6371 pre-save transform: context links ("pipe trick") with parens and comma
6372 !! options
6373 pst title=[[Someplace (IGNORED), Somewhere]]
6374 !! input
6375 [[|Otherplace]]
6376 [[Otherplace (place), Elsewhere|]]
6377 !! result
6378 [[Otherplace, Somewhere|Otherplace]]
6379 [[Otherplace (place), Elsewhere|Otherplace]]
6380 !! end
6381
6382 !! test
6383 pre-save transform: context links ("pipe trick") with comma and parens
6384 !! options
6385 pst title=[[Who, me? (context)]]
6386 !! input
6387 [[|Yes, you.]]
6388 [[Me, Myself, and I (1937 song)|]]
6389 !! result
6390 [[Yes, you. (context)|Yes, you.]]
6391 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6392 !! end
6393
6394 !! test
6395 pre-save transform: context links ("pipe trick") with namespace
6396 !! options
6397 pst title=[[Ns:Somearticle]]
6398 !! input
6399 [[|Article]]
6400 !! result
6401 [[Ns:Article|Article]]
6402 !! end
6403
6404 !! test
6405 pre-save transform: context links ("pipe trick") with namespace and parens
6406 !! options
6407 pst title=[[Ns:Somearticle (context)]]
6408 !! input
6409 [[|Article]]
6410 !! result
6411 [[Ns:Article (context)|Article]]
6412 !! end
6413
6414 !! test
6415 pre-save transform: context links ("pipe trick") with namespace and comma
6416 !! options
6417 pst title=[[Ns:Somearticle, Context, Whatever]]
6418 !! input
6419 [[|Article]]
6420 !! result
6421 [[Ns:Article, Context, Whatever|Article]]
6422 !! end
6423
6424 !! test
6425 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6426 !! options
6427 pst title=[[Ns:Somearticle, Context (context)]]
6428 !! input
6429 [[|Article]]
6430 !! result
6431 [[Ns:Article (context)|Article]]
6432 !! end
6433
6434 !! test
6435 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6436 !! options
6437 pst title=[[Ns:Somearticle (IGNORED), Context]]
6438 !! input
6439 [[|Article]]
6440 !! result
6441 [[Ns:Article, Context|Article]]
6442 !! end
6443
6444 !! test
6445 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6446 !! options
6447 pst
6448 !! input
6449 [[Article(context)|]]
6450 [[Bar:Article(context)|]]
6451 [[:Bar:Article(context)|]]
6452 [[|Article(context)]]
6453 [[Bar:X(Y)Z|]]
6454 [[:Bar:X(Y)Z|]]
6455 !! result
6456 [[Article(context)|Article]]
6457 [[Bar:Article(context)|Article]]
6458 [[:Bar:Article(context)|Article]]
6459 [[Article(context)]]
6460 [[Bar:X(Y)Z|X(Y)Z]]
6461 [[:Bar:X(Y)Z|X(Y)Z]]
6462 !! end
6463
6464 !! test
6465 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6466 !! options
6467 pst
6468 !! input
6469 [[Article (context)|]]
6470 [[Bar:Article (context)|]]
6471 [[:Bar:Article (context)|]]
6472 [[|Article (context)]]
6473 [[Bar:X (Y) Z|]]
6474 [[:Bar:X (Y) Z|]]
6475 !! result
6476 [[Article (context)|Article]]
6477 [[Bar:Article (context)|Article]]
6478 [[:Bar:Article (context)|Article]]
6479 [[Article (context)]]
6480 [[Bar:X (Y) Z|X (Y) Z]]
6481 [[:Bar:X (Y) Z|X (Y) Z]]
6482 !! end
6483
6484 !! test
6485 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6486 !! options
6487 pst
6488 !! input
6489 [[Article(context)|]]
6490 [[Bar:Article(context)|]]
6491 [[:Bar:Article(context)|]]
6492 [[|Article(context)]]
6493 [[Bar:X(Y)Z|]]
6494 [[:Bar:X(Y)Z|]]
6495 !! result
6496 [[Article(context)|Article]]
6497 [[Bar:Article(context)|Article]]
6498 [[:Bar:Article(context)|Article]]
6499 [[Article(context)]]
6500 [[Bar:X(Y)Z|X(Y)Z]]
6501 [[:Bar:X(Y)Z|X(Y)Z]]
6502 !! end
6503
6504 !! test
6505 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6506 !! options
6507 pst
6508 !! input
6509 [[Article (context), context|]]
6510 [[Article (context),context|]]
6511 [[Bar:Article (context), context|]]
6512 [[Bar:Article (context),context|]]
6513 [[:Bar:Article (context), context|]]
6514 [[:Bar:Article (context),context|]]
6515 !! result
6516 [[Article (context), context|Article]]
6517 [[Article (context),context|Article]]
6518 [[Bar:Article (context), context|Article]]
6519 [[Bar:Article (context),context|Article]]
6520 [[:Bar:Article (context), context|Article]]
6521 [[:Bar:Article (context),context|Article]]
6522 !! end
6523
6524 !! test
6525 pre-save transform: trim trailing empty lines
6526 !! options
6527 pst
6528 !! input
6529 Empty lines are trimmed
6530
6531
6532
6533
6534 !! result
6535 Empty lines are trimmed
6536 !! end
6537
6538 !! test
6539 pre-save transform: Signature expansion
6540 !! options
6541 pst
6542 !! input
6543 * ~~~
6544 * <noinclude>~~~</noinclude>
6545 * <includeonly>~~~</includeonly>
6546 * <onlyinclude>~~~</onlyinclude>
6547 !! result
6548 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6549 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6550 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6551 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6552 !! end
6553
6554
6555 !! test
6556 pre-save transform: Signature expansion in nowiki tags (bug 93)
6557 !! options
6558 pst disabled
6559 !! input
6560 Shall not expand:
6561
6562 <nowiki>~~~~</nowiki>
6563
6564 <includeonly><nowiki>~~~~</nowiki></includeonly>
6565
6566 <noinclude><nowiki>~~~~</nowiki></noinclude>
6567
6568 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6569
6570 {{subst:Foo}} shall be converted to FOO
6571
6572 As well as inside noinclude/onlyinclude
6573 <noinclude>{{subst:Foo}}</noinclude>
6574 <onlyinclude>{{subst:Foo}}</onlyinclude>
6575
6576 But not inside includeonly
6577 <includeonly>{{subst:Foo}}</includeonly>
6578 !! result
6579 Shall not expand:
6580
6581 <nowiki>~~~~</nowiki>
6582
6583 <includeonly><nowiki>~~~~</nowiki></includeonly>
6584
6585 <noinclude><nowiki>~~~~</nowiki></noinclude>
6586
6587 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6588
6589 FOO shall be converted to FOO
6590
6591 As well as inside noinclude/onlyinclude
6592 <noinclude>FOO</noinclude>
6593 <onlyinclude>FOO</onlyinclude>
6594
6595 But not inside includeonly
6596 <includeonly>{{subst:Foo}}</includeonly>
6597 !! end
6598
6599 ###
6600 ### Message transform tests
6601 ###
6602 !! test
6603 message transform: magic variables
6604 !! options
6605 msg
6606 !! input
6607 {{SITENAME}}
6608 !! result
6609 MediaWiki
6610 !! end
6611
6612 !! test
6613 message transform: should not transform wiki markup
6614 !! options
6615 msg
6616 !! input
6617 ''test''
6618 !! result
6619 ''test''
6620 !! end
6621
6622 !! test
6623 message transform: <noinclude> in transcluded template (bug 4926)
6624 !! options
6625 msg
6626 !! input
6627 {{Includes}}
6628 !! result
6629 Foobar
6630 !! end
6631
6632 !! test
6633 message transform: <onlyinclude> in transcluded template (bug 4926)
6634 !! options
6635 msg
6636 !! input
6637 {{Includes2}}
6638 !! result
6639 Foo
6640 !! end
6641
6642 !! test
6643 {{#special:}} page name, known
6644 !! options
6645 msg
6646 !! input
6647 {{#special:Recentchanges}}
6648 !! result
6649 Special:RecentChanges
6650 !! end
6651
6652 !! test
6653 {{#special:}} page name with subpage, known
6654 !! options
6655 msg
6656 !! input
6657 {{#special:Recentchanges/param}}
6658 !! result
6659 Special:RecentChanges/param
6660 !! end
6661
6662 !! test
6663 {{#special:}} page name, unknown
6664 !! options
6665 msg
6666 !! input
6667 {{#special:foobarnonexistent}}
6668 !! result
6669 No such special page
6670 !! end
6671
6672 !! test
6673 {{#speciale:}} page name, known
6674 !! options
6675 msg
6676 !! input
6677 {{#speciale:Recentchanges}}
6678 !! result
6679 Special:RecentChanges
6680 !! end
6681
6682 !! test
6683 {{#speciale:}} page name with subpage, known
6684 !! options
6685 msg
6686 !! input
6687 {{#speciale:Recentchanges/param}}
6688 !! result
6689 Special:RecentChanges/param
6690 !! end
6691
6692 !! test
6693 {{#speciale:}} page name, unknown
6694 !! options
6695 msg
6696 !! input
6697 {{#speciale:foobarnonexistent}}
6698 !! result
6699 No_such_special_page
6700 !! end
6701
6702 ###
6703 ### Images
6704 ###
6705 !! test
6706 Simple image
6707 !! input
6708 [[Image:foobar.jpg]]
6709 !! result
6710 <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>
6711 </p>
6712 !! end
6713
6714 !! test
6715 Right-aligned image
6716 !! input
6717 [[Image:foobar.jpg|right]]
6718 !! result
6719 <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>
6720
6721 !! end
6722
6723 !! test
6724 Simple image (using File: namespace, now canonical)
6725 !! input
6726 [[File:foobar.jpg]]
6727 !! result
6728 <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>
6729 </p>
6730 !! end
6731
6732 !! test
6733 Image with caption
6734 !! input
6735 [[Image:foobar.jpg|right|Caption text]]
6736 !! result
6737 <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>
6738
6739 !! end
6740
6741 !! test
6742 Image with empty attribute
6743 !! input
6744 [[Image:foobar.jpg|right||Caption text]]
6745 !! result
6746 <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>
6747
6748 !! end
6749
6750 !! test
6751 Image with link tails
6752 !! input
6753 123[[Image:foobar.jpg]]456
6754 123[[Image:foobar.jpg|right]]456
6755 123[[Image:foobar.jpg|thumb]]456
6756 !! result
6757 <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
6758 </p>
6759 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
6760 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
6761
6762 !! end
6763
6764 !! test
6765 Image with multiple captions -- only last one is accepted
6766 !! input
6767 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6768 !! result
6769 <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>
6770
6771 !! end
6772
6773 !! test
6774 Image with width attribute at different positions
6775 !! input
6776 [[Image:foobar.jpg|200px|right|Caption]]
6777 [[Image:foobar.jpg|right|200px|Caption]]
6778 [[Image:foobar.jpg|right|Caption|200px]]
6779 !! result
6780 <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>
6781 <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>
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
6784 !! end
6785
6786 !! test
6787 Image with link parameter, wiki target
6788 !! input
6789 [[Image:foobar.jpg|link=Target page]]
6790 !! result
6791 <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>
6792 </p>
6793 !! end
6794
6795 !! test
6796 Image with link parameter, URL target
6797 !! input
6798 [[Image:foobar.jpg|link=http://example.com/]]
6799 !! result
6800 <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>
6801 </p>
6802 !! end
6803
6804 !! test
6805 Image with link parameter, wgExternalLinkTarget
6806 !! input
6807 [[Image:foobar.jpg|link=http://example.com/]]
6808 !! config
6809 wgExternalLinkTarget='foobar'
6810 !! result
6811 <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>
6812 </p>
6813 !! end
6814
6815 !! test
6816 Image with link parameter, wgNoFollowLinks set to false
6817 !! input
6818 [[Image:foobar.jpg|link=http://example.com/]]
6819 !! config
6820 wgNoFollowLinks=false
6821 !! result
6822 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6823 </p>
6824 !! end
6825
6826 !! test
6827 Image with link parameter, wgNoFollowDomainExceptions
6828 !! input
6829 [[Image:foobar.jpg|link=http://example.com/]]
6830 !! config
6831 wgNoFollowDomainExceptions='example.com'
6832 !! result
6833 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6834 </p>
6835 !! end
6836
6837 !! test
6838 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6839 !! input
6840 [[Image:foobar.jpg|link=http://example.com/|Title]]
6841 !! config
6842 wgExternalLinkTarget='foobar'
6843 !! result
6844 <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>
6845 </p>
6846 !! end
6847
6848 !! test
6849 Image with empty link parameter
6850 !! input
6851 [[Image:foobar.jpg|link=]]
6852 !! result
6853 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6854 </p>
6855 !! end
6856
6857 !! test
6858 Image with link parameter (wiki target) and unnamed parameter
6859 !! input
6860 [[Image:foobar.jpg|link=Target page|Title]]
6861 !! result
6862 <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>
6863 </p>
6864 !! end
6865
6866 !! test
6867 Image with link parameter (URL target) and unnamed parameter
6868 !! input
6869 [[Image:foobar.jpg|link=http://example.com/|Title]]
6870 !! result
6871 <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>
6872 </p>
6873 !! end
6874
6875 !! test
6876 Thumbnail image with link parameter
6877 !! input
6878 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6879 !! result
6880 <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>
6881
6882 !! end
6883
6884 !! test
6885 Image with frame and link
6886 !! input
6887 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6888 !! result
6889 <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>
6890
6891 !! end
6892
6893 !! test
6894 Image with frame and link and explicit alt
6895 !! input
6896 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6897 !! result
6898 <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>
6899
6900 !! end
6901
6902 !! test
6903 Image with wiki markup in implicit alt
6904 !! input
6905 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6906 !! result
6907 <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>
6908 </p>
6909 !! end
6910
6911 !! test
6912 Image with wiki markup in explicit alt
6913 !! input
6914 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6915 !! result
6916 <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>
6917 </p>
6918 !! end
6919
6920 !! test
6921 Link to image page- image page normally doesn't exists, hence edit link
6922 Add test with existing image page
6923 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6924 !! input
6925 [[:Image:test]]
6926 !! result
6927 <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>
6928 </p>
6929 !! end
6930
6931 !! test
6932 bug 18784 Link to non-existent image page with caption should use caption as link text
6933 !! input
6934 [[:Image:test|caption]]
6935 !! result
6936 <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>
6937 </p>
6938 !! end
6939
6940 !! test
6941 Frameless image caption with a free URL
6942 !! input
6943 [[Image:foobar.jpg|http://example.com]]
6944 !! result
6945 <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>
6946 </p>
6947 !! end
6948
6949 !! test
6950 Thumbnail image caption with a free URL
6951 !! input
6952 [[Image:foobar.jpg|thumb|http://example.com]]
6953 !! result
6954 <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>
6955
6956 !! end
6957
6958 !! test
6959 Thumbnail image caption with a free URL and explicit alt
6960 !! input
6961 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6962 !! result
6963 <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>
6964
6965 !! end
6966
6967 !! test
6968 BUG 1887: A ISBN with a thumbnail
6969 !! input
6970 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6971 !! result
6972 <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>
6973
6974 !! end
6975
6976 !! test
6977 BUG 1887: A RFC with a thumbnail
6978 !! input
6979 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6980 !! result
6981 <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>
6982
6983 !! end
6984
6985 !! test
6986 BUG 1887: A mailto link with a thumbnail
6987 !! input
6988 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
6989 !! result
6990 <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>
6991
6992 !! end
6993
6994 # Pending resolution to bug 368
6995 !! test
6996 BUG 648: Frameless image caption with a link
6997 !! input
6998 [[Image:foobar.jpg|text with a [[link]] in it]]
6999 !! result
7000 <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>
7001 </p>
7002 !! end
7003
7004 !! test
7005 BUG 648: Frameless image caption with a link (suffix)
7006 !! input
7007 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7008 !! result
7009 <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>
7010 </p>
7011 !! end
7012
7013 !! test
7014 BUG 648: Frameless image caption with an interwiki link
7015 !! input
7016 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7017 !! result
7018 <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>
7019 </p>
7020 !! end
7021
7022 !! test
7023 BUG 648: Frameless image caption with a piped interwiki link
7024 !! input
7025 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7026 !! result
7027 <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>
7028 </p>
7029 !! end
7030
7031 !! test
7032 Escape HTML special chars in image alt text
7033 !! input
7034 [[Image:foobar.jpg|& < > "]]
7035 !! result
7036 <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>
7037 </p>
7038 !! end
7039
7040 !! test
7041 BUG 499: Alt text should have &#1234;, not &amp;1234;
7042 !! input
7043 [[Image:foobar.jpg|&#9792;]]
7044 !! result
7045 <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>
7046 </p>
7047 !! end
7048
7049 !! test
7050 Broken image caption with link
7051 !! input
7052 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7053 !! result
7054 <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.
7055 </p>
7056 !! end
7057
7058 !! test
7059 Image caption containing another image
7060 !! input
7061 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7062 !! result
7063 <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>
7064
7065 !! end
7066
7067 !! test
7068 Image caption containing a newline
7069 !! input
7070 [[Image:Foobar.jpg|This
7071 *is some text]]
7072 !! result
7073 <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>
7074 </p>
7075 !!end
7076
7077 !!test
7078 Parsoid: Image caption containing leading space
7079 (The leading space should not trigger nowiki escaping in wt2wt mode)
7080 !! input
7081 [[Image:Foobar.jpg|thumb| bar]]
7082 !! result
7083 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7084
7085 !!end
7086
7087 !! test
7088 Bug 3090: External links other than http: in image captions
7089 !! input
7090 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7091 !! result
7092 <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>
7093
7094 !! end
7095
7096 !! test
7097 Custom class
7098 !! input
7099 [[Image:foobar.jpg|a|class=b]]
7100 !! result
7101 <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>
7102 </p>
7103 !! end
7104
7105 !! test
7106 Localized image handling (1).
7107 !! options
7108 language=es
7109 !! input
7110 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7111 !! result
7112 <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>
7113
7114 !! end
7115
7116 !! test
7117 Localized image handling (2).
7118 !! options
7119 language=es
7120 !! input
7121 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7122 !! result
7123 <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>
7124
7125 !! end
7126
7127 !! test
7128 "border", "frameless" and "class" attributes on an image.
7129 !! input
7130 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7131 !! result
7132 <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>
7133 </p>
7134 !! end
7135
7136 !! article
7137 File:Barfoo.jpg
7138 !! text
7139 #REDIRECT [[File:Barfoo.jpg]]
7140 !! endarticle
7141
7142 !! test
7143 Redirected image
7144 !! input
7145 [[Image:Barfoo.jpg]]
7146 !! result
7147 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7148 </p>
7149 !! end
7150
7151 !! test
7152 Missing image with uploads disabled
7153 !! options
7154 wgEnableUploads=0
7155 !! input
7156 [[Image:Foobaz.jpg]]
7157 !! result
7158 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7159 </p>
7160 !! end
7161
7162
7163 ###
7164 ### Subpages
7165 ###
7166 !! article
7167 Subpage test/subpage
7168 !! text
7169 foo
7170 !! endarticle
7171
7172 !! test
7173 Subpage link
7174 !! options
7175 subpage title=[[Subpage test]]
7176 !! input
7177 [[/subpage]]
7178 !! result
7179 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7180 </p>
7181 !! end
7182
7183 !! test
7184 Subpage noslash link
7185 !! options
7186 subpage title=[[Subpage test]]
7187 !!input
7188 [[/subpage/]]
7189 !! result
7190 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7191 </p>
7192 !! end
7193
7194 !! test
7195 Disabled subpages
7196 !! input
7197 [[/subpage]]
7198 !! result
7199 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7200 </p>
7201 !! end
7202
7203 !! test
7204 BUG 561: {{/Subpage}}
7205 !! options
7206 subpage title=[[Page]]
7207 !! input
7208 {{/Subpage}}
7209 !! result
7210 <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>
7211 </p>
7212 !! end
7213
7214 ###
7215 ### Categories
7216 ###
7217 !! article
7218 Category:MediaWiki User's Guide
7219 !! text
7220 blah
7221 !! endarticle
7222
7223 !! test
7224 Link to category
7225 !! input
7226 [[:Category:MediaWiki User's Guide]]
7227 !! result
7228 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7229 </p>
7230 !! end
7231
7232 !! test
7233 Simple category
7234 !! options
7235 cat
7236 !! input
7237 [[Category:MediaWiki User's Guide]]
7238 !! result
7239 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7240 !! end
7241
7242 !! test
7243 PAGESINCATEGORY invalid title fatal (r33546 fix)
7244 !! input
7245 {{PAGESINCATEGORY:<bogus>}}
7246 !! result
7247 <p>0
7248 </p>
7249 !! end
7250
7251 !! test
7252 Category with different sort key
7253 !! options
7254 cat
7255 !! input
7256 [[Category:MediaWiki User's Guide|Foo]]
7257 !! result
7258 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7259 !! end
7260
7261 !! test
7262 Category with identical sort key
7263 !! options
7264 cat
7265 !! input
7266 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7267 !! result
7268 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7269 !! end
7270
7271 !! test
7272 Category with empty sort key
7273 !! options
7274 cat
7275 pst
7276 !! input
7277 [[Category:MediaWiki User's Guide|]]
7278 !! result
7279 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7280 !! end
7281
7282 !! test
7283 Category with empty sort key and parentheses
7284 !! options
7285 cat
7286 pst
7287 !! input
7288 [[Category:Foo (bar)|]]
7289 !! result
7290 [[Category:Foo (bar)|Foo]]
7291 !! end
7292
7293 !! test
7294 Category with link tail
7295 !! options
7296 cat
7297 pst
7298 !! input
7299 123[[Category:Foo]]456
7300 !! result
7301 123[[Category:Foo]]456
7302 !! end
7303
7304 !! test
7305 Category with template
7306 !! options
7307 cat
7308 pst
7309 !! input
7310 [[Category:{{echo|Foo}}]]
7311 !! result
7312 [[Category:{{echo|Foo}}]]
7313 !! end
7314
7315 !! test
7316 Category with template in sort key
7317 !! options
7318 cat
7319 pst
7320 !! input
7321 [[Category:Foo|{{echo|Bar}}]]
7322 !! result
7323 [[Category:Foo|{{echo|Bar}}]]
7324 !! end
7325
7326 !! test
7327 Category with template in sort key and title
7328 !! options
7329 cat
7330 pst
7331 !! input
7332 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7333 !! result
7334 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7335 !! end
7336
7337 !! test
7338 Category / paragraph interactions
7339 !! input
7340 Foo [[Category:Baz]] Bar
7341
7342 Foo [[Category:Baz]]
7343 Bar
7344
7345 Foo
7346 [[Category:Baz]]
7347 Bar
7348
7349 Foo
7350 [[Category:Baz]] Bar
7351
7352 Foo
7353 [[Category:Baz]]
7354 [[Category:Baz]]
7355 [[Category:Baz]]
7356 Bar
7357
7358 [[Category:Baz]]
7359 [[Category:Baz]]
7360 [[Category:Baz]]
7361
7362 [[Category:Baz]]
7363 {{echo|[[Category:Baz]]}}
7364 [[Category:Baz]]
7365 !! result
7366 <p>Foo Bar
7367 </p><p>Foo
7368 Bar
7369 </p><p>Foo
7370 Bar
7371 </p><p>Foo Bar
7372 </p><p>Foo
7373 Bar
7374 </p>
7375 !! end
7376
7377 ###
7378 ### Inter-language links
7379 ###
7380 !! test
7381 Inter-language links
7382 !! options
7383 ill
7384 !! input
7385 [[es:Alimento]]
7386 [[fr:Nourriture]]
7387 [[zh:&#39135;&#21697;]]
7388 !! result
7389 es:Alimento fr:Nourriture zh:食品
7390 !! end
7391
7392 !! test
7393 Duplicate interlanguage links (bug 24502)
7394 !! options
7395 ill
7396 !! input
7397 [[es:1]]
7398 [[es:2]]
7399 [[fr:1]]
7400 [[fr:2]]
7401 !! result
7402 es:1 fr:1
7403 !! end
7404
7405 ###
7406 ### Sections
7407 ###
7408 !! test
7409 Basic section headings
7410 !! input
7411 == Headline 1 ==
7412 Some text
7413
7414 ==Headline 2==
7415 More
7416 ===Smaller headline===
7417 Blah blah
7418 !! result
7419 <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>
7420 <p>Some text
7421 </p>
7422 <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>
7423 <p>More
7424 </p>
7425 <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>
7426 <p>Blah blah
7427 </p>
7428 !! end
7429
7430 !! test
7431 Section headings with TOC
7432 !! input
7433 == Headline 1 ==
7434 === Subheadline 1 ===
7435 ===== Skipping a level =====
7436 ====== Skipping a level ======
7437
7438 == Headline 2 ==
7439 Some text
7440 ===Another headline===
7441 !! result
7442 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7443 <ul>
7444 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7445 <ul>
7446 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7447 <ul>
7448 <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>
7449 <ul>
7450 <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>
7451 </ul>
7452 </li>
7453 </ul>
7454 </li>
7455 </ul>
7456 </li>
7457 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7458 <ul>
7459 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7460 </ul>
7461 </li>
7462 </ul>
7463 </td></tr></table>
7464 <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>
7465 <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>
7466 <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>
7467 <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>
7468 <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>
7469 <p>Some text
7470 </p>
7471 <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>
7472
7473 !! end
7474
7475 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7476 !! test
7477 Handling of sections up to level 6 and beyond
7478 !! input
7479 = Level 1 Heading=
7480 == Level 2 Heading==
7481 === Level 3 Heading===
7482 ==== Level 4 Heading====
7483 ===== Level 5 Heading=====
7484 ====== Level 6 Heading======
7485 ======= Level 7 Heading=======
7486 ======== Level 8 Heading========
7487 ========= Level 9 Heading=========
7488 ========== Level 10 Heading==========
7489 !! result
7490 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7491 <ul>
7492 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7493 <ul>
7494 <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>
7495 <ul>
7496 <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>
7497 <ul>
7498 <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>
7499 <ul>
7500 <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>
7501 <ul>
7502 <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>
7503 <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>
7504 <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>
7505 <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>
7506 <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>
7507 </ul>
7508 </li>
7509 </ul>
7510 </li>
7511 </ul>
7512 </li>
7513 </ul>
7514 </li>
7515 </ul>
7516 </li>
7517 </ul>
7518 </td></tr></table>
7519 <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>
7520 <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>
7521 <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>
7522 <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>
7523 <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>
7524 <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>
7525 <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>
7526 <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>
7527 <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>
7528 <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>
7529
7530 !! end
7531
7532 !! test
7533 TOC regression (bug 9764)
7534 !! input
7535 == title 1 ==
7536 === title 1.1 ===
7537 ==== title 1.1.1 ====
7538 === title 1.2 ===
7539 == title 2 ==
7540 === title 2.1 ===
7541 !! result
7542 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7543 <ul>
7544 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7545 <ul>
7546 <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>
7547 <ul>
7548 <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>
7549 </ul>
7550 </li>
7551 <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>
7552 </ul>
7553 </li>
7554 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7555 <ul>
7556 <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>
7557 </ul>
7558 </li>
7559 </ul>
7560 </td></tr></table>
7561 <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>
7562 <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>
7563 <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>
7564 <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>
7565 <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>
7566 <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>
7567
7568 !! end
7569
7570 !! test
7571 TOC with wgMaxTocLevel=3 (bug 6204)
7572 !! options
7573 wgMaxTocLevel=3
7574 !! input
7575 == title 1 ==
7576 === title 1.1 ===
7577 ==== title 1.1.1 ====
7578 === title 1.2 ===
7579 == title 2 ==
7580 === title 2.1 ===
7581 !! result
7582 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7583 <ul>
7584 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7585 <ul>
7586 <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>
7587 <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>
7588 </ul>
7589 </li>
7590 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7591 <ul>
7592 <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>
7593 </ul>
7594 </li>
7595 </ul>
7596 </td></tr></table>
7597 <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>
7598 <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>
7599 <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>
7600 <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>
7601 <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>
7602 <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>
7603
7604 !! end
7605
7606 !! test
7607 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7608 !! options
7609 wgMaxTocLevel=3
7610 !! input
7611 ==Section 1==
7612 ===Section 1.1===
7613 ====Section 1.1.1====
7614 ====Section 1.1.1.1====
7615 ==Section 2==
7616 !! result
7617 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7618 <ul>
7619 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7620 <ul>
7621 <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>
7622 </ul>
7623 </li>
7624 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7625 </ul>
7626 </td></tr></table>
7627 <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>
7628 <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>
7629 <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>
7630 <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>
7631 <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>
7632
7633 !! end
7634
7635
7636 !! test
7637 Resolving duplicate section names
7638 !! input
7639 == Foo bar ==
7640 == Foo bar ==
7641 !! result
7642 <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>
7643 <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>
7644
7645 !! end
7646
7647 !! test
7648 Resolving duplicate section names with differing case (bug 10721)
7649 !! input
7650 == Foo bar ==
7651 == Foo Bar ==
7652 !! result
7653 <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>
7654 <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>
7655
7656 !! end
7657
7658 !! article
7659 Template:sections
7660 !! text
7661 ===Section 1===
7662 ==Section 2==
7663 !! endarticle
7664
7665 !! test
7666 Template with sections, __NOTOC__
7667 !! input
7668 __NOTOC__
7669 ==Section 0==
7670 {{sections}}
7671 ==Section 4==
7672 !! result
7673 <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>
7674 <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>
7675 <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>
7676 <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>
7677
7678 !! end
7679
7680 !! test
7681 __NOEDITSECTION__ keyword
7682 !! input
7683 __NOEDITSECTION__
7684 ==Section 1==
7685 ==Section 2==
7686 !! result
7687 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7688 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7689
7690 !! end
7691
7692 !! test
7693 Link inside a section heading
7694 !! input
7695 ==Section with a [[Main Page|link]] in it==
7696 !! result
7697 <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>
7698
7699 !! end
7700
7701 !! test
7702 TOC regression (bug 12077)
7703 !! input
7704 __TOC__
7705 == title 1 ==
7706 === title 1.1 ===
7707 == title 2 ==
7708 !! result
7709 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7710 <ul>
7711 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7712 <ul>
7713 <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>
7714 </ul>
7715 </li>
7716 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7717 </ul>
7718 </td></tr></table>
7719 <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>
7720 <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>
7721 <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>
7722
7723 !! end
7724
7725 !! test
7726 BUG 1219 URL next to image (good)
7727 !! input
7728 http://example.com [[Image:foobar.jpg]]
7729 !! result
7730 <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>
7731 </p>
7732 !!end
7733
7734 !! test
7735 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
7736 !! input
7737 ===
7738 The line above must have a trailing space!
7739 === <!--
7740 --> <!-- -->
7741 But just in case it doesn't...
7742 !! result
7743 <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>
7744 <p>The line above must have a trailing space!
7745 </p>
7746 <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>
7747 <p>But just in case it doesn't...
7748 </p>
7749 !! end
7750
7751 !! test
7752 Header with special characters (bug 25462)
7753 !! input
7754 The tooltips shall not show entities to the user (ie. be double escaped)
7755
7756 == text > text ==
7757 section 1
7758
7759 == text < text ==
7760 section 2
7761
7762 == text & text ==
7763 section 3
7764
7765 == text ' text ==
7766 section 4
7767
7768 == text " text ==
7769 section 5
7770 !! result
7771 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7772 </p>
7773 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7774 <ul>
7775 <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>
7776 <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>
7777 <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>
7778 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7779 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7780 </ul>
7781 </td></tr></table>
7782 <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>
7783 <p>section 1
7784 </p>
7785 <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>
7786 <p>section 2
7787 </p>
7788 <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>
7789 <p>section 3
7790 </p>
7791 <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>
7792 <p>section 4
7793 </p>
7794 <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>
7795 <p>section 5
7796 </p>
7797 !! end
7798
7799 !! test
7800 Headers with excess '=' characters
7801 (Are similar tests necessary beyond the 1st level?)
7802 !! input
7803 =foo==
7804 ==foo=
7805 =''italic'' heading==
7806 ==''italic'' heading=
7807 !! result
7808 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7809 <ul>
7810 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7811 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7812 <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>
7813 <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>
7814 </ul>
7815 </td></tr></table>
7816 <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>
7817 <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>
7818 <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>
7819 <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>
7820
7821 !! end
7822
7823 !! test
7824 BUG 1219 URL next to image (broken)
7825 !! input
7826 http://example.com[[Image:foobar.jpg]]
7827 !! result
7828 <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>
7829 </p>
7830 !!end
7831
7832 !! test
7833 Bug 1186 news: in the middle of text
7834 !! input
7835 http://en.wikinews.org/wiki/Wikinews:Workplace
7836 !! result
7837 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7838 </p>
7839 !!end
7840
7841
7842 !! test
7843 Namespaced link must have a title
7844 !! input
7845 [[Project:]]
7846 !! result
7847 <p>[[Project:]]
7848 </p>
7849 !!end
7850
7851 !! test
7852 Namespaced link must have a title (bad fragment version)
7853 !! input
7854 [[Project:#fragment]]
7855 !! result
7856 <p>[[Project:#fragment]]
7857 </p>
7858 !!end
7859
7860
7861 ###
7862 ### HTML tags and HTML attributes
7863 ###
7864
7865 !! test
7866 div with no attributes
7867 !! input
7868 <div>HTML rocks</div>
7869 !! result
7870 <div>HTML rocks</div>
7871
7872 !! end
7873
7874 !! test
7875 div with double-quoted attribute
7876 !! input
7877 <div id="rock">HTML rocks</div>
7878 !! result
7879 <div id="rock">HTML rocks</div>
7880
7881 !! end
7882
7883 !! test
7884 div with single-quoted attribute
7885 !! input
7886 <div id='rock'>HTML rocks</div>
7887 !! result
7888 <div id="rock">HTML rocks</div>
7889
7890 !! end
7891
7892 !! test
7893 div with unquoted attribute
7894 !! input
7895 <div id=rock>HTML rocks</div>
7896 !! result
7897 <div id="rock">HTML rocks</div>
7898
7899 !! end
7900
7901 !! test
7902 div with illegal double attributes
7903 !! input
7904 <div id="a" id="b">HTML rocks</div>
7905 !! result
7906 <div id="b">HTML rocks</div>
7907
7908 !!end
7909
7910 # FIXME: produce empty string instead of "class" in the PHP parser, following
7911 # the HTML5 spec.
7912 !! test
7913 div with empty attribute value, space before equals
7914 !! options
7915 disabled
7916 !! input
7917 <div class =>HTML rocks</div>
7918 !! result
7919 <div class="">HTML rocks</div>
7920
7921 !! end
7922
7923 # The PHP parser escapes the opening brace to &#123; for some reason, so
7924 # disabled this test for it.
7925 !! test
7926 div with braces in attribute value
7927 !! options
7928 disabled
7929 !! input
7930 <div title="{}">Foo</div>
7931 !! result
7932 <div title="{}">Foo</div>
7933 !! end
7934
7935 # This it very inconsistent in the PHP parser: it returns
7936 # class="class" if there is a space between the name and the equal sign (see
7937 # 'div with empty attribute value, space before equals'), but strips the
7938 # attribute completely if the space is missing. We hope that not much content
7939 # depends on this, so are implementing the behavior below in Parsoid for
7940 # consistencies' sake. Disabled for the PHP parser.
7941 # FIXME: fix this behavior in the PHP parser?
7942 !! test
7943 div with empty attribute value, no space before equals
7944 !! options
7945 disabled
7946 !! input
7947 <div class=>HTML rocks</div>
7948 !! result
7949 <div class="">HTML rocks</div>
7950
7951 !! end
7952
7953 !! test
7954 HTML multiple attributes correction
7955 !! input
7956 <p class="error" class="awesome">Awesome!</p>
7957 !! result
7958 <p class="awesome">Awesome!</p>
7959
7960 !!end
7961
7962 !! test
7963 Table multiple attributes correction
7964 !! input
7965 {|
7966 !+ class="error" class="awesome"| status
7967 |}
7968 !! result
7969 <table>
7970 <tr>
7971 <th class="awesome"> status
7972 </th></tr></table>
7973
7974 !!end
7975
7976 !! test
7977 DIV IN UPPERCASE
7978 !! input
7979 <DIV ID="x">HTML ROCKS</DIV>
7980 !! result
7981 <div id="x">HTML ROCKS</div>
7982
7983 !!end
7984
7985 !! test
7986 Non-ASCII pseudo-tags are rendered as text
7987 !! input
7988 <khyô>
7989 !! result
7990 <p>&lt;khyô&gt;
7991 </p>
7992 !! end
7993
7994 !! test
7995 Pseudo-tag with URL 'name' renders as url link
7996 !! input
7997 <http://example.com/>
7998 !! result
7999 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8000 </p>
8001 !! end
8002
8003 !! test
8004 text with amp in the middle of nowhere
8005 !! input
8006 Remember AT&T?
8007 !!result
8008 <p>Remember AT&amp;T?
8009 </p>
8010 !! end
8011
8012 !! test
8013 text with character entity: eacute
8014 !! input
8015 I always thought &eacute; was a cute letter.
8016 !! result
8017 <p>I always thought &#233; was a cute letter.
8018 </p>
8019 !! end
8020
8021 !! test
8022 text with entity-escaped character entity-like string: eacute
8023 !! input
8024 I always thought &amp;eacute; was a cute letter.
8025 !! result
8026 <p>I always thought &amp;eacute; was a cute letter.
8027 </p>
8028 !! end
8029
8030 !! test
8031 text with undefined character entity: xacute
8032 !! input
8033 I always thought &xacute; was a cute letter.
8034 !! result
8035 <p>I always thought &amp;xacute; was a cute letter.
8036 </p>
8037 !! end
8038
8039
8040 ###
8041 ### Media links
8042 ###
8043
8044 !! test
8045 Media link
8046 !! input
8047 [[Media:Foobar.jpg]]
8048 !! result
8049 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8050 </p>
8051 !! end
8052
8053 !! test
8054 Media link with text
8055 !! input
8056 [[Media:Foobar.jpg|A neat file to look at]]
8057 !! result
8058 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8059 </p>
8060 !! end
8061
8062 # FIXME: this is still bad HTML tag nesting
8063 !! test
8064 Media link with nasty text
8065 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8066 !! input
8067 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8068 !! result
8069 <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>
8070
8071 !! end
8072
8073 !! test
8074 Media link to nonexistent file (bug 1702)
8075 !! input
8076 [[Media:No such.jpg]]
8077 !! result
8078 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8079 </p>
8080 !! end
8081
8082 !! test
8083 Image link to nonexistent file (bug 1850 - good)
8084 !! input
8085 [[Image:No such.jpg]]
8086 !! result
8087 <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>
8088 </p>
8089 !! end
8090
8091 !! test
8092 :Image link to nonexistent file (bug 1850 - bad)
8093 !! input
8094 [[:Image:No such.jpg]]
8095 !! result
8096 <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>
8097 </p>
8098 !! end
8099
8100
8101
8102 !! test
8103 Character reference normalization in link text (bug 1938)
8104 !! input
8105 [[Main Page|this&that]]
8106 !! result
8107 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8108 </p>
8109 !!end
8110
8111 !! article
8112 אַ
8113 !! text
8114 Test for unicode normalization
8115
8116 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8117 !! endarticle
8118
8119 !! test
8120 (bug 19451) Links should refer to the normalized form.
8121 !! input
8122 [[&#xFB2E;]]
8123 [[&#x5d0;&#x5b7;]]
8124 [[&#x5d0;ַ]]
8125 [[א&#x5b7;]]
8126 [[אַ]]
8127 !! result
8128 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8129 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8130 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8131 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8132 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8133 </p>
8134 !! end
8135
8136 !! test
8137 Empty attribute crash test (bug 2067)
8138 !! input
8139 <font color="">foo</font>
8140 !! result
8141 <p><font color="">foo</font>
8142 </p>
8143 !! end
8144
8145 !! test
8146 Empty attribute crash test single-quotes (bug 2067)
8147 !! input
8148 <font color=''>foo</font>
8149 !! result
8150 <p><font color="">foo</font>
8151 </p>
8152 !! end
8153
8154 !! test
8155 Attribute test: equals, then nothing
8156 !! input
8157 <font color=>foo</font>
8158 !! result
8159 <p><font>foo</font>
8160 </p>
8161 !! end
8162
8163 !! test
8164 Attribute test: unquoted value
8165 !! input
8166 <font color=x>foo</font>
8167 !! result
8168 <p><font color="x">foo</font>
8169 </p>
8170 !! end
8171
8172 !! test
8173 Attribute test: unquoted but illegal value (hash)
8174 !! input
8175 <font color=#x>foo</font>
8176 !! result
8177 <p><font color="#x">foo</font>
8178 </p>
8179 !! end
8180
8181 !! test
8182 Attribute test: no value
8183 !! input
8184 <font color>foo</font>
8185 !! result
8186 <p><font color="color">foo</font>
8187 </p>
8188 !! end
8189
8190 !! test
8191 Bug 2095: link with three closing brackets
8192 !! input
8193 [[Main Page]]]
8194 !! result
8195 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8196 </p>
8197 !! end
8198
8199 !! test
8200 Bug 2095: link with pipe and three closing brackets
8201 !! input
8202 [[Main Page|link]]]
8203 !! result
8204 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8205 </p>
8206 !! end
8207
8208 !! test
8209 Bug 2095: link with pipe and three closing brackets, version 2
8210 !! input
8211 [[Main Page|[http://example.com/]]]
8212 !! result
8213 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8214 </p>
8215 !! end
8216
8217
8218 ###
8219 ### Safety
8220 ###
8221
8222 !! article
8223 Template:Dangerous attribute
8224 !! text
8225 " onmouseover="alert(document.cookie)
8226 !! endarticle
8227
8228 !! article
8229 Template:Dangerous style attribute
8230 !! text
8231 border-size: expression(alert(document.cookie))
8232 !! endarticle
8233
8234 !! article
8235 Template:Div style
8236 !! text
8237 <div style="float: right; {{{1}}}">Magic div</div>
8238 !! endarticle
8239
8240 !! test
8241 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8242 !! input
8243 <div title="{{test}}"></div>
8244 !! result
8245 <div title="This is a test template"></div>
8246
8247 !! end
8248
8249 !! test
8250 Bug 2304: HTML attribute safety (dangerous template; 2309)
8251 !! input
8252 <div title="{{dangerous attribute}}"></div>
8253 !! result
8254 <div title=""></div>
8255
8256 !! end
8257
8258 !! test
8259 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8260 !! input
8261 <div style="{{dangerous style attribute}}"></div>
8262 !! result
8263 <div style="/* insecure input */"></div>
8264
8265 !! end
8266
8267 !! test
8268 Bug 2304: HTML attribute safety (safe parameter; 2309)
8269 !! input
8270 {{div style|width: 200px}}
8271 !! result
8272 <div style="float: right; width: 200px">Magic div</div>
8273
8274 !! end
8275
8276 !! test
8277 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8278 !! input
8279 {{div style|width: expression(alert(document.cookie))}}
8280 !! result
8281 <div style="/* insecure input */">Magic div</div>
8282
8283 !! end
8284
8285 !! test
8286 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8287 !! input
8288 {{div style|"><script>alert(document.cookie)</script>}}
8289 !! result
8290 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8291
8292 !! end
8293
8294 !! test
8295 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8296 !! input
8297 {{div style|" ><script>alert(document.cookie)</script>}}
8298 !! result
8299 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8300
8301 !! end
8302
8303 !! test
8304 Bug 2304: HTML attribute safety (link)
8305 !! input
8306 <div title="[[Main Page]]"></div>
8307 !! result
8308 <div title="&#91;&#91;Main Page]]"></div>
8309
8310 !! end
8311
8312 !! test
8313 Bug 2304: HTML attribute safety (italics)
8314 !! input
8315 <div title="''foobar''"></div>
8316 !! result
8317 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8318
8319 !! end
8320
8321 !! test
8322 Bug 2304: HTML attribute safety (bold)
8323 !! input
8324 <div title="'''foobar'''"></div>
8325 !! result
8326 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8327
8328 !! end
8329
8330
8331 !! test
8332 Bug 2304: HTML attribute safety (ISBN)
8333 !! input
8334 <div title="ISBN 1234567890"></div>
8335 !! result
8336 <div title="&#73;SBN 1234567890"></div>
8337
8338 !! end
8339
8340 !! test
8341 Bug 2304: HTML attribute safety (RFC)
8342 !! input
8343 <div title="RFC 1234"></div>
8344 !! result
8345 <div title="&#82;FC 1234"></div>
8346
8347 !! end
8348
8349 !! test
8350 Bug 2304: HTML attribute safety (PMID)
8351 !! input
8352 <div title="PMID 1234567890"></div>
8353 !! result
8354 <div title="&#80;MID 1234567890"></div>
8355
8356 !! end
8357
8358 !! test
8359 Bug 2304: HTML attribute safety (web link)
8360 !! input
8361 <div title="http://example.com/"></div>
8362 !! result
8363 <div title="http&#58;//example.com/"></div>
8364
8365 !! end
8366
8367 !! test
8368 Bug 2304: HTML attribute safety (named web link)
8369 !! input
8370 <div title="[http://example.com/ link]"></div>
8371 !! result
8372 <div title="&#91;http&#58;//example.com/ link]"></div>
8373
8374 !! end
8375
8376 !! test
8377 Bug 3244: HTML attribute safety (extension; safe)
8378 !! input
8379 <div style="<nowiki>background:blue</nowiki>"></div>
8380 !! result
8381 <div style="background:blue"></div>
8382
8383 !! end
8384
8385 !! test
8386 Bug 3244: HTML attribute safety (extension; unsafe)
8387 !! input
8388 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8389 !! result
8390 <div style="/* insecure input */"></div>
8391
8392 !! end
8393
8394 # More MSIE fun discovered by Tom Gilder
8395
8396 !! test
8397 MSIE CSS safety test: spurious slash
8398 !! input
8399 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8400 !! result
8401 <div style="/* insecure input */">evil</div>
8402
8403 !! end
8404
8405 !! test
8406 MSIE CSS safety test: hex code
8407 !! input
8408 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8409 !! result
8410 <div style="/* insecure input */">evil</div>
8411
8412 !! end
8413
8414 !! test
8415 MSIE CSS safety test: comment in url
8416 !! input
8417 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8418 !! result
8419 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8420
8421 !! end
8422
8423 !! test
8424 MSIE CSS safety test: comment in expression
8425 !! input
8426 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8427 !! result
8428 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8429
8430 !! end
8431
8432
8433 !! test
8434 Table attribute legitimate extension
8435 !! input
8436 {|
8437 !+ style="<nowiki>color:blue</nowiki>"| status
8438 |}
8439 !! result
8440 <table>
8441 <tr>
8442 <th style="color:blue"> status
8443 </th></tr></table>
8444
8445 !!end
8446
8447 !! test
8448 Table attribute safety
8449 !! input
8450 {|
8451 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8452 |}
8453 !! result
8454 <table>
8455 <tr>
8456 <th style="/* insecure input */"> status
8457 </th></tr></table>
8458
8459 !! end
8460
8461 !! test
8462 CSS line continuation 1
8463 !! input
8464 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8465 !! result
8466 <div style="/* insecure input */"></div>
8467
8468 !! end
8469
8470 !! test
8471 CSS line continuation 2
8472 !! input
8473 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8474 !! result
8475 <div style="/* insecure input */"></div>
8476
8477 !! end
8478
8479 !! article
8480 Template:Identity
8481 !! text
8482 {{{1}}}
8483 !! endarticle
8484
8485 !! test
8486 Expansion of multi-line templates in attribute values (bug 6255)
8487 !! input
8488 <div style="background: {{identity|#00FF00}}">-</div>
8489 !! result
8490 <div style="background: #00FF00">-</div>
8491
8492 !! end
8493
8494
8495 !! test
8496 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8497 !! input
8498 <div style="background:
8499 #00FF00">-</div>
8500 !! result
8501 <div style="background: #00FF00">-</div>
8502
8503 !! end
8504
8505 !! test
8506 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8507 !! input
8508 <div style="background: &#10;#00FF00">-</div>
8509 !! result
8510 <div style="background: &#10;#00FF00">-</div>
8511
8512 !! end
8513
8514 ###
8515 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8516 ###
8517 !! test
8518 Parser hook: empty input
8519 !! input
8520 <tag></tag>
8521 !! result
8522 <pre>
8523 ''
8524 array (
8525 )
8526 </pre>
8527
8528 !! end
8529
8530 !! test
8531 Parser hook: empty input using terminated empty elements
8532 !! input
8533 <tag/>
8534 !! result
8535 <pre>
8536 NULL
8537 array (
8538 )
8539 </pre>
8540
8541 !! end
8542
8543 !! test
8544 Parser hook: empty input using terminated empty elements (space before)
8545 !! input
8546 <tag />
8547 !! result
8548 <pre>
8549 NULL
8550 array (
8551 )
8552 </pre>
8553
8554 !! end
8555
8556 !! test
8557 Parser hook: basic input
8558 !! input
8559 <tag>input</tag>
8560 !! result
8561 <pre>
8562 'input'
8563 array (
8564 )
8565 </pre>
8566
8567 !! end
8568
8569
8570 !! test
8571 Parser hook: case insensitive
8572 !! input
8573 <TAG>input</TAG>
8574 !! result
8575 <pre>
8576 'input'
8577 array (
8578 )
8579 </pre>
8580
8581 !! end
8582
8583
8584 !! test
8585 Parser hook: case insensitive, redux
8586 !! input
8587 <TaG>input</TAg>
8588 !! result
8589 <pre>
8590 'input'
8591 array (
8592 )
8593 </pre>
8594
8595 !! end
8596
8597 !! test
8598 Parser hook: nested tags
8599 !! options
8600 noxml
8601 !! input
8602 <tag><tag></tag></tag>
8603 !! result
8604 <pre>
8605 '<tag>'
8606 array (
8607 )
8608 </pre>&lt;/tag&gt;
8609
8610 !! end
8611
8612 !! test
8613 Parser hook: basic arguments
8614 !! input
8615 <tag width=200 height = "100" depth = '50' square></tag>
8616 !! result
8617 <pre>
8618 ''
8619 array (
8620 'width' => '200',
8621 'height' => '100',
8622 'depth' => '50',
8623 'square' => 'square',
8624 )
8625 </pre>
8626
8627 !! end
8628
8629 !! test
8630 Parser hook: argument containing a forward slash (bug 5344)
8631 !! input
8632 <tag filename='/tmp/bla'></tag>
8633 !! result
8634 <pre>
8635 ''
8636 array (
8637 'filename' => '/tmp/bla',
8638 )
8639 </pre>
8640
8641 !! end
8642
8643 !! test
8644 Parser hook: empty input using terminated empty elements (bug 2374)
8645 !! input
8646 <tag foo=bar/>text
8647 !! result
8648 <pre>
8649 NULL
8650 array (
8651 'foo' => 'bar',
8652 )
8653 </pre>text
8654
8655 !! end
8656
8657 # </tag> should be output literally since there is no matching tag that begins it
8658 !! test
8659 Parser hook: basic arguments using terminated empty elements (bug 2374)
8660 !! input
8661 <tag width=200 height = "100" depth = '50' square/>
8662 other stuff
8663 </tag>
8664 !! result
8665 <pre>
8666 NULL
8667 array (
8668 'width' => '200',
8669 'height' => '100',
8670 'depth' => '50',
8671 'square' => 'square',
8672 )
8673 </pre>
8674 <p>other stuff
8675 &lt;/tag&gt;
8676 </p>
8677 !! end
8678
8679 ###
8680 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8681 ###
8682
8683 !! test
8684 Parser hook: static parser hook not inside a comment
8685 !! input
8686 <statictag>hello, world</statictag>
8687 <statictag action=flush/>
8688 !! result
8689 <p>hello, world
8690 </p>
8691 !! end
8692
8693
8694 !! test
8695 Parser hook: static parser hook inside a comment
8696 !! input
8697 <!-- <statictag>hello, world</statictag> -->
8698 <statictag action=flush/>
8699 !! result
8700 <p><br />
8701 </p>
8702 !! end
8703
8704 # Nested template calls; this case was broken by Parser.php rev 1.506,
8705 # since reverted.
8706
8707 !! article
8708 Template:One-parameter
8709 !! text
8710 (My parameter is: {{{1}}})
8711 !! endarticle
8712
8713 !! article
8714 Template:Map-one-parameter
8715 !! text
8716 {{{{{1}}}|{{{2}}}}}
8717 !! endarticle
8718
8719 !! test
8720 Nested template calls
8721 !! input
8722 {{Map-one-parameter|One-parameter|param}}
8723 !! result
8724 <p>(My parameter is: param)
8725 </p>
8726 !! end
8727
8728
8729 ###
8730 ### Sanitizer
8731 ###
8732 !! test
8733 Sanitizer: Closing of open tags
8734 !! input
8735 <s></s><table></table>
8736 !! result
8737 <s></s><table></table>
8738
8739 !! end
8740
8741 !! test
8742 Sanitizer: Closing of open but not closed tags
8743 !! input
8744 <s>foo
8745 !! result
8746 <p><s>foo</s>
8747 </p>
8748 !! end
8749
8750 !! test
8751 Sanitizer: Closing of closed but not open tags
8752 !! input
8753 </s>
8754 !! result
8755 <p>&lt;/s&gt;
8756 </p>
8757 !! end
8758
8759 !! test
8760 Sanitizer: Closing of closed but not open table tags
8761 !! input
8762 Table not started</td></tr></table>
8763 !! result
8764 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8765 </p>
8766 !! end
8767
8768 !! test
8769 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8770 !! input
8771 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8772 !! result
8773 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8774 </p>
8775 !! end
8776
8777 !! test
8778 Sanitizer: Validating the contents of the id attribute (bug 4515)
8779 !! options
8780 disabled
8781 !! input
8782 <br id=9 />
8783 !! result
8784 Something, but definitely not <br id="9" />...
8785 !! end
8786
8787 !! test
8788 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8789 !! options
8790 disabled
8791 !! input
8792 <br id="foo" /><br id="foo" />
8793 !! result
8794 Something need to be done. foo-2 ?
8795 !! end
8796
8797 !! test
8798 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8799 !! input
8800 <div itemscope>
8801 <meta itemprop="hello" content="world">
8802 <meta http-equiv="refresh" content="5">
8803 <meta itemprop="hello" http-equiv="refresh" content="5">
8804 <link itemprop="hello" href="{{SERVER}}">
8805 <link rel="stylesheet" href="{{SERVER}}">
8806 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8807 </div>
8808 !! result
8809 <div itemscope="itemscope">
8810 <p> <meta itemprop="hello" content="world" />
8811 &lt;meta http-equiv="refresh" content="5"&gt;
8812 <meta itemprop="hello" content="5" />
8813 </p>
8814 <link itemprop="hello" href="http&#58;//example.org" />
8815 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
8816 <link itemprop="hello" href="http&#58;//example.org" />
8817 </div>
8818
8819 !! end
8820
8821 !! test
8822 Language converter: output gets cut off unexpectedly (bug 5757)
8823 !! options
8824 language=zh
8825 !! input
8826 this bit is safe: }-
8827
8828 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8829
8830 then we get cut off here: }-
8831
8832 all additional text is vanished
8833 !! result
8834 <p>this bit is safe: }-
8835 </p><p>but if we add a conversion instance: xxx
8836 </p><p>then we get cut off here: }-
8837 </p><p>all additional text is vanished
8838 </p>
8839 !! end
8840
8841 !! test
8842 Self closed html pairs (bug 5487)
8843 !! options
8844 !! input
8845 <center><font id="bug" />Centered text</center>
8846 <div><font id="bug2" />In div text</div>
8847 !! result
8848 <center>&lt;font id="bug" /&gt;Centered text</center>
8849 <div>&lt;font id="bug2" /&gt;In div text</div>
8850
8851 !! end
8852
8853 #
8854 #
8855 #
8856
8857 !! test
8858 Punctuation: nbsp before exclamation
8859 !! input
8860 C'est grave !
8861 !! result
8862 <p>C'est grave&#160;!
8863 </p>
8864 !! end
8865
8866 !! test
8867 Punctuation: CSS !important (bug 11874)
8868 !! input
8869 <div style="width:50% !important">important</div>
8870 !! result
8871 <div style="width:50% !important">important</div>
8872
8873 !!end
8874
8875 !! test
8876 Punctuation: CSS ! important (bug 11874; with space after)
8877 !! input
8878 <div style="width:50% ! important">important</div>
8879 !! result
8880 <div style="width:50% ! important">important</div>
8881
8882 !!end
8883
8884
8885 !! test
8886 HTML bullet list, closed tags (bug 5497)
8887 !! input
8888 <ul>
8889 <li>One</li>
8890 <li>Two</li>
8891 </ul>
8892 !! result
8893 <ul>
8894 <li>One</li>
8895 <li>Two</li>
8896 </ul>
8897
8898 !! end
8899
8900 !! test
8901 HTML bullet list, unclosed tags (bug 5497)
8902 !! options
8903 disabled
8904 !! input
8905 <ul>
8906 <li>One
8907 <li>Two
8908 </ul>
8909 !! result
8910 <ul>
8911 <li>One
8912 </li><li>Two
8913 </li></ul>
8914
8915 !! end
8916
8917 !! test
8918 HTML ordered list, closed tags (bug 5497)
8919 !! input
8920 <ol>
8921 <li>One</li>
8922 <li>Two</li>
8923 </ol>
8924 !! result
8925 <ol>
8926 <li>One</li>
8927 <li>Two</li>
8928 </ol>
8929
8930 !! end
8931
8932 !! test
8933 HTML ordered list, unclosed tags (bug 5497)
8934 !! options
8935 disabled
8936 !! input
8937 <ol>
8938 <li>One
8939 <li>Two
8940 </ol>
8941 !! result
8942 <ol>
8943 <li>One
8944 </li><li>Two
8945 </li></ol>
8946
8947 !! end
8948
8949 !! test
8950 HTML nested bullet list, closed tags (bug 5497)
8951 !! input
8952 <ul>
8953 <li>One</li>
8954 <li>Two:
8955 <ul>
8956 <li>Sub-one</li>
8957 <li>Sub-two</li>
8958 </ul>
8959 </li>
8960 </ul>
8961 !! result
8962 <ul>
8963 <li>One</li>
8964 <li>Two:
8965 <ul>
8966 <li>Sub-one</li>
8967 <li>Sub-two</li>
8968 </ul>
8969 </li>
8970 </ul>
8971
8972 !! end
8973
8974 !! test
8975 HTML nested bullet list, open tags (bug 5497)
8976 !! options
8977 disabled
8978 !! input
8979 <ul>
8980 <li>One
8981 <li>Two:
8982 <ul>
8983 <li>Sub-one
8984 <li>Sub-two
8985 </ul>
8986 </ul>
8987 !! result
8988 <ul>
8989 <li>One
8990 </li><li>Two:
8991 <ul>
8992 <li>Sub-one
8993 </li><li>Sub-two
8994 </li></ul>
8995 </li></ul>
8996
8997 !! end
8998
8999 !! test
9000 HTML nested ordered list, closed tags (bug 5497)
9001 !! input
9002 <ol>
9003 <li>One</li>
9004 <li>Two:
9005 <ol>
9006 <li>Sub-one</li>
9007 <li>Sub-two</li>
9008 </ol>
9009 </li>
9010 </ol>
9011 !! result
9012 <ol>
9013 <li>One</li>
9014 <li>Two:
9015 <ol>
9016 <li>Sub-one</li>
9017 <li>Sub-two</li>
9018 </ol>
9019 </li>
9020 </ol>
9021
9022 !! end
9023
9024 !! test
9025 HTML nested ordered list, open tags (bug 5497)
9026 !! options
9027 disabled
9028 !! input
9029 <ol>
9030 <li>One
9031 <li>Two:
9032 <ol>
9033 <li>Sub-one
9034 <li>Sub-two
9035 </ol>
9036 </ol>
9037 !! result
9038 <ol>
9039 <li>One
9040 </li><li>Two:
9041 <ol>
9042 <li>Sub-one
9043 </li><li>Sub-two
9044 </li></ol>
9045 </li></ol>
9046
9047 !! end
9048
9049 !! test
9050 HTML ordered list item with parameters oddity
9051 !! input
9052 <ol><li id="fragment">One</li></ol>
9053 !! result
9054 <ol><li id="fragment">One</li></ol>
9055
9056 !! end
9057
9058 !!test
9059 bug 5918: autonumbering
9060 !! input
9061 [http://first/] [http://second] [ftp://ftp]
9062
9063 ftp://inlineftp
9064
9065 [mailto:enclosed@mail.tld With target]
9066
9067 [mailto:enclosed@mail.tld]
9068
9069 mailto:inline@mail.tld
9070 !! result
9071 <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>
9072 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9073 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9074 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9075 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9076 </p>
9077 !! end
9078
9079
9080 #
9081 # Security and HTML correctness
9082 # From Nick Jenkins' fuzz testing
9083 #
9084
9085 !! test
9086 Fuzz testing: Parser13
9087 !! input
9088 {|
9089 | http://a|
9090 !! result
9091 <table>
9092 <tr>
9093 <td>
9094 </td>
9095 </tr>
9096 </table>
9097
9098 !! end
9099
9100 !! test
9101 Fuzz testing: Parser14
9102 !! input
9103 == onmouseover= ==
9104 http://__TOC__
9105 !! result
9106 <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>
9107 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9108 <ul>
9109 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9110 </ul>
9111 </td></tr></table>
9112
9113 !! end
9114
9115 !! test
9116 Fuzz testing: Parser14-table
9117 !! input
9118 ==a==
9119 {| STYLE=__TOC__
9120 !! result
9121 <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>
9122 <table style="&#95;_TOC&#95;_">
9123 <tr><td></td></tr>
9124 </table>
9125
9126 !! end
9127
9128 # Known to produce bogus xml (extra </td>)
9129 !! test
9130 Fuzz testing: Parser16
9131 !! options
9132 noxml
9133 !! input
9134 {|
9135 !https://||||||
9136 !! result
9137 <table>
9138 <tr>
9139 <th>https://</th>
9140 <th></th>
9141 <th></th>
9142 <th>
9143 </td>
9144 </tr>
9145 </table>
9146
9147 !! end
9148
9149 !! test
9150 Fuzz testing: Parser21
9151 !! input
9152 {|
9153 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9154 |
9155 !! result
9156 <table>
9157 <tr>
9158 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9159 </th>
9160 <td>
9161 </td>
9162 </tr>
9163 </table>
9164
9165 !! end
9166
9167 !! test
9168 Fuzz testing: Parser22
9169 !! input
9170 http://===r:::https://b
9171
9172 {|
9173 !!result
9174 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9175 </p>
9176 <table>
9177 <tr><td></td></tr>
9178 </table>
9179
9180 !! end
9181
9182 # Known to produce bad XML for now
9183 !! test
9184 Fuzz testing: Parser24
9185 !! options
9186 noxml
9187 !! input
9188 {|
9189 {{{|
9190 <u CLASS=
9191 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9192 <br style="onmouseover='alert(document.cookie);' " />
9193
9194 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9195 |
9196 !! result
9197 <table>
9198 {{{|
9199 <u class="&#124;">}}}} &gt;
9200 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9201
9202 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9203 <tr>
9204 <td></u>
9205 </td>
9206 </tr>
9207 </table>
9208
9209 !! end
9210
9211 # Note: the current result listed for this is not what the original one was,
9212 # but the original bug was JavaScript injection, which is fixed in any case.
9213 # It's not clear that the original result listed was any more correct than the
9214 # current one. Original result:
9215 # <p>{{{|
9216 # </p>
9217 # <li class="&#124;&#124;">
9218 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9219 !!test
9220 Fuzz testing: Parser25 (bug 6055)
9221 !! input
9222 {{{
9223 |
9224 <LI CLASS=||
9225 >
9226 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9227 !! result
9228 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9229 </p>
9230 !! end
9231
9232 !!test
9233 Fuzz testing: URL adjacent extension (with space, clean)
9234 !! options
9235 !! input
9236 http://example.com <nowiki>junk</nowiki>
9237 !! result
9238 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9239 </p>
9240 !!end
9241
9242 !!test
9243 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9244 !! options
9245 !! input
9246 http://example.com<nowiki>junk</nowiki>
9247 !! result
9248 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9249 </p>
9250 !!end
9251
9252 !!test
9253 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9254 !! options
9255 !! input
9256 http://example.com<pre>junk</pre>
9257 !! result
9258 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9259
9260 !!end
9261
9262 !!test
9263 Fuzz testing: image with bogus manual thumbnail
9264 !!input
9265 [[Image:foobar.jpg|thumbnail= ]]
9266 !!result
9267 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9268
9269 !!end
9270
9271 !! test
9272 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9273 !! input
9274 <pre dir="&#10;"></pre>
9275 !! result
9276 <pre dir="&#10;"></pre>
9277
9278 !! end
9279
9280 !! test
9281 Parsing optional HTML elements (Bug 6171)
9282 !! options
9283 !! input
9284 <table>
9285 <tr>
9286 <td> Some tabular data</td>
9287 <td> More tabular data ...
9288 <td> And yet som tabular data</td>
9289 </tr>
9290 </table>
9291 !! result
9292 <table>
9293 <tr>
9294 <td> Some tabular data</td>
9295 <td> More tabular data ...
9296 </td><td> And yet som tabular data</td>
9297 </tr>
9298 </table>
9299
9300 !! end
9301
9302 !! test
9303 Correct handling of <td>, <tr> (Bug 6171)
9304 !! options
9305 !! input
9306 <table>
9307 <tr>
9308 <td> Some tabular data</td>
9309 <td> More tabular data ...</td>
9310 <td> And yet som tabular data</td>
9311 </tr>
9312 </table>
9313 !! result
9314 <table>
9315 <tr>
9316 <td> Some tabular data</td>
9317 <td> More tabular data ...</td>
9318 <td> And yet som tabular data</td>
9319 </tr>
9320 </table>
9321
9322 !! end
9323
9324
9325 !! test
9326 Parsing crashing regression (fr:JavaScript)
9327 !! input
9328 </body></x>
9329 !! result
9330 <p>&lt;/body&gt;&lt;/x&gt;
9331 </p>
9332 !! end
9333
9334 !! test
9335 Inline wiki vs wiki block nesting
9336 !! input
9337 '''Bold paragraph
9338
9339 New wiki paragraph
9340 !! result
9341 <p><b>Bold paragraph</b>
9342 </p><p>New wiki paragraph
9343 </p>
9344 !! end
9345
9346 !! test
9347 Inline HTML vs wiki block nesting
9348 !! options
9349 disabled
9350 !! input
9351 <b>Bold paragraph
9352
9353 New wiki paragraph
9354 !! result
9355 <p><b>Bold paragraph</b>
9356 </p><p>New wiki paragraph
9357 </p>
9358 !! end
9359
9360 # Original result was this:
9361 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9362 # </p>
9363 # While that might be marginally more intuitive, maybe, the six-apostrophe
9364 # construct is clearly pathological and the result stated here (which is what
9365 # the parser actually does) is about as reasonable as anything.
9366 !!test
9367 Mixing markup for italics and bold
9368 !! options
9369 !! input
9370 '''bold''''''bold''bolditalics'''''
9371 !! result
9372 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9373 </p>
9374 !! end
9375
9376
9377 !! article
9378 Xyzzyx
9379 !! text
9380 Article for special page transclusion test
9381 !! endarticle
9382
9383 !! test
9384 Special page transclusion
9385 !! options
9386 !! input
9387 {{Special:Prefixindex/Xyzzyx}}
9388 !! result
9389 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9390
9391 !! end
9392
9393 !! test
9394 Special page transclusion twice (bug 5021)
9395 !! options
9396 !! input
9397 {{Special:Prefixindex/Xyzzyx}}
9398 {{Special:Prefixindex/Xyzzyx}}
9399 !! result
9400 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9401 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9402
9403 !! end
9404
9405 !! test
9406 Transclusion of default MediaWiki message
9407 !! input
9408 {{MediaWiki:Mainpage}}
9409 !!result
9410 <p>Main Page
9411 </p>
9412 !! end
9413
9414 !! test
9415 Transclusion of nonexistent MediaWiki message
9416 !! input
9417 {{MediaWiki:Mainpagexxx}}
9418 !!result
9419 <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>
9420 </p>
9421 !! end
9422
9423 !! test
9424 Transclusion of MediaWiki message with underscore
9425 !! input
9426 {{MediaWiki:history_short}}
9427 !! result
9428 <p>History
9429 </p>
9430 !! end
9431
9432 !! test
9433 Transclusion of MediaWiki message with space
9434 !! input
9435 {{MediaWiki:history short}}
9436 !! result
9437 <p>History
9438 </p>
9439 !! end
9440
9441 !! test
9442 Invalid header with following text
9443 !! input
9444 = x = y
9445 !! result
9446 <p>= x = y
9447 </p>
9448 !! end
9449
9450
9451 !! test
9452 Section extraction test (section 0)
9453 !! options
9454 section=0
9455 !! input
9456 start
9457 ==a==
9458 ===aa===
9459 ====aaa====
9460 ==b==
9461 ===ba===
9462 ===bb===
9463 ====bba====
9464 ===bc===
9465 ==c==
9466 ===ca===
9467 !! result
9468 start
9469 !! end
9470
9471 !! test
9472 Section extraction test (section 1)
9473 !! options
9474 section=1
9475 !! input
9476 start
9477 ==a==
9478 ===aa===
9479 ====aaa====
9480 ==b==
9481 ===ba===
9482 ===bb===
9483 ====bba====
9484 ===bc===
9485 ==c==
9486 ===ca===
9487 !! result
9488 ==a==
9489 ===aa===
9490 ====aaa====
9491 !! end
9492
9493 !! test
9494 Section extraction test (section 2)
9495 !! options
9496 section=2
9497 !! input
9498 start
9499 ==a==
9500 ===aa===
9501 ====aaa====
9502 ==b==
9503 ===ba===
9504 ===bb===
9505 ====bba====
9506 ===bc===
9507 ==c==
9508 ===ca===
9509 !! result
9510 ===aa===
9511 ====aaa====
9512 !! end
9513
9514 !! test
9515 Section extraction test (section 3)
9516 !! options
9517 section=3
9518 !! input
9519 start
9520 ==a==
9521 ===aa===
9522 ====aaa====
9523 ==b==
9524 ===ba===
9525 ===bb===
9526 ====bba====
9527 ===bc===
9528 ==c==
9529 ===ca===
9530 !! result
9531 ====aaa====
9532 !! end
9533
9534 !! test
9535 Section extraction test (section 4)
9536 !! options
9537 section=4
9538 !! input
9539 start
9540 ==a==
9541 ===aa===
9542 ====aaa====
9543 ==b==
9544 ===ba===
9545 ===bb===
9546 ====bba====
9547 ===bc===
9548 ==c==
9549 ===ca===
9550 !! result
9551 ==b==
9552 ===ba===
9553 ===bb===
9554 ====bba====
9555 ===bc===
9556 !! end
9557
9558 !! test
9559 Section extraction test (section 5)
9560 !! options
9561 section=5
9562 !! input
9563 start
9564 ==a==
9565 ===aa===
9566 ====aaa====
9567 ==b==
9568 ===ba===
9569 ===bb===
9570 ====bba====
9571 ===bc===
9572 ==c==
9573 ===ca===
9574 !! result
9575 ===ba===
9576 !! end
9577
9578 !! test
9579 Section extraction test (section 6)
9580 !! options
9581 section=6
9582 !! input
9583 start
9584 ==a==
9585 ===aa===
9586 ====aaa====
9587 ==b==
9588 ===ba===
9589 ===bb===
9590 ====bba====
9591 ===bc===
9592 ==c==
9593 ===ca===
9594 !! result
9595 ===bb===
9596 ====bba====
9597 !! end
9598
9599 !! test
9600 Section extraction test (section 7)
9601 !! options
9602 section=7
9603 !! input
9604 start
9605 ==a==
9606 ===aa===
9607 ====aaa====
9608 ==b==
9609 ===ba===
9610 ===bb===
9611 ====bba====
9612 ===bc===
9613 ==c==
9614 ===ca===
9615 !! result
9616 ====bba====
9617 !! end
9618
9619 !! test
9620 Section extraction test (section 8)
9621 !! options
9622 section=8
9623 !! input
9624 start
9625 ==a==
9626 ===aa===
9627 ====aaa====
9628 ==b==
9629 ===ba===
9630 ===bb===
9631 ====bba====
9632 ===bc===
9633 ==c==
9634 ===ca===
9635 !! result
9636 ===bc===
9637 !! end
9638
9639 !! test
9640 Section extraction test (section 9)
9641 !! options
9642 section=9
9643 !! input
9644 start
9645 ==a==
9646 ===aa===
9647 ====aaa====
9648 ==b==
9649 ===ba===
9650 ===bb===
9651 ====bba====
9652 ===bc===
9653 ==c==
9654 ===ca===
9655 !! result
9656 ==c==
9657 ===ca===
9658 !! end
9659
9660 !! test
9661 Section extraction test (section 10)
9662 !! options
9663 section=10
9664 !! input
9665 start
9666 ==a==
9667 ===aa===
9668 ====aaa====
9669 ==b==
9670 ===ba===
9671 ===bb===
9672 ====bba====
9673 ===bc===
9674 ==c==
9675 ===ca===
9676 !! result
9677 ===ca===
9678 !! end
9679
9680 !! test
9681 Section extraction test (nonexistent section 11)
9682 !! options
9683 section=11
9684 !! input
9685 start
9686 ==a==
9687 ===aa===
9688 ====aaa====
9689 ==b==
9690 ===ba===
9691 ===bb===
9692 ====bba====
9693 ===bc===
9694 ==c==
9695 ===ca===
9696 !! result
9697 !! end
9698
9699 !! test
9700 Section extraction test with bogus heading (section 1)
9701 !! options
9702 section=1
9703 !! input
9704 ==a==
9705 ==bogus== not a legal section
9706 ==b==
9707 !! result
9708 ==a==
9709 ==bogus== not a legal section
9710 !! end
9711
9712 !! test
9713 Section extraction test with bogus heading (section 2)
9714 !! options
9715 section=2
9716 !! input
9717 ==a==
9718 ==bogus== not a legal section
9719 ==b==
9720 !! result
9721 ==b==
9722 !! end
9723
9724 !! test
9725 Section extraction test with comment after heading (section 1)
9726 !! options
9727 section=1
9728 !! input
9729 ==a==
9730 ==b== <!-- -->
9731 ==c==
9732 !! result
9733 ==a==
9734 !! end
9735
9736 !! test
9737 Section extraction test with comment after heading (section 2)
9738 !! options
9739 section=2
9740 !! input
9741 ==a==
9742 ==b== <!-- -->
9743 ==c==
9744 !! result
9745 ==b== <!-- -->
9746 !! end
9747
9748 !! test
9749 Section extraction test with bogus <nowiki> heading (section 1)
9750 !! options
9751 section=1
9752 !! input
9753 ==a==
9754 ==bogus== <nowiki>not a legal section</nowiki>
9755 ==b==
9756 !! result
9757 ==a==
9758 ==bogus== <nowiki>not a legal section</nowiki>
9759 !! end
9760
9761 !! test
9762 Section extraction test with bogus <nowiki> heading (section 2)
9763 !! options
9764 section=2
9765 !! input
9766 ==a==
9767 ==bogus== <nowiki>not a legal section</nowiki>
9768 ==b==
9769 !! result
9770 ==b==
9771 !! end
9772
9773
9774 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9775 # instead of respecting commented sections
9776 !! test
9777 Section extraction prefixed by comment (section 1)
9778 !! options
9779 section=1
9780 !! input
9781 <!-- -->==sec1==
9782 ==sec2==
9783 !!result
9784 ==sec2==
9785 !!end
9786
9787 !! test
9788 Section extraction prefixed by comment (section 2)
9789 !! options
9790 section=2
9791 !! input
9792 <!-- -->==sec1==
9793 ==sec2==
9794 !!result
9795
9796 !!end
9797
9798
9799 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9800 # instead of respecting HTML-style headings
9801 !! test
9802 Section extraction, mixed wiki and html (section 1)
9803 !! options
9804 section=1
9805 !! input
9806 <h2>unmarked</h2>
9807 unmarked
9808 ==1==
9809 one
9810 ==2==
9811 two
9812 !! result
9813 ==1==
9814 one
9815 !! end
9816
9817 !! test
9818 Section extraction, mixed wiki and html (section 2)
9819 !! options
9820 section=2
9821 !! input
9822 <h2>unmarked</h2>
9823 unmarked
9824 ==1==
9825 one
9826 ==2==
9827 two
9828 !! result
9829 ==2==
9830 two
9831 !! end
9832
9833
9834 # Formerly testing for bug 3342
9835 !! test
9836 Section extraction, heading surrounded by <noinclude>
9837 !! options
9838 section=1
9839 !! input
9840 <noinclude>==unmarked==</noinclude>
9841 ==marked==
9842 !! result
9843 ==marked==
9844 !!end
9845
9846 # Test behaviour of bug 19910
9847 !! test
9848 Sectiion with all-equals
9849 !! options
9850 section=2
9851 !! input
9852 ===
9853 The line above must have a trailing space
9854 === <!--
9855 --> <!-- -->
9856 But just in case it doesn't...
9857 !! result
9858 === <!--
9859 --> <!-- -->
9860 But just in case it doesn't...
9861 !! end
9862
9863 !! test
9864 Section replacement test (section 0)
9865 !! options
9866 replace=0,"xxx"
9867 !! input
9868 start
9869 ==a==
9870 ===aa===
9871 ====aaa====
9872 ==b==
9873 ===ba===
9874 ===bb===
9875 ====bba====
9876 ===bc===
9877 ==c==
9878 ===ca===
9879 !! result
9880 xxx
9881
9882 ==a==
9883 ===aa===
9884 ====aaa====
9885 ==b==
9886 ===ba===
9887 ===bb===
9888 ====bba====
9889 ===bc===
9890 ==c==
9891 ===ca===
9892 !! end
9893
9894 !! test
9895 Section replacement test (section 1)
9896 !! options
9897 replace=1,"xxx"
9898 !! input
9899 start
9900 ==a==
9901 ===aa===
9902 ====aaa====
9903 ==b==
9904 ===ba===
9905 ===bb===
9906 ====bba====
9907 ===bc===
9908 ==c==
9909 ===ca===
9910 !! result
9911 start
9912 xxx
9913
9914 ==b==
9915 ===ba===
9916 ===bb===
9917 ====bba====
9918 ===bc===
9919 ==c==
9920 ===ca===
9921 !! end
9922
9923 !! test
9924 Section replacement test (section 2)
9925 !! options
9926 replace=2,"xxx"
9927 !! input
9928 start
9929 ==a==
9930 ===aa===
9931 ====aaa====
9932 ==b==
9933 ===ba===
9934 ===bb===
9935 ====bba====
9936 ===bc===
9937 ==c==
9938 ===ca===
9939 !! result
9940 start
9941 ==a==
9942 xxx
9943
9944 ==b==
9945 ===ba===
9946 ===bb===
9947 ====bba====
9948 ===bc===
9949 ==c==
9950 ===ca===
9951 !! end
9952
9953 !! test
9954 Section replacement test (section 3)
9955 !! options
9956 replace=3,"xxx"
9957 !! input
9958 start
9959 ==a==
9960 ===aa===
9961 ====aaa====
9962 ==b==
9963 ===ba===
9964 ===bb===
9965 ====bba====
9966 ===bc===
9967 ==c==
9968 ===ca===
9969 !! result
9970 start
9971 ==a==
9972 ===aa===
9973 xxx
9974
9975 ==b==
9976 ===ba===
9977 ===bb===
9978 ====bba====
9979 ===bc===
9980 ==c==
9981 ===ca===
9982 !! end
9983
9984 !! test
9985 Section replacement test (section 4)
9986 !! options
9987 replace=4,"xxx"
9988 !! input
9989 start
9990 ==a==
9991 ===aa===
9992 ====aaa====
9993 ==b==
9994 ===ba===
9995 ===bb===
9996 ====bba====
9997 ===bc===
9998 ==c==
9999 ===ca===
10000 !! result
10001 start
10002 ==a==
10003 ===aa===
10004 ====aaa====
10005 xxx
10006
10007 ==c==
10008 ===ca===
10009 !! end
10010
10011 !! test
10012 Section replacement test (section 5)
10013 !! options
10014 replace=5,"xxx"
10015 !! input
10016 start
10017 ==a==
10018 ===aa===
10019 ====aaa====
10020 ==b==
10021 ===ba===
10022 ===bb===
10023 ====bba====
10024 ===bc===
10025 ==c==
10026 ===ca===
10027 !! result
10028 start
10029 ==a==
10030 ===aa===
10031 ====aaa====
10032 ==b==
10033 xxx
10034
10035 ===bb===
10036 ====bba====
10037 ===bc===
10038 ==c==
10039 ===ca===
10040 !! end
10041
10042 !! test
10043 Section replacement test (section 6)
10044 !! options
10045 replace=6,"xxx"
10046 !! input
10047 start
10048 ==a==
10049 ===aa===
10050 ====aaa====
10051 ==b==
10052 ===ba===
10053 ===bb===
10054 ====bba====
10055 ===bc===
10056 ==c==
10057 ===ca===
10058 !! result
10059 start
10060 ==a==
10061 ===aa===
10062 ====aaa====
10063 ==b==
10064 ===ba===
10065 xxx
10066
10067 ===bc===
10068 ==c==
10069 ===ca===
10070 !! end
10071
10072 !! test
10073 Section replacement test (section 7)
10074 !! options
10075 replace=7,"xxx"
10076 !! input
10077 start
10078 ==a==
10079 ===aa===
10080 ====aaa====
10081 ==b==
10082 ===ba===
10083 ===bb===
10084 ====bba====
10085 ===bc===
10086 ==c==
10087 ===ca===
10088 !! result
10089 start
10090 ==a==
10091 ===aa===
10092 ====aaa====
10093 ==b==
10094 ===ba===
10095 ===bb===
10096 xxx
10097
10098 ===bc===
10099 ==c==
10100 ===ca===
10101 !! end
10102
10103 !! test
10104 Section replacement test (section 8)
10105 !! options
10106 replace=8,"xxx"
10107 !! input
10108 start
10109 ==a==
10110 ===aa===
10111 ====aaa====
10112 ==b==
10113 ===ba===
10114 ===bb===
10115 ====bba====
10116 ===bc===
10117 ==c==
10118 ===ca===
10119 !! result
10120 start
10121 ==a==
10122 ===aa===
10123 ====aaa====
10124 ==b==
10125 ===ba===
10126 ===bb===
10127 ====bba====
10128 xxx
10129
10130 ==c==
10131 ===ca===
10132 !!end
10133
10134 !! test
10135 Section replacement test (section 9)
10136 !! options
10137 replace=9,"xxx"
10138 !! input
10139 start
10140 ==a==
10141 ===aa===
10142 ====aaa====
10143 ==b==
10144 ===ba===
10145 ===bb===
10146 ====bba====
10147 ===bc===
10148 ==c==
10149 ===ca===
10150 !! result
10151 start
10152 ==a==
10153 ===aa===
10154 ====aaa====
10155 ==b==
10156 ===ba===
10157 ===bb===
10158 ====bba====
10159 ===bc===
10160 xxx
10161 !! end
10162
10163 !! test
10164 Section replacement test (section 10)
10165 !! options
10166 replace=10,"xxx"
10167 !! input
10168 start
10169 ==a==
10170 ===aa===
10171 ====aaa====
10172 ==b==
10173 ===ba===
10174 ===bb===
10175 ====bba====
10176 ===bc===
10177 ==c==
10178 ===ca===
10179 !! result
10180 start
10181 ==a==
10182 ===aa===
10183 ====aaa====
10184 ==b==
10185 ===ba===
10186 ===bb===
10187 ====bba====
10188 ===bc===
10189 ==c==
10190 xxx
10191 !! end
10192
10193 !! test
10194 Section replacement test with initial whitespace (bug 13728)
10195 !! options
10196 replace=2,"xxx"
10197 !! input
10198 Preformatted initial line
10199 ==a==
10200 ===a===
10201 !! result
10202 Preformatted initial line
10203 ==a==
10204 xxx
10205 !! end
10206
10207
10208 !! test
10209 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10210 !! options
10211 section=1
10212 !! input
10213 ==a==
10214 a
10215 !! result
10216 ==a==
10217 a
10218 !! end
10219
10220 !! test
10221 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10222 !! options
10223 section=1
10224 !! input
10225 ==a==
10226 a
10227 !! result
10228 ==a==
10229 a
10230 !! end
10231
10232
10233 !! test
10234 Section extraction, <pre> around bogus header (bug 10309)
10235 !! options
10236 noxml section=2
10237 !! input
10238 == Section One ==
10239 <pre>
10240 =======
10241 </pre>
10242
10243 == Section Two ==
10244 stuff
10245 !! result
10246 == Section Two ==
10247 stuff
10248 !! end
10249
10250 !! test
10251 Section replacement, <pre> around bogus header (bug 10309)
10252 !! options
10253 noxml replace=2,"xxx"
10254 !! input
10255 == Section One ==
10256 <pre>
10257 =======
10258 </pre>
10259
10260 == Section Two ==
10261 stuff
10262 !! result
10263 == Section One ==
10264 <pre>
10265 =======
10266 </pre>
10267
10268 xxx
10269 !! end
10270
10271
10272
10273 !! test
10274 Handling of &#x0A; in URLs
10275 !! input
10276 **irc://&#x0A;a
10277 !! result
10278 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10279 </li></ul>
10280 </li></ul>
10281
10282 !!end
10283
10284 !! test
10285 5 quotes, code coverage +1 line
10286 !! input
10287 '''''
10288 !! result
10289 !! end
10290
10291 !! test
10292 Special:Search page linking.
10293 !! input
10294 {{Special:search}}
10295 !! result
10296 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10297 </p>
10298 !! end
10299
10300 !! test
10301 Say the magic word
10302 !! input
10303 * {{PAGENAME}}
10304 * {{BASEPAGENAME}}
10305 * {{SUBPAGENAME}}
10306 * {{SUBPAGENAMEE}}
10307 * {{BASEPAGENAME}}
10308 * {{BASEPAGENAMEE}}
10309 * {{TALKPAGENAME}}
10310 * {{TALKPAGENAMEE}}
10311 * {{SUBJECTPAGENAME}}
10312 * {{SUBJECTPAGENAMEE}}
10313 * {{NAMESPACEE}}
10314 * {{NAMESPACE}}
10315 * {{TALKSPACE}}
10316 * {{TALKSPACEE}}
10317 * {{SUBJECTSPACE}}
10318 * {{SUBJECTSPACEE}}
10319 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10320 !! result
10321 <ul><li> Parser test
10322 </li><li> Parser test
10323 </li><li> Parser test
10324 </li><li> Parser_test
10325 </li><li> Parser test
10326 </li><li> Parser_test
10327 </li><li> Talk:Parser test
10328 </li><li> Talk:Parser_test
10329 </li><li> Parser test
10330 </li><li> Parser_test
10331 </li><li>
10332 </li><li>
10333 </li><li> Talk
10334 </li><li> Talk
10335 </li><li>
10336 </li><li>
10337 </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>
10338 </li></ul>
10339
10340 !! end
10341 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10342
10343 !! test
10344 Gallery
10345 !! input
10346 <gallery>
10347 image1.png |
10348 image2.gif|||||
10349
10350 image3|
10351 image4 |300px| centre
10352 image5.svg| http://///////
10353 [[x|xx]]]]
10354 * image6
10355 </gallery>
10356 !! result
10357 <ul class="gallery">
10358 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10359 <div style="height: 150px;">Image1.png</div>
10360 <div class="gallerytext">
10361 </div>
10362 </div></li>
10363 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10364 <div style="height: 150px;">Image2.gif</div>
10365 <div class="gallerytext">
10366 <p>||||
10367 </p>
10368 </div>
10369 </div></li>
10370 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10371 <div style="height: 150px;">Image3</div>
10372 <div class="gallerytext">
10373 </div>
10374 </div></li>
10375 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10376 <div style="height: 150px;">Image4</div>
10377 <div class="gallerytext">
10378 <p>300px| centre
10379 </p>
10380 </div>
10381 </div></li>
10382 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10383 <div style="height: 150px;">Image5.svg</div>
10384 <div class="gallerytext">
10385 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10386 </p>
10387 </div>
10388 </div></li>
10389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10390 <div style="height: 150px;">* image6</div>
10391 <div class="gallerytext">
10392 </div>
10393 </div></li>
10394 </ul>
10395
10396 !! end
10397
10398 !! test
10399 Gallery (with options)
10400 !! input
10401 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10402 File:Nonexistant.jpg|caption
10403 File:Nonexistant.jpg
10404 image:foobar.jpg|some '''caption''' [[Main Page]]
10405 image:foobar.jpg
10406 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10407 </gallery>
10408 !! result
10409 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10410 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10411 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10412 <div style="height: 70px;">Nonexistant.jpg</div>
10413 <div class="gallerytext">
10414 <p>caption
10415 </p>
10416 </div>
10417 </div></li>
10418 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10419 <div style="height: 70px;">Nonexistant.jpg</div>
10420 <div class="gallerytext">
10421 </div>
10422 </div></li>
10423 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10424 <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>
10425 <div class="gallerytext">
10426 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10427 </p>
10428 </div>
10429 </div></li>
10430 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10431 <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>
10432 <div class="gallerytext">
10433 </div>
10434 </div></li>
10435 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10436 <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>
10437 <div class="gallerytext">
10438 <p>Blabla|blabla.
10439 </p>
10440 </div>
10441 </div></li>
10442 </ul>
10443
10444 !! end
10445
10446 !! test
10447 Gallery with wikitext inside caption
10448 !! input
10449 <gallery>
10450 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10451 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10452 </gallery>
10453 !! result
10454 <ul class="gallery">
10455 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10456 <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>
10457 <div class="gallerytext">
10458 <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>
10459 </p>
10460 </div>
10461 </div></li>
10462 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10463 <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>
10464 <div class="gallerytext">
10465 <p>This is a test template
10466 </p>
10467 </div>
10468 </div></li>
10469 </ul>
10470
10471 !! end
10472
10473 !! test
10474 gallery (with showfilename option)
10475 !! input
10476 <gallery showfilename>
10477 File:Nonexistant.jpg|caption
10478 File:Nonexistant.jpg
10479 image:foobar.jpg|some '''caption''' [[Main Page]]
10480 File:Foobar.jpg
10481 </gallery>
10482 !! result
10483 <ul class="gallery">
10484 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10485 <div style="height: 150px;">Nonexistant.jpg</div>
10486 <div class="gallerytext">
10487 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10488 caption
10489 </p>
10490 </div>
10491 </div></li>
10492 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10493 <div style="height: 150px;">Nonexistant.jpg</div>
10494 <div class="gallerytext">
10495 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10496 </p>
10497 </div>
10498 </div></li>
10499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10500 <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>
10501 <div class="gallerytext">
10502 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10503 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10504 </p>
10505 </div>
10506 </div></li>
10507 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10508 <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>
10509 <div class="gallerytext">
10510 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10511 </p>
10512 </div>
10513 </div></li>
10514 </ul>
10515
10516 !! end
10517
10518 !! test
10519 Gallery (with namespace-less filenames)
10520 !! input
10521 <gallery>
10522 File:Nonexistant.jpg
10523 Nonexistant.jpg
10524 image:foobar.jpg
10525 foobar.jpg
10526 </gallery>
10527 !! result
10528 <ul class="gallery">
10529 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10530 <div style="height: 150px;">Nonexistant.jpg</div>
10531 <div class="gallerytext">
10532 </div>
10533 </div></li>
10534 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10535 <div style="height: 150px;">Nonexistant.jpg</div>
10536 <div class="gallerytext">
10537 </div>
10538 </div></li>
10539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10540 <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>
10541 <div class="gallerytext">
10542 </div>
10543 </div></li>
10544 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10545 <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>
10546 <div class="gallerytext">
10547 </div>
10548 </div></li>
10549 </ul>
10550
10551 !! end
10552
10553 !! test
10554 HTML Hex character encoding (spells the word "JavaScript")
10555 !! input
10556 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10557 !! result
10558 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10559 </p>
10560 !! end
10561
10562 !! test
10563 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10564 !! input
10565 &#xsee;&#XSEE;
10566 !! result
10567 <p>&amp;#xsee;&amp;#XSEE;
10568 </p>
10569 !! end
10570
10571 !! test
10572 HTML Hex character encoding mixed case
10573 !! input
10574 &#xEE;&#Xee;
10575 !! result
10576 <p>&#xee;&#xee;
10577 </p>
10578 !! end
10579
10580 !! test
10581 __FORCETOC__ override
10582 !! input
10583 __NEWSECTIONLINK__
10584 __FORCETOC__
10585 !! result
10586 <p><br />
10587 </p>
10588 !! end
10589
10590 !! test
10591 ISBN code coverage
10592 !! input
10593 ISBN 978-0-1234-56&#x20;789
10594 !! result
10595 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10596 </p>
10597 !! end
10598
10599 !! test
10600 ISBN followed by 5 spaces
10601 !! input
10602 ISBN
10603 !! result
10604 <p>ISBN
10605 </p>
10606 !! end
10607
10608 !! test
10609 Double ISBN
10610 !! input
10611 ISBN ISBN 1234567890
10612 !! result
10613 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10614 </p>
10615 !! end
10616
10617 !! test
10618 Bug 22905: <abbr> followed by ISBN followed by </a>
10619 !! input
10620 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10621 !! result
10622 <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>
10623 </p>
10624 !! end
10625
10626 !! test
10627 Double RFC
10628 !! input
10629 RFC RFC 1234
10630 !! result
10631 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10632 </p>
10633 !! end
10634
10635 !! test
10636 Double RFC with a wiki link
10637 !! input
10638 RFC [[RFC 1234]]
10639 !! result
10640 <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>
10641 </p>
10642 !! end
10643
10644 !! test
10645 RFC code coverage
10646 !! input
10647 RFC 983&#x20;987
10648 !! result
10649 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10650 </p>
10651 !! end
10652
10653 !! test
10654 Centre-aligned image
10655 !! input
10656 [[Image:foobar.jpg|centre]]
10657 !! result
10658 <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>
10659
10660 !!end
10661
10662 !! test
10663 None-aligned image
10664 !! input
10665 [[Image:foobar.jpg|none]]
10666 !! result
10667 <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>
10668
10669 !!end
10670
10671 !! test
10672 Width + Height sized image (using px) (height is ignored)
10673 !! input
10674 [[Image:foobar.jpg|640x480px]]
10675 !! result
10676 <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>
10677 </p>
10678 !!end
10679
10680 !! test
10681 Width-sized image (using px, no following whitespace)
10682 !! input
10683 [[Image:foobar.jpg|640px]]
10684 !! result
10685 <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>
10686 </p>
10687 !!end
10688
10689 !! test
10690 Width-sized image (using px, with following whitespace - test regression from r39467)
10691 !! input
10692 [[Image:foobar.jpg|640px ]]
10693 !! result
10694 <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>
10695 </p>
10696 !!end
10697
10698 !! test
10699 Width-sized image (using px, with preceding whitespace - test regression from r39467)
10700 !! input
10701 [[Image:foobar.jpg| 640px]]
10702 !! result
10703 <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>
10704 </p>
10705 !!end
10706
10707 !! test
10708 Another italics / bold test
10709 !! input
10710 ''' ''x'
10711 !! result
10712 <pre>'<i> </i>x'
10713 </pre>
10714 !!end
10715
10716 # Note the results may be incorrect, as parserTest output included this:
10717 # XML error: Mismatched tag at byte 6120:
10718 # ...<dd> </dt></dl> </dd...
10719 !! test
10720 dt/dd/dl test
10721 !! options
10722 disabled
10723 !! input
10724 :;;;::
10725 !! result
10726 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10727 </dd></dl>
10728 </dd></dl>
10729 </dt></dl>
10730 </dt></dl>
10731 </dt></dl>
10732 </dd></dl>
10733
10734 !!end
10735
10736
10737 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10738 !! test
10739 Images with the "|" character in the comment
10740 !! input
10741 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10742 !! result
10743 <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>
10744
10745 !!end
10746
10747 !! test
10748 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10749 !! input
10750 <html><script>alert(1);</script></html>
10751 !! result
10752 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10753 </p>
10754 !! end
10755
10756 !! test
10757 HTML with raw HTML ($wgRawHtml==true)
10758 !! options
10759 rawhtml
10760 !! input
10761 <html><script>alert(1);</script></html>
10762 !! result
10763 <p><script>alert(1);</script>
10764 </p>
10765 !! end
10766
10767 !! test
10768 Parents of subpages, one level up
10769 !! options
10770 subpage title=[[Subpage test/L1/L2/L3]]
10771 !! input
10772 [[../|L2]]
10773 !! result
10774 <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>
10775 </p>
10776 !! end
10777
10778
10779 !! test
10780 Parents of subpages, one level up, not named
10781 !! options
10782 subpage title=[[Subpage test/L1/L2/L3]]
10783 !! input
10784 [[../]]
10785 !! result
10786 <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>
10787 </p>
10788 !! end
10789
10790
10791
10792 !! test
10793 Parents of subpages, two levels up
10794 !! options
10795 subpage title=[[Subpage test/L1/L2/L3]]
10796 !! input
10797 [[../../|L1]]2
10798
10799 [[../../|L1]]l
10800 !! result
10801 <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
10802 </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>
10803 </p>
10804 !! end
10805
10806 !! test
10807 Parents of subpages, two levels up, without trailing slash or name.
10808 !! options
10809 subpage title=[[Subpage test/L1/L2/L3]]
10810 !! input
10811 [[../..]]
10812 !! result
10813 <p>[[../..]]
10814 </p>
10815 !! end
10816
10817 !! test
10818 Parents of subpages, two levels up, with lots of extra trailing slashes.
10819 !! options
10820 subpage title=[[Subpage test/L1/L2/L3]]
10821 !! input
10822 [[../../////]]
10823 !! result
10824 <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>
10825 </p>
10826 !! end
10827
10828 !! test
10829 Definition list code coverage
10830 !! input
10831 ; title : def
10832 ; title : def
10833 ;title: def
10834 !! result
10835 <dl><dt> title &#160;</dt><dd> def
10836 </dd><dt> title&#160;</dt><dd> def
10837 </dd><dt>title</dt><dd> def
10838 </dd></dl>
10839
10840 !! end
10841
10842 !! test
10843 Don't fall for the self-closing div
10844 !! input
10845 <div>hello world</div/>
10846 !! result
10847 <div>hello world</div>
10848
10849 !! end
10850
10851 !! test
10852 MSGNW magic word
10853 !! input
10854 {{MSGNW:msg}}
10855 !! result
10856 <p>&#91;&#91;:Template:Msg&#93;&#93;
10857 </p>
10858 !! end
10859
10860 !! test
10861 RAW magic word
10862 !! input
10863 {{RAW:QUERTY}}
10864 !! result
10865 <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>
10866 </p>
10867 !! end
10868
10869 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10870 !! test
10871 Always escape literal '>' in output, not just after '<'
10872 !! input
10873 ><>
10874 !! result
10875 <p>&gt;&lt;&gt;
10876 </p>
10877 !! end
10878
10879 !! test
10880 Template caching
10881 !! input
10882 {{Test}}
10883 {{Test}}
10884 !! result
10885 <p>This is a test template
10886 This is a test template
10887 </p>
10888 !! end
10889
10890
10891 !! article
10892 MediaWiki:Fake
10893 !! text
10894 ==header==
10895 !! endarticle
10896
10897 !! test
10898 Inclusion of !userCanEdit() content
10899 !! input
10900 {{MediaWiki:Fake}}
10901 !! result
10902 <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>
10903
10904 !! end
10905
10906
10907 !! test
10908 Out-of-order TOC heading levels
10909 !! input
10910 ==2==
10911 ======6======
10912 ===3===
10913 =1=
10914 =====5=====
10915 ==2==
10916 !! result
10917 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10918 <ul>
10919 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10920 <ul>
10921 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10922 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10923 </ul>
10924 </li>
10925 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10926 <ul>
10927 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10928 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10929 </ul>
10930 </li>
10931 </ul>
10932 </td></tr></table>
10933 <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>
10934 <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>
10935 <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>
10936 <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>
10937 <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>
10938 <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>
10939
10940 !! end
10941
10942
10943 !! test
10944 ISBN with a dummy number
10945 !! input
10946 ISBN ---
10947 !! result
10948 <p>ISBN ---
10949 </p>
10950 !! end
10951
10952
10953 !! test
10954 ISBN with space-delimited number
10955 !! input
10956 ISBN 92 9017 032 8
10957 !! result
10958 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10959 </p>
10960 !! end
10961
10962
10963 !! test
10964 ISBN with multiple spaces, no number
10965 !! input
10966 ISBN foo
10967 !! result
10968 <p>ISBN foo
10969 </p>
10970 !! end
10971
10972
10973 !! test
10974 ISBN length
10975 !! input
10976 ISBN 123456789
10977
10978 ISBN 1234567890
10979
10980 ISBN 12345678901
10981 !! result
10982 <p>ISBN 123456789
10983 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10984 </p><p>ISBN 12345678901
10985 </p>
10986 !! end
10987
10988
10989 !! test
10990 ISBN with trailing year (bug 8110)
10991 !! input
10992 ISBN 1-234-56789-0 - 2006
10993
10994 ISBN 1 234 56789 0 - 2006
10995 !! result
10996 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10997 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10998 </p>
10999 !! end
11000
11001
11002 !! test
11003 anchorencode
11004 !! input
11005 {{anchorencode:foo bar©#%n}}
11006 !! result
11007 <p>foo_bar.C2.A9.23.25n
11008 </p>
11009 !! end
11010
11011 !! test
11012 anchorencode trims spaces
11013 !! input
11014 {{anchorencode: __pretty__please__}}
11015 !! result
11016 <p>pretty_please
11017 </p>
11018 !! end
11019
11020 !! test
11021 anchorencode deals with links
11022 !! input
11023 {{anchorencode: [[hello|world]] [[hi]]}}
11024 !! result
11025 <p>world_hi
11026 </p>
11027 !! end
11028
11029 !! test
11030 anchorencode deals with templates
11031 !! input
11032 {{anchorencode: {{Foo}} }}
11033 !! result
11034 <p>FOO
11035 </p>
11036 !! end
11037
11038 !! test
11039 anchorencode encodes like the TOC generator: (bug 18431)
11040 !! input
11041 === _ +:.3A%3A&&amp;]] ===
11042 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11043 __NOEDITSECTION__
11044 !! result
11045 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
11046 <p>.2B:.3A.253A.26.26.5D.5D
11047 </p>
11048 !! end
11049
11050 # Expected output in the following test is not necessarily expected (there
11051 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11052 # only testing for well-formedness.
11053 !! test
11054 Bug 6200: blockquotes and paragraph formatting
11055 !! input
11056 <blockquote>
11057 foo
11058 </blockquote>
11059
11060 bar
11061
11062 baz
11063 !! result
11064 <blockquote>
11065 foo
11066 </blockquote>
11067 <p>bar
11068 </p>
11069 <pre>baz
11070 </pre>
11071 !! end
11072
11073 !! test
11074 Bug 8293: Use of center tag ruins paragraph formatting
11075 !! input
11076 <center>
11077 foo
11078 </center>
11079
11080 bar
11081
11082 baz
11083 !! result
11084 <center>
11085 <p>foo
11086 </p>
11087 </center>
11088 <p>bar
11089 </p>
11090 <pre>baz
11091 </pre>
11092 !! end
11093
11094
11095 ###
11096 ### Language variants related tests
11097 ###
11098 !! test
11099 Self-link in language variants
11100 !! options
11101 title=[[Dunav]] language=sr
11102 !! input
11103 Both [[Dunav]] and [[Дунав]] are names for this river.
11104 !! result
11105 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11106 </p>
11107 !!end
11108
11109 !! article
11110 Дуна
11111 !! text
11112 content
11113 !! endarticle
11114
11115 !! test
11116 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11117 !! options
11118 title=[[Duna]] language=sr
11119 !! input
11120 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11121 !! result
11122 <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.
11123 </p>
11124 !! end
11125
11126 !! test
11127 Link to pages in language variants
11128 !! options
11129 language=sr
11130 !! input
11131 Main Page can be written as [[Маин Паге]]
11132 !! result
11133 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11134 </p>
11135 !!end
11136
11137
11138 !! test
11139 Multiple links to pages in language variants
11140 !! options
11141 language=sr
11142 !! input
11143 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11144 !! result
11145 <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>.
11146 </p>
11147 !!end
11148
11149
11150 !! test
11151 Simple template in language variants
11152 !! options
11153 language=sr
11154 !! input
11155 {{тест}}
11156 !! result
11157 <p>This is a test template
11158 </p>
11159 !! end
11160
11161
11162 !! test
11163 Template with explicit namespace in language variants
11164 !! options
11165 language=sr
11166 !! input
11167 {{Template:тест}}
11168 !! result
11169 <p>This is a test template
11170 </p>
11171 !! end
11172
11173
11174 !! test
11175 Basic test for template parameter in language variants
11176 !! options
11177 language=sr
11178 !! input
11179 {{парамтест|param=foo}}
11180 !! result
11181 <p>This is a test template with parameter foo
11182 </p>
11183 !! end
11184
11185
11186 !! test
11187 Simple category in language variants
11188 !! options
11189 language=sr cat
11190 !! input
11191 [[Category:МедиаWики Усер'с Гуиде]]
11192 !! result
11193 <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>
11194 !! end
11195
11196
11197 !! article
11198 Category:分类
11199 !! text
11200 blah
11201 !! endarticle
11202
11203 !! article
11204 Category:分類
11205 !! text
11206 blah
11207 !! endarticle
11208
11209 !! test
11210 Don't convert blue categorylinks to another variant (bug 33210)
11211 !! options
11212 language=zh cat
11213 !! input
11214 [[A]][[Category:分类]]
11215 !! result
11216 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11217 !! end
11218
11219
11220 !! test
11221 Stripping -{}- tags (language variants)
11222 !! options
11223 language=sr
11224 !! input
11225 Latin proverb: -{Ne nuntium necare}-
11226 !! result
11227 <p>Latin proverb: Ne nuntium necare
11228 </p>
11229 !! end
11230
11231
11232 !! test
11233 Prevent conversion with -{}- tags (language variants)
11234 !! options
11235 language=sr variant=sr-ec
11236 !! input
11237 Latinski: -{Ne nuntium necare}-
11238 !! result
11239 <p>Латински: Ne nuntium necare
11240 </p>
11241 !! end
11242
11243
11244 !! test
11245 Prevent conversion of text with -{}- tags (language variants)
11246 !! options
11247 language=sr variant=sr-ec
11248 !! input
11249 Latinski: -{Ne nuntium necare}-
11250 !! result
11251 <p>Латински: Ne nuntium necare
11252 </p>
11253 !! end
11254
11255
11256 !! test
11257 Prevent conversion of links with -{}- tags (language variants)
11258 !! options
11259 language=sr variant=sr-ec
11260 !! input
11261 -{[[Main Page]]}-
11262 !! result
11263 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11264 </p>
11265 !! end
11266
11267
11268 !! test
11269 -{}- tags within headlines (within html for parserConvert())
11270 !! options
11271 language=sr variant=sr-ec
11272 !! input
11273 == -{Naslov}- ==
11274 !! result
11275 <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>
11276
11277 !! end
11278
11279
11280 !! test
11281 Explicit definition of language variant alternatives
11282 !! options
11283 language=zh variant=zh-tw
11284 !! input
11285 -{zh:China;zh-tw:Taiwan}-, not China
11286 !! result
11287 <p>Taiwan, not China
11288 </p>
11289 !! end
11290
11291
11292 !! test
11293 Conversion around HTML tags
11294 !! options
11295 language=sr variant=sr-ec
11296 !! input
11297 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11298 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11299 !! result
11300 <p>
11301 <span title="ЛаCтин">ски</span>
11302 </p>
11303 !! end
11304
11305
11306 !! test
11307 Explicit session-wise language variant mapping (A flag and - flag)
11308 !! options
11309 language=zh variant=zh-tw
11310 !! input
11311 Taiwan is not China.
11312 But -{A|zh:China;zh-tw:Taiwan}- is China,
11313 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11314 and -{China}- is China.
11315 !! result
11316 <p>Taiwan is not China.
11317 But Taiwan is Taiwan,
11318 (This should be stripped!)
11319 and China is China.
11320 </p>
11321 !! end
11322
11323 !! test
11324 Explicit session-wise language variant mapping (H flag for hide)
11325 !! options
11326 language=zh variant=zh-tw
11327 !! input
11328 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11329 Taiwan is China.
11330 !! result
11331 <p>(This should be stripped!)
11332 Taiwan is Taiwan.
11333 </p>
11334 !! end
11335
11336 !! test
11337 Adding explicit conversion rule for title (T flag)
11338 !! options
11339 language=zh variant=zh-tw showtitle
11340 !! input
11341 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11342 !! result
11343 Taiwan
11344 <p>Should be stripped!
11345 </p>
11346 !! end
11347
11348 !! test
11349 Testing that changing the language variant here in the tests actually works
11350 !! options
11351 language=zh variant=zh showtitle
11352 !! input
11353 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11354 !! result
11355 China
11356 <p>Should be stripped!
11357 </p>
11358 !! end
11359
11360 !! test
11361 Recursive conversion of alt and title attrs shouldn't clear converter state
11362 !! options
11363 language=zh variant=zh-cn showtitle
11364 !! input
11365 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11366 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11367 !! result
11368 China
11369 <p>
11370 Should be stripped<span title="Exclamation">!</span>
11371 </p>
11372 !! end
11373
11374 !! test
11375 Bug 24072: more test on conversion rule for title
11376 !! options
11377 language=zh variant=zh-tw showtitle
11378 !! input
11379 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11380 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11381 !! result
11382 Taiwan
11383 <p>This should be stripped!
11384 This won't take interferes with the title rule.
11385 </p>
11386 !! end
11387
11388 !! test
11389 Raw output of variant escape tags (R flag)
11390 !! options
11391 language=zh variant=zh-tw
11392 !! input
11393 Raw: -{R|zh:China;zh-tw:Taiwan}-
11394 !! result
11395 <p>Raw: zh:China;zh-tw:Taiwan
11396 </p>
11397 !! end
11398
11399 !! test
11400 Nested using of manual convert syntax
11401 !! options
11402 language=zh variant=zh-hk
11403 !! input
11404 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11405 !! result
11406 <p>Nested: Hello Hong Kong!
11407 </p>
11408 !! end
11409
11410 !! test
11411 Proper conversion of text in external links
11412 !! options
11413 language=sr variant=sr-ec
11414 !! input
11415 http://www.google.com
11416 gopher://www.google.com
11417 [http://www.google.com http://www.google.com]
11418 [gopher://www.google.com gopher://www.google.com]
11419 [https://www.google.com irc://www.google.com]
11420 [ftp://www.google.com www.google.com/ftp://dir]
11421 [//www.google.com www.google.com]
11422 !! result
11423 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11424 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11425 <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 text" href="https://www.google.com">irc://www.google.com</a>
11428 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11429 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11430 </p>
11431 !! end
11432
11433 !! test
11434 Do not convert roman numbers to language variants
11435 !! options
11436 language=sr variant=sr-ec
11437 !! input
11438 Fridrih IV je car.
11439 !! result
11440 <p>Фридрих IV је цар.
11441 </p>
11442 !! end
11443
11444 !! test
11445 Unclosed language converter markup "-{"
11446 !! options
11447 language=sr
11448 !! input
11449 -{T|hello
11450 !! result
11451 <p>-{T|hello
11452 </p>
11453 !! end
11454
11455 !! test
11456 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11457 !! options
11458 language=sr
11459 !! input
11460 -{R|=&gt;}-
11461 !! result
11462 <p>=&gt;
11463 </p>
11464 !!end
11465
11466 !!article
11467 Template:Bullet
11468 !!text
11469 * Bar
11470 !!endarticle
11471
11472 !! test
11473 Bug 529: Uncovered bullet
11474 !! input
11475 * Foo {{bullet}}
11476 !! result
11477 <ul><li> Foo
11478 </li><li> Bar
11479 </li></ul>
11480
11481 !! end
11482
11483 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11484 # Templates in Wikipedia rely on this behavior, as tidy has always been
11485 # enabled there. These tests are normally run *without* tidy, so specify the
11486 # full output here.
11487 # To test realistic parsing behavior, apply a tidy-like transformation to both
11488 # the expected output and your parser's output.
11489 !! test
11490 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11491 !! input
11492 ******* Foo {{bullet}}
11493 !! result
11494 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11495 </li></ul>
11496 </li></ul>
11497 </li></ul>
11498 </li></ul>
11499 </li></ul>
11500 </li></ul>
11501 </li><li> Bar
11502 </li></ul>
11503
11504 !! end
11505
11506 !! test
11507 Bug 529: Uncovered table already at line-start
11508 !! input
11509 x
11510
11511 {{table}}
11512 y
11513 !! result
11514 <p>x
11515 </p>
11516 <table>
11517 <tr>
11518 <td> 1 </td>
11519 <td> 2
11520 </td></tr>
11521 <tr>
11522 <td> 3 </td>
11523 <td> 4
11524 </td></tr></table>
11525 <p>y
11526 </p>
11527 !! end
11528
11529 !! test
11530 Bug 529: Uncovered bullet in parser function result
11531 !! input
11532 * Foo {{lc:{{bullet}} }}
11533 !! result
11534 <ul><li> Foo
11535 </li><li> bar
11536 </li></ul>
11537
11538 !! end
11539
11540 !! test
11541 Bug 5678: Double-parsed template argument
11542 !! input
11543 {{lc:{{{1}}}|hello}}
11544 !! result
11545 <p>{{{1}}}
11546 </p>
11547 !! end
11548
11549 !! test
11550 Bug 5678: Double-parsed template invocation
11551 !! input
11552 {{lc:{{paramtest {{!}} param = hello }} }}
11553 !! result
11554 <p>{{paramtest | param = hello }}
11555 </p>
11556 !! end
11557
11558 !! test
11559 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11560 !! options
11561 language=cs
11562 title=[[Main Page]]
11563 !! input
11564 {{PRVNÍVELKÉ:ěščř}}
11565 {{prvnívelké:ěščř}}
11566 {{PRVNÍMALÉ:ěščř}}
11567 {{prvnímalé:ěščř}}
11568 {{MALÁ:ěščř}}
11569 {{malá:ěščř}}
11570 {{VELKÁ:ěščř}}
11571 {{velká:ěščř}}
11572 !! result
11573 <p>Ěščř
11574 Ěščř
11575 ěščř
11576 ěščř
11577 ěščř
11578 ěščř
11579 ĚŠČŘ
11580 ĚŠČŘ
11581 </p>
11582 !! end
11583
11584 !! test
11585 Morwen/13: Unclosed link followed by heading
11586 !! input
11587 [[link
11588 ==heading==
11589 !! result
11590 <p>[[link
11591 </p>
11592 <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>
11593
11594 !! end
11595
11596 !! test
11597 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11598 !! input
11599 {{foo|
11600 =heading=
11601 !! result
11602 <p>{{foo|
11603 </p>
11604 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11605
11606 !! end
11607
11608 !! test
11609 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11610 !! input
11611 {{foo|
11612 ==heading==
11613 !! result
11614 <p>{{foo|
11615 </p>
11616 <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>
11617
11618 !! end
11619
11620 !! test
11621 Tildes in comments
11622 !! options
11623 pst
11624 !! input
11625 <!-- ~~~~ -->
11626 !! result
11627 <!-- ~~~~ -->
11628 !! end
11629
11630 !! test
11631 Paragraphs inside divs (no extra line breaks)
11632 !! input
11633 <div>Line one
11634
11635 Line two</div>
11636 !! result
11637 <div>Line one
11638 Line two</div>
11639
11640 !! end
11641
11642 !! test
11643 Paragraphs inside divs (extra line break on open)
11644 !! input
11645 <div>
11646 Line one
11647
11648 Line two</div>
11649 !! result
11650 <div>
11651 <p>Line one
11652 </p>
11653 Line two</div>
11654
11655 !! end
11656
11657 !! test
11658 Paragraphs inside divs (extra line break on close)
11659 !! input
11660 <div>Line one
11661
11662 Line two
11663 </div>
11664 !! result
11665 <div>Line one
11666 <p>Line two
11667 </p>
11668 </div>
11669
11670 !! end
11671
11672 !! test
11673 Paragraphs inside divs (extra line break on open and close)
11674 !! input
11675 <div>
11676 Line one
11677
11678 Line two
11679 </div>
11680 !! result
11681 <div>
11682 <p>Line one
11683 </p><p>Line two
11684 </p>
11685 </div>
11686
11687 !! end
11688
11689 !! test
11690 Nesting tags, paragraphs on lines which begin with <div>
11691 !! options
11692 disabled
11693 !! input
11694 <div></div><strong>A
11695 B</strong>
11696 !! result
11697 <div></div>
11698 <p><strong>A
11699 B</strong>
11700 </p>
11701 !! end
11702
11703 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11704 !! test
11705 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11706 !! options
11707 disabled
11708 !! input
11709 <blockquote>Line one
11710
11711 Line two</blockquote>
11712 !! result
11713 <blockquote>Line one
11714 Line two</blockquote>
11715
11716 !! end
11717
11718 !! test
11719 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11720 !! options
11721 disabled
11722 !! input
11723 <blockquote>
11724 Line one
11725
11726 Line two</blockquote>
11727 !! result
11728 <blockquote>
11729 <p>Line one
11730 </p>
11731 Line two</blockquote>
11732
11733 !! end
11734
11735 !! test
11736 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11737 !! options
11738 disabled
11739 !! input
11740 <blockquote>Line one
11741
11742 Line two
11743 </blockquote>
11744 !! result
11745 <blockquote>Line one
11746 <p>Line two
11747 </p>
11748 </blockquote>
11749
11750 !! end
11751
11752 !! test
11753 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11754 !! options
11755 disabled
11756 !! input
11757 <blockquote>
11758 Line one
11759
11760 Line two
11761 </blockquote>
11762 !! result
11763 <blockquote>
11764 <p>Line one
11765 </p><p>Line two
11766 </p>
11767 </blockquote>
11768
11769 !! end
11770
11771 !! test
11772 Paragraphs inside blockquotes/divs (no extra line breaks)
11773 !! input
11774 <blockquote><div>Line one
11775
11776 Line two</div></blockquote>
11777 !! result
11778 <blockquote><div>Line one
11779 Line two</div></blockquote>
11780
11781 !! end
11782
11783 !! test
11784 Paragraphs inside blockquotes/divs (extra line break on open)
11785 !! input
11786 <blockquote><div>
11787 Line one
11788
11789 Line two</div></blockquote>
11790 !! result
11791 <blockquote><div>
11792 <p>Line one
11793 </p>
11794 Line two</div></blockquote>
11795
11796 !! end
11797
11798 !! test
11799 Paragraphs inside blockquotes/divs (extra line break on close)
11800 !! input
11801 <blockquote><div>Line one
11802
11803 Line two
11804 </div></blockquote>
11805 !! result
11806 <blockquote><div>Line one
11807 <p>Line two
11808 </p>
11809 </div></blockquote>
11810
11811 !! end
11812
11813 !! test
11814 Paragraphs inside blockquotes/divs (extra line break on open and close)
11815 !! input
11816 <blockquote><div>
11817 Line one
11818
11819 Line two
11820 </div></blockquote>
11821 !! result
11822 <blockquote><div>
11823 <p>Line one
11824 </p><p>Line two
11825 </p>
11826 </div></blockquote>
11827
11828 !! end
11829
11830 !! test
11831 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11832 !! options
11833 wgLinkHolderBatchSize=0
11834 !! input
11835 [[meatball:1]]
11836 [[meatball:2]]
11837 [[meatball:3]]
11838 !! result
11839 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11840 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11841 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11842 </p>
11843 !! end
11844
11845 !! test
11846 Free external link invading image caption
11847 !! input
11848 [[Image:Foobar.jpg|thumb|http://x|hello]]
11849 !! result
11850 <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>
11851
11852 !! end
11853
11854 !! test
11855 Bug 15196: localised external link numbers
11856 !! options
11857 language=fa
11858 !! input
11859 [http://en.wikipedia.org/]
11860 !! result
11861 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11862 </p>
11863 !! end
11864
11865 !! test
11866 Multibyte character in padleft
11867 !! input
11868 {{padleft:-Hello|7|Æ}}
11869 !! result
11870 <p>Æ-Hello
11871 </p>
11872 !! end
11873
11874 !! test
11875 Multibyte character in padright
11876 !! input
11877 {{padright:Hello-|7|Æ}}
11878 !! result
11879 <p>Hello-Æ
11880 </p>
11881 !! end
11882
11883 !!test
11884 formatdate parser function
11885 !!input
11886 {{#formatdate:2009-03-24}}
11887 !! result
11888 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11889 </p>
11890 !! end
11891
11892 !!test
11893 formatdate parser function, with default format
11894 !!input
11895 {{#formatdate:2009-03-24|mdy}}
11896 !! result
11897 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11898 </p>
11899 !! end
11900
11901 !! test
11902 Spacing of numbers in formatted dates
11903 !! input
11904 {{#formatdate:January 15}}
11905 !! result
11906 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11907 </p>
11908 !! end
11909
11910 !! test
11911 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
11912 !! options
11913 language=nl title=[[MediaWiki:Common.css]]
11914 !! input
11915 {{#formatdate:2009-03-24|dmy}}
11916 !! result
11917 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11918 </p>
11919 !! end
11920
11921 #
11922 #
11923 #
11924
11925 #
11926 # Edit comments
11927 #
11928
11929 !! test
11930 Edit comment with link
11931 !! options
11932 comment
11933 !! input
11934 I like the [[Main Page]] a lot
11935 !! result
11936 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11937 !!end
11938
11939 !! test
11940 Edit comment with link and link text
11941 !! options
11942 comment
11943 !! input
11944 I like the [[Main Page|best pages]] a lot
11945 !! result
11946 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11947 !!end
11948
11949 !! test
11950 Edit comment with link and link text with suffix
11951 !! options
11952 comment
11953 !! input
11954 I like the [[Main Page|best page]]s a lot
11955 !! result
11956 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11957 !!end
11958
11959 !! test
11960 Edit comment with section link (non-local, eg in history list)
11961 !! options
11962 comment title=[[Main Page]]
11963 !! input
11964 /* External links */ removed bogus entries
11965 !! result
11966 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11967 !!end
11968
11969 !! test
11970 Edit comment with section link and text before it (non-local, eg in history list)
11971 !! options
11972 comment title=[[Main Page]]
11973 !! input
11974 pre-comment text /* External links */ removed bogus entries
11975 !! result
11976 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>
11977 !!end
11978
11979 !! test
11980 Edit comment with section link (local, eg in diff view)
11981 !! options
11982 comment local title=[[Main Page]]
11983 !! input
11984 /* External links */ removed bogus entries
11985 !! result
11986 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11987 !!end
11988
11989 !! test
11990 Edit comment with subpage link (bug 14080)
11991 !! options
11992 comment
11993 subpage
11994 title=[[Subpage test]]
11995 !! input
11996 Poked at a [[/subpage]] here...
11997 !! result
11998 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11999 !!end
12000
12001 !! test
12002 Edit comment with subpage link and link text (bug 14080)
12003 !! options
12004 comment
12005 subpage
12006 title=[[Subpage test]]
12007 !! input
12008 Poked at a [[/subpage|neat little page]] here...
12009 !! result
12010 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12011 !!end
12012
12013 !! test
12014 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12015 !! options
12016 comment
12017 title=[[Subpage test]]
12018 !! input
12019 Poked at a [[/subpage]] here...
12020 !! result
12021 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...
12022 !!end
12023
12024 !! test
12025 Edit comment with bare anchor link (local, as on diff)
12026 !! options
12027 comment
12028 local
12029 title=[[Main Page]]
12030 !!input
12031 [[#section]]
12032 !! result
12033 <a href="#section">#section</a>
12034 !! end
12035
12036 !! test
12037 Edit comment with bare anchor link (non-local, as on history)
12038 !! options
12039 comment
12040 title=[[Main Page]]
12041 !!input
12042 [[#section]]
12043 !! result
12044 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12045 !! end
12046
12047 !! test
12048 Anchor starting with underscore
12049 !!input
12050 [[#_ref|One]]
12051 !! result
12052 <p><a href="#_ref">One</a>
12053 </p>
12054 !! end
12055
12056 !! test
12057 Id starting with underscore
12058 !!input
12059 <div id="_ref"></div>
12060 !! result
12061 <div id="_ref"></div>
12062
12063 !! end
12064
12065 !! test
12066 Space normalisation on autocomment (bug 22784)
12067 !! options
12068 comment
12069 title=[[Main Page]]
12070 !!input
12071 /* __hello__world__ */
12072 !! result
12073 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12074 !! end
12075
12076 !! test
12077 percent-encoding and + signs in comments (Bug 26410)
12078 !! options
12079 comment
12080 !!input
12081 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12082 !! result
12083 <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>
12084 !! end
12085
12086 !! test
12087 Bad images - basic functionality
12088 !! options
12089 disabled
12090 !! input
12091 [[File:Bad.jpg]]
12092 !! result
12093 !! end
12094
12095 !! test
12096 Bad images - bug 16039: text after bad image disappears
12097 !! options
12098 disabled
12099 !! input
12100 Foo bar
12101 [[File:Bad.jpg]]
12102 Bar foo
12103 !! result
12104 <p>Foo bar
12105 </p><p>Bar foo
12106 </p>
12107 !! end
12108
12109 !! test
12110 Verify that displaytitle works (bug #22501) no displaytitle
12111 !! options
12112 showtitle
12113 !! config
12114 wgAllowDisplayTitle=true
12115 wgRestrictDisplayTitle=false
12116 !! input
12117 this is not the the title
12118 !! result
12119 Parser test
12120 <p>this is not the the title
12121 </p>
12122 !! end
12123
12124 !! test
12125 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12126 !! options
12127 showtitle
12128 title=[[Screen]]
12129 !! config
12130 wgAllowDisplayTitle=true
12131 wgRestrictDisplayTitle=false
12132 !! input
12133 this is not the the title
12134 {{DISPLAYTITLE:whatever}}
12135 !! result
12136 whatever
12137 <p>this is not the the title
12138 </p>
12139 !! end
12140
12141 !! test
12142 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12143 !! options
12144 showtitle
12145 title=[[Screen]]
12146 !! config
12147 wgAllowDisplayTitle=true
12148 wgRestrictDisplayTitle=true
12149 !! input
12150 this is not the the title
12151 {{DISPLAYTITLE:whatever}}
12152 !! result
12153 Screen
12154 <p>this is not the the title
12155 </p>
12156 !! end
12157
12158 !! test
12159 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12160 !! options
12161 showtitle
12162 title=[[Screen]]
12163 !! config
12164 wgAllowDisplayTitle=true
12165 wgRestrictDisplayTitle=true
12166 !! input
12167 this is not the the title
12168 {{DISPLAYTITLE:screen}}
12169 !! result
12170 screen
12171 <p>this is not the the title
12172 </p>
12173 !! end
12174
12175 !! test
12176 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12177 !! options
12178 showtitle
12179 title=[[Screen]]
12180 !! config
12181 wgAllowDisplayTitle=false
12182 !! input
12183 this is not the the title
12184 {{DISPLAYTITLE:screen}}
12185 !! result
12186 Screen
12187 <p>this is not the the title
12188 <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>
12189 </p>
12190 !! end
12191
12192 !! test
12193 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12194 !! options
12195 showtitle
12196 title=[[Screen]]
12197 !! config
12198 wgAllowDisplayTitle=false
12199 !! input
12200 this is not the the title
12201 !! result
12202 Screen
12203 <p>this is not the the title
12204 </p>
12205 !! end
12206
12207 !! test
12208 preload: check <noinclude> and <includeonly>
12209 !! options
12210 preload
12211 !! input
12212 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12213 !! result
12214 Hello kind world.
12215 !! end
12216
12217 !! test
12218 preload: check <onlyinclude>
12219 !! options
12220 preload
12221 !! input
12222 Goodbye <onlyinclude>Hello world</onlyinclude>
12223 !! result
12224 Hello world
12225 !! end
12226
12227 !! test
12228 preload: can pass tags through if we want to
12229 !! options
12230 preload
12231 !! input
12232 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12233 !! result
12234 <includeonly>Hello world</includeonly>
12235 !! end
12236
12237 !! test
12238 preload: check that it doesn't try to do tricks
12239 !! options
12240 preload
12241 !! input
12242 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12243 !! result
12244 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12245 !! end
12246
12247 !! test
12248 Play a bit with r67090 and bug 3158
12249 !! options
12250 disabled
12251 !! input
12252 <div style="width:50% !important">&nbsp;</div>
12253 <div style="width:50%&nbsp;!important">&nbsp;</div>
12254 <div style="width:50%&#160;!important">&nbsp;</div>
12255 <div style="border : solid;">&nbsp;</div>
12256 !! result
12257 <div style="width:50% !important">&nbsp;</div>
12258 <div style="width:50% !important">&nbsp;</div>
12259 <div style="width:50% !important">&nbsp;</div>
12260 <div style="border&#160;: solid;">&nbsp;</div>
12261
12262 !! end
12263
12264 !! test
12265 HTML5 data attributes
12266 !! input
12267 <span data-foo="bar">Baz</span>
12268 <p data-abc-def_hij="">Quuz</p>
12269 !! result
12270 <p><span data-foo="bar">Baz</span>
12271 </p>
12272 <p data-abc-def_hij="">Quuz</p>
12273
12274 !! end
12275
12276 !! test
12277 percent-encoding and + signs in internal links (Bug 26410)
12278 !! input
12279 [[User:+%]] [[Page+title%]]
12280 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12281 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12282 [[%33%45]] [[%33%45+]]
12283 !! result
12284 <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>
12285 <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>
12286 <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>
12287 <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>
12288 </p>
12289 !! end
12290
12291 !! test
12292 Special characters in embedded file links (bug 27679)
12293 !! input
12294 [[File:Contains & ampersand.jpg]]
12295 [[File:Does not exist.jpg|Title with & ampersand]]
12296 !! result
12297 <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>
12298 <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>
12299 </p>
12300 !! end
12301
12302
12303 !! test
12304 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12305 !! input
12306 Text&apos;s been normalized?
12307 !! result
12308 <p>Text&#39;s been normalized?
12309 </p>
12310 !! end
12311
12312 !! test
12313 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12314 !! input
12315 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12316 !! result
12317 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12318 </p>
12319 !! end
12320
12321 !! test
12322 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12323 !! input
12324 [http://www.example.org/ ideograms]
12325 !! result
12326 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12327 </p>
12328 !! end
12329
12330 !! test
12331 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12332 !! input
12333 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12334 !! result
12335 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12336 </p>
12337 !! end
12338
12339 !! article
12340 Mediawiki:loop1
12341 !! text
12342 {{Identical|A}}
12343 !! endarticle
12344
12345 !! article
12346 Mediawiki:loop2
12347 !! text
12348 {{Identical|B}}
12349 !! endarticle
12350
12351 !! article
12352 Template:Identical
12353 !! text
12354 {{int:loop1}}
12355 {{int:loop2}}
12356 !! endarticle
12357
12358 !! test
12359 Bug 31098 Template which includes system messages which includes the template
12360 !! input
12361 {{Identical}}
12362 !! result
12363 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12364 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12365 </p>
12366 !! end
12367
12368 !! test
12369 Bug31490 Turkish: ucfirst 'blah'
12370 !! options
12371 language=tr
12372 !! input
12373 {{ucfirst:blah}}
12374 !! result
12375 <p>Blah
12376 </p>
12377 !! end
12378
12379 !! test
12380 Bug31490 Turkish: ucfirst 'ix'
12381 !! options
12382 language=tr
12383 !! input
12384 {{ucfirst:ix}}
12385 !! result
12386 <p>İx
12387 </p>
12388 !! end
12389
12390 !! test
12391 Bug31490 Turkish: lcfirst 'BLAH'
12392 !! options
12393 language=tr
12394 !! input
12395 {{lcfirst:BLAH}}
12396 !! result
12397 <p>bLAH
12398 </p>
12399 !! end
12400
12401 !! test
12402 Bug31490 Turkish: ucfırst (with a dotless i)
12403 !! options
12404 language=tr
12405 !! input
12406 {{ucfırst:blah}}
12407 !! result
12408 <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>
12409 </p>
12410 !! end
12411
12412 !! test
12413 Bug31490 ucfırst (with a dotless i) with English language
12414 !! options
12415 language=en
12416 !! input
12417 {{ucfırst:blah}}
12418 !! result
12419 <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>
12420 </p>
12421 !! end
12422
12423 !! test
12424 Bug 26375: TOC with italics
12425 !! options
12426 title=[[Main Page]]
12427 !! input
12428 __TOC__
12429 == ''Lost'' episodes ==
12430 !! result
12431 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12432 <ul>
12433 <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>
12434 </ul>
12435 </td></tr></table>
12436 <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>
12437
12438 !! end
12439
12440 !! test
12441 Bug 26375: TOC with bold
12442 !! options
12443 title=[[Main Page]]
12444 !! input
12445 __TOC__
12446 == '''should be bold''' then normal text ==
12447 !! result
12448 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12449 <ul>
12450 <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>
12451 </ul>
12452 </td></tr></table>
12453 <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>
12454
12455 !! end
12456
12457 !! test
12458 Bug 33845: Headings become cursive in TOC when they contain an image
12459 !! options
12460 title=[[Main Page]]
12461 !! input
12462 __TOC__
12463 == Image [[Image:foobar.jpg]] ==
12464 !! result
12465 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12466 <ul>
12467 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12468 </ul>
12469 </td></tr></table>
12470 <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>
12471
12472 !! end
12473
12474 !! test
12475 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12476 !! options
12477 title=[[Main Page]]
12478 !! input
12479 __TOC__
12480 == <blockquote>Quote</blockquote> ==
12481 !! result
12482 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12483 <ul>
12484 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12485 </ul>
12486 </td></tr></table>
12487 <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>
12488
12489 !! end
12490
12491 !! test
12492 Unclosed tags in TOC
12493 !! options
12494 title=[[Main Page]]
12495 !! input
12496 __TOC__
12497 == Proof: 2 < 3 ==
12498 <small>Hanc marginis exiguitas non caperet.</small>
12499 QED
12500 !! result
12501 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12502 <ul>
12503 <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>
12504 </ul>
12505 </td></tr></table>
12506 <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>
12507 <p><small>Hanc marginis exiguitas non caperet.</small>
12508 QED
12509 </p>
12510 !! end
12511
12512 !! test
12513 Multiple tags in TOC
12514 !! input
12515 __TOC__
12516 == <i>Foo</i> <b>Bar</b> ==
12517
12518 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12519 !! result
12520 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12521 <ul>
12522 <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>
12523 <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>
12524 </ul>
12525 </td></tr></table>
12526 <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>
12527 <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>
12528
12529 !! end
12530
12531 !! test
12532 Tags with parameters in TOC
12533 !! input
12534 __TOC__
12535 == <sup class="in-h2">Hello</sup> ==
12536
12537 == <sup class="a > b">Evilbye</sup> ==
12538 !! result
12539 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12540 <ul>
12541 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12542 <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>
12543 </ul>
12544 </td></tr></table>
12545 <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>
12546 <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>
12547
12548 !! end
12549
12550 !! test
12551 span tags with directionality in TOC
12552 !! input
12553 __TOC__
12554 == <span dir="ltr">C++</span> ==
12555
12556 == <span dir="rtl">זבנג!</span> ==
12557
12558 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12559
12560 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12561
12562 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12563 !! result
12564 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12565 <ul>
12566 <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>
12567 <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>
12568 <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>
12569 <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>
12570 <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>
12571 </ul>
12572 </td></tr></table>
12573 <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>
12574 <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>
12575 <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>
12576 <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>
12577 <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>
12578
12579 !! end
12580
12581 !! article
12582 MediaWiki:Bug32057
12583 !! text
12584 == {{int:headline_sample}} ==
12585 !! endarticle
12586
12587 !! test
12588 Bug 32057: Title needed when expanding <h> nodes.
12589 !! options
12590 title=[[Main Page]]
12591 !! input
12592 {{int:Bug32057}}
12593 !! result
12594 <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>
12595
12596 !! end
12597
12598 !! test
12599 Strip marker in urlencode
12600 !! input
12601 {{urlencode:x<nowiki/>y}}
12602 {{urlencode:x<nowiki/>y|wiki}}
12603 {{urlencode:x<nowiki/>y|path}}
12604 !! result
12605 <p>xy
12606 xy
12607 xy
12608 </p>
12609 !! end
12610
12611 !! test
12612 Strip marker in lc
12613 !! input
12614 {{lc:x<nowiki/>y}}
12615 !! result
12616 <p>xy
12617 </p>
12618 !! end
12619
12620 !! test
12621 Strip marker in uc
12622 !! input
12623 {{uc:x<nowiki/>y}}
12624 !! result
12625 <p>XY
12626 </p>
12627 !! end
12628
12629 !! test
12630 Strip marker in formatNum
12631 !! input
12632 {{formatnum:1<nowiki/>2}}
12633 {{formatnum:1<nowiki/>2|R}}
12634 !! result
12635 <p>12
12636 12
12637 </p>
12638 !! end
12639
12640 !! test
12641 Check noCommafy in formatNum
12642 !! options
12643 language=be-tarask
12644 !! input
12645 {{formatnum:123456.78}}
12646 {{formatnum:123456.78|NOSEP}}
12647 !! result
12648 <p>123 456,78
12649 123456.78
12650 </p>
12651 !! end
12652
12653 !! test
12654 Strip marker in grammar
12655 !! options
12656 language=fi
12657 !! input
12658 {{grammar:elative|foo<nowiki/>bar}}
12659 !! result
12660 <p>foobarista
12661 </p>
12662 !! end
12663
12664 !! test
12665 Strip marker in padleft
12666 !! input
12667 {{padleft:|2|x<nowiki/>y}}
12668 !! result
12669 <p>xy
12670 </p>
12671 !! end
12672
12673 !! test
12674 Strip marker in padright
12675 !! input
12676 {{padright:|2|x<nowiki/>y}}
12677 !! result
12678 <p>xy
12679 </p>
12680 !! end
12681
12682 !! test
12683 Strip marker in anchorencode
12684 !! input
12685 {{anchorencode:x<nowiki/>y}}
12686 !! result
12687 <p>xy
12688 </p>
12689 !! end
12690
12691 !! test
12692 nowiki inside link inside heading (bug 18295)
12693 !! input
12694 ==[[foo|x<nowiki>y</nowiki>z]]==
12695 !! result
12696 <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>
12697
12698 !! end
12699
12700 !! test
12701 new support for bdi element (bug 31817)
12702 !! input
12703 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12704 !! result
12705 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12706
12707 !!end
12708
12709 !! test
12710 Ignore pipe between table row attributes
12711 !! input
12712 {|
12713 | quux
12714 |- id=foo | style='color: red'
12715 | bar
12716 |}
12717 !! result
12718 <table>
12719 <tr>
12720 <td> quux
12721 </td></tr>
12722 <tr id="foo" style="color: red">
12723 <td> bar
12724 </td></tr></table>
12725
12726 !! end
12727
12728 !!test
12729 Gallery override link with WikiLink (bug 34852)
12730 !! input
12731 <gallery>
12732 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12733 </gallery>
12734 !! result
12735 <ul class="gallery">
12736 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12737 <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>
12738 <div class="gallerytext">
12739 <p>caption
12740 </p>
12741 </div>
12742 </div></li>
12743 </ul>
12744
12745 !! end
12746
12747 !!test
12748 Gallery override link with absolute external link (bug 34852)
12749 !! input
12750 <gallery>
12751 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12752 </gallery>
12753 !! result
12754 <ul class="gallery">
12755 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12756 <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>
12757 <div class="gallerytext">
12758 <p>caption
12759 </p>
12760 </div>
12761 </div></li>
12762 </ul>
12763
12764 !! end
12765
12766 !!test
12767 Gallery override link with malicious javascript (bug 34852)
12768 !! input
12769 <gallery>
12770 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12771 </gallery>
12772 !! result
12773 <ul class="gallery">
12774 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12775 <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>
12776 <div class="gallerytext">
12777 <p>caption
12778 </p>
12779 </div>
12780 </div></li>
12781 </ul>
12782
12783 !! end
12784
12785 !!test
12786 Gallery with invalid title as link (bug 43964)
12787 !! input
12788 <gallery>
12789 File:foobar.jpg|link=<
12790 </gallery>
12791 !! result
12792 <ul class="gallery">
12793 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12794 <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>
12795 <div class="gallerytext">
12796 </div>
12797 </div></li>
12798 </ul>
12799
12800 !! end
12801
12802 !!test
12803 Language parser function
12804 !! input
12805 {{#language:ar}}
12806 !! result
12807 <p>العربية
12808 </p>
12809 !! end
12810
12811 !!test
12812 Padleft and padright as substr
12813 !! input
12814 {{padleft:|3|abcde}}
12815 {{padright:|3|abcde}}
12816 !! result
12817 <p>abc
12818 abc
12819 </p>
12820 !! end
12821
12822 !!test
12823 Bug 34939 - Case insensitive link parsing ([HttP://])
12824 !! input
12825 [HttP://MediaWiki.Org/]
12826 !! result
12827 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12828 </p>
12829 !! end
12830
12831 !!test
12832 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12833 !! input
12834 [HttP://MediaWiki.Org/ MediaWiki]
12835 !! result
12836 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12837 </p>
12838 !! end
12839
12840 !!test
12841 Bug 34939 - Case insensitive link parsing (HttP://)
12842 !! input
12843 HttP://MediaWiki.Org/
12844 !! result
12845 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12846 </p>
12847 !! end
12848
12849 ###
12850 ### Parsoids-specific tests
12851 ### Parsoid-PHP parser incompatibilities
12852 ###
12853 !!test
12854 1. SOL-sensitive wikitext tokens as template-args
12855 !!options
12856 disabled
12857 !!input
12858 {{echo|*a}}
12859 {{echo|#a}}
12860 {{echo|:a}}
12861 !!result
12862 <p>*a
12863 #a
12864 :a
12865 </p>
12866 !!end
12867
12868 #### The following section of tests are primarily to test
12869 #### wikitext escaping capabilities of Parsoid.
12870 #### A lot of the tests are disabled for the PHP parser either
12871 #### because of minor newline diffs or other reasons.
12872 #### As Parsoid serializer can handle newlines and other HTML
12873 #### more robustly, some of these tests might get reenabled
12874 #### for the PHP parser.
12875
12876 #### --------------- Headings ---------------
12877 #### 0. Unnested
12878 #### 1. Nested inside html <h1>=foo=</h1>
12879 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12880 #### 3. Nested inside html with wikitext split by html tags
12881 #### 4. No escape needed
12882 #### 5. Empty headings <h1></h1>
12883 #### 6. Heading chars in SOL context
12884 #### ----------------------------------------
12885 !! test
12886 Headings: 0. Unnested
12887 !! input
12888 <nowiki>=foo=</nowiki>
12889
12890 <nowiki>=foo</nowiki>''a''=
12891 !! result
12892 <p>=foo=
12893 </p><p>=foo<i>a</i>=
12894 </p>
12895 !!end
12896
12897 !! test
12898 Headings: 1. Nested inside html
12899 !! options
12900 disabled
12901 !! input
12902 =<nowiki>=foo=</nowiki>=
12903 ==<nowiki>=foo=</nowiki>==
12904 ===<nowiki>=foo=</nowiki>===
12905 ====<nowiki>=foo=</nowiki>====
12906 =====<nowiki>=foo=</nowiki>=====
12907 ======<nowiki>=foo=</nowiki>======
12908 !! result
12909 <h1>=foo=</h1>
12910 <h2>=foo=</h2>
12911 <h3>=foo=</h3>
12912 <h4>=foo=</h4>
12913 <h5>=foo=</h5>
12914 <h6>=foo=</h6>
12915 !!end
12916
12917 !! test
12918 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12919 !! options
12920 disabled
12921 !! input
12922 =foo=
12923 <nowiki>*bar</nowiki>
12924 =foo=
12925 =bar
12926 =foo=
12927 <nowiki>=bar=</nowiki>
12928 !! result
12929 <h1>foo</h1>*bar
12930 <h1>foo</h1>=bar
12931 <h1>foo</h1>=bar=
12932 !!end
12933
12934 !! test
12935 Headings: 3. Nested inside html with wikitext split by html tags
12936 !! options
12937 disabled
12938 !! input
12939 =<nowiki>=</nowiki>'''bold'''foo==
12940 !! result
12941 <h1>=<b>bold</b>foo=</h1>
12942 !!end
12943
12944 !! test
12945 Headings: 4. No escaping needed (testing just h1 and h2)
12946 !! options
12947 disabled
12948 !! input
12949 ==foo=
12950 =foo==
12951 ===foo==
12952 ==foo===
12953 =''=''foo==
12954 ===
12955 !! result
12956 <h1>=foo</h1>
12957 <h1>foo=</h1>
12958 <h2>=foo</h2>
12959 <h2>foo=</h2>
12960 <h1><i>=</i>foo=</h1>
12961 <h1>=</h1>
12962 !!end
12963
12964 !! test
12965 Headings: 5. Empty headings
12966 !! options
12967 disabled
12968 !! input
12969 =<nowiki></nowiki>=
12970 ==<nowiki></nowiki>==
12971 ===<nowiki></nowiki>===
12972 ====<nowiki></nowiki>====
12973 =====<nowiki></nowiki>=====
12974 ======<nowiki></nowiki>======
12975 !! result
12976 <h1></h1>
12977 <h2></h2>
12978 <h3></h3>
12979 <h4></h4>
12980 <h5></h5>
12981 <h6></h6>
12982 !!end
12983
12984 !! test
12985 Headings: 6. Heading chars in SOL context
12986 !! options
12987 disabled
12988 !! input
12989 <!--cmt--><nowiki>=h1=</nowiki>
12990 !! result
12991 <p><!--cmt-->=h1=
12992 </p>
12993 !!end
12994
12995 #### --------------- Lists ---------------
12996 #### 0. Outside nests (*foo, etc.)
12997 #### 1. Nested inside html <ul><li>*foo</li></ul>
12998 #### 2. Inside definition lists
12999 #### 3. Only bullets at start should be escaped
13000 #### 4. No escapes needed
13001 #### 5. No unnecessary escapes
13002 #### 6. Escape bullets in SOL position
13003 #### 7. Escape bullets in a multi-line context
13004 #### ----------------------------------------
13005
13006 !! test
13007 Lists: 0. Outside nests
13008 !! input
13009 <nowiki>*foo</nowiki>
13010
13011 <nowiki>#foo</nowiki>
13012 !! result
13013 <p>*foo
13014 </p><p>#foo
13015 </p>
13016 !!end
13017
13018 !! test
13019 Lists: 1. Nested inside html
13020 !! input
13021 *<nowiki>*foo</nowiki>
13022
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 !! result
13037 <ul><li>*foo
13038 </li></ul>
13039 <ul><li>#foo
13040 </li></ul>
13041 <ul><li>:foo
13042 </li></ul>
13043 <ul><li>;foo
13044 </li></ul>
13045 <ol><li>*foo
13046 </li></ol>
13047 <ol><li>#foo
13048 </li></ol>
13049 <ol><li>:foo
13050 </li></ol>
13051 <ol><li>;foo
13052 </li></ol>
13053
13054 !!end
13055
13056 !! test
13057 Lists: 2. Inside definition lists
13058 !! input
13059 ;<nowiki>;foo</nowiki>
13060
13061 ;<nowiki>:foo</nowiki>
13062
13063 ;<nowiki>:foo</nowiki>
13064 :bar
13065
13066 :<nowiki>:foo</nowiki>
13067 !! result
13068 <dl><dt>;foo
13069 </dt></dl>
13070 <dl><dt>:foo
13071 </dt></dl>
13072 <dl><dt>:foo
13073 </dt><dd>bar
13074 </dd></dl>
13075 <dl><dd>:foo
13076 </dd></dl>
13077
13078 !!end
13079
13080 !! test
13081 Lists: 3. Only bullets at start of text should be escaped
13082 !! input
13083 *<nowiki>*foo*bar</nowiki>
13084
13085 *<nowiki>*foo</nowiki>''it''*bar
13086 !! result
13087 <ul><li>*foo*bar
13088 </li></ul>
13089 <ul><li>*foo<i>it</i>*bar
13090 </li></ul>
13091
13092 !!end
13093
13094 !! test
13095 Lists: 4. No escapes needed
13096 !! options
13097 disabled
13098 !! input
13099 *foo*bar
13100
13101 *''foo''*bar
13102
13103 *[[Foo]]: bar
13104 !! result
13105 <ul><li>foo*bar
13106 </li></ul>
13107 <ul><li><i>foo</i>*bar
13108 </li></ul>
13109 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13110 </li></ul>
13111 !!end
13112
13113 !! test
13114 Lists: 5. No unnecessary escapes
13115 !! input
13116 * bar <span><nowiki>[[foo]]</nowiki></span>
13117
13118 *=bar <span><nowiki>[[foo]]</nowiki></span>
13119
13120 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13121
13122 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13123
13124 *=bar <span>foo]]</span>=
13125 !! result
13126 <ul><li> bar <span>[[foo]]</span>
13127 </li></ul>
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
13137 !!end
13138
13139 !! test
13140 Lists: 6. Escape bullets in SOL position
13141 !! options
13142 disabled
13143 !! input
13144 <!--cmt--><nowiki>*foo</nowiki>
13145 !! result
13146 <p><!--cmt-->*foo
13147 </p>
13148 !!end
13149
13150 !! test
13151 Lists: 7. Escape bullets in a multi-line context
13152 !! input
13153 <nowiki>a
13154 *b</nowiki>
13155 !! result
13156 <p>a
13157 *b
13158 </p>
13159 !!end
13160
13161 #### --------------- HRs ---------------
13162 #### 1. Single line
13163 #### -----------------------------------
13164
13165 !! test
13166 HRs: 1. Single line
13167 !! options
13168 disabled
13169 !! input
13170 ----
13171 <nowiki>----</nowiki>
13172 ----
13173 <nowiki>=foo=</nowiki>
13174 ----
13175 <nowiki>*foo</nowiki>
13176 !! result
13177 <hr/>----
13178 <hr/>=foo=
13179 <hr/>*foo
13180 !! end
13181
13182 #### --------------- Tables ---------------
13183 #### 1a. Simple example
13184 #### 1b. No escaping needed (!foo)
13185 #### 1c. No escaping needed (|foo)
13186 #### 1d. No escaping needed (|}foo)
13187 ####
13188 #### 2a. Nested in td (<td>foo|bar</td>)
13189 #### 2b. Nested in td (<td>foo||bar</td>)
13190 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13191 ####
13192 #### 3a. Nested in th (<th>foo!bar</th>)
13193 #### 3b. Nested in th (<th>foo!!bar</th>)
13194 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13195 ####
13196 #### 4a. Escape -
13197 #### 4b. Escape +
13198 #### 4c. No escaping needed
13199 #### --------------------------------------
13200
13201 !! test
13202 Tables: 1a. Simple example
13203 !! input
13204 <nowiki>{|
13205 |}</nowiki>
13206 !! result
13207 <p>{|
13208 |}
13209 </p>
13210 !! end
13211
13212 !! test
13213 Tables: 1b. No escaping needed
13214 !! input
13215 !foo
13216 !! result
13217 <p>!foo
13218 </p>
13219 !! end
13220
13221 !! test
13222 Tables: 1c. No escaping needed
13223 !! input
13224 |foo
13225 !! result
13226 <p>|foo
13227 </p>
13228 !! end
13229
13230 !! test
13231 Tables: 1d. No escaping needed
13232 !! input
13233 |}foo
13234 !! result
13235 <p>|}foo
13236 </p>
13237 !! end
13238
13239 !! test
13240 Tables: 2a. Nested in td
13241 !! options
13242 disabled
13243 !! input
13244 {|
13245 |<nowiki>foo|bar</nowiki>
13246 |}
13247 !! result
13248 <table>
13249 <tr><td>foo|bar
13250 </td></tr></table>
13251
13252 !! end
13253
13254 !! test
13255 Tables: 2b. Nested in td
13256 !! options
13257 disabled
13258 !! input
13259 {|
13260 |<nowiki>foo||bar</nowiki>
13261 |''it''<nowiki>foo||bar</nowiki>
13262 |}
13263 !! result
13264 <table>
13265 <tr><td>foo||bar
13266 </td><td><i>it</i>foo||bar
13267 </td></tr></table>
13268
13269 !! end
13270
13271 !! test
13272 Tables: 2c. Nested in td -- no escaping needed
13273 !! options
13274 disabled
13275 !! input
13276 {|
13277 |foo!!bar
13278 |}
13279 !! result
13280 <table>
13281 <tr><td>foo!!bar
13282 </td></tr></table>
13283
13284 !! end
13285
13286 !! test
13287 Tables: 3a. Nested in th
13288 !! options
13289 disabled
13290 !! input
13291 {|
13292 !foo!bar
13293 |}
13294 !! result
13295 <table>
13296 <tr><th>foo!bar
13297 </th></tr></table>
13298
13299 !! end
13300
13301 !! test
13302 Tables: 3b. Nested in th
13303 !! options
13304 disabled
13305 !! input
13306 {|
13307 !<nowiki>foo!!bar</nowiki>
13308 |}
13309 !! result
13310 <table>
13311 <tr><th>foo!!bar
13312 </th></tr></table>
13313
13314 !! end
13315
13316 !! test
13317 Tables: 3c. Nested in th -- no escaping needed
13318 !! options
13319 disabled
13320 !! input
13321 {|
13322 !foo||bar
13323 |}
13324 !! result
13325 <table>
13326 <tr><th>foo||bar
13327 </th></tr></table>
13328
13329 !! end
13330
13331 !! test
13332 Tables: 4a. Escape -
13333 !! options
13334 disabled
13335 !! input
13336 {|
13337 |-
13338 !-bar
13339 |-
13340 |<nowiki>-bar</nowiki>
13341 |}
13342 !! result
13343 <table><tbody>
13344 <tr><th>-bar</th></tr>
13345 <tr><td>-bar</td></tr>
13346 </tbody></table>
13347 !! end
13348
13349 !! test
13350 Tables: 4b. Escape +
13351 !! options
13352 disabled
13353 !! input
13354 {|
13355 |-
13356 !+bar
13357 |-
13358 |<nowiki>+bar</nowiki>
13359 |}
13360 !! result
13361 <table><tbody>
13362 <tr><th>+bar</th></tr>
13363 <tr><td>+bar</td></tr>
13364 </tbody></table>
13365 !! end
13366
13367 !! test
13368 Tables: 4c. No escaping needed
13369 !! options
13370 disabled
13371 !! input
13372 {|
13373 |-
13374 |foo-bar
13375 |foo+bar
13376 |-
13377 |''foo''-bar
13378 |''foo''+bar
13379 |}
13380 !! result
13381 <table><tbody>
13382 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13383 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13384 </tbody></table>
13385 !! end
13386
13387 !! test
13388 Tables: 4d. No escaping needed
13389 !! input
13390 {|
13391 ||+1
13392 ||-2
13393 |}
13394 !! result
13395 <table>
13396 <tr>
13397 <td>+1
13398 </td>
13399 <td>-2
13400 </td></tr></table>
13401
13402 !! end
13403
13404 #### --------------- Links ---------------
13405 #### 1. Quote marks in link text
13406 #### 2. Wikilinks: Escapes needed
13407 #### 3. Wikilinks: No escapes needed
13408 #### 4. Extlinks: Escapes needed
13409 #### 5. Extlinks: No escapes needed
13410 #### --------------------------------------
13411 !! test
13412 Links 1. Quote marks in link text
13413 !! options
13414 disabled
13415 !! input
13416 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13417 !! result
13418 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13419 !! end
13420
13421 !! test
13422 Links 2. WikiLinks: Escapes needed
13423 !! options
13424 disabled
13425 !! input
13426 [[Foo|<nowiki>[Foobar]</nowiki>]]
13427 [[Foo|<nowiki>Foobar]</nowiki>]]
13428 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13429 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13430 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13431 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13432 [[Foo|<nowiki>|Bar</nowiki>]]
13433 !! result
13434 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13435 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13436 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13437 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13438 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13439 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13440 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13441 !! end
13442
13443 !! test
13444 Links 3. WikiLinks: No escapes needed
13445 !! options
13446 disabled
13447 !! input
13448 [[Foo|[Foobar]]
13449 [[Foo|foo|bar]]
13450 !! result
13451 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13452 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13453 !! end
13454
13455 !! test
13456 Links 4. ExtLinks: Escapes needed
13457 !! options
13458 disabled
13459 !! input
13460 [http://google.com <nowiki>[google]</nowiki>]
13461 [http://google.com <nowiki>google]</nowiki>]
13462 !! result
13463 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13464 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13465 !! end
13466
13467 !! test
13468 Links 5. ExtLinks: No escapes needed
13469 !! options
13470 disabled
13471 !! input
13472 [http://google.com [google]
13473 !! result
13474 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13475 !! end
13476
13477 #### --------------- Quotes ---------------
13478 #### 1. Quotes inside <b> and <i>
13479 #### 2. Link fragments separated by <i> and <b> tags
13480 #### 3. Link fragments inside <i> and <b>
13481 #### --------------------------------------
13482 !! test
13483 1. Quotes inside <b> and <i>
13484 !! input
13485 ''<nowiki>'foo'</nowiki>''
13486 ''<nowiki>''foo''</nowiki>''
13487 ''<nowiki>'''foo'''</nowiki>''
13488 '''<nowiki>'foo'</nowiki>'''
13489 '''<nowiki>''foo''</nowiki>'''
13490 '''<nowiki>'''foo'''</nowiki>'''
13491 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13492 !! result
13493 <p><i>'foo'</i>
13494 <i>''foo''</i>
13495 <i>'''foo'''</i>
13496 <b>'foo'</b>
13497 <b>''foo''</b>
13498 <b>'''foo'''</b>
13499 <b>foo'<i>bar'</i>baz</b>
13500 </p>
13501 !! end
13502
13503 !! test
13504 2. Link fragments separated by <i> and <b> tags
13505 !! input
13506 [[''foo''<nowiki>hello]]</nowiki>
13507
13508 [['''foo'''<nowiki>hello]]</nowiki>
13509 !! result
13510 <p>[[<i>foo</i>hello]]
13511 </p><p>[[<b>foo</b>hello]]
13512 </p>
13513 !! end
13514
13515 !! test
13516 2. Link fragments inside <i> and <b>
13517 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13518 this is one of the shortcomings of this format)
13519 !! input
13520 ''[[foo''<nowiki>]]</nowiki>
13521
13522 '''[[foo'''<nowiki>]]</nowiki>
13523 !! result
13524 <p><i>[[foo</i>]]
13525 </p><p><b>[[foo</b>]]
13526 </p>
13527 !! end
13528
13529 #### --------------- Paragraphs ---------------
13530 #### 1. No unnecessary escapes
13531 #### --------------------------------------
13532
13533 !! test
13534 1. No unnecessary escapes
13535 !! input
13536 bar <span><nowiki>[[foo]]</nowiki></span>
13537
13538 =bar <span><nowiki>[[foo]]</nowiki></span>
13539
13540 [[bar <span><nowiki>[[foo]]</nowiki></span>
13541
13542 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13543
13544 <nowiki>=bar </nowiki><span>foo]]</span>=
13545 !! result
13546 <p>bar <span>[[foo]]</span>
13547 </p><p>=bar <span>[[foo]]</span>
13548 </p><p>[[bar <span>[[foo]]</span>
13549 </p><p>]]bar <span>[[foo]]</span>
13550 </p><p>=bar <span>foo]]</span>=
13551 </p>
13552 !!end
13553
13554 #### --------------- PRE ------------------
13555 #### 1. Leading space in SOL context should be escaped
13556 #### --------------------------------------
13557 !! test
13558 1. Leading space in SOL context should be escaped
13559 !! options
13560 disabled
13561 !! input
13562 <nowiki> foo</nowiki>
13563 <!--cmt--><nowiki> foo</nowiki>
13564 !! result
13565 <p> foo
13566 <!--cmt--> foo
13567 </p>
13568 !! end
13569
13570 #### --------------- HTML tags ---------------
13571 #### 1. a tags
13572 #### 2. other tags
13573 #### 3. multi-line html tag
13574 #### --------------------------------------
13575 !! test
13576 1. a tags
13577 !! options
13578 disabled
13579 !! input
13580 <a href="http://google.com">google</a>
13581 !! result
13582 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13583 !! end
13584
13585 !! test
13586 2. other tags
13587 !! input
13588 <nowiki><div>foo</div>
13589 <div style="color:red">foo</div></nowiki>
13590 !! result
13591 <p>&lt;div&gt;foo&lt;/div&gt;
13592 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13593 </p>
13594 !! end
13595
13596 !! test
13597 3. multi-line html tag
13598 !! input
13599 <nowiki><div
13600 >foo</div
13601 ></nowiki>
13602 !! result
13603 <p>&lt;div
13604 &gt;foo&lt;/div
13605 &gt;
13606 </p>
13607 !! end
13608
13609 #### --------------- Others ---------------
13610 !! test
13611 Escaping nowikis
13612 !! input
13613 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13614 !! result
13615 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13616 </p>
13617 !! end
13618
13619 !! test
13620 Tag-like HTML structures are passed through as text
13621 !! input
13622 <x y>
13623
13624 <x.y>
13625
13626 <x-y>
13627
13628 1>2
13629
13630 x<y
13631
13632 a>b
13633
13634 1<d e>f
13635 !! result
13636 <p>&lt;x y&gt;
13637 </p><p>&lt;x.y&gt;
13638 </p><p>&lt;x-y&gt;
13639 </p><p>1&gt;2
13640 </p><p>x&lt;y
13641 </p><p>a&gt;b
13642 </p><p>1&lt;d e&gt;f
13643 </p>
13644 !! end
13645
13646
13647 # This fails in the PHP parser (see bug 40670,
13648 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13649 !! test
13650 Tag names followed by punctuation should not be recognized as tags
13651 !! options
13652 disabled
13653 !! input
13654 <s.ome> text
13655 !! result
13656 <p>&lt;s.ome&gt text
13657 </p>
13658 !! end
13659
13660 !! test
13661 HTML tag with necessary entities in attributes
13662 !! input
13663 <span title="&amp;amp;">foo</span>
13664 !! result
13665 <p><span title="&amp;amp;">foo</span>
13666 </p>
13667 !! end
13668
13669 !! test
13670 HTML tag with 'unnecessary' entity encoding in attributes
13671 !! input
13672 <span title="&amp;">foo</span>
13673 !! result
13674 <p><span title="&amp;">foo</span>
13675 </p>
13676 !! end
13677
13678 !! test
13679 HTML tag with broken attribute value quoting
13680 !! input
13681 <span title="Hello world>Foo</span>
13682 !! result
13683 <p><span>Foo</span>
13684 </p>
13685 !! end
13686
13687 !! test
13688 Parsoid-only: HTML tag with broken attribute value quoting
13689 !! options
13690 disabled
13691 !! input
13692 <span title="Hello world>Foo</span>
13693 !! result
13694 <p><span title="Hello world">Foo</span>
13695 </p>
13696 !! end
13697
13698 !! test
13699 Table with broken attribute value quoting
13700 !! input
13701 {|
13702 | title="Hello world|Foo
13703 |}
13704 !! result
13705 <table>
13706 <tr>
13707 <td>Foo
13708 </td></tr></table>
13709
13710 !! end
13711
13712 !! test
13713 Table with broken attribute value quoting on consecutive lines
13714 !! input
13715 {|
13716 | title="Hello world|Foo
13717 | style="color:red|Bar
13718 |}
13719 !! result
13720 <table>
13721 <tr>
13722 <td>Foo
13723 </td>
13724 <td>Bar
13725 </td></tr></table>
13726
13727 !! end
13728
13729 !! test
13730 Parsoid-only: Table with broken attribute value quoting on consecutive lines
13731 !! options
13732 disabled
13733 !! input
13734 {|
13735 | title="Hello world|Foo
13736 | style="color:red|Bar
13737 |}
13738 !! result
13739 <table>
13740 <tr>
13741 <td title="Hello world">Foo
13742 </td><td style="color: red">Bar
13743 </td></tr></table>
13744
13745 !! end
13746
13747 !!test
13748 Accept empty td cell attribute
13749 !!input
13750 {|
13751 | align="center" | foo || |
13752 |}
13753 !!result
13754 <table>
13755 <tr>
13756 <td align="center"> foo </td>
13757 <td>
13758 </td></tr></table>
13759
13760 !!end
13761
13762 !!test
13763 Non-empty attributes in th-cells
13764 !!input
13765 {|
13766 ! Foo !! style="color: red" | Bar
13767 |}
13768 !!result
13769 <table>
13770 <tr>
13771 <th> Foo </th>
13772 <th style="color: red"> Bar
13773 </th></tr></table>
13774
13775 !!end
13776
13777 !!test
13778 Accept empty attributes in th-cells
13779 !!input
13780 {|
13781 !| foo !!| bar
13782 |}
13783 !!result
13784 <table>
13785 <tr>
13786 <th> foo </th>
13787 <th> bar
13788 </th></tr></table>
13789
13790 !!end
13791
13792 !!test
13793 Empty table rows go away
13794 !!input
13795 {|
13796 | Hello
13797 | there
13798 |- class="foo"
13799 |-
13800 |}
13801 !! result
13802 <table>
13803 <tr>
13804 <td> Hello
13805 </td>
13806 <td> there
13807 </td></tr>
13808
13809 </table>
13810
13811 !! end
13812
13813 TODO:
13814 more images
13815 more tables
13816 character entities
13817 and much more
13818 Try for 100% code coverage