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