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