doxygen -s -u mwdoxgen.cfg :
[mediawiki.git] / maintenance / parserTests.txt
blobdd1a6c4c4eaa2ed1104cc7d9bbda8558fae541b1
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 #       variant=XXX     set the variant of language for this test (eg zh-tw)
23 #       disabled        do not run test
25 # For testing purposes, temporary articles can created:
26 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
27 # where '/' denotes a newline.
29 # This is the standard article assumed to exist.
30 !! article
31 Main Page
32 !! text
33 blah blah
34 !! endarticle
36 ###
37 ### Basic tests
38 ###
39 !! test
40 Blank input
41 !! input
42 !! result
43 !! end
46 !! test
47 Simple paragraph
48 !! input
49 This is a simple paragraph.
50 !! result
51 <p>This is a simple paragraph.
52 </p>
53 !! end
55 !! test
56 Simple list
57 !! input
58 * Item 1
59 * Item 2
60 !! result
61 <ul><li> Item 1
62 </li><li> Item 2
63 </li></ul>
65 !! end
67 !! test
68 Italics and bold
69 !! input
70 * plain
71 * plain''italic''plain
72 * plain''italic''plain''italic''plain
73 * plain'''bold'''plain
74 * plain'''bold'''plain'''bold'''plain
75 * plain''italic''plain'''bold'''plain
76 * plain'''bold'''plain''italic''plain
77 * plain''italic'''bold-italic'''italic''plain
78 * plain'''bold''bold-italic''bold'''plain
79 * plain'''''bold-italic'''italic''plain
80 * plain'''''bold-italic''bold'''plain
81 * plain''italic'''bold-italic'''''plain
82 * plain'''bold''bold-italic'''''plain
83 * plain l'''italic''plain
84 !! result
85 <ul><li> plain
86 </li><li> plain<i>italic</i>plain
87 </li><li> plain<i>italic</i>plain<i>italic</i>plain
88 </li><li> plain<b>bold</b>plain
89 </li><li> plain<b>bold</b>plain<b>bold</b>plain
90 </li><li> plain<i>italic</i>plain<b>bold</b>plain
91 </li><li> plain<b>bold</b>plain<i>italic</i>plain
92 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
93 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
94 </li><li> plain<i><b>bold-italic</b>italic</i>plain
95 </li><li> plain<b><i>bold-italic</i>bold</b>plain
96 </li><li> plain<i>italic<b>bold-italic</b></i>plain
97 </li><li> plain<b>bold<i>bold-italic</i></b>plain
98 </li><li> plain l'<i>italic</i>plain
99 </li></ul>
101 !! end
104 ### <nowiki> test cases
107 !! test
108 <nowiki> unordered list
109 !! input
110 <nowiki>* This is not an unordered list item.</nowiki>
111 !! result
112 <p>* This is not an unordered list item.
113 </p>
114 !! end
116 !! test
117 <nowiki> spacing
118 !! input
119 <nowiki>Lorem ipsum dolor
121 sed abit.
122   sed nullum.
124 :and a colon
125 </nowiki>
126 !! result
127 <p>Lorem ipsum dolor
129 sed abit.
130   sed nullum.
132 :and a colon
134 </p>
135 !! end
137 !! test
138 nowiki 3
139 !! input
140 :There is not nowiki.
141 :There is <nowiki>nowiki</nowiki>.
143 #There is not nowiki.
144 #There is <nowiki>nowiki</nowiki>.
146 *There is not nowiki.
147 *There is <nowiki>nowiki</nowiki>.
148 !! result
149 <dl><dd>There is not nowiki.
150 </dd><dd>There is nowiki.
151 </dd></dl>
152 <ol><li>There is not nowiki.
153 </li><li>There is nowiki.
154 </li></ol>
155 <ul><li>There is not nowiki.
156 </li><li>There is nowiki.
157 </li></ul>
159 !! end
163 ### Comments
165 !! test
166 Comment test 1
167 !! input
168 <!-- comment 1 --> asdf
169 <!-- comment 2 -->
170 !! result
171 <pre>asdf
172 </pre>
174 !! end
176 !! test
177 Comment test 2
178 !! input
179 asdf
180 <!-- comment 1 -->
182 !! result
183 <p>asdf
185 </p>
186 !! end
188 !! test
189 Comment test 3
190 !! input
191 asdf
192 <!-- comment 1 -->
193 <!-- comment 2 -->
195 !! result
196 <p>asdf
198 </p>
199 !! end
201 !! test
202 Comment test 4
203 !! input
204 asdf<!-- comment 1 -->jkl
205 !! result
206 <p>asdfjkl
207 </p>
208 !! end
210 !! test
211 Comment spacing
212 !! input
214  <!-- foo --> b <!-- bar -->
216 !! result
217 <p>a
218 </p>
219 <pre> b 
220 </pre>
221 <p>c
222 </p>
223 !! end
225 !! test
226 Comment whitespace
227 !! input
228 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
229 !! result
231 !! end
233 !! test
234 Comment semantics and delimiters
235 !! input
236 <!-- --><!----><!-----><!------>
237 !! result
239 !! end
241 !! test
242 Comment semantics and delimiters, redux
243 !! input
244 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
245 -- foo -- funky huh? ... -->
246 !! result
248 !! end
250 !! test
251 Comment semantics and delimiters: directors cut
252 !! input
253 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
254 everything starting with < followed by !-- until the first -- and > we see,
255 that wouldn't be valid XML however, since in XML -- has to terminate a comment
256 -->-->
257 !! result
258 <p>--&gt;
259 </p>
260 !! end
262 !! test
263 Comment semantics: nesting
264 !! input
265 <!--<!-- no, we're not going to do anything fancy here -->-->
266 !! result
267 <p>--&gt;
268 </p>
269 !! end
271 !! test
272 Comment semantics: unclosed comment at end
273 !! input
274 <!--This comment will run out to the end of the document
275 !! result
277 !! end
281 ### Preformatted text
283 !! test
284 Preformatted text
285 !! input
286  This is some
287  Preformatted text
288  With ''italic''
289  And '''bold'''
290  And a [[Main Page|link]]
291 !! result
292 <pre>This is some
293 Preformatted text
294 With <i>italic</i>
295 And <b>bold</b>
296 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
297 </pre>
298 !! end
300 !! test
301 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
302 !! input
303 <pre><nowiki>
305 <cite>
306 <em>
307 </nowiki></pre>
308 !! result
309 <pre>
310 &lt;b&gt;
311 &lt;cite&gt;
312 &lt;em&gt;
313 </pre>
315 !! end
317 !! test
318 Regression with preformatted in <center>
319 !! input
320 <center>
321  Blah
322 </center>
323 !! result
324 <center>
325 <pre>Blah
326 </pre>
327 </center>
329 !! end
331 !! test
332 <pre> with attributes (bug 3202)
333 !! input
334 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
335 !! result
336 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
338 !! end
340 !! test
341 <pre> with width attribute (bug 3202)
342 !! input
343 <pre width="8">Narrow screen goodies</pre>
344 !! result
345 <pre width="8">Narrow screen goodies</pre>
347 !! end
349 !! test
350 <pre> with forbidden attribute (bug 3202)
351 !! input
352 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
353 !! result
354 <pre width="8">Narrow screen goodies</pre>
356 !! end
358 !! test
359 <pre> with forbidden attribute values (bug 3202)
360 !! input
361 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
362 !! result
363 <pre width="8">Narrow screen goodies</pre>
365 !! end
368 ### Definition lists
370 !! test
371 Simple definition
372 !! input
373 ; name : Definition
374 !! result
375 <dl><dt> name&nbsp;</dt><dd> Definition
376 </dd></dl>
378 !! end
380 !! test
381 Definition list for indentation only
382 !! input
383 : Indented text
384 !! result
385 <dl><dd> Indented text
386 </dd></dl>
388 !! end
390 !! test
391 Definition list with no space
392 !! input
393 ;name:Definition
394 !! result
395 <dl><dt>name</dt><dd>Definition
396 </dd></dl>
398 !!end
400 !! test
401 Definition list with URL link
402 !! input
403 ; http://example.com/ : definition
404 !! result
405 <dl><dt> <a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
406 </dd></dl>
408 !! end
410 !! test
411 Definition list with bracketed URL link
412 !! input
413 ;[http://www.example.com/ Example]:Something about it
414 !! result
415 <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
416 </dd></dl>
418 !! end
420 !! test
421 Definition list with wikilink containing colon
422 !! input
423 ; [[Help:FAQ]]: The least-read page on Wikipedia
424 !! result
425 <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
426 </dd></dl>
428 !! end
430 # At Brion's and JeLuF's insistence... :)
431 !! test
432 Definition list with news link containing colon
433 !! input
434 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
435 !! result
436 <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!
437 </dd></dl>
439 !! end
441 !! test
442 Malformed definition list with colon
443 !! input
444 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
445 !! result
446 <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
447 </dt></dl>
449 !! end
451 !! test
452 Definition lists: colon in external link text
453 !! input
454 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
455 !! result
456 <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
457 </dd></dl>
459 !! end
461 !! test
462 Definition lists: colon in HTML attribute
463 !! input
464 ;<b style="display: inline">bold</b>
465 !! result
466 <dl><dt><b style="display: inline">bold</b>
467 </dt></dl>
469 !! end
472 !! test
473 Definition lists: self-closed tag
474 !! input
475 ;one<br/>two : two-line fun
476 !! result
477 <dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
478 </dd></dl>
480 !! end
484 ### External links
486 !! test
487 External links: non-bracketed
488 !! input
489 Non-bracketed: http://example.com
490 !! result
491 <p>Non-bracketed: <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>
492 </p>
493 !! end
495 !! test
496 External links: numbered
497 !! input
498 Numbered: [http://example.com]
499 Numbered: [http://example.net]
500 Numbered: [http://example.org]
501 !! result
502 <p>Numbered: <a href="http://example.com" class="external autonumber" title="http://example.com" rel="nofollow">[1]</a>
503 Numbered: <a href="http://example.net" class="external autonumber" title="http://example.net" rel="nofollow">[2]</a>
504 Numbered: <a href="http://example.org" class="external autonumber" title="http://example.org" rel="nofollow">[3]</a>
505 </p>
506 !!end
508 !! test
509 External links: specified text
510 !! input
511 Specified text: [http://example.com link]
512 !! result
513 <p>Specified text: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow">link</a>
514 </p>
515 !!end
517 !! test
518 External links: trail
519 !! input
520 Linktrails should not work for external links: [http://example.com link]s
521 !! result
522 <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
523 </p>
524 !! end
526 !! test
527 External links: dollar sign in URL
528 !! input
529 http://example.com/1$2345
530 !! result
531 <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>
532 </p>
533 !! end
535 !! test
536 External links: dollar sign in URL (named)
537 !! input
538 [http://example.com/1$2345]
539 !! result
540 <p><a href="http://example.com/1$2345" class="external autonumber" title="http://example.com/1$2345" rel="nofollow">[1]</a>
541 </p>
542 !!end
544 !! test
545 External links: open square bracket forbidden in URL (bug 4377)
546 !! input
547 http://example.com/1[2345
548 !! result
549 <p><a href="http://example.com/1" class="external free" title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
550 </p>
551 !! end
553 !! test
554 External links: open square bracket forbidden in URL (named) (bug 4377)
555 !! input
556 [http://example.com/1[2345]
557 !! result
558 <p><a href="http://example.com/1" class="external text" title="http://example.com/1" rel="nofollow">[2345</a>
559 </p>
560 !!end
562 !! test
563 External links: nowiki in URL link text (bug 6230)
564 !!input
565 [http://example.com/ <nowiki>''example site''</nowiki>]
566 !! result
567 <p><a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow">''example site''</a>
568 </p>
569 !! end
571 !! test
572 External links: newline forbidden in text (bug 6230 regression check)
573 !! input
574 [http://example.com/ first
575 second]
576 !! result
577 <p>[<a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a> first
578 second]
579 </p>
580 !!end
582 !! test
583 External image
584 !! input
585 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
586 !! result
587 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
588 </p>
589 !! end
591 !! test
592 External image from https
593 !! input
594 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
595 !! result
596 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
597 </p>
598 !! end
600 !! test
601 Link to non-http image, no img tag
602 !! input
603 Link to non-http image, no img tag: ftp://example.com/test.jpg
604 !! result
605 <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>
606 </p>
607 !! end
609 !! test
610 External links: terminating separator
611 !! input
612 Terminating separator: http://example.com/thing,
613 !! result
614 <p>Terminating separator: <a href="http://example.com/thing" class="external free" title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
615 </p>
616 !! end
618 !! test
619 External links: intervening separator
620 !! input
621 Intervening separator: http://example.com/1,2,3
622 !! result
623 <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>
624 </p>
625 !! end
627 !! test
628 External links: old bug with URL in query
629 !! input
630 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
631 !! result
632 <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>
633 </p>
634 !! end
636 !! test
637 External links: old URL-in-URL bug, mixed protocols
638 !! input
639 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
640 !! result
641 <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>
642 </p>
643 !!end
645 !! test
646 External links: URL in text
647 !! input
648 URL in text: [http://example.com http://example.com]
649 !! result
650 <p>URL in text: <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>
651 </p>
652 !! end
654 !! test
655 External links: Clickable images
656 !! input
657 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
658 !! result
659 <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>
660 </p>
661 !!end
663 !! test
664 External links: raw ampersand
665 !! input
666 Old &amp; use: http://x&y
667 !! result
668 <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>
669 </p>
670 !! end
672 !! test
673 External links: encoded ampersand
674 !! input
675 Old &amp; use: http://x&amp;y
676 !! result
677 <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>
678 </p>
679 !! end
681 !! test
682 External links: encoded equals (bug 6102)
683 !! input
684 http://example.com/?foo&#61;bar
685 !! result
686 <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>
687 </p>
688 !! end
690 !! test
691 External links: [raw ampersand]
692 !! input
693 Old &amp; use: [http://x&y]
694 !! result
695 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" title="http://x&amp;y" rel="nofollow">[1]</a>
696 </p>
697 !! end
699 !! test
700 External links: [encoded ampersand]
701 !! input
702 Old &amp; use: [http://x&amp;y]
703 !! result
704 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" title="http://x&amp;y" rel="nofollow">[1]</a>
705 </p>
706 !! end
708 !! test
709 External links: [encoded equals] (bug 6102)
710 !! input
711 [http://example.com/?foo&#61;bar]
712 !! result
713 <p><a href="http://example.com/?foo=bar" class="external autonumber" title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
714 </p>
715 !! end
717 !! test
718 External links: [IDN ignored character reference in hostname; strip it right off]
719 !! input
720 [http://e&zwnj;xample.com/]
721 !! result
722 <p><a href="http://example.com/" class="external autonumber" title="http://example.com/" rel="nofollow">[1]</a>
723 </p>
724 !! end
726 !! test
727 External links: IDN ignored character reference in hostname; strip it right off
728 !! input
729 http://e&zwnj;xample.com/
730 !! result
731 <p><a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a>
732 </p>
733 !! end
735 !! test
736 External links: www.jpeg.org (bug 554)
737 !! input
738 http://www.jpeg.org
739 !!result
740 <p><a href="http://www.jpeg.org" class="external free" title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
741 </p>
742 !! end
744 !! test
745 External links: URL within URL (original bug 2)
746 !! input
747 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
748 !! result
749 <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>
750 </p>
751 !! end
753 !! test
754 BUG 361: URL inside bracketed URL
755 !! input
756 [http://www.example.com/foo http://www.example.com/bar]
757 !! result
758 <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>
759 </p>
760 !! end
762 !! test
763 BUG 361: URL within URL, not bracketed
764 !! input
765 http://www.example.com/foo?=http://www.example.com/bar
766 !! result
767 <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>
768 </p>
769 !! end
771 !! test
772 BUG 289: ">"-token in URL-tail
773 !! input
774 http://www.example.com/<hello>
775 !! result
776 <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;
777 </p>
778 !!end
780 !! test
781 BUG 289: literal ">"-token in URL-tail
782 !! input
783 http://www.example.com/<b>html</b>
784 !! result
785 <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>
786 </p>
787 !!end
789 !! test
790 BUG 289: ">"-token in bracketed URL
791 !! input
792 [http://www.example.com/<hello> stuff]
793 !! result
794 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
795 </p>
796 !!end
798 !! test
799 BUG 289: literal ">"-token in bracketed URL
800 !! input
801 [http://www.example.com/<b>html</b> stuff]
802 !! result
803 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
804 </p>
805 !!end
807 !! test
808 BUG 289: literal double quote at end of URL
809 !! input
810 http://www.example.com/"hello"
811 !! result
812 <p><a href="http://www.example.com/" class="external free" title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
813 </p>
814 !!end
816 !! test
817 BUG 289: literal double quote in bracketed URL
818 !! input
819 [http://www.example.com/"hello" stuff]
820 !! result
821 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
822 </p>
823 !!end
825 !! test
826 External links: invalid character
827 Fixme: the missing char seems to have gone missing
828 !! options
829 disabled
830 !! input
831 [http://www.example.com  test]
832 !! result
833 <p>[<a href="http://www.example.com" class="external free" title="http://www.example.com" rel="nofollow">http://www.example.com</a>  test]
834 </p>
835 !! end
837 !! test
838 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
839 !! input
840 [http://www.example.com  test]
841 !! result
842 <p><a href="http://www.example.com" class="external text" title="http://www.example.com" rel="nofollow">test</a>
843 </p>
844 !! end
846 !! test
847 External links: wiki links within external link (Bug 3695)
848 !! input
849 [http://example.com [[wikilink]] embedded in ext link]
850 !! result
851 <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>
852 </p>
853 !! end
855 !! test
856 BUG 787: Links with one slash after the url protocol are invalid
857 !! input
858 http:/example.com
860 [http:/example.com title]
861 !! result
862 <p>http:/example.com
863 </p><p>[http:/example.com title]
864 </p>
865 !! end
867 !! test
868 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
869 !! input
870 ''[http://example.com text'']
871 [http://example.com '''text]'''
872 ''Something [http://example.com in italic'']
873 ''Something [http://example.com mixed''''', even bold]'''
874 '''''Now [http://example.com both''''']
875 !! result
876 <p><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>text</i></a>
877 <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><b>text</b></a>
878 <i>Something </i><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>in italic</i></a>
879 <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>
880 <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>
881 </p>
882 !! end
885 !! test
886 Bug 4781: %26 in URL
887 !! input
888 http://www.example.com/?title=AT%26T
889 !! result
890 <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>
891 </p>
892 !! end
894 !! test
895 Bug 4781, 5267: %26 in URL
896 !! input
897 http://www.example.com/?title=100%25_Bran
898 !! result
899 <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>
900 </p>
901 !! end
903 !! test
904 Bug 4781, 5267: %28, %29 in URL
905 !! input
906 http://www.example.com/?title=Ben-Hur_%281959_film%29
907 !! result
908 <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>
909 </p>
910 !! end
913 !! test
914 Bug 4781: %26 in autonumber URL
915 !! input
916 [http://www.example.com/?title=AT%26T]
917 !! result
918 <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>
919 </p>
920 !! end
922 !! test
923 Bug 4781, 5267: %26 in autonumber URL
924 !! input
925 [http://www.example.com/?title=100%25_Bran]
926 !! result
927 <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>
928 </p>
929 !! end
931 !! test
932 Bug 4781, 5267: %28, %29 in autonumber URL
933 !! input
934 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
935 !! result
936 <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>
937 </p>
938 !! end
941 !! test
942 Bug 4781: %26 in bracketed URL
943 !! input
944 [http://www.example.com/?title=AT%26T link]
945 !! result
946 <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>
947 </p>
948 !! end
950 !! test
951 Bug 4781, 5267: %26 in bracketed URL
952 !! input
953 [http://www.example.com/?title=100%25_Bran link]
954 !! result
955 <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>
956 </p>
957 !! end
959 !! test
960 Bug 4781, 5267: %28, %29 in bracketed URL
961 !! input
962 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
963 !! result
964 <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>
965 </p>
966 !! end
968 !! test
969 External link containing double-single-quotes in text '' (bug 4598 sanity check)
970 !! input
971 Some [http://example.com/ pretty ''italics'' and stuff]!
972 !! result
973 <p>Some <a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow">pretty <i>italics</i> and stuff</a>!
974 </p>
975 !! end
977 !! test
978 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
979 !! input
980 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
981 !! result
982 <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>
983 </p>
984 !! end
986 !! test
987 URL-encoding in URL functions (single parameter)
988 !! input
989 {{localurl:Some page|amp=&}}
990 !! result
991 <p>/index.php?title=Some_page&amp;amp=%26
992 </p>
993 !! end
995 !! test
996 URL-encoding in URL functions (multiple parameters)
997 !! input
998 {{localurl:Some page|q=?&amp=&}}
999 !! result
1000 <p>/index.php?title=Some_page&amp;q=%3F&amp;amp=%26
1001 </p>
1002 !! end
1005 ### Quotes
1008 !! test
1009 Quotes
1010 !! input
1011 Normal text. '''Bold text.''' Normal text. ''Italic text.''
1013 Normal text. '''''Bold italic text.''''' Normal text.
1014 !!result
1015 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
1016 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1017 </p>
1018 !! end
1021 !! test
1022 Unclosed and unmatched quotes
1023 !! input
1024 '''''Bold italic text '''with bold deactivated''' in between.'''''
1026 '''''Bold italic text ''with italic deactivated'' in between.'''''
1028 '''Bold text..
1030 ..spanning two paragraphs (should not work).'''
1032 '''Bold tag left open
1034 ''Italic tag left open
1036 Normal text.
1038 <!-- Unmatching number of opening, closing tags: -->
1039 '''This year''''s election ''should'' beat '''last year''''s.
1041 ''Tom'''s car is bigger than ''Susan'''s.
1042 !! result
1043 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1044 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1045 </p><p><b>Bold text..</b>
1046 </p><p>..spanning two paragraphs (should not work).
1047 </p><p><b>Bold tag left open</b>
1048 </p><p><i>Italic tag left open</i>
1049 </p><p>Normal text.
1050 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1051 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1052 </p>
1053 !! end
1056 ### Tables
1058 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1061 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1062 # is the bare minimun required by the spec, see:
1063 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1064 !! test
1065 A table with no data.
1066 !! input
1067 {||}
1068 !! result
1069 !! end
1071 # A table with nothing but a caption is invalid XHTML, we might want to render
1072 # this as <p>caption</p>
1073 !! test
1074 A table with nothing but a caption
1075 !! input 
1077 |+ caption
1079 !! result
1080 <table>
1081 <caption> caption
1082 </caption><tr><td></td></tr></table>
1084 !! end
1086 !! test
1087 Simple table
1088 !! input
1089 {| 
1090 | 1 || 2
1091 |- 
1092 | 3 || 4
1094 !! result
1095 <table>
1096 <tr>
1097 <td> 1 </td><td> 2
1098 </td></tr>
1099 <tr>
1100 <td> 3 </td><td> 4
1101 </td></tr></table>
1103 !! end
1105 !! test
1106 Multiplication table
1107 !! input
1108 {| border="1" cellpadding="2"
1109 |+Multiplication table
1111 ! &times; !! 1 !! 2 !! 3
1113 ! 1
1114 | 1 || 2 || 3
1116 ! 2
1117 | 2 || 4 || 6
1119 ! 3
1120 | 3 || 6 || 9
1122 ! 4
1123 | 4 || 8 || 12
1125 ! 5
1126 | 5 || 10 || 15
1128 !! result
1129 <table border="1" cellpadding="2">
1130 <caption>Multiplication table
1131 </caption>
1132 <tr>
1133 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1134 </th></tr>
1135 <tr>
1136 <th> 1
1137 </th><td> 1 </td><td> 2 </td><td> 3
1138 </td></tr>
1139 <tr>
1140 <th> 2
1141 </th><td> 2 </td><td> 4 </td><td> 6
1142 </td></tr>
1143 <tr>
1144 <th> 3
1145 </th><td> 3 </td><td> 6 </td><td> 9
1146 </td></tr>
1147 <tr>
1148 <th> 4
1149 </th><td> 4 </td><td> 8 </td><td> 12
1150 </td></tr>
1151 <tr>
1152 <th> 5
1153 </th><td> 5 </td><td> 10 </td><td> 15
1154 </td></tr></table>
1156 !! end
1158 !! test
1159 Table rowspan
1160 !! input
1161 {| align=right border=1
1162 | Cell 1, row 1 
1163 |rowspan=2| Cell 2, row 1 (and 2) 
1164 | Cell 3, row 1 
1165 |- 
1166 | Cell 1, row 2 
1167 | Cell 3, row 2 
1169 !! result
1170 <table align="right" border="1">
1171 <tr>
1172 <td> Cell 1, row 1
1173 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1174 </td><td> Cell 3, row 1
1175 </td></tr>
1176 <tr>
1177 <td> Cell 1, row 2
1178 </td><td> Cell 3, row 2
1179 </td></tr></table>
1181 !! end
1183 !! test
1184 Nested table
1185 !! input
1186 {| border=1
1187 | &alpha;
1189 {| bgcolor=#ABCDEF border=2
1190 |nested
1192 |table
1194 |the original table again
1196 !! result
1197 <table border="1">
1198 <tr>
1199 <td> &alpha;
1200 </td><td>
1201 <table bgcolor="#ABCDEF" border="2">
1202 <tr>
1203 <td>nested
1204 </td></tr>
1205 <tr>
1206 <td>table
1207 </td></tr></table>
1208 </td><td>the original table again
1209 </td></tr></table>
1211 !! end
1213 !! test
1214 Invalid attributes in table cell (bug 1830)
1215 !! input
1217 |Cell:|broken
1219 !! result
1220 <table>
1221 <tr>
1222 <td>broken
1223 </td></tr></table>
1225 !! end
1228 # FIXME: this one has incorrect tag nesting still.
1229 !! test
1230 Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)
1231 !! input
1233 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1234 !! result
1235 <table>
1236 <tr>
1237 <td><a href="ftp://|x||" class="external autonumber" title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
1238 </td>
1239 </tr>
1240 </table>
1242 !! end
1246 ### Internal links
1248 !! test
1249 Plain link, capitalized
1250 !! input
1251 [[Main Page]]
1252 !! result
1253 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1254 </p>
1255 !! end
1257 !! test
1258 Plain link, uncapitalized
1259 !! input
1260 [[main Page]]
1261 !! result
1262 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1263 </p>
1264 !! end
1266 !! test
1267 Piped link
1268 !! input
1269 [[Main Page|The Main Page]]
1270 !! result
1271 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1272 </p>
1273 !! end
1275 !! test
1276 Broken link
1277 !! input
1278 [[Zigzagzogzagzig]]
1279 !! result
1280 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
1281 </p>
1282 !! end
1284 !! test
1285 Link with prefix
1286 !! input
1287 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1288 !! result
1289 <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>
1290 </p>
1291 !! end
1293 !! test
1294 Link with suffix
1295 !! input
1296 [[Main Page]]xxx, [[Main Page]]XXX
1297 !! result
1298 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
1299 </p>
1300 !! end
1302 !! test
1303 Link with 3 brackets
1304 !! input
1305 [[[main page]]]
1306 !! result
1307 <p>[[[main page]]]
1308 </p>
1309 !! end
1311 !! test
1312 Piped link with 3 brackets
1313 !! input
1314 [[[main page|the main page]]]
1315 !! result
1316 <p>[[[main page|the main page]]]
1317 </p>
1318 !! end
1320 !! test
1321 Link with multiple pipes
1322 !! input
1323 [[Main Page|The|Main|Page]]
1324 !! result
1325 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1326 </p>
1327 !! end
1329 !! test
1330 Link to namespaces
1331 !! input
1332 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1333 !! result
1334 <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>
1335 </p>
1336 !! end
1338 !! test
1339 Piped link to namespace
1340 !! input
1341 [[Meta:Disclaimers|The disclaimers]]
1342 !! result
1343 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
1344 </p>
1345 !! end
1347 !! test
1348 Link containing }
1349 !! input
1350 [[Usually caused by a typo (oops}]]
1351 !! result
1352 <p>[[Usually caused by a typo (oops}]]
1353 </p>
1354 !! end
1356 !! test
1357 Link containing % (not as a hex sequence)
1358 !! input
1359 [[7% Solution]]
1360 !! result
1361 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1362 </p>
1363 !! end
1365 !! test
1366 Link containing % as a single hex sequence interpreted to char
1367 !! input
1368 [[7%25 Solution]]
1369 !! result
1370 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1371 </p>
1372 !!end
1374 !! test
1375 Link containing % as a double hex sequence interpreted to hex sequence
1376 !! input
1377 [[7%2525 Solution]]
1378 !! result
1379 <p>[[7%2525 Solution]]
1380 </p>
1381 !!end
1383 !! test
1384 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1385 Example for such a section: == < ==
1386 !! input
1387 [[%23%3c]][[%23%3e]]
1388 !! result
1389 <p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
1390 </p>
1391 !! end
1393 !! test
1394 Link containing "<#" and ">#" as a hex sequences
1395 !! input
1396 [[%3c%23]][[%3e%23]]
1397 !! result
1398 <p>[[%3c%23]][[%3e%23]]
1399 </p>
1400 !! end
1402 !! test
1403 Link containing double-single-quotes '' (bug 4598)
1404 !! input
1405 [[Lista d''e paise d''o munno]]
1406 !! result
1407 <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>
1408 </p>
1409 !! end
1411 !! test
1412 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1413 !! input
1414 Some [[Link|pretty ''italics'' and stuff]]!
1415 !! result
1416 <p>Some <a href="/index.php?title=Link&amp;action=edit" class="new" title="Link">pretty <i>italics</i> and stuff</a>!
1417 </p>
1418 !! end
1420 !! test
1421 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1422 !! input
1423 ''Some [[Link|pretty ''italics'' and stuff]]!
1424 !! result
1425 <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>
1426 </p>
1427 !! end
1429 !! test
1430 Plain link to URL
1431 !! input
1432 [[http://www.example.org]]
1433 !! result
1434 <p>[<a href="http://www.example.org" class="external autonumber" title="http://www.example.org" rel="nofollow">[1]</a>]
1435 </p>
1436 !! end
1438 # I'm fairly sure the expected result here is wrong.
1439 # We want these to be URL links, not pseudo-pages with URLs for titles....
1440 # However the current output is also pretty screwy.
1442 # ----
1443 # I'm changing it to match the current output--it arguably makes more
1444 # sense in the light of the test above. Old expected result was:
1445 #<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>
1446 #</p>
1447 # But I think this test is bordering on "garbage in, garbage out" anyway.
1448 # -- wtm
1449 !! test
1450 Piped link to URL
1451 !! input
1452 Piped link to URL: [[http://www.example.org|an example URL]]
1453 !! result
1454 <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>]
1455 </p>
1456 !! end
1458 !! test
1459 BUG 2: [[page|http://url/]] should link to page, not http://url/
1460 !! input
1461 [[Main Page|http://url/]]
1462 !! result
1463 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1464 </p>
1465 !! end
1467 !! test
1468 BUG 337: Escaped self-links should be bold
1469 !! options
1470 title=[[Bug462]]
1471 !! input
1472 [[Bu&#103;462]] [[Bug462]]
1473 !! result
1474 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1475 </p>
1476 !! end
1478 !! test
1479 Self-link to section should not be bold
1480 !! options
1481 title=[[Main Page]]
1482 !! input
1483 [[Main Page#section]]
1484 !! result
1485 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1486 </p>
1487 !! end
1489 !! article
1491 !! text
1492 This is 00.
1493 !! endarticle
1495 !!test
1496 Self-link to numeric title
1497 !!options
1498 title=[[0]]
1499 !!input
1500 [[0]]
1501 !!result
1502 <p><strong class="selflink">0</strong>
1503 </p>
1504 !!end
1506 !!test
1507 Link to numeric-equivalent title
1508 !!options
1509 title=[[0]]
1510 !!input
1511 [[00]]
1512 !!result
1513 <p><a href="/wiki/00" title="00">00</a>
1514 </p>
1515 !!end
1517 !! test
1518 <nowiki> inside a link
1519 !! input
1520 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1521 !! result
1522 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1523 </p>
1524 !! end
1527 ### Interwiki links (see maintenance/interwiki.sql)
1530 !! test
1531 Inline interwiki link
1532 !! input
1533 [[MeatBall:SoftSecurity]]
1534 !! result
1535 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1536 </p>
1537 !! end
1539 !! test
1540 Inline interwiki link with empty title (bug 2372)
1541 !! input
1542 [[MeatBall:]]
1543 !! result
1544 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
1545 </p>
1546 !! end
1548 !! test
1549 Interwiki link encoding conversion (bug 1636)
1550 !! input
1551 *[[Wikipedia:ro:Olteni&#0355;a]]
1552 *[[Wikipedia:ro:Olteni&#355;a]]
1553 !! result
1554 <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>
1555 </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>
1556 </li></ul>
1558 !! end
1560 !! test
1561 Interwiki link with fragment (bug 2130)
1562 !! input
1563 [[MeatBall:SoftSecurity#foo]]
1564 !! result
1565 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1566 </p>
1567 !! end
1569 !! test
1570 Interlanguage link
1571 !! input
1572 Blah blah blah
1573 [[zh:Chinese]]
1574 !!result
1575 <p>Blah blah blah
1576 </p>
1577 !! end
1579 !! test
1580 Double interlanguage link
1581 !! input
1582 Blah blah blah
1583 [[es:Spanish]]
1584 [[zh:Chinese]]
1585 !!result
1586 <p>Blah blah blah
1587 </p>
1588 !! end
1590 !! test
1591 Interlanguage link, with prefix links
1592 !! options
1593 language=ln
1594 !! input
1595 Blah blah blah
1596 [[zh:Chinese]]
1597 !!result
1598 <p>Blah blah blah
1599 </p>
1600 !! end
1602 !! test
1603 Double interlanguage link, with prefix links (bug 8897)
1604 !! options
1605 language=ln
1606 !! input
1607 Blah blah blah
1608 [[es:Spanish]]
1609 [[zh:Chinese]]
1610 !!result
1611 <p>Blah blah blah
1612 </p>
1613 !! end
1617 ## XHTML tidiness
1620 !! test
1621 <br> to <br />
1622 !! input
1623 1<br>2<br />3
1624 !! result
1625 <p>1<br />2<br />3
1626 </p>
1627 !! end
1629 !! test
1630 Incorrecly removing closing slashes from correctly formed XHTML
1631 !! input
1632 <br style="clear:both;" />
1633 !! result
1634 <p><br style="clear:both;" />
1635 </p>
1636 !! end
1638 !! test 
1639 Failing to transform badly formed HTML into correct XHTML
1640 !! input
1641 <br clear=left>
1642 <br clear=right>
1643 <br clear=all>
1644 !! result
1645 <p><br clear="left" />
1646 <br clear="right" />
1647 <br clear="all" />
1648 </p>
1649 !!end
1651 !! test 
1652 Horizontal ruler (should it add that extra space?)
1653 !! input 
1654 <hr>
1655 <hr >
1656 foo <hr
1657 > bar
1658 !! result 
1659 <hr />
1660 <hr />
1661 foo <hr /> bar
1663 !! end
1666 ### Block-level elements
1668 !! test
1669 Common list
1670 !! input
1671 *Common list
1672 * item 2
1673 *item 3
1674 !! result
1675 <ul><li>Common list
1676 </li><li> item 2
1677 </li><li>item 3
1678 </li></ul>
1680 !! end
1682 !! test
1683 Numbered list
1684 !! input
1685 #Numbered list
1686 #item 2
1687 # item 3
1688 !! result
1689 <ol><li>Numbered list
1690 </li><li>item 2
1691 </li><li> item 3
1692 </li></ol>
1694 !! end
1696 !! test
1697 Mixed list
1698 !! input
1699 *Mixed list
1700 *# with numbers
1701 ** and bullets
1702 *# and numbers
1703 *bullets again
1704 **bullet level 2
1705 ***bullet level 3
1706 ***#Number on level 4
1707 **bullet level 2
1708 **#Number on level 3
1709 **#Number on level 3
1710 *#number level 2
1711 *Level 1
1712 !! result
1713 <ul><li>Mixed list
1714 <ol><li> with numbers
1715 </li></ol>
1716 <ul><li> and bullets
1717 </li></ul>
1718 <ol><li> and numbers
1719 </li></ol>
1720 </li><li>bullets again
1721 <ul><li>bullet level 2
1722 <ul><li>bullet level 3
1723 <ol><li>Number on level 4
1724 </li></ol>
1725 </li></ul>
1726 </li><li>bullet level 2
1727 <ol><li>Number on level 3
1728 </li><li>Number on level 3
1729 </li></ol>
1730 </li></ul>
1731 <ol><li>number level 2
1732 </li></ol>
1733 </li><li>Level 1
1734 </li></ul>
1736 !! end
1738 !! test
1739 List items are not parsed correctly following a <pre> block (bug 785)
1740 !! input
1741 * <pre>foo</pre>
1742 * <pre>bar</pre>
1743 * zar
1744 !! result
1745 <ul><li> <pre>foo</pre>
1746 </li><li> <pre>bar</pre>
1747 </li><li> zar
1748 </li></ul>
1750 !! end
1753 ### Magic Words
1756 !! test
1757 Magic Word: {{CURRENTDAY}}
1758 !! input
1759 {{CURRENTDAY}}
1760 !! result
1761 <p>1
1762 </p>
1763 !! end
1765 !! test
1766 Magic Word: {{CURRENTDAY2}}
1767 !! input
1768 {{CURRENTDAY2}}
1769 !! result
1770 <p>01
1771 </p>
1772 !! end
1774 !! test
1775 Magic Word: {{CURRENTDAYNAME}}
1776 !! input
1777 {{CURRENTDAYNAME}}
1778 !! result
1779 <p>Thursday
1780 </p>
1781 !! end
1783 !! test
1784 Magic Word: {{CURRENTDOW}}
1785 !! input
1786 {{CURRENTDOW}}
1787 !! result
1788 <p>4
1789 </p>
1790 !! end
1792 !! test
1793 Magic Word: {{CURRENTMONTH}}
1794 !! input
1795 {{CURRENTMONTH}}
1796 !! result
1797 <p>01
1798 </p>
1799 !! end
1801 !! test
1802 Magic Word: {{CURRENTMONTHABBREV}}
1803 !! input
1804 {{CURRENTMONTHABBREV}}
1805 !! result
1806 <p>Jan
1807 </p>
1808 !! end
1810 !! test
1811 Magic Word: {{CURRENTMONTHNAME}}
1812 !! input
1813 {{CURRENTMONTHNAME}}
1814 !! result
1815 <p>January
1816 </p>
1817 !! end
1819 !! test
1820 Magic Word: {{CURRENTMONTHNAMEGEN}}
1821 !! input
1822 {{CURRENTMONTHNAMEGEN}}
1823 !! result
1824 <p>January
1825 </p>
1826 !! end
1828 !! test
1829 Magic Word: {{CURRENTTIME}}
1830 !! input
1831 {{CURRENTTIME}}
1832 !! result
1833 <p>00:02
1834 </p>
1835 !! end
1837 !! test
1838 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1839 !! input
1840 {{CURRENTWEEK}}
1841 !! result
1842 <p>1
1843 </p>
1844 !! end
1846 !! test
1847 Magic Word: {{CURRENTYEAR}}
1848 !! input
1849 {{CURRENTYEAR}}
1850 !! result
1851 <p>1970
1852 </p>
1853 !! end
1855 !! test
1856 Magic Word: {{FULLPAGENAME}}
1857 !! options
1858 title=[[User:Ævar Arnfjörð Bjarmason]]
1859 !! input
1860 {{FULLPAGENAME}}
1861 !! result
1862 <p>User:Ævar Arnfjörð Bjarmason
1863 </p>
1864 !! end
1866 !! test
1867 Magic Word: {{FULLPAGENAMEE}}
1868 !! options
1869 title=[[User:Ævar Arnfjörð Bjarmason]]
1870 !! input
1871 {{FULLPAGENAMEE}}
1872 !! result
1873 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1874 </p>
1875 !! end
1877 !! test
1878 Magic Word: {{NAMESPACE}}
1879 !! options
1880 title=[[User:Ævar Arnfjörð Bjarmason]]
1881 disabled # FIXME
1882 !! input
1883 {{NAMESPACE}}
1884 !! result
1885 <p>User
1886 </p>
1887 !! end
1889 !! test
1890 Magic Word: {{NAMESPACEE}}
1891 !! options
1892 title=[[User:Ævar Arnfjörð Bjarmason]]
1893 disabled # FIXME
1894 !! input
1895 {{NAMESPACEE}}
1896 !! result
1897 <p>User
1898 </p>
1899 !! end
1901 !! test
1902 Magic Word: {{NUMBEROFARTICLES}}
1903 !! input
1904 {{NUMBEROFARTICLES}}
1905 !! result
1906 <p>1
1907 </p>
1908 !! end
1910 !! test
1911 Magic Word: {{NUMBEROFFILES}}
1912 !! input
1913 {{NUMBEROFFILES}}
1914 !! result
1915 <p>1
1916 </p>
1917 !! end
1919 !! test
1920 Magic Word: {{PAGENAME}}
1921 !! options
1922 title=[[User:Ævar Arnfjörð Bjarmason]]
1923 disabled # FIXME
1924 !! input
1925 {{PAGENAME}}
1926 !! result
1927 <p>Ævar Arnfjörð Bjarmason
1928 </p>
1929 !! end
1931 !! test
1932 Magic Word: {{PAGENAMEE}}
1933 !! options
1934 title=[[User:Ævar Arnfjörð Bjarmason]]
1935 !! input
1936 {{PAGENAMEE}}
1937 !! result
1938 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1939 </p>
1940 !! end
1942 !! test
1943 Magic Word: {{REVISIONID}}
1944 !! input
1945 {{REVISIONID}}
1946 !! result
1947 <p>1337
1948 </p>
1949 !! end
1951 !! test
1952 Magic Word: {{SCRIPTPATH}}
1953 !! input
1954 {{SCRIPTPATH}}
1955 !! result
1956 <p>/
1957 </p>
1958 !! end
1960 !! test
1961 Magic Word: {{SERVER}}
1962 !! input
1963 {{SERVER}}
1964 !! result
1965 <p><a href="http://localhost" class="external free" title="http://localhost" rel="nofollow">http://localhost</a>
1966 </p>
1967 !! end
1969 !! test
1970 Magic Word: {{SERVERNAME}}
1971 !! input
1972 {{SERVERNAME}}
1973 !! result
1974 <p>Britney Spears
1975 </p>
1976 !! end
1978 !! test
1979 Magic Word: {{SITENAME}}
1980 !! input
1981 {{SITENAME}}
1982 !! result
1983 <p>MediaWiki
1984 </p>
1985 !! end
1987 !! test
1988 Namespace 1 {{ns:1}}
1989 !! input
1990 {{ns:1}}
1991 !! result
1992 <p>Talk
1993 </p>
1994 !! end
1996 !! test
1997 Namespace 1 {{ns:01}}
1998 !! input
1999 {{ns:01}}
2000 !! result
2001 <p>Talk
2002 </p>
2003 !! end
2005 !! test
2006 Namespace 0 {{ns:0}} (bug 4783)
2007 !! input
2008 {{ns:0}}
2009 !! result
2011 !! end
2013 !! test
2014 Namespace 0 {{ns:00}} (bug 4783)
2015 !! input
2016 {{ns:00}}
2017 !! result
2019 !! end
2021 !! test
2022 Namespace -1 {{ns:-1}}
2023 !! input
2024 {{ns:-1}}
2025 !! result
2026 <p>Special
2027 </p>
2028 !! end
2030 !! test
2031 Namespace Project {{ns:User}}
2032 !! input
2033 {{ns:User}}
2034 !! result
2035 <p>User
2036 </p>
2037 !! end
2041 ### Magic links
2043 !! test
2044 Magic links: internal link to RFC (bug 479)
2045 !! input
2046 [[RFC 123]]
2047 !! result
2048 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
2049 </p>
2050 !! end
2052 !! test
2053 Magic links: RFC (bug 479)
2054 !! input
2055 RFC 822
2056 !! result
2057 <p><a href="http://tools.ietf.org/html/rfc822" class="external" title="http://tools.ietf.org/html/rfc822">RFC 822</a>
2058 </p>
2059 !! end
2061 !! test
2062 Magic links: ISBN (bug 1937)
2063 !! input
2064 ISBN 0-306-40615-2
2065 !! result
2066 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
2067 </p>
2068 !! end
2070 !! test
2071 Magic links: PMID incorrectly converts space to underscore
2072 !! input
2073 PMID 1234
2074 !! result
2075 <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>
2076 </p>
2077 !! end
2080 ### Templates
2081 ####
2083 !! test
2084 Nonexistant template
2085 !! input
2086 {{thistemplatedoesnotexist}}
2087 !! result
2088 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
2089 </p>
2090 !! end
2092 !! article
2093 Template:test
2094 !! text
2095 This is a test template
2096 !! endarticle
2098 !! test
2099 Simple template
2100 !! input
2101 {{test}}
2102 !! result
2103 <p>This is a test template
2104 </p>
2105 !! end
2107 !! test
2108 Template with explicit namespace
2109 !! input
2110 {{Template:test}}
2111 !! result
2112 <p>This is a test template
2113 </p>
2114 !! end
2117 !! article
2118 Template:paramtest
2119 !! text
2120 This is a test template with parameter {{{param}}}
2121 !! endarticle
2123 !! test
2124 Template parameter
2125 !! input
2126 {{paramtest|param=foo}}
2127 !! result
2128 <p>This is a test template with parameter foo
2129 </p>
2130 !! end
2132 !! article
2133 Template:paramtestnum
2134 !! text
2135 [[{{{1}}}|{{{2}}}]]
2136 !! endarticle
2138 !! test
2139 Template unnamed parameter
2140 !! input
2141 {{paramtestnum|Main Page|the main page}}
2142 !! result
2143 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2144 </p>
2145 !! end
2147 !! article
2148 Template:templatesimple
2149 !! text
2150 (test)
2151 !! endarticle
2153 !! article
2154 Template:templateredirect
2155 !! text
2156 #redirect [[Template:templatesimple]]
2157 !! endarticle
2159 !! article
2160 Template:templateasargtestnum
2161 !! text
2162 {{{{{1}}}}}
2163 !! endarticle
2165 !! article
2166 Template:templateasargtest
2167 !! text
2168 {{template{{{templ}}}}}
2169 !! endarticle
2171 !! article
2172 Template:templateasargtest2
2173 !! text
2174 {{{{{templ}}}}}
2175 !! endarticle
2177 !! test
2178 Template with template name as unnamed argument
2179 !! input
2180 {{templateasargtestnum|templatesimple}}
2181 !! result
2182 <p>(test)
2183 </p>
2184 !! end
2186 !! test
2187 Template with template name as argument
2188 !! input
2189 {{templateasargtest|templ=simple}}
2190 !! result
2191 <p>(test)
2192 </p>
2193 !! end
2195 !! test
2196 Template with template name as argument (2)
2197 !! input
2198 {{templateasargtest2|templ=templatesimple}}
2199 !! result
2200 <p>(test)
2201 </p>
2202 !! end
2204 !! article
2205 Template:templateasargtestdefault
2206 !! text
2207 {{{{{templ|templatesimple}}}}}
2208 !! endarticle
2210 !! article
2211 Template:templa
2212 !! text
2213 '''templ'''
2214 !! endarticle
2216 !! test
2217 Template with default value
2218 !! input
2219 {{templateasargtestdefault}}
2220 !! result
2221 <p>(test)
2222 </p>
2223 !! end
2225 !! test
2226 Template with default value (value set)
2227 !! input
2228 {{templateasargtestdefault|templ=templa}}
2229 !! result
2230 <p><b>templ</b>
2231 </p>
2232 !! end
2234 !! test
2235 Template redirect
2236 !! input
2237 {{templateredirect}}
2238 !! result
2239 <p>(test)
2240 </p>
2241 !! end
2243 !! test
2244 Template with argument in separate line
2245 !! input
2246 {{ templateasargtest  |
2247  templ = simple }}
2248 !! result
2249 <p>(test)
2250 </p>
2251 !! end
2253 !! test
2254 Template with complex template as argument
2255 !! input
2256 {{paramtest|
2257   param ={{ templateasargtest  |
2258  templ = simple }}}}
2259 !! result
2260 <p>This is a test template with parameter (test)
2261 </p>
2262 !! end
2264 !! test
2265 Template with thumb image (with link in description)
2266 !! input
2267 {{paramtest|
2268   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2269 !! result
2270 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:122px;"><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>
2272 !! end
2274 !! article
2275 Template:complextemplate
2276 !! text
2277 {{{1}}} {{paramtest|
2278   param ={{{param}}}}}
2279 !! endarticle
2281 !! test
2282 Template with complex arguments
2283 !! input
2284 {{complextemplate|
2285   param ={{ templateasargtest  |
2286  templ = simple }}|[[Template:complextemplate|link]]}}
2287 !! result
2288 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2289 </p>
2290 !! end
2292 !! test
2293 BUG 553: link with two variables in a piped link
2294 !! input
2295 {| 
2296 |[[{{{1}}}|{{{2}}}]]
2298 !! result
2299 <table>
2300 <tr>
2301 <td>[[{{{1}}}|{{{2}}}]]
2302 </td></tr></table>
2304 !! end
2306 !! test
2307 Magic variable as template parameter
2308 !! input
2309 {{paramtest|param={{SITENAME}}}}
2310 !! result
2311 <p>This is a test template with parameter MediaWiki
2312 </p>
2313 !! end
2315 !! article
2316 Template:linktest
2317 !! text
2318 [[{{{param}}}|link]]
2319 !! endarticle
2321 !! test
2322 Template parameter as link source
2323 !! input
2324 {{linktest|param=Main Page}}
2325 !! result
2326 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2327 </p>
2328 !! end
2331 !!article
2332 Template:paramtest2
2333 !! text
2334 including another template, {{paramtest|param={{{arg}}}}}
2335 !! endarticle
2337 !! test
2338 Template passing argument to another template
2339 !! input
2340 {{paramtest2|arg='hmm'}}
2341 !! result
2342 <p>including another template, This is a test template with parameter 'hmm'
2343 </p>
2344 !! end
2346 !! article
2347 Template:Linktest2
2348 !! text
2349 Main Page
2350 !! endarticle
2352 !! test
2353 Template as link source
2354 !! input
2355 [[{{linktest2}}]]
2356 !! result
2357 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2358 </p>
2359 !! end
2362 !! article
2363 Template:loop1
2364 !! text
2365 {{loop2}}
2366 !! endarticle
2368 !! article
2369 Template:loop2
2370 !! text
2371 {{loop1}}
2372 !! endarticle
2374 !! test
2375 Template infinite loop
2376 !! input
2377 {{loop1}}
2378 !! result
2379 <p><a href="/index.php?title=Loop1&amp;action=edit" class="new" title="Loop1">loop1</a><!-- WARNING: template loop detected -->
2380 </p>
2381 !! end
2383 !! test
2384 Template from main namespace
2385 !! input
2386 {{:Main Page}}
2387 !! result
2388 <p>blah blah
2389 </p>
2390 !! end
2392 !! article
2393 Template:table
2394 !! text
2395 {| 
2396 | 1 || 2
2397 |- 
2398 | 3 || 4
2400 !! endarticle
2402 !! test
2403 BUG 529: Template with table, not included at beginning of line
2404 !! input
2405 foo {{table}}
2406 !! result
2407 <p>foo 
2408 </p>
2409 <table>
2410 <tr>
2411 <td> 1 </td><td> 2
2412 </td></tr>
2413 <tr>
2414 <td> 3 </td><td> 4
2415 </td></tr></table>
2417 !! end
2419 !! test
2420 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2421 !! input
2423 {{table}}
2424 !! result
2425 <p>foo
2426 </p>
2427 <table>
2428 <tr>
2429 <td> 1 </td><td> 2
2430 </td></tr>
2431 <tr>
2432 <td> 3 </td><td> 4
2433 </td></tr></table>
2435 !! end
2437 !! test
2438 BUG 41: Template parameters shown as broken links
2439 !! input
2440 {{{parameter}}}
2441 !! result
2442 <p>{{{parameter}}}
2443 </p>
2444 !! end
2447 !! article
2448 Template:MSGNW test
2449 !! text
2450 ''None'' of '''this''' should be 
2451 * interepreted
2452  but rather passed unmodified
2453 {{test}}
2454 !! endarticle
2456 # hmm, fix this or just deprecate msgnw and document its behavior?
2457 !! test
2458 msgnw keyword
2459 !! options
2460 disabled
2461 !! input
2462 {{msgnw:MSGNW test}}
2463 !! result
2464 <p>''None'' of '''this''' should be 
2465 * interepreted
2466  but rather passed unmodified
2467 {{test}}
2468 </p>
2469 !! end
2471 !! test
2472 int keyword
2473 !! input
2474 {{int:youhavenewmessages|lots of money|not!}}
2475 !! result
2476 <p>You have lots of money (not!).
2477 </p>
2478 !! end
2480 !! article
2481 Template:Includes
2482 !! text
2483 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2484 !! endarticle
2486 !! test
2487 <includeonly> and <noinclude> being included
2488 !! input
2489 {{Includes}}
2490 !! result
2491 <p>Foobar
2492 </p>
2493 !! end
2495 !! article
2496 Template:Includes2
2497 !! text
2498 <onlyinclude>Foo</onlyinclude>bar
2499 !! endarticle
2501 !! test
2502 <onlyinclude> being included
2503 !! input
2504 {{Includes2}}
2505 !! result
2506 <p>Foo
2507 </p>
2508 !! end
2511 !! article
2512 Template:Includes3
2513 !! text
2514 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2515 !! endarticle
2517 !! test
2518 <onlyinclude> and <includeonly> being included
2519 !! input
2520 {{Includes3}}
2521 !! result
2522 <p>Foo
2523 </p>
2524 !! end
2526 !! test
2527 <includeonly> and <noinclude> on a page
2528 !! input
2529 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2530 !! result
2531 <p>Foozar
2532 </p>
2533 !! end
2535 !! test
2536 <onlyinclude> on a page
2537 !! input
2538 <onlyinclude>Foo</onlyinclude>bar
2539 !! result
2540 <p>Foobar
2541 </p>
2542 !! end
2545 ### Pre-save transform tests
2547 !! test
2548 pre-save transform: subst:
2549 !! options
2551 !! input
2552 {{subst:test}}
2553 !! result
2554 This is a test template
2555 !! end
2557 !! test
2558 pre-save transform: normal template
2559 !! options
2561 !! input
2562 {{test}}
2563 !! result
2564 {{test}}
2565 !! end
2567 !! test
2568 pre-save transform: nonexistant template
2569 !! options
2571 !! input
2572 {{thistemplatedoesnotexist}}
2573 !! result
2574 {{thistemplatedoesnotexist}}
2575 !! end
2578 !! test
2579 pre-save transform: subst magic variables
2580 !! options
2582 !! input
2583 {{subst:SITENAME}}
2584 !! result
2585 MediaWiki
2586 !! end
2588 # This is bug 89, which I fixed. -- wtm
2589 !! test
2590 pre-save transform: subst: templates with parameters
2591 !! options
2593 !! input
2594 {{subst:paramtest|param="something else"}}
2595 !! result
2596 This is a test template with parameter "something else"
2597 !! end
2599 !! article
2600 Template:nowikitest
2601 !! text
2602 <nowiki>'''not wiki'''</nowiki>
2603 !! endarticle
2605 !! test
2606 pre-save transform: nowiki in subst (bug 1188)
2607 !! options
2609 !! input
2610 {{subst:nowikitest}}
2611 !! result
2612 <nowiki>'''not wiki'''</nowiki>
2613 !! end
2616 !! article
2617 Template:commenttest
2618 !! text
2619 This template has <!-- a comment --> in it.
2620 !! endarticle
2622 !! test
2623 pre-save transform: comment in subst (bug 1936)
2624 !! options
2626 !! input
2627 {{subst:commenttest}}
2628 !! result
2629 This template has <!-- a comment --> in it.
2630 !! end
2632 !! test
2633 pre-save transform: unclosed tag
2634 !! options
2635 pst noxml
2636 !! input
2637 <nowiki>'''not wiki'''
2638 !! result
2639 <nowiki>'''not wiki'''
2640 !! end
2642 !! test
2643 pre-save transform: mixed tag case
2644 !! options
2645 pst noxml
2646 !! input
2647 <NOwiki>'''not wiki'''</noWIKI>
2648 !! result
2649 <NOwiki>'''not wiki'''</noWIKI>
2650 !! end
2652 !! test
2653 pre-save transform: unclosed comment in <nowiki>
2654 !! options
2655 pst noxml
2656 !! input
2657 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2658 !! result
2659 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2660 !!end
2662 !! article
2663 Template:dangerous
2664 !!text
2665 <span onmouseover="alert('crap')">Oh no</span>
2666 !!endarticle
2668 !!test
2669 (confirming safety of fix for subst bug 1936)
2670 !! input
2671 {{Template:dangerous}}
2672 !! result
2673 <p><span>Oh no</span>
2674 </p>
2675 !! end
2677 !! test
2678 pre-save transform: comment containing gallery (bug 5024)
2679 !! options
2681 !! input
2682 <!-- <gallery>data</gallery> -->
2683 !!result
2684 <!-- <gallery>data</gallery> -->
2685 !!end
2687 !! test
2688 pre-save transform: comment containing extension
2689 !! options
2691 !! input
2692 <!-- <tag>data</tag> -->
2693 !!result
2694 <!-- <tag>data</tag> -->
2695 !!end
2697 !! test
2698 pre-save transform: comment containing nowiki
2699 !! options
2701 !! input
2702 <!-- <nowiki>data</nowiki> -->
2703 !!result
2704 <!-- <nowiki>data</nowiki> -->
2705 !!end
2707 !! test
2708 pre-save transform: comment containing math
2709 !! options
2711 !! input
2712 <!-- <math>data</math> -->
2713 !!result
2714 <!-- <math>data</math> -->
2715 !!end
2717 !! test
2718 pre-save transform: <noinclude> in subst (bug 3298)
2719 !! options
2721 !! input
2722 {{subst:Includes}}
2723 !! result
2724 Foobar
2725 !! end
2727 !! test
2728 pre-save transform: <onlyinclude> in subst (bug 3298)
2729 !! options
2731 !! input
2732 {{subst:Includes2}}
2733 !! result
2735 !! end
2737 !! test
2738 pre-save transform: context links ("pipe trick")
2739 !! options
2741 !! input
2742 [[Article (context)|]]
2743 [[Bar:Article|]]
2744 [[:Bar:Article|]]
2745 [[Bar:Article (context)|]]
2746 [[:Bar:Article (context)|]]
2747 [[|Article]]
2748 [[|Article (context)]]
2749 [[Bar:X (Y) Z|]]
2750 [[:Bar:X (Y) Z|]]
2751 !! result
2752 [[Article (context)|Article]]
2753 [[Bar:Article|Article]]
2754 [[:Bar:Article|Article]]
2755 [[Bar:Article (context)|Article]]
2756 [[:Bar:Article (context)|Article]]
2757 [[Article]]
2758 [[Article (context)]]
2759 [[Bar:X (Y) Z|X (Y) Z]]
2760 [[:Bar:X (Y) Z|X (Y) Z]]
2761 !! end
2763 !! test
2764 pre-save transform: context links ("pipe trick") with interwiki prefix
2765 !! options
2767 !! input
2768 [[interwiki:Article|]]
2769 [[:interwiki:Article|]]
2770 [[interwiki:Bar:Article|]]
2771 [[:interwiki:Bar:Article|]]
2772 !! result
2773 [[interwiki:Article|Article]]
2774 [[:interwiki:Article|Article]]
2775 [[interwiki:Bar:Article|Bar:Article]]
2776 [[:interwiki:Bar:Article|Bar:Article]]
2777 !! end
2779 !! test
2780 pre-save transform: context links ("pipe trick") with parens in title
2781 !! options
2782 pst title=[[Somearticle (context)]]
2783 !! input
2784 [[|Article]]
2785 !! result
2786 [[Article (context)|Article]]
2787 !! end
2789 !! test
2790 pre-save transform: context links ("pipe trick") with comma in title
2791 !! options
2792 pst title=[[Someplace, Somewhere]]
2793 !! input
2794 [[|Otherplace]]
2795 [[Otherplace, Elsewhere|]]
2796 [[Otherplace, Elsewhere, Anywhere|]]
2797 !! result
2798 [[Otherplace, Somewhere|Otherplace]]
2799 [[Otherplace, Elsewhere|Otherplace]]
2800 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
2801 !! end
2803 !! test
2804 pre-save transform: context links ("pipe trick") with parens and comma
2805 !! options
2806 pst title=[[Someplace (IGNORED), Somewhere]]
2807 !! input
2808 [[|Otherplace]]
2809 [[Otherplace (place), Elsewhere|]]
2810 !! result
2811 [[Otherplace, Somewhere|Otherplace]]
2812 [[Otherplace (place), Elsewhere|Otherplace]]
2813 !! end
2815 !! test
2816 pre-save transform: context links ("pipe trick") with comma and parens
2817 !! options
2818 pst title=[[Who, me? (context)]]
2819 !! input
2820 [[|Yes, you.]]
2821 [[Me, Myself, and I (1937 song)|]]
2822 !! result
2823 [[Yes, you. (context)|Yes, you.]]
2824 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
2825 !! end
2827 !! test
2828 pre-save transform: context links ("pipe trick") with namespace
2829 !! options
2830 pst title=[[Ns:Somearticle]]
2831 !! input
2832 [[|Article]]
2833 !! result
2834 [[Ns:Article|Article]]
2835 !! end
2837 !! test
2838 pre-save transform: context links ("pipe trick") with namespace and parens
2839 !! options
2840 pst title=[[Ns:Somearticle (context)]]
2841 !! input
2842 [[|Article]]
2843 !! result
2844 [[Ns:Article (context)|Article]]
2845 !! end
2847 !! test
2848 pre-save transform: context links ("pipe trick") with namespace and comma
2849 !! options
2850 pst title=[[Ns:Somearticle, Context, Whatever]]
2851 !! input
2852 [[|Article]]
2853 !! result
2854 [[Ns:Article, Context, Whatever|Article]]
2855 !! end
2857 !! test
2858 pre-save transform: context links ("pipe trick") with namespace, comma and parens
2859 !! options
2860 pst title=[[Ns:Somearticle, Context (context)]]
2861 !! input
2862 [[|Article]]
2863 !! result
2864 [[Ns:Article (context)|Article]]
2865 !! end
2867 !! test
2868 pre-save transform: context links ("pipe trick") with namespace, parens and comma
2869 !! options
2870 pst title=[[Ns:Somearticle (IGNORED), Context]]
2871 !! input
2872 [[|Article]]
2873 !! result
2874 [[Ns:Article, Context|Article]]
2875 !! end
2879 ### Message transform tests
2881 !! test
2882 message transform: magic variables
2883 !! options
2885 !! input
2886 {{SITENAME}}
2887 !! result
2888 MediaWiki
2889 !! end
2891 !! test
2892 message transform: should not transform wiki markup
2893 !! options
2895 !! input
2896 ''test''
2897 !! result
2898 ''test''
2899 !! end
2901 !! test
2902 message transform: <noinclude> in transcluded template (bug 4926)
2903 !! options
2905 !! input
2906 {{Includes}}
2907 !! result
2908 Foobar
2909 !! end
2911 !! test
2912 message transform: <onlyinclude> in transcluded template (bug 4926)
2913 !! options
2915 !! input
2916 {{Includes2}}
2917 !! result
2919 !! end
2921 !! test
2922 {{#special:}} page name, known
2923 !! options
2925 !! input
2926 {{#special:Recentchanges}}
2927 !! result
2928 Special:Recentchanges
2929 !! end
2931 !! test
2932 {{#special:}} page name, unknown
2933 !! options
2935 !! input
2936 {{#special:foobarnonexistent}}
2937 !! result
2938 No such special page
2939 !! end
2942 ### Images
2944 !! test
2945 Simple image
2946 !! input
2947 [[Image:foobar.jpg]]
2948 !! result
2949 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
2950 </p>
2951 !! end
2953 !! test
2954 Right-aligned image
2955 !! input
2956 [[Image:foobar.jpg|right]]
2957 !! result
2958 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></div>
2960 !! end
2962 !! test
2963 Image with caption
2964 !! input
2965 [[Image:foobar.jpg|right|Caption text]]
2966 !! result
2967 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></div>
2969 !! end
2971 !! test
2972 Image with frame and link
2973 !! input
2974 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2975 !! result
2976 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image Main Page"><img alt="This is a test image Main Page" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
2978 !! end
2980 !! test
2981 Link to image page- image page normally doesn't exists, hence edit link
2982 Add test with existing image page
2983 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2984 !! input
2985 [[:Image:test]]
2986 !! result
2987 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2988 </p>
2989 !! end
2991 !! test
2992 Frameless image caption with a free URL
2993 !! input
2994 [[Image:foobar.jpg|http://example.com]]
2995 !! result
2996 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
2997 </p>
2998 !! end
3000 !! test
3001 Thumbnail image caption with a free URL
3002 !! input
3003 [[Image:foobar.jpg|thumb|http://example.com]]
3004 !! result
3005 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img alt="http://example.com" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></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="" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
3007 !! end
3009 !! test
3010 BUG 1887: A ISBN with a thumbnail
3011 !! input
3012 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
3013 !! result
3014 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="ISBN 1235467890"><img alt="ISBN 1235467890" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></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="" /></a></div><a href="/index.php?title=Special:Booksources&amp;isbn=1235467890" class="internal">ISBN 1235467890</a></div></div></div>
3016 !! end
3018 !! test
3019 BUG 1887: A RFC with a thumbnail
3020 !! input
3021 [[Image:foobar.jpg|thumb|This is RFC 12354]]
3022 !! result
3023 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is RFC 12354"><img alt="This is RFC 12354" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></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="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external" title="http://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
3025 !! end
3027 !! test
3028 BUG 1887: A mailto link with a thumbnail
3029 !! input
3030 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
3031 !! result
3032 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Please mailto:nobody@example.com"><img alt="Please mailto:nobody@example.com" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></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="" /></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>
3034 !! end
3036 !! test
3037 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
3038 so math is not stripped and turns up as escaped &lt;math&gt; tags.
3039 !! input
3040 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3041 !! result
3042 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="&lt;math&gt;2+2&lt;/math&gt;"><img alt="&lt;math&gt;2+2&lt;/math&gt;" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></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="" /></a></div>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
3044 !! end
3046 !! test
3047 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3048 !! options
3049 math
3050 !! input
3051 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3052 !! result
3053 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="2 + 2"><img alt="2 + 2" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></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="" /></a></div><span class="texhtml">2 + 2</span></div></div></div>
3055 !! end
3057 # Pending resolution to bug 368
3058 !! test
3059 BUG 648: Frameless image caption with a link
3060 !! input
3061 [[Image:foobar.jpg|text with a [[link]] in it]]
3062 !! result
3063 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3064 </p>
3065 !! end
3067 !! test
3068 BUG 648: Frameless image caption with a link (suffix)
3069 !! input
3070 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3071 !! result
3072 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3073 </p>
3074 !! end
3076 !! test
3077 BUG 648: Frameless image caption with an interwiki link
3078 !! input
3079 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3080 !! result
3081 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3082 </p>
3083 !! end
3085 !! test
3086 BUG 648: Frameless image caption with a piped interwiki link
3087 !! input
3088 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3089 !! result
3090 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3091 </p>
3092 !! end
3094 !! test
3095 Escape HTML special chars in image alt text
3096 !! input
3097 [[Image:foobar.jpg|& < > "]]
3098 !! result
3099 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3100 </p>
3101 !! end
3103 !! test
3104 BUG 499: Alt text should have &#1234;, not &amp;1234;
3105 !! input
3106 [[Image:foobar.jpg|&#9792;]]
3107 !! result
3108 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="♀"><img alt="♀" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3109 </p>
3110 !! end
3112 !! test
3113 Broken image caption with link
3114 !! input
3115 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3116 !! result
3117 <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.
3118 </p>
3119 !! end
3121 !! test
3122 Image caption containing another image
3123 !! input
3124 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3125 !! result
3126 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a caption with another Image:Icon.png inside it!"><img alt="This is a caption with another Image:Icon.png inside it!" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></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="" /></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>
3128 !! end
3130 !! test
3131 Image caption containing a newline
3132 !! input
3133 [[Image:Foobar.jpg|This
3134 *is some text]]
3135 !! result
3136 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3137 </p>
3138 !!end
3141 !! test
3142 Bug 3090: External links other than http: in image captions
3143 !! input
3144 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3145 !! result
3146 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This caption has irc and Secure ext links in it."><img alt="This caption has irc and Secure ext links in it." longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" /></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="" /></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>
3148 !! end
3152 ### Subpages
3154 !! article
3155 Subpage test/subpage
3156 !! text
3158 !! endarticle
3160 !! test
3161 Subpage link
3162 !! options
3163 subpage title=[[Subpage test]]
3164 !! input
3165 [[/subpage]]
3166 !! result
3167 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3168 </p>
3169 !! end
3171 !! test
3172 Subpage noslash link
3173 !! options
3174 subpage title=[[Subpage test]]
3175 !!input
3176 [[/subpage/]]
3177 !! result
3178 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3179 </p>
3180 !! end
3182 !! test
3183 Disabled subpages
3184 !! input
3185 [[/subpage]]
3186 !! result
3187 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
3188 </p>
3189 !! end
3191 !! test
3192 BUG 561: {{/Subpage}}
3193 !! options
3194 subpage title=[[Page]]
3195 !! input
3196 {{/Subpage}}
3197 !! result
3198 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
3199 </p>
3200 !! end
3203 ### Categories
3205 !! article
3206 Category:MediaWiki User's Guide
3207 !! text
3208 blah
3209 !! endarticle
3211 !! test
3212 Link to category
3213 !! input
3214 [[:Category:MediaWiki User's Guide]]
3215 !! result
3216 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3217 </p>
3218 !! end
3220 !! test
3221 Simple category
3222 !! options
3224 !! input
3225 [[Category:MediaWiki User's Guide]]
3226 !! result
3227 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3228 !! end
3231 ### Inter-language links
3233 !! test
3234 Inter-language links
3235 !! options
3237 !! input
3238 [[es:Alimento]]
3239 [[fr:Nourriture]]
3240 [[zh:&#39135;&#21697;]]
3241 !! result
3242 es:Alimento fr:Nourriture zh:食品
3243 !! end
3246 ### Sections
3248 !! test
3249 Basic section headings
3250 !! input
3251 == Headline 1 ==
3252 Some text
3254 ==Headline 2==
3255 More
3256 ===Smaller headline===
3257 Blah blah
3258 !! result
3259 <a name="Headline_1"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline"> Headline 1 </span></h2>
3260 <p>Some text
3261 </p>
3262 <a name="Headline_2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline">Headline 2</span></h2>
3263 <p>More
3264 </p>
3265 <a name="Smaller_headline"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline">Smaller headline</span></h3>
3266 <p>Blah blah
3267 </p>
3268 !! end
3270 !! test
3271 Section headings with TOC
3272 !! input
3273 == Headline 1 ==
3274 === Subheadline 1 ===
3275 ===== Skipping a level =====
3276 ====== Skipping a level ======
3278 == Headline 2 ==
3279 Some text
3280 ===Another headline===
3281 !! result
3282 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3283 <ul>
3284 <li class="toclevel-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3285 <ul>
3286 <li class="toclevel-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3287 <ul>
3288 <li class="toclevel-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3289 <ul>
3290 <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>
3291 </ul>
3292 </li>
3293 </ul>
3294 </li>
3295 </ul>
3296 </li>
3297 <li class="toclevel-1"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3298 <ul>
3299 <li class="toclevel-2"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3300 </ul>
3301 </li>
3302 </ul>
3303 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3304 <a name="Headline_1"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline"> Headline 1 </span></h2>
3305 <a name="Subheadline_1"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline"> Subheadline 1 </span></h3>
3306 <a name="Skipping_a_level"></a><h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline"> Skipping a level </span></h5>
3307 <a name="Skipping_a_level_2"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline"> Skipping a level </span></h6>
3308 <a name="Headline_2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline"> Headline 2 </span></h2>
3309 <p>Some text
3310 </p>
3311 <a name="Another_headline"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline">Another headline</span></h3>
3313 !! end
3315 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3316 !! test
3317 Handling of sections up to level 6 and beyond
3318 !! input 
3319 = Level 1 Heading=
3320 == Level 2 Heading==
3321 === Level 3 Heading===
3322 ==== Level 4 Heading====
3323 ===== Level 5 Heading=====
3324 ====== Level 6 Heading======
3325 ======= Level 7 Heading=======
3326 ======== Level 8 Heading========
3327 ========= Level 9 Heading=========
3328 ========== Level 10 Heading==========
3329 !! result
3330 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3331 <ul>
3332 <li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3333 <ul>
3334 <li class="toclevel-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3335 <ul>
3336 <li class="toclevel-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3337 <ul>
3338 <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>
3339 <ul>
3340 <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>
3341 <ul>
3342 <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>
3343 <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>
3344 <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>
3345 <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>
3346 <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>
3347 </ul>
3348 </li>
3349 </ul>
3350 </li>
3351 </ul>
3352 </li>
3353 </ul>
3354 </li>
3355 </ul>
3356 </li>
3357 </ul>
3358 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3359 <a name="Level_1_Heading"></a><h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline"> Level 1 Heading</span></h1>
3360 <a name="Level_2_Heading"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline"> Level 2 Heading</span></h2>
3361 <a name="Level_3_Heading"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline"> Level 3 Heading</span></h3>
3362 <a name="Level_4_Heading"></a><h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline"> Level 4 Heading</span></h4>
3363 <a name="Level_5_Heading"></a><h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline"> Level 5 Heading</span></h5>
3364 <a name="Level_6_Heading"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline"> Level 6 Heading</span></h6>
3365 <a name=".3D_Level_7_Heading.3D"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline">= Level 7 Heading=</span></h6>
3366 <a name=".3D.3D_Level_8_Heading.3D.3D"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline">== Level 8 Heading==</span></h6>
3367 <a name=".3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline">=== Level 9 Heading===</span></h6>
3368 <a name=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline">==== Level 10 Heading====</span></h6>
3370 !! end
3372 !! test
3373 Resolving duplicate section names
3374 !! input
3375 == Foo bar ==
3376 == Foo bar ==
3377 !! result
3378 <a name="Foo_bar"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
3379 <a name="Foo_bar_2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
3381 !! end
3383 !! article
3384 Template:sections
3385 !! text
3386 ===Section 1===
3387 ==Section 2==
3388 !! endarticle
3390 !! test
3391 Template with sections, __NOTOC__
3392 !! input
3393 __NOTOC__
3394 ==Section 0==
3395 {{sections}}
3396 ==Section 4==
3397 !! result
3398 <a name="Section_0"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline">Section 0</span></h2>
3399 <a name="Section_1"></a><h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 1</span></h3>
3400 <a name="Section_2"></a><h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 2</span></h2>
3401 <a name="Section_4"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline">Section 4</span></h2>
3403 !! end
3405 !! test
3406 __NOEDITSECTION__ keyword
3407 !! input
3408 __NOEDITSECTION__
3409 ==Section 1==
3410 ==Section 2==
3411 !! result
3412 <a name="Section_1"></a><h2> <span class="mw-headline">Section 1</span></h2>
3413 <a name="Section_2"></a><h2> <span class="mw-headline">Section 2</span></h2>
3415 !! end
3417 !! test
3418 Link inside a section heading
3419 !! input
3420 ==Section with a [[Main Page|link]] in it==
3421 !! result
3422 <a name="Section_with_a_link_in_it"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
3424 !! end
3427 !! test
3428 BUG 1219 URL next to image (good)
3429 !! input
3430 http://example.com [[Image:foobar.jpg]]
3431 !! result
3432 <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 alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3433 </p>
3434 !!end
3436 !! test
3437 BUG 1219 URL next to image (broken)
3438 !! input
3439 http://example.com[[Image:foobar.jpg]]
3440 !! result
3441 <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 alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3442 </p>
3443 !!end
3445 !! test
3446 Bug 1186 news: in the middle of text
3447 !! input
3448 http://en.wikinews.org/wiki/Wikinews:Workplace
3449 !! result
3450 <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>
3451 </p>
3452 !!end
3455 !! test
3456 Namespaced link must have a title
3457 !! input
3458 [[Project:]]
3459 !! result
3460 <p>[[Project:]]
3461 </p>
3462 !!end
3464 !! test
3465 Namespaced link must have a title (bad fragment version)
3466 !! input
3467 [[Project:#fragment]]
3468 !! result
3469 <p>[[Project:#fragment]]
3470 </p>
3471 !!end
3474 !! test
3475 div with no attributes
3476 !! input
3477 <div>HTML rocks</div>
3478 !! result
3479 <div>HTML rocks</div>
3481 !! end
3483 !! test
3484 div with double-quoted attribute
3485 !! input
3486 <div id="rock">HTML rocks</div>
3487 !! result
3488 <div id="rock">HTML rocks</div>
3490 !! end
3492 !! test
3493 div with single-quoted attribute
3494 !! input
3495 <div id='rock'>HTML rocks</div>
3496 !! result
3497 <div id="rock">HTML rocks</div>
3499 !! end
3501 !! test
3502 div with unquoted attribute
3503 !! input
3504 <div id=rock>HTML rocks</div>
3505 !! result
3506 <div id="rock">HTML rocks</div>
3508 !! end
3510 !! test
3511 div with illegal double attributes
3512 !! input
3513 <div align="center" align="right">HTML rocks</div>
3514 !! result
3515 <div align="right">HTML rocks</div>
3517 !!end
3519 !! test
3520 HTML multiple attributes correction
3521 !! input
3522 <p class="error" class="awesome">Awesome!</p>
3523 !! result
3524 <p class="awesome">Awesome!</p>
3526 !!end
3528 !! test
3529 Table multiple attributes correction
3530 !! input
3532 !+ class="error" class="awesome"| status
3534 !! result
3535 <table>
3536 <tr>
3537 <th class="awesome"> status
3538 </th></tr></table>
3540 !!end
3542 !! test
3543 DIV IN UPPERCASE
3544 !! input
3545 <DIV ALIGN="center">HTML ROCKS</DIV>
3546 !! result
3547 <div align="center">HTML ROCKS</div>
3549 !!end
3552 !! test
3553 text with amp in the middle of nowhere
3554 !! input
3555 Remember AT&T?
3556 !!result
3557 <p>Remember AT&amp;T?
3558 </p>
3559 !! end
3561 !! test
3562 text with character entity: eacute
3563 !! input
3564 I always thought &eacute; was a cute letter.
3565 !! result
3566 <p>I always thought &eacute; was a cute letter.
3567 </p>
3568 !! end
3570 !! test
3571 text with undefined character entity: xacute
3572 !! input
3573 I always thought &xacute; was a cute letter.
3574 !! result
3575 <p>I always thought &amp;xacute; was a cute letter.
3576 </p>
3577 !! end
3581 ### Media links
3584 !! test
3585 Media link
3586 !! input
3587 [[Media:Foobar.jpg]]
3588 !! result
3589 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3590 </p>
3591 !! end
3593 !! test
3594 Media link with text
3595 !! input
3596 [[Media:Foobar.jpg|A neat file to look at]]
3597 !! result
3598 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3599 </p>
3600 !! end
3602 # FIXME: this is still bad HTML tag nesting
3603 !! test
3604 Media link with nasty text
3605 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3606 !! input
3607 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3608 !! result
3609 <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>
3611 !! end
3613 !! test
3614 Media link to nonexistent file (bug 1702)
3615 !! input
3616 [[Media:No such.jpg]]
3617 !! result
3618 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
3619 </p>
3620 !! end
3622 !! test
3623 Image link to nonexistent file (bug 1850 - good)
3624 !! input
3625 [[Image:No such.jpg]]
3626 !! result
3627 <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>
3628 </p>
3629 !! end
3631 !! test
3632 :Image link to nonexistent file (bug 1850 - bad)
3633 !! input
3634 [[:Image:No such.jpg]]
3635 !! result
3636 <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>
3637 </p>
3638 !! end
3642 !! test
3643 Character reference normalization in link text (bug 1938)
3644 !! input
3645 [[Main Page|this&that]]
3646 !! result
3647 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3648 </p>
3649 !!end
3651 !! test
3652 Empty attribute crash test (bug 2067)
3653 !! input
3654 <font color="">foo</font>
3655 !! result
3656 <p><font color="">foo</font>
3657 </p>
3658 !! end
3660 !! test
3661 Empty attribute crash test single-quotes (bug 2067)
3662 !! input
3663 <font color=''>foo</font>
3664 !! result
3665 <p><font color="">foo</font>
3666 </p>
3667 !! end
3669 !! test
3670 Attribute test: equals, then nothing
3671 !! input
3672 <font color=>foo</font>
3673 !! result
3674 <p><font>foo</font>
3675 </p>
3676 !! end
3678 !! test
3679 Attribute test: unquoted value
3680 !! input
3681 <font color=x>foo</font>
3682 !! result
3683 <p><font color="x">foo</font>
3684 </p>
3685 !! end
3687 !! test
3688 Attribute test: unquoted but illegal value (hash)
3689 !! input
3690 <font color=#x>foo</font>
3691 !! result
3692 <p><font color="#x">foo</font>
3693 </p>
3694 !! end
3696 !! test
3697 Attribute test: no value
3698 !! input
3699 <font color>foo</font>
3700 !! result
3701 <p><font color="color">foo</font>
3702 </p>
3703 !! end
3705 !! test
3706 Bug 2095: link with three closing brackets
3707 !! input
3708 [[Main Page]]]
3709 !! result
3710 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3711 </p>
3712 !! end
3714 !! test
3715 Bug 2095: link with pipe and three closing brackets
3716 !! input
3717 [[Main Page|link]]]
3718 !! result
3719 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3720 </p>
3721 !! end
3723 !! test
3724 Bug 2095: link with pipe and three closing brackets, version 2
3725 !! input
3726 [[Main Page|[http://example.com/]]]
3727 !! result
3728 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3729 </p>
3730 !! end
3734 ### Safety
3737 !! article
3738 Template:Dangerous attribute
3739 !! text
3740 " onmouseover="alert(document.cookie)
3741 !! endarticle
3743 !! article
3744 Template:Dangerous style attribute
3745 !! text
3746 border-size: expression(alert(document.cookie))
3747 !! endarticle
3749 !! article
3750 Template:Div style
3751 !! text
3752 <div style="float: right; {{{1}}}">Magic div</div>
3753 !! endarticle
3755 !! test
3756 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3757 !! input
3758 <div title="{{test}}"></div>
3759 !! result
3760 <div title="This is a test template"></div>
3762 !! end
3764 !! test
3765 Bug 2304: HTML attribute safety (dangerous template; 2309)
3766 !! input
3767 <div title="{{dangerous attribute}}"></div>
3768 !! result
3769 <div title=""></div>
3771 !! end
3773 !! test
3774 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3775 !! input
3776 <div style="{{dangerous style attribute}}"></div>
3777 !! result
3778 <div></div>
3780 !! end
3782 !! test
3783 Bug 2304: HTML attribute safety (safe parameter; 2309)
3784 !! input
3785 {{div style|width: 200px}}
3786 !! result
3787 <div style="float: right; width: 200px">Magic div</div>
3789 !! end
3791 !! test
3792 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3793 !! input
3794 {{div style|width: expression(alert(document.cookie))}}
3795 !! result
3796 <div>Magic div</div>
3798 !! end
3800 !! test
3801 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3802 !! input
3803 {{div style|"><script>alert(document.cookie)</script>}}
3804 !! result
3805 <div>Magic div</div>
3807 !! end
3809 !! test
3810 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3811 !! input
3812 {{div style|" ><script>alert(document.cookie)</script>}}
3813 !! result
3814 <div style="float: right;">Magic div</div>
3816 !! end
3818 !! test
3819 Bug 2304: HTML attribute safety (link)
3820 !! input
3821 <div title="[[Main Page]]"></div>
3822 !! result
3823 <div title="&#91;&#91;Main Page]]"></div>
3825 !! end
3827 !! test
3828 Bug 2304: HTML attribute safety (italics)
3829 !! input
3830 <div title="''foobar''"></div>
3831 !! result
3832 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3834 !! end
3836 !! test
3837 Bug 2304: HTML attribute safety (bold)
3838 !! input
3839 <div title="'''foobar'''"></div>
3840 !! result
3841 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3843 !! end
3846 !! test
3847 Bug 2304: HTML attribute safety (ISBN)
3848 !! input
3849 <div title="ISBN 1234567890"></div>
3850 !! result
3851 <div title="&#73;SBN 1234567890"></div>
3853 !! end
3855 !! test
3856 Bug 2304: HTML attribute safety (RFC)
3857 !! input
3858 <div title="RFC 1234"></div>
3859 !! result
3860 <div title="&#82;FC 1234"></div>
3862 !! end
3864 !! test
3865 Bug 2304: HTML attribute safety (PMID)
3866 !! input
3867 <div title="PMID 1234567890"></div>
3868 !! result
3869 <div title="&#80;MID 1234567890"></div>
3871 !! end
3873 !! test
3874 Bug 2304: HTML attribute safety (web link)
3875 !! input
3876 <div title="http://example.com/"></div>
3877 !! result
3878 <div title="http&#58;//example.com/"></div>
3880 !! end
3882 !! test
3883 Bug 2304: HTML attribute safety (named web link)
3884 !! input
3885 <div title="[http://example.com/ link]"></div>
3886 !! result
3887 <div title="&#91;http&#58;//example.com/ link]"></div>
3889 !! end
3891 !! test
3892 Bug 3244: HTML attribute safety (extension; safe)
3893 !! input
3894 <div style="<nowiki>background:blue</nowiki>"></div>
3895 !! result
3896 <div style="background:blue"></div>
3898 !! end
3900 !! test
3901 Bug 3244: HTML attribute safety (extension; unsafe)
3902 !! input
3903 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3904 !! result
3905 <div></div>
3907 !! end
3909 !! test
3910 Math section safety when disabled
3911 !! input
3912 <math><script>alert(document.cookies);</script></math>
3913 !! result
3914 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3915 </p>
3916 !! end
3918 # More MSIE fun discovered by Tom Gilder
3920 !! test
3921 MSIE CSS safety test: spurious slash
3922 !! input
3923 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3924 !! result
3925 <div>evil</div>
3927 !! end
3929 !! test
3930 MSIE CSS safety test: hex code
3931 !! input
3932 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3933 !! result
3934 <div>evil</div>
3936 !! end
3938 !! test
3939 MSIE CSS safety test: comment in url
3940 !! input
3941 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3942 !! result
3943 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3945 !! end
3947 !! test
3948 MSIE CSS safety test: comment in expression
3949 !! input
3950 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3951 !! result
3952 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3954 !! end
3957 !! test
3958 Table attribute legitimate extension
3959 !! input
3961 !+ style="<nowiki>color:blue</nowiki>"| status
3963 !! result
3964 <table>
3965 <tr>
3966 <th style="color:blue"> status
3967 </th></tr></table>
3969 !!end
3971 !! test
3972 Table attribute safety
3973 !! input
3975 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3977 !! result
3978 <table>
3979 <tr>
3980 <th> status
3981 </th></tr></table>
3983 !! end
3986 !! article
3987 Template:Identity
3988 !! text
3989 {{{1}}}
3990 !! endarticle
3992 !! test
3993 Expansion of multi-line templates in attribute values (bug 6255)
3994 !! input
3995 <div style="background: {{identity|#00FF00}}">-</div>
3996 !! result
3997 <div style="background: #00FF00">-</div>
3999 !! end
4002 !! test
4003 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4004 !! input
4005 <div style="background: 
4006 #00FF00">-</div>
4007 !! result
4008 <div style="background: #00FF00">-</div>
4010 !! end
4012 !! test
4013 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4014 !! input
4015 <div style="background: &#10;#00FF00">-</div>
4016 !! result
4017 <div style="background: &#10;#00FF00">-</div>
4019 !! end
4022 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4024 !! test
4025 Parser hook: empty input
4026 !! input
4027 <tag></tag>
4028 !! result
4029 <pre>
4030 string(0) ""
4031 array(0) {
4033 </pre>
4035 !! end
4037 !! test
4038 Parser hook: empty input using terminated empty elements
4039 !! input
4040 <tag/>
4041 !! result
4042 <pre>
4043 NULL
4044 array(0) {
4046 </pre>
4048 !! end
4050 !! test
4051 Parser hook: empty input using terminated empty elements (space before)
4052 !! input
4053 <tag />
4054 !! result
4055 <pre>
4056 NULL
4057 array(0) {
4059 </pre>
4061 !! end
4063 !! test
4064 Parser hook: basic input
4065 !! input
4066 <tag>input</tag>
4067 !! result
4068 <pre>
4069 string(5) "input"
4070 array(0) {
4072 </pre>
4074 !! end
4077 !! test
4078 Parser hook: case insensetive
4079 !! input
4080 <TAG>input</TAG>
4081 !! result
4082 <pre>
4083 string(5) "input"
4084 array(0) {
4086 </pre>
4088 !! end
4091 !! test
4092 Parser hook: case insensetive, redux
4093 !! input
4094 <TaG>input</TAg>
4095 !! result
4096 <pre>
4097 string(5) "input"
4098 array(0) {
4100 </pre>
4102 !! end
4104 !! test
4105 Parser hook: nested tags
4106 !! options
4107 noxml
4108 !! input
4109 <tag><tag></tag></tag>
4110 !! result
4111 <pre>
4112 string(5) "<tag>"
4113 array(0) {
4115 </pre>&lt;/tag&gt;
4117 !! end
4119 !! test
4120 Parser hook: basic arguments
4121 !! input
4122 <tag width=200 height = "100" depth = '50' square></tag>
4123 !! result
4124 <pre>
4125 string(0) ""
4126 array(4) {
4127   ["width"]=>
4128   string(3) "200"
4129   ["height"]=>
4130   string(3) "100"
4131   ["depth"]=>
4132   string(2) "50"
4133   ["square"]=>
4134   string(6) "square"
4136 </pre>
4138 !! end
4140 !! test
4141 Parser hook: argument containing a forward slash (bug 5344)
4142 !! input
4143 <tag filename='/tmp/bla'></tag>
4144 !! result
4145 <pre>
4146 string(0) ""
4147 array(1) {
4148   ["filename"]=>
4149   string(8) "/tmp/bla"
4151 </pre>
4153 !! end
4155 !! test
4156 Parser hook: empty input using terminated empty elements (bug 2374)
4157 !! input
4158 <tag foo=bar/>text
4159 !! result
4160 <pre>
4161 NULL
4162 array(1) {
4163   ["foo"]=>
4164   string(3) "bar"
4166 </pre>text
4168 !! end
4170 # </tag> should be output literally since there is no matching tag that begins it
4171 !! test
4172 Parser hook: basic arguments using terminated empty elements (bug 2374)
4173 !! input
4174 <tag width=200 height = "100" depth = '50' square/>
4175 other stuff
4176 </tag>
4177 !! result
4178 <pre>
4179 NULL
4180 array(4) {
4181   ["width"]=>
4182   string(3) "200"
4183   ["height"]=>
4184   string(3) "100"
4185   ["depth"]=>
4186   string(2) "50"
4187   ["square"]=>
4188   string(6) "square"
4190 </pre>
4191 <p>other stuff
4192 &lt;/tag&gt;
4193 </p>
4194 !! end
4197 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4200 !! test
4201 Parser hook: static parser hook not inside a comment
4202 !! input
4203 <statictag>hello, world</statictag>
4204 <statictag action=flush/>
4205 !! result
4206 <p>hello, world
4207 </p>
4208 !! end
4211 !! test
4212 Parser hook: static parser hook inside a comment
4213 !! input
4214 <!-- <statictag>hello, world</statictag> -->
4215 <statictag action=flush/>
4216 !! result
4217 <p><br />
4218 </p>
4219 !! end
4221 # Nested template calls; this case was broken by Parser.php rev 1.506,
4222 # since reverted.
4224 !! article
4225 Template:One-parameter
4226 !! text
4227 (My parameter is: {{{1}}})
4228 !! endarticle
4230 !! article
4231 Template:Map-one-parameter
4232 !! text
4233 {{{{{1}}}|{{{2}}}}}
4234 !! endarticle
4236 !! test
4237 Nested template calls
4238 !! input
4239 {{Map-one-parameter|One-parameter|param}}
4240 !! result
4241 <p>(My parameter is: param)
4242 </p>
4243 !! end
4247 ### Sanitizer
4249 !! test
4250 Sanitizer: Closing of open tags
4251 !! input
4252 <s></s><table></table>
4253 !! result
4254 <s></s><table></table>
4256 !! end
4258 !! test
4259 Sanitizer: Closing of open but not closed tags
4260 !! input
4261 <s>foo
4262 !! result
4263 <p><s>foo</s>
4264 </p>
4265 !! end
4267 !! test
4268 Sanitizer: Closing of closed but not open tags
4269 !! input
4270 </s>
4271 !! result
4272 <p>&lt;/s&gt;
4273 </p>
4274 !! end
4276 !! test
4277 Sanitizer: Closing of closed but not open table tags
4278 !! input
4279 Table not started</td></tr></table>
4280 !! result
4281 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4282 </p>
4283 !! end
4285 !! test
4286 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4287 !! input
4288 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4289 !! result
4290 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4291 </p>
4292 !! end
4294 !! test
4295 Sanitizer: Validating the contents of the id attribute (bug 4515)
4296 !! options
4297 disabled
4298 !! input
4299 <br id=9 />
4300 !! result
4301 Something, but defenetly not <br id="9" />...
4302 !! end
4304 !! test
4305 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4306 !! options
4307 disabled
4308 !! input
4309 <br id="foo" /><br id="foo" />
4310 !! result
4311 Something need to be done. foo-2 ? 
4312 !! end
4314 !! test
4315 Language converter: output gets cut off unexpectedly (bug 5757)
4316 !! options
4317 language=zh
4318 !! input
4319 this bit is safe: }-
4321 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4323 then we get cut off here: }-
4325 all additional text is vanished
4326 !! result
4327 <p>this bit is safe: }-
4328 </p><p>but if we add a conversion instance: xxx
4329 </p><p>then we get cut off here: }-
4330 </p><p>all additional text is vanished
4331 </p>
4332 !! end
4334 !! test
4335 Self closed html pairs (bug 5487)
4336 !! options
4337 !! input
4338 <center><font id="bug" />Centered text</center>
4339 <div><font id="bug2" />In div text</div>
4340 !! result
4341 <center>&lt;font id="bug" /&gt;Centered text</center>
4342 <div>&lt;font id="bug2" /&gt;In div text</div>
4344 !! end
4350 !! test
4351 HTML bullet list, closed tags (bug 5497)
4352 !! input
4353 <ul>
4354 <li>One</li>
4355 <li>Two</li>
4356 </ul>
4357 !! result
4358 <ul>
4359 <li>One</li>
4360 <li>Two</li>
4361 </ul>
4363 !! end
4365 !! test
4366 HTML bullet list, unclosed tags (bug 5497)
4367 !! input
4368 <ul>
4369 <li>One
4370 <li>Two
4371 </ul>
4372 !! result
4373 <ul>
4374 <li>One
4375 </li><li>Two
4376 </li></ul>
4378 !! end
4380 !! test
4381 HTML ordered list, closed tags (bug 5497)
4382 !! input
4383 <ol>
4384 <li>One</li>
4385 <li>Two</li>
4386 </ol>
4387 !! result
4388 <ol>
4389 <li>One</li>
4390 <li>Two</li>
4391 </ol>
4393 !! end
4395 !! test
4396 HTML ordered list, unclosed tags (bug 5497)
4397 !! input
4398 <ol>
4399 <li>One
4400 <li>Two
4401 </ol>
4402 !! result
4403 <ol>
4404 <li>One
4405 </li><li>Two
4406 </li></ol>
4408 !! end
4410 !! test
4411 HTML nested bullet list, closed tags (bug 5497)
4412 !! input
4413 <ul>
4414 <li>One</li>
4415 <li>Two:
4416 <ul>
4417 <li>Sub-one</li>
4418 <li>Sub-two</li>
4419 </ul>
4420 </li>
4421 </ul>
4422 !! result
4423 <ul>
4424 <li>One</li>
4425 <li>Two:
4426 <ul>
4427 <li>Sub-one</li>
4428 <li>Sub-two</li>
4429 </ul>
4430 </li>
4431 </ul>
4433 !! end
4435 !! test
4436 HTML nested bullet list, open tags (bug 5497)
4437 !! input
4438 <ul>
4439 <li>One
4440 <li>Two:
4441 <ul>
4442 <li>Sub-one
4443 <li>Sub-two
4444 </ul>
4445 </ul>
4446 !! result
4447 <ul>
4448 <li>One
4449 </li><li>Two:
4450 <ul>
4451 <li>Sub-one
4452 </li><li>Sub-two
4453 </li></ul>
4454 </li></ul>
4456 !! end
4458 !! test
4459 HTML nested ordered list, closed tags (bug 5497)
4460 !! input
4461 <ol>
4462 <li>One</li>
4463 <li>Two:
4464 <ol>
4465 <li>Sub-one</li>
4466 <li>Sub-two</li>
4467 </ol>
4468 </li>
4469 </ol>
4470 !! result
4471 <ol>
4472 <li>One</li>
4473 <li>Two:
4474 <ol>
4475 <li>Sub-one</li>
4476 <li>Sub-two</li>
4477 </ol>
4478 </li>
4479 </ol>
4481 !! end
4483 !! test
4484 HTML nested ordered list, open tags (bug 5497)
4485 !! input
4486 <ol>
4487 <li>One
4488 <li>Two:
4489 <ol>
4490 <li>Sub-one
4491 <li>Sub-two
4492 </ol>
4493 </ol>
4494 !! result
4495 <ol>
4496 <li>One
4497 </li><li>Two:
4498 <ol>
4499 <li>Sub-one
4500 </li><li>Sub-two
4501 </li></ol>
4502 </li></ol>
4504 !! end
4506 !! test
4507 HTML ordered list item with parameters oddity
4508 !! input
4509 <ol><li id="fragment">One</li></ol>
4510 !! result
4511 <ol><li id="fragment">One</li></ol>
4513 !! end
4515 !!test
4516 bug 5918: autonumbering
4517 !! input
4518 [http://first/] [http://second] [ftp://ftp]
4520 ftp://inlineftp
4522 [mailto:enclosed@mail.tld With target]
4524 [mailto:enclosed@mail.tld]
4526 mailto:inline@mail.tld
4527 !! result
4528 <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>
4529 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4530 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4531 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4532 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4533 </p>
4534 !! end
4538 # Security and HTML correctness
4539 # From Nick Jenkins' fuzz testing
4542 !! test
4543 Fuzz testing: Parser13
4544 !! input
4545 {| 
4546 | http://a|
4547 !! result
4548 <table>
4549 <tr>
4550 <td>
4551 </td>
4552 </tr>
4553 </table>
4555 !! end
4557 !! test
4558 Fuzz testing: Parser14
4559 !! input
4560 == onmouseover= ==
4561 http://__TOC__
4562 !! result
4563 <a name="onmouseover.3D"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline"> onmouseover= </span></h2>
4564 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4565 <ul>
4566 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4567 </ul>
4568 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4570 !! end
4572 !! test
4573 Fuzz testing: Parser14-table
4574 !! input
4575 ==a==
4576 {| STYLE=__TOC__
4577 !! result
4578 <a name="a"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline">a</span></h2>
4579 <table style="&#95;_TOC&#95;_">
4580 <tr><td></td></tr>
4581 </table>
4583 !! end
4585 # Known to produce bogus xml (extra </td>)
4586 !! test
4587 Fuzz testing: Parser16
4588 !! options
4589 noxml
4590 !! input
4592 !https://||||||
4593 !! result
4594 <table>
4595 <tr>
4596 <th>https://</th><th></th><th></th><th>
4597 </td>
4598 </tr>
4599 </table>
4601 !! end
4603 !! test
4604 Fuzz testing: Parser21
4605 !! input
4607 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4609 !! result
4610 <table>
4611 <tr>
4612 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4613 </th><td>
4614 </td>
4615 </tr>
4616 </table>
4618 !! end
4620 !! test
4621 Fuzz testing: Parser22
4622 !! input
4623 http://===r:::https://b
4626 !!result
4627 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4628 </p>
4629 <table>
4630 <tr><td></td></tr>
4631 </table>
4633 !! end
4635 # Known to produce bad XML for now
4636 !! test
4637 Fuzz testing: Parser24
4638 !! options
4639 noxml
4640 !! input
4642 {{{|
4643 <u CLASS=
4644 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4645 <br style="onmouseover='alert(document.cookie);' " />
4647 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4649 !! result
4650 <table>
4652 <u class="&#124;">} &gt;
4653 <br style="onmouseover='alert(document.cookie);'" />
4655 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4656 <tr>
4657 <td></u>
4658 </td>
4659 </tr>
4660 </table>
4662 !! end
4664 # Known to produce bad XML for now
4665 !!test
4666 Fuzz testing: Parser25 (bug 6055)
4667 !! options
4668 noxml
4669 !! input
4672 <LI CLASS=||
4674 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4675 !! result
4676 <li class="&#124;&#124;">
4677 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4679 !! end
4681 !!test
4682 Fuzz testing: URL adjacent extension (with space, clean)
4683 !! options
4684 !! input
4685 http://example.com <nowiki>junk</nowiki>
4686 !! result
4687 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
4688 </p>
4689 !!end
4691 !!test
4692 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4693 !! options
4694 !! input
4695 http://example.com<nowiki>junk</nowiki>
4696 !! result
4697 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
4698 </p>
4699 !!end
4701 !!test
4702 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4703 !! options
4704 !! input
4705 http://example.com<pre>junk</pre>
4706 !! result
4707 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4709 !!end
4711 !!test
4712 Fuzz testing: image with bogus manual thumbnail
4713 !!input
4714 [[Image:foobar.jpg|thumbnail= ]]
4715 !!result
4716 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" /></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="" /></a></div></div></div></div>
4718 !!end
4720 !! test
4721 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
4722 !! input
4723 <pre dir="&#10;"></pre>
4724 !! result
4725 <pre dir="&#10;"></pre>
4727 !! end
4729 !! test
4730 Parsing optional HTML elements (Bug 6171)
4731 !! options
4732 !! input
4733 <table>
4734   <tr>
4735     <td> Some tabular data</td>
4736     <td> More tabular data ...
4737     <td> And yet som tabular data</td>
4738   </tr>
4739 </table>
4740 !! result
4741 <table>
4742   <tr>
4743     <td> Some tabular data</td>
4744     <td> More tabular data ...
4745     </td><td> And yet som tabular data</td>
4746   </tr>
4747 </table>
4749 !! end
4751 !! test
4752 Correct handling of <td>, <tr> (Bug 6171)
4753 !! options
4754 !! input
4755 <table>
4756   <tr>
4757     <td> Some tabular data</td>
4758     <td> More tabular data ...</td>
4759     <td> And yet som tabular data</td>
4760   </tr>
4761 </table>
4762 !! result
4763 <table>
4764   <tr>
4765     <td> Some tabular data</td>
4766     <td> More tabular data ...</td>
4767     <td> And yet som tabular data</td>
4768   </tr>
4769 </table>
4771 !! end
4774 !! test
4775 Parsing crashing regression (fr:JavaScript)
4776 !! input
4777 </body></x>
4778 !! result
4779 <p>&lt;/body&gt;&lt;/x&gt;
4780 </p>
4781 !! end
4783 !! test
4784 Inline wiki vs wiki block nesting
4785 !! input
4786 '''Bold paragraph
4788 New wiki paragraph
4789 !! result
4790 <p><b>Bold paragraph</b>
4791 </p><p>New wiki paragraph
4792 </p>
4793 !! end
4795 !! test
4796 Inline HTML vs wiki block nesting
4797 !! input
4798 <b>Bold paragraph
4800 New wiki paragraph
4801 !! result
4802 <p><b>Bold paragraph</b>
4803 </p><p>New wiki paragraph
4804 </p>
4805 !! end
4808 !!test
4809 Mixing markup for italics and bold
4810 !! options
4811 !! input
4812 '''bold''''''bold''bolditalics'''''
4813 !! result
4814 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4815 </p>
4816 !! end
4819 !! article
4820 Xyzzyx
4821 !! text
4822 Article for special page transclusion test
4823 !! endarticle
4825 !! test
4826 Special page transclusion
4827 !! options
4828 !! input
4829 {{Special:Prefixindex/Xyzzyx}}
4830 !! result
4831 <p><br />
4832 </p>
4833 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4835 !! end
4837 !! test
4838 Special page transclusion twice (bug 5021)
4839 !! options
4840 !! input
4841 {{Special:Prefixindex/Xyzzyx}}
4842 {{Special:Prefixindex/Xyzzyx}}
4843 !! result
4844 <p><br />
4845 </p>
4846 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4847 <p><br />
4848 </p>
4849 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4851 !! end
4853 !! test
4854 Transclusion of default MediaWiki message
4855 !! input
4856 {{MediaWiki:Mainpage}}
4857 !!result
4858 <p>Main Page
4859 </p>
4860 !! end
4862 !! test
4863 Transclusion of nonexistent MediaWiki message
4864 !! input
4865 {{MediaWiki:Mainpagexxx}}
4866 !!result
4867 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit" class="new" title="MediaWiki:Mainpagexxx">MediaWiki:Mainpagexxx</a>
4868 </p>
4869 !! end
4871 !! test
4872 Transclusion of MediaWiki message with underscore
4873 !! input
4874 {{MediaWiki:history_short}}
4875 !! result
4876 <p>History
4877 </p>
4878 !! end
4880 !! test
4881 Transclusion of MediaWiki message with space
4882 !! input
4883 {{MediaWiki:history short}}
4884 !! result
4885 <p>History
4886 </p>
4887 !! end
4889 !! test
4890 Invalid header with following text
4891 !! input
4892 = x = y
4893 !! result
4894 <p>= x = y
4895 </p>
4896 !! end
4899 !! test
4900 Section extraction test (section 0)
4901 !! options
4902 section=0
4903 !! input
4904 start
4905 ==a==
4906 ===aa===
4907 ====aaa====
4908 ==b==
4909 ===ba===
4910 ===bb===
4911 ====bba====
4912 ===bc===
4913 ==c==
4914 ===ca===
4915 !! result
4916 start
4917 !! end
4919 !! test
4920 Section extraction test (section 1)
4921 !! options
4922 section=1
4923 !! input
4924 start
4925 ==a==
4926 ===aa===
4927 ====aaa====
4928 ==b==
4929 ===ba===
4930 ===bb===
4931 ====bba====
4932 ===bc===
4933 ==c==
4934 ===ca===
4935 !! result
4936 ==a==
4937 ===aa===
4938 ====aaa====
4939 !! end
4941 !! test
4942 Section extraction test (section 2)
4943 !! options
4944 section=2
4945 !! input
4946 start
4947 ==a==
4948 ===aa===
4949 ====aaa====
4950 ==b==
4951 ===ba===
4952 ===bb===
4953 ====bba====
4954 ===bc===
4955 ==c==
4956 ===ca===
4957 !! result
4958 ===aa===
4959 ====aaa====
4960 !! end
4962 !! test
4963 Section extraction test (section 3)
4964 !! options
4965 section=3
4966 !! input
4967 start
4968 ==a==
4969 ===aa===
4970 ====aaa====
4971 ==b==
4972 ===ba===
4973 ===bb===
4974 ====bba====
4975 ===bc===
4976 ==c==
4977 ===ca===
4978 !! result
4979 ====aaa====
4980 !! end
4982 !! test
4983 Section extraction test (section 4)
4984 !! options
4985 section=4
4986 !! input
4987 start
4988 ==a==
4989 ===aa===
4990 ====aaa====
4991 ==b==
4992 ===ba===
4993 ===bb===
4994 ====bba====
4995 ===bc===
4996 ==c==
4997 ===ca===
4998 !! result
4999 ==b==
5000 ===ba===
5001 ===bb===
5002 ====bba====
5003 ===bc===
5004 !! end
5006 !! test
5007 Section extraction test (section 5)
5008 !! options
5009 section=5
5010 !! input
5011 start
5012 ==a==
5013 ===aa===
5014 ====aaa====
5015 ==b==
5016 ===ba===
5017 ===bb===
5018 ====bba====
5019 ===bc===
5020 ==c==
5021 ===ca===
5022 !! result
5023 ===ba===
5024 !! end
5026 !! test
5027 Section extraction test (section 6)
5028 !! options
5029 section=6
5030 !! input
5031 start
5032 ==a==
5033 ===aa===
5034 ====aaa====
5035 ==b==
5036 ===ba===
5037 ===bb===
5038 ====bba====
5039 ===bc===
5040 ==c==
5041 ===ca===
5042 !! result
5043 ===bb===
5044 ====bba====
5045 !! end
5047 !! test
5048 Section extraction test (section 7)
5049 !! options
5050 section=7
5051 !! input
5052 start
5053 ==a==
5054 ===aa===
5055 ====aaa====
5056 ==b==
5057 ===ba===
5058 ===bb===
5059 ====bba====
5060 ===bc===
5061 ==c==
5062 ===ca===
5063 !! result
5064 ====bba====
5065 !! end
5067 !! test
5068 Section extraction test (section 8)
5069 !! options
5070 section=8
5071 !! input
5072 start
5073 ==a==
5074 ===aa===
5075 ====aaa====
5076 ==b==
5077 ===ba===
5078 ===bb===
5079 ====bba====
5080 ===bc===
5081 ==c==
5082 ===ca===
5083 !! result
5084 ===bc===
5085 !! end
5087 !! test
5088 Section extraction test (section 9)
5089 !! options
5090 section=9
5091 !! input
5092 start
5093 ==a==
5094 ===aa===
5095 ====aaa====
5096 ==b==
5097 ===ba===
5098 ===bb===
5099 ====bba====
5100 ===bc===
5101 ==c==
5102 ===ca===
5103 !! result
5104 ==c==
5105 ===ca===
5106 !! end
5108 !! test
5109 Section extraction test (section 10)
5110 !! options
5111 section=10
5112 !! input
5113 start
5114 ==a==
5115 ===aa===
5116 ====aaa====
5117 ==b==
5118 ===ba===
5119 ===bb===
5120 ====bba====
5121 ===bc===
5122 ==c==
5123 ===ca===
5124 !! result
5125 ===ca===
5126 !! end
5128 !! test
5129 Section extraction test (nonexistent section 11)
5130 !! options
5131 section=11
5132 !! input
5133 start
5134 ==a==
5135 ===aa===
5136 ====aaa====
5137 ==b==
5138 ===ba===
5139 ===bb===
5140 ====bba====
5141 ===bc===
5142 ==c==
5143 ===ca===
5144 !! result
5145 !! end
5147 !! test
5148 Section extraction test with bogus heading (section 1)
5149 !! options
5150 section=1
5151 !! input
5152 ==a==
5153 ==bogus== not a legal section
5154 ==b==
5155 !! result
5156 ==a==
5157 ==bogus== not a legal section
5158 !! end
5160 !! test
5161 Section extraction test with bogus heading (section 2)
5162 !! options
5163 section=2
5164 !! input
5165 ==a==
5166 ==bogus== not a legal section
5167 ==b==
5168 !! result
5169 ==b==
5170 !! end
5172 !! test
5173 Section extraction test with comment after heading (section 1)
5174 !! options
5175 section=1
5176 !! input
5177 ==a==
5178 ==legal== <!-- a legal section -->
5179 ==b==
5180 !! result
5181 ==a==
5182 !! end
5184 !! test
5185 Section extraction test with comment after heading (section 2)
5186 !! options
5187 section=2
5188 !! input
5189 ==a==
5190 ==legal== <!-- a legal section -->
5191 ==b==
5192 !! result
5193 ==legal== <!-- a legal section -->
5194 !! end
5196 !! test
5197 Section extraction test with bogus <nowiki> heading (section 1)
5198 !! options
5199 section=1
5200 !! input
5201 ==a==
5202 ==bogus== <nowiki>not a legal section</nowiki>
5203 ==b==
5204 !! result
5205 ==a==
5206 ==bogus== <nowiki>not a legal section</nowiki>
5207 !! end
5209 !! test
5210 Section extraction test with bogus <nowiki> heading (section 2)
5211 !! options
5212 section=2
5213 !! input
5214 ==a==
5215 ==bogus== <nowiki>not a legal section</nowiki>
5216 ==b==
5217 !! result
5218 ==b==
5219 !! end
5222 !! test
5223 Section extraction prefixed by comment (section 1) (bug 2587)
5224 !! options
5225 section=1
5226 !! input
5227 <!-- -->==sec1==
5228 ==sec2==
5229 !!result
5230 <!-- -->==sec1==
5231 !!end
5233 !! test
5234 Section extraction prefixed by comment (section 2) (bug 2587)
5235 !! options
5236 section=2
5237 !! input
5238 <!-- -->==sec1==
5239 ==sec2==
5240 !!result
5241 ==sec2==
5242 !!end
5245 !! test
5246 Section extraction, mixed wiki and html (section 1) (bug 2607)
5247 !! options
5248 section=1
5249 !! input
5250 <h2>1</h2>
5252 ==2==
5254 ==3==
5255 three
5256 !! result
5257 <h2>1</h2>
5259 !! end
5261 !! test
5262 Section extraction, mixed wiki and html (section 2) (bug 2607)
5263 !! options
5264 section=2
5265 !! input
5266 <h2>1</h2>
5268 ==2==
5270 ==3==
5271 three
5272 !! result
5273 ==2==
5275 !! end
5278 !! test
5279 Section extraction, heading surrounded by <noinclude> (bug 3342)
5280 !! options
5281 section=1
5282 !! input
5283 <noinclude>==a==</noinclude>
5284 text
5285 !! result
5286 <noinclude>==a==</noinclude>
5287 text
5288 !!end
5291 !! test
5292 Section extraction, HTML heading subsections (bug 5272)
5293 !! options
5294 section=1
5295 !! input
5296 <h2>a</h2>
5297 <h3>aa</h3>
5298 <h2>b</h2>
5299 !! result
5300 <h2>a</h2>
5301 <h3>aa</h3>
5302 !! end
5304 !! test
5305 Section extraction, HTML headings should be ignored in extensions (bug 3476)
5306 !! options
5307 section=2
5308 !! input
5309 <h2>a</h2>
5310 <tag>
5311 <h2>not b</h2>
5312 </tag>
5313 <h2>b</h2>
5314 !! result
5315 <h2>b</h2>
5316 !! end
5318 !! test
5319 Section replacement test (section 0)
5320 !! options
5321 replace=0,"xxx"
5322 !! input
5323 start
5324 ==a==
5325 ===aa===
5326 ====aaa====
5327 ==b==
5328 ===ba===
5329 ===bb===
5330 ====bba====
5331 ===bc===
5332 ==c==
5333 ===ca===
5334 !! result
5337 ==a==
5338 ===aa===
5339 ====aaa====
5340 ==b==
5341 ===ba===
5342 ===bb===
5343 ====bba====
5344 ===bc===
5345 ==c==
5346 ===ca===
5347 !! end
5349 !! test
5350 Section replacement test (section 1)
5351 !! options
5352 replace=1,"xxx"
5353 !! input
5354 start
5355 ==a==
5356 ===aa===
5357 ====aaa====
5358 ==b==
5359 ===ba===
5360 ===bb===
5361 ====bba====
5362 ===bc===
5363 ==c==
5364 ===ca===
5365 !! result
5366 start
5369 ==b==
5370 ===ba===
5371 ===bb===
5372 ====bba====
5373 ===bc===
5374 ==c==
5375 ===ca===
5376 !! end
5378 !! test
5379 Section replacement test (section 2)
5380 !! options
5381 replace=2,"xxx"
5382 !! input
5383 start
5384 ==a==
5385 ===aa===
5386 ====aaa====
5387 ==b==
5388 ===ba===
5389 ===bb===
5390 ====bba====
5391 ===bc===
5392 ==c==
5393 ===ca===
5394 !! result
5395 start
5396 ==a==
5399 ==b==
5400 ===ba===
5401 ===bb===
5402 ====bba====
5403 ===bc===
5404 ==c==
5405 ===ca===
5406 !! end
5408 !! test
5409 Section replacement test (section 3)
5410 !! options
5411 replace=3,"xxx"
5412 !! input
5413 start
5414 ==a==
5415 ===aa===
5416 ====aaa====
5417 ==b==
5418 ===ba===
5419 ===bb===
5420 ====bba====
5421 ===bc===
5422 ==c==
5423 ===ca===
5424 !! result
5425 start
5426 ==a==
5427 ===aa===
5430 ==b==
5431 ===ba===
5432 ===bb===
5433 ====bba====
5434 ===bc===
5435 ==c==
5436 ===ca===
5437 !! end
5439 !! test
5440 Section replacement test (section 4)
5441 !! options
5442 replace=4,"xxx"
5443 !! input
5444 start
5445 ==a==
5446 ===aa===
5447 ====aaa====
5448 ==b==
5449 ===ba===
5450 ===bb===
5451 ====bba====
5452 ===bc===
5453 ==c==
5454 ===ca===
5455 !! result
5456 start
5457 ==a==
5458 ===aa===
5459 ====aaa====
5462 ==c==
5463 ===ca===
5464 !! end
5466 !! test
5467 Section replacement test (section 5)
5468 !! options
5469 replace=5,"xxx"
5470 !! input
5471 start
5472 ==a==
5473 ===aa===
5474 ====aaa====
5475 ==b==
5476 ===ba===
5477 ===bb===
5478 ====bba====
5479 ===bc===
5480 ==c==
5481 ===ca===
5482 !! result
5483 start
5484 ==a==
5485 ===aa===
5486 ====aaa====
5487 ==b==
5490 ===bb===
5491 ====bba====
5492 ===bc===
5493 ==c==
5494 ===ca===
5495 !! end
5497 !! test
5498 Section replacement test (section 6)
5499 !! options
5500 replace=6,"xxx"
5501 !! input
5502 start
5503 ==a==
5504 ===aa===
5505 ====aaa====
5506 ==b==
5507 ===ba===
5508 ===bb===
5509 ====bba====
5510 ===bc===
5511 ==c==
5512 ===ca===
5513 !! result
5514 start
5515 ==a==
5516 ===aa===
5517 ====aaa====
5518 ==b==
5519 ===ba===
5522 ===bc===
5523 ==c==
5524 ===ca===
5525 !! end
5527 !! test
5528 Section replacement test (section 7)
5529 !! options
5530 replace=7,"xxx"
5531 !! input
5532 start
5533 ==a==
5534 ===aa===
5535 ====aaa====
5536 ==b==
5537 ===ba===
5538 ===bb===
5539 ====bba====
5540 ===bc===
5541 ==c==
5542 ===ca===
5543 !! result
5544 start
5545 ==a==
5546 ===aa===
5547 ====aaa====
5548 ==b==
5549 ===ba===
5550 ===bb===
5553 ===bc===
5554 ==c==
5555 ===ca===
5556 !! end
5558 !! test
5559 Section replacement test (section 8)
5560 !! options
5561 replace=8,"xxx"
5562 !! input
5563 start
5564 ==a==
5565 ===aa===
5566 ====aaa====
5567 ==b==
5568 ===ba===
5569 ===bb===
5570 ====bba====
5571 ===bc===
5572 ==c==
5573 ===ca===
5574 !! result
5575 start
5576 ==a==
5577 ===aa===
5578 ====aaa====
5579 ==b==
5580 ===ba===
5581 ===bb===
5582 ====bba====
5585 ==c==
5586 ===ca===
5587 !!end
5589 !! test
5590 Section replacement test (section 9)
5591 !! options
5592 replace=9,"xxx"
5593 !! input
5594 start
5595 ==a==
5596 ===aa===
5597 ====aaa====
5598 ==b==
5599 ===ba===
5600 ===bb===
5601 ====bba====
5602 ===bc===
5603 ==c==
5604 ===ca===
5605 !! result
5606 start
5607 ==a==
5608 ===aa===
5609 ====aaa====
5610 ==b==
5611 ===ba===
5612 ===bb===
5613 ====bba====
5614 ===bc===
5616 !! end
5618 !! test
5619 Section replacement test (section 10)
5620 !! options
5621 replace=10,"xxx"
5622 !! input
5623 start
5624 ==a==
5625 ===aa===
5626 ====aaa====
5627 ==b==
5628 ===ba===
5629 ===bb===
5630 ====bba====
5631 ===bc===
5632 ==c==
5633 ===ca===
5634 !! result
5635 start
5636 ==a==
5637 ===aa===
5638 ====aaa====
5639 ==b==
5640 ===ba===
5641 ===bb===
5642 ====bba====
5643 ===bc===
5644 ==c==
5646 !! end
5649 !! test
5650 Section extraction, HTML headings not at line boundaries (section 0)
5651 !! options
5652 section=0
5653 !! input
5654 <h2>Evil</h2><i>blah blah blah</i>
5656 evil blah
5658 <h2>Nice</h2>
5660 nice blah
5662 <i>extra evil</i><h2>Extra nasty</h2>
5664 extra nasty
5665 !! result
5666 !! end
5668 !! test
5669 Section extraction, HTML headings not at line boundaries (section 1)
5670 !! options
5671 section=1
5672 !! input
5673 <h2>Evil</h2><i>blah blah blah</i>
5675 evil blah
5677 <h2>Nice</h2>
5679 nice blah
5681 <i>extra evil</i><h2>Extra nasty</h2>
5683 extra nasty
5684 !! result
5685 <h2>Evil</h2><i>blah blah blah</i>
5687 evil blah
5688 !! end
5690 !! test
5691 Section extraction, HTML headings not at line boundaries (section 2)
5692 !! options
5693 section=2
5694 !! input
5695 <h2>Evil</h2><i>blah blah blah</i>
5697 evil blah
5699 <h2>Nice</h2>
5701 nice blah
5703 <i>extra evil</i><h2>Extra nasty</h2>
5705 extra nasty
5706 !! result
5707 <h2>Nice</h2>
5709 nice blah
5711 <i>extra evil</i>
5712 !! end
5714 !! test
5715 Section extraction, HTML headings not at line boundaries (section 3)
5716 !! options
5717 section=3
5718 !! input
5719 <h2>Evil</h2><i>blah blah blah</i>
5721 evil blah
5723 <h2>Nice</h2>
5725 nice blah
5727 <i>extra evil</i><h2>Extra nasty</h2>
5729 extra nasty
5730 !! result
5731 <h2>Extra nasty</h2>
5733 extra nasty
5734 !! end
5737 !! test
5738 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5739 !! options
5740 section=1
5741 !! input
5742 ==a==
5743                     a
5744 !! result
5745 ==a==
5746                     a
5747 !! end
5749 !! test
5750 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5751 !! options
5752 section=1
5753 !! input
5754 ==a==
5755                    a
5756 !! result
5757 ==a==
5758                    a
5759 !! end
5761 !! test
5762 Handling of &#x0A; in URLs
5763 !! input
5764 **irc://&#x0A;a
5765 !! result
5766 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
5767 </li></ul>
5768 </li></ul>
5770 !!end
5772 !! test
5773 5 quotes, code coverage +1 line
5774 !! input
5775 '''''
5776 !! result
5777 !! end
5779 !! test
5780 Special:Search page linking.
5781 !! input
5782 {{Special:search}}
5783 !! result
5784 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
5785 </p>
5786 !! end
5788 !! test
5789 Say the magic word
5790 !! input
5791 * {{PAGENAME}}
5792 * {{BASEPAGENAME}}
5793 * {{SUBPAGENAME}}
5794 * {{SUBPAGENAMEE}}
5795 * {{BASEPAGENAME}}
5796 * {{BASEPAGENAMEE}}
5797 * {{TALKPAGENAME}}
5798 * {{TALKPAGENAMEE}}
5799 * {{SUBJECTPAGENAME}}
5800 * {{SUBJECTPAGENAMEE}}
5801 * {{NAMESPACEE}}
5802 * {{NAMESPACE}}
5803 * {{TALKSPACE}}
5804 * {{TALKSPACEE}}
5805 * {{SUBJECTSPACE}}
5806 * {{SUBJECTSPACEE}}
5807 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
5808 !! result
5809 <ul><li> Parser test
5810 </li><li> Parser test
5811 </li><li> Parser test
5812 </li><li> Parser_test
5813 </li><li> Parser test
5814 </li><li> Parser_test
5815 </li><li> Talk:Parser test
5816 </li><li> Talk:Parser_test
5817 </li><li> Parser test
5818 </li><li> Parser_test
5819 </li><li> 
5820 </li><li> 
5821 </li><li> Talk
5822 </li><li> Talk
5823 </li><li> 
5824 </li><li> 
5825 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit" class="new" title="Template:Dynamic">Template:Dynamic</a>
5826 </li></ul>
5828 !! end
5829 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
5831 !! test
5832 Gallery
5833 !! input
5834 <gallery>
5835 image1.png |
5836 image2.gif|||||
5838 image3|
5839 image4    |300px| centre
5840  image5.svg| http://///////
5841 [[x|xx]]]]
5842 * image6
5843 </gallery>
5844 !! result
5845 <table class="gallery" cellspacing="0" cellpadding="0">
5846         <tr>
5847                 <td><div class="gallerybox" style="width: 150px;">
5848                         <div style="height: 152px;">Image1.png</div>
5849                         <div class="gallerytext">
5850                         </div>
5851                 </div></td>
5852                 <td><div class="gallerybox" style="width: 150px;">
5853                         <div style="height: 152px;">Image2.gif</div>
5854                         <div class="gallerytext">
5855 <p>||||
5856 </p>
5857                         </div>
5858                 </div></td>
5859                 <td><div class="gallerybox" style="width: 150px;">
5860                         <div style="height: 152px;">Image3</div>
5861                         <div class="gallerytext">
5862                         </div>
5863                 </div></td>
5864                 <td><div class="gallerybox" style="width: 150px;">
5865                         <div style="height: 152px;">Image4</div>
5866                         <div class="gallerytext">
5867 <p>300px| centre
5868 </p>
5869                         </div>
5870                 </div></td>
5871         </tr>
5872         <tr>
5873                 <td><div class="gallerybox" style="width: 150px;">
5874                         <div style="height: 152px;">Image5.svg</div>
5875                         <div class="gallerytext">
5876 <pre><a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a>
5877 </pre>
5878                         </div>
5879                 </div></td>
5880                 <td><div class="gallerybox" style="width: 150px;">
5881                         <div style="height: 152px;">* image6</div>
5882                         <div class="gallerytext">
5883                         </div>
5884                 </div></td>
5885         </tr>
5886 </table>
5888 !! end
5890 !! test
5891 HTML Hex character encoding (spells the word "JavaScript")
5892 !! input
5893 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
5894 !! result
5895 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
5896 </p>
5897 !! end
5899 !! test
5900 __FORCETOC__ override
5901 !! input 
5902 __NEWSECTIONLINK__
5903 __FORCETOC__
5904 !! result
5905 <p><br />
5906 </p>
5907 !! end
5909 !! test
5910 ISBN code coverage
5911 !! input
5912 ISBN  978-0-1234-56&#x20;789
5913 !! result
5914 <p><a href="/index.php?title=Special:Booksources&amp;isbn=9780123456" class="internal">ISBN 978-0-1234-56</a>&#x20;789
5915 </p>
5916 !! end
5918 !! test
5919 ISBN followed by 5 spaces
5920 !! input
5921 ISBN    
5922 !! result
5923 <p>ISBN    
5924 </p>
5925 !! end
5927 !! test
5928 Double ISBN
5929 !! input
5930 ISBN ISBN 1234567890
5931 !! result
5932 <p>ISBN <a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1234567890</a>
5933 </p>
5934 !! end
5936 !! test
5937 Double RFC
5938 !! input
5939 RFC RFC 1234
5940 !! result
5941 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external" title="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
5942 </p>
5943 !! end
5945 !! test
5946 Double RFC with a wiki link 
5947 !! input
5948 RFC [[RFC 1234]]
5949 !! result
5950 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit" class="new" title="RFC 1234">RFC 1234</a>
5951 </p>
5952 !! end
5954 !! test
5955 RFC code coverage
5956 !! input
5957 RFC   983&#x20;987
5958 !! result
5959 <p><a href="http://tools.ietf.org/html/rfc983" class="external" title="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
5960 </p>
5961 !! end
5963 !! test
5964 Centre-aligned image
5965 !! input
5966 [[Image:foobar.jpg|centre]]
5967 !! result
5968 <div class="center"><div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></div></div>
5970 !!end
5972 !! test
5973 None-aligned image
5974 !! input
5975 [[Image:foobar.jpg|none]]
5976 !! result
5977 <div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></div>
5979 !!end
5981 !! test
5982 Width + Height sized image (using px) (height is ignored)
5983 !! input
5984 [[Image:foobar.jpg|640x480px]]
5985 !! result
5986 <p><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" /></a>
5987 </p>
5988 !!end
5990 !! test
5991 Another italics / bold test
5992 !! input
5993  ''' ''x'
5994 !! result
5995 <pre>'<i> </i>x'
5996 </pre>
5997 !!end
5999 # Note the results may be incorrect, as parserTest output included this:
6000 # XML error: Mismatched tag at byte 6120:
6001 # ...<dd> </dt></dl> </dd...
6002 !! test
6003 dt/dd/dl test
6004 !! input
6005 :;;;::
6006 !! result
6007 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6008 </dd></dl>
6009 </dd></dl>
6010 </dt></dl>
6011 </dt></dl>
6012 </dt></dl>
6013 </dd></dl>
6015 !!end
6018 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6019 !! test
6020 Images with the "|" character in the comment
6021 !! input
6022 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6023 !! result
6024 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="An external URL"><img alt="An external URL" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></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="" /></a></div>An <a href="http://test/?param1=|left|&amp;param2=|x" class="external text" title="http://test/?param1=|left|&amp;param2=|x" rel="nofollow">external</a> URL</div></div></div>
6026 !!end
6028 !! test
6029 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6030 !! input
6031 <html><script>alert(1);</script></html>
6032 !! result
6033 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6034 </p>
6035 !! end
6037 !! test
6038 HTML with raw HTML ($wgRawHtml==true)
6039 !! options
6040 rawhtml
6041 !! input
6042 <html><script>alert(1);</script></html>
6043 !! result
6044 <p><script>alert(1);</script>
6045 </p>
6046 !! end
6048 !! test
6049 Parents of subpages, one level up
6050 !! options
6051 subpage title=[[Subpage test/L1/L2/L3]]
6052 !! input
6053 [[../|L2]]
6054 !! result
6055 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit" class="new" title="Subpage test/L1/L2">L2</a>
6056 </p>
6057 !! end
6060 !! test
6061 Parents of subpages, one level up, not named
6062 !! options
6063 subpage title=[[Subpage test/L1/L2/L3]]
6064 !! input
6065 [[../]]
6066 !! result
6067 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit" class="new" title="Subpage test/L1/L2">Subpage test/L1/L2</a>
6068 </p>
6069 !! end
6073 !! test
6074 Parents of subpages, two levels up
6075 !! options
6076 disabled
6077 subpage title=[[Subpage test/L1/L2/L3]]
6078 !! input
6079 [[../../|L1]]2
6080 !! result
6081 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit" class="new" title="Subpage test/L1">L1</a>
6082 </p>
6083 !! end
6086 # Question: should result be "/index.php?title=Subpage_test/L1&amp;action=edit" instead?
6087 !! test
6088 Parents of subpages, two levels up, without trailing slash or name.
6089 !! options
6090 subpage title=[[Subpage test/L1/L2/L3]]
6091 !! input
6092 [[../..]]
6093 !! result
6094 <p><a href="/index.php?title=Subpage_test/L1/L2/..&amp;action=edit" class="new" title="Subpage test/L1">../..</a>
6095 </p>
6096 !! end
6098 # Question: Why should the link text in the above test be "../..", yet in this test the "../.." part is silently dropped?
6099 # Current result: <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit" class="new" title="Subpage test/L1////">///
6100 !! test
6101 Parents of subpages, two levels up, with lots of extra trailing slashes.
6102 !! options
6103 subpage title=[[Subpage test/L1/L2/L3]]
6104 !! input
6105 [[../../////]]
6106 !! result
6107 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit" class="new" title="Subpage test/L1">Subpage test/L1</a>
6108 </p>
6109 !! end
6111 !! test
6112 Definition list code coverage
6113 !! input
6114 ; title   : def
6115 ; title : def
6116 ;title: def
6117 !! result
6118 <dl><dt> title  &nbsp;</dt><dd> def
6119 </dd><dt> title&nbsp;</dt><dd> def
6120 </dd><dt>title</dt><dd> def
6121 </dd></dl>
6123 !! end
6125 !! test
6126 Don't fall for the self-closing div
6127 !! input
6128 <div>hello world</div/>
6129 !! result
6130 <div>hello world</div>
6132 !! end
6134 !! test
6135 MSGNW magic word
6136 !! input
6137 {{MSGNW:msg}}
6138 !! result
6139 <p>&#91;&#91;:Template:Msg]]
6140 </p>
6141 !! end
6143 !! test
6144 RAW magic word
6145 !! input
6146 {{RAW:QUERTY}}
6147 !! result
6148 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit" class="new" title="Template:QUERTY">Template:QUERTY</a>
6149 </p>
6150 !! end
6152 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6153 !! test
6154 Always escape literal '>' in output, not just after '<'
6155 !! input
6157 !! result
6158 <p>&gt;&lt;&gt;
6159 </p>
6160 !! end
6162 !! test
6163 Template caching
6164 !! input
6165 {{Test}}
6166 {{Test}}
6167 !! result
6168 <p>This is a test template
6169 This is a test template
6170 </p>
6171 !! end
6174 !! article
6175 MediaWiki:Fake
6176 !! text
6177 ==header==
6178 !! endarticle
6180 !! test
6181 Inclusion of !userCanEdit() content
6182 !! input
6183 {{MediaWiki:Fake}}
6184 !! result
6185 <a name="header"></a><h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline">header</span></h2>
6187 !! end
6190 !! test
6191 Out-of-order TOC heading levels
6192 !! input
6193 ==2==
6194 ======6======
6195 ===3===
6197 =====5=====
6198 ==2==
6199 !! result
6200 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6201 <ul>
6202 <li class="toclevel-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6203 <ul>
6204 <li class="toclevel-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6205 <li class="toclevel-2"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6206 </ul>
6207 </li>
6208 <li class="toclevel-1"><a href="#1_7"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6209 <ul>
6210 <li class="toclevel-2"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6211 <li class="toclevel-2"><a href="#2_4"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6212 </ul>
6213 </li>
6214 </ul>
6215 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6216 <a name="2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
6217 <a name="6"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline">6</span></h6>
6218 <a name="3"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline">3</span></h3>
6219 <a name="1_7"></a><h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline">1</span></h1>
6220 <a name="5"></a><h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline">5</span></h5>
6221 <a name="2_4"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
6223 !! end
6226 !! test
6227 ISBN with a dummy number
6228 !! input
6229 ISBN ---
6230 !! result
6231 <p>ISBN ---
6232 </p>
6233 !! end
6236 !! test
6237 ISBN with space-delimited number
6238 !! input
6239 ISBN 92 9017 032 8
6240 !! result
6241 <p><a href="/index.php?title=Special:Booksources&amp;isbn=9290170328" class="internal">ISBN 92 9017 032 8</a>
6242 </p>
6243 !! end
6246 !! test
6247 ISBN with multiple spaces, no number
6248 !! input
6249 ISBN  foo
6250 !! result
6251 <p>ISBN  foo
6252 </p>
6253 !! end
6256 !! test
6257 ISBN length
6258 !! input
6259 ISBN 123456789
6261 ISBN 1234567890
6263 ISBN 12345678901
6264 !! result
6265 <p>ISBN 123456789
6266 </p><p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1234567890</a>
6267 </p><p>ISBN 12345678901
6268 </p>
6269 !! end
6272 !! test
6273 ISBN with trailing year (bug 8110)
6274 !! input
6275 ISBN 1-234-56789-0 - 2006
6277 ISBN 1 234 56789 0 - 2006
6278 !! result
6279 <p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1-234-56789-0</a> - 2006
6280 </p><p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1 234 56789 0</a> - 2006
6281 </p>
6282 !! end
6285 !! test
6286 Pages in namespace (Magic word disabled currently)
6287 !! input
6288 {{PAGESINNAMESPACE:}}
6289 !! result
6291 !! end
6294 !! test
6295 anchorencode
6296 !! input
6297 {{anchorencode:foo bar©#%n}}
6298 !! result
6299 <p>foo_bar.C2.A9.23.25n
6300 </p>
6301 !! end
6304 !! test
6305 Bug 8293: Use of center tag ruins paragraph formatting
6306 !! input
6307 <center>
6309 </center>
6313  baz
6314 !! result
6315 <center>
6316 <p>foo
6317 </p>
6318 </center>
6319 <p>bar
6320 </p>
6321 <pre>baz
6322 </pre>
6323 !! end
6327 ### Language variants related tests
6329 !! test
6330 Self-link in language variants
6331 !! options
6332 title=[[Dunav]] language=sr
6333 !! input
6334 Both [[Dunav]] and [[Дунав]] are names for this river.
6335 !! result
6336 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6337 </p>
6338 !!end
6341 !! test
6342 Link to pages in language variants
6343 !! options
6344 language=sr
6345 !! input
6346 Main Page can be written as [[Маин Паге]]
6347 !! result
6348 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6349 </p>
6350 !!end
6353 !! test
6354 Multiple links to pages in language variants
6355 !! options
6356 language=sr
6357 !! input
6358 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6359 !! result
6360 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
6361 </p>
6362 !!end
6365 !! test
6366 Simple template in language variants
6367 !! options
6368 language=sr
6369 !! input
6370 {{тест}}
6371 !! result
6372 <p>This is a test template
6373 </p>
6374 !! end
6377 !! test
6378 Template with explicit namespace in language variants
6379 !! options
6380 language=sr
6381 !! input
6382 {{Template:тест}}
6383 !! result
6384 <p>This is a test template
6385 </p>
6386 !! end
6389 !! test
6390 Basic test for template parameter in language variants
6391 !! options
6392 language=sr
6393 !! input
6394 {{парамтест|param=foo}}
6395 !! result
6396 <p>This is a test template with parameter foo
6397 </p>
6398 !! end
6401 !! test
6402 Simple category in language variants
6403 !! options
6404 language=sr cat
6405 !! input
6406 [[:Category:МедиаWики Усер'с Гуиде]]
6407 !! result
6408 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6409 !! end
6412 !! test
6413 Stripping -{}- tags (language variants)
6414 !! options
6415 language=sr
6416 !! input
6417 Latin proverb: -{Ne nuntium necare}-
6418 !! result
6419 <p>Latin proverb: Ne nuntium necare
6420 </p>
6421 !! end
6424 !! test
6425 Prevent conversion with -{}- tags (language variants)
6426 !! options
6427 language=sr variant=sr-ec
6428 !! input
6429 Latinski: -{Ne nuntium necare}-
6430 !! result
6431 <p>Латински: Ne nuntium necare
6432 </p>
6433 !! end
6436 !! test
6437 Prevent conversion of text with -{}- tags (language variants)
6438 !! options
6439 language=sr variant=sr-ec
6440 !! input
6441 Latinski: -{Ne nuntium necare}-
6442 !! result
6443 <p>Латински: Ne nuntium necare
6444 </p>
6445 !! end
6448 !! test
6449 Prevent conversion of links with -{}- tags (language variants)
6450 !! options
6451 language=sr variant=sr-ec
6452 !! input
6453 -{[[Main Page]]}-
6454 !! result
6455 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
6456 </p>
6457 !! end
6460 !! test
6461 -{}- tags within headlines (within html for parserConvert())
6462 !! options
6463 language=sr variant=sr-ec
6464 !! input
6465 == -{Naslov}- ==
6466 !! result
6467 <a name="-.7BNaslov.7D-"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline"> Naslov </span></h2>
6469 !! end
6472 !! test
6473 Explicit definition of language variant alternatives
6474 !! options
6475 language=zh variant=zh-tw
6476 !! input
6477 -{zh:China;zh-tw:Taiwan}-, not China
6478 !! result
6479 <p>Taiwan, not China
6480 </p>
6481 !! end
6484 !! test
6485 Adding explicit session-wise language variant mapping (A flag)
6486 !! options
6487 language=zh variant=zh-tw
6488 !! input
6489 -{A|zh:China;zh-tw:Taiwan}- is China
6490 !! result
6491 <p>Taiwan is Taiwan
6492 </p>
6493 !! end
6496 !! test
6497 Adding explicit conversion rule for title (T flag)
6498 !! options
6499 language=zh variant=zh-tw
6500 !! input
6501 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
6502 !! result
6503 <p>Should be stripped!
6504 </p>
6505 !! end
6508 !! test
6509 Raw output of variant escape tags (R flag)
6510 !! options
6511 language=zh variant=zh-tw
6512 !! input
6513 Raw: -{R|zh:China;zh-tw:Taiwan}-
6514 !! result
6515 <p>Raw: zh:China;zh-tw:Taiwan
6516 </p>
6517 !! end
6520 !! test
6521 Do not convert roman numbers to language variants
6522 !! options
6523 language=sr variant=sr-ec
6524 !! input
6525 Fridrih IV je car.
6526 !! result
6527 <p>Фридрих IV је цар.
6528 </p>
6529 !! end
6536 TODO:
6537 more images
6538 more tables
6539 math
6540 character entities
6541 and much more
6542 Try for 100% code coverage