Restore factory function to avoid gratuitously breaking extensions for no reason...
[mediawiki.git] / maintenance / parserTests.txt
blob1fb856cdb565599c84f808efbdab244750382576
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
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 #       One of the following three:
10 #       (default)       generate HTML output
11 #       pst             apply pre-save transform
12 #       msg             apply message transform
14 #       Plus any combination of these:
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 #       disabled        do not run test
24 # For testing purposes, temporary articles can created:
25 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
26 # where '/' denotes a newline.
28 # This is the standard article assumed to exist.
29 !! article
30 Main Page
31 !! text
32 blah blah
33 !! endarticle
35 ###
36 ### Basic tests
37 ###
38 !! test
39 Blank input
40 !! input
41 !! result
42 !! end
45 !! test
46 Simple paragraph
47 !! input
48 This is a simple paragraph.
49 !! result
50 <p>This is a simple paragraph.
51 </p>
52 !! end
54 !! test
55 Simple list
56 !! input
57 * Item 1
58 * Item 2
59 !! result
60 <ul><li> Item 1
61 </li><li> Item 2
62 </li></ul>
64 !! end
66 !! test
67 Italics and bold
68 !! input
69 * plain
70 * plain''italic''plain
71 * plain''italic''plain''italic''plain
72 * plain'''bold'''plain
73 * plain'''bold'''plain'''bold'''plain
74 * plain''italic''plain'''bold'''plain
75 * plain'''bold'''plain''italic''plain
76 * plain''italic'''bold-italic'''italic''plain
77 * plain'''bold''bold-italic''bold'''plain
78 * plain'''''bold-italic'''italic''plain
79 * plain'''''bold-italic''bold'''plain
80 * plain''italic'''bold-italic'''''plain
81 * plain'''bold''bold-italic'''''plain
82 * plain l'''italic''plain
83 !! result
84 <ul><li> plain
85 </li><li> plain<i>italic</i>plain
86 </li><li> plain<i>italic</i>plain<i>italic</i>plain
87 </li><li> plain<b>bold</b>plain
88 </li><li> plain<b>bold</b>plain<b>bold</b>plain
89 </li><li> plain<i>italic</i>plain<b>bold</b>plain
90 </li><li> plain<b>bold</b>plain<i>italic</i>plain
91 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
92 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
93 </li><li> plain<i><b>bold-italic</b>italic</i>plain
94 </li><li> plain<b><i>bold-italic</i>bold</b>plain
95 </li><li> plain<i>italic<b>bold-italic</b></i>plain
96 </li><li> plain<b>bold<i>bold-italic</i></b>plain
97 </li><li> plain l'<i>italic</i>plain
98 </li></ul>
100 !! end
103 ### <nowiki> test cases
106 !! test
107 <nowiki> unordered list
108 !! input
109 <nowiki>* This is not an unordered list item.</nowiki>
110 !! result
111 <p>* This is not an unordered list item.
112 </p>
113 !! end
115 !! test
116 <nowiki> spacing
117 !! input
118 <nowiki>Lorem ipsum dolor
120 sed abit.
121   sed nullum.
123 :and a colon
124 </nowiki>
125 !! result
126 <p>Lorem ipsum dolor
128 sed abit.
129   sed nullum.
131 :and a colon
133 </p>
134 !! end
136 !! test
137 nowiki 3
138 !! input
139 :There is not nowiki.
140 :There is <nowiki>nowiki</nowiki>.
142 #There is not nowiki.
143 #There is <nowiki>nowiki</nowiki>.
145 *There is not nowiki.
146 *There is <nowiki>nowiki</nowiki>.
147 !! result
148 <dl><dd>There is not nowiki.
149 </dd><dd>There is nowiki.
150 </dd></dl>
151 <ol><li>There is not nowiki.
152 </li><li>There is nowiki.
153 </li></ol>
154 <ul><li>There is not nowiki.
155 </li><li>There is nowiki.
156 </li></ul>
158 !! end
162 ### Comments
164 !! test
165 Comment test 1
166 !! input
167 <!-- comment 1 --> asdf
168 <!-- comment 2 -->
169 !! result
170 <pre>asdf
171 </pre>
173 !! end
175 !! test
176 Comment test 2
177 !! input
178 asdf
179 <!-- comment 1 -->
181 !! result
182 <p>asdf
184 </p>
185 !! end
187 !! test
188 Comment test 3
189 !! input
190 asdf
191 <!-- comment 1 -->
192 <!-- comment 2 -->
194 !! result
195 <p>asdf
197 </p>
198 !! end
200 !! test
201 Comment test 4
202 !! input
203 asdf<!-- comment 1 -->jkl
204 !! result
205 <p>asdfjkl
206 </p>
207 !! end
209 !! test
210 Comment spacing
211 !! input
213  <!-- foo --> b <!-- bar -->
215 !! result
216 <p>a
217 </p>
218 <pre> b 
219 </pre>
220 <p>c
221 </p>
222 !! end
224 !! test
225 Comment whitespace
226 !! input
227 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
228 !! result
230 !! end
232 !! test
233 Comment semantics and delimiters
234 !! input
235 <!-- --><!----><!-----><!------>
236 !! result
238 !! end
240 !! test
241 Comment semantics and delimiters, redux
242 !! input
243 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
244 -- foo -- funky huh? ... -->
245 !! result
247 !! end
249 !! test
250 Comment semantics and delimiters: directors cut
251 !! input
252 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
253 everything starting with < followed by !-- until the first -- and > we see,
254 that wouldn't be valid XML however, since in XML -- has to terminate a comment
255 -->-->
256 !! result
257 <p>-->
258 </p>
259 !! end
261 !! test
262 Comment semantics: nesting
263 !! input
264 <!--<!-- no, we're not going to do anything fancy here -->-->
265 !! result
266 <p>-->
267 </p>
268 !! end
270 !! test
271 Comment semantics: unclosed comment at end
272 !! input
273 <!--This comment will run out to the end of the document
274 !! result
276 !! end
280 ### Preformatted text
282 !! test
283 Preformatted text
284 !! input
285  This is some
286  Preformatted text
287  With ''italic''
288  And '''bold'''
289  And a [[Main Page|link]]
290 !! result
291 <pre>This is some
292 Preformatted text
293 With <i>italic</i>
294 And <b>bold</b>
295 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
296 </pre>
297 !! end
299 !! test
300 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
301 !! input
302 <pre><nowiki>
304 <cite>
305 <em>
306 </nowiki></pre>
307 !! result
308 <pre>
309 &lt;b&gt;
310 &lt;cite&gt;
311 &lt;em&gt;
312 </pre>
314 !! end
316 !! test
317 Regression with preformatted in <center>
318 !! input
319 <center>
320  Blah
321 </center>
322 !! result
323 <center>
324 <pre>Blah
325 </pre>
326 </center>
328 !! end
330 !! test
331 <pre> with attributes (bug 3202)
332 !! input
333 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
334 !! result
335 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
337 !! end
339 !! test
340 <pre> with width attribute (bug 3202)
341 !! input
342 <pre width="8">Narrow screen goodies</pre>
343 !! result
344 <pre width="8">Narrow screen goodies</pre>
346 !! end
348 !! test
349 <pre> with forbidden attribute (bug 3202)
350 !! input
351 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
352 !! result
353 <pre width="8">Narrow screen goodies</pre>
355 !! end
357 !! test
358 <pre> with forbidden attribute values (bug 3202)
359 !! input
360 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
361 !! result
362 <pre width="8">Narrow screen goodies</pre>
364 !! end
367 ### Definition lists
369 !! test
370 Simple definition
371 !! input
372 ; name : Definition
373 !! result
374 <dl><dt> name&nbsp;</dt><dd> Definition
375 </dd></dl>
377 !! end
379 !! test
380 Simple definition
381 !! input
382 : Indented text
383 !! result
384 <dl><dd> Indented text
385 </dd></dl>
387 !! end
389 !! test
390 Definition list with no space
391 !! input
392 ;name:Definition
393 !! result
394 <dl><dt>name</dt><dd>Definition
395 </dd></dl>
397 !!end
399 !! test
400 Definition list with URL link
401 !! input
402 ; http://example.com/ : definition
403 !! result
404 <dl><dt> <a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
405 </dd></dl>
407 !! end
409 !! test
410 Definition list with bracketed URL link
411 !! input
412 ;[http://www.example.com/ Example]:Something about it
413 !! result
414 <dl><dt><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">Example</a></dt><dd>Something about it
415 </dd></dl>
417 !! end
419 !! test
420 Definition list with wikilink containing colon
421 !! input
422 ; [[Help:FAQ]]: The least-read page on Wikipedia
423 !! result
424 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit" class="new" title="Help:FAQ">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
425 </dd></dl>
427 !! end
429 # At Brion's and JeLuF's insistence... :)
430 !! test
431 Definition list with wikilink containing colon
432 !! input
433 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
434 !! result
435 <dl><dt>  <a href="news:alt.wikipedia.rox" class="external free" title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
436 </dd></dl>
438 !! end
440 !! test
441 Malformed definition list with colon
442 !! input
443 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
444 !! result
445 <dl><dt>  <a href="news:alt.wikipedia.rox" class="external free" title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
446 </dt></dl>
448 !! end
450 !! test
451 Definition lists: colon in external link text
452 !! input
453 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
454 !! result
455 <dl><dt> <a href="http://www.wikipedia2.org/" class="external text" title="http://www.wikipedia2.org/" rel="nofollow">Wikipedia&nbsp;: The Next Generation</a></dt><dd> OK, I made that up
456 </dd></dl>
458 !! end
460 !! test
461 Definition lists: colon in HTML attribute
462 !! input
463 ;<b style="display: inline">bold</b>
464 !! result
465 <dl><dt><b style="display: inline">bold</b>
466 </dt></dl>
468 !! end
471 !! test
472 Definition lists: self-closed tag
473 !! input
474 ;one<br/>two : two-line fun
475 !! result
476 <dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
477 </dd></dl>
479 !! end
483 ### External links
485 !! test
486 External links: non-bracketed
487 !! input
488 Non-bracketed: http://example.com
489 !! result
490 <p>Non-bracketed: <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>
491 </p>
492 !! end
494 !! test
495 External links: numbered
496 !! input
497 Numbered: [http://example.com]
498 Numbered: [http://example.net]
499 Numbered: [http://example.org]
500 !! result
501 <p>Numbered: <a href="http://example.com" class="external autonumber" title="http://example.com" rel="nofollow">[1]</a>
502 Numbered: <a href="http://example.net" class="external autonumber" title="http://example.net" rel="nofollow">[2]</a>
503 Numbered: <a href="http://example.org" class="external autonumber" title="http://example.org" rel="nofollow">[3]</a>
504 </p>
505 !!end
507 !! test
508 External links: specified text
509 !! input
510 Specified text: [http://example.com link]
511 !! result
512 <p>Specified text: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow">link</a>
513 </p>
514 !!end
516 !! test
517 External links: trail
518 !! input
519 Linktrails should not work for external links: [http://example.com link]s
520 !! result
521 <p>Linktrails should not work for external links: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow">link</a>s
522 </p>
523 !! end
525 !! test
526 External links: dollar sign in URL
527 !! input
528 http://example.com/1$2345
529 !! result
530 <p><a href="http://example.com/1$2345" class="external free" title="http://example.com/1$2345" rel="nofollow">http://example.com/1$2345</a>
531 </p>
532 !! end
534 !! test
535 External links: dollar sign in URL (named)
536 !! input
537 [http://example.com/1$2345]
538 !! result
539 <p><a href="http://example.com/1$2345" class="external autonumber" title="http://example.com/1$2345" rel="nofollow">[1]</a>
540 </p>
541 !!end
543 !! test
544 External links: open square bracket forbidden in URL (bug 4377)
545 !! input
546 http://example.com/1[2345
547 !! result
548 <p><a href="http://example.com/1" class="external free" title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
549 </p>
550 !! end
552 !! test
553 External links: open square bracket forbidden in URL (named) (bug 4377)
554 !! input
555 [http://example.com/1[2345]
556 !! result
557 <p><a href="http://example.com/1" class="external text" title="http://example.com/1" rel="nofollow">[2345</a>
558 </p>
559 !!end
561 !! test
562 External links: nowiki in URL link text (bug 6230)
563 !!input
564 [http://example.com/ <nowiki>''example site''</nowiki>]
565 !! result
566 <p><a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow">''example site''</a>
567 </p>
568 !! end
570 !! test
571 External links: newline forbidden in text (bug 6230 regression check)
572 !! input
573 [http://example.com/ first
574 second]
575 !! result
576 <p>[<a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a> first
577 second]
578 </p>
579 !!end
581 !! test
582 External image
583 !! input
584 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
585 !! result
586 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
587 </p>
588 !! end
590 !! test
591 External image from https
592 !! input
593 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
594 !! result
595 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
596 </p>
597 !! end
599 !! test
600 Link to non-http image, no img tag
601 !! input
602 Link to non-http image, no img tag: ftp://example.com/test.jpg
603 !! result
604 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class="external free" title="ftp://example.com/test.jpg" rel="nofollow">ftp://example.com/test.jpg</a>
605 </p>
606 !! end
608 !! test
609 External links: terminating separator
610 !! input
611 Terminating separator: http://example.com/thing,
612 !! result
613 <p>Terminating separator: <a href="http://example.com/thing" class="external free" title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
614 </p>
615 !! end
617 !! test
618 External links: intervening separator
619 !! input
620 Intervening separator: http://example.com/1,2,3
621 !! result
622 <p>Intervening separator: <a href="http://example.com/1,2,3" class="external free" title="http://example.com/1,2,3" rel="nofollow">http://example.com/1,2,3</a>
623 </p>
624 !! end
626 !! test
627 External links: old bug with URL in query
628 !! input
629 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
630 !! result
631 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class="external text" title="http://example.com/thing?url=http://example.com" rel="nofollow">link</a>
632 </p>
633 !! end
635 !! test
636 External links: old URL-in-URL bug, mixed protocols
637 !! input
638 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
639 !! result
640 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class="external text" title="ftp://example.com?url=http://example.com" rel="nofollow">link</a>
641 </p>
642 !!end
644 !! test
645 External links: URL in text
646 !! input
647 URL in text: [http://example.com http://example.com]
648 !! result
649 <p>URL in text: <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>
650 </p>
651 !! end
653 !! test
654 External links: Clickable images
655 !! input
656 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
657 !! result
658 <p>ja-style clickable images: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
659 </p>
660 !!end
662 !! test
663 External links: raw ampersand
664 !! input
665 Old &amp; use: http://x&y
666 !! result
667 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
668 </p>
669 !! end
671 !! test
672 External links: encoded ampersand
673 !! input
674 Old &amp; use: http://x&amp;y
675 !! result
676 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
677 </p>
678 !! end
680 !! test
681 External links: encoded equals (bug 6102)
682 !! input
683 http://example.com/?foo&#61;bar
684 !! result
685 <p><a href="http://example.com/?foo=bar" class="external free" title="http://example.com/?foo=bar" rel="nofollow">http://example.com/?foo=bar</a>
686 </p>
687 !! end
689 !! test
690 External links: [raw ampersand]
691 !! input
692 Old &amp; use: [http://x&y]
693 !! result
694 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" title="http://x&amp;y" rel="nofollow">[1]</a>
695 </p>
696 !! end
698 !! test
699 External links: [encoded ampersand]
700 !! input
701 Old &amp; use: [http://x&amp;y]
702 !! result
703 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" title="http://x&amp;y" rel="nofollow">[1]</a>
704 </p>
705 !! end
707 !! test
708 External links: [encoded equals] (bug 6102)
709 !! input
710 [http://example.com/?foo&#61;bar]
711 !! result
712 <p><a href="http://example.com/?foo=bar" class="external autonumber" title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
713 </p>
714 !! end
716 !! test
717 External links: [IDN ignored character reference in hostname; strip it right off]
718 !! input
719 [http://e&zwnj;xample.com/]
720 !! result
721 <p><a href="http://example.com/" class="external autonumber" title="http://example.com/" rel="nofollow">[1]</a>
722 </p>
723 !! end
725 !! test
726 External links: IDN ignored character reference in hostname; strip it right off
727 !! input
728 http://e&zwnj;xample.com/
729 !! result
730 <p><a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a>
731 </p>
732 !! end
734 !! test
735 External links: www.jpeg.org (bug 554)
736 !! input
737 http://www.jpeg.org
738 !!result
739 <p><a href="http://www.jpeg.org" class="external free" title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
740 </p>
741 !! end
743 !! test
744 External links: URL within URL (original bug 2)
745 !! input
746 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
747 !! result
748 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class="external autonumber" title="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" rel="nofollow">[1]</a>
749 </p>
750 !! end
752 !! test
753 BUG 361: URL inside bracketed URL
754 !! input
755 [http://www.example.com/foo http://www.example.com/bar]
756 !! result
757 <p><a href="http://www.example.com/foo" class="external text" title="http://www.example.com/foo" rel="nofollow">http://www.example.com/bar</a>
758 </p>
759 !! end
761 !! test
762 BUG 361: URL within URL, not bracketed
763 !! input
764 http://www.example.com/foo?=http://www.example.com/bar
765 !! result
766 <p><a href="http://www.example.com/foo?=http://www.example.com/bar" class="external free" title="http://www.example.com/foo?=http://www.example.com/bar" rel="nofollow">http://www.example.com/foo?=http://www.example.com/bar</a>
767 </p>
768 !! end
770 !! test
771 BUG 289: ">"-token in URL-tail
772 !! input
773 http://www.example.com/<hello>
774 !! result
775 <p><a href="http://www.example.com/" class="external free" title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>&lt;hello&gt;
776 </p>
777 !!end
779 !! test
780 BUG 289: literal ">"-token in URL-tail
781 !! input
782 http://www.example.com/<b>html</b>
783 !! result
784 <p><a href="http://www.example.com/" class="external free" title="http://www.example.com/" rel="nofollow">http://www.example.com/</a><b>html</b>
785 </p>
786 !!end
788 !! test
789 BUG 289: ">"-token in bracketed URL
790 !! input
791 [http://www.example.com/<hello> stuff]
792 !! result
793 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
794 </p>
795 !!end
797 !! test
798 BUG 289: literal ">"-token in bracketed URL
799 !! input
800 [http://www.example.com/<b>html</b> stuff]
801 !! result
802 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
803 </p>
804 !!end
806 !! test
807 BUG 289: literal double quote at end of URL
808 !! input
809 http://www.example.com/"hello"
810 !! result
811 <p><a href="http://www.example.com/" class="external free" title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
812 </p>
813 !!end
815 !! test
816 BUG 289: literal double quote in bracketed URL
817 !! input
818 [http://www.example.com/"hello" stuff]
819 !! result
820 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
821 </p>
822 !!end
824 !! test
825 External links: invalid character
826 Fixme: the missing char seems to have gone missing
827 !! options
828 disabled
829 !! input
830 [http://www.example.com  test]
831 !! result
832 <p>[<a href="http://www.example.com" class="external free" title="http://www.example.com" rel="nofollow">http://www.example.com</a>  test]
833 </p>
834 !! end
836 !! test
837 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
838 !! input
839 [http://www.example.com  test]
840 !! result
841 <p><a href="http://www.example.com" class="external text" title="http://www.example.com" rel="nofollow">test</a>
842 </p>
843 !! end
845 !! test
846 External links: wiki links within external link (Bug 3695)
847 !! input
848 [http://example.com [[wikilink]] embedded in ext link]
849 !! result
850 <p><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"></a><a href="/index.php?title=Wikilink&amp;action=edit" class="new" title="Wikilink">wikilink</a><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"> embedded in ext link</a>
851 </p>
852 !! end
854 !! test
855 BUG 787: Links with one slash after the url protocol are invalid
856 !! input
857 http:/example.com
859 [http:/example.com title]
860 !! result
861 <p>http:/example.com
862 </p><p>[http:/example.com title]
863 </p>
864 !! end
866 !! test
867 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
868 !! input
869 ''[http://example.com text'']
870 [http://example.com '''text]'''
871 ''Something [http://example.com in italic'']
872 ''Something [http://example.com mixed''''', even bold]'''
873 '''''Now [http://example.com both''''']
874 !! result
875 <p><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>text</i></a>
876 <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><b>text</b></a>
877 <i>Something </i><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>in italic</i></a>
878 <i>Something </i><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>mixed</i><b>, even bold</b></a>
879 <i><b>Now </b></i><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i><b>both</b></i></a>
880 </p>
881 !! end
884 !! test
885 Bug 4781: %26 in URL
886 !! input
887 http://www.example.com/?title=AT%26T
888 !! result
889 <p><a href="http://www.example.com/?title=AT%26T" class="external free" title="http://www.example.com/?title=AT%26T" rel="nofollow">http://www.example.com/?title=AT%26T</a>
890 </p>
891 !! end
893 !! test
894 Bug 4781, 5267: %26 in URL
895 !! input
896 http://www.example.com/?title=100%25_Bran
897 !! result
898 <p><a href="http://www.example.com/?title=100%25_Bran" class="external free" title="http://www.example.com/?title=100%25_Bran" rel="nofollow">http://www.example.com/?title=100%25_Bran</a>
899 </p>
900 !! end
902 !! test
903 Bug 4781, 5267: %28, %29 in URL
904 !! input
905 http://www.example.com/?title=Ben-Hur_%281959_film%29
906 !! result
907 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external free" title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
908 </p>
909 !! end
912 !! test
913 Bug 4781: %26 in autonumber URL
914 !! input
915 [http://www.example.com/?title=AT%26T]
916 !! result
917 <p><a href="http://www.example.com/?title=AT%26T" class="external autonumber" title="http://www.example.com/?title=AT%26T" rel="nofollow">[1]</a>
918 </p>
919 !! end
921 !! test
922 Bug 4781, 5267: %26 in autonumber URL
923 !! input
924 [http://www.example.com/?title=100%25_Bran]
925 !! result
926 <p><a href="http://www.example.com/?title=100%25_Bran" class="external autonumber" title="http://www.example.com/?title=100%25_Bran" rel="nofollow">[1]</a>
927 </p>
928 !! end
930 !! test
931 Bug 4781, 5267: %28, %29 in autonumber URL
932 !! input
933 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
934 !! result
935 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external autonumber" title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">[1]</a>
936 </p>
937 !! end
940 !! test
941 Bug 4781: %26 in bracketed URL
942 !! input
943 [http://www.example.com/?title=AT%26T link]
944 !! result
945 <p><a href="http://www.example.com/?title=AT%26T" class="external text" title="http://www.example.com/?title=AT%26T" rel="nofollow">link</a>
946 </p>
947 !! end
949 !! test
950 Bug 4781, 5267: %26 in bracketed URL
951 !! input
952 [http://www.example.com/?title=100%25_Bran link]
953 !! result
954 <p><a href="http://www.example.com/?title=100%25_Bran" class="external text" title="http://www.example.com/?title=100%25_Bran" rel="nofollow">link</a>
955 </p>
956 !! end
958 !! test
959 Bug 4781, 5267: %28, %29 in bracketed URL
960 !! input
961 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
962 !! result
963 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external text" title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">link</a>
964 </p>
965 !! end
967 !! test
968 External link containing double-single-quotes in text '' (bug 4598 sanity check)
969 !! input
970 Some [http://example.com/ pretty ''italics'' and stuff]!
971 !! result
972 <p>Some <a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow">pretty <i>italics</i> and stuff</a>!
973 </p>
974 !! end
976 !! test
977 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
978 !! input
979 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
980 !! result
981 <p><i>Some </i><a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
982 </p>
983 !! end
988 ### Quotes
991 !! test
992 Quotes
993 !! input
994 Normal text. '''Bold text.''' Normal text. ''Italic text.''
996 Normal text. '''''Bold italic text.''''' Normal text.
997 !!result
998 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
999 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1000 </p>
1001 !! end
1004 !! test
1005 Unclosed and unmatched quotes
1006 !! input
1007 '''''Bold italic text '''with bold deactivated''' in between.'''''
1009 '''''Bold italic text ''with italic deactivated'' in between.'''''
1011 '''Bold text..
1013 ..spanning two paragraphs (should not work).'''
1015 '''Bold tag left open
1017 ''Italic tag left open
1019 Normal text.
1021 <!-- Unmatching number of opening, closing tags: -->
1022 '''This year''''s election ''should'' beat '''last year''''s.
1024 ''Tom'''s car is bigger than ''Susan'''s.
1025 !! result
1026 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1027 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1028 </p><p><b>Bold text..</b>
1029 </p><p>..spanning two paragraphs (should not work).
1030 </p><p><b>Bold tag left open</b>
1031 </p><p><i>Italic tag left open</i>
1032 </p><p>Normal text.
1033 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1034 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1035 </p>
1036 !! end
1039 ### Tables
1041 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1044 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1045 # is the bare minimun required by the spec, see:
1046 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1047 !! test
1048 A table with no data.
1049 !! input
1050 {||}
1051 !! result
1052 !! end
1054 # A table with nothing but a caption is invalid XHTML, we might want to render
1055 # this as <p>caption</p>
1056 !! test
1057 A table with nothing but a caption
1058 !! input 
1060 |+ caption
1062 !! result
1063 <table>
1064 <caption> caption
1065 </caption><tr><td></td></tr></table>
1067 !! end
1069 !! test
1070 Simple table
1071 !! input
1072 {| 
1073 | 1 || 2
1074 |- 
1075 | 3 || 4
1077 !! result
1078 <table>
1079 <tr>
1080 <td> 1 </td><td> 2
1081 </td></tr>
1082 <tr>
1083 <td> 3 </td><td> 4
1084 </td></tr></table>
1086 !! end
1088 !! test
1089 Multiplication table
1090 !! input
1091 {| border="1" cellpadding="2"
1092 |+Multiplication table
1094 ! &times; !! 1 !! 2 !! 3
1096 ! 1
1097 | 1 || 2 || 3
1099 ! 2
1100 | 2 || 4 || 6
1102 ! 3
1103 | 3 || 6 || 9
1105 ! 4
1106 | 4 || 8 || 12
1108 ! 5
1109 | 5 || 10 || 15
1111 !! result
1112 <table border="1" cellpadding="2">
1113 <caption>Multiplication table
1114 </caption>
1115 <tr>
1116 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1117 </th></tr>
1118 <tr>
1119 <th> 1
1120 </th><td> 1 </td><td> 2 </td><td> 3
1121 </td></tr>
1122 <tr>
1123 <th> 2
1124 </th><td> 2 </td><td> 4 </td><td> 6
1125 </td></tr>
1126 <tr>
1127 <th> 3
1128 </th><td> 3 </td><td> 6 </td><td> 9
1129 </td></tr>
1130 <tr>
1131 <th> 4
1132 </th><td> 4 </td><td> 8 </td><td> 12
1133 </td></tr>
1134 <tr>
1135 <th> 5
1136 </th><td> 5 </td><td> 10 </td><td> 15
1137 </td></tr></table>
1139 !! end
1141 !! test
1142 Table rowspan
1143 !! input
1144 {| align=right border=1
1145 | Cell 1, row 1 
1146 |rowspan=2| Cell 2, row 1 (and 2) 
1147 | Cell 3, row 1 
1148 |- 
1149 | Cell 1, row 2 
1150 | Cell 3, row 2 
1152 !! result
1153 <table align="right" border="1">
1154 <tr>
1155 <td> Cell 1, row 1
1156 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1157 </td><td> Cell 3, row 1
1158 </td></tr>
1159 <tr>
1160 <td> Cell 1, row 2
1161 </td><td> Cell 3, row 2
1162 </td></tr></table>
1164 !! end
1166 !! test
1167 Nested table
1168 !! input
1169 {| border=1
1170 | &alpha;
1172 {| bgcolor=#ABCDEF border=2
1173 |nested
1175 |table
1177 |the original table again
1179 !! result
1180 <table border="1">
1181 <tr>
1182 <td> &alpha;
1183 </td><td>
1184 <table bgcolor="#ABCDEF" border="2">
1185 <tr>
1186 <td>nested
1187 </td></tr>
1188 <tr>
1189 <td>table
1190 </td></tr></table>
1191 </td><td>the original table again
1192 </td></tr></table>
1194 !! end
1196 !! test
1197 Invalid attributes in table cell (bug 1830)
1198 !! input
1200 |Cell:|broken
1202 !! result
1203 <table>
1204 <tr>
1205 <td>broken
1206 </td></tr></table>
1208 !! end
1211 # FIXME: this one has incorrect tag nesting still.
1212 !! test
1213 Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)
1214 !! input
1216 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1217 !! result
1218 <table>
1219 <tr>
1220 <td><a href="ftp://|x||" class="external autonumber" title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
1221 </td>
1222 </tr>
1223 </table>
1225 !! end
1229 ### Internal links
1231 !! test
1232 Plain link, capitalized
1233 !! input
1234 [[Main Page]]
1235 !! result
1236 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1237 </p>
1238 !! end
1240 !! test
1241 Plain link, uncapitalized
1242 !! input
1243 [[main Page]]
1244 !! result
1245 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1246 </p>
1247 !! end
1249 !! test
1250 Piped link
1251 !! input
1252 [[Main Page|The Main Page]]
1253 !! result
1254 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1255 </p>
1256 !! end
1258 !! test
1259 Broken link
1260 !! input
1261 [[Zigzagzogzagzig]]
1262 !! result
1263 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
1264 </p>
1265 !! end
1267 !! test
1268 Link with prefix
1269 !! input
1270 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1271 !! result
1272 <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>
1273 </p>
1274 !! end
1276 !! test
1277 Link with suffix
1278 !! input
1279 [[Main Page]]xxx, [[Main Page]]XXX
1280 !! result
1281 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
1282 </p>
1283 !! end
1285 !! test
1286 Link with 3 brackets
1287 !! input
1288 [[[main page]]]
1289 !! result
1290 <p>[[[main page]]]
1291 </p>
1292 !! end
1294 !! test
1295 Piped link with 3 brackets
1296 !! input
1297 [[[main page|the main page]]]
1298 !! result
1299 <p>[[[main page|the main page]]]
1300 </p>
1301 !! end
1303 !! test
1304 Link with multiple pipes
1305 !! input
1306 [[Main Page|The|Main|Page]]
1307 !! result
1308 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1309 </p>
1310 !! end
1312 !! test
1313 Link to namespaces
1314 !! input
1315 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1316 !! result
1317 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit" class="new" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">Meta:Disclaimers</a>
1318 </p>
1319 !! end
1321 !! test
1322 Piped link to namespace
1323 !! input
1324 [[Meta:Disclaimers|The disclaimers]]
1325 !! result
1326 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
1327 </p>
1328 !! end
1330 !! test
1331 Link containing }
1332 !! input
1333 [[Usually caused by a typo (oops}]]
1334 !! result
1335 <p>[[Usually caused by a typo (oops}]]
1336 </p>
1337 !! end
1339 !! test
1340 Link containing % (not as a hex sequence)
1341 !! input
1342 [[7% Solution]]
1343 !! result
1344 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1345 </p>
1346 !! end
1348 !! test
1349 Link containing % as a single hex sequence interpreted to char
1350 !! input
1351 [[7%25 Solution]]
1352 !! result
1353 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1354 </p>
1355 !!end
1357 !! test
1358 Link containing % as a double hex sequence interpreted to hex sequence
1359 !! input
1360 [[7%2525 Solution]]
1361 !! result
1362 <p>[[7%2525 Solution]]
1363 </p>
1364 !!end
1366 !! test
1367 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1368 Example for such a section: == < ==
1369 !! input
1370 [[%23%3c]][[%23%3e]]
1371 !! result
1372 <p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
1373 </p>
1374 !! end
1376 !! test
1377 Link containing "<#" and ">#" as a hex sequences
1378 !! input
1379 [[%3c%23]][[%3e%23]]
1380 !! result
1381 <p>[[%3c%23]][[%3e%23]]
1382 </p>
1383 !! end
1385 !! test
1386 Link containing double-single-quotes '' (bug 4598)
1387 !! input
1388 [[Lista d''e paise d''o munno]]
1389 !! result
1390 <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>
1391 </p>
1392 !! end
1394 !! test
1395 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1396 !! input
1397 Some [[Link|pretty ''italics'' and stuff]]!
1398 !! result
1399 <p>Some <a href="/index.php?title=Link&amp;action=edit" class="new" title="Link">pretty <i>italics</i> and stuff</a>!
1400 </p>
1401 !! end
1403 !! test
1404 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1405 !! input
1406 ''Some [[Link|pretty ''italics'' and stuff]]!
1407 !! result
1408 <p><i>Some </i><a href="/index.php?title=Link&amp;action=edit" class="new" title="Link"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1409 </p>
1410 !! end
1412 !! test
1413 Plain link to URL
1414 !! input
1415 [[http://www.example.org]]
1416 !! result
1417 <p>[<a href="http://www.example.org" class="external autonumber" title="http://www.example.org" rel="nofollow">[1]</a>]
1418 </p>
1419 !! end
1421 # I'm fairly sure the expected result here is wrong.
1422 # We want these to be URL links, not pseudo-pages with URLs for titles....
1423 # However the current output is also pretty screwy.
1425 # ----
1426 # I'm changing it to match the current output--it arguably makes more
1427 # sense in the light of the test above. Old expected result was:
1428 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.org&amp;action=edit" class="new" title="Http://www.example.org">an example URL</a>
1429 #</p>
1430 # But I think this test is bordering on "garbage in, garbage out" anyway.
1431 # -- wtm
1432 !! test
1433 Piped link to URL
1434 !! input
1435 Piped link to URL: [[http://www.example.org|an example URL]]
1436 !! result
1437 <p>Piped link to URL: [<a href="http://www.example.org|an" class="external text" title="http://www.example.org|an" rel="nofollow">example URL</a>]
1438 </p>
1439 !! end
1441 !! test
1442 BUG 2: [[page|http://url/]] should link to page, not http://url/
1443 !! input
1444 [[Main Page|http://url/]]
1445 !! result
1446 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1447 </p>
1448 !! end
1450 !! test
1451 BUG 337: Escaped self-links should be bold
1452 !! options
1453 title=[[Bug462]]
1454 !! input
1455 [[Bu&#103;462]] [[Bug462]]
1456 !! result
1457 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1458 </p>
1459 !! end
1461 !! test
1462 Self-link to section should not be bold
1463 !! options
1464 title=[[Main Page]]
1465 !! input
1466 [[Main Page#section]]
1467 !! result
1468 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1469 </p>
1470 !! end
1472 !! test
1473 <nowiki> inside a link
1474 !! input
1475 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1476 !! result
1477 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1478 </p>
1479 !! end
1482 ### Interwiki links (see maintenance/interwiki.sql)
1485 !! test
1486 Inline interwiki link
1487 !! input
1488 [[MeatBall:SoftSecurity]]
1489 !! result
1490 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1491 </p>
1492 !! end
1494 !! test
1495 Inline interwiki link with empty title (bug 2372)
1496 !! input
1497 [[MeatBall:]]
1498 !! result
1499 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
1500 </p>
1501 !! end
1503 !! test
1504 Interwiki link encoding conversion (bug 1636)
1505 !! input
1506 *[[Wikipedia:ro:Olteni&#0355;a]]
1507 *[[Wikipedia:ro:Olteni&#355;a]]
1508 !! result
1509 <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>
1510 </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>
1511 </li></ul>
1513 !! end
1515 !! test
1516 Interwiki link with fragment (bug 2130)
1517 !! input
1518 [[MeatBall:SoftSecurity#foo]]
1519 !! result
1520 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1521 </p>
1522 !! end
1525 ## XHTML tidiness
1528 !! test
1529 <br> to <br />
1530 !! input
1531 1<br>2<br />3
1532 !! result
1533 <p>1<br />2<br />3
1534 </p>
1535 !! end
1537 !! test
1538 Incorrecly removing closing slashes from correctly formed XHTML
1539 !! input
1540 <br style="clear:both;" />
1541 !! result
1542 <p><br style="clear:both;" />
1543 </p>
1544 !! end
1546 !! test 
1547 Failing to transform badly formed HTML into correct XHTML
1548 !! input
1549 <br clear=left>
1550 <br clear=right>
1551 <br clear=all>
1552 !! result
1553 <p><br clear="left" />
1554 <br clear="right" />
1555 <br clear="all" />
1556 </p>
1557 !!end
1559 !! test 
1560 Horizontal ruler (should it add that extra space?)
1561 !! input 
1562 <hr>
1563 <hr >
1564 foo <hr
1565 > bar
1566 !! result 
1567 <hr />
1568 <hr />
1569 foo <hr /> bar
1571 !! end
1574 ### Block-level elements
1576 !! test
1577 Common list
1578 !! input
1579 *Common list
1580 * item 2
1581 *item 3
1582 !! result
1583 <ul><li>Common list
1584 </li><li> item 2
1585 </li><li>item 3
1586 </li></ul>
1588 !! end
1590 !! test
1591 Numbered list
1592 !! input
1593 #Numbered list
1594 #item 2
1595 # item 3
1596 !! result
1597 <ol><li>Numbered list
1598 </li><li>item 2
1599 </li><li> item 3
1600 </li></ol>
1602 !! end
1604 !! test
1605 Mixed list
1606 !! input
1607 *Mixed list
1608 *# with numbers
1609 ** and bullets
1610 *# and numbers
1611 *bullets again
1612 **bullet level 2
1613 ***bullet level 3
1614 ***#Number on level 4
1615 **bullet level 2
1616 **#Number on level 3
1617 **#Number on level 3
1618 *#number level 2
1619 *Level 1
1620 !! result
1621 <ul><li>Mixed list
1622 <ol><li> with numbers
1623 </li></ol>
1624 <ul><li> and bullets
1625 </li></ul>
1626 <ol><li> and numbers
1627 </li></ol>
1628 </li><li>bullets again
1629 <ul><li>bullet level 2
1630 <ul><li>bullet level 3
1631 <ol><li>Number on level 4
1632 </li></ol>
1633 </li></ul>
1634 </li><li>bullet level 2
1635 <ol><li>Number on level 3
1636 </li><li>Number on level 3
1637 </li></ol>
1638 </li></ul>
1639 <ol><li>number level 2
1640 </li></ol>
1641 </li><li>Level 1
1642 </li></ul>
1644 !! end
1646 !! test
1647 List items are not parsed correctly following a <pre> block (bug 785)
1648 !! input
1649 * <pre>foo</pre>
1650 * <pre>bar</pre>
1651 * zar
1652 !! result
1653 <ul><li> <pre>foo</pre>
1654 </li><li> <pre>bar</pre>
1655 </li><li> zar
1656 </li></ul>
1658 !! end
1661 ### Magic Words
1664 !! test
1665 Magic Word: {{CURRENTDAY}}
1666 !! input
1667 {{CURRENTDAY}}
1668 !! result
1669 <p>1
1670 </p>
1671 !! end
1673 !! test
1674 Magic Word: {{CURRENTDAY2}}
1675 !! input
1676 {{CURRENTDAY2}}
1677 !! result
1678 <p>01
1679 </p>
1680 !! end
1682 !! test
1683 Magic Word: {{CURRENTDAYNAME}}
1684 !! input
1685 {{CURRENTDAYNAME}}
1686 !! result
1687 <p>Thursday
1688 </p>
1689 !! end
1691 !! test
1692 Magic Word: {{CURRENTDOW}}
1693 !! input
1694 {{CURRENTDOW}}
1695 !! result
1696 <p>4
1697 </p>
1698 !! end
1700 !! test
1701 Magic Word: {{CURRENTMONTH}}
1702 !! input
1703 {{CURRENTMONTH}}
1704 !! result
1705 <p>01
1706 </p>
1707 !! end
1709 !! test
1710 Magic Word: {{CURRENTMONTHABBREV}}
1711 !! input
1712 {{CURRENTMONTHABBREV}}
1713 !! result
1714 <p>Jan
1715 </p>
1716 !! end
1718 !! test
1719 Magic Word: {{CURRENTMONTHNAME}}
1720 !! input
1721 {{CURRENTMONTHNAME}}
1722 !! result
1723 <p>January
1724 </p>
1725 !! end
1727 !! test
1728 Magic Word: {{CURRENTMONTHNAMEGEN}}
1729 !! input
1730 {{CURRENTMONTHNAMEGEN}}
1731 !! result
1732 <p>January
1733 </p>
1734 !! end
1736 !! test
1737 Magic Word: {{CURRENTTIME}}
1738 !! input
1739 {{CURRENTTIME}}
1740 !! result
1741 <p>00:02
1742 </p>
1743 !! end
1745 !! test
1746 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1747 !! input
1748 {{CURRENTWEEK}}
1749 !! result
1750 <p>1
1751 </p>
1752 !! end
1754 !! test
1755 Magic Word: {{CURRENTYEAR}}
1756 !! input
1757 {{CURRENTYEAR}}
1758 !! result
1759 <p>1970
1760 </p>
1761 !! end
1763 !! test
1764 Magic Word: {{FULLPAGENAME}}
1765 !! options
1766 title=[[User:Ævar Arnfjörð Bjarmason]]
1767 !! input
1768 {{FULLPAGENAME}}
1769 !! result
1770 <p>User:Ævar Arnfjörð Bjarmason
1771 </p>
1772 !! end
1774 !! test
1775 Magic Word: {{FULLPAGENAMEE}}
1776 !! options
1777 title=[[User:Ævar Arnfjörð Bjarmason]]
1778 !! input
1779 {{FULLPAGENAMEE}}
1780 !! result
1781 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1782 </p>
1783 !! end
1785 !! test
1786 Magic Word: {{NAMESPACE}}
1787 !! options
1788 title=[[User:Ævar Arnfjörð Bjarmason]]
1789 disabled # FIXME
1790 !! input
1791 {{NAMESPACE}}
1792 !! result
1793 <p>User
1794 </p>
1795 !! end
1797 !! test
1798 Magic Word: {{NAMESPACEE}}
1799 !! options
1800 title=[[User:Ævar Arnfjörð Bjarmason]]
1801 disabled # FIXME
1802 !! input
1803 {{NAMESPACEE}}
1804 !! result
1805 <p>User
1806 </p>
1807 !! end
1809 !! test
1810 Magic Word: {{NUMBEROFARTICLES}}
1811 !! input
1812 {{NUMBEROFARTICLES}}
1813 !! result
1814 <p>1
1815 </p>
1816 !! end
1818 !! test
1819 Magic Word: {{NUMBEROFFILES}}
1820 !! input
1821 {{NUMBEROFFILES}}
1822 !! result
1823 <p>1
1824 </p>
1825 !! end
1827 !! test
1828 Magic Word: {{PAGENAME}}
1829 !! options
1830 title=[[User:Ævar Arnfjörð Bjarmason]]
1831 disabled # FIXME
1832 !! input
1833 {{PAGENAME}}
1834 !! result
1835 <p>Ævar Arnfjörð Bjarmason
1836 </p>
1837 !! end
1839 !! test
1840 Magic Word: {{PAGENAMEE}}
1841 !! options
1842 title=[[User:Ævar Arnfjörð Bjarmason]]
1843 !! input
1844 {{PAGENAMEE}}
1845 !! result
1846 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1847 </p>
1848 !! end
1850 !! test
1851 Magic Word: {{REVISIONID}}
1852 !! input
1853 {{REVISIONID}}
1854 !! result
1855 <p>1337
1856 </p>
1857 !! end
1859 !! test
1860 Magic Word: {{SCRIPTPATH}}
1861 !! input
1862 {{SCRIPTPATH}}
1863 !! result
1864 <p>/
1865 </p>
1866 !! end
1868 !! test
1869 Magic Word: {{SERVER}}
1870 !! input
1871 {{SERVER}}
1872 !! result
1873 <p><a href="http://localhost" class="external free" title="http://localhost" rel="nofollow">http://localhost</a>
1874 </p>
1875 !! end
1877 !! test
1878 Magic Word: {{SERVERNAME}}
1879 !! input
1880 {{SERVERNAME}}
1881 !! result
1882 <p>Britney Spears
1883 </p>
1884 !! end
1886 !! test
1887 Magic Word: {{SITENAME}}
1888 !! input
1889 {{SITENAME}}
1890 !! result
1891 <p>MediaWiki
1892 </p>
1893 !! end
1895 !! test
1896 Namespace 1 {{ns:1}}
1897 !! input
1898 {{ns:1}}
1899 !! result
1900 <p>Talk
1901 </p>
1902 !! end
1904 !! test
1905 Namespace 1 {{ns:01}}
1906 !! input
1907 {{ns:01}}
1908 !! result
1909 <p>Talk
1910 </p>
1911 !! end
1913 !! test
1914 Namespace 0 {{ns:0}} (bug 4783)
1915 !! input
1916 {{ns:0}}
1917 !! result
1919 !! end
1921 !! test
1922 Namespace 0 {{ns:00}} (bug 4783)
1923 !! input
1924 {{ns:00}}
1925 !! result
1927 !! end
1929 !! test
1930 Namespace -1 {{ns:-1}}
1931 !! input
1932 {{ns:-1}}
1933 !! result
1934 <p>Special
1935 </p>
1936 !! end
1938 !! test
1939 Namespace Project {{ns:User}}
1940 !! input
1941 {{ns:User}}
1942 !! result
1943 <p>User
1944 </p>
1945 !! end
1949 ### Magic links
1951 !! test
1952 Magic links: internal link to RFC (bug 479)
1953 !! input
1954 [[RFC 123]]
1955 !! result
1956 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1957 </p>
1958 !! end
1960 !! test
1961 Magic links: RFC (bug 479)
1962 !! input
1963 RFC 822
1964 !! result
1965 <p><a href="http://www.ietf.org/rfc/rfc822.txt" class="external" title="http://www.ietf.org/rfc/rfc822.txt">RFC 822</a>
1966 </p>
1967 !! end
1969 !! test
1970 Magic links: ISBN (bug 1937)
1971 !! input
1972 ISBN 0-306-40615-2
1973 !! result
1974 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1975 </p>
1976 !! end
1978 !! test
1979 Magic links: PMID incorrectly converts space to underscore
1980 !! input
1981 PMID 1234
1982 !! result
1983 <p><a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=1234" class="external" title="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=1234">PMID 1234</a>
1984 </p>
1985 !! end
1988 ### Templates
1989 ####
1991 !! test
1992 Nonexistant template
1993 !! input
1994 {{thistemplatedoesnotexist}}
1995 !! result
1996 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1997 </p>
1998 !! end
2000 !! article
2001 Template:test
2002 !! text
2003 This is a test template
2004 !! endarticle
2006 !! test
2007 Simple template
2008 !! input
2009 {{test}}
2010 !! result
2011 <p>This is a test template
2012 </p>
2013 !! end
2015 !! test
2016 Template with explicit namespace
2017 !! input
2018 {{Template:test}}
2019 !! result
2020 <p>This is a test template
2021 </p>
2022 !! end
2025 !! article
2026 Template:paramtest
2027 !! text
2028 This is a test template with parameter {{{param}}}
2029 !! endarticle
2031 !! test
2032 Template parameter
2033 !! input
2034 {{paramtest|param=foo}}
2035 !! result
2036 <p>This is a test template with parameter foo
2037 </p>
2038 !! end
2040 !! article
2041 Template:paramtestnum
2042 !! text
2043 [[{{{1}}}|{{{2}}}]]
2044 !! endarticle
2046 !! test
2047 Template unnamed parameter
2048 !! input
2049 {{paramtestnum|Main Page|the main page}}
2050 !! result
2051 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2052 </p>
2053 !! end
2055 !! article
2056 Template:templatesimple
2057 !! text
2058 (test)
2059 !! endarticle
2061 !! article
2062 Template:templateredirect
2063 !! text
2064 #redirect [[Template:templatesimple]]
2065 !! endarticle
2067 !! article
2068 Template:templateasargtestnum
2069 !! text
2070 {{{{{1}}}}}
2071 !! endarticle
2073 !! article
2074 Template:templateasargtest
2075 !! text
2076 {{template{{{templ}}}}}
2077 !! endarticle
2079 !! article
2080 Template:templateasargtest2
2081 !! text
2082 {{{{{templ}}}}}
2083 !! endarticle
2085 !! test
2086 Template with template name as unnamed argument
2087 !! input
2088 {{templateasargtestnum|templatesimple}}
2089 !! result
2090 <p>(test)
2091 </p>
2092 !! end
2094 !! test
2095 Template with template name as argument
2096 !! input
2097 {{templateasargtest|templ=simple}}
2098 !! result
2099 <p>(test)
2100 </p>
2101 !! end
2103 !! test
2104 Template with template name as argument (2)
2105 !! input
2106 {{templateasargtest2|templ=templatesimple}}
2107 !! result
2108 <p>(test)
2109 </p>
2110 !! end
2112 !! article
2113 Template:templateasargtestdefault
2114 !! text
2115 {{{{{templ|templatesimple}}}}}
2116 !! endarticle
2118 !! article
2119 Template:templa
2120 !! text
2121 '''templ'''
2122 !! endarticle
2124 !! test
2125 Template with default value
2126 !! input
2127 {{templateasargtestdefault}}
2128 !! result
2129 <p>(test)
2130 </p>
2131 !! end
2133 !! test
2134 Template with default value (value set)
2135 !! input
2136 {{templateasargtestdefault|templ=templa}}
2137 !! result
2138 <p><b>templ</b>
2139 </p>
2140 !! end
2142 !! test
2143 Template redirect
2144 !! input
2145 {{templateredirect}}
2146 !! result
2147 <p>(test)
2148 </p>
2149 !! end
2151 !! test
2152 Template with argument in separate line
2153 !! input
2154 {{ templateasargtest  |
2155  templ = simple }}
2156 !! result
2157 <p>(test)
2158 </p>
2159 !! end
2161 !! test
2162 Template with complex template as argument
2163 !! input
2164 {{paramtest|
2165   param ={{ templateasargtest  |
2166  templ = simple }}}}
2167 !! result
2168 <p>This is a test template with parameter (test)
2169 </p>
2170 !! end
2172 !! test
2173 Template with thumb image (wiht link in description)
2174 !! input
2175 {{paramtest|
2176   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2177 !! result
2178 This is a test template with parameter <div class="thumb tright"><div style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="Image:Noimage.png">Image:Noimage.png</a>  <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit" class="new" title="No link">link</a> <a href="/index.php?title=No_link&amp;action=edit" class="new" title="No link">caption</a></div></div></div>
2180 !! end
2182 !! article
2183 Template:complextemplate
2184 !! text
2185 {{{1}}} {{paramtest|
2186   param ={{{param}}}}}
2187 !! endarticle
2189 !! test
2190 Template with complex arguments
2191 !! input
2192 {{complextemplate|
2193   param ={{ templateasargtest  |
2194  templ = simple }}|[[Template:complextemplate|link]]}}
2195 !! result
2196 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2197 </p>
2198 !! end
2200 !! test
2201 BUG 553: link with two variables in a piped link
2202 !! input
2203 {| 
2204 |[[{{{1}}}|{{{2}}}]]
2206 !! result
2207 <table>
2208 <tr>
2209 <td>[[{{{1}}}|{{{2}}}]]
2210 </td></tr></table>
2212 !! end
2214 !! test
2215 Magic variable as template parameter
2216 !! input
2217 {{paramtest|param={{SITENAME}}}}
2218 !! result
2219 <p>This is a test template with parameter MediaWiki
2220 </p>
2221 !! end
2223 !! article
2224 Template:linktest
2225 !! text
2226 [[{{{param}}}|link]]
2227 !! endarticle
2229 !! test
2230 Template parameter as link source
2231 !! input
2232 {{linktest|param=Main Page}}
2233 !! result
2234 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2235 </p>
2236 !! end
2239 !!article
2240 Template:paramtest2
2241 !! text
2242 including another template, {{paramtest|param={{{arg}}}}}
2243 !! endarticle
2245 !! test
2246 Template passing argument to another template
2247 !! input
2248 {{paramtest2|arg='hmm'}}
2249 !! result
2250 <p>including another template, This is a test template with parameter 'hmm'
2251 </p>
2252 !! end
2254 !! article
2255 Template:Linktest2
2256 !! text
2257 Main Page
2258 !! endarticle
2260 !! test
2261 Template as link source
2262 !! input
2263 [[{{linktest2}}]]
2264 !! result
2265 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2266 </p>
2267 !! end
2270 !! article
2271 Template:loop1
2272 !! text
2273 {{loop2}}
2274 !! endarticle
2276 !! article
2277 Template:loop2
2278 !! text
2279 {{loop1}}
2280 !! endarticle
2282 !! test
2283 Template infinite loop
2284 !! input
2285 {{loop1}}
2286 !! result
2287 <p>{{loop1}}<!-- WARNING: template loop detected -->
2288 </p>
2289 !! end
2291 !! test
2292 Template from main namespace
2293 !! input
2294 {{:Main Page}}
2295 !! result
2296 <p>blah blah
2297 </p>
2298 !! end
2300 !! article
2301 Template:table
2302 !! text
2303 {| 
2304 | 1 || 2
2305 |- 
2306 | 3 || 4
2308 !! endarticle
2310 !! test
2311 BUG 529: Template with table, not included at beginning of line
2312 !! input
2313 foo {{table}}
2314 !! result
2315 <p>foo 
2316 </p>
2317 <table>
2318 <tr>
2319 <td> 1 </td><td> 2
2320 </td></tr>
2321 <tr>
2322 <td> 3 </td><td> 4
2323 </td></tr></table>
2325 !! end
2327 !! test
2328 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2329 !! input
2331 {{table}}
2332 !! result
2333 <p>foo
2334 </p>
2335 <table>
2336 <tr>
2337 <td> 1 </td><td> 2
2338 </td></tr>
2339 <tr>
2340 <td> 3 </td><td> 4
2341 </td></tr></table>
2343 !! end
2345 !! test
2346 BUG 41: Template parameters shown as broken links
2347 !! input
2348 {{{parameter}}}
2349 !! result
2350 <p>{{{parameter}}}
2351 </p>
2352 !! end
2355 !! article
2356 Template:MSGNW test
2357 !! text
2358 ''None'' of '''this''' should be 
2359 * interepreted
2360  but rather passed unmodified
2361 {{test}}
2362 !! endarticle
2364 # hmm, fix this or just deprecate msgnw and document its behavior?
2365 !! test
2366 msgnw keyword
2367 !! options
2368 disabled
2369 !! input
2370 {{msgnw:MSGNW test}}
2371 !! result
2372 <p>''None'' of '''this''' should be 
2373 * interepreted
2374  but rather passed unmodified
2375 {{test}}
2376 </p>
2377 !! end
2379 !! test
2380 int keyword
2381 !! input
2382 {{int:youhavenewmessages|lots of money|not!}}
2383 !! result
2384 <p>You have lots of money (not!).
2385 </p>
2386 !! end
2388 !! article
2389 Template:Includes
2390 !! text
2391 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2392 !! endarticle
2394 !! test
2395 <includeonly> and <noinclude> being included
2396 !! input
2397 {{Includes}}
2398 !! result
2399 <p>Foobar
2400 </p>
2401 !! end
2403 !! article
2404 Template:Includes2
2405 !! text
2406 <onlyinclude>Foo</onlyinclude>bar
2407 !! endarticle
2409 !! test
2410 <onlyinclude> being included
2411 !! input
2412 {{Includes2}}
2413 !! result
2414 <p>Foo
2415 </p>
2416 !! end
2419 !! article
2420 Template:Includes3
2421 !! text
2422 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2423 !! endarticle
2425 !! test
2426 <onlyinclude> and <includeonly> being included
2427 !! input
2428 {{Includes3}}
2429 !! result
2430 <p>Foo
2431 </p>
2432 !! end
2434 !! test
2435 <includeonly> and <noinclude> on a page
2436 !! input
2437 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2438 !! result
2439 <p>Foozar
2440 </p>
2441 !! end
2443 !! test
2444 <onlyinclude> on a page
2445 !! input
2446 <onlyinclude>Foo</onlyinclude>bar
2447 !! result
2448 <p>Foobar
2449 </p>
2450 !! end
2453 ### Pre-save transform tests
2455 !! test
2456 pre-save transform: subst:
2457 !! options
2459 !! input
2460 {{subst:test}}
2461 !! result
2462 This is a test template
2463 !! end
2465 !! test
2466 pre-save transform: normal template
2467 !! options
2469 !! input
2470 {{test}}
2471 !! result
2472 {{test}}
2473 !! end
2475 !! test
2476 pre-save transform: nonexistant template
2477 !! options
2479 !! input
2480 {{thistemplatedoesnotexist}}
2481 !! result
2482 {{thistemplatedoesnotexist}}
2483 !! end
2486 !! test
2487 pre-save transform: subst magic variables
2488 !! options
2490 !! input
2491 {{subst:SITENAME}}
2492 !! result
2493 MediaWiki
2494 !! end
2496 # This is bug 89, which I fixed. -- wtm
2497 !! test
2498 pre-save transform: subst: templates with parameters
2499 !! options
2501 !! input
2502 {{subst:paramtest|param="something else"}}
2503 !! result
2504 This is a test template with parameter "something else"
2505 !! end
2507 !! article
2508 Template:nowikitest
2509 !! text
2510 <nowiki>'''not wiki'''</nowiki>
2511 !! endarticle
2513 !! test
2514 pre-save transform: nowiki in subst (bug 1188)
2515 !! options
2517 !! input
2518 {{subst:nowikitest}}
2519 !! result
2520 <nowiki>'''not wiki'''</nowiki>
2521 !! end
2524 !! article
2525 Template:commenttest
2526 !! text
2527 This template has <!-- a comment --> in it.
2528 !! endarticle
2530 !! test
2531 pre-save transform: comment in subst (bug 1936)
2532 !! options
2534 !! input
2535 {{subst:commenttest}}
2536 !! result
2537 This template has <!-- a comment --> in it.
2538 !! end
2540 !! test
2541 pre-save transform: unclosed tag
2542 !! options
2543 pst noxml
2544 !! input
2545 <nowiki>'''not wiki'''
2546 !! result
2547 <nowiki>'''not wiki'''
2548 !! end
2550 !! test
2551 pre-save transform: mixed tag case
2552 !! options
2553 pst noxml
2554 !! input
2555 <NOwiki>'''not wiki'''</noWIKI>
2556 !! result
2557 <NOwiki>'''not wiki'''</noWIKI>
2558 !! end
2560 !! test
2561 pre-save transform: unclosed comment in <nowiki>
2562 !! options
2563 pst noxml
2564 !! input
2565 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2566 !! result
2567 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2568 !!end
2570 !! article
2571 Template:dangerous
2572 !!text
2573 <span onmouseover="alert('crap')">Oh no</span>
2574 !!endarticle
2576 !!test
2577 (confirming safety of fix for subst bug 1936)
2578 !! input
2579 {{Template:dangerous}}
2580 !! result
2581 <p><span>Oh no</span>
2582 </p>
2583 !! end
2585 !! test
2586 pre-save transform: comment containing gallery (bug 5024)
2587 !! options
2589 !! input
2590 <!-- <gallery>data</gallery> -->
2591 !!result
2592 <!-- <gallery>data</gallery> -->
2593 !!end
2595 !! test
2596 pre-save transform: comment containing extension
2597 !! options
2599 !! input
2600 <!-- <tag>data</tag> -->
2601 !!result
2602 <!-- <tag>data</tag> -->
2603 !!end
2605 !! test
2606 pre-save transform: comment containing nowiki
2607 !! options
2609 !! input
2610 <!-- <nowiki>data</nowiki> -->
2611 !!result
2612 <!-- <nowiki>data</nowiki> -->
2613 !!end
2615 !! test
2616 pre-save transform: comment containing math
2617 !! options
2619 !! input
2620 <!-- <math>data</math> -->
2621 !!result
2622 <!-- <math>data</math> -->
2623 !!end
2625 !! test
2626 pre-save transform: <noinclude> in subst (bug 3298)
2627 !! options
2629 !! input
2630 {{subst:Includes}}
2631 !! result
2632 Foobar
2633 !! end
2635 !! test
2636 pre-save transform: <onlyinclude> in subst (bug 3298)
2637 !! options
2639 !! input
2640 {{subst:Includes2}}
2641 !! result
2643 !! end
2647 ### Message transform tests
2649 !! test
2650 message transform: magic variables
2651 !! options
2653 !! input
2654 {{SITENAME}}
2655 !! result
2656 MediaWiki
2657 !! end
2659 !! test
2660 message transform: should not transform wiki markup
2661 !! options
2663 !! input
2664 ''test''
2665 !! result
2666 ''test''
2667 !! end
2669 !! test
2670 message transform: <noinclude> in transcluded template (bug 4926)
2671 !! options
2673 !! input
2674 {{Includes}}
2675 !! result
2676 Foobar
2677 !! end
2679 !! test
2680 message transform: <onlyinclude> in transcluded template (bug 4926)
2681 !! options
2683 !! input
2684 {{Includes2}}
2685 !! result
2687 !! end
2691 ### Images
2693 !! test
2694 Simple image
2695 !! input
2696 [[Image:foobar.jpg]]
2697 !! result
2698 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2699 </p>
2700 !! end
2702 !! test
2703 Right-aligned image
2704 !! input
2705 [[Image:foobar.jpg|right]]
2706 !! result
2707 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
2709 !! end
2711 !! test
2712 Image with caption
2713 !! input
2714 [[Image:foobar.jpg|right|Caption text]]
2715 !! result
2716 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Caption text" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
2718 !! end
2720 !! test
2721 Image with frame and link
2722 !! input
2723 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2724 !! result
2725 <div class="thumb tleft"><div style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image Main Page"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="This is a test image Main Page" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
2727 !! end
2729 !! test
2730 Link to image page- image page normally doesn't exists, hence edit link
2731 TODO: Add test with existing image page
2732 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2733 !! input
2734 [[:Image:test]]
2735 !! result
2736 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2737 </p>
2738 !! end
2740 !! test
2741 Frameless image caption with a free URL
2742 !! input
2743 [[Image:foobar.jpg|http://example.com]]
2744 !! result
2745 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="http://example.com" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2746 </p>
2747 !! end
2749 !! test
2750 Thumbnail image caption with a free URL
2751 !! input
2752 [[Image:foobar.jpg|thumb|http://example.com]]
2753 !! result
2754 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="http://example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
2756 !! end
2758 !! test
2759 BUG 1887: A ISBN with a thumbnail
2760 !! input
2761 [[Image:foobar.jpg|thumb|ISBN 12354]]
2762 !! result
2763 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="ISBN 12354"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="ISBN 12354" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><a href="/index.php?title=Special:Booksources&amp;isbn=12354" class="internal">ISBN 12354</a></div></div></div>
2765 !! end
2767 !! test
2768 BUG 1887: A RFC with a thumbnail
2769 !! input
2770 [[Image:foobar.jpg|thumb|This is RFC 12354]]
2771 !! result
2772 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is RFC 12354"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is RFC 12354" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This is <a href="http://www.ietf.org/rfc/rfc12354.txt" class="external" title="http://www.ietf.org/rfc/rfc12354.txt">RFC 12354</a></div></div></div>
2774 !! end
2776 !! test
2777 BUG 1887: A mailto link with a thumbnail
2778 !! input
2779 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
2780 !! result
2781 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Please mailto:nobody@example.com"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="Please mailto:nobody@example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>Please <a href="mailto:nobody@example.com" class="external free" title="mailto:nobody@example.com" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
2783 !! end
2785 !! test
2786 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
2787 so math is not stripped and turns up as escaped &lt;math&gt; tags.
2788 !! input
2789 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2790 !! result
2791 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="&lt;math&gt;2+2&lt;/math&gt;"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="&lt;math&gt;2+2&lt;/math&gt;" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
2793 !! end
2795 !! test
2796 BUG 1887, part 2: A <math> with a thumbnail- math enabled
2797 !! options
2798 math
2799 !! input
2800 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2801 !! result
2802 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="2 + 2"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="2 + 2" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><span class="texhtml">2 + 2</span></div></div></div>
2804 !! end
2806 # Pending resolution to bug 368
2807 !! test
2808 BUG 648: Frameless image caption with a link
2809 !! input
2810 [[Image:foobar.jpg|text with a [[link]] in it]]
2811 !! result
2812 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2813 </p>
2814 !! end
2816 !! test
2817 BUG 648: Frameless image caption with a link (suffix)
2818 !! input
2819 [[Image:foobar.jpg|text with a [[link]]foo in it]]
2820 !! result
2821 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a linkfoo in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a linkfoo in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2822 </p>
2823 !! end
2825 !! test
2826 BUG 648: Frameless image caption with an interwiki link
2827 !! input
2828 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
2829 !! result
2830 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a MeatBall:Link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2831 </p>
2832 !! end
2834 !! test
2835 BUG 648: Frameless image caption with a piped interwiki link
2836 !! input
2837 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
2838 !! result
2839 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2840 </p>
2841 !! end
2843 !! test
2844 Escape HTML special chars in image alt text
2845 !! input
2846 [[Image:foobar.jpg|& < > "]]
2847 !! result
2848 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="&amp; &lt; &gt; &quot;" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2849 </p>
2850 !! end
2852 !! test
2853 BUG 499: Alt text should have &#1234;, not &amp;1234;
2854 !! input
2855 [[Image:foobar.jpg|&#9792;]]
2856 !! result
2857 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&#9792;"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="&#9792;" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2858 </p>
2859 !! end
2861 !! test
2862 Broken image caption with link
2863 !! input
2864 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
2865 !! result
2866 <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.
2867 </p>
2868 !! end
2870 !! test
2871 Image caption containing another image
2872 !! input
2873 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
2874 !! result
2875 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a caption with another Image:Icon.png inside it!"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is a caption with another Image:Icon.png inside it!" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div>
2877 !! end
2879 !! test
2880 Image caption containing a newline
2881 !! input
2882 [[Image:Foobar.jpg|This
2883 *is some text]]
2884 !! result
2885 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="This *is some text" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2886 </p>
2887 !!end
2890 !! test
2891 Bug 3090: External links other than http: in image captions
2892 !! input
2893 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
2894 !! result
2895 <div class="thumb tright"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This caption has irc and Secure ext links in it."><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" alt="This caption has irc and Secure ext links in it." width="200" height="23" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This caption has <a href="irc://example.net" class="external text" title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div>
2897 !! end
2901 ### Subpages
2903 !! article
2904 Subpage test/subpage
2905 !! text
2907 !! endarticle
2909 !! test
2910 Subpage link
2911 !! options
2912 subpage title=[[Subpage test]]
2913 !! input
2914 [[/subpage]]
2915 !! result
2916 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
2917 </p>
2918 !! end
2920 !! test
2921 Subpage noslash link
2922 !! options
2923 subpage title=[[Subpage test]]
2924 !!input
2925 [[/subpage/]]
2926 !! result
2927 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
2928 </p>
2929 !! end
2931 !! test
2932 Disabled subpages
2933 !! input
2934 [[/subpage]]
2935 !! result
2936 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
2937 </p>
2938 !! end
2940 !! test
2941 BUG 561: {{/Subpage}}
2942 !! options
2943 subpage title=[[Page]]
2944 !! input
2945 {{/Subpage}}
2946 !! result
2947 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
2948 </p>
2949 !! end
2952 ### Categories
2954 !! article
2955 Category:MediaWiki User's Guide
2956 !! text
2957 blah
2958 !! endarticle
2960 !! test
2961 Link to category
2962 !! input
2963 [[:Category:MediaWiki User's Guide]]
2964 !! result
2965 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
2966 </p>
2967 !! end
2969 !! test
2970 Simple category
2971 !! options
2973 !! input
2974 [[Category:MediaWiki User's Guide]]
2975 !! result
2976 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
2977 !! end
2980 ### Inter-language links
2982 !! test
2983 Inter-language links
2984 !! options
2986 !! input
2987 [[es:Alimento]]
2988 [[fr:Nourriture]]
2989 [[zh:&#39135;&#21697;]]
2990 !! result
2991 es:Alimento fr:Nourriture zh:食品
2992 !! end
2995 ### Sections
2997 !! test
2998 Basic section headings
2999 !! options
3000 title=[[Parser test script]]
3001 !! input
3002 == Headline 1 ==
3003 Some text
3005 ==Headline 2==
3006 More
3007 ===Smaller headline===
3008 Blah blah
3009 !! result
3010 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
3011 <p>Some text
3012 </p>
3013 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</div><a name="Headline_2"></a><h2>Headline 2</h2>
3014 <p>More
3015 </p>
3016 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</div><a name="Smaller_headline"></a><h3>Smaller headline</h3>
3017 <p>Blah blah
3018 </p>
3019 !! end
3021 !! test
3022 Section headings with TOC
3023 !! options
3024 title=[[Parser test script]]
3025 !! input
3026 == Headline 1 ==
3027 === Subheadline 1 ===
3028 ===== Skipping a level =====
3029 ====== Skipping a level ======
3031 == Headline 2 ==
3032 Some text
3033 ===Another headline===
3034 !! result
3035 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3036 <ul>
3037 <li class="toclevel-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3038 <ul>
3039 <li class="toclevel-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3040 <ul>
3041 <li class="toclevel-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3042 <ul>
3043 <li class="toclevel-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
3044 </ul>
3045 </li>
3046 </ul>
3047 </li>
3048 </ul>
3049 </li>
3050 <li class="toclevel-1"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3051 <ul>
3052 <li class="toclevel-2"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3053 </ul>
3054 </li>
3055 </ul>
3056 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3057 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
3058 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</div><a name="Subheadline_1"></a><h3> Subheadline 1 </h3>
3059 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</div><a name="Skipping_a_level"></a><h5> Skipping a level </h5>
3060 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</div><a name="Skipping_a_level_2"></a><h6> Skipping a level </h6>
3061 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</div><a name="Headline_2"></a><h2> Headline 2 </h2>
3062 <p>Some text
3063 </p>
3064 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</div><a name="Another_headline"></a><h3>Another headline</h3>
3066 !! end
3068 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3069 !! test
3070 Handling of sections up to level 6 and beyond
3071 !! input 
3072 = Level 1 Heading=
3073 == Level 2 Heading==
3074 === Level 3 Heading===
3075 ==== Level 4 Heading====
3076 ===== Level 5 Heading=====
3077 ====== Level 6 Heading======
3078 ======= Level 7 Heading=======
3079 ======== Level 8 Heading========
3080 ========= Level 9 Heading=========
3081 ========== Level 10 Heading==========
3082 !! result
3083 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3084 <ul>
3085 <li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3086 <ul>
3087 <li class="toclevel-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3088 <ul>
3089 <li class="toclevel-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3090 <ul>
3091 <li class="toclevel-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
3092 <ul>
3093 <li class="toclevel-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
3094 <ul>
3095 <li class="toclevel-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>
3096 <li class="toclevel-6"><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>
3097 <li class="toclevel-6"><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>
3098 <li class="toclevel-6"><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>
3099 <li class="toclevel-6"><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>
3100 </ul>
3101 </li>
3102 </ul>
3103 </li>
3104 </ul>
3105 </li>
3106 </ul>
3107 </li>
3108 </ul>
3109 </li>
3110 </ul>
3111 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3112 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</div><a name="Level_1_Heading"></a><h1> Level 1 Heading</h1>
3113 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</div><a name="Level_2_Heading"></a><h2> Level 2 Heading</h2>
3114 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</div><a name="Level_3_Heading"></a><h3> Level 3 Heading</h3>
3115 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</div><a name="Level_4_Heading"></a><h4> Level 4 Heading</h4>
3116 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</div><a name="Level_5_Heading"></a><h5> Level 5 Heading</h5>
3117 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</div><a name="Level_6_Heading"></a><h6> Level 6 Heading</h6>
3118 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</div><a name=".3D_Level_7_Heading.3D"></a><h6>= Level 7 Heading=</h6>
3119 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</div><a name=".3D.3D_Level_8_Heading.3D.3D"></a><h6>== Level 8 Heading==</h6>
3120 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</div><a name=".3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><h6>=== Level 9 Heading===</h6>
3121 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</div><a name=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><h6>==== Level 10 Heading====</h6>
3123 !! end
3125 !! test
3126 Resolving duplicate section names
3127 !! options
3128 title=[[Parser test script]]
3129 !! input
3130 == Foo bar ==
3131 == Foo bar ==
3132 !! result
3133 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</div><a name="Foo_bar"></a><h2> Foo bar </h2>
3134 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</div><a name="Foo_bar_2"></a><h2> Foo bar </h2>
3136 !! end
3138 !! article
3139 Template:sections
3140 !! text
3141 ===Section 1===
3142 ==Section 2==
3143 !! endarticle
3145 !! test
3146 Template with sections, __NOTOC__
3147 !! options
3148 title=[[Parser test script]]
3149 !! input
3150 __NOTOC__
3151 ==Section 0==
3152 {{sections}}
3153 ==Section 4==
3154 !! result
3155 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</div><a name="Section_0"></a><h2>Section 0</h2>
3156 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</div><a name="Section_1"></a><h3>Section 1</h3>
3157 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</div><a name="Section_2"></a><h2>Section 2</h2>
3158 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</div><a name="Section_4"></a><h2>Section 4</h2>
3160 !! end
3162 !! test
3163 __NOEDITSECTION__ keyword
3164 !! input
3165 __NOEDITSECTION__
3166 ==Section 1==
3167 ==Section 2==
3168 !! result
3169 <a name="Section_1"></a><h2>Section 1</h2>
3170 <a name="Section_2"></a><h2>Section 2</h2>
3172 !! end
3174 !! test
3175 Link inside a section heading
3176 !! options
3177 title=[[Parser test script]]
3178 !! input
3179 ==Section with a [[Main Page|link]] in it==
3180 !! result
3181 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</div><a name="Section_with_a_link_in_it"></a><h2>Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</h2>
3183 !! end
3186 !! test
3187 BUG 1219 URL next to image (good)
3188 !! input
3189 http://example.com [[Image:foobar.jpg]]
3190 !! result
3191 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> <a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3192 </p>
3193 !!end
3195 !! test
3196 BUG 1219 URL next to image (broken)
3197 !! input
3198 http://example.com[[Image:foobar.jpg]]
3199 !! result
3200 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3201 </p>
3202 !!end
3204 !! test
3205 Bug 1186 news: in the middle of text
3206 !! input
3207 http://en.wikinews.org/wiki/Wikinews:Workplace
3208 !! result
3209 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" title="http://en.wikinews.org/wiki/Wikinews:Workplace" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
3210 </p>
3211 !!end
3214 !! test
3215 Namespaced link must have a title
3216 !! input
3217 [[Project:]]
3218 !! result
3219 <p>[[Project:]]
3220 </p>
3221 !!end
3223 !! test
3224 Namespaced link must have a title (bad fragment version)
3225 !! input
3226 [[Project:#fragment]]
3227 !! result
3228 <p>[[Project:#fragment]]
3229 </p>
3230 !!end
3233 !! test
3234 div with no attributes
3235 !! input
3236 <div>HTML rocks</div>
3237 !! result
3238 <div>HTML rocks</div>
3240 !! end
3242 !! test
3243 div with double-quoted attribute
3244 !! input
3245 <div id="rock">HTML rocks</div>
3246 !! result
3247 <div id="rock">HTML rocks</div>
3249 !! end
3251 !! test
3252 div with single-quoted attribute
3253 !! input
3254 <div id='rock'>HTML rocks</div>
3255 !! result
3256 <div id="rock">HTML rocks</div>
3258 !! end
3260 !! test
3261 div with unquoted attribute
3262 !! input
3263 <div id=rock>HTML rocks</div>
3264 !! result
3265 <div id="rock">HTML rocks</div>
3267 !! end
3269 !! test
3270 div with illegal double attributes
3271 !! input
3272 <div align="center" align="right">HTML rocks</div>
3273 !! result
3274 <div align="right">HTML rocks</div>
3276 !!end
3278 !! test
3279 HTML multiple attributes correction
3280 !! input
3281 <p class="error" class="awesome">Awesome!</p>
3282 !! result
3283 <p class="awesome">Awesome!</p>
3285 !!end
3287 !! test
3288 Table multiple attributes correction
3289 !! input
3291 !+ class="error" class="awesome"| status
3293 !! result
3294 <table>
3295 <tr>
3296 <th class="awesome"> status
3297 </th></tr></table>
3299 !!end
3301 !! test
3302 DIV IN UPPERCASE
3303 !! input
3304 <DIV ALIGN="center">HTML ROCKS</DIV>
3305 !! result
3306 <div align="center">HTML ROCKS</div>
3308 !!end
3311 !! test
3312 text with amp in the middle of nowhere
3313 !! input
3314 Remember AT&T?
3315 !!result
3316 <p>Remember AT&amp;T?
3317 </p>
3318 !! end
3320 !! test
3321 text with character entity: eacute
3322 !! input
3323 I always thought &eacute; was a cute letter.
3324 !! result
3325 <p>I always thought &eacute; was a cute letter.
3326 </p>
3327 !! end
3329 !! test
3330 text with undefined character entity: xacute
3331 !! input
3332 I always thought &xacute; was a cute letter.
3333 !! result
3334 <p>I always thought &amp;xacute; was a cute letter.
3335 </p>
3336 !! end
3340 ### Media links
3343 !! test
3344 Media link
3345 !! input
3346 [[Media:Foobar.jpg]]
3347 !! result
3348 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3349 </p>
3350 !! end
3352 !! test
3353 Media link with text
3354 !! input
3355 [[Media:Foobar.jpg|A neat file to look at]]
3356 !! result
3357 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3358 </p>
3359 !! end
3361 # FIXME: this is still bad HTML tag nesting
3362 !! test
3363 Media link with nasty text
3364 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3365 !! input
3366 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3367 !! result
3368 <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>
3370 !! end
3372 !! test
3373 Media link to nonexistent file (bug 1702)
3374 !! input
3375 [[Media:No such.jpg]]
3376 !! result
3377 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
3378 </p>
3379 !! end
3381 !! test
3382 Image link to nonexistent file (bug 1850 - good)
3383 !! input
3384 [[Image:No such.jpg]]
3385 !! result
3386 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="Image:No such.jpg">Image:No such.jpg</a>
3387 </p>
3388 !! end
3390 !! test
3391 :Image link to nonexistent file (bug 1850 - bad)
3392 !! input
3393 [[:Image:No such.jpg]]
3394 !! result
3395 <p><a href="/index.php?title=Image:No_such.jpg&amp;action=edit" class="new" title="Image:No such.jpg">Image:No such.jpg</a>
3396 </p>
3397 !! end
3401 !! test
3402 Character reference normalization in link text (bug 1938)
3403 !! input
3404 [[Main Page|this&that]]
3405 !! result
3406 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3407 </p>
3408 !!end
3410 !! test
3411 Empty attribute crash test (bug 2067)
3412 !! input
3413 <font color="">foo</font>
3414 !! result
3415 <p><font color="">foo</font>
3416 </p>
3417 !! end
3419 !! test
3420 Empty attribute crash test single-quotes (bug 2067)
3421 !! input
3422 <font color=''>foo</font>
3423 !! result
3424 <p><font color="">foo</font>
3425 </p>
3426 !! end
3428 !! test
3429 Attribute test: equals, then nothing
3430 !! input
3431 <font color=>foo</font>
3432 !! result
3433 <p><font>foo</font>
3434 </p>
3435 !! end
3437 !! test
3438 Attribute test: unquoted value
3439 !! input
3440 <font color=x>foo</font>
3441 !! result
3442 <p><font color="x">foo</font>
3443 </p>
3444 !! end
3446 !! test
3447 Attribute test: unquoted but illegal value (hash)
3448 !! input
3449 <font color=#x>foo</font>
3450 !! result
3451 <p><font color="#x">foo</font>
3452 </p>
3453 !! end
3455 !! test
3456 Attribute test: no value
3457 !! input
3458 <font color>foo</font>
3459 !! result
3460 <p><font color="color">foo</font>
3461 </p>
3462 !! end
3464 !! test
3465 Bug 2095: link with three closing brackets
3466 !! input
3467 [[Main Page]]]
3468 !! result
3469 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3470 </p>
3471 !! end
3473 !! test
3474 Bug 2095: link with pipe and three closing brackets
3475 !! input
3476 [[Main Page|link]]]
3477 !! result
3478 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3479 </p>
3480 !! end
3482 !! test
3483 Bug 2095: link with pipe and three closing brackets, version 2
3484 !! input
3485 [[Main Page|[http://example.com/]]]
3486 !! result
3487 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3488 </p>
3489 !! end
3493 ### Safety
3496 !! article
3497 Template:Dangerous attribute
3498 !! text
3499 " onmouseover="alert(document.cookie)
3500 !! endarticle
3502 !! article
3503 Template:Dangerous style attribute
3504 !! text
3505 border-size: expression(alert(document.cookie))
3506 !! endarticle
3508 !! article
3509 Template:Div style
3510 !! text
3511 <div style="float: right; {{{1}}}">Magic div</div>
3512 !! endarticle
3514 !! test
3515 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3516 !! input
3517 <div title="{{test}}"></div>
3518 !! result
3519 <div title="This is a test template"></div>
3521 !! end
3523 !! test
3524 Bug 2304: HTML attribute safety (dangerous template; 2309)
3525 !! input
3526 <div title="{{dangerous attribute}}"></div>
3527 !! result
3528 <div title=""></div>
3530 !! end
3532 !! test
3533 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3534 !! input
3535 <div style="{{dangerous style attribute}}"></div>
3536 !! result
3537 <div></div>
3539 !! end
3541 !! test
3542 Bug 2304: HTML attribute safety (safe parameter; 2309)
3543 !! input
3544 {{div style|width: 200px}}
3545 !! result
3546 <div style="float: right; width: 200px">Magic div</div>
3548 !! end
3550 !! test
3551 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3552 !! input
3553 {{div style|width: expression(alert(document.cookie))}}
3554 !! result
3555 <div>Magic div</div>
3557 !! end
3559 !! test
3560 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3561 !! input
3562 {{div style|"><script>alert(document.cookie)</script>}}
3563 !! result
3564 <div>Magic div</div>
3566 !! end
3568 !! test
3569 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3570 !! input
3571 {{div style|" ><script>alert(document.cookie)</script>}}
3572 !! result
3573 <div style="float: right;">Magic div</div>
3575 !! end
3577 !! test
3578 Bug 2304: HTML attribute safety (link)
3579 !! input
3580 <div title="[[Main Page]]"></div>
3581 !! result
3582 <div title="&#91;&#91;Main Page]]"></div>
3584 !! end
3586 !! test
3587 Bug 2304: HTML attribute safety (italics)
3588 !! input
3589 <div title="''foobar''"></div>
3590 !! result
3591 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3593 !! end
3595 !! test
3596 Bug 2304: HTML attribute safety (bold)
3597 !! input
3598 <div title="'''foobar'''"></div>
3599 !! result
3600 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3602 !! end
3605 !! test
3606 Bug 2304: HTML attribute safety (ISBN)
3607 !! input
3608 <div title="ISBN 1234567890"></div>
3609 !! result
3610 <div title="&#73;SBN 1234567890"></div>
3612 !! end
3614 !! test
3615 Bug 2304: HTML attribute safety (RFC)
3616 !! input
3617 <div title="RFC 1234"></div>
3618 !! result
3619 <div title="&#82;FC 1234"></div>
3621 !! end
3623 !! test
3624 Bug 2304: HTML attribute safety (PMID)
3625 !! input
3626 <div title="PMID 1234567890"></div>
3627 !! result
3628 <div title="&#80;MID 1234567890"></div>
3630 !! end
3632 !! test
3633 Bug 2304: HTML attribute safety (web link)
3634 !! input
3635 <div title="http://example.com/"></div>
3636 !! result
3637 <div title="http&#58;//example.com/"></div>
3639 !! end
3641 !! test
3642 Bug 2304: HTML attribute safety (named web link)
3643 !! input
3644 <div title="[http://example.com/ link]"></div>
3645 !! result
3646 <div title="&#91;http&#58;//example.com/ link]"></div>
3648 !! end
3650 !! test
3651 Bug 3244: HTML attribute safety (extension; safe)
3652 !! input
3653 <div style="<nowiki>background:blue</nowiki>"></div>
3654 !! result
3655 <div style="background:blue"></div>
3657 !! end
3659 !! test
3660 Bug 3244: HTML attribute safety (extension; unsafe)
3661 !! input
3662 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3663 !! result
3664 <div></div>
3666 !! end
3668 !! test
3669 Math section safety when disabled
3670 !! input
3671 <math><script>alert(document.cookies);</script></math>
3672 !! result
3673 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3674 </p>
3675 !! end
3677 # More MSIE fun discovered by Tom Gilder
3679 !! test
3680 MSIE CSS safety test: spurious slash
3681 !! input
3682 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3683 !! result
3684 <div>evil</div>
3686 !! end
3688 !! test
3689 MSIE CSS safety test: hex code
3690 !! input
3691 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3692 !! result
3693 <div>evil</div>
3695 !! end
3697 !! test
3698 MSIE CSS safety test: comment in url
3699 !! input
3700 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3701 !! result
3702 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3704 !! end
3706 !! test
3707 MSIE CSS safety test: comment in expression
3708 !! input
3709 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3710 !! result
3711 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3713 !! end
3716 !! test
3717 Table attribute legitimate extension
3718 !! input
3720 !+ style="<nowiki>color:blue</nowiki>"| status
3722 !! result
3723 <table>
3724 <tr>
3725 <th style="color:blue"> status
3726 </th></tr></table>
3728 !!end
3730 !! test
3731 Table attribute safety
3732 !! input
3734 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3736 !! result
3737 <table>
3738 <tr>
3739 <th> status
3740 </th></tr></table>
3742 !! end
3745 !! article
3746 Template:Identity
3747 !! text
3748 {{{1}}}
3749 !! endarticle
3751 !! test
3752 Expansion of multi-line templates in attribute values (bug 6255)
3753 !! input
3754 <div style="background: {{identity|#00FF00}}">-</div>
3755 !! result
3756 <div style="background: #00FF00">-</div>
3758 !! end
3761 !! test
3762 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3763 !! input
3764 <div style="background: 
3765 #00FF00">-</div>
3766 !! result
3767 <div style="background: #00FF00">-</div>
3769 !! end
3771 !! test
3772 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3773 !! input
3774 <div style="background: &#10;#00FF00">-</div>
3775 !! result
3776 <div style="background: &#10;#00FF00">-</div>
3778 !! end
3781 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3783 !! test
3784 Parser hook: empty input
3785 !! input
3786 <tag></tag>
3787 !! result
3788 <pre>
3789 string(0) ""
3790 array(0) {
3792 </pre>
3794 !! end
3796 !! test
3797 Parser hook: empty input using terminated empty elements
3798 !! input
3799 <tag/>
3800 !! result
3801 <pre>
3802 NULL
3803 array(0) {
3805 </pre>
3807 !! end
3809 !! test
3810 Parser hook: empty input using terminated empty elements (space before)
3811 !! input
3812 <tag />
3813 !! result
3814 <pre>
3815 NULL
3816 array(0) {
3818 </pre>
3820 !! end
3822 !! test
3823 Parser hook: basic input
3824 !! input
3825 <tag>input</tag>
3826 !! result
3827 <pre>
3828 string(5) "input"
3829 array(0) {
3831 </pre>
3833 !! end
3836 !! test
3837 Parser hook: case insensetive
3838 !! input
3839 <TAG>input</TAG>
3840 !! result
3841 <pre>
3842 string(5) "input"
3843 array(0) {
3845 </pre>
3847 !! end
3850 !! test
3851 Parser hook: case insensetive, redux
3852 !! input
3853 <TaG>input</TAg>
3854 !! result
3855 <pre>
3856 string(5) "input"
3857 array(0) {
3859 </pre>
3861 !! end
3863 !! test
3864 Parser hook: nested tags
3865 !! options
3866 noxml
3867 !! input
3868 <tag><tag></tag></tag>
3869 !! result
3870 <pre>
3871 string(5) "<tag>"
3872 array(0) {
3874 </pre>&lt;/tag&gt;
3876 !! end
3878 !! test
3879 Parser hook: basic arguments
3880 !! input
3881 <tag width=200 height = "100" depth = '50' square></tag>
3882 !! result
3883 <pre>
3884 string(0) ""
3885 array(4) {
3886   ["width"]=>
3887   string(3) "200"
3888   ["height"]=>
3889   string(3) "100"
3890   ["depth"]=>
3891   string(2) "50"
3892   ["square"]=>
3893   string(6) "square"
3895 </pre>
3897 !! end
3899 !! test
3900 Parser hook: argument containing a forward slash (bug 5344)
3901 !! input
3902 <tag filename='/tmp/bla'></tag>
3903 !! result
3904 <pre>
3905 string(0) ""
3906 array(1) {
3907   ["filename"]=>
3908   string(8) "/tmp/bla"
3910 </pre>
3912 !! end
3914 !! test
3915 Parser hook: empty input using terminated empty elements (bug 2374)
3916 !! input
3917 <tag foo=bar/>text
3918 !! result
3919 <pre>
3920 NULL
3921 array(1) {
3922   ["foo"]=>
3923   string(3) "bar"
3925 </pre>text
3927 !! end
3929 # </tag> should be output literally since there is no matching tag that begins it
3930 !! test
3931 Parser hook: basic arguments using terminated empty elements (bug 2374)
3932 !! input
3933 <tag width=200 height = "100" depth = '50' square/>
3934 other stuff
3935 </tag>
3936 !! result
3937 <pre>
3938 NULL
3939 array(4) {
3940   ["width"]=>
3941   string(3) "200"
3942   ["height"]=>
3943   string(3) "100"
3944   ["depth"]=>
3945   string(2) "50"
3946   ["square"]=>
3947   string(6) "square"
3949 </pre>
3950 <p>other stuff
3951 &lt;/tag&gt;
3952 </p>
3953 !! end
3956 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
3959 !! test
3960 Parser hook: static parser hook not inside a comment
3961 !! input
3962 <statictag>hello, world</statictag>
3963 <statictag action=flush/>
3964 !! result
3965 <p>hello, world
3966 </p>
3967 !! end
3970 !! test
3971 Parser hook: static parser hook inside a comment
3972 !! input
3973 <!-- <statictag>hello, world</statictag> -->
3974 <statictag action=flush/>
3975 !! result
3976 <p><br />
3977 </p>
3978 !! end
3980 # Nested template calls; this case was broken by Parser.php rev 1.506,
3981 # since reverted.
3983 !! article
3984 Template:One-parameter
3985 !! text
3986 (My parameter is: {{{1}}})
3987 !! endarticle
3989 !! article
3990 Template:Map-one-parameter
3991 !! text
3992 {{{{{1}}}|{{{2}}}}}
3993 !! endarticle
3995 !! test
3996 Nested template calls
3997 !! input
3998 {{Map-one-parameter|One-parameter|param}}
3999 !! result
4000 <p>(My parameter is: param)
4001 </p>
4002 !! end
4006 ### Sanitizer
4008 !! test
4009 Sanitizer: Closing of open tags
4010 !! input
4011 <s></s><table></table>
4012 !! result
4013 <s></s><table></table>
4015 !! end
4017 !! test
4018 Sanitizer: Closing of open but not closed tags
4019 !! input
4020 <s>foo
4021 !! result
4022 <p><s>foo</s>
4023 </p>
4024 !! end
4026 !! test
4027 Sanitizer: Closing of closed but not open tags
4028 !! input
4029 </s>
4030 !! result
4031 <p>&lt;/s&gt;
4032 </p>
4033 !! end
4035 !! test
4036 Sanitizer: Closing of closed but not open table tags
4037 !! input
4038 Table not started</td></tr></table>
4039 !! result
4040 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4041 </p>
4042 !! end
4044 !! test
4045 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4046 !! input
4047 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4048 !! result
4049 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4050 </p>
4051 !! end
4053 !! test
4054 Sanitizer: Validating the contents of the id attribute (bug 4515)
4055 !! options
4056 disabled
4057 !! input
4058 <br id=9 />
4059 !! result
4060 Something, but defenetly not <br id="9" />...
4061 !! end
4063 !! test
4064 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4065 !! options
4066 disabled
4067 !! input
4068 <br id="foo" /><br id="foo" />
4069 !! result
4070 Something need to be done. foo-2 ? 
4071 !! end
4073 !! test
4074 Language converter: output gets cut off unexpectedly (bug 5757)
4075 !! options
4076 language=zh
4077 !! input
4078 this bit is safe: }-
4080 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4082 then we get cut off here: }-
4084 all additional text is vanished
4085 !! result
4086 <p>this bit is safe: }-
4087 </p><p>but if we add a conversion instance: xxx
4088 </p><p>then we get cut off here: }-
4089 </p><p>all additional text is vanished
4090 </p>
4091 !! end
4093 !! test
4094 Self closed html pairs (bug 5487)
4095 !! options
4096 !! input
4097 <center><font id="bug" />Centered text</center>
4098 <div><font id="bug2" />In div text</div>
4099 !! result
4100 <center>&lt;font id="bug" /&gt;Centered text</center>
4101 <div>&lt;font id="bug2" /&gt;In div text</div>
4103 !! end
4109 !! test
4110 HTML bullet list, closed tags (bug 5497)
4111 !! input
4112 <ul>
4113 <li>One</li>
4114 <li>Two</li>
4115 </ul>
4116 !! result
4117 <ul>
4118 <li>One</li>
4119 <li>Two</li>
4120 </ul>
4122 !! end
4124 !! test
4125 HTML bullet list, unclosed tags (bug 5497)
4126 !! input
4127 <ul>
4128 <li>One
4129 <li>Two
4130 </ul>
4131 !! result
4132 <ul>
4133 <li>One
4134 </li><li>Two
4135 </li></ul>
4137 !! end
4139 !! test
4140 HTML ordered list, closed tags (bug 5497)
4141 !! input
4142 <ol>
4143 <li>One</li>
4144 <li>Two</li>
4145 </ol>
4146 !! result
4147 <ol>
4148 <li>One</li>
4149 <li>Two</li>
4150 </ol>
4152 !! end
4154 !! test
4155 HTML ordered list, unclosed tags (bug 5497)
4156 !! input
4157 <ol>
4158 <li>One
4159 <li>Two
4160 </ol>
4161 !! result
4162 <ol>
4163 <li>One
4164 </li><li>Two
4165 </li></ol>
4167 !! end
4169 !! test
4170 HTML nested bullet list, closed tags (bug 5497)
4171 !! input
4172 <ul>
4173 <li>One</li>
4174 <li>Two:
4175 <ul>
4176 <li>Sub-one</li>
4177 <li>Sub-two</li>
4178 </ul>
4179 </li>
4180 </ul>
4181 !! result
4182 <ul>
4183 <li>One</li>
4184 <li>Two:
4185 <ul>
4186 <li>Sub-one</li>
4187 <li>Sub-two</li>
4188 </ul>
4189 </li>
4190 </ul>
4192 !! end
4194 !! test
4195 HTML nested bullet list, open tags (bug 5497)
4196 !! input
4197 <ul>
4198 <li>One
4199 <li>Two:
4200 <ul>
4201 <li>Sub-one
4202 <li>Sub-two
4203 </ul>
4204 </ul>
4205 !! result
4206 <ul>
4207 <li>One
4208 </li><li>Two:
4209 <ul>
4210 <li>Sub-one
4211 </li><li>Sub-two
4212 </li></ul>
4213 </li></ul>
4215 !! end
4217 !! test
4218 HTML nested ordered list, closed tags (bug 5497)
4219 !! input
4220 <ol>
4221 <li>One</li>
4222 <li>Two:
4223 <ol>
4224 <li>Sub-one</li>
4225 <li>Sub-two</li>
4226 </ol>
4227 </li>
4228 </ol>
4229 !! result
4230 <ol>
4231 <li>One</li>
4232 <li>Two:
4233 <ol>
4234 <li>Sub-one</li>
4235 <li>Sub-two</li>
4236 </ol>
4237 </li>
4238 </ol>
4240 !! end
4242 !! test
4243 HTML nested ordered list, open tags (bug 5497)
4244 !! input
4245 <ol>
4246 <li>One
4247 <li>Two:
4248 <ol>
4249 <li>Sub-one
4250 <li>Sub-two
4251 </ol>
4252 </ol>
4253 !! result
4254 <ol>
4255 <li>One
4256 </li><li>Two:
4257 <ol>
4258 <li>Sub-one
4259 </li><li>Sub-two
4260 </li></ol>
4261 </li></ol>
4263 !! end
4265 !! test
4266 HTML ordered list item with parameters oddity
4267 !! input
4268 <ol><li id="fragment">One</li></ol>
4269 !! result
4270 <ol><li id="fragment">One</li></ol>
4272 !! end
4274 !!test
4275 bug 5918: autonumbering
4276 !! input
4277 [http://first/] [http://second] [ftp://ftp]
4279 ftp://inlineftp
4281 [mailto:enclosed@mail.tld With target]
4283 [mailto:enclosed@mail.tld]
4285 mailto:inline@mail.tld
4286 !! result
4287 <p><a href="http://first/" class="external autonumber" title="http://first/" rel="nofollow">[1]</a> <a href="http://second" class="external autonumber" title="http://second" rel="nofollow">[2]</a> <a href="ftp://ftp" class="external autonumber" title="ftp://ftp" rel="nofollow">[3]</a>
4288 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4289 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4290 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4291 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4292 </p>
4293 !! end
4297 # Security and HTML correctness
4298 # From Nick Jenkins' fuzz testing
4301 !! test
4302 Fuzz testing: Parser13
4303 !! input
4304 {| 
4305 | http://a|
4306 !! result
4307 <table>
4308 <tr>
4309 <td>
4310 </td>
4311 </tr>
4312 </table>
4314 !! end
4316 !! test
4317 Fuzz testing: Parser14
4318 !! input
4319 == onmouseover= ==
4320 http://__TOC__
4321 !! result
4322 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</div><a name="onmouseover.3D"></a><h2> onmouseover= </h2>
4323 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4324 <ul>
4325 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4326 </ul>
4327 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4329 !! end
4331 !! test
4332 Fuzz testing: Parser14-table
4333 !! input
4334 ==a==
4335 {| STYLE=__TOC__
4336 !! result
4337 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</div><a name="a"></a><h2>a</h2>
4338 <table style="&#95;_TOC&#95;_">
4339 <tr><td></td></tr>
4340 </table>
4342 !! end
4344 # Known to produce bogus xml (extra </td>)
4345 !! test
4346 Fuzz testing: Parser16
4347 !! options
4348 noxml
4349 !! input
4351 !https://||||||
4352 !! result
4353 <table>
4354 <tr>
4355 <th>https://</th><th></th><th></th><th>
4356 </td>
4357 </tr>
4358 </table>
4360 !! end
4362 !! test
4363 Fuzz testing: Parser21
4364 !! input
4366 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4368 !! result
4369 <table>
4370 <tr>
4371 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4372 </th><td>
4373 </td>
4374 </tr>
4375 </table>
4377 !! end
4379 !! test
4380 Fuzz testing: Parser22
4381 !! input
4382 http://===r:::https://b
4385 !!result
4386 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4387 </p>
4388 <table>
4389 <tr><td></td></tr>
4390 </table>
4392 !! end
4394 # Known to produce bad XML for now
4395 !! test
4396 Fuzz testing: Parser24
4397 !! options
4398 noxml
4399 !! input
4401 {{{|
4402 <u CLASS=
4403 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4404 <br style="onmouseover='alert(document.cookie);' " />
4406 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4408 !! result
4409 <table>
4411 <u class="&#124;">} &gt;
4412 <br style="onmouseover='alert(document.cookie);'" />
4414 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4415 <tr>
4416 <td></u>
4417 </td>
4418 </tr>
4419 </table>
4421 !! end
4423 # Known to produce bad XML for now
4424 !!test
4425 Fuzz testing: Parser25 (bug 6055)
4426 !! options
4427 noxml
4428 !! input
4431 <LI CLASS=||
4433 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4434 !! result
4435 <li class="&#124;&#124;">
4436 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4438 !! end
4440 !!test
4441 Fuzz testing: URL adjacent extension (with space, clean)
4442 !! options
4443 !! input
4444 http://example.com <nowiki>junk</nowiki>
4445 !! result
4446 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
4447 </p>
4448 !!end
4450 !!test
4451 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4452 !! options
4453 !! input
4454 http://example.com<nowiki>junk</nowiki>
4455 !! result
4456 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
4457 </p>
4458 !!end
4460 !!test
4461 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4462 !! options
4463 !! input
4464 http://example.com<pre>junk</pre>
4465 !! result
4466 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4468 !!end
4470 !!test
4471 Fuzz testing: image with bogus manual thumbnail
4472 !!input
4473 [[Image:foobar.jpg|thumbnail= ]]
4474 !!result
4475 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="180" height="-1" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div></div></div></div>
4477 !!end
4479 !! test
4480 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
4481 !! input
4482 <pre dir="&#10;"></pre>
4483 !! result
4484 <pre dir="&#10;"></pre>
4486 !! end
4488 !! test
4489 Parsing optional HTML elements (Bug 6171)
4490 !! options
4491 !! input
4492 <table>
4493   <tr>
4494     <td> Some tabular data</td>
4495     <td> More tabular data ...
4496     <td> And yet som tabular data</td>
4497   </tr>
4498 </table>
4499 !! result
4500 <table>
4501   <tr>
4502     <td> Some tabular data</td>
4503     <td> More tabular data ...
4504     </td><td> And yet som tabular data</td>
4505   </tr>
4506 </table>
4508 !! end
4510 !! test
4511 Correct handling of <td>, <tr> (Bug 6171)
4512 !! options
4513 !! input
4514 <table>
4515   <tr>
4516     <td> Some tabular data</td>
4517     <td> More tabular data ...</td>
4518     <td> And yet som tabular data</td>
4519   </tr>
4520 </table>
4521 !! result
4522 <table>
4523   <tr>
4524     <td> Some tabular data</td>
4525     <td> More tabular data ...</td>
4526     <td> And yet som tabular data</td>
4527   </tr>
4528 </table>
4530 !! end
4533 !! test
4534 Parsing crashing regression (fr:JavaScript)
4535 !! input
4536 </body></x>
4537 !! result
4538 <p>&lt;/body&gt;&lt;/x&gt;
4539 </p>
4540 !! end
4542 !! test
4543 Inline wiki vs wiki block nesting
4544 !! input
4545 '''Bold paragraph
4547 New wiki paragraph
4548 !! result
4549 <p><b>Bold paragraph</b>
4550 </p><p>New wiki paragraph
4551 </p>
4552 !! end
4554 !! test
4555 Inline HTML vs wiki block nesting
4556 !! input
4557 <b>Bold paragraph
4559 New wiki paragraph
4560 !! result
4561 <p><b>Bold paragraph</b>
4562 </p><p>New wiki paragraph
4563 </p>
4564 !! end
4567 !!test
4568 Mixing markup for italics and bold
4569 !! options
4570 !! input
4571 '''bold''''''bold''bolditalics'''''
4572 !! result
4573 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4574 </p>
4575 !! end
4578 !! article
4579 Xyzzyx
4580 !! text
4581 Article for special page transclusion test
4582 !! endarticle
4584 !! test
4585 Special page transclusion
4586 !! options
4587 !! input
4588 {{Special:Prefixindex/Xyzzyx}}
4589 !! result
4590 <p><br />
4591 </p>
4592 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4594 !! end
4596 !! test
4597 Special page transclusion twice (bug 5021)
4598 !! options
4599 !! input
4600 {{Special:Prefixindex/Xyzzyx}}
4601 {{Special:Prefixindex/Xyzzyx}}
4602 !! result
4603 <p><br />
4604 </p>
4605 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4606 <p><br />
4607 </p>
4608 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4610 !! end
4612 !! test
4613 Invalid header with following text
4614 !! input
4615 = x = y
4616 !! result
4617 <p>= x = y
4618 </p>
4619 !! end
4622 !! test
4623 Section extraction test (section 0)
4624 !! options
4625 section=0
4626 !! input
4627 start
4628 ==a==
4629 ===aa===
4630 ====aaa====
4631 ==b==
4632 ===ba===
4633 ===bb===
4634 ====bba====
4635 ===bc===
4636 ==c==
4637 ===ca===
4638 !! result
4639 start
4640 !! end
4642 !! test
4643 Section extraction test (section 1)
4644 !! options
4645 section=1
4646 !! input
4647 start
4648 ==a==
4649 ===aa===
4650 ====aaa====
4651 ==b==
4652 ===ba===
4653 ===bb===
4654 ====bba====
4655 ===bc===
4656 ==c==
4657 ===ca===
4658 !! result
4659 ==a==
4660 ===aa===
4661 ====aaa====
4662 !! end
4664 !! test
4665 Section extraction test (section 2)
4666 !! options
4667 section=2
4668 !! input
4669 start
4670 ==a==
4671 ===aa===
4672 ====aaa====
4673 ==b==
4674 ===ba===
4675 ===bb===
4676 ====bba====
4677 ===bc===
4678 ==c==
4679 ===ca===
4680 !! result
4681 ===aa===
4682 ====aaa====
4683 !! end
4685 !! test
4686 Section extraction test (section 3)
4687 !! options
4688 section=3
4689 !! input
4690 start
4691 ==a==
4692 ===aa===
4693 ====aaa====
4694 ==b==
4695 ===ba===
4696 ===bb===
4697 ====bba====
4698 ===bc===
4699 ==c==
4700 ===ca===
4701 !! result
4702 ====aaa====
4703 !! end
4705 !! test
4706 Section extraction test (section 4)
4707 !! options
4708 section=4
4709 !! input
4710 start
4711 ==a==
4712 ===aa===
4713 ====aaa====
4714 ==b==
4715 ===ba===
4716 ===bb===
4717 ====bba====
4718 ===bc===
4719 ==c==
4720 ===ca===
4721 !! result
4722 ==b==
4723 ===ba===
4724 ===bb===
4725 ====bba====
4726 ===bc===
4727 !! end
4729 !! test
4730 Section extraction test (section 5)
4731 !! options
4732 section=5
4733 !! input
4734 start
4735 ==a==
4736 ===aa===
4737 ====aaa====
4738 ==b==
4739 ===ba===
4740 ===bb===
4741 ====bba====
4742 ===bc===
4743 ==c==
4744 ===ca===
4745 !! result
4746 ===ba===
4747 !! end
4749 !! test
4750 Section extraction test (section 6)
4751 !! options
4752 section=6
4753 !! input
4754 start
4755 ==a==
4756 ===aa===
4757 ====aaa====
4758 ==b==
4759 ===ba===
4760 ===bb===
4761 ====bba====
4762 ===bc===
4763 ==c==
4764 ===ca===
4765 !! result
4766 ===bb===
4767 ====bba====
4768 !! end
4770 !! test
4771 Section extraction test (section 7)
4772 !! options
4773 section=7
4774 !! input
4775 start
4776 ==a==
4777 ===aa===
4778 ====aaa====
4779 ==b==
4780 ===ba===
4781 ===bb===
4782 ====bba====
4783 ===bc===
4784 ==c==
4785 ===ca===
4786 !! result
4787 ====bba====
4788 !! end
4790 !! test
4791 Section extraction test (section 8)
4792 !! options
4793 section=8
4794 !! input
4795 start
4796 ==a==
4797 ===aa===
4798 ====aaa====
4799 ==b==
4800 ===ba===
4801 ===bb===
4802 ====bba====
4803 ===bc===
4804 ==c==
4805 ===ca===
4806 !! result
4807 ===bc===
4808 !! end
4810 !! test
4811 Section extraction test (section 9)
4812 !! options
4813 section=9
4814 !! input
4815 start
4816 ==a==
4817 ===aa===
4818 ====aaa====
4819 ==b==
4820 ===ba===
4821 ===bb===
4822 ====bba====
4823 ===bc===
4824 ==c==
4825 ===ca===
4826 !! result
4827 ==c==
4828 ===ca===
4829 !! end
4831 !! test
4832 Section extraction test (section 10)
4833 !! options
4834 section=10
4835 !! input
4836 start
4837 ==a==
4838 ===aa===
4839 ====aaa====
4840 ==b==
4841 ===ba===
4842 ===bb===
4843 ====bba====
4844 ===bc===
4845 ==c==
4846 ===ca===
4847 !! result
4848 ===ca===
4849 !! end
4851 !! test
4852 Section extraction test (nonexistent section 11)
4853 !! options
4854 section=11
4855 !! input
4856 start
4857 ==a==
4858 ===aa===
4859 ====aaa====
4860 ==b==
4861 ===ba===
4862 ===bb===
4863 ====bba====
4864 ===bc===
4865 ==c==
4866 ===ca===
4867 !! result
4868 !! end
4870 !! test
4871 Section extraction test with bogus heading (section 1)
4872 !! options
4873 section=1
4874 !! input
4875 ==a==
4876 ==bogus== not a legal section
4877 ==b==
4878 !! result
4879 ==a==
4880 ==bogus== not a legal section
4881 !! end
4883 !! test
4884 Section extraction test with bogus heading (section 2)
4885 !! options
4886 section=2
4887 !! input
4888 ==a==
4889 ==bogus== not a legal section
4890 ==b==
4891 !! result
4892 ==b==
4893 !! end
4895 !! test
4896 Section extraction test with comment after heading (section 1)
4897 !! options
4898 section=1
4899 !! input
4900 ==a==
4901 ==legal== <!-- a legal section -->
4902 ==b==
4903 !! result
4904 ==a==
4905 !! end
4907 !! test
4908 Section extraction test with comment after heading (section 2)
4909 !! options
4910 section=2
4911 !! input
4912 ==a==
4913 ==legal== <!-- a legal section -->
4914 ==b==
4915 !! result
4916 ==legal== <!-- a legal section -->
4917 !! end
4919 !! test
4920 Section extraction test with bogus <nowiki> heading (section 1)
4921 !! options
4922 section=1
4923 !! input
4924 ==a==
4925 ==bogus== <nowiki>not a legal section</nowiki>
4926 ==b==
4927 !! result
4928 ==a==
4929 ==bogus== <nowiki>not a legal section</nowiki>
4930 !! end
4932 !! test
4933 Section extraction test with bogus <nowiki> heading (section 2)
4934 !! options
4935 section=2
4936 !! input
4937 ==a==
4938 ==bogus== <nowiki>not a legal section</nowiki>
4939 ==b==
4940 !! result
4941 ==b==
4942 !! end
4945 !! test
4946 Section extraction prefixed by comment (section 1) (bug 2587)
4947 !! options
4948 section=1
4949 !! input
4950 <!-- -->==sec1==
4951 ==sec2==
4952 !!result
4953 <!-- -->==sec1==
4954 !!end
4956 !! test
4957 Section extraction prefixed by comment (section 2) (bug 2587)
4958 !! options
4959 section=2
4960 !! input
4961 <!-- -->==sec1==
4962 ==sec2==
4963 !!result
4964 ==sec2==
4965 !!end
4968 !! test
4969 Section extraction, mixed wiki and html (section 1) (bug 2607)
4970 !! options
4971 section=1
4972 !! input
4973 <h2>1</h2>
4975 ==2==
4977 ==3==
4978 three
4979 !! result
4980 <h2>1</h2>
4982 !! end
4984 !! test
4985 Section extraction, mixed wiki and html (section 2) (bug 2607)
4986 !! options
4987 section=2
4988 !! input
4989 <h2>1</h2>
4991 ==2==
4993 ==3==
4994 three
4995 !! result
4996 ==2==
4998 !! end
5001 !! test
5002 Section extraction, heading surrounded by <noinclude> (bug 3342)
5003 !! options
5004 section=1
5005 !! input
5006 <noinclude>==a==</noinclude>
5007 text
5008 !! result
5009 <noinclude>==a==</noinclude>
5010 text
5011 !!end
5014 !! test
5015 Section extraction, HTML heading subsections (bug 5272)
5016 !! options
5017 section=1
5018 !! input
5019 <h2>a</h2>
5020 <h3>aa</h3>
5021 <h2>b</h2>
5022 !! result
5023 <h2>a</h2>
5024 <h3>aa</h3>
5025 !! end
5027 !! test
5028 Section extraction, HTML headings should be ignored in extensions (bug 3476)
5029 !! options
5030 section=2
5031 !! input
5032 <h2>a</h2>
5033 <tag>
5034 <h2>not b</h2>
5035 </tag>
5036 <h2>b</h2>
5037 !! result
5038 <h2>b</h2>
5039 !! end
5041 !! test
5042 Section replacement test (section 0)
5043 !! options
5044 replace=0,"xxx"
5045 !! input
5046 start
5047 ==a==
5048 ===aa===
5049 ====aaa====
5050 ==b==
5051 ===ba===
5052 ===bb===
5053 ====bba====
5054 ===bc===
5055 ==c==
5056 ===ca===
5057 !! result
5060 ==a==
5061 ===aa===
5062 ====aaa====
5063 ==b==
5064 ===ba===
5065 ===bb===
5066 ====bba====
5067 ===bc===
5068 ==c==
5069 ===ca===
5070 !! end
5072 !! test
5073 Section replacement test (section 1)
5074 !! options
5075 replace=1,"xxx"
5076 !! input
5077 start
5078 ==a==
5079 ===aa===
5080 ====aaa====
5081 ==b==
5082 ===ba===
5083 ===bb===
5084 ====bba====
5085 ===bc===
5086 ==c==
5087 ===ca===
5088 !! result
5089 start
5092 ==b==
5093 ===ba===
5094 ===bb===
5095 ====bba====
5096 ===bc===
5097 ==c==
5098 ===ca===
5099 !! end
5101 !! test
5102 Section replacement test (section 2)
5103 !! options
5104 replace=2,"xxx"
5105 !! input
5106 start
5107 ==a==
5108 ===aa===
5109 ====aaa====
5110 ==b==
5111 ===ba===
5112 ===bb===
5113 ====bba====
5114 ===bc===
5115 ==c==
5116 ===ca===
5117 !! result
5118 start
5119 ==a==
5122 ==b==
5123 ===ba===
5124 ===bb===
5125 ====bba====
5126 ===bc===
5127 ==c==
5128 ===ca===
5129 !! end
5131 !! test
5132 Section replacement test (section 3)
5133 !! options
5134 replace=3,"xxx"
5135 !! input
5136 start
5137 ==a==
5138 ===aa===
5139 ====aaa====
5140 ==b==
5141 ===ba===
5142 ===bb===
5143 ====bba====
5144 ===bc===
5145 ==c==
5146 ===ca===
5147 !! result
5148 start
5149 ==a==
5150 ===aa===
5153 ==b==
5154 ===ba===
5155 ===bb===
5156 ====bba====
5157 ===bc===
5158 ==c==
5159 ===ca===
5160 !! end
5162 !! test
5163 Section replacement test (section 4)
5164 !! options
5165 replace=4,"xxx"
5166 !! input
5167 start
5168 ==a==
5169 ===aa===
5170 ====aaa====
5171 ==b==
5172 ===ba===
5173 ===bb===
5174 ====bba====
5175 ===bc===
5176 ==c==
5177 ===ca===
5178 !! result
5179 start
5180 ==a==
5181 ===aa===
5182 ====aaa====
5185 ==c==
5186 ===ca===
5187 !! end
5189 !! test
5190 Section replacement test (section 5)
5191 !! options
5192 replace=5,"xxx"
5193 !! input
5194 start
5195 ==a==
5196 ===aa===
5197 ====aaa====
5198 ==b==
5199 ===ba===
5200 ===bb===
5201 ====bba====
5202 ===bc===
5203 ==c==
5204 ===ca===
5205 !! result
5206 start
5207 ==a==
5208 ===aa===
5209 ====aaa====
5210 ==b==
5213 ===bb===
5214 ====bba====
5215 ===bc===
5216 ==c==
5217 ===ca===
5218 !! end
5220 !! test
5221 Section replacement test (section 6)
5222 !! options
5223 replace=6,"xxx"
5224 !! input
5225 start
5226 ==a==
5227 ===aa===
5228 ====aaa====
5229 ==b==
5230 ===ba===
5231 ===bb===
5232 ====bba====
5233 ===bc===
5234 ==c==
5235 ===ca===
5236 !! result
5237 start
5238 ==a==
5239 ===aa===
5240 ====aaa====
5241 ==b==
5242 ===ba===
5245 ===bc===
5246 ==c==
5247 ===ca===
5248 !! end
5250 !! test
5251 Section replacement test (section 7)
5252 !! options
5253 replace=7,"xxx"
5254 !! input
5255 start
5256 ==a==
5257 ===aa===
5258 ====aaa====
5259 ==b==
5260 ===ba===
5261 ===bb===
5262 ====bba====
5263 ===bc===
5264 ==c==
5265 ===ca===
5266 !! result
5267 start
5268 ==a==
5269 ===aa===
5270 ====aaa====
5271 ==b==
5272 ===ba===
5273 ===bb===
5276 ===bc===
5277 ==c==
5278 ===ca===
5279 !! end
5281 !! test
5282 Section replacement test (section 8)
5283 !! options
5284 replace=8,"xxx"
5285 !! input
5286 start
5287 ==a==
5288 ===aa===
5289 ====aaa====
5290 ==b==
5291 ===ba===
5292 ===bb===
5293 ====bba====
5294 ===bc===
5295 ==c==
5296 ===ca===
5297 !! result
5298 start
5299 ==a==
5300 ===aa===
5301 ====aaa====
5302 ==b==
5303 ===ba===
5304 ===bb===
5305 ====bba====
5308 ==c==
5309 ===ca===
5310 !!end
5312 !! test
5313 Section replacement test (section 9)
5314 !! options
5315 replace=9,"xxx"
5316 !! input
5317 start
5318 ==a==
5319 ===aa===
5320 ====aaa====
5321 ==b==
5322 ===ba===
5323 ===bb===
5324 ====bba====
5325 ===bc===
5326 ==c==
5327 ===ca===
5328 !! result
5329 start
5330 ==a==
5331 ===aa===
5332 ====aaa====
5333 ==b==
5334 ===ba===
5335 ===bb===
5336 ====bba====
5337 ===bc===
5339 !! end
5341 !! test
5342 Section replacement test (section 10)
5343 !! options
5344 replace=10,"xxx"
5345 !! input
5346 start
5347 ==a==
5348 ===aa===
5349 ====aaa====
5350 ==b==
5351 ===ba===
5352 ===bb===
5353 ====bba====
5354 ===bc===
5355 ==c==
5356 ===ca===
5357 !! result
5358 start
5359 ==a==
5360 ===aa===
5361 ====aaa====
5362 ==b==
5363 ===ba===
5364 ===bb===
5365 ====bba====
5366 ===bc===
5367 ==c==
5369 !! end
5372 !! test
5373 Section extraction, HTML headings not at line boundaries (section 0)
5374 !! options
5375 section=0
5376 !! input
5377 <h2>Evil</h2><i>blah blah blah</i>
5379 evil blah
5381 <h2>Nice</h2>
5383 nice blah
5385 <i>extra evil</i><h2>Extra nasty</h2>
5387 extra nasty
5388 !! result
5389 !! end
5391 !! test
5392 Section extraction, HTML headings not at line boundaries (section 1)
5393 !! options
5394 section=1
5395 !! input
5396 <h2>Evil</h2><i>blah blah blah</i>
5398 evil blah
5400 <h2>Nice</h2>
5402 nice blah
5404 <i>extra evil</i><h2>Extra nasty</h2>
5406 extra nasty
5407 !! result
5408 <h2>Evil</h2><i>blah blah blah</i>
5410 evil blah
5411 !! end
5413 !! test
5414 Section extraction, HTML headings not at line boundaries (section 2)
5415 !! options
5416 section=2
5417 !! input
5418 <h2>Evil</h2><i>blah blah blah</i>
5420 evil blah
5422 <h2>Nice</h2>
5424 nice blah
5426 <i>extra evil</i><h2>Extra nasty</h2>
5428 extra nasty
5429 !! result
5430 <h2>Nice</h2>
5432 nice blah
5434 <i>extra evil</i>
5435 !! end
5437 !! test
5438 Section extraction, HTML headings not at line boundaries (section 3)
5439 !! options
5440 section=3
5441 !! input
5442 <h2>Evil</h2><i>blah blah blah</i>
5444 evil blah
5446 <h2>Nice</h2>
5448 nice blah
5450 <i>extra evil</i><h2>Extra nasty</h2>
5452 extra nasty
5453 !! result
5454 <h2>Extra nasty</h2>
5456 extra nasty
5457 !! end
5460 !! test
5461 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5462 !! options
5463 section=1
5464 !! input
5465 ==a==
5466                     a
5467 !! result
5468 ==a==
5469                     a
5470 !! end
5472 !! test
5473 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5474 !! options
5475 section=1
5476 !! input
5477 ==a==
5478                    a
5479 !! result
5480 ==a==
5481                    a
5482 !! end
5484 !! test
5485 Handling of &#x0A; in URLs
5486 !! input
5487 **irc://&#x0A;a
5488 !! result
5489 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
5490 </li></ul>
5491 </li></ul>
5493 !!end
5495 !! test
5496 5 quotes, code coverage +1 line
5497 !! input
5498 '''''
5499 !! result
5500 !! end
5502 !! test
5503 Special:Search page linking.
5504 !! input
5505 {{Special:search}}
5506 !! result
5507 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
5508 </p>
5509 !! end
5511 !! test
5512 Say the magic word
5513 !! input
5514 * {{PAGENAME}}
5515 * {{BASEPAGENAME}}
5516 * {{SUBPAGENAME}}
5517 * {{SUBPAGENAMEE}}
5518 * {{BASEPAGENAME}}
5519 * {{BASEPAGENAMEE}}
5520 * {{TALKPAGENAME}}
5521 * {{TALKPAGENAMEE}}
5522 * {{SUBJECTPAGENAME}}
5523 * {{SUBJECTPAGENAMEE}}
5524 * {{NAMESPACEE}}
5525 * {{NAMESPACE}}
5526 * {{TALKSPACE}}
5527 * {{TALKSPACEE}}
5528 * {{SUBJECTSPACE}}
5529 * {{SUBJECTSPACEE}}
5530 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
5531 !! result
5532 <ul><li> Parser test
5533 </li><li> Parser test
5534 </li><li> Parser test
5535 </li><li> Parser_test
5536 </li><li> Parser test
5537 </li><li> Parser_test
5538 </li><li> Talk:Parser test
5539 </li><li> Talk:Parser_test
5540 </li><li> Parser test
5541 </li><li> Parser_test
5542 </li><li> 
5543 </li><li> 
5544 </li><li> Talk
5545 </li><li> Talk
5546 </li><li> 
5547 </li><li> 
5548 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit" class="new" title="Template:Dynamic">Template:Dynamic</a>
5549 </li></ul>
5551 !! end
5552 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
5554 !! test
5555 Gallery
5556 !! input
5557 <gallery>
5558 image1.png |
5559 image2.gif|||||
5561 image3|
5562 image4    |300px| centre
5563  image5.svg| http://///////
5564 [[x|xx]]]]
5565 * image6
5566 </gallery>
5567 !! result
5568 <table class="gallery" cellspacing="0" cellpadding="0"><tr><td><div class="gallerybox"><div style="height: 152px;">Image1.png</div><div class="gallerytext">
5569 </div></div></td>
5570 <td><div class="gallerybox"><div style="height: 152px;">Image2.gif</div><div class="gallerytext">
5571 ||||</div></div></td>
5572 <td><div class="gallerybox"><div style="height: 152px;">Image3</div><div class="gallerytext">
5573 </div></div></td>
5574 <td><div class="gallerybox"><div style="height: 152px;">Image4</div><div class="gallerytext">
5575 300px| centre</div></div></td>
5576 </tr><tr><td><div class="gallerybox"><div style="height: 152px;">Image5.svg</div><div class="gallerytext">
5577  <a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a></div></div></td>
5578 <td><div class="gallerybox"><div style="height: 152px;">* image6</div><div class="gallerytext">
5579 </div></div></td>
5580 </tr>
5581 </table>
5583 !! end
5585 !! test
5586 HTML Hex character encoding.
5587 !! input
5588 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
5589 !! result
5590 <p>JavaScript
5591 </p>
5592 !! end
5594 !! test
5595 __FORCETOC__ override
5596 !! input 
5597 __NEWSECTIONLINK__
5598 __FORCETOC__
5599 !! result
5600 <p><br />
5601 </p>
5602 !! end
5604 !! test
5605 ISBN code coverage
5606 !! input
5607 ISBN  983&#x20;987
5608 !! result
5609 <p><a href="/index.php?title=Special:Booksources&amp;isbn=983" class="internal">ISBN 983</a>&#x20;987
5610 </p>
5611 !! end
5613 !! test
5614 ISBN followed by 5 spaces
5615 !! input
5616 ISBN    
5617 !! result
5618 <p>ISBN    
5619 </p>
5620 !! end
5622 !! test
5623 Double ISBN
5624 !! options
5625 disabled # Disabled until Bug 6560 resolved
5626 !! input
5627 ISBN ISBN 1234
5628 !! result
5629 <p>ISBN <a href="/wiki/index.php?title=Special:Booksources&amp;isbn=1234" class="internal">ISBN 1234</a>
5630 </p>
5631 !! end
5633 !! test
5634 Double RFC
5635 !! input
5636 RFC RFC 1234
5637 !! result
5638 <p>RFC <a href="http://www.ietf.org/rfc/rfc1234.txt" class="external" title="http://www.ietf.org/rfc/rfc1234.txt">RFC 1234</a>
5639 </p>
5640 !! end
5642 !! test
5643 Double RFC with a wiki link 
5644 !! input
5645 RFC [[RFC 1234
5646 !! result
5647 <p>RFC [[RFC 1234
5648 </p>
5649 !! end
5651 !! test
5652 RFC code coverage
5653 !! input
5654 RFC   983&#x20;987
5655 !! result
5656 <p><a href="http://www.ietf.org/rfc/rfc983.txt" class="external" title="http://www.ietf.org/rfc/rfc983.txt">RFC 983</a>&#x20;987
5657 </p>
5658 !! end
5660 !! test
5661 Centre-aligned image
5662 !! input
5663 [[Image:foobar.jpg|centre]]
5664 !! result
5665 <div class="center"><div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div></div>
5667 !!end
5669 !! test
5670 None-aligned image
5671 !! input
5672 [[Image:foobar.jpg|none]]
5673 !! result
5674 <div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
5676 !!end
5678 !! test
5679 Width + Height sized image (using px) (height is ignored)
5680 !! input
5681 [[Image:foobar.jpg|640x480px]]
5682 !! result
5683 <p><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" alt="" width="640" height="73" longdesc="/wiki/Image:Foobar.jpg" /></a>
5684 </p>
5685 !!end
5687 !! test
5688 Another italics / bold test
5689 !! input
5690  ''' ''x'
5691 !! result
5692 <pre>'<i> </i>x'
5693 </pre>
5694 !!end
5696 # Note the results may be incorrect, as parserTest output included this:
5697 # XML error: Mismatched tag at byte 6120:
5698 # ...<dd> </dt></dl> </dd...
5699 !! test
5700 dt/dd/dl test
5701 !! input
5702 :;;;::
5703 !! result
5704 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
5705 </dt></dl>
5706 </dd></dl>
5707 </dd></dl>
5708 </dd></dl>
5709 </dd></dl>
5710 </dd></dl>
5712 !!end
5718 TODO:
5719 more images
5720 more tables
5721 math
5722 character entities
5723 and much more
5724 Try for 100% code coverage