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