Merge "(bug 45937) API: Check amlang in meta=allmessages"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Parsing an URL
169 !! input
170 http://fr.wikipedia.org/wiki/🍺
171 <!-- EasterEgg we love beer, better be able be able to link to it -->
172 !! result
173 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
174 </p>
175 !! end
176
177 !! test
178 Simple list
179 !! input
180 * Item 1
181 * Item 2
182 !! result
183 <ul><li> Item 1
184 </li><li> Item 2
185 </li></ul>
186
187 !! end
188
189 !! test
190 Italics and bold
191 !! input
192 * plain
193 * plain''italic''plain
194 * plain''italic''plain''italic''plain
195 * plain'''bold'''plain
196 * plain'''bold'''plain'''bold'''plain
197 * plain''italic''plain'''bold'''plain
198 * plain'''bold'''plain''italic''plain
199 * plain''italic'''bold-italic'''italic''plain
200 * plain'''bold''bold-italic''bold'''plain
201 * plain'''''bold-italic'''italic''plain
202 * plain'''''bold-italic''bold'''plain
203 * plain''italic'''bold-italic'''''plain
204 * plain'''bold''bold-italic'''''plain
205 * plain l'''italic''plain
206 * plain l''''bold''' plain
207 !! result
208 <ul><li> plain
209 </li><li> plain<i>italic</i>plain
210 </li><li> plain<i>italic</i>plain<i>italic</i>plain
211 </li><li> plain<b>bold</b>plain
212 </li><li> plain<b>bold</b>plain<b>bold</b>plain
213 </li><li> plain<i>italic</i>plain<b>bold</b>plain
214 </li><li> plain<b>bold</b>plain<i>italic</i>plain
215 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
216 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
217 </li><li> plain<i><b>bold-italic</b>italic</i>plain
218 </li><li> plain<b><i>bold-italic</i>bold</b>plain
219 </li><li> plain<i>italic<b>bold-italic</b></i>plain
220 </li><li> plain<b>bold<i>bold-italic</i></b>plain
221 </li><li> plain l'<i>italic</i>plain
222 </li><li> plain l'<b>bold</b> plain
223 </li></ul>
224
225 !! end
226
227 ###
228 ### 2-quote opening sequence tests
229 ###
230 !! test
231 Italics and bold: 2-quote opening sequence: (2,2)
232 !! input
233 ''foo''
234 !! result
235 <p><i>foo</i>
236 </p>
237 !!end
238
239
240 !! test
241 Italics and bold: 2-quote opening sequence: (2,3)
242 !! input
243 ''foo'''
244 !! result
245 <p><i>foo'</i>
246 </p>
247 !!end
248
249
250 !! test
251 Italics and bold: 2-quote opening sequence: (2,4)
252 !! input
253 ''foo''''
254 !! result
255 <p><i>foo''</i>
256 </p>
257 !!end
258
259
260 !! test
261 Italics and bold: 2-quote opening sequence: (2,5)
262 !! input
263 ''foo'''''
264 !! result
265 <p><i>foo</i>
266 </p>
267 !!end
268
269
270 ###
271 ### 3-quote opening sequence tests
272 ###
273
274 !! test
275 Italics and bold: 3-quote opening sequence: (3,2)
276 !! input
277 '''foo''
278 !! result
279 <p>'<i>foo</i>
280 </p>
281 !!end
282
283
284 !! test
285 Italics and bold: 3-quote opening sequence: (3,3)
286 !! input
287 '''foo'''
288 !! result
289 <p><b>foo</b>
290 </p>
291 !!end
292
293
294 !! test
295 Italics and bold: 3-quote opening sequence: (3,4)
296 !! input
297 '''foo''''
298 !! result
299 <p><b>foo'</b>
300 </p>
301 !!end
302
303
304 !! test
305 Italics and bold: 3-quote opening sequence: (3,5)
306 !! input
307 '''foo'''''
308 !! result
309 <p><b>foo</b>
310 </p>
311 !!end
312
313
314 ###
315 ### 4-quote opening sequence tests
316 ###
317
318 !! test
319 Italics and bold: 4-quote opening sequence: (4,2)
320 !! input
321 ''''foo''
322 !! result
323 <p>''<i>foo</i>
324 </p>
325 !!end
326
327
328 !! test
329 Italics and bold: 4-quote opening sequence: (4,3)
330 !! input
331 ''''foo'''
332 !! result
333 <p>'<b>foo</b>
334 </p>
335 !!end
336
337
338 !! test
339 Italics and bold: 4-quote opening sequence: (4,4)
340 !! input
341 ''''foo''''
342 !! result
343 <p>'<b>foo'</b>
344 </p>
345 !!end
346
347
348 !! test
349 Italics and bold: 4-quote opening sequence: (4,5)
350 !! input
351 ''''foo'''''
352 !! result
353 <p>'<b>foo</b>
354 </p>
355 !!end
356
357
358 ###
359 ### 5-quote opening sequence tests
360 ###
361
362 !! test
363 Italics and bold: 5-quote opening sequence: (5,2)
364 !! input
365 '''''foo''
366 !! result
367 <p><b><i>foo</i></b>
368 </p>
369 !!end
370
371
372 !! test
373 Italics and bold: 5-quote opening sequence: (5,3)
374 !! input
375 '''''foo'''
376 !! result
377 <p><i><b>foo</b></i>
378 </p>
379 !!end
380
381
382 !! test
383 Italics and bold: 5-quote opening sequence: (5,4)
384 !! input
385 '''''foo''''
386 !! result
387 <p><i><b>foo'</b></i>
388 </p>
389 !!end
390
391
392 !! test
393 Italics and bold: 5-quote opening sequence: (5,5)
394 !! input
395 '''''foo'''''
396 !! result
397 <p><i><b>foo</b></i>
398 </p>
399 !!end
400
401 ###
402 ### multiple quote sequences in a line
403 ###
404 !! test
405 Italics and bold: multiple quote sequences: (2,4,2)
406 !! input
407 ''foo''''bar''
408 !! result
409 <p><i>foo'<b>bar</b></i>
410 </p>
411 !!end
412
413
414 !! test
415 Italics and bold: multiple quote sequences: (2,4,3)
416 !! input
417 ''foo''''bar'''
418 !! result
419 <p><i>foo'<b>bar</b></i>
420 </p>
421 !!end
422
423
424 !! test
425 Italics and bold: multiple quote sequences: (2,4,4)
426 !! input
427 ''foo''''bar''''
428 !! result
429 <p><i>foo'<b>bar'</b></i>
430 </p>
431 !!end
432
433
434 !! test
435 Italics and bold: multiple quote sequences: (3,4,2)
436 !! input
437 '''foo''''bar''
438 !! result
439 <p><b>foo'</b>bar
440 </p>
441 !!end
442
443
444 !! test
445 Italics and bold: multiple quote sequences: (3,4,3)
446 !! input
447 '''foo''''bar'''
448 !! result
449 <p><b>foo'</b>bar
450 </p>
451 !!end
452
453 ###
454 ### other quote tests
455 ###
456 !! test
457 Italics and bold: other quote tests: (2,3,5)
458 !! input
459 ''this is about '''foo's family'''''
460 !! result
461 <p><i>this is about <b>foo's family</b></i>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: other quote tests: (2,(3,3),2)
468 !! input
469 ''this is about '''foo's''' family''
470 !! result
471 <p><i>this is about <b>foo's</b> family</i>
472 </p>
473 !!end
474
475
476 !! test
477 Italics and bold: other quote tests: (3,2,3,2)
478 !! input
479 '''this is about ''foo'''s family''
480 !! result
481 <p><b>this is about <i>foo</i></b><i>s family</i>
482 </p>
483 !!end
484
485
486 !! test
487 Italics and bold: other quote tests: (3,2,3,3)
488 !! input
489 '''this is about ''foo'''s family'''
490 !! result
491 <p>'<i>this is about </i>foo<b>s family</b>
492 </p>
493 !!end
494
495
496 !! test
497 Italics and bold: other quote tests: (3,(2,2),3)
498 !! input
499 '''this is about ''foo's'' family'''
500 !! result
501 <p><b>this is about <i>foo's</i> family</b>
502 </p>
503 !!end
504
505
506 !! test
507 Italicized possessive
508 !! input
509 The ''[[Main Page]]'''s talk page.
510 !! result
511 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
512 </p>
513 !! end
514
515 ###
516 ### Non-html5 tags
517 ###
518
519 !! test
520 Non-html5 tags should be accepted
521 !! input
522 <center>''foo''</center>
523 <big>''foo''</big>
524 <font>''foo''</font>
525 <strike>''foo''</strike>
526 <tt>''foo''</tt>
527 !! result
528 <center><i>foo</i></center>
529 <p><big><i>foo</i></big>
530 <font><i>foo</i></font>
531 <strike><i>foo</i></strike>
532 <tt><i>foo</i></tt>
533 </p>
534 !! end
535
536 ###
537 ### <nowiki> test cases
538 ###
539
540 !! test
541 <nowiki> unordered list
542 !! input
543 <nowiki>* This is not an unordered list item.</nowiki>
544 !! result
545 <p>* This is not an unordered list item.
546 </p>
547 !! end
548
549 !! test
550 <nowiki> spacing
551 !! input
552 <nowiki>Lorem ipsum dolor
553
554 sed abit.
555 sed nullum.
556
557 :and a colon
558 </nowiki>
559 !! result
560 <p>Lorem ipsum dolor
561
562 sed abit.
563 sed nullum.
564
565 :and a colon
566
567 </p>
568 !! end
569
570 !! test
571 nowiki 3
572 !! input
573 :There is not nowiki.
574 :There is <nowiki>nowiki</nowiki>.
575
576 #There is not nowiki.
577 #There is <nowiki>nowiki</nowiki>.
578
579 *There is not nowiki.
580 *There is <nowiki>nowiki</nowiki>.
581 !! result
582 <dl><dd>There is not nowiki.
583 </dd><dd>There is nowiki.
584 </dd></dl>
585 <ol><li>There is not nowiki.
586 </li><li>There is nowiki.
587 </li></ol>
588 <ul><li>There is not nowiki.
589 </li><li>There is nowiki.
590 </li></ul>
591
592 !! end
593
594 !! test
595 Entities inside <nowiki>
596 !! input
597 <nowiki>&lt;</nowiki>
598 !! result
599 <p>&lt;
600 </p>
601 !! end
602
603
604 ###
605 ### Comments
606 ###
607 !! test
608 Comments and Indent-Pre
609 !! input
610 <!-- comment 1 --> asdf
611
612 <!-- comment 1 --> asdf
613 <!-- comment 2 -->
614
615 <!-- comment 1 --> asdf
616 <!-- comment 2 -->xyz
617
618 <!-- comment 1 --> asdf
619 <!-- comment 2 --> xyz
620 !! result
621 <pre>asdf
622 </pre>
623 <pre>asdf
624 </pre>
625 <pre>asdf
626 </pre>
627 <p>xyz
628 </p>
629 <pre>asdf
630 xyz
631 </pre>
632 !! end
633
634 !! test
635 Comment test 2a
636 !! input
637 asdf
638 <!-- comment 1 -->
639 jkl
640 !! result
641 <p>asdf
642 jkl
643 </p>
644 !! end
645
646 !! test
647 Comment test 2b
648 !! input
649 asdf
650 <!-- comment 1 -->
651
652 jkl
653 !! result
654 <p>asdf
655 </p><p>jkl
656 </p>
657 !! end
658
659 !! test
660 Comment test 3
661 !! input
662 asdf
663 <!-- comment 1 -->
664 <!-- comment 2 -->
665 jkl
666 !! result
667 <p>asdf
668 jkl
669 </p>
670 !! end
671
672 !! test
673 Comment test 4
674 !! input
675 asdf<!-- comment 1 -->jkl
676 !! result
677 <p>asdfjkl
678 </p>
679 !! end
680
681 !! test
682 Comment spacing
683 !! input
684 a
685 <!-- foo --> b <!-- bar -->
686 c
687 !! result
688 <p>a
689 </p>
690 <pre> b
691 </pre>
692 <p>c
693 </p>
694 !! end
695
696 !! test
697 Comment whitespace
698 !! input
699 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
700 !! result
701
702 !! end
703
704 !! test
705 Comment semantics and delimiters
706 !! input
707 <!-- --><!----><!-----><!------>
708 !! result
709
710 !! end
711
712 !! test
713 Comment semantics and delimiters, redux
714 !! input
715 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
716 -- foo -- funky huh? ... -->
717 !! result
718
719 !! end
720
721 !! test
722 Comment semantics and delimiters: directors cut
723 !! input
724 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
725 everything starting with < followed by !-- until the first -- and > we see,
726 that wouldn't be valid XML however, since in XML -- has to terminate a comment
727 -->-->
728 !! result
729 <p>--&gt;
730 </p>
731 !! end
732
733 !! test
734 Comment semantics: nesting
735 !! input
736 <!--<!-- no, we're not going to do anything fancy here -->-->
737 !! result
738 <p>--&gt;
739 </p>
740 !! end
741
742 !! test
743 Comment semantics: unclosed comment at end
744 !! input
745 <!--This comment will run out to the end of the document
746 !! result
747
748 !! end
749
750 !! test
751 Comment in template title
752 !! input
753 {{f<!---->oo}}
754 !! result
755 <p>FOO
756 </p>
757 !! end
758
759 !! test
760 Comment on its own line post-expand
761 !! input
762 a
763 {{blank}}<!---->
764 b
765 !! result
766 <p>a
767 </p><p>b
768 </p>
769 !! end
770
771 !! test
772 Comment on its own line post-expand with non-significant whitespace
773 !! input
774 a
775 {{blank}} <!---->
776 b
777 !! result
778 <p>a
779 </p><p>b
780 </p>
781 !! end
782
783 ###
784 ### paragraph wraping tests
785 ###
786 !! test
787 No block tags
788 !! input
789 a
790
791 b
792 !! result
793 <p>a
794 </p><p>b
795 </p>
796 !! end
797 !! test
798 Block tag on one line
799 !! input
800 a <div>foo</div>
801
802 b
803 !! result
804 a <div>foo</div>
805 <p>b
806 </p>
807 !! end
808
809 !! test
810 Block tag on both lines
811 !! input
812 a <div>foo</div>
813
814 b <div>foo</div>
815 !! result
816 a <div>foo</div>
817 b <div>foo</div>
818
819 !! end
820
821 !! test
822 Multiple lines without block tags
823 !! input
824 <div>foo</div> a
825 b
826 c
827 d<!--foo--> e
828 x <div>foo</div> z
829 !! result
830 <div>foo</div> a
831 <p>b
832 c
833 d e
834 </p>
835 x <div>foo</div> z
836
837 !! end
838
839 !! test
840 Empty lines between block tags to test open p-tags are closed between the block tags
841 !! input
842 <div></div>
843
844
845 <div></div>a
846
847 b
848 !! result
849 <div></div>
850 <p><br />
851 </p>
852 <div></div>a
853 <p>b
854 </p>
855 !! end
856
857 ###
858 ### Preformatted text
859 ###
860 !! test
861 Preformatted text
862 !! input
863 This is some
864 Preformatted text
865 With ''italic''
866 And '''bold'''
867 And a [[Main Page|link]]
868 !! result
869 <pre>This is some
870 Preformatted text
871 With <i>italic</i>
872 And <b>bold</b>
873 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
874 </pre>
875 !! end
876
877 !! test
878 Ident preformatting with inline content
879 !! input
880 a
881 ''b''
882 !! result
883 <pre>a
884 <i>b</i>
885 </pre>
886 !! end
887
888 !! test
889 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
890 !! input
891 <pre><nowiki>
892 <b>
893 <cite>
894 <em>
895 </nowiki></pre>
896 !! result
897 <pre>
898 &lt;b&gt;
899 &lt;cite&gt;
900 &lt;em&gt;
901 </pre>
902
903 !! end
904
905 !! test
906 Regression with preformatted in <center>
907 !! input
908 <center>
909 Blah
910 </center>
911 !! result
912 <center>
913 <pre>Blah
914 </pre>
915 </center>
916
917 !! end
918
919 # Expected output in the following test is not really expected (there should be
920 # <pre> in the output) -- it's only testing for well-formedness.
921 !! test
922 Bug 6200: Preformatted in <blockquote>
923 !! input
924 <blockquote>
925 Blah
926 </blockquote>
927 !! result
928 <blockquote>
929 Blah
930 </blockquote>
931
932 !! end
933
934 !! test
935 <pre> with attributes (bug 3202)
936 !! input
937 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
938 !! result
939 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
940
941 !! end
942
943 !! test
944 <pre> with width attribute (bug 3202)
945 !! input
946 <pre width="8">Narrow screen goodies</pre>
947 !! result
948 <pre width="8">Narrow screen goodies</pre>
949
950 !! end
951
952 !! test
953 <pre> with forbidden attribute (bug 3202)
954 !! input
955 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
956 !! result
957 <pre width="8">Narrow screen goodies</pre>
958
959 !! end
960
961 !! test
962 Entities inside <pre>
963 !! input
964 <pre>&lt;</pre>
965 !! result
966 <pre>&lt;</pre>
967
968 !! end
969
970 !! test
971 <pre> with forbidden attribute values (bug 3202)
972 !! input
973 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
974 !! result
975 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
976
977 !! end
978
979 !! test
980 <nowiki> inside <pre> (bug 13238)
981 !! input
982 <pre>
983 <nowiki>
984 </pre>
985 <pre>
986 <nowiki></nowiki>
987 </pre>
988 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
989 !! result
990 <pre>
991 &lt;nowiki&gt;
992 </pre>
993 <pre>
994
995 </pre>
996 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
997
998 !! end
999
1000 !! test
1001 <nowiki> and <pre> preference (first one wins)
1002 !! input
1003 <pre>
1004 <nowiki>
1005 </pre>
1006 </nowiki>
1007 </pre>
1008
1009 <nowiki>
1010 <pre>
1011 <nowiki>
1012 </pre>
1013 </nowiki>
1014 </pre>
1015
1016 !! result
1017 <pre>
1018 &lt;nowiki&gt;
1019 </pre>
1020 <p>&lt;/nowiki&gt;
1021 &lt;/pre&gt;
1022 </p><p>
1023 &lt;pre&gt;
1024 &lt;nowiki&gt;
1025 &lt;/pre&gt;
1026
1027 &lt;/pre&gt;
1028 </p>
1029 !! end
1030
1031 !! test
1032 </pre> inside nowiki
1033 !! input
1034 <nowiki></pre></nowiki>
1035 !! result
1036 <p>&lt;/pre&gt;
1037 </p>
1038 !! end
1039
1040 !!test
1041 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1042 !!input
1043 {{echo|}}
1044 !!result
1045
1046 !!end
1047
1048 !!test
1049 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1050 !!input
1051 {{echo|
1052 foo}}
1053 !!result
1054 <p>foo
1055 </p>
1056 !!end
1057
1058 !! test
1059 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1060 !! input
1061 {{echo|a
1062 b}}
1063 !!result
1064 <pre>a
1065 </pre>
1066 <p>b
1067 </p>
1068 !!end
1069
1070 !! test
1071 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1072 !! input
1073 {{echo|a
1074 b
1075 c
1076 d
1077 e
1078 }}
1079 !!result
1080 <pre>a
1081 </pre>
1082 <p>b
1083 c
1084 </p>
1085 <pre>d
1086 </pre>
1087 <p>e
1088 </p>
1089 !!end
1090
1091 !!test
1092 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1093 !!input
1094 {{echo| foo}}
1095
1096 {{echo| foo}}{{echo| bar}}
1097
1098 {{echo| foo}}
1099 {{echo| bar}}
1100
1101 {{echo|<!--cmt--> foo}}
1102
1103 <!--cmt-->{{echo| foo}}
1104
1105 {{echo|{{echo| }}bar}}
1106 !!result
1107 <pre>foo
1108 </pre>
1109 <pre>foo bar
1110 </pre>
1111 <pre>foo
1112 bar
1113 </pre>
1114 <pre>foo
1115 </pre>
1116 <pre>foo
1117 </pre>
1118 <pre>bar
1119 </pre>
1120 !!end
1121
1122 !! test
1123 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1124 !! input
1125 {{echo| }}a
1126
1127 {{echo|
1128 }}a
1129
1130 {{echo|
1131 b}}
1132
1133 {{echo|a
1134 }}b
1135
1136 {{echo|a
1137 }} b
1138 !!result
1139 <pre>a
1140 </pre>
1141 <p><br />
1142 </p>
1143 <pre>a
1144 </pre>
1145 <p><br />
1146 </p>
1147 <pre>b
1148 </pre>
1149 <p>a
1150 </p>
1151 <pre>b
1152 </pre>
1153 <p>a
1154 </p>
1155 <pre>b
1156 </pre>
1157 !!end
1158
1159 !! test
1160 Templates: Single-line variant of parameter whitespace stripping test
1161 !! input
1162 {{echo| a}}
1163
1164 {{echo|1= a}}
1165
1166 {{echo|{{echo| a}}}}
1167
1168 {{echo|1={{echo| a}}}}
1169 !! result
1170 <pre>a
1171 </pre>
1172 <p>a
1173 </p>
1174 <pre>a
1175 </pre>
1176 <p>a
1177 </p>
1178 !! end
1179
1180 !! test
1181 Templates: Strip whitespace from named parameters, but not positional ones
1182 !! input
1183 {{echo|
1184 foo}}
1185
1186 {{echo|
1187 * foo}}
1188
1189 {{echo| 1 =
1190 foo}}
1191
1192 {{echo| 1 =
1193 * foo}}
1194 !! result
1195 <pre>foo
1196 </pre>
1197 <p><br />
1198 </p>
1199 <ul><li> foo
1200 </li></ul>
1201 <p>foo
1202 </p>
1203 <ul><li> foo
1204 </li></ul>
1205
1206 !! end
1207
1208 ###
1209 ### Parsoid-centric tests for testing RT edge cases for pre
1210 ###
1211
1212 !!test
1213 1a. Indent-Pre and Comments
1214 !!input
1215 a
1216 <!--a-->
1217 c
1218 !!result
1219 <pre>a
1220 </pre>
1221 <p>c
1222 </p>
1223 !!end
1224
1225 !!test
1226 1b. Indent-Pre and Comments
1227 !!input
1228 a
1229 <!--a-->
1230 c
1231 !!result
1232 <pre>a
1233 </pre>
1234 <p>c
1235 </p>
1236 !!end
1237
1238 !!test
1239 1c. Indent-Pre and Comments
1240 !!input
1241 <!--a--> a
1242
1243 <!--a--> a
1244 !!result
1245 <pre> a
1246 </pre>
1247 <pre> a
1248 </pre>
1249 !!end
1250
1251 !!test
1252 2a. Indent-Pre and tables
1253 !!input
1254 {|
1255 |-
1256 !h1!!h2
1257 |foo||bar
1258 |}
1259 !!result
1260 <table>
1261
1262 <tr>
1263 <th>h1</th>
1264 <th>h2
1265 </th>
1266 <td>foo</td>
1267 <td>bar
1268 </td></tr></table>
1269
1270 !!end
1271
1272 !!test
1273 2b. Indent-Pre and tables
1274 !!input
1275 {|
1276 |-
1277 |foo
1278 |}
1279 !!result
1280 <table>
1281
1282 <tr>
1283 <td>foo
1284 </td></tr></table>
1285
1286 !!end
1287
1288 !!test
1289 2c. Indent-Pre and tables (bug 42252)
1290 !!input
1291 {|
1292 |+ foo
1293 ! | bar
1294 |}
1295 !!result
1296 <table>
1297 <caption> foo
1298 </caption>
1299 <tr>
1300 <th> bar
1301 </th></tr></table>
1302
1303 !!end
1304
1305 !!test
1306 3a. Indent-Pre and block tags (single-line html)
1307 !!input
1308 <p> foo </p>
1309 <div> foo </div>
1310 <span> foo </span>
1311 !!result
1312 <p> foo </p>
1313 <div> foo </div>
1314 <pre><span> foo </span>
1315 </pre>
1316 !!end
1317
1318 !!test
1319 3b. Indent-Pre and block tags (pre-content on separate line)
1320 !!input
1321 <p>
1322 foo
1323 </p>
1324
1325 <div>
1326 foo
1327 </div>
1328
1329 <center>
1330 foo
1331 </center>
1332
1333 <blockquote>
1334 foo
1335 </blockquote>
1336
1337 <table><tr><td>
1338 foo
1339 </td></tr></table>
1340
1341 <ul><li>
1342 foo
1343 </li></ul>
1344
1345 !!result
1346 <p>
1347 foo
1348 </p>
1349 <div>
1350 <pre>foo
1351 </pre>
1352 </div>
1353 <center>
1354 <pre>foo
1355 </pre>
1356 </center>
1357 <blockquote>
1358 foo
1359 </blockquote>
1360 <table><tr><td>
1361 <pre>foo
1362 </pre>
1363 </td></tr></table>
1364 <ul><li>
1365 foo
1366 </li></ul>
1367
1368 !!end
1369
1370 !!test
1371 4. Multiple spaces at start-of-line
1372 !!input
1373 <p> foo </p>
1374 foo
1375 {|
1376 |foo
1377 |}
1378 !!result
1379 <p> foo </p>
1380 <pre> foo
1381 </pre>
1382 <table>
1383 <tr>
1384 <td>foo
1385 </td></tr></table>
1386
1387 !!end
1388
1389 !! test
1390 5. White-space in indent-pre
1391 NOTE: the white-space char on 2nd line is significant
1392 !! input
1393 a<br/>
1394
1395 b
1396 !! result
1397 <pre>a<br />
1398
1399 b
1400 </pre>
1401 !! end
1402
1403 ###
1404 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1405 ###
1406
1407 !!test
1408 HTML-pre: 1. embedded newlines
1409 !!input
1410 <pre>foo</pre>
1411
1412 <pre>
1413 foo
1414 </pre>
1415
1416 <pre>
1417
1418 foo
1419 </pre>
1420
1421 <pre>
1422
1423
1424 foo
1425 </pre>
1426 !!result
1427 <pre>foo</pre>
1428 <pre>
1429 foo
1430 </pre>
1431 <pre>
1432
1433 foo
1434 </pre>
1435 <pre>
1436
1437
1438 foo
1439 </pre>
1440
1441 !!end
1442
1443 !!test
1444 HTML-pre: 2: indented text
1445 !!input
1446 <pre>
1447 foo
1448 </pre>
1449 !!result
1450 <pre>
1451 foo
1452 </pre>
1453
1454 !!end
1455
1456 !!test
1457 HTML-pre: 3: other wikitext
1458 !!input
1459 <pre>
1460 * foo
1461 # bar
1462 = no-h =
1463 '' no-italic ''
1464 [[ NoLink ]]
1465 </pre>
1466 !!result
1467 <pre>
1468 * foo
1469 # bar
1470 = no-h =
1471 '' no-italic ''
1472 [[ NoLink ]]
1473 </pre>
1474
1475 !!end
1476
1477 ###
1478 ### Definition lists
1479 ###
1480 !! test
1481 Simple definition
1482 !! input
1483 ; name : Definition
1484 !! result
1485 <dl><dt> name&#160;</dt><dd> Definition
1486 </dd></dl>
1487
1488 !! end
1489
1490 !! test
1491 Definition list for indentation only
1492 !! input
1493 : Indented text
1494 !! result
1495 <dl><dd> Indented text
1496 </dd></dl>
1497
1498 !! end
1499
1500 !! test
1501 Definition list with no space
1502 !! input
1503 ;name:Definition
1504 !! result
1505 <dl><dt>name</dt><dd>Definition
1506 </dd></dl>
1507
1508 !!end
1509
1510 !! test
1511 Definition list with URL link
1512 !! input
1513 ; http://example.com/ : definition
1514 !! result
1515 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1516 </dd></dl>
1517
1518 !! end
1519
1520 !! test
1521 Definition list with bracketed URL link
1522 !! input
1523 ;[http://www.example.com/ Example]:Something about it
1524 !! result
1525 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1526 </dd></dl>
1527
1528 !! end
1529
1530 !! test
1531 Definition list with wikilink containing colon
1532 !! input
1533 ; [[Help:FAQ]]: The least-read page on Wikipedia
1534 !! result
1535 <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
1536 </dd></dl>
1537
1538 !! end
1539
1540 # At Brion's and JeLuF's insistence... :)
1541 !! test
1542 Definition list with news link containing colon
1543 !! input
1544 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1545 !! result
1546 <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!
1547 </dd></dl>
1548
1549 !! end
1550
1551 !! test
1552 Malformed definition list with colon
1553 !! input
1554 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1555 !! result
1556 <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
1557 </dt></dl>
1558
1559 !! end
1560
1561 !! test
1562 Definition lists: colon in external link text
1563 !! input
1564 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1565 !! result
1566 <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
1567 </dd></dl>
1568
1569 !! end
1570
1571 !! test
1572 Definition lists: colon in HTML attribute
1573 !! input
1574 ;<b style="display: inline">bold</b>
1575 !! result
1576 <dl><dt><b style="display: inline">bold</b>
1577 </dt></dl>
1578
1579 !! end
1580
1581 !! test
1582 Definition lists: self-closed tag
1583 !! input
1584 ;one<br/>two : two-line fun
1585 !! result
1586 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1587 </dd></dl>
1588
1589 !! end
1590
1591 !! test
1592 Bug 11748: Literal closing tags
1593 !! input
1594 <dl>
1595 <dt>test 1</dt>
1596 <dd>test test test test test</dd>
1597 <dt>test 2</dt>
1598 <dd>test test test test test</dd>
1599 </dl>
1600 !! result
1601 <dl>
1602 <dt>test 1</dt>
1603 <dd>test test test test test</dd>
1604 <dt>test 2</dt>
1605 <dd>test test test test test</dd>
1606 </dl>
1607
1608 !! end
1609
1610 !! test
1611 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1612 !! input
1613 <ul><li>
1614 ; term : description
1615 * unordered
1616 </li>
1617 </ul>
1618 !! result
1619 <ul><li>
1620 <dl><dt> term&#160;</dt><dd> description
1621 </dd></dl>
1622 <ul><li> unordered
1623 </li></ul>
1624 </li>
1625 </ul>
1626
1627 !! end
1628
1629 !! test
1630
1631 Definition list with empty definition and following paragraph
1632 !! input
1633 ; term:
1634 Paragraph text
1635 !! result
1636 <dl><dt> term</dt><dd>
1637 </dd></dl>
1638 <p>Paragraph text
1639 </p>
1640 !! end
1641
1642 !! test
1643 Nested definition lists using html syntax
1644 !! input
1645 <dl><dd>
1646 <dl>
1647 <dd>Foo</dd>
1648 </dl>
1649 </dd></dl>
1650 !! result
1651 <dl><dd>
1652 <dl>
1653 <dd>Foo</dd>
1654 </dl>
1655 </dd></dl>
1656
1657 !! end
1658
1659 !! test
1660 Definition Lists: No nesting: Multiple dd's
1661 !! input
1662 ;x
1663 :a
1664 :b
1665 !! result
1666 <dl><dt>x
1667 </dt><dd>a
1668 </dd><dd>b
1669 </dd></dl>
1670
1671 !! end
1672
1673 !! test
1674 Definition Lists: Indentation: Regular
1675 !! input
1676 :i1
1677 ::i2
1678 :::i3
1679 !! result
1680 <dl><dd>i1
1681 <dl><dd>i2
1682 <dl><dd>i3
1683 </dd></dl>
1684 </dd></dl>
1685 </dd></dl>
1686
1687 !! end
1688
1689 !! test
1690 Definition Lists: Indentation: Missing 1st level
1691 !! input
1692 ::i2
1693 :::i3
1694 !! result
1695 <dl><dd><dl><dd>i2
1696 <dl><dd>i3
1697 </dd></dl>
1698 </dd></dl>
1699 </dd></dl>
1700
1701 !! end
1702
1703 !! test
1704 Definition Lists: Indentation: Multi-level indent
1705 !! input
1706 :::i3
1707 !! result
1708 <dl><dd><dl><dd><dl><dd>i3
1709 </dd></dl>
1710 </dd></dl>
1711 </dd></dl>
1712
1713 !! end
1714
1715 !! test
1716 Definition Lists: Hacky use to indent tables
1717 !! input
1718 ::{|
1719 |foo
1720 |bar
1721 |}
1722 this text
1723 should be left alone
1724 !! result
1725 <dl><dd><dl><dd><table>
1726 <tr>
1727 <td>foo
1728 </td>
1729 <td>bar
1730 </td></tr></table></dd></dl></dd></dl>
1731 <p>this text
1732 should be left alone
1733 </p>
1734 !! end
1735 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1736 ## as an empty dt item. It also ignores all but the last ";" when followed
1737 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1738 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1739 ## ";"s.
1740 ##
1741 ## Ex: ";;t2 ::d2" is transformed into:
1742 ##
1743 ## <dl>
1744 ## <dt>t2 </dt>
1745 ## <dd>
1746 ## <dl>
1747 ## <dt></dt>
1748 ## <dd>d2</dd>
1749 ## </dl>
1750 ## </dd>
1751 ## </dl>
1752 ##
1753 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1754 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1755 ##
1756 ## <dl>
1757 ## <dt>
1758 ## <dl>
1759 ## <dt>t2 </dt>
1760 ## <dd>:d2</dd>
1761 ## </dl>
1762 ## </dt>
1763 ## </dl>
1764 ##
1765 ## All Parsoid only definition list tests have this difference.
1766 ##
1767 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1768 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1769
1770 !! test
1771 Table / list interaction: indented table with lists in table contents
1772 !! input
1773 :{|
1774 |-
1775 | a
1776 * b
1777 |-
1778 | c
1779 * d
1780 |}
1781 !! result
1782 <dl><dd><table>
1783
1784 <tr>
1785 <td> a
1786 <ul><li> b
1787 </li></ul>
1788 </td></tr>
1789 <tr>
1790 <td> c
1791 <ul><li> d
1792 </li></ul>
1793 </td></tr></table></dd></dl>
1794
1795 !! end
1796
1797 !!test
1798 Table / list interaction: lists nested in tables nested in indented lists
1799 !!input
1800 :{|
1801 |
1802 :a
1803 :b
1804 |
1805 *c
1806 *d
1807 |}
1808
1809 *e
1810 *f
1811 !!result
1812 <dl><dd><table>
1813 <tr>
1814 <td>
1815 <dl><dd>a
1816 </dd><dd>b
1817 </dd></dl>
1818 </td>
1819 <td>
1820 <ul><li>c
1821 </li><li>d
1822 </li></ul>
1823 </td></tr></table></dd></dl>
1824 <ul><li>e
1825 </li><li>f
1826 </li></ul>
1827
1828 !!end
1829
1830 !! test
1831 Definition Lists: Nesting: Multi-level (Parsoid only)
1832 !! options
1833 parsoid
1834 !! input
1835 ;t1 :d1
1836 ;;t2 ::d2
1837 ;;;t3 :::d3
1838 !! result
1839 <dl>
1840 <dt>t1 </dt>
1841 <dd>d1</dd>
1842 <dt>
1843 <dl>
1844 <dt>t2 </dt>
1845 <dd>:d2</dd>
1846 <dt>
1847 <dl>
1848 <dt>t3 </dt>
1849 <dd>::d3</dd>
1850 </dl>
1851 </dt>
1852 </dl>
1853 </dt>
1854 </dl>
1855
1856
1857 !! end
1858
1859
1860 !! test
1861 Definition Lists: Nesting: Test 2 (Parsoid only)
1862 !! options
1863 parsoid
1864 !! input
1865 ;t1
1866 ::d2
1867 !! result
1868 <dl>
1869 <dt>t1</dt>
1870 <dd>
1871 <dl>
1872 <dd>d2</dd>
1873 </dl>
1874 </dd>
1875 </dl>
1876
1877 !! end
1878
1879
1880 !! test
1881 Definition Lists: Nesting: Test 3 (Parsoid only)
1882 !! options
1883 parsoid
1884 !! input
1885 :;t1
1886 ::::d2
1887 !! result
1888 <dl>
1889 <dd>
1890 <dl>
1891 <dt>t1</dt>
1892 <dd>
1893 <dl>
1894 <dd>
1895 <dl>
1896 <dd>d2</dd>
1897 </dl>
1898 </dd>
1899 </dl>
1900 </dd>
1901 </dl>
1902 </dd>
1903 </dl>
1904
1905 !! end
1906
1907
1908 !! test
1909 Definition Lists: Nesting: Test 4
1910 !! input
1911 ::;t3
1912 :::d3
1913 !! result
1914 <dl><dd><dl><dd><dl><dt>t3
1915 </dt><dd>d3
1916 </dd></dl>
1917 </dd></dl>
1918 </dd></dl>
1919
1920 !! end
1921
1922
1923 !! test
1924 Definition Lists: Mixed Lists: Test 1
1925 !! input
1926 :;* foo
1927 ::* bar
1928 :; baz
1929 !! result
1930 <dl><dd><dl><dt><ul><li> foo
1931 </li><li> bar
1932 </li></ul>
1933 </dt></dl>
1934 <dl><dt> baz
1935 </dt></dl>
1936 </dd></dl>
1937
1938 !! end
1939
1940
1941 !! test
1942 Definition Lists: Mixed Lists: Test 2
1943 !! input
1944 *: d1
1945 *: d2
1946 !! result
1947 <ul><li><dl><dd> d1
1948 </dd><dd> d2
1949 </dd></dl>
1950 </li></ul>
1951
1952 !! end
1953
1954
1955 !! test
1956 Definition Lists: Mixed Lists: Test 3
1957 !! input
1958 *::: d1
1959 *::: d2
1960 !! result
1961 <ul><li><dl><dd><dl><dd><dl><dd> d1
1962 </dd><dd> d2
1963 </dd></dl>
1964 </dd></dl>
1965 </dd></dl>
1966 </li></ul>
1967
1968 !! end
1969
1970
1971 !! test
1972 Definition Lists: Mixed Lists: Test 4
1973 !! input
1974 *;d1 :d2
1975 *;d3 :d4
1976 !! result
1977 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1978 </dd><dt>d3&#160;</dt><dd>d4
1979 </dd></dl>
1980 </li></ul>
1981
1982 !! end
1983
1984
1985 !! test
1986 Definition Lists: Mixed Lists: Test 5
1987 !! input
1988 *:d1
1989 *:: d2
1990 !! result
1991 <ul><li><dl><dd>d1
1992 <dl><dd> d2
1993 </dd></dl>
1994 </dd></dl>
1995 </li></ul>
1996
1997 !! end
1998
1999
2000 !! test
2001 Definition Lists: Mixed Lists: Test 6
2002 !! input
2003 #*:d1
2004 #*::: d3
2005 !! result
2006 <ol><li><ul><li><dl><dd>d1
2007 <dl><dd><dl><dd> d3
2008 </dd></dl>
2009 </dd></dl>
2010 </dd></dl>
2011 </li></ul>
2012 </li></ol>
2013
2014 !! end
2015
2016
2017 !! test
2018 Definition Lists: Mixed Lists: Test 7
2019 !! input
2020 :* d1
2021 :* d2
2022 !! result
2023 <dl><dd><ul><li> d1
2024 </li><li> d2
2025 </li></ul>
2026 </dd></dl>
2027
2028 !! end
2029
2030
2031 !! test
2032 Definition Lists: Mixed Lists: Test 8
2033 !! input
2034 :* d1
2035 ::* d2
2036 !! result
2037 <dl><dd><ul><li> d1
2038 </li></ul>
2039 <dl><dd><ul><li> d2
2040 </li></ul>
2041 </dd></dl>
2042 </dd></dl>
2043
2044 !! end
2045
2046
2047 !! test
2048 Definition Lists: Mixed Lists: Test 9
2049 !! input
2050 *;foo :bar
2051 !! result
2052 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2053 </dd></dl>
2054 </li></ul>
2055
2056 !! end
2057
2058
2059 !! test
2060 Definition Lists: Mixed Lists: Test 10
2061 !! input
2062 *#;foo :bar
2063 !! result
2064 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2065 </dd></dl>
2066 </li></ol>
2067 </li></ul>
2068
2069 !! end
2070
2071
2072 !! test
2073 Definition Lists: Mixed Lists: Test 11
2074 !! input
2075 *#*#;*;;foo :bar
2076 *#*#;boo :baz
2077 !! result
2078 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2079 </dt></dl>
2080 </dd></dl>
2081 </li></ul>
2082 </dd></dl>
2083 <dl><dt>boo&#160;</dt><dd>baz
2084 </dd></dl>
2085 </li></ol>
2086 </li></ul>
2087 </li></ol>
2088 </li></ul>
2089
2090 !! end
2091
2092
2093 !! test
2094 Definition Lists: Weird Ones: Test 1
2095 !! input
2096 *#;*::;; foo : bar (who uses this?)
2097 !! result
2098 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2099 </dt></dl>
2100 </dd></dl>
2101 </dd></dl>
2102 </dd></dl>
2103 </li></ul>
2104 </dd></dl>
2105 </li></ol>
2106 </li></ul>
2107
2108 !! end
2109
2110 ###
2111 ### External links
2112 ###
2113 !! test
2114 External links: non-bracketed
2115 !! input
2116 Non-bracketed: http://example.com
2117 !! result
2118 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2119 </p>
2120 !! end
2121
2122 !! test
2123 External links: numbered
2124 !! input
2125 Numbered: [http://example.com]
2126 Numbered: [http://example.net]
2127 Numbered: [http://example.com]
2128 !! result
2129 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2130 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2131 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2132 </p>
2133 !!end
2134
2135 !! test
2136 External links: specified text
2137 !! input
2138 Specified text: [http://example.com link]
2139 !! result
2140 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2141 </p>
2142 !!end
2143
2144 !! test
2145 External links: trail
2146 !! input
2147 Linktrails should not work for external links: [http://example.com link]s
2148 !! result
2149 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2150 </p>
2151 !! end
2152
2153 !! test
2154 External links: dollar sign in URL
2155 !! input
2156 http://example.com/1$2345
2157 !! result
2158 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2159 </p>
2160 !! end
2161
2162 !! test
2163 External links: dollar sign in URL (named)
2164 !! input
2165 [http://example.com/1$2345]
2166 !! result
2167 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2168 </p>
2169 !!end
2170
2171 !! test
2172 External links: open square bracket forbidden in URL (bug 4377)
2173 !! input
2174 http://example.com/1[2345
2175 !! result
2176 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2177 </p>
2178 !! end
2179
2180 !! test
2181 External links: open square bracket forbidden in URL (named) (bug 4377)
2182 !! input
2183 [http://example.com/1[2345]
2184 !! result
2185 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2186 </p>
2187 !!end
2188
2189 !! test
2190 External links: nowiki in URL link text (bug 6230)
2191 !!input
2192 [http://example.com/ <nowiki>''example site''</nowiki>]
2193 !! result
2194 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2195 </p>
2196 !! end
2197
2198 !! test
2199 External links: newline forbidden in text (bug 6230 regression check)
2200 !! input
2201 [http://example.com/ first
2202 second]
2203 !! result
2204 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2205 second]
2206 </p>
2207 !!end
2208
2209 !! test
2210 External links: Pipe char between url and text
2211 !! input
2212 [http://example.com | link]
2213 !! result
2214 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2215 </p>
2216 !!end
2217
2218 !! test
2219 External links: protocol-relative URL in brackets
2220 !! input
2221 [//example.com/ Test]
2222 !! result
2223 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2224 </p>
2225 !! end
2226
2227 !! test
2228 External links: protocol-relative URL in brackets without text
2229 !! input
2230 [//example.com]
2231 !! result
2232 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2233 </p>
2234 !! end
2235
2236 !! test
2237 External links: protocol-relative URL in free text is left alone
2238 !! input
2239 //example.com/Foo
2240 !! result
2241 <p>//example.com/Foo
2242 </p>
2243 !!end
2244
2245 !! test
2246 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2247 !! input
2248 foo//example.com/Foo
2249 !! result
2250 <p>foo//example.com/Foo
2251 </p>
2252 !! end
2253
2254 !! test
2255 External image
2256 !! input
2257 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2258 !! result
2259 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2260 </p>
2261 !! end
2262
2263 !! test
2264 External image from https
2265 !! input
2266 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2267 !! result
2268 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2269 </p>
2270 !! end
2271
2272 !! test
2273 Link to non-http image, no img tag
2274 !! input
2275 Link to non-http image, no img tag: ftp://example.com/test.jpg
2276 !! result
2277 <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>
2278 </p>
2279 !! end
2280
2281 !! test
2282 External links: terminating separator
2283 !! input
2284 Terminating separator: http://example.com/thing,
2285 !! result
2286 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2287 </p>
2288 !! end
2289
2290 !! test
2291 External links: intervening separator
2292 !! input
2293 Intervening separator: http://example.com/1,2,3
2294 !! result
2295 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2296 </p>
2297 !! end
2298
2299 !! test
2300 External links: old bug with URL in query
2301 !! input
2302 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2303 !! result
2304 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2305 </p>
2306 !! end
2307
2308 !! test
2309 External links: old URL-in-URL bug, mixed protocols
2310 !! input
2311 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2312 !! result
2313 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2314 </p>
2315 !!end
2316
2317 !! test
2318 External links: URL in text
2319 !! input
2320 URL in text: [http://example.com http://example.com]
2321 !! result
2322 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2323 </p>
2324 !! end
2325
2326 !! test
2327 External links: Clickable images
2328 !! input
2329 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2330 !! result
2331 <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>
2332 </p>
2333 !!end
2334
2335 !! test
2336 External links: raw ampersand
2337 !! input
2338 Old &amp; use: http://x&y
2339 !! result
2340 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2341 </p>
2342 !! end
2343
2344 !! test
2345 External links: encoded ampersand
2346 !! input
2347 Old &amp; use: http://x&amp;y
2348 !! result
2349 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2350 </p>
2351 !! end
2352
2353 !! test
2354 External links: encoded equals (bug 6102)
2355 !! input
2356 http://example.com/?foo&#61;bar
2357 !! result
2358 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2359 </p>
2360 !! end
2361
2362 !! test
2363 External links: [raw ampersand]
2364 !! input
2365 Old &amp; use: [http://x&y]
2366 !! result
2367 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2368 </p>
2369 !! end
2370
2371 !! test
2372 External links: [encoded ampersand]
2373 !! input
2374 Old &amp; use: [http://x&amp;y]
2375 !! result
2376 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2377 </p>
2378 !! end
2379
2380 !! test
2381 External links: [encoded equals] (bug 6102)
2382 !! input
2383 [http://example.com/?foo&#61;bar]
2384 !! result
2385 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2386 </p>
2387 !! end
2388
2389 !! test
2390 External links: [IDN ignored character reference in hostname; strip it right off]
2391 !! input
2392 [http://e&zwnj;xample.com/]
2393 !! result
2394 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2395 </p>
2396 !! end
2397
2398 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2399 # Where an external link could easily circumvent the sanitization of the text of
2400 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2401 # test demands a higher standard. That's a bit strange.
2402 #
2403 # Example:
2404 #
2405 # http://e‌xample.com -> [http://example.com|http://example.com]
2406 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2407 #
2408 # The first example is sanitized, but the second is not. Any security benefits
2409 # from this production are trivial to circumvent. Either remove this test and
2410 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2411 # the test accordingly.
2412 #
2413 # All our love,
2414 # The Parsoid team.
2415 !! test
2416 External links: IDN ignored character reference in hostname; strip it right off
2417 !! input
2418 http://e&zwnj;xample.com/
2419 !! result
2420 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2421 </p>
2422 !! end
2423
2424 !! test
2425 External links: www.jpeg.org (bug 554)
2426 !! input
2427 http://www.jpeg.org
2428 !!result
2429 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2430 </p>
2431 !! end
2432
2433 !! test
2434 External links: URL within URL (original bug 2)
2435 !! input
2436 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2437 !! result
2438 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2439 </p>
2440 !! end
2441
2442 !! test
2443 BUG 361: URL inside bracketed URL
2444 !! input
2445 [http://www.example.com/foo http://www.example.com/bar]
2446 !! result
2447 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2448 </p>
2449 !! end
2450
2451 !! test
2452 BUG 361: URL within URL, not bracketed
2453 !! input
2454 http://www.example.com/foo?=http://www.example.com/bar
2455 !! result
2456 <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>
2457 </p>
2458 !! end
2459
2460 !! test
2461 BUG 289: ">"-token in URL-tail
2462 !! input
2463 http://www.example.com/<hello>
2464 !! result
2465 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2466 </p>
2467 !!end
2468
2469 !! test
2470 BUG 289: literal ">"-token in URL-tail
2471 !! input
2472 http://www.example.com/<b>html</b>
2473 !! result
2474 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2475 </p>
2476 !!end
2477
2478 !! test
2479 BUG 289: ">"-token in bracketed URL
2480 !! input
2481 [http://www.example.com/<hello> stuff]
2482 !! result
2483 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2484 </p>
2485 !!end
2486
2487 !! test
2488 BUG 289: literal ">"-token in bracketed URL
2489 !! input
2490 [http://www.example.com/<b>html</b> stuff]
2491 !! result
2492 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2493 </p>
2494 !!end
2495
2496 !! test
2497 BUG 289: literal double quote at end of URL
2498 !! input
2499 http://www.example.com/"hello"
2500 !! result
2501 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2502 </p>
2503 !!end
2504
2505 !! test
2506 BUG 289: literal double quote in bracketed URL
2507 !! input
2508 [http://www.example.com/"hello" stuff]
2509 !! result
2510 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2511 </p>
2512 !!end
2513
2514 !! test
2515 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2516 !! input
2517 [http://www.example.com test]
2518 !! result
2519 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2520 </p>
2521 !! end
2522
2523 !! test
2524 External links: link text with spaces
2525 !! input
2526 [http://www.example.com a b c]
2527 [http://www.example.com ''a'' ''b'']
2528 !! result
2529 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2530 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2531 </p>
2532 !! end
2533
2534 !! test
2535 External links: wiki links within external link (Bug 3695)
2536 !! input
2537 [http://example.com [[wikilink]] embedded in ext link]
2538 !! result
2539 <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>
2540 </p>
2541 !! end
2542
2543 !! test
2544 BUG 787: Links with one slash after the url protocol are invalid
2545 !! input
2546 http:/example.com
2547
2548 [http:/example.com title]
2549 !! result
2550 <p>http:/example.com
2551 </p><p>[http:/example.com title]
2552 </p>
2553 !! end
2554
2555 !! test
2556 Bracketed external links with template-generated invalid target
2557 !! input
2558 [{{echo|http:/example.com}} title]
2559 !! result
2560 <p>[http:/example.com title]
2561 </p>
2562 !! end
2563
2564 !! test
2565 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2566 !! input
2567 ''[http://example.com text'']
2568 [http://example.com '''text]'''
2569 ''Something [http://example.com in italic'']
2570 ''Something [http://example.com mixed''''', even bold]'''
2571 '''''Now [http://example.com both''''']
2572 !! result
2573 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2574 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2575 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2576 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2577 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2578 </p>
2579 !! end
2580
2581
2582 !! test
2583 Bug 4781: %26 in URL
2584 !! input
2585 http://www.example.com/?title=AT%26T
2586 !! result
2587 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2588 </p>
2589 !! end
2590
2591 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2592 # % is actually legal in HTML5. Any change in output would need testing though.
2593 !! test
2594 Bug 4781, 5267: %25 in URL
2595 !! input
2596 http://www.example.com/?title=100%25_Bran
2597 !! result
2598 <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>
2599 </p>
2600 !! end
2601
2602 !! test
2603 Bug 4781, 5267: %28, %29 in URL
2604 !! input
2605 http://www.example.com/?title=Ben-Hur_%281959_film%29
2606 !! result
2607 <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>
2608 </p>
2609 !! end
2610
2611
2612 !! test
2613 Bug 4781: %26 in autonumber URL
2614 !! input
2615 [http://www.example.com/?title=AT%26T]
2616 !! result
2617 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2618 </p>
2619 !! end
2620
2621 !! test
2622 Bug 4781, 5267: %26 in autonumber URL
2623 !! input
2624 [http://www.example.com/?title=100%25_Bran]
2625 !! result
2626 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2627 </p>
2628 !! end
2629
2630 !! test
2631 Bug 4781, 5267: %28, %29 in autonumber URL
2632 !! input
2633 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2634 !! result
2635 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2636 </p>
2637 !! end
2638
2639
2640 !! test
2641 Bug 4781: %26 in bracketed URL
2642 !! input
2643 [http://www.example.com/?title=AT%26T link]
2644 !! result
2645 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2646 </p>
2647 !! end
2648
2649 !! test
2650 Bug 4781, 5267: %26 in bracketed URL
2651 !! input
2652 [http://www.example.com/?title=100%25_Bran link]
2653 !! result
2654 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2655 </p>
2656 !! end
2657
2658 !! test
2659 Bug 4781, 5267: %28, %29 in bracketed URL
2660 !! input
2661 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2662 !! result
2663 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2664 </p>
2665 !! end
2666
2667 !! test
2668 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2669 !! input
2670 Some [http://example.com/ pretty ''italics'' and stuff]!
2671 !! result
2672 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2673 </p>
2674 !! end
2675
2676 !! test
2677 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2678 !! input
2679 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2680 !! result
2681 <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>
2682 </p>
2683 !! end
2684
2685 !! test
2686 External link containing double-single-quotes with no space separating the url from text in italics
2687 !! input
2688 [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]].]
2689 !! result
2690 <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>
2691 </p>
2692 !! end
2693
2694 !! test
2695 URL-encoding in URL functions (single parameter)
2696 !! input
2697 {{localurl:Some page|amp=&}}
2698 !! result
2699 <p>/index.php?title=Some_page&amp;amp=&amp;
2700 </p>
2701 !! end
2702
2703 !! test
2704 URL-encoding in URL functions (multiple parameters)
2705 !! input
2706 {{localurl:Some page|q=?&amp=&}}
2707 !! result
2708 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2709 </p>
2710 !! end
2711
2712 !! test
2713 Brackets in urls
2714 !! input
2715 http://example.com/index.php?foozoid%5B%5D=bar
2716
2717 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2718 !! result
2719 <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>
2720 </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>
2721 </p>
2722 !! end
2723
2724 !! test
2725 IPv6 urls (bug 21261)
2726 !! options
2727 disabled
2728 !! input
2729 http://[2404:130:0:1000::187:2]/index.php
2730 !! result
2731 <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>
2732 </p>
2733 !! end
2734
2735 !! test
2736 Non-extlinks in brackets
2737 !! input
2738 [foo]
2739 [foo bar]
2740 [foo ''bar'']
2741 [fool's] errand
2742 [fool's errand]
2743 [{{echo|foo}}]
2744 [{{echo|foo}} bar]
2745 [{{echo|foo}} ''bar'']
2746 [{{echo|foo}}l's] errand
2747 [{{echo|foo}}l's errand]
2748 [url={{echo|foo}}]
2749 [url=http://example.com]
2750 !! result
2751 <p>[foo]
2752 [foo bar]
2753 [foo <i>bar</i>]
2754 [fool's] errand
2755 [fool's errand]
2756 [foo]
2757 [foo bar]
2758 [foo <i>bar</i>]
2759 [fool's] errand
2760 [fool's errand]
2761 [url=foo]
2762 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
2763 </p>
2764 !! end
2765
2766 ###
2767 ### Quotes
2768 ###
2769
2770 !! test
2771 Quotes
2772 !! input
2773 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2774
2775 Normal text. '''''Bold italic text.''''' Normal text.
2776 !!result
2777 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2778 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2779 </p>
2780 !! end
2781
2782
2783 !! test
2784 Unclosed and unmatched quotes
2785 !! input
2786 '''''Bold italic text '''with bold deactivated''' in between.'''''
2787
2788 '''''Bold italic text ''with italic deactivated'' in between.'''''
2789
2790 '''Bold text..
2791
2792 ..spanning two paragraphs (should not work).'''
2793
2794 '''Bold tag left open
2795
2796 ''Italic tag left open
2797
2798 Normal text.
2799
2800 <!-- Unmatching number of opening, closing tags: -->
2801 '''This year''''s election ''should'' beat '''last year''''s.
2802
2803 ''Tom'''s car is bigger than ''Susan'''s.
2804
2805 Plain ''italic'''s plain
2806 !! result
2807 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2808 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2809 </p><p><b>Bold text..</b>
2810 </p><p>..spanning two paragraphs (should not work).
2811 </p><p><b>Bold tag left open</b>
2812 </p><p><i>Italic tag left open</i>
2813 </p><p>Normal text.
2814 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2815 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2816 </p><p>Plain <i>italic'</i>s plain
2817 </p>
2818 !! end
2819
2820 ###
2821 ### Tables
2822 ###
2823 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2824 ###
2825
2826 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2827 # is the bare minimun required by the spec, see:
2828 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2829 !! test
2830 A table with no data.
2831 !! input
2832 {||}
2833 !! result
2834 !! end
2835
2836 # A table with nothing but a caption is invalid XHTML, we might want to render
2837 # this as <p>caption</p>
2838 !! test
2839 A table with nothing but a caption
2840 !! input
2841 {|
2842 |+ caption
2843 |}
2844 !! result
2845 <table>
2846 <caption> caption
2847 </caption><tr><td></td></tr></table>
2848
2849 !! end
2850
2851 !! test
2852 A table with caption with default-spaced attributes and a table row
2853 !! input
2854 {|
2855 |+ style="color: red;" | caption1
2856 |-
2857 | foo
2858 |}
2859 !! result
2860 <table>
2861 <caption style="color: red;"> caption1
2862 </caption>
2863 <tr>
2864 <td> foo
2865 </td></tr></table>
2866
2867 !! end
2868
2869 !! test
2870 A table with captions with non-default spaced attributes and a table row
2871 !! input
2872 {|
2873 |+style="color: red;"|caption2
2874 |+ style="color: red;"| caption3
2875 |-
2876 | foo
2877 |}
2878 !! result
2879 <table>
2880 <caption style="color: red;">caption2
2881 </caption>
2882 <caption style="color: red;"> caption3
2883 </caption>
2884 <tr>
2885 <td> foo
2886 </td></tr></table>
2887
2888 !! end
2889
2890 !! test
2891 Table td-cell syntax variations
2892 !! input
2893 {|
2894 | foo bar foo | baz
2895 | foo bar foo || baz
2896 | style='color:red;' | baz
2897 | style='color:red;' || baz
2898 |}
2899 !! result
2900 <table>
2901 <tr>
2902 <td> baz
2903 </td>
2904 <td> foo bar foo </td>
2905 <td> baz
2906 </td>
2907 <td style="color:red;"> baz
2908 </td>
2909 <td> style='color:red;' </td>
2910 <td> baz
2911 </td></tr></table>
2912
2913 !! end
2914
2915 !! test
2916 Simple table
2917 !! input
2918 {|
2919 | 1 || 2
2920 |-
2921 | 3 || 4
2922 |}
2923 !! result
2924 <table>
2925 <tr>
2926 <td> 1 </td>
2927 <td> 2
2928 </td></tr>
2929 <tr>
2930 <td> 3 </td>
2931 <td> 4
2932 </td></tr></table>
2933
2934 !! end
2935
2936 !! test
2937 Simple table but with multiple dashes for row wikitext
2938 !! input
2939 {|
2940 | foo
2941 |-----
2942 | bar
2943 |}
2944 !! result
2945 <table>
2946 <tr>
2947 <td> foo
2948 </td></tr>
2949 <tr>
2950 <td> bar
2951 </td></tr></table>
2952
2953 !! end
2954 !! test
2955 Multiplication table
2956 !! input
2957 {| border="1" cellpadding="2"
2958 |+Multiplication table
2959 |-
2960 ! &times; !! 1 !! 2 !! 3
2961 |-
2962 ! 1
2963 | 1 || 2 || 3
2964 |-
2965 ! 2
2966 | 2 || 4 || 6
2967 |-
2968 ! 3
2969 | 3 || 6 || 9
2970 |-
2971 ! 4
2972 | 4 || 8 || 12
2973 |-
2974 ! 5
2975 | 5 || 10 || 15
2976 |}
2977 !! result
2978 <table border="1" cellpadding="2">
2979 <caption>Multiplication table
2980 </caption>
2981 <tr>
2982 <th> &#215; </th>
2983 <th> 1 </th>
2984 <th> 2 </th>
2985 <th> 3
2986 </th></tr>
2987 <tr>
2988 <th> 1
2989 </th>
2990 <td> 1 </td>
2991 <td> 2 </td>
2992 <td> 3
2993 </td></tr>
2994 <tr>
2995 <th> 2
2996 </th>
2997 <td> 2 </td>
2998 <td> 4 </td>
2999 <td> 6
3000 </td></tr>
3001 <tr>
3002 <th> 3
3003 </th>
3004 <td> 3 </td>
3005 <td> 6 </td>
3006 <td> 9
3007 </td></tr>
3008 <tr>
3009 <th> 4
3010 </th>
3011 <td> 4 </td>
3012 <td> 8 </td>
3013 <td> 12
3014 </td></tr>
3015 <tr>
3016 <th> 5
3017 </th>
3018 <td> 5 </td>
3019 <td> 10 </td>
3020 <td> 15
3021 </td></tr></table>
3022
3023 !! end
3024
3025 !! test
3026 Accept "||" in table headings
3027 !! input
3028 {|
3029 !h1 || h2
3030 |}
3031 !! result
3032 <table>
3033 <tr>
3034 <th>h1 </th>
3035 <th> h2
3036 </th></tr></table>
3037
3038 !! end
3039
3040 !! test
3041 Accept "||" in indented table headings
3042 !! input
3043 :{|
3044 !h1 || h2
3045 |}
3046 !! result
3047 <dl><dd><table>
3048 <tr>
3049 <th>h1 </th>
3050 <th> h2
3051 </th></tr></table></dd></dl>
3052
3053 !! end
3054
3055 !! test
3056 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3057 !! input
3058 {|
3059 !| h1
3060 || a
3061 |}
3062 !! result
3063 <table>
3064 <tr>
3065 <th> h1
3066 </th>
3067 <td> a
3068 </td></tr></table>
3069
3070 !! end
3071
3072 !!test
3073 Accept "| !" at start of line in tables (ignore !-attribute)
3074 !!input
3075 {|
3076 |-
3077 | !style="color:red" | bar
3078 |}
3079 !!result
3080 <table>
3081
3082 <tr>
3083 <td> bar
3084 </td></tr></table>
3085
3086 !!end
3087
3088 !!test
3089 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 +/-
3090 !!input
3091 {|
3092 |-
3093 |style='color:red;'|+1
3094 |style='color:blue;'|-1
3095 |-
3096 | 1 || 2 || 3
3097 | 1 ||+2 ||-3
3098 |-
3099 | +1
3100 | -1
3101 |}
3102 !!result
3103 <table>
3104
3105 <tr>
3106 <td style="color:red;">+1
3107 </td>
3108 <td style="color:blue;">-1
3109 </td></tr>
3110 <tr>
3111 <td> 1 </td>
3112 <td> 2 </td>
3113 <td> 3
3114 </td>
3115 <td> 1 </td>
3116 <td>+2 </td>
3117 <td>-3
3118 </td></tr>
3119 <tr>
3120 <td> +1
3121 </td>
3122 <td> -1
3123 </td></tr></table>
3124
3125 !!end
3126
3127 !! test
3128 Table rowspan
3129 !! input
3130 {| border=1
3131 | Cell 1, row 1
3132 |rowspan=2| Cell 2, row 1 (and 2)
3133 | Cell 3, row 1
3134 |-
3135 | Cell 1, row 2
3136 | Cell 3, row 2
3137 |}
3138 !! result
3139 <table border="1">
3140 <tr>
3141 <td> Cell 1, row 1
3142 </td>
3143 <td rowspan="2"> Cell 2, row 1 (and 2)
3144 </td>
3145 <td> Cell 3, row 1
3146 </td></tr>
3147 <tr>
3148 <td> Cell 1, row 2
3149 </td>
3150 <td> Cell 3, row 2
3151 </td></tr></table>
3152
3153 !! end
3154
3155 !! test
3156 Nested table
3157 !! input
3158 {| border=1
3159 | &alpha;
3160 |
3161 {| bgcolor=#ABCDEF border=2
3162 |nested
3163 |-
3164 |table
3165 |}
3166 |the original table again
3167 |}
3168 !! result
3169 <table border="1">
3170 <tr>
3171 <td> &#945;
3172 </td>
3173 <td>
3174 <table bgcolor="#ABCDEF" border="2">
3175 <tr>
3176 <td>nested
3177 </td></tr>
3178 <tr>
3179 <td>table
3180 </td></tr></table>
3181 </td>
3182 <td>the original table again
3183 </td></tr></table>
3184
3185 !! end
3186
3187 !! test
3188 Invalid attributes in table cell (bug 1830)
3189 !! input
3190 {|
3191 |Cell:|broken
3192 |}
3193 !! result
3194 <table>
3195 <tr>
3196 <td>broken
3197 </td></tr></table>
3198
3199 !! end
3200
3201
3202 !! test
3203 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3204 !! input
3205 {|
3206 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3207 !! result
3208 <table>
3209 <tr>
3210 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3211 <td>]" onmouseover="alert(document.cookie)"&gt;test
3212 </td>
3213 </tr>
3214 </table>
3215
3216 !! end
3217
3218
3219 !! test
3220 Indented table markup mixed with indented pre content (proposed in bug 6200)
3221 !! input
3222 <table>
3223 <tr>
3224 <td>
3225 Text that should be rendered preformatted
3226 </td>
3227 </tr>
3228 </table>
3229 !! result
3230 <table>
3231 <tr>
3232 <td>
3233 <pre>Text that should be rendered preformatted
3234 </pre>
3235 </td>
3236 </tr>
3237 </table>
3238
3239 !! end
3240
3241 !! test
3242 Template-generated table cell attributes and cell content
3243 !! input
3244 {|
3245 |{{table_attribs}}
3246 |}
3247 !! result
3248 <table>
3249 <tr>
3250 <td style="color: red"> Foo
3251 </td></tr></table>
3252
3253 !! end
3254
3255 !! test
3256 Table with row followed by newlines and table heading
3257 !! input
3258 {|
3259 |-
3260
3261 ! foo
3262 |}
3263 !! result
3264 <table>
3265
3266
3267 <tr>
3268 <th> foo
3269 </th></tr></table>
3270
3271 !! end
3272
3273 # FIXME: Preserve the attribute properly (with an empty string as value) in
3274 # the PHP parser. Parsoid implements the behavior below.
3275 !! test
3276 Table attributes with empty value
3277 !! options
3278 disabled
3279 !! input
3280 {|
3281 | style=| hello
3282 |}
3283 !! result
3284 <table>
3285 <tr>
3286 <td style=""> hello
3287 </td></tr></table>
3288
3289 !! end
3290
3291 !! test
3292 Wikitext table with a lot of comments
3293 !! input
3294 {|
3295 <!-- c0 -->
3296 | foo
3297 <!-- c1 -->
3298 |- <!-- c2 -->
3299 <!-- c3 -->
3300 |<!-- c4 -->
3301 <!-- c5 -->
3302 |}
3303 !! result
3304 <table>
3305 <tr>
3306 <td> foo
3307 </td></tr>
3308 <tr>
3309 <td>
3310 </td></tr></table>
3311
3312 !! end
3313
3314 ###
3315 ### Internal links
3316 ###
3317 !! test
3318 Plain link, capitalized
3319 !! input
3320 [[Main Page]]
3321 !! result
3322 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3323 </p>
3324 !! end
3325
3326 !! test
3327 Plain link, uncapitalized
3328 !! input
3329 [[main Page]]
3330 !! result
3331 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3332 </p>
3333 !! end
3334
3335 !! test
3336 Piped link
3337 !! input
3338 [[Main Page|The Main Page]]
3339 !! result
3340 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3341 </p>
3342 !! end
3343
3344 !! test
3345 Broken link
3346 !! input
3347 [[Zigzagzogzagzig]]
3348 !! result
3349 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3350 </p>
3351 !! end
3352
3353 !! test
3354 Broken link with fragment
3355 !! input
3356 [[Zigzagzogzagzig#zug]]
3357 !! result
3358 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3359 </p>
3360 !! end
3361
3362 !! test
3363 Special page link with fragment
3364 !! input
3365 [[Special:Version#anchor]]
3366 !! result
3367 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3368 </p>
3369 !! end
3370
3371 !! test
3372 Nonexistent special page link with fragment
3373 !! input
3374 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3375 !! result
3376 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3377 </p>
3378 !! end
3379
3380 !! test
3381 Link with prefix
3382 !! input
3383 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3384 !! result
3385 <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>
3386 </p>
3387 !! end
3388
3389 !! test
3390 Link with suffix
3391 !! input
3392 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3393 !! result
3394 <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>!!!
3395 </p>
3396 !! end
3397
3398 !! article
3399 prefixed article
3400 !! text
3401 Some text
3402 !! endarticle
3403
3404 !! test
3405 Bug 43661: Piped links with identical prefixes
3406 !! input
3407 [[prefixed article|prefixed articles with spaces]]
3408
3409 [[prefixed article|prefixed articlesaoeu]]
3410
3411 [[Main Page|Main Page test]]
3412 !! result
3413 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3414 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3415 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3416 </p>
3417 !! end
3418
3419
3420 !! test
3421 Link with HTML entity in suffix / tail
3422 !! input
3423 [[Main Page]]&quot;, [[Main Page]]&#97;
3424 !! result
3425 <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;
3426 </p>
3427 !! end
3428
3429 !! test
3430 Link with 3 brackets
3431 !! input
3432 [[[main page]]]
3433 !! result
3434 <p>[[[main page]]]
3435 </p>
3436 !! end
3437
3438 !! test
3439 Piped link with 3 brackets
3440 !! input
3441 [[[main page|the main page]]]
3442 !! result
3443 <p>[[[main page|the main page]]]
3444 </p>
3445 !! end
3446
3447 !! test
3448 Link with multiple pipes
3449 !! input
3450 [[Main Page|The|Main|Page]]
3451 !! result
3452 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3453 </p>
3454 !! end
3455
3456 !! test
3457 Link to namespaces
3458 !! input
3459 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3460 !! result
3461 <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>
3462 </p>
3463 !! end
3464
3465 !! test
3466 Piped link to namespace
3467 !! input
3468 [[Meta:Disclaimers|The disclaimers]]
3469 !! result
3470 <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>
3471 </p>
3472 !! end
3473
3474 !! test
3475 Link containing }
3476 !! input
3477 [[Usually caused by a typo (oops}]]
3478 !! result
3479 <p>[[Usually caused by a typo (oops}]]
3480 </p>
3481 !! end
3482
3483 !! test
3484 Link containing % (not as a hex sequence)
3485 !! input
3486 [[7% Solution]]
3487 !! result
3488 <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>
3489 </p>
3490 !! end
3491
3492 !! test
3493 Link containing % as a single hex sequence interpreted to char
3494 !! input
3495 [[7%25 Solution]]
3496 !! result
3497 <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>
3498 </p>
3499 !!end
3500
3501 !! test
3502 Link containing % as a double hex sequence interpreted to hex sequence
3503 !! input
3504 [[7%2525 Solution]]
3505 !! result
3506 <p>[[7%2525 Solution]]
3507 </p>
3508 !!end
3509
3510 !! test
3511 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3512 Example for such a section: == < ==
3513 !! input
3514 [[%23%3c]][[%23%3e]]
3515 !! result
3516 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3517 </p>
3518 !! end
3519
3520 !! test
3521 Link containing "<#" and ">#" as a hex sequences
3522 !! input
3523 [[%3c%23]][[%3e%23]]
3524 !! result
3525 <p>[[%3c%23]][[%3e%23]]
3526 </p>
3527 !! end
3528
3529 !! test
3530 Link containing double-single-quotes '' (bug 4598)
3531 !! input
3532 [[Lista d''e paise d''o munno]]
3533 !! result
3534 <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>
3535 </p>
3536 !! end
3537
3538 !! test
3539 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3540 !! input
3541 Some [[Link|pretty ''italics'' and stuff]]!
3542 !! result
3543 <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>!
3544 </p>
3545 !! end
3546
3547 !! test
3548 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3549 !! input
3550 ''Some [[Link|pretty ''italics'' and stuff]]!
3551 !! result
3552 <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>
3553 </p>
3554 !! end
3555
3556 !! test
3557 Link with double quotes in title part (literal) and alternate part (interpreted)
3558 !! input
3559 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3560
3561 [[''Pentecoste'']]
3562
3563 [[''Pentecoste''|Pentecoste]]
3564
3565 [[''Pentecoste''|''Pentecoste'']]
3566 !! result
3567 <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>
3568 </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>
3569 </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>
3570 </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>
3571 </p>
3572 !! end
3573
3574 !! test
3575 Broken image links with HTML captions (bug 39700)
3576 !! input
3577 [[File:Nonexistent|<script></script>]]
3578 [[File:Nonexistent|100px|<script></script>]]
3579 [[File:Nonexistent|&lt;]]
3580 [[File:Nonexistent|a<i>b</i>c]]
3581 !! result
3582 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3583 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3584 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3585 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3586 </p>
3587 !! end
3588
3589 !! test
3590 Plain link to URL
3591 !! input
3592 [[http://www.example.com]]
3593 !! result
3594 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3595 </p>
3596 !! end
3597
3598 !! test
3599 Plain link to URL with link text
3600 !! input
3601 [[http://www.example.com Link text]]
3602 !! result
3603 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3604 </p>
3605 !! end
3606
3607 !! test
3608 Plain link to protocol-relative URL
3609 !! input
3610 [[//www.example.com]]
3611 !! result
3612 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3613 </p>
3614 !! end
3615
3616 !! test
3617 Plain link to protocol-relative URL with link text
3618 !! input
3619 [[//www.example.com Link text]]
3620 !! result
3621 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3622 </p>
3623 !! end
3624
3625 !! test
3626 Plain link to page with question mark in title
3627 !! input
3628 [[A?b]]
3629
3630 [[A?b|Baz]]
3631 !! result
3632 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3633 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3634 </p>
3635 !! end
3636
3637
3638 # I'm fairly sure the expected result here is wrong.
3639 # We want these to be URL links, not pseudo-pages with URLs for titles....
3640 # However the current output is also pretty screwy.
3641 #
3642 # ----
3643 # I'm changing it to match the current output--it arguably makes more
3644 # sense in the light of the test above. Old expected result was:
3645 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3646 #</p>
3647 # But I think this test is bordering on "garbage in, garbage out" anyway.
3648 # -- wtm
3649 !! test
3650 Piped link to URL
3651 !! input
3652 Piped link to URL: [[http://www.example.com|an example URL]]
3653 !! result
3654 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3655 </p>
3656 !! end
3657
3658 !! test
3659 BUG 2: [[page|http://url/]] should link to page, not http://url/
3660 !! input
3661 [[Main Page|http://url/]]
3662 !! result
3663 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3664 </p>
3665 !! end
3666
3667 !! test
3668 BUG 337: Escaped self-links should be bold
3669 !! options
3670 title=[[Bug462]]
3671 !! input
3672 [[Bu&#103;462]] [[Bug462]]
3673 !! result
3674 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3675 </p>
3676 !! end
3677
3678 !! test
3679 Self-link to section should not be bold
3680 !! options
3681 title=[[Main Page]]
3682 !! input
3683 [[Main Page#section]]
3684 !! result
3685 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3686 </p>
3687 !! end
3688
3689 !! article
3690 00
3691 !! text
3692 This is 00.
3693 !! endarticle
3694
3695 !!test
3696 Self-link to numeric title
3697 !!options
3698 title=[[0]]
3699 !!input
3700 [[0]]
3701 !!result
3702 <p><strong class="selflink">0</strong>
3703 </p>
3704 !!end
3705
3706 !!test
3707 Link to numeric-equivalent title
3708 !!options
3709 title=[[0]]
3710 !!input
3711 [[00]]
3712 !!result
3713 <p><a href="/wiki/00" title="00">00</a>
3714 </p>
3715 !!end
3716
3717 !! test
3718 <nowiki> inside a link
3719 !! input
3720 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3721 !! result
3722 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3723 </p>
3724 !! end
3725
3726 !! test
3727 Non-breaking spaces in title
3728 !! input
3729 [[&nbsp; Main &nbsp; Page &nbsp;]]
3730 !! result
3731 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3732 </p>
3733 !!end
3734
3735 !! test
3736 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3737 !! options
3738 language=ca
3739 !! input
3740 '''[[Main Page]]'''
3741 !! result
3742 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3743 </p>
3744 !! end
3745
3746 !! test
3747 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3748 !! options
3749 language=ca
3750 !! input
3751 ''[[Main Page]]''
3752 !! result
3753 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3754 </p>
3755 !! end
3756
3757 !! test
3758 Internal link with en linktrail: no apostrophes (bug 27473)
3759 !! options
3760 language=en
3761 !! input
3762 [[Something]]'nice
3763 !! result
3764 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3765 </p>
3766 !! end
3767
3768 !! test
3769 Internal link with ca linktrail with apostrophes (bug 27473)
3770 !! options
3771 language=ca
3772 !! input
3773 [[Something]]'nice
3774 !! result
3775 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3776 </p>
3777 !! end
3778
3779 !! test
3780 Internal link with kaa linktrail with apostrophes (bug 27473)
3781 !! options
3782 language=kaa
3783 !! input
3784 [[Something]]'nice
3785 !! result
3786 <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>
3787 </p>
3788 !! end
3789
3790 !! test
3791 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
3792 !! input
3793 [[Foo| bar]]
3794
3795 [[Foo| ''bar'']]
3796
3797 [http://wp.org foo]
3798
3799 [http://wp.org ''foo'']
3800 !! result
3801 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
3802 </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>
3803 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
3804 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
3805 </p>
3806 !! end
3807
3808 ###
3809 ### Interwiki links (see maintenance/interwiki.sql)
3810 ###
3811
3812 !! test
3813 Inline interwiki link
3814 !! input
3815 [[MeatBall:SoftSecurity]]
3816 !! result
3817 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3818 </p>
3819 !! end
3820
3821 !! test
3822 Inline interwiki link with empty title (bug 2372)
3823 !! input
3824 [[MeatBall:]]
3825 !! result
3826 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3827 </p>
3828 !! end
3829
3830 !! test
3831 Interwiki link encoding conversion (bug 1636)
3832 !! input
3833 *[[Wikipedia:ro:Olteni&#0355;a]]
3834 *[[Wikipedia:ro:Olteni&#355;a]]
3835 !! result
3836 <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>
3837 </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>
3838 </li></ul>
3839
3840 !! end
3841
3842 !! test
3843 Interwiki link with fragment (bug 2130)
3844 !! input
3845 [[MeatBall:SoftSecurity#foo]]
3846 !! result
3847 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3848 </p>
3849 !! end
3850
3851 !! test
3852 Interlanguage link
3853 !! input
3854 Blah blah blah
3855 [[zh:Chinese]]
3856 !!result
3857 <p>Blah blah blah
3858 </p>
3859 !! end
3860
3861 !! test
3862 Double interlanguage link
3863 !! input
3864 Blah blah blah
3865 [[es:Spanish]]
3866 [[zh:Chinese]]
3867 !!result
3868 <p>Blah blah blah
3869 </p>
3870 !! end
3871
3872 !! test
3873 Interlanguage link, with prefix links
3874 !! options
3875 language=ln
3876 !! input
3877 Blah blah blah
3878 [[zh:Chinese]]
3879 !!result
3880 <p>Blah blah blah
3881 </p>
3882 !! end
3883
3884 !! test
3885 Double interlanguage link, with prefix links (bug 8897)
3886 !! options
3887 language=ln
3888 !! input
3889 Blah blah blah
3890 [[es:Spanish]]
3891 [[zh:Chinese]]
3892 !!result
3893 <p>Blah blah blah
3894 </p>
3895 !! end
3896
3897 !! test
3898 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3899 !! options
3900 language=ln
3901 !! input
3902 [[WW&nbsp;II]]
3903 !!result
3904 <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>
3905 </p>
3906 !! end
3907
3908 ##
3909 ## XHTML tidiness
3910 ###
3911
3912 !! test
3913 <br> to <br />
3914 !! input
3915 1<br>2<br />3
3916 !! result
3917 <p>1<br />2<br />3
3918 </p>
3919 !! end
3920
3921 !! test
3922 Broken br tag sanitization
3923 !! input
3924 </br>
3925 !! result
3926 <p>&lt;/br&gt;
3927 </p>
3928 !! end
3929
3930 !! test
3931 Incorrecly removing closing slashes from correctly formed XHTML
3932 !! input
3933 <br style="clear:both;" />
3934 !! result
3935 <p><br style="clear:both;" />
3936 </p>
3937 !! end
3938
3939 !! test
3940 Failing to transform badly formed HTML into correct XHTML
3941 !! input
3942 <br style="clear: left;">
3943 <br style="clear: right;">
3944 <br style="clear: both;">
3945 !! result
3946 <p><br style="clear: left;" />
3947 <br style="clear: right;" />
3948 <br style="clear: both;" />
3949 </p>
3950 !!end
3951
3952 !! test
3953 Handling html with a div self-closing tag
3954 !! input
3955 <div title />
3956 <div title/>
3957 <div title/ >
3958 <div title=bar />
3959 <div title=bar/>
3960 <div title=bar/ >
3961 !! result
3962 <p>&lt;div title /&gt;
3963 &lt;div title/&gt;
3964 </p>
3965 <div>
3966 <p>&lt;div title=bar /&gt;
3967 &lt;div title=bar/&gt;
3968 </p>
3969 <div title="bar/"></div>
3970 </div>
3971
3972 !! end
3973
3974 !! test
3975 Handling html with a br self-closing tag
3976 !! input
3977 <br title />
3978 <br title/>
3979 <br title/ >
3980 <br title=bar />
3981 <br title=bar/>
3982 <br title=bar/ >
3983 !! result
3984 <p><br title="title" />
3985 <br title="title" />
3986 <br />
3987 <br title="bar" />
3988 <br title="bar" />
3989 <br title="bar/" />
3990 </p>
3991 !! end
3992
3993 !! test
3994 Horizontal ruler (should it add that extra space?)
3995 !! input
3996 <hr>
3997 <hr >
3998 foo <hr
3999 > bar
4000 !! result
4001 <hr />
4002 <hr />
4003 foo <hr /> bar
4004
4005 !! end
4006
4007 !! test
4008 Horizontal ruler -- 4+ dashes render hr
4009 !! input
4010 ----
4011 !! result
4012 <hr />
4013
4014 !! end
4015
4016 !! test
4017 Horizontal ruler -- eats additional dashes on the same line
4018 !! input
4019 ---------
4020 !! result
4021 <hr />
4022
4023 !! end
4024
4025 !! test
4026 Horizontal ruler -- does not collaps dashes on consecutive lines
4027 !! input
4028 ----
4029 ----
4030 !! result
4031 <hr />
4032 <hr />
4033
4034 !! end
4035
4036 !! test
4037 Horizontal ruler -- <4 dashes render as plain text
4038 !! input
4039 ---
4040 !! result
4041 <p>---
4042 </p>
4043 !! end
4044
4045 !! test
4046 Horizontal ruler -- Supports content following dashes on same line
4047 !! input
4048 ---- Foo
4049 !! result
4050 <hr /> Foo
4051
4052 !! end
4053
4054 ###
4055 ### Block-level elements
4056 ###
4057 !! test
4058 Common list
4059 !! input
4060 *Common list
4061 * item 2
4062 *item 3
4063 !! result
4064 <ul><li>Common list
4065 </li><li> item 2
4066 </li><li>item 3
4067 </li></ul>
4068
4069 !! end
4070
4071 !! test
4072 Numbered list
4073 !! input
4074 #Numbered list
4075 #item 2
4076 # item 3
4077 !! result
4078 <ol><li>Numbered list
4079 </li><li>item 2
4080 </li><li> item 3
4081 </li></ol>
4082
4083 !! end
4084
4085 !! test
4086 Mixed list
4087 !! input
4088 *Mixed list
4089 *# with numbers
4090 ** and bullets
4091 *# and numbers
4092 *bullets again
4093 **bullet level 2
4094 ***bullet level 3
4095 ***#Number on level 4
4096 **bullet level 2
4097 **#Number on level 3
4098 **#Number on level 3
4099 *#number level 2
4100 *Level 1
4101 *** Level 3
4102 #** Level 3, but ordered
4103 !! result
4104 <ul><li>Mixed list
4105 <ol><li> with numbers
4106 </li></ol>
4107 <ul><li> and bullets
4108 </li></ul>
4109 <ol><li> and numbers
4110 </li></ol>
4111 </li><li>bullets again
4112 <ul><li>bullet level 2
4113 <ul><li>bullet level 3
4114 <ol><li>Number on level 4
4115 </li></ol>
4116 </li></ul>
4117 </li><li>bullet level 2
4118 <ol><li>Number on level 3
4119 </li><li>Number on level 3
4120 </li></ol>
4121 </li></ul>
4122 <ol><li>number level 2
4123 </li></ol>
4124 </li><li>Level 1
4125 <ul><li><ul><li> Level 3
4126 </li></ul>
4127 </li></ul>
4128 </li></ul>
4129 <ol><li><ul><li><ul><li> Level 3, but ordered
4130 </li></ul>
4131 </li></ul>
4132 </li></ol>
4133
4134 !! end
4135
4136 !! test
4137 Nested lists 1
4138 !! input
4139 *foo
4140 **bar
4141 !! result
4142 <ul><li>foo
4143 <ul><li>bar
4144 </li></ul>
4145 </li></ul>
4146
4147 !! end
4148
4149 !! test
4150 Nested lists 2
4151 !! input
4152 **foo
4153 *bar
4154 !! result
4155 <ul><li><ul><li>foo
4156 </li></ul>
4157 </li><li>bar
4158 </li></ul>
4159
4160 !! end
4161
4162 !! test
4163 Nested lists 3 (first element empty)
4164 !! input
4165 *
4166 **bar
4167 !! result
4168 <ul><li>
4169 <ul><li>bar
4170 </li></ul>
4171 </li></ul>
4172
4173 !! end
4174
4175 !! test
4176 Nested lists 4 (first element empty)
4177 !! input
4178 **
4179 *bar
4180 !! result
4181 <ul><li><ul><li>
4182 </li></ul>
4183 </li><li>bar
4184 </li></ul>
4185
4186 !! end
4187
4188 !! test
4189 Nested lists 5 (both elements empty)
4190 !! input
4191 **
4192 *
4193 !! result
4194 <ul><li><ul><li>
4195 </li></ul>
4196 </li><li>
4197 </li></ul>
4198
4199 !! end
4200
4201 !! test
4202 Nested lists 6 (both elements empty)
4203 !! input
4204 *
4205 **
4206 !! result
4207 <ul><li>
4208 <ul><li>
4209 </li></ul>
4210 </li></ul>
4211
4212 !! end
4213
4214 !! test
4215 Nested lists 7 (skip initial nesting levels)
4216 !! input
4217 *** foo
4218 !! result
4219 <ul><li><ul><li><ul><li> foo
4220 </li></ul>
4221 </li></ul>
4222 </li></ul>
4223
4224 !! end
4225
4226 !! test
4227 Nested lists 8 (multiple nesting transitions)
4228 !! input
4229 * foo
4230 *** bar
4231 ** baz
4232 * boo
4233 !! result
4234 <ul><li> foo
4235 <ul><li><ul><li> bar
4236 </li></ul>
4237 </li><li> baz
4238 </li></ul>
4239 </li><li> boo
4240 </li></ul>
4241
4242 !! end
4243
4244 !! test
4245 1. Lists with start-of-line-transparent tokens before bullets: Comments
4246 !! input
4247 *foo
4248 *<!--cmt-->bar
4249 <!--cmt-->*baz
4250 !! result
4251 <ul><li>foo
4252 </li><li>bar
4253 </li><li>baz
4254 </li></ul>
4255
4256 !! end
4257
4258 !! test
4259 2. Lists with start-of-line-transparent tokens before bullets: Template close
4260 !! input
4261 *foo {{echo|bar
4262 }}*baz
4263 !! result
4264 <ul><li>foo bar
4265 </li><li>baz
4266 </li></ul>
4267
4268 !! end
4269
4270 !! test
4271 Unbalanced closing block tags break a list
4272 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4273 !! options
4274 disabled
4275 !! input
4276 <div>
4277 *a</div><div>
4278 *b</div>
4279 !! result
4280 <div>
4281 <ul><li>a
4282 </li></ul></div><div>
4283 <ul><li>b
4284 </li></ul></div>
4285 !! end
4286
4287 !! test
4288 Unbalanced closing non-block tags don't break a list
4289 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4290 !! options
4291 disabled
4292 !! input
4293 <span>
4294 *a</span><span>
4295 *b</span>
4296 !! result
4297 <p><span></span>
4298 </p>
4299 <ul><li>a<span></span>
4300 </li><li>b
4301 </li></ul>
4302 !! end
4303
4304 !! test
4305 Unclosed formatting tags that straddle lists are closed and reopened
4306 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4307 !! options
4308 disabled
4309 !! input
4310 # <s> a
4311 # b </s>
4312 !! result
4313 <ol><li> <s> a </s>
4314 </li><li> <s> b </s>
4315 </li></ol>
4316 !! end
4317
4318 !!test
4319 List embedded in a non-block tag
4320 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4321 !! options
4322 parsoid
4323 !!input
4324 <small>
4325 * foo
4326 </small>
4327 !!result
4328 <p><small></small></p>
4329 <small>
4330 <ul>
4331 <li> foo</li>
4332 </ul>
4333 </small>
4334 <p><small></small></p>
4335 !!end
4336
4337 !! test
4338 List items are not parsed correctly following a <pre> block (bug 785)
4339 !! input
4340 * <pre>foo</pre>
4341 * <pre>bar</pre>
4342 * zar
4343 !! result
4344 <ul><li> <pre>foo</pre>
4345 </li><li> <pre>bar</pre>
4346 </li><li> zar
4347 </li></ul>
4348
4349 !! end
4350
4351 !! test
4352 List items from template
4353 !! input
4354
4355 {{inner list}}
4356 * item 2
4357
4358 * item 0
4359 {{inner list}}
4360 * item 2
4361
4362 * item 0
4363 * notSOL{{inner list}}
4364 * item 2
4365 !! result
4366 <ul><li> item 1
4367 </li><li> item 2
4368 </li></ul>
4369 <ul><li> item 0
4370 </li><li> item 1
4371 </li><li> item 2
4372 </li></ul>
4373 <ul><li> item 0
4374 </li><li> notSOL
4375 </li><li> item 1
4376 </li><li> item 2
4377 </li></ul>
4378
4379 !! end
4380
4381 !! test
4382 List interrupted by empty line or heading
4383 !! input
4384 * foo
4385
4386 ** bar
4387 == A heading ==
4388 * Another list item
4389 !! result
4390 <ul><li> foo
4391 </li></ul>
4392 <ul><li><ul><li> bar
4393 </li></ul>
4394 </li></ul>
4395 <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>
4396 <ul><li> Another list item
4397 </li></ul>
4398
4399 !!end
4400
4401 !!test
4402 Multiple list tags generated by templates
4403 !!input
4404 {{echo|<li>}}a
4405 {{echo|<li>}}b
4406 {{echo|<li>}}c
4407 !!result
4408 <li>a
4409 <li>b
4410 <li>c</li>
4411 </li>
4412 </li>
4413
4414 !!end
4415
4416 ###
4417 ### Magic Words
4418 ###
4419
4420 !! test
4421 Magic Word: {{CURRENTDAY}}
4422 !! input
4423 {{CURRENTDAY}}
4424 !! result
4425 <p>1
4426 </p>
4427 !! end
4428
4429 !! test
4430 Magic Word: {{CURRENTDAY2}}
4431 !! input
4432 {{CURRENTDAY2}}
4433 !! result
4434 <p>01
4435 </p>
4436 !! end
4437
4438 !! test
4439 Magic Word: {{CURRENTDAYNAME}}
4440 !! input
4441 {{CURRENTDAYNAME}}
4442 !! result
4443 <p>Thursday
4444 </p>
4445 !! end
4446
4447 !! test
4448 Magic Word: {{CURRENTDOW}}
4449 !! input
4450 {{CURRENTDOW}}
4451 !! result
4452 <p>4
4453 </p>
4454 !! end
4455
4456 !! test
4457 Magic Word: {{CURRENTMONTH}}
4458 !! input
4459 {{CURRENTMONTH}}
4460 !! result
4461 <p>01
4462 </p>
4463 !! end
4464
4465 !! test
4466 Magic Word: {{CURRENTMONTHABBREV}}
4467 !! input
4468 {{CURRENTMONTHABBREV}}
4469 !! result
4470 <p>Jan
4471 </p>
4472 !! end
4473
4474 !! test
4475 Magic Word: {{CURRENTMONTHNAME}}
4476 !! input
4477 {{CURRENTMONTHNAME}}
4478 !! result
4479 <p>January
4480 </p>
4481 !! end
4482
4483 !! test
4484 Magic Word: {{CURRENTMONTHNAMEGEN}}
4485 !! input
4486 {{CURRENTMONTHNAMEGEN}}
4487 !! result
4488 <p>January
4489 </p>
4490 !! end
4491
4492 !! test
4493 Magic Word: {{CURRENTTIME}}
4494 !! input
4495 {{CURRENTTIME}}
4496 !! result
4497 <p>00:02
4498 </p>
4499 !! end
4500
4501 !! test
4502 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4503 !! input
4504 {{CURRENTWEEK}}
4505 !! result
4506 <p>1
4507 </p>
4508 !! end
4509
4510 !! test
4511 Magic Word: {{CURRENTYEAR}}
4512 !! input
4513 {{CURRENTYEAR}}
4514 !! result
4515 <p>1970
4516 </p>
4517 !! end
4518
4519 !! test
4520 Magic Word: {{FULLPAGENAME}}
4521 !! options
4522 title=[[User:Ævar Arnfjörð Bjarmason]]
4523 !! input
4524 {{FULLPAGENAME}}
4525 !! result
4526 <p>User:Ævar Arnfjörð Bjarmason
4527 </p>
4528 !! end
4529
4530 !! test
4531 Magic Word: {{FULLPAGENAMEE}}
4532 !! options
4533 title=[[User:Ævar Arnfjörð Bjarmason]]
4534 !! input
4535 {{FULLPAGENAMEE}}
4536 !! result
4537 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4538 </p>
4539 !! end
4540
4541 !! test
4542 Magic Word: {{NAMESPACE}}
4543 !! options
4544 title=[[User:Ævar Arnfjörð Bjarmason]]
4545 !! input
4546 {{NAMESPACE}}
4547 !! result
4548 <p>User
4549 </p>
4550 !! end
4551
4552 !! test
4553 Magic Word: {{NAMESPACEE}}
4554 !! options
4555 title=[[User:Ævar Arnfjörð Bjarmason]]
4556 !! input
4557 {{NAMESPACEE}}
4558 !! result
4559 <p>User
4560 </p>
4561 !! end
4562
4563 !! test
4564 Magic Word: {{NAMESPACENUMBER}}
4565 !! options
4566 title=[[User:Ævar Arnfjörð Bjarmason]]
4567 !! input
4568 {{NAMESPACENUMBER}}
4569 !! result
4570 <p>2
4571 </p>
4572 !! end
4573
4574 !! test
4575 Magic Word: {{NUMBEROFFILES}}
4576 !! input
4577 {{NUMBEROFFILES}}
4578 !! result
4579 <p>2
4580 </p>
4581 !! end
4582
4583 !! test
4584 Magic Word: {{PAGENAME}}
4585 !! options
4586 title=[[User:Ævar Arnfjörð Bjarmason]]
4587 !! input
4588 {{PAGENAME}}
4589 !! result
4590 <p>Ævar Arnfjörð Bjarmason
4591 </p>
4592 !! end
4593
4594 !! test
4595 Magic Word: {{PAGENAME}} with metacharacters
4596 !! options
4597 title=[['foo & bar = baz']]
4598 !! input
4599 ''{{PAGENAME}}''
4600 !! result
4601 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4602 </p>
4603 !! end
4604
4605 !! test
4606 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4607 !! options
4608 title=[[*RFC 1234 http://example.com/]]
4609 !! input
4610 {{PAGENAME}}
4611 !! result
4612 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4613 </p>
4614 !! end
4615
4616 !! test
4617 Magic Word: {{PAGENAMEE}}
4618 !! options
4619 title=[[User:Ævar Arnfjörð Bjarmason]]
4620 !! input
4621 {{PAGENAMEE}}
4622 !! result
4623 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4624 </p>
4625 !! end
4626
4627 !! test
4628 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4629 !! options
4630 title=[[*RFC 1234 http://example.com/]]
4631 !! input
4632 {{PAGENAMEE}}
4633 !! result
4634 <p>&#42;RFC_1234_http&#58;//example.com/
4635 </p>
4636 !! end
4637
4638 !! test
4639 Magic Word: {{REVISIONID}}
4640 !! input
4641 {{REVISIONID}}
4642 !! result
4643 <p>1337
4644 </p>
4645 !! end
4646
4647 !! test
4648 Magic Word: {{SCRIPTPATH}}
4649 !! input
4650 {{SCRIPTPATH}}
4651 !! result
4652 <p>/
4653 </p>
4654 !! end
4655
4656 !! test
4657 Magic Word: {{SERVER}}
4658 !! input
4659 {{SERVER}}
4660 !! result
4661 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4662 </p>
4663 !! end
4664
4665 !! test
4666 Magic Word: {{SERVERNAME}}
4667 !! input
4668 {{SERVERNAME}}
4669 !! result
4670 <p>example.org
4671 </p>
4672 !! end
4673
4674 !! test
4675 Magic Word: {{SITENAME}}
4676 !! input
4677 {{SITENAME}}
4678 !! result
4679 <p>MediaWiki
4680 </p>
4681 !! end
4682
4683 !! test
4684 Namespace 1 {{ns:1}}
4685 !! input
4686 {{ns:1}}
4687 !! result
4688 <p>Talk
4689 </p>
4690 !! end
4691
4692 !! test
4693 Namespace 1 {{ns:01}}
4694 !! input
4695 {{ns:01}}
4696 !! result
4697 <p>Talk
4698 </p>
4699 !! end
4700
4701 !! test
4702 Namespace 0 {{ns:0}} (bug 4783)
4703 !! input
4704 {{ns:0}}
4705 !! result
4706
4707 !! end
4708
4709 !! test
4710 Namespace 0 {{ns:00}} (bug 4783)
4711 !! input
4712 {{ns:00}}
4713 !! result
4714
4715 !! end
4716
4717 !! test
4718 Namespace -1 {{ns:-1}}
4719 !! input
4720 {{ns:-1}}
4721 !! result
4722 <p>Special
4723 </p>
4724 !! end
4725
4726 !! test
4727 Namespace User {{ns:User}}
4728 !! input
4729 {{ns:User}}
4730 !! result
4731 <p>User
4732 </p>
4733 !! end
4734
4735 !! test
4736 Namespace User talk {{ns:User_talk}}
4737 !! input
4738 {{ns:User_talk}}
4739 !! result
4740 <p>User talk
4741 </p>
4742 !! end
4743
4744 !! test
4745 Namespace User talk {{ns:uSeR tAlK}}
4746 !! input
4747 {{ns:uSeR tAlK}}
4748 !! result
4749 <p>User talk
4750 </p>
4751 !! end
4752
4753 !! test
4754 Namespace File {{ns:File}}
4755 !! input
4756 {{ns:File}}
4757 !! result
4758 <p>File
4759 </p>
4760 !! end
4761
4762 !! test
4763 Namespace File {{ns:Image}}
4764 !! input
4765 {{ns:Image}}
4766 !! result
4767 <p>File
4768 </p>
4769 !! end
4770
4771 !! test
4772 Namespace (lang=de) Benutzer {{ns:User}}
4773 !! options
4774 language=de
4775 !! input
4776 {{ns:User}}
4777 !! result
4778 <p>Benutzer
4779 </p>
4780 !! end
4781
4782 !! test
4783 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4784 !! options
4785 language=de
4786 !! input
4787 {{ns:3}}
4788 !! result
4789 <p>Benutzer Diskussion
4790 </p>
4791 !! end
4792
4793
4794 !! test
4795 Urlencode
4796 !! input
4797 {{urlencode:hi world?!}}
4798 {{urlencode:hi world?!|WIKI}}
4799 {{urlencode:hi world?!|PATH}}
4800 {{urlencode:hi world?!|QUERY}}
4801 !! result
4802 <p>hi+world%3F%21
4803 hi_world%3F!
4804 hi%20world%3F%21
4805 hi+world%3F%21
4806 </p>
4807 !! end
4808
4809 ###
4810 ### Magic links
4811 ###
4812 !! test
4813 Magic links: internal link to RFC (bug 479)
4814 !! input
4815 [[RFC 123]]
4816 !! result
4817 <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>
4818 </p>
4819 !! end
4820
4821 !! test
4822 Magic links: RFC (bug 479)
4823 !! input
4824 RFC 822
4825 !! result
4826 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4827 </p>
4828 !! end
4829
4830 !! test
4831 Magic links: ISBN (bug 1937)
4832 !! input
4833 ISBN 0-306-40615-2
4834 !! result
4835 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4836 </p>
4837 !! end
4838
4839 !! test
4840 Magic links: PMID incorrectly converts space to underscore
4841 !! input
4842 PMID 1234
4843 !! result
4844 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4845 </p>
4846 !! end
4847
4848 ###
4849 ### Templates
4850 ####
4851
4852 !! test
4853 Nonexistent template
4854 !! input
4855 {{thistemplatedoesnotexist}}
4856 !! result
4857 <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>
4858 </p>
4859 !! end
4860
4861 !! test
4862 Template with invalid target containing tags
4863 !! input
4864 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4865 !! result
4866 <p>{{a<b>b</b>|foo|a=b|a = b}}
4867 </p>
4868 !! end
4869
4870 !! test
4871 Template with invalid target containing unclosed tag
4872 !! input
4873 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4874 !! result
4875 <p>{{a<b>|foo|a=b|a = b}}</b>
4876 </p>
4877 !! end
4878
4879 !! article
4880 Template:test
4881 !! text
4882 This is a test template
4883 !! endarticle
4884
4885 !! test
4886 Simple template
4887 !! input
4888 {{test}}
4889 !! result
4890 <p>This is a test template
4891 </p>
4892 !! end
4893
4894 !! test
4895 Template with explicit namespace
4896 !! input
4897 {{Template:test}}
4898 !! result
4899 <p>This is a test template
4900 </p>
4901 !! end
4902
4903
4904 !! article
4905 Template:paramtest
4906 !! text
4907 This is a test template with parameter {{{param}}}
4908 !! endarticle
4909
4910 !! test
4911 Template parameter
4912 !! input
4913 {{paramtest|param=foo}}
4914 !! result
4915 <p>This is a test template with parameter foo
4916 </p>
4917 !! end
4918
4919 !! article
4920 Template:paramtestnum
4921 !! text
4922 [[{{{1}}}|{{{2}}}]]
4923 !! endarticle
4924
4925 !! test
4926 Template unnamed parameter
4927 !! input
4928 {{paramtestnum|Main Page|the main page}}
4929 !! result
4930 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4931 </p>
4932 !! end
4933
4934 !! article
4935 Template:templatesimple
4936 !! text
4937 (test)
4938 !! endarticle
4939
4940 !! article
4941 Template:templateredirect
4942 !! text
4943 #redirect [[Template:templatesimple]]
4944 !! endarticle
4945
4946 !! article
4947 Template:templateasargtestnum
4948 !! text
4949 {{{{{1}}}}}
4950 !! endarticle
4951
4952 !! article
4953 Template:templateasargtest
4954 !! text
4955 {{template{{{templ}}}}}
4956 !! endarticle
4957
4958 !! article
4959 Template:templateasargtest2
4960 !! text
4961 {{{{{templ}}}}}
4962 !! endarticle
4963
4964 !! test
4965 Template with template name as unnamed argument
4966 !! input
4967 {{templateasargtestnum|templatesimple}}
4968 !! result
4969 <p>(test)
4970 </p>
4971 !! end
4972
4973 !! test
4974 Template with template name as argument
4975 !! input
4976 {{templateasargtest|templ=simple}}
4977 !! result
4978 <p>(test)
4979 </p>
4980 !! end
4981
4982 !! test
4983 Template with template name as argument (2)
4984 !! input
4985 {{templateasargtest2|templ=templatesimple}}
4986 !! result
4987 <p>(test)
4988 </p>
4989 !! end
4990
4991 !! article
4992 Template:templateasargtestdefault
4993 !! text
4994 {{{{{templ|templatesimple}}}}}
4995 !! endarticle
4996
4997 !! article
4998 Template:templa
4999 !! text
5000 '''templ'''
5001 !! endarticle
5002
5003 !! test
5004 Template with default value
5005 !! input
5006 {{templateasargtestdefault}}
5007 !! result
5008 <p>(test)
5009 </p>
5010 !! end
5011
5012 !! test
5013 Template with default value (value set)
5014 !! input
5015 {{templateasargtestdefault|templ=templa}}
5016 !! result
5017 <p><b>templ</b>
5018 </p>
5019 !! end
5020
5021 !! test
5022 Template redirect
5023 !! input
5024 {{templateredirect}}
5025 !! result
5026 <p>(test)
5027 </p>
5028 !! end
5029
5030 !! test
5031 Template with argument in separate line
5032 !! input
5033 {{ templateasargtest |
5034 templ = simple }}
5035 !! result
5036 <p>(test)
5037 </p>
5038 !! end
5039
5040 !! test
5041 Template with complex template as argument
5042 !! input
5043 {{paramtest|
5044 param ={{ templateasargtest |
5045 templ = simple }}}}
5046 !! result
5047 <p>This is a test template with parameter (test)
5048 </p>
5049 !! end
5050
5051 !! test
5052 Template with thumb image (with link in description)
5053 !! input
5054 {{paramtest|
5055 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5056 !! result
5057 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>
5058
5059 !! end
5060
5061 !! article
5062 Template:complextemplate
5063 !! text
5064 {{{1}}} {{paramtest|
5065 param ={{{param}}}}}
5066 !! endarticle
5067
5068 !! test
5069 Template with complex arguments
5070 !! input
5071 {{complextemplate|
5072 param ={{ templateasargtest |
5073 templ = simple }}|[[Template:complextemplate|link]]}}
5074 !! result
5075 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5076 </p>
5077 !! end
5078
5079 !! test
5080 BUG 553: link with two variables in a piped link
5081 !! input
5082 {|
5083 |[[{{{1}}}|{{{2}}}]]
5084 |}
5085 !! result
5086 <table>
5087 <tr>
5088 <td>[[{{{1}}}|{{{2}}}]]
5089 </td></tr></table>
5090
5091 !! end
5092
5093 !! test
5094 Magic variable as template parameter
5095 !! input
5096 {{paramtest|param={{SITENAME}}}}
5097 !! result
5098 <p>This is a test template with parameter MediaWiki
5099 </p>
5100 !! end
5101
5102 !! article
5103 Template:linktest
5104 !! text
5105 [[{{{param}}}|link]]
5106 !! endarticle
5107
5108 !! test
5109 Template parameter as link source
5110 !! input
5111 {{linktest|param=Main Page}}
5112 !! result
5113 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5114 </p>
5115 !! end
5116
5117 !!test
5118 Template-generated attribute string (k='v')
5119 !!input
5120 <span {{attr_str|id|v1}}>bar</span>
5121 !!result
5122 <p><span id="v1">bar</span>
5123 </p>
5124 !!end
5125
5126 !!article
5127 Template:paramtest2
5128 !! text
5129 including another template, {{paramtest|param={{{arg}}}}}
5130 !! endarticle
5131
5132 !! test
5133 Template passing argument to another template
5134 !! input
5135 {{paramtest2|arg='hmm'}}
5136 !! result
5137 <p>including another template, This is a test template with parameter 'hmm'
5138 </p>
5139 !! end
5140
5141 !! article
5142 Template:Linktest2
5143 !! text
5144 Main Page
5145 !! endarticle
5146
5147 !! test
5148 Template as link source
5149 !! input
5150 [[{{linktest2}}]]
5151
5152 [[{{linktest2}}|Main Page]]
5153
5154 [[{{linktest2}}]]Page
5155 !! result
5156 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5157 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5158 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5159 </p>
5160 !! end
5161
5162
5163 !! article
5164 Template:loop1
5165 !! text
5166 {{loop2}}
5167 !! endarticle
5168
5169 !! article
5170 Template:loop2
5171 !! text
5172 {{loop1}}
5173 !! endarticle
5174
5175 !! test
5176 Template infinite loop
5177 !! input
5178 {{loop1}}
5179 !! result
5180 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5181 </p>
5182 !! end
5183
5184 !! test
5185 Template from main namespace
5186 !! input
5187 {{:Main Page}}
5188 !! result
5189 <p>blah blah
5190 </p>
5191 !! end
5192
5193 !! article
5194 Template:table
5195 !! text
5196 {|
5197 | 1 || 2
5198 |-
5199 | 3 || 4
5200 |}
5201 !! endarticle
5202
5203 !! test
5204 BUG 529: Template with table, not included at beginning of line
5205 !! input
5206 foo {{table}}
5207 !! result
5208 <p>foo
5209 </p>
5210 <table>
5211 <tr>
5212 <td> 1 </td>
5213 <td> 2
5214 </td></tr>
5215 <tr>
5216 <td> 3 </td>
5217 <td> 4
5218 </td></tr></table>
5219
5220 !! end
5221
5222 !! test
5223 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5224 !! input
5225 foo
5226 {{table}}
5227 !! result
5228 <p>foo
5229 </p>
5230 <table>
5231 <tr>
5232 <td> 1 </td>
5233 <td> 2
5234 </td></tr>
5235 <tr>
5236 <td> 3 </td>
5237 <td> 4
5238 </td></tr></table>
5239
5240 !! end
5241
5242 !! test
5243 BUG 41: Template parameters shown as broken links
5244 !! input
5245 {{{parameter}}}
5246 !! result
5247 <p>{{{parameter}}}
5248 </p>
5249 !! end
5250
5251 !! test
5252 Template with targets containing wikilinks
5253 !! input
5254 {{[[foo]]}}
5255
5256 {{[[{{echo|foo}}]]}}
5257
5258 {{{{echo|[[foo}}]]}}
5259 !! result
5260 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5261 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5262 </p><p>{{[[foo}}]]
5263 </p>
5264 !! end
5265
5266 !! article
5267 Template:MSGNW test
5268 !! text
5269 ''None'' of '''this''' should be
5270 * interpreted
5271 but rather passed unmodified
5272 {{test}}
5273 !! endarticle
5274
5275 # hmm, fix this or just deprecate msgnw and document its behavior?
5276 !! test
5277 msgnw keyword
5278 !! options
5279 disabled
5280 !! input
5281 {{msgnw:MSGNW test}}
5282 !! result
5283 <p>''None'' of '''this''' should be
5284 * interpreted
5285 but rather passed unmodified
5286 {{test}}
5287 </p>
5288 !! end
5289
5290 !! test
5291 int keyword
5292 !! input
5293 {{int:youhavenewmessages|lots of money|not!}}
5294 !! result
5295 <p>You have lots of money (not!).
5296 </p>
5297 !! end
5298
5299 !! article
5300 Template:Includes
5301 !! text
5302 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5303 !! endarticle
5304
5305 !! test
5306 <includeonly> and <noinclude> being included
5307 !! input
5308 {{Includes}}
5309 !! result
5310 <p>Foobar
5311 </p>
5312 !! end
5313
5314 !! article
5315 Template:Includes2
5316 !! text
5317 <onlyinclude>Foo</onlyinclude>bar
5318 !! endarticle
5319
5320 !! test
5321 <onlyinclude> being included
5322 !! input
5323 {{Includes2}}
5324 !! result
5325 <p>Foo
5326 </p>
5327 !! end
5328
5329
5330 !! article
5331 Template:Includes3
5332 !! text
5333 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5334 !! endarticle
5335
5336 !! test
5337 <onlyinclude> and <includeonly> being included
5338 !! input
5339 {{Includes3}}
5340 !! result
5341 <p>Foo
5342 </p>
5343 !! end
5344
5345 !! test
5346 <includeonly> and <noinclude> on a page
5347 !! input
5348 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5349 !! result
5350 <p>Foozar
5351 </p>
5352 !! end
5353
5354 !! test
5355 Un-closed <noinclude>
5356 !! input
5357 <noinclude>
5358 !! result
5359 !! end
5360
5361 !! test
5362 <onlyinclude> on a page
5363 !! input
5364 <onlyinclude>Foo</onlyinclude>bar
5365 !! result
5366 <p>Foobar
5367 </p>
5368 !! end
5369
5370 !! test
5371 Un-closed <onlyinclude>
5372 !! input
5373 <onlyinclude>
5374 !! result
5375 !! end
5376
5377 !!test
5378 Self-closed noinclude, includeonly, onlyinclude tags
5379 !!input
5380 <noinclude />
5381 <includeonly />
5382 <onlyinclude />
5383 !!result
5384 <p><br />
5385 </p>
5386 !!end
5387
5388 !!test
5389 Unbalanced includeonly and noinclude tags
5390 !!input
5391 {|
5392 |a</noinclude>
5393 |b</noinclude></noinclude>
5394 |c</noinclude></includeonly>
5395 |d</includeonly></includeonly>
5396 |}
5397 !!result
5398 <table>
5399 <tr>
5400 <td>a
5401 </td>
5402 <td>b
5403 </td>
5404 <td>c&lt;/includeonly&gt;
5405 </td>
5406 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5407 </td></tr></table>
5408
5409 !!end
5410
5411 !! article
5412 Template:Includeonly section
5413 !! text
5414 <includeonly>
5415 ==Includeonly section==
5416 </includeonly>
5417 ==Section T-1==
5418 !!endarticle
5419
5420 !! test
5421 Bug 6563: Edit link generation for section shown by <includeonly>
5422 !! input
5423 {{includeonly section}}
5424 !! result
5425 <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>
5426 <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>
5427
5428 !! end
5429
5430 # Uses same input as the contents of [[Template:Includeonly section]]
5431 !! test
5432 Bug 6563: Section extraction for section shown by <includeonly>
5433 !! options
5434 section=T-2
5435 !! input
5436 <includeonly>
5437 ==Includeonly section==
5438 </includeonly>
5439 ==Section T-2==
5440 !! result
5441 ==Section T-2==
5442 !! end
5443
5444 !! test
5445 Bug 6563: Edit link generation for section suppressed by <includeonly>
5446 !! input
5447 <includeonly>
5448 ==Includeonly section==
5449 </includeonly>
5450 ==Section 1==
5451 !! result
5452 <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>
5453
5454 !! end
5455
5456 !! test
5457 Bug 6563: Section extraction for section suppressed by <includeonly>
5458 !! options
5459 section=1
5460 !! input
5461 <includeonly>
5462 ==Includeonly section==
5463 </includeonly>
5464 ==Section 1==
5465 !! result
5466 ==Section 1==
5467 !! end
5468
5469 !! test
5470 Un-closed <includeonly>
5471 !! input
5472 <includeonly>
5473 !! result
5474 !! end
5475
5476 ###
5477 ### <includeonly> and <noinclude> in attributes
5478 ###
5479 !!test
5480 0. includeonly around the entire attribute
5481 !!input
5482 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5483 !!result
5484 <p><span id="v2">bar</span>
5485 </p>
5486 !!end
5487
5488 !!test
5489 1. includeonly in html attr key
5490 !!input
5491 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5492 !!result
5493 <p><span id="foo">bar</span>
5494 </p>
5495 !!end
5496
5497 !!test
5498 2. includeonly in html attr value
5499 !!input
5500 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5501 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5502 !!result
5503 <p><span id="v1">bar</span>
5504 <span id="v1">bar</span>
5505 </p>
5506 !!end
5507
5508 !!test
5509 3. includeonly in part of an attr value
5510 !!input
5511 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5512 !!result
5513 <p><span style="color:red;">bar</span>
5514 </p>
5515 !!end
5516
5517 ###
5518 ### Testing parsing of templates where a template arg
5519 ### has the same name as the template itself.
5520 ###
5521
5522 !! article
5523 Template:quote
5524 !! text
5525 {{{quote|{{{1}}}}}}
5526 !! endarticle
5527
5528 !!test
5529 Templates: Template Name/Arg clash: 1. Use of positional param
5530 !!input
5531 {{quote|foo}}
5532 !!result
5533 <p>foo
5534 </p>
5535 !!end
5536
5537 !!test
5538 Templates: Template Name/Arg clash: 2. Use of named param
5539 !!input
5540 {{quote|quote=foo}}
5541 !!result
5542 <p>foo
5543 </p>
5544 !!end
5545
5546 !!test
5547 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5548 !!input
5549 {{quote|quote}}
5550 !!result
5551 <p>quote
5552 </p>
5553 !!end
5554
5555 ###
5556 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5557 ###
5558
5559 !!test
5560 Templates: 1. Simple use
5561 !!input
5562 {{echo|Foo}}
5563 !!result
5564 <p>Foo
5565 </p>
5566 !!end
5567
5568 !!test
5569 Templates: 2. Inside a block tag
5570 !!input
5571 <div>{{echo|Foo}}</div>
5572 !!result
5573 <div>Foo</div>
5574
5575 !!end
5576
5577 !!test
5578 Templates: P-wrapping: 1a. Templates on consecutive lines
5579 !!input
5580 {{echo|Foo}}
5581 {{echo|bar}}
5582 !!result
5583 <p>Foo
5584 bar
5585 </p>
5586 !!end
5587
5588 !!test
5589 Templates: P-wrapping: 1b. Templates on consecutive lines
5590 !!input
5591 Foo
5592
5593 {{echo|bar}}
5594 {{echo|baz}}
5595 !!result
5596 <p>Foo
5597 </p><p>bar
5598 baz
5599 </p>
5600 !!end
5601
5602 !!test
5603 Templates: P-wrapping: 1c. Templates on consecutive lines
5604 !!input
5605 {{echo|Foo}}
5606 {{echo|bar}} <div>baz</div>
5607 !!result
5608 <p>Foo
5609 </p>
5610 bar <div>baz</div>
5611
5612 !!end
5613
5614 !!test
5615 Templates: Inline Text: 1. Multiple tmeplate uses
5616 !!input
5617 {{echo|Foo}}bar{{echo|baz}}
5618 !!result
5619 <p>Foobarbaz
5620 </p>
5621 !!end
5622
5623 !!test
5624 Templates: Inline Text: 2. Back-to-back template uses
5625 !!input
5626 {{echo|Foo}}{{echo|bar}}
5627 !!result
5628 <p>Foobar
5629 </p>
5630 !!end
5631
5632 !!test
5633 Templates: Block Tags: 1. Multiple template uses
5634 !!input
5635 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5636 !!result
5637 <div>Foo</div><div>bar</div><div>baz</div>
5638
5639 !!end
5640
5641 !!test
5642 Templates: Block Tags: 2. Back-to-back template uses
5643 !!input
5644 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5645 !!result
5646 <div>Foo</div><div>bar</div>
5647
5648 !!end
5649
5650 !!test
5651 Templates: Links: 1. Simple example
5652 !!input
5653 {{echo|[[Foo|bar]]}}
5654 !!result
5655 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5656 </p>
5657 !!end
5658
5659 !!test
5660 Templates: Links: 2. Generation of link href
5661 !!input
5662 [[{{echo|Foo}}|bar]]
5663 !!result
5664 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5665 </p>
5666 !!end
5667
5668 !!test
5669 Templates: Links: 3. Generation of part of a link href
5670 !!input
5671 [[Fo{{echo|o}}|bar]]
5672
5673 [[Foo{{echo|bar}}]]
5674
5675 [[Foo{{echo|bar}}baz]]
5676
5677 [[Foo{{echo|bar}}|bar]]
5678
5679 [[:Foo{{echo|bar}}]]
5680
5681 [[:Foo{{echo|bar}}|bar]]
5682 !!result
5683 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5684 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5685 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5686 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5687 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5688 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5689 </p>
5690 !!end
5691
5692 !!test
5693 Templates: Links: 4. Multiple templates generating link href
5694 !!input
5695 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5696 !!result
5697 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5698 </p>
5699 !!end
5700
5701 !!test
5702 Templates: Links: 5. Generation of link text
5703 !!input
5704 [[Foo|{{echo|bar}}]]
5705 !!result
5706 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5707 </p>
5708 !!end
5709
5710 !!test
5711 Templates: Links: 5. Nested templates (only outermost template should be marked)
5712 !!input
5713 {{echo|[[{{echo|Foo}}|bar]]}}
5714 !!result
5715 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5716 </p>
5717 !!end
5718
5719 !!test
5720 Templates: HTML Tag: 1. Generation of HTML attr. key
5721 !!input
5722 <div {{echo|style}}="color:red;">foo</div>
5723 !!result
5724 <div style="color:red;">foo</div>
5725
5726 !!end
5727
5728 !!test
5729 Templates: HTML Tag: 2. Generation of HTML attr. value
5730 !!input
5731 <div style={{echo|'color:red;'}}>foo</div>
5732 !!result
5733 <div style="color:red;">foo</div>
5734
5735 !!end
5736
5737 !!test
5738 Templates: HTML Tag: 3. Generation of HTML attr key and value
5739 !!input
5740 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5741 !!result
5742 <div style="color:red;">foo</div>
5743
5744 !!end
5745
5746 !!test
5747 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5748 !!input
5749 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5750 !!result
5751 <div title="This is a long title with just one piece templated">foo</div>
5752
5753 !!end
5754
5755 !!test
5756 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5757 !!input
5758 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5759 !!result
5760 <div title="This is a long title with just one piece templated">foo</div>
5761
5762 !!end
5763
5764 !!test
5765 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5766 !!input
5767 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
5768 !!result
5769 <div title="This is a long title with just one piece templated">foo</div>
5770
5771 !!end
5772
5773 !!test
5774 Templates: HTML Tables: 1. Generating start of a HTML table
5775 !!input
5776 {{echo|<table><tr><td>foo</td>}}</tr></table>
5777 !!result
5778 <table><tr><td>foo</td></tr></table>
5779
5780 !!end
5781
5782 !!test
5783 Templates: HTML Tables: 2a. Generating middle of a HTML table
5784 !!input
5785 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5786 !!result
5787 <table><tr><td>foo</td></tr></table>
5788
5789 !!end
5790
5791 !!test
5792 Templates: HTML Tables: 2b. Generating middle of a HTML table
5793 !!input
5794 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5795 !!result
5796 <table><tr><td>foo</td></tr></table>
5797
5798 !!end
5799
5800 !!test
5801 Templates: HTML Tables: 3. Generating end of a HTML table
5802 !!input
5803 <table><tr>{{echo|<td>foo</td></tr></table>}}
5804 !!result
5805 <table><tr><td>foo</td></tr></table>
5806
5807 !!end
5808
5809 !!test
5810 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5811 !!input
5812 {{echo|<table>}}<tr><td>foo</td></tr></table>
5813 !!result
5814 <table><tr><td>foo</td></tr></table>
5815
5816 !!end
5817
5818 !!test
5819 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5820 !!input
5821 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5822 !!result
5823 <table><tr><td>foo</td></tr></table>
5824
5825 !!end
5826
5827 !!test
5828 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5829 !!input
5830 <table><tr>{{echo|<td>}}foo</td></tr></table>
5831 !!result
5832 <table><tr><td>foo</td></tr></table>
5833
5834 !!end
5835
5836 !!test
5837 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5838 !!input
5839 <table><tr><td>foo{{echo|</td>}}</tr></table>
5840 !!result
5841 <table><tr><td>foo</td></tr></table>
5842
5843 !!end
5844
5845 !!test
5846 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5847 !!input
5848 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5849 !!result
5850 <table><tr><td>foo</td></tr></table>
5851
5852 !!end
5853
5854 !!test
5855 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5856 !!input
5857 <table><tr><td>foo</td></tr>{{echo|</table>}}
5858 !!result
5859 <table><tr><td>foo</td></tr></table>
5860
5861 !!end
5862
5863 !!test
5864 Templates: Wiki Tables: 1a. Fostering of entire template content
5865 !!input
5866 {|
5867 {{echo|a}}
5868 |}
5869 !!result
5870 <table>
5871 a
5872 <tr><td></td></tr></table>
5873
5874 !!end
5875
5876 !!test
5877 Templates: Wiki Tables: 1b. Fostering of entire template content
5878 !!input
5879 {|
5880 {{echo|<div>}}
5881 foo
5882 {{echo|</div>}}
5883 |}
5884 !!result
5885 <table>
5886 <div>
5887 <p>foo
5888 </p>
5889 </div>
5890 <tr><td></td></tr></table>
5891
5892 !!end
5893
5894 !!test
5895 Templates: Wiki Tables: 2. Fostering of partial template content
5896 !!input
5897 {|
5898 {{echo|a
5899 <div>b</div>}}
5900 |}
5901 !!result
5902 <table>
5903 a
5904 <div>b</div>
5905 <tr><td></td></tr></table>
5906
5907 !!end
5908
5909 !!test
5910 Templates: Wiki Tables: 3. td-content via multiple templates
5911 !!input
5912 {|
5913 {{echo|{{pipe}}a}}{{echo|b}}
5914 |}
5915 !!result
5916 <table>
5917 <tr>
5918 <td>ab
5919 </td></tr></table>
5920
5921 !!end
5922
5923 !!test
5924 Templates: Wiki Tables: 4. Templated tags, no content
5925 !!input
5926 {{tbl-start}}
5927 {{tbl-end}}
5928 !!result
5929 <table>
5930 <tr><td></td></tr></table>
5931
5932 !!end
5933
5934 !!test
5935 Templates: Wiki Tables: 5. Templated tags, regular td-tags
5936 !!input
5937 {{tbl-start}}
5938 |foo
5939 {{tbl-end}}
5940 !!result
5941 <table>
5942 <tr>
5943 <td>foo
5944 </td></tr></table>
5945
5946 !!end
5947
5948 !!test
5949 Templates: Wiki Tables: 6. Templated tags, templated td-tags
5950 !!input
5951 {{tbl-start}}
5952 {{!}}foo
5953 {{tbl-end}}
5954 !!result
5955 <table>
5956 <tr>
5957 <td>foo
5958 </td></tr></table>
5959
5960 !!end
5961
5962 !!test
5963 Templates: Lists: Multi-line list-items via templates
5964 !!input
5965 *{{echo|a {{nonexistent|
5966 unused}}}}
5967 *{{echo|b {{nonexistent|
5968 unused}}}}
5969 !!result
5970 <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>
5971 </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>
5972 </li></ul>
5973
5974 !!end
5975
5976 !!test
5977 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5978 !!input
5979 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5980 !!result
5981 <p><i>ab</i>c<i>d</i>e
5982 </p>
5983 !!end
5984
5985 !!test
5986 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5987 (PHP parser generates misnested html)
5988 !! options
5989 disabled
5990 !!input
5991 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5992 !!result
5993 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5994 !!end
5995
5996 !!test
5997 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5998 (PHP parser generates misnested html)
5999 !! options
6000 disabled
6001 !!input
6002 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6003 !!result
6004 <div><i>a</i></div>
6005 <div><i>b</i>c<i>d</i></div>
6006 <div>e</div>
6007 !!end
6008
6009 !!test
6010 Templates: Ugly nesting: 4. Divs opened/closed across templates
6011 !!input
6012 a<div>b{{echo|c</div>d}}e
6013 !!result
6014 a<div>bc</div>de
6015
6016 !!end
6017
6018 !!test
6019 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6020 (Parsoid-centric)
6021 !! options
6022 parsoid
6023 !!input
6024 {|
6025 |{{echo|foo</table>}}
6026 |bar
6027 |}
6028 !!result
6029 <table about="#mwt1" typeof="mw:Object/Template ">
6030 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6031 bar</span><span about="#mwt1">
6032 </span>
6033 !!end
6034
6035 !!test
6036 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6037 (Parsoid-centric)
6038 !! options
6039 parsoid
6040 !!input
6041 <table>
6042 <tr>
6043 <td>
6044 <table>
6045 <tr>
6046 <td>1. {{echo|foo </table>}}</td>
6047 <td> bar </td>
6048 <td>2. {{echo|baz </table>}}</td>
6049 </tr>
6050 <tr>
6051 <td>abc</td>
6052 </tr>
6053 </table>
6054 </td>
6055 </tr>
6056 <tr>
6057 <td>xyz</td>
6058 </tr>
6059 </table>
6060 !!result
6061 <table about="#mwt1" typeof="mw:Object/Template">
6062 <tbody><tr >
6063 <td >
6064 <table >
6065 <tbody><tr >
6066 <td >1. foo </td></tr></tbody></table></td>
6067 <td > bar </td>
6068 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6069 </span><span about="#mwt1">
6070
6071 abc</span><span about="#mwt1">
6072 </span><span about="#mwt1">
6073 </span><span about="#mwt1">
6074 </span><span about="#mwt1">
6075 </span><span about="#mwt1">
6076
6077 xyz</span><span about="#mwt1">
6078 </span><span about="#mwt1">
6079 </span>
6080 !!end
6081
6082 !! test
6083 Templates: Ugly templates: 3. newline-only template parameter
6084 !! input
6085 foo {{echo|
6086 }}
6087 !! result
6088 <p>foo
6089 </p>
6090 !! end
6091
6092 # This looks like a bug: a single newline triggers p/br for some reason.
6093 !! test
6094 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6095 !! input
6096 {{echo|
6097 }}
6098 !! result
6099 <p><br />
6100 </p>
6101 !! end
6102
6103
6104 !!test
6105 Parser Functions: 1. Simple example
6106 !!input
6107 {{uc:foo}}
6108 !!result
6109 <p>FOO
6110 </p>
6111 !!end
6112
6113 !!test
6114 Parser Functions: 2. Nested use (only outermost should be marked up)
6115 !!input
6116 {{uc:{{lc:FOO}}}}
6117 !!result
6118 <p>FOO
6119 </p>
6120 !!end
6121
6122 ###
6123 ### Pre-save transform tests
6124 ###
6125 !! test
6126 pre-save transform: subst:
6127 !! options
6128 PST
6129 !! input
6130 {{subst:test}}
6131 !! result
6132 This is a test template
6133 !! end
6134
6135 !! test
6136 pre-save transform: normal template
6137 !! options
6138 PST
6139 !! input
6140 {{test}}
6141 !! result
6142 {{test}}
6143 !! end
6144
6145 !! test
6146 pre-save transform: nonexistent template
6147 !! options
6148 PST
6149 !! input
6150 {{thistemplatedoesnotexist}}
6151 !! result
6152 {{thistemplatedoesnotexist}}
6153 !! end
6154
6155
6156 !! test
6157 pre-save transform: subst magic variables
6158 !! options
6159 PST
6160 !! input
6161 {{subst:SITENAME}}
6162 !! result
6163 MediaWiki
6164 !! end
6165
6166 # This is bug 89, which I fixed. -- wtm
6167 !! test
6168 pre-save transform: subst: templates with parameters
6169 !! options
6170 pst
6171 !! input
6172 {{subst:paramtest|param="something else"}}
6173 !! result
6174 This is a test template with parameter "something else"
6175 !! end
6176
6177 !! article
6178 Template:nowikitest
6179 !! text
6180 <nowiki>'''not wiki'''</nowiki>
6181 !! endarticle
6182
6183 !! test
6184 pre-save transform: nowiki in subst (bug 1188)
6185 !! options
6186 pst
6187 !! input
6188 {{subst:nowikitest}}
6189 !! result
6190 <nowiki>'''not wiki'''</nowiki>
6191 !! end
6192
6193
6194 !! article
6195 Template:commenttest
6196 !! text
6197 This template has <!-- a comment --> in it.
6198 !! endarticle
6199
6200 !! test
6201 pre-save transform: comment in subst (bug 1936)
6202 !! options
6203 pst
6204 !! input
6205 {{subst:commenttest}}
6206 !! result
6207 This template has <!-- a comment --> in it.
6208 !! end
6209
6210 !! test
6211 pre-save transform: unclosed tag
6212 !! options
6213 pst noxml
6214 !! input
6215 <nowiki>'''not wiki'''
6216 !! result
6217 <nowiki>'''not wiki'''
6218 !! end
6219
6220 !! test
6221 pre-save transform: mixed tag case
6222 !! options
6223 pst noxml
6224 !! input
6225 <NOwiki>'''not wiki'''</noWIKI>
6226 !! result
6227 <NOwiki>'''not wiki'''</noWIKI>
6228 !! end
6229
6230 !! test
6231 pre-save transform: unclosed comment in <nowiki>
6232 !! options
6233 pst noxml
6234 !! input
6235 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6236 !! result
6237 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6238 !!end
6239
6240 !! article
6241 Template:dangerous
6242 !!text
6243 <span onmouseover="alert('crap')">Oh no</span>
6244 !!endarticle
6245
6246 !!test
6247 (confirming safety of fix for subst bug 1936)
6248 !! input
6249 {{Template:dangerous}}
6250 !! result
6251 <p><span>Oh no</span>
6252 </p>
6253 !! end
6254
6255 !! test
6256 pre-save transform: comment containing gallery (bug 5024)
6257 !! options
6258 pst
6259 !! input
6260 <!-- <gallery>data</gallery> -->
6261 !!result
6262 <!-- <gallery>data</gallery> -->
6263 !!end
6264
6265 !! test
6266 pre-save transform: comment containing extension
6267 !! options
6268 pst
6269 !! input
6270 <!-- <tag>data</tag> -->
6271 !!result
6272 <!-- <tag>data</tag> -->
6273 !!end
6274
6275 !! test
6276 pre-save transform: comment containing nowiki
6277 !! options
6278 pst
6279 !! input
6280 <!-- <nowiki>data</nowiki> -->
6281 !!result
6282 <!-- <nowiki>data</nowiki> -->
6283 !!end
6284
6285 !! test
6286 pre-save transform: <noinclude> in subst (bug 3298)
6287 !! options
6288 pst
6289 !! input
6290 {{subst:Includes}}
6291 !! result
6292 Foobar
6293 !! end
6294
6295 !! test
6296 pre-save transform: <onlyinclude> in subst (bug 3298)
6297 !! options
6298 pst
6299 !! input
6300 {{subst:Includes2}}
6301 !! result
6302 Foo
6303 !! end
6304
6305 !! article
6306 Template:SubstTest
6307 !!text
6308 {{<includeonly>subst:</includeonly>Includes}}
6309 !! endarticle
6310
6311 !! article
6312 Template:SafeSubstTest
6313 !! text
6314 {{<includeonly>safesubst:</includeonly>Includes}}
6315 !! endarticle
6316
6317 !! test
6318 bug 22297: safesubst: works during PST
6319 !! options
6320 pst
6321 !! input
6322 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6323 !! result
6324 FoobarFoobar
6325 !! end
6326
6327 !! test
6328 bug 22297: safesubst: works during normal parse
6329 !! input
6330 {{SafeSubstTest}}
6331 !! result
6332 <p>Foobar
6333 </p>
6334 !! end
6335
6336 !! test:
6337 subst: does not work during normal parse
6338 !! input
6339 {{SubstTest}}
6340 !! result
6341 <p>{{subst:Includes}}
6342 </p>
6343 !! end
6344
6345 !! test
6346 pre-save transform: context links ("pipe trick")
6347 !! options
6348 pst
6349 !! input
6350 [[Article (context)|]]
6351 [[Bar:Article|]]
6352 [[:Bar:Article|]]
6353 [[Bar:Article (context)|]]
6354 [[:Bar:Article (context)|]]
6355 [[|Article]]
6356 [[|Article (context)]]
6357 [[Bar:X (Y) Z|]]
6358 [[:Bar:X (Y) Z|]]
6359 !! result
6360 [[Article (context)|Article]]
6361 [[Bar:Article|Article]]
6362 [[:Bar:Article|Article]]
6363 [[Bar:Article (context)|Article]]
6364 [[:Bar:Article (context)|Article]]
6365 [[Article]]
6366 [[Article (context)]]
6367 [[Bar:X (Y) Z|X (Y) Z]]
6368 [[:Bar:X (Y) Z|X (Y) Z]]
6369 !! end
6370
6371 !! test
6372 pre-save transform: context links ("pipe trick") with interwiki prefix
6373 !! options
6374 pst
6375 !! input
6376 [[interwiki:Article|]]
6377 [[:interwiki:Article|]]
6378 [[interwiki:Bar:Article|]]
6379 [[:interwiki:Bar:Article|]]
6380 !! result
6381 [[interwiki:Article|Article]]
6382 [[:interwiki:Article|Article]]
6383 [[interwiki:Bar:Article|Bar:Article]]
6384 [[:interwiki:Bar:Article|Bar:Article]]
6385 !! end
6386
6387 !! test
6388 pre-save transform: context links ("pipe trick") with parens in title
6389 !! options
6390 pst title=[[Somearticle (context)]]
6391 !! input
6392 [[|Article]]
6393 !! result
6394 [[Article (context)|Article]]
6395 !! end
6396
6397 !! test
6398 pre-save transform: context links ("pipe trick") with comma in title
6399 !! options
6400 pst title=[[Someplace, Somewhere]]
6401 !! input
6402 [[|Otherplace]]
6403 [[Otherplace, Elsewhere|]]
6404 [[Otherplace, Elsewhere, Anywhere|]]
6405 !! result
6406 [[Otherplace, Somewhere|Otherplace]]
6407 [[Otherplace, Elsewhere|Otherplace]]
6408 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6409 !! end
6410
6411 !! test
6412 pre-save transform: context links ("pipe trick") with parens and comma
6413 !! options
6414 pst title=[[Someplace (IGNORED), Somewhere]]
6415 !! input
6416 [[|Otherplace]]
6417 [[Otherplace (place), Elsewhere|]]
6418 !! result
6419 [[Otherplace, Somewhere|Otherplace]]
6420 [[Otherplace (place), Elsewhere|Otherplace]]
6421 !! end
6422
6423 !! test
6424 pre-save transform: context links ("pipe trick") with comma and parens
6425 !! options
6426 pst title=[[Who, me? (context)]]
6427 !! input
6428 [[|Yes, you.]]
6429 [[Me, Myself, and I (1937 song)|]]
6430 !! result
6431 [[Yes, you. (context)|Yes, you.]]
6432 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6433 !! end
6434
6435 !! test
6436 pre-save transform: context links ("pipe trick") with namespace
6437 !! options
6438 pst title=[[Ns:Somearticle]]
6439 !! input
6440 [[|Article]]
6441 !! result
6442 [[Ns:Article|Article]]
6443 !! end
6444
6445 !! test
6446 pre-save transform: context links ("pipe trick") with namespace and parens
6447 !! options
6448 pst title=[[Ns:Somearticle (context)]]
6449 !! input
6450 [[|Article]]
6451 !! result
6452 [[Ns:Article (context)|Article]]
6453 !! end
6454
6455 !! test
6456 pre-save transform: context links ("pipe trick") with namespace and comma
6457 !! options
6458 pst title=[[Ns:Somearticle, Context, Whatever]]
6459 !! input
6460 [[|Article]]
6461 !! result
6462 [[Ns:Article, Context, Whatever|Article]]
6463 !! end
6464
6465 !! test
6466 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6467 !! options
6468 pst title=[[Ns:Somearticle, Context (context)]]
6469 !! input
6470 [[|Article]]
6471 !! result
6472 [[Ns:Article (context)|Article]]
6473 !! end
6474
6475 !! test
6476 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6477 !! options
6478 pst title=[[Ns:Somearticle (IGNORED), Context]]
6479 !! input
6480 [[|Article]]
6481 !! result
6482 [[Ns:Article, Context|Article]]
6483 !! end
6484
6485 !! test
6486 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6487 !! options
6488 pst
6489 !! input
6490 [[Article(context)|]]
6491 [[Bar:Article(context)|]]
6492 [[:Bar:Article(context)|]]
6493 [[|Article(context)]]
6494 [[Bar:X(Y)Z|]]
6495 [[:Bar:X(Y)Z|]]
6496 !! result
6497 [[Article(context)|Article]]
6498 [[Bar:Article(context)|Article]]
6499 [[:Bar:Article(context)|Article]]
6500 [[Article(context)]]
6501 [[Bar:X(Y)Z|X(Y)Z]]
6502 [[:Bar:X(Y)Z|X(Y)Z]]
6503 !! end
6504
6505 !! test
6506 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6507 !! options
6508 pst
6509 !! input
6510 [[Article (context)|]]
6511 [[Bar:Article (context)|]]
6512 [[:Bar:Article (context)|]]
6513 [[|Article (context)]]
6514 [[Bar:X (Y) Z|]]
6515 [[:Bar:X (Y) Z|]]
6516 !! result
6517 [[Article (context)|Article]]
6518 [[Bar:Article (context)|Article]]
6519 [[:Bar:Article (context)|Article]]
6520 [[Article (context)]]
6521 [[Bar:X (Y) Z|X (Y) Z]]
6522 [[:Bar:X (Y) Z|X (Y) Z]]
6523 !! end
6524
6525 !! test
6526 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6527 !! options
6528 pst
6529 !! input
6530 [[Article(context)|]]
6531 [[Bar:Article(context)|]]
6532 [[:Bar:Article(context)|]]
6533 [[|Article(context)]]
6534 [[Bar:X(Y)Z|]]
6535 [[:Bar:X(Y)Z|]]
6536 !! result
6537 [[Article(context)|Article]]
6538 [[Bar:Article(context)|Article]]
6539 [[:Bar:Article(context)|Article]]
6540 [[Article(context)]]
6541 [[Bar:X(Y)Z|X(Y)Z]]
6542 [[:Bar:X(Y)Z|X(Y)Z]]
6543 !! end
6544
6545 !! test
6546 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6547 !! options
6548 pst
6549 !! input
6550 [[Article (context), context|]]
6551 [[Article (context),context|]]
6552 [[Bar:Article (context), context|]]
6553 [[Bar:Article (context),context|]]
6554 [[:Bar:Article (context), context|]]
6555 [[:Bar:Article (context),context|]]
6556 !! result
6557 [[Article (context), context|Article]]
6558 [[Article (context),context|Article]]
6559 [[Bar:Article (context), context|Article]]
6560 [[Bar:Article (context),context|Article]]
6561 [[:Bar:Article (context), context|Article]]
6562 [[:Bar:Article (context),context|Article]]
6563 !! end
6564
6565 !! test
6566 pre-save transform: trim trailing empty lines
6567 !! options
6568 pst
6569 !! input
6570 Empty lines are trimmed
6571
6572
6573
6574
6575 !! result
6576 Empty lines are trimmed
6577 !! end
6578
6579 !! test
6580 pre-save transform: Signature expansion
6581 !! options
6582 pst
6583 !! input
6584 * ~~~
6585 * <noinclude>~~~</noinclude>
6586 * <includeonly>~~~</includeonly>
6587 * <onlyinclude>~~~</onlyinclude>
6588 !! result
6589 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6590 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6591 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6592 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6593 !! end
6594
6595
6596 !! test
6597 pre-save transform: Signature expansion in nowiki tags (bug 93)
6598 !! options
6599 pst disabled
6600 !! input
6601 Shall not expand:
6602
6603 <nowiki>~~~~</nowiki>
6604
6605 <includeonly><nowiki>~~~~</nowiki></includeonly>
6606
6607 <noinclude><nowiki>~~~~</nowiki></noinclude>
6608
6609 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6610
6611 {{subst:Foo}} shall be converted to FOO
6612
6613 As well as inside noinclude/onlyinclude
6614 <noinclude>{{subst:Foo}}</noinclude>
6615 <onlyinclude>{{subst:Foo}}</onlyinclude>
6616
6617 But not inside includeonly
6618 <includeonly>{{subst:Foo}}</includeonly>
6619 !! result
6620 Shall not expand:
6621
6622 <nowiki>~~~~</nowiki>
6623
6624 <includeonly><nowiki>~~~~</nowiki></includeonly>
6625
6626 <noinclude><nowiki>~~~~</nowiki></noinclude>
6627
6628 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6629
6630 FOO shall be converted to FOO
6631
6632 As well as inside noinclude/onlyinclude
6633 <noinclude>FOO</noinclude>
6634 <onlyinclude>FOO</onlyinclude>
6635
6636 But not inside includeonly
6637 <includeonly>{{subst:Foo}}</includeonly>
6638 !! end
6639
6640 ###
6641 ### Message transform tests
6642 ###
6643 !! test
6644 message transform: magic variables
6645 !! options
6646 msg
6647 !! input
6648 {{SITENAME}}
6649 !! result
6650 MediaWiki
6651 !! end
6652
6653 !! test
6654 message transform: should not transform wiki markup
6655 !! options
6656 msg
6657 !! input
6658 ''test''
6659 !! result
6660 ''test''
6661 !! end
6662
6663 !! test
6664 message transform: <noinclude> in transcluded template (bug 4926)
6665 !! options
6666 msg
6667 !! input
6668 {{Includes}}
6669 !! result
6670 Foobar
6671 !! end
6672
6673 !! test
6674 message transform: <onlyinclude> in transcluded template (bug 4926)
6675 !! options
6676 msg
6677 !! input
6678 {{Includes2}}
6679 !! result
6680 Foo
6681 !! end
6682
6683 !! test
6684 {{#special:}} page name, known
6685 !! options
6686 msg
6687 !! input
6688 {{#special:Recentchanges}}
6689 !! result
6690 Special:RecentChanges
6691 !! end
6692
6693 !! test
6694 {{#special:}} page name with subpage, known
6695 !! options
6696 msg
6697 !! input
6698 {{#special:Recentchanges/param}}
6699 !! result
6700 Special:RecentChanges/param
6701 !! end
6702
6703 !! test
6704 {{#special:}} page name, unknown
6705 !! options
6706 msg
6707 !! input
6708 {{#special:foobarnonexistent}}
6709 !! result
6710 No such special page
6711 !! end
6712
6713 !! test
6714 {{#speciale:}} page name, known
6715 !! options
6716 msg
6717 !! input
6718 {{#speciale:Recentchanges}}
6719 !! result
6720 Special:RecentChanges
6721 !! end
6722
6723 !! test
6724 {{#speciale:}} page name with subpage, known
6725 !! options
6726 msg
6727 !! input
6728 {{#speciale:Recentchanges/param}}
6729 !! result
6730 Special:RecentChanges/param
6731 !! end
6732
6733 !! test
6734 {{#speciale:}} page name, unknown
6735 !! options
6736 msg
6737 !! input
6738 {{#speciale:foobarnonexistent}}
6739 !! result
6740 No_such_special_page
6741 !! end
6742
6743 ###
6744 ### Images
6745 ###
6746 !! test
6747 Simple image
6748 !! input
6749 [[Image:foobar.jpg]]
6750 !! result
6751 <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>
6752 </p>
6753 !! end
6754
6755 !! test
6756 Right-aligned image
6757 !! input
6758 [[Image:foobar.jpg|right]]
6759 !! result
6760 <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>
6761
6762 !! end
6763
6764 !! test
6765 Simple image (using File: namespace, now canonical)
6766 !! input
6767 [[File:foobar.jpg]]
6768 !! result
6769 <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>
6770 </p>
6771 !! end
6772
6773 !! test
6774 Image with caption
6775 !! input
6776 [[Image:foobar.jpg|right|Caption text]]
6777 !! result
6778 <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>
6779
6780 !! end
6781
6782 !! test
6783 Image with empty attribute
6784 !! input
6785 [[Image:foobar.jpg|right||Caption text]]
6786 !! result
6787 <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>
6788
6789 !! end
6790
6791 !! test
6792 Image with link tails
6793 !! input
6794 123[[Image:foobar.jpg]]456
6795 123[[Image:foobar.jpg|right]]456
6796 123[[Image:foobar.jpg|thumb]]456
6797 !! result
6798 <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
6799 </p>
6800 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
6801 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
6802
6803 !! end
6804
6805 !! test
6806 Image with multiple captions -- only last one is accepted
6807 !! input
6808 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6809 !! result
6810 <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>
6811
6812 !! end
6813
6814 !! test
6815 Image with width attribute at different positions
6816 !! input
6817 [[Image:foobar.jpg|200px|right|Caption]]
6818 [[Image:foobar.jpg|right|200px|Caption]]
6819 [[Image:foobar.jpg|right|Caption|200px]]
6820 !! result
6821 <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>
6822 <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>
6823 <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>
6824
6825 !! end
6826
6827 !! test
6828 Image with link parameter, wiki target
6829 !! input
6830 [[Image:foobar.jpg|link=Target page]]
6831 !! result
6832 <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>
6833 </p>
6834 !! end
6835
6836 !! test
6837 Image with link parameter, URL target
6838 !! input
6839 [[Image:foobar.jpg|link=http://example.com/]]
6840 !! result
6841 <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>
6842 </p>
6843 !! end
6844
6845 !! test
6846 Image with link parameter, wgExternalLinkTarget
6847 !! input
6848 [[Image:foobar.jpg|link=http://example.com/]]
6849 !! config
6850 wgExternalLinkTarget='foobar'
6851 !! result
6852 <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>
6853 </p>
6854 !! end
6855
6856 !! test
6857 Image with link parameter, wgNoFollowLinks set to false
6858 !! input
6859 [[Image:foobar.jpg|link=http://example.com/]]
6860 !! config
6861 wgNoFollowLinks=false
6862 !! result
6863 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6864 </p>
6865 !! end
6866
6867 !! test
6868 Image with link parameter, wgNoFollowDomainExceptions
6869 !! input
6870 [[Image:foobar.jpg|link=http://example.com/]]
6871 !! config
6872 wgNoFollowDomainExceptions='example.com'
6873 !! result
6874 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6875 </p>
6876 !! end
6877
6878 !! test
6879 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6880 !! input
6881 [[Image:foobar.jpg|link=http://example.com/|Title]]
6882 !! config
6883 wgExternalLinkTarget='foobar'
6884 !! result
6885 <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>
6886 </p>
6887 !! end
6888
6889 !! test
6890 Image with empty link parameter
6891 !! input
6892 [[Image:foobar.jpg|link=]]
6893 !! result
6894 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6895 </p>
6896 !! end
6897
6898 !! test
6899 Image with link parameter (wiki target) and unnamed parameter
6900 !! input
6901 [[Image:foobar.jpg|link=Target page|Title]]
6902 !! result
6903 <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>
6904 </p>
6905 !! end
6906
6907 !! test
6908 Image with link parameter (URL target) and unnamed parameter
6909 !! input
6910 [[Image:foobar.jpg|link=http://example.com/|Title]]
6911 !! result
6912 <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>
6913 </p>
6914 !! end
6915
6916 !! test
6917 Thumbnail image with link parameter
6918 !! input
6919 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6920 !! result
6921 <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>
6922
6923 !! end
6924
6925 !! test
6926 Image with frame and link
6927 !! input
6928 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6929 !! result
6930 <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>
6931
6932 !! end
6933
6934 !! test
6935 Image with frame and link and explicit alt
6936 !! input
6937 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6938 !! result
6939 <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>
6940
6941 !! end
6942
6943 !! test
6944 Image with wiki markup in implicit alt
6945 !! input
6946 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6947 !! result
6948 <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>
6949 </p>
6950 !! end
6951
6952 !! test
6953 Image with wiki markup in explicit alt
6954 !! input
6955 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6956 !! result
6957 <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>
6958 </p>
6959 !! end
6960
6961 !! test
6962 Link to image page- image page normally doesn't exists, hence edit link
6963 Add test with existing image page
6964 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6965 !! input
6966 [[:Image:test]]
6967 !! result
6968 <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>
6969 </p>
6970 !! end
6971
6972 !! test
6973 bug 18784 Link to non-existent image page with caption should use caption as link text
6974 !! input
6975 [[:Image:test|caption]]
6976 !! result
6977 <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>
6978 </p>
6979 !! end
6980
6981 !! test
6982 Frameless image caption with a free URL
6983 !! input
6984 [[Image:foobar.jpg|http://example.com]]
6985 !! result
6986 <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>
6987 </p>
6988 !! end
6989
6990 !! test
6991 Thumbnail image caption with a free URL
6992 !! input
6993 [[Image:foobar.jpg|thumb|http://example.com]]
6994 !! result
6995 <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>
6996
6997 !! end
6998
6999 !! test
7000 Thumbnail image caption with a free URL and explicit alt
7001 !! input
7002 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7003 !! result
7004 <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>
7005
7006 !! end
7007
7008 !! test
7009 BUG 1887: A ISBN with a thumbnail
7010 !! input
7011 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7012 !! result
7013 <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>
7014
7015 !! end
7016
7017 !! test
7018 BUG 1887: A RFC with a thumbnail
7019 !! input
7020 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7021 !! result
7022 <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>
7023
7024 !! end
7025
7026 !! test
7027 BUG 1887: A mailto link with a thumbnail
7028 !! input
7029 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7030 !! result
7031 <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>
7032
7033 !! end
7034
7035 # Pending resolution to bug 368
7036 !! test
7037 BUG 648: Frameless image caption with a link
7038 !! input
7039 [[Image:foobar.jpg|text with a [[link]] in it]]
7040 !! result
7041 <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>
7042 </p>
7043 !! end
7044
7045 !! test
7046 BUG 648: Frameless image caption with a link (suffix)
7047 !! input
7048 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7049 !! result
7050 <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>
7051 </p>
7052 !! end
7053
7054 !! test
7055 BUG 648: Frameless image caption with an interwiki link
7056 !! input
7057 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7058 !! result
7059 <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>
7060 </p>
7061 !! end
7062
7063 !! test
7064 BUG 648: Frameless image caption with a piped interwiki link
7065 !! input
7066 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7067 !! result
7068 <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>
7069 </p>
7070 !! end
7071
7072 !! test
7073 Escape HTML special chars in image alt text
7074 !! input
7075 [[Image:foobar.jpg|& < > "]]
7076 !! result
7077 <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>
7078 </p>
7079 !! end
7080
7081 !! test
7082 BUG 499: Alt text should have &#1234;, not &amp;1234;
7083 !! input
7084 [[Image:foobar.jpg|&#9792;]]
7085 !! result
7086 <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>
7087 </p>
7088 !! end
7089
7090 !! test
7091 Broken image caption with link
7092 !! input
7093 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7094 !! result
7095 <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.
7096 </p>
7097 !! end
7098
7099 !! test
7100 Image caption containing another image
7101 !! input
7102 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7103 !! result
7104 <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>
7105
7106 !! end
7107
7108 !! test
7109 Image caption containing a newline
7110 !! input
7111 [[Image:Foobar.jpg|This
7112 *is some text]]
7113 !! result
7114 <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>
7115 </p>
7116 !!end
7117
7118 !!test
7119 Parsoid: Image caption containing leading space
7120 (The leading space should not trigger nowiki escaping in wt2wt mode)
7121 !! input
7122 [[Image:Foobar.jpg|thumb| bar]]
7123 !! result
7124 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7125
7126 !!end
7127
7128 !! test
7129 Bug 3090: External links other than http: in image captions
7130 !! input
7131 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7132 !! result
7133 <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>
7134
7135 !! end
7136
7137 !! test
7138 Custom class
7139 !! input
7140 [[Image:foobar.jpg|a|class=b]]
7141 !! result
7142 <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>
7143 </p>
7144 !! end
7145
7146 !! test
7147 Localized image handling (1).
7148 !! options
7149 language=es
7150 !! input
7151 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7152 !! result
7153 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7154
7155 !! end
7156
7157 !! test
7158 Localized image handling (2).
7159 !! options
7160 language=es
7161 !! input
7162 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7163 !! result
7164 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7165
7166 !! end
7167
7168 !! test
7169 "border", "frameless" and "class" attributes on an image.
7170 !! input
7171 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7172 !! result
7173 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7174 </p>
7175 !! end
7176
7177 !! article
7178 File:Barfoo.jpg
7179 !! text
7180 #REDIRECT [[File:Barfoo.jpg]]
7181 !! endarticle
7182
7183 !! test
7184 Redirected image
7185 !! input
7186 [[Image:Barfoo.jpg]]
7187 !! result
7188 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7189 </p>
7190 !! end
7191
7192 !! test
7193 Missing image with uploads disabled
7194 !! options
7195 wgEnableUploads=0
7196 !! input
7197 [[Image:Foobaz.jpg]]
7198 !! result
7199 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7200 </p>
7201 !! end
7202
7203
7204 ###
7205 ### Subpages
7206 ###
7207 !! article
7208 Subpage test/subpage
7209 !! text
7210 foo
7211 !! endarticle
7212
7213 !! test
7214 Subpage link
7215 !! options
7216 subpage title=[[Subpage test]]
7217 !! input
7218 [[/subpage]]
7219 !! result
7220 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7221 </p>
7222 !! end
7223
7224 !! test
7225 Subpage noslash link
7226 !! options
7227 subpage title=[[Subpage test]]
7228 !!input
7229 [[/subpage/]]
7230 !! result
7231 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7232 </p>
7233 !! end
7234
7235 !! test
7236 Disabled subpages
7237 !! input
7238 [[/subpage]]
7239 !! result
7240 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7241 </p>
7242 !! end
7243
7244 !! test
7245 BUG 561: {{/Subpage}}
7246 !! options
7247 subpage title=[[Page]]
7248 !! input
7249 {{/Subpage}}
7250 !! result
7251 <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>
7252 </p>
7253 !! end
7254
7255 ###
7256 ### Categories
7257 ###
7258 !! article
7259 Category:MediaWiki User's Guide
7260 !! text
7261 blah
7262 !! endarticle
7263
7264 !! test
7265 Link to category
7266 !! input
7267 [[:Category:MediaWiki User's Guide]]
7268 !! result
7269 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7270 </p>
7271 !! end
7272
7273 !! test
7274 Simple category
7275 !! options
7276 cat
7277 !! input
7278 [[Category:MediaWiki User's Guide]]
7279 !! result
7280 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7281 !! end
7282
7283 !! test
7284 PAGESINCATEGORY invalid title fatal (r33546 fix)
7285 !! input
7286 {{PAGESINCATEGORY:<bogus>}}
7287 !! result
7288 <p>0
7289 </p>
7290 !! end
7291
7292 !! test
7293 Category with different sort key
7294 !! options
7295 cat
7296 !! input
7297 [[Category:MediaWiki User's Guide|Foo]]
7298 !! result
7299 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7300 !! end
7301
7302 !! test
7303 Category with identical sort key
7304 !! options
7305 cat
7306 !! input
7307 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7308 !! result
7309 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7310 !! end
7311
7312 !! test
7313 Category with empty sort key
7314 !! options
7315 cat
7316 pst
7317 !! input
7318 [[Category:MediaWiki User's Guide|]]
7319 !! result
7320 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7321 !! end
7322
7323 !! test
7324 Category with empty sort key and parentheses
7325 !! options
7326 cat
7327 pst
7328 !! input
7329 [[Category:Foo (bar)|]]
7330 !! result
7331 [[Category:Foo (bar)|Foo]]
7332 !! end
7333
7334 !! test
7335 Category with link tail
7336 !! options
7337 cat
7338 pst
7339 !! input
7340 123[[Category:Foo]]456
7341 !! result
7342 123[[Category:Foo]]456
7343 !! end
7344
7345 !! test
7346 Category with template
7347 !! options
7348 cat
7349 pst
7350 !! input
7351 [[Category:{{echo|Foo}}]]
7352 !! result
7353 [[Category:{{echo|Foo}}]]
7354 !! end
7355
7356 !! test
7357 Category with template in sort key
7358 !! options
7359 cat
7360 pst
7361 !! input
7362 [[Category:Foo|{{echo|Bar}}]]
7363 !! result
7364 [[Category:Foo|{{echo|Bar}}]]
7365 !! end
7366
7367 !! test
7368 Category with template in sort key and title
7369 !! options
7370 cat
7371 pst
7372 !! input
7373 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7374 !! result
7375 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7376 !! end
7377
7378 !! test
7379 Category / paragraph interactions
7380 !! input
7381 Foo [[Category:Baz]] Bar
7382
7383 Foo [[Category:Baz]]
7384 Bar
7385
7386 Foo
7387 [[Category:Baz]]
7388 Bar
7389
7390 Foo
7391 [[Category:Baz]] Bar
7392
7393 Foo
7394 [[Category:Baz]]
7395 [[Category:Baz]]
7396 [[Category:Baz]]
7397 Bar
7398
7399 [[Category:Baz]]
7400 [[Category:Baz]]
7401 [[Category:Baz]]
7402
7403 [[Category:Baz]]
7404 {{echo|[[Category:Baz]]}}
7405 [[Category:Baz]]
7406 !! result
7407 <p>Foo Bar
7408 </p><p>Foo
7409 Bar
7410 </p><p>Foo
7411 Bar
7412 </p><p>Foo Bar
7413 </p><p>Foo
7414 Bar
7415 </p>
7416 !! end
7417
7418 ###
7419 ### Inter-language links
7420 ###
7421 !! test
7422 Inter-language links
7423 !! options
7424 ill
7425 !! input
7426 [[es:Alimento]]
7427 [[fr:Nourriture]]
7428 [[zh:&#39135;&#21697;]]
7429 !! result
7430 es:Alimento fr:Nourriture zh:食品
7431 !! end
7432
7433 !! test
7434 Duplicate interlanguage links (bug 24502)
7435 !! options
7436 ill
7437 !! input
7438 [[es:1]]
7439 [[es:2]]
7440 [[fr:1]]
7441 [[fr:2]]
7442 !! result
7443 es:1 fr:1
7444 !! end
7445
7446 ###
7447 ### Sections
7448 ###
7449 !! test
7450 Basic section headings
7451 !! input
7452 == Headline 1 ==
7453 Some text
7454
7455 ==Headline 2==
7456 More
7457 ===Smaller headline===
7458 Blah blah
7459 !! result
7460 <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>
7461 <p>Some text
7462 </p>
7463 <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>
7464 <p>More
7465 </p>
7466 <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>
7467 <p>Blah blah
7468 </p>
7469 !! end
7470
7471 !! test
7472 Section headings with TOC
7473 !! input
7474 == Headline 1 ==
7475 === Subheadline 1 ===
7476 ===== Skipping a level =====
7477 ====== Skipping a level ======
7478
7479 == Headline 2 ==
7480 Some text
7481 ===Another headline===
7482 !! result
7483 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7484 <ul>
7485 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7486 <ul>
7487 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7488 <ul>
7489 <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>
7490 <ul>
7491 <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>
7492 </ul>
7493 </li>
7494 </ul>
7495 </li>
7496 </ul>
7497 </li>
7498 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7499 <ul>
7500 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7501 </ul>
7502 </li>
7503 </ul>
7504 </td></tr></table>
7505 <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>
7506 <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>
7507 <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>
7508 <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>
7509 <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>
7510 <p>Some text
7511 </p>
7512 <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>
7513
7514 !! end
7515
7516 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7517 !! test
7518 Handling of sections up to level 6 and beyond
7519 !! input
7520 = Level 1 Heading=
7521 == Level 2 Heading==
7522 === Level 3 Heading===
7523 ==== Level 4 Heading====
7524 ===== Level 5 Heading=====
7525 ====== Level 6 Heading======
7526 ======= Level 7 Heading=======
7527 ======== Level 8 Heading========
7528 ========= Level 9 Heading=========
7529 ========== Level 10 Heading==========
7530 !! result
7531 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7532 <ul>
7533 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7534 <ul>
7535 <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>
7536 <ul>
7537 <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>
7538 <ul>
7539 <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>
7540 <ul>
7541 <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>
7542 <ul>
7543 <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>
7544 <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>
7545 <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>
7546 <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>
7547 <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>
7548 </ul>
7549 </li>
7550 </ul>
7551 </li>
7552 </ul>
7553 </li>
7554 </ul>
7555 </li>
7556 </ul>
7557 </li>
7558 </ul>
7559 </td></tr></table>
7560 <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>
7561 <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>
7562 <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>
7563 <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>
7564 <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>
7565 <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>
7566 <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>
7567 <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>
7568 <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>
7569 <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>
7570
7571 !! end
7572
7573 !! test
7574 TOC regression (bug 9764)
7575 !! input
7576 == title 1 ==
7577 === title 1.1 ===
7578 ==== title 1.1.1 ====
7579 === title 1.2 ===
7580 == title 2 ==
7581 === title 2.1 ===
7582 !! result
7583 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7584 <ul>
7585 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7586 <ul>
7587 <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>
7588 <ul>
7589 <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>
7590 </ul>
7591 </li>
7592 <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>
7593 </ul>
7594 </li>
7595 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7596 <ul>
7597 <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>
7598 </ul>
7599 </li>
7600 </ul>
7601 </td></tr></table>
7602 <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>
7603 <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>
7604 <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>
7605 <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>
7606 <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>
7607 <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>
7608
7609 !! end
7610
7611 !! test
7612 TOC with wgMaxTocLevel=3 (bug 6204)
7613 !! options
7614 wgMaxTocLevel=3
7615 !! input
7616 == title 1 ==
7617 === title 1.1 ===
7618 ==== title 1.1.1 ====
7619 === title 1.2 ===
7620 == title 2 ==
7621 === title 2.1 ===
7622 !! result
7623 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7624 <ul>
7625 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7626 <ul>
7627 <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>
7628 <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>
7629 </ul>
7630 </li>
7631 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7632 <ul>
7633 <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>
7634 </ul>
7635 </li>
7636 </ul>
7637 </td></tr></table>
7638 <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>
7639 <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>
7640 <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>
7641 <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>
7642 <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>
7643 <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>
7644
7645 !! end
7646
7647 !! test
7648 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7649 !! options
7650 wgMaxTocLevel=3
7651 !! input
7652 ==Section 1==
7653 ===Section 1.1===
7654 ====Section 1.1.1====
7655 ====Section 1.1.1.1====
7656 ==Section 2==
7657 !! result
7658 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7659 <ul>
7660 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7661 <ul>
7662 <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>
7663 </ul>
7664 </li>
7665 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7666 </ul>
7667 </td></tr></table>
7668 <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>
7669 <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>
7670 <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>
7671 <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>
7672 <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>
7673
7674 !! end
7675
7676
7677 !! test
7678 Resolving duplicate section names
7679 !! input
7680 == Foo bar ==
7681 == Foo bar ==
7682 !! result
7683 <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>
7684 <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>
7685
7686 !! end
7687
7688 !! test
7689 Resolving duplicate section names with differing case (bug 10721)
7690 !! input
7691 == Foo bar ==
7692 == Foo Bar ==
7693 !! result
7694 <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>
7695 <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>
7696
7697 !! end
7698
7699 !! article
7700 Template:sections
7701 !! text
7702 ===Section 1===
7703 ==Section 2==
7704 !! endarticle
7705
7706 !! test
7707 Template with sections, __NOTOC__
7708 !! input
7709 __NOTOC__
7710 ==Section 0==
7711 {{sections}}
7712 ==Section 4==
7713 !! result
7714 <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>
7715 <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>
7716 <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>
7717 <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>
7718
7719 !! end
7720
7721 !! test
7722 __NOEDITSECTION__ keyword
7723 !! input
7724 __NOEDITSECTION__
7725 ==Section 1==
7726 ==Section 2==
7727 !! result
7728 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7729 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7730
7731 !! end
7732
7733 !! test
7734 Link inside a section heading
7735 !! input
7736 ==Section with a [[Main Page|link]] in it==
7737 !! result
7738 <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>
7739
7740 !! end
7741
7742 !! test
7743 TOC regression (bug 12077)
7744 !! input
7745 __TOC__
7746 == title 1 ==
7747 === title 1.1 ===
7748 == title 2 ==
7749 !! result
7750 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7751 <ul>
7752 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7753 <ul>
7754 <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>
7755 </ul>
7756 </li>
7757 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7758 </ul>
7759 </td></tr></table>
7760 <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>
7761 <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>
7762 <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>
7763
7764 !! end
7765
7766 !! test
7767 BUG 1219 URL next to image (good)
7768 !! input
7769 http://example.com [[Image:foobar.jpg]]
7770 !! result
7771 <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>
7772 </p>
7773 !!end
7774
7775 !! test
7776 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
7777 !! input
7778 ===
7779 The line above must have a trailing space!
7780 === <!--
7781 --> <!-- -->
7782 But just in case it doesn't...
7783 !! result
7784 <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>
7785 <p>The line above must have a trailing space!
7786 </p>
7787 <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>
7788 <p>But just in case it doesn't...
7789 </p>
7790 !! end
7791
7792 !! test
7793 Header with special characters (bug 25462)
7794 !! input
7795 The tooltips shall not show entities to the user (ie. be double escaped)
7796
7797 == text > text ==
7798 section 1
7799
7800 == text < text ==
7801 section 2
7802
7803 == text & text ==
7804 section 3
7805
7806 == text ' text ==
7807 section 4
7808
7809 == text " text ==
7810 section 5
7811 !! result
7812 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7813 </p>
7814 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7815 <ul>
7816 <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>
7817 <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>
7818 <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>
7819 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7820 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7821 </ul>
7822 </td></tr></table>
7823 <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>
7824 <p>section 1
7825 </p>
7826 <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>
7827 <p>section 2
7828 </p>
7829 <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>
7830 <p>section 3
7831 </p>
7832 <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>
7833 <p>section 4
7834 </p>
7835 <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>
7836 <p>section 5
7837 </p>
7838 !! end
7839
7840 !! test
7841 Headers with excess '=' characters
7842 (Are similar tests necessary beyond the 1st level?)
7843 !! input
7844 =foo==
7845 ==foo=
7846 =''italic'' heading==
7847 ==''italic'' heading=
7848 !! result
7849 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7850 <ul>
7851 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7852 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7853 <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>
7854 <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>
7855 </ul>
7856 </td></tr></table>
7857 <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>
7858 <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>
7859 <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>
7860 <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>
7861
7862 !! end
7863
7864 !! test
7865 BUG 1219 URL next to image (broken)
7866 !! input
7867 http://example.com[[Image:foobar.jpg]]
7868 !! result
7869 <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>
7870 </p>
7871 !!end
7872
7873 !! test
7874 Bug 1186 news: in the middle of text
7875 !! input
7876 http://en.wikinews.org/wiki/Wikinews:Workplace
7877 !! result
7878 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7879 </p>
7880 !!end
7881
7882
7883 !! test
7884 Namespaced link must have a title
7885 !! input
7886 [[Project:]]
7887 !! result
7888 <p>[[Project:]]
7889 </p>
7890 !!end
7891
7892 !! test
7893 Namespaced link must have a title (bad fragment version)
7894 !! input
7895 [[Project:#fragment]]
7896 !! result
7897 <p>[[Project:#fragment]]
7898 </p>
7899 !!end
7900
7901
7902 ###
7903 ### HTML tags and HTML attributes
7904 ###
7905
7906 !! test
7907 div with no attributes
7908 !! input
7909 <div>HTML rocks</div>
7910 !! result
7911 <div>HTML rocks</div>
7912
7913 !! end
7914
7915 !! test
7916 div with double-quoted attribute
7917 !! input
7918 <div id="rock">HTML rocks</div>
7919 !! result
7920 <div id="rock">HTML rocks</div>
7921
7922 !! end
7923
7924 !! test
7925 div with single-quoted attribute
7926 !! input
7927 <div id='rock'>HTML rocks</div>
7928 !! result
7929 <div id="rock">HTML rocks</div>
7930
7931 !! end
7932
7933 !! test
7934 div with unquoted attribute
7935 !! input
7936 <div id=rock>HTML rocks</div>
7937 !! result
7938 <div id="rock">HTML rocks</div>
7939
7940 !! end
7941
7942 !! test
7943 div with illegal double attributes
7944 !! input
7945 <div id="a" id="b">HTML rocks</div>
7946 !! result
7947 <div id="b">HTML rocks</div>
7948
7949 !!end
7950
7951 # FIXME: produce empty string instead of "class" in the PHP parser, following
7952 # the HTML5 spec.
7953 !! test
7954 div with empty attribute value, space before equals
7955 !! options
7956 disabled
7957 !! input
7958 <div class =>HTML rocks</div>
7959 !! result
7960 <div class="">HTML rocks</div>
7961
7962 !! end
7963
7964 # The PHP parser escapes the opening brace to &#123; for some reason, so
7965 # disabled this test for it.
7966 !! test
7967 div with braces in attribute value
7968 !! options
7969 disabled
7970 !! input
7971 <div title="{}">Foo</div>
7972 !! result
7973 <div title="{}">Foo</div>
7974 !! end
7975
7976 # This it very inconsistent in the PHP parser: it returns
7977 # class="class" if there is a space between the name and the equal sign (see
7978 # 'div with empty attribute value, space before equals'), but strips the
7979 # attribute completely if the space is missing. We hope that not much content
7980 # depends on this, so are implementing the behavior below in Parsoid for
7981 # consistencies' sake. Disabled for the PHP parser.
7982 # FIXME: fix this behavior in the PHP parser?
7983 !! test
7984 div with empty attribute value, no space before equals
7985 !! options
7986 disabled
7987 !! input
7988 <div class=>HTML rocks</div>
7989 !! result
7990 <div class="">HTML rocks</div>
7991
7992 !! end
7993
7994 !! test
7995 HTML multiple attributes correction
7996 !! input
7997 <p class="error" class="awesome">Awesome!</p>
7998 !! result
7999 <p class="awesome">Awesome!</p>
8000
8001 !!end
8002
8003 !! test
8004 Table multiple attributes correction
8005 !! input
8006 {|
8007 !+ class="error" class="awesome"| status
8008 |}
8009 !! result
8010 <table>
8011 <tr>
8012 <th class="awesome"> status
8013 </th></tr></table>
8014
8015 !!end
8016
8017 !! test
8018 DIV IN UPPERCASE
8019 !! input
8020 <DIV ID="x">HTML ROCKS</DIV>
8021 !! result
8022 <div id="x">HTML ROCKS</div>
8023
8024 !!end
8025
8026 !! test
8027 Non-ASCII pseudo-tags are rendered as text
8028 !! input
8029 <khyô>
8030 !! result
8031 <p>&lt;khyô&gt;
8032 </p>
8033 !! end
8034
8035 !! test
8036 Pseudo-tag with URL 'name' renders as url link
8037 !! input
8038 <http://example.com/>
8039 !! result
8040 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8041 </p>
8042 !! end
8043
8044 !! test
8045 text with amp in the middle of nowhere
8046 !! input
8047 Remember AT&T?
8048 !!result
8049 <p>Remember AT&amp;T?
8050 </p>
8051 !! end
8052
8053 !! test
8054 text with character entity: eacute
8055 !! input
8056 I always thought &eacute; was a cute letter.
8057 !! result
8058 <p>I always thought &#233; was a cute letter.
8059 </p>
8060 !! end
8061
8062 !! test
8063 text with entity-escaped character entity-like string: eacute
8064 !! input
8065 I always thought &amp;eacute; was a cute letter.
8066 !! result
8067 <p>I always thought &amp;eacute; was a cute letter.
8068 </p>
8069 !! end
8070
8071 !! test
8072 text with undefined character entity: xacute
8073 !! input
8074 I always thought &xacute; was a cute letter.
8075 !! result
8076 <p>I always thought &amp;xacute; was a cute letter.
8077 </p>
8078 !! end
8079
8080
8081 ###
8082 ### Media links
8083 ###
8084
8085 !! test
8086 Media link
8087 !! input
8088 [[Media:Foobar.jpg]]
8089 !! result
8090 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8091 </p>
8092 !! end
8093
8094 !! test
8095 Media link with text
8096 !! input
8097 [[Media:Foobar.jpg|A neat file to look at]]
8098 !! result
8099 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8100 </p>
8101 !! end
8102
8103 # FIXME: this is still bad HTML tag nesting
8104 !! test
8105 Media link with nasty text
8106 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8107 !! input
8108 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8109 !! result
8110 <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>
8111
8112 !! end
8113
8114 !! test
8115 Media link to nonexistent file (bug 1702)
8116 !! input
8117 [[Media:No such.jpg]]
8118 !! result
8119 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8120 </p>
8121 !! end
8122
8123 !! test
8124 Image link to nonexistent file (bug 1850 - good)
8125 !! input
8126 [[Image:No such.jpg]]
8127 !! result
8128 <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>
8129 </p>
8130 !! end
8131
8132 !! test
8133 :Image link to nonexistent file (bug 1850 - bad)
8134 !! input
8135 [[:Image:No such.jpg]]
8136 !! result
8137 <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>
8138 </p>
8139 !! end
8140
8141
8142
8143 !! test
8144 Character reference normalization in link text (bug 1938)
8145 !! input
8146 [[Main Page|this&that]]
8147 !! result
8148 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8149 </p>
8150 !!end
8151
8152 !! article
8153 אַ
8154 !! text
8155 Test for unicode normalization
8156
8157 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8158 !! endarticle
8159
8160 !! test
8161 (bug 19451) Links should refer to the normalized form.
8162 !! input
8163 [[&#xFB2E;]]
8164 [[&#x5d0;&#x5b7;]]
8165 [[&#x5d0;ַ]]
8166 [[א&#x5b7;]]
8167 [[אַ]]
8168 !! result
8169 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8170 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8171 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8172 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8173 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8174 </p>
8175 !! end
8176
8177 !! test
8178 Empty attribute crash test (bug 2067)
8179 !! input
8180 <font color="">foo</font>
8181 !! result
8182 <p><font color="">foo</font>
8183 </p>
8184 !! end
8185
8186 !! test
8187 Empty attribute crash test single-quotes (bug 2067)
8188 !! input
8189 <font color=''>foo</font>
8190 !! result
8191 <p><font color="">foo</font>
8192 </p>
8193 !! end
8194
8195 !! test
8196 Attribute test: equals, then nothing
8197 !! input
8198 <font color=>foo</font>
8199 !! result
8200 <p><font>foo</font>
8201 </p>
8202 !! end
8203
8204 !! test
8205 Attribute test: unquoted value
8206 !! input
8207 <font color=x>foo</font>
8208 !! result
8209 <p><font color="x">foo</font>
8210 </p>
8211 !! end
8212
8213 !! test
8214 Attribute test: unquoted but illegal value (hash)
8215 !! input
8216 <font color=#x>foo</font>
8217 !! result
8218 <p><font color="#x">foo</font>
8219 </p>
8220 !! end
8221
8222 !! test
8223 Attribute test: no value
8224 !! input
8225 <font color>foo</font>
8226 !! result
8227 <p><font color="color">foo</font>
8228 </p>
8229 !! end
8230
8231 !! test
8232 Bug 2095: link with three closing brackets
8233 !! input
8234 [[Main Page]]]
8235 !! result
8236 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8237 </p>
8238 !! end
8239
8240 !! test
8241 Bug 2095: link with pipe and three closing brackets
8242 !! input
8243 [[Main Page|link]]]
8244 !! result
8245 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8246 </p>
8247 !! end
8248
8249 !! test
8250 Bug 2095: link with pipe and three closing brackets, version 2
8251 !! input
8252 [[Main Page|[http://example.com/]]]
8253 !! result
8254 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8255 </p>
8256 !! end
8257
8258
8259 ###
8260 ### Safety
8261 ###
8262
8263 !! article
8264 Template:Dangerous attribute
8265 !! text
8266 " onmouseover="alert(document.cookie)
8267 !! endarticle
8268
8269 !! article
8270 Template:Dangerous style attribute
8271 !! text
8272 border-size: expression(alert(document.cookie))
8273 !! endarticle
8274
8275 !! article
8276 Template:Div style
8277 !! text
8278 <div style="float: right; {{{1}}}">Magic div</div>
8279 !! endarticle
8280
8281 !! test
8282 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8283 !! input
8284 <div title="{{test}}"></div>
8285 !! result
8286 <div title="This is a test template"></div>
8287
8288 !! end
8289
8290 !! test
8291 Bug 2304: HTML attribute safety (dangerous template; 2309)
8292 !! input
8293 <div title="{{dangerous attribute}}"></div>
8294 !! result
8295 <div title=""></div>
8296
8297 !! end
8298
8299 !! test
8300 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8301 !! input
8302 <div style="{{dangerous style attribute}}"></div>
8303 !! result
8304 <div style="/* insecure input */"></div>
8305
8306 !! end
8307
8308 !! test
8309 Bug 2304: HTML attribute safety (safe parameter; 2309)
8310 !! input
8311 {{div style|width: 200px}}
8312 !! result
8313 <div style="float: right; width: 200px">Magic div</div>
8314
8315 !! end
8316
8317 !! test
8318 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8319 !! input
8320 {{div style|width: expression(alert(document.cookie))}}
8321 !! result
8322 <div style="/* insecure input */">Magic div</div>
8323
8324 !! end
8325
8326 !! test
8327 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8328 !! input
8329 {{div style|"><script>alert(document.cookie)</script>}}
8330 !! result
8331 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8332
8333 !! end
8334
8335 !! test
8336 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8337 !! input
8338 {{div style|" ><script>alert(document.cookie)</script>}}
8339 !! result
8340 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8341
8342 !! end
8343
8344 !! test
8345 Bug 2304: HTML attribute safety (link)
8346 !! input
8347 <div title="[[Main Page]]"></div>
8348 !! result
8349 <div title="&#91;&#91;Main Page]]"></div>
8350
8351 !! end
8352
8353 !! test
8354 Bug 2304: HTML attribute safety (italics)
8355 !! input
8356 <div title="''foobar''"></div>
8357 !! result
8358 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8359
8360 !! end
8361
8362 !! test
8363 Bug 2304: HTML attribute safety (bold)
8364 !! input
8365 <div title="'''foobar'''"></div>
8366 !! result
8367 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8368
8369 !! end
8370
8371
8372 !! test
8373 Bug 2304: HTML attribute safety (ISBN)
8374 !! input
8375 <div title="ISBN 1234567890"></div>
8376 !! result
8377 <div title="&#73;SBN 1234567890"></div>
8378
8379 !! end
8380
8381 !! test
8382 Bug 2304: HTML attribute safety (RFC)
8383 !! input
8384 <div title="RFC 1234"></div>
8385 !! result
8386 <div title="&#82;FC 1234"></div>
8387
8388 !! end
8389
8390 !! test
8391 Bug 2304: HTML attribute safety (PMID)
8392 !! input
8393 <div title="PMID 1234567890"></div>
8394 !! result
8395 <div title="&#80;MID 1234567890"></div>
8396
8397 !! end
8398
8399 !! test
8400 Bug 2304: HTML attribute safety (web link)
8401 !! input
8402 <div title="http://example.com/"></div>
8403 !! result
8404 <div title="http&#58;//example.com/"></div>
8405
8406 !! end
8407
8408 !! test
8409 Bug 2304: HTML attribute safety (named web link)
8410 !! input
8411 <div title="[http://example.com/ link]"></div>
8412 !! result
8413 <div title="&#91;http&#58;//example.com/ link]"></div>
8414
8415 !! end
8416
8417 !! test
8418 Bug 3244: HTML attribute safety (extension; safe)
8419 !! input
8420 <div style="<nowiki>background:blue</nowiki>"></div>
8421 !! result
8422 <div style="background:blue"></div>
8423
8424 !! end
8425
8426 !! test
8427 Bug 3244: HTML attribute safety (extension; unsafe)
8428 !! input
8429 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8430 !! result
8431 <div style="/* insecure input */"></div>
8432
8433 !! end
8434
8435 # More MSIE fun discovered by Tom Gilder
8436
8437 !! test
8438 MSIE CSS safety test: spurious slash
8439 !! input
8440 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8441 !! result
8442 <div style="/* insecure input */">evil</div>
8443
8444 !! end
8445
8446 !! test
8447 MSIE CSS safety test: hex code
8448 !! input
8449 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8450 !! result
8451 <div style="/* insecure input */">evil</div>
8452
8453 !! end
8454
8455 !! test
8456 MSIE CSS safety test: comment in url
8457 !! input
8458 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8459 !! result
8460 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8461
8462 !! end
8463
8464 !! test
8465 MSIE CSS safety test: comment in expression
8466 !! input
8467 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8468 !! result
8469 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8470
8471 !! end
8472
8473
8474 !! test
8475 Table attribute legitimate extension
8476 !! input
8477 {|
8478 !+ style="<nowiki>color:blue</nowiki>"| status
8479 |}
8480 !! result
8481 <table>
8482 <tr>
8483 <th style="color:blue"> status
8484 </th></tr></table>
8485
8486 !!end
8487
8488 !! test
8489 Table attribute safety
8490 !! input
8491 {|
8492 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8493 |}
8494 !! result
8495 <table>
8496 <tr>
8497 <th style="/* insecure input */"> status
8498 </th></tr></table>
8499
8500 !! end
8501
8502 !! test
8503 CSS line continuation 1
8504 !! input
8505 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8506 !! result
8507 <div style="/* insecure input */"></div>
8508
8509 !! end
8510
8511 !! test
8512 CSS line continuation 2
8513 !! input
8514 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8515 !! result
8516 <div style="/* insecure input */"></div>
8517
8518 !! end
8519
8520 !! article
8521 Template:Identity
8522 !! text
8523 {{{1}}}
8524 !! endarticle
8525
8526 !! test
8527 Expansion of multi-line templates in attribute values (bug 6255)
8528 !! input
8529 <div style="background: {{identity|#00FF00}}">-</div>
8530 !! result
8531 <div style="background: #00FF00">-</div>
8532
8533 !! end
8534
8535
8536 !! test
8537 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8538 !! input
8539 <div style="background:
8540 #00FF00">-</div>
8541 !! result
8542 <div style="background: #00FF00">-</div>
8543
8544 !! end
8545
8546 !! test
8547 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8548 !! input
8549 <div style="background: &#10;#00FF00">-</div>
8550 !! result
8551 <div style="background: &#10;#00FF00">-</div>
8552
8553 !! end
8554
8555 ###
8556 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8557 ###
8558 !! test
8559 Parser hook: empty input
8560 !! input
8561 <tag></tag>
8562 !! result
8563 <pre>
8564 ''
8565 array (
8566 )
8567 </pre>
8568
8569 !! end
8570
8571 !! test
8572 Parser hook: empty input using terminated empty elements
8573 !! input
8574 <tag/>
8575 !! result
8576 <pre>
8577 NULL
8578 array (
8579 )
8580 </pre>
8581
8582 !! end
8583
8584 !! test
8585 Parser hook: empty input using terminated empty elements (space before)
8586 !! input
8587 <tag />
8588 !! result
8589 <pre>
8590 NULL
8591 array (
8592 )
8593 </pre>
8594
8595 !! end
8596
8597 !! test
8598 Parser hook: basic input
8599 !! input
8600 <tag>input</tag>
8601 !! result
8602 <pre>
8603 'input'
8604 array (
8605 )
8606 </pre>
8607
8608 !! end
8609
8610
8611 !! test
8612 Parser hook: case insensitive
8613 !! input
8614 <TAG>input</TAG>
8615 !! result
8616 <pre>
8617 'input'
8618 array (
8619 )
8620 </pre>
8621
8622 !! end
8623
8624
8625 !! test
8626 Parser hook: case insensitive, redux
8627 !! input
8628 <TaG>input</TAg>
8629 !! result
8630 <pre>
8631 'input'
8632 array (
8633 )
8634 </pre>
8635
8636 !! end
8637
8638 !! test
8639 Parser hook: nested tags
8640 !! options
8641 noxml
8642 !! input
8643 <tag><tag></tag></tag>
8644 !! result
8645 <pre>
8646 '<tag>'
8647 array (
8648 )
8649 </pre>&lt;/tag&gt;
8650
8651 !! end
8652
8653 !! test
8654 Parser hook: basic arguments
8655 !! input
8656 <tag width=200 height = "100" depth = '50' square></tag>
8657 !! result
8658 <pre>
8659 ''
8660 array (
8661 'width' => '200',
8662 'height' => '100',
8663 'depth' => '50',
8664 'square' => 'square',
8665 )
8666 </pre>
8667
8668 !! end
8669
8670 !! test
8671 Parser hook: argument containing a forward slash (bug 5344)
8672 !! input
8673 <tag filename='/tmp/bla'></tag>
8674 !! result
8675 <pre>
8676 ''
8677 array (
8678 'filename' => '/tmp/bla',
8679 )
8680 </pre>
8681
8682 !! end
8683
8684 !! test
8685 Parser hook: empty input using terminated empty elements (bug 2374)
8686 !! input
8687 <tag foo=bar/>text
8688 !! result
8689 <pre>
8690 NULL
8691 array (
8692 'foo' => 'bar',
8693 )
8694 </pre>text
8695
8696 !! end
8697
8698 # </tag> should be output literally since there is no matching tag that begins it
8699 !! test
8700 Parser hook: basic arguments using terminated empty elements (bug 2374)
8701 !! input
8702 <tag width=200 height = "100" depth = '50' square/>
8703 other stuff
8704 </tag>
8705 !! result
8706 <pre>
8707 NULL
8708 array (
8709 'width' => '200',
8710 'height' => '100',
8711 'depth' => '50',
8712 'square' => 'square',
8713 )
8714 </pre>
8715 <p>other stuff
8716 &lt;/tag&gt;
8717 </p>
8718 !! end
8719
8720 ###
8721 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8722 ###
8723
8724 !! test
8725 Parser hook: static parser hook not inside a comment
8726 !! input
8727 <statictag>hello, world</statictag>
8728 <statictag action=flush/>
8729 !! result
8730 <p>hello, world
8731 </p>
8732 !! end
8733
8734
8735 !! test
8736 Parser hook: static parser hook inside a comment
8737 !! input
8738 <!-- <statictag>hello, world</statictag> -->
8739 <statictag action=flush/>
8740 !! result
8741 <p><br />
8742 </p>
8743 !! end
8744
8745 # Nested template calls; this case was broken by Parser.php rev 1.506,
8746 # since reverted.
8747
8748 !! article
8749 Template:One-parameter
8750 !! text
8751 (My parameter is: {{{1}}})
8752 !! endarticle
8753
8754 !! article
8755 Template:Map-one-parameter
8756 !! text
8757 {{{{{1}}}|{{{2}}}}}
8758 !! endarticle
8759
8760 !! test
8761 Nested template calls
8762 !! input
8763 {{Map-one-parameter|One-parameter|param}}
8764 !! result
8765 <p>(My parameter is: param)
8766 </p>
8767 !! end
8768
8769
8770 ###
8771 ### Sanitizer
8772 ###
8773 !! test
8774 Sanitizer: Closing of open tags
8775 !! input
8776 <s></s><table></table>
8777 !! result
8778 <s></s><table></table>
8779
8780 !! end
8781
8782 !! test
8783 Sanitizer: Closing of open but not closed tags
8784 !! input
8785 <s>foo
8786 !! result
8787 <p><s>foo</s>
8788 </p>
8789 !! end
8790
8791 !! test
8792 Sanitizer: Closing of closed but not open tags
8793 !! input
8794 </s>
8795 !! result
8796 <p>&lt;/s&gt;
8797 </p>
8798 !! end
8799
8800 !! test
8801 Sanitizer: Closing of closed but not open table tags
8802 !! input
8803 Table not started</td></tr></table>
8804 !! result
8805 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8806 </p>
8807 !! end
8808
8809 !! test
8810 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8811 !! input
8812 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8813 !! result
8814 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8815 </p>
8816 !! end
8817
8818 !! test
8819 Sanitizer: Validating the contents of the id attribute (bug 4515)
8820 !! options
8821 disabled
8822 !! input
8823 <br id=9 />
8824 !! result
8825 Something, but definitely not <br id="9" />...
8826 !! end
8827
8828 !! test
8829 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8830 !! options
8831 disabled
8832 !! input
8833 <br id="foo" /><br id="foo" />
8834 !! result
8835 Something need to be done. foo-2 ?
8836 !! end
8837
8838 !! test
8839 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8840 !! input
8841 <div itemscope>
8842 <meta itemprop="hello" content="world">
8843 <meta http-equiv="refresh" content="5">
8844 <meta itemprop="hello" http-equiv="refresh" content="5">
8845 <link itemprop="hello" href="{{SERVER}}">
8846 <link rel="stylesheet" href="{{SERVER}}">
8847 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8848 </div>
8849 !! result
8850 <div itemscope="itemscope">
8851 <p> <meta itemprop="hello" content="world" />
8852 &lt;meta http-equiv="refresh" content="5"&gt;
8853 <meta itemprop="hello" content="5" />
8854 </p>
8855 <link itemprop="hello" href="http&#58;//example.org" />
8856 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
8857 <link itemprop="hello" href="http&#58;//example.org" />
8858 </div>
8859
8860 !! end
8861
8862 !! test
8863 Language converter: output gets cut off unexpectedly (bug 5757)
8864 !! options
8865 language=zh
8866 !! input
8867 this bit is safe: }-
8868
8869 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8870
8871 then we get cut off here: }-
8872
8873 all additional text is vanished
8874 !! result
8875 <p>this bit is safe: }-
8876 </p><p>but if we add a conversion instance: xxx
8877 </p><p>then we get cut off here: }-
8878 </p><p>all additional text is vanished
8879 </p>
8880 !! end
8881
8882 !! test
8883 Self closed html pairs (bug 5487)
8884 !! options
8885 !! input
8886 <center><font id="bug" />Centered text</center>
8887 <div><font id="bug2" />In div text</div>
8888 !! result
8889 <center>&lt;font id="bug" /&gt;Centered text</center>
8890 <div>&lt;font id="bug2" /&gt;In div text</div>
8891
8892 !! end
8893
8894 #
8895 #
8896 #
8897
8898 !! test
8899 Punctuation: nbsp before exclamation
8900 !! input
8901 C'est grave !
8902 !! result
8903 <p>C'est grave&#160;!
8904 </p>
8905 !! end
8906
8907 !! test
8908 Punctuation: CSS !important (bug 11874)
8909 !! input
8910 <div style="width:50% !important">important</div>
8911 !! result
8912 <div style="width:50% !important">important</div>
8913
8914 !!end
8915
8916 !! test
8917 Punctuation: CSS ! important (bug 11874; with space after)
8918 !! input
8919 <div style="width:50% ! important">important</div>
8920 !! result
8921 <div style="width:50% ! important">important</div>
8922
8923 !!end
8924
8925
8926 !! test
8927 HTML bullet list, closed tags (bug 5497)
8928 !! input
8929 <ul>
8930 <li>One</li>
8931 <li>Two</li>
8932 </ul>
8933 !! result
8934 <ul>
8935 <li>One</li>
8936 <li>Two</li>
8937 </ul>
8938
8939 !! end
8940
8941 !! test
8942 HTML bullet list, unclosed tags (bug 5497)
8943 !! options
8944 disabled
8945 !! input
8946 <ul>
8947 <li>One
8948 <li>Two
8949 </ul>
8950 !! result
8951 <ul>
8952 <li>One
8953 </li><li>Two
8954 </li></ul>
8955
8956 !! end
8957
8958 !! test
8959 HTML ordered list, closed tags (bug 5497)
8960 !! input
8961 <ol>
8962 <li>One</li>
8963 <li>Two</li>
8964 </ol>
8965 !! result
8966 <ol>
8967 <li>One</li>
8968 <li>Two</li>
8969 </ol>
8970
8971 !! end
8972
8973 !! test
8974 HTML ordered list, unclosed tags (bug 5497)
8975 !! options
8976 disabled
8977 !! input
8978 <ol>
8979 <li>One
8980 <li>Two
8981 </ol>
8982 !! result
8983 <ol>
8984 <li>One
8985 </li><li>Two
8986 </li></ol>
8987
8988 !! end
8989
8990 !! test
8991 HTML nested bullet list, closed tags (bug 5497)
8992 !! input
8993 <ul>
8994 <li>One</li>
8995 <li>Two:
8996 <ul>
8997 <li>Sub-one</li>
8998 <li>Sub-two</li>
8999 </ul>
9000 </li>
9001 </ul>
9002 !! result
9003 <ul>
9004 <li>One</li>
9005 <li>Two:
9006 <ul>
9007 <li>Sub-one</li>
9008 <li>Sub-two</li>
9009 </ul>
9010 </li>
9011 </ul>
9012
9013 !! end
9014
9015 !! test
9016 HTML nested bullet list, open tags (bug 5497)
9017 !! options
9018 disabled
9019 !! input
9020 <ul>
9021 <li>One
9022 <li>Two:
9023 <ul>
9024 <li>Sub-one
9025 <li>Sub-two
9026 </ul>
9027 </ul>
9028 !! result
9029 <ul>
9030 <li>One
9031 </li><li>Two:
9032 <ul>
9033 <li>Sub-one
9034 </li><li>Sub-two
9035 </li></ul>
9036 </li></ul>
9037
9038 !! end
9039
9040 !! test
9041 HTML nested ordered list, closed tags (bug 5497)
9042 !! input
9043 <ol>
9044 <li>One</li>
9045 <li>Two:
9046 <ol>
9047 <li>Sub-one</li>
9048 <li>Sub-two</li>
9049 </ol>
9050 </li>
9051 </ol>
9052 !! result
9053 <ol>
9054 <li>One</li>
9055 <li>Two:
9056 <ol>
9057 <li>Sub-one</li>
9058 <li>Sub-two</li>
9059 </ol>
9060 </li>
9061 </ol>
9062
9063 !! end
9064
9065 !! test
9066 HTML nested ordered list, open tags (bug 5497)
9067 !! options
9068 disabled
9069 !! input
9070 <ol>
9071 <li>One
9072 <li>Two:
9073 <ol>
9074 <li>Sub-one
9075 <li>Sub-two
9076 </ol>
9077 </ol>
9078 !! result
9079 <ol>
9080 <li>One
9081 </li><li>Two:
9082 <ol>
9083 <li>Sub-one
9084 </li><li>Sub-two
9085 </li></ol>
9086 </li></ol>
9087
9088 !! end
9089
9090 !! test
9091 HTML ordered list item with parameters oddity
9092 !! input
9093 <ol><li id="fragment">One</li></ol>
9094 !! result
9095 <ol><li id="fragment">One</li></ol>
9096
9097 !! end
9098
9099 !!test
9100 bug 5918: autonumbering
9101 !! input
9102 [http://first/] [http://second] [ftp://ftp]
9103
9104 ftp://inlineftp
9105
9106 [mailto:enclosed@mail.tld With target]
9107
9108 [mailto:enclosed@mail.tld]
9109
9110 mailto:inline@mail.tld
9111 !! result
9112 <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>
9113 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9114 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9115 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9116 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9117 </p>
9118 !! end
9119
9120
9121 #
9122 # Security and HTML correctness
9123 # From Nick Jenkins' fuzz testing
9124 #
9125
9126 !! test
9127 Fuzz testing: Parser13
9128 !! input
9129 {|
9130 | http://a|
9131 !! result
9132 <table>
9133 <tr>
9134 <td>
9135 </td>
9136 </tr>
9137 </table>
9138
9139 !! end
9140
9141 !! test
9142 Fuzz testing: Parser14
9143 !! input
9144 == onmouseover= ==
9145 http://__TOC__
9146 !! result
9147 <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>
9148 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9149 <ul>
9150 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9151 </ul>
9152 </td></tr></table>
9153
9154 !! end
9155
9156 !! test
9157 Fuzz testing: Parser14-table
9158 !! input
9159 ==a==
9160 {| STYLE=__TOC__
9161 !! result
9162 <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>
9163 <table style="&#95;_TOC&#95;_">
9164 <tr><td></td></tr>
9165 </table>
9166
9167 !! end
9168
9169 # Known to produce bogus xml (extra </td>)
9170 !! test
9171 Fuzz testing: Parser16
9172 !! options
9173 noxml
9174 !! input
9175 {|
9176 !https://||||||
9177 !! result
9178 <table>
9179 <tr>
9180 <th>https://</th>
9181 <th></th>
9182 <th></th>
9183 <th>
9184 </td>
9185 </tr>
9186 </table>
9187
9188 !! end
9189
9190 !! test
9191 Fuzz testing: Parser21
9192 !! input
9193 {|
9194 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9195 |
9196 !! result
9197 <table>
9198 <tr>
9199 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9200 </th>
9201 <td>
9202 </td>
9203 </tr>
9204 </table>
9205
9206 !! end
9207
9208 !! test
9209 Fuzz testing: Parser22
9210 !! input
9211 http://===r:::https://b
9212
9213 {|
9214 !!result
9215 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9216 </p>
9217 <table>
9218 <tr><td></td></tr>
9219 </table>
9220
9221 !! end
9222
9223 # Known to produce bad XML for now
9224 !! test
9225 Fuzz testing: Parser24
9226 !! options
9227 noxml
9228 !! input
9229 {|
9230 {{{|
9231 <u CLASS=
9232 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9233 <br style="onmouseover='alert(document.cookie);' " />
9234
9235 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9236 |
9237 !! result
9238 <table>
9239 {{{|
9240 <u class="&#124;">}}}} &gt;
9241 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9242
9243 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9244 <tr>
9245 <td></u>
9246 </td>
9247 </tr>
9248 </table>
9249
9250 !! end
9251
9252 # Note: the current result listed for this is not what the original one was,
9253 # but the original bug was JavaScript injection, which is fixed in any case.
9254 # It's not clear that the original result listed was any more correct than the
9255 # current one. Original result:
9256 # <p>{{{|
9257 # </p>
9258 # <li class="&#124;&#124;">
9259 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9260 !!test
9261 Fuzz testing: Parser25 (bug 6055)
9262 !! input
9263 {{{
9264 |
9265 <LI CLASS=||
9266 >
9267 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9268 !! result
9269 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9270 </p>
9271 !! end
9272
9273 !!test
9274 Fuzz testing: URL adjacent extension (with space, clean)
9275 !! options
9276 !! input
9277 http://example.com <nowiki>junk</nowiki>
9278 !! result
9279 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9280 </p>
9281 !!end
9282
9283 !!test
9284 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9285 !! options
9286 !! input
9287 http://example.com<nowiki>junk</nowiki>
9288 !! result
9289 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9290 </p>
9291 !!end
9292
9293 !!test
9294 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9295 !! options
9296 !! input
9297 http://example.com<pre>junk</pre>
9298 !! result
9299 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9300
9301 !!end
9302
9303 !!test
9304 Fuzz testing: image with bogus manual thumbnail
9305 !!input
9306 [[Image:foobar.jpg|thumbnail= ]]
9307 !!result
9308 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9309
9310 !!end
9311
9312 !! test
9313 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9314 !! input
9315 <pre dir="&#10;"></pre>
9316 !! result
9317 <pre dir="&#10;"></pre>
9318
9319 !! end
9320
9321 !! test
9322 Parsing optional HTML elements (Bug 6171)
9323 !! options
9324 !! input
9325 <table>
9326 <tr>
9327 <td> Some tabular data</td>
9328 <td> More tabular data ...
9329 <td> And yet som tabular data</td>
9330 </tr>
9331 </table>
9332 !! result
9333 <table>
9334 <tr>
9335 <td> Some tabular data</td>
9336 <td> More tabular data ...
9337 </td><td> And yet som tabular data</td>
9338 </tr>
9339 </table>
9340
9341 !! end
9342
9343 !! test
9344 Correct handling of <td>, <tr> (Bug 6171)
9345 !! options
9346 !! input
9347 <table>
9348 <tr>
9349 <td> Some tabular data</td>
9350 <td> More tabular data ...</td>
9351 <td> And yet som tabular data</td>
9352 </tr>
9353 </table>
9354 !! result
9355 <table>
9356 <tr>
9357 <td> Some tabular data</td>
9358 <td> More tabular data ...</td>
9359 <td> And yet som tabular data</td>
9360 </tr>
9361 </table>
9362
9363 !! end
9364
9365
9366 !! test
9367 Parsing crashing regression (fr:JavaScript)
9368 !! input
9369 </body></x>
9370 !! result
9371 <p>&lt;/body&gt;&lt;/x&gt;
9372 </p>
9373 !! end
9374
9375 !! test
9376 Inline wiki vs wiki block nesting
9377 !! input
9378 '''Bold paragraph
9379
9380 New wiki paragraph
9381 !! result
9382 <p><b>Bold paragraph</b>
9383 </p><p>New wiki paragraph
9384 </p>
9385 !! end
9386
9387 !! test
9388 Inline HTML vs wiki block nesting
9389 !! options
9390 disabled
9391 !! input
9392 <b>Bold paragraph
9393
9394 New wiki paragraph
9395 !! result
9396 <p><b>Bold paragraph</b>
9397 </p><p>New wiki paragraph
9398 </p>
9399 !! end
9400
9401 # Original result was this:
9402 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9403 # </p>
9404 # While that might be marginally more intuitive, maybe, the six-apostrophe
9405 # construct is clearly pathological and the result stated here (which is what
9406 # the parser actually does) is about as reasonable as anything.
9407 !!test
9408 Mixing markup for italics and bold
9409 !! options
9410 !! input
9411 '''bold''''''bold''bolditalics'''''
9412 !! result
9413 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9414 </p>
9415 !! end
9416
9417
9418 !! article
9419 Xyzzyx
9420 !! text
9421 Article for special page transclusion test
9422 !! endarticle
9423
9424 !! test
9425 Special page transclusion
9426 !! options
9427 !! input
9428 {{Special:Prefixindex/Xyzzyx}}
9429 !! result
9430 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9431
9432 !! end
9433
9434 !! test
9435 Special page transclusion twice (bug 5021)
9436 !! options
9437 !! input
9438 {{Special:Prefixindex/Xyzzyx}}
9439 {{Special:Prefixindex/Xyzzyx}}
9440 !! result
9441 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9442 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9443
9444 !! end
9445
9446 !! test
9447 Transclusion of default MediaWiki message
9448 !! input
9449 {{MediaWiki:Mainpage}}
9450 !!result
9451 <p>Main Page
9452 </p>
9453 !! end
9454
9455 !! test
9456 Transclusion of nonexistent MediaWiki message
9457 !! input
9458 {{MediaWiki:Mainpagexxx}}
9459 !!result
9460 <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>
9461 </p>
9462 !! end
9463
9464 !! test
9465 Transclusion of MediaWiki message with underscore
9466 !! input
9467 {{MediaWiki:history_short}}
9468 !! result
9469 <p>History
9470 </p>
9471 !! end
9472
9473 !! test
9474 Transclusion of MediaWiki message with space
9475 !! input
9476 {{MediaWiki:history short}}
9477 !! result
9478 <p>History
9479 </p>
9480 !! end
9481
9482 !! test
9483 Invalid header with following text
9484 !! input
9485 = x = y
9486 !! result
9487 <p>= x = y
9488 </p>
9489 !! end
9490
9491
9492 !! test
9493 Section extraction test (section 0)
9494 !! options
9495 section=0
9496 !! input
9497 start
9498 ==a==
9499 ===aa===
9500 ====aaa====
9501 ==b==
9502 ===ba===
9503 ===bb===
9504 ====bba====
9505 ===bc===
9506 ==c==
9507 ===ca===
9508 !! result
9509 start
9510 !! end
9511
9512 !! test
9513 Section extraction test (section 1)
9514 !! options
9515 section=1
9516 !! input
9517 start
9518 ==a==
9519 ===aa===
9520 ====aaa====
9521 ==b==
9522 ===ba===
9523 ===bb===
9524 ====bba====
9525 ===bc===
9526 ==c==
9527 ===ca===
9528 !! result
9529 ==a==
9530 ===aa===
9531 ====aaa====
9532 !! end
9533
9534 !! test
9535 Section extraction test (section 2)
9536 !! options
9537 section=2
9538 !! input
9539 start
9540 ==a==
9541 ===aa===
9542 ====aaa====
9543 ==b==
9544 ===ba===
9545 ===bb===
9546 ====bba====
9547 ===bc===
9548 ==c==
9549 ===ca===
9550 !! result
9551 ===aa===
9552 ====aaa====
9553 !! end
9554
9555 !! test
9556 Section extraction test (section 3)
9557 !! options
9558 section=3
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 ====aaa====
9573 !! end
9574
9575 !! test
9576 Section extraction test (section 4)
9577 !! options
9578 section=4
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 ==b==
9593 ===ba===
9594 ===bb===
9595 ====bba====
9596 ===bc===
9597 !! end
9598
9599 !! test
9600 Section extraction test (section 5)
9601 !! options
9602 section=5
9603 !! input
9604 start
9605 ==a==
9606 ===aa===
9607 ====aaa====
9608 ==b==
9609 ===ba===
9610 ===bb===
9611 ====bba====
9612 ===bc===
9613 ==c==
9614 ===ca===
9615 !! result
9616 ===ba===
9617 !! end
9618
9619 !! test
9620 Section extraction test (section 6)
9621 !! options
9622 section=6
9623 !! input
9624 start
9625 ==a==
9626 ===aa===
9627 ====aaa====
9628 ==b==
9629 ===ba===
9630 ===bb===
9631 ====bba====
9632 ===bc===
9633 ==c==
9634 ===ca===
9635 !! result
9636 ===bb===
9637 ====bba====
9638 !! end
9639
9640 !! test
9641 Section extraction test (section 7)
9642 !! options
9643 section=7
9644 !! input
9645 start
9646 ==a==
9647 ===aa===
9648 ====aaa====
9649 ==b==
9650 ===ba===
9651 ===bb===
9652 ====bba====
9653 ===bc===
9654 ==c==
9655 ===ca===
9656 !! result
9657 ====bba====
9658 !! end
9659
9660 !! test
9661 Section extraction test (section 8)
9662 !! options
9663 section=8
9664 !! input
9665 start
9666 ==a==
9667 ===aa===
9668 ====aaa====
9669 ==b==
9670 ===ba===
9671 ===bb===
9672 ====bba====
9673 ===bc===
9674 ==c==
9675 ===ca===
9676 !! result
9677 ===bc===
9678 !! end
9679
9680 !! test
9681 Section extraction test (section 9)
9682 !! options
9683 section=9
9684 !! input
9685 start
9686 ==a==
9687 ===aa===
9688 ====aaa====
9689 ==b==
9690 ===ba===
9691 ===bb===
9692 ====bba====
9693 ===bc===
9694 ==c==
9695 ===ca===
9696 !! result
9697 ==c==
9698 ===ca===
9699 !! end
9700
9701 !! test
9702 Section extraction test (section 10)
9703 !! options
9704 section=10
9705 !! input
9706 start
9707 ==a==
9708 ===aa===
9709 ====aaa====
9710 ==b==
9711 ===ba===
9712 ===bb===
9713 ====bba====
9714 ===bc===
9715 ==c==
9716 ===ca===
9717 !! result
9718 ===ca===
9719 !! end
9720
9721 !! test
9722 Section extraction test (nonexistent section 11)
9723 !! options
9724 section=11
9725 !! input
9726 start
9727 ==a==
9728 ===aa===
9729 ====aaa====
9730 ==b==
9731 ===ba===
9732 ===bb===
9733 ====bba====
9734 ===bc===
9735 ==c==
9736 ===ca===
9737 !! result
9738 !! end
9739
9740 !! test
9741 Section extraction test with bogus heading (section 1)
9742 !! options
9743 section=1
9744 !! input
9745 ==a==
9746 ==bogus== not a legal section
9747 ==b==
9748 !! result
9749 ==a==
9750 ==bogus== not a legal section
9751 !! end
9752
9753 !! test
9754 Section extraction test with bogus heading (section 2)
9755 !! options
9756 section=2
9757 !! input
9758 ==a==
9759 ==bogus== not a legal section
9760 ==b==
9761 !! result
9762 ==b==
9763 !! end
9764
9765 !! test
9766 Section extraction test with comment after heading (section 1)
9767 !! options
9768 section=1
9769 !! input
9770 ==a==
9771 ==b== <!-- -->
9772 ==c==
9773 !! result
9774 ==a==
9775 !! end
9776
9777 !! test
9778 Section extraction test with comment after heading (section 2)
9779 !! options
9780 section=2
9781 !! input
9782 ==a==
9783 ==b== <!-- -->
9784 ==c==
9785 !! result
9786 ==b== <!-- -->
9787 !! end
9788
9789 !! test
9790 Section extraction test with bogus <nowiki> heading (section 1)
9791 !! options
9792 section=1
9793 !! input
9794 ==a==
9795 ==bogus== <nowiki>not a legal section</nowiki>
9796 ==b==
9797 !! result
9798 ==a==
9799 ==bogus== <nowiki>not a legal section</nowiki>
9800 !! end
9801
9802 !! test
9803 Section extraction test with bogus <nowiki> heading (section 2)
9804 !! options
9805 section=2
9806 !! input
9807 ==a==
9808 ==bogus== <nowiki>not a legal section</nowiki>
9809 ==b==
9810 !! result
9811 ==b==
9812 !! end
9813
9814
9815 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9816 # instead of respecting commented sections
9817 !! test
9818 Section extraction prefixed by comment (section 1)
9819 !! options
9820 section=1
9821 !! input
9822 <!-- -->==sec1==
9823 ==sec2==
9824 !!result
9825 ==sec2==
9826 !!end
9827
9828 !! test
9829 Section extraction prefixed by comment (section 2)
9830 !! options
9831 section=2
9832 !! input
9833 <!-- -->==sec1==
9834 ==sec2==
9835 !!result
9836
9837 !!end
9838
9839
9840 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9841 # instead of respecting HTML-style headings
9842 !! test
9843 Section extraction, mixed wiki and html (section 1)
9844 !! options
9845 section=1
9846 !! input
9847 <h2>unmarked</h2>
9848 unmarked
9849 ==1==
9850 one
9851 ==2==
9852 two
9853 !! result
9854 ==1==
9855 one
9856 !! end
9857
9858 !! test
9859 Section extraction, mixed wiki and html (section 2)
9860 !! options
9861 section=2
9862 !! input
9863 <h2>unmarked</h2>
9864 unmarked
9865 ==1==
9866 one
9867 ==2==
9868 two
9869 !! result
9870 ==2==
9871 two
9872 !! end
9873
9874
9875 # Formerly testing for bug 3342
9876 !! test
9877 Section extraction, heading surrounded by <noinclude>
9878 !! options
9879 section=1
9880 !! input
9881 <noinclude>==unmarked==</noinclude>
9882 ==marked==
9883 !! result
9884 ==marked==
9885 !!end
9886
9887 # Test behavior of bug 19910
9888 !! test
9889 Sectiion with all-equals
9890 !! options
9891 section=2
9892 !! input
9893 ===
9894 The line above must have a trailing space
9895 === <!--
9896 --> <!-- -->
9897 But just in case it doesn't...
9898 !! result
9899 === <!--
9900 --> <!-- -->
9901 But just in case it doesn't...
9902 !! end
9903
9904 !! test
9905 Section replacement test (section 0)
9906 !! options
9907 replace=0,"xxx"
9908 !! input
9909 start
9910 ==a==
9911 ===aa===
9912 ====aaa====
9913 ==b==
9914 ===ba===
9915 ===bb===
9916 ====bba====
9917 ===bc===
9918 ==c==
9919 ===ca===
9920 !! result
9921 xxx
9922
9923 ==a==
9924 ===aa===
9925 ====aaa====
9926 ==b==
9927 ===ba===
9928 ===bb===
9929 ====bba====
9930 ===bc===
9931 ==c==
9932 ===ca===
9933 !! end
9934
9935 !! test
9936 Section replacement test (section 1)
9937 !! options
9938 replace=1,"xxx"
9939 !! input
9940 start
9941 ==a==
9942 ===aa===
9943 ====aaa====
9944 ==b==
9945 ===ba===
9946 ===bb===
9947 ====bba====
9948 ===bc===
9949 ==c==
9950 ===ca===
9951 !! result
9952 start
9953 xxx
9954
9955 ==b==
9956 ===ba===
9957 ===bb===
9958 ====bba====
9959 ===bc===
9960 ==c==
9961 ===ca===
9962 !! end
9963
9964 !! test
9965 Section replacement test (section 2)
9966 !! options
9967 replace=2,"xxx"
9968 !! input
9969 start
9970 ==a==
9971 ===aa===
9972 ====aaa====
9973 ==b==
9974 ===ba===
9975 ===bb===
9976 ====bba====
9977 ===bc===
9978 ==c==
9979 ===ca===
9980 !! result
9981 start
9982 ==a==
9983 xxx
9984
9985 ==b==
9986 ===ba===
9987 ===bb===
9988 ====bba====
9989 ===bc===
9990 ==c==
9991 ===ca===
9992 !! end
9993
9994 !! test
9995 Section replacement test (section 3)
9996 !! options
9997 replace=3,"xxx"
9998 !! input
9999 start
10000 ==a==
10001 ===aa===
10002 ====aaa====
10003 ==b==
10004 ===ba===
10005 ===bb===
10006 ====bba====
10007 ===bc===
10008 ==c==
10009 ===ca===
10010 !! result
10011 start
10012 ==a==
10013 ===aa===
10014 xxx
10015
10016 ==b==
10017 ===ba===
10018 ===bb===
10019 ====bba====
10020 ===bc===
10021 ==c==
10022 ===ca===
10023 !! end
10024
10025 !! test
10026 Section replacement test (section 4)
10027 !! options
10028 replace=4,"xxx"
10029 !! input
10030 start
10031 ==a==
10032 ===aa===
10033 ====aaa====
10034 ==b==
10035 ===ba===
10036 ===bb===
10037 ====bba====
10038 ===bc===
10039 ==c==
10040 ===ca===
10041 !! result
10042 start
10043 ==a==
10044 ===aa===
10045 ====aaa====
10046 xxx
10047
10048 ==c==
10049 ===ca===
10050 !! end
10051
10052 !! test
10053 Section replacement test (section 5)
10054 !! options
10055 replace=5,"xxx"
10056 !! input
10057 start
10058 ==a==
10059 ===aa===
10060 ====aaa====
10061 ==b==
10062 ===ba===
10063 ===bb===
10064 ====bba====
10065 ===bc===
10066 ==c==
10067 ===ca===
10068 !! result
10069 start
10070 ==a==
10071 ===aa===
10072 ====aaa====
10073 ==b==
10074 xxx
10075
10076 ===bb===
10077 ====bba====
10078 ===bc===
10079 ==c==
10080 ===ca===
10081 !! end
10082
10083 !! test
10084 Section replacement test (section 6)
10085 !! options
10086 replace=6,"xxx"
10087 !! input
10088 start
10089 ==a==
10090 ===aa===
10091 ====aaa====
10092 ==b==
10093 ===ba===
10094 ===bb===
10095 ====bba====
10096 ===bc===
10097 ==c==
10098 ===ca===
10099 !! result
10100 start
10101 ==a==
10102 ===aa===
10103 ====aaa====
10104 ==b==
10105 ===ba===
10106 xxx
10107
10108 ===bc===
10109 ==c==
10110 ===ca===
10111 !! end
10112
10113 !! test
10114 Section replacement test (section 7)
10115 !! options
10116 replace=7,"xxx"
10117 !! input
10118 start
10119 ==a==
10120 ===aa===
10121 ====aaa====
10122 ==b==
10123 ===ba===
10124 ===bb===
10125 ====bba====
10126 ===bc===
10127 ==c==
10128 ===ca===
10129 !! result
10130 start
10131 ==a==
10132 ===aa===
10133 ====aaa====
10134 ==b==
10135 ===ba===
10136 ===bb===
10137 xxx
10138
10139 ===bc===
10140 ==c==
10141 ===ca===
10142 !! end
10143
10144 !! test
10145 Section replacement test (section 8)
10146 !! options
10147 replace=8,"xxx"
10148 !! input
10149 start
10150 ==a==
10151 ===aa===
10152 ====aaa====
10153 ==b==
10154 ===ba===
10155 ===bb===
10156 ====bba====
10157 ===bc===
10158 ==c==
10159 ===ca===
10160 !! result
10161 start
10162 ==a==
10163 ===aa===
10164 ====aaa====
10165 ==b==
10166 ===ba===
10167 ===bb===
10168 ====bba====
10169 xxx
10170
10171 ==c==
10172 ===ca===
10173 !!end
10174
10175 !! test
10176 Section replacement test (section 9)
10177 !! options
10178 replace=9,"xxx"
10179 !! input
10180 start
10181 ==a==
10182 ===aa===
10183 ====aaa====
10184 ==b==
10185 ===ba===
10186 ===bb===
10187 ====bba====
10188 ===bc===
10189 ==c==
10190 ===ca===
10191 !! result
10192 start
10193 ==a==
10194 ===aa===
10195 ====aaa====
10196 ==b==
10197 ===ba===
10198 ===bb===
10199 ====bba====
10200 ===bc===
10201 xxx
10202 !! end
10203
10204 !! test
10205 Section replacement test (section 10)
10206 !! options
10207 replace=10,"xxx"
10208 !! input
10209 start
10210 ==a==
10211 ===aa===
10212 ====aaa====
10213 ==b==
10214 ===ba===
10215 ===bb===
10216 ====bba====
10217 ===bc===
10218 ==c==
10219 ===ca===
10220 !! result
10221 start
10222 ==a==
10223 ===aa===
10224 ====aaa====
10225 ==b==
10226 ===ba===
10227 ===bb===
10228 ====bba====
10229 ===bc===
10230 ==c==
10231 xxx
10232 !! end
10233
10234 !! test
10235 Section replacement test with initial whitespace (bug 13728)
10236 !! options
10237 replace=2,"xxx"
10238 !! input
10239 Preformatted initial line
10240 ==a==
10241 ===a===
10242 !! result
10243 Preformatted initial line
10244 ==a==
10245 xxx
10246 !! end
10247
10248
10249 !! test
10250 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10251 !! options
10252 section=1
10253 !! input
10254 ==a==
10255 a
10256 !! result
10257 ==a==
10258 a
10259 !! end
10260
10261 !! test
10262 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10263 !! options
10264 section=1
10265 !! input
10266 ==a==
10267 a
10268 !! result
10269 ==a==
10270 a
10271 !! end
10272
10273
10274 !! test
10275 Section extraction, <pre> around bogus header (bug 10309)
10276 !! options
10277 noxml section=2
10278 !! input
10279 == Section One ==
10280 <pre>
10281 =======
10282 </pre>
10283
10284 == Section Two ==
10285 stuff
10286 !! result
10287 == Section Two ==
10288 stuff
10289 !! end
10290
10291 !! test
10292 Section replacement, <pre> around bogus header (bug 10309)
10293 !! options
10294 noxml replace=2,"xxx"
10295 !! input
10296 == Section One ==
10297 <pre>
10298 =======
10299 </pre>
10300
10301 == Section Two ==
10302 stuff
10303 !! result
10304 == Section One ==
10305 <pre>
10306 =======
10307 </pre>
10308
10309 xxx
10310 !! end
10311
10312
10313
10314 !! test
10315 Handling of &#x0A; in URLs
10316 !! input
10317 **irc://&#x0A;a
10318 !! result
10319 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10320 </li></ul>
10321 </li></ul>
10322
10323 !!end
10324
10325 !! test
10326 5 quotes, code coverage +1 line
10327 !! input
10328 '''''
10329 !! result
10330 !! end
10331
10332 !! test
10333 Special:Search page linking.
10334 !! input
10335 {{Special:search}}
10336 !! result
10337 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10338 </p>
10339 !! end
10340
10341 !! test
10342 Say the magic word
10343 !! input
10344 * {{PAGENAME}}
10345 * {{BASEPAGENAME}}
10346 * {{SUBPAGENAME}}
10347 * {{SUBPAGENAMEE}}
10348 * {{BASEPAGENAME}}
10349 * {{BASEPAGENAMEE}}
10350 * {{TALKPAGENAME}}
10351 * {{TALKPAGENAMEE}}
10352 * {{SUBJECTPAGENAME}}
10353 * {{SUBJECTPAGENAMEE}}
10354 * {{NAMESPACEE}}
10355 * {{NAMESPACE}}
10356 * {{TALKSPACE}}
10357 * {{TALKSPACEE}}
10358 * {{SUBJECTSPACE}}
10359 * {{SUBJECTSPACEE}}
10360 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10361 !! result
10362 <ul><li> Parser test
10363 </li><li> Parser test
10364 </li><li> Parser test
10365 </li><li> Parser_test
10366 </li><li> Parser test
10367 </li><li> Parser_test
10368 </li><li> Talk:Parser test
10369 </li><li> Talk:Parser_test
10370 </li><li> Parser test
10371 </li><li> Parser_test
10372 </li><li>
10373 </li><li>
10374 </li><li> Talk
10375 </li><li> Talk
10376 </li><li>
10377 </li><li>
10378 </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>
10379 </li></ul>
10380
10381 !! end
10382 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10383
10384 !! test
10385 Gallery
10386 !! input
10387 <gallery>
10388 image1.png |
10389 image2.gif|||||
10390
10391 image3|
10392 image4 |300px| centre
10393 image5.svg| http://///////
10394 [[x|xx]]]]
10395 * image6
10396 </gallery>
10397 !! result
10398 <ul class="gallery">
10399 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10400 <div style="height: 150px;">Image1.png</div>
10401 <div class="gallerytext">
10402 </div>
10403 </div></li>
10404 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10405 <div style="height: 150px;">Image2.gif</div>
10406 <div class="gallerytext">
10407 <p>||||
10408 </p>
10409 </div>
10410 </div></li>
10411 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10412 <div style="height: 150px;">Image3</div>
10413 <div class="gallerytext">
10414 </div>
10415 </div></li>
10416 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10417 <div style="height: 150px;">Image4</div>
10418 <div class="gallerytext">
10419 <p>300px| centre
10420 </p>
10421 </div>
10422 </div></li>
10423 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10424 <div style="height: 150px;">Image5.svg</div>
10425 <div class="gallerytext">
10426 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10427 </p>
10428 </div>
10429 </div></li>
10430 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10431 <div style="height: 150px;">* image6</div>
10432 <div class="gallerytext">
10433 </div>
10434 </div></li>
10435 </ul>
10436
10437 !! end
10438
10439 !! test
10440 Gallery (with options)
10441 !! input
10442 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10443 File:Nonexistant.jpg|caption
10444 File:Nonexistant.jpg
10445 image:foobar.jpg|some '''caption''' [[Main Page]]
10446 image:foobar.jpg
10447 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10448 </gallery>
10449 !! result
10450 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10451 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10452 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10453 <div style="height: 70px;">Nonexistant.jpg</div>
10454 <div class="gallerytext">
10455 <p>caption
10456 </p>
10457 </div>
10458 </div></li>
10459 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10460 <div style="height: 70px;">Nonexistant.jpg</div>
10461 <div class="gallerytext">
10462 </div>
10463 </div></li>
10464 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10465 <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>
10466 <div class="gallerytext">
10467 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10468 </p>
10469 </div>
10470 </div></li>
10471 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10472 <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>
10473 <div class="gallerytext">
10474 </div>
10475 </div></li>
10476 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10477 <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>
10478 <div class="gallerytext">
10479 <p>Blabla|blabla.
10480 </p>
10481 </div>
10482 </div></li>
10483 </ul>
10484
10485 !! end
10486
10487 !! test
10488 Gallery with wikitext inside caption
10489 !! input
10490 <gallery>
10491 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10492 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10493 </gallery>
10494 !! result
10495 <ul class="gallery">
10496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10497 <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>
10498 <div class="gallerytext">
10499 <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>
10500 </p>
10501 </div>
10502 </div></li>
10503 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10504 <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>
10505 <div class="gallerytext">
10506 <p>This is a test template
10507 </p>
10508 </div>
10509 </div></li>
10510 </ul>
10511
10512 !! end
10513
10514 !! test
10515 gallery (with showfilename option)
10516 !! input
10517 <gallery showfilename>
10518 File:Nonexistant.jpg|caption
10519 File:Nonexistant.jpg
10520 image:foobar.jpg|some '''caption''' [[Main Page]]
10521 File:Foobar.jpg
10522 </gallery>
10523 !! result
10524 <ul class="gallery">
10525 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10526 <div style="height: 150px;">Nonexistant.jpg</div>
10527 <div class="gallerytext">
10528 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10529 caption
10530 </p>
10531 </div>
10532 </div></li>
10533 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10534 <div style="height: 150px;">Nonexistant.jpg</div>
10535 <div class="gallerytext">
10536 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10537 </p>
10538 </div>
10539 </div></li>
10540 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10541 <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>
10542 <div class="gallerytext">
10543 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10544 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10545 </p>
10546 </div>
10547 </div></li>
10548 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10549 <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>
10550 <div class="gallerytext">
10551 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10552 </p>
10553 </div>
10554 </div></li>
10555 </ul>
10556
10557 !! end
10558
10559 !! test
10560 Gallery (with namespace-less filenames)
10561 !! input
10562 <gallery>
10563 File:Nonexistant.jpg
10564 Nonexistant.jpg
10565 image:foobar.jpg
10566 foobar.jpg
10567 </gallery>
10568 !! result
10569 <ul class="gallery">
10570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10571 <div style="height: 150px;">Nonexistant.jpg</div>
10572 <div class="gallerytext">
10573 </div>
10574 </div></li>
10575 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10576 <div style="height: 150px;">Nonexistant.jpg</div>
10577 <div class="gallerytext">
10578 </div>
10579 </div></li>
10580 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10581 <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>
10582 <div class="gallerytext">
10583 </div>
10584 </div></li>
10585 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10586 <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>
10587 <div class="gallerytext">
10588 </div>
10589 </div></li>
10590 </ul>
10591
10592 !! end
10593
10594 !! test
10595 HTML Hex character encoding (spells the word "JavaScript")
10596 !! input
10597 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10598 !! result
10599 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10600 </p>
10601 !! end
10602
10603 !! test
10604 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10605 !! input
10606 &#xsee;&#XSEE;
10607 !! result
10608 <p>&amp;#xsee;&amp;#XSEE;
10609 </p>
10610 !! end
10611
10612 !! test
10613 HTML Hex character encoding mixed case
10614 !! input
10615 &#xEE;&#Xee;
10616 !! result
10617 <p>&#xee;&#xee;
10618 </p>
10619 !! end
10620
10621 !! test
10622 __FORCETOC__ override
10623 !! input
10624 __NEWSECTIONLINK__
10625 __FORCETOC__
10626 !! result
10627 <p><br />
10628 </p>
10629 !! end
10630
10631 !! test
10632 ISBN code coverage
10633 !! input
10634 ISBN 978-0-1234-56&#x20;789
10635 !! result
10636 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10637 </p>
10638 !! end
10639
10640 !! test
10641 ISBN followed by 5 spaces
10642 !! input
10643 ISBN
10644 !! result
10645 <p>ISBN
10646 </p>
10647 !! end
10648
10649 !! test
10650 Double ISBN
10651 !! input
10652 ISBN ISBN 1234567890
10653 !! result
10654 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10655 </p>
10656 !! end
10657
10658 !! test
10659 Bug 22905: <abbr> followed by ISBN followed by </a>
10660 !! input
10661 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10662 !! result
10663 <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>
10664 </p>
10665 !! end
10666
10667 !! test
10668 Double RFC
10669 !! input
10670 RFC RFC 1234
10671 !! result
10672 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10673 </p>
10674 !! end
10675
10676 !! test
10677 Double RFC with a wiki link
10678 !! input
10679 RFC [[RFC 1234]]
10680 !! result
10681 <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>
10682 </p>
10683 !! end
10684
10685 !! test
10686 RFC code coverage
10687 !! input
10688 RFC 983&#x20;987
10689 !! result
10690 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10691 </p>
10692 !! end
10693
10694 !! test
10695 Centre-aligned image
10696 !! input
10697 [[Image:foobar.jpg|centre]]
10698 !! result
10699 <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>
10700
10701 !!end
10702
10703 !! test
10704 None-aligned image
10705 !! input
10706 [[Image:foobar.jpg|none]]
10707 !! result
10708 <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>
10709
10710 !!end
10711
10712 !! test
10713 Width + Height sized image (using px) (height is ignored)
10714 !! input
10715 [[Image:foobar.jpg|640x480px]]
10716 !! result
10717 <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>
10718 </p>
10719 !!end
10720
10721 !! test
10722 Width-sized image (using px, no following whitespace)
10723 !! input
10724 [[Image:foobar.jpg|640px]]
10725 !! result
10726 <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>
10727 </p>
10728 !!end
10729
10730 !! test
10731 Width-sized image (using px, with following whitespace - test regression from r39467)
10732 !! input
10733 [[Image:foobar.jpg|640px ]]
10734 !! result
10735 <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>
10736 </p>
10737 !!end
10738
10739 !! test
10740 Width-sized image (using px, with preceding whitespace - test regression from r39467)
10741 !! input
10742 [[Image:foobar.jpg| 640px]]
10743 !! result
10744 <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>
10745 </p>
10746 !!end
10747
10748 !! test
10749 Another italics / bold test
10750 !! input
10751 ''' ''x'
10752 !! result
10753 <pre>'<i> </i>x'
10754 </pre>
10755 !!end
10756
10757 # Note the results may be incorrect, as parserTest output included this:
10758 # XML error: Mismatched tag at byte 6120:
10759 # ...<dd> </dt></dl> </dd...
10760 !! test
10761 dt/dd/dl test
10762 !! options
10763 disabled
10764 !! input
10765 :;;;::
10766 !! result
10767 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10768 </dd></dl>
10769 </dd></dl>
10770 </dt></dl>
10771 </dt></dl>
10772 </dt></dl>
10773 </dd></dl>
10774
10775 !!end
10776
10777
10778 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10779 !! test
10780 Images with the "|" character in the comment
10781 !! input
10782 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10783 !! result
10784 <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>
10785
10786 !!end
10787
10788 !! test
10789 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10790 !! input
10791 <html><script>alert(1);</script></html>
10792 !! result
10793 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10794 </p>
10795 !! end
10796
10797 !! test
10798 HTML with raw HTML ($wgRawHtml==true)
10799 !! options
10800 rawhtml
10801 !! input
10802 <html><script>alert(1);</script></html>
10803 !! result
10804 <p><script>alert(1);</script>
10805 </p>
10806 !! end
10807
10808 !! test
10809 Parents of subpages, one level up
10810 !! options
10811 subpage title=[[Subpage test/L1/L2/L3]]
10812 !! input
10813 [[../|L2]]
10814 !! result
10815 <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>
10816 </p>
10817 !! end
10818
10819
10820 !! test
10821 Parents of subpages, one level up, not named
10822 !! options
10823 subpage title=[[Subpage test/L1/L2/L3]]
10824 !! input
10825 [[../]]
10826 !! result
10827 <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>
10828 </p>
10829 !! end
10830
10831
10832
10833 !! test
10834 Parents of subpages, two levels up
10835 !! options
10836 subpage title=[[Subpage test/L1/L2/L3]]
10837 !! input
10838 [[../../|L1]]2
10839
10840 [[../../|L1]]l
10841 !! result
10842 <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
10843 </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>
10844 </p>
10845 !! end
10846
10847 !! test
10848 Parents of subpages, two levels up, without trailing slash or name.
10849 !! options
10850 subpage title=[[Subpage test/L1/L2/L3]]
10851 !! input
10852 [[../..]]
10853 !! result
10854 <p>[[../..]]
10855 </p>
10856 !! end
10857
10858 !! test
10859 Parents of subpages, two levels up, with lots of extra trailing slashes.
10860 !! options
10861 subpage title=[[Subpage test/L1/L2/L3]]
10862 !! input
10863 [[../../////]]
10864 !! result
10865 <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>
10866 </p>
10867 !! end
10868
10869 !! test
10870 Definition list code coverage
10871 !! input
10872 ; title : def
10873 ; title : def
10874 ;title: def
10875 !! result
10876 <dl><dt> title &#160;</dt><dd> def
10877 </dd><dt> title&#160;</dt><dd> def
10878 </dd><dt>title</dt><dd> def
10879 </dd></dl>
10880
10881 !! end
10882
10883 !! test
10884 Don't fall for the self-closing div
10885 !! input
10886 <div>hello world</div/>
10887 !! result
10888 <div>hello world</div>
10889
10890 !! end
10891
10892 !! test
10893 MSGNW magic word
10894 !! input
10895 {{MSGNW:msg}}
10896 !! result
10897 <p>&#91;&#91;:Template:Msg&#93;&#93;
10898 </p>
10899 !! end
10900
10901 !! test
10902 RAW magic word
10903 !! input
10904 {{RAW:QUERTY}}
10905 !! result
10906 <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>
10907 </p>
10908 !! end
10909
10910 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10911 !! test
10912 Always escape literal '>' in output, not just after '<'
10913 !! input
10914 ><>
10915 !! result
10916 <p>&gt;&lt;&gt;
10917 </p>
10918 !! end
10919
10920 !! test
10921 Template caching
10922 !! input
10923 {{Test}}
10924 {{Test}}
10925 !! result
10926 <p>This is a test template
10927 This is a test template
10928 </p>
10929 !! end
10930
10931
10932 !! article
10933 MediaWiki:Fake
10934 !! text
10935 ==header==
10936 !! endarticle
10937
10938 !! test
10939 Inclusion of !userCanEdit() content
10940 !! input
10941 {{MediaWiki:Fake}}
10942 !! result
10943 <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>
10944
10945 !! end
10946
10947
10948 !! test
10949 Out-of-order TOC heading levels
10950 !! input
10951 ==2==
10952 ======6======
10953 ===3===
10954 =1=
10955 =====5=====
10956 ==2==
10957 !! result
10958 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10959 <ul>
10960 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10961 <ul>
10962 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10963 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10964 </ul>
10965 </li>
10966 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10967 <ul>
10968 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10969 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10970 </ul>
10971 </li>
10972 </ul>
10973 </td></tr></table>
10974 <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>
10975 <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>
10976 <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>
10977 <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>
10978 <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>
10979 <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>
10980
10981 !! end
10982
10983
10984 !! test
10985 ISBN with a dummy number
10986 !! input
10987 ISBN ---
10988 !! result
10989 <p>ISBN ---
10990 </p>
10991 !! end
10992
10993
10994 !! test
10995 ISBN with space-delimited number
10996 !! input
10997 ISBN 92 9017 032 8
10998 !! result
10999 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11000 </p>
11001 !! end
11002
11003
11004 !! test
11005 ISBN with multiple spaces, no number
11006 !! input
11007 ISBN foo
11008 !! result
11009 <p>ISBN foo
11010 </p>
11011 !! end
11012
11013
11014 !! test
11015 ISBN length
11016 !! input
11017 ISBN 123456789
11018
11019 ISBN 1234567890
11020
11021 ISBN 12345678901
11022 !! result
11023 <p>ISBN 123456789
11024 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11025 </p><p>ISBN 12345678901
11026 </p>
11027 !! end
11028
11029
11030 !! test
11031 ISBN with trailing year (bug 8110)
11032 !! input
11033 ISBN 1-234-56789-0 - 2006
11034
11035 ISBN 1 234 56789 0 - 2006
11036 !! result
11037 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11038 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11039 </p>
11040 !! end
11041
11042
11043 !! test
11044 anchorencode
11045 !! input
11046 {{anchorencode:foo bar©#%n}}
11047 !! result
11048 <p>foo_bar.C2.A9.23.25n
11049 </p>
11050 !! end
11051
11052 !! test
11053 anchorencode trims spaces
11054 !! input
11055 {{anchorencode: __pretty__please__}}
11056 !! result
11057 <p>pretty_please
11058 </p>
11059 !! end
11060
11061 !! test
11062 anchorencode deals with links
11063 !! input
11064 {{anchorencode: [[hello|world]] [[hi]]}}
11065 !! result
11066 <p>world_hi
11067 </p>
11068 !! end
11069
11070 !! test
11071 anchorencode deals with templates
11072 !! input
11073 {{anchorencode: {{Foo}} }}
11074 !! result
11075 <p>FOO
11076 </p>
11077 !! end
11078
11079 !! test
11080 anchorencode encodes like the TOC generator: (bug 18431)
11081 !! input
11082 === _ +:.3A%3A&&amp;]] ===
11083 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11084 __NOEDITSECTION__
11085 !! result
11086 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
11087 <p>.2B:.3A.253A.26.26.5D.5D
11088 </p>
11089 !! end
11090
11091 # Expected output in the following test is not necessarily expected (there
11092 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11093 # only testing for well-formedness.
11094 !! test
11095 Bug 6200: blockquotes and paragraph formatting
11096 !! input
11097 <blockquote>
11098 foo
11099 </blockquote>
11100
11101 bar
11102
11103 baz
11104 !! result
11105 <blockquote>
11106 foo
11107 </blockquote>
11108 <p>bar
11109 </p>
11110 <pre>baz
11111 </pre>
11112 !! end
11113
11114 !! test
11115 Bug 8293: Use of center tag ruins paragraph formatting
11116 !! input
11117 <center>
11118 foo
11119 </center>
11120
11121 bar
11122
11123 baz
11124 !! result
11125 <center>
11126 <p>foo
11127 </p>
11128 </center>
11129 <p>bar
11130 </p>
11131 <pre>baz
11132 </pre>
11133 !! end
11134
11135
11136 ###
11137 ### Language variants related tests
11138 ###
11139 !! test
11140 Self-link in language variants
11141 !! options
11142 title=[[Dunav]] language=sr
11143 !! input
11144 Both [[Dunav]] and [[Дунав]] are names for this river.
11145 !! result
11146 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11147 </p>
11148 !!end
11149
11150 !! article
11151 Дуна
11152 !! text
11153 content
11154 !! endarticle
11155
11156 !! test
11157 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11158 !! options
11159 title=[[Duna]] language=sr
11160 !! input
11161 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11162 !! result
11163 <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.
11164 </p>
11165 !! end
11166
11167 !! test
11168 Link to pages in language variants
11169 !! options
11170 language=sr
11171 !! input
11172 Main Page can be written as [[Маин Паге]]
11173 !! result
11174 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11175 </p>
11176 !!end
11177
11178
11179 !! test
11180 Multiple links to pages in language variants
11181 !! options
11182 language=sr
11183 !! input
11184 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11185 !! result
11186 <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>.
11187 </p>
11188 !!end
11189
11190
11191 !! test
11192 Simple template in language variants
11193 !! options
11194 language=sr
11195 !! input
11196 {{тест}}
11197 !! result
11198 <p>This is a test template
11199 </p>
11200 !! end
11201
11202
11203 !! test
11204 Template with explicit namespace in language variants
11205 !! options
11206 language=sr
11207 !! input
11208 {{Template:тест}}
11209 !! result
11210 <p>This is a test template
11211 </p>
11212 !! end
11213
11214
11215 !! test
11216 Basic test for template parameter in language variants
11217 !! options
11218 language=sr
11219 !! input
11220 {{парамтест|param=foo}}
11221 !! result
11222 <p>This is a test template with parameter foo
11223 </p>
11224 !! end
11225
11226
11227 !! test
11228 Simple category in language variants
11229 !! options
11230 language=sr cat
11231 !! input
11232 [[Category:МедиаWики Усер'с Гуиде]]
11233 !! result
11234 <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>
11235 !! end
11236
11237
11238 !! article
11239 Category:分类
11240 !! text
11241 blah
11242 !! endarticle
11243
11244 !! article
11245 Category:分類
11246 !! text
11247 blah
11248 !! endarticle
11249
11250 !! test
11251 Don't convert blue categorylinks to another variant (bug 33210)
11252 !! options
11253 language=zh cat
11254 !! input
11255 [[A]][[Category:分类]]
11256 !! result
11257 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11258 !! end
11259
11260
11261 !! test
11262 Stripping -{}- tags (language variants)
11263 !! options
11264 language=sr
11265 !! input
11266 Latin proverb: -{Ne nuntium necare}-
11267 !! result
11268 <p>Latin proverb: Ne nuntium necare
11269 </p>
11270 !! end
11271
11272
11273 !! test
11274 Prevent conversion with -{}- tags (language variants)
11275 !! options
11276 language=sr variant=sr-ec
11277 !! input
11278 Latinski: -{Ne nuntium necare}-
11279 !! result
11280 <p>Латински: Ne nuntium necare
11281 </p>
11282 !! end
11283
11284
11285 !! test
11286 Prevent conversion of text with -{}- tags (language variants)
11287 !! options
11288 language=sr variant=sr-ec
11289 !! input
11290 Latinski: -{Ne nuntium necare}-
11291 !! result
11292 <p>Латински: Ne nuntium necare
11293 </p>
11294 !! end
11295
11296
11297 !! test
11298 Prevent conversion of links with -{}- tags (language variants)
11299 !! options
11300 language=sr variant=sr-ec
11301 !! input
11302 -{[[Main Page]]}-
11303 !! result
11304 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11305 </p>
11306 !! end
11307
11308
11309 !! test
11310 -{}- tags within headlines (within html for parserConvert())
11311 !! options
11312 language=sr variant=sr-ec
11313 !! input
11314 == -{Naslov}- ==
11315 !! result
11316 <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>
11317
11318 !! end
11319
11320
11321 !! test
11322 Explicit definition of language variant alternatives
11323 !! options
11324 language=zh variant=zh-tw
11325 !! input
11326 -{zh:China;zh-tw:Taiwan}-, not China
11327 !! result
11328 <p>Taiwan, not China
11329 </p>
11330 !! end
11331
11332
11333 !! test
11334 Conversion around HTML tags
11335 !! options
11336 language=sr variant=sr-ec
11337 !! input
11338 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11339 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11340 !! result
11341 <p>
11342 <span title="ЛаCтин">ски</span>
11343 </p>
11344 !! end
11345
11346
11347 !! test
11348 Explicit session-wise language variant mapping (A flag and - flag)
11349 !! options
11350 language=zh variant=zh-tw
11351 !! input
11352 Taiwan is not China.
11353 But -{A|zh:China;zh-tw:Taiwan}- is China,
11354 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11355 and -{China}- is China.
11356 !! result
11357 <p>Taiwan is not China.
11358 But Taiwan is Taiwan,
11359 (This should be stripped!)
11360 and China is China.
11361 </p>
11362 !! end
11363
11364 !! test
11365 Explicit session-wise language variant mapping (H flag for hide)
11366 !! options
11367 language=zh variant=zh-tw
11368 !! input
11369 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11370 Taiwan is China.
11371 !! result
11372 <p>(This should be stripped!)
11373 Taiwan is Taiwan.
11374 </p>
11375 !! end
11376
11377 !! test
11378 Adding explicit conversion rule for title (T flag)
11379 !! options
11380 language=zh variant=zh-tw showtitle
11381 !! input
11382 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11383 !! result
11384 Taiwan
11385 <p>Should be stripped!
11386 </p>
11387 !! end
11388
11389 !! test
11390 Testing that changing the language variant here in the tests actually works
11391 !! options
11392 language=zh variant=zh showtitle
11393 !! input
11394 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11395 !! result
11396 China
11397 <p>Should be stripped!
11398 </p>
11399 !! end
11400
11401 !! test
11402 Recursive conversion of alt and title attrs shouldn't clear converter state
11403 !! options
11404 language=zh variant=zh-cn showtitle
11405 !! input
11406 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11407 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11408 !! result
11409 China
11410 <p>
11411 Should be stripped<span title="Exclamation">!</span>
11412 </p>
11413 !! end
11414
11415 !! test
11416 Bug 24072: more test on conversion rule for title
11417 !! options
11418 language=zh variant=zh-tw showtitle
11419 !! input
11420 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11421 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11422 !! result
11423 Taiwan
11424 <p>This should be stripped!
11425 This won't take interferes with the title rule.
11426 </p>
11427 !! end
11428
11429 !! test
11430 Raw output of variant escape tags (R flag)
11431 !! options
11432 language=zh variant=zh-tw
11433 !! input
11434 Raw: -{R|zh:China;zh-tw:Taiwan}-
11435 !! result
11436 <p>Raw: zh:China;zh-tw:Taiwan
11437 </p>
11438 !! end
11439
11440 !! test
11441 Nested using of manual convert syntax
11442 !! options
11443 language=zh variant=zh-hk
11444 !! input
11445 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11446 !! result
11447 <p>Nested: Hello Hong Kong!
11448 </p>
11449 !! end
11450
11451 !! test
11452 Proper conversion of text in external links
11453 !! options
11454 language=sr variant=sr-ec
11455 !! input
11456 http://www.google.com
11457 gopher://www.google.com
11458 [http://www.google.com http://www.google.com]
11459 [gopher://www.google.com gopher://www.google.com]
11460 [https://www.google.com irc://www.google.com]
11461 [ftp://www.google.com www.google.com/ftp://dir]
11462 [//www.google.com www.google.com]
11463 !! result
11464 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11465 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11466 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11467 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11468 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11469 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11470 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11471 </p>
11472 !! end
11473
11474 !! test
11475 Do not convert roman numbers to language variants
11476 !! options
11477 language=sr variant=sr-ec
11478 !! input
11479 Fridrih IV je car.
11480 !! result
11481 <p>Фридрих IV је цар.
11482 </p>
11483 !! end
11484
11485 !! test
11486 Unclosed language converter markup "-{"
11487 !! options
11488 language=sr
11489 !! input
11490 -{T|hello
11491 !! result
11492 <p>-{T|hello
11493 </p>
11494 !! end
11495
11496 !! test
11497 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11498 !! options
11499 language=sr
11500 !! input
11501 -{R|=&gt;}-
11502 !! result
11503 <p>=&gt;
11504 </p>
11505 !!end
11506
11507 !!article
11508 Template:Bullet
11509 !!text
11510 * Bar
11511 !!endarticle
11512
11513 !! test
11514 Bug 529: Uncovered bullet
11515 !! input
11516 * Foo {{bullet}}
11517 !! result
11518 <ul><li> Foo
11519 </li><li> Bar
11520 </li></ul>
11521
11522 !! end
11523
11524 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11525 # Templates in Wikipedia rely on this behavior, as tidy has always been
11526 # enabled there. These tests are normally run *without* tidy, so specify the
11527 # full output here.
11528 # To test realistic parsing behavior, apply a tidy-like transformation to both
11529 # the expected output and your parser's output.
11530 !! test
11531 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11532 !! input
11533 ******* Foo {{bullet}}
11534 !! result
11535 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11536 </li></ul>
11537 </li></ul>
11538 </li></ul>
11539 </li></ul>
11540 </li></ul>
11541 </li></ul>
11542 </li><li> Bar
11543 </li></ul>
11544
11545 !! end
11546
11547 !! test
11548 Bug 529: Uncovered table already at line-start
11549 !! input
11550 x
11551
11552 {{table}}
11553 y
11554 !! result
11555 <p>x
11556 </p>
11557 <table>
11558 <tr>
11559 <td> 1 </td>
11560 <td> 2
11561 </td></tr>
11562 <tr>
11563 <td> 3 </td>
11564 <td> 4
11565 </td></tr></table>
11566 <p>y
11567 </p>
11568 !! end
11569
11570 !! test
11571 Bug 529: Uncovered bullet in parser function result
11572 !! input
11573 * Foo {{lc:{{bullet}} }}
11574 !! result
11575 <ul><li> Foo
11576 </li><li> bar
11577 </li></ul>
11578
11579 !! end
11580
11581 !! test
11582 Bug 5678: Double-parsed template argument
11583 !! input
11584 {{lc:{{{1}}}|hello}}
11585 !! result
11586 <p>{{{1}}}
11587 </p>
11588 !! end
11589
11590 !! test
11591 Bug 5678: Double-parsed template invocation
11592 !! input
11593 {{lc:{{paramtest {{!}} param = hello }} }}
11594 !! result
11595 <p>{{paramtest | param = hello }}
11596 </p>
11597 !! end
11598
11599 !! test
11600 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11601 !! options
11602 language=cs
11603 title=[[Main Page]]
11604 !! input
11605 {{PRVNÍVELKÉ:ěščř}}
11606 {{prvnívelké:ěščř}}
11607 {{PRVNÍMALÉ:ěščř}}
11608 {{prvnímalé:ěščř}}
11609 {{MALÁ:ěščř}}
11610 {{malá:ěščř}}
11611 {{VELKÁ:ěščř}}
11612 {{velká:ěščř}}
11613 !! result
11614 <p>Ěščř
11615 Ěščř
11616 ěščř
11617 ěščř
11618 ěščř
11619 ěščř
11620 ĚŠČŘ
11621 ĚŠČŘ
11622 </p>
11623 !! end
11624
11625 !! test
11626 Morwen/13: Unclosed link followed by heading
11627 !! input
11628 [[link
11629 ==heading==
11630 !! result
11631 <p>[[link
11632 </p>
11633 <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>
11634
11635 !! end
11636
11637 !! test
11638 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11639 !! input
11640 {{foo|
11641 =heading=
11642 !! result
11643 <p>{{foo|
11644 </p>
11645 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11646
11647 !! end
11648
11649 !! test
11650 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11651 !! input
11652 {{foo|
11653 ==heading==
11654 !! result
11655 <p>{{foo|
11656 </p>
11657 <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>
11658
11659 !! end
11660
11661 !! test
11662 Tildes in comments
11663 !! options
11664 pst
11665 !! input
11666 <!-- ~~~~ -->
11667 !! result
11668 <!-- ~~~~ -->
11669 !! end
11670
11671 !! test
11672 Paragraphs inside divs (no extra line breaks)
11673 !! input
11674 <div>Line one
11675
11676 Line two</div>
11677 !! result
11678 <div>Line one
11679 Line two</div>
11680
11681 !! end
11682
11683 !! test
11684 Paragraphs inside divs (extra line break on open)
11685 !! input
11686 <div>
11687 Line one
11688
11689 Line two</div>
11690 !! result
11691 <div>
11692 <p>Line one
11693 </p>
11694 Line two</div>
11695
11696 !! end
11697
11698 !! test
11699 Paragraphs inside divs (extra line break on close)
11700 !! input
11701 <div>Line one
11702
11703 Line two
11704 </div>
11705 !! result
11706 <div>Line one
11707 <p>Line two
11708 </p>
11709 </div>
11710
11711 !! end
11712
11713 !! test
11714 Paragraphs inside divs (extra line break on open and close)
11715 !! input
11716 <div>
11717 Line one
11718
11719 Line two
11720 </div>
11721 !! result
11722 <div>
11723 <p>Line one
11724 </p><p>Line two
11725 </p>
11726 </div>
11727
11728 !! end
11729
11730 !! test
11731 Nesting tags, paragraphs on lines which begin with <div>
11732 !! options
11733 disabled
11734 !! input
11735 <div></div><strong>A
11736 B</strong>
11737 !! result
11738 <div></div>
11739 <p><strong>A
11740 B</strong>
11741 </p>
11742 !! end
11743
11744 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11745 !! test
11746 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11747 !! options
11748 disabled
11749 !! input
11750 <blockquote>Line one
11751
11752 Line two</blockquote>
11753 !! result
11754 <blockquote>Line one
11755 Line two</blockquote>
11756
11757 !! end
11758
11759 !! test
11760 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11761 !! options
11762 disabled
11763 !! input
11764 <blockquote>
11765 Line one
11766
11767 Line two</blockquote>
11768 !! result
11769 <blockquote>
11770 <p>Line one
11771 </p>
11772 Line two</blockquote>
11773
11774 !! end
11775
11776 !! test
11777 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11778 !! options
11779 disabled
11780 !! input
11781 <blockquote>Line one
11782
11783 Line two
11784 </blockquote>
11785 !! result
11786 <blockquote>Line one
11787 <p>Line two
11788 </p>
11789 </blockquote>
11790
11791 !! end
11792
11793 !! test
11794 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11795 !! options
11796 disabled
11797 !! input
11798 <blockquote>
11799 Line one
11800
11801 Line two
11802 </blockquote>
11803 !! result
11804 <blockquote>
11805 <p>Line one
11806 </p><p>Line two
11807 </p>
11808 </blockquote>
11809
11810 !! end
11811
11812 !! test
11813 Paragraphs inside blockquotes/divs (no extra line breaks)
11814 !! input
11815 <blockquote><div>Line one
11816
11817 Line two</div></blockquote>
11818 !! result
11819 <blockquote><div>Line one
11820 Line two</div></blockquote>
11821
11822 !! end
11823
11824 !! test
11825 Paragraphs inside blockquotes/divs (extra line break on open)
11826 !! input
11827 <blockquote><div>
11828 Line one
11829
11830 Line two</div></blockquote>
11831 !! result
11832 <blockquote><div>
11833 <p>Line one
11834 </p>
11835 Line two</div></blockquote>
11836
11837 !! end
11838
11839 !! test
11840 Paragraphs inside blockquotes/divs (extra line break on close)
11841 !! input
11842 <blockquote><div>Line one
11843
11844 Line two
11845 </div></blockquote>
11846 !! result
11847 <blockquote><div>Line one
11848 <p>Line two
11849 </p>
11850 </div></blockquote>
11851
11852 !! end
11853
11854 !! test
11855 Paragraphs inside blockquotes/divs (extra line break on open and close)
11856 !! input
11857 <blockquote><div>
11858 Line one
11859
11860 Line two
11861 </div></blockquote>
11862 !! result
11863 <blockquote><div>
11864 <p>Line one
11865 </p><p>Line two
11866 </p>
11867 </div></blockquote>
11868
11869 !! end
11870
11871 !! test
11872 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11873 !! options
11874 wgLinkHolderBatchSize=0
11875 !! input
11876 [[meatball:1]]
11877 [[meatball:2]]
11878 [[meatball:3]]
11879 !! result
11880 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11881 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11882 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11883 </p>
11884 !! end
11885
11886 !! test
11887 Free external link invading image caption
11888 !! input
11889 [[Image:Foobar.jpg|thumb|http://x|hello]]
11890 !! result
11891 <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>
11892
11893 !! end
11894
11895 !! test
11896 Bug 15196: localised external link numbers
11897 !! options
11898 language=fa
11899 !! input
11900 [http://en.wikipedia.org/]
11901 !! result
11902 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11903 </p>
11904 !! end
11905
11906 !! test
11907 Multibyte character in padleft
11908 !! input
11909 {{padleft:-Hello|7|Æ}}
11910 !! result
11911 <p>Æ-Hello
11912 </p>
11913 !! end
11914
11915 !! test
11916 Multibyte character in padright
11917 !! input
11918 {{padright:Hello-|7|Æ}}
11919 !! result
11920 <p>Hello-Æ
11921 </p>
11922 !! end
11923
11924 !!test
11925 formatdate parser function
11926 !!input
11927 {{#formatdate:2009-03-24}}
11928 !! result
11929 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11930 </p>
11931 !! end
11932
11933 !!test
11934 formatdate parser function, with default format
11935 !!input
11936 {{#formatdate:2009-03-24|mdy}}
11937 !! result
11938 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11939 </p>
11940 !! end
11941
11942 !! test
11943 Spacing of numbers in formatted dates
11944 !! input
11945 {{#formatdate:January 15}}
11946 !! result
11947 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11948 </p>
11949 !! end
11950
11951 !! test
11952 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
11953 !! options
11954 language=nl title=[[MediaWiki:Common.css]]
11955 !! input
11956 {{#formatdate:2009-03-24|dmy}}
11957 !! result
11958 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11959 </p>
11960 !! end
11961
11962 #
11963 #
11964 #
11965
11966 #
11967 # Edit comments
11968 #
11969
11970 !! test
11971 Edit comment with link
11972 !! options
11973 comment
11974 !! input
11975 I like the [[Main Page]] a lot
11976 !! result
11977 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11978 !!end
11979
11980 !! test
11981 Edit comment with link and link text
11982 !! options
11983 comment
11984 !! input
11985 I like the [[Main Page|best pages]] a lot
11986 !! result
11987 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11988 !!end
11989
11990 !! test
11991 Edit comment with link and link text with suffix
11992 !! options
11993 comment
11994 !! input
11995 I like the [[Main Page|best page]]s a lot
11996 !! result
11997 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11998 !!end
11999
12000 !! test
12001 Edit comment with section link (non-local, eg in history list)
12002 !! options
12003 comment title=[[Main Page]]
12004 !! input
12005 /* External links */ removed bogus entries
12006 !! result
12007 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12008 !!end
12009
12010 !! test
12011 Edit comment with section link and text before it (non-local, eg in history list)
12012 !! options
12013 comment title=[[Main Page]]
12014 !! input
12015 pre-comment text /* External links */ removed bogus entries
12016 !! result
12017 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>
12018 !!end
12019
12020 !! test
12021 Edit comment with section link (local, eg in diff view)
12022 !! options
12023 comment local title=[[Main Page]]
12024 !! input
12025 /* External links */ removed bogus entries
12026 !! result
12027 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12028 !!end
12029
12030 !! test
12031 Edit comment with subpage link (bug 14080)
12032 !! options
12033 comment
12034 subpage
12035 title=[[Subpage test]]
12036 !! input
12037 Poked at a [[/subpage]] here...
12038 !! result
12039 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12040 !!end
12041
12042 !! test
12043 Edit comment with subpage link and link text (bug 14080)
12044 !! options
12045 comment
12046 subpage
12047 title=[[Subpage test]]
12048 !! input
12049 Poked at a [[/subpage|neat little page]] here...
12050 !! result
12051 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12052 !!end
12053
12054 !! test
12055 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12056 !! options
12057 comment
12058 title=[[Subpage test]]
12059 !! input
12060 Poked at a [[/subpage]] here...
12061 !! result
12062 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...
12063 !!end
12064
12065 !! test
12066 Edit comment with bare anchor link (local, as on diff)
12067 !! options
12068 comment
12069 local
12070 title=[[Main Page]]
12071 !!input
12072 [[#section]]
12073 !! result
12074 <a href="#section">#section</a>
12075 !! end
12076
12077 !! test
12078 Edit comment with bare anchor link (non-local, as on history)
12079 !! options
12080 comment
12081 title=[[Main Page]]
12082 !!input
12083 [[#section]]
12084 !! result
12085 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12086 !! end
12087
12088 !! test
12089 Anchor starting with underscore
12090 !!input
12091 [[#_ref|One]]
12092 !! result
12093 <p><a href="#_ref">One</a>
12094 </p>
12095 !! end
12096
12097 !! test
12098 Id starting with underscore
12099 !!input
12100 <div id="_ref"></div>
12101 !! result
12102 <div id="_ref"></div>
12103
12104 !! end
12105
12106 !! test
12107 Space normalisation on autocomment (bug 22784)
12108 !! options
12109 comment
12110 title=[[Main Page]]
12111 !!input
12112 /* __hello__world__ */
12113 !! result
12114 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12115 !! end
12116
12117 !! test
12118 percent-encoding and + signs in comments (Bug 26410)
12119 !! options
12120 comment
12121 !!input
12122 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12123 !! result
12124 <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>
12125 !! end
12126
12127 !! test
12128 Bad images - basic functionality
12129 !! options
12130 disabled
12131 !! input
12132 [[File:Bad.jpg]]
12133 !! result
12134 !! end
12135
12136 !! test
12137 Bad images - bug 16039: text after bad image disappears
12138 !! options
12139 disabled
12140 !! input
12141 Foo bar
12142 [[File:Bad.jpg]]
12143 Bar foo
12144 !! result
12145 <p>Foo bar
12146 </p><p>Bar foo
12147 </p>
12148 !! end
12149
12150 !! test
12151 Verify that displaytitle works (bug #22501) no displaytitle
12152 !! options
12153 showtitle
12154 !! config
12155 wgAllowDisplayTitle=true
12156 wgRestrictDisplayTitle=false
12157 !! input
12158 this is not the the title
12159 !! result
12160 Parser test
12161 <p>this is not the the title
12162 </p>
12163 !! end
12164
12165 !! test
12166 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12167 !! options
12168 showtitle
12169 title=[[Screen]]
12170 !! config
12171 wgAllowDisplayTitle=true
12172 wgRestrictDisplayTitle=false
12173 !! input
12174 this is not the the title
12175 {{DISPLAYTITLE:whatever}}
12176 !! result
12177 whatever
12178 <p>this is not the the title
12179 </p>
12180 !! end
12181
12182 !! test
12183 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12184 !! options
12185 showtitle
12186 title=[[Screen]]
12187 !! config
12188 wgAllowDisplayTitle=true
12189 wgRestrictDisplayTitle=true
12190 !! input
12191 this is not the the title
12192 {{DISPLAYTITLE:whatever}}
12193 !! result
12194 Screen
12195 <p>this is not the the title
12196 </p>
12197 !! end
12198
12199 !! test
12200 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12201 !! options
12202 showtitle
12203 title=[[Screen]]
12204 !! config
12205 wgAllowDisplayTitle=true
12206 wgRestrictDisplayTitle=true
12207 !! input
12208 this is not the the title
12209 {{DISPLAYTITLE:screen}}
12210 !! result
12211 screen
12212 <p>this is not the the title
12213 </p>
12214 !! end
12215
12216 !! test
12217 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12218 !! options
12219 showtitle
12220 title=[[Screen]]
12221 !! config
12222 wgAllowDisplayTitle=false
12223 !! input
12224 this is not the the title
12225 {{DISPLAYTITLE:screen}}
12226 !! result
12227 Screen
12228 <p>this is not the the title
12229 <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>
12230 </p>
12231 !! end
12232
12233 !! test
12234 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12235 !! options
12236 showtitle
12237 title=[[Screen]]
12238 !! config
12239 wgAllowDisplayTitle=false
12240 !! input
12241 this is not the the title
12242 !! result
12243 Screen
12244 <p>this is not the the title
12245 </p>
12246 !! end
12247
12248 !! test
12249 preload: check <noinclude> and <includeonly>
12250 !! options
12251 preload
12252 !! input
12253 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12254 !! result
12255 Hello kind world.
12256 !! end
12257
12258 !! test
12259 preload: check <onlyinclude>
12260 !! options
12261 preload
12262 !! input
12263 Goodbye <onlyinclude>Hello world</onlyinclude>
12264 !! result
12265 Hello world
12266 !! end
12267
12268 !! test
12269 preload: can pass tags through if we want to
12270 !! options
12271 preload
12272 !! input
12273 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12274 !! result
12275 <includeonly>Hello world</includeonly>
12276 !! end
12277
12278 !! test
12279 preload: check that it doesn't try to do tricks
12280 !! options
12281 preload
12282 !! input
12283 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12284 !! result
12285 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12286 !! end
12287
12288 !! test
12289 Play a bit with r67090 and bug 3158
12290 !! options
12291 disabled
12292 !! input
12293 <div style="width:50% !important">&nbsp;</div>
12294 <div style="width:50%&nbsp;!important">&nbsp;</div>
12295 <div style="width:50%&#160;!important">&nbsp;</div>
12296 <div style="border : solid;">&nbsp;</div>
12297 !! result
12298 <div style="width:50% !important">&nbsp;</div>
12299 <div style="width:50% !important">&nbsp;</div>
12300 <div style="width:50% !important">&nbsp;</div>
12301 <div style="border&#160;: solid;">&nbsp;</div>
12302
12303 !! end
12304
12305 !! test
12306 HTML5 data attributes
12307 !! input
12308 <span data-foo="bar">Baz</span>
12309 <p data-abc-def_hij="">Quuz</p>
12310 !! result
12311 <p><span data-foo="bar">Baz</span>
12312 </p>
12313 <p data-abc-def_hij="">Quuz</p>
12314
12315 !! end
12316
12317 !! test
12318 percent-encoding and + signs in internal links (Bug 26410)
12319 !! input
12320 [[User:+%]] [[Page+title%]]
12321 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12322 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12323 [[%33%45]] [[%33%45+]]
12324 !! result
12325 <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>
12326 <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>
12327 <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>
12328 <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>
12329 </p>
12330 !! end
12331
12332 !! test
12333 Special characters in embedded file links (bug 27679)
12334 !! input
12335 [[File:Contains & ampersand.jpg]]
12336 [[File:Does not exist.jpg|Title with & ampersand]]
12337 !! result
12338 <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>
12339 <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>
12340 </p>
12341 !! end
12342
12343
12344 !! test
12345 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12346 !! input
12347 Text&apos;s been normalized?
12348 !! result
12349 <p>Text&#39;s been normalized?
12350 </p>
12351 !! end
12352
12353 !! test
12354 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12355 !! input
12356 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12357 !! result
12358 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12359 </p>
12360 !! end
12361
12362 !! test
12363 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12364 !! input
12365 [http://www.example.org/ ideograms]
12366 !! result
12367 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12368 </p>
12369 !! end
12370
12371 !! test
12372 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12373 !! input
12374 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12375 !! result
12376 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12377 </p>
12378 !! end
12379
12380 !! article
12381 Mediawiki:loop1
12382 !! text
12383 {{Identical|A}}
12384 !! endarticle
12385
12386 !! article
12387 Mediawiki:loop2
12388 !! text
12389 {{Identical|B}}
12390 !! endarticle
12391
12392 !! article
12393 Template:Identical
12394 !! text
12395 {{int:loop1}}
12396 {{int:loop2}}
12397 !! endarticle
12398
12399 !! test
12400 Bug 31098 Template which includes system messages which includes the template
12401 !! input
12402 {{Identical}}
12403 !! result
12404 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12405 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12406 </p>
12407 !! end
12408
12409 !! test
12410 Bug31490 Turkish: ucfirst 'blah'
12411 !! options
12412 language=tr
12413 !! input
12414 {{ucfirst:blah}}
12415 !! result
12416 <p>Blah
12417 </p>
12418 !! end
12419
12420 !! test
12421 Bug31490 Turkish: ucfirst 'ix'
12422 !! options
12423 language=tr
12424 !! input
12425 {{ucfirst:ix}}
12426 !! result
12427 <p>İx
12428 </p>
12429 !! end
12430
12431 !! test
12432 Bug31490 Turkish: lcfirst 'BLAH'
12433 !! options
12434 language=tr
12435 !! input
12436 {{lcfirst:BLAH}}
12437 !! result
12438 <p>bLAH
12439 </p>
12440 !! end
12441
12442 !! test
12443 Bug31490 Turkish: ucfırst (with a dotless i)
12444 !! options
12445 language=tr
12446 !! input
12447 {{ucfırst:blah}}
12448 !! result
12449 <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>
12450 </p>
12451 !! end
12452
12453 !! test
12454 Bug31490 ucfırst (with a dotless i) with English language
12455 !! options
12456 language=en
12457 !! input
12458 {{ucfırst:blah}}
12459 !! result
12460 <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>
12461 </p>
12462 !! end
12463
12464 !! test
12465 Bug 26375: TOC with italics
12466 !! options
12467 title=[[Main Page]]
12468 !! input
12469 __TOC__
12470 == ''Lost'' episodes ==
12471 !! result
12472 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12473 <ul>
12474 <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>
12475 </ul>
12476 </td></tr></table>
12477 <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>
12478
12479 !! end
12480
12481 !! test
12482 Bug 26375: TOC with bold
12483 !! options
12484 title=[[Main Page]]
12485 !! input
12486 __TOC__
12487 == '''should be bold''' then normal text ==
12488 !! result
12489 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12490 <ul>
12491 <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>
12492 </ul>
12493 </td></tr></table>
12494 <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>
12495
12496 !! end
12497
12498 !! test
12499 Bug 33845: Headings become cursive in TOC when they contain an image
12500 !! options
12501 title=[[Main Page]]
12502 !! input
12503 __TOC__
12504 == Image [[Image:foobar.jpg]] ==
12505 !! result
12506 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12507 <ul>
12508 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12509 </ul>
12510 </td></tr></table>
12511 <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>
12512
12513 !! end
12514
12515 !! test
12516 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12517 !! options
12518 title=[[Main Page]]
12519 !! input
12520 __TOC__
12521 == <blockquote>Quote</blockquote> ==
12522 !! result
12523 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12524 <ul>
12525 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12526 </ul>
12527 </td></tr></table>
12528 <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>
12529
12530 !! end
12531
12532 !! test
12533 Unclosed tags in TOC
12534 !! options
12535 title=[[Main Page]]
12536 !! input
12537 __TOC__
12538 == Proof: 2 < 3 ==
12539 <small>Hanc marginis exiguitas non caperet.</small>
12540 QED
12541 !! result
12542 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12543 <ul>
12544 <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>
12545 </ul>
12546 </td></tr></table>
12547 <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>
12548 <p><small>Hanc marginis exiguitas non caperet.</small>
12549 QED
12550 </p>
12551 !! end
12552
12553 !! test
12554 Multiple tags in TOC
12555 !! input
12556 __TOC__
12557 == <i>Foo</i> <b>Bar</b> ==
12558
12559 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12560 !! result
12561 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12562 <ul>
12563 <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>
12564 <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>
12565 </ul>
12566 </td></tr></table>
12567 <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>
12568 <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>
12569
12570 !! end
12571
12572 !! test
12573 Tags with parameters in TOC
12574 !! input
12575 __TOC__
12576 == <sup class="in-h2">Hello</sup> ==
12577
12578 == <sup class="a > b">Evilbye</sup> ==
12579 !! result
12580 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12581 <ul>
12582 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12583 <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>
12584 </ul>
12585 </td></tr></table>
12586 <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>
12587 <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>
12588
12589 !! end
12590
12591 !! test
12592 span tags with directionality in TOC
12593 !! input
12594 __TOC__
12595 == <span dir="ltr">C++</span> ==
12596
12597 == <span dir="rtl">זבנג!</span> ==
12598
12599 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12600
12601 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12602
12603 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12604 !! result
12605 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12606 <ul>
12607 <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>
12608 <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>
12609 <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>
12610 <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>
12611 <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>
12612 </ul>
12613 </td></tr></table>
12614 <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>
12615 <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>
12616 <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>
12617 <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>
12618 <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>
12619
12620 !! end
12621
12622 !! article
12623 MediaWiki:Bug32057
12624 !! text
12625 == {{int:headline_sample}} ==
12626 !! endarticle
12627
12628 !! test
12629 Bug 32057: Title needed when expanding <h> nodes.
12630 !! options
12631 title=[[Main Page]]
12632 !! input
12633 {{int:Bug32057}}
12634 !! result
12635 <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>
12636
12637 !! end
12638
12639 !! test
12640 Strip marker in urlencode
12641 !! input
12642 {{urlencode:x<nowiki/>y}}
12643 {{urlencode:x<nowiki/>y|wiki}}
12644 {{urlencode:x<nowiki/>y|path}}
12645 !! result
12646 <p>xy
12647 xy
12648 xy
12649 </p>
12650 !! end
12651
12652 !! test
12653 Strip marker in lc
12654 !! input
12655 {{lc:x<nowiki/>y}}
12656 !! result
12657 <p>xy
12658 </p>
12659 !! end
12660
12661 !! test
12662 Strip marker in uc
12663 !! input
12664 {{uc:x<nowiki/>y}}
12665 !! result
12666 <p>XY
12667 </p>
12668 !! end
12669
12670 !! test
12671 Strip marker in formatNum
12672 !! input
12673 {{formatnum:1<nowiki/>2}}
12674 {{formatnum:1<nowiki/>2|R}}
12675 !! result
12676 <p>12
12677 12
12678 </p>
12679 !! end
12680
12681 !! test
12682 Check noCommafy in formatNum
12683 !! options
12684 language=be-tarask
12685 !! input
12686 {{formatnum:123456.78}}
12687 {{formatnum:123456.78|NOSEP}}
12688 !! result
12689 <p>123 456,78
12690 123456.78
12691 </p>
12692 !! end
12693
12694 !! test
12695 Strip marker in grammar
12696 !! options
12697 language=fi
12698 !! input
12699 {{grammar:elative|foo<nowiki/>bar}}
12700 !! result
12701 <p>foobarista
12702 </p>
12703 !! end
12704
12705 !! test
12706 Strip marker in padleft
12707 !! input
12708 {{padleft:|2|x<nowiki/>y}}
12709 !! result
12710 <p>xy
12711 </p>
12712 !! end
12713
12714 !! test
12715 Strip marker in padright
12716 !! input
12717 {{padright:|2|x<nowiki/>y}}
12718 !! result
12719 <p>xy
12720 </p>
12721 !! end
12722
12723 !! test
12724 Strip marker in anchorencode
12725 !! input
12726 {{anchorencode:x<nowiki/>y}}
12727 !! result
12728 <p>xy
12729 </p>
12730 !! end
12731
12732 !! test
12733 nowiki inside link inside heading (bug 18295)
12734 !! input
12735 ==[[foo|x<nowiki>y</nowiki>z]]==
12736 !! result
12737 <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>
12738
12739 !! end
12740
12741 !! test
12742 new support for bdi element (bug 31817)
12743 !! input
12744 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12745 !! result
12746 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12747
12748 !!end
12749
12750 !! test
12751 Ignore pipe between table row attributes
12752 !! input
12753 {|
12754 | quux
12755 |- id=foo | style='color: red'
12756 | bar
12757 |}
12758 !! result
12759 <table>
12760 <tr>
12761 <td> quux
12762 </td></tr>
12763 <tr id="foo" style="color: red">
12764 <td> bar
12765 </td></tr></table>
12766
12767 !! end
12768
12769 !!test
12770 Gallery override link with WikiLink (bug 34852)
12771 !! input
12772 <gallery>
12773 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12774 </gallery>
12775 !! result
12776 <ul class="gallery">
12777 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12778 <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>
12779 <div class="gallerytext">
12780 <p>caption
12781 </p>
12782 </div>
12783 </div></li>
12784 </ul>
12785
12786 !! end
12787
12788 !!test
12789 Gallery override link with absolute external link (bug 34852)
12790 !! input
12791 <gallery>
12792 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12793 </gallery>
12794 !! result
12795 <ul class="gallery">
12796 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12797 <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>
12798 <div class="gallerytext">
12799 <p>caption
12800 </p>
12801 </div>
12802 </div></li>
12803 </ul>
12804
12805 !! end
12806
12807 !!test
12808 Gallery override link with malicious javascript (bug 34852)
12809 !! input
12810 <gallery>
12811 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12812 </gallery>
12813 !! result
12814 <ul class="gallery">
12815 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12816 <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>
12817 <div class="gallerytext">
12818 <p>caption
12819 </p>
12820 </div>
12821 </div></li>
12822 </ul>
12823
12824 !! end
12825
12826 !!test
12827 Gallery with invalid title as link (bug 43964)
12828 !! input
12829 <gallery>
12830 File:foobar.jpg|link=<
12831 </gallery>
12832 !! result
12833 <ul class="gallery">
12834 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12835 <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>
12836 <div class="gallerytext">
12837 </div>
12838 </div></li>
12839 </ul>
12840
12841 !! end
12842
12843 !!test
12844 Language parser function
12845 !! input
12846 {{#language:ar}}
12847 !! result
12848 <p>العربية
12849 </p>
12850 !! end
12851
12852 !!test
12853 Padleft and padright as substr
12854 !! input
12855 {{padleft:|3|abcde}}
12856 {{padright:|3|abcde}}
12857 !! result
12858 <p>abc
12859 abc
12860 </p>
12861 !! end
12862
12863 !!test
12864 Bug 34939 - Case insensitive link parsing ([HttP://])
12865 !! input
12866 [HttP://MediaWiki.Org/]
12867 !! result
12868 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12869 </p>
12870 !! end
12871
12872 !!test
12873 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12874 !! input
12875 [HttP://MediaWiki.Org/ MediaWiki]
12876 !! result
12877 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12878 </p>
12879 !! end
12880
12881 !!test
12882 Bug 34939 - Case insensitive link parsing (HttP://)
12883 !! input
12884 HttP://MediaWiki.Org/
12885 !! result
12886 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12887 </p>
12888 !! end
12889
12890 ###
12891 ### Parsoids-specific tests
12892 ### Parsoid-PHP parser incompatibilities
12893 ###
12894 !!test
12895 1. SOL-sensitive wikitext tokens as template-args
12896 !!options
12897 disabled
12898 !!input
12899 {{echo|*a}}
12900 {{echo|#a}}
12901 {{echo|:a}}
12902 !!result
12903 <p>*a
12904 #a
12905 :a
12906 </p>
12907 !!end
12908
12909 #### The following section of tests are primarily to test
12910 #### wikitext escaping capabilities of Parsoid.
12911 #### A lot of the tests are disabled for the PHP parser either
12912 #### because of minor newline diffs or other reasons.
12913 #### As Parsoid serializer can handle newlines and other HTML
12914 #### more robustly, some of these tests might get reenabled
12915 #### for the PHP parser.
12916
12917 #### --------------- Headings ---------------
12918 #### 0. Unnested
12919 #### 1. Nested inside html <h1>=foo=</h1>
12920 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12921 #### 3. Nested inside html with wikitext split by html tags
12922 #### 4. No escape needed
12923 #### 5. Empty headings <h1></h1>
12924 #### 6. Heading chars in SOL context
12925 #### ----------------------------------------
12926 !! test
12927 Headings: 0. Unnested
12928 !! input
12929 <nowiki>=foo=</nowiki>
12930
12931 <nowiki>=foo</nowiki>''a''=
12932 !! result
12933 <p>=foo=
12934 </p><p>=foo<i>a</i>=
12935 </p>
12936 !!end
12937
12938 !! test
12939 Headings: 1. Nested inside html
12940 !! options
12941 disabled
12942 !! input
12943 =<nowiki>=foo=</nowiki>=
12944 ==<nowiki>=foo=</nowiki>==
12945 ===<nowiki>=foo=</nowiki>===
12946 ====<nowiki>=foo=</nowiki>====
12947 =====<nowiki>=foo=</nowiki>=====
12948 ======<nowiki>=foo=</nowiki>======
12949 !! result
12950 <h1>=foo=</h1>
12951 <h2>=foo=</h2>
12952 <h3>=foo=</h3>
12953 <h4>=foo=</h4>
12954 <h5>=foo=</h5>
12955 <h6>=foo=</h6>
12956 !!end
12957
12958 !! test
12959 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12960 !! options
12961 disabled
12962 !! input
12963 =foo=
12964 <nowiki>*bar</nowiki>
12965 =foo=
12966 =bar
12967 =foo=
12968 <nowiki>=bar=</nowiki>
12969 !! result
12970 <h1>foo</h1>*bar
12971 <h1>foo</h1>=bar
12972 <h1>foo</h1>=bar=
12973 !!end
12974
12975 !! test
12976 Headings: 3. Nested inside html with wikitext split by html tags
12977 !! options
12978 disabled
12979 !! input
12980 =<nowiki>=</nowiki>'''bold'''foo==
12981 !! result
12982 <h1>=<b>bold</b>foo=</h1>
12983 !!end
12984
12985 !! test
12986 Headings: 4. No escaping needed (testing just h1 and h2)
12987 !! options
12988 disabled
12989 !! input
12990 ==foo=
12991 =foo==
12992 ===foo==
12993 ==foo===
12994 =''=''foo==
12995 ===
12996 !! result
12997 <h1>=foo</h1>
12998 <h1>foo=</h1>
12999 <h2>=foo</h2>
13000 <h2>foo=</h2>
13001 <h1><i>=</i>foo=</h1>
13002 <h1>=</h1>
13003 !!end
13004
13005 !! test
13006 Headings: 5. Empty headings
13007 !! options
13008 disabled
13009 !! input
13010 =<nowiki></nowiki>=
13011 ==<nowiki></nowiki>==
13012 ===<nowiki></nowiki>===
13013 ====<nowiki></nowiki>====
13014 =====<nowiki></nowiki>=====
13015 ======<nowiki></nowiki>======
13016 !! result
13017 <h1></h1>
13018 <h2></h2>
13019 <h3></h3>
13020 <h4></h4>
13021 <h5></h5>
13022 <h6></h6>
13023 !!end
13024
13025 !! test
13026 Headings: 6. Heading chars in SOL context
13027 !! options
13028 disabled
13029 !! input
13030 <!--cmt--><nowiki>=h1=</nowiki>
13031 !! result
13032 <p><!--cmt-->=h1=
13033 </p>
13034 !!end
13035
13036 #### --------------- Lists ---------------
13037 #### 0. Outside nests (*foo, etc.)
13038 #### 1. Nested inside html <ul><li>*foo</li></ul>
13039 #### 2. Inside definition lists
13040 #### 3. Only bullets at start should be escaped
13041 #### 4. No escapes needed
13042 #### 5. No unnecessary escapes
13043 #### 6. Escape bullets in SOL position
13044 #### 7. Escape bullets in a multi-line context
13045 #### ----------------------------------------
13046
13047 !! test
13048 Lists: 0. Outside nests
13049 !! input
13050 <nowiki>*foo</nowiki>
13051
13052 <nowiki>#foo</nowiki>
13053 !! result
13054 <p>*foo
13055 </p><p>#foo
13056 </p>
13057 !!end
13058
13059 !! test
13060 Lists: 1. Nested inside html
13061 !! input
13062 *<nowiki>*foo</nowiki>
13063
13064 *<nowiki>#foo</nowiki>
13065
13066 *<nowiki>:foo</nowiki>
13067
13068 *<nowiki>;foo</nowiki>
13069
13070 #<nowiki>*foo</nowiki>
13071
13072 #<nowiki>#foo</nowiki>
13073
13074 #<nowiki>:foo</nowiki>
13075
13076 #<nowiki>;foo</nowiki>
13077 !! result
13078 <ul><li>*foo
13079 </li></ul>
13080 <ul><li>#foo
13081 </li></ul>
13082 <ul><li>:foo
13083 </li></ul>
13084 <ul><li>;foo
13085 </li></ul>
13086 <ol><li>*foo
13087 </li></ol>
13088 <ol><li>#foo
13089 </li></ol>
13090 <ol><li>:foo
13091 </li></ol>
13092 <ol><li>;foo
13093 </li></ol>
13094
13095 !!end
13096
13097 !! test
13098 Lists: 2. Inside definition lists
13099 !! input
13100 ;<nowiki>;foo</nowiki>
13101
13102 ;<nowiki>:foo</nowiki>
13103
13104 ;<nowiki>:foo</nowiki>
13105 :bar
13106
13107 :<nowiki>:foo</nowiki>
13108 !! result
13109 <dl><dt>;foo
13110 </dt></dl>
13111 <dl><dt>:foo
13112 </dt></dl>
13113 <dl><dt>:foo
13114 </dt><dd>bar
13115 </dd></dl>
13116 <dl><dd>:foo
13117 </dd></dl>
13118
13119 !!end
13120
13121 !! test
13122 Lists: 3. Only bullets at start of text should be escaped
13123 !! input
13124 *<nowiki>*foo*bar</nowiki>
13125
13126 *<nowiki>*foo</nowiki>''it''*bar
13127 !! result
13128 <ul><li>*foo*bar
13129 </li></ul>
13130 <ul><li>*foo<i>it</i>*bar
13131 </li></ul>
13132
13133 !!end
13134
13135 !! test
13136 Lists: 4. No escapes needed
13137 !! options
13138 disabled
13139 !! input
13140 *foo*bar
13141
13142 *''foo''*bar
13143
13144 *[[Foo]]: bar
13145 !! result
13146 <ul><li>foo*bar
13147 </li></ul>
13148 <ul><li><i>foo</i>*bar
13149 </li></ul>
13150 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13151 </li></ul>
13152 !!end
13153
13154 !! test
13155 Lists: 5. No unnecessary escapes
13156 !! input
13157 * bar <span><nowiki>[[foo]]</nowiki></span>
13158
13159 *=bar <span><nowiki>[[foo]]</nowiki></span>
13160
13161 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13162
13163 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13164
13165 *=bar <span>foo]]</span>=
13166 !! result
13167 <ul><li> bar <span>[[foo]]</span>
13168 </li></ul>
13169 <ul><li>=bar <span>[[foo]]</span>
13170 </li></ul>
13171 <ul><li>[[bar <span>[[foo]]</span>
13172 </li></ul>
13173 <ul><li>]]bar <span>[[foo]]</span>
13174 </li></ul>
13175 <ul><li>=bar <span>foo]]</span>=
13176 </li></ul>
13177
13178 !!end
13179
13180 !! test
13181 Lists: 6. Escape bullets in SOL position
13182 !! options
13183 disabled
13184 !! input
13185 <!--cmt--><nowiki>*foo</nowiki>
13186 !! result
13187 <p><!--cmt-->*foo
13188 </p>
13189 !!end
13190
13191 !! test
13192 Lists: 7. Escape bullets in a multi-line context
13193 !! input
13194 <nowiki>a
13195 *b</nowiki>
13196 !! result
13197 <p>a
13198 *b
13199 </p>
13200 !!end
13201
13202 #### --------------- HRs ---------------
13203 #### 1. Single line
13204 #### -----------------------------------
13205
13206 !! test
13207 HRs: 1. Single line
13208 !! options
13209 disabled
13210 !! input
13211 ----
13212 <nowiki>----</nowiki>
13213 ----
13214 <nowiki>=foo=</nowiki>
13215 ----
13216 <nowiki>*foo</nowiki>
13217 !! result
13218 <hr/>----
13219 <hr/>=foo=
13220 <hr/>*foo
13221 !! end
13222
13223 #### --------------- Tables ---------------
13224 #### 1a. Simple example
13225 #### 1b. No escaping needed (!foo)
13226 #### 1c. No escaping needed (|foo)
13227 #### 1d. No escaping needed (|}foo)
13228 ####
13229 #### 2a. Nested in td (<td>foo|bar</td>)
13230 #### 2b. Nested in td (<td>foo||bar</td>)
13231 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13232 ####
13233 #### 3a. Nested in th (<th>foo!bar</th>)
13234 #### 3b. Nested in th (<th>foo!!bar</th>)
13235 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13236 ####
13237 #### 4a. Escape -
13238 #### 4b. Escape +
13239 #### 4c. No escaping needed
13240 #### --------------------------------------
13241
13242 !! test
13243 Tables: 1a. Simple example
13244 !! input
13245 <nowiki>{|
13246 |}</nowiki>
13247 !! result
13248 <p>{|
13249 |}
13250 </p>
13251 !! end
13252
13253 !! test
13254 Tables: 1b. No escaping needed
13255 !! input
13256 !foo
13257 !! result
13258 <p>!foo
13259 </p>
13260 !! end
13261
13262 !! test
13263 Tables: 1c. No escaping needed
13264 !! input
13265 |foo
13266 !! result
13267 <p>|foo
13268 </p>
13269 !! end
13270
13271 !! test
13272 Tables: 1d. No escaping needed
13273 !! input
13274 |}foo
13275 !! result
13276 <p>|}foo
13277 </p>
13278 !! end
13279
13280 !! test
13281 Tables: 2a. Nested in td
13282 !! options
13283 disabled
13284 !! input
13285 {|
13286 |<nowiki>foo|bar</nowiki>
13287 |}
13288 !! result
13289 <table>
13290 <tr><td>foo|bar
13291 </td></tr></table>
13292
13293 !! end
13294
13295 !! test
13296 Tables: 2b. Nested in td
13297 !! options
13298 disabled
13299 !! input
13300 {|
13301 |<nowiki>foo||bar</nowiki>
13302 |''it''<nowiki>foo||bar</nowiki>
13303 |}
13304 !! result
13305 <table>
13306 <tr><td>foo||bar
13307 </td><td><i>it</i>foo||bar
13308 </td></tr></table>
13309
13310 !! end
13311
13312 !! test
13313 Tables: 2c. Nested in td -- no escaping needed
13314 !! options
13315 disabled
13316 !! input
13317 {|
13318 |foo!!bar
13319 |}
13320 !! result
13321 <table>
13322 <tr><td>foo!!bar
13323 </td></tr></table>
13324
13325 !! end
13326
13327 !! test
13328 Tables: 3a. Nested in th
13329 !! options
13330 disabled
13331 !! input
13332 {|
13333 !foo!bar
13334 |}
13335 !! result
13336 <table>
13337 <tr><th>foo!bar
13338 </th></tr></table>
13339
13340 !! end
13341
13342 !! test
13343 Tables: 3b. Nested in th
13344 !! options
13345 disabled
13346 !! input
13347 {|
13348 !<nowiki>foo!!bar</nowiki>
13349 |}
13350 !! result
13351 <table>
13352 <tr><th>foo!!bar
13353 </th></tr></table>
13354
13355 !! end
13356
13357 !! test
13358 Tables: 3c. Nested in th -- no escaping needed
13359 !! options
13360 disabled
13361 !! input
13362 {|
13363 !foo||bar
13364 |}
13365 !! result
13366 <table>
13367 <tr><th>foo||bar
13368 </th></tr></table>
13369
13370 !! end
13371
13372 !! test
13373 Tables: 4a. Escape -
13374 !! options
13375 disabled
13376 !! input
13377 {|
13378 |-
13379 !-bar
13380 |-
13381 |<nowiki>-bar</nowiki>
13382 |}
13383 !! result
13384 <table><tbody>
13385 <tr><th>-bar</th></tr>
13386 <tr><td>-bar</td></tr>
13387 </tbody></table>
13388 !! end
13389
13390 !! test
13391 Tables: 4b. Escape +
13392 !! options
13393 disabled
13394 !! input
13395 {|
13396 |-
13397 !+bar
13398 |-
13399 |<nowiki>+bar</nowiki>
13400 |}
13401 !! result
13402 <table><tbody>
13403 <tr><th>+bar</th></tr>
13404 <tr><td>+bar</td></tr>
13405 </tbody></table>
13406 !! end
13407
13408 !! test
13409 Tables: 4c. No escaping needed
13410 !! options
13411 disabled
13412 !! input
13413 {|
13414 |-
13415 |foo-bar
13416 |foo+bar
13417 |-
13418 |''foo''-bar
13419 |''foo''+bar
13420 |}
13421 !! result
13422 <table><tbody>
13423 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13424 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13425 </tbody></table>
13426 !! end
13427
13428 !! test
13429 Tables: 4d. No escaping needed
13430 !! input
13431 {|
13432 ||+1
13433 ||-2
13434 |}
13435 !! result
13436 <table>
13437 <tr>
13438 <td>+1
13439 </td>
13440 <td>-2
13441 </td></tr></table>
13442
13443 !! end
13444
13445 #### --------------- Links ---------------
13446 #### 1. Quote marks in link text
13447 #### 2. Wikilinks: Escapes needed
13448 #### 3. Wikilinks: No escapes needed
13449 #### 4. Extlinks: Escapes needed
13450 #### 5. Extlinks: No escapes needed
13451 #### --------------------------------------
13452 !! test
13453 Links 1. Quote marks in link text
13454 !! options
13455 disabled
13456 !! input
13457 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13458 !! result
13459 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13460 !! end
13461
13462 !! test
13463 Links 2. WikiLinks: Escapes needed
13464 !! options
13465 disabled
13466 !! input
13467 [[Foo|<nowiki>[Foobar]</nowiki>]]
13468 [[Foo|<nowiki>Foobar]</nowiki>]]
13469 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13470 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13471 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13472 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13473 [[Foo|<nowiki>|Bar</nowiki>]]
13474 !! result
13475 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13476 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13477 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13478 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13479 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13480 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13481 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13482 !! end
13483
13484 !! test
13485 Links 3. WikiLinks: No escapes needed
13486 !! options
13487 disabled
13488 !! input
13489 [[Foo|[Foobar]]
13490 [[Foo|foo|bar]]
13491 !! result
13492 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13493 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13494 !! end
13495
13496 !! test
13497 Links 4. ExtLinks: Escapes needed
13498 !! options
13499 disabled
13500 !! input
13501 [http://google.com <nowiki>[google]</nowiki>]
13502 [http://google.com <nowiki>google]</nowiki>]
13503 !! result
13504 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13505 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13506 !! end
13507
13508 !! test
13509 Links 5. ExtLinks: No escapes needed
13510 !! options
13511 disabled
13512 !! input
13513 [http://google.com [google]
13514 !! result
13515 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13516 !! end
13517
13518 #### --------------- Quotes ---------------
13519 #### 1. Quotes inside <b> and <i>
13520 #### 2. Link fragments separated by <i> and <b> tags
13521 #### 3. Link fragments inside <i> and <b>
13522 #### --------------------------------------
13523 !! test
13524 1. Quotes inside <b> and <i>
13525 !! input
13526 ''<nowiki>'foo'</nowiki>''
13527 ''<nowiki>''foo''</nowiki>''
13528 ''<nowiki>'''foo'''</nowiki>''
13529 '''<nowiki>'foo'</nowiki>'''
13530 '''<nowiki>''foo''</nowiki>'''
13531 '''<nowiki>'''foo'''</nowiki>'''
13532 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13533 !! result
13534 <p><i>'foo'</i>
13535 <i>''foo''</i>
13536 <i>'''foo'''</i>
13537 <b>'foo'</b>
13538 <b>''foo''</b>
13539 <b>'''foo'''</b>
13540 <b>foo'<i>bar'</i>baz</b>
13541 </p>
13542 !! end
13543
13544 !! test
13545 2. Link fragments separated by <i> and <b> tags
13546 !! input
13547 [[''foo''<nowiki>hello]]</nowiki>
13548
13549 [['''foo'''<nowiki>hello]]</nowiki>
13550 !! result
13551 <p>[[<i>foo</i>hello]]
13552 </p><p>[[<b>foo</b>hello]]
13553 </p>
13554 !! end
13555
13556 !! test
13557 2. Link fragments inside <i> and <b>
13558 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13559 this is one of the shortcomings of this format)
13560 !! input
13561 ''[[foo''<nowiki>]]</nowiki>
13562
13563 '''[[foo'''<nowiki>]]</nowiki>
13564 !! result
13565 <p><i>[[foo</i>]]
13566 </p><p><b>[[foo</b>]]
13567 </p>
13568 !! end
13569
13570 #### --------------- Paragraphs ---------------
13571 #### 1. No unnecessary escapes
13572 #### --------------------------------------
13573
13574 !! test
13575 1. No unnecessary escapes
13576 !! input
13577 bar <span><nowiki>[[foo]]</nowiki></span>
13578
13579 =bar <span><nowiki>[[foo]]</nowiki></span>
13580
13581 [[bar <span><nowiki>[[foo]]</nowiki></span>
13582
13583 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13584
13585 <nowiki>=bar </nowiki><span>foo]]</span>=
13586 !! result
13587 <p>bar <span>[[foo]]</span>
13588 </p><p>=bar <span>[[foo]]</span>
13589 </p><p>[[bar <span>[[foo]]</span>
13590 </p><p>]]bar <span>[[foo]]</span>
13591 </p><p>=bar <span>foo]]</span>=
13592 </p>
13593 !!end
13594
13595 #### --------------- PRE ------------------
13596 #### 1. Leading space in SOL context should be escaped
13597 #### --------------------------------------
13598 !! test
13599 1. Leading space in SOL context should be escaped
13600 !! options
13601 disabled
13602 !! input
13603 <nowiki> foo</nowiki>
13604 <!--cmt--><nowiki> foo</nowiki>
13605 !! result
13606 <p> foo
13607 <!--cmt--> foo
13608 </p>
13609 !! end
13610
13611 #### --------------- HTML tags ---------------
13612 #### 1. a tags
13613 #### 2. other tags
13614 #### 3. multi-line html tag
13615 #### --------------------------------------
13616 !! test
13617 1. a tags
13618 !! options
13619 disabled
13620 !! input
13621 <a href="http://google.com">google</a>
13622 !! result
13623 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13624 !! end
13625
13626 !! test
13627 2. other tags
13628 !! input
13629 <nowiki><div>foo</div>
13630 <div style="color:red">foo</div></nowiki>
13631 !! result
13632 <p>&lt;div&gt;foo&lt;/div&gt;
13633 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13634 </p>
13635 !! end
13636
13637 !! test
13638 3. multi-line html tag
13639 !! input
13640 <nowiki><div
13641 >foo</div
13642 ></nowiki>
13643 !! result
13644 <p>&lt;div
13645 &gt;foo&lt;/div
13646 &gt;
13647 </p>
13648 !! end
13649
13650 #### --------------- Others ---------------
13651 !! test
13652 Escaping nowikis
13653 !! input
13654 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13655 !! result
13656 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13657 </p>
13658 !! end
13659
13660 !! test
13661 Tag-like HTML structures are passed through as text
13662 !! input
13663 <x y>
13664
13665 <x.y>
13666
13667 <x-y>
13668
13669 1>2
13670
13671 x<y
13672
13673 a>b
13674
13675 1<d e>f
13676 !! result
13677 <p>&lt;x y&gt;
13678 </p><p>&lt;x.y&gt;
13679 </p><p>&lt;x-y&gt;
13680 </p><p>1&gt;2
13681 </p><p>x&lt;y
13682 </p><p>a&gt;b
13683 </p><p>1&lt;d e&gt;f
13684 </p>
13685 !! end
13686
13687
13688 # This fails in the PHP parser (see bug 40670,
13689 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13690 !! test
13691 Tag names followed by punctuation should not be recognized as tags
13692 !! options
13693 disabled
13694 !! input
13695 <s.ome> text
13696 !! result
13697 <p>&lt;s.ome&gt text
13698 </p>
13699 !! end
13700
13701 !! test
13702 HTML tag with necessary entities in attributes
13703 !! input
13704 <span title="&amp;amp;">foo</span>
13705 !! result
13706 <p><span title="&amp;amp;">foo</span>
13707 </p>
13708 !! end
13709
13710 !! test
13711 HTML tag with 'unnecessary' entity encoding in attributes
13712 !! input
13713 <span title="&amp;">foo</span>
13714 !! result
13715 <p><span title="&amp;">foo</span>
13716 </p>
13717 !! end
13718
13719 !! test
13720 HTML tag with broken attribute value quoting
13721 !! input
13722 <span title="Hello world>Foo</span>
13723 !! result
13724 <p><span>Foo</span>
13725 </p>
13726 !! end
13727
13728 !! test
13729 Parsoid-only: HTML tag with broken attribute value quoting
13730 !! options
13731 parsoid
13732 !! input
13733 <span title="Hello world>Foo</span>
13734 !! result
13735 <p><span title="Hello world">Foo</span>
13736 </p>
13737 !! end
13738
13739 !! test
13740 Table with broken attribute value quoting
13741 !! input
13742 {|
13743 | title="Hello world|Foo
13744 |}
13745 !! result
13746 <table>
13747 <tr>
13748 <td>Foo
13749 </td></tr></table>
13750
13751 !! end
13752
13753 !! test
13754 Table with broken attribute value quoting on consecutive lines
13755 !! input
13756 {|
13757 | title="Hello world|Foo
13758 | style="color:red|Bar
13759 |}
13760 !! result
13761 <table>
13762 <tr>
13763 <td>Foo
13764 </td>
13765 <td>Bar
13766 </td></tr></table>
13767
13768 !! end
13769
13770 !! test
13771 Parsoid-only: Table with broken attribute value quoting on consecutive lines
13772 !! options
13773 parsoid
13774 !! input
13775 {|
13776 | title="Hello world|Foo
13777 | style="color:red|Bar
13778 |}
13779 !! result
13780 <table>
13781 <tr>
13782 <td title="Hello world">Foo
13783 </td><td style="color: red">Bar
13784 </td></tr></table>
13785
13786 !! end
13787
13788 !!test
13789 Accept empty td cell attribute
13790 !!input
13791 {|
13792 | align="center" | foo || |
13793 |}
13794 !!result
13795 <table>
13796 <tr>
13797 <td align="center"> foo </td>
13798 <td>
13799 </td></tr></table>
13800
13801 !!end
13802
13803 !!test
13804 Non-empty attributes in th-cells
13805 !!input
13806 {|
13807 ! Foo !! style="color: red" | Bar
13808 |}
13809 !!result
13810 <table>
13811 <tr>
13812 <th> Foo </th>
13813 <th style="color: red"> Bar
13814 </th></tr></table>
13815
13816 !!end
13817
13818 !!test
13819 Accept empty attributes in th-cells
13820 !!input
13821 {|
13822 !| foo !!| bar
13823 |}
13824 !!result
13825 <table>
13826 <tr>
13827 <th> foo </th>
13828 <th> bar
13829 </th></tr></table>
13830
13831 !!end
13832
13833 !!test
13834 Empty table rows go away
13835 !!input
13836 {|
13837 | Hello
13838 | there
13839 |- class="foo"
13840 |-
13841 |}
13842 !! result
13843 <table>
13844 <tr>
13845 <td> Hello
13846 </td>
13847 <td> there
13848 </td></tr>
13849
13850 </table>
13851
13852 !! end
13853
13854 TODO:
13855 more images
13856 more tables
13857 character entities
13858 and much more
13859 Try for 100% code coverage