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