d63fb3b18c54067562305a0d559adb95e69b0fc6
[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
495 !! test
496 Italics and bold: other quote tests: (3,(2,2),3)
497 !! input
498 '''this is about ''foo's'' family'''
499 !! result
500 <p><b>this is about <i>foo's</i> family</b>
501 </p>
502 !!end
503
504 ###
505 ### <nowiki> test cases
506 ###
507
508 !! test
509 <nowiki> unordered list
510 !! input
511 <nowiki>* This is not an unordered list item.</nowiki>
512 !! result
513 <p>* This is not an unordered list item.
514 </p>
515 !! end
516
517 !! test
518 <nowiki> spacing
519 !! input
520 <nowiki>Lorem ipsum dolor
521
522 sed abit.
523 sed nullum.
524
525 :and a colon
526 </nowiki>
527 !! result
528 <p>Lorem ipsum dolor
529
530 sed abit.
531 sed nullum.
532
533 :and a colon
534
535 </p>
536 !! end
537
538 !! test
539 nowiki 3
540 !! input
541 :There is not nowiki.
542 :There is <nowiki>nowiki</nowiki>.
543
544 #There is not nowiki.
545 #There is <nowiki>nowiki</nowiki>.
546
547 *There is not nowiki.
548 *There is <nowiki>nowiki</nowiki>.
549 !! result
550 <dl><dd>There is not nowiki.
551 </dd><dd>There is nowiki.
552 </dd></dl>
553 <ol><li>There is not nowiki.
554 </li><li>There is nowiki.
555 </li></ol>
556 <ul><li>There is not nowiki.
557 </li><li>There is nowiki.
558 </li></ul>
559
560 !! end
561
562 !! test
563 Entities inside <nowiki>
564 !! input
565 <nowiki>&lt;</nowiki>
566 !! result
567 <p>&lt;
568 </p>
569 !! end
570
571
572 ###
573 ### Comments
574 ###
575 !! test
576 Comments and Indent-Pre
577 !! input
578 <!-- comment 1 --> asdf
579
580 <!-- comment 1 --> asdf
581 <!-- comment 2 -->
582
583 <!-- comment 1 --> asdf
584 <!-- comment 2 -->xyz
585
586 <!-- comment 1 --> asdf
587 <!-- comment 2 --> xyz
588 !! result
589 <pre>asdf
590 </pre>
591 <pre>asdf
592 </pre>
593 <pre>asdf
594 </pre>
595 <p>xyz
596 </p>
597 <pre>asdf
598 xyz
599 </pre>
600 !! end
601
602 !! test
603 Comment test 2a
604 !! input
605 asdf
606 <!-- comment 1 -->
607 jkl
608 !! result
609 <p>asdf
610 jkl
611 </p>
612 !! end
613
614 !! test
615 Comment test 2b
616 !! input
617 asdf
618 <!-- comment 1 -->
619
620 jkl
621 !! result
622 <p>asdf
623 </p><p>jkl
624 </p>
625 !! end
626
627 !! test
628 Comment test 3
629 !! input
630 asdf
631 <!-- comment 1 -->
632 <!-- comment 2 -->
633 jkl
634 !! result
635 <p>asdf
636 jkl
637 </p>
638 !! end
639
640 !! test
641 Comment test 4
642 !! input
643 asdf<!-- comment 1 -->jkl
644 !! result
645 <p>asdfjkl
646 </p>
647 !! end
648
649 !! test
650 Comment spacing
651 !! input
652 a
653 <!-- foo --> b <!-- bar -->
654 c
655 !! result
656 <p>a
657 </p>
658 <pre> b
659 </pre>
660 <p>c
661 </p>
662 !! end
663
664 !! test
665 Comment whitespace
666 !! input
667 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
668 !! result
669
670 !! end
671
672 !! test
673 Comment semantics and delimiters
674 !! input
675 <!-- --><!----><!-----><!------>
676 !! result
677
678 !! end
679
680 !! test
681 Comment semantics and delimiters, redux
682 !! input
683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
684 -- foo -- funky huh? ... -->
685 !! result
686
687 !! end
688
689 !! test
690 Comment semantics and delimiters: directors cut
691 !! input
692 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
693 everything starting with < followed by !-- until the first -- and > we see,
694 that wouldn't be valid XML however, since in XML -- has to terminate a comment
695 -->-->
696 !! result
697 <p>--&gt;
698 </p>
699 !! end
700
701 !! test
702 Comment semantics: nesting
703 !! input
704 <!--<!-- no, we're not going to do anything fancy here -->-->
705 !! result
706 <p>--&gt;
707 </p>
708 !! end
709
710 !! test
711 Comment semantics: unclosed comment at end
712 !! input
713 <!--This comment will run out to the end of the document
714 !! result
715
716 !! end
717
718 !! test
719 Comment in template title
720 !! input
721 {{f<!---->oo}}
722 !! result
723 <p>FOO
724 </p>
725 !! end
726
727 !! test
728 Comment on its own line post-expand
729 !! input
730 a
731 {{blank}}<!---->
732 b
733 !! result
734 <p>a
735 </p><p>b
736 </p>
737 !! end
738
739 !! test
740 Comment on its own line post-expand with non-significant whitespace
741 !! input
742 a
743 {{blank}} <!---->
744 b
745 !! result
746 <p>a
747 </p><p>b
748 </p>
749 !! end
750
751 ###
752 ### paragraph wraping tests
753 ###
754 !! test
755 No block tags
756 !! input
757 a
758
759 b
760 !! result
761 <p>a
762 </p><p>b
763 </p>
764 !! end
765 !! test
766 Block tag on one line
767 !! input
768 a <div>foo</div>
769
770 b
771 !! result
772 a <div>foo</div>
773 <p>b
774 </p>
775 !! end
776
777 !! test
778 Block tag on both lines
779 !! input
780 a <div>foo</div>
781
782 b <div>foo</div>
783 !! result
784 a <div>foo</div>
785 b <div>foo</div>
786
787 !! end
788
789 !! test
790 Multiple lines without block tags
791 !! input
792 <div>foo</div> a
793 b
794 c
795 d<!--foo--> e
796 x <div>foo</div> z
797 !! result
798 <div>foo</div> a
799 <p>b
800 c
801 d e
802 </p>
803 x <div>foo</div> z
804
805 !! end
806
807 !! test
808 Empty lines between block tags to test open p-tags are closed between the block tags
809 !! input
810 <div></div>
811
812
813 <div></div>a
814
815 b
816 !! result
817 <div></div>
818 <p><br />
819 </p>
820 <div></div>a
821 <p>b
822 </p>
823 !! end
824
825 ###
826 ### Preformatted text
827 ###
828 !! test
829 Preformatted text
830 !! input
831 This is some
832 Preformatted text
833 With ''italic''
834 And '''bold'''
835 And a [[Main Page|link]]
836 !! result
837 <pre>This is some
838 Preformatted text
839 With <i>italic</i>
840 And <b>bold</b>
841 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
842 </pre>
843 !! end
844
845 !! test
846 Ident preformatting with inline content
847 !! input
848 a
849 ''b''
850 !! result
851 <pre>a
852 <i>b</i>
853 </pre>
854 !! end
855
856 !! test
857 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
858 !! input
859 <pre><nowiki>
860 <b>
861 <cite>
862 <em>
863 </nowiki></pre>
864 !! result
865 <pre>
866 &lt;b&gt;
867 &lt;cite&gt;
868 &lt;em&gt;
869 </pre>
870
871 !! end
872
873 !! test
874 Regression with preformatted in <center>
875 !! input
876 <center>
877 Blah
878 </center>
879 !! result
880 <center>
881 <pre>Blah
882 </pre>
883 </center>
884
885 !! end
886
887 # Expected output in the following test is not really expected (there should be
888 # <pre> in the output) -- it's only testing for well-formedness.
889 !! test
890 Bug 6200: Preformatted in <blockquote>
891 !! input
892 <blockquote>
893 Blah
894 </blockquote>
895 !! result
896 <blockquote>
897 Blah
898 </blockquote>
899
900 !! end
901
902 !! test
903 <pre> with attributes (bug 3202)
904 !! input
905 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
906 !! result
907 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
908
909 !! end
910
911 !! test
912 <pre> with width attribute (bug 3202)
913 !! input
914 <pre width="8">Narrow screen goodies</pre>
915 !! result
916 <pre width="8">Narrow screen goodies</pre>
917
918 !! end
919
920 !! test
921 <pre> with forbidden attribute (bug 3202)
922 !! input
923 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
924 !! result
925 <pre width="8">Narrow screen goodies</pre>
926
927 !! end
928
929 !! test
930 Entities inside <pre>
931 !! input
932 <pre>&lt;</pre>
933 !! result
934 <pre>&lt;</pre>
935
936 !! end
937
938 !! test
939 <pre> with forbidden attribute values (bug 3202)
940 !! input
941 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
942 !! result
943 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
944
945 !! end
946
947 !! test
948 <nowiki> inside <pre> (bug 13238)
949 !! input
950 <pre>
951 <nowiki>
952 </pre>
953 <pre>
954 <nowiki></nowiki>
955 </pre>
956 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
957 !! result
958 <pre>
959 &lt;nowiki&gt;
960 </pre>
961 <pre>
962
963 </pre>
964 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
965
966 !! end
967
968 !! test
969 <nowiki> and <pre> preference (first one wins)
970 !! input
971 <pre>
972 <nowiki>
973 </pre>
974 </nowiki>
975 </pre>
976
977 <nowiki>
978 <pre>
979 <nowiki>
980 </pre>
981 </nowiki>
982 </pre>
983
984 !! result
985 <pre>
986 &lt;nowiki&gt;
987 </pre>
988 <p>&lt;/nowiki&gt;
989 &lt;/pre&gt;
990 </p><p>
991 &lt;pre&gt;
992 &lt;nowiki&gt;
993 &lt;/pre&gt;
994
995 &lt;/pre&gt;
996 </p>
997 !! end
998
999 !! test
1000 </pre> inside nowiki
1001 !! input
1002 <nowiki></pre></nowiki>
1003 !! result
1004 <p>&lt;/pre&gt;
1005 </p>
1006 !! end
1007
1008 !!test
1009 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1010 !!input
1011 {{echo|}}
1012 !!result
1013
1014 !!end
1015
1016 !!test
1017 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1018 !!input
1019 {{echo|
1020 foo}}
1021 !!result
1022 <p>foo
1023 </p>
1024 !!end
1025
1026 !! test
1027 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1028 !! input
1029 {{echo|a
1030 b}}
1031 !!result
1032 <pre>a
1033 </pre>
1034 <p>b
1035 </p>
1036 !!end
1037
1038 !! test
1039 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1040 !! input
1041 {{echo|a
1042 b
1043 c
1044 d
1045 e
1046 }}
1047 !!result
1048 <pre>a
1049 </pre>
1050 <p>b
1051 c
1052 </p>
1053 <pre>d
1054 </pre>
1055 <p>e
1056 </p>
1057 !!end
1058
1059 !!test
1060 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1061 !!input
1062 {{echo| foo}}
1063
1064 {{echo| foo}}{{echo| bar}}
1065
1066 {{echo| foo}}
1067 {{echo| bar}}
1068
1069 {{echo|<!--cmt--> foo}}
1070
1071 <!--cmt-->{{echo| foo}}
1072
1073 {{echo|{{echo| }}bar}}
1074 !!result
1075 <pre>foo
1076 </pre>
1077 <pre>foo bar
1078 </pre>
1079 <pre>foo
1080 bar
1081 </pre>
1082 <pre>foo
1083 </pre>
1084 <pre>foo
1085 </pre>
1086 <pre>bar
1087 </pre>
1088 !!end
1089
1090 !! test
1091 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1092 !! input
1093 {{echo| }}a
1094
1095 {{echo|
1096 }}a
1097
1098 {{echo|
1099 b}}
1100
1101 {{echo|a
1102 }}b
1103
1104 {{echo|a
1105 }} b
1106 !!result
1107 <pre>a
1108 </pre>
1109 <p><br />
1110 </p>
1111 <pre>a
1112 </pre>
1113 <p><br />
1114 </p>
1115 <pre>b
1116 </pre>
1117 <p>a
1118 </p>
1119 <pre>b
1120 </pre>
1121 <p>a
1122 </p>
1123 <pre>b
1124 </pre>
1125 !!end
1126
1127 !! test
1128 Templates: Single-line variant of parameter whitespace stripping test
1129 !! input
1130 {{echo| a}}
1131
1132 {{echo|1= a}}
1133
1134 {{echo|{{echo| a}}}}
1135
1136 {{echo|1={{echo| a}}}}
1137 !! result
1138 <pre>a
1139 </pre>
1140 <p>a
1141 </p>
1142 <pre>a
1143 </pre>
1144 <p>a
1145 </p>
1146 !! end
1147
1148 !! test
1149 Templates: Strip whitespace from named parameters, but not positional ones
1150 !! input
1151 {{echo|
1152 foo}}
1153
1154 {{echo|
1155 * foo}}
1156
1157 {{echo| 1 =
1158 foo}}
1159
1160 {{echo| 1 =
1161 * foo}}
1162 !! result
1163 <pre>foo
1164 </pre>
1165 <p><br />
1166 </p>
1167 <ul><li> foo
1168 </li></ul>
1169 <p>foo
1170 </p>
1171 <ul><li> foo
1172 </li></ul>
1173
1174 !! end
1175
1176 ###
1177 ### Parsoid-centric tests for testing RT edge cases for pre
1178 ###
1179
1180 !!test
1181 1a. Indent-Pre and Comments
1182 !!input
1183 a
1184 <!--a-->
1185 c
1186 !!result
1187 <pre>a
1188 </pre>
1189 <p>c
1190 </p>
1191 !!end
1192
1193 !!test
1194 1b. Indent-Pre and Comments
1195 !!input
1196 a
1197 <!--a-->
1198 c
1199 !!result
1200 <pre>a
1201 </pre>
1202 <p>c
1203 </p>
1204 !!end
1205
1206 !!test
1207 1c. Indent-Pre and Comments
1208 !!input
1209 <!--a--> a
1210
1211 <!--a--> a
1212 !!result
1213 <pre> a
1214 </pre>
1215 <pre> a
1216 </pre>
1217 !!end
1218
1219 !!test
1220 2a. Indent-Pre and tables
1221 !!input
1222 {|
1223 |-
1224 !h1!!h2
1225 |foo||bar
1226 |}
1227 !!result
1228 <table>
1229
1230 <tr>
1231 <th>h1</th>
1232 <th>h2
1233 </th>
1234 <td>foo</td>
1235 <td>bar
1236 </td></tr></table>
1237
1238 !!end
1239
1240 !!test
1241 2b. Indent-Pre and tables
1242 !!input
1243 {|
1244 |-
1245 |foo
1246 |}
1247 !!result
1248 <table>
1249
1250 <tr>
1251 <td>foo
1252 </td></tr></table>
1253
1254 !!end
1255
1256 !!test
1257 2c. Indent-Pre and tables (bug 42252)
1258 !!input
1259 {|
1260 |+ foo
1261 ! | bar
1262 |}
1263 !!result
1264 <table>
1265 <caption> foo
1266 </caption>
1267 <tr>
1268 <th> bar
1269 </th></tr></table>
1270
1271 !!end
1272
1273 !!test
1274 3a. Indent-Pre and block tags (single-line html)
1275 !!input
1276 <p> foo </p>
1277 <div> foo </div>
1278 <span> foo </span>
1279 !!result
1280 <p> foo </p>
1281 <div> foo </div>
1282 <pre><span> foo </span>
1283 </pre>
1284 !!end
1285
1286 !!test
1287 3b. Indent-Pre and block tags (pre-content on separate line)
1288 !!input
1289 <p>
1290 foo
1291 </p>
1292
1293 <div>
1294 foo
1295 </div>
1296
1297 <center>
1298 foo
1299 </center>
1300
1301 <blockquote>
1302 foo
1303 </blockquote>
1304
1305 <table><tr><td>
1306 foo
1307 </td></tr></table>
1308
1309 <ul><li>
1310 foo
1311 </li></ul>
1312
1313 !!result
1314 <p>
1315 foo
1316 </p>
1317 <div>
1318 <pre>foo
1319 </pre>
1320 </div>
1321 <center>
1322 <pre>foo
1323 </pre>
1324 </center>
1325 <blockquote>
1326 foo
1327 </blockquote>
1328 <table><tr><td>
1329 <pre>foo
1330 </pre>
1331 </td></tr></table>
1332 <ul><li>
1333 foo
1334 </li></ul>
1335
1336 !!end
1337
1338 !!test
1339 4. Multiple spaces at start-of-line
1340 !!input
1341 <p> foo </p>
1342 foo
1343 {|
1344 |foo
1345 |}
1346 !!result
1347 <p> foo </p>
1348 <pre> foo
1349 </pre>
1350 <table>
1351 <tr>
1352 <td>foo
1353 </td></tr></table>
1354
1355 !!end
1356
1357 !! test
1358 5. White-space in indent-pre
1359 NOTE: the white-space char on 2nd line is significant
1360 !! input
1361 a<br/>
1362
1363 b
1364 !! result
1365 <pre>a<br />
1366
1367 b
1368 </pre>
1369 !! end
1370
1371 ###
1372 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1373 ###
1374
1375 !!test
1376 HTML-pre: 1. embedded newlines
1377 !!input
1378 <pre>foo</pre>
1379
1380 <pre>
1381 foo
1382 </pre>
1383
1384 <pre>
1385
1386 foo
1387 </pre>
1388
1389 <pre>
1390
1391
1392 foo
1393 </pre>
1394 !!result
1395 <pre>foo</pre>
1396 <pre>
1397 foo
1398 </pre>
1399 <pre>
1400
1401 foo
1402 </pre>
1403 <pre>
1404
1405
1406 foo
1407 </pre>
1408
1409 !!end
1410
1411 !!test
1412 HTML-pre: 2: indented text
1413 !!input
1414 <pre>
1415 foo
1416 </pre>
1417 !!result
1418 <pre>
1419 foo
1420 </pre>
1421
1422 !!end
1423
1424 !!test
1425 HTML-pre: 3: other wikitext
1426 !!input
1427 <pre>
1428 * foo
1429 # bar
1430 = no-h =
1431 '' no-italic ''
1432 [[ NoLink ]]
1433 </pre>
1434 !!result
1435 <pre>
1436 * foo
1437 # bar
1438 = no-h =
1439 '' no-italic ''
1440 [[ NoLink ]]
1441 </pre>
1442
1443 !!end
1444
1445 ###
1446 ### Definition lists
1447 ###
1448 !! test
1449 Simple definition
1450 !! input
1451 ; name : Definition
1452 !! result
1453 <dl><dt> name&#160;</dt><dd> Definition
1454 </dd></dl>
1455
1456 !! end
1457
1458 !! test
1459 Definition list for indentation only
1460 !! input
1461 : Indented text
1462 !! result
1463 <dl><dd> Indented text
1464 </dd></dl>
1465
1466 !! end
1467
1468 !! test
1469 Definition list with no space
1470 !! input
1471 ;name:Definition
1472 !! result
1473 <dl><dt>name</dt><dd>Definition
1474 </dd></dl>
1475
1476 !!end
1477
1478 !! test
1479 Definition list with URL link
1480 !! input
1481 ; http://example.com/ : definition
1482 !! result
1483 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1484 </dd></dl>
1485
1486 !! end
1487
1488 !! test
1489 Definition list with bracketed URL link
1490 !! input
1491 ;[http://www.example.com/ Example]:Something about it
1492 !! result
1493 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1494 </dd></dl>
1495
1496 !! end
1497
1498 !! test
1499 Definition list with wikilink containing colon
1500 !! input
1501 ; [[Help:FAQ]]: The least-read page on Wikipedia
1502 !! result
1503 <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
1504 </dd></dl>
1505
1506 !! end
1507
1508 # At Brion's and JeLuF's insistence... :)
1509 !! test
1510 Definition list with news link containing colon
1511 !! input
1512 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1513 !! result
1514 <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!
1515 </dd></dl>
1516
1517 !! end
1518
1519 !! test
1520 Malformed definition list with colon
1521 !! input
1522 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1523 !! result
1524 <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
1525 </dt></dl>
1526
1527 !! end
1528
1529 !! test
1530 Definition lists: colon in external link text
1531 !! input
1532 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1533 !! result
1534 <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
1535 </dd></dl>
1536
1537 !! end
1538
1539 !! test
1540 Definition lists: colon in HTML attribute
1541 !! input
1542 ;<b style="display: inline">bold</b>
1543 !! result
1544 <dl><dt><b style="display: inline">bold</b>
1545 </dt></dl>
1546
1547 !! end
1548
1549 !! test
1550 Definition lists: self-closed tag
1551 !! input
1552 ;one<br/>two : two-line fun
1553 !! result
1554 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1555 </dd></dl>
1556
1557 !! end
1558
1559 !! test
1560 Bug 11748: Literal closing tags
1561 !! input
1562 <dl>
1563 <dt>test 1</dt>
1564 <dd>test test test test test</dd>
1565 <dt>test 2</dt>
1566 <dd>test test test test test</dd>
1567 </dl>
1568 !! result
1569 <dl>
1570 <dt>test 1</dt>
1571 <dd>test test test test test</dd>
1572 <dt>test 2</dt>
1573 <dd>test test test test test</dd>
1574 </dl>
1575
1576 !! end
1577
1578 !! test
1579 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1580 !! input
1581 <ul><li>
1582 ; term : description
1583 * unordered
1584 </li>
1585 </ul>
1586 !! result
1587 <ul><li>
1588 <dl><dt> term&#160;</dt><dd> description
1589 </dd></dl>
1590 <ul><li> unordered
1591 </li></ul>
1592 </li>
1593 </ul>
1594
1595 !! end
1596
1597 !! test
1598
1599 Definition list with empty definition and following paragraph
1600 !! input
1601 ; term:
1602 Paragraph text
1603 !! result
1604 <dl><dt> term</dt><dd>
1605 </dd></dl>
1606 <p>Paragraph text
1607 </p>
1608 !! end
1609
1610 !! test
1611 Nested definition lists using html syntax
1612 !! input
1613 <dl><dd>
1614 <dl>
1615 <dd>Foo</dd>
1616 </dl>
1617 </dd></dl>
1618 !! result
1619 <dl><dd>
1620 <dl>
1621 <dd>Foo</dd>
1622 </dl>
1623 </dd></dl>
1624
1625 !! end
1626
1627 !! test
1628 Definition Lists: No nesting: Multiple dd's
1629 !! input
1630 ;x
1631 :a
1632 :b
1633 !! result
1634 <dl><dt>x
1635 </dt><dd>a
1636 </dd><dd>b
1637 </dd></dl>
1638
1639 !! end
1640
1641 !! test
1642 Definition Lists: Indentation: Regular
1643 !! input
1644 :i1
1645 ::i2
1646 :::i3
1647 !! result
1648 <dl><dd>i1
1649 <dl><dd>i2
1650 <dl><dd>i3
1651 </dd></dl>
1652 </dd></dl>
1653 </dd></dl>
1654
1655 !! end
1656
1657 !! test
1658 Definition Lists: Indentation: Missing 1st level
1659 !! input
1660 ::i2
1661 :::i3
1662 !! result
1663 <dl><dd><dl><dd>i2
1664 <dl><dd>i3
1665 </dd></dl>
1666 </dd></dl>
1667 </dd></dl>
1668
1669 !! end
1670
1671 !! test
1672 Definition Lists: Indentation: Multi-level indent
1673 !! input
1674 :::i3
1675 !! result
1676 <dl><dd><dl><dd><dl><dd>i3
1677 </dd></dl>
1678 </dd></dl>
1679 </dd></dl>
1680
1681 !! end
1682
1683 !! test
1684 Definition Lists: Hacky use to indent tables
1685 !! input
1686 ::{|
1687 |foo
1688 |bar
1689 |}
1690 this text
1691 should be left alone
1692 !! result
1693 <dl><dd><dl><dd><table>
1694 <tr>
1695 <td>foo
1696 </td>
1697 <td>bar
1698 </td></tr></table></dd></dl></dd></dl>
1699 <p>this text
1700 should be left alone
1701 </p>
1702 !! end
1703 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1704 ## as an empty dt item. It also ignores all but the last ";" when followed
1705 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1706 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1707 ## ";"s.
1708 ##
1709 ## Ex: ";;t2 ::d2" is transformed into:
1710 ##
1711 ## <dl>
1712 ## <dt>t2 </dt>
1713 ## <dd>
1714 ## <dl>
1715 ## <dt></dt>
1716 ## <dd>d2</dd>
1717 ## </dl>
1718 ## </dd>
1719 ## </dl>
1720 ##
1721 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1722 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1723 ##
1724 ## <dl>
1725 ## <dt>
1726 ## <dl>
1727 ## <dt>t2 </dt>
1728 ## <dd>:d2</dd>
1729 ## </dl>
1730 ## </dt>
1731 ## </dl>
1732 ##
1733 ## All Parsoid only definition list tests have this difference.
1734 ##
1735 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1736 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1737
1738 !! test
1739 Table / list interaction: indented table with lists in table contents
1740 !! input
1741 :{|
1742 |-
1743 | a
1744 * b
1745 |-
1746 | c
1747 * d
1748 |}
1749 !! result
1750 <dl><dd><table>
1751
1752 <tr>
1753 <td> a
1754 <ul><li> b
1755 </li></ul>
1756 </td></tr>
1757 <tr>
1758 <td> c
1759 <ul><li> d
1760 </li></ul>
1761 </td></tr></table></dd></dl>
1762
1763 !! end
1764
1765 !!test
1766 Table / list interaction: lists nested in tables nested in indented lists
1767 !!input
1768 :{|
1769 |
1770 :a
1771 :b
1772 |
1773 *c
1774 *d
1775 |}
1776
1777 *e
1778 *f
1779 !!result
1780 <dl><dd><table>
1781 <tr>
1782 <td>
1783 <dl><dd>a
1784 </dd><dd>b
1785 </dd></dl>
1786 </td>
1787 <td>
1788 <ul><li>c
1789 </li><li>d
1790 </li></ul>
1791 </td></tr></table></dd></dl>
1792 <ul><li>e
1793 </li><li>f
1794 </li></ul>
1795
1796 !!end
1797
1798 !! test
1799 Definition Lists: Nesting: Multi-level (Parsoid only)
1800 !! options
1801 disabled
1802 !! input
1803 ;t1 :d1
1804 ;;t2 ::d2
1805 ;;;t3 :::d3
1806 !! result
1807 <dl>
1808 <dt>t1 </dt>
1809 <dd>d1</dd>
1810 <dt>
1811 <dl>
1812 <dt>t2 </dt>
1813 <dd>:d2</dd>
1814 <dt>
1815 <dl>
1816 <dt>t3 </dt>
1817 <dd>::d3</dd>
1818 </dl>
1819 </dt>
1820 </dl>
1821 </dt>
1822 </dl>
1823
1824
1825 !! end
1826
1827
1828 !! test
1829 Definition Lists: Nesting: Test 2 (Parsoid only)
1830 !! options
1831 disabled
1832 !! input
1833 ;t1
1834 ::d2
1835 !! result
1836 <dl>
1837 <dt>t1</dt>
1838 <dd>
1839 <dl>
1840 <dd>d2</dd>
1841 </dl>
1842 </dd>
1843 </dl>
1844
1845 !! end
1846
1847
1848 !! test
1849 Definition Lists: Nesting: Test 3 (Parsoid only)
1850 !! options
1851 disabled
1852 !! input
1853 :;t1
1854 ::::d2
1855 !! result
1856 <dl>
1857 <dd>
1858 <dl>
1859 <dt>t1</dt>
1860 <dd>
1861 <dl>
1862 <dd>
1863 <dl>
1864 <dd>d2</dd>
1865 </dl>
1866 </dd>
1867 </dl>
1868 </dd>
1869 </dl>
1870 </dd>
1871 </dl>
1872
1873 !! end
1874
1875
1876 !! test
1877 Definition Lists: Nesting: Test 4
1878 !! input
1879 ::;t3
1880 :::d3
1881 !! result
1882 <dl><dd><dl><dd><dl><dt>t3
1883 </dt><dd>d3
1884 </dd></dl>
1885 </dd></dl>
1886 </dd></dl>
1887
1888 !! end
1889
1890
1891 !! test
1892 Definition Lists: Mixed Lists: Test 1
1893 !! input
1894 :;* foo
1895 ::* bar
1896 :; baz
1897 !! result
1898 <dl><dd><dl><dt><ul><li> foo
1899 </li><li> bar
1900 </li></ul>
1901 </dt></dl>
1902 <dl><dt> baz
1903 </dt></dl>
1904 </dd></dl>
1905
1906 !! end
1907
1908
1909 !! test
1910 Definition Lists: Mixed Lists: Test 2
1911 !! input
1912 *: d1
1913 *: d2
1914 !! result
1915 <ul><li><dl><dd> d1
1916 </dd><dd> d2
1917 </dd></dl>
1918 </li></ul>
1919
1920 !! end
1921
1922
1923 !! test
1924 Definition Lists: Mixed Lists: Test 3
1925 !! input
1926 *::: d1
1927 *::: d2
1928 !! result
1929 <ul><li><dl><dd><dl><dd><dl><dd> d1
1930 </dd><dd> d2
1931 </dd></dl>
1932 </dd></dl>
1933 </dd></dl>
1934 </li></ul>
1935
1936 !! end
1937
1938
1939 !! test
1940 Definition Lists: Mixed Lists: Test 4
1941 !! input
1942 *;d1 :d2
1943 *;d3 :d4
1944 !! result
1945 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1946 </dd><dt>d3&#160;</dt><dd>d4
1947 </dd></dl>
1948 </li></ul>
1949
1950 !! end
1951
1952
1953 !! test
1954 Definition Lists: Mixed Lists: Test 5
1955 !! input
1956 *:d1
1957 *:: d2
1958 !! result
1959 <ul><li><dl><dd>d1
1960 <dl><dd> d2
1961 </dd></dl>
1962 </dd></dl>
1963 </li></ul>
1964
1965 !! end
1966
1967
1968 !! test
1969 Definition Lists: Mixed Lists: Test 6
1970 !! input
1971 #*:d1
1972 #*::: d3
1973 !! result
1974 <ol><li><ul><li><dl><dd>d1
1975 <dl><dd><dl><dd> d3
1976 </dd></dl>
1977 </dd></dl>
1978 </dd></dl>
1979 </li></ul>
1980 </li></ol>
1981
1982 !! end
1983
1984
1985 !! test
1986 Definition Lists: Mixed Lists: Test 7
1987 !! input
1988 :* d1
1989 :* d2
1990 !! result
1991 <dl><dd><ul><li> d1
1992 </li><li> d2
1993 </li></ul>
1994 </dd></dl>
1995
1996 !! end
1997
1998
1999 !! test
2000 Definition Lists: Mixed Lists: Test 8
2001 !! input
2002 :* d1
2003 ::* d2
2004 !! result
2005 <dl><dd><ul><li> d1
2006 </li></ul>
2007 <dl><dd><ul><li> d2
2008 </li></ul>
2009 </dd></dl>
2010 </dd></dl>
2011
2012 !! end
2013
2014
2015 !! test
2016 Definition Lists: Mixed Lists: Test 9
2017 !! input
2018 *;foo :bar
2019 !! result
2020 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2021 </dd></dl>
2022 </li></ul>
2023
2024 !! end
2025
2026
2027 !! test
2028 Definition Lists: Mixed Lists: Test 10
2029 !! input
2030 *#;foo :bar
2031 !! result
2032 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2033 </dd></dl>
2034 </li></ol>
2035 </li></ul>
2036
2037 !! end
2038
2039
2040 !! test
2041 Definition Lists: Mixed Lists: Test 11
2042 !! input
2043 *#*#;*;;foo :bar
2044 *#*#;boo :baz
2045 !! result
2046 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2047 </dt></dl>
2048 </dd></dl>
2049 </li></ul>
2050 </dd></dl>
2051 <dl><dt>boo&#160;</dt><dd>baz
2052 </dd></dl>
2053 </li></ol>
2054 </li></ul>
2055 </li></ol>
2056 </li></ul>
2057
2058 !! end
2059
2060
2061 !! test
2062 Definition Lists: Weird Ones: Test 1
2063 !! input
2064 *#;*::;; foo : bar (who uses this?)
2065 !! result
2066 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2067 </dt></dl>
2068 </dd></dl>
2069 </dd></dl>
2070 </dd></dl>
2071 </li></ul>
2072 </dd></dl>
2073 </li></ol>
2074 </li></ul>
2075
2076 !! end
2077
2078 ###
2079 ### External links
2080 ###
2081 !! test
2082 External links: non-bracketed
2083 !! input
2084 Non-bracketed: http://example.com
2085 !! result
2086 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2087 </p>
2088 !! end
2089
2090 !! test
2091 External links: numbered
2092 !! input
2093 Numbered: [http://example.com]
2094 Numbered: [http://example.net]
2095 Numbered: [http://example.com]
2096 !! result
2097 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2098 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2099 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2100 </p>
2101 !!end
2102
2103 !! test
2104 External links: specified text
2105 !! input
2106 Specified text: [http://example.com link]
2107 !! result
2108 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2109 </p>
2110 !!end
2111
2112 !! test
2113 External links: trail
2114 !! input
2115 Linktrails should not work for external links: [http://example.com link]s
2116 !! result
2117 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2118 </p>
2119 !! end
2120
2121 !! test
2122 External links: dollar sign in URL
2123 !! input
2124 http://example.com/1$2345
2125 !! result
2126 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2127 </p>
2128 !! end
2129
2130 !! test
2131 External links: dollar sign in URL (named)
2132 !! input
2133 [http://example.com/1$2345]
2134 !! result
2135 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2136 </p>
2137 !!end
2138
2139 !! test
2140 External links: open square bracket forbidden in URL (bug 4377)
2141 !! input
2142 http://example.com/1[2345
2143 !! result
2144 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2145 </p>
2146 !! end
2147
2148 !! test
2149 External links: open square bracket forbidden in URL (named) (bug 4377)
2150 !! input
2151 [http://example.com/1[2345]
2152 !! result
2153 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2154 </p>
2155 !!end
2156
2157 !! test
2158 External links: nowiki in URL link text (bug 6230)
2159 !!input
2160 [http://example.com/ <nowiki>''example site''</nowiki>]
2161 !! result
2162 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2163 </p>
2164 !! end
2165
2166 !! test
2167 External links: newline forbidden in text (bug 6230 regression check)
2168 !! input
2169 [http://example.com/ first
2170 second]
2171 !! result
2172 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2173 second]
2174 </p>
2175 !!end
2176
2177 !! test
2178 External links: Pipe char between url and text
2179 !! input
2180 [http://example.com | link]
2181 !! result
2182 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2183 </p>
2184 !!end
2185
2186 !! test
2187 External links: protocol-relative URL in brackets
2188 !! input
2189 [//example.com/ Test]
2190 !! result
2191 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2192 </p>
2193 !! end
2194
2195 !! test
2196 External links: protocol-relative URL in brackets without text
2197 !! input
2198 [//example.com]
2199 !! result
2200 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2201 </p>
2202 !! end
2203
2204 !! test
2205 External links: protocol-relative URL in free text is left alone
2206 !! input
2207 //example.com/Foo
2208 !! result
2209 <p>//example.com/Foo
2210 </p>
2211 !!end
2212
2213 !! test
2214 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2215 !! input
2216 foo//example.com/Foo
2217 !! result
2218 <p>foo//example.com/Foo
2219 </p>
2220 !! end
2221
2222 !! test
2223 External image
2224 !! input
2225 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2226 !! result
2227 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2228 </p>
2229 !! end
2230
2231 !! test
2232 External image from https
2233 !! input
2234 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2235 !! result
2236 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2237 </p>
2238 !! end
2239
2240 !! test
2241 Link to non-http image, no img tag
2242 !! input
2243 Link to non-http image, no img tag: ftp://example.com/test.jpg
2244 !! result
2245 <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>
2246 </p>
2247 !! end
2248
2249 !! test
2250 External links: terminating separator
2251 !! input
2252 Terminating separator: http://example.com/thing,
2253 !! result
2254 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2255 </p>
2256 !! end
2257
2258 !! test
2259 External links: intervening separator
2260 !! input
2261 Intervening separator: http://example.com/1,2,3
2262 !! result
2263 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2264 </p>
2265 !! end
2266
2267 !! test
2268 External links: old bug with URL in query
2269 !! input
2270 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2271 !! result
2272 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2273 </p>
2274 !! end
2275
2276 !! test
2277 External links: old URL-in-URL bug, mixed protocols
2278 !! input
2279 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2280 !! result
2281 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2282 </p>
2283 !!end
2284
2285 !! test
2286 External links: URL in text
2287 !! input
2288 URL in text: [http://example.com http://example.com]
2289 !! result
2290 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2291 </p>
2292 !! end
2293
2294 !! test
2295 External links: Clickable images
2296 !! input
2297 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2298 !! result
2299 <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>
2300 </p>
2301 !!end
2302
2303 !! test
2304 External links: raw ampersand
2305 !! input
2306 Old &amp; use: http://x&y
2307 !! result
2308 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2309 </p>
2310 !! end
2311
2312 !! test
2313 External links: encoded ampersand
2314 !! input
2315 Old &amp; use: http://x&amp;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 equals (bug 6102)
2323 !! input
2324 http://example.com/?foo&#61;bar
2325 !! result
2326 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2327 </p>
2328 !! end
2329
2330 !! test
2331 External links: [raw ampersand]
2332 !! input
2333 Old &amp; use: [http://x&y]
2334 !! result
2335 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2336 </p>
2337 !! end
2338
2339 !! test
2340 External links: [encoded ampersand]
2341 !! input
2342 Old &amp; use: [http://x&amp;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 equals] (bug 6102)
2350 !! input
2351 [http://example.com/?foo&#61;bar]
2352 !! result
2353 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2354 </p>
2355 !! end
2356
2357 !! test
2358 External links: [IDN ignored character reference in hostname; strip it right off]
2359 !! input
2360 [http://e&zwnj;xample.com/]
2361 !! result
2362 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2363 </p>
2364 !! end
2365
2366 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2367 # Where an external link could easily circumvent the sanitization of the text of
2368 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2369 # test demands a higher standard. That's a bit strange.
2370 #
2371 # Example:
2372 #
2373 # http://e‌xample.com -> [http://example.com|http://example.com]
2374 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2375 #
2376 # The first example is sanitized, but the second is not. Any security benefits
2377 # from this production are trivial to circumvent. Either remove this test and
2378 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2379 # the test accordingly.
2380 #
2381 # All our love,
2382 # The Parsoid team.
2383 !! test
2384 External links: IDN ignored character reference in hostname; strip it right off
2385 !! input
2386 http://e&zwnj;xample.com/
2387 !! result
2388 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2389 </p>
2390 !! end
2391
2392 !! test
2393 External links: www.jpeg.org (bug 554)
2394 !! input
2395 http://www.jpeg.org
2396 !!result
2397 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2398 </p>
2399 !! end
2400
2401 !! test
2402 External links: URL within URL (original bug 2)
2403 !! input
2404 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2405 !! result
2406 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2407 </p>
2408 !! end
2409
2410 !! test
2411 BUG 361: URL inside bracketed URL
2412 !! input
2413 [http://www.example.com/foo http://www.example.com/bar]
2414 !! result
2415 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2416 </p>
2417 !! end
2418
2419 !! test
2420 BUG 361: URL within URL, not bracketed
2421 !! input
2422 http://www.example.com/foo?=http://www.example.com/bar
2423 !! result
2424 <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>
2425 </p>
2426 !! end
2427
2428 !! test
2429 BUG 289: ">"-token in URL-tail
2430 !! input
2431 http://www.example.com/<hello>
2432 !! result
2433 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2434 </p>
2435 !!end
2436
2437 !! test
2438 BUG 289: literal ">"-token in URL-tail
2439 !! input
2440 http://www.example.com/<b>html</b>
2441 !! result
2442 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2443 </p>
2444 !!end
2445
2446 !! test
2447 BUG 289: ">"-token in bracketed URL
2448 !! input
2449 [http://www.example.com/<hello> stuff]
2450 !! result
2451 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2452 </p>
2453 !!end
2454
2455 !! test
2456 BUG 289: literal ">"-token in bracketed URL
2457 !! input
2458 [http://www.example.com/<b>html</b> stuff]
2459 !! result
2460 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2461 </p>
2462 !!end
2463
2464 !! test
2465 BUG 289: literal double quote at end of URL
2466 !! input
2467 http://www.example.com/"hello"
2468 !! result
2469 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2470 </p>
2471 !!end
2472
2473 !! test
2474 BUG 289: literal double quote in bracketed URL
2475 !! input
2476 [http://www.example.com/"hello" stuff]
2477 !! result
2478 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2479 </p>
2480 !!end
2481
2482 !! test
2483 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2484 !! input
2485 [http://www.example.com test]
2486 !! result
2487 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2488 </p>
2489 !! end
2490
2491 !! test
2492 External links: wiki links within external link (Bug 3695)
2493 !! input
2494 [http://example.com [[wikilink]] embedded in ext link]
2495 !! result
2496 <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>
2497 </p>
2498 !! end
2499
2500 !! test
2501 BUG 787: Links with one slash after the url protocol are invalid
2502 !! input
2503 http:/example.com
2504
2505 [http:/example.com title]
2506 !! result
2507 <p>http:/example.com
2508 </p><p>[http:/example.com title]
2509 </p>
2510 !! end
2511
2512 !! test
2513 Bracketed external links with template-generated invalid target
2514 !! input
2515 [{{echo|http:/example.com}} title]
2516 !! result
2517 <p>[http:/example.com title]
2518 </p>
2519 !! end
2520
2521 !! test
2522 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2523 !! input
2524 ''[http://example.com text'']
2525 [http://example.com '''text]'''
2526 ''Something [http://example.com in italic'']
2527 ''Something [http://example.com mixed''''', even bold]'''
2528 '''''Now [http://example.com both''''']
2529 !! result
2530 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2531 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2532 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2533 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2534 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2535 </p>
2536 !! end
2537
2538
2539 !! test
2540 Bug 4781: %26 in URL
2541 !! input
2542 http://www.example.com/?title=AT%26T
2543 !! result
2544 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2545 </p>
2546 !! end
2547
2548 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2549 # % is actually legal in HTML5. Any change in output would need testing though.
2550 !! test
2551 Bug 4781, 5267: %25 in URL
2552 !! input
2553 http://www.example.com/?title=100%25_Bran
2554 !! result
2555 <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>
2556 </p>
2557 !! end
2558
2559 !! test
2560 Bug 4781, 5267: %28, %29 in URL
2561 !! input
2562 http://www.example.com/?title=Ben-Hur_%281959_film%29
2563 !! result
2564 <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>
2565 </p>
2566 !! end
2567
2568
2569 !! test
2570 Bug 4781: %26 in autonumber URL
2571 !! input
2572 [http://www.example.com/?title=AT%26T]
2573 !! result
2574 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2575 </p>
2576 !! end
2577
2578 !! test
2579 Bug 4781, 5267: %26 in autonumber URL
2580 !! input
2581 [http://www.example.com/?title=100%25_Bran]
2582 !! result
2583 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2584 </p>
2585 !! end
2586
2587 !! test
2588 Bug 4781, 5267: %28, %29 in autonumber URL
2589 !! input
2590 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2591 !! result
2592 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2593 </p>
2594 !! end
2595
2596
2597 !! test
2598 Bug 4781: %26 in bracketed URL
2599 !! input
2600 [http://www.example.com/?title=AT%26T link]
2601 !! result
2602 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2603 </p>
2604 !! end
2605
2606 !! test
2607 Bug 4781, 5267: %26 in bracketed URL
2608 !! input
2609 [http://www.example.com/?title=100%25_Bran link]
2610 !! result
2611 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2612 </p>
2613 !! end
2614
2615 !! test
2616 Bug 4781, 5267: %28, %29 in bracketed URL
2617 !! input
2618 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2619 !! result
2620 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2621 </p>
2622 !! end
2623
2624 !! test
2625 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2626 !! input
2627 Some [http://example.com/ pretty ''italics'' and stuff]!
2628 !! result
2629 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2630 </p>
2631 !! end
2632
2633 !! test
2634 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2635 !! input
2636 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2637 !! result
2638 <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>
2639 </p>
2640 !! end
2641
2642 !! test
2643 External link containing double-single-quotes with no space separating the url from text in italics
2644 !! input
2645 [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]].]
2646 !! result
2647 <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>
2648 </p>
2649 !! end
2650
2651 !!test
2652 Text in square brackets that is not a link should parse as text
2653 !!input
2654 [foo]
2655 [{{echo|foo}}]
2656 [url={{echo|foo}}]
2657 [url=http://example.com]
2658 !!result
2659 <p>[foo]
2660 [foo]
2661 [url=foo]
2662 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
2663 </p>
2664 !!end
2665
2666 !! test
2667 URL-encoding in URL functions (single parameter)
2668 !! input
2669 {{localurl:Some page|amp=&}}
2670 !! result
2671 <p>/index.php?title=Some_page&amp;amp=&amp;
2672 </p>
2673 !! end
2674
2675 !! test
2676 URL-encoding in URL functions (multiple parameters)
2677 !! input
2678 {{localurl:Some page|q=?&amp=&}}
2679 !! result
2680 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2681 </p>
2682 !! end
2683
2684 !! test
2685 Brackets in urls
2686 !! input
2687 http://example.com/index.php?foozoid%5B%5D=bar
2688
2689 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2690 !! result
2691 <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>
2692 </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>
2693 </p>
2694 !! end
2695
2696 !! test
2697 IPv6 urls (bug 21261)
2698 !! options
2699 disabled
2700 !! input
2701 http://[2404:130:0:1000::187:2]/index.php
2702 !! result
2703 <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>
2704 </p>
2705 !! end
2706
2707 !! test
2708 Non-extlinks in brackets
2709 !! input
2710 [foo]
2711 [foo bar]
2712 [foo ''bar'']
2713 [fool's] errand
2714 [fool's errand]
2715 [{{echo|foo}}]
2716 [{{echo|foo}} bar]
2717 [{{echo|foo}} ''bar'']
2718 [{{echo|foo}}l's] errand
2719 [{{echo|foo}}l's errand]
2720 !! result
2721 <p>[foo]
2722 [foo bar]
2723 [foo <i>bar</i>]
2724 [fool's] errand
2725 [fool's errand]
2726 [foo]
2727 [foo bar]
2728 [foo <i>bar</i>]
2729 [fool's] errand
2730 [fool's errand]
2731 </p>
2732 !! end
2733
2734 ###
2735 ### Quotes
2736 ###
2737
2738 !! test
2739 Quotes
2740 !! input
2741 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2742
2743 Normal text. '''''Bold italic text.''''' Normal text.
2744 !!result
2745 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2746 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2747 </p>
2748 !! end
2749
2750
2751 !! test
2752 Unclosed and unmatched quotes
2753 !! input
2754 '''''Bold italic text '''with bold deactivated''' in between.'''''
2755
2756 '''''Bold italic text ''with italic deactivated'' in between.'''''
2757
2758 '''Bold text..
2759
2760 ..spanning two paragraphs (should not work).'''
2761
2762 '''Bold tag left open
2763
2764 ''Italic tag left open
2765
2766 Normal text.
2767
2768 <!-- Unmatching number of opening, closing tags: -->
2769 '''This year''''s election ''should'' beat '''last year''''s.
2770
2771 ''Tom'''s car is bigger than ''Susan'''s.
2772
2773 Plain ''italic'''s plain
2774 !! result
2775 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2776 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2777 </p><p><b>Bold text..</b>
2778 </p><p>..spanning two paragraphs (should not work).
2779 </p><p><b>Bold tag left open</b>
2780 </p><p><i>Italic tag left open</i>
2781 </p><p>Normal text.
2782 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2783 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2784 </p><p>Plain <i>italic'</i>s plain
2785 </p>
2786 !! end
2787
2788 ###
2789 ### Tables
2790 ###
2791 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2792 ###
2793
2794 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2795 # is the bare minimun required by the spec, see:
2796 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2797 !! test
2798 A table with no data.
2799 !! input
2800 {||}
2801 !! result
2802 !! end
2803
2804 # A table with nothing but a caption is invalid XHTML, we might want to render
2805 # this as <p>caption</p>
2806 !! test
2807 A table with nothing but a caption
2808 !! input
2809 {|
2810 |+ caption
2811 |}
2812 !! result
2813 <table>
2814 <caption> caption
2815 </caption><tr><td></td></tr></table>
2816
2817 !! end
2818
2819 !! test
2820 A table with caption with default-spaced attributes and a table row
2821 !! input
2822 {|
2823 |+ style="color: red;" | caption1
2824 |-
2825 | foo
2826 |}
2827 !! result
2828 <table>
2829 <caption style="color: red;"> caption1
2830 </caption>
2831 <tr>
2832 <td> foo
2833 </td></tr></table>
2834
2835 !! end
2836
2837 !! test
2838 A table with captions with non-default spaced attributes and a table row
2839 !! input
2840 {|
2841 |+style="color: red;"|caption2
2842 |+ style="color: red;"| caption3
2843 |-
2844 | foo
2845 |}
2846 !! result
2847 <table>
2848 <caption style="color: red;">caption2
2849 </caption>
2850 <caption style="color: red;"> caption3
2851 </caption>
2852 <tr>
2853 <td> foo
2854 </td></tr></table>
2855
2856 !! end
2857
2858 !! test
2859 Table td-cell syntax variations
2860 !! input
2861 {|
2862 | foo bar foo | baz
2863 | foo bar foo || baz
2864 | style='color:red;' | baz
2865 | style='color:red;' || baz
2866 |}
2867 !! result
2868 <table>
2869 <tr>
2870 <td> baz
2871 </td>
2872 <td> foo bar foo </td>
2873 <td> baz
2874 </td>
2875 <td style="color:red;"> baz
2876 </td>
2877 <td> style='color:red;' </td>
2878 <td> baz
2879 </td></tr></table>
2880
2881 !! end
2882
2883 !! test
2884 Simple table
2885 !! input
2886 {|
2887 | 1 || 2
2888 |-
2889 | 3 || 4
2890 |}
2891 !! result
2892 <table>
2893 <tr>
2894 <td> 1 </td>
2895 <td> 2
2896 </td></tr>
2897 <tr>
2898 <td> 3 </td>
2899 <td> 4
2900 </td></tr></table>
2901
2902 !! end
2903
2904 !! test
2905 Simple table but with multiple dashes for row wikitext
2906 !! input
2907 {|
2908 | foo
2909 |-----
2910 | bar
2911 |}
2912 !! result
2913 <table>
2914 <tr>
2915 <td> foo
2916 </td></tr>
2917 <tr>
2918 <td> bar
2919 </td></tr></table>
2920
2921 !! end
2922 !! test
2923 Multiplication table
2924 !! input
2925 {| border="1" cellpadding="2"
2926 |+Multiplication table
2927 |-
2928 ! &times; !! 1 !! 2 !! 3
2929 |-
2930 ! 1
2931 | 1 || 2 || 3
2932 |-
2933 ! 2
2934 | 2 || 4 || 6
2935 |-
2936 ! 3
2937 | 3 || 6 || 9
2938 |-
2939 ! 4
2940 | 4 || 8 || 12
2941 |-
2942 ! 5
2943 | 5 || 10 || 15
2944 |}
2945 !! result
2946 <table border="1" cellpadding="2">
2947 <caption>Multiplication table
2948 </caption>
2949 <tr>
2950 <th> &#215; </th>
2951 <th> 1 </th>
2952 <th> 2 </th>
2953 <th> 3
2954 </th></tr>
2955 <tr>
2956 <th> 1
2957 </th>
2958 <td> 1 </td>
2959 <td> 2 </td>
2960 <td> 3
2961 </td></tr>
2962 <tr>
2963 <th> 2
2964 </th>
2965 <td> 2 </td>
2966 <td> 4 </td>
2967 <td> 6
2968 </td></tr>
2969 <tr>
2970 <th> 3
2971 </th>
2972 <td> 3 </td>
2973 <td> 6 </td>
2974 <td> 9
2975 </td></tr>
2976 <tr>
2977 <th> 4
2978 </th>
2979 <td> 4 </td>
2980 <td> 8 </td>
2981 <td> 12
2982 </td></tr>
2983 <tr>
2984 <th> 5
2985 </th>
2986 <td> 5 </td>
2987 <td> 10 </td>
2988 <td> 15
2989 </td></tr></table>
2990
2991 !! end
2992
2993 !! test
2994 Accept "||" in table headings
2995 !! input
2996 {|
2997 !h1 || h2
2998 |}
2999 !! result
3000 <table>
3001 <tr>
3002 <th>h1 </th>
3003 <th> h2
3004 </th></tr></table>
3005
3006 !! end
3007
3008 !! test
3009 Accept "||" in indented table headings
3010 !! input
3011 :{|
3012 !h1 || h2
3013 |}
3014 !! result
3015 <dl><dd><table>
3016 <tr>
3017 <th>h1 </th>
3018 <th> h2
3019 </th></tr></table></dd></dl>
3020
3021 !! end
3022
3023 !! test
3024 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3025 !! input
3026 {|
3027 !| h1
3028 || a
3029 |}
3030 !! result
3031 <table>
3032 <tr>
3033 <th> h1
3034 </th>
3035 <td> a
3036 </td></tr></table>
3037
3038 !! end
3039
3040 !!test
3041 Accept "| !" at start of line in tables (ignore !-attribute)
3042 !!input
3043 {|
3044 |-
3045 | !style="color:red" | bar
3046 |}
3047 !!result
3048 <table>
3049
3050 <tr>
3051 <td> bar
3052 </td></tr></table>
3053
3054 !!end
3055
3056 !!test
3057 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 +/-
3058 !!input
3059 {|
3060 |-
3061 |style='color:red;'|+1
3062 |style='color:blue;'|-1
3063 |-
3064 | 1 || 2 || 3
3065 | 1 ||+2 ||-3
3066 |-
3067 | +1
3068 | -1
3069 |}
3070 !!result
3071 <table>
3072
3073 <tr>
3074 <td style="color:red;">+1
3075 </td>
3076 <td style="color:blue;">-1
3077 </td></tr>
3078 <tr>
3079 <td> 1 </td>
3080 <td> 2 </td>
3081 <td> 3
3082 </td>
3083 <td> 1 </td>
3084 <td>+2 </td>
3085 <td>-3
3086 </td></tr>
3087 <tr>
3088 <td> +1
3089 </td>
3090 <td> -1
3091 </td></tr></table>
3092
3093 !!end
3094
3095 !! test
3096 Table rowspan
3097 !! input
3098 {| border=1
3099 | Cell 1, row 1
3100 |rowspan=2| Cell 2, row 1 (and 2)
3101 | Cell 3, row 1
3102 |-
3103 | Cell 1, row 2
3104 | Cell 3, row 2
3105 |}
3106 !! result
3107 <table border="1">
3108 <tr>
3109 <td> Cell 1, row 1
3110 </td>
3111 <td rowspan="2"> Cell 2, row 1 (and 2)
3112 </td>
3113 <td> Cell 3, row 1
3114 </td></tr>
3115 <tr>
3116 <td> Cell 1, row 2
3117 </td>
3118 <td> Cell 3, row 2
3119 </td></tr></table>
3120
3121 !! end
3122
3123 !! test
3124 Nested table
3125 !! input
3126 {| border=1
3127 | &alpha;
3128 |
3129 {| bgcolor=#ABCDEF border=2
3130 |nested
3131 |-
3132 |table
3133 |}
3134 |the original table again
3135 |}
3136 !! result
3137 <table border="1">
3138 <tr>
3139 <td> &#945;
3140 </td>
3141 <td>
3142 <table bgcolor="#ABCDEF" border="2">
3143 <tr>
3144 <td>nested
3145 </td></tr>
3146 <tr>
3147 <td>table
3148 </td></tr></table>
3149 </td>
3150 <td>the original table again
3151 </td></tr></table>
3152
3153 !! end
3154
3155 !! test
3156 Invalid attributes in table cell (bug 1830)
3157 !! input
3158 {|
3159 |Cell:|broken
3160 |}
3161 !! result
3162 <table>
3163 <tr>
3164 <td>broken
3165 </td></tr></table>
3166
3167 !! end
3168
3169
3170 !! test
3171 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3172 !! input
3173 {|
3174 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3175 !! result
3176 <table>
3177 <tr>
3178 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3179 <td>]" onmouseover="alert(document.cookie)"&gt;test
3180 </td>
3181 </tr>
3182 </table>
3183
3184 !! end
3185
3186
3187 !! test
3188 Indented table markup mixed with indented pre content (proposed in bug 6200)
3189 !! input
3190 <table>
3191 <tr>
3192 <td>
3193 Text that should be rendered preformatted
3194 </td>
3195 </tr>
3196 </table>
3197 !! result
3198 <table>
3199 <tr>
3200 <td>
3201 <pre>Text that should be rendered preformatted
3202 </pre>
3203 </td>
3204 </tr>
3205 </table>
3206
3207 !! end
3208
3209 !! test
3210 Template-generated table cell attributes and cell content
3211 !! input
3212 {|
3213 |{{table_attribs}}
3214 |}
3215 !! result
3216 <table>
3217 <tr>
3218 <td style="color: red"> Foo
3219 </td></tr></table>
3220
3221 !! end
3222
3223 !! test
3224 Table with row followed by newlines and table heading
3225 !! input
3226 {|
3227 |-
3228
3229 ! foo
3230 |}
3231 !! result
3232 <table>
3233
3234
3235 <tr>
3236 <th> foo
3237 </th></tr></table>
3238
3239 !! end
3240
3241 # FIXME: Preserve the attribute properly (with an empty string as value) in
3242 # the PHP parser. Parsoid implements the behavior below.
3243 !! test
3244 Table attributes with empty value
3245 !! options
3246 disabled
3247 !! input
3248 {|
3249 | style=| hello
3250 |}
3251 !! result
3252 <table>
3253 <tr>
3254 <td style=""> hello
3255 </td></tr></table>
3256
3257 !! end
3258
3259 !! test
3260 Wikitext table with a lot of comments
3261 !! input
3262 {|
3263 <!-- c0 -->
3264 | foo
3265 <!-- c1 -->
3266 |- <!-- c2 -->
3267 <!-- c3 -->
3268 |<!-- c4 -->
3269 <!-- c5 -->
3270 |}
3271 !! result
3272 <table>
3273 <tr>
3274 <td> foo
3275 </td></tr>
3276 <tr>
3277 <td>
3278 </td></tr></table>
3279
3280 !! end
3281
3282 ###
3283 ### Internal links
3284 ###
3285 !! test
3286 Plain link, capitalized
3287 !! input
3288 [[Main Page]]
3289 !! result
3290 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3291 </p>
3292 !! end
3293
3294 !! test
3295 Plain link, uncapitalized
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 Piped link
3305 !! input
3306 [[Main Page|The Main Page]]
3307 !! result
3308 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3309 </p>
3310 !! end
3311
3312 !! test
3313 Broken link
3314 !! input
3315 [[Zigzagzogzagzig]]
3316 !! result
3317 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3318 </p>
3319 !! end
3320
3321 !! test
3322 Broken link with fragment
3323 !! input
3324 [[Zigzagzogzagzig#zug]]
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#zug</a>
3327 </p>
3328 !! end
3329
3330 !! test
3331 Special page link with fragment
3332 !! input
3333 [[Special:Version#anchor]]
3334 !! result
3335 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3336 </p>
3337 !! end
3338
3339 !! test
3340 Nonexistent special page link with fragment
3341 !! input
3342 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3343 !! result
3344 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3345 </p>
3346 !! end
3347
3348 !! test
3349 Link with prefix
3350 !! input
3351 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3352 !! result
3353 <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>
3354 </p>
3355 !! end
3356
3357 !! test
3358 Link with suffix
3359 !! input
3360 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3361 !! result
3362 <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>!!!
3363 </p>
3364 !! end
3365
3366 !! article
3367 prefixed article
3368 !! text
3369 Some text
3370 !! endarticle
3371
3372 !! test
3373 Bug 43661: Piped links with identical prefixes
3374 !! input
3375 [[prefixed article|prefixed articles with spaces]]
3376
3377 [[prefixed article|prefixed articlesaoeu]]
3378
3379 [[Main Page|Main Page test]]
3380 !! result
3381 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3382 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3383 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3384 </p>
3385 !! end
3386
3387
3388 !! test
3389 Link with HTML entity in suffix / tail
3390 !! input
3391 [[Main Page]]&quot;, [[Main Page]]&#97;
3392 !! result
3393 <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;
3394 </p>
3395 !! end
3396
3397 !! test
3398 Link with 3 brackets
3399 !! input
3400 [[[main page]]]
3401 !! result
3402 <p>[[[main page]]]
3403 </p>
3404 !! end
3405
3406 !! test
3407 Piped link with 3 brackets
3408 !! input
3409 [[[main page|the main page]]]
3410 !! result
3411 <p>[[[main page|the main page]]]
3412 </p>
3413 !! end
3414
3415 !! test
3416 Link with multiple pipes
3417 !! input
3418 [[Main Page|The|Main|Page]]
3419 !! result
3420 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3421 </p>
3422 !! end
3423
3424 !! test
3425 Link to namespaces
3426 !! input
3427 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3428 !! result
3429 <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>
3430 </p>
3431 !! end
3432
3433 !! test
3434 Piped link to namespace
3435 !! input
3436 [[Meta:Disclaimers|The disclaimers]]
3437 !! result
3438 <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>
3439 </p>
3440 !! end
3441
3442 !! test
3443 Link containing }
3444 !! input
3445 [[Usually caused by a typo (oops}]]
3446 !! result
3447 <p>[[Usually caused by a typo (oops}]]
3448 </p>
3449 !! end
3450
3451 !! test
3452 Link containing % (not as a hex sequence)
3453 !! input
3454 [[7% Solution]]
3455 !! result
3456 <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>
3457 </p>
3458 !! end
3459
3460 !! test
3461 Link containing % as a single hex sequence interpreted to char
3462 !! input
3463 [[7%25 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 double hex sequence interpreted to hex sequence
3471 !! input
3472 [[7%2525 Solution]]
3473 !! result
3474 <p>[[7%2525 Solution]]
3475 </p>
3476 !!end
3477
3478 !! test
3479 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3480 Example for such a section: == < ==
3481 !! input
3482 [[%23%3c]][[%23%3e]]
3483 !! result
3484 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3485 </p>
3486 !! end
3487
3488 !! test
3489 Link containing "<#" and ">#" as a hex sequences
3490 !! input
3491 [[%3c%23]][[%3e%23]]
3492 !! result
3493 <p>[[%3c%23]][[%3e%23]]
3494 </p>
3495 !! end
3496
3497 !! test
3498 Link containing double-single-quotes '' (bug 4598)
3499 !! input
3500 [[Lista d''e paise d''o munno]]
3501 !! result
3502 <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>
3503 </p>
3504 !! end
3505
3506 !! test
3507 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3508 !! input
3509 Some [[Link|pretty ''italics'' and stuff]]!
3510 !! result
3511 <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>!
3512 </p>
3513 !! end
3514
3515 !! test
3516 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3517 !! input
3518 ''Some [[Link|pretty ''italics'' and stuff]]!
3519 !! result
3520 <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>
3521 </p>
3522 !! end
3523
3524 !! test
3525 Link with double quotes in title part (literal) and alternate part (interpreted)
3526 !! input
3527 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3528
3529 [[''Pentecoste'']]
3530
3531 [[''Pentecoste''|Pentecoste]]
3532
3533 [[''Pentecoste''|''Pentecoste'']]
3534 !! result
3535 <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>
3536 </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>
3537 </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>
3538 </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>
3539 </p>
3540 !! end
3541
3542 !! test
3543 Broken image links with HTML captions (bug 39700)
3544 !! input
3545 [[File:Nonexistent|<script></script>]]
3546 [[File:Nonexistent|100px|<script></script>]]
3547 [[File:Nonexistent|&lt;]]
3548 [[File:Nonexistent|a<i>b</i>c]]
3549 !! result
3550 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3551 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3552 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3553 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3554 </p>
3555 !! end
3556
3557 !! test
3558 Plain link to URL
3559 !! input
3560 [[http://www.example.com]]
3561 !! result
3562 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3563 </p>
3564 !! end
3565
3566 !! test
3567 Plain link to URL with link text
3568 !! input
3569 [[http://www.example.com Link text]]
3570 !! result
3571 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3572 </p>
3573 !! end
3574
3575 !! test
3576 Plain link to protocol-relative URL
3577 !! input
3578 [[//www.example.com]]
3579 !! result
3580 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3581 </p>
3582 !! end
3583
3584 !! test
3585 Plain link to protocol-relative URL with link text
3586 !! input
3587 [[//www.example.com Link text]]
3588 !! result
3589 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3590 </p>
3591 !! end
3592
3593 !! test
3594 Plain link to page with question mark in title
3595 !! input
3596 [[A?b]]
3597
3598 [[A?b|Baz]]
3599 !! result
3600 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3601 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3602 </p>
3603 !! end
3604
3605
3606 # I'm fairly sure the expected result here is wrong.
3607 # We want these to be URL links, not pseudo-pages with URLs for titles....
3608 # However the current output is also pretty screwy.
3609 #
3610 # ----
3611 # I'm changing it to match the current output--it arguably makes more
3612 # sense in the light of the test above. Old expected result was:
3613 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3614 #</p>
3615 # But I think this test is bordering on "garbage in, garbage out" anyway.
3616 # -- wtm
3617 !! test
3618 Piped link to URL
3619 !! input
3620 Piped link to URL: [[http://www.example.com|an example URL]]
3621 !! result
3622 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3623 </p>
3624 !! end
3625
3626 !! test
3627 BUG 2: [[page|http://url/]] should link to page, not http://url/
3628 !! input
3629 [[Main Page|http://url/]]
3630 !! result
3631 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3632 </p>
3633 !! end
3634
3635 !! test
3636 BUG 337: Escaped self-links should be bold
3637 !! options
3638 title=[[Bug462]]
3639 !! input
3640 [[Bu&#103;462]] [[Bug462]]
3641 !! result
3642 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3643 </p>
3644 !! end
3645
3646 !! test
3647 Self-link to section should not be bold
3648 !! options
3649 title=[[Main Page]]
3650 !! input
3651 [[Main Page#section]]
3652 !! result
3653 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3654 </p>
3655 !! end
3656
3657 !! article
3658 00
3659 !! text
3660 This is 00.
3661 !! endarticle
3662
3663 !!test
3664 Self-link to numeric title
3665 !!options
3666 title=[[0]]
3667 !!input
3668 [[0]]
3669 !!result
3670 <p><strong class="selflink">0</strong>
3671 </p>
3672 !!end
3673
3674 !!test
3675 Link to numeric-equivalent title
3676 !!options
3677 title=[[0]]
3678 !!input
3679 [[00]]
3680 !!result
3681 <p><a href="/wiki/00" title="00">00</a>
3682 </p>
3683 !!end
3684
3685 !! test
3686 <nowiki> inside a link
3687 !! input
3688 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3689 !! result
3690 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3691 </p>
3692 !! end
3693
3694 !! test
3695 Non-breaking spaces in title
3696 !! input
3697 [[&nbsp; Main &nbsp; Page &nbsp;]]
3698 !! result
3699 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3700 </p>
3701 !!end
3702
3703 !! test
3704 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3705 !! options
3706 language=ca
3707 !! input
3708 '''[[Main Page]]'''
3709 !! result
3710 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3711 </p>
3712 !! end
3713
3714 !! test
3715 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3716 !! options
3717 language=ca
3718 !! input
3719 ''[[Main Page]]''
3720 !! result
3721 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3722 </p>
3723 !! end
3724
3725 !! test
3726 Internal link with en linktrail: no apostrophes (bug 27473)
3727 !! options
3728 language=en
3729 !! input
3730 [[Something]]'nice
3731 !! result
3732 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3733 </p>
3734 !! end
3735
3736 !! test
3737 Internal link with ca linktrail with apostrophes (bug 27473)
3738 !! options
3739 language=ca
3740 !! input
3741 [[Something]]'nice
3742 !! result
3743 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3744 </p>
3745 !! end
3746
3747 !! test
3748 Internal link with kaa linktrail with apostrophes (bug 27473)
3749 !! options
3750 language=kaa
3751 !! input
3752 [[Something]]'nice
3753 !! result
3754 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
3755 </p>
3756 !! end
3757
3758 !! test
3759 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
3760 !! input
3761 [[Foo| bar]]
3762
3763 [[Foo| ''bar'']]
3764
3765 [http://wp.org foo]
3766
3767 [http://wp.org ''foo'']
3768 !! result
3769 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
3770 </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>
3771 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
3772 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
3773 </p>
3774 !! end
3775
3776 ###
3777 ### Interwiki links (see maintenance/interwiki.sql)
3778 ###
3779
3780 !! test
3781 Inline interwiki link
3782 !! input
3783 [[MeatBall:SoftSecurity]]
3784 !! result
3785 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3786 </p>
3787 !! end
3788
3789 !! test
3790 Inline interwiki link with empty title (bug 2372)
3791 !! input
3792 [[MeatBall:]]
3793 !! result
3794 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3795 </p>
3796 !! end
3797
3798 !! test
3799 Interwiki link encoding conversion (bug 1636)
3800 !! input
3801 *[[Wikipedia:ro:Olteni&#0355;a]]
3802 *[[Wikipedia:ro:Olteni&#355;a]]
3803 !! result
3804 <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>
3805 </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>
3806 </li></ul>
3807
3808 !! end
3809
3810 !! test
3811 Interwiki link with fragment (bug 2130)
3812 !! input
3813 [[MeatBall:SoftSecurity#foo]]
3814 !! result
3815 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3816 </p>
3817 !! end
3818
3819 !! test
3820 Interlanguage link
3821 !! input
3822 Blah blah blah
3823 [[zh:Chinese]]
3824 !!result
3825 <p>Blah blah blah
3826 </p>
3827 !! end
3828
3829 !! test
3830 Double interlanguage link
3831 !! input
3832 Blah blah blah
3833 [[es:Spanish]]
3834 [[zh:Chinese]]
3835 !!result
3836 <p>Blah blah blah
3837 </p>
3838 !! end
3839
3840 !! test
3841 Interlanguage link, with prefix links
3842 !! options
3843 language=ln
3844 !! input
3845 Blah blah blah
3846 [[zh:Chinese]]
3847 !!result
3848 <p>Blah blah blah
3849 </p>
3850 !! end
3851
3852 !! test
3853 Double interlanguage link, with prefix links (bug 8897)
3854 !! options
3855 language=ln
3856 !! input
3857 Blah blah blah
3858 [[es:Spanish]]
3859 [[zh:Chinese]]
3860 !!result
3861 <p>Blah blah blah
3862 </p>
3863 !! end
3864
3865 !! test
3866 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3867 !! options
3868 language=ln
3869 !! input
3870 [[WW&nbsp;II]]
3871 !!result
3872 <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>
3873 </p>
3874 !! end
3875
3876 ##
3877 ## XHTML tidiness
3878 ###
3879
3880 !! test
3881 <br> to <br />
3882 !! input
3883 1<br>2<br />3
3884 !! result
3885 <p>1<br />2<br />3
3886 </p>
3887 !! end
3888
3889 !! test
3890 Broken br tag sanitization
3891 !! input
3892 </br>
3893 !! result
3894 <p>&lt;/br&gt;
3895 </p>
3896 !! end
3897
3898 !! test
3899 Incorrecly removing closing slashes from correctly formed XHTML
3900 !! input
3901 <br style="clear:both;" />
3902 !! result
3903 <p><br style="clear:both;" />
3904 </p>
3905 !! end
3906
3907 !! test
3908 Failing to transform badly formed HTML into correct XHTML
3909 !! input
3910 <br style="clear: left;">
3911 <br style="clear: right;">
3912 <br style="clear: both;">
3913 !! result
3914 <p><br style="clear: left;" />
3915 <br style="clear: right;" />
3916 <br style="clear: both;" />
3917 </p>
3918 !!end
3919
3920 !! test
3921 Handling html with a div self-closing tag
3922 !! input
3923 <div title />
3924 <div title/>
3925 <div title/ >
3926 <div title=bar />
3927 <div title=bar/>
3928 <div title=bar/ >
3929 !! result
3930 <p>&lt;div title /&gt;
3931 &lt;div title/&gt;
3932 </p>
3933 <div>
3934 <p>&lt;div title=bar /&gt;
3935 &lt;div title=bar/&gt;
3936 </p>
3937 <div title="bar/"></div>
3938 </div>
3939
3940 !! end
3941
3942 !! test
3943 Handling html with a br self-closing tag
3944 !! input
3945 <br title />
3946 <br title/>
3947 <br title/ >
3948 <br title=bar />
3949 <br title=bar/>
3950 <br title=bar/ >
3951 !! result
3952 <p><br title="title" />
3953 <br title="title" />
3954 <br />
3955 <br title="bar" />
3956 <br title="bar" />
3957 <br title="bar/" />
3958 </p>
3959 !! end
3960
3961 !! test
3962 Horizontal ruler (should it add that extra space?)
3963 !! input
3964 <hr>
3965 <hr >
3966 foo <hr
3967 > bar
3968 !! result
3969 <hr />
3970 <hr />
3971 foo <hr /> bar
3972
3973 !! end
3974
3975 !! test
3976 Horizontal ruler -- 4+ dashes render hr
3977 !! input
3978 ----
3979 !! result
3980 <hr />
3981
3982 !! end
3983
3984 !! test
3985 Horizontal ruler -- eats additional dashes on the same line
3986 !! input
3987 ---------
3988 !! result
3989 <hr />
3990
3991 !! end
3992
3993 !! test
3994 Horizontal ruler -- does not collaps dashes on consecutive lines
3995 !! input
3996 ----
3997 ----
3998 !! result
3999 <hr />
4000 <hr />
4001
4002 !! end
4003
4004 !! test
4005 Horizontal ruler -- <4 dashes render as plain text
4006 !! input
4007 ---
4008 !! result
4009 <p>---
4010 </p>
4011 !! end
4012
4013 !! test
4014 Horizontal ruler -- Supports content following dashes on same line
4015 !! input
4016 ---- Foo
4017 !! result
4018 <hr /> Foo
4019
4020 !! end
4021
4022 ###
4023 ### Block-level elements
4024 ###
4025 !! test
4026 Common list
4027 !! input
4028 *Common list
4029 * item 2
4030 *item 3
4031 !! result
4032 <ul><li>Common list
4033 </li><li> item 2
4034 </li><li>item 3
4035 </li></ul>
4036
4037 !! end
4038
4039 !! test
4040 Numbered list
4041 !! input
4042 #Numbered list
4043 #item 2
4044 # item 3
4045 !! result
4046 <ol><li>Numbered list
4047 </li><li>item 2
4048 </li><li> item 3
4049 </li></ol>
4050
4051 !! end
4052
4053 !! test
4054 Mixed list
4055 !! input
4056 *Mixed list
4057 *# with numbers
4058 ** and bullets
4059 *# and numbers
4060 *bullets again
4061 **bullet level 2
4062 ***bullet level 3
4063 ***#Number on level 4
4064 **bullet level 2
4065 **#Number on level 3
4066 **#Number on level 3
4067 *#number level 2
4068 *Level 1
4069 *** Level 3
4070 #** Level 3, but ordered
4071 !! result
4072 <ul><li>Mixed list
4073 <ol><li> with numbers
4074 </li></ol>
4075 <ul><li> and bullets
4076 </li></ul>
4077 <ol><li> and numbers
4078 </li></ol>
4079 </li><li>bullets again
4080 <ul><li>bullet level 2
4081 <ul><li>bullet level 3
4082 <ol><li>Number on level 4
4083 </li></ol>
4084 </li></ul>
4085 </li><li>bullet level 2
4086 <ol><li>Number on level 3
4087 </li><li>Number on level 3
4088 </li></ol>
4089 </li></ul>
4090 <ol><li>number level 2
4091 </li></ol>
4092 </li><li>Level 1
4093 <ul><li><ul><li> Level 3
4094 </li></ul>
4095 </li></ul>
4096 </li></ul>
4097 <ol><li><ul><li><ul><li> Level 3, but ordered
4098 </li></ul>
4099 </li></ul>
4100 </li></ol>
4101
4102 !! end
4103
4104 !! test
4105 Nested lists 1
4106 !! input
4107 *foo
4108 **bar
4109 !! result
4110 <ul><li>foo
4111 <ul><li>bar
4112 </li></ul>
4113 </li></ul>
4114
4115 !! end
4116
4117 !! test
4118 Nested lists 2
4119 !! input
4120 **foo
4121 *bar
4122 !! result
4123 <ul><li><ul><li>foo
4124 </li></ul>
4125 </li><li>bar
4126 </li></ul>
4127
4128 !! end
4129
4130 !! test
4131 Nested lists 3 (first element empty)
4132 !! input
4133 *
4134 **bar
4135 !! result
4136 <ul><li>
4137 <ul><li>bar
4138 </li></ul>
4139 </li></ul>
4140
4141 !! end
4142
4143 !! test
4144 Nested lists 4 (first element empty)
4145 !! input
4146 **
4147 *bar
4148 !! result
4149 <ul><li><ul><li>
4150 </li></ul>
4151 </li><li>bar
4152 </li></ul>
4153
4154 !! end
4155
4156 !! test
4157 Nested lists 5 (both elements empty)
4158 !! input
4159 **
4160 *
4161 !! result
4162 <ul><li><ul><li>
4163 </li></ul>
4164 </li><li>
4165 </li></ul>
4166
4167 !! end
4168
4169 !! test
4170 Nested lists 6 (both elements empty)
4171 !! input
4172 *
4173 **
4174 !! result
4175 <ul><li>
4176 <ul><li>
4177 </li></ul>
4178 </li></ul>
4179
4180 !! end
4181
4182 !! test
4183 Nested lists 7 (skip initial nesting levels)
4184 !! input
4185 *** foo
4186 !! result
4187 <ul><li><ul><li><ul><li> foo
4188 </li></ul>
4189 </li></ul>
4190 </li></ul>
4191
4192 !! end
4193
4194 !! test
4195 Nested lists 8 (multiple nesting transitions)
4196 !! input
4197 * foo
4198 *** bar
4199 ** baz
4200 * boo
4201 !! result
4202 <ul><li> foo
4203 <ul><li><ul><li> bar
4204 </li></ul>
4205 </li><li> baz
4206 </li></ul>
4207 </li><li> boo
4208 </li></ul>
4209
4210 !! end
4211
4212 !! test
4213 1. Lists with start-of-line-transparent tokens before bullets: Comments
4214 !! input
4215 *foo
4216 *<!--cmt-->bar
4217 <!--cmt-->*baz
4218 !! result
4219 <ul><li>foo
4220 </li><li>bar
4221 </li><li>baz
4222 </li></ul>
4223
4224 !! end
4225
4226 !! test
4227 2. Lists with start-of-line-transparent tokens before bullets: Template close
4228 !! input
4229 *foo {{echo|bar
4230 }}*baz
4231 !! result
4232 <ul><li>foo bar
4233 </li><li>baz
4234 </li></ul>
4235
4236 !! end
4237
4238 !! test
4239 Unbalanced closing block tags break a list
4240 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4241 !! options
4242 disabled
4243 !! input
4244 <div>
4245 *a</div><div>
4246 *b</div>
4247 !! result
4248 <div>
4249 <ul><li>a
4250 </li></ul></div><div>
4251 <ul><li>b
4252 </li></ul></div>
4253 !! end
4254
4255 !! test
4256 Unbalanced closing non-block tags don't break a list
4257 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4258 !! options
4259 disabled
4260 !! input
4261 <span>
4262 *a</span><span>
4263 *b</span>
4264 !! result
4265 <p><span></span>
4266 </p>
4267 <ul><li>a<span></span>
4268 </li><li>b
4269 </li></ul>
4270 !! end
4271
4272 !! test
4273 Unclosed formatting tags that straddle lists are closed and reopened
4274 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4275 !! options
4276 disabled
4277 !! input
4278 # <s> a
4279 # b </s>
4280 !! result
4281 <ol><li> <s> a </s>
4282 </li><li> <s> b </s>
4283 </li></ol>
4284 !! end
4285
4286 !!test
4287 List embedded in a non-block tag
4288 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4289 !! options
4290 disabled
4291 !!input
4292 <small>
4293 * foo
4294 </small>
4295 !!result
4296 <p><small></small></p>
4297 <small>
4298 <ul>
4299 <li> foo</li>
4300 </ul>
4301 </small>
4302 <p><small></small></p>
4303 !!end
4304
4305 !! test
4306 List items are not parsed correctly following a <pre> block (bug 785)
4307 !! input
4308 * <pre>foo</pre>
4309 * <pre>bar</pre>
4310 * zar
4311 !! result
4312 <ul><li> <pre>foo</pre>
4313 </li><li> <pre>bar</pre>
4314 </li><li> zar
4315 </li></ul>
4316
4317 !! end
4318
4319 !! test
4320 List items from template
4321 !! input
4322
4323 {{inner list}}
4324 * item 2
4325
4326 * item 0
4327 {{inner list}}
4328 * item 2
4329
4330 * item 0
4331 * notSOL{{inner list}}
4332 * item 2
4333 !! result
4334 <ul><li> item 1
4335 </li><li> item 2
4336 </li></ul>
4337 <ul><li> item 0
4338 </li><li> item 1
4339 </li><li> item 2
4340 </li></ul>
4341 <ul><li> item 0
4342 </li><li> notSOL
4343 </li><li> item 1
4344 </li><li> item 2
4345 </li></ul>
4346
4347 !! end
4348
4349 !! test
4350 List interrupted by empty line or heading
4351 !! input
4352 * foo
4353
4354 ** bar
4355 == A heading ==
4356 * Another list item
4357 !! result
4358 <ul><li> foo
4359 </li></ul>
4360 <ul><li><ul><li> bar
4361 </li></ul>
4362 </li></ul>
4363 <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>
4364 <ul><li> Another list item
4365 </li></ul>
4366
4367 !!end
4368
4369 !!test
4370 Multiple list tags generated by templates
4371 !!input
4372 {{echo|<li>}}a
4373 {{echo|<li>}}b
4374 {{echo|<li>}}c
4375 !!result
4376 <li>a
4377 <li>b
4378 <li>c</li>
4379 </li>
4380 </li>
4381
4382 !!end
4383
4384 ###
4385 ### Magic Words
4386 ###
4387
4388 !! test
4389 Magic Word: {{CURRENTDAY}}
4390 !! input
4391 {{CURRENTDAY}}
4392 !! result
4393 <p>1
4394 </p>
4395 !! end
4396
4397 !! test
4398 Magic Word: {{CURRENTDAY2}}
4399 !! input
4400 {{CURRENTDAY2}}
4401 !! result
4402 <p>01
4403 </p>
4404 !! end
4405
4406 !! test
4407 Magic Word: {{CURRENTDAYNAME}}
4408 !! input
4409 {{CURRENTDAYNAME}}
4410 !! result
4411 <p>Thursday
4412 </p>
4413 !! end
4414
4415 !! test
4416 Magic Word: {{CURRENTDOW}}
4417 !! input
4418 {{CURRENTDOW}}
4419 !! result
4420 <p>4
4421 </p>
4422 !! end
4423
4424 !! test
4425 Magic Word: {{CURRENTMONTH}}
4426 !! input
4427 {{CURRENTMONTH}}
4428 !! result
4429 <p>01
4430 </p>
4431 !! end
4432
4433 !! test
4434 Magic Word: {{CURRENTMONTHABBREV}}
4435 !! input
4436 {{CURRENTMONTHABBREV}}
4437 !! result
4438 <p>Jan
4439 </p>
4440 !! end
4441
4442 !! test
4443 Magic Word: {{CURRENTMONTHNAME}}
4444 !! input
4445 {{CURRENTMONTHNAME}}
4446 !! result
4447 <p>January
4448 </p>
4449 !! end
4450
4451 !! test
4452 Magic Word: {{CURRENTMONTHNAMEGEN}}
4453 !! input
4454 {{CURRENTMONTHNAMEGEN}}
4455 !! result
4456 <p>January
4457 </p>
4458 !! end
4459
4460 !! test
4461 Magic Word: {{CURRENTTIME}}
4462 !! input
4463 {{CURRENTTIME}}
4464 !! result
4465 <p>00:02
4466 </p>
4467 !! end
4468
4469 !! test
4470 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4471 !! input
4472 {{CURRENTWEEK}}
4473 !! result
4474 <p>1
4475 </p>
4476 !! end
4477
4478 !! test
4479 Magic Word: {{CURRENTYEAR}}
4480 !! input
4481 {{CURRENTYEAR}}
4482 !! result
4483 <p>1970
4484 </p>
4485 !! end
4486
4487 !! test
4488 Magic Word: {{FULLPAGENAME}}
4489 !! options
4490 title=[[User:Ævar Arnfjörð Bjarmason]]
4491 !! input
4492 {{FULLPAGENAME}}
4493 !! result
4494 <p>User:Ævar Arnfjörð Bjarmason
4495 </p>
4496 !! end
4497
4498 !! test
4499 Magic Word: {{FULLPAGENAMEE}}
4500 !! options
4501 title=[[User:Ævar Arnfjörð Bjarmason]]
4502 !! input
4503 {{FULLPAGENAMEE}}
4504 !! result
4505 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4506 </p>
4507 !! end
4508
4509 !! test
4510 Magic Word: {{NAMESPACE}}
4511 !! options
4512 title=[[User:Ævar Arnfjörð Bjarmason]]
4513 !! input
4514 {{NAMESPACE}}
4515 !! result
4516 <p>User
4517 </p>
4518 !! end
4519
4520 !! test
4521 Magic Word: {{NAMESPACEE}}
4522 !! options
4523 title=[[User:Ævar Arnfjörð Bjarmason]]
4524 !! input
4525 {{NAMESPACEE}}
4526 !! result
4527 <p>User
4528 </p>
4529 !! end
4530
4531 !! test
4532 Magic Word: {{NAMESPACENUMBER}}
4533 !! options
4534 title=[[User:Ævar Arnfjörð Bjarmason]]
4535 !! input
4536 {{NAMESPACENUMBER}}
4537 !! result
4538 <p>2
4539 </p>
4540 !! end
4541
4542 !! test
4543 Magic Word: {{NUMBEROFFILES}}
4544 !! input
4545 {{NUMBEROFFILES}}
4546 !! result
4547 <p>2
4548 </p>
4549 !! end
4550
4551 !! test
4552 Magic Word: {{PAGENAME}}
4553 !! options
4554 title=[[User:Ævar Arnfjörð Bjarmason]]
4555 !! input
4556 {{PAGENAME}}
4557 !! result
4558 <p>Ævar Arnfjörð Bjarmason
4559 </p>
4560 !! end
4561
4562 !! test
4563 Magic Word: {{PAGENAME}} with metacharacters
4564 !! options
4565 title=[['foo & bar = baz']]
4566 !! input
4567 ''{{PAGENAME}}''
4568 !! result
4569 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4570 </p>
4571 !! end
4572
4573 !! test
4574 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4575 !! options
4576 title=[[*RFC 1234 http://example.com/]]
4577 !! input
4578 {{PAGENAME}}
4579 !! result
4580 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4581 </p>
4582 !! end
4583
4584 !! test
4585 Magic Word: {{PAGENAMEE}}
4586 !! options
4587 title=[[User:Ævar Arnfjörð Bjarmason]]
4588 !! input
4589 {{PAGENAMEE}}
4590 !! result
4591 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4592 </p>
4593 !! end
4594
4595 !! test
4596 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4597 !! options
4598 title=[[*RFC 1234 http://example.com/]]
4599 !! input
4600 {{PAGENAMEE}}
4601 !! result
4602 <p>&#42;RFC_1234_http&#58;//example.com/
4603 </p>
4604 !! end
4605
4606 !! test
4607 Magic Word: {{REVISIONID}}
4608 !! input
4609 {{REVISIONID}}
4610 !! result
4611 <p>1337
4612 </p>
4613 !! end
4614
4615 !! test
4616 Magic Word: {{SCRIPTPATH}}
4617 !! input
4618 {{SCRIPTPATH}}
4619 !! result
4620 <p>/
4621 </p>
4622 !! end
4623
4624 !! test
4625 Magic Word: {{SERVER}}
4626 !! input
4627 {{SERVER}}
4628 !! result
4629 <p><a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>
4630 </p>
4631 !! end
4632
4633 !! test
4634 Magic Word: {{SERVERNAME}}
4635 !! input
4636 {{SERVERNAME}}
4637 !! result
4638 <p>Britney-Spears
4639 </p>
4640 !! end
4641
4642 !! test
4643 Magic Word: {{SITENAME}}
4644 !! input
4645 {{SITENAME}}
4646 !! result
4647 <p>MediaWiki
4648 </p>
4649 !! end
4650
4651 !! test
4652 Namespace 1 {{ns:1}}
4653 !! input
4654 {{ns:1}}
4655 !! result
4656 <p>Talk
4657 </p>
4658 !! end
4659
4660 !! test
4661 Namespace 1 {{ns:01}}
4662 !! input
4663 {{ns:01}}
4664 !! result
4665 <p>Talk
4666 </p>
4667 !! end
4668
4669 !! test
4670 Namespace 0 {{ns:0}} (bug 4783)
4671 !! input
4672 {{ns:0}}
4673 !! result
4674
4675 !! end
4676
4677 !! test
4678 Namespace 0 {{ns:00}} (bug 4783)
4679 !! input
4680 {{ns:00}}
4681 !! result
4682
4683 !! end
4684
4685 !! test
4686 Namespace -1 {{ns:-1}}
4687 !! input
4688 {{ns:-1}}
4689 !! result
4690 <p>Special
4691 </p>
4692 !! end
4693
4694 !! test
4695 Namespace User {{ns:User}}
4696 !! input
4697 {{ns:User}}
4698 !! result
4699 <p>User
4700 </p>
4701 !! end
4702
4703 !! test
4704 Namespace User talk {{ns:User_talk}}
4705 !! input
4706 {{ns:User_talk}}
4707 !! result
4708 <p>User talk
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 File {{ns:File}}
4723 !! input
4724 {{ns:File}}
4725 !! result
4726 <p>File
4727 </p>
4728 !! end
4729
4730 !! test
4731 Namespace File {{ns:Image}}
4732 !! input
4733 {{ns:Image}}
4734 !! result
4735 <p>File
4736 </p>
4737 !! end
4738
4739 !! test
4740 Namespace (lang=de) Benutzer {{ns:User}}
4741 !! options
4742 language=de
4743 !! input
4744 {{ns:User}}
4745 !! result
4746 <p>Benutzer
4747 </p>
4748 !! end
4749
4750 !! test
4751 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4752 !! options
4753 language=de
4754 !! input
4755 {{ns:3}}
4756 !! result
4757 <p>Benutzer Diskussion
4758 </p>
4759 !! end
4760
4761
4762 !! test
4763 Urlencode
4764 !! input
4765 {{urlencode:hi world?!}}
4766 {{urlencode:hi world?!|WIKI}}
4767 {{urlencode:hi world?!|PATH}}
4768 {{urlencode:hi world?!|QUERY}}
4769 !! result
4770 <p>hi+world%3F%21
4771 hi_world%3F!
4772 hi%20world%3F%21
4773 hi+world%3F%21
4774 </p>
4775 !! end
4776
4777 ###
4778 ### Magic links
4779 ###
4780 !! test
4781 Magic links: internal link to RFC (bug 479)
4782 !! input
4783 [[RFC 123]]
4784 !! result
4785 <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>
4786 </p>
4787 !! end
4788
4789 !! test
4790 Magic links: RFC (bug 479)
4791 !! input
4792 RFC 822
4793 !! result
4794 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4795 </p>
4796 !! end
4797
4798 !! test
4799 Magic links: ISBN (bug 1937)
4800 !! input
4801 ISBN 0-306-40615-2
4802 !! result
4803 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4804 </p>
4805 !! end
4806
4807 !! test
4808 Magic links: PMID incorrectly converts space to underscore
4809 !! input
4810 PMID 1234
4811 !! result
4812 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4813 </p>
4814 !! end
4815
4816 ###
4817 ### Templates
4818 ####
4819
4820 !! test
4821 Nonexistent template
4822 !! input
4823 {{thistemplatedoesnotexist}}
4824 !! result
4825 <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>
4826 </p>
4827 !! end
4828
4829 !! test
4830 Template with invalid target containing tags
4831 !! input
4832 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4833 !! result
4834 <p>{{a<b>b</b>|foo|a=b|a = b}}
4835 </p>
4836 !! end
4837
4838 !! test
4839 Template with invalid target containing unclosed tag
4840 !! input
4841 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4842 !! result
4843 <p>{{a<b>|foo|a=b|a = b}}</b>
4844 </p>
4845 !! end
4846
4847 !! article
4848 Template:test
4849 !! text
4850 This is a test template
4851 !! endarticle
4852
4853 !! test
4854 Simple template
4855 !! input
4856 {{test}}
4857 !! result
4858 <p>This is a test template
4859 </p>
4860 !! end
4861
4862 !! test
4863 Template with explicit namespace
4864 !! input
4865 {{Template:test}}
4866 !! result
4867 <p>This is a test template
4868 </p>
4869 !! end
4870
4871
4872 !! article
4873 Template:paramtest
4874 !! text
4875 This is a test template with parameter {{{param}}}
4876 !! endarticle
4877
4878 !! test
4879 Template parameter
4880 !! input
4881 {{paramtest|param=foo}}
4882 !! result
4883 <p>This is a test template with parameter foo
4884 </p>
4885 !! end
4886
4887 !! article
4888 Template:paramtestnum
4889 !! text
4890 [[{{{1}}}|{{{2}}}]]
4891 !! endarticle
4892
4893 !! test
4894 Template unnamed parameter
4895 !! input
4896 {{paramtestnum|Main Page|the main page}}
4897 !! result
4898 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4899 </p>
4900 !! end
4901
4902 !! article
4903 Template:templatesimple
4904 !! text
4905 (test)
4906 !! endarticle
4907
4908 !! article
4909 Template:templateredirect
4910 !! text
4911 #redirect [[Template:templatesimple]]
4912 !! endarticle
4913
4914 !! article
4915 Template:templateasargtestnum
4916 !! text
4917 {{{{{1}}}}}
4918 !! endarticle
4919
4920 !! article
4921 Template:templateasargtest
4922 !! text
4923 {{template{{{templ}}}}}
4924 !! endarticle
4925
4926 !! article
4927 Template:templateasargtest2
4928 !! text
4929 {{{{{templ}}}}}
4930 !! endarticle
4931
4932 !! test
4933 Template with template name as unnamed argument
4934 !! input
4935 {{templateasargtestnum|templatesimple}}
4936 !! result
4937 <p>(test)
4938 </p>
4939 !! end
4940
4941 !! test
4942 Template with template name as argument
4943 !! input
4944 {{templateasargtest|templ=simple}}
4945 !! result
4946 <p>(test)
4947 </p>
4948 !! end
4949
4950 !! test
4951 Template with template name as argument (2)
4952 !! input
4953 {{templateasargtest2|templ=templatesimple}}
4954 !! result
4955 <p>(test)
4956 </p>
4957 !! end
4958
4959 !! article
4960 Template:templateasargtestdefault
4961 !! text
4962 {{{{{templ|templatesimple}}}}}
4963 !! endarticle
4964
4965 !! article
4966 Template:templa
4967 !! text
4968 '''templ'''
4969 !! endarticle
4970
4971 !! test
4972 Template with default value
4973 !! input
4974 {{templateasargtestdefault}}
4975 !! result
4976 <p>(test)
4977 </p>
4978 !! end
4979
4980 !! test
4981 Template with default value (value set)
4982 !! input
4983 {{templateasargtestdefault|templ=templa}}
4984 !! result
4985 <p><b>templ</b>
4986 </p>
4987 !! end
4988
4989 !! test
4990 Template redirect
4991 !! input
4992 {{templateredirect}}
4993 !! result
4994 <p>(test)
4995 </p>
4996 !! end
4997
4998 !! test
4999 Template with argument in separate line
5000 !! input
5001 {{ templateasargtest |
5002 templ = simple }}
5003 !! result
5004 <p>(test)
5005 </p>
5006 !! end
5007
5008 !! test
5009 Template with complex template as argument
5010 !! input
5011 {{paramtest|
5012 param ={{ templateasargtest |
5013 templ = simple }}}}
5014 !! result
5015 <p>This is a test template with parameter (test)
5016 </p>
5017 !! end
5018
5019 !! test
5020 Template with thumb image (with link in description)
5021 !! input
5022 {{paramtest|
5023 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5024 !! result
5025 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>
5026
5027 !! end
5028
5029 !! article
5030 Template:complextemplate
5031 !! text
5032 {{{1}}} {{paramtest|
5033 param ={{{param}}}}}
5034 !! endarticle
5035
5036 !! test
5037 Template with complex arguments
5038 !! input
5039 {{complextemplate|
5040 param ={{ templateasargtest |
5041 templ = simple }}|[[Template:complextemplate|link]]}}
5042 !! result
5043 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5044 </p>
5045 !! end
5046
5047 !! test
5048 BUG 553: link with two variables in a piped link
5049 !! input
5050 {|
5051 |[[{{{1}}}|{{{2}}}]]
5052 |}
5053 !! result
5054 <table>
5055 <tr>
5056 <td>[[{{{1}}}|{{{2}}}]]
5057 </td></tr></table>
5058
5059 !! end
5060
5061 !! test
5062 Magic variable as template parameter
5063 !! input
5064 {{paramtest|param={{SITENAME}}}}
5065 !! result
5066 <p>This is a test template with parameter MediaWiki
5067 </p>
5068 !! end
5069
5070 !! article
5071 Template:linktest
5072 !! text
5073 [[{{{param}}}|link]]
5074 !! endarticle
5075
5076 !! test
5077 Template parameter as link source
5078 !! input
5079 {{linktest|param=Main Page}}
5080 !! result
5081 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5082 </p>
5083 !! end
5084
5085 !!test
5086 Template-generated attribute string (k='v')
5087 !!input
5088 <span {{attr_str|id|v1}}>bar</span>
5089 !!result
5090 <p><span id="v1">bar</span>
5091 </p>
5092 !!end
5093
5094 !!article
5095 Template:paramtest2
5096 !! text
5097 including another template, {{paramtest|param={{{arg}}}}}
5098 !! endarticle
5099
5100 !! test
5101 Template passing argument to another template
5102 !! input
5103 {{paramtest2|arg='hmm'}}
5104 !! result
5105 <p>including another template, This is a test template with parameter 'hmm'
5106 </p>
5107 !! end
5108
5109 !! article
5110 Template:Linktest2
5111 !! text
5112 Main Page
5113 !! endarticle
5114
5115 !! test
5116 Template as link source
5117 !! input
5118 [[{{linktest2}}]]
5119
5120 [[{{linktest2}}|Main Page]]
5121
5122 [[{{linktest2}}]]Page
5123 !! result
5124 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5125 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5126 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5127 </p>
5128 !! end
5129
5130
5131 !! article
5132 Template:loop1
5133 !! text
5134 {{loop2}}
5135 !! endarticle
5136
5137 !! article
5138 Template:loop2
5139 !! text
5140 {{loop1}}
5141 !! endarticle
5142
5143 !! test
5144 Template infinite loop
5145 !! input
5146 {{loop1}}
5147 !! result
5148 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5149 </p>
5150 !! end
5151
5152 !! test
5153 Template from main namespace
5154 !! input
5155 {{:Main Page}}
5156 !! result
5157 <p>blah blah
5158 </p>
5159 !! end
5160
5161 !! article
5162 Template:table
5163 !! text
5164 {|
5165 | 1 || 2
5166 |-
5167 | 3 || 4
5168 |}
5169 !! endarticle
5170
5171 !! test
5172 BUG 529: Template with table, not included at beginning of line
5173 !! input
5174 foo {{table}}
5175 !! result
5176 <p>foo
5177 </p>
5178 <table>
5179 <tr>
5180 <td> 1 </td>
5181 <td> 2
5182 </td></tr>
5183 <tr>
5184 <td> 3 </td>
5185 <td> 4
5186 </td></tr></table>
5187
5188 !! end
5189
5190 !! test
5191 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5192 !! input
5193 foo
5194 {{table}}
5195 !! result
5196 <p>foo
5197 </p>
5198 <table>
5199 <tr>
5200 <td> 1 </td>
5201 <td> 2
5202 </td></tr>
5203 <tr>
5204 <td> 3 </td>
5205 <td> 4
5206 </td></tr></table>
5207
5208 !! end
5209
5210 !! test
5211 BUG 41: Template parameters shown as broken links
5212 !! input
5213 {{{parameter}}}
5214 !! result
5215 <p>{{{parameter}}}
5216 </p>
5217 !! end
5218
5219 !! test
5220 Template with targets containing wikilinks
5221 !! input
5222 {{[[foo]]}}
5223
5224 {{[[{{echo|foo}}]]}}
5225
5226 {{{{echo|[[foo}}]]}}
5227 !! result
5228 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5229 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5230 </p><p>{{[[foo}}]]
5231 </p>
5232 !! end
5233
5234 !! article
5235 Template:MSGNW test
5236 !! text
5237 ''None'' of '''this''' should be
5238 * interpreted
5239 but rather passed unmodified
5240 {{test}}
5241 !! endarticle
5242
5243 # hmm, fix this or just deprecate msgnw and document its behavior?
5244 !! test
5245 msgnw keyword
5246 !! options
5247 disabled
5248 !! input
5249 {{msgnw:MSGNW test}}
5250 !! result
5251 <p>''None'' of '''this''' should be
5252 * interpreted
5253 but rather passed unmodified
5254 {{test}}
5255 </p>
5256 !! end
5257
5258 !! test
5259 int keyword
5260 !! input
5261 {{int:youhavenewmessages|lots of money|not!}}
5262 !! result
5263 <p>You have lots of money (not!).
5264 </p>
5265 !! end
5266
5267 !! article
5268 Template:Includes
5269 !! text
5270 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5271 !! endarticle
5272
5273 !! test
5274 <includeonly> and <noinclude> being included
5275 !! input
5276 {{Includes}}
5277 !! result
5278 <p>Foobar
5279 </p>
5280 !! end
5281
5282 !! article
5283 Template:Includes2
5284 !! text
5285 <onlyinclude>Foo</onlyinclude>bar
5286 !! endarticle
5287
5288 !! test
5289 <onlyinclude> being included
5290 !! input
5291 {{Includes2}}
5292 !! result
5293 <p>Foo
5294 </p>
5295 !! end
5296
5297
5298 !! article
5299 Template:Includes3
5300 !! text
5301 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5302 !! endarticle
5303
5304 !! test
5305 <onlyinclude> and <includeonly> being included
5306 !! input
5307 {{Includes3}}
5308 !! result
5309 <p>Foo
5310 </p>
5311 !! end
5312
5313 !! test
5314 <includeonly> and <noinclude> on a page
5315 !! input
5316 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5317 !! result
5318 <p>Foozar
5319 </p>
5320 !! end
5321
5322 !! test
5323 Un-closed <noinclude>
5324 !! input
5325 <noinclude>
5326 !! result
5327 !! end
5328
5329 !! test
5330 <onlyinclude> on a page
5331 !! input
5332 <onlyinclude>Foo</onlyinclude>bar
5333 !! result
5334 <p>Foobar
5335 </p>
5336 !! end
5337
5338 !! test
5339 Un-closed <onlyinclude>
5340 !! input
5341 <onlyinclude>
5342 !! result
5343 !! end
5344
5345 !!test
5346 Self-closed noinclude, includeonly, onlyinclude tags
5347 !!input
5348 <noinclude />
5349 <includeonly />
5350 <onlyinclude />
5351 !!result
5352 <p><br />
5353 </p>
5354 !!end
5355
5356 !!test
5357 Unbalanced includeonly and noinclude tags
5358 !!input
5359 {|
5360 |a</noinclude>
5361 |b</noinclude></noinclude>
5362 |c</noinclude></includeonly>
5363 |d</includeonly></includeonly>
5364 |}
5365 !!result
5366 <table>
5367 <tr>
5368 <td>a
5369 </td>
5370 <td>b
5371 </td>
5372 <td>c&lt;/includeonly&gt;
5373 </td>
5374 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5375 </td></tr></table>
5376
5377 !!end
5378
5379 !! article
5380 Template:Includeonly section
5381 !! text
5382 <includeonly>
5383 ==Includeonly section==
5384 </includeonly>
5385 ==Section T-1==
5386 !!endarticle
5387
5388 !! test
5389 Bug 6563: Edit link generation for section shown by <includeonly>
5390 !! input
5391 {{includeonly section}}
5392 !! result
5393 <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>
5394 <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>
5395
5396 !! end
5397
5398 # Uses same input as the contents of [[Template:Includeonly section]]
5399 !! test
5400 Bug 6563: Section extraction for section shown by <includeonly>
5401 !! options
5402 section=T-2
5403 !! input
5404 <includeonly>
5405 ==Includeonly section==
5406 </includeonly>
5407 ==Section T-2==
5408 !! result
5409 ==Section T-2==
5410 !! end
5411
5412 !! test
5413 Bug 6563: Edit link generation for section suppressed by <includeonly>
5414 !! input
5415 <includeonly>
5416 ==Includeonly section==
5417 </includeonly>
5418 ==Section 1==
5419 !! result
5420 <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>
5421
5422 !! end
5423
5424 !! test
5425 Bug 6563: Section extraction for section suppressed by <includeonly>
5426 !! options
5427 section=1
5428 !! input
5429 <includeonly>
5430 ==Includeonly section==
5431 </includeonly>
5432 ==Section 1==
5433 !! result
5434 ==Section 1==
5435 !! end
5436
5437 !! test
5438 Un-closed <includeonly>
5439 !! input
5440 <includeonly>
5441 !! result
5442 !! end
5443
5444 ###
5445 ### <includeonly> and <noinclude> in attributes
5446 ###
5447 !!test
5448 0. includeonly around the entire attribute
5449 !!input
5450 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5451 !!result
5452 <p><span id="v2">bar</span>
5453 </p>
5454 !!end
5455
5456 !!test
5457 1. includeonly in html attr key
5458 !!input
5459 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5460 !!result
5461 <p><span id="foo">bar</span>
5462 </p>
5463 !!end
5464
5465 !!test
5466 2. includeonly in html attr value
5467 !!input
5468 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5469 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5470 !!result
5471 <p><span id="v1">bar</span>
5472 <span id="v1">bar</span>
5473 </p>
5474 !!end
5475
5476 !!test
5477 3. includeonly in part of an attr value
5478 !!input
5479 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5480 !!result
5481 <p><span style="color:red;">bar</span>
5482 </p>
5483 !!end
5484
5485 ###
5486 ### Testing parsing of templates where a template arg
5487 ### has the same name as the template itself.
5488 ###
5489
5490 !! article
5491 Template:quote
5492 !! text
5493 {{{quote|{{{1}}}}}}
5494 !! endarticle
5495
5496 !!test
5497 Templates: Template Name/Arg clash: 1. Use of positional param
5498 !!input
5499 {{quote|foo}}
5500 !!result
5501 <p>foo
5502 </p>
5503 !!end
5504
5505 !!test
5506 Templates: Template Name/Arg clash: 2. Use of named param
5507 !!input
5508 {{quote|quote=foo}}
5509 !!result
5510 <p>foo
5511 </p>
5512 !!end
5513
5514 !!test
5515 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5516 !!input
5517 {{quote|quote}}
5518 !!result
5519 <p>quote
5520 </p>
5521 !!end
5522
5523 ###
5524 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5525 ###
5526
5527 !!test
5528 Templates: 1. Simple use
5529 !!input
5530 {{echo|Foo}}
5531 !!result
5532 <p>Foo
5533 </p>
5534 !!end
5535
5536 !!test
5537 Templates: 2. Inside a block tag
5538 !!input
5539 <div>{{echo|Foo}}</div>
5540 !!result
5541 <div>Foo</div>
5542
5543 !!end
5544
5545 !!test
5546 Templates: P-wrapping: 1a. Templates on consecutive lines
5547 !!input
5548 {{echo|Foo}}
5549 {{echo|bar}}
5550 !!result
5551 <p>Foo
5552 bar
5553 </p>
5554 !!end
5555
5556 !!test
5557 Templates: P-wrapping: 1b. Templates on consecutive lines
5558 !!input
5559 Foo
5560
5561 {{echo|bar}}
5562 {{echo|baz}}
5563 !!result
5564 <p>Foo
5565 </p><p>bar
5566 baz
5567 </p>
5568 !!end
5569
5570 !!test
5571 Templates: P-wrapping: 1c. Templates on consecutive lines
5572 !!input
5573 {{echo|Foo}}
5574 {{echo|bar}} <div>baz</div>
5575 !!result
5576 <p>Foo
5577 </p>
5578 bar <div>baz</div>
5579
5580 !!end
5581
5582 !!test
5583 Templates: Inline Text: 1. Multiple tmeplate uses
5584 !!input
5585 {{echo|Foo}}bar{{echo|baz}}
5586 !!result
5587 <p>Foobarbaz
5588 </p>
5589 !!end
5590
5591 !!test
5592 Templates: Inline Text: 2. Back-to-back template uses
5593 !!input
5594 {{echo|Foo}}{{echo|bar}}
5595 !!result
5596 <p>Foobar
5597 </p>
5598 !!end
5599
5600 !!test
5601 Templates: Block Tags: 1. Multiple template uses
5602 !!input
5603 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5604 !!result
5605 <div>Foo</div><div>bar</div><div>baz</div>
5606
5607 !!end
5608
5609 !!test
5610 Templates: Block Tags: 2. Back-to-back template uses
5611 !!input
5612 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5613 !!result
5614 <div>Foo</div><div>bar</div>
5615
5616 !!end
5617
5618 !!test
5619 Templates: Links: 1. Simple example
5620 !!input
5621 {{echo|[[Foo|bar]]}}
5622 !!result
5623 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5624 </p>
5625 !!end
5626
5627 !!test
5628 Templates: Links: 2. Generation of link href
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: 3. Generation of part of a link href
5638 !!input
5639 [[Fo{{echo|o}}|bar]]
5640
5641 [[Foo{{echo|bar}}]]
5642
5643 [[Foo{{echo|bar}}baz]]
5644
5645 [[Foo{{echo|bar}}|bar]]
5646
5647 [[:Foo{{echo|bar}}]]
5648
5649 [[:Foo{{echo|bar}}|bar]]
5650 !!result
5651 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5652 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5653 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5654 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5655 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5656 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5657 </p>
5658 !!end
5659
5660 !!test
5661 Templates: Links: 4. Multiple templates generating link href
5662 !!input
5663 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5664 !!result
5665 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5666 </p>
5667 !!end
5668
5669 !!test
5670 Templates: Links: 5. Generation of link text
5671 !!input
5672 [[Foo|{{echo|bar}}]]
5673 !!result
5674 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5675 </p>
5676 !!end
5677
5678 !!test
5679 Templates: Links: 5. Nested templates (only outermost template should be marked)
5680 !!input
5681 {{echo|[[{{echo|Foo}}|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: HTML Tag: 1. Generation of HTML attr. key
5689 !!input
5690 <div {{echo|style}}="color:red;">foo</div>
5691 !!result
5692 <div style="color:red;">foo</div>
5693
5694 !!end
5695
5696 !!test
5697 Templates: HTML Tag: 2. Generation of HTML attr. value
5698 !!input
5699 <div style={{echo|'color:red;'}}>foo</div>
5700 !!result
5701 <div style="color:red;">foo</div>
5702
5703 !!end
5704
5705 !!test
5706 Templates: HTML Tag: 3. Generation of HTML attr key and value
5707 !!input
5708 <div {{echo|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: 4. Generation of starting piece of HTML attr value
5716 !!input
5717 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5718 !!result
5719 <div title="This is a long title with just one piece templated">foo</div>
5720
5721 !!end
5722
5723 !!test
5724 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5725 !!input
5726 <div title="This is a long title with just {{echo|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: 6. Generation of end piece of HTML attr value
5734 !!input
5735 <div title="This is a long title with just one piece {{echo|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 Tables: 1. Generating start of a HTML table
5743 !!input
5744 {{echo|<table><tr><td>foo</td>}}</tr></table>
5745 !!result
5746 <table><tr><td>foo</td></tr></table>
5747
5748 !!end
5749
5750 !!test
5751 Templates: HTML Tables: 2a. Generating middle of a HTML table
5752 !!input
5753 <table><tr>{{echo|<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: 2b. Generating middle of a HTML table
5761 !!input
5762 <table>{{echo|<tr><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: 3. Generating end of a HTML table
5770 !!input
5771 <table><tr>{{echo|<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: 4a. Generating a single tag of a HTML table
5779 !!input
5780 {{echo|<table>}}<tr><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: 4b. Generating a single tag of a HTML table
5788 !!input
5789 <table>{{echo|<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: 4c. Generating a single tag of a HTML table
5797 !!input
5798 <table><tr>{{echo|<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: 4d. Generating a single tag of a HTML table
5806 !!input
5807 <table><tr><td>foo{{echo|</td>}}</tr></table>
5808 !!result
5809 <table><tr><td>foo</td></tr></table>
5810
5811 !!end
5812
5813 !!test
5814 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5815 !!input
5816 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5817 !!result
5818 <table><tr><td>foo</td></tr></table>
5819
5820 !!end
5821
5822 !!test
5823 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5824 !!input
5825 <table><tr><td>foo</td></tr>{{echo|</table>}}
5826 !!result
5827 <table><tr><td>foo</td></tr></table>
5828
5829 !!end
5830
5831 !!test
5832 Templates: Wiki Tables: 1. Fostering of entire template content
5833 !!input
5834 {|
5835 {{echo|a}}
5836 |}
5837 !!result
5838 <table>
5839 a
5840 <tr><td></td></tr></table>
5841
5842 !!end
5843
5844 !!test
5845 Templates: Wiki Tables: 2. Fostering of partial template content
5846 !!input
5847 {|
5848 {{echo|a
5849 <div>b</div>}}
5850 |}
5851 !!result
5852 <table>
5853 a
5854 <div>b</div>
5855 <tr><td></td></tr></table>
5856
5857 !!end
5858
5859 !!test
5860 Templates: Wiki Tables: 3. td-content via multiple templates
5861 !!input
5862 {|
5863 {{echo|{{pipe}}a}}{{echo|b}}
5864 |}
5865 !!result
5866 <table>
5867 <tr>
5868 <td>ab
5869 </td></tr></table>
5870
5871 !!end
5872
5873 !!test
5874 Templates: Wiki Tables: 4. Templated tags, no content
5875 !!input
5876 {{tbl-start}}
5877 {{tbl-end}}
5878 !!result
5879 <table>
5880 <tr><td></td></tr></table>
5881
5882 !!end
5883
5884 !!test
5885 Templates: Wiki Tables: 4. Templated tags, regular td-tags
5886 !!input
5887 {{tbl-start}}
5888 |foo
5889 {{tbl-end}}
5890 !!result
5891 <table>
5892 <tr>
5893 <td>foo
5894 </td></tr></table>
5895
5896 !!end
5897
5898 !!test
5899 Templates: Wiki Tables: 4. Templated tags, templated td-tags
5900 !!input
5901 {{tbl-start}}
5902 {{!}}foo
5903 {{tbl-end}}
5904 !!result
5905 <table>
5906 <tr>
5907 <td>foo
5908 </td></tr></table>
5909
5910 !!end
5911
5912 !!test
5913 Templates: Lists: Multi-line list-items via templates
5914 !!input
5915 *{{echo|a {{nonexistent|
5916 unused}}}}
5917 *{{echo|b {{nonexistent|
5918 unused}}}}
5919 !!result
5920 <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>
5921 </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>
5922 </li></ul>
5923
5924 !!end
5925
5926 !!test
5927 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5928 !!input
5929 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5930 !!result
5931 <p><i>ab</i>c<i>d</i>e
5932 </p>
5933 !!end
5934
5935 !!test
5936 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5937 (PHP parser generates misnested html)
5938 !! options
5939 disabled
5940 !!input
5941 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5942 !!result
5943 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5944 !!end
5945
5946 !!test
5947 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5948 (PHP parser generates misnested html)
5949 !! options
5950 disabled
5951 !!input
5952 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5953 !!result
5954 <div><i>a</i></div>
5955 <div><i>b</i>c<i>d</i></div>
5956 <div>e</div>
5957 !!end
5958
5959 !!test
5960 Templates: Ugly nesting: 4. Divs opened/closed across templates
5961 !!input
5962 a<div>b{{echo|c</div>d}}e
5963 !!result
5964 a<div>bc</div>de
5965
5966 !!end
5967
5968 !!test
5969 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5970 (Parsoid-centric)
5971 !! options
5972 disabled
5973 !!input
5974 {|
5975 |{{echo|foo</table>}}
5976 |bar
5977 |}
5978 !!result
5979 <table about="#mwt1" typeof="mw:Object/Template ">
5980 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5981 bar</span><span about="#mwt1">
5982 </span>
5983 !!end
5984
5985 !!test
5986 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5987 (Parsoid-centric)
5988 !! options
5989 disabled
5990 !!input
5991 <table>
5992 <tr>
5993 <td>
5994 <table>
5995 <tr>
5996 <td>1. {{echo|foo </table>}}</td>
5997 <td> bar </td>
5998 <td>2. {{echo|baz </table>}}</td>
5999 </tr>
6000 <tr>
6001 <td>abc</td>
6002 </tr>
6003 </table>
6004 </td>
6005 </tr>
6006 <tr>
6007 <td>xyz</td>
6008 </tr>
6009 </table>
6010 !!result
6011 <table about="#mwt1" typeof="mw:Object/Template">
6012 <tbody><tr >
6013 <td >
6014 <table >
6015 <tbody><tr >
6016 <td >1. foo </td></tr></tbody></table></td>
6017 <td > bar </td>
6018 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6019 </span><span about="#mwt1">
6020
6021 abc</span><span about="#mwt1">
6022 </span><span about="#mwt1">
6023 </span><span about="#mwt1">
6024 </span><span about="#mwt1">
6025 </span><span about="#mwt1">
6026
6027 xyz</span><span about="#mwt1">
6028 </span><span about="#mwt1">
6029 </span>
6030 !!end
6031
6032 !! test
6033 Templates: Ugly templates: 3. newline-only template parameter
6034 !! input
6035 foo {{echo|
6036 }}
6037 !! result
6038 <p>foo
6039 </p>
6040 !! end
6041
6042 # This looks like a bug: a single newline triggers p/br for some reason.
6043 !! test
6044 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6045 !! input
6046 {{echo|
6047 }}
6048 !! result
6049 <p><br />
6050 </p>
6051 !! end
6052
6053
6054 !!test
6055 Parser Functions: 1. Simple example
6056 !!input
6057 {{uc:foo}}
6058 !!result
6059 <p>FOO
6060 </p>
6061 !!end
6062
6063 !!test
6064 Parser Functions: 2. Nested use (only outermost should be marked up)
6065 !!input
6066 {{uc:{{lc:FOO}}}}
6067 !!result
6068 <p>FOO
6069 </p>
6070 !!end
6071
6072 ###
6073 ### Pre-save transform tests
6074 ###
6075 !! test
6076 pre-save transform: subst:
6077 !! options
6078 PST
6079 !! input
6080 {{subst:test}}
6081 !! result
6082 This is a test template
6083 !! end
6084
6085 !! test
6086 pre-save transform: normal template
6087 !! options
6088 PST
6089 !! input
6090 {{test}}
6091 !! result
6092 {{test}}
6093 !! end
6094
6095 !! test
6096 pre-save transform: nonexistent template
6097 !! options
6098 PST
6099 !! input
6100 {{thistemplatedoesnotexist}}
6101 !! result
6102 {{thistemplatedoesnotexist}}
6103 !! end
6104
6105
6106 !! test
6107 pre-save transform: subst magic variables
6108 !! options
6109 PST
6110 !! input
6111 {{subst:SITENAME}}
6112 !! result
6113 MediaWiki
6114 !! end
6115
6116 # This is bug 89, which I fixed. -- wtm
6117 !! test
6118 pre-save transform: subst: templates with parameters
6119 !! options
6120 pst
6121 !! input
6122 {{subst:paramtest|param="something else"}}
6123 !! result
6124 This is a test template with parameter "something else"
6125 !! end
6126
6127 !! article
6128 Template:nowikitest
6129 !! text
6130 <nowiki>'''not wiki'''</nowiki>
6131 !! endarticle
6132
6133 !! test
6134 pre-save transform: nowiki in subst (bug 1188)
6135 !! options
6136 pst
6137 !! input
6138 {{subst:nowikitest}}
6139 !! result
6140 <nowiki>'''not wiki'''</nowiki>
6141 !! end
6142
6143
6144 !! article
6145 Template:commenttest
6146 !! text
6147 This template has <!-- a comment --> in it.
6148 !! endarticle
6149
6150 !! test
6151 pre-save transform: comment in subst (bug 1936)
6152 !! options
6153 pst
6154 !! input
6155 {{subst:commenttest}}
6156 !! result
6157 This template has <!-- a comment --> in it.
6158 !! end
6159
6160 !! test
6161 pre-save transform: unclosed tag
6162 !! options
6163 pst noxml
6164 !! input
6165 <nowiki>'''not wiki'''
6166 !! result
6167 <nowiki>'''not wiki'''
6168 !! end
6169
6170 !! test
6171 pre-save transform: mixed tag case
6172 !! options
6173 pst noxml
6174 !! input
6175 <NOwiki>'''not wiki'''</noWIKI>
6176 !! result
6177 <NOwiki>'''not wiki'''</noWIKI>
6178 !! end
6179
6180 !! test
6181 pre-save transform: unclosed comment in <nowiki>
6182 !! options
6183 pst noxml
6184 !! input
6185 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6186 !! result
6187 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6188 !!end
6189
6190 !! article
6191 Template:dangerous
6192 !!text
6193 <span onmouseover="alert('crap')">Oh no</span>
6194 !!endarticle
6195
6196 !!test
6197 (confirming safety of fix for subst bug 1936)
6198 !! input
6199 {{Template:dangerous}}
6200 !! result
6201 <p><span>Oh no</span>
6202 </p>
6203 !! end
6204
6205 !! test
6206 pre-save transform: comment containing gallery (bug 5024)
6207 !! options
6208 pst
6209 !! input
6210 <!-- <gallery>data</gallery> -->
6211 !!result
6212 <!-- <gallery>data</gallery> -->
6213 !!end
6214
6215 !! test
6216 pre-save transform: comment containing extension
6217 !! options
6218 pst
6219 !! input
6220 <!-- <tag>data</tag> -->
6221 !!result
6222 <!-- <tag>data</tag> -->
6223 !!end
6224
6225 !! test
6226 pre-save transform: comment containing nowiki
6227 !! options
6228 pst
6229 !! input
6230 <!-- <nowiki>data</nowiki> -->
6231 !!result
6232 <!-- <nowiki>data</nowiki> -->
6233 !!end
6234
6235 !! test
6236 pre-save transform: <noinclude> in subst (bug 3298)
6237 !! options
6238 pst
6239 !! input
6240 {{subst:Includes}}
6241 !! result
6242 Foobar
6243 !! end
6244
6245 !! test
6246 pre-save transform: <onlyinclude> in subst (bug 3298)
6247 !! options
6248 pst
6249 !! input
6250 {{subst:Includes2}}
6251 !! result
6252 Foo
6253 !! end
6254
6255 !! article
6256 Template:SubstTest
6257 !!text
6258 {{<includeonly>subst:</includeonly>Includes}}
6259 !! endarticle
6260
6261 !! article
6262 Template:SafeSubstTest
6263 !! text
6264 {{<includeonly>safesubst:</includeonly>Includes}}
6265 !! endarticle
6266
6267 !! test
6268 bug 22297: safesubst: works during PST
6269 !! options
6270 pst
6271 !! input
6272 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6273 !! result
6274 FoobarFoobar
6275 !! end
6276
6277 !! test
6278 bug 22297: safesubst: works during normal parse
6279 !! input
6280 {{SafeSubstTest}}
6281 !! result
6282 <p>Foobar
6283 </p>
6284 !! end
6285
6286 !! test:
6287 subst: does not work during normal parse
6288 !! input
6289 {{SubstTest}}
6290 !! result
6291 <p>{{subst:Includes}}
6292 </p>
6293 !! end
6294
6295 !! test
6296 pre-save transform: context links ("pipe trick")
6297 !! options
6298 pst
6299 !! input
6300 [[Article (context)|]]
6301 [[Bar:Article|]]
6302 [[:Bar:Article|]]
6303 [[Bar:Article (context)|]]
6304 [[:Bar:Article (context)|]]
6305 [[|Article]]
6306 [[|Article (context)]]
6307 [[Bar:X (Y) Z|]]
6308 [[:Bar:X (Y) Z|]]
6309 !! result
6310 [[Article (context)|Article]]
6311 [[Bar:Article|Article]]
6312 [[:Bar:Article|Article]]
6313 [[Bar:Article (context)|Article]]
6314 [[:Bar:Article (context)|Article]]
6315 [[Article]]
6316 [[Article (context)]]
6317 [[Bar:X (Y) Z|X (Y) Z]]
6318 [[:Bar:X (Y) Z|X (Y) Z]]
6319 !! end
6320
6321 !! test
6322 pre-save transform: context links ("pipe trick") with interwiki prefix
6323 !! options
6324 pst
6325 !! input
6326 [[interwiki:Article|]]
6327 [[:interwiki:Article|]]
6328 [[interwiki:Bar:Article|]]
6329 [[:interwiki:Bar:Article|]]
6330 !! result
6331 [[interwiki:Article|Article]]
6332 [[:interwiki:Article|Article]]
6333 [[interwiki:Bar:Article|Bar:Article]]
6334 [[:interwiki:Bar:Article|Bar:Article]]
6335 !! end
6336
6337 !! test
6338 pre-save transform: context links ("pipe trick") with parens in title
6339 !! options
6340 pst title=[[Somearticle (context)]]
6341 !! input
6342 [[|Article]]
6343 !! result
6344 [[Article (context)|Article]]
6345 !! end
6346
6347 !! test
6348 pre-save transform: context links ("pipe trick") with comma in title
6349 !! options
6350 pst title=[[Someplace, Somewhere]]
6351 !! input
6352 [[|Otherplace]]
6353 [[Otherplace, Elsewhere|]]
6354 [[Otherplace, Elsewhere, Anywhere|]]
6355 !! result
6356 [[Otherplace, Somewhere|Otherplace]]
6357 [[Otherplace, Elsewhere|Otherplace]]
6358 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6359 !! end
6360
6361 !! test
6362 pre-save transform: context links ("pipe trick") with parens and comma
6363 !! options
6364 pst title=[[Someplace (IGNORED), Somewhere]]
6365 !! input
6366 [[|Otherplace]]
6367 [[Otherplace (place), Elsewhere|]]
6368 !! result
6369 [[Otherplace, Somewhere|Otherplace]]
6370 [[Otherplace (place), Elsewhere|Otherplace]]
6371 !! end
6372
6373 !! test
6374 pre-save transform: context links ("pipe trick") with comma and parens
6375 !! options
6376 pst title=[[Who, me? (context)]]
6377 !! input
6378 [[|Yes, you.]]
6379 [[Me, Myself, and I (1937 song)|]]
6380 !! result
6381 [[Yes, you. (context)|Yes, you.]]
6382 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6383 !! end
6384
6385 !! test
6386 pre-save transform: context links ("pipe trick") with namespace
6387 !! options
6388 pst title=[[Ns:Somearticle]]
6389 !! input
6390 [[|Article]]
6391 !! result
6392 [[Ns:Article|Article]]
6393 !! end
6394
6395 !! test
6396 pre-save transform: context links ("pipe trick") with namespace and parens
6397 !! options
6398 pst title=[[Ns:Somearticle (context)]]
6399 !! input
6400 [[|Article]]
6401 !! result
6402 [[Ns:Article (context)|Article]]
6403 !! end
6404
6405 !! test
6406 pre-save transform: context links ("pipe trick") with namespace and comma
6407 !! options
6408 pst title=[[Ns:Somearticle, Context, Whatever]]
6409 !! input
6410 [[|Article]]
6411 !! result
6412 [[Ns:Article, Context, Whatever|Article]]
6413 !! end
6414
6415 !! test
6416 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6417 !! options
6418 pst title=[[Ns:Somearticle, Context (context)]]
6419 !! input
6420 [[|Article]]
6421 !! result
6422 [[Ns:Article (context)|Article]]
6423 !! end
6424
6425 !! test
6426 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6427 !! options
6428 pst title=[[Ns:Somearticle (IGNORED), Context]]
6429 !! input
6430 [[|Article]]
6431 !! result
6432 [[Ns:Article, Context|Article]]
6433 !! end
6434
6435 !! test
6436 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6437 !! options
6438 pst
6439 !! input
6440 [[Article(context)|]]
6441 [[Bar:Article(context)|]]
6442 [[:Bar:Article(context)|]]
6443 [[|Article(context)]]
6444 [[Bar:X(Y)Z|]]
6445 [[:Bar:X(Y)Z|]]
6446 !! result
6447 [[Article(context)|Article]]
6448 [[Bar:Article(context)|Article]]
6449 [[:Bar:Article(context)|Article]]
6450 [[Article(context)]]
6451 [[Bar:X(Y)Z|X(Y)Z]]
6452 [[:Bar:X(Y)Z|X(Y)Z]]
6453 !! end
6454
6455 !! test
6456 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6457 !! options
6458 pst
6459 !! input
6460 [[Article (context)|]]
6461 [[Bar:Article (context)|]]
6462 [[:Bar:Article (context)|]]
6463 [[|Article (context)]]
6464 [[Bar:X (Y) Z|]]
6465 [[:Bar:X (Y) Z|]]
6466 !! result
6467 [[Article (context)|Article]]
6468 [[Bar:Article (context)|Article]]
6469 [[:Bar:Article (context)|Article]]
6470 [[Article (context)]]
6471 [[Bar:X (Y) Z|X (Y) Z]]
6472 [[:Bar:X (Y) Z|X (Y) Z]]
6473 !! end
6474
6475 !! test
6476 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6477 !! options
6478 pst
6479 !! input
6480 [[Article(context)|]]
6481 [[Bar:Article(context)|]]
6482 [[:Bar:Article(context)|]]
6483 [[|Article(context)]]
6484 [[Bar:X(Y)Z|]]
6485 [[:Bar:X(Y)Z|]]
6486 !! result
6487 [[Article(context)|Article]]
6488 [[Bar:Article(context)|Article]]
6489 [[:Bar:Article(context)|Article]]
6490 [[Article(context)]]
6491 [[Bar:X(Y)Z|X(Y)Z]]
6492 [[:Bar:X(Y)Z|X(Y)Z]]
6493 !! end
6494
6495 !! test
6496 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6497 !! options
6498 pst
6499 !! input
6500 [[Article (context), context|]]
6501 [[Article (context),context|]]
6502 [[Bar:Article (context), context|]]
6503 [[Bar:Article (context),context|]]
6504 [[:Bar:Article (context), context|]]
6505 [[:Bar:Article (context),context|]]
6506 !! result
6507 [[Article (context), context|Article]]
6508 [[Article (context),context|Article]]
6509 [[Bar:Article (context), context|Article]]
6510 [[Bar:Article (context),context|Article]]
6511 [[:Bar:Article (context), context|Article]]
6512 [[:Bar:Article (context),context|Article]]
6513 !! end
6514
6515 !! test
6516 pre-save transform: trim trailing empty lines
6517 !! options
6518 pst
6519 !! input
6520 Empty lines are trimmed
6521
6522
6523
6524
6525 !! result
6526 Empty lines are trimmed
6527 !! end
6528
6529 !! test
6530 pre-save transform: Signature expansion
6531 !! options
6532 pst
6533 !! input
6534 * ~~~
6535 * <noinclude>~~~</noinclude>
6536 * <includeonly>~~~</includeonly>
6537 * <onlyinclude>~~~</onlyinclude>
6538 !! result
6539 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6540 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6541 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6542 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6543 !! end
6544
6545
6546 !! test
6547 pre-save transform: Signature expansion in nowiki tags (bug 93)
6548 !! options
6549 pst disabled
6550 !! input
6551 Shall not expand:
6552
6553 <nowiki>~~~~</nowiki>
6554
6555 <includeonly><nowiki>~~~~</nowiki></includeonly>
6556
6557 <noinclude><nowiki>~~~~</nowiki></noinclude>
6558
6559 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6560
6561 {{subst:Foo}} shall be converted to FOO
6562
6563 As well as inside noinclude/onlyinclude
6564 <noinclude>{{subst:Foo}}</noinclude>
6565 <onlyinclude>{{subst:Foo}}</onlyinclude>
6566
6567 But not inside includeonly
6568 <includeonly>{{subst:Foo}}</includeonly>
6569 !! result
6570 Shall not expand:
6571
6572 <nowiki>~~~~</nowiki>
6573
6574 <includeonly><nowiki>~~~~</nowiki></includeonly>
6575
6576 <noinclude><nowiki>~~~~</nowiki></noinclude>
6577
6578 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6579
6580 FOO shall be converted to FOO
6581
6582 As well as inside noinclude/onlyinclude
6583 <noinclude>FOO</noinclude>
6584 <onlyinclude>FOO</onlyinclude>
6585
6586 But not inside includeonly
6587 <includeonly>{{subst:Foo}}</includeonly>
6588 !! end
6589
6590 ###
6591 ### Message transform tests
6592 ###
6593 !! test
6594 message transform: magic variables
6595 !! options
6596 msg
6597 !! input
6598 {{SITENAME}}
6599 !! result
6600 MediaWiki
6601 !! end
6602
6603 !! test
6604 message transform: should not transform wiki markup
6605 !! options
6606 msg
6607 !! input
6608 ''test''
6609 !! result
6610 ''test''
6611 !! end
6612
6613 !! test
6614 message transform: <noinclude> in transcluded template (bug 4926)
6615 !! options
6616 msg
6617 !! input
6618 {{Includes}}
6619 !! result
6620 Foobar
6621 !! end
6622
6623 !! test
6624 message transform: <onlyinclude> in transcluded template (bug 4926)
6625 !! options
6626 msg
6627 !! input
6628 {{Includes2}}
6629 !! result
6630 Foo
6631 !! end
6632
6633 !! test
6634 {{#special:}} page name, known
6635 !! options
6636 msg
6637 !! input
6638 {{#special:Recentchanges}}
6639 !! result
6640 Special:RecentChanges
6641 !! end
6642
6643 !! test
6644 {{#special:}} page name with subpage, known
6645 !! options
6646 msg
6647 !! input
6648 {{#special:Recentchanges/param}}
6649 !! result
6650 Special:RecentChanges/param
6651 !! end
6652
6653 !! test
6654 {{#special:}} page name, unknown
6655 !! options
6656 msg
6657 !! input
6658 {{#special:foobarnonexistent}}
6659 !! result
6660 No such special page
6661 !! end
6662
6663 !! test
6664 {{#speciale:}} page name, known
6665 !! options
6666 msg
6667 !! input
6668 {{#speciale:Recentchanges}}
6669 !! result
6670 Special:RecentChanges
6671 !! end
6672
6673 !! test
6674 {{#speciale:}} page name with subpage, known
6675 !! options
6676 msg
6677 !! input
6678 {{#speciale:Recentchanges/param}}
6679 !! result
6680 Special:RecentChanges/param
6681 !! end
6682
6683 !! test
6684 {{#speciale:}} page name, unknown
6685 !! options
6686 msg
6687 !! input
6688 {{#speciale:foobarnonexistent}}
6689 !! result
6690 No_such_special_page
6691 !! end
6692
6693 ###
6694 ### Images
6695 ###
6696 !! test
6697 Simple image
6698 !! input
6699 [[Image:foobar.jpg]]
6700 !! result
6701 <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>
6702 </p>
6703 !! end
6704
6705 !! test
6706 Right-aligned image
6707 !! input
6708 [[Image:foobar.jpg|right]]
6709 !! result
6710 <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>
6711
6712 !! end
6713
6714 !! test
6715 Simple image (using File: namespace, now canonical)
6716 !! input
6717 [[File:foobar.jpg]]
6718 !! result
6719 <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>
6720 </p>
6721 !! end
6722
6723 !! test
6724 Image with caption
6725 !! input
6726 [[Image:foobar.jpg|right|Caption text]]
6727 !! result
6728 <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>
6729
6730 !! end
6731
6732 !! test
6733 Image with empty attribute
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 link tails
6743 !! input
6744 123[[Image:foobar.jpg]]456
6745 123[[Image:foobar.jpg|right]]456
6746 123[[Image:foobar.jpg|thumb]]456
6747 !! result
6748 <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
6749 </p>
6750 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
6751 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
6752
6753 !! end
6754
6755 !! test
6756 Image with multiple captions -- only last one is accepted
6757 !! input
6758 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6759 !! result
6760 <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>
6761
6762 !! end
6763
6764 !! test
6765 Image with width attribute at different positions
6766 !! input
6767 [[Image:foobar.jpg|200px|right|Caption]]
6768 [[Image:foobar.jpg|right|200px|Caption]]
6769 [[Image:foobar.jpg|right|Caption|200px]]
6770 !! result
6771 <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>
6772 <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>
6773 <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>
6774
6775 !! end
6776
6777 !! test
6778 Image with link parameter, wiki target
6779 !! input
6780 [[Image:foobar.jpg|link=Target page]]
6781 !! result
6782 <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>
6783 </p>
6784 !! end
6785
6786 !! test
6787 Image with link parameter, URL target
6788 !! input
6789 [[Image:foobar.jpg|link=http://example.com/]]
6790 !! result
6791 <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>
6792 </p>
6793 !! end
6794
6795 !! test
6796 Image with link parameter, wgExternalLinkTarget
6797 !! input
6798 [[Image:foobar.jpg|link=http://example.com/]]
6799 !! config
6800 wgExternalLinkTarget='foobar'
6801 !! result
6802 <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>
6803 </p>
6804 !! end
6805
6806 !! test
6807 Image with link parameter, wgNoFollowLinks set to false
6808 !! input
6809 [[Image:foobar.jpg|link=http://example.com/]]
6810 !! config
6811 wgNoFollowLinks=false
6812 !! result
6813 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6814 </p>
6815 !! end
6816
6817 !! test
6818 Image with link parameter, wgNoFollowDomainExceptions
6819 !! input
6820 [[Image:foobar.jpg|link=http://example.com/]]
6821 !! config
6822 wgNoFollowDomainExceptions='example.com'
6823 !! result
6824 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6825 </p>
6826 !! end
6827
6828 !! test
6829 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6830 !! input
6831 [[Image:foobar.jpg|link=http://example.com/|Title]]
6832 !! config
6833 wgExternalLinkTarget='foobar'
6834 !! result
6835 <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>
6836 </p>
6837 !! end
6838
6839 !! test
6840 Image with empty link parameter
6841 !! input
6842 [[Image:foobar.jpg|link=]]
6843 !! result
6844 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6845 </p>
6846 !! end
6847
6848 !! test
6849 Image with link parameter (wiki target) and unnamed parameter
6850 !! input
6851 [[Image:foobar.jpg|link=Target page|Title]]
6852 !! result
6853 <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>
6854 </p>
6855 !! end
6856
6857 !! test
6858 Image with link parameter (URL target) and unnamed parameter
6859 !! input
6860 [[Image:foobar.jpg|link=http://example.com/|Title]]
6861 !! result
6862 <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>
6863 </p>
6864 !! end
6865
6866 !! test
6867 Thumbnail image with link parameter
6868 !! input
6869 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6870 !! result
6871 <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>
6872
6873 !! end
6874
6875 !! test
6876 Image with frame and link
6877 !! input
6878 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6879 !! result
6880 <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>
6881
6882 !! end
6883
6884 !! test
6885 Image with frame and link and explicit alt
6886 !! input
6887 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6888 !! result
6889 <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>
6890
6891 !! end
6892
6893 !! test
6894 Image with wiki markup in implicit alt
6895 !! input
6896 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6897 !! result
6898 <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>
6899 </p>
6900 !! end
6901
6902 !! test
6903 Image with wiki markup in explicit alt
6904 !! input
6905 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6906 !! result
6907 <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>
6908 </p>
6909 !! end
6910
6911 !! test
6912 Link to image page- image page normally doesn't exists, hence edit link
6913 Add test with existing image page
6914 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6915 !! input
6916 [[:Image:test]]
6917 !! result
6918 <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>
6919 </p>
6920 !! end
6921
6922 !! test
6923 bug 18784 Link to non-existent image page with caption should use caption as link text
6924 !! input
6925 [[:Image:test|caption]]
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)">caption</a>
6928 </p>
6929 !! end
6930
6931 !! test
6932 Frameless image caption with a free URL
6933 !! input
6934 [[Image:foobar.jpg|http://example.com]]
6935 !! result
6936 <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>
6937 </p>
6938 !! end
6939
6940 !! test
6941 Thumbnail image caption with a free URL
6942 !! input
6943 [[Image:foobar.jpg|thumb|http://example.com]]
6944 !! result
6945 <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>
6946
6947 !! end
6948
6949 !! test
6950 Thumbnail image caption with a free URL and explicit alt
6951 !! input
6952 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6953 !! result
6954 <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>
6955
6956 !! end
6957
6958 !! test
6959 BUG 1887: A ISBN with a thumbnail
6960 !! input
6961 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6962 !! result
6963 <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>
6964
6965 !! end
6966
6967 !! test
6968 BUG 1887: A RFC with a thumbnail
6969 !! input
6970 [[Image:foobar.jpg|thumb|This is RFC 12354]]
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>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
6973
6974 !! end
6975
6976 !! test
6977 BUG 1887: A mailto link with a thumbnail
6978 !! input
6979 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
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>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
6982
6983 !! end
6984
6985 # Pending resolution to bug 368
6986 !! test
6987 BUG 648: Frameless image caption with a link
6988 !! input
6989 [[Image:foobar.jpg|text with a [[link]] in it]]
6990 !! result
6991 <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>
6992 </p>
6993 !! end
6994
6995 !! test
6996 BUG 648: Frameless image caption with a link (suffix)
6997 !! input
6998 [[Image:foobar.jpg|text with a [[link]]foo in it]]
6999 !! result
7000 <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>
7001 </p>
7002 !! end
7003
7004 !! test
7005 BUG 648: Frameless image caption with an interwiki link
7006 !! input
7007 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7008 !! result
7009 <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>
7010 </p>
7011 !! end
7012
7013 !! test
7014 BUG 648: Frameless image caption with a piped interwiki link
7015 !! input
7016 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7017 !! result
7018 <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>
7019 </p>
7020 !! end
7021
7022 !! test
7023 Escape HTML special chars in image alt text
7024 !! input
7025 [[Image:foobar.jpg|& < > "]]
7026 !! result
7027 <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>
7028 </p>
7029 !! end
7030
7031 !! test
7032 BUG 499: Alt text should have &#1234;, not &amp;1234;
7033 !! input
7034 [[Image:foobar.jpg|&#9792;]]
7035 !! result
7036 <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>
7037 </p>
7038 !! end
7039
7040 !! test
7041 Broken image caption with link
7042 !! input
7043 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7044 !! result
7045 <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.
7046 </p>
7047 !! end
7048
7049 !! test
7050 Image caption containing another image
7051 !! input
7052 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7053 !! result
7054 <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>
7055
7056 !! end
7057
7058 !! test
7059 Image caption containing a newline
7060 !! input
7061 [[Image:Foobar.jpg|This
7062 *is some text]]
7063 !! result
7064 <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>
7065 </p>
7066 !!end
7067
7068 !!test
7069 Parsoid: Image caption containing leading space
7070 (The leading space should not trigger nowiki escaping in wt2wt mode)
7071 !! input
7072 [[Image:Foobar.jpg|thumb| bar]]
7073 !! result
7074 <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>
7075
7076 !!end
7077
7078 !! test
7079 Bug 3090: External links other than http: in image captions
7080 !! input
7081 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7082 !! result
7083 <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>
7084
7085 !! end
7086
7087 !! test
7088 Custom class
7089 !! input
7090 [[Image:foobar.jpg|a|class=b]]
7091 !! result
7092 <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>
7093 </p>
7094 !! end
7095
7096 !! article
7097 File:Barfoo.jpg
7098 !! text
7099 #REDIRECT [[File:Barfoo.jpg]]
7100 !! endarticle
7101
7102 !! test
7103 Redirected image
7104 !! input
7105 [[Image:Barfoo.jpg]]
7106 !! result
7107 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7108 </p>
7109 !! end
7110
7111 !! test
7112 Missing image with uploads disabled
7113 !! options
7114 wgEnableUploads=0
7115 !! input
7116 [[Image:Foobaz.jpg]]
7117 !! result
7118 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7119 </p>
7120 !! end
7121
7122
7123 ###
7124 ### Subpages
7125 ###
7126 !! article
7127 Subpage test/subpage
7128 !! text
7129 foo
7130 !! endarticle
7131
7132 !! test
7133 Subpage link
7134 !! options
7135 subpage title=[[Subpage test]]
7136 !! input
7137 [[/subpage]]
7138 !! result
7139 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7140 </p>
7141 !! end
7142
7143 !! test
7144 Subpage noslash link
7145 !! options
7146 subpage title=[[Subpage test]]
7147 !!input
7148 [[/subpage/]]
7149 !! result
7150 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7151 </p>
7152 !! end
7153
7154 !! test
7155 Disabled subpages
7156 !! input
7157 [[/subpage]]
7158 !! result
7159 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7160 </p>
7161 !! end
7162
7163 !! test
7164 BUG 561: {{/Subpage}}
7165 !! options
7166 subpage title=[[Page]]
7167 !! input
7168 {{/Subpage}}
7169 !! result
7170 <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>
7171 </p>
7172 !! end
7173
7174 ###
7175 ### Categories
7176 ###
7177 !! article
7178 Category:MediaWiki User's Guide
7179 !! text
7180 blah
7181 !! endarticle
7182
7183 !! test
7184 Link to category
7185 !! input
7186 [[:Category:MediaWiki User's Guide]]
7187 !! result
7188 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7189 </p>
7190 !! end
7191
7192 !! test
7193 Simple category
7194 !! options
7195 cat
7196 !! input
7197 [[Category:MediaWiki User's Guide]]
7198 !! result
7199 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7200 !! end
7201
7202 !! test
7203 PAGESINCATEGORY invalid title fatal (r33546 fix)
7204 !! input
7205 {{PAGESINCATEGORY:<bogus>}}
7206 !! result
7207 <p>0
7208 </p>
7209 !! end
7210
7211 !! test
7212 Category with different sort key
7213 !! options
7214 cat
7215 !! input
7216 [[Category:MediaWiki User's Guide|Foo]]
7217 !! result
7218 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7219 !! end
7220
7221 !! test
7222 Category with identical sort key
7223 !! options
7224 cat
7225 !! input
7226 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7227 !! result
7228 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7229 !! end
7230
7231 !! test
7232 Category with empty sort key
7233 !! options
7234 cat
7235 pst
7236 !! input
7237 [[Category:MediaWiki User's Guide|]]
7238 !! result
7239 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7240 !! end
7241
7242 !! test
7243 Category with empty sort key and parentheses
7244 !! options
7245 cat
7246 pst
7247 !! input
7248 [[Category:Foo (bar)|]]
7249 !! result
7250 [[Category:Foo (bar)|Foo]]
7251 !! end
7252
7253 !! test
7254 Category with link tail
7255 !! options
7256 cat
7257 pst
7258 !! input
7259 123[[Category:Foo]]456
7260 !! result
7261 123[[Category:Foo]]456
7262 !! end
7263
7264 !! test
7265 Category with template
7266 !! options
7267 cat
7268 pst
7269 !! input
7270 [[Category:{{echo|Foo}}]]
7271 !! result
7272 [[Category:{{echo|Foo}}]]
7273 !! end
7274
7275 !! test
7276 Category with template in sort key
7277 !! options
7278 cat
7279 pst
7280 !! input
7281 [[Category:Foo|{{echo|Bar}}]]
7282 !! result
7283 [[Category:Foo|{{echo|Bar}}]]
7284 !! end
7285
7286 !! test
7287 Category with template in sort key and title
7288 !! options
7289 cat
7290 pst
7291 !! input
7292 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7293 !! result
7294 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7295 !! end
7296
7297 !! test
7298 Category / paragraph interactions
7299 !! input
7300 Foo [[Category:Baz]] Bar
7301
7302 Foo [[Category:Baz]]
7303 Bar
7304
7305 Foo
7306 [[Category:Baz]]
7307 Bar
7308
7309 Foo
7310 [[Category:Baz]] Bar
7311
7312 Foo
7313 [[Category:Baz]]
7314 [[Category:Baz]]
7315 [[Category:Baz]]
7316 Bar
7317
7318 [[Category:Baz]]
7319 [[Category:Baz]]
7320 [[Category:Baz]]
7321
7322 [[Category:Baz]]
7323 {{echo|[[Category:Baz]]}}
7324 [[Category:Baz]]
7325 !! result
7326 <p>Foo Bar
7327 </p><p>Foo
7328 Bar
7329 </p><p>Foo
7330 Bar
7331 </p><p>Foo Bar
7332 </p><p>Foo
7333 Bar
7334 </p>
7335 !! end
7336
7337 ###
7338 ### Inter-language links
7339 ###
7340 !! test
7341 Inter-language links
7342 !! options
7343 ill
7344 !! input
7345 [[es:Alimento]]
7346 [[fr:Nourriture]]
7347 [[zh:&#39135;&#21697;]]
7348 !! result
7349 es:Alimento fr:Nourriture zh:食品
7350 !! end
7351
7352 !! test
7353 Duplicate interlanguage links (bug 24502)
7354 !! options
7355 ill
7356 !! input
7357 [[es:1]]
7358 [[es:2]]
7359 [[fr:1]]
7360 [[fr:2]]
7361 !! result
7362 es:1 fr:1
7363 !! end
7364
7365 ###
7366 ### Sections
7367 ###
7368 !! test
7369 Basic section headings
7370 !! input
7371 == Headline 1 ==
7372 Some text
7373
7374 ==Headline 2==
7375 More
7376 ===Smaller headline===
7377 Blah blah
7378 !! result
7379 <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>
7380 <p>Some text
7381 </p>
7382 <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>
7383 <p>More
7384 </p>
7385 <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>
7386 <p>Blah blah
7387 </p>
7388 !! end
7389
7390 !! test
7391 Section headings with TOC
7392 !! input
7393 == Headline 1 ==
7394 === Subheadline 1 ===
7395 ===== Skipping a level =====
7396 ====== Skipping a level ======
7397
7398 == Headline 2 ==
7399 Some text
7400 ===Another headline===
7401 !! result
7402 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7403 <ul>
7404 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7405 <ul>
7406 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7407 <ul>
7408 <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>
7409 <ul>
7410 <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>
7411 </ul>
7412 </li>
7413 </ul>
7414 </li>
7415 </ul>
7416 </li>
7417 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7418 <ul>
7419 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7420 </ul>
7421 </li>
7422 </ul>
7423 </td></tr></table>
7424 <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>
7425 <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>
7426 <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>
7427 <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>
7428 <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>
7429 <p>Some text
7430 </p>
7431 <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>
7432
7433 !! end
7434
7435 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7436 !! test
7437 Handling of sections up to level 6 and beyond
7438 !! input
7439 = Level 1 Heading=
7440 == Level 2 Heading==
7441 === Level 3 Heading===
7442 ==== Level 4 Heading====
7443 ===== Level 5 Heading=====
7444 ====== Level 6 Heading======
7445 ======= Level 7 Heading=======
7446 ======== Level 8 Heading========
7447 ========= Level 9 Heading=========
7448 ========== Level 10 Heading==========
7449 !! result
7450 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7451 <ul>
7452 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7453 <ul>
7454 <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>
7455 <ul>
7456 <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>
7457 <ul>
7458 <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>
7459 <ul>
7460 <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>
7461 <ul>
7462 <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>
7463 <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>
7464 <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>
7465 <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>
7466 <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>
7467 </ul>
7468 </li>
7469 </ul>
7470 </li>
7471 </ul>
7472 </li>
7473 </ul>
7474 </li>
7475 </ul>
7476 </li>
7477 </ul>
7478 </td></tr></table>
7479 <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>
7480 <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>
7481 <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>
7482 <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>
7483 <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>
7484 <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>
7485 <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>
7486 <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>
7487 <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>
7488 <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>
7489
7490 !! end
7491
7492 !! test
7493 TOC regression (bug 9764)
7494 !! input
7495 == title 1 ==
7496 === title 1.1 ===
7497 ==== title 1.1.1 ====
7498 === title 1.2 ===
7499 == title 2 ==
7500 === title 2.1 ===
7501 !! result
7502 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7503 <ul>
7504 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7505 <ul>
7506 <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>
7507 <ul>
7508 <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>
7509 </ul>
7510 </li>
7511 <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>
7512 </ul>
7513 </li>
7514 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7515 <ul>
7516 <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>
7517 </ul>
7518 </li>
7519 </ul>
7520 </td></tr></table>
7521 <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>
7522 <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>
7523 <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>
7524 <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>
7525 <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>
7526 <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>
7527
7528 !! end
7529
7530 !! test
7531 TOC with wgMaxTocLevel=3 (bug 6204)
7532 !! options
7533 wgMaxTocLevel=3
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></li>
7547 <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>
7548 </ul>
7549 </li>
7550 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7551 <ul>
7552 <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>
7553 </ul>
7554 </li>
7555 </ul>
7556 </td></tr></table>
7557 <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>
7558 <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>
7559 <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>
7560 <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>
7561 <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>
7562 <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>
7563
7564 !! end
7565
7566 !! test
7567 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7568 !! options
7569 wgMaxTocLevel=3
7570 !! input
7571 ==Section 1==
7572 ===Section 1.1===
7573 ====Section 1.1.1====
7574 ====Section 1.1.1.1====
7575 ==Section 2==
7576 !! result
7577 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7578 <ul>
7579 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7580 <ul>
7581 <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>
7582 </ul>
7583 </li>
7584 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7585 </ul>
7586 </td></tr></table>
7587 <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>
7588 <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>
7589 <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>
7590 <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>
7591 <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>
7592
7593 !! end
7594
7595
7596 !! test
7597 Resolving duplicate section names
7598 !! input
7599 == Foo bar ==
7600 == Foo bar ==
7601 !! result
7602 <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>
7603 <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>
7604
7605 !! end
7606
7607 !! test
7608 Resolving duplicate section names with differing case (bug 10721)
7609 !! input
7610 == Foo bar ==
7611 == Foo Bar ==
7612 !! result
7613 <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>
7614 <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>
7615
7616 !! end
7617
7618 !! article
7619 Template:sections
7620 !! text
7621 ===Section 1===
7622 ==Section 2==
7623 !! endarticle
7624
7625 !! test
7626 Template with sections, __NOTOC__
7627 !! input
7628 __NOTOC__
7629 ==Section 0==
7630 {{sections}}
7631 ==Section 4==
7632 !! result
7633 <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>
7634 <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>
7635 <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>
7636 <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>
7637
7638 !! end
7639
7640 !! test
7641 __NOEDITSECTION__ keyword
7642 !! input
7643 __NOEDITSECTION__
7644 ==Section 1==
7645 ==Section 2==
7646 !! result
7647 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7648 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7649
7650 !! end
7651
7652 !! test
7653 Link inside a section heading
7654 !! input
7655 ==Section with a [[Main Page|link]] in it==
7656 !! result
7657 <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>
7658
7659 !! end
7660
7661 !! test
7662 TOC regression (bug 12077)
7663 !! input
7664 __TOC__
7665 == title 1 ==
7666 === title 1.1 ===
7667 == title 2 ==
7668 !! result
7669 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7670 <ul>
7671 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7672 <ul>
7673 <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>
7674 </ul>
7675 </li>
7676 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7677 </ul>
7678 </td></tr></table>
7679 <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>
7680 <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>
7681 <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>
7682
7683 !! end
7684
7685 !! test
7686 BUG 1219 URL next to image (good)
7687 !! input
7688 http://example.com [[Image:foobar.jpg]]
7689 !! result
7690 <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>
7691 </p>
7692 !!end
7693
7694 !! test
7695 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
7696 !! input
7697 ===
7698 The line above must have a trailing space!
7699 === <!--
7700 --> <!-- -->
7701 But just in case it doesn't...
7702 !! result
7703 <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>
7704 <p>The line above must have a trailing space!
7705 </p>
7706 <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>
7707 <p>But just in case it doesn't...
7708 </p>
7709 !! end
7710
7711 !! test
7712 Header with special characters (bug 25462)
7713 !! input
7714 The tooltips shall not show entities to the user (ie. be double escaped)
7715
7716 == text > text ==
7717 section 1
7718
7719 == text < text ==
7720 section 2
7721
7722 == text & text ==
7723 section 3
7724
7725 == text ' text ==
7726 section 4
7727
7728 == text " text ==
7729 section 5
7730 !! result
7731 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7732 </p>
7733 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7734 <ul>
7735 <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>
7736 <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>
7737 <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>
7738 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7739 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7740 </ul>
7741 </td></tr></table>
7742 <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>
7743 <p>section 1
7744 </p>
7745 <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>
7746 <p>section 2
7747 </p>
7748 <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>
7749 <p>section 3
7750 </p>
7751 <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>
7752 <p>section 4
7753 </p>
7754 <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>
7755 <p>section 5
7756 </p>
7757 !! end
7758
7759 !! test
7760 Headers with excess '=' characters
7761 (Are similar tests necessary beyond the 1st level?)
7762 !! input
7763 =foo==
7764 ==foo=
7765 =''italic'' heading==
7766 ==''italic'' heading=
7767 !! result
7768 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7769 <ul>
7770 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7771 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7772 <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>
7773 <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>
7774 </ul>
7775 </td></tr></table>
7776 <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>
7777 <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>
7778 <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>
7779 <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>
7780
7781 !! end
7782
7783 !! test
7784 BUG 1219 URL next to image (broken)
7785 !! input
7786 http://example.com[[Image:foobar.jpg]]
7787 !! result
7788 <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>
7789 </p>
7790 !!end
7791
7792 !! test
7793 Bug 1186 news: in the middle of text
7794 !! input
7795 http://en.wikinews.org/wiki/Wikinews:Workplace
7796 !! result
7797 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7798 </p>
7799 !!end
7800
7801
7802 !! test
7803 Namespaced link must have a title
7804 !! input
7805 [[Project:]]
7806 !! result
7807 <p>[[Project:]]
7808 </p>
7809 !!end
7810
7811 !! test
7812 Namespaced link must have a title (bad fragment version)
7813 !! input
7814 [[Project:#fragment]]
7815 !! result
7816 <p>[[Project:#fragment]]
7817 </p>
7818 !!end
7819
7820
7821 ###
7822 ### HTML tags and HTML attributes
7823 ###
7824
7825 !! test
7826 div with no attributes
7827 !! input
7828 <div>HTML rocks</div>
7829 !! result
7830 <div>HTML rocks</div>
7831
7832 !! end
7833
7834 !! test
7835 div with double-quoted attribute
7836 !! input
7837 <div id="rock">HTML rocks</div>
7838 !! result
7839 <div id="rock">HTML rocks</div>
7840
7841 !! end
7842
7843 !! test
7844 div with single-quoted attribute
7845 !! input
7846 <div id='rock'>HTML rocks</div>
7847 !! result
7848 <div id="rock">HTML rocks</div>
7849
7850 !! end
7851
7852 !! test
7853 div with unquoted attribute
7854 !! input
7855 <div id=rock>HTML rocks</div>
7856 !! result
7857 <div id="rock">HTML rocks</div>
7858
7859 !! end
7860
7861 !! test
7862 div with illegal double attributes
7863 !! input
7864 <div id="a" id="b">HTML rocks</div>
7865 !! result
7866 <div id="b">HTML rocks</div>
7867
7868 !!end
7869
7870 # FIXME: produce empty string instead of "class" in the PHP parser, following
7871 # the HTML5 spec.
7872 !! test
7873 div with empty attribute value, space before equals
7874 !! options
7875 disabled
7876 !! input
7877 <div class =>HTML rocks</div>
7878 !! result
7879 <div class="">HTML rocks</div>
7880
7881 !! end
7882
7883 # The PHP parser escapes the opening brace to &#123; for some reason, so
7884 # disabled this test for it.
7885 !! test
7886 div with braces in attribute value
7887 !! options
7888 disabled
7889 !! input
7890 <div title="{}">Foo</div>
7891 !! result
7892 <div title="{}">Foo</div>
7893 !! end
7894
7895 # This it very inconsistent in the PHP parser: it returns
7896 # class="class" if there is a space between the name and the equal sign (see
7897 # 'div with empty attribute value, space before equals'), but strips the
7898 # attribute completely if the space is missing. We hope that not much content
7899 # depends on this, so are implementing the behavior below in Parsoid for
7900 # consistencies' sake. Disabled for the PHP parser.
7901 # FIXME: fix this behavior in the PHP parser?
7902 !! test
7903 div with empty attribute value, no space before equals
7904 !! options
7905 disabled
7906 !! input
7907 <div class=>HTML rocks</div>
7908 !! result
7909 <div class="">HTML rocks</div>
7910
7911 !! end
7912
7913 !! test
7914 HTML multiple attributes correction
7915 !! input
7916 <p class="error" class="awesome">Awesome!</p>
7917 !! result
7918 <p class="awesome">Awesome!</p>
7919
7920 !!end
7921
7922 !! test
7923 Table multiple attributes correction
7924 !! input
7925 {|
7926 !+ class="error" class="awesome"| status
7927 |}
7928 !! result
7929 <table>
7930 <tr>
7931 <th class="awesome"> status
7932 </th></tr></table>
7933
7934 !!end
7935
7936 !! test
7937 DIV IN UPPERCASE
7938 !! input
7939 <DIV ID="x">HTML ROCKS</DIV>
7940 !! result
7941 <div id="x">HTML ROCKS</div>
7942
7943 !!end
7944
7945 !! test
7946 Non-ASCII pseudo-tags are rendered as text
7947 !! input
7948 <khyô>
7949 !! result
7950 <p>&lt;khyô&gt;
7951 </p>
7952 !! end
7953
7954 !! test
7955 Pseudo-tag with URL 'name' renders as url link
7956 !! input
7957 <http://example.com/>
7958 !! result
7959 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
7960 </p>
7961 !! end
7962
7963 !! test
7964 text with amp in the middle of nowhere
7965 !! input
7966 Remember AT&T?
7967 !!result
7968 <p>Remember AT&amp;T?
7969 </p>
7970 !! end
7971
7972 !! test
7973 text with character entity: eacute
7974 !! input
7975 I always thought &eacute; was a cute letter.
7976 !! result
7977 <p>I always thought &#233; was a cute letter.
7978 </p>
7979 !! end
7980
7981 !! test
7982 text with entity-escaped character entity-like string: eacute
7983 !! input
7984 I always thought &amp;eacute; was a cute letter.
7985 !! result
7986 <p>I always thought &amp;eacute; was a cute letter.
7987 </p>
7988 !! end
7989
7990 !! test
7991 text with undefined character entity: xacute
7992 !! input
7993 I always thought &xacute; was a cute letter.
7994 !! result
7995 <p>I always thought &amp;xacute; was a cute letter.
7996 </p>
7997 !! end
7998
7999
8000 ###
8001 ### Media links
8002 ###
8003
8004 !! test
8005 Media link
8006 !! input
8007 [[Media:Foobar.jpg]]
8008 !! result
8009 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8010 </p>
8011 !! end
8012
8013 !! test
8014 Media link with text
8015 !! input
8016 [[Media:Foobar.jpg|A neat file to look at]]
8017 !! result
8018 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8019 </p>
8020 !! end
8021
8022 # FIXME: this is still bad HTML tag nesting
8023 !! test
8024 Media link with nasty text
8025 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8026 !! input
8027 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8028 !! result
8029 <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>
8030
8031 !! end
8032
8033 !! test
8034 Media link to nonexistent file (bug 1702)
8035 !! input
8036 [[Media:No such.jpg]]
8037 !! result
8038 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8039 </p>
8040 !! end
8041
8042 !! test
8043 Image link to nonexistent file (bug 1850 - good)
8044 !! input
8045 [[Image:No such.jpg]]
8046 !! result
8047 <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>
8048 </p>
8049 !! end
8050
8051 !! test
8052 :Image link to nonexistent file (bug 1850 - bad)
8053 !! input
8054 [[:Image:No such.jpg]]
8055 !! result
8056 <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>
8057 </p>
8058 !! end
8059
8060
8061
8062 !! test
8063 Character reference normalization in link text (bug 1938)
8064 !! input
8065 [[Main Page|this&that]]
8066 !! result
8067 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8068 </p>
8069 !!end
8070
8071 !! article
8072 אַ
8073 !! text
8074 Test for unicode normalization
8075
8076 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8077 !! endarticle
8078
8079 !! test
8080 (bug 19451) Links should refer to the normalized form.
8081 !! input
8082 [[&#xFB2E;]]
8083 [[&#x5d0;&#x5b7;]]
8084 [[&#x5d0;ַ]]
8085 [[א&#x5b7;]]
8086 [[אַ]]
8087 !! result
8088 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8089 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8090 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8091 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8092 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8093 </p>
8094 !! end
8095
8096 !! test
8097 Empty attribute crash test (bug 2067)
8098 !! input
8099 <font color="">foo</font>
8100 !! result
8101 <p><font color="">foo</font>
8102 </p>
8103 !! end
8104
8105 !! test
8106 Empty attribute crash test single-quotes (bug 2067)
8107 !! input
8108 <font color=''>foo</font>
8109 !! result
8110 <p><font color="">foo</font>
8111 </p>
8112 !! end
8113
8114 !! test
8115 Attribute test: equals, then nothing
8116 !! input
8117 <font color=>foo</font>
8118 !! result
8119 <p><font>foo</font>
8120 </p>
8121 !! end
8122
8123 !! test
8124 Attribute test: unquoted value
8125 !! input
8126 <font color=x>foo</font>
8127 !! result
8128 <p><font color="x">foo</font>
8129 </p>
8130 !! end
8131
8132 !! test
8133 Attribute test: unquoted but illegal value (hash)
8134 !! input
8135 <font color=#x>foo</font>
8136 !! result
8137 <p><font color="#x">foo</font>
8138 </p>
8139 !! end
8140
8141 !! test
8142 Attribute test: no value
8143 !! input
8144 <font color>foo</font>
8145 !! result
8146 <p><font color="color">foo</font>
8147 </p>
8148 !! end
8149
8150 !! test
8151 Bug 2095: link with three closing brackets
8152 !! input
8153 [[Main Page]]]
8154 !! result
8155 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8156 </p>
8157 !! end
8158
8159 !! test
8160 Bug 2095: link with pipe and three closing brackets
8161 !! input
8162 [[Main Page|link]]]
8163 !! result
8164 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8165 </p>
8166 !! end
8167
8168 !! test
8169 Bug 2095: link with pipe and three closing brackets, version 2
8170 !! input
8171 [[Main Page|[http://example.com/]]]
8172 !! result
8173 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8174 </p>
8175 !! end
8176
8177
8178 ###
8179 ### Safety
8180 ###
8181
8182 !! article
8183 Template:Dangerous attribute
8184 !! text
8185 " onmouseover="alert(document.cookie)
8186 !! endarticle
8187
8188 !! article
8189 Template:Dangerous style attribute
8190 !! text
8191 border-size: expression(alert(document.cookie))
8192 !! endarticle
8193
8194 !! article
8195 Template:Div style
8196 !! text
8197 <div style="float: right; {{{1}}}">Magic div</div>
8198 !! endarticle
8199
8200 !! test
8201 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8202 !! input
8203 <div title="{{test}}"></div>
8204 !! result
8205 <div title="This is a test template"></div>
8206
8207 !! end
8208
8209 !! test
8210 Bug 2304: HTML attribute safety (dangerous template; 2309)
8211 !! input
8212 <div title="{{dangerous attribute}}"></div>
8213 !! result
8214 <div title=""></div>
8215
8216 !! end
8217
8218 !! test
8219 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8220 !! input
8221 <div style="{{dangerous style attribute}}"></div>
8222 !! result
8223 <div style="/* insecure input */"></div>
8224
8225 !! end
8226
8227 !! test
8228 Bug 2304: HTML attribute safety (safe parameter; 2309)
8229 !! input
8230 {{div style|width: 200px}}
8231 !! result
8232 <div style="float: right; width: 200px">Magic div</div>
8233
8234 !! end
8235
8236 !! test
8237 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8238 !! input
8239 {{div style|width: expression(alert(document.cookie))}}
8240 !! result
8241 <div style="/* insecure input */">Magic div</div>
8242
8243 !! end
8244
8245 !! test
8246 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8247 !! input
8248 {{div style|"><script>alert(document.cookie)</script>}}
8249 !! result
8250 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8251
8252 !! end
8253
8254 !! test
8255 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8256 !! input
8257 {{div style|" ><script>alert(document.cookie)</script>}}
8258 !! result
8259 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8260
8261 !! end
8262
8263 !! test
8264 Bug 2304: HTML attribute safety (link)
8265 !! input
8266 <div title="[[Main Page]]"></div>
8267 !! result
8268 <div title="&#91;&#91;Main Page]]"></div>
8269
8270 !! end
8271
8272 !! test
8273 Bug 2304: HTML attribute safety (italics)
8274 !! input
8275 <div title="''foobar''"></div>
8276 !! result
8277 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8278
8279 !! end
8280
8281 !! test
8282 Bug 2304: HTML attribute safety (bold)
8283 !! input
8284 <div title="'''foobar'''"></div>
8285 !! result
8286 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8287
8288 !! end
8289
8290
8291 !! test
8292 Bug 2304: HTML attribute safety (ISBN)
8293 !! input
8294 <div title="ISBN 1234567890"></div>
8295 !! result
8296 <div title="&#73;SBN 1234567890"></div>
8297
8298 !! end
8299
8300 !! test
8301 Bug 2304: HTML attribute safety (RFC)
8302 !! input
8303 <div title="RFC 1234"></div>
8304 !! result
8305 <div title="&#82;FC 1234"></div>
8306
8307 !! end
8308
8309 !! test
8310 Bug 2304: HTML attribute safety (PMID)
8311 !! input
8312 <div title="PMID 1234567890"></div>
8313 !! result
8314 <div title="&#80;MID 1234567890"></div>
8315
8316 !! end
8317
8318 !! test
8319 Bug 2304: HTML attribute safety (web link)
8320 !! input
8321 <div title="http://example.com/"></div>
8322 !! result
8323 <div title="http&#58;//example.com/"></div>
8324
8325 !! end
8326
8327 !! test
8328 Bug 2304: HTML attribute safety (named web link)
8329 !! input
8330 <div title="[http://example.com/ link]"></div>
8331 !! result
8332 <div title="&#91;http&#58;//example.com/ link]"></div>
8333
8334 !! end
8335
8336 !! test
8337 Bug 3244: HTML attribute safety (extension; safe)
8338 !! input
8339 <div style="<nowiki>background:blue</nowiki>"></div>
8340 !! result
8341 <div style="background:blue"></div>
8342
8343 !! end
8344
8345 !! test
8346 Bug 3244: HTML attribute safety (extension; unsafe)
8347 !! input
8348 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8349 !! result
8350 <div style="/* insecure input */"></div>
8351
8352 !! end
8353
8354 # More MSIE fun discovered by Tom Gilder
8355
8356 !! test
8357 MSIE CSS safety test: spurious slash
8358 !! input
8359 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8360 !! result
8361 <div style="/* insecure input */">evil</div>
8362
8363 !! end
8364
8365 !! test
8366 MSIE CSS safety test: hex code
8367 !! input
8368 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8369 !! result
8370 <div style="/* insecure input */">evil</div>
8371
8372 !! end
8373
8374 !! test
8375 MSIE CSS safety test: comment in url
8376 !! input
8377 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8378 !! result
8379 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8380
8381 !! end
8382
8383 !! test
8384 MSIE CSS safety test: comment in expression
8385 !! input
8386 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8387 !! result
8388 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8389
8390 !! end
8391
8392
8393 !! test
8394 Table attribute legitimate extension
8395 !! input
8396 {|
8397 !+ style="<nowiki>color:blue</nowiki>"| status
8398 |}
8399 !! result
8400 <table>
8401 <tr>
8402 <th style="color:blue"> status
8403 </th></tr></table>
8404
8405 !!end
8406
8407 !! test
8408 Table attribute safety
8409 !! input
8410 {|
8411 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8412 |}
8413 !! result
8414 <table>
8415 <tr>
8416 <th style="/* insecure input */"> status
8417 </th></tr></table>
8418
8419 !! end
8420
8421 !! test
8422 CSS line continuation 1
8423 !! input
8424 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8425 !! result
8426 <div style="/* insecure input */"></div>
8427
8428 !! end
8429
8430 !! test
8431 CSS line continuation 2
8432 !! input
8433 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8434 !! result
8435 <div style="/* insecure input */"></div>
8436
8437 !! end
8438
8439 !! article
8440 Template:Identity
8441 !! text
8442 {{{1}}}
8443 !! endarticle
8444
8445 !! test
8446 Expansion of multi-line templates in attribute values (bug 6255)
8447 !! input
8448 <div style="background: {{identity|#00FF00}}">-</div>
8449 !! result
8450 <div style="background: #00FF00">-</div>
8451
8452 !! end
8453
8454
8455 !! test
8456 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8457 !! input
8458 <div style="background:
8459 #00FF00">-</div>
8460 !! result
8461 <div style="background: #00FF00">-</div>
8462
8463 !! end
8464
8465 !! test
8466 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8467 !! input
8468 <div style="background: &#10;#00FF00">-</div>
8469 !! result
8470 <div style="background: &#10;#00FF00">-</div>
8471
8472 !! end
8473
8474 ###
8475 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8476 ###
8477 !! test
8478 Parser hook: empty input
8479 !! input
8480 <tag></tag>
8481 !! result
8482 <pre>
8483 ''
8484 array (
8485 )
8486 </pre>
8487
8488 !! end
8489
8490 !! test
8491 Parser hook: empty input using terminated empty elements
8492 !! input
8493 <tag/>
8494 !! result
8495 <pre>
8496 NULL
8497 array (
8498 )
8499 </pre>
8500
8501 !! end
8502
8503 !! test
8504 Parser hook: empty input using terminated empty elements (space before)
8505 !! input
8506 <tag />
8507 !! result
8508 <pre>
8509 NULL
8510 array (
8511 )
8512 </pre>
8513
8514 !! end
8515
8516 !! test
8517 Parser hook: basic input
8518 !! input
8519 <tag>input</tag>
8520 !! result
8521 <pre>
8522 'input'
8523 array (
8524 )
8525 </pre>
8526
8527 !! end
8528
8529
8530 !! test
8531 Parser hook: case insensitive
8532 !! input
8533 <TAG>input</TAG>
8534 !! result
8535 <pre>
8536 'input'
8537 array (
8538 )
8539 </pre>
8540
8541 !! end
8542
8543
8544 !! test
8545 Parser hook: case insensitive, redux
8546 !! input
8547 <TaG>input</TAg>
8548 !! result
8549 <pre>
8550 'input'
8551 array (
8552 )
8553 </pre>
8554
8555 !! end
8556
8557 !! test
8558 Parser hook: nested tags
8559 !! options
8560 noxml
8561 !! input
8562 <tag><tag></tag></tag>
8563 !! result
8564 <pre>
8565 '<tag>'
8566 array (
8567 )
8568 </pre>&lt;/tag&gt;
8569
8570 !! end
8571
8572 !! test
8573 Parser hook: basic arguments
8574 !! input
8575 <tag width=200 height = "100" depth = '50' square></tag>
8576 !! result
8577 <pre>
8578 ''
8579 array (
8580 'width' => '200',
8581 'height' => '100',
8582 'depth' => '50',
8583 'square' => 'square',
8584 )
8585 </pre>
8586
8587 !! end
8588
8589 !! test
8590 Parser hook: argument containing a forward slash (bug 5344)
8591 !! input
8592 <tag filename='/tmp/bla'></tag>
8593 !! result
8594 <pre>
8595 ''
8596 array (
8597 'filename' => '/tmp/bla',
8598 )
8599 </pre>
8600
8601 !! end
8602
8603 !! test
8604 Parser hook: empty input using terminated empty elements (bug 2374)
8605 !! input
8606 <tag foo=bar/>text
8607 !! result
8608 <pre>
8609 NULL
8610 array (
8611 'foo' => 'bar',
8612 )
8613 </pre>text
8614
8615 !! end
8616
8617 # </tag> should be output literally since there is no matching tag that begins it
8618 !! test
8619 Parser hook: basic arguments using terminated empty elements (bug 2374)
8620 !! input
8621 <tag width=200 height = "100" depth = '50' square/>
8622 other stuff
8623 </tag>
8624 !! result
8625 <pre>
8626 NULL
8627 array (
8628 'width' => '200',
8629 'height' => '100',
8630 'depth' => '50',
8631 'square' => 'square',
8632 )
8633 </pre>
8634 <p>other stuff
8635 &lt;/tag&gt;
8636 </p>
8637 !! end
8638
8639 ###
8640 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8641 ###
8642
8643 !! test
8644 Parser hook: static parser hook not inside a comment
8645 !! input
8646 <statictag>hello, world</statictag>
8647 <statictag action=flush/>
8648 !! result
8649 <p>hello, world
8650 </p>
8651 !! end
8652
8653
8654 !! test
8655 Parser hook: static parser hook inside a comment
8656 !! input
8657 <!-- <statictag>hello, world</statictag> -->
8658 <statictag action=flush/>
8659 !! result
8660 <p><br />
8661 </p>
8662 !! end
8663
8664 # Nested template calls; this case was broken by Parser.php rev 1.506,
8665 # since reverted.
8666
8667 !! article
8668 Template:One-parameter
8669 !! text
8670 (My parameter is: {{{1}}})
8671 !! endarticle
8672
8673 !! article
8674 Template:Map-one-parameter
8675 !! text
8676 {{{{{1}}}|{{{2}}}}}
8677 !! endarticle
8678
8679 !! test
8680 Nested template calls
8681 !! input
8682 {{Map-one-parameter|One-parameter|param}}
8683 !! result
8684 <p>(My parameter is: param)
8685 </p>
8686 !! end
8687
8688
8689 ###
8690 ### Sanitizer
8691 ###
8692 !! test
8693 Sanitizer: Closing of open tags
8694 !! input
8695 <s></s><table></table>
8696 !! result
8697 <s></s><table></table>
8698
8699 !! end
8700
8701 !! test
8702 Sanitizer: Closing of open but not closed tags
8703 !! input
8704 <s>foo
8705 !! result
8706 <p><s>foo</s>
8707 </p>
8708 !! end
8709
8710 !! test
8711 Sanitizer: Closing of closed but not open tags
8712 !! input
8713 </s>
8714 !! result
8715 <p>&lt;/s&gt;
8716 </p>
8717 !! end
8718
8719 !! test
8720 Sanitizer: Closing of closed but not open table tags
8721 !! input
8722 Table not started</td></tr></table>
8723 !! result
8724 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8725 </p>
8726 !! end
8727
8728 !! test
8729 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8730 !! input
8731 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8732 !! result
8733 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8734 </p>
8735 !! end
8736
8737 !! test
8738 Sanitizer: Validating the contents of the id attribute (bug 4515)
8739 !! options
8740 disabled
8741 !! input
8742 <br id=9 />
8743 !! result
8744 Something, but definitely not <br id="9" />...
8745 !! end
8746
8747 !! test
8748 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8749 !! options
8750 disabled
8751 !! input
8752 <br id="foo" /><br id="foo" />
8753 !! result
8754 Something need to be done. foo-2 ?
8755 !! end
8756
8757 !! test
8758 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8759 !! input
8760 <div itemscope>
8761 <meta itemprop="hello" content="world">
8762 <meta http-equiv="refresh" content="5">
8763 <meta itemprop="hello" http-equiv="refresh" content="5">
8764 <link itemprop="hello" href="{{SERVER}}">
8765 <link rel="stylesheet" href="{{SERVER}}">
8766 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8767 </div>
8768 !! result
8769 <div itemscope="itemscope">
8770 <p> <meta itemprop="hello" content="world" />
8771 &lt;meta http-equiv="refresh" content="5"&gt;
8772 <meta itemprop="hello" content="5" />
8773 </p>
8774 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8775 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>"&gt;
8776 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8777 </div>
8778
8779 !! end
8780
8781 !! test
8782 Language converter: output gets cut off unexpectedly (bug 5757)
8783 !! options
8784 language=zh
8785 !! input
8786 this bit is safe: }-
8787
8788 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8789
8790 then we get cut off here: }-
8791
8792 all additional text is vanished
8793 !! result
8794 <p>this bit is safe: }-
8795 </p><p>but if we add a conversion instance: xxx
8796 </p><p>then we get cut off here: }-
8797 </p><p>all additional text is vanished
8798 </p>
8799 !! end
8800
8801 !! test
8802 Self closed html pairs (bug 5487)
8803 !! options
8804 !! input
8805 <center><font id="bug" />Centered text</center>
8806 <div><font id="bug2" />In div text</div>
8807 !! result
8808 <center>&lt;font id="bug" /&gt;Centered text</center>
8809 <div>&lt;font id="bug2" /&gt;In div text</div>
8810
8811 !! end
8812
8813 #
8814 #
8815 #
8816
8817 !! test
8818 Punctuation: nbsp before exclamation
8819 !! input
8820 C'est grave !
8821 !! result
8822 <p>C'est grave&#160;!
8823 </p>
8824 !! end
8825
8826 !! test
8827 Punctuation: CSS !important (bug 11874)
8828 !! input
8829 <div style="width:50% !important">important</div>
8830 !! result
8831 <div style="width:50% !important">important</div>
8832
8833 !!end
8834
8835 !! test
8836 Punctuation: CSS ! important (bug 11874; with space after)
8837 !! input
8838 <div style="width:50% ! important">important</div>
8839 !! result
8840 <div style="width:50% ! important">important</div>
8841
8842 !!end
8843
8844
8845 !! test
8846 HTML bullet list, closed tags (bug 5497)
8847 !! input
8848 <ul>
8849 <li>One</li>
8850 <li>Two</li>
8851 </ul>
8852 !! result
8853 <ul>
8854 <li>One</li>
8855 <li>Two</li>
8856 </ul>
8857
8858 !! end
8859
8860 !! test
8861 HTML bullet list, unclosed tags (bug 5497)
8862 !! options
8863 disabled
8864 !! input
8865 <ul>
8866 <li>One
8867 <li>Two
8868 </ul>
8869 !! result
8870 <ul>
8871 <li>One
8872 </li><li>Two
8873 </li></ul>
8874
8875 !! end
8876
8877 !! test
8878 HTML ordered list, closed tags (bug 5497)
8879 !! input
8880 <ol>
8881 <li>One</li>
8882 <li>Two</li>
8883 </ol>
8884 !! result
8885 <ol>
8886 <li>One</li>
8887 <li>Two</li>
8888 </ol>
8889
8890 !! end
8891
8892 !! test
8893 HTML ordered list, unclosed tags (bug 5497)
8894 !! options
8895 disabled
8896 !! input
8897 <ol>
8898 <li>One
8899 <li>Two
8900 </ol>
8901 !! result
8902 <ol>
8903 <li>One
8904 </li><li>Two
8905 </li></ol>
8906
8907 !! end
8908
8909 !! test
8910 HTML nested bullet list, closed tags (bug 5497)
8911 !! input
8912 <ul>
8913 <li>One</li>
8914 <li>Two:
8915 <ul>
8916 <li>Sub-one</li>
8917 <li>Sub-two</li>
8918 </ul>
8919 </li>
8920 </ul>
8921 !! result
8922 <ul>
8923 <li>One</li>
8924 <li>Two:
8925 <ul>
8926 <li>Sub-one</li>
8927 <li>Sub-two</li>
8928 </ul>
8929 </li>
8930 </ul>
8931
8932 !! end
8933
8934 !! test
8935 HTML nested bullet list, open tags (bug 5497)
8936 !! options
8937 disabled
8938 !! input
8939 <ul>
8940 <li>One
8941 <li>Two:
8942 <ul>
8943 <li>Sub-one
8944 <li>Sub-two
8945 </ul>
8946 </ul>
8947 !! result
8948 <ul>
8949 <li>One
8950 </li><li>Two:
8951 <ul>
8952 <li>Sub-one
8953 </li><li>Sub-two
8954 </li></ul>
8955 </li></ul>
8956
8957 !! end
8958
8959 !! test
8960 HTML nested ordered list, closed tags (bug 5497)
8961 !! input
8962 <ol>
8963 <li>One</li>
8964 <li>Two:
8965 <ol>
8966 <li>Sub-one</li>
8967 <li>Sub-two</li>
8968 </ol>
8969 </li>
8970 </ol>
8971 !! result
8972 <ol>
8973 <li>One</li>
8974 <li>Two:
8975 <ol>
8976 <li>Sub-one</li>
8977 <li>Sub-two</li>
8978 </ol>
8979 </li>
8980 </ol>
8981
8982 !! end
8983
8984 !! test
8985 HTML nested ordered list, open tags (bug 5497)
8986 !! options
8987 disabled
8988 !! input
8989 <ol>
8990 <li>One
8991 <li>Two:
8992 <ol>
8993 <li>Sub-one
8994 <li>Sub-two
8995 </ol>
8996 </ol>
8997 !! result
8998 <ol>
8999 <li>One
9000 </li><li>Two:
9001 <ol>
9002 <li>Sub-one
9003 </li><li>Sub-two
9004 </li></ol>
9005 </li></ol>
9006
9007 !! end
9008
9009 !! test
9010 HTML ordered list item with parameters oddity
9011 !! input
9012 <ol><li id="fragment">One</li></ol>
9013 !! result
9014 <ol><li id="fragment">One</li></ol>
9015
9016 !! end
9017
9018 !!test
9019 bug 5918: autonumbering
9020 !! input
9021 [http://first/] [http://second] [ftp://ftp]
9022
9023 ftp://inlineftp
9024
9025 [mailto:enclosed@mail.tld With target]
9026
9027 [mailto:enclosed@mail.tld]
9028
9029 mailto:inline@mail.tld
9030 !! result
9031 <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>
9032 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9033 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9034 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9035 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9036 </p>
9037 !! end
9038
9039
9040 #
9041 # Security and HTML correctness
9042 # From Nick Jenkins' fuzz testing
9043 #
9044
9045 !! test
9046 Fuzz testing: Parser13
9047 !! input
9048 {|
9049 | http://a|
9050 !! result
9051 <table>
9052 <tr>
9053 <td>
9054 </td>
9055 </tr>
9056 </table>
9057
9058 !! end
9059
9060 !! test
9061 Fuzz testing: Parser14
9062 !! input
9063 == onmouseover= ==
9064 http://__TOC__
9065 !! result
9066 <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>
9067 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9068 <ul>
9069 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9070 </ul>
9071 </td></tr></table>
9072
9073 !! end
9074
9075 !! test
9076 Fuzz testing: Parser14-table
9077 !! input
9078 ==a==
9079 {| STYLE=__TOC__
9080 !! result
9081 <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>
9082 <table style="&#95;_TOC&#95;_">
9083 <tr><td></td></tr>
9084 </table>
9085
9086 !! end
9087
9088 # Known to produce bogus xml (extra </td>)
9089 !! test
9090 Fuzz testing: Parser16
9091 !! options
9092 noxml
9093 !! input
9094 {|
9095 !https://||||||
9096 !! result
9097 <table>
9098 <tr>
9099 <th>https://</th>
9100 <th></th>
9101 <th></th>
9102 <th>
9103 </td>
9104 </tr>
9105 </table>
9106
9107 !! end
9108
9109 !! test
9110 Fuzz testing: Parser21
9111 !! input
9112 {|
9113 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9114 |
9115 !! result
9116 <table>
9117 <tr>
9118 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9119 </th>
9120 <td>
9121 </td>
9122 </tr>
9123 </table>
9124
9125 !! end
9126
9127 !! test
9128 Fuzz testing: Parser22
9129 !! input
9130 http://===r:::https://b
9131
9132 {|
9133 !!result
9134 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9135 </p>
9136 <table>
9137 <tr><td></td></tr>
9138 </table>
9139
9140 !! end
9141
9142 # Known to produce bad XML for now
9143 !! test
9144 Fuzz testing: Parser24
9145 !! options
9146 noxml
9147 !! input
9148 {|
9149 {{{|
9150 <u CLASS=
9151 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9152 <br style="onmouseover='alert(document.cookie);' " />
9153
9154 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9155 |
9156 !! result
9157 <table>
9158 {{{|
9159 <u class="&#124;">}}}} &gt;
9160 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9161
9162 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9163 <tr>
9164 <td></u>
9165 </td>
9166 </tr>
9167 </table>
9168
9169 !! end
9170
9171 # Note: the current result listed for this is not what the original one was,
9172 # but the original bug was JavaScript injection, which is fixed in any case.
9173 # It's not clear that the original result listed was any more correct than the
9174 # current one. Original result:
9175 # <p>{{{|
9176 # </p>
9177 # <li class="&#124;&#124;">
9178 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9179 !!test
9180 Fuzz testing: Parser25 (bug 6055)
9181 !! input
9182 {{{
9183 |
9184 <LI CLASS=||
9185 >
9186 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9187 !! result
9188 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9189 </p>
9190 !! end
9191
9192 !!test
9193 Fuzz testing: URL adjacent extension (with space, clean)
9194 !! options
9195 !! input
9196 http://example.com <nowiki>junk</nowiki>
9197 !! result
9198 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9199 </p>
9200 !!end
9201
9202 !!test
9203 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9204 !! options
9205 !! input
9206 http://example.com<nowiki>junk</nowiki>
9207 !! result
9208 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9209 </p>
9210 !!end
9211
9212 !!test
9213 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9214 !! options
9215 !! input
9216 http://example.com<pre>junk</pre>
9217 !! result
9218 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9219
9220 !!end
9221
9222 !!test
9223 Fuzz testing: image with bogus manual thumbnail
9224 !!input
9225 [[Image:foobar.jpg|thumbnail= ]]
9226 !!result
9227 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9228
9229 !!end
9230
9231 !! test
9232 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9233 !! input
9234 <pre dir="&#10;"></pre>
9235 !! result
9236 <pre dir="&#10;"></pre>
9237
9238 !! end
9239
9240 !! test
9241 Parsing optional HTML elements (Bug 6171)
9242 !! options
9243 !! input
9244 <table>
9245 <tr>
9246 <td> Some tabular data</td>
9247 <td> More tabular data ...
9248 <td> And yet som tabular data</td>
9249 </tr>
9250 </table>
9251 !! result
9252 <table>
9253 <tr>
9254 <td> Some tabular data</td>
9255 <td> More tabular data ...
9256 </td><td> And yet som tabular data</td>
9257 </tr>
9258 </table>
9259
9260 !! end
9261
9262 !! test
9263 Correct handling of <td>, <tr> (Bug 6171)
9264 !! options
9265 !! input
9266 <table>
9267 <tr>
9268 <td> Some tabular data</td>
9269 <td> More tabular data ...</td>
9270 <td> And yet som tabular data</td>
9271 </tr>
9272 </table>
9273 !! result
9274 <table>
9275 <tr>
9276 <td> Some tabular data</td>
9277 <td> More tabular data ...</td>
9278 <td> And yet som tabular data</td>
9279 </tr>
9280 </table>
9281
9282 !! end
9283
9284
9285 !! test
9286 Parsing crashing regression (fr:JavaScript)
9287 !! input
9288 </body></x>
9289 !! result
9290 <p>&lt;/body&gt;&lt;/x&gt;
9291 </p>
9292 !! end
9293
9294 !! test
9295 Inline wiki vs wiki block nesting
9296 !! input
9297 '''Bold paragraph
9298
9299 New wiki paragraph
9300 !! result
9301 <p><b>Bold paragraph</b>
9302 </p><p>New wiki paragraph
9303 </p>
9304 !! end
9305
9306 !! test
9307 Inline HTML vs wiki block nesting
9308 !! options
9309 disabled
9310 !! input
9311 <b>Bold paragraph
9312
9313 New wiki paragraph
9314 !! result
9315 <p><b>Bold paragraph</b>
9316 </p><p>New wiki paragraph
9317 </p>
9318 !! end
9319
9320 # Original result was this:
9321 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9322 # </p>
9323 # While that might be marginally more intuitive, maybe, the six-apostrophe
9324 # construct is clearly pathological and the result stated here (which is what
9325 # the parser actually does) is about as reasonable as anything.
9326 !!test
9327 Mixing markup for italics and bold
9328 !! options
9329 !! input
9330 '''bold''''''bold''bolditalics'''''
9331 !! result
9332 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9333 </p>
9334 !! end
9335
9336
9337 !! article
9338 Xyzzyx
9339 !! text
9340 Article for special page transclusion test
9341 !! endarticle
9342
9343 !! test
9344 Special page transclusion
9345 !! options
9346 !! input
9347 {{Special:Prefixindex/Xyzzyx}}
9348 !! result
9349 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9350
9351 !! end
9352
9353 !! test
9354 Special page transclusion twice (bug 5021)
9355 !! options
9356 !! input
9357 {{Special:Prefixindex/Xyzzyx}}
9358 {{Special:Prefixindex/Xyzzyx}}
9359 !! result
9360 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9361 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9362
9363 !! end
9364
9365 !! test
9366 Transclusion of default MediaWiki message
9367 !! input
9368 {{MediaWiki:Mainpage}}
9369 !!result
9370 <p>Main Page
9371 </p>
9372 !! end
9373
9374 !! test
9375 Transclusion of nonexistent MediaWiki message
9376 !! input
9377 {{MediaWiki:Mainpagexxx}}
9378 !!result
9379 <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>
9380 </p>
9381 !! end
9382
9383 !! test
9384 Transclusion of MediaWiki message with underscore
9385 !! input
9386 {{MediaWiki:history_short}}
9387 !! result
9388 <p>History
9389 </p>
9390 !! end
9391
9392 !! test
9393 Transclusion of MediaWiki message with space
9394 !! input
9395 {{MediaWiki:history short}}
9396 !! result
9397 <p>History
9398 </p>
9399 !! end
9400
9401 !! test
9402 Invalid header with following text
9403 !! input
9404 = x = y
9405 !! result
9406 <p>= x = y
9407 </p>
9408 !! end
9409
9410
9411 !! test
9412 Section extraction test (section 0)
9413 !! options
9414 section=0
9415 !! input
9416 start
9417 ==a==
9418 ===aa===
9419 ====aaa====
9420 ==b==
9421 ===ba===
9422 ===bb===
9423 ====bba====
9424 ===bc===
9425 ==c==
9426 ===ca===
9427 !! result
9428 start
9429 !! end
9430
9431 !! test
9432 Section extraction test (section 1)
9433 !! options
9434 section=1
9435 !! input
9436 start
9437 ==a==
9438 ===aa===
9439 ====aaa====
9440 ==b==
9441 ===ba===
9442 ===bb===
9443 ====bba====
9444 ===bc===
9445 ==c==
9446 ===ca===
9447 !! result
9448 ==a==
9449 ===aa===
9450 ====aaa====
9451 !! end
9452
9453 !! test
9454 Section extraction test (section 2)
9455 !! options
9456 section=2
9457 !! input
9458 start
9459 ==a==
9460 ===aa===
9461 ====aaa====
9462 ==b==
9463 ===ba===
9464 ===bb===
9465 ====bba====
9466 ===bc===
9467 ==c==
9468 ===ca===
9469 !! result
9470 ===aa===
9471 ====aaa====
9472 !! end
9473
9474 !! test
9475 Section extraction test (section 3)
9476 !! options
9477 section=3
9478 !! input
9479 start
9480 ==a==
9481 ===aa===
9482 ====aaa====
9483 ==b==
9484 ===ba===
9485 ===bb===
9486 ====bba====
9487 ===bc===
9488 ==c==
9489 ===ca===
9490 !! result
9491 ====aaa====
9492 !! end
9493
9494 !! test
9495 Section extraction test (section 4)
9496 !! options
9497 section=4
9498 !! input
9499 start
9500 ==a==
9501 ===aa===
9502 ====aaa====
9503 ==b==
9504 ===ba===
9505 ===bb===
9506 ====bba====
9507 ===bc===
9508 ==c==
9509 ===ca===
9510 !! result
9511 ==b==
9512 ===ba===
9513 ===bb===
9514 ====bba====
9515 ===bc===
9516 !! end
9517
9518 !! test
9519 Section extraction test (section 5)
9520 !! options
9521 section=5
9522 !! input
9523 start
9524 ==a==
9525 ===aa===
9526 ====aaa====
9527 ==b==
9528 ===ba===
9529 ===bb===
9530 ====bba====
9531 ===bc===
9532 ==c==
9533 ===ca===
9534 !! result
9535 ===ba===
9536 !! end
9537
9538 !! test
9539 Section extraction test (section 6)
9540 !! options
9541 section=6
9542 !! input
9543 start
9544 ==a==
9545 ===aa===
9546 ====aaa====
9547 ==b==
9548 ===ba===
9549 ===bb===
9550 ====bba====
9551 ===bc===
9552 ==c==
9553 ===ca===
9554 !! result
9555 ===bb===
9556 ====bba====
9557 !! end
9558
9559 !! test
9560 Section extraction test (section 7)
9561 !! options
9562 section=7
9563 !! input
9564 start
9565 ==a==
9566 ===aa===
9567 ====aaa====
9568 ==b==
9569 ===ba===
9570 ===bb===
9571 ====bba====
9572 ===bc===
9573 ==c==
9574 ===ca===
9575 !! result
9576 ====bba====
9577 !! end
9578
9579 !! test
9580 Section extraction test (section 8)
9581 !! options
9582 section=8
9583 !! input
9584 start
9585 ==a==
9586 ===aa===
9587 ====aaa====
9588 ==b==
9589 ===ba===
9590 ===bb===
9591 ====bba====
9592 ===bc===
9593 ==c==
9594 ===ca===
9595 !! result
9596 ===bc===
9597 !! end
9598
9599 !! test
9600 Section extraction test (section 9)
9601 !! options
9602 section=9
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 ==c==
9617 ===ca===
9618 !! end
9619
9620 !! test
9621 Section extraction test (section 10)
9622 !! options
9623 section=10
9624 !! input
9625 start
9626 ==a==
9627 ===aa===
9628 ====aaa====
9629 ==b==
9630 ===ba===
9631 ===bb===
9632 ====bba====
9633 ===bc===
9634 ==c==
9635 ===ca===
9636 !! result
9637 ===ca===
9638 !! end
9639
9640 !! test
9641 Section extraction test (nonexistent section 11)
9642 !! options
9643 section=11
9644 !! input
9645 start
9646 ==a==
9647 ===aa===
9648 ====aaa====
9649 ==b==
9650 ===ba===
9651 ===bb===
9652 ====bba====
9653 ===bc===
9654 ==c==
9655 ===ca===
9656 !! result
9657 !! end
9658
9659 !! test
9660 Section extraction test with bogus heading (section 1)
9661 !! options
9662 section=1
9663 !! input
9664 ==a==
9665 ==bogus== not a legal section
9666 ==b==
9667 !! result
9668 ==a==
9669 ==bogus== not a legal section
9670 !! end
9671
9672 !! test
9673 Section extraction test with bogus heading (section 2)
9674 !! options
9675 section=2
9676 !! input
9677 ==a==
9678 ==bogus== not a legal section
9679 ==b==
9680 !! result
9681 ==b==
9682 !! end
9683
9684 !! test
9685 Section extraction test with comment after heading (section 1)
9686 !! options
9687 section=1
9688 !! input
9689 ==a==
9690 ==b== <!-- -->
9691 ==c==
9692 !! result
9693 ==a==
9694 !! end
9695
9696 !! test
9697 Section extraction test with comment after heading (section 2)
9698 !! options
9699 section=2
9700 !! input
9701 ==a==
9702 ==b== <!-- -->
9703 ==c==
9704 !! result
9705 ==b== <!-- -->
9706 !! end
9707
9708 !! test
9709 Section extraction test with bogus <nowiki> heading (section 1)
9710 !! options
9711 section=1
9712 !! input
9713 ==a==
9714 ==bogus== <nowiki>not a legal section</nowiki>
9715 ==b==
9716 !! result
9717 ==a==
9718 ==bogus== <nowiki>not a legal section</nowiki>
9719 !! end
9720
9721 !! test
9722 Section extraction test with bogus <nowiki> heading (section 2)
9723 !! options
9724 section=2
9725 !! input
9726 ==a==
9727 ==bogus== <nowiki>not a legal section</nowiki>
9728 ==b==
9729 !! result
9730 ==b==
9731 !! end
9732
9733
9734 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9735 # instead of respecting commented sections
9736 !! test
9737 Section extraction prefixed by comment (section 1)
9738 !! options
9739 section=1
9740 !! input
9741 <!-- -->==sec1==
9742 ==sec2==
9743 !!result
9744 ==sec2==
9745 !!end
9746
9747 !! test
9748 Section extraction prefixed by comment (section 2)
9749 !! options
9750 section=2
9751 !! input
9752 <!-- -->==sec1==
9753 ==sec2==
9754 !!result
9755
9756 !!end
9757
9758
9759 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9760 # instead of respecting HTML-style headings
9761 !! test
9762 Section extraction, mixed wiki and html (section 1)
9763 !! options
9764 section=1
9765 !! input
9766 <h2>unmarked</h2>
9767 unmarked
9768 ==1==
9769 one
9770 ==2==
9771 two
9772 !! result
9773 ==1==
9774 one
9775 !! end
9776
9777 !! test
9778 Section extraction, mixed wiki and html (section 2)
9779 !! options
9780 section=2
9781 !! input
9782 <h2>unmarked</h2>
9783 unmarked
9784 ==1==
9785 one
9786 ==2==
9787 two
9788 !! result
9789 ==2==
9790 two
9791 !! end
9792
9793
9794 # Formerly testing for bug 3342
9795 !! test
9796 Section extraction, heading surrounded by <noinclude>
9797 !! options
9798 section=1
9799 !! input
9800 <noinclude>==unmarked==</noinclude>
9801 ==marked==
9802 !! result
9803 ==marked==
9804 !!end
9805
9806 # Test behaviour of bug 19910
9807 !! test
9808 Sectiion with all-equals
9809 !! options
9810 section=2
9811 !! input
9812 ===
9813 The line above must have a trailing space
9814 === <!--
9815 --> <!-- -->
9816 But just in case it doesn't...
9817 !! result
9818 === <!--
9819 --> <!-- -->
9820 But just in case it doesn't...
9821 !! end
9822
9823 !! test
9824 Section replacement test (section 0)
9825 !! options
9826 replace=0,"xxx"
9827 !! input
9828 start
9829 ==a==
9830 ===aa===
9831 ====aaa====
9832 ==b==
9833 ===ba===
9834 ===bb===
9835 ====bba====
9836 ===bc===
9837 ==c==
9838 ===ca===
9839 !! result
9840 xxx
9841
9842 ==a==
9843 ===aa===
9844 ====aaa====
9845 ==b==
9846 ===ba===
9847 ===bb===
9848 ====bba====
9849 ===bc===
9850 ==c==
9851 ===ca===
9852 !! end
9853
9854 !! test
9855 Section replacement test (section 1)
9856 !! options
9857 replace=1,"xxx"
9858 !! input
9859 start
9860 ==a==
9861 ===aa===
9862 ====aaa====
9863 ==b==
9864 ===ba===
9865 ===bb===
9866 ====bba====
9867 ===bc===
9868 ==c==
9869 ===ca===
9870 !! result
9871 start
9872 xxx
9873
9874 ==b==
9875 ===ba===
9876 ===bb===
9877 ====bba====
9878 ===bc===
9879 ==c==
9880 ===ca===
9881 !! end
9882
9883 !! test
9884 Section replacement test (section 2)
9885 !! options
9886 replace=2,"xxx"
9887 !! input
9888 start
9889 ==a==
9890 ===aa===
9891 ====aaa====
9892 ==b==
9893 ===ba===
9894 ===bb===
9895 ====bba====
9896 ===bc===
9897 ==c==
9898 ===ca===
9899 !! result
9900 start
9901 ==a==
9902 xxx
9903
9904 ==b==
9905 ===ba===
9906 ===bb===
9907 ====bba====
9908 ===bc===
9909 ==c==
9910 ===ca===
9911 !! end
9912
9913 !! test
9914 Section replacement test (section 3)
9915 !! options
9916 replace=3,"xxx"
9917 !! input
9918 start
9919 ==a==
9920 ===aa===
9921 ====aaa====
9922 ==b==
9923 ===ba===
9924 ===bb===
9925 ====bba====
9926 ===bc===
9927 ==c==
9928 ===ca===
9929 !! result
9930 start
9931 ==a==
9932 ===aa===
9933 xxx
9934
9935 ==b==
9936 ===ba===
9937 ===bb===
9938 ====bba====
9939 ===bc===
9940 ==c==
9941 ===ca===
9942 !! end
9943
9944 !! test
9945 Section replacement test (section 4)
9946 !! options
9947 replace=4,"xxx"
9948 !! input
9949 start
9950 ==a==
9951 ===aa===
9952 ====aaa====
9953 ==b==
9954 ===ba===
9955 ===bb===
9956 ====bba====
9957 ===bc===
9958 ==c==
9959 ===ca===
9960 !! result
9961 start
9962 ==a==
9963 ===aa===
9964 ====aaa====
9965 xxx
9966
9967 ==c==
9968 ===ca===
9969 !! end
9970
9971 !! test
9972 Section replacement test (section 5)
9973 !! options
9974 replace=5,"xxx"
9975 !! input
9976 start
9977 ==a==
9978 ===aa===
9979 ====aaa====
9980 ==b==
9981 ===ba===
9982 ===bb===
9983 ====bba====
9984 ===bc===
9985 ==c==
9986 ===ca===
9987 !! result
9988 start
9989 ==a==
9990 ===aa===
9991 ====aaa====
9992 ==b==
9993 xxx
9994
9995 ===bb===
9996 ====bba====
9997 ===bc===
9998 ==c==
9999 ===ca===
10000 !! end
10001
10002 !! test
10003 Section replacement test (section 6)
10004 !! options
10005 replace=6,"xxx"
10006 !! input
10007 start
10008 ==a==
10009 ===aa===
10010 ====aaa====
10011 ==b==
10012 ===ba===
10013 ===bb===
10014 ====bba====
10015 ===bc===
10016 ==c==
10017 ===ca===
10018 !! result
10019 start
10020 ==a==
10021 ===aa===
10022 ====aaa====
10023 ==b==
10024 ===ba===
10025 xxx
10026
10027 ===bc===
10028 ==c==
10029 ===ca===
10030 !! end
10031
10032 !! test
10033 Section replacement test (section 7)
10034 !! options
10035 replace=7,"xxx"
10036 !! input
10037 start
10038 ==a==
10039 ===aa===
10040 ====aaa====
10041 ==b==
10042 ===ba===
10043 ===bb===
10044 ====bba====
10045 ===bc===
10046 ==c==
10047 ===ca===
10048 !! result
10049 start
10050 ==a==
10051 ===aa===
10052 ====aaa====
10053 ==b==
10054 ===ba===
10055 ===bb===
10056 xxx
10057
10058 ===bc===
10059 ==c==
10060 ===ca===
10061 !! end
10062
10063 !! test
10064 Section replacement test (section 8)
10065 !! options
10066 replace=8,"xxx"
10067 !! input
10068 start
10069 ==a==
10070 ===aa===
10071 ====aaa====
10072 ==b==
10073 ===ba===
10074 ===bb===
10075 ====bba====
10076 ===bc===
10077 ==c==
10078 ===ca===
10079 !! result
10080 start
10081 ==a==
10082 ===aa===
10083 ====aaa====
10084 ==b==
10085 ===ba===
10086 ===bb===
10087 ====bba====
10088 xxx
10089
10090 ==c==
10091 ===ca===
10092 !!end
10093
10094 !! test
10095 Section replacement test (section 9)
10096 !! options
10097 replace=9,"xxx"
10098 !! input
10099 start
10100 ==a==
10101 ===aa===
10102 ====aaa====
10103 ==b==
10104 ===ba===
10105 ===bb===
10106 ====bba====
10107 ===bc===
10108 ==c==
10109 ===ca===
10110 !! result
10111 start
10112 ==a==
10113 ===aa===
10114 ====aaa====
10115 ==b==
10116 ===ba===
10117 ===bb===
10118 ====bba====
10119 ===bc===
10120 xxx
10121 !! end
10122
10123 !! test
10124 Section replacement test (section 10)
10125 !! options
10126 replace=10,"xxx"
10127 !! input
10128 start
10129 ==a==
10130 ===aa===
10131 ====aaa====
10132 ==b==
10133 ===ba===
10134 ===bb===
10135 ====bba====
10136 ===bc===
10137 ==c==
10138 ===ca===
10139 !! result
10140 start
10141 ==a==
10142 ===aa===
10143 ====aaa====
10144 ==b==
10145 ===ba===
10146 ===bb===
10147 ====bba====
10148 ===bc===
10149 ==c==
10150 xxx
10151 !! end
10152
10153 !! test
10154 Section replacement test with initial whitespace (bug 13728)
10155 !! options
10156 replace=2,"xxx"
10157 !! input
10158 Preformatted initial line
10159 ==a==
10160 ===a===
10161 !! result
10162 Preformatted initial line
10163 ==a==
10164 xxx
10165 !! end
10166
10167
10168 !! test
10169 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10170 !! options
10171 section=1
10172 !! input
10173 ==a==
10174 a
10175 !! result
10176 ==a==
10177 a
10178 !! end
10179
10180 !! test
10181 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10182 !! options
10183 section=1
10184 !! input
10185 ==a==
10186 a
10187 !! result
10188 ==a==
10189 a
10190 !! end
10191
10192
10193 !! test
10194 Section extraction, <pre> around bogus header (bug 10309)
10195 !! options
10196 noxml section=2
10197 !! input
10198 == Section One ==
10199 <pre>
10200 =======
10201 </pre>
10202
10203 == Section Two ==
10204 stuff
10205 !! result
10206 == Section Two ==
10207 stuff
10208 !! end
10209
10210 !! test
10211 Section replacement, <pre> around bogus header (bug 10309)
10212 !! options
10213 noxml replace=2,"xxx"
10214 !! input
10215 == Section One ==
10216 <pre>
10217 =======
10218 </pre>
10219
10220 == Section Two ==
10221 stuff
10222 !! result
10223 == Section One ==
10224 <pre>
10225 =======
10226 </pre>
10227
10228 xxx
10229 !! end
10230
10231
10232
10233 !! test
10234 Handling of &#x0A; in URLs
10235 !! input
10236 **irc://&#x0A;a
10237 !! result
10238 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10239 </li></ul>
10240 </li></ul>
10241
10242 !!end
10243
10244 !! test
10245 5 quotes, code coverage +1 line
10246 !! input
10247 '''''
10248 !! result
10249 !! end
10250
10251 !! test
10252 Special:Search page linking.
10253 !! input
10254 {{Special:search}}
10255 !! result
10256 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10257 </p>
10258 !! end
10259
10260 !! test
10261 Say the magic word
10262 !! input
10263 * {{PAGENAME}}
10264 * {{BASEPAGENAME}}
10265 * {{SUBPAGENAME}}
10266 * {{SUBPAGENAMEE}}
10267 * {{BASEPAGENAME}}
10268 * {{BASEPAGENAMEE}}
10269 * {{TALKPAGENAME}}
10270 * {{TALKPAGENAMEE}}
10271 * {{SUBJECTPAGENAME}}
10272 * {{SUBJECTPAGENAMEE}}
10273 * {{NAMESPACEE}}
10274 * {{NAMESPACE}}
10275 * {{TALKSPACE}}
10276 * {{TALKSPACEE}}
10277 * {{SUBJECTSPACE}}
10278 * {{SUBJECTSPACEE}}
10279 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10280 !! result
10281 <ul><li> Parser test
10282 </li><li> Parser test
10283 </li><li> Parser test
10284 </li><li> Parser_test
10285 </li><li> Parser test
10286 </li><li> Parser_test
10287 </li><li> Talk:Parser test
10288 </li><li> Talk:Parser_test
10289 </li><li> Parser test
10290 </li><li> Parser_test
10291 </li><li>
10292 </li><li>
10293 </li><li> Talk
10294 </li><li> Talk
10295 </li><li>
10296 </li><li>
10297 </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>
10298 </li></ul>
10299
10300 !! end
10301 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10302
10303 !! test
10304 Gallery
10305 !! input
10306 <gallery>
10307 image1.png |
10308 image2.gif|||||
10309
10310 image3|
10311 image4 |300px| centre
10312 image5.svg| http://///////
10313 [[x|xx]]]]
10314 * image6
10315 </gallery>
10316 !! result
10317 <ul class="gallery">
10318 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10319 <div style="height: 150px;">Image1.png</div>
10320 <div class="gallerytext">
10321 </div>
10322 </div></li>
10323 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10324 <div style="height: 150px;">Image2.gif</div>
10325 <div class="gallerytext">
10326 <p>||||
10327 </p>
10328 </div>
10329 </div></li>
10330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10331 <div style="height: 150px;">Image3</div>
10332 <div class="gallerytext">
10333 </div>
10334 </div></li>
10335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10336 <div style="height: 150px;">Image4</div>
10337 <div class="gallerytext">
10338 <p>300px| centre
10339 </p>
10340 </div>
10341 </div></li>
10342 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10343 <div style="height: 150px;">Image5.svg</div>
10344 <div class="gallerytext">
10345 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10346 </p>
10347 </div>
10348 </div></li>
10349 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10350 <div style="height: 150px;">* image6</div>
10351 <div class="gallerytext">
10352 </div>
10353 </div></li>
10354 </ul>
10355
10356 !! end
10357
10358 !! test
10359 Gallery (with options)
10360 !! input
10361 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10362 File:Nonexistant.jpg|caption
10363 File:Nonexistant.jpg
10364 image:foobar.jpg|some '''caption''' [[Main Page]]
10365 image:foobar.jpg
10366 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10367 </gallery>
10368 !! result
10369 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10370 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10371 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10372 <div style="height: 70px;">Nonexistant.jpg</div>
10373 <div class="gallerytext">
10374 <p>caption
10375 </p>
10376 </div>
10377 </div></li>
10378 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10379 <div style="height: 70px;">Nonexistant.jpg</div>
10380 <div class="gallerytext">
10381 </div>
10382 </div></li>
10383 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10384 <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>
10385 <div class="gallerytext">
10386 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10387 </p>
10388 </div>
10389 </div></li>
10390 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10391 <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>
10392 <div class="gallerytext">
10393 </div>
10394 </div></li>
10395 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10396 <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>
10397 <div class="gallerytext">
10398 <p>Blabla|blabla.
10399 </p>
10400 </div>
10401 </div></li>
10402 </ul>
10403
10404 !! end
10405
10406 !! test
10407 Gallery with wikitext inside caption
10408 !! input
10409 <gallery>
10410 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10411 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10412 </gallery>
10413 !! result
10414 <ul class="gallery">
10415 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10416 <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>
10417 <div class="gallerytext">
10418 <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>
10419 </p>
10420 </div>
10421 </div></li>
10422 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10423 <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>
10424 <div class="gallerytext">
10425 <p>This is a test template
10426 </p>
10427 </div>
10428 </div></li>
10429 </ul>
10430
10431 !! end
10432
10433 !! test
10434 gallery (with showfilename option)
10435 !! input
10436 <gallery showfilename>
10437 File:Nonexistant.jpg|caption
10438 File:Nonexistant.jpg
10439 image:foobar.jpg|some '''caption''' [[Main Page]]
10440 File:Foobar.jpg
10441 </gallery>
10442 !! result
10443 <ul class="gallery">
10444 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10445 <div style="height: 150px;">Nonexistant.jpg</div>
10446 <div class="gallerytext">
10447 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10448 caption
10449 </p>
10450 </div>
10451 </div></li>
10452 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10453 <div style="height: 150px;">Nonexistant.jpg</div>
10454 <div class="gallerytext">
10455 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10456 </p>
10457 </div>
10458 </div></li>
10459 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10460 <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>
10461 <div class="gallerytext">
10462 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10463 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10464 </p>
10465 </div>
10466 </div></li>
10467 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10468 <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>
10469 <div class="gallerytext">
10470 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10471 </p>
10472 </div>
10473 </div></li>
10474 </ul>
10475
10476 !! end
10477
10478 !! test
10479 Gallery (with namespace-less filenames)
10480 !! input
10481 <gallery>
10482 File:Nonexistant.jpg
10483 Nonexistant.jpg
10484 image:foobar.jpg
10485 foobar.jpg
10486 </gallery>
10487 !! result
10488 <ul class="gallery">
10489 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10490 <div style="height: 150px;">Nonexistant.jpg</div>
10491 <div class="gallerytext">
10492 </div>
10493 </div></li>
10494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10495 <div style="height: 150px;">Nonexistant.jpg</div>
10496 <div class="gallerytext">
10497 </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="Foobar.jpg" 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 </div>
10503 </div></li>
10504 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10505 <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>
10506 <div class="gallerytext">
10507 </div>
10508 </div></li>
10509 </ul>
10510
10511 !! end
10512
10513 !! test
10514 HTML Hex character encoding (spells the word "JavaScript")
10515 !! input
10516 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10517 !! result
10518 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10519 </p>
10520 !! end
10521
10522 !! test
10523 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10524 !! input
10525 &#xsee;&#XSEE;
10526 !! result
10527 <p>&amp;#xsee;&amp;#XSEE;
10528 </p>
10529 !! end
10530
10531 !! test
10532 HTML Hex character encoding mixed case
10533 !! input
10534 &#xEE;&#Xee;
10535 !! result
10536 <p>&#xee;&#xee;
10537 </p>
10538 !! end
10539
10540 !! test
10541 __FORCETOC__ override
10542 !! input
10543 __NEWSECTIONLINK__
10544 __FORCETOC__
10545 !! result
10546 <p><br />
10547 </p>
10548 !! end
10549
10550 !! test
10551 ISBN code coverage
10552 !! input
10553 ISBN 978-0-1234-56&#x20;789
10554 !! result
10555 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10556 </p>
10557 !! end
10558
10559 !! test
10560 ISBN followed by 5 spaces
10561 !! input
10562 ISBN
10563 !! result
10564 <p>ISBN
10565 </p>
10566 !! end
10567
10568 !! test
10569 Double ISBN
10570 !! input
10571 ISBN ISBN 1234567890
10572 !! result
10573 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10574 </p>
10575 !! end
10576
10577 !! test
10578 Bug 22905: <abbr> followed by ISBN followed by </a>
10579 !! input
10580 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10581 !! result
10582 <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>
10583 </p>
10584 !! end
10585
10586 !! test
10587 Double RFC
10588 !! input
10589 RFC RFC 1234
10590 !! result
10591 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10592 </p>
10593 !! end
10594
10595 !! test
10596 Double RFC with a wiki link
10597 !! input
10598 RFC [[RFC 1234]]
10599 !! result
10600 <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>
10601 </p>
10602 !! end
10603
10604 !! test
10605 RFC code coverage
10606 !! input
10607 RFC 983&#x20;987
10608 !! result
10609 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10610 </p>
10611 !! end
10612
10613 !! test
10614 Centre-aligned image
10615 !! input
10616 [[Image:foobar.jpg|centre]]
10617 !! result
10618 <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>
10619
10620 !!end
10621
10622 !! test
10623 None-aligned image
10624 !! input
10625 [[Image:foobar.jpg|none]]
10626 !! result
10627 <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>
10628
10629 !!end
10630
10631 !! test
10632 Width + Height sized image (using px) (height is ignored)
10633 !! input
10634 [[Image:foobar.jpg|640x480px]]
10635 !! result
10636 <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>
10637 </p>
10638 !!end
10639
10640 !! test
10641 Width-sized image (using px, no following whitespace)
10642 !! input
10643 [[Image:foobar.jpg|640px]]
10644 !! result
10645 <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>
10646 </p>
10647 !!end
10648
10649 !! test
10650 Width-sized image (using px, with following whitespace - test regression from r39467)
10651 !! input
10652 [[Image:foobar.jpg|640px ]]
10653 !! result
10654 <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>
10655 </p>
10656 !!end
10657
10658 !! test
10659 Width-sized image (using px, with preceding whitespace - test regression from r39467)
10660 !! input
10661 [[Image:foobar.jpg| 640px]]
10662 !! result
10663 <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>
10664 </p>
10665 !!end
10666
10667 !! test
10668 Another italics / bold test
10669 !! input
10670 ''' ''x'
10671 !! result
10672 <pre>'<i> </i>x'
10673 </pre>
10674 !!end
10675
10676 # Note the results may be incorrect, as parserTest output included this:
10677 # XML error: Mismatched tag at byte 6120:
10678 # ...<dd> </dt></dl> </dd...
10679 !! test
10680 dt/dd/dl test
10681 !! options
10682 disabled
10683 !! input
10684 :;;;::
10685 !! result
10686 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10687 </dd></dl>
10688 </dd></dl>
10689 </dt></dl>
10690 </dt></dl>
10691 </dt></dl>
10692 </dd></dl>
10693
10694 !!end
10695
10696
10697 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10698 !! test
10699 Images with the "|" character in the comment
10700 !! input
10701 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10702 !! result
10703 <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>
10704
10705 !!end
10706
10707 !! test
10708 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10709 !! input
10710 <html><script>alert(1);</script></html>
10711 !! result
10712 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10713 </p>
10714 !! end
10715
10716 !! test
10717 HTML with raw HTML ($wgRawHtml==true)
10718 !! options
10719 rawhtml
10720 !! input
10721 <html><script>alert(1);</script></html>
10722 !! result
10723 <p><script>alert(1);</script>
10724 </p>
10725 !! end
10726
10727 !! test
10728 Parents of subpages, one level up
10729 !! options
10730 subpage title=[[Subpage test/L1/L2/L3]]
10731 !! input
10732 [[../|L2]]
10733 !! result
10734 <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>
10735 </p>
10736 !! end
10737
10738
10739 !! test
10740 Parents of subpages, one level up, not named
10741 !! options
10742 subpage title=[[Subpage test/L1/L2/L3]]
10743 !! input
10744 [[../]]
10745 !! result
10746 <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>
10747 </p>
10748 !! end
10749
10750
10751
10752 !! test
10753 Parents of subpages, two levels up
10754 !! options
10755 subpage title=[[Subpage test/L1/L2/L3]]
10756 !! input
10757 [[../../|L1]]2
10758
10759 [[../../|L1]]l
10760 !! result
10761 <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
10762 </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>
10763 </p>
10764 !! end
10765
10766 !! test
10767 Parents of subpages, two levels up, without trailing slash or name.
10768 !! options
10769 subpage title=[[Subpage test/L1/L2/L3]]
10770 !! input
10771 [[../..]]
10772 !! result
10773 <p>[[../..]]
10774 </p>
10775 !! end
10776
10777 !! test
10778 Parents of subpages, two levels up, with lots of extra trailing slashes.
10779 !! options
10780 subpage title=[[Subpage test/L1/L2/L3]]
10781 !! input
10782 [[../../////]]
10783 !! result
10784 <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>
10785 </p>
10786 !! end
10787
10788 !! test
10789 Definition list code coverage
10790 !! input
10791 ; title : def
10792 ; title : def
10793 ;title: def
10794 !! result
10795 <dl><dt> title &#160;</dt><dd> def
10796 </dd><dt> title&#160;</dt><dd> def
10797 </dd><dt>title</dt><dd> def
10798 </dd></dl>
10799
10800 !! end
10801
10802 !! test
10803 Don't fall for the self-closing div
10804 !! input
10805 <div>hello world</div/>
10806 !! result
10807 <div>hello world</div>
10808
10809 !! end
10810
10811 !! test
10812 MSGNW magic word
10813 !! input
10814 {{MSGNW:msg}}
10815 !! result
10816 <p>&#91;&#91;:Template:Msg&#93;&#93;
10817 </p>
10818 !! end
10819
10820 !! test
10821 RAW magic word
10822 !! input
10823 {{RAW:QUERTY}}
10824 !! result
10825 <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>
10826 </p>
10827 !! end
10828
10829 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10830 !! test
10831 Always escape literal '>' in output, not just after '<'
10832 !! input
10833 ><>
10834 !! result
10835 <p>&gt;&lt;&gt;
10836 </p>
10837 !! end
10838
10839 !! test
10840 Template caching
10841 !! input
10842 {{Test}}
10843 {{Test}}
10844 !! result
10845 <p>This is a test template
10846 This is a test template
10847 </p>
10848 !! end
10849
10850
10851 !! article
10852 MediaWiki:Fake
10853 !! text
10854 ==header==
10855 !! endarticle
10856
10857 !! test
10858 Inclusion of !userCanEdit() content
10859 !! input
10860 {{MediaWiki:Fake}}
10861 !! result
10862 <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>
10863
10864 !! end
10865
10866
10867 !! test
10868 Out-of-order TOC heading levels
10869 !! input
10870 ==2==
10871 ======6======
10872 ===3===
10873 =1=
10874 =====5=====
10875 ==2==
10876 !! result
10877 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10878 <ul>
10879 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10880 <ul>
10881 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10882 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10883 </ul>
10884 </li>
10885 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10886 <ul>
10887 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10888 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10889 </ul>
10890 </li>
10891 </ul>
10892 </td></tr></table>
10893 <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>
10894 <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>
10895 <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>
10896 <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>
10897 <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>
10898 <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>
10899
10900 !! end
10901
10902
10903 !! test
10904 ISBN with a dummy number
10905 !! input
10906 ISBN ---
10907 !! result
10908 <p>ISBN ---
10909 </p>
10910 !! end
10911
10912
10913 !! test
10914 ISBN with space-delimited number
10915 !! input
10916 ISBN 92 9017 032 8
10917 !! result
10918 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10919 </p>
10920 !! end
10921
10922
10923 !! test
10924 ISBN with multiple spaces, no number
10925 !! input
10926 ISBN foo
10927 !! result
10928 <p>ISBN foo
10929 </p>
10930 !! end
10931
10932
10933 !! test
10934 ISBN length
10935 !! input
10936 ISBN 123456789
10937
10938 ISBN 1234567890
10939
10940 ISBN 12345678901
10941 !! result
10942 <p>ISBN 123456789
10943 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10944 </p><p>ISBN 12345678901
10945 </p>
10946 !! end
10947
10948
10949 !! test
10950 ISBN with trailing year (bug 8110)
10951 !! input
10952 ISBN 1-234-56789-0 - 2006
10953
10954 ISBN 1 234 56789 0 - 2006
10955 !! result
10956 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10957 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10958 </p>
10959 !! end
10960
10961
10962 !! test
10963 anchorencode
10964 !! input
10965 {{anchorencode:foo bar©#%n}}
10966 !! result
10967 <p>foo_bar.C2.A9.23.25n
10968 </p>
10969 !! end
10970
10971 !! test
10972 anchorencode trims spaces
10973 !! input
10974 {{anchorencode: __pretty__please__}}
10975 !! result
10976 <p>pretty_please
10977 </p>
10978 !! end
10979
10980 !! test
10981 anchorencode deals with links
10982 !! input
10983 {{anchorencode: [[hello|world]] [[hi]]}}
10984 !! result
10985 <p>world_hi
10986 </p>
10987 !! end
10988
10989 !! test
10990 anchorencode deals with templates
10991 !! input
10992 {{anchorencode: {{Foo}} }}
10993 !! result
10994 <p>FOO
10995 </p>
10996 !! end
10997
10998 !! test
10999 anchorencode encodes like the TOC generator: (bug 18431)
11000 !! input
11001 === _ +:.3A%3A&&amp;]] ===
11002 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11003 __NOEDITSECTION__
11004 !! result
11005 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
11006 <p>.2B:.3A.253A.26.26.5D.5D
11007 </p>
11008 !! end
11009
11010 # Expected output in the following test is not necessarily expected (there
11011 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11012 # only testing for well-formedness.
11013 !! test
11014 Bug 6200: blockquotes and paragraph formatting
11015 !! input
11016 <blockquote>
11017 foo
11018 </blockquote>
11019
11020 bar
11021
11022 baz
11023 !! result
11024 <blockquote>
11025 foo
11026 </blockquote>
11027 <p>bar
11028 </p>
11029 <pre>baz
11030 </pre>
11031 !! end
11032
11033 !! test
11034 Bug 8293: Use of center tag ruins paragraph formatting
11035 !! input
11036 <center>
11037 foo
11038 </center>
11039
11040 bar
11041
11042 baz
11043 !! result
11044 <center>
11045 <p>foo
11046 </p>
11047 </center>
11048 <p>bar
11049 </p>
11050 <pre>baz
11051 </pre>
11052 !! end
11053
11054
11055 ###
11056 ### Language variants related tests
11057 ###
11058 !! test
11059 Self-link in language variants
11060 !! options
11061 title=[[Dunav]] language=sr
11062 !! input
11063 Both [[Dunav]] and [[Дунав]] are names for this river.
11064 !! result
11065 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11066 </p>
11067 !!end
11068
11069 !! article
11070 Дуна
11071 !! text
11072 content
11073 !! endarticle
11074
11075 !! test
11076 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11077 !! options
11078 title=[[Duna]] language=sr
11079 !! input
11080 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11081 !! result
11082 <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.
11083 </p>
11084 !! end
11085
11086 !! test
11087 Link to pages in language variants
11088 !! options
11089 language=sr
11090 !! input
11091 Main Page can be written as [[Маин Паге]]
11092 !! result
11093 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11094 </p>
11095 !!end
11096
11097
11098 !! test
11099 Multiple links to pages in language variants
11100 !! options
11101 language=sr
11102 !! input
11103 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11104 !! result
11105 <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>.
11106 </p>
11107 !!end
11108
11109
11110 !! test
11111 Simple template in language variants
11112 !! options
11113 language=sr
11114 !! input
11115 {{тест}}
11116 !! result
11117 <p>This is a test template
11118 </p>
11119 !! end
11120
11121
11122 !! test
11123 Template with explicit namespace in language variants
11124 !! options
11125 language=sr
11126 !! input
11127 {{Template:тест}}
11128 !! result
11129 <p>This is a test template
11130 </p>
11131 !! end
11132
11133
11134 !! test
11135 Basic test for template parameter in language variants
11136 !! options
11137 language=sr
11138 !! input
11139 {{парамтест|param=foo}}
11140 !! result
11141 <p>This is a test template with parameter foo
11142 </p>
11143 !! end
11144
11145
11146 !! test
11147 Simple category in language variants
11148 !! options
11149 language=sr cat
11150 !! input
11151 [[Category:МедиаWики Усер'с Гуиде]]
11152 !! result
11153 <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>
11154 !! end
11155
11156
11157 !! article
11158 Category:分类
11159 !! text
11160 blah
11161 !! endarticle
11162
11163 !! article
11164 Category:分類
11165 !! text
11166 blah
11167 !! endarticle
11168
11169 !! test
11170 Don't convert blue categorylinks to another variant (bug 33210)
11171 !! options
11172 language=zh cat
11173 !! input
11174 [[A]][[Category:分类]]
11175 !! result
11176 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11177 !! end
11178
11179
11180 !! test
11181 Stripping -{}- tags (language variants)
11182 !! options
11183 language=sr
11184 !! input
11185 Latin proverb: -{Ne nuntium necare}-
11186 !! result
11187 <p>Latin proverb: Ne nuntium necare
11188 </p>
11189 !! end
11190
11191
11192 !! test
11193 Prevent conversion with -{}- tags (language variants)
11194 !! options
11195 language=sr variant=sr-ec
11196 !! input
11197 Latinski: -{Ne nuntium necare}-
11198 !! result
11199 <p>Латински: Ne nuntium necare
11200 </p>
11201 !! end
11202
11203
11204 !! test
11205 Prevent conversion of text with -{}- tags (language variants)
11206 !! options
11207 language=sr variant=sr-ec
11208 !! input
11209 Latinski: -{Ne nuntium necare}-
11210 !! result
11211 <p>Латински: Ne nuntium necare
11212 </p>
11213 !! end
11214
11215
11216 !! test
11217 Prevent conversion of links with -{}- tags (language variants)
11218 !! options
11219 language=sr variant=sr-ec
11220 !! input
11221 -{[[Main Page]]}-
11222 !! result
11223 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11224 </p>
11225 !! end
11226
11227
11228 !! test
11229 -{}- tags within headlines (within html for parserConvert())
11230 !! options
11231 language=sr variant=sr-ec
11232 !! input
11233 == -{Naslov}- ==
11234 !! result
11235 <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>
11236
11237 !! end
11238
11239
11240 !! test
11241 Explicit definition of language variant alternatives
11242 !! options
11243 language=zh variant=zh-tw
11244 !! input
11245 -{zh:China;zh-tw:Taiwan}-, not China
11246 !! result
11247 <p>Taiwan, not China
11248 </p>
11249 !! end
11250
11251
11252 !! test
11253 Conversion around HTML tags
11254 !! options
11255 language=sr variant=sr-ec
11256 !! input
11257 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11258 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11259 !! result
11260 <p>
11261 <span title="ЛаCтин">ски</span>
11262 </p>
11263 !! end
11264
11265
11266 !! test
11267 Explicit session-wise language variant mapping (A flag and - flag)
11268 !! options
11269 language=zh variant=zh-tw
11270 !! input
11271 Taiwan is not China.
11272 But -{A|zh:China;zh-tw:Taiwan}- is China,
11273 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11274 and -{China}- is China.
11275 !! result
11276 <p>Taiwan is not China.
11277 But Taiwan is Taiwan,
11278 (This should be stripped!)
11279 and China is China.
11280 </p>
11281 !! end
11282
11283 !! test
11284 Explicit session-wise language variant mapping (H flag for hide)
11285 !! options
11286 language=zh variant=zh-tw
11287 !! input
11288 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11289 Taiwan is China.
11290 !! result
11291 <p>(This should be stripped!)
11292 Taiwan is Taiwan.
11293 </p>
11294 !! end
11295
11296 !! test
11297 Adding explicit conversion rule for title (T flag)
11298 !! options
11299 language=zh variant=zh-tw showtitle
11300 !! input
11301 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11302 !! result
11303 Taiwan
11304 <p>Should be stripped!
11305 </p>
11306 !! end
11307
11308 !! test
11309 Testing that changing the language variant here in the tests actually works
11310 !! options
11311 language=zh variant=zh showtitle
11312 !! input
11313 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11314 !! result
11315 China
11316 <p>Should be stripped!
11317 </p>
11318 !! end
11319
11320 !! test
11321 Recursive conversion of alt and title attrs shouldn't clear converter state
11322 !! options
11323 language=zh variant=zh-cn showtitle
11324 !! input
11325 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11326 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11327 !! result
11328 China
11329 <p>
11330 Should be stripped<span title="Exclamation">!</span>
11331 </p>
11332 !! end
11333
11334 !! test
11335 Bug 24072: more test on conversion rule for title
11336 !! options
11337 language=zh variant=zh-tw showtitle
11338 !! input
11339 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11340 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11341 !! result
11342 Taiwan
11343 <p>This should be stripped!
11344 This won't take interferes with the title rule.
11345 </p>
11346 !! end
11347
11348 !! test
11349 Raw output of variant escape tags (R flag)
11350 !! options
11351 language=zh variant=zh-tw
11352 !! input
11353 Raw: -{R|zh:China;zh-tw:Taiwan}-
11354 !! result
11355 <p>Raw: zh:China;zh-tw:Taiwan
11356 </p>
11357 !! end
11358
11359 !! test
11360 Nested using of manual convert syntax
11361 !! options
11362 language=zh variant=zh-hk
11363 !! input
11364 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11365 !! result
11366 <p>Nested: Hello Hong Kong!
11367 </p>
11368 !! end
11369
11370 !! test
11371 Proper conversion of text in external links
11372 !! options
11373 language=sr variant=sr-ec
11374 !! input
11375 http://www.google.com
11376 gopher://www.google.com
11377 [http://www.google.com http://www.google.com]
11378 [gopher://www.google.com gopher://www.google.com]
11379 [https://www.google.com irc://www.google.com]
11380 [ftp://www.google.com www.google.com/ftp://dir]
11381 [//www.google.com www.google.com]
11382 !! result
11383 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11384 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11385 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11386 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11387 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11388 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11389 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11390 </p>
11391 !! end
11392
11393 !! test
11394 Do not convert roman numbers to language variants
11395 !! options
11396 language=sr variant=sr-ec
11397 !! input
11398 Fridrih IV je car.
11399 !! result
11400 <p>Фридрих IV је цар.
11401 </p>
11402 !! end
11403
11404 !! test
11405 Unclosed language converter markup "-{"
11406 !! options
11407 language=sr
11408 !! input
11409 -{T|hello
11410 !! result
11411 <p>-{T|hello
11412 </p>
11413 !! end
11414
11415 !! test
11416 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11417 !! options
11418 language=sr
11419 !! input
11420 -{R|=&gt;}-
11421 !! result
11422 <p>=&gt;
11423 </p>
11424 !!end
11425
11426 !!article
11427 Template:Bullet
11428 !!text
11429 * Bar
11430 !!endarticle
11431
11432 !! test
11433 Bug 529: Uncovered bullet
11434 !! input
11435 * Foo {{bullet}}
11436 !! result
11437 <ul><li> Foo
11438 </li><li> Bar
11439 </li></ul>
11440
11441 !! end
11442
11443 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11444 # Templates in Wikipedia rely on this behavior, as tidy has always been
11445 # enabled there. These tests are normally run *without* tidy, so specify the
11446 # full output here.
11447 # To test realistic parsing behavior, apply a tidy-like transformation to both
11448 # the expected output and your parser's output.
11449 !! test
11450 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11451 !! input
11452 ******* Foo {{bullet}}
11453 !! result
11454 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11455 </li></ul>
11456 </li></ul>
11457 </li></ul>
11458 </li></ul>
11459 </li></ul>
11460 </li></ul>
11461 </li><li> Bar
11462 </li></ul>
11463
11464 !! end
11465
11466 !! test
11467 Bug 529: Uncovered table already at line-start
11468 !! input
11469 x
11470
11471 {{table}}
11472 y
11473 !! result
11474 <p>x
11475 </p>
11476 <table>
11477 <tr>
11478 <td> 1 </td>
11479 <td> 2
11480 </td></tr>
11481 <tr>
11482 <td> 3 </td>
11483 <td> 4
11484 </td></tr></table>
11485 <p>y
11486 </p>
11487 !! end
11488
11489 !! test
11490 Bug 529: Uncovered bullet in parser function result
11491 !! input
11492 * Foo {{lc:{{bullet}} }}
11493 !! result
11494 <ul><li> Foo
11495 </li><li> bar
11496 </li></ul>
11497
11498 !! end
11499
11500 !! test
11501 Bug 5678: Double-parsed template argument
11502 !! input
11503 {{lc:{{{1}}}|hello}}
11504 !! result
11505 <p>{{{1}}}
11506 </p>
11507 !! end
11508
11509 !! test
11510 Bug 5678: Double-parsed template invocation
11511 !! input
11512 {{lc:{{paramtest {{!}} param = hello }} }}
11513 !! result
11514 <p>{{paramtest | param = hello }}
11515 </p>
11516 !! end
11517
11518 !! test
11519 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11520 !! options
11521 language=cs
11522 title=[[Main Page]]
11523 !! input
11524 {{PRVNÍVELKÉ:ěščř}}
11525 {{prvnívelké:ěščř}}
11526 {{PRVNÍMALÉ:ěščř}}
11527 {{prvnímalé:ěščř}}
11528 {{MALÁ:ěščř}}
11529 {{malá:ěščř}}
11530 {{VELKÁ:ěščř}}
11531 {{velká:ěščř}}
11532 !! result
11533 <p>Ěščř
11534 Ěščř
11535 ěščř
11536 ěščř
11537 ěščř
11538 ěščř
11539 ĚŠČŘ
11540 ĚŠČŘ
11541 </p>
11542 !! end
11543
11544 !! test
11545 Morwen/13: Unclosed link followed by heading
11546 !! input
11547 [[link
11548 ==heading==
11549 !! result
11550 <p>[[link
11551 </p>
11552 <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>
11553
11554 !! end
11555
11556 !! test
11557 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11558 !! input
11559 {{foo|
11560 =heading=
11561 !! result
11562 <p>{{foo|
11563 </p>
11564 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11565
11566 !! end
11567
11568 !! test
11569 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11570 !! input
11571 {{foo|
11572 ==heading==
11573 !! result
11574 <p>{{foo|
11575 </p>
11576 <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>
11577
11578 !! end
11579
11580 !! test
11581 Tildes in comments
11582 !! options
11583 pst
11584 !! input
11585 <!-- ~~~~ -->
11586 !! result
11587 <!-- ~~~~ -->
11588 !! end
11589
11590 !! test
11591 Paragraphs inside divs (no extra line breaks)
11592 !! input
11593 <div>Line one
11594
11595 Line two</div>
11596 !! result
11597 <div>Line one
11598 Line two</div>
11599
11600 !! end
11601
11602 !! test
11603 Paragraphs inside divs (extra line break on open)
11604 !! input
11605 <div>
11606 Line one
11607
11608 Line two</div>
11609 !! result
11610 <div>
11611 <p>Line one
11612 </p>
11613 Line two</div>
11614
11615 !! end
11616
11617 !! test
11618 Paragraphs inside divs (extra line break on close)
11619 !! input
11620 <div>Line one
11621
11622 Line two
11623 </div>
11624 !! result
11625 <div>Line one
11626 <p>Line two
11627 </p>
11628 </div>
11629
11630 !! end
11631
11632 !! test
11633 Paragraphs inside divs (extra line break on open and close)
11634 !! input
11635 <div>
11636 Line one
11637
11638 Line two
11639 </div>
11640 !! result
11641 <div>
11642 <p>Line one
11643 </p><p>Line two
11644 </p>
11645 </div>
11646
11647 !! end
11648
11649 !! test
11650 Nesting tags, paragraphs on lines which begin with <div>
11651 !! options
11652 disabled
11653 !! input
11654 <div></div><strong>A
11655 B</strong>
11656 !! result
11657 <div></div>
11658 <p><strong>A
11659 B</strong>
11660 </p>
11661 !! end
11662
11663 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11664 !! test
11665 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11666 !! options
11667 disabled
11668 !! input
11669 <blockquote>Line one
11670
11671 Line two</blockquote>
11672 !! result
11673 <blockquote>Line one
11674 Line two</blockquote>
11675
11676 !! end
11677
11678 !! test
11679 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11680 !! options
11681 disabled
11682 !! input
11683 <blockquote>
11684 Line one
11685
11686 Line two</blockquote>
11687 !! result
11688 <blockquote>
11689 <p>Line one
11690 </p>
11691 Line two</blockquote>
11692
11693 !! end
11694
11695 !! test
11696 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11697 !! options
11698 disabled
11699 !! input
11700 <blockquote>Line one
11701
11702 Line two
11703 </blockquote>
11704 !! result
11705 <blockquote>Line one
11706 <p>Line two
11707 </p>
11708 </blockquote>
11709
11710 !! end
11711
11712 !! test
11713 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11714 !! options
11715 disabled
11716 !! input
11717 <blockquote>
11718 Line one
11719
11720 Line two
11721 </blockquote>
11722 !! result
11723 <blockquote>
11724 <p>Line one
11725 </p><p>Line two
11726 </p>
11727 </blockquote>
11728
11729 !! end
11730
11731 !! test
11732 Paragraphs inside blockquotes/divs (no extra line breaks)
11733 !! input
11734 <blockquote><div>Line one
11735
11736 Line two</div></blockquote>
11737 !! result
11738 <blockquote><div>Line one
11739 Line two</div></blockquote>
11740
11741 !! end
11742
11743 !! test
11744 Paragraphs inside blockquotes/divs (extra line break on open)
11745 !! input
11746 <blockquote><div>
11747 Line one
11748
11749 Line two</div></blockquote>
11750 !! result
11751 <blockquote><div>
11752 <p>Line one
11753 </p>
11754 Line two</div></blockquote>
11755
11756 !! end
11757
11758 !! test
11759 Paragraphs inside blockquotes/divs (extra line break on close)
11760 !! input
11761 <blockquote><div>Line one
11762
11763 Line two
11764 </div></blockquote>
11765 !! result
11766 <blockquote><div>Line one
11767 <p>Line two
11768 </p>
11769 </div></blockquote>
11770
11771 !! end
11772
11773 !! test
11774 Paragraphs inside blockquotes/divs (extra line break on open and close)
11775 !! input
11776 <blockquote><div>
11777 Line one
11778
11779 Line two
11780 </div></blockquote>
11781 !! result
11782 <blockquote><div>
11783 <p>Line one
11784 </p><p>Line two
11785 </p>
11786 </div></blockquote>
11787
11788 !! end
11789
11790 !! test
11791 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11792 !! options
11793 wgLinkHolderBatchSize=0
11794 !! input
11795 [[meatball:1]]
11796 [[meatball:2]]
11797 [[meatball:3]]
11798 !! result
11799 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11800 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11801 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11802 </p>
11803 !! end
11804
11805 !! test
11806 Free external link invading image caption
11807 !! input
11808 [[Image:Foobar.jpg|thumb|http://x|hello]]
11809 !! result
11810 <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>
11811
11812 !! end
11813
11814 !! test
11815 Bug 15196: localised external link numbers
11816 !! options
11817 language=fa
11818 !! input
11819 [http://en.wikipedia.org/]
11820 !! result
11821 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11822 </p>
11823 !! end
11824
11825 !! test
11826 Multibyte character in padleft
11827 !! input
11828 {{padleft:-Hello|7|Æ}}
11829 !! result
11830 <p>Æ-Hello
11831 </p>
11832 !! end
11833
11834 !! test
11835 Multibyte character in padright
11836 !! input
11837 {{padright:Hello-|7|Æ}}
11838 !! result
11839 <p>Hello-Æ
11840 </p>
11841 !! end
11842
11843 !!test
11844 formatdate parser function
11845 !!input
11846 {{#formatdate:2009-03-24}}
11847 !! result
11848 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11849 </p>
11850 !! end
11851
11852 !!test
11853 formatdate parser function, with default format
11854 !!input
11855 {{#formatdate:2009-03-24|mdy}}
11856 !! result
11857 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11858 </p>
11859 !! end
11860
11861 !! test
11862 Spacing of numbers in formatted dates
11863 !! input
11864 {{#formatdate:January 15}}
11865 !! result
11866 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11867 </p>
11868 !! end
11869
11870 !! test
11871 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
11872 !! options
11873 language=nl title=[[MediaWiki:Common.css]]
11874 !! input
11875 {{#formatdate:2009-03-24|dmy}}
11876 !! result
11877 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11878 </p>
11879 !! end
11880
11881 #
11882 #
11883 #
11884
11885 #
11886 # Edit comments
11887 #
11888
11889 !! test
11890 Edit comment with link
11891 !! options
11892 comment
11893 !! input
11894 I like the [[Main Page]] a lot
11895 !! result
11896 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11897 !!end
11898
11899 !! test
11900 Edit comment with link and link text
11901 !! options
11902 comment
11903 !! input
11904 I like the [[Main Page|best pages]] a lot
11905 !! result
11906 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11907 !!end
11908
11909 !! test
11910 Edit comment with link and link text with suffix
11911 !! options
11912 comment
11913 !! input
11914 I like the [[Main Page|best page]]s a lot
11915 !! result
11916 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11917 !!end
11918
11919 !! test
11920 Edit comment with section link (non-local, eg in history list)
11921 !! options
11922 comment title=[[Main Page]]
11923 !! input
11924 /* External links */ removed bogus entries
11925 !! result
11926 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11927 !!end
11928
11929 !! test
11930 Edit comment with section link and text before it (non-local, eg in history list)
11931 !! options
11932 comment title=[[Main Page]]
11933 !! input
11934 pre-comment text /* External links */ removed bogus entries
11935 !! result
11936 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>
11937 !!end
11938
11939 !! test
11940 Edit comment with section link (local, eg in diff view)
11941 !! options
11942 comment local title=[[Main Page]]
11943 !! input
11944 /* External links */ removed bogus entries
11945 !! result
11946 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11947 !!end
11948
11949 !! test
11950 Edit comment with subpage link (bug 14080)
11951 !! options
11952 comment
11953 subpage
11954 title=[[Subpage test]]
11955 !! input
11956 Poked at a [[/subpage]] here...
11957 !! result
11958 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11959 !!end
11960
11961 !! test
11962 Edit comment with subpage link and link text (bug 14080)
11963 !! options
11964 comment
11965 subpage
11966 title=[[Subpage test]]
11967 !! input
11968 Poked at a [[/subpage|neat little page]] here...
11969 !! result
11970 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
11971 !!end
11972
11973 !! test
11974 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
11975 !! options
11976 comment
11977 title=[[Subpage test]]
11978 !! input
11979 Poked at a [[/subpage]] here...
11980 !! result
11981 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...
11982 !!end
11983
11984 !! test
11985 Edit comment with bare anchor link (local, as on diff)
11986 !! options
11987 comment
11988 local
11989 title=[[Main Page]]
11990 !!input
11991 [[#section]]
11992 !! result
11993 <a href="#section">#section</a>
11994 !! end
11995
11996 !! test
11997 Edit comment with bare anchor link (non-local, as on history)
11998 !! options
11999 comment
12000 title=[[Main Page]]
12001 !!input
12002 [[#section]]
12003 !! result
12004 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12005 !! end
12006
12007 !! test
12008 Anchor starting with underscore
12009 !!input
12010 [[#_ref|One]]
12011 !! result
12012 <p><a href="#_ref">One</a>
12013 </p>
12014 !! end
12015
12016 !! test
12017 Id starting with underscore
12018 !!input
12019 <div id="_ref"></div>
12020 !! result
12021 <div id="_ref"></div>
12022
12023 !! end
12024
12025 !! test
12026 Space normalisation on autocomment (bug 22784)
12027 !! options
12028 comment
12029 title=[[Main Page]]
12030 !!input
12031 /* __hello__world__ */
12032 !! result
12033 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12034 !! end
12035
12036 !! test
12037 percent-encoding and + signs in comments (Bug 26410)
12038 !! options
12039 comment
12040 !!input
12041 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12042 !! result
12043 <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>
12044 !! end
12045
12046 !! test
12047 Bad images - basic functionality
12048 !! options
12049 disabled
12050 !! input
12051 [[File:Bad.jpg]]
12052 !! result
12053 !! end
12054
12055 !! test
12056 Bad images - bug 16039: text after bad image disappears
12057 !! options
12058 disabled
12059 !! input
12060 Foo bar
12061 [[File:Bad.jpg]]
12062 Bar foo
12063 !! result
12064 <p>Foo bar
12065 </p><p>Bar foo
12066 </p>
12067 !! end
12068
12069 !! test
12070 Verify that displaytitle works (bug #22501) no displaytitle
12071 !! options
12072 showtitle
12073 !! config
12074 wgAllowDisplayTitle=true
12075 wgRestrictDisplayTitle=false
12076 !! input
12077 this is not the the title
12078 !! result
12079 Parser test
12080 <p>this is not the the title
12081 </p>
12082 !! end
12083
12084 !! test
12085 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12086 !! options
12087 showtitle
12088 title=[[Screen]]
12089 !! config
12090 wgAllowDisplayTitle=true
12091 wgRestrictDisplayTitle=false
12092 !! input
12093 this is not the the title
12094 {{DISPLAYTITLE:whatever}}
12095 !! result
12096 whatever
12097 <p>this is not the the title
12098 </p>
12099 !! end
12100
12101 !! test
12102 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12103 !! options
12104 showtitle
12105 title=[[Screen]]
12106 !! config
12107 wgAllowDisplayTitle=true
12108 wgRestrictDisplayTitle=true
12109 !! input
12110 this is not the the title
12111 {{DISPLAYTITLE:whatever}}
12112 !! result
12113 Screen
12114 <p>this is not the the title
12115 </p>
12116 !! end
12117
12118 !! test
12119 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12120 !! options
12121 showtitle
12122 title=[[Screen]]
12123 !! config
12124 wgAllowDisplayTitle=true
12125 wgRestrictDisplayTitle=true
12126 !! input
12127 this is not the the title
12128 {{DISPLAYTITLE:screen}}
12129 !! result
12130 screen
12131 <p>this is not the the title
12132 </p>
12133 !! end
12134
12135 !! test
12136 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12137 !! options
12138 showtitle
12139 title=[[Screen]]
12140 !! config
12141 wgAllowDisplayTitle=false
12142 !! input
12143 this is not the the title
12144 {{DISPLAYTITLE:screen}}
12145 !! result
12146 Screen
12147 <p>this is not the the title
12148 <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>
12149 </p>
12150 !! end
12151
12152 !! test
12153 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12154 !! options
12155 showtitle
12156 title=[[Screen]]
12157 !! config
12158 wgAllowDisplayTitle=false
12159 !! input
12160 this is not the the title
12161 !! result
12162 Screen
12163 <p>this is not the the title
12164 </p>
12165 !! end
12166
12167 !! test
12168 preload: check <noinclude> and <includeonly>
12169 !! options
12170 preload
12171 !! input
12172 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12173 !! result
12174 Hello kind world.
12175 !! end
12176
12177 !! test
12178 preload: check <onlyinclude>
12179 !! options
12180 preload
12181 !! input
12182 Goodbye <onlyinclude>Hello world</onlyinclude>
12183 !! result
12184 Hello world
12185 !! end
12186
12187 !! test
12188 preload: can pass tags through if we want to
12189 !! options
12190 preload
12191 !! input
12192 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12193 !! result
12194 <includeonly>Hello world</includeonly>
12195 !! end
12196
12197 !! test
12198 preload: check that it doesn't try to do tricks
12199 !! options
12200 preload
12201 !! input
12202 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12203 !! result
12204 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12205 !! end
12206
12207 !! test
12208 Play a bit with r67090 and bug 3158
12209 !! options
12210 disabled
12211 !! input
12212 <div style="width:50% !important">&nbsp;</div>
12213 <div style="width:50%&nbsp;!important">&nbsp;</div>
12214 <div style="width:50%&#160;!important">&nbsp;</div>
12215 <div style="border : solid;">&nbsp;</div>
12216 !! result
12217 <div style="width:50% !important">&nbsp;</div>
12218 <div style="width:50% !important">&nbsp;</div>
12219 <div style="width:50% !important">&nbsp;</div>
12220 <div style="border&#160;: solid;">&nbsp;</div>
12221
12222 !! end
12223
12224 !! test
12225 HTML5 data attributes
12226 !! input
12227 <span data-foo="bar">Baz</span>
12228 <p data-abc-def_hij="">Quuz</p>
12229 !! result
12230 <p><span data-foo="bar">Baz</span>
12231 </p>
12232 <p data-abc-def_hij="">Quuz</p>
12233
12234 !! end
12235
12236 !! test
12237 percent-encoding and + signs in internal links (Bug 26410)
12238 !! input
12239 [[User:+%]] [[Page+title%]]
12240 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12241 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12242 [[%33%45]] [[%33%45+]]
12243 !! result
12244 <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>
12245 <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>
12246 <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>
12247 <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>
12248 </p>
12249 !! end
12250
12251 !! test
12252 Special characters in embedded file links (bug 27679)
12253 !! input
12254 [[File:Contains & ampersand.jpg]]
12255 [[File:Does not exist.jpg|Title with & ampersand]]
12256 !! result
12257 <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>
12258 <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>
12259 </p>
12260 !! end
12261
12262
12263 !! test
12264 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12265 !! input
12266 Text&apos;s been normalized?
12267 !! result
12268 <p>Text&#39;s been normalized?
12269 </p>
12270 !! end
12271
12272 !! test
12273 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12274 !! input
12275 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12276 !! result
12277 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12278 </p>
12279 !! end
12280
12281 !! test
12282 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12283 !! input
12284 [http://www.example.org/ ideograms]
12285 !! result
12286 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12287 </p>
12288 !! end
12289
12290 !! test
12291 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12292 !! input
12293 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12294 !! result
12295 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12296 </p>
12297 !! end
12298
12299 !! article
12300 Mediawiki:loop1
12301 !! text
12302 {{Identical|A}}
12303 !! endarticle
12304
12305 !! article
12306 Mediawiki:loop2
12307 !! text
12308 {{Identical|B}}
12309 !! endarticle
12310
12311 !! article
12312 Template:Identical
12313 !! text
12314 {{int:loop1}}
12315 {{int:loop2}}
12316 !! endarticle
12317
12318 !! test
12319 Bug 31098 Template which includes system messages which includes the template
12320 !! input
12321 {{Identical}}
12322 !! result
12323 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12324 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12325 </p>
12326 !! end
12327
12328 !! test
12329 Bug31490 Turkish: ucfirst 'blah'
12330 !! options
12331 language=tr
12332 !! input
12333 {{ucfirst:blah}}
12334 !! result
12335 <p>Blah
12336 </p>
12337 !! end
12338
12339 !! test
12340 Bug31490 Turkish: ucfirst 'ix'
12341 !! options
12342 language=tr
12343 !! input
12344 {{ucfirst:ix}}
12345 !! result
12346 <p>İx
12347 </p>
12348 !! end
12349
12350 !! test
12351 Bug31490 Turkish: lcfirst 'BLAH'
12352 !! options
12353 language=tr
12354 !! input
12355 {{lcfirst:BLAH}}
12356 !! result
12357 <p>bLAH
12358 </p>
12359 !! end
12360
12361 !! test
12362 Bug31490 Turkish: ucfırst (with a dotless i)
12363 !! options
12364 language=tr
12365 !! input
12366 {{ucfırst:blah}}
12367 !! result
12368 <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>
12369 </p>
12370 !! end
12371
12372 !! test
12373 Bug31490 ucfırst (with a dotless i) with English language
12374 !! options
12375 language=en
12376 !! input
12377 {{ucfırst:blah}}
12378 !! result
12379 <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>
12380 </p>
12381 !! end
12382
12383 !! test
12384 Bug 26375: TOC with italics
12385 !! options
12386 title=[[Main Page]]
12387 !! input
12388 __TOC__
12389 == ''Lost'' episodes ==
12390 !! result
12391 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12392 <ul>
12393 <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>
12394 </ul>
12395 </td></tr></table>
12396 <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>
12397
12398 !! end
12399
12400 !! test
12401 Bug 26375: TOC with bold
12402 !! options
12403 title=[[Main Page]]
12404 !! input
12405 __TOC__
12406 == '''should be bold''' then normal text ==
12407 !! result
12408 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12409 <ul>
12410 <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>
12411 </ul>
12412 </td></tr></table>
12413 <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>
12414
12415 !! end
12416
12417 !! test
12418 Bug 33845: Headings become cursive in TOC when they contain an image
12419 !! options
12420 title=[[Main Page]]
12421 !! input
12422 __TOC__
12423 == Image [[Image:foobar.jpg]] ==
12424 !! result
12425 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12426 <ul>
12427 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12428 </ul>
12429 </td></tr></table>
12430 <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>
12431
12432 !! end
12433
12434 !! test
12435 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12436 !! options
12437 title=[[Main Page]]
12438 !! input
12439 __TOC__
12440 == <blockquote>Quote</blockquote> ==
12441 !! result
12442 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12443 <ul>
12444 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12445 </ul>
12446 </td></tr></table>
12447 <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>
12448
12449 !! end
12450
12451 !! test
12452 Unclosed tags in TOC
12453 !! options
12454 title=[[Main Page]]
12455 !! input
12456 __TOC__
12457 == Proof: 2 < 3 ==
12458 <small>Hanc marginis exiguitas non caperet.</small>
12459 QED
12460 !! result
12461 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12462 <ul>
12463 <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>
12464 </ul>
12465 </td></tr></table>
12466 <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>
12467 <p><small>Hanc marginis exiguitas non caperet.</small>
12468 QED
12469 </p>
12470 !! end
12471
12472 !! test
12473 Multiple tags in TOC
12474 !! input
12475 __TOC__
12476 == <i>Foo</i> <b>Bar</b> ==
12477
12478 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12479 !! result
12480 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12481 <ul>
12482 <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>
12483 <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>
12484 </ul>
12485 </td></tr></table>
12486 <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>
12487 <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>
12488
12489 !! end
12490
12491 !! test
12492 Tags with parameters in TOC
12493 !! input
12494 __TOC__
12495 == <sup class="in-h2">Hello</sup> ==
12496
12497 == <sup class="a > b">Evilbye</sup> ==
12498 !! result
12499 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12500 <ul>
12501 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12502 <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>
12503 </ul>
12504 </td></tr></table>
12505 <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>
12506 <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>
12507
12508 !! end
12509
12510 !! test
12511 span tags with directionality in TOC
12512 !! input
12513 __TOC__
12514 == <span dir="ltr">C++</span> ==
12515
12516 == <span dir="rtl">זבנג!</span> ==
12517
12518 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12519
12520 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12521
12522 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12523 !! result
12524 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12525 <ul>
12526 <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>
12527 <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>
12528 <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>
12529 <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>
12530 <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>
12531 </ul>
12532 </td></tr></table>
12533 <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>
12534 <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>
12535 <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>
12536 <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>
12537 <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>
12538
12539 !! end
12540
12541 !! article
12542 MediaWiki:Bug32057
12543 !! text
12544 == {{int:headline_sample}} ==
12545 !! endarticle
12546
12547 !! test
12548 Bug 32057: Title needed when expanding <h> nodes.
12549 !! options
12550 title=[[Main Page]]
12551 !! input
12552 {{int:Bug32057}}
12553 !! result
12554 <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>
12555
12556 !! end
12557
12558 !! test
12559 Strip marker in urlencode
12560 !! input
12561 {{urlencode:x<nowiki/>y}}
12562 {{urlencode:x<nowiki/>y|wiki}}
12563 {{urlencode:x<nowiki/>y|path}}
12564 !! result
12565 <p>xy
12566 xy
12567 xy
12568 </p>
12569 !! end
12570
12571 !! test
12572 Strip marker in lc
12573 !! input
12574 {{lc:x<nowiki/>y}}
12575 !! result
12576 <p>xy
12577 </p>
12578 !! end
12579
12580 !! test
12581 Strip marker in uc
12582 !! input
12583 {{uc:x<nowiki/>y}}
12584 !! result
12585 <p>XY
12586 </p>
12587 !! end
12588
12589 !! test
12590 Strip marker in formatNum
12591 !! input
12592 {{formatnum:1<nowiki/>2}}
12593 {{formatnum:1<nowiki/>2|R}}
12594 !! result
12595 <p>12
12596 12
12597 </p>
12598 !! end
12599
12600 !! test
12601 Strip marker in grammar
12602 !! options
12603 language=fi
12604 !! input
12605 {{grammar:elative|foo<nowiki/>bar}}
12606 !! result
12607 <p>foobarista
12608 </p>
12609 !! end
12610
12611 !! test
12612 Strip marker in padleft
12613 !! input
12614 {{padleft:|2|x<nowiki/>y}}
12615 !! result
12616 <p>xy
12617 </p>
12618 !! end
12619
12620 !! test
12621 Strip marker in padright
12622 !! input
12623 {{padright:|2|x<nowiki/>y}}
12624 !! result
12625 <p>xy
12626 </p>
12627 !! end
12628
12629 !! test
12630 Strip marker in anchorencode
12631 !! input
12632 {{anchorencode:x<nowiki/>y}}
12633 !! result
12634 <p>xy
12635 </p>
12636 !! end
12637
12638 !! test
12639 nowiki inside link inside heading (bug 18295)
12640 !! input
12641 ==[[foo|x<nowiki>y</nowiki>z]]==
12642 !! result
12643 <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>
12644
12645 !! end
12646
12647 !! test
12648 new support for bdi element (bug 31817)
12649 !! input
12650 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12651 !! result
12652 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12653
12654 !!end
12655
12656 !! test
12657 Ignore pipe between table row attributes
12658 !! input
12659 {|
12660 | quux
12661 |- id=foo | style='color: red'
12662 | bar
12663 |}
12664 !! result
12665 <table>
12666 <tr>
12667 <td> quux
12668 </td></tr>
12669 <tr id="foo" style="color: red">
12670 <td> bar
12671 </td></tr></table>
12672
12673 !! end
12674
12675 !!test
12676 Gallery override link with WikiLink (bug 34852)
12677 !! input
12678 <gallery>
12679 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12680 </gallery>
12681 !! result
12682 <ul class="gallery">
12683 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12684 <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>
12685 <div class="gallerytext">
12686 <p>caption
12687 </p>
12688 </div>
12689 </div></li>
12690 </ul>
12691
12692 !! end
12693
12694 !!test
12695 Gallery override link with absolute external link (bug 34852)
12696 !! input
12697 <gallery>
12698 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12699 </gallery>
12700 !! result
12701 <ul class="gallery">
12702 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12703 <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>
12704 <div class="gallerytext">
12705 <p>caption
12706 </p>
12707 </div>
12708 </div></li>
12709 </ul>
12710
12711 !! end
12712
12713 !!test
12714 Gallery override link with malicious javascript (bug 34852)
12715 !! input
12716 <gallery>
12717 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12718 </gallery>
12719 !! result
12720 <ul class="gallery">
12721 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12722 <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>
12723 <div class="gallerytext">
12724 <p>caption
12725 </p>
12726 </div>
12727 </div></li>
12728 </ul>
12729
12730 !! end
12731
12732 !!test
12733 Gallery with invalid title as link (bug 43964)
12734 !! input
12735 <gallery>
12736 File:foobar.jpg|link=<
12737 </gallery>
12738 !! result
12739 <ul class="gallery">
12740 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12741 <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>
12742 <div class="gallerytext">
12743 </div>
12744 </div></li>
12745 </ul>
12746
12747 !! end
12748
12749 !!test
12750 Language parser function
12751 !! input
12752 {{#language:ar}}
12753 !! result
12754 <p>العربية
12755 </p>
12756 !! end
12757
12758 !!test
12759 Padleft and padright as substr
12760 !! input
12761 {{padleft:|3|abcde}}
12762 {{padright:|3|abcde}}
12763 !! result
12764 <p>abc
12765 abc
12766 </p>
12767 !! end
12768
12769 !!test
12770 Bug 34939 - Case insensitive link parsing ([HttP://])
12771 !! input
12772 [HttP://MediaWiki.Org/]
12773 !! result
12774 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12775 </p>
12776 !! end
12777
12778 !!test
12779 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12780 !! input
12781 [HttP://MediaWiki.Org/ MediaWiki]
12782 !! result
12783 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12784 </p>
12785 !! end
12786
12787 !!test
12788 Bug 34939 - Case insensitive link parsing (HttP://)
12789 !! input
12790 HttP://MediaWiki.Org/
12791 !! result
12792 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12793 </p>
12794 !! end
12795
12796 ###
12797 ### Parsoids-specific tests
12798 ### Parsoid-PHP parser incompatibilities
12799 ###
12800 !!test
12801 1. SOL-sensitive wikitext tokens as template-args
12802 !!options
12803 disabled
12804 !!input
12805 {{echo|*a}}
12806 {{echo|#a}}
12807 {{echo|:a}}
12808 !!result
12809 <p>*a
12810 #a
12811 :a
12812 </p>
12813 !!end
12814
12815 #### The following section of tests are primarily to test
12816 #### wikitext escaping capabilities of Parsoid.
12817 #### A lot of the tests are disabled for the PHP parser either
12818 #### because of minor newline diffs or other reasons.
12819 #### As Parsoid serializer can handle newlines and other HTML
12820 #### more robustly, some of these tests might get reenabled
12821 #### for the PHP parser.
12822
12823 #### --------------- Headings ---------------
12824 #### 0. Unnested
12825 #### 1. Nested inside html <h1>=foo=</h1>
12826 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12827 #### 3. Nested inside html with wikitext split by html tags
12828 #### 4. No escape needed
12829 #### 5. Empty headings <h1></h1>
12830 #### 6. Heading chars in SOL context
12831 #### ----------------------------------------
12832 !! test
12833 Headings: 0. Unnested
12834 !! input
12835 <nowiki>=foo=</nowiki>
12836
12837 <nowiki>=foo</nowiki>''a''=
12838 !! result
12839 <p>=foo=
12840 </p><p>=foo<i>a</i>=
12841 </p>
12842 !!end
12843
12844 !! test
12845 Headings: 1. Nested inside html
12846 !! options
12847 disabled
12848 !! input
12849 =<nowiki>=foo=</nowiki>=
12850 ==<nowiki>=foo=</nowiki>==
12851 ===<nowiki>=foo=</nowiki>===
12852 ====<nowiki>=foo=</nowiki>====
12853 =====<nowiki>=foo=</nowiki>=====
12854 ======<nowiki>=foo=</nowiki>======
12855 !! result
12856 <h1>=foo=</h1>
12857 <h2>=foo=</h2>
12858 <h3>=foo=</h3>
12859 <h4>=foo=</h4>
12860 <h5>=foo=</h5>
12861 <h6>=foo=</h6>
12862 !!end
12863
12864 !! test
12865 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12866 !! options
12867 disabled
12868 !! input
12869 =foo=
12870 <nowiki>*bar</nowiki>
12871 =foo=
12872 =bar
12873 =foo=
12874 <nowiki>=bar=</nowiki>
12875 !! result
12876 <h1>foo</h1>*bar
12877 <h1>foo</h1>=bar
12878 <h1>foo</h1>=bar=
12879 !!end
12880
12881 !! test
12882 Headings: 3. Nested inside html with wikitext split by html tags
12883 !! options
12884 disabled
12885 !! input
12886 =<nowiki>=</nowiki>'''bold'''foo==
12887 !! result
12888 <h1>=<b>bold</b>foo=</h1>
12889 !!end
12890
12891 !! test
12892 Headings: 4. No escaping needed (testing just h1 and h2)
12893 !! options
12894 disabled
12895 !! input
12896 ==foo=
12897 =foo==
12898 ===foo==
12899 ==foo===
12900 =''=''foo==
12901 ===
12902 !! result
12903 <h1>=foo</h1>
12904 <h1>foo=</h1>
12905 <h2>=foo</h2>
12906 <h2>foo=</h2>
12907 <h1><i>=</i>foo=</h1>
12908 <h1>=</h1>
12909 !!end
12910
12911 !! test
12912 Headings: 5. Empty headings
12913 !! options
12914 disabled
12915 !! input
12916 =<nowiki></nowiki>=
12917 ==<nowiki></nowiki>==
12918 ===<nowiki></nowiki>===
12919 ====<nowiki></nowiki>====
12920 =====<nowiki></nowiki>=====
12921 ======<nowiki></nowiki>======
12922 !! result
12923 <h1></h1>
12924 <h2></h2>
12925 <h3></h3>
12926 <h4></h4>
12927 <h5></h5>
12928 <h6></h6>
12929 !!end
12930
12931 !! test
12932 Headings: 6. Heading chars in SOL context
12933 !! options
12934 disabled
12935 !! input
12936 <!--cmt--><nowiki>=h1=</nowiki>
12937 !! result
12938 <p><!--cmt-->=h1=
12939 </p>
12940 !!end
12941
12942 #### --------------- Lists ---------------
12943 #### 0. Outside nests (*foo, etc.)
12944 #### 1. Nested inside html <ul><li>*foo</li></ul>
12945 #### 2. Inside definition lists
12946 #### 3. Only bullets at start should be escaped
12947 #### 4. No escapes needed
12948 #### 5. No unnecessary escapes
12949 #### 6. Escape bullets in SOL position
12950 #### 7. Escape bullets in a multi-line context
12951 #### ----------------------------------------
12952
12953 !! test
12954 Lists: 0. Outside nests
12955 !! input
12956 <nowiki>*foo</nowiki>
12957
12958 <nowiki>#foo</nowiki>
12959 !! result
12960 <p>*foo
12961 </p><p>#foo
12962 </p>
12963 !!end
12964
12965 !! test
12966 Lists: 1. Nested inside html
12967 !! input
12968 *<nowiki>*foo</nowiki>
12969
12970 *<nowiki>#foo</nowiki>
12971
12972 *<nowiki>:foo</nowiki>
12973
12974 *<nowiki>;foo</nowiki>
12975
12976 #<nowiki>*foo</nowiki>
12977
12978 #<nowiki>#foo</nowiki>
12979
12980 #<nowiki>:foo</nowiki>
12981
12982 #<nowiki>;foo</nowiki>
12983 !! result
12984 <ul><li>*foo
12985 </li></ul>
12986 <ul><li>#foo
12987 </li></ul>
12988 <ul><li>:foo
12989 </li></ul>
12990 <ul><li>;foo
12991 </li></ul>
12992 <ol><li>*foo
12993 </li></ol>
12994 <ol><li>#foo
12995 </li></ol>
12996 <ol><li>:foo
12997 </li></ol>
12998 <ol><li>;foo
12999 </li></ol>
13000
13001 !!end
13002
13003 !! test
13004 Lists: 2. Inside definition lists
13005 !! input
13006 ;<nowiki>;foo</nowiki>
13007
13008 ;<nowiki>:foo</nowiki>
13009
13010 ;<nowiki>:foo</nowiki>
13011 :bar
13012
13013 :<nowiki>:foo</nowiki>
13014 !! result
13015 <dl><dt>;foo
13016 </dt></dl>
13017 <dl><dt>:foo
13018 </dt></dl>
13019 <dl><dt>:foo
13020 </dt><dd>bar
13021 </dd></dl>
13022 <dl><dd>:foo
13023 </dd></dl>
13024
13025 !!end
13026
13027 !! test
13028 Lists: 3. Only bullets at start of text should be escaped
13029 !! input
13030 *<nowiki>*foo*bar</nowiki>
13031
13032 *<nowiki>*foo</nowiki>''it''*bar
13033 !! result
13034 <ul><li>*foo*bar
13035 </li></ul>
13036 <ul><li>*foo<i>it</i>*bar
13037 </li></ul>
13038
13039 !!end
13040
13041 !! test
13042 Lists: 4. No escapes needed
13043 !! options
13044 disabled
13045 !! input
13046 *foo*bar
13047
13048 *''foo''*bar
13049
13050 *[[Foo]]: bar
13051 !! result
13052 <ul><li>foo*bar
13053 </li></ul>
13054 <ul><li><i>foo</i>*bar
13055 </li></ul>
13056 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13057 </li></ul>
13058 !!end
13059
13060 !! test
13061 Lists: 5. No unnecessary escapes
13062 !! input
13063 * bar <span><nowiki>[[foo]]</nowiki></span>
13064
13065 *=bar <span><nowiki>[[foo]]</nowiki></span>
13066
13067 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13068
13069 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13070
13071 *=bar <span>foo]]</span>=
13072 !! result
13073 <ul><li> bar <span>[[foo]]</span>
13074 </li></ul>
13075 <ul><li>=bar <span>[[foo]]</span>
13076 </li></ul>
13077 <ul><li>[[bar <span>[[foo]]</span>
13078 </li></ul>
13079 <ul><li>]]bar <span>[[foo]]</span>
13080 </li></ul>
13081 <ul><li>=bar <span>foo]]</span>=
13082 </li></ul>
13083
13084 !!end
13085
13086 !! test
13087 Lists: 6. Escape bullets in SOL position
13088 !! options
13089 disabled
13090 !! input
13091 <!--cmt--><nowiki>*foo</nowiki>
13092 !! result
13093 <p><!--cmt-->*foo
13094 </p>
13095 !!end
13096
13097 !! test
13098 Lists: 7. Escape bullets in a multi-line context
13099 !! input
13100 <nowiki>a
13101 *b</nowiki>
13102 !! result
13103 <p>a
13104 *b
13105 </p>
13106 !!end
13107
13108 #### --------------- HRs ---------------
13109 #### 1. Single line
13110 #### -----------------------------------
13111
13112 !! test
13113 HRs: 1. Single line
13114 !! options
13115 disabled
13116 !! input
13117 ----
13118 <nowiki>----</nowiki>
13119 ----
13120 <nowiki>=foo=</nowiki>
13121 ----
13122 <nowiki>*foo</nowiki>
13123 !! result
13124 <hr/>----
13125 <hr/>=foo=
13126 <hr/>*foo
13127 !! end
13128
13129 #### --------------- Tables ---------------
13130 #### 1a. Simple example
13131 #### 1b. No escaping needed (!foo)
13132 #### 1c. No escaping needed (|foo)
13133 #### 1d. No escaping needed (|}foo)
13134 ####
13135 #### 2a. Nested in td (<td>foo|bar</td>)
13136 #### 2b. Nested in td (<td>foo||bar</td>)
13137 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13138 ####
13139 #### 3a. Nested in th (<th>foo!bar</th>)
13140 #### 3b. Nested in th (<th>foo!!bar</th>)
13141 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13142 ####
13143 #### 4a. Escape -
13144 #### 4b. Escape +
13145 #### 4c. No escaping needed
13146 #### --------------------------------------
13147
13148 !! test
13149 Tables: 1a. Simple example
13150 !! input
13151 <nowiki>{|
13152 |}</nowiki>
13153 !! result
13154 <p>{|
13155 |}
13156 </p>
13157 !! end
13158
13159 !! test
13160 Tables: 1b. No escaping needed
13161 !! input
13162 !foo
13163 !! result
13164 <p>!foo
13165 </p>
13166 !! end
13167
13168 !! test
13169 Tables: 1c. No escaping needed
13170 !! input
13171 |foo
13172 !! result
13173 <p>|foo
13174 </p>
13175 !! end
13176
13177 !! test
13178 Tables: 1d. No escaping needed
13179 !! input
13180 |}foo
13181 !! result
13182 <p>|}foo
13183 </p>
13184 !! end
13185
13186 !! test
13187 Tables: 2a. Nested in td
13188 !! options
13189 disabled
13190 !! input
13191 {|
13192 |<nowiki>foo|bar</nowiki>
13193 |}
13194 !! result
13195 <table>
13196 <tr><td>foo|bar
13197 </td></tr></table>
13198
13199 !! end
13200
13201 !! test
13202 Tables: 2b. Nested in td
13203 !! options
13204 disabled
13205 !! input
13206 {|
13207 |<nowiki>foo||bar</nowiki>
13208 |''it''<nowiki>foo||bar</nowiki>
13209 |}
13210 !! result
13211 <table>
13212 <tr><td>foo||bar
13213 </td><td><i>it</i>foo||bar
13214 </td></tr></table>
13215
13216 !! end
13217
13218 !! test
13219 Tables: 2c. Nested in td -- no escaping needed
13220 !! options
13221 disabled
13222 !! input
13223 {|
13224 |foo!!bar
13225 |}
13226 !! result
13227 <table>
13228 <tr><td>foo!!bar
13229 </td></tr></table>
13230
13231 !! end
13232
13233 !! test
13234 Tables: 3a. Nested in th
13235 !! options
13236 disabled
13237 !! input
13238 {|
13239 !foo!bar
13240 |}
13241 !! result
13242 <table>
13243 <tr><th>foo!bar
13244 </th></tr></table>
13245
13246 !! end
13247
13248 !! test
13249 Tables: 3b. Nested in th
13250 !! options
13251 disabled
13252 !! input
13253 {|
13254 !<nowiki>foo!!bar</nowiki>
13255 |}
13256 !! result
13257 <table>
13258 <tr><th>foo!!bar
13259 </th></tr></table>
13260
13261 !! end
13262
13263 !! test
13264 Tables: 3c. Nested in th -- no escaping needed
13265 !! options
13266 disabled
13267 !! input
13268 {|
13269 !foo||bar
13270 |}
13271 !! result
13272 <table>
13273 <tr><th>foo||bar
13274 </th></tr></table>
13275
13276 !! end
13277
13278 !! test
13279 Tables: 4a. Escape -
13280 !! options
13281 disabled
13282 !! input
13283 {|
13284 |-
13285 !-bar
13286 |-
13287 |<nowiki>-bar</nowiki>
13288 |}
13289 !! result
13290 <table><tbody>
13291 <tr><th>-bar</th></tr>
13292 <tr><td>-bar</td></tr>
13293 </tbody></table>
13294 !! end
13295
13296 !! test
13297 Tables: 4b. Escape +
13298 !! options
13299 disabled
13300 !! input
13301 {|
13302 |-
13303 !+bar
13304 |-
13305 |<nowiki>+bar</nowiki>
13306 |}
13307 !! result
13308 <table><tbody>
13309 <tr><th>+bar</th></tr>
13310 <tr><td>+bar</td></tr>
13311 </tbody></table>
13312 !! end
13313
13314 !! test
13315 Tables: 4c. No escaping needed
13316 !! options
13317 disabled
13318 !! input
13319 {|
13320 |-
13321 |foo-bar
13322 |foo+bar
13323 |-
13324 |''foo''-bar
13325 |''foo''+bar
13326 |}
13327 !! result
13328 <table><tbody>
13329 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13330 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13331 </tbody></table>
13332 !! end
13333
13334 !! test
13335 Tables: 4d. No escaping needed
13336 !! input
13337 {|
13338 ||+1
13339 ||-2
13340 |}
13341 !! result
13342 <table>
13343 <tr>
13344 <td>+1
13345 </td>
13346 <td>-2
13347 </td></tr></table>
13348
13349 !! end
13350
13351 #### --------------- Links ---------------
13352 #### 1. Quote marks in link text
13353 #### 2. Wikilinks: Escapes needed
13354 #### 3. Wikilinks: No escapes needed
13355 #### 4. Extlinks: Escapes needed
13356 #### 5. Extlinks: No escapes needed
13357 #### --------------------------------------
13358 !! test
13359 Links 1. Quote marks in link text
13360 !! options
13361 disabled
13362 !! input
13363 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13364 !! result
13365 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13366 !! end
13367
13368 !! test
13369 Links 2. WikiLinks: Escapes needed
13370 !! options
13371 disabled
13372 !! input
13373 [[Foo|<nowiki>[Foobar]</nowiki>]]
13374 [[Foo|<nowiki>Foobar]</nowiki>]]
13375 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13376 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13377 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13378 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13379 [[Foo|<nowiki>|Bar</nowiki>]]
13380 !! result
13381 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13382 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13383 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13384 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13385 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13386 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13387 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13388 !! end
13389
13390 !! test
13391 Links 3. WikiLinks: No escapes needed
13392 !! options
13393 disabled
13394 !! input
13395 [[Foo|[Foobar]]
13396 [[Foo|foo|bar]]
13397 !! result
13398 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13399 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13400 !! end
13401
13402 !! test
13403 Links 4. ExtLinks: Escapes needed
13404 !! options
13405 disabled
13406 !! input
13407 [http://google.com <nowiki>[google]</nowiki>]
13408 [http://google.com <nowiki>google]</nowiki>]
13409 !! result
13410 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13411 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13412 !! end
13413
13414 !! test
13415 Links 5. ExtLinks: No escapes needed
13416 !! options
13417 disabled
13418 !! input
13419 [http://google.com [google]
13420 !! result
13421 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13422 !! end
13423
13424 #### --------------- Quotes ---------------
13425 #### 1. Quotes inside <b> and <i>
13426 #### 2. Link fragments separated by <i> and <b> tags
13427 #### 3. Link fragments inside <i> and <b>
13428 #### --------------------------------------
13429 !! test
13430 1. Quotes inside <b> and <i>
13431 !! input
13432 ''<nowiki>'foo'</nowiki>''
13433 ''<nowiki>''foo''</nowiki>''
13434 ''<nowiki>'''foo'''</nowiki>''
13435 '''<nowiki>'foo'</nowiki>'''
13436 '''<nowiki>''foo''</nowiki>'''
13437 '''<nowiki>'''foo'''</nowiki>'''
13438 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13439 !! result
13440 <p><i>'foo'</i>
13441 <i>''foo''</i>
13442 <i>'''foo'''</i>
13443 <b>'foo'</b>
13444 <b>''foo''</b>
13445 <b>'''foo'''</b>
13446 <b>foo'<i>bar'</i>baz</b>
13447 </p>
13448 !! end
13449
13450 !! test
13451 2. Link fragments separated by <i> and <b> tags
13452 !! input
13453 [[''foo''<nowiki>hello]]</nowiki>
13454
13455 [['''foo'''<nowiki>hello]]</nowiki>
13456 !! result
13457 <p>[[<i>foo</i>hello]]
13458 </p><p>[[<b>foo</b>hello]]
13459 </p>
13460 !! end
13461
13462 !! test
13463 2. Link fragments inside <i> and <b>
13464 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13465 this is one of the shortcomings of this format)
13466 !! input
13467 ''[[foo''<nowiki>]]</nowiki>
13468
13469 '''[[foo'''<nowiki>]]</nowiki>
13470 !! result
13471 <p><i>[[foo</i>]]
13472 </p><p><b>[[foo</b>]]
13473 </p>
13474 !! end
13475
13476 #### --------------- Paragraphs ---------------
13477 #### 1. No unnecessary escapes
13478 #### --------------------------------------
13479
13480 !! test
13481 1. No unnecessary escapes
13482 !! input
13483 bar <span><nowiki>[[foo]]</nowiki></span>
13484
13485 =bar <span><nowiki>[[foo]]</nowiki></span>
13486
13487 [[bar <span><nowiki>[[foo]]</nowiki></span>
13488
13489 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13490
13491 <nowiki>=bar </nowiki><span>foo]]</span>=
13492 !! result
13493 <p>bar <span>[[foo]]</span>
13494 </p><p>=bar <span>[[foo]]</span>
13495 </p><p>[[bar <span>[[foo]]</span>
13496 </p><p>]]bar <span>[[foo]]</span>
13497 </p><p>=bar <span>foo]]</span>=
13498 </p>
13499 !!end
13500
13501 #### --------------- PRE ------------------
13502 #### 1. Leading space in SOL context should be escaped
13503 #### --------------------------------------
13504 !! test
13505 1. Leading space in SOL context should be escaped
13506 !! options
13507 disabled
13508 !! input
13509 <nowiki> foo</nowiki>
13510 <!--cmt--><nowiki> foo</nowiki>
13511 !! result
13512 <p> foo
13513 <!--cmt--> foo
13514 </p>
13515 !! end
13516
13517 #### --------------- HTML tags ---------------
13518 #### 1. a tags
13519 #### 2. other tags
13520 #### 3. multi-line html tag
13521 #### --------------------------------------
13522 !! test
13523 1. a tags
13524 !! options
13525 disabled
13526 !! input
13527 <a href="http://google.com">google</a>
13528 !! result
13529 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13530 !! end
13531
13532 !! test
13533 2. other tags
13534 !! input
13535 <nowiki><div>foo</div>
13536 <div style="color:red">foo</div></nowiki>
13537 !! result
13538 <p>&lt;div&gt;foo&lt;/div&gt;
13539 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13540 </p>
13541 !! end
13542
13543 !! test
13544 3. multi-line html tag
13545 !! input
13546 <nowiki><div
13547 >foo</div
13548 ></nowiki>
13549 !! result
13550 <p>&lt;div
13551 &gt;foo&lt;/div
13552 &gt;
13553 </p>
13554 !! end
13555
13556 #### --------------- Others ---------------
13557 !! test
13558 Escaping nowikis
13559 !! input
13560 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13561 !! result
13562 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13563 </p>
13564 !! end
13565
13566 !! test
13567 Tag-like HTML structures are passed through as text
13568 !! input
13569 <x y>
13570
13571 <x.y>
13572
13573 <x-y>
13574
13575 1>2
13576
13577 x<y
13578
13579 a>b
13580
13581 1<d e>f
13582 !! result
13583 <p>&lt;x y&gt;
13584 </p><p>&lt;x.y&gt;
13585 </p><p>&lt;x-y&gt;
13586 </p><p>1&gt;2
13587 </p><p>x&lt;y
13588 </p><p>a&gt;b
13589 </p><p>1&lt;d e&gt;f
13590 </p>
13591 !! end
13592
13593
13594 # This fails in the PHP parser (see bug 40670,
13595 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13596 !! test
13597 Tag names followed by punctuation should not be recognized as tags
13598 !! options
13599 disabled
13600 !! input
13601 <s.ome> text
13602 !! result
13603 <p>&lt;s.ome&gt text
13604 </p>
13605 !! end
13606
13607 !! test
13608 HTML tag with necessary entities in attributes
13609 !! input
13610 <span title="&amp;amp;">foo</span>
13611 !! result
13612 <p><span title="&amp;amp;">foo</span>
13613 </p>
13614 !! end
13615
13616 !! test
13617 HTML tag with 'unnecessary' entity encoding in attributes
13618 !! input
13619 <span title="&amp;">foo</span>
13620 !! result
13621 <p><span title="&amp;">foo</span>
13622 </p>
13623 !! end
13624
13625 !! test
13626 HTML tag with broken attribute value quoting
13627 !! input
13628 <span title="Hello world>Foo</span>
13629 !! result
13630 <p><span>Foo</span>
13631 </p>
13632 !! end
13633
13634 !! test
13635 Parsoid-only: HTML tag with broken attribute value quoting
13636 !! options
13637 disabled
13638 !! input
13639 <span title="Hello world>Foo</span>
13640 !! result
13641 <p><span title="Hello world">Foo</span>
13642 </p>
13643 !! end
13644
13645 !! test
13646 Table with broken attribute value quoting
13647 !! input
13648 {|
13649 | title="Hello world|Foo
13650 |}
13651 !! result
13652 <table>
13653 <tr>
13654 <td>Foo
13655 </td></tr></table>
13656
13657 !! end
13658
13659 !! test
13660 Table with broken attribute value quoting on consecutive lines
13661 !! input
13662 {|
13663 | title="Hello world|Foo
13664 | style="color:red|Bar
13665 |}
13666 !! result
13667 <table>
13668 <tr>
13669 <td>Foo
13670 </td>
13671 <td>Bar
13672 </td></tr></table>
13673
13674 !! end
13675
13676 !! test
13677 Parsoid-only: Table with broken attribute value quoting on consecutive lines
13678 !! options
13679 disabled
13680 !! input
13681 {|
13682 | title="Hello world|Foo
13683 | style="color:red|Bar
13684 |}
13685 !! result
13686 <table>
13687 <tr>
13688 <td title="Hello world">Foo
13689 </td><td style="color: red;">Bar
13690 </td></tr></table>
13691
13692 !! end
13693
13694 !!test
13695 Accept empty td cell attribute
13696 !!input
13697 {|
13698 | align="center" | foo || |
13699 |}
13700 !!result
13701 <table>
13702 <tr>
13703 <td align="center"> foo </td>
13704 <td>
13705 </td></tr></table>
13706
13707 !!end
13708
13709 !!test
13710 Non-empty attributes in th-cells
13711 !!input
13712 {|
13713 ! Foo !! style="color: red" | Bar
13714 |}
13715 !!result
13716 <table>
13717 <tr>
13718 <th> Foo </th>
13719 <th style="color: red"> Bar
13720 </th></tr></table>
13721
13722 !!end
13723
13724 !!test
13725 Accept empty attributes in th-cells
13726 !!input
13727 {|
13728 !| foo !!| bar
13729 |}
13730 !!result
13731 <table>
13732 <tr>
13733 <th> foo </th>
13734 <th> bar
13735 </th></tr></table>
13736
13737 !!end
13738
13739 TODO:
13740 more images
13741 more tables
13742 character entities
13743 and much more
13744 Try for 100% code coverage