Oops and fix the test it was supposed to check.
[lhc/web/wiklou.git] / maintenance / 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 # comment run through Linker::formatComment() instead of main parser
25 # local format section links in edit comment text as local links
26 #
27 # For testing purposes, temporary articles can created:
28 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
29 # where '/' denotes a newline.
30
31 # This is the standard article assumed to exist.
32 !! article
33 Main Page
34 !! text
35 blah blah
36 !! endarticle
37
38 !!article
39 Template:Foo
40 !!text
41 FOO
42 !!endarticle
43
44 !! article
45 Template:Blank
46 !! text
47 !! endarticle
48
49 !! article
50 Template:!
51 !! text
52 |
53 !! endarticle
54
55 ###
56 ### Basic tests
57 ###
58 !! test
59 Blank input
60 !! input
61 !! result
62 !! end
63
64
65 !! test
66 Simple paragraph
67 !! input
68 This is a simple paragraph.
69 !! result
70 <p>This is a simple paragraph.
71 </p>
72 !! end
73
74 !! test
75 Simple list
76 !! input
77 * Item 1
78 * Item 2
79 !! result
80 <ul><li> Item 1
81 </li><li> Item 2
82 </li></ul>
83
84 !! end
85
86 !! test
87 Italics and bold
88 !! input
89 * plain
90 * plain''italic''plain
91 * plain''italic''plain''italic''plain
92 * plain'''bold'''plain
93 * plain'''bold'''plain'''bold'''plain
94 * plain''italic''plain'''bold'''plain
95 * plain'''bold'''plain''italic''plain
96 * plain''italic'''bold-italic'''italic''plain
97 * plain'''bold''bold-italic''bold'''plain
98 * plain'''''bold-italic'''italic''plain
99 * plain'''''bold-italic''bold'''plain
100 * plain''italic'''bold-italic'''''plain
101 * plain'''bold''bold-italic'''''plain
102 * plain l'''italic''plain
103 * plain l''''bold''' plain
104 !! result
105 <ul><li> plain
106 </li><li> plain<i>italic</i>plain
107 </li><li> plain<i>italic</i>plain<i>italic</i>plain
108 </li><li> plain<b>bold</b>plain
109 </li><li> plain<b>bold</b>plain<b>bold</b>plain
110 </li><li> plain<i>italic</i>plain<b>bold</b>plain
111 </li><li> plain<b>bold</b>plain<i>italic</i>plain
112 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
113 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
114 </li><li> plain<i><b>bold-italic</b>italic</i>plain
115 </li><li> plain<b><i>bold-italic</i>bold</b>plain
116 </li><li> plain<i>italic<b>bold-italic</b></i>plain
117 </li><li> plain<b>bold<i>bold-italic</i></b>plain
118 </li><li> plain l'<i>italic</i>plain
119 </li><li> plain l'<b>bold</b> plain
120 </li></ul>
121
122 !! end
123
124 ###
125 ### <nowiki> test cases
126 ###
127
128 !! test
129 <nowiki> unordered list
130 !! input
131 <nowiki>* This is not an unordered list item.</nowiki>
132 !! result
133 <p>* This is not an unordered list item.
134 </p>
135 !! end
136
137 !! test
138 <nowiki> spacing
139 !! input
140 <nowiki>Lorem ipsum dolor
141
142 sed abit.
143 sed nullum.
144
145 :and a colon
146 </nowiki>
147 !! result
148 <p>Lorem ipsum dolor
149
150 sed abit.
151 sed nullum.
152
153 :and a colon
154
155 </p>
156 !! end
157
158 !! test
159 nowiki 3
160 !! input
161 :There is not nowiki.
162 :There is <nowiki>nowiki</nowiki>.
163
164 #There is not nowiki.
165 #There is <nowiki>nowiki</nowiki>.
166
167 *There is not nowiki.
168 *There is <nowiki>nowiki</nowiki>.
169 !! result
170 <dl><dd>There is not nowiki.
171 </dd><dd>There is nowiki.
172 </dd></dl>
173 <ol><li>There is not nowiki.
174 </li><li>There is nowiki.
175 </li></ol>
176 <ul><li>There is not nowiki.
177 </li><li>There is nowiki.
178 </li></ul>
179
180 !! end
181
182
183 ###
184 ### Comments
185 ###
186 !! test
187 Comment test 1
188 !! input
189 <!-- comment 1 --> asdf
190 <!-- comment 2 -->
191 !! result
192 <pre>asdf
193 </pre>
194
195 !! end
196
197 !! test
198 Comment test 2
199 !! input
200 asdf
201 <!-- comment 1 -->
202 jkl
203 !! result
204 <p>asdf
205 jkl
206 </p>
207 !! end
208
209 !! test
210 Comment test 3
211 !! input
212 asdf
213 <!-- comment 1 -->
214 <!-- comment 2 -->
215 jkl
216 !! result
217 <p>asdf
218 jkl
219 </p>
220 !! end
221
222 !! test
223 Comment test 4
224 !! input
225 asdf<!-- comment 1 -->jkl
226 !! result
227 <p>asdfjkl
228 </p>
229 !! end
230
231 !! test
232 Comment spacing
233 !! input
234 a
235 <!-- foo --> b <!-- bar -->
236 c
237 !! result
238 <p>a
239 </p>
240 <pre> b
241 </pre>
242 <p>c
243 </p>
244 !! end
245
246 !! test
247 Comment whitespace
248 !! input
249 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
250 !! result
251
252 !! end
253
254 !! test
255 Comment semantics and delimiters
256 !! input
257 <!-- --><!----><!-----><!------>
258 !! result
259
260 !! end
261
262 !! test
263 Comment semantics and delimiters, redux
264 !! input
265 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
266 -- foo -- funky huh? ... -->
267 !! result
268
269 !! end
270
271 !! test
272 Comment semantics and delimiters: directors cut
273 !! input
274 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
275 everything starting with < followed by !-- until the first -- and > we see,
276 that wouldn't be valid XML however, since in XML -- has to terminate a comment
277 -->-->
278 !! result
279 <p>--&gt;
280 </p>
281 !! end
282
283 !! test
284 Comment semantics: nesting
285 !! input
286 <!--<!-- no, we're not going to do anything fancy here -->-->
287 !! result
288 <p>--&gt;
289 </p>
290 !! end
291
292 !! test
293 Comment semantics: unclosed comment at end
294 !! input
295 <!--This comment will run out to the end of the document
296 !! result
297
298 !! end
299
300 !! test
301 Comment in template title
302 !! input
303 {{f<!---->oo}}
304 !! result
305 <p>FOO
306 </p>
307 !! end
308
309 !! test
310 Comment on its own line post-expand
311 !! input
312 a
313 {{blank}}<!---->
314 b
315 !! result
316 <p>a
317 </p><p>b
318 </p>
319 !! end
320
321 ###
322 ### Preformatted text
323 ###
324 !! test
325 Preformatted text
326 !! input
327 This is some
328 Preformatted text
329 With ''italic''
330 And '''bold'''
331 And a [[Main Page|link]]
332 !! result
333 <pre>This is some
334 Preformatted text
335 With <i>italic</i>
336 And <b>bold</b>
337 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
338 </pre>
339 !! end
340
341 !! test
342 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
343 !! input
344 <pre><nowiki>
345 <b>
346 <cite>
347 <em>
348 </nowiki></pre>
349 !! result
350 <pre>
351 &lt;b&gt;
352 &lt;cite&gt;
353 &lt;em&gt;
354 </pre>
355
356 !! end
357
358 !! test
359 Regression with preformatted in <center>
360 !! input
361 <center>
362 Blah
363 </center>
364 !! result
365 <center>
366 <pre>Blah
367 </pre>
368 </center>
369
370 !! end
371
372 !! test
373 <pre> with attributes (bug 3202)
374 !! input
375 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
376 !! result
377 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
378
379 !! end
380
381 !! test
382 <pre> with width attribute (bug 3202)
383 !! input
384 <pre width="8">Narrow screen goodies</pre>
385 !! result
386 <pre width="8">Narrow screen goodies</pre>
387
388 !! end
389
390 !! test
391 <pre> with forbidden attribute (bug 3202)
392 !! input
393 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
394 !! result
395 <pre width="8">Narrow screen goodies</pre>
396
397 !! end
398
399 !! test
400 <pre> with forbidden attribute values (bug 3202)
401 !! input
402 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
403 !! result
404 <pre width="8">Narrow screen goodies</pre>
405
406 !! end
407
408 ###
409 ### Definition lists
410 ###
411 !! test
412 Simple definition
413 !! input
414 ; name : Definition
415 !! result
416 <dl><dt> name&nbsp;</dt><dd> Definition
417 </dd></dl>
418
419 !! end
420
421 !! test
422 Definition list for indentation only
423 !! input
424 : Indented text
425 !! result
426 <dl><dd> Indented text
427 </dd></dl>
428
429 !! end
430
431 !! test
432 Definition list with no space
433 !! input
434 ;name:Definition
435 !! result
436 <dl><dt>name</dt><dd>Definition
437 </dd></dl>
438
439 !!end
440
441 !! test
442 Definition list with URL link
443 !! input
444 ; http://example.com/ : definition
445 !! result
446 <dl><dt> <a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
447 </dd></dl>
448
449 !! end
450
451 !! test
452 Definition list with bracketed URL link
453 !! input
454 ;[http://www.example.com/ Example]:Something about it
455 !! result
456 <dl><dt><a href="http://www.example.com/" class="external text" rel="nofollow">Example</a></dt><dd>Something about it
457 </dd></dl>
458
459 !! end
460
461 !! test
462 Definition list with wikilink containing colon
463 !! input
464 ; [[Help:FAQ]]: The least-read page on Wikipedia
465 !! result
466 <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
467 </dd></dl>
468
469 !! end
470
471 # At Brion's and JeLuF's insistence... :)
472 !! test
473 Definition list with news link containing colon
474 !! input
475 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
476 !! result
477 <dl><dt> <a href="news:alt.wikipedia.rox" class="external free" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
478 </dd></dl>
479
480 !! end
481
482 !! test
483 Malformed definition list with colon
484 !! input
485 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
486 !! result
487 <dl><dt> <a href="news:alt.wikipedia.rox" class="external free" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
488 </dt></dl>
489
490 !! end
491
492 !! test
493 Definition lists: colon in external link text
494 !! input
495 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
496 !! result
497 <dl><dt> <a href="http://www.wikipedia2.org/" class="external text" rel="nofollow">Wikipedia&nbsp;: The Next Generation</a></dt><dd> OK, I made that up
498 </dd></dl>
499
500 !! end
501
502 !! test
503 Definition lists: colon in HTML attribute
504 !! input
505 ;<b style="display: inline">bold</b>
506 !! result
507 <dl><dt><b style="display: inline">bold</b>
508 </dt></dl>
509
510 !! end
511
512
513 !! test
514 Definition lists: self-closed tag
515 !! input
516 ;one<br/>two : two-line fun
517 !! result
518 <dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
519 </dd></dl>
520
521 !! end
522
523
524 ###
525 ### External links
526 ###
527 !! test
528 External links: non-bracketed
529 !! input
530 Non-bracketed: http://example.com
531 !! result
532 <p>Non-bracketed: <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>
533 </p>
534 !! end
535
536 !! test
537 External links: numbered
538 !! input
539 Numbered: [http://example.com]
540 Numbered: [http://example.net]
541 Numbered: [http://example.com]
542 !! result
543 <p>Numbered: <a href="http://example.com" class="external autonumber" rel="nofollow">[1]</a>
544 Numbered: <a href="http://example.net" class="external autonumber" rel="nofollow">[2]</a>
545 Numbered: <a href="http://example.com" class="external autonumber" rel="nofollow">[3]</a>
546 </p>
547 !!end
548
549 !! test
550 External links: specified text
551 !! input
552 Specified text: [http://example.com link]
553 !! result
554 <p>Specified text: <a href="http://example.com" class="external text" rel="nofollow">link</a>
555 </p>
556 !!end
557
558 !! test
559 External links: trail
560 !! input
561 Linktrails should not work for external links: [http://example.com link]s
562 !! result
563 <p>Linktrails should not work for external links: <a href="http://example.com" class="external text" rel="nofollow">link</a>s
564 </p>
565 !! end
566
567 !! test
568 External links: dollar sign in URL
569 !! input
570 http://example.com/1$2345
571 !! result
572 <p><a href="http://example.com/1$2345" class="external free" rel="nofollow">http://example.com/1$2345</a>
573 </p>
574 !! end
575
576 !! test
577 External links: dollar sign in URL (named)
578 !! input
579 [http://example.com/1$2345]
580 !! result
581 <p><a href="http://example.com/1$2345" class="external autonumber" rel="nofollow">[1]</a>
582 </p>
583 !!end
584
585 !! test
586 External links: open square bracket forbidden in URL (bug 4377)
587 !! input
588 http://example.com/1[2345
589 !! result
590 <p><a href="http://example.com/1" class="external free" rel="nofollow">http://example.com/1</a>[2345
591 </p>
592 !! end
593
594 !! test
595 External links: open square bracket forbidden in URL (named) (bug 4377)
596 !! input
597 [http://example.com/1[2345]
598 !! result
599 <p><a href="http://example.com/1" class="external text" rel="nofollow">[2345</a>
600 </p>
601 !!end
602
603 !! test
604 External links: nowiki in URL link text (bug 6230)
605 !!input
606 [http://example.com/ <nowiki>''example site''</nowiki>]
607 !! result
608 <p><a href="http://example.com/" class="external text" rel="nofollow">''example site''</a>
609 </p>
610 !! end
611
612 !! test
613 External links: newline forbidden in text (bug 6230 regression check)
614 !! input
615 [http://example.com/ first
616 second]
617 !! result
618 <p>[<a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a> first
619 second]
620 </p>
621 !!end
622
623 !! test
624 External image
625 !! input
626 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
627 !! result
628 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
629 </p>
630 !! end
631
632 !! test
633 External image from https
634 !! input
635 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
636 !! result
637 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
638 </p>
639 !! end
640
641 !! test
642 Link to non-http image, no img tag
643 !! input
644 Link to non-http image, no img tag: ftp://example.com/test.jpg
645 !! result
646 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class="external free" rel="nofollow">ftp://example.com/test.jpg</a>
647 </p>
648 !! end
649
650 !! test
651 External links: terminating separator
652 !! input
653 Terminating separator: http://example.com/thing,
654 !! result
655 <p>Terminating separator: <a href="http://example.com/thing" class="external free" rel="nofollow">http://example.com/thing</a>,
656 </p>
657 !! end
658
659 !! test
660 External links: intervening separator
661 !! input
662 Intervening separator: http://example.com/1,2,3
663 !! result
664 <p>Intervening separator: <a href="http://example.com/1,2,3" class="external free" rel="nofollow">http://example.com/1,2,3</a>
665 </p>
666 !! end
667
668 !! test
669 External links: old bug with URL in query
670 !! input
671 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
672 !! result
673 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class="external text" rel="nofollow">link</a>
674 </p>
675 !! end
676
677 !! test
678 External links: old URL-in-URL bug, mixed protocols
679 !! input
680 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
681 !! result
682 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class="external text" rel="nofollow">link</a>
683 </p>
684 !!end
685
686 !! test
687 External links: URL in text
688 !! input
689 URL in text: [http://example.com http://example.com]
690 !! result
691 <p>URL in text: <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>
692 </p>
693 !! end
694
695 !! test
696 External links: Clickable images
697 !! input
698 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
699 !! result
700 <p>ja-style clickable images: <a href="http://example.com" class="external text" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
701 </p>
702 !!end
703
704 !! test
705 External links: raw ampersand
706 !! input
707 Old &amp; use: http://x&y
708 !! result
709 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" rel="nofollow">http://x&amp;y</a>
710 </p>
711 !! end
712
713 !! test
714 External links: encoded ampersand
715 !! input
716 Old &amp; use: http://x&amp;y
717 !! result
718 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" rel="nofollow">http://x&amp;y</a>
719 </p>
720 !! end
721
722 !! test
723 External links: encoded equals (bug 6102)
724 !! input
725 http://example.com/?foo&#61;bar
726 !! result
727 <p><a href="http://example.com/?foo=bar" class="external free" rel="nofollow">http://example.com/?foo=bar</a>
728 </p>
729 !! end
730
731 !! test
732 External links: [raw ampersand]
733 !! input
734 Old &amp; use: [http://x&y]
735 !! result
736 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" rel="nofollow">[1]</a>
737 </p>
738 !! end
739
740 !! test
741 External links: [encoded ampersand]
742 !! input
743 Old &amp; use: [http://x&amp;y]
744 !! result
745 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" rel="nofollow">[1]</a>
746 </p>
747 !! end
748
749 !! test
750 External links: [encoded equals] (bug 6102)
751 !! input
752 [http://example.com/?foo&#61;bar]
753 !! result
754 <p><a href="http://example.com/?foo=bar" class="external autonumber" rel="nofollow">[1]</a>
755 </p>
756 !! end
757
758 !! test
759 External links: [IDN ignored character reference in hostname; strip it right off]
760 !! input
761 [http://e&zwnj;xample.com/]
762 !! result
763 <p><a href="http://example.com/" class="external autonumber" rel="nofollow">[1]</a>
764 </p>
765 !! end
766
767 !! test
768 External links: IDN ignored character reference in hostname; strip it right off
769 !! input
770 http://e&zwnj;xample.com/
771 !! result
772 <p><a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a>
773 </p>
774 !! end
775
776 !! test
777 External links: www.jpeg.org (bug 554)
778 !! input
779 http://www.jpeg.org
780 !!result
781 <p><a href="http://www.jpeg.org" class="external free" rel="nofollow">http://www.jpeg.org</a>
782 </p>
783 !! end
784
785 !! test
786 External links: URL within URL (original bug 2)
787 !! input
788 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
789 !! result
790 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class="external autonumber" rel="nofollow">[1]</a>
791 </p>
792 !! end
793
794 !! test
795 BUG 361: URL inside bracketed URL
796 !! input
797 [http://www.example.com/foo http://www.example.com/bar]
798 !! result
799 <p><a href="http://www.example.com/foo" class="external text" rel="nofollow">http://www.example.com/bar</a>
800 </p>
801 !! end
802
803 !! test
804 BUG 361: URL within URL, not bracketed
805 !! input
806 http://www.example.com/foo?=http://www.example.com/bar
807 !! result
808 <p><a href="http://www.example.com/foo?=http://www.example.com/bar" class="external free" rel="nofollow">http://www.example.com/foo?=http://www.example.com/bar</a>
809 </p>
810 !! end
811
812 !! test
813 BUG 289: ">"-token in URL-tail
814 !! input
815 http://www.example.com/<hello>
816 !! result
817 <p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a>&lt;hello&gt;
818 </p>
819 !!end
820
821 !! test
822 BUG 289: literal ">"-token in URL-tail
823 !! input
824 http://www.example.com/<b>html</b>
825 !! result
826 <p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a><b>html</b>
827 </p>
828 !!end
829
830 !! test
831 BUG 289: ">"-token in bracketed URL
832 !! input
833 [http://www.example.com/<hello> stuff]
834 !! result
835 <p><a href="http://www.example.com/" class="external text" rel="nofollow">&lt;hello&gt; stuff</a>
836 </p>
837 !!end
838
839 !! test
840 BUG 289: literal ">"-token in bracketed URL
841 !! input
842 [http://www.example.com/<b>html</b> stuff]
843 !! result
844 <p><a href="http://www.example.com/" class="external text" rel="nofollow"><b>html</b> stuff</a>
845 </p>
846 !!end
847
848 !! test
849 BUG 289: literal double quote at end of URL
850 !! input
851 http://www.example.com/"hello"
852 !! result
853 <p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a>"hello"
854 </p>
855 !!end
856
857 !! test
858 BUG 289: literal double quote in bracketed URL
859 !! input
860 [http://www.example.com/"hello" stuff]
861 !! result
862 <p><a href="http://www.example.com/" class="external text" rel="nofollow">"hello" stuff</a>
863 </p>
864 !!end
865
866 !! test
867 External links: invalid character
868 Fixme: the missing char seems to have gone missing
869 !! options
870 disabled
871 !! input
872 [http://www.example.com test]
873 !! result
874 <p>[<a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a> test]
875 </p>
876 !! end
877
878 !! test
879 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
880 !! input
881 [http://www.example.com test]
882 !! result
883 <p><a href="http://www.example.com" class="external text" rel="nofollow">test</a>
884 </p>
885 !! end
886
887 !! test
888 External links: wiki links within external link (Bug 3695)
889 !! input
890 [http://example.com [[wikilink]] embedded in ext link]
891 !! result
892 <p><a href="http://example.com" class="external text" rel="nofollow"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a href="http://example.com" class="external text" rel="nofollow"> embedded in ext link</a>
893 </p>
894 !! end
895
896 !! test
897 BUG 787: Links with one slash after the url protocol are invalid
898 !! input
899 http:/example.com
900
901 [http:/example.com title]
902 !! result
903 <p>http:/example.com
904 </p><p>[http:/example.com title]
905 </p>
906 !! end
907
908 !! test
909 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
910 !! input
911 ''[http://example.com text'']
912 [http://example.com '''text]'''
913 ''Something [http://example.com in italic'']
914 ''Something [http://example.com mixed''''', even bold]'''
915 '''''Now [http://example.com both''''']
916 !! result
917 <p><a href="http://example.com" class="external text" rel="nofollow"><i>text</i></a>
918 <a href="http://example.com" class="external text" rel="nofollow"><b>text</b></a>
919 <i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>in italic</i></a>
920 <i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>mixed</i><b>, even bold</b></a>
921 <i><b>Now </b></i><a href="http://example.com" class="external text" rel="nofollow"><i><b>both</b></i></a>
922 </p>
923 !! end
924
925
926 !! test
927 Bug 4781: %26 in URL
928 !! input
929 http://www.example.com/?title=AT%26T
930 !! result
931 <p><a href="http://www.example.com/?title=AT%26T" class="external free" rel="nofollow">http://www.example.com/?title=AT%26T</a>
932 </p>
933 !! end
934
935 !! test
936 Bug 4781, 5267: %26 in URL
937 !! input
938 http://www.example.com/?title=100%25_Bran
939 !! result
940 <p><a href="http://www.example.com/?title=100%25_Bran" class="external free" rel="nofollow">http://www.example.com/?title=100%25_Bran</a>
941 </p>
942 !! end
943
944 !! test
945 Bug 4781, 5267: %28, %29 in URL
946 !! input
947 http://www.example.com/?title=Ben-Hur_%281959_film%29
948 !! result
949 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external free" rel="nofollow">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
950 </p>
951 !! end
952
953
954 !! test
955 Bug 4781: %26 in autonumber URL
956 !! input
957 [http://www.example.com/?title=AT%26T]
958 !! result
959 <p><a href="http://www.example.com/?title=AT%26T" class="external autonumber" rel="nofollow">[1]</a>
960 </p>
961 !! end
962
963 !! test
964 Bug 4781, 5267: %26 in autonumber URL
965 !! input
966 [http://www.example.com/?title=100%25_Bran]
967 !! result
968 <p><a href="http://www.example.com/?title=100%25_Bran" class="external autonumber" rel="nofollow">[1]</a>
969 </p>
970 !! end
971
972 !! test
973 Bug 4781, 5267: %28, %29 in autonumber URL
974 !! input
975 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
976 !! result
977 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external autonumber" rel="nofollow">[1]</a>
978 </p>
979 !! end
980
981
982 !! test
983 Bug 4781: %26 in bracketed URL
984 !! input
985 [http://www.example.com/?title=AT%26T link]
986 !! result
987 <p><a href="http://www.example.com/?title=AT%26T" class="external text" rel="nofollow">link</a>
988 </p>
989 !! end
990
991 !! test
992 Bug 4781, 5267: %26 in bracketed URL
993 !! input
994 [http://www.example.com/?title=100%25_Bran link]
995 !! result
996 <p><a href="http://www.example.com/?title=100%25_Bran" class="external text" rel="nofollow">link</a>
997 </p>
998 !! end
999
1000 !! test
1001 Bug 4781, 5267: %28, %29 in bracketed URL
1002 !! input
1003 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
1004 !! result
1005 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external text" rel="nofollow">link</a>
1006 </p>
1007 !! end
1008
1009 !! test
1010 External link containing double-single-quotes in text '' (bug 4598 sanity check)
1011 !! input
1012 Some [http://example.com/ pretty ''italics'' and stuff]!
1013 !! result
1014 <p>Some <a href="http://example.com/" class="external text" rel="nofollow">pretty <i>italics</i> and stuff</a>!
1015 </p>
1016 !! end
1017
1018 !! test
1019 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
1020 !! input
1021 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
1022 !! result
1023 <p><i>Some </i><a href="http://example.com/" class="external text" rel="nofollow"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1024 </p>
1025 !! end
1026
1027 !! test
1028 URL-encoding in URL functions (single parameter)
1029 !! input
1030 {{localurl:Some page|amp=&}}
1031 !! result
1032 <p>/index.php?title=Some_page&amp;amp=&amp;
1033 </p>
1034 !! end
1035
1036 !! test
1037 URL-encoding in URL functions (multiple parameters)
1038 !! input
1039 {{localurl:Some page|q=?&amp=&}}
1040 !! result
1041 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
1042 </p>
1043 !! end
1044
1045 ###
1046 ### Quotes
1047 ###
1048
1049 !! test
1050 Quotes
1051 !! input
1052 Normal text. '''Bold text.''' Normal text. ''Italic text.''
1053
1054 Normal text. '''''Bold italic text.''''' Normal text.
1055 !!result
1056 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
1057 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1058 </p>
1059 !! end
1060
1061
1062 !! test
1063 Unclosed and unmatched quotes
1064 !! input
1065 '''''Bold italic text '''with bold deactivated''' in between.'''''
1066
1067 '''''Bold italic text ''with italic deactivated'' in between.'''''
1068
1069 '''Bold text..
1070
1071 ..spanning two paragraphs (should not work).'''
1072
1073 '''Bold tag left open
1074
1075 ''Italic tag left open
1076
1077 Normal text.
1078
1079 <!-- Unmatching number of opening, closing tags: -->
1080 '''This year''''s election ''should'' beat '''last year''''s.
1081
1082 ''Tom'''s car is bigger than ''Susan'''s.
1083 !! result
1084 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1085 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1086 </p><p><b>Bold text..</b>
1087 </p><p>..spanning two paragraphs (should not work).
1088 </p><p><b>Bold tag left open</b>
1089 </p><p><i>Italic tag left open</i>
1090 </p><p>Normal text.
1091 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1092 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1093 </p>
1094 !! end
1095
1096 ###
1097 ### Tables
1098 ###
1099 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1100 ###
1101
1102 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1103 # is the bare minimun required by the spec, see:
1104 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1105 !! test
1106 A table with no data.
1107 !! input
1108 {||}
1109 !! result
1110 !! end
1111
1112 # A table with nothing but a caption is invalid XHTML, we might want to render
1113 # this as <p>caption</p>
1114 !! test
1115 A table with nothing but a caption
1116 !! input
1117 {|
1118 |+ caption
1119 |}
1120 !! result
1121 <table>
1122 <caption> caption
1123 </caption><tr><td></td></tr></table>
1124
1125 !! end
1126
1127 !! test
1128 Simple table
1129 !! input
1130 {|
1131 | 1 || 2
1132 |-
1133 | 3 || 4
1134 |}
1135 !! result
1136 <table>
1137 <tr>
1138 <td> 1 </td><td> 2
1139 </td></tr>
1140 <tr>
1141 <td> 3 </td><td> 4
1142 </td></tr></table>
1143
1144 !! end
1145
1146 !! test
1147 Multiplication table
1148 !! input
1149 {| border="1" cellpadding="2"
1150 |+Multiplication table
1151 |-
1152 ! &times; !! 1 !! 2 !! 3
1153 |-
1154 ! 1
1155 | 1 || 2 || 3
1156 |-
1157 ! 2
1158 | 2 || 4 || 6
1159 |-
1160 ! 3
1161 | 3 || 6 || 9
1162 |-
1163 ! 4
1164 | 4 || 8 || 12
1165 |-
1166 ! 5
1167 | 5 || 10 || 15
1168 |}
1169 !! result
1170 <table border="1" cellpadding="2">
1171 <caption>Multiplication table
1172 </caption>
1173 <tr>
1174 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1175 </th></tr>
1176 <tr>
1177 <th> 1
1178 </th><td> 1 </td><td> 2 </td><td> 3
1179 </td></tr>
1180 <tr>
1181 <th> 2
1182 </th><td> 2 </td><td> 4 </td><td> 6
1183 </td></tr>
1184 <tr>
1185 <th> 3
1186 </th><td> 3 </td><td> 6 </td><td> 9
1187 </td></tr>
1188 <tr>
1189 <th> 4
1190 </th><td> 4 </td><td> 8 </td><td> 12
1191 </td></tr>
1192 <tr>
1193 <th> 5
1194 </th><td> 5 </td><td> 10 </td><td> 15
1195 </td></tr></table>
1196
1197 !! end
1198
1199 !! test
1200 Table rowspan
1201 !! input
1202 {| align=right border=1
1203 | Cell 1, row 1
1204 |rowspan=2| Cell 2, row 1 (and 2)
1205 | Cell 3, row 1
1206 |-
1207 | Cell 1, row 2
1208 | Cell 3, row 2
1209 |}
1210 !! result
1211 <table align="right" border="1">
1212 <tr>
1213 <td> Cell 1, row 1
1214 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1215 </td><td> Cell 3, row 1
1216 </td></tr>
1217 <tr>
1218 <td> Cell 1, row 2
1219 </td><td> Cell 3, row 2
1220 </td></tr></table>
1221
1222 !! end
1223
1224 !! test
1225 Nested table
1226 !! input
1227 {| border=1
1228 | &alpha;
1229 |
1230 {| bgcolor=#ABCDEF border=2
1231 |nested
1232 |-
1233 |table
1234 |}
1235 |the original table again
1236 |}
1237 !! result
1238 <table border="1">
1239 <tr>
1240 <td> &alpha;
1241 </td><td>
1242 <table bgcolor="#ABCDEF" border="2">
1243 <tr>
1244 <td>nested
1245 </td></tr>
1246 <tr>
1247 <td>table
1248 </td></tr></table>
1249 </td><td>the original table again
1250 </td></tr></table>
1251
1252 !! end
1253
1254 !! test
1255 Invalid attributes in table cell (bug 1830)
1256 !! input
1257 {|
1258 |Cell:|broken
1259 |}
1260 !! result
1261 <table>
1262 <tr>
1263 <td>broken
1264 </td></tr></table>
1265
1266 !! end
1267
1268
1269 # FIXME: It's not clear at all that this is the result we want, but the actual
1270 # output right now is invalid XML, so clearly something is wrong. The result
1271 # specified here is now valid XML, which is an improvement . . .
1272 !! test
1273 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
1274 !! options
1275 disabled
1276 !! input
1277 {|
1278 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1279 !! result
1280 <table>
1281 <tr>
1282 <td><a href="ftp://|x||" class="external autonumber" title="ftp://|x||" rel="nofollow">[1]</a></td><td>" onmouseover="alert(document.cookie)"&gt;test
1283 </td>
1284 </tr>
1285 </table>
1286
1287 !! end
1288
1289
1290 ###
1291 ### Internal links
1292 ###
1293 !! test
1294 Plain link, capitalized
1295 !! input
1296 [[Main Page]]
1297 !! result
1298 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1299 </p>
1300 !! end
1301
1302 !! test
1303 Plain link, uncapitalized
1304 !! input
1305 [[main Page]]
1306 !! result
1307 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1308 </p>
1309 !! end
1310
1311 !! test
1312 Piped link
1313 !! input
1314 [[Main Page|The Main Page]]
1315 !! result
1316 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1317 </p>
1318 !! end
1319
1320 !! test
1321 Broken link
1322 !! input
1323 [[Zigzagzogzagzig]]
1324 !! result
1325 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
1326 </p>
1327 !! end
1328
1329 !! test
1330 Broken link with fragment
1331 !! input
1332 [[Zigzagzogzagzig#zug]]
1333 !! result
1334 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
1335 </p>
1336 !! end
1337
1338 !! test
1339 Special page link with fragment
1340 !! input
1341 [[Special:Version#anchor]]
1342 !! result
1343 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
1344 </p>
1345 !! end
1346
1347 !! test
1348 Nonexistent special page link with fragment
1349 !! input
1350 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
1351 !! result
1352 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
1353 </p>
1354 !! end
1355
1356 !! test
1357 Link with prefix
1358 !! input
1359 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1360 !! result
1361 <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>
1362 </p>
1363 !! end
1364
1365 !! test
1366 Link with suffix
1367 !! input
1368 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
1369 !! result
1370 <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>!!!
1371 </p>
1372 !! end
1373
1374 !! test
1375 Link with 3 brackets
1376 !! input
1377 [[[main page]]]
1378 !! result
1379 <p>[[[main page]]]
1380 </p>
1381 !! end
1382
1383 !! test
1384 Piped link with 3 brackets
1385 !! input
1386 [[[main page|the main page]]]
1387 !! result
1388 <p>[[[main page|the main page]]]
1389 </p>
1390 !! end
1391
1392 !! test
1393 Link with multiple pipes
1394 !! input
1395 [[Main Page|The|Main|Page]]
1396 !! result
1397 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1398 </p>
1399 !! end
1400
1401 !! test
1402 Link to namespaces
1403 !! input
1404 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1405 !! result
1406 <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>
1407 </p>
1408 !! end
1409
1410 !! test
1411 Piped link to namespace
1412 !! input
1413 [[Meta:Disclaimers|The disclaimers]]
1414 !! result
1415 <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>
1416 </p>
1417 !! end
1418
1419 !! test
1420 Link containing }
1421 !! input
1422 [[Usually caused by a typo (oops}]]
1423 !! result
1424 <p>[[Usually caused by a typo (oops}]]
1425 </p>
1426 !! end
1427
1428 !! test
1429 Link containing % (not as a hex sequence)
1430 !! input
1431 [[7% Solution]]
1432 !! result
1433 <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>
1434 </p>
1435 !! end
1436
1437 !! test
1438 Link containing % as a single hex sequence interpreted to char
1439 !! input
1440 [[7%25 Solution]]
1441 !! result
1442 <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>
1443 </p>
1444 !!end
1445
1446 !! test
1447 Link containing % as a double hex sequence interpreted to hex sequence
1448 !! input
1449 [[7%2525 Solution]]
1450 !! result
1451 <p>[[7%2525 Solution]]
1452 </p>
1453 !!end
1454
1455 !! test
1456 Link containing "#<" and "#>" % as hex sequences- these are valid section anchors
1457 Example for such a section: == < ==
1458 !! input
1459 [[%23%3c]][[%23%3e]]
1460 !! result
1461 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
1462 </p>
1463 !! end
1464
1465 !! test
1466 Link containing "<#" and ">#" as hex sequences
1467 !! input
1468 [[%3c%23]][[%3e%23]]
1469 !! result
1470 <p>[[%3c%23]]<a href="/index.php?title=%3E&amp;action=edit&amp;redlink=1" class="new" title="&gt; (page does not exist)">&gt;#</a>
1471 </p>
1472 !! end
1473
1474 !! test
1475 Link containing double-single-quotes '' (bug 4598)
1476 !! options
1477 disabled
1478 !! input
1479 [[Lista d''e paise d''o munno]]
1480 !! result
1481 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit" class="new" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a>
1482 </p>
1483 !! end
1484
1485 !! test
1486 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1487 !! input
1488 Some [[Link|pretty ''italics'' and stuff]]!
1489 !! result
1490 <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>!
1491 </p>
1492 !! end
1493
1494 !! test
1495 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1496 !! input
1497 ''Some [[Link|pretty ''italics'' and stuff]]!
1498 !! result
1499 <p><i>Some </i><a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1500 </p>
1501 !! end
1502
1503 !! test
1504 Plain link to URL
1505 !! input
1506 [[http://www.example.com]]
1507 !! result
1508 <p>[<a href="http://www.example.com" class="external autonumber" rel="nofollow">[1]</a>]
1509 </p>
1510 !! end
1511
1512 # I'm fairly sure the expected result here is wrong.
1513 # We want these to be URL links, not pseudo-pages with URLs for titles....
1514 # However the current output is also pretty screwy.
1515 #
1516 # ----
1517 # I'm changing it to match the current output--it arguably makes more
1518 # sense in the light of the test above. Old expected result was:
1519 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
1520 #</p>
1521 # But I think this test is bordering on "garbage in, garbage out" anyway.
1522 # -- wtm
1523 !! test
1524 Piped link to URL
1525 !! input
1526 Piped link to URL: [[http://www.example.com|an example URL]]
1527 !! result
1528 <p>Piped link to URL: [<a href="http://www.example.com|an" class="external text" rel="nofollow">example URL</a>]
1529 </p>
1530 !! end
1531
1532 !! test
1533 BUG 2: [[page|http://url/]] should link to page, not http://url/
1534 !! input
1535 [[Main Page|http://url/]]
1536 !! result
1537 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1538 </p>
1539 !! end
1540
1541 !! test
1542 BUG 337: Escaped self-links should be bold
1543 !! options
1544 title=[[Bug462]]
1545 !! input
1546 [[Bu&#103;462]] [[Bug462]]
1547 !! result
1548 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1549 </p>
1550 !! end
1551
1552 !! test
1553 Self-link to section should not be bold
1554 !! options
1555 title=[[Main Page]]
1556 !! input
1557 [[Main Page#section]]
1558 !! result
1559 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1560 </p>
1561 !! end
1562
1563 !! article
1564 00
1565 !! text
1566 This is 00.
1567 !! endarticle
1568
1569 !!test
1570 Self-link to numeric title
1571 !!options
1572 title=[[0]]
1573 !!input
1574 [[0]]
1575 !!result
1576 <p><strong class="selflink">0</strong>
1577 </p>
1578 !!end
1579
1580 !!test
1581 Link to numeric-equivalent title
1582 !!options
1583 title=[[0]]
1584 !!input
1585 [[00]]
1586 !!result
1587 <p><a href="/wiki/00" title="00">00</a>
1588 </p>
1589 !!end
1590
1591 !! test
1592 <nowiki> inside a link
1593 !! input
1594 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1595 !! result
1596 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1597 </p>
1598 !! end
1599
1600 ###
1601 ### Interwiki links (see maintenance/interwiki.sql)
1602 ###
1603
1604 !! test
1605 Inline interwiki link
1606 !! input
1607 [[MeatBall:SoftSecurity]]
1608 !! result
1609 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1610 </p>
1611 !! end
1612
1613 !! test
1614 Inline interwiki link with empty title (bug 2372)
1615 !! input
1616 [[MeatBall:]]
1617 !! result
1618 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
1619 </p>
1620 !! end
1621
1622 !! test
1623 Interwiki link encoding conversion (bug 1636)
1624 !! input
1625 *[[Wikipedia:ro:Olteni&#0355;a]]
1626 *[[Wikipedia:ro:Olteni&#355;a]]
1627 !! result
1628 <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>
1629 </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>
1630 </li></ul>
1631
1632 !! end
1633
1634 !! test
1635 Interwiki link with fragment (bug 2130)
1636 !! input
1637 [[MeatBall:SoftSecurity#foo]]
1638 !! result
1639 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1640 </p>
1641 !! end
1642
1643 !! test
1644 Interlanguage link
1645 !! input
1646 Blah blah blah
1647 [[zh:Chinese]]
1648 !!result
1649 <p>Blah blah blah
1650 </p>
1651 !! end
1652
1653 !! test
1654 Double interlanguage link
1655 !! input
1656 Blah blah blah
1657 [[es:Spanish]]
1658 [[zh:Chinese]]
1659 !!result
1660 <p>Blah blah blah
1661 </p>
1662 !! end
1663
1664 !! test
1665 Interlanguage link, with prefix links
1666 !! options
1667 language=ln
1668 !! input
1669 Blah blah blah
1670 [[zh:Chinese]]
1671 !!result
1672 <p>Blah blah blah
1673 </p>
1674 !! end
1675
1676 !! test
1677 Double interlanguage link, with prefix links (bug 8897)
1678 !! options
1679 language=ln
1680 !! input
1681 Blah blah blah
1682 [[es:Spanish]]
1683 [[zh:Chinese]]
1684 !!result
1685 <p>Blah blah blah
1686 </p>
1687 !! end
1688
1689
1690 ##
1691 ## XHTML tidiness
1692 ###
1693
1694 !! test
1695 <br> to <br />
1696 !! input
1697 1<br>2<br />3
1698 !! result
1699 <p>1<br />2<br />3
1700 </p>
1701 !! end
1702
1703 !! test
1704 Incorrecly removing closing slashes from correctly formed XHTML
1705 !! input
1706 <br style="clear:both;" />
1707 !! result
1708 <p><br style="clear:both;" />
1709 </p>
1710 !! end
1711
1712 !! test
1713 Failing to transform badly formed HTML into correct XHTML
1714 !! input
1715 <br clear=left>
1716 <br clear=right>
1717 <br clear=all>
1718 !! result
1719 <p><br clear="left" />
1720 <br clear="right" />
1721 <br clear="all" />
1722 </p>
1723 !!end
1724
1725 !! test
1726 Horizontal ruler (should it add that extra space?)
1727 !! input
1728 <hr>
1729 <hr >
1730 foo <hr
1731 > bar
1732 !! result
1733 <hr />
1734 <hr />
1735 foo <hr /> bar
1736
1737 !! end
1738
1739 ###
1740 ### Block-level elements
1741 ###
1742 !! test
1743 Common list
1744 !! input
1745 *Common list
1746 * item 2
1747 *item 3
1748 !! result
1749 <ul><li>Common list
1750 </li><li> item 2
1751 </li><li>item 3
1752 </li></ul>
1753
1754 !! end
1755
1756 !! test
1757 Numbered list
1758 !! input
1759 #Numbered list
1760 #item 2
1761 # item 3
1762 !! result
1763 <ol><li>Numbered list
1764 </li><li>item 2
1765 </li><li> item 3
1766 </li></ol>
1767
1768 !! end
1769
1770 !! test
1771 Mixed list
1772 !! input
1773 *Mixed list
1774 *# with numbers
1775 ** and bullets
1776 *# and numbers
1777 *bullets again
1778 **bullet level 2
1779 ***bullet level 3
1780 ***#Number on level 4
1781 **bullet level 2
1782 **#Number on level 3
1783 **#Number on level 3
1784 *#number level 2
1785 *Level 1
1786 !! result
1787 <ul><li>Mixed list
1788 <ol><li> with numbers
1789 </li></ol>
1790 <ul><li> and bullets
1791 </li></ul>
1792 <ol><li> and numbers
1793 </li></ol>
1794 </li><li>bullets again
1795 <ul><li>bullet level 2
1796 <ul><li>bullet level 3
1797 <ol><li>Number on level 4
1798 </li></ol>
1799 </li></ul>
1800 </li><li>bullet level 2
1801 <ol><li>Number on level 3
1802 </li><li>Number on level 3
1803 </li></ol>
1804 </li></ul>
1805 <ol><li>number level 2
1806 </li></ol>
1807 </li><li>Level 1
1808 </li></ul>
1809
1810 !! end
1811
1812 !! test
1813 List items are not parsed correctly following a <pre> block (bug 785)
1814 !! input
1815 * <pre>foo</pre>
1816 * <pre>bar</pre>
1817 * zar
1818 !! result
1819 <ul><li> <pre>foo</pre>
1820 </li><li> <pre>bar</pre>
1821 </li><li> zar
1822 </li></ul>
1823
1824 !! end
1825
1826 ###
1827 ### Magic Words
1828 ###
1829
1830 !! test
1831 Magic Word: {{CURRENTDAY}}
1832 !! input
1833 {{CURRENTDAY}}
1834 !! result
1835 <p>1
1836 </p>
1837 !! end
1838
1839 !! test
1840 Magic Word: {{CURRENTDAY2}}
1841 !! input
1842 {{CURRENTDAY2}}
1843 !! result
1844 <p>01
1845 </p>
1846 !! end
1847
1848 !! test
1849 Magic Word: {{CURRENTDAYNAME}}
1850 !! input
1851 {{CURRENTDAYNAME}}
1852 !! result
1853 <p>Thursday
1854 </p>
1855 !! end
1856
1857 !! test
1858 Magic Word: {{CURRENTDOW}}
1859 !! input
1860 {{CURRENTDOW}}
1861 !! result
1862 <p>4
1863 </p>
1864 !! end
1865
1866 !! test
1867 Magic Word: {{CURRENTMONTH}}
1868 !! input
1869 {{CURRENTMONTH}}
1870 !! result
1871 <p>01
1872 </p>
1873 !! end
1874
1875 !! test
1876 Magic Word: {{CURRENTMONTHABBREV}}
1877 !! input
1878 {{CURRENTMONTHABBREV}}
1879 !! result
1880 <p>Jan
1881 </p>
1882 !! end
1883
1884 !! test
1885 Magic Word: {{CURRENTMONTHNAME}}
1886 !! input
1887 {{CURRENTMONTHNAME}}
1888 !! result
1889 <p>January
1890 </p>
1891 !! end
1892
1893 !! test
1894 Magic Word: {{CURRENTMONTHNAMEGEN}}
1895 !! input
1896 {{CURRENTMONTHNAMEGEN}}
1897 !! result
1898 <p>January
1899 </p>
1900 !! end
1901
1902 !! test
1903 Magic Word: {{CURRENTTIME}}
1904 !! input
1905 {{CURRENTTIME}}
1906 !! result
1907 <p>00:02
1908 </p>
1909 !! end
1910
1911 !! test
1912 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1913 !! input
1914 {{CURRENTWEEK}}
1915 !! result
1916 <p>1
1917 </p>
1918 !! end
1919
1920 !! test
1921 Magic Word: {{CURRENTYEAR}}
1922 !! input
1923 {{CURRENTYEAR}}
1924 !! result
1925 <p>1970
1926 </p>
1927 !! end
1928
1929 !! test
1930 Magic Word: {{FULLPAGENAME}}
1931 !! options
1932 title=[[User:Ævar Arnfjörð Bjarmason]]
1933 !! input
1934 {{FULLPAGENAME}}
1935 !! result
1936 <p>User:Ævar Arnfjörð Bjarmason
1937 </p>
1938 !! end
1939
1940 !! test
1941 Magic Word: {{FULLPAGENAMEE}}
1942 !! options
1943 title=[[User:Ævar Arnfjörð Bjarmason]]
1944 !! input
1945 {{FULLPAGENAMEE}}
1946 !! result
1947 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1948 </p>
1949 !! end
1950
1951 !! test
1952 Magic Word: {{NAMESPACE}}
1953 !! options
1954 title=[[User:Ævar Arnfjörð Bjarmason]]
1955 !! input
1956 {{NAMESPACE}}
1957 !! result
1958 <p>User
1959 </p>
1960 !! end
1961
1962 !! test
1963 Magic Word: {{NAMESPACEE}}
1964 !! options
1965 title=[[User:Ævar Arnfjörð Bjarmason]]
1966 !! input
1967 {{NAMESPACEE}}
1968 !! result
1969 <p>User
1970 </p>
1971 !! end
1972
1973 !! test
1974 Magic Word: {{NUMBEROFARTICLES}}
1975 !! input
1976 {{NUMBEROFARTICLES}}
1977 !! result
1978 <p>2
1979 </p>
1980 !! end
1981
1982 !! test
1983 Magic Word: {{NUMBEROFFILES}}
1984 !! input
1985 {{NUMBEROFFILES}}
1986 !! result
1987 <p>1
1988 </p>
1989 !! end
1990
1991 !! test
1992 Magic Word: {{PAGENAME}}
1993 !! options
1994 title=[[User:Ævar Arnfjörð Bjarmason]]
1995 !! input
1996 {{PAGENAME}}
1997 !! result
1998 <p>Ævar Arnfjörð Bjarmason
1999 </p>
2000 !! end
2001
2002 !! test
2003 Magic Word: {{PAGENAMEE}}
2004 !! options
2005 title=[[User:Ævar Arnfjörð Bjarmason]]
2006 !! input
2007 {{PAGENAMEE}}
2008 !! result
2009 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
2010 </p>
2011 !! end
2012
2013 !! test
2014 Magic Word: {{REVISIONID}}
2015 !! input
2016 {{REVISIONID}}
2017 !! result
2018 <p>1337
2019 </p>
2020 !! end
2021
2022 !! test
2023 Magic Word: {{SCRIPTPATH}}
2024 !! input
2025 {{SCRIPTPATH}}
2026 !! result
2027 <p>/
2028 </p>
2029 !! end
2030
2031 !! test
2032 Magic Word: {{SERVER}}
2033 !! input
2034 {{SERVER}}
2035 !! result
2036 <p><a href="http://localhost" class="external free" rel="nofollow">http://localhost</a>
2037 </p>
2038 !! end
2039
2040 !! test
2041 Magic Word: {{SERVERNAME}}
2042 !! input
2043 {{SERVERNAME}}
2044 !! result
2045 <p>Britney-Spears
2046 </p>
2047 !! end
2048
2049 !! test
2050 Magic Word: {{SITENAME}}
2051 !! input
2052 {{SITENAME}}
2053 !! result
2054 <p>MediaWiki
2055 </p>
2056 !! end
2057
2058 !! test
2059 Namespace 1 {{ns:1}}
2060 !! input
2061 {{ns:1}}
2062 !! result
2063 <p>Talk
2064 </p>
2065 !! end
2066
2067 !! test
2068 Namespace 1 {{ns:01}}
2069 !! input
2070 {{ns:01}}
2071 !! result
2072 <p>Talk
2073 </p>
2074 !! end
2075
2076 !! test
2077 Namespace 0 {{ns:0}} (bug 4783)
2078 !! input
2079 {{ns:0}}
2080 !! result
2081
2082 !! end
2083
2084 !! test
2085 Namespace 0 {{ns:00}} (bug 4783)
2086 !! input
2087 {{ns:00}}
2088 !! result
2089
2090 !! end
2091
2092 !! test
2093 Namespace -1 {{ns:-1}}
2094 !! input
2095 {{ns:-1}}
2096 !! result
2097 <p>Special
2098 </p>
2099 !! end
2100
2101 !! test
2102 Namespace User {{ns:User}}
2103 !! input
2104 {{ns:User}}
2105 !! result
2106 <p>User
2107 </p>
2108 !! end
2109
2110 !! test
2111 Namespace User talk {{ns:User_talk}}
2112 !! input
2113 {{ns:User_talk}}
2114 !! result
2115 <p>User talk
2116 </p>
2117 !! end
2118
2119 !! test
2120 Namespace User talk {{ns:uSeR tAlK}}
2121 !! input
2122 {{ns:uSeR tAlK}}
2123 !! result
2124 <p>User talk
2125 </p>
2126 !! end
2127
2128 !! test
2129 Namespace File {{ns:File}}
2130 !! input
2131 {{ns:File}}
2132 !! result
2133 <p>File
2134 </p>
2135 !! end
2136
2137 !! test
2138 Namespace File {{ns:Image}}
2139 !! input
2140 {{ns:Image}}
2141 !! result
2142 <p>File
2143 </p>
2144 !! end
2145
2146 !! test
2147 Namespace (lang=de) Benutzer {{ns:User}}
2148 !! options
2149 language=de
2150 !! input
2151 {{ns:User}}
2152 !! result
2153 <p>Benutzer
2154 </p>
2155 !! end
2156
2157 !! test
2158 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
2159 !! options
2160 language=de
2161 !! input
2162 {{ns:3}}
2163 !! result
2164 <p>Benutzer Diskussion
2165 </p>
2166 !! end
2167
2168
2169 ###
2170 ### Magic links
2171 ###
2172 !! test
2173 Magic links: internal link to RFC (bug 479)
2174 !! input
2175 [[RFC 123]]
2176 !! result
2177 <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>
2178 </p>
2179 !! end
2180
2181 !! test
2182 Magic links: RFC (bug 479)
2183 !! input
2184 RFC 822
2185 !! result
2186 <p><a href="http://tools.ietf.org/html/rfc822" class="external">RFC 822</a>
2187 </p>
2188 !! end
2189
2190 !! test
2191 Magic links: ISBN (bug 1937)
2192 !! input
2193 ISBN 0-306-40615-2
2194 !! result
2195 <p><a href="/wiki/Special:BookSources/0306406152" class="internal">ISBN 0-306-40615-2</a>
2196 </p>
2197 !! end
2198
2199 !! test
2200 Magic links: PMID incorrectly converts space to underscore
2201 !! input
2202 PMID 1234
2203 !! result
2204 <p><a href="http://www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" class="external">PMID 1234</a>
2205 </p>
2206 !! end
2207
2208 ###
2209 ### Templates
2210 ####
2211
2212 !! test
2213 Nonexistent template
2214 !! input
2215 {{thistemplatedoesnotexist}}
2216 !! result
2217 <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>
2218 </p>
2219 !! end
2220
2221 !! article
2222 Template:test
2223 !! text
2224 This is a test template
2225 !! endarticle
2226
2227 !! test
2228 Simple template
2229 !! input
2230 {{test}}
2231 !! result
2232 <p>This is a test template
2233 </p>
2234 !! end
2235
2236 !! test
2237 Template with explicit namespace
2238 !! input
2239 {{Template:test}}
2240 !! result
2241 <p>This is a test template
2242 </p>
2243 !! end
2244
2245
2246 !! article
2247 Template:paramtest
2248 !! text
2249 This is a test template with parameter {{{param}}}
2250 !! endarticle
2251
2252 !! test
2253 Template parameter
2254 !! input
2255 {{paramtest|param=foo}}
2256 !! result
2257 <p>This is a test template with parameter foo
2258 </p>
2259 !! end
2260
2261 !! article
2262 Template:paramtestnum
2263 !! text
2264 [[{{{1}}}|{{{2}}}]]
2265 !! endarticle
2266
2267 !! test
2268 Template unnamed parameter
2269 !! input
2270 {{paramtestnum|Main Page|the main page}}
2271 !! result
2272 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2273 </p>
2274 !! end
2275
2276 !! article
2277 Template:templatesimple
2278 !! text
2279 (test)
2280 !! endarticle
2281
2282 !! article
2283 Template:templateredirect
2284 !! text
2285 #redirect [[Template:templatesimple]]
2286 !! endarticle
2287
2288 !! article
2289 Template:templateasargtestnum
2290 !! text
2291 {{{{{1}}}}}
2292 !! endarticle
2293
2294 !! article
2295 Template:templateasargtest
2296 !! text
2297 {{template{{{templ}}}}}
2298 !! endarticle
2299
2300 !! article
2301 Template:templateasargtest2
2302 !! text
2303 {{{{{templ}}}}}
2304 !! endarticle
2305
2306 !! test
2307 Template with template name as unnamed argument
2308 !! input
2309 {{templateasargtestnum|templatesimple}}
2310 !! result
2311 <p>(test)
2312 </p>
2313 !! end
2314
2315 !! test
2316 Template with template name as argument
2317 !! input
2318 {{templateasargtest|templ=simple}}
2319 !! result
2320 <p>(test)
2321 </p>
2322 !! end
2323
2324 !! test
2325 Template with template name as argument (2)
2326 !! input
2327 {{templateasargtest2|templ=templatesimple}}
2328 !! result
2329 <p>(test)
2330 </p>
2331 !! end
2332
2333 !! article
2334 Template:templateasargtestdefault
2335 !! text
2336 {{{{{templ|templatesimple}}}}}
2337 !! endarticle
2338
2339 !! article
2340 Template:templa
2341 !! text
2342 '''templ'''
2343 !! endarticle
2344
2345 !! test
2346 Template with default value
2347 !! input
2348 {{templateasargtestdefault}}
2349 !! result
2350 <p>(test)
2351 </p>
2352 !! end
2353
2354 !! test
2355 Template with default value (value set)
2356 !! input
2357 {{templateasargtestdefault|templ=templa}}
2358 !! result
2359 <p><b>templ</b>
2360 </p>
2361 !! end
2362
2363 !! test
2364 Template redirect
2365 !! input
2366 {{templateredirect}}
2367 !! result
2368 <p>(test)
2369 </p>
2370 !! end
2371
2372 !! test
2373 Template with argument in separate line
2374 !! input
2375 {{ templateasargtest |
2376 templ = simple }}
2377 !! result
2378 <p>(test)
2379 </p>
2380 !! end
2381
2382 !! test
2383 Template with complex template as argument
2384 !! input
2385 {{paramtest|
2386 param ={{ templateasargtest |
2387 templ = simple }}}}
2388 !! result
2389 <p>This is a test template with parameter (test)
2390 </p>
2391 !! end
2392
2393 !! test
2394 Template with thumb image (with link in description)
2395 !! input
2396 {{paramtest|
2397 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2398 !! result
2399 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>
2400
2401 !! end
2402
2403 !! article
2404 Template:complextemplate
2405 !! text
2406 {{{1}}} {{paramtest|
2407 param ={{{param}}}}}
2408 !! endarticle
2409
2410 !! test
2411 Template with complex arguments
2412 !! input
2413 {{complextemplate|
2414 param ={{ templateasargtest |
2415 templ = simple }}|[[Template:complextemplate|link]]}}
2416 !! result
2417 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2418 </p>
2419 !! end
2420
2421 !! test
2422 BUG 553: link with two variables in a piped link
2423 !! input
2424 {|
2425 |[[{{{1}}}|{{{2}}}]]
2426 |}
2427 !! result
2428 <table>
2429 <tr>
2430 <td>[[{{{1}}}|{{{2}}}]]
2431 </td></tr></table>
2432
2433 !! end
2434
2435 !! test
2436 Magic variable as template parameter
2437 !! input
2438 {{paramtest|param={{SITENAME}}}}
2439 !! result
2440 <p>This is a test template with parameter MediaWiki
2441 </p>
2442 !! end
2443
2444 !! article
2445 Template:linktest
2446 !! text
2447 [[{{{param}}}|link]]
2448 !! endarticle
2449
2450 !! test
2451 Template parameter as link source
2452 !! input
2453 {{linktest|param=Main Page}}
2454 !! result
2455 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2456 </p>
2457 !! end
2458
2459
2460 !!article
2461 Template:paramtest2
2462 !! text
2463 including another template, {{paramtest|param={{{arg}}}}}
2464 !! endarticle
2465
2466 !! test
2467 Template passing argument to another template
2468 !! input
2469 {{paramtest2|arg='hmm'}}
2470 !! result
2471 <p>including another template, This is a test template with parameter 'hmm'
2472 </p>
2473 !! end
2474
2475 !! article
2476 Template:Linktest2
2477 !! text
2478 Main Page
2479 !! endarticle
2480
2481 !! test
2482 Template as link source
2483 !! input
2484 [[{{linktest2}}]]
2485 !! result
2486 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2487 </p>
2488 !! end
2489
2490
2491 !! article
2492 Template:loop1
2493 !! text
2494 {{loop2}}
2495 !! endarticle
2496
2497 !! article
2498 Template:loop2
2499 !! text
2500 {{loop1}}
2501 !! endarticle
2502
2503 !! test
2504 Template infinite loop
2505 !! input
2506 {{loop1}}
2507 !! result
2508 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
2509 </p>
2510 !! end
2511
2512 !! test
2513 Template from main namespace
2514 !! input
2515 {{:Main Page}}
2516 !! result
2517 <p>blah blah
2518 </p>
2519 !! end
2520
2521 !! article
2522 Template:table
2523 !! text
2524 {|
2525 | 1 || 2
2526 |-
2527 | 3 || 4
2528 |}
2529 !! endarticle
2530
2531 !! test
2532 BUG 529: Template with table, not included at beginning of line
2533 !! input
2534 foo {{table}}
2535 !! result
2536 <p>foo
2537 </p>
2538 <table>
2539 <tr>
2540 <td> 1 </td><td> 2
2541 </td></tr>
2542 <tr>
2543 <td> 3 </td><td> 4
2544 </td></tr></table>
2545
2546 !! end
2547
2548 !! test
2549 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2550 !! input
2551 foo
2552 {{table}}
2553 !! result
2554 <p>foo
2555 </p>
2556 <table>
2557 <tr>
2558 <td> 1 </td><td> 2
2559 </td></tr>
2560 <tr>
2561 <td> 3 </td><td> 4
2562 </td></tr></table>
2563
2564 !! end
2565
2566 !! test
2567 BUG 41: Template parameters shown as broken links
2568 !! input
2569 {{{parameter}}}
2570 !! result
2571 <p>{{{parameter}}}
2572 </p>
2573 !! end
2574
2575
2576 !! article
2577 Template:MSGNW test
2578 !! text
2579 ''None'' of '''this''' should be
2580 * interepreted
2581 but rather passed unmodified
2582 {{test}}
2583 !! endarticle
2584
2585 # hmm, fix this or just deprecate msgnw and document its behavior?
2586 !! test
2587 msgnw keyword
2588 !! options
2589 disabled
2590 !! input
2591 {{msgnw:MSGNW test}}
2592 !! result
2593 <p>''None'' of '''this''' should be
2594 * interepreted
2595 but rather passed unmodified
2596 {{test}}
2597 </p>
2598 !! end
2599
2600 !! test
2601 int keyword
2602 !! input
2603 {{int:youhavenewmessages|lots of money|not!}}
2604 !! result
2605 <p>You have lots of money (not!).
2606 </p>
2607 !! end
2608
2609 !! article
2610 Template:Includes
2611 !! text
2612 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2613 !! endarticle
2614
2615 !! test
2616 <includeonly> and <noinclude> being included
2617 !! input
2618 {{Includes}}
2619 !! result
2620 <p>Foobar
2621 </p>
2622 !! end
2623
2624 !! article
2625 Template:Includes2
2626 !! text
2627 <onlyinclude>Foo</onlyinclude>bar
2628 !! endarticle
2629
2630 !! test
2631 <onlyinclude> being included
2632 !! input
2633 {{Includes2}}
2634 !! result
2635 <p>Foo
2636 </p>
2637 !! end
2638
2639
2640 !! article
2641 Template:Includes3
2642 !! text
2643 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2644 !! endarticle
2645
2646 !! test
2647 <onlyinclude> and <includeonly> being included
2648 !! input
2649 {{Includes3}}
2650 !! result
2651 <p>Foo
2652 </p>
2653 !! end
2654
2655 !! test
2656 <includeonly> and <noinclude> on a page
2657 !! input
2658 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2659 !! result
2660 <p>Foozar
2661 </p>
2662 !! end
2663
2664 !! test
2665 <onlyinclude> on a page
2666 !! input
2667 <onlyinclude>Foo</onlyinclude>bar
2668 !! result
2669 <p>Foobar
2670 </p>
2671 !! end
2672
2673 !! article
2674 Template:Includeonly section
2675 !! text
2676 <includeonly>
2677 ==Includeonly section==
2678 </includeonly>
2679 ==Section T-1==
2680 !!endarticle
2681
2682 !! test
2683 Bug 6563: Edit link generation for section shown by <includeonly>
2684 !! input
2685 {{includeonly section}}
2686 !! result
2687 <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>
2688 <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>
2689
2690 !! end
2691
2692 # Uses same input as the contents of [[Template:Includeonly section]]
2693 !! test
2694 Bug 6563: Section extraction for section shown by <includeonly>
2695 !! options
2696 section=T-2
2697 !! input
2698 <includeonly>
2699 ==Includeonly section==
2700 </includeonly>
2701 ==Section T-2==
2702 !! result
2703 ==Section T-2==
2704 !! end
2705
2706 !! test
2707 Bug 6563: Edit link generation for section suppressed by <includeonly>
2708 !! input
2709 <includeonly>
2710 ==Includeonly section==
2711 </includeonly>
2712 ==Section 1==
2713 !! result
2714 <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>
2715
2716 !! end
2717
2718 !! test
2719 Bug 6563: Section extraction for section suppressed by <includeonly>
2720 !! options
2721 section=1
2722 !! input
2723 <includeonly>
2724 ==Includeonly section==
2725 </includeonly>
2726 ==Section 1==
2727 !! result
2728 ==Section 1==
2729 !! end
2730
2731 ###
2732 ### Pre-save transform tests
2733 ###
2734 !! test
2735 pre-save transform: subst:
2736 !! options
2737 PST
2738 !! input
2739 {{subst:test}}
2740 !! result
2741 This is a test template
2742 !! end
2743
2744 !! test
2745 pre-save transform: normal template
2746 !! options
2747 PST
2748 !! input
2749 {{test}}
2750 !! result
2751 {{test}}
2752 !! end
2753
2754 !! test
2755 pre-save transform: nonexistent template
2756 !! options
2757 PST
2758 !! input
2759 {{thistemplatedoesnotexist}}
2760 !! result
2761 {{thistemplatedoesnotexist}}
2762 !! end
2763
2764
2765 !! test
2766 pre-save transform: subst magic variables
2767 !! options
2768 PST
2769 !! input
2770 {{subst:SITENAME}}
2771 !! result
2772 MediaWiki
2773 !! end
2774
2775 # This is bug 89, which I fixed. -- wtm
2776 !! test
2777 pre-save transform: subst: templates with parameters
2778 !! options
2779 pst
2780 !! input
2781 {{subst:paramtest|param="something else"}}
2782 !! result
2783 This is a test template with parameter "something else"
2784 !! end
2785
2786 !! article
2787 Template:nowikitest
2788 !! text
2789 <nowiki>'''not wiki'''</nowiki>
2790 !! endarticle
2791
2792 !! test
2793 pre-save transform: nowiki in subst (bug 1188)
2794 !! options
2795 pst
2796 !! input
2797 {{subst:nowikitest}}
2798 !! result
2799 <nowiki>'''not wiki'''</nowiki>
2800 !! end
2801
2802
2803 !! article
2804 Template:commenttest
2805 !! text
2806 This template has <!-- a comment --> in it.
2807 !! endarticle
2808
2809 !! test
2810 pre-save transform: comment in subst (bug 1936)
2811 !! options
2812 pst
2813 !! input
2814 {{subst:commenttest}}
2815 !! result
2816 This template has <!-- a comment --> in it.
2817 !! end
2818
2819 !! test
2820 pre-save transform: unclosed tag
2821 !! options
2822 pst noxml
2823 !! input
2824 <nowiki>'''not wiki'''
2825 !! result
2826 <nowiki>'''not wiki'''
2827 !! end
2828
2829 !! test
2830 pre-save transform: mixed tag case
2831 !! options
2832 pst noxml
2833 !! input
2834 <NOwiki>'''not wiki'''</noWIKI>
2835 !! result
2836 <NOwiki>'''not wiki'''</noWIKI>
2837 !! end
2838
2839 !! test
2840 pre-save transform: unclosed comment in <nowiki>
2841 !! options
2842 pst noxml
2843 !! input
2844 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2845 !! result
2846 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2847 !!end
2848
2849 !! article
2850 Template:dangerous
2851 !!text
2852 <span onmouseover="alert('crap')">Oh no</span>
2853 !!endarticle
2854
2855 !!test
2856 (confirming safety of fix for subst bug 1936)
2857 !! input
2858 {{Template:dangerous}}
2859 !! result
2860 <p><span>Oh no</span>
2861 </p>
2862 !! end
2863
2864 !! test
2865 pre-save transform: comment containing gallery (bug 5024)
2866 !! options
2867 pst
2868 !! input
2869 <!-- <gallery>data</gallery> -->
2870 !!result
2871 <!-- <gallery>data</gallery> -->
2872 !!end
2873
2874 !! test
2875 pre-save transform: comment containing extension
2876 !! options
2877 pst
2878 !! input
2879 <!-- <tag>data</tag> -->
2880 !!result
2881 <!-- <tag>data</tag> -->
2882 !!end
2883
2884 !! test
2885 pre-save transform: comment containing nowiki
2886 !! options
2887 pst
2888 !! input
2889 <!-- <nowiki>data</nowiki> -->
2890 !!result
2891 <!-- <nowiki>data</nowiki> -->
2892 !!end
2893
2894 !! test
2895 pre-save transform: comment containing math
2896 !! options
2897 pst
2898 !! input
2899 <!-- <math>data</math> -->
2900 !!result
2901 <!-- <math>data</math> -->
2902 !!end
2903
2904 !! test
2905 pre-save transform: <noinclude> in subst (bug 3298)
2906 !! options
2907 pst
2908 !! input
2909 {{subst:Includes}}
2910 !! result
2911 Foobar
2912 !! end
2913
2914 !! test
2915 pre-save transform: <onlyinclude> in subst (bug 3298)
2916 !! options
2917 pst
2918 !! input
2919 {{subst:Includes2}}
2920 !! result
2921 Foo
2922 !! end
2923
2924 !! test
2925 pre-save transform: context links ("pipe trick")
2926 !! options
2927 pst
2928 !! input
2929 [[Article (context)|]]
2930 [[Bar:Article|]]
2931 [[:Bar:Article|]]
2932 [[Bar:Article (context)|]]
2933 [[:Bar:Article (context)|]]
2934 [[|Article]]
2935 [[|Article (context)]]
2936 [[Bar:X (Y) Z|]]
2937 [[:Bar:X (Y) Z|]]
2938 !! result
2939 [[Article (context)|Article]]
2940 [[Bar:Article|Article]]
2941 [[:Bar:Article|Article]]
2942 [[Bar:Article (context)|Article]]
2943 [[:Bar:Article (context)|Article]]
2944 [[Article]]
2945 [[Article (context)]]
2946 [[Bar:X (Y) Z|X (Y) Z]]
2947 [[:Bar:X (Y) Z|X (Y) Z]]
2948 !! end
2949
2950 !! test
2951 pre-save transform: context links ("pipe trick") with interwiki prefix
2952 !! options
2953 pst
2954 !! input
2955 [[interwiki:Article|]]
2956 [[:interwiki:Article|]]
2957 [[interwiki:Bar:Article|]]
2958 [[:interwiki:Bar:Article|]]
2959 !! result
2960 [[interwiki:Article|Article]]
2961 [[:interwiki:Article|Article]]
2962 [[interwiki:Bar:Article|Bar:Article]]
2963 [[:interwiki:Bar:Article|Bar:Article]]
2964 !! end
2965
2966 !! test
2967 pre-save transform: context links ("pipe trick") with parens in title
2968 !! options
2969 pst title=[[Somearticle (context)]]
2970 !! input
2971 [[|Article]]
2972 !! result
2973 [[Article (context)|Article]]
2974 !! end
2975
2976 !! test
2977 pre-save transform: context links ("pipe trick") with comma in title
2978 !! options
2979 pst title=[[Someplace, Somewhere]]
2980 !! input
2981 [[|Otherplace]]
2982 [[Otherplace, Elsewhere|]]
2983 [[Otherplace, Elsewhere, Anywhere|]]
2984 !! result
2985 [[Otherplace, Somewhere|Otherplace]]
2986 [[Otherplace, Elsewhere|Otherplace]]
2987 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
2988 !! end
2989
2990 !! test
2991 pre-save transform: context links ("pipe trick") with parens and comma
2992 !! options
2993 pst title=[[Someplace (IGNORED), Somewhere]]
2994 !! input
2995 [[|Otherplace]]
2996 [[Otherplace (place), Elsewhere|]]
2997 !! result
2998 [[Otherplace, Somewhere|Otherplace]]
2999 [[Otherplace (place), Elsewhere|Otherplace]]
3000 !! end
3001
3002 !! test
3003 pre-save transform: context links ("pipe trick") with comma and parens
3004 !! options
3005 pst title=[[Who, me? (context)]]
3006 !! input
3007 [[|Yes, you.]]
3008 [[Me, Myself, and I (1937 song)|]]
3009 !! result
3010 [[Yes, you. (context)|Yes, you.]]
3011 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
3012 !! end
3013
3014 !! test
3015 pre-save transform: context links ("pipe trick") with namespace
3016 !! options
3017 pst title=[[Ns:Somearticle]]
3018 !! input
3019 [[|Article]]
3020 !! result
3021 [[Ns:Article|Article]]
3022 !! end
3023
3024 !! test
3025 pre-save transform: context links ("pipe trick") with namespace and parens
3026 !! options
3027 pst title=[[Ns:Somearticle (context)]]
3028 !! input
3029 [[|Article]]
3030 !! result
3031 [[Ns:Article (context)|Article]]
3032 !! end
3033
3034 !! test
3035 pre-save transform: context links ("pipe trick") with namespace and comma
3036 !! options
3037 pst title=[[Ns:Somearticle, Context, Whatever]]
3038 !! input
3039 [[|Article]]
3040 !! result
3041 [[Ns:Article, Context, Whatever|Article]]
3042 !! end
3043
3044 !! test
3045 pre-save transform: context links ("pipe trick") with namespace, comma and parens
3046 !! options
3047 pst title=[[Ns:Somearticle, Context (context)]]
3048 !! input
3049 [[|Article]]
3050 !! result
3051 [[Ns:Article (context)|Article]]
3052 !! end
3053
3054 !! test
3055 pre-save transform: context links ("pipe trick") with namespace, parens and comma
3056 !! options
3057 pst title=[[Ns:Somearticle (IGNORED), Context]]
3058 !! input
3059 [[|Article]]
3060 !! result
3061 [[Ns:Article, Context|Article]]
3062 !! end
3063
3064
3065 ###
3066 ### Message transform tests
3067 ###
3068 !! test
3069 message transform: magic variables
3070 !! options
3071 msg
3072 !! input
3073 {{SITENAME}}
3074 !! result
3075 MediaWiki
3076 !! end
3077
3078 !! test
3079 message transform: should not transform wiki markup
3080 !! options
3081 msg
3082 !! input
3083 ''test''
3084 !! result
3085 ''test''
3086 !! end
3087
3088 !! test
3089 message transform: <noinclude> in transcluded template (bug 4926)
3090 !! options
3091 msg
3092 !! input
3093 {{Includes}}
3094 !! result
3095 Foobar
3096 !! end
3097
3098 !! test
3099 message transform: <onlyinclude> in transcluded template (bug 4926)
3100 !! options
3101 msg
3102 !! input
3103 {{Includes2}}
3104 !! result
3105 Foo
3106 !! end
3107
3108 !! test
3109 {{#special:}} page name, known
3110 !! options
3111 msg
3112 !! input
3113 {{#special:Recentchanges}}
3114 !! result
3115 Special:RecentChanges
3116 !! end
3117
3118 !! test
3119 {{#special:}} page name, unknown
3120 !! options
3121 msg
3122 !! input
3123 {{#special:foobarnonexistent}}
3124 !! result
3125 No such special page
3126 !! end
3127
3128 ###
3129 ### Images
3130 ###
3131 !! test
3132 Simple image
3133 !! input
3134 [[Image:foobar.jpg]]
3135 !! result
3136 <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>
3137 </p>
3138 !! end
3139
3140 !! test
3141 Right-aligned image
3142 !! input
3143 [[Image:foobar.jpg|right]]
3144 !! result
3145 <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>
3146
3147 !! end
3148
3149 !! test
3150 Simple image (using File: namespace, now canonical)
3151 !! input
3152 [[File:foobar.jpg]]
3153 !! result
3154 <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>
3155 </p>
3156 !! end
3157
3158 !! test
3159 Image with caption
3160 !! input
3161 [[Image:foobar.jpg|right|Caption text]]
3162 !! result
3163 <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>
3164
3165 !! end
3166
3167 !! test
3168 Image with link parameter, wiki target
3169 !! input
3170 [[Image:foobar.jpg|link=Target page]]
3171 !! result
3172 <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>
3173 </p>
3174 !! end
3175
3176 !! test
3177 Image with link parameter, URL target
3178 !! input
3179 [[Image:foobar.jpg|link=http://example.com/]]
3180 !! result
3181 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3182 </p>
3183 !! end
3184
3185 !! test
3186 Image with empty link parameter
3187 !! input
3188 [[Image:foobar.jpg|link=]]
3189 !! result
3190 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
3191 </p>
3192 !! end
3193
3194 !! test
3195 Image with link parameter (wiki target) and unnamed parameter
3196 !! input
3197 [[Image:foobar.jpg|link=Target page|Title]]
3198 !! result
3199 <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>
3200 </p>
3201 !! end
3202
3203 !! test
3204 Image with link parameter (URL target) and unnamed parameter
3205 !! input
3206 [[Image:foobar.jpg|link=http://example.com/|Title]]
3207 !! result
3208 <p><a href="http://example.com/" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3209 </p>
3210 !! end
3211
3212
3213
3214 !! test
3215 Image with frame and link
3216 !! input
3217 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
3218 !! result
3219 <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>
3220
3221 !! end
3222
3223 !! test
3224 Image with frame and link and explicit alt
3225 !! input
3226 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
3227 !! result
3228 <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>
3229
3230 !! end
3231
3232 !! test
3233 Image with wiki markup in implicit alt
3234 !! input
3235 [[Image:Foobar.jpg|testing '''bold''' in alt]]
3236 !! result
3237 <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>
3238 </p>
3239 !! end
3240
3241 !! test
3242 Image with wiki markup in explicit alt
3243 !! input
3244 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
3245 !! result
3246 <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>
3247 </p>
3248 !! end
3249
3250 !! test
3251 Link to image page- image page normally doesn't exists, hence edit link
3252 Add test with existing image page
3253 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
3254 !! input
3255 [[:Image:test]]
3256 !! result
3257 <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>
3258 </p>
3259 !! end
3260
3261 !! test
3262 Frameless image caption with a free URL
3263 !! input
3264 [[Image:foobar.jpg|http://example.com]]
3265 !! result
3266 <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>
3267 </p>
3268 !! end
3269
3270 !! test
3271 Thumbnail image caption with a free URL
3272 !! input
3273 [[Image:foobar.jpg|thumb|http://example.com]]
3274 !! result
3275 <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" /></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="http://example.com" class="external free" rel="nofollow">http://example.com</a></div></div></div>
3276
3277 !! end
3278
3279 !! test
3280 Thumbnail image caption with a free URL and explicit alt
3281 !! input
3282 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
3283 !! result
3284 <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" /></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="http://example.com" class="external free" rel="nofollow">http://example.com</a></div></div></div>
3285
3286 !! end
3287
3288 !! test
3289 BUG 1887: A ISBN with a thumbnail
3290 !! input
3291 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
3292 !! result
3293 <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" /></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">ISBN 1235467890</a></div></div></div>
3294
3295 !! end
3296
3297 !! test
3298 BUG 1887: A RFC with a thumbnail
3299 !! input
3300 [[Image:foobar.jpg|thumb|This is RFC 12354]]
3301 !! result
3302 <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" /></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 href="http://tools.ietf.org/html/rfc12354" class="external">RFC 12354</a></div></div></div>
3303
3304 !! end
3305
3306 !! test
3307 BUG 1887: A mailto link with a thumbnail
3308 !! input
3309 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
3310 !! result
3311 <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" /></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 href="mailto:nobody@example.com" class="external free" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
3312
3313 !! end
3314
3315 !! test
3316 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
3317 so math is not stripped and turns up as escaped &lt;math&gt; tags.
3318 !! input
3319 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3320 !! result
3321 <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" /></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>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
3322
3323 !! end
3324
3325 !! test
3326 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3327 !! options
3328 math
3329 !! input
3330 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3331 !! result
3332 <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" /></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><span class="texhtml">2 + 2</span></div></div></div>
3333
3334 !! end
3335
3336 # Pending resolution to bug 368
3337 !! test
3338 BUG 648: Frameless image caption with a link
3339 !! input
3340 [[Image:foobar.jpg|text with a [[link]] in it]]
3341 !! result
3342 <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>
3343 </p>
3344 !! end
3345
3346 !! test
3347 BUG 648: Frameless image caption with a link (suffix)
3348 !! input
3349 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3350 !! result
3351 <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>
3352 </p>
3353 !! end
3354
3355 !! test
3356 BUG 648: Frameless image caption with an interwiki link
3357 !! input
3358 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3359 !! result
3360 <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>
3361 </p>
3362 !! end
3363
3364 !! test
3365 BUG 648: Frameless image caption with a piped interwiki link
3366 !! input
3367 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3368 !! result
3369 <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>
3370 </p>
3371 !! end
3372
3373 !! test
3374 Escape HTML special chars in image alt text
3375 !! input
3376 [[Image:foobar.jpg|& < > "]]
3377 !! result
3378 <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>
3379 </p>
3380 !! end
3381
3382 !! test
3383 BUG 499: Alt text should have &#1234;, not &amp;1234;
3384 !! input
3385 [[Image:foobar.jpg|&#9792;]]
3386 !! result
3387 <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>
3388 </p>
3389 !! end
3390
3391 !! test
3392 Broken image caption with link
3393 !! input
3394 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3395 !! result
3396 <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.
3397 </p>
3398 !! end
3399
3400 !! test
3401 Image caption containing another image
3402 !! input
3403 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3404 !! result
3405 <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" /></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">File:Icon.png</a> inside it!</div></div></div>
3406
3407 !! end
3408
3409 !! test
3410 Image caption containing a newline
3411 !! input
3412 [[Image:Foobar.jpg|This
3413 *is some text]]
3414 !! result
3415 <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>
3416 </p>
3417 !!end
3418
3419
3420 !! test
3421 Bug 3090: External links other than http: in image captions
3422 !! input
3423 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3424 !! result
3425 <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" /></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 href="irc://example.net" class="external text" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" rel="nofollow">Secure</a> ext links in it.</div></div></div>
3426
3427 !! end
3428
3429
3430 ###
3431 ### Subpages
3432 ###
3433 !! article
3434 Subpage test/subpage
3435 !! text
3436 foo
3437 !! endarticle
3438
3439 !! test
3440 Subpage link
3441 !! options
3442 subpage title=[[Subpage test]]
3443 !! input
3444 [[/subpage]]
3445 !! result
3446 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3447 </p>
3448 !! end
3449
3450 !! test
3451 Subpage noslash link
3452 !! options
3453 subpage title=[[Subpage test]]
3454 !!input
3455 [[/subpage/]]
3456 !! result
3457 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3458 </p>
3459 !! end
3460
3461 !! test
3462 Disabled subpages
3463 !! input
3464 [[/subpage]]
3465 !! result
3466 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
3467 </p>
3468 !! end
3469
3470 !! test
3471 BUG 561: {{/Subpage}}
3472 !! options
3473 subpage title=[[Page]]
3474 !! input
3475 {{/Subpage}}
3476 !! result
3477 <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>
3478 </p>
3479 !! end
3480
3481 ###
3482 ### Categories
3483 ###
3484 !! article
3485 Category:MediaWiki User's Guide
3486 !! text
3487 blah
3488 !! endarticle
3489
3490 !! test
3491 Link to category
3492 !! input
3493 [[:Category:MediaWiki User's Guide]]
3494 !! result
3495 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
3496 </p>
3497 !! end
3498
3499 !! test
3500 Simple category
3501 !! options
3502 cat
3503 !! input
3504 [[Category:MediaWiki User's Guide]]
3505 !! result
3506 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#039;s Guide">MediaWiki User's Guide</a>
3507 !! end
3508
3509 !! test
3510 PAGESINCATEGORY invalid title fatal (r33546 fix)
3511 !! input
3512 {{PAGESINCATEGORY:<bogus>}}
3513 !! result
3514 <p>0
3515 </p>
3516 !! end
3517
3518 ###
3519 ### Inter-language links
3520 ###
3521 !! test
3522 Inter-language links
3523 !! options
3524 ill
3525 !! input
3526 [[es:Alimento]]
3527 [[fr:Nourriture]]
3528 [[zh:&#39135;&#21697;]]
3529 !! result
3530 es:Alimento fr:Nourriture zh:食品
3531 !! end
3532
3533 ###
3534 ### Sections
3535 ###
3536 !! test
3537 Basic section headings
3538 !! input
3539 == Headline 1 ==
3540 Some text
3541
3542 ==Headline 2==
3543 More
3544 ===Smaller headline===
3545 Blah blah
3546 !! result
3547 <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>
3548 <p>Some text
3549 </p>
3550 <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>
3551 <p>More
3552 </p>
3553 <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>
3554 <p>Blah blah
3555 </p>
3556 !! end
3557
3558 !! test
3559 Section headings with TOC
3560 !! input
3561 == Headline 1 ==
3562 === Subheadline 1 ===
3563 ===== Skipping a level =====
3564 ====== Skipping a level ======
3565
3566 == Headline 2 ==
3567 Some text
3568 ===Another headline===
3569 !! result
3570 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3571 <ul>
3572 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3573 <ul>
3574 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3575 <ul>
3576 <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>
3577 <ul>
3578 <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>
3579 </ul>
3580 </li>
3581 </ul>
3582 </li>
3583 </ul>
3584 </li>
3585 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3586 <ul>
3587 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3588 </ul>
3589 </li>
3590 </ul>
3591 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3592 <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>
3593 <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>
3594 <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>
3595 <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>
3596 <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>
3597 <p>Some text
3598 </p>
3599 <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>
3600
3601 !! end
3602
3603 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3604 !! test
3605 Handling of sections up to level 6 and beyond
3606 !! input
3607 = Level 1 Heading=
3608 == Level 2 Heading==
3609 === Level 3 Heading===
3610 ==== Level 4 Heading====
3611 ===== Level 5 Heading=====
3612 ====== Level 6 Heading======
3613 ======= Level 7 Heading=======
3614 ======== Level 8 Heading========
3615 ========= Level 9 Heading=========
3616 ========== Level 10 Heading==========
3617 !! result
3618 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3619 <ul>
3620 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3621 <ul>
3622 <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>
3623 <ul>
3624 <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>
3625 <ul>
3626 <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>
3627 <ul>
3628 <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>
3629 <ul>
3630 <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>
3631 <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>
3632 <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>
3633 <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>
3634 <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>
3635 </ul>
3636 </li>
3637 </ul>
3638 </li>
3639 </ul>
3640 </li>
3641 </ul>
3642 </li>
3643 </ul>
3644 </li>
3645 </ul>
3646 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3647 <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>
3648 <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>
3649 <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>
3650 <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>
3651 <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>
3652 <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>
3653 <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>
3654 <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>
3655 <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>
3656 <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>
3657
3658 !! end
3659
3660 !! test
3661 TOC regression (bug 9764)
3662 !! input
3663 == title 1 ==
3664 === title 1.1 ===
3665 ==== title 1.1.1 ====
3666 === title 1.2 ===
3667 == title 2 ==
3668 === title 2.1 ===
3669 !! result
3670 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3671 <ul>
3672 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3673 <ul>
3674 <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>
3675 <ul>
3676 <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>
3677 </ul>
3678 </li>
3679 <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>
3680 </ul>
3681 </li>
3682 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3683 <ul>
3684 <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>
3685 </ul>
3686 </li>
3687 </ul>
3688 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3689 <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>
3690 <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>
3691 <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>
3692 <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>
3693 <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>
3694 <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>
3695
3696 !! end
3697
3698 !! test
3699 TOC with wgMaxTocLevel=3 (bug 6204)
3700 !! options
3701 wgMaxTocLevel=3
3702 !! input
3703 == title 1 ==
3704 === title 1.1 ===
3705 ==== title 1.1.1 ====
3706 === title 1.2 ===
3707 == title 2 ==
3708 === title 2.1 ===
3709 !! result
3710 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3711 <ul>
3712 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3713 <ul>
3714 <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>
3715 <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>
3716 </ul>
3717 </li>
3718 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3719 <ul>
3720 <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>
3721 </ul>
3722 </li>
3723 </ul>
3724 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3725 <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>
3726 <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>
3727 <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>
3728 <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>
3729 <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>
3730 <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>
3731
3732 !! end
3733
3734 !! test
3735 Resolving duplicate section names
3736 !! input
3737 == Foo bar ==
3738 == Foo bar ==
3739 !! result
3740 <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>
3741 <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>
3742
3743 !! end
3744
3745 !! test
3746 Resolving duplicate section names with differing case (bug 10721)
3747 !! input
3748 == Foo bar ==
3749 == Foo Bar ==
3750 !! result
3751 <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>
3752 <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>
3753
3754 !! end
3755
3756 !! article
3757 Template:sections
3758 !! text
3759 ===Section 1===
3760 ==Section 2==
3761 !! endarticle
3762
3763 !! test
3764 Template with sections, __NOTOC__
3765 !! input
3766 __NOTOC__
3767 ==Section 0==
3768 {{sections}}
3769 ==Section 4==
3770 !! result
3771 <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>
3772 <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>
3773 <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>
3774 <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>
3775
3776 !! end
3777
3778 !! test
3779 __NOEDITSECTION__ keyword
3780 !! input
3781 __NOEDITSECTION__
3782 ==Section 1==
3783 ==Section 2==
3784 !! result
3785 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
3786 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
3787
3788 !! end
3789
3790 !! test
3791 Link inside a section heading
3792 !! input
3793 ==Section with a [[Main Page|link]] in it==
3794 !! result
3795 <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>
3796
3797 !! end
3798
3799 !! test
3800 TOC regression (bug 12077)
3801 !! input
3802 __TOC__
3803 == title 1 ==
3804 === title 1.1 ===
3805 == title 2 ==
3806 !! result
3807 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3808 <ul>
3809 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3810 <ul>
3811 <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>
3812 </ul>
3813 </li>
3814 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
3815 </ul>
3816 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3817 <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>
3818 <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>
3819 <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>
3820
3821 !! end
3822
3823 !! test
3824 BUG 1219 URL next to image (good)
3825 !! input
3826 http://example.com [[Image:foobar.jpg]]
3827 !! result
3828 <p><a href="http://example.com" class="external free" rel="nofollow">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>
3829 </p>
3830 !!end
3831
3832 !! test
3833 BUG 1219 URL next to image (broken)
3834 !! input
3835 http://example.com[[Image:foobar.jpg]]
3836 !! result
3837 <p><a href="http://example.com" class="external free" rel="nofollow">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>
3838 </p>
3839 !!end
3840
3841 !! test
3842 Bug 1186 news: in the middle of text
3843 !! input
3844 http://en.wikinews.org/wiki/Wikinews:Workplace
3845 !! result
3846 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
3847 </p>
3848 !!end
3849
3850
3851 !! test
3852 Namespaced link must have a title
3853 !! input
3854 [[Project:]]
3855 !! result
3856 <p>[[Project:]]
3857 </p>
3858 !!end
3859
3860 !! test
3861 Namespaced link must have a title (bad fragment version)
3862 !! input
3863 [[Project:#fragment]]
3864 !! result
3865 <p>[[Project:#fragment]]
3866 </p>
3867 !!end
3868
3869
3870 !! test
3871 div with no attributes
3872 !! input
3873 <div>HTML rocks</div>
3874 !! result
3875 <div>HTML rocks</div>
3876
3877 !! end
3878
3879 !! test
3880 div with double-quoted attribute
3881 !! input
3882 <div id="rock">HTML rocks</div>
3883 !! result
3884 <div id="rock">HTML rocks</div>
3885
3886 !! end
3887
3888 !! test
3889 div with single-quoted attribute
3890 !! input
3891 <div id='rock'>HTML rocks</div>
3892 !! result
3893 <div id="rock">HTML rocks</div>
3894
3895 !! end
3896
3897 !! test
3898 div with unquoted attribute
3899 !! input
3900 <div id=rock>HTML rocks</div>
3901 !! result
3902 <div id="rock">HTML rocks</div>
3903
3904 !! end
3905
3906 !! test
3907 div with illegal double attributes
3908 !! input
3909 <div align="center" align="right">HTML rocks</div>
3910 !! result
3911 <div align="right">HTML rocks</div>
3912
3913 !!end
3914
3915 !! test
3916 HTML multiple attributes correction
3917 !! input
3918 <p class="error" class="awesome">Awesome!</p>
3919 !! result
3920 <p class="awesome">Awesome!</p>
3921
3922 !!end
3923
3924 !! test
3925 Table multiple attributes correction
3926 !! input
3927 {|
3928 !+ class="error" class="awesome"| status
3929 |}
3930 !! result
3931 <table>
3932 <tr>
3933 <th class="awesome"> status
3934 </th></tr></table>
3935
3936 !!end
3937
3938 !! test
3939 DIV IN UPPERCASE
3940 !! input
3941 <DIV ALIGN="center">HTML ROCKS</DIV>
3942 !! result
3943 <div align="center">HTML ROCKS</div>
3944
3945 !!end
3946
3947
3948 !! test
3949 text with amp in the middle of nowhere
3950 !! input
3951 Remember AT&T?
3952 !!result
3953 <p>Remember AT&amp;T?
3954 </p>
3955 !! end
3956
3957 !! test
3958 text with character entity: eacute
3959 !! input
3960 I always thought &eacute; was a cute letter.
3961 !! result
3962 <p>I always thought &eacute; was a cute letter.
3963 </p>
3964 !! end
3965
3966 !! test
3967 text with undefined character entity: xacute
3968 !! input
3969 I always thought &xacute; was a cute letter.
3970 !! result
3971 <p>I always thought &amp;xacute; was a cute letter.
3972 </p>
3973 !! end
3974
3975
3976 ###
3977 ### Media links
3978 ###
3979
3980 !! test
3981 Media link
3982 !! input
3983 [[Media:Foobar.jpg]]
3984 !! result
3985 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3986 </p>
3987 !! end
3988
3989 !! test
3990 Media link with text
3991 !! input
3992 [[Media:Foobar.jpg|A neat file to look at]]
3993 !! result
3994 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3995 </p>
3996 !! end
3997
3998 # FIXME: this is still bad HTML tag nesting
3999 !! test
4000 Media link with nasty text
4001 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
4002 !! input
4003 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
4004 !! result
4005 <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>
4006
4007 !! end
4008
4009 !! test
4010 Media link to nonexistent file (bug 1702)
4011 !! input
4012 [[Media:No such.jpg]]
4013 !! result
4014 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
4015 </p>
4016 !! end
4017
4018 !! test
4019 Image link to nonexistent file (bug 1850 - good)
4020 !! input
4021 [[Image:No such.jpg]]
4022 !! result
4023 <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>
4024 </p>
4025 !! end
4026
4027 !! test
4028 :Image link to nonexistent file (bug 1850 - bad)
4029 !! input
4030 [[:Image:No such.jpg]]
4031 !! result
4032 <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>
4033 </p>
4034 !! end
4035
4036
4037
4038 !! test
4039 Character reference normalization in link text (bug 1938)
4040 !! input
4041 [[Main Page|this&that]]
4042 !! result
4043 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
4044 </p>
4045 !!end
4046
4047 !! test
4048 Empty attribute crash test (bug 2067)
4049 !! input
4050 <font color="">foo</font>
4051 !! result
4052 <p><font color="">foo</font>
4053 </p>
4054 !! end
4055
4056 !! test
4057 Empty attribute crash test single-quotes (bug 2067)
4058 !! input
4059 <font color=''>foo</font>
4060 !! result
4061 <p><font color="">foo</font>
4062 </p>
4063 !! end
4064
4065 !! test
4066 Attribute test: equals, then nothing
4067 !! input
4068 <font color=>foo</font>
4069 !! result
4070 <p><font>foo</font>
4071 </p>
4072 !! end
4073
4074 !! test
4075 Attribute test: unquoted value
4076 !! input
4077 <font color=x>foo</font>
4078 !! result
4079 <p><font color="x">foo</font>
4080 </p>
4081 !! end
4082
4083 !! test
4084 Attribute test: unquoted but illegal value (hash)
4085 !! input
4086 <font color=#x>foo</font>
4087 !! result
4088 <p><font color="#x">foo</font>
4089 </p>
4090 !! end
4091
4092 !! test
4093 Attribute test: no value
4094 !! input
4095 <font color>foo</font>
4096 !! result
4097 <p><font color="color">foo</font>
4098 </p>
4099 !! end
4100
4101 !! test
4102 Bug 2095: link with three closing brackets
4103 !! input
4104 [[Main Page]]]
4105 !! result
4106 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
4107 </p>
4108 !! end
4109
4110 !! test
4111 Bug 2095: link with pipe and three closing brackets
4112 !! input
4113 [[Main Page|link]]]
4114 !! result
4115 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
4116 </p>
4117 !! end
4118
4119 !! test
4120 Bug 2095: link with pipe and three closing brackets, version 2
4121 !! input
4122 [[Main Page|[http://example.com/]]]
4123 !! result
4124 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
4125 </p>
4126 !! end
4127
4128
4129 ###
4130 ### Safety
4131 ###
4132
4133 !! article
4134 Template:Dangerous attribute
4135 !! text
4136 " onmouseover="alert(document.cookie)
4137 !! endarticle
4138
4139 !! article
4140 Template:Dangerous style attribute
4141 !! text
4142 border-size: expression(alert(document.cookie))
4143 !! endarticle
4144
4145 !! article
4146 Template:Div style
4147 !! text
4148 <div style="float: right; {{{1}}}">Magic div</div>
4149 !! endarticle
4150
4151 !! test
4152 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
4153 !! input
4154 <div title="{{test}}"></div>
4155 !! result
4156 <div title="This is a test template"></div>
4157
4158 !! end
4159
4160 !! test
4161 Bug 2304: HTML attribute safety (dangerous template; 2309)
4162 !! input
4163 <div title="{{dangerous attribute}}"></div>
4164 !! result
4165 <div title=""></div>
4166
4167 !! end
4168
4169 !! test
4170 Bug 2304: HTML attribute safety (dangerous style template; 2309)
4171 !! input
4172 <div style="{{dangerous style attribute}}"></div>
4173 !! result
4174 <div></div>
4175
4176 !! end
4177
4178 !! test
4179 Bug 2304: HTML attribute safety (safe parameter; 2309)
4180 !! input
4181 {{div style|width: 200px}}
4182 !! result
4183 <div style="float: right; width: 200px">Magic div</div>
4184
4185 !! end
4186
4187 !! test
4188 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
4189 !! input
4190 {{div style|width: expression(alert(document.cookie))}}
4191 !! result
4192 <div>Magic div</div>
4193
4194 !! end
4195
4196 !! test
4197 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
4198 !! input
4199 {{div style|"><script>alert(document.cookie)</script>}}
4200 !! result
4201 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4202
4203 !! end
4204
4205 !! test
4206 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
4207 !! input
4208 {{div style|" ><script>alert(document.cookie)</script>}}
4209 !! result
4210 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4211
4212 !! end
4213
4214 !! test
4215 Bug 2304: HTML attribute safety (link)
4216 !! input
4217 <div title="[[Main Page]]"></div>
4218 !! result
4219 <div title="&#91;&#91;Main Page]]"></div>
4220
4221 !! end
4222
4223 !! test
4224 Bug 2304: HTML attribute safety (italics)
4225 !! input
4226 <div title="''foobar''"></div>
4227 !! result
4228 <div title="&#39;&#39;foobar&#39;&#39;"></div>
4229
4230 !! end
4231
4232 !! test
4233 Bug 2304: HTML attribute safety (bold)
4234 !! input
4235 <div title="'''foobar'''"></div>
4236 !! result
4237 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
4238
4239 !! end
4240
4241
4242 !! test
4243 Bug 2304: HTML attribute safety (ISBN)
4244 !! input
4245 <div title="ISBN 1234567890"></div>
4246 !! result
4247 <div title="&#73;SBN 1234567890"></div>
4248
4249 !! end
4250
4251 !! test
4252 Bug 2304: HTML attribute safety (RFC)
4253 !! input
4254 <div title="RFC 1234"></div>
4255 !! result
4256 <div title="&#82;FC 1234"></div>
4257
4258 !! end
4259
4260 !! test
4261 Bug 2304: HTML attribute safety (PMID)
4262 !! input
4263 <div title="PMID 1234567890"></div>
4264 !! result
4265 <div title="&#80;MID 1234567890"></div>
4266
4267 !! end
4268
4269 !! test
4270 Bug 2304: HTML attribute safety (web link)
4271 !! input
4272 <div title="http://example.com/"></div>
4273 !! result
4274 <div title="http&#58;//example.com/"></div>
4275
4276 !! end
4277
4278 !! test
4279 Bug 2304: HTML attribute safety (named web link)
4280 !! input
4281 <div title="[http://example.com/ link]"></div>
4282 !! result
4283 <div title="&#91;http&#58;//example.com/ link]"></div>
4284
4285 !! end
4286
4287 !! test
4288 Bug 3244: HTML attribute safety (extension; safe)
4289 !! input
4290 <div style="<nowiki>background:blue</nowiki>"></div>
4291 !! result
4292 <div style="background:blue"></div>
4293
4294 !! end
4295
4296 !! test
4297 Bug 3244: HTML attribute safety (extension; unsafe)
4298 !! input
4299 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
4300 !! result
4301 <div></div>
4302
4303 !! end
4304
4305 !! test
4306 Math section safety when disabled
4307 !! input
4308 <math><script>alert(document.cookies);</script></math>
4309 !! result
4310 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
4311 </p>
4312 !! end
4313
4314 # More MSIE fun discovered by Tom Gilder
4315
4316 !! test
4317 MSIE CSS safety test: spurious slash
4318 !! input
4319 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
4320 !! result
4321 <div>evil</div>
4322
4323 !! end
4324
4325 !! test
4326 MSIE CSS safety test: hex code
4327 !! input
4328 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
4329 !! result
4330 <div>evil</div>
4331
4332 !! end
4333
4334 !! test
4335 MSIE CSS safety test: comment in url
4336 !! input
4337 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
4338 !! result
4339 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
4340
4341 !! end
4342
4343 !! test
4344 MSIE CSS safety test: comment in expression
4345 !! input
4346 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
4347 !! result
4348 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
4349
4350 !! end
4351
4352
4353 !! test
4354 Table attribute legitimate extension
4355 !! input
4356 {|
4357 !+ style="<nowiki>color:blue</nowiki>"| status
4358 |}
4359 !! result
4360 <table>
4361 <tr>
4362 <th style="color:blue"> status
4363 </th></tr></table>
4364
4365 !!end
4366
4367 !! test
4368 Table attribute safety
4369 !! input
4370 {|
4371 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
4372 |}
4373 !! result
4374 <table>
4375 <tr>
4376 <th> status
4377 </th></tr></table>
4378
4379 !! end
4380
4381
4382 !! article
4383 Template:Identity
4384 !! text
4385 {{{1}}}
4386 !! endarticle
4387
4388 !! test
4389 Expansion of multi-line templates in attribute values (bug 6255)
4390 !! input
4391 <div style="background: {{identity|#00FF00}}">-</div>
4392 !! result
4393 <div style="background: #00FF00">-</div>
4394
4395 !! end
4396
4397
4398 !! test
4399 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4400 !! input
4401 <div style="background:
4402 #00FF00">-</div>
4403 !! result
4404 <div style="background: #00FF00">-</div>
4405
4406 !! end
4407
4408 !! test
4409 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4410 !! input
4411 <div style="background: &#10;#00FF00">-</div>
4412 !! result
4413 <div style="background: &#10;#00FF00">-</div>
4414
4415 !! end
4416
4417 ###
4418 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4419 ###
4420 !! test
4421 Parser hook: empty input
4422 !! input
4423 <tag></tag>
4424 !! result
4425 <pre>
4426 string(0) ""
4427 array(0) {
4428 }
4429 </pre>
4430
4431 !! end
4432
4433 !! test
4434 Parser hook: empty input using terminated empty elements
4435 !! input
4436 <tag/>
4437 !! result
4438 <pre>
4439 NULL
4440 array(0) {
4441 }
4442 </pre>
4443
4444 !! end
4445
4446 !! test
4447 Parser hook: empty input using terminated empty elements (space before)
4448 !! input
4449 <tag />
4450 !! result
4451 <pre>
4452 NULL
4453 array(0) {
4454 }
4455 </pre>
4456
4457 !! end
4458
4459 !! test
4460 Parser hook: basic input
4461 !! input
4462 <tag>input</tag>
4463 !! result
4464 <pre>
4465 string(5) "input"
4466 array(0) {
4467 }
4468 </pre>
4469
4470 !! end
4471
4472
4473 !! test
4474 Parser hook: case insensitive
4475 !! input
4476 <TAG>input</TAG>
4477 !! result
4478 <pre>
4479 string(5) "input"
4480 array(0) {
4481 }
4482 </pre>
4483
4484 !! end
4485
4486
4487 !! test
4488 Parser hook: case insensitive, redux
4489 !! input
4490 <TaG>input</TAg>
4491 !! result
4492 <pre>
4493 string(5) "input"
4494 array(0) {
4495 }
4496 </pre>
4497
4498 !! end
4499
4500 !! test
4501 Parser hook: nested tags
4502 !! options
4503 noxml
4504 !! input
4505 <tag><tag></tag></tag>
4506 !! result
4507 <pre>
4508 string(5) "<tag>"
4509 array(0) {
4510 }
4511 </pre>&lt;/tag&gt;
4512
4513 !! end
4514
4515 !! test
4516 Parser hook: basic arguments
4517 !! input
4518 <tag width=200 height = "100" depth = '50' square></tag>
4519 !! result
4520 <pre>
4521 string(0) ""
4522 array(4) {
4523 ["width"]=>
4524 string(3) "200"
4525 ["height"]=>
4526 string(3) "100"
4527 ["depth"]=>
4528 string(2) "50"
4529 ["square"]=>
4530 string(6) "square"
4531 }
4532 </pre>
4533
4534 !! end
4535
4536 !! test
4537 Parser hook: argument containing a forward slash (bug 5344)
4538 !! input
4539 <tag filename='/tmp/bla'></tag>
4540 !! result
4541 <pre>
4542 string(0) ""
4543 array(1) {
4544 ["filename"]=>
4545 string(8) "/tmp/bla"
4546 }
4547 </pre>
4548
4549 !! end
4550
4551 !! test
4552 Parser hook: empty input using terminated empty elements (bug 2374)
4553 !! input
4554 <tag foo=bar/>text
4555 !! result
4556 <pre>
4557 NULL
4558 array(1) {
4559 ["foo"]=>
4560 string(3) "bar"
4561 }
4562 </pre>text
4563
4564 !! end
4565
4566 # </tag> should be output literally since there is no matching tag that begins it
4567 !! test
4568 Parser hook: basic arguments using terminated empty elements (bug 2374)
4569 !! input
4570 <tag width=200 height = "100" depth = '50' square/>
4571 other stuff
4572 </tag>
4573 !! result
4574 <pre>
4575 NULL
4576 array(4) {
4577 ["width"]=>
4578 string(3) "200"
4579 ["height"]=>
4580 string(3) "100"
4581 ["depth"]=>
4582 string(2) "50"
4583 ["square"]=>
4584 string(6) "square"
4585 }
4586 </pre>
4587 <p>other stuff
4588 &lt;/tag&gt;
4589 </p>
4590 !! end
4591
4592 ###
4593 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4594 ###
4595
4596 !! test
4597 Parser hook: static parser hook not inside a comment
4598 !! input
4599 <statictag>hello, world</statictag>
4600 <statictag action=flush/>
4601 !! result
4602 <p>hello, world
4603 </p>
4604 !! end
4605
4606
4607 !! test
4608 Parser hook: static parser hook inside a comment
4609 !! input
4610 <!-- <statictag>hello, world</statictag> -->
4611 <statictag action=flush/>
4612 !! result
4613 <p><br />
4614 </p>
4615 !! end
4616
4617 # Nested template calls; this case was broken by Parser.php rev 1.506,
4618 # since reverted.
4619
4620 !! article
4621 Template:One-parameter
4622 !! text
4623 (My parameter is: {{{1}}})
4624 !! endarticle
4625
4626 !! article
4627 Template:Map-one-parameter
4628 !! text
4629 {{{{{1}}}|{{{2}}}}}
4630 !! endarticle
4631
4632 !! test
4633 Nested template calls
4634 !! input
4635 {{Map-one-parameter|One-parameter|param}}
4636 !! result
4637 <p>(My parameter is: param)
4638 </p>
4639 !! end
4640
4641
4642 ###
4643 ### Sanitizer
4644 ###
4645 !! test
4646 Sanitizer: Closing of open tags
4647 !! input
4648 <s></s><table></table>
4649 !! result
4650 <s></s><table></table>
4651
4652 !! end
4653
4654 !! test
4655 Sanitizer: Closing of open but not closed tags
4656 !! input
4657 <s>foo
4658 !! result
4659 <p><s>foo</s>
4660 </p>
4661 !! end
4662
4663 !! test
4664 Sanitizer: Closing of closed but not open tags
4665 !! input
4666 </s>
4667 !! result
4668 <p>&lt;/s&gt;
4669 </p>
4670 !! end
4671
4672 !! test
4673 Sanitizer: Closing of closed but not open table tags
4674 !! input
4675 Table not started</td></tr></table>
4676 !! result
4677 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4678 </p>
4679 !! end
4680
4681 !! test
4682 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4683 !! input
4684 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4685 !! result
4686 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
4687 </p>
4688 !! end
4689
4690 !! test
4691 Sanitizer: Validating the contents of the id attribute (bug 4515)
4692 !! options
4693 disabled
4694 !! input
4695 <br id=9 />
4696 !! result
4697 Something, but defenetly not <br id="9" />...
4698 !! end
4699
4700 !! test
4701 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4702 !! options
4703 disabled
4704 !! input
4705 <br id="foo" /><br id="foo" />
4706 !! result
4707 Something need to be done. foo-2 ?
4708 !! end
4709
4710 !! test
4711 Language converter: output gets cut off unexpectedly (bug 5757)
4712 !! options
4713 language=zh
4714 !! input
4715 this bit is safe: }-
4716
4717 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4718
4719 then we get cut off here: }-
4720
4721 all additional text is vanished
4722 !! result
4723 <p>this bit is safe: }-
4724 </p><p>but if we add a conversion instance: xxx
4725 </p><p>then we get cut off here: }-
4726 </p><p>all additional text is vanished
4727 </p>
4728 !! end
4729
4730 !! test
4731 Self closed html pairs (bug 5487)
4732 !! options
4733 !! input
4734 <center><font id="bug" />Centered text</center>
4735 <div><font id="bug2" />In div text</div>
4736 !! result
4737 <center>&lt;font id="bug" /&gt;Centered text</center>
4738 <div>&lt;font id="bug2" /&gt;In div text</div>
4739
4740 !! end
4741
4742 #
4743 #
4744 #
4745
4746 !! test
4747 Punctuation: nbsp before exclamation
4748 !! input
4749 C'est grave !
4750 !! result
4751 <p>C'est grave&nbsp;!
4752 </p>
4753 !! end
4754
4755 !! test
4756 Punctuation: CSS !important (bug 11874)
4757 !! input
4758 <div style="width:50% !important">important</div>
4759 !! result
4760 <div style="width:50% !important">important</div>
4761
4762 !!end
4763
4764 !! test
4765 Punctuation: CSS ! important (bug 11874; with space after)
4766 !! input
4767 <div style="width:50% ! important">important</div>
4768 !! result
4769 <div style="width:50% ! important">important</div>
4770
4771 !!end
4772
4773
4774 !! test
4775 HTML bullet list, closed tags (bug 5497)
4776 !! input
4777 <ul>
4778 <li>One</li>
4779 <li>Two</li>
4780 </ul>
4781 !! result
4782 <ul>
4783 <li>One</li>
4784 <li>Two</li>
4785 </ul>
4786
4787 !! end
4788
4789 !! test
4790 HTML bullet list, unclosed tags (bug 5497)
4791 !! options
4792 disabled
4793 !! input
4794 <ul>
4795 <li>One
4796 <li>Two
4797 </ul>
4798 !! result
4799 <ul>
4800 <li>One
4801 </li><li>Two
4802 </li></ul>
4803
4804 !! end
4805
4806 !! test
4807 HTML ordered list, closed tags (bug 5497)
4808 !! input
4809 <ol>
4810 <li>One</li>
4811 <li>Two</li>
4812 </ol>
4813 !! result
4814 <ol>
4815 <li>One</li>
4816 <li>Two</li>
4817 </ol>
4818
4819 !! end
4820
4821 !! test
4822 HTML ordered list, unclosed tags (bug 5497)
4823 !! options
4824 disabled
4825 !! input
4826 <ol>
4827 <li>One
4828 <li>Two
4829 </ol>
4830 !! result
4831 <ol>
4832 <li>One
4833 </li><li>Two
4834 </li></ol>
4835
4836 !! end
4837
4838 !! test
4839 HTML nested bullet list, closed tags (bug 5497)
4840 !! input
4841 <ul>
4842 <li>One</li>
4843 <li>Two:
4844 <ul>
4845 <li>Sub-one</li>
4846 <li>Sub-two</li>
4847 </ul>
4848 </li>
4849 </ul>
4850 !! result
4851 <ul>
4852 <li>One</li>
4853 <li>Two:
4854 <ul>
4855 <li>Sub-one</li>
4856 <li>Sub-two</li>
4857 </ul>
4858 </li>
4859 </ul>
4860
4861 !! end
4862
4863 !! test
4864 HTML nested bullet list, open tags (bug 5497)
4865 !! options
4866 disabled
4867 !! input
4868 <ul>
4869 <li>One
4870 <li>Two:
4871 <ul>
4872 <li>Sub-one
4873 <li>Sub-two
4874 </ul>
4875 </ul>
4876 !! result
4877 <ul>
4878 <li>One
4879 </li><li>Two:
4880 <ul>
4881 <li>Sub-one
4882 </li><li>Sub-two
4883 </li></ul>
4884 </li></ul>
4885
4886 !! end
4887
4888 !! test
4889 HTML nested ordered list, closed tags (bug 5497)
4890 !! input
4891 <ol>
4892 <li>One</li>
4893 <li>Two:
4894 <ol>
4895 <li>Sub-one</li>
4896 <li>Sub-two</li>
4897 </ol>
4898 </li>
4899 </ol>
4900 !! result
4901 <ol>
4902 <li>One</li>
4903 <li>Two:
4904 <ol>
4905 <li>Sub-one</li>
4906 <li>Sub-two</li>
4907 </ol>
4908 </li>
4909 </ol>
4910
4911 !! end
4912
4913 !! test
4914 HTML nested ordered list, open tags (bug 5497)
4915 !! options
4916 disabled
4917 !! input
4918 <ol>
4919 <li>One
4920 <li>Two:
4921 <ol>
4922 <li>Sub-one
4923 <li>Sub-two
4924 </ol>
4925 </ol>
4926 !! result
4927 <ol>
4928 <li>One
4929 </li><li>Two:
4930 <ol>
4931 <li>Sub-one
4932 </li><li>Sub-two
4933 </li></ol>
4934 </li></ol>
4935
4936 !! end
4937
4938 !! test
4939 HTML ordered list item with parameters oddity
4940 !! input
4941 <ol><li id="fragment">One</li></ol>
4942 !! result
4943 <ol><li id="fragment">One</li></ol>
4944
4945 !! end
4946
4947 !!test
4948 bug 5918: autonumbering
4949 !! input
4950 [http://first/] [http://second] [ftp://ftp]
4951
4952 ftp://inlineftp
4953
4954 [mailto:enclosed@mail.tld With target]
4955
4956 [mailto:enclosed@mail.tld]
4957
4958 mailto:inline@mail.tld
4959 !! result
4960 <p><a href="http://first/" class="external autonumber" rel="nofollow">[1]</a> <a href="http://second" class="external autonumber" rel="nofollow">[2]</a> <a href="ftp://ftp" class="external autonumber" rel="nofollow">[3]</a>
4961 </p><p><a href="ftp://inlineftp" class="external free" rel="nofollow">ftp://inlineftp</a>
4962 </p><p><a href="mailto:enclosed@mail.tld" class="external text" rel="nofollow">With target</a>
4963 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" rel="nofollow">[4]</a>
4964 </p><p><a href="mailto:inline@mail.tld" class="external free" rel="nofollow">mailto:inline@mail.tld</a>
4965 </p>
4966 !! end
4967
4968
4969 #
4970 # Security and HTML correctness
4971 # From Nick Jenkins' fuzz testing
4972 #
4973
4974 !! test
4975 Fuzz testing: Parser13
4976 !! input
4977 {|
4978 | http://a|
4979 !! result
4980 <table>
4981 <tr>
4982 <td>
4983 </td>
4984 </tr>
4985 </table>
4986
4987 !! end
4988
4989 !! test
4990 Fuzz testing: Parser14
4991 !! input
4992 == onmouseover= ==
4993 http://__TOC__
4994 !! result
4995 <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>
4996 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4997 <ul>
4998 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4999 </ul>
5000 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
5001
5002 !! end
5003
5004 !! test
5005 Fuzz testing: Parser14-table
5006 !! input
5007 ==a==
5008 {| STYLE=__TOC__
5009 !! result
5010 <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>
5011 <table style="&#95;_TOC&#95;_">
5012 <tr><td></td></tr>
5013 </table>
5014
5015 !! end
5016
5017 # Known to produce bogus xml (extra </td>)
5018 !! test
5019 Fuzz testing: Parser16
5020 !! options
5021 noxml
5022 !! input
5023 {|
5024 !https://||||||
5025 !! result
5026 <table>
5027 <tr>
5028 <th>https://</th><th></th><th></th><th>
5029 </td>
5030 </tr>
5031 </table>
5032
5033 !! end
5034
5035 !! test
5036 Fuzz testing: Parser21
5037 !! input
5038 {|
5039 ! irc://{{ftp://a" onmouseover="alert('hello world');"
5040 |
5041 !! result
5042 <table>
5043 <tr>
5044 <th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
5045 </th><td>
5046 </td>
5047 </tr>
5048 </table>
5049
5050 !! end
5051
5052 !! test
5053 Fuzz testing: Parser22
5054 !! input
5055 http://===r:::https://b
5056
5057 {|
5058 !!result
5059 <p><a href="http://===r:::https://b" class="external free" rel="nofollow">http://===r:::https://b</a>
5060 </p>
5061 <table>
5062 <tr><td></td></tr>
5063 </table>
5064
5065 !! end
5066
5067 # Known to produce bad XML for now
5068 !! test
5069 Fuzz testing: Parser24
5070 !! options
5071 noxml
5072 !! input
5073 {|
5074 {{{|
5075 <u CLASS=
5076 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
5077 <br style="onmouseover='alert(document.cookie);' " />
5078
5079 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5080 |
5081 !! result
5082 <table>
5083 {{{|
5084 <u class="&#124;">}}}} &gt;
5085 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5086
5087 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5088 <tr>
5089 <td></u>
5090 </td>
5091 </tr>
5092 </table>
5093
5094 !! end
5095
5096 # Note: the current result listed for this is not what the original one was,
5097 # but the original bug was JavaScript injection, which is fixed in any case.
5098 # It's not clear that the original result listed was any more correct than the
5099 # current one. Original result:
5100 # <p>{{{|
5101 # </p>
5102 # <li class="&#124;&#124;">
5103 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5104 !!test
5105 Fuzz testing: Parser25 (bug 6055)
5106 !! input
5107 {{{
5108 |
5109 <LI CLASS=||
5110 >
5111 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
5112 !! result
5113 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5114 </p>
5115 !! end
5116
5117 !!test
5118 Fuzz testing: URL adjacent extension (with space, clean)
5119 !! options
5120 !! input
5121 http://example.com <nowiki>junk</nowiki>
5122 !! result
5123 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> junk
5124 </p>
5125 !!end
5126
5127 !!test
5128 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
5129 !! options
5130 !! input
5131 http://example.com<nowiki>junk</nowiki>
5132 !! result
5133 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>junk
5134 </p>
5135 !!end
5136
5137 !!test
5138 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5139 !! options
5140 !! input
5141 http://example.com<pre>junk</pre>
5142 !! result
5143 <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><pre>junk</pre>
5144
5145 !!end
5146
5147 !!test
5148 Fuzz testing: image with bogus manual thumbnail
5149 !!input
5150 [[Image:foobar.jpg|thumbnail= ]]
5151 !!result
5152 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
5153
5154 !!end
5155
5156 !! test
5157 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5158 !! input
5159 <pre dir="&#10;"></pre>
5160 !! result
5161 <pre dir="&#10;"></pre>
5162
5163 !! end
5164
5165 !! test
5166 Parsing optional HTML elements (Bug 6171)
5167 !! options
5168 !! input
5169 <table>
5170 <tr>
5171 <td> Some tabular data</td>
5172 <td> More tabular data ...
5173 <td> And yet som tabular data</td>
5174 </tr>
5175 </table>
5176 !! result
5177 <table>
5178 <tr>
5179 <td> Some tabular data</td>
5180 <td> More tabular data ...
5181 </td><td> And yet som tabular data</td>
5182 </tr>
5183 </table>
5184
5185 !! end
5186
5187 !! test
5188 Correct handling of <td>, <tr> (Bug 6171)
5189 !! options
5190 !! input
5191 <table>
5192 <tr>
5193 <td> Some tabular data</td>
5194 <td> More tabular data ...</td>
5195 <td> And yet som tabular data</td>
5196 </tr>
5197 </table>
5198 !! result
5199 <table>
5200 <tr>
5201 <td> Some tabular data</td>
5202 <td> More tabular data ...</td>
5203 <td> And yet som tabular data</td>
5204 </tr>
5205 </table>
5206
5207 !! end
5208
5209
5210 !! test
5211 Parsing crashing regression (fr:JavaScript)
5212 !! input
5213 </body></x>
5214 !! result
5215 <p>&lt;/body&gt;&lt;/x&gt;
5216 </p>
5217 !! end
5218
5219 !! test
5220 Inline wiki vs wiki block nesting
5221 !! input
5222 '''Bold paragraph
5223
5224 New wiki paragraph
5225 !! result
5226 <p><b>Bold paragraph</b>
5227 </p><p>New wiki paragraph
5228 </p>
5229 !! end
5230
5231 !! test
5232 Inline HTML vs wiki block nesting
5233 !! options
5234 disabled
5235 !! input
5236 <b>Bold paragraph
5237
5238 New wiki paragraph
5239 !! result
5240 <p><b>Bold paragraph</b>
5241 </p><p>New wiki paragraph
5242 </p>
5243 !! end
5244
5245 # Original result was this:
5246 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5247 # </p>
5248 # While that might be marginally more intuitive, maybe, the six-apostrophe
5249 # construct is clearly pathological and the result stated here (which is what
5250 # the parser actually does) is about as reasonable as anything.
5251 !!test
5252 Mixing markup for italics and bold
5253 !! options
5254 !! input
5255 '''bold''''''bold''bolditalics'''''
5256 !! result
5257 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5258 </p>
5259 !! end
5260
5261
5262 !! article
5263 Xyzzyx
5264 !! text
5265 Article for special page transclusion test
5266 !! endarticle
5267
5268 !! test
5269 Special page transclusion
5270 !! options
5271 !! input
5272 {{Special:Prefixindex/Xyzzyx}}
5273 !! result
5274 <p><br />
5275 </p>
5276 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5277
5278 !! end
5279
5280 !! test
5281 Special page transclusion twice (bug 5021)
5282 !! options
5283 !! input
5284 {{Special:Prefixindex/Xyzzyx}}
5285 {{Special:Prefixindex/Xyzzyx}}
5286 !! result
5287 <p><br />
5288 </p>
5289 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5290 <p><br />
5291 </p>
5292 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5293
5294 !! end
5295
5296 !! test
5297 Transclusion of default MediaWiki message
5298 !! input
5299 {{MediaWiki:Mainpage}}
5300 !!result
5301 <p>Main Page
5302 </p>
5303 !! end
5304
5305 !! test
5306 Transclusion of nonexistent MediaWiki message
5307 !! input
5308 {{MediaWiki:Mainpagexxx}}
5309 !!result
5310 <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>
5311 </p>
5312 !! end
5313
5314 !! test
5315 Transclusion of MediaWiki message with underscore
5316 !! input
5317 {{MediaWiki:history_short}}
5318 !! result
5319 <p>History
5320 </p>
5321 !! end
5322
5323 !! test
5324 Transclusion of MediaWiki message with space
5325 !! input
5326 {{MediaWiki:history short}}
5327 !! result
5328 <p>History
5329 </p>
5330 !! end
5331
5332 !! test
5333 Invalid header with following text
5334 !! input
5335 = x = y
5336 !! result
5337 <p>= x = y
5338 </p>
5339 !! end
5340
5341
5342 !! test
5343 Section extraction test (section 0)
5344 !! options
5345 section=0
5346 !! input
5347 start
5348 ==a==
5349 ===aa===
5350 ====aaa====
5351 ==b==
5352 ===ba===
5353 ===bb===
5354 ====bba====
5355 ===bc===
5356 ==c==
5357 ===ca===
5358 !! result
5359 start
5360 !! end
5361
5362 !! test
5363 Section extraction test (section 1)
5364 !! options
5365 section=1
5366 !! input
5367 start
5368 ==a==
5369 ===aa===
5370 ====aaa====
5371 ==b==
5372 ===ba===
5373 ===bb===
5374 ====bba====
5375 ===bc===
5376 ==c==
5377 ===ca===
5378 !! result
5379 ==a==
5380 ===aa===
5381 ====aaa====
5382 !! end
5383
5384 !! test
5385 Section extraction test (section 2)
5386 !! options
5387 section=2
5388 !! input
5389 start
5390 ==a==
5391 ===aa===
5392 ====aaa====
5393 ==b==
5394 ===ba===
5395 ===bb===
5396 ====bba====
5397 ===bc===
5398 ==c==
5399 ===ca===
5400 !! result
5401 ===aa===
5402 ====aaa====
5403 !! end
5404
5405 !! test
5406 Section extraction test (section 3)
5407 !! options
5408 section=3
5409 !! input
5410 start
5411 ==a==
5412 ===aa===
5413 ====aaa====
5414 ==b==
5415 ===ba===
5416 ===bb===
5417 ====bba====
5418 ===bc===
5419 ==c==
5420 ===ca===
5421 !! result
5422 ====aaa====
5423 !! end
5424
5425 !! test
5426 Section extraction test (section 4)
5427 !! options
5428 section=4
5429 !! input
5430 start
5431 ==a==
5432 ===aa===
5433 ====aaa====
5434 ==b==
5435 ===ba===
5436 ===bb===
5437 ====bba====
5438 ===bc===
5439 ==c==
5440 ===ca===
5441 !! result
5442 ==b==
5443 ===ba===
5444 ===bb===
5445 ====bba====
5446 ===bc===
5447 !! end
5448
5449 !! test
5450 Section extraction test (section 5)
5451 !! options
5452 section=5
5453 !! input
5454 start
5455 ==a==
5456 ===aa===
5457 ====aaa====
5458 ==b==
5459 ===ba===
5460 ===bb===
5461 ====bba====
5462 ===bc===
5463 ==c==
5464 ===ca===
5465 !! result
5466 ===ba===
5467 !! end
5468
5469 !! test
5470 Section extraction test (section 6)
5471 !! options
5472 section=6
5473 !! input
5474 start
5475 ==a==
5476 ===aa===
5477 ====aaa====
5478 ==b==
5479 ===ba===
5480 ===bb===
5481 ====bba====
5482 ===bc===
5483 ==c==
5484 ===ca===
5485 !! result
5486 ===bb===
5487 ====bba====
5488 !! end
5489
5490 !! test
5491 Section extraction test (section 7)
5492 !! options
5493 section=7
5494 !! input
5495 start
5496 ==a==
5497 ===aa===
5498 ====aaa====
5499 ==b==
5500 ===ba===
5501 ===bb===
5502 ====bba====
5503 ===bc===
5504 ==c==
5505 ===ca===
5506 !! result
5507 ====bba====
5508 !! end
5509
5510 !! test
5511 Section extraction test (section 8)
5512 !! options
5513 section=8
5514 !! input
5515 start
5516 ==a==
5517 ===aa===
5518 ====aaa====
5519 ==b==
5520 ===ba===
5521 ===bb===
5522 ====bba====
5523 ===bc===
5524 ==c==
5525 ===ca===
5526 !! result
5527 ===bc===
5528 !! end
5529
5530 !! test
5531 Section extraction test (section 9)
5532 !! options
5533 section=9
5534 !! input
5535 start
5536 ==a==
5537 ===aa===
5538 ====aaa====
5539 ==b==
5540 ===ba===
5541 ===bb===
5542 ====bba====
5543 ===bc===
5544 ==c==
5545 ===ca===
5546 !! result
5547 ==c==
5548 ===ca===
5549 !! end
5550
5551 !! test
5552 Section extraction test (section 10)
5553 !! options
5554 section=10
5555 !! input
5556 start
5557 ==a==
5558 ===aa===
5559 ====aaa====
5560 ==b==
5561 ===ba===
5562 ===bb===
5563 ====bba====
5564 ===bc===
5565 ==c==
5566 ===ca===
5567 !! result
5568 ===ca===
5569 !! end
5570
5571 !! test
5572 Section extraction test (nonexistent section 11)
5573 !! options
5574 section=11
5575 !! input
5576 start
5577 ==a==
5578 ===aa===
5579 ====aaa====
5580 ==b==
5581 ===ba===
5582 ===bb===
5583 ====bba====
5584 ===bc===
5585 ==c==
5586 ===ca===
5587 !! result
5588 !! end
5589
5590 !! test
5591 Section extraction test with bogus heading (section 1)
5592 !! options
5593 section=1
5594 !! input
5595 ==a==
5596 ==bogus== not a legal section
5597 ==b==
5598 !! result
5599 ==a==
5600 ==bogus== not a legal section
5601 !! end
5602
5603 !! test
5604 Section extraction test with bogus heading (section 2)
5605 !! options
5606 section=2
5607 !! input
5608 ==a==
5609 ==bogus== not a legal section
5610 ==b==
5611 !! result
5612 ==b==
5613 !! end
5614
5615 !! test
5616 Section extraction test with comment after heading (section 1)
5617 !! options
5618 section=1
5619 !! input
5620 ==a==
5621 ==b== <!-- -->
5622 ==c==
5623 !! result
5624 ==a==
5625 !! end
5626
5627 !! test
5628 Section extraction test with comment after heading (section 2)
5629 !! options
5630 section=2
5631 !! input
5632 ==a==
5633 ==b== <!-- -->
5634 ==c==
5635 !! result
5636 ==b== <!-- -->
5637 !! end
5638
5639 !! test
5640 Section extraction test with bogus <nowiki> heading (section 1)
5641 !! options
5642 section=1
5643 !! input
5644 ==a==
5645 ==bogus== <nowiki>not a legal section</nowiki>
5646 ==b==
5647 !! result
5648 ==a==
5649 ==bogus== <nowiki>not a legal section</nowiki>
5650 !! end
5651
5652 !! test
5653 Section extraction test with bogus <nowiki> heading (section 2)
5654 !! options
5655 section=2
5656 !! input
5657 ==a==
5658 ==bogus== <nowiki>not a legal section</nowiki>
5659 ==b==
5660 !! result
5661 ==b==
5662 !! end
5663
5664
5665 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
5666 # instead of respecting commented sections
5667 !! test
5668 Section extraction prefixed by comment (section 1)
5669 !! options
5670 section=1
5671 !! input
5672 <!-- -->==sec1==
5673 ==sec2==
5674 !!result
5675 ==sec2==
5676 !!end
5677
5678 !! test
5679 Section extraction prefixed by comment (section 2)
5680 !! options
5681 section=2
5682 !! input
5683 <!-- -->==sec1==
5684 ==sec2==
5685 !!result
5686
5687 !!end
5688
5689
5690 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
5691 # instead of respecting HTML-style headings
5692 !! test
5693 Section extraction, mixed wiki and html (section 1)
5694 !! options
5695 section=1
5696 !! input
5697 <h2>unmarked</h2>
5698 unmarked
5699 ==1==
5700 one
5701 ==2==
5702 two
5703 !! result
5704 ==1==
5705 one
5706 !! end
5707
5708 !! test
5709 Section extraction, mixed wiki and html (section 2)
5710 !! options
5711 section=2
5712 !! input
5713 <h2>unmarked</h2>
5714 unmarked
5715 ==1==
5716 one
5717 ==2==
5718 two
5719 !! result
5720 ==2==
5721 two
5722 !! end
5723
5724
5725 # Formerly testing for bug 3342
5726 !! test
5727 Section extraction, heading surrounded by <noinclude>
5728 !! options
5729 section=1
5730 !! input
5731 <noinclude>==unmarked==</noinclude>
5732 ==marked==
5733 !! result
5734 ==marked==
5735 !!end
5736
5737
5738 !! test
5739 Section replacement test (section 0)
5740 !! options
5741 replace=0,"xxx"
5742 !! input
5743 start
5744 ==a==
5745 ===aa===
5746 ====aaa====
5747 ==b==
5748 ===ba===
5749 ===bb===
5750 ====bba====
5751 ===bc===
5752 ==c==
5753 ===ca===
5754 !! result
5755 xxx
5756
5757 ==a==
5758 ===aa===
5759 ====aaa====
5760 ==b==
5761 ===ba===
5762 ===bb===
5763 ====bba====
5764 ===bc===
5765 ==c==
5766 ===ca===
5767 !! end
5768
5769 !! test
5770 Section replacement test (section 1)
5771 !! options
5772 replace=1,"xxx"
5773 !! input
5774 start
5775 ==a==
5776 ===aa===
5777 ====aaa====
5778 ==b==
5779 ===ba===
5780 ===bb===
5781 ====bba====
5782 ===bc===
5783 ==c==
5784 ===ca===
5785 !! result
5786 start
5787 xxx
5788
5789 ==b==
5790 ===ba===
5791 ===bb===
5792 ====bba====
5793 ===bc===
5794 ==c==
5795 ===ca===
5796 !! end
5797
5798 !! test
5799 Section replacement test (section 2)
5800 !! options
5801 replace=2,"xxx"
5802 !! input
5803 start
5804 ==a==
5805 ===aa===
5806 ====aaa====
5807 ==b==
5808 ===ba===
5809 ===bb===
5810 ====bba====
5811 ===bc===
5812 ==c==
5813 ===ca===
5814 !! result
5815 start
5816 ==a==
5817 xxx
5818
5819 ==b==
5820 ===ba===
5821 ===bb===
5822 ====bba====
5823 ===bc===
5824 ==c==
5825 ===ca===
5826 !! end
5827
5828 !! test
5829 Section replacement test (section 3)
5830 !! options
5831 replace=3,"xxx"
5832 !! input
5833 start
5834 ==a==
5835 ===aa===
5836 ====aaa====
5837 ==b==
5838 ===ba===
5839 ===bb===
5840 ====bba====
5841 ===bc===
5842 ==c==
5843 ===ca===
5844 !! result
5845 start
5846 ==a==
5847 ===aa===
5848 xxx
5849
5850 ==b==
5851 ===ba===
5852 ===bb===
5853 ====bba====
5854 ===bc===
5855 ==c==
5856 ===ca===
5857 !! end
5858
5859 !! test
5860 Section replacement test (section 4)
5861 !! options
5862 replace=4,"xxx"
5863 !! input
5864 start
5865 ==a==
5866 ===aa===
5867 ====aaa====
5868 ==b==
5869 ===ba===
5870 ===bb===
5871 ====bba====
5872 ===bc===
5873 ==c==
5874 ===ca===
5875 !! result
5876 start
5877 ==a==
5878 ===aa===
5879 ====aaa====
5880 xxx
5881
5882 ==c==
5883 ===ca===
5884 !! end
5885
5886 !! test
5887 Section replacement test (section 5)
5888 !! options
5889 replace=5,"xxx"
5890 !! input
5891 start
5892 ==a==
5893 ===aa===
5894 ====aaa====
5895 ==b==
5896 ===ba===
5897 ===bb===
5898 ====bba====
5899 ===bc===
5900 ==c==
5901 ===ca===
5902 !! result
5903 start
5904 ==a==
5905 ===aa===
5906 ====aaa====
5907 ==b==
5908 xxx
5909
5910 ===bb===
5911 ====bba====
5912 ===bc===
5913 ==c==
5914 ===ca===
5915 !! end
5916
5917 !! test
5918 Section replacement test (section 6)
5919 !! options
5920 replace=6,"xxx"
5921 !! input
5922 start
5923 ==a==
5924 ===aa===
5925 ====aaa====
5926 ==b==
5927 ===ba===
5928 ===bb===
5929 ====bba====
5930 ===bc===
5931 ==c==
5932 ===ca===
5933 !! result
5934 start
5935 ==a==
5936 ===aa===
5937 ====aaa====
5938 ==b==
5939 ===ba===
5940 xxx
5941
5942 ===bc===
5943 ==c==
5944 ===ca===
5945 !! end
5946
5947 !! test
5948 Section replacement test (section 7)
5949 !! options
5950 replace=7,"xxx"
5951 !! input
5952 start
5953 ==a==
5954 ===aa===
5955 ====aaa====
5956 ==b==
5957 ===ba===
5958 ===bb===
5959 ====bba====
5960 ===bc===
5961 ==c==
5962 ===ca===
5963 !! result
5964 start
5965 ==a==
5966 ===aa===
5967 ====aaa====
5968 ==b==
5969 ===ba===
5970 ===bb===
5971 xxx
5972
5973 ===bc===
5974 ==c==
5975 ===ca===
5976 !! end
5977
5978 !! test
5979 Section replacement test (section 8)
5980 !! options
5981 replace=8,"xxx"
5982 !! input
5983 start
5984 ==a==
5985 ===aa===
5986 ====aaa====
5987 ==b==
5988 ===ba===
5989 ===bb===
5990 ====bba====
5991 ===bc===
5992 ==c==
5993 ===ca===
5994 !! result
5995 start
5996 ==a==
5997 ===aa===
5998 ====aaa====
5999 ==b==
6000 ===ba===
6001 ===bb===
6002 ====bba====
6003 xxx
6004
6005 ==c==
6006 ===ca===
6007 !!end
6008
6009 !! test
6010 Section replacement test (section 9)
6011 !! options
6012 replace=9,"xxx"
6013 !! input
6014 start
6015 ==a==
6016 ===aa===
6017 ====aaa====
6018 ==b==
6019 ===ba===
6020 ===bb===
6021 ====bba====
6022 ===bc===
6023 ==c==
6024 ===ca===
6025 !! result
6026 start
6027 ==a==
6028 ===aa===
6029 ====aaa====
6030 ==b==
6031 ===ba===
6032 ===bb===
6033 ====bba====
6034 ===bc===
6035 xxx
6036 !! end
6037
6038 !! test
6039 Section replacement test (section 10)
6040 !! options
6041 replace=10,"xxx"
6042 !! input
6043 start
6044 ==a==
6045 ===aa===
6046 ====aaa====
6047 ==b==
6048 ===ba===
6049 ===bb===
6050 ====bba====
6051 ===bc===
6052 ==c==
6053 ===ca===
6054 !! result
6055 start
6056 ==a==
6057 ===aa===
6058 ====aaa====
6059 ==b==
6060 ===ba===
6061 ===bb===
6062 ====bba====
6063 ===bc===
6064 ==c==
6065 xxx
6066 !! end
6067
6068 !! test
6069 Section replacement test with initial whitespace (bug 13728)
6070 !! options
6071 replace=2,"xxx"
6072 !! input
6073 Preformatted initial line
6074 ==a==
6075 ===a===
6076 !! result
6077 Preformatted initial line
6078 ==a==
6079 xxx
6080 !! end
6081
6082
6083 !! test
6084 Section extraction, heading followed by pre with 20 spaces (bug 6398)
6085 !! options
6086 section=1
6087 !! input
6088 ==a==
6089 a
6090 !! result
6091 ==a==
6092 a
6093 !! end
6094
6095 !! test
6096 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
6097 !! options
6098 section=1
6099 !! input
6100 ==a==
6101 a
6102 !! result
6103 ==a==
6104 a
6105 !! end
6106
6107
6108 !! test
6109 Section extraction, <pre> around bogus header (bug 10309)
6110 !! options
6111 noxml section=2
6112 !! input
6113 == Section One ==
6114 <pre>
6115 =======
6116 </pre>
6117
6118 == Section Two ==
6119 stuff
6120 !! result
6121 == Section Two ==
6122 stuff
6123 !! end
6124
6125 !! test
6126 Section replacement, <pre> around bogus header (bug 10309)
6127 !! options
6128 noxml replace=2,"xxx"
6129 !! input
6130 == Section One ==
6131 <pre>
6132 =======
6133 </pre>
6134
6135 == Section Two ==
6136 stuff
6137 !! result
6138 == Section One ==
6139 <pre>
6140 =======
6141 </pre>
6142
6143 xxx
6144 !! end
6145
6146
6147
6148 !! test
6149 Handling of &#x0A; in URLs
6150 !! input
6151 **irc://&#x0A;a
6152 !! result
6153 <ul><li><ul><li><a href="irc://%0Aa" class="external free" rel="nofollow">irc://%0Aa</a>
6154 </li></ul>
6155 </li></ul>
6156
6157 !!end
6158
6159 !! test
6160 5 quotes, code coverage +1 line
6161 !! input
6162 '''''
6163 !! result
6164 !! end
6165
6166 !! test
6167 Special:Search page linking.
6168 !! input
6169 {{Special:search}}
6170 !! result
6171 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6172 </p>
6173 !! end
6174
6175 !! test
6176 Say the magic word
6177 !! input
6178 * {{PAGENAME}}
6179 * {{BASEPAGENAME}}
6180 * {{SUBPAGENAME}}
6181 * {{SUBPAGENAMEE}}
6182 * {{BASEPAGENAME}}
6183 * {{BASEPAGENAMEE}}
6184 * {{TALKPAGENAME}}
6185 * {{TALKPAGENAMEE}}
6186 * {{SUBJECTPAGENAME}}
6187 * {{SUBJECTPAGENAMEE}}
6188 * {{NAMESPACEE}}
6189 * {{NAMESPACE}}
6190 * {{TALKSPACE}}
6191 * {{TALKSPACEE}}
6192 * {{SUBJECTSPACE}}
6193 * {{SUBJECTSPACEE}}
6194 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6195 !! result
6196 <ul><li> Parser test
6197 </li><li> Parser test
6198 </li><li> Parser test
6199 </li><li> Parser_test
6200 </li><li> Parser test
6201 </li><li> Parser_test
6202 </li><li> Talk:Parser test
6203 </li><li> Talk:Parser_test
6204 </li><li> Parser test
6205 </li><li> Parser_test
6206 </li><li>
6207 </li><li>
6208 </li><li> Talk
6209 </li><li> Talk
6210 </li><li>
6211 </li><li>
6212 </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>
6213 </li></ul>
6214
6215 !! end
6216 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6217
6218 !! test
6219 Gallery
6220 !! input
6221 <gallery>
6222 image1.png |
6223 image2.gif|||||
6224
6225 image3|
6226 image4 |300px| centre
6227 image5.svg| http://///////
6228 [[x|xx]]]]
6229 * image6
6230 </gallery>
6231 !! result
6232 <table class="gallery" cellspacing="0" cellpadding="0">
6233 <tr>
6234 <td><div class="gallerybox" style="width: 155px;">
6235 <div style="height: 152px;">Image1.png</div>
6236 <div class="gallerytext">
6237 </div>
6238 </div></td>
6239 <td><div class="gallerybox" style="width: 155px;">
6240 <div style="height: 152px;">Image2.gif</div>
6241 <div class="gallerytext">
6242 <p>||||
6243 </p>
6244 </div>
6245 </div></td>
6246 <td><div class="gallerybox" style="width: 155px;">
6247 <div style="height: 152px;">Image3</div>
6248 <div class="gallerytext">
6249 </div>
6250 </div></td>
6251 <td><div class="gallerybox" style="width: 155px;">
6252 <div style="height: 152px;">Image4</div>
6253 <div class="gallerytext">
6254 <p>300px| centre
6255 </p>
6256 </div>
6257 </div></td>
6258 </tr>
6259 <tr>
6260 <td><div class="gallerybox" style="width: 155px;">
6261 <div style="height: 152px;">Image5.svg</div>
6262 <div class="gallerytext">
6263 <p><a href="http://///////" class="external free" rel="nofollow">http://///////</a>
6264 </p>
6265 </div>
6266 </div></td>
6267 <td><div class="gallerybox" style="width: 155px;">
6268 <div style="height: 152px;">* image6</div>
6269 <div class="gallerytext">
6270 </div>
6271 </div></td>
6272 </tr>
6273 </table>
6274
6275 !! end
6276
6277 !! test
6278 HTML Hex character encoding (spells the word "JavaScript")
6279 !! input
6280 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6281 !! result
6282 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6283 </p>
6284 !! end
6285
6286 !! test
6287 __FORCETOC__ override
6288 !! input
6289 __NEWSECTIONLINK__
6290 __FORCETOC__
6291 !! result
6292 <p><br />
6293 </p>
6294 !! end
6295
6296 !! test
6297 ISBN code coverage
6298 !! input
6299 ISBN 978-0-1234-56&#x20;789
6300 !! result
6301 <p><a href="/wiki/Special:BookSources/9780123456" class="internal">ISBN 978-0-1234-56</a>&#x20;789
6302 </p>
6303 !! end
6304
6305 !! test
6306 ISBN followed by 5 spaces
6307 !! input
6308 ISBN
6309 !! result
6310 <p>ISBN
6311 </p>
6312 !! end
6313
6314 !! test
6315 Double ISBN
6316 !! input
6317 ISBN ISBN 1234567890
6318 !! result
6319 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1234567890</a>
6320 </p>
6321 !! end
6322
6323 !! test
6324 Double RFC
6325 !! input
6326 RFC RFC 1234
6327 !! result
6328 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external">RFC 1234</a>
6329 </p>
6330 !! end
6331
6332 !! test
6333 Double RFC with a wiki link
6334 !! input
6335 RFC [[RFC 1234]]
6336 !! result
6337 <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>
6338 </p>
6339 !! end
6340
6341 !! test
6342 RFC code coverage
6343 !! input
6344 RFC 983&#x20;987
6345 !! result
6346 <p><a href="http://tools.ietf.org/html/rfc983" class="external">RFC 983</a>&#x20;987
6347 </p>
6348 !! end
6349
6350 !! test
6351 Centre-aligned image
6352 !! input
6353 [[Image:foobar.jpg|centre]]
6354 !! result
6355 <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>
6356
6357 !!end
6358
6359 !! test
6360 None-aligned image
6361 !! input
6362 [[Image:foobar.jpg|none]]
6363 !! result
6364 <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>
6365
6366 !!end
6367
6368 !! test
6369 Width + Height sized image (using px) (height is ignored)
6370 !! input
6371 [[Image:foobar.jpg|640x480px]]
6372 !! result
6373 <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" /></a>
6374 </p>
6375 !!end
6376
6377 !! test
6378 Width-sized image (using px, no following whitespace)
6379 !! input
6380 [[Image:foobar.jpg|640px]]
6381 !! result
6382 <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" /></a>
6383 </p>
6384 !!end
6385
6386 !! test
6387 Width-sized image (using px, with following whitespace - test regression from r39467)
6388 !! input
6389 [[Image:foobar.jpg|640px ]]
6390 !! result
6391 <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" /></a>
6392 </p>
6393 !!end
6394
6395 !! test
6396 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6397 !! input
6398 [[Image:foobar.jpg| 640px]]
6399 !! result
6400 <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" /></a>
6401 </p>
6402 !!end
6403
6404 !! test
6405 Another italics / bold test
6406 !! input
6407 ''' ''x'
6408 !! result
6409 <pre>'<i> </i>x'
6410 </pre>
6411 !!end
6412
6413 # Note the results may be incorrect, as parserTest output included this:
6414 # XML error: Mismatched tag at byte 6120:
6415 # ...<dd> </dt></dl> </dd...
6416 !! test
6417 dt/dd/dl test
6418 !! options
6419 disabled
6420 !! input
6421 :;;;::
6422 !! result
6423 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6424 </dd></dl>
6425 </dd></dl>
6426 </dt></dl>
6427 </dt></dl>
6428 </dt></dl>
6429 </dd></dl>
6430
6431 !!end
6432
6433
6434 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6435 !! test
6436 Images with the "|" character in the comment
6437 !! options
6438 disabled
6439 !! input
6440 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6441 !! result
6442 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="An external URL" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" /></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 href="http://test/?param1=|left|&amp;param2=|x" class="external text" rel="nofollow">external</a> URL</div></div></div>
6443
6444 !!end
6445
6446 !! test
6447 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6448 !! input
6449 <html><script>alert(1);</script></html>
6450 !! result
6451 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6452 </p>
6453 !! end
6454
6455 !! test
6456 HTML with raw HTML ($wgRawHtml==true)
6457 !! options
6458 rawhtml
6459 !! input
6460 <html><script>alert(1);</script></html>
6461 !! result
6462 <p><script>alert(1);</script>
6463 </p>
6464 !! end
6465
6466 !! test
6467 Parents of subpages, one level up
6468 !! options
6469 subpage title=[[Subpage test/L1/L2/L3]]
6470 !! input
6471 [[../|L2]]
6472 !! result
6473 <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>
6474 </p>
6475 !! end
6476
6477
6478 !! test
6479 Parents of subpages, one level up, not named
6480 !! options
6481 subpage title=[[Subpage test/L1/L2/L3]]
6482 !! input
6483 [[../]]
6484 !! result
6485 <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>
6486 </p>
6487 !! end
6488
6489
6490
6491 !! test
6492 Parents of subpages, two levels up
6493 !! options
6494 disabled
6495 subpage title=[[Subpage test/L1/L2/L3]]
6496 !! input
6497 [[../../|L1]]2
6498 !! result
6499 <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>
6500 </p>
6501 !! end
6502
6503 !! test
6504 Parents of subpages, two levels up, without trailing slash or name.
6505 !! options
6506 subpage title=[[Subpage test/L1/L2/L3]]
6507 !! input
6508 [[../..]]
6509 !! result
6510 <p>[[../..]]
6511 </p>
6512 !! end
6513
6514 !! test
6515 Parents of subpages, two levels up, with lots of extra trailing slashes.
6516 !! options
6517 subpage title=[[Subpage test/L1/L2/L3]]
6518 !! input
6519 [[../../////]]
6520 !! result
6521 <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>
6522 </p>
6523 !! end
6524
6525 !! test
6526 Definition list code coverage
6527 !! input
6528 ; title : def
6529 ; title : def
6530 ;title: def
6531 !! result
6532 <dl><dt> title &nbsp;</dt><dd> def
6533 </dd><dt> title&nbsp;</dt><dd> def
6534 </dd><dt>title</dt><dd> def
6535 </dd></dl>
6536
6537 !! end
6538
6539 !! test
6540 Don't fall for the self-closing div
6541 !! input
6542 <div>hello world</div/>
6543 !! result
6544 <div>hello world</div>
6545
6546 !! end
6547
6548 !! test
6549 MSGNW magic word
6550 !! input
6551 {{MSGNW:msg}}
6552 !! result
6553 <p>&#91;&#91;:Template:Msg&#93;&#93;
6554 </p>
6555 !! end
6556
6557 !! test
6558 RAW magic word
6559 !! input
6560 {{RAW:QUERTY}}
6561 !! result
6562 <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>
6563 </p>
6564 !! end
6565
6566 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6567 !! test
6568 Always escape literal '>' in output, not just after '<'
6569 !! input
6570 test ><>
6571 !! result
6572 <p>test &gt;&lt;&gt;
6573 </p>
6574 !! end
6575
6576 !! test
6577 Template caching
6578 !! input
6579 {{Test}}
6580 {{Test}}
6581 !! result
6582 <p>This is a test template
6583 This is a test template
6584 </p>
6585 !! end
6586
6587
6588 !! article
6589 MediaWiki:Fake
6590 !! text
6591 ==header==
6592 !! endarticle
6593
6594 !! test
6595 Inclusion of !userCanEdit() content
6596 !! input
6597 {{MediaWiki:Fake}}
6598 !! result
6599 <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>
6600
6601 !! end
6602
6603
6604 !! test
6605 Out-of-order TOC heading levels
6606 !! input
6607 ==2==
6608 ======6======
6609 ===3===
6610 =1=
6611 =====5=====
6612 ==2==
6613 !! result
6614 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6615 <ul>
6616 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6617 <ul>
6618 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6619 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6620 </ul>
6621 </li>
6622 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6623 <ul>
6624 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6625 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6626 </ul>
6627 </li>
6628 </ul>
6629 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6630 <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>
6631 <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>
6632 <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>
6633 <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>
6634 <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>
6635 <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>
6636
6637 !! end
6638
6639
6640 !! test
6641 ISBN with a dummy number
6642 !! input
6643 ISBN ---
6644 !! result
6645 <p>ISBN ---
6646 </p>
6647 !! end
6648
6649
6650 !! test
6651 ISBN with space-delimited number
6652 !! input
6653 ISBN 92 9017 032 8
6654 !! result
6655 <p><a href="/wiki/Special:BookSources/9290170328" class="internal">ISBN 92 9017 032 8</a>
6656 </p>
6657 !! end
6658
6659
6660 !! test
6661 ISBN with multiple spaces, no number
6662 !! input
6663 ISBN foo
6664 !! result
6665 <p>ISBN foo
6666 </p>
6667 !! end
6668
6669
6670 !! test
6671 ISBN length
6672 !! input
6673 ISBN 123456789
6674
6675 ISBN 1234567890
6676
6677 ISBN 12345678901
6678 !! result
6679 <p>ISBN 123456789
6680 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1234567890</a>
6681 </p><p>ISBN 12345678901
6682 </p>
6683 !! end
6684
6685
6686 !! test
6687 ISBN with trailing year (bug 8110)
6688 !! input
6689 ISBN 1-234-56789-0 - 2006
6690
6691 ISBN 1 234 56789 0 - 2006
6692 !! result
6693 <p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1-234-56789-0</a> - 2006
6694 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1 234 56789 0</a> - 2006
6695 </p>
6696 !! end
6697
6698
6699 !! test
6700 anchorencode
6701 !! input
6702 {{anchorencode:foo bar©#%n}}
6703 !! result
6704 <p>foo_bar.C2.A9.23.25n
6705 </p>
6706 !! end
6707
6708
6709 !! test
6710 Bug 8293: Use of center tag ruins paragraph formatting
6711 !! input
6712 <center>
6713 foo
6714 </center>
6715
6716 bar
6717
6718 baz
6719 !! result
6720 <center>
6721 <p>foo
6722 </p>
6723 </center>
6724 <p>bar
6725 </p>
6726 <pre>baz
6727 </pre>
6728 !! end
6729
6730
6731 ###
6732 ### Language variants related tests
6733 ###
6734 !! test
6735 Self-link in language variants
6736 !! options
6737 title=[[Dunav]] language=sr
6738 !! input
6739 Both [[Dunav]] and [[Дунав]] are names for this river.
6740 !! result
6741 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6742 </p>
6743 !!end
6744
6745
6746 !! test
6747 Link to pages in language variants
6748 !! options
6749 language=sr
6750 !! input
6751 Main Page can be written as [[Маин Паге]]
6752 !! result
6753 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6754 </p>
6755 !!end
6756
6757
6758 !! test
6759 Multiple links to pages in language variants
6760 !! options
6761 language=sr
6762 !! input
6763 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6764 !! result
6765 <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>.
6766 </p>
6767 !!end
6768
6769
6770 !! test
6771 Simple template in language variants
6772 !! options
6773 language=sr
6774 !! input
6775 {{тест}}
6776 !! result
6777 <p>This is a test template
6778 </p>
6779 !! end
6780
6781
6782 !! test
6783 Template with explicit namespace in language variants
6784 !! options
6785 language=sr
6786 !! input
6787 {{Template:тест}}
6788 !! result
6789 <p>This is a test template
6790 </p>
6791 !! end
6792
6793
6794 !! test
6795 Basic test for template parameter in language variants
6796 !! options
6797 language=sr
6798 !! input
6799 {{парамтест|param=foo}}
6800 !! result
6801 <p>This is a test template with parameter foo
6802 </p>
6803 !! end
6804
6805
6806 !! test
6807 Simple category in language variants
6808 !! options
6809 language=sr cat
6810 !! input
6811 [[:Category:МедиаWики Усер'с Гуиде]]
6812 !! result
6813 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#039;s Guide">MediaWiki User's Guide</a>
6814 !! end
6815
6816
6817 !! test
6818 Stripping -{}- tags (language variants)
6819 !! options
6820 language=sr
6821 !! input
6822 Latin proverb: -{Ne nuntium necare}-
6823 !! result
6824 <p>Latin proverb: Ne nuntium necare
6825 </p>
6826 !! end
6827
6828
6829 !! test
6830 Prevent conversion with -{}- tags (language variants)
6831 !! options
6832 language=sr variant=sr-ec
6833 !! input
6834 Latinski: -{Ne nuntium necare}-
6835 !! result
6836 <p>Латински: Ne nuntium necare
6837 </p>
6838 !! end
6839
6840
6841 !! test
6842 Prevent conversion of text with -{}- tags (language variants)
6843 !! options
6844 language=sr variant=sr-ec
6845 !! input
6846 Latinski: -{Ne nuntium necare}-
6847 !! result
6848 <p>Латински: Ne nuntium necare
6849 </p>
6850 !! end
6851
6852
6853 !! test
6854 Prevent conversion of links with -{}- tags (language variants)
6855 !! options
6856 language=sr variant=sr-ec
6857 !! input
6858 -{[[Main Page]]}-
6859 !! result
6860 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
6861 </p>
6862 !! end
6863
6864
6865 !! test
6866 -{}- tags within headlines (within html for parserConvert())
6867 !! options
6868 language=sr variant=sr-ec
6869 !! input
6870 == -{Naslov}- ==
6871 !! result
6872 <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>
6873
6874 !! end
6875
6876
6877 !! test
6878 Explicit definition of language variant alternatives
6879 !! options
6880 language=zh variant=zh-tw
6881 !! input
6882 -{zh:China;zh-tw:Taiwan}-, not China
6883 !! result
6884 <p>Taiwan, not China
6885 </p>
6886 !! end
6887
6888
6889 !! test
6890 Adding explicit session-wise language variant mapping (A flag)
6891 !! options
6892 language=zh variant=zh-tw
6893 !! input
6894 -{A|zh:China;zh-tw:Taiwan}- is China
6895 !! result
6896 <p>Taiwan is Taiwan
6897 </p>
6898 !! end
6899
6900
6901 !! test
6902 Adding explicit conversion rule for title (T flag)
6903 !! options
6904 language=zh variant=zh-tw
6905 !! input
6906 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
6907 !! result
6908 <p>Should be stripped!
6909 </p>
6910 !! end
6911
6912
6913 !! test
6914 Raw output of variant escape tags (R flag)
6915 !! options
6916 language=zh variant=zh-tw
6917 !! input
6918 Raw: -{R|zh:China;zh-tw:Taiwan}-
6919 !! result
6920 <p>Raw: zh:China;zh-tw:Taiwan
6921 </p>
6922 !! end
6923
6924
6925 !! test
6926 Do not convert roman numbers to language variants
6927 !! options
6928 language=sr variant=sr-ec
6929 !! input
6930 Fridrih IV je car.
6931 !! result
6932 <p>Фридрих IV је цар.
6933 </p>
6934 !! end
6935
6936 !!article
6937 Template:Bullet
6938 !!text
6939 * Bar
6940 !!endarticle
6941
6942 !! test
6943 Bug 529: Uncovered bullet
6944 !! input
6945 * Foo {{bullet}}
6946 !! result
6947 <ul><li> Foo
6948 </li><li> Bar
6949 </li></ul>
6950
6951 !! end
6952
6953 !! test
6954 Bug 529: Uncovered table already at line-start
6955 !! input
6956 x
6957
6958 {{table}}
6959 y
6960 !! result
6961 <p>x
6962 </p>
6963 <table>
6964 <tr>
6965 <td> 1 </td><td> 2
6966 </td></tr>
6967 <tr>
6968 <td> 3 </td><td> 4
6969 </td></tr></table>
6970 <p>y
6971 </p>
6972 !! end
6973
6974 !! test
6975 Bug 529: Uncovered bullet in parser function result
6976 !! input
6977 * Foo {{lc:{{bullet}} }}
6978 !! result
6979 <ul><li> Foo
6980 </li><li> bar
6981 </li></ul>
6982
6983 !! end
6984
6985 !! test
6986 Bug 5678: Double-parsed template argument
6987 !! input
6988 {{lc:{{{1}}}|hello}}
6989 !! result
6990 <p>{{{1}}}
6991 </p>
6992 !! end
6993
6994 !! test
6995 Bug 5678: Double-parsed template invocation
6996 !! input
6997 {{lc:{{paramtest {{!}} param = hello }} }}
6998 !! result
6999 <p>{{paramtest | param = hello }}
7000 </p>
7001 !! end
7002
7003 !! test
7004 Morwen/13: Unclosed link followed by heading
7005 !! input
7006 [[link
7007 ==heading==
7008 !! result
7009 <p>[[link
7010 </p>
7011 <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>
7012
7013 !! end
7014
7015 !! test
7016 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
7017 !! input
7018 {{foo|
7019 =heading=
7020 !! result
7021 <p>{{foo|
7022 </p>
7023 <h1> <span class="mw-headline" id="heading">heading</span></h1>
7024
7025 !! end
7026
7027 !! test
7028 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
7029 !! input
7030 {{foo|
7031 ==heading==
7032 !! result
7033 <p>{{foo|
7034 </p>
7035 <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>
7036
7037 !! end
7038
7039 !! test
7040 Tildes in comments
7041 !! options
7042 pst
7043 !! input
7044 <!-- ~~~~ -->
7045 !! result
7046 <!-- ~~~~ -->
7047 !! end
7048
7049 !! test
7050 Paragraphs inside divs (no extra line breaks)
7051 !! input
7052 <div>Line one
7053
7054 Line two</div>
7055 !! result
7056 <div>Line one
7057 Line two</div>
7058
7059 !! end
7060
7061 !! test
7062 Paragraphs inside divs (extra line break on open)
7063 !! input
7064 <div>
7065 Line one
7066
7067 Line two</div>
7068 !! result
7069 <div>
7070 <p>Line one
7071 </p>
7072 Line two</div>
7073
7074 !! end
7075
7076 !! test
7077 Paragraphs inside divs (extra line break on close)
7078 !! input
7079 <div>Line one
7080
7081 Line two
7082 </div>
7083 !! result
7084 <div>Line one
7085 <p>Line two
7086 </p>
7087 </div>
7088
7089 !! end
7090
7091 !! test
7092 Paragraphs inside divs (extra line break on open and close)
7093 !! input
7094 <div>
7095 Line one
7096
7097 Line two
7098 </div>
7099 !! result
7100 <div>
7101 <p>Line one
7102 </p><p>Line two
7103 </p>
7104 </div>
7105
7106 !! end
7107
7108 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7109 !! test
7110 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7111 !! options
7112 disabled
7113 !! input
7114 <blockquote>Line one
7115
7116 Line two</blockquote>
7117 !! result
7118 <blockquote>Line one
7119 Line two</blockquote>
7120
7121 !! end
7122
7123 !! test
7124 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7125 !! options
7126 disabled
7127 !! input
7128 <blockquote>
7129 Line one
7130
7131 Line two</blockquote>
7132 !! result
7133 <blockquote>
7134 <p>Line one
7135 </p>
7136 Line two</blockquote>
7137
7138 !! end
7139
7140 !! test
7141 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7142 !! options
7143 disabled
7144 !! input
7145 <blockquote>Line one
7146
7147 Line two
7148 </blockquote>
7149 !! result
7150 <blockquote>Line one
7151 <p>Line two
7152 </p>
7153 </blockquote>
7154
7155 !! end
7156
7157 !! test
7158 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7159 !! options
7160 disabled
7161 !! input
7162 <blockquote>
7163 Line one
7164
7165 Line two
7166 </blockquote>
7167 !! result
7168 <blockquote>
7169 <p>Line one
7170 </p><p>Line two
7171 </p>
7172 </blockquote>
7173
7174 !! end
7175
7176 !! test
7177 Paragraphs inside blockquotes/divs (no extra line breaks)
7178 !! input
7179 <blockquote><div>Line one
7180
7181 Line two</div></blockquote>
7182 !! result
7183 <blockquote><div>Line one
7184 Line two</div></blockquote>
7185
7186 !! end
7187
7188 !! test
7189 Paragraphs inside blockquotes/divs (extra line break on open)
7190 !! input
7191 <blockquote><div>
7192 Line one
7193
7194 Line two</div></blockquote>
7195 !! result
7196 <blockquote><div>
7197 <p>Line one
7198 </p>
7199 Line two</div></blockquote>
7200
7201 !! end
7202
7203 !! test
7204 Paragraphs inside blockquotes/divs (extra line break on close)
7205 !! input
7206 <blockquote><div>Line one
7207
7208 Line two
7209 </div></blockquote>
7210 !! result
7211 <blockquote><div>Line one
7212 <p>Line two
7213 </p>
7214 </div></blockquote>
7215
7216 !! end
7217
7218 !! test
7219 Paragraphs inside blockquotes/divs (extra line break on open and close)
7220 !! input
7221 <blockquote><div>
7222 Line one
7223
7224 Line two
7225 </div></blockquote>
7226 !! result
7227 <blockquote><div>
7228 <p>Line one
7229 </p><p>Line two
7230 </p>
7231 </div></blockquote>
7232
7233 !! end
7234
7235 !! test
7236 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
7237 !! options
7238 wgLinkHolderBatchSize=0
7239 !! input
7240 [[meatball:1]]
7241 [[meatball:2]]
7242 [[meatball:3]]
7243 !! result
7244 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
7245 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
7246 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
7247 </p>
7248 !! end
7249
7250 !! test
7251 Free external link invading image caption
7252 !! input
7253 [[Image:Foobar.jpg|thumb|http://x|hello]]
7254 !! result
7255 <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" /></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>
7256
7257 !! end
7258
7259 !! test
7260 Bug 15196: localised external link numbers
7261 !! options
7262 language=fa
7263 !! input
7264 [http://en.wikipedia.org/]
7265 !! result
7266 <p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[۱]</a>
7267 </p>
7268 !! end
7269
7270 !! test
7271 Multibyte character in padleft
7272 !! input
7273 {{padleft:-Hello|7|Æ}}
7274 !! result
7275 <p>Æ-Hello
7276 </p>
7277 !! end
7278
7279 !! test
7280 Multibyte character in padright
7281 !! input
7282 {{padright:Hello-|7|Æ}}
7283 !! result
7284 <p>Hello-Æ
7285 </p>
7286 !! end
7287
7288 !! test
7289 Formatted date
7290 !! config
7291 wgUseDynamicDates=1
7292 !! input
7293 [[2009-03-24]]
7294 !! result
7295 <p><span class="mw-formatted-date" title="2009-03-24"><a href="/index.php?title=2009&amp;action=edit&amp;redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="/index.php?title=March_24&amp;action=edit&amp;redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span>
7296 </p>
7297 !!end
7298
7299 !!test
7300 formatdate parser function
7301 !!input
7302 {{#formatdate:2009-03-24}}
7303 !! result
7304 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
7305 </p>
7306 !! end
7307
7308 !!test
7309 formatdate parser function, with default format
7310 !!input
7311 {{#formatdate:2009-03-24|mdy}}
7312 !! result
7313 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
7314 </p>
7315 !! end
7316
7317 !! test
7318 Linked date with autoformatting disabled
7319 !! config
7320 wgUseDynamicDates=false
7321 !! input
7322 [[2009-03-24]]
7323 !! result
7324 <p><a href="/index.php?title=2009-03-24&amp;action=edit&amp;redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a>
7325 </p>
7326 !! end
7327
7328 !! test
7329 Spacing of numbers in formatted dates
7330 !! input
7331 {{#formatdate:January 15}}
7332 !! result
7333 <p><span class="mw-formatted-date" title="01-15">January 15</span>
7334 </p>
7335 !! end
7336
7337 !! test
7338 Spacing of numbers in formatted dates (linked)
7339 !! config
7340 wgUseDynamicDates=true
7341 !! input
7342 [[January 15]]
7343 !! result
7344 <p><span class="mw-formatted-date" title="01-15"><a href="/index.php?title=January_15&amp;action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
7345 </p>
7346 !! end
7347
7348 !! test
7349 Leading > blockquote syntax
7350 !! input
7351 > Hi
7352 > This
7353 > Is
7354 > A
7355 > Quote
7356 !! result
7357 <blockquote><p> Hi
7358 </p><p> This
7359 </p><p> Is
7360 </p><p> A
7361 </p><p> Quote
7362 </p></blockquote>
7363
7364 !! end
7365
7366 #
7367 #
7368 #
7369
7370 #
7371 # Edit comments
7372 #
7373
7374 !! test
7375 Edit comment with link
7376 !! options
7377 comment
7378 !! input
7379 I like the [[Main Page]] a lot
7380 !! result
7381 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
7382 !!end
7383
7384 !! test
7385 Edit comment with link and link text
7386 !! options
7387 comment
7388 !! input
7389 I like the [[Main Page|best pages]] a lot
7390 !! result
7391 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7392 !!end
7393
7394 !! test
7395 Edit comment with link and link text with suffix
7396 !! options
7397 comment
7398 !! input
7399 I like the [[Main Page|best page]]s a lot
7400 !! result
7401 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7402 !!end
7403
7404 !! test
7405 Edit comment with section link (non-local, eg in history list)
7406 !! options
7407 comment title=[[Main Page]]
7408 !! input
7409 /* External links */ removed bogus entries
7410 !! result
7411 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
7412 !!end
7413
7414 !! test
7415 Edit comment with section link (local, eg in diff view)
7416 !! options
7417 comment local title=[[Main Page]]
7418 !! input
7419 /* External links */ removed bogus entries
7420 !! result
7421 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
7422 !!end
7423
7424 !! test
7425 Edit comment with subpage link (bug 14080)
7426 !! options
7427 comment
7428 subpage
7429 title=[[Subpage test]]
7430 !! input
7431 Poked at a [[/subpage]] here...
7432 !! result
7433 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
7434 !!end
7435
7436 !! test
7437 Edit comment with subpage link and link text (bug 14080)
7438 !! options
7439 comment
7440 subpage
7441 title=[[Subpage test]]
7442 !! input
7443 Poked at a [[/subpage|neat little page]] here...
7444 !! result
7445 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
7446 !!end
7447
7448 !! test
7449 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
7450 !! options
7451 comment
7452 title=[[Subpage test]]
7453 !! input
7454 Poked at a [[/subpage]] here...
7455 !! result
7456 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...
7457 !!end
7458
7459 !! test
7460 Edit comment with bare anchor link (local, as on diff)
7461 !! options
7462 comment
7463 local
7464 title=[[Main Page]]
7465 !!input
7466 [[#section]]
7467 !! result
7468 <a href="#section">#section</a>
7469 !! end
7470
7471 !! test
7472 Edit comment with bare anchor link (non-local, as on history)
7473 !! options
7474 comment
7475 title=[[Main Page]]
7476 !!input
7477 [[#section]]
7478 !! result
7479 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
7480 !! end
7481
7482 !! test
7483 Edit comment with mismatched brackets (bug 15745)
7484 !! options
7485 comment
7486 title=[[Main Page]]
7487 !!input
7488 Some text, a [[broken link|bad and a [[good link|good]]
7489 !! result
7490 Some text, a [[broken link|bad and a <a href="/index.php?title=Good_link&amp;action=edit&amp;redlink=1" class="new" title="Good link (page does not exist)">good</a>
7491 !! end
7492
7493 TODO:
7494 more images
7495 more tables
7496 math
7497 character entities
7498 and much more
7499 Try for 100% code coverage