having some fun with doxygen error log
[mediawiki.git] / maintenance / parserTests.txt
blobc4f944684c6f0ee8e85b3363390da660dbc0186b
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 #       One of the following three:
10 #       (default)       generate HTML output
11 #       pst             apply pre-save transform
12 #       msg             apply message transform
14 #       Plus any combination of these:
16 #       cat             add category links
17 #       ill             add inter-language links
18 #       subpage         enable subpages (disabled by default)
19 #       noxml           don't check for XML well formdness
20 #       title=[[XXX]]   run test using article title XXX
21 #   language=XXX        set content language to XXX for this test
22 #       disabled        do not run test
24 # For testing purposes, temporary articles can created:
25 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
26 # where '/' denotes a newline.
28 # This is the standard article assumed to exist.
29 !! article
30 Main Page
31 !! text
32 blah blah
33 !! endarticle
35 ###
36 ### Basic tests
37 ###
38 !! test
39 Blank input
40 !! input
41 !! result
42 !! end
45 !! test
46 Simple paragraph
47 !! input
48 This is a simple paragraph.
49 !! result
50 <p>This is a simple paragraph.
51 </p>
52 !! end
54 !! test
55 Simple list
56 !! input
57 * Item 1
58 * Item 2
59 !! result
60 <ul><li> Item 1
61 </li><li> Item 2
62 </li></ul>
64 !! end
66 !! test
67 Italics and bold
68 !! input
69 * plain
70 * plain''italic''plain
71 * plain''italic''plain''italic''plain
72 * plain'''bold'''plain
73 * plain'''bold'''plain'''bold'''plain
74 * plain''italic''plain'''bold'''plain
75 * plain'''bold'''plain''italic''plain
76 * plain''italic'''bold-italic'''italic''plain
77 * plain'''bold''bold-italic''bold'''plain
78 * plain'''''bold-italic'''italic''plain
79 * plain'''''bold-italic''bold'''plain
80 * plain''italic'''bold-italic'''''plain
81 * plain'''bold''bold-italic'''''plain
82 * plain l'''italic''plain
83 !! result
84 <ul><li> plain
85 </li><li> plain<i>italic</i>plain
86 </li><li> plain<i>italic</i>plain<i>italic</i>plain
87 </li><li> plain<b>bold</b>plain
88 </li><li> plain<b>bold</b>plain<b>bold</b>plain
89 </li><li> plain<i>italic</i>plain<b>bold</b>plain
90 </li><li> plain<b>bold</b>plain<i>italic</i>plain
91 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
92 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
93 </li><li> plain<i><b>bold-italic</b>italic</i>plain
94 </li><li> plain<b><i>bold-italic</i>bold</b>plain
95 </li><li> plain<i>italic<b>bold-italic</b></i>plain
96 </li><li> plain<b>bold<i>bold-italic</i></b>plain
97 </li><li> plain l'<i>italic</i>plain
98 </li></ul>
100 !! end
103 ### <nowiki> test cases
106 !! test
107 <nowiki> unordered list
108 !! input
109 <nowiki>* This is not an unordered list item.</nowiki>
110 !! result
111 <p>* This is not an unordered list item.
112 </p>
113 !! end
115 !! test
116 <nowiki> spacing
117 !! input
118 <nowiki>Lorem ipsum dolor
120 sed abit.
121   sed nullum.
123 :and a colon
124 </nowiki>
125 !! result
126 <p>Lorem ipsum dolor
128 sed abit.
129   sed nullum.
131 :and a colon
133 </p>
134 !! end
136 !! test
137 nowiki 3
138 !! input
139 :There is not nowiki.
140 :There is <nowiki>nowiki</nowiki>.
142 #There is not nowiki.
143 #There is <nowiki>nowiki</nowiki>.
145 *There is not nowiki.
146 *There is <nowiki>nowiki</nowiki>.
147 !! result
148 <dl><dd>There is not nowiki.
149 </dd><dd>There is nowiki.
150 </dd></dl>
151 <ol><li>There is not nowiki.
152 </li><li>There is nowiki.
153 </li></ol>
154 <ul><li>There is not nowiki.
155 </li><li>There is nowiki.
156 </li></ul>
158 !! end
162 ### Comments
164 !! test
165 Comment test 1
166 !! input
167 <!-- comment 1 --> asdf
168 <!-- comment 2 -->
169 !! result
170 <pre>asdf
171 </pre>
173 !! end
175 !! test
176 Comment test 2
177 !! input
178 asdf
179 <!-- comment 1 -->
181 !! result
182 <p>asdf
184 </p>
185 !! end
187 !! test
188 Comment test 3
189 !! input
190 asdf
191 <!-- comment 1 -->
192 <!-- comment 2 -->
194 !! result
195 <p>asdf
197 </p>
198 !! end
200 !! test
201 Comment test 4
202 !! input
203 asdf<!-- comment 1 -->jkl
204 !! result
205 <p>asdfjkl
206 </p>
207 !! end
209 !! test
210 Comment spacing
211 !! input
213  <!-- foo --> b <!-- bar -->
215 !! result
216 <p>a
217 </p>
218 <pre> b 
219 </pre>
220 <p>c
221 </p>
222 !! end
224 !! test
225 Comment whitespace
226 !! input
227 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
228 !! result
230 !! end
232 !! test
233 Comment semantics and delimiters
234 !! input
235 <!-- --><!----><!-----><!------>
236 !! result
238 !! end
240 !! test
241 Comment semantics and delimiters, redux
242 !! input
243 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
244 -- foo -- funky huh? ... -->
245 !! result
247 !! end
249 !! test
250 Comment semantics and delimiters: directors cut
251 !! input
252 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
253 everything starting with < followed by !-- until the first -- and > we see,
254 that wouldn't be valid XML however, since in XML -- has to terminate a comment
255 -->-->
256 !! result
257 <p>-->
258 </p>
259 !! end
261 !! test
262 Comment semantics: nesting
263 !! input
264 <!--<!-- no, we're not going to do anything fancy here -->-->
265 !! result
266 <p>-->
267 </p>
268 !! end
270 !! test
271 Comment semantics: unclosed comment at end
272 !! input
273 <!--This comment will run out to the end of the document
274 !! result
276 !! end
280 ### Preformatted text
282 !! test
283 Preformatted text
284 !! input
285  This is some
286  Preformatted text
287  With ''italic''
288  And '''bold'''
289  And a [[Main Page|link]]
290 !! result
291 <pre>This is some
292 Preformatted text
293 With <i>italic</i>
294 And <b>bold</b>
295 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
296 </pre>
297 !! end
299 !! test
300 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
301 !! input
302 <pre><nowiki>
304 <cite>
305 <em>
306 </nowiki></pre>
307 !! result
308 <pre>
309 &lt;b&gt;
310 &lt;cite&gt;
311 &lt;em&gt;
312 </pre>
314 !! end
316 !! test
317 Regression with preformatted in <center>
318 !! input
319 <center>
320  Blah
321 </center>
322 !! result
323 <center>
324 <pre>Blah
325 </pre>
326 </center>
328 !! end
330 !! test
331 <pre> with attributes (bug 3202)
332 !! input
333 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
334 !! result
335 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
337 !! end
339 !! test
340 <pre> with width attribute (bug 3202)
341 !! input
342 <pre width="8">Narrow screen goodies</pre>
343 !! result
344 <pre width="8">Narrow screen goodies</pre>
346 !! end
348 !! test
349 <pre> with forbidden attribute (bug 3202)
350 !! input
351 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
352 !! result
353 <pre width="8">Narrow screen goodies</pre>
355 !! end
357 !! test
358 <pre> with forbidden attribute values (bug 3202)
359 !! input
360 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
361 !! result
362 <pre width="8">Narrow screen goodies</pre>
364 !! end
367 ### Definition lists
369 !! test
370 Simple definition
371 !! input
372 ; name : Definition
373 !! result
374 <dl><dt> name&nbsp;</dt><dd> Definition
375 </dd></dl>
377 !! end
379 !! test
380 Simple definition
381 !! input
382 : Indented text
383 !! result
384 <dl><dd> Indented text
385 </dd></dl>
387 !! end
389 !! test
390 Definition list with no space
391 !! input
392 ;name:Definition
393 !! result
394 <dl><dt>name</dt><dd>Definition
395 </dd></dl>
397 !!end
399 !! test
400 Definition list with URL link
401 !! input
402 ; http://example.com/ : definition
403 !! result
404 <dl><dt> <a href="http://example.com/" class='external free' title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
405 </dd></dl>
407 !! end
409 !! test
410 Definition list with bracketed URL link
411 !! input
412 ;[http://www.example.com/ Example]:Something about it
413 !! result
414 <dl><dt><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">Example</a></dt><dd>Something about it
415 </dd></dl>
417 !! end
419 !! test
420 Definition list with wikilink containing colon
421 !! input
422 ; [[Help:FAQ]]: The least-read page on Wikipedia
423 !! result
424 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit" class="new" title="Help:FAQ">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
425 </dd></dl>
427 !! end
429 # At Brion's and JeLuF's insistence... :)
430 !! test
431 Definition list with wikilink containing colon
432 !! input
433 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
434 !! result
435 <dl><dt>  <a href="news:alt.wikipedia.rox" class='external free' title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
436 </dd></dl>
438 !! end
440 !! test
441 Malformed definition list with colon
442 !! input
443 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
444 !! result
445 <dl><dt>  <a href="news:alt.wikipedia.rox" class='external free' title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
446 </dt></dl>
448 !! end
450 !! test
451 Definition lists: colon in external link text
452 !! input
453 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
454 !! result
455 <dl><dt> <a href="http://www.wikipedia2.org/" class='external text' title="http://www.wikipedia2.org/" rel="nofollow">Wikipedia&nbsp;: The Next Generation</a></dt><dd> OK, I made that up
456 </dd></dl>
458 !! end
460 !! test
461 Definition lists: colon in HTML attribute
462 !! input
463 ;<b style="display: inline">bold</b>
464 !! result
465 <dl><dt><b style="display: inline">bold</b>
466 </dt></dl>
468 !! end
471 !! test
472 Definition lists: self-closed tag
473 !! input
474 ;one<br/>two : two-line fun
475 !! result
476 <dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
477 </dd></dl>
479 !! end
483 ### External links
485 !! test
486 External links: non-bracketed
487 !! input
488 Non-bracketed: http://example.com
489 !! result
490 <p>Non-bracketed: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
491 </p>
492 !! end
494 !! test
495 External links: numbered
496 !! input
497 Numbered: [http://example.com]
498 Numbered: [http://example.net]
499 Numbered: [http://example.org]
500 !! result
501 <p>Numbered: <a href="http://example.com" class='external autonumber' title="http://example.com" rel="nofollow">[1]</a>
502 Numbered: <a href="http://example.net" class='external autonumber' title="http://example.net" rel="nofollow">[2]</a>
503 Numbered: <a href="http://example.org" class='external autonumber' title="http://example.org" rel="nofollow">[3]</a>
504 </p>
505 !!end
507 !! test
508 External links: specified text
509 !! input
510 Specified text: [http://example.com link]
511 !! result
512 <p>Specified text: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>
513 </p>
514 !!end
516 !! test
517 External links: trail
518 !! input
519 Linktrails should not work for external links: [http://example.com link]s
520 !! result
521 <p>Linktrails should not work for external links: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>s
522 </p>
523 !! end
525 !! test
526 External links: dollar sign in URL
527 !! input
528 http://example.com/1$2345
529 !! result
530 <p><a href="http://example.com/1$2345" class='external free' title="http://example.com/1$2345" rel="nofollow">http://example.com/1$2345</a>
531 </p>
532 !! end
534 !! test
535 External links: dollar sign in URL (named)
536 !! input
537 [http://example.com/1$2345]
538 !! result
539 <p><a href="http://example.com/1$2345" class='external autonumber' title="http://example.com/1$2345" rel="nofollow">[1]</a>
540 </p>
541 !!end
543 !! test
544 External links: open square bracket forbidden in URL (bug 4377)
545 !! input
546 http://example.com/1[2345
547 !! result
548 <p><a href="http://example.com/1" class='external free' title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
549 </p>
550 !! end
552 !! test
553 External links: open square bracket forbidden in URL (named) (bug 4377)
554 !! input
555 [http://example.com/1[2345]
556 !! result
557 <p><a href="http://example.com/1" class='external text' title="http://example.com/1" rel="nofollow">[2345</a>
558 </p>
559 !!end
561 !! test
562 External links: nowiki in URL link text (bug 6230)
563 !!input
564 [http://example.com/ <nowiki>''example site''</nowiki>]
565 !! result
566 <p><a href="http://example.com/" class='external text' title="http://example.com/" rel="nofollow">''example site''</a>
567 </p>
568 !! end
570 !! test
571 External links: newline forbidden in text (bug 6230 regression check)
572 !! input
573 [http://example.com/ first
574 second]
575 !! result
576 <p>[<a href="http://example.com/" class='external free' title="http://example.com/" rel="nofollow">http://example.com/</a> first
577 second]
578 </p>
579 !!end
581 !! test
582 External image
583 !! input
584 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
585 !! result
586 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
587 </p>
588 !! end
590 !! test
591 External image from https
592 !! input
593 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
594 !! result
595 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
596 </p>
597 !! end
599 !! test
600 Link to non-http image, no img tag
601 !! input
602 Link to non-http image, no img tag: ftp://example.com/test.jpg
603 !! result
604 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external free' title="ftp://example.com/test.jpg" rel="nofollow">ftp://example.com/test.jpg</a>
605 </p>
606 !! end
608 !! test
609 External links: terminating separator
610 !! input
611 Terminating separator: http://example.com/thing,
612 !! result
613 <p>Terminating separator: <a href="http://example.com/thing" class='external free' title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
614 </p>
615 !! end
617 !! test
618 External links: intervening separator
619 !! input
620 Intervening separator: http://example.com/1,2,3
621 !! result
622 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external free' title="http://example.com/1,2,3" rel="nofollow">http://example.com/1,2,3</a>
623 </p>
624 !! end
626 !! test
627 External links: old bug with URL in query
628 !! input
629 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
630 !! result
631 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class='external text' title="http://example.com/thing?url=http://example.com" rel="nofollow">link</a>
632 </p>
633 !! end
635 !! test
636 External links: old URL-in-URL bug, mixed protocols
637 !! input
638 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
639 !! result
640 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class='external text' title="ftp://example.com?url=http://example.com" rel="nofollow">link</a>
641 </p>
642 !!end
644 !! test
645 External links: URL in text
646 !! input
647 URL in text: [http://example.com http://example.com]
648 !! result
649 <p>URL in text: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
650 </p>
651 !! end
653 !! test
654 External links: Clickable images
655 !! input
656 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
657 !! result
658 <p>ja-style clickable images: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
659 </p>
660 !!end
662 !! test
663 External links: raw ampersand
664 !! input
665 Old &amp; use: http://x&y
666 !! result
667 <p>Old &amp; use: <a href="http://x&amp;y" class='external free' title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
668 </p>
669 !! end
671 !! test
672 External links: encoded ampersand
673 !! input
674 Old &amp; use: http://x&amp;y
675 !! result
676 <p>Old &amp; use: <a href="http://x&amp;y" class='external free' title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
677 </p>
678 !! end
680 !! test
681 External links: encoded equals (bug 6102)
682 !! input
683 http://example.com/?foo&#61;bar
684 !! result
685 <p><a href="http://example.com/?foo=bar" class='external free' title="http://example.com/?foo=bar" rel="nofollow">http://example.com/?foo=bar</a>
686 </p>
687 !! end
689 !! test
690 External links: [raw ampersand]
691 !! input
692 Old &amp; use: [http://x&y]
693 !! result
694 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
695 </p>
696 !! end
698 !! test
699 External links: [encoded ampersand]
700 !! input
701 Old &amp; use: [http://x&amp;y]
702 !! result
703 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
704 </p>
705 !! end
707 !! test
708 External links: [encoded equals] (bug 6102)
709 !! input
710 [http://example.com/?foo&#61;bar]
711 !! result
712 <p><a href="http://example.com/?foo=bar" class='external autonumber' title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
713 </p>
714 !! end
716 !! test
717 External links: www.jpeg.org (bug 554)
718 !! input
719 http://www.jpeg.org
720 !!result
721 <p><a href="http://www.jpeg.org" class='external free' title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
722 </p>
723 !! end
725 !! test
726 External links: URL within URL (original bug 2)
727 !! input
728 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
729 !! result
730 <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>
731 </p>
732 !! end
734 !! test
735 BUG 361: URL inside bracketed URL
736 !! input
737 [http://www.example.com/foo http://www.example.com/bar]
738 !! result
739 <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>
740 </p>
741 !! end
743 !! test
744 BUG 361: URL within URL, not bracketed
745 !! input
746 http://www.example.com/foo?=http://www.example.com/bar
747 !! result
748 <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>
749 </p>
750 !! end
752 !! test
753 BUG 289: ">"-token in URL-tail
754 !! input
755 http://www.example.com/<hello>
756 !! result
757 <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;
758 </p>
759 !!end
761 !! test
762 BUG 289: literal ">"-token in URL-tail
763 !! input
764 http://www.example.com/<b>html</b>
765 !! result
766 <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>
767 </p>
768 !!end
770 !! test
771 BUG 289: ">"-token in bracketed URL
772 !! input
773 [http://www.example.com/<hello> stuff]
774 !! result
775 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
776 </p>
777 !!end
779 !! test
780 BUG 289: literal ">"-token in bracketed URL
781 !! input
782 [http://www.example.com/<b>html</b> stuff]
783 !! result
784 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
785 </p>
786 !!end
788 !! test
789 BUG 289: literal double quote at end of URL
790 !! input
791 http://www.example.com/"hello"
792 !! result
793 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
794 </p>
795 !!end
797 !! test
798 BUG 289: literal double quote in bracketed URL
799 !! input
800 [http://www.example.com/"hello" stuff]
801 !! result
802 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
803 </p>
804 !!end
806 !! test
807 External links: invalid character
808 Fixme: the missing char seems to have gone missing
809 !! options
810 disabled
811 !! input
812 [http://www.example.com  test]
813 !! result
814 <p>[<a href="http://www.example.com" class='external free' title="http://www.example.com" rel="nofollow">http://www.example.com</a>  test]
815 </p>
816 !! end
818 !! test
819 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
820 !! input
821 [http://www.example.com  test]
822 !! result
823 <p><a href="http://www.example.com" class='external text' title="http://www.example.com" rel="nofollow">test</a>
824 </p>
825 !! end
827 !! test
828 External links: wiki links within external link (Bug 3695)
829 !! input
830 [http://example.com [[wikilink]] embedded in ext link]
831 !! result
832 <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>
833 </p>
834 !! end
836 !! test
837 BUG 787: Links with one slash after the url protocol are invalid
838 !! input
839 http:/example.com
841 [http:/example.com title]
842 !! result
843 <p>http:/example.com
844 </p><p>[http:/example.com title]
845 </p>
846 !! end
848 !! test
849 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
850 !! input
851 ''[http://example.com text'']
852 [http://example.com '''text]'''
853 ''Something [http://example.com in italic'']
854 ''Something [http://example.com mixed''''', even bold]'''
855 '''''Now [http://example.com both''''']
856 !! result
857 <p><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>text</i></a>
858 <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><b>text</b></a>
859 <i>Something </i><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>in italic</i></a>
860 <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>
861 <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>
862 </p>
863 !! end
866 !! test
867 Bug 4781: %26 in URL
868 !! input
869 http://www.example.com/?title=AT%26T
870 !! result
871 <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>
872 </p>
873 !! end
875 !! test
876 Bug 4781, 5267: %26 in URL
877 !! input
878 http://www.example.com/?title=100%25_Bran
879 !! result
880 <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>
881 </p>
882 !! end
884 !! test
885 Bug 4781, 5267: %28, %29 in URL
886 !! input
887 http://www.example.com/?title=Ben-Hur_%281959_film%29
888 !! result
889 <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>
890 </p>
891 !! end
894 !! test
895 Bug 4781: %26 in autonumber URL
896 !! input
897 [http://www.example.com/?title=AT%26T]
898 !! result
899 <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>
900 </p>
901 !! end
903 !! test
904 Bug 4781, 5267: %26 in autonumber URL
905 !! input
906 [http://www.example.com/?title=100%25_Bran]
907 !! result
908 <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>
909 </p>
910 !! end
912 !! test
913 Bug 4781, 5267: %28, %29 in autonumber URL
914 !! input
915 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
916 !! result
917 <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>
918 </p>
919 !! end
922 !! test
923 Bug 4781: %26 in bracketed URL
924 !! input
925 [http://www.example.com/?title=AT%26T link]
926 !! result
927 <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>
928 </p>
929 !! end
931 !! test
932 Bug 4781, 5267: %26 in bracketed URL
933 !! input
934 [http://www.example.com/?title=100%25_Bran link]
935 !! result
936 <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>
937 </p>
938 !! end
940 !! test
941 Bug 4781, 5267: %28, %29 in bracketed URL
942 !! input
943 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
944 !! result
945 <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>
946 </p>
947 !! end
949 !! test
950 External link containing double-single-quotes in text '' (bug 4598 sanity check)
951 !! input
952 Some [http://example.com/ pretty ''italics'' and stuff]!
953 !! result
954 <p>Some <a href="http://example.com/" class='external text' title="http://example.com/" rel="nofollow">pretty <i>italics</i> and stuff</a>!
955 </p>
956 !! end
958 !! test
959 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
960 !! input
961 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
962 !! result
963 <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>
964 </p>
965 !! end
970 ### Quotes
973 !! test
974 Quotes
975 !! input
976 Normal text. '''Bold text.''' Normal text. ''Italic text.''
978 Normal text. '''''Bold italic text.''''' Normal text.
979 !!result
980 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
981 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
982 </p>
983 !! end
986 !! test
987 Unclosed and unmatched quotes
988 !! input
989 '''''Bold italic text '''with bold deactivated''' in between.'''''
991 '''''Bold italic text ''with italic deactivated'' in between.'''''
993 '''Bold text..
995 ..spanning two paragraphs (should not work).'''
997 '''Bold tag left open
999 ''Italic tag left open
1001 Normal text.
1003 <!-- Unmatching number of opening, closing tags: -->
1004 '''This year''''s election ''should'' beat '''last year''''s.
1006 ''Tom'''s car is bigger than ''Susan'''s.
1007 !! result
1008 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1009 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1010 </p><p><b>Bold text..</b>
1011 </p><p>..spanning two paragraphs (should not work).
1012 </p><p><b>Bold tag left open</b>
1013 </p><p><i>Italic tag left open</i>
1014 </p><p>Normal text.
1015 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1016 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1017 </p>
1018 !! end
1021 ### Tables
1023 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1026 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1027 # is the bare minimun required by the spec, see:
1028 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1029 !! test
1030 A table with no data.
1031 !! input
1032 {||}
1033 !! result
1034 !! end
1036 # A table with nothing but a caption is invalid XHTML, we might want to render
1037 # this as <p>caption</p>
1038 !! test
1039 A table with nothing but a caption
1040 !! input 
1042 |+ caption
1044 !! result
1045 <table>
1046 <caption> caption
1047 </caption><tr><td></td></tr></table>
1049 !! end
1051 !! test
1052 Simple table
1053 !! input
1054 {| 
1055 | 1 || 2
1056 |- 
1057 | 3 || 4
1059 !! result
1060 <table>
1061 <tr>
1062 <td> 1 </td><td> 2
1063 </td></tr>
1064 <tr>
1065 <td> 3 </td><td> 4
1066 </td></tr></table>
1068 !! end
1070 !! test
1071 Multiplication table
1072 !! input
1073 {| border="1" cellpadding="2"
1074 |+Multiplication table
1076 ! &times; !! 1 !! 2 !! 3
1078 ! 1
1079 | 1 || 2 || 3
1081 ! 2
1082 | 2 || 4 || 6
1084 ! 3
1085 | 3 || 6 || 9
1087 ! 4
1088 | 4 || 8 || 12
1090 ! 5
1091 | 5 || 10 || 15
1093 !! result
1094 <table border="1" cellpadding="2">
1095 <caption>Multiplication table
1096 </caption>
1097 <tr>
1098 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1099 </th></tr>
1100 <tr>
1101 <th> 1
1102 </th><td> 1 </td><td> 2 </td><td> 3
1103 </td></tr>
1104 <tr>
1105 <th> 2
1106 </th><td> 2 </td><td> 4 </td><td> 6
1107 </td></tr>
1108 <tr>
1109 <th> 3
1110 </th><td> 3 </td><td> 6 </td><td> 9
1111 </td></tr>
1112 <tr>
1113 <th> 4
1114 </th><td> 4 </td><td> 8 </td><td> 12
1115 </td></tr>
1116 <tr>
1117 <th> 5
1118 </th><td> 5 </td><td> 10 </td><td> 15
1119 </td></tr></table>
1121 !! end
1123 !! test
1124 Table rowspan
1125 !! input
1126 {| align=right border=1
1127 | Cell 1, row 1 
1128 |rowspan=2| Cell 2, row 1 (and 2) 
1129 | Cell 3, row 1 
1130 |- 
1131 | Cell 1, row 2 
1132 | Cell 3, row 2 
1134 !! result
1135 <table align="right" border="1">
1136 <tr>
1137 <td> Cell 1, row 1
1138 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1139 </td><td> Cell 3, row 1
1140 </td></tr>
1141 <tr>
1142 <td> Cell 1, row 2
1143 </td><td> Cell 3, row 2
1144 </td></tr></table>
1146 !! end
1148 !! test
1149 Nested table
1150 !! input
1151 {| border=1
1152 | &alpha;
1154 {| bgcolor=#ABCDEF border=2
1155 |nested
1157 |table
1159 |the original table again
1161 !! result
1162 <table border="1">
1163 <tr>
1164 <td> &alpha;
1165 </td><td>
1166 <table bgcolor="#ABCDEF" border="2">
1167 <tr>
1168 <td>nested
1169 </td></tr>
1170 <tr>
1171 <td>table
1172 </td></tr></table>
1173 </td><td>the original table again
1174 </td></tr></table>
1176 !! end
1178 !! test
1179 Invalid attributes in table cell (bug 1830)
1180 !! input
1182 |Cell:|broken
1184 !! result
1185 <table>
1186 <tr>
1187 <td>broken
1188 </td></tr></table>
1190 !! end
1193 # FIXME: this one has incorrect tag nesting still.
1194 !! test
1195 Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)
1196 !! input
1198 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1199 !! result
1200 <table>
1201 <tr>
1202 <td><a href="ftp://|x||" class='external autonumber' title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
1203 </td>
1204 </tr>
1205 </table>
1207 !! end
1211 ### Internal links
1213 !! test
1214 Plain link, capitalized
1215 !! input
1216 [[Main Page]]
1217 !! result
1218 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1219 </p>
1220 !! end
1222 !! test
1223 Plain link, uncapitalized
1224 !! input
1225 [[main Page]]
1226 !! result
1227 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1228 </p>
1229 !! end
1231 !! test
1232 Piped link
1233 !! input
1234 [[Main Page|The Main Page]]
1235 !! result
1236 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1237 </p>
1238 !! end
1240 !! test
1241 Broken link
1242 !! input
1243 [[Zigzagzogzagzig]]
1244 !! result
1245 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
1246 </p>
1247 !! end
1249 !! test
1250 Link with prefix
1251 !! input
1252 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1253 !! result
1254 <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>
1255 </p>
1256 !! end
1258 !! test
1259 Link with suffix
1260 !! input
1261 [[Main Page]]xxx, [[Main Page]]XXX
1262 !! result
1263 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
1264 </p>
1265 !! end
1267 !! test
1268 Link with 3 brackets
1269 !! input
1270 [[[main page]]]
1271 !! result
1272 <p>[[[main page]]]
1273 </p>
1274 !! end
1276 !! test
1277 Piped link with 3 brackets
1278 !! input
1279 [[[main page|the main page]]]
1280 !! result
1281 <p>[[[main page|the main page]]]
1282 </p>
1283 !! end
1285 !! test
1286 Link with multiple pipes
1287 !! input
1288 [[Main Page|The|Main|Page]]
1289 !! result
1290 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1291 </p>
1292 !! end
1294 !! test
1295 Link to namespaces
1296 !! input
1297 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1298 !! result
1299 <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>
1300 </p>
1301 !! end
1303 !! test
1304 Piped link to namespace
1305 !! input
1306 [[Meta:Disclaimers|The disclaimers]]
1307 !! result
1308 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
1309 </p>
1310 !! end
1312 !! test
1313 Link containing }
1314 !! input
1315 [[Usually caused by a typo (oops}]]
1316 !! result
1317 <p>[[Usually caused by a typo (oops}]]
1318 </p>
1319 !! end
1321 !! test
1322 Link containing % (not as a hex sequence)
1323 !! input
1324 [[7% Solution]]
1325 !! result
1326 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1327 </p>
1328 !! end
1330 !! test
1331 Link containing % as a single hex sequence interpreted to char
1332 !! input
1333 [[7%25 Solution]]
1334 !! result
1335 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1336 </p>
1337 !!end
1339 !! test
1340 Link containing % as a double hex sequence interpreted to hex sequence
1341 !! input
1342 [[7%2525 Solution]]
1343 !! result
1344 <p>[[7%2525 Solution]]
1345 </p>
1346 !!end
1348 !! test
1349 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1350 Example for such a section: == < ==
1351 !! input
1352 [[%23%3c]][[%23%3e]]
1353 !! result
1354 <p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
1355 </p>
1356 !! end
1358 !! test
1359 Link containing "<#" and ">#" as a hex sequences
1360 !! input
1361 [[%3c%23]][[%3e%23]]
1362 !! result
1363 <p>[[%3c%23]][[%3e%23]]
1364 </p>
1365 !! end
1367 !! test
1368 Link containing double-single-quotes '' (bug 4598)
1369 !! input
1370 [[Lista d''e paise d''o munno]]
1371 !! result
1372 <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>
1373 </p>
1374 !! end
1376 !! test
1377 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1378 !! input
1379 Some [[Link|pretty ''italics'' and stuff]]!
1380 !! result
1381 <p>Some <a href="/index.php?title=Link&amp;action=edit" class="new" title="Link">pretty <i>italics</i> and stuff</a>!
1382 </p>
1383 !! end
1385 !! test
1386 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1387 !! input
1388 ''Some [[Link|pretty ''italics'' and stuff]]!
1389 !! result
1390 <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>
1391 </p>
1392 !! end
1394 !! test
1395 Plain link to URL
1396 !! input
1397 [[http://www.example.org]]
1398 !! result
1399 <p>[<a href="http://www.example.org" class='external autonumber' title="http://www.example.org" rel="nofollow">[1]</a>]
1400 </p>
1401 !! end
1403 # I'm fairly sure the expected result here is wrong.
1404 # We want these to be URL links, not pseudo-pages with URLs for titles....
1405 # However the current output is also pretty screwy.
1407 # ----
1408 # I'm changing it to match the current output--it arguably makes more
1409 # sense in the light of the test above. Old expected result was:
1410 #<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>
1411 #</p>
1412 # But I think this test is bordering on "garbage in, garbage out" anyway.
1413 # -- wtm
1414 !! test
1415 Piped link to URL
1416 !! input
1417 Piped link to URL: [[http://www.example.org|an example URL]]
1418 !! result
1419 <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>]
1420 </p>
1421 !! end
1423 !! test
1424 BUG 2: [[page|http://url/]] should link to page, not http://url/
1425 !! input
1426 [[Main Page|http://url/]]
1427 !! result
1428 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1429 </p>
1430 !! end
1432 !! test
1433 BUG 337: Escaped self-links should be bold
1434 !! options
1435 title=[[Bug462]]
1436 !! input
1437 [[Bu&#103;462]] [[Bug462]]
1438 !! result
1439 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1440 </p>
1441 !! end
1443 !! test
1444 Self-link to section should not be bold
1445 !! options
1446 title=[[Main Page]]
1447 !! input
1448 [[Main Page#section]]
1449 !! result
1450 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1451 </p>
1452 !! end
1454 !! test
1455 <nowiki> inside a link
1456 !! input
1457 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1458 !! result
1459 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1460 </p>
1461 !! end
1464 ### Interwiki links (see maintenance/interwiki.sql)
1467 !! test
1468 Inline interwiki link
1469 !! input
1470 [[MeatBall:SoftSecurity]]
1471 !! result
1472 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw' title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1473 </p>
1474 !! end
1476 !! test
1477 Inline interwiki link with empty title (bug 2372)
1478 !! input
1479 [[MeatBall:]]
1480 !! result
1481 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class='extiw' title="meatball:">MeatBall:</a>
1482 </p>
1483 !! end
1485 !! test
1486 Interwiki link encoding conversion (bug 1636)
1487 !! input
1488 *[[Wikipedia:ro:Olteni&#0355;a]]
1489 *[[Wikipedia:ro:Olteni&#355;a]]
1490 !! result
1491 <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>
1492 </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>
1493 </li></ul>
1495 !! end
1497 !! test
1498 Interwiki link with fragment (bug 2130)
1499 !! input
1500 [[MeatBall:SoftSecurity#foo]]
1501 !! result
1502 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class='extiw' title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1503 </p>
1504 !! end
1507 ## XHTML tidiness
1510 !! test
1511 <br> to <br />
1512 !! input
1513 1<br>2<br />3
1514 !! result
1515 <p>1<br />2<br />3
1516 </p>
1517 !! end
1519 !! test
1520 Incorrecly removing closing slashes from correctly formed XHTML
1521 !! input
1522 <br style="clear:both;" />
1523 !! result
1524 <p><br style="clear:both;" />
1525 </p>
1526 !! end
1528 !! test 
1529 Failing to transform badly formed HTML into correct XHTML
1530 !! input
1531 <br clear=left>
1532 <br clear=right>
1533 <br clear=all>
1534 !! result
1535 <p><br clear="left" />
1536 <br clear="right" />
1537 <br clear="all" />
1538 </p>
1539 !!end
1541 !! test 
1542 Horizontal ruler (should it add that extra space?)
1543 !! input 
1544 <hr>
1545 <hr >
1546 foo <hr
1547 > bar
1548 !! result 
1549 <hr />
1550 <hr />
1551 foo <hr /> bar
1553 !! end
1556 ### Block-level elements
1558 !! test
1559 Common list
1560 !! input
1561 *Common list
1562 * item 2
1563 *item 3
1564 !! result
1565 <ul><li>Common list
1566 </li><li> item 2
1567 </li><li>item 3
1568 </li></ul>
1570 !! end
1572 !! test
1573 Numbered list
1574 !! input
1575 #Numbered list
1576 #item 2
1577 # item 3
1578 !! result
1579 <ol><li>Numbered list
1580 </li><li>item 2
1581 </li><li> item 3
1582 </li></ol>
1584 !! end
1586 !! test
1587 Mixed list
1588 !! input
1589 *Mixed list
1590 *# with numbers
1591 ** and bullets
1592 *# and numbers
1593 *bullets again
1594 **bullet level 2
1595 ***bullet level 3
1596 ***#Number on level 4
1597 **bullet level 2
1598 **#Number on level 3
1599 **#Number on level 3
1600 *#number level 2
1601 *Level 1
1602 !! result
1603 <ul><li>Mixed list
1604 <ol><li> with numbers
1605 </li></ol>
1606 <ul><li> and bullets
1607 </li></ul>
1608 <ol><li> and numbers
1609 </li></ol>
1610 </li><li>bullets again
1611 <ul><li>bullet level 2
1612 <ul><li>bullet level 3
1613 <ol><li>Number on level 4
1614 </li></ol>
1615 </li></ul>
1616 </li><li>bullet level 2
1617 <ol><li>Number on level 3
1618 </li><li>Number on level 3
1619 </li></ol>
1620 </li></ul>
1621 <ol><li>number level 2
1622 </li></ol>
1623 </li><li>Level 1
1624 </li></ul>
1626 !! end
1628 !! test
1629 List items are not parsed correctly following a <pre> block (bug 785)
1630 !! input
1631 * <pre>foo</pre>
1632 * <pre>bar</pre>
1633 * zar
1634 !! result
1635 <ul><li> <pre>foo</pre>
1636 </li><li> <pre>bar</pre>
1637 </li><li> zar
1638 </li></ul>
1640 !! end
1643 ### Magic Words
1646 !! test
1647 Magic Word: {{CURRENTDAY}}
1648 !! input
1649 {{CURRENTDAY}}
1650 !! result
1651 <p>1
1652 </p>
1653 !! end
1655 !! test
1656 Magic Word: {{CURRENTDAY2}}
1657 !! input
1658 {{CURRENTDAY2}}
1659 !! result
1660 <p>01
1661 </p>
1662 !! end
1664 !! test
1665 Magic Word: {{CURRENTDAYNAME}}
1666 !! input
1667 {{CURRENTDAYNAME}}
1668 !! result
1669 <p>Thursday
1670 </p>
1671 !! end
1673 !! test
1674 Magic Word: {{CURRENTDOW}}
1675 !! input
1676 {{CURRENTDOW}}
1677 !! result
1678 <p>4
1679 </p>
1680 !! end
1682 !! test
1683 Magic Word: {{CURRENTMONTH}}
1684 !! input
1685 {{CURRENTMONTH}}
1686 !! result
1687 <p>01
1688 </p>
1689 !! end
1691 !! test
1692 Magic Word: {{CURRENTMONTHABBREV}}
1693 !! input
1694 {{CURRENTMONTHABBREV}}
1695 !! result
1696 <p>Jan
1697 </p>
1698 !! end
1700 !! test
1701 Magic Word: {{CURRENTMONTHNAME}}
1702 !! input
1703 {{CURRENTMONTHNAME}}
1704 !! result
1705 <p>January
1706 </p>
1707 !! end
1709 !! test
1710 Magic Word: {{CURRENTMONTHNAMEGEN}}
1711 !! input
1712 {{CURRENTMONTHNAMEGEN}}
1713 !! result
1714 <p>January
1715 </p>
1716 !! end
1718 !! test
1719 Magic Word: {{CURRENTTIME}}
1720 !! input
1721 {{CURRENTTIME}}
1722 !! result
1723 <p>00:02
1724 </p>
1725 !! end
1727 !! test
1728 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1729 !! input
1730 {{CURRENTWEEK}}
1731 !! result
1732 <p>1
1733 </p>
1734 !! end
1736 !! test
1737 Magic Word: {{CURRENTYEAR}}
1738 !! input
1739 {{CURRENTYEAR}}
1740 !! result
1741 <p>1970
1742 </p>
1743 !! end
1745 !! test
1746 Magic Word: {{FULLPAGENAME}}
1747 !! options
1748 title=[[User:Ævar Arnfjörð Bjarmason]]
1749 !! input
1750 {{FULLPAGENAME}}
1751 !! result
1752 <p>User:Ævar Arnfjörð Bjarmason
1753 </p>
1754 !! end
1756 !! test
1757 Magic Word: {{FULLPAGENAMEE}}
1758 !! options
1759 title=[[User:Ævar Arnfjörð Bjarmason]]
1760 !! input
1761 {{FULLPAGENAMEE}}
1762 !! result
1763 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1764 </p>
1765 !! end
1767 !! test
1768 Magic Word: {{NAMESPACE}}
1769 !! options
1770 title=[[User:Ævar Arnfjörð Bjarmason]]
1771 disabled # FIXME
1772 !! input
1773 {{NAMESPACE}}
1774 !! result
1775 <p>User
1776 </p>
1777 !! end
1779 !! test
1780 Magic Word: {{NAMESPACEE}}
1781 !! options
1782 title=[[User:Ævar Arnfjörð Bjarmason]]
1783 disabled # FIXME
1784 !! input
1785 {{NAMESPACEE}}
1786 !! result
1787 <p>User
1788 </p>
1789 !! end
1791 !! test
1792 Magic Word: {{NUMBEROFARTICLES}}
1793 !! input
1794 {{NUMBEROFARTICLES}}
1795 !! result
1796 <p>1
1797 </p>
1798 !! end
1800 !! test
1801 Magic Word: {{NUMBEROFFILES}}
1802 !! input
1803 {{NUMBEROFFILES}}
1804 !! result
1805 <p>1
1806 </p>
1807 !! end
1809 !! test
1810 Magic Word: {{PAGENAME}}
1811 !! options
1812 title=[[User:Ævar Arnfjörð Bjarmason]]
1813 disabled # FIXME
1814 !! input
1815 {{PAGENAME}}
1816 !! result
1817 <p>Ævar Arnfjörð Bjarmason
1818 </p>
1819 !! end
1821 !! test
1822 Magic Word: {{PAGENAMEE}}
1823 !! options
1824 title=[[User:Ævar Arnfjörð Bjarmason]]
1825 !! input
1826 {{PAGENAMEE}}
1827 !! result
1828 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1829 </p>
1830 !! end
1832 !! test
1833 Magic Word: {{REVISIONID}}
1834 !! input
1835 {{REVISIONID}}
1836 !! result
1837 <p>1337
1838 </p>
1839 !! end
1841 !! test
1842 Magic Word: {{SCRIPTPATH}}
1843 !! input
1844 {{SCRIPTPATH}}
1845 !! result
1846 <p>/
1847 </p>
1848 !! end
1850 !! test
1851 Magic Word: {{SERVER}}
1852 !! input
1853 {{SERVER}}
1854 !! result
1855 <p><a href="http://localhost" class='external free' title="http://localhost" rel="nofollow">http://localhost</a>
1856 </p>
1857 !! end
1859 !! test
1860 Magic Word: {{SERVERNAME}}
1861 !! input
1862 {{SERVERNAME}}
1863 !! result
1864 <p>Britney Spears
1865 </p>
1866 !! end
1868 !! test
1869 Magic Word: {{SITENAME}}
1870 !! input
1871 {{SITENAME}}
1872 !! result
1873 <p>MediaWiki
1874 </p>
1875 !! end
1877 !! test
1878 Namespace 1 {{ns:1}}
1879 !! input
1880 {{ns:1}}
1881 !! result
1882 <p>Talk
1883 </p>
1884 !! end
1886 !! test
1887 Namespace 1 {{ns:01}}
1888 !! input
1889 {{ns:01}}
1890 !! result
1891 <p>Talk
1892 </p>
1893 !! end
1895 !! test
1896 Namespace 0 {{ns:0}} (bug 4783)
1897 !! input
1898 {{ns:0}}
1899 !! result
1901 !! end
1903 !! test
1904 Namespace 0 {{ns:00}} (bug 4783)
1905 !! input
1906 {{ns:00}}
1907 !! result
1909 !! end
1911 !! test
1912 Namespace -1 {{ns:-1}}
1913 !! input
1914 {{ns:-1}}
1915 !! result
1916 <p>Special
1917 </p>
1918 !! end
1920 !! test
1921 Namespace Project {{ns:User}}
1922 !! input
1923 {{ns:User}}
1924 !! result
1925 <p>User
1926 </p>
1927 !! end
1931 ### Magic links
1933 !! test
1934 Magic links: internal link to RFC (bug 479)
1935 !! input
1936 [[RFC 123]]
1937 !! result
1938 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1939 </p>
1940 !! end
1942 !! test
1943 Magic links: RFC (bug 479)
1944 !! input
1945 RFC 822
1946 !! result
1947 <p><a href='http://www.ietf.org/rfc/rfc822.txt' class='external' title="http://www.ietf.org/rfc/rfc822.txt">RFC 822</a>
1948 </p>
1949 !! end
1951 !! test
1952 Magic links: ISBN (bug 1937)
1953 !! input
1954 ISBN 0-306-40615-2
1955 !! result
1956 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1957 </p>
1958 !! end
1960 !! test
1961 Magic links: PMID incorrectly converts space to underscore
1962 !! input
1963 PMID 1234
1964 !! result
1965 <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>
1966 </p>
1967 !! end
1970 ### Templates
1971 ####
1973 !! test
1974 Nonexistant template
1975 !! input
1976 {{thistemplatedoesnotexist}}
1977 !! result
1978 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1979 </p>
1980 !! end
1982 !! article
1983 Template:test
1984 !! text
1985 This is a test template
1986 !! endarticle
1988 !! test
1989 Simple template
1990 !! input
1991 {{test}}
1992 !! result
1993 <p>This is a test template
1994 </p>
1995 !! end
1997 !! test
1998 Template with explicit namespace
1999 !! input
2000 {{Template:test}}
2001 !! result
2002 <p>This is a test template
2003 </p>
2004 !! end
2007 !! article
2008 Template:paramtest
2009 !! text
2010 This is a test template with parameter {{{param}}}
2011 !! endarticle
2013 !! test
2014 Template parameter
2015 !! input
2016 {{paramtest|param=foo}}
2017 !! result
2018 <p>This is a test template with parameter foo
2019 </p>
2020 !! end
2022 !! article
2023 Template:paramtestnum
2024 !! text
2025 [[{{{1}}}|{{{2}}}]]
2026 !! endarticle
2028 !! test
2029 Template unnamed parameter
2030 !! input
2031 {{paramtestnum|Main Page|the main page}}
2032 !! result
2033 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2034 </p>
2035 !! end
2037 !! article
2038 Template:templatesimple
2039 !! text
2040 (test)
2041 !! endarticle
2043 !! article
2044 Template:templateredirect
2045 !! text
2046 #redirect [[Template:templatesimple]]
2047 !! endarticle
2049 !! article
2050 Template:templateasargtestnum
2051 !! text
2052 {{{{{1}}}}}
2053 !! endarticle
2055 !! article
2056 Template:templateasargtest
2057 !! text
2058 {{template{{{templ}}}}}
2059 !! endarticle
2061 !! article
2062 Template:templateasargtest2
2063 !! text
2064 {{{{{templ}}}}}
2065 !! endarticle
2067 !! test
2068 Template with template name as unnamed argument
2069 !! input
2070 {{templateasargtestnum|templatesimple}}
2071 !! result
2072 <p>(test)
2073 </p>
2074 !! end
2076 !! test
2077 Template with template name as argument
2078 !! input
2079 {{templateasargtest|templ=simple}}
2080 !! result
2081 <p>(test)
2082 </p>
2083 !! end
2085 !! test
2086 Template with template name as argument (2)
2087 !! input
2088 {{templateasargtest2|templ=templatesimple}}
2089 !! result
2090 <p>(test)
2091 </p>
2092 !! end
2094 !! article
2095 Template:templateasargtestdefault
2096 !! text
2097 {{{{{templ|templatesimple}}}}}
2098 !! endarticle
2100 !! article
2101 Template:templa
2102 !! text
2103 '''templ'''
2104 !! endarticle
2106 !! test
2107 Template with default value
2108 !! input
2109 {{templateasargtestdefault}}
2110 !! result
2111 <p>(test)
2112 </p>
2113 !! end
2115 !! test
2116 Template with default value (value set)
2117 !! input
2118 {{templateasargtestdefault|templ=templa}}
2119 !! result
2120 <p><b>templ</b>
2121 </p>
2122 !! end
2124 !! test
2125 Template redirect
2126 !! input
2127 {{templateredirect}}
2128 !! result
2129 <p>(test)
2130 </p>
2131 !! end
2133 !! test
2134 Template with argument in separate line
2135 !! input
2136 {{ templateasargtest  |
2137  templ = simple }}
2138 !! result
2139 <p>(test)
2140 </p>
2141 !! end
2143 !! test
2144 Template with complex template as argument
2145 !! input
2146 {{paramtest|
2147   param ={{ templateasargtest  |
2148  templ = simple }}}}
2149 !! result
2150 <p>This is a test template with parameter (test)
2151 </p>
2152 !! end
2154 !! test
2155 Template with thumb image (wiht link in description)
2156 !! input
2157 {{paramtest|
2158   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2159 !! result
2160 This is a test template with parameter <div class="thumb tright"><div style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="Image:Noimage.png">Image:Noimage.png</a>  <div class="thumbcaption" ><a href="/index.php?title=No_link&amp;action=edit" class="new" title="No link">link</a> <a href="/index.php?title=No_link&amp;action=edit" class="new" title="No link">caption</a></div></div></div>
2162 !! end
2164 !! article
2165 Template:complextemplate
2166 !! text
2167 {{{1}}} {{paramtest|
2168   param ={{{param}}}}}
2169 !! endarticle
2171 !! test
2172 Template with complex arguments
2173 !! input
2174 {{complextemplate|
2175   param ={{ templateasargtest  |
2176  templ = simple }}|[[Template:complextemplate|link]]}}
2177 !! result
2178 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2179 </p>
2180 !! end
2182 !! test
2183 BUG 553: link with two variables in a piped link
2184 !! input
2185 {| 
2186 |[[{{{1}}}|{{{2}}}]]
2188 !! result
2189 <table>
2190 <tr>
2191 <td>[[{{{1}}}|{{{2}}}]]
2192 </td></tr></table>
2194 !! end
2196 !! test
2197 Magic variable as template parameter
2198 !! input
2199 {{paramtest|param={{SITENAME}}}}
2200 !! result
2201 <p>This is a test template with parameter MediaWiki
2202 </p>
2203 !! end
2205 !! article
2206 Template:linktest
2207 !! text
2208 [[{{{param}}}|link]]
2209 !! endarticle
2211 !! test
2212 Template parameter as link source
2213 !! input
2214 {{linktest|param=Main Page}}
2215 !! result
2216 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2217 </p>
2218 !! end
2221 !!article
2222 Template:paramtest2
2223 !! text
2224 including another template, {{paramtest|param={{{arg}}}}}
2225 !! endarticle
2227 !! test
2228 Template passing argument to another template
2229 !! input
2230 {{paramtest2|arg='hmm'}}
2231 !! result
2232 <p>including another template, This is a test template with parameter 'hmm'
2233 </p>
2234 !! end
2236 !! article
2237 Template:Linktest2
2238 !! text
2239 Main Page
2240 !! endarticle
2242 !! test
2243 Template as link source
2244 !! input
2245 [[{{linktest2}}]]
2246 !! result
2247 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2248 </p>
2249 !! end
2252 !! article
2253 Template:loop1
2254 !! text
2255 {{loop2}}
2256 !! endarticle
2258 !! article
2259 Template:loop2
2260 !! text
2261 {{loop1}}
2262 !! endarticle
2264 !! test
2265 Template infinite loop
2266 !! input
2267 {{loop1}}
2268 !! result
2269 <p>{{loop1}}<!-- WARNING: template loop detected -->
2270 </p>
2271 !! end
2273 !! test
2274 Template from main namespace
2275 !! input
2276 {{:Main Page}}
2277 !! result
2278 <p>blah blah
2279 </p>
2280 !! end
2282 !! article
2283 Template:table
2284 !! text
2285 {| 
2286 | 1 || 2
2287 |- 
2288 | 3 || 4
2290 !! endarticle
2292 !! test
2293 BUG 529: Template with table, not included at beginning of line
2294 !! input
2295 foo {{table}}
2296 !! result
2297 <p>foo 
2298 </p>
2299 <table>
2300 <tr>
2301 <td> 1 </td><td> 2
2302 </td></tr>
2303 <tr>
2304 <td> 3 </td><td> 4
2305 </td></tr></table>
2307 !! end
2309 !! test
2310 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2311 !! input
2313 {{table}}
2314 !! result
2315 <p>foo
2316 </p>
2317 <table>
2318 <tr>
2319 <td> 1 </td><td> 2
2320 </td></tr>
2321 <tr>
2322 <td> 3 </td><td> 4
2323 </td></tr></table>
2325 !! end
2327 !! test
2328 BUG 41: Template parameters shown as broken links
2329 !! input
2330 {{{parameter}}}
2331 !! result
2332 <p>{{{parameter}}}
2333 </p>
2334 !! end
2337 !! article
2338 Template:MSGNW test
2339 !! text
2340 ''None'' of '''this''' should be 
2341 * interepreted
2342  but rather passed unmodified
2343 {{test}}
2344 !! endarticle
2346 # hmm, fix this or just deprecate msgnw and document its behavior?
2347 !! test
2348 msgnw keyword
2349 !! options
2350 disabled
2351 !! input
2352 {{msgnw:MSGNW test}}
2353 !! result
2354 <p>''None'' of '''this''' should be 
2355 * interepreted
2356  but rather passed unmodified
2357 {{test}}
2358 </p>
2359 !! end
2361 !! test
2362 int keyword
2363 !! input
2364 {{int:youhavenewmessages|lots of money|not!}}
2365 !! result
2366 <p>You have lots of money (not!).
2367 </p>
2368 !! end
2370 !! article
2371 Template:Includes
2372 !! text
2373 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2374 !! endarticle
2376 !! test
2377 <includeonly> and <noinclude> being included
2378 !! input
2379 {{Includes}}
2380 !! result
2381 <p>Foobar
2382 </p>
2383 !! end
2385 !! article
2386 Template:Includes2
2387 !! text
2388 <onlyinclude>Foo</onlyinclude>bar
2389 !! endarticle
2391 !! test
2392 <onlyinclude> being included
2393 !! input
2394 {{Includes2}}
2395 !! result
2396 <p>Foo
2397 </p>
2398 !! end
2401 !! article
2402 Template:Includes3
2403 !! text
2404 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2405 !! endarticle
2407 !! test
2408 <onlyinclude> and <includeonly> being included
2409 !! input
2410 {{Includes3}}
2411 !! result
2412 <p>Foo
2413 </p>
2414 !! end
2416 !! test
2417 <includeonly> and <noinclude> on a page
2418 !! input
2419 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2420 !! result
2421 <p>Foozar
2422 </p>
2423 !! end
2425 !! test
2426 <onlyinclude> on a page
2427 !! input
2428 <onlyinclude>Foo</onlyinclude>bar
2429 !! result
2430 <p>Foobar
2431 </p>
2432 !! end
2435 ### Pre-save transform tests
2437 !! test
2438 pre-save transform: subst:
2439 !! options
2441 !! input
2442 {{subst:test}}
2443 !! result
2444 This is a test template
2445 !! end
2447 !! test
2448 pre-save transform: normal template
2449 !! options
2451 !! input
2452 {{test}}
2453 !! result
2454 {{test}}
2455 !! end
2457 !! test
2458 pre-save transform: nonexistant template
2459 !! options
2461 !! input
2462 {{thistemplatedoesnotexist}}
2463 !! result
2464 {{thistemplatedoesnotexist}}
2465 !! end
2468 !! test
2469 pre-save transform: subst magic variables
2470 !! options
2472 !! input
2473 {{subst:SITENAME}}
2474 !! result
2475 MediaWiki
2476 !! end
2478 # This is bug 89, which I fixed. -- wtm
2479 !! test
2480 pre-save transform: subst: templates with parameters
2481 !! options
2483 !! input
2484 {{subst:paramtest|param="something else"}}
2485 !! result
2486 This is a test template with parameter "something else"
2487 !! end
2489 !! article
2490 Template:nowikitest
2491 !! text
2492 <nowiki>'''not wiki'''</nowiki>
2493 !! endarticle
2495 !! test
2496 pre-save transform: nowiki in subst (bug 1188)
2497 !! options
2499 !! input
2500 {{subst:nowikitest}}
2501 !! result
2502 <nowiki>'''not wiki'''</nowiki>
2503 !! end
2506 !! article
2507 Template:commenttest
2508 !! text
2509 This template has <!-- a comment --> in it.
2510 !! endarticle
2512 !! test
2513 pre-save transform: comment in subst (bug 1936)
2514 !! options
2516 !! input
2517 {{subst:commenttest}}
2518 !! result
2519 This template has <!-- a comment --> in it.
2520 !! end
2522 !! test
2523 pre-save transform: unclosed tag
2524 !! options
2525 pst noxml
2526 !! input
2527 <nowiki>'''not wiki'''
2528 !! result
2529 <nowiki>'''not wiki'''
2530 !! end
2532 !! test
2533 pre-save transform: mixed tag case
2534 !! options
2535 pst noxml
2536 !! input
2537 <NOwiki>'''not wiki'''</noWIKI>
2538 !! result
2539 <NOwiki>'''not wiki'''</noWIKI>
2540 !! end
2542 !! test
2543 pre-save transform: unclosed comment in <nowiki>
2544 !! options
2545 pst noxml
2546 !! input
2547 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2548 !! result
2549 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2550 !!end
2552 !! article
2553 Template:dangerous
2554 !!text
2555 <span onmouseover="alert('crap')">Oh no</span>
2556 !!endarticle
2558 !!test
2559 (confirming safety of fix for subst bug 1936)
2560 !! input
2561 {{Template:dangerous}}
2562 !! result
2563 <p><span>Oh no</span>
2564 </p>
2565 !! end
2567 !! test
2568 pre-save transform: comment containing gallery (bug 5024)
2569 !! options
2571 !! input
2572 <!-- <gallery>data</gallery> -->
2573 !!result
2574 <!-- <gallery>data</gallery> -->
2575 !!end
2577 !! test
2578 pre-save transform: comment containing extension
2579 !! options
2581 !! input
2582 <!-- <tag>data</tag> -->
2583 !!result
2584 <!-- <tag>data</tag> -->
2585 !!end
2587 !! test
2588 pre-save transform: comment containing nowiki
2589 !! options
2591 !! input
2592 <!-- <nowiki>data</nowiki> -->
2593 !!result
2594 <!-- <nowiki>data</nowiki> -->
2595 !!end
2597 !! test
2598 pre-save transform: comment containing math
2599 !! options
2601 !! input
2602 <!-- <math>data</math> -->
2603 !!result
2604 <!-- <math>data</math> -->
2605 !!end
2607 !! test
2608 pre-save transform: <noinclude> in subst (bug 3298)
2609 !! options
2611 !! input
2612 {{subst:Includes}}
2613 !! result
2614 Foobar
2615 !! end
2617 !! test
2618 pre-save transform: <onlyinclude> in subst (bug 3298)
2619 !! options
2621 !! input
2622 {{subst:Includes2}}
2623 !! result
2625 !! end
2629 ### Message transform tests
2631 !! test
2632 message transform: magic variables
2633 !! options
2635 !! input
2636 {{SITENAME}}
2637 !! result
2638 MediaWiki
2639 !! end
2641 !! test
2642 message transform: should not transform wiki markup
2643 !! options
2645 !! input
2646 ''test''
2647 !! result
2648 ''test''
2649 !! end
2651 !! test
2652 message transform: <noinclude> in transcluded template (bug 4926)
2653 !! options
2655 !! input
2656 {{Includes}}
2657 !! result
2658 Foobar
2659 !! end
2661 !! test
2662 message transform: <onlyinclude> in transcluded template (bug 4926)
2663 !! options
2665 !! input
2666 {{Includes2}}
2667 !! result
2669 !! end
2673 ### Images
2675 !! test
2676 Simple image
2677 !! input
2678 [[Image:foobar.jpg]]
2679 !! result
2680 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2681 </p>
2682 !! end
2684 !! test
2685 Right-aligned image
2686 !! input
2687 [[Image:foobar.jpg|right]]
2688 !! result
2689 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
2691 !! end
2693 !! test
2694 Image with caption
2695 !! input
2696 [[Image:foobar.jpg|right|Caption text]]
2697 !! result
2698 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Caption text" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
2700 !! end
2702 !! test
2703 Image with frame and link
2704 !! input
2705 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2706 !! result
2707 <div class="thumb tleft"><div style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image Main Page"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="This is a test image Main Page" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
2709 !! end
2711 !! test
2712 Link to image page- image page normally doesn't exists, hence edit link
2713 TODO: Add test with existing image page
2714 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2715 !! input
2716 [[:Image:test]]
2717 !! result
2718 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2719 </p>
2720 !! end
2722 !! test
2723 Frameless image caption with a free URL
2724 !! input
2725 [[Image:foobar.jpg|http://example.com]]
2726 !! result
2727 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="http://example.com" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2728 </p>
2729 !! end
2731 !! test
2732 Thumbnail image caption with a free URL
2733 !! input
2734 [[Image:foobar.jpg|thumb|http://example.com]]
2735 !! result
2736 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="http://example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
2738 !! end
2740 !! test
2741 BUG 1887: A ISBN with a thumbnail
2742 !! input
2743 [[Image:foobar.jpg|thumb|ISBN 12354]]
2744 !! result
2745 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="ISBN 12354"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="ISBN 12354" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><a href="/index.php?title=Special:Booksources&amp;isbn=12354" class="internal">ISBN 12354</a></div></div></div>
2747 !! end
2749 !! test
2750 BUG 1887: A RFC with a thumbnail
2751 !! input
2752 [[Image:foobar.jpg|thumb|This is RFC 12354]]
2753 !! result
2754 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is RFC 12354"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is RFC 12354" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This is <a href='http://www.ietf.org/rfc/rfc12354.txt' class='external' title="http://www.ietf.org/rfc/rfc12354.txt">RFC 12354</a></div></div></div>
2756 !! end
2758 !! test
2759 BUG 1887: A mailto link with a thumbnail
2760 !! input
2761 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
2762 !! result
2763 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Please mailto:nobody@example.com"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="Please mailto:nobody@example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>Please <a href="mailto:nobody@example.com" class='external free' title="mailto:nobody@example.com" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
2765 !! end
2767 !! test
2768 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
2769 so math is not stripped and turns up as escaped &lt;math&gt; tags.
2770 !! input
2771 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2772 !! result
2773 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="&lt;math&gt;2+2&lt;/math&gt;"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="&lt;math&gt;2+2&lt;/math&gt;" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
2775 !! end
2777 !! test
2778 BUG 1887, part 2: A <math> with a thumbnail- math enabled
2779 !! options
2780 math
2781 !! input
2782 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2783 !! result
2784 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="2 + 2"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="2 + 2" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><span class="texhtml">2 + 2</span></div></div></div>
2786 !! end
2788 # Pending resolution to bug 368
2789 !! test
2790 BUG 648: Frameless image caption with a link
2791 !! input
2792 [[Image:foobar.jpg|text with a [[link]] in it]]
2793 !! result
2794 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2795 </p>
2796 !! end
2798 !! test
2799 BUG 648: Frameless image caption with a link (suffix)
2800 !! input
2801 [[Image:foobar.jpg|text with a [[link]]foo in it]]
2802 !! result
2803 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a linkfoo in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a linkfoo in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2804 </p>
2805 !! end
2807 !! test
2808 BUG 648: Frameless image caption with an interwiki link
2809 !! input
2810 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
2811 !! result
2812 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a MeatBall:Link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2813 </p>
2814 !! end
2816 !! test
2817 BUG 648: Frameless image caption with a piped interwiki link
2818 !! input
2819 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
2820 !! result
2821 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2822 </p>
2823 !! end
2825 !! test
2826 Escape HTML special chars in image alt text
2827 !! input
2828 [[Image:foobar.jpg|& < > "]]
2829 !! result
2830 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="&amp; &lt; &gt; &quot;" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2831 </p>
2832 !! end
2834 !! test
2835 BUG 499: Alt text should have &#1234;, not &amp;1234;
2836 !! input
2837 [[Image:foobar.jpg|&#9792;]]
2838 !! result
2839 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&#9792;"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="&#9792;" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2840 </p>
2841 !! end
2843 !! test
2844 Broken image caption with link
2845 !! input
2846 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
2847 !! result
2848 <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.
2849 </p>
2850 !! end
2852 !! test
2853 Image caption containing another image
2854 !! input
2855 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
2856 !! result
2857 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a caption with another Image:Icon.png inside it!"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is a caption with another Image:Icon.png inside it!" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div>
2859 !! end
2861 !! test
2862 Image caption containing a newline
2863 !! input
2864 [[Image:Foobar.jpg|This
2865 *is some text]]
2866 !! result
2867 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="This *is some text" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2868 </p>
2869 !!end
2872 !! test
2873 Bug 3090: External links other than http: in image captions
2874 !! input
2875 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
2876 !! result
2877 <div class="thumb tright"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This caption has irc and Secure ext links in it."><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" alt="This caption has irc and Secure ext links in it." width="200" height="23" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This caption has <a href="irc://example.net" class='external text' title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class='external text' title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div>
2879 !! end
2883 ### Subpages
2885 !! article
2886 Subpage test/subpage
2887 !! text
2889 !! endarticle
2891 !! test
2892 Subpage link
2893 !! options
2894 subpage title=[[Subpage test]]
2895 !! input
2896 [[/subpage]]
2897 !! result
2898 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
2899 </p>
2900 !! end
2902 !! test
2903 Subpage noslash link
2904 !! options
2905 subpage title=[[Subpage test]]
2906 !!input
2907 [[/subpage/]]
2908 !! result
2909 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
2910 </p>
2911 !! end
2913 !! test
2914 Disabled subpages
2915 !! input
2916 [[/subpage]]
2917 !! result
2918 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
2919 </p>
2920 !! end
2922 !! test
2923 BUG 561: {{/Subpage}}
2924 !! options
2925 subpage title=[[Page]]
2926 !! input
2927 {{/Subpage}}
2928 !! result
2929 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
2930 </p>
2931 !! end
2934 ### Categories
2936 !! article
2937 Category:MediaWiki User's Guide
2938 !! text
2939 blah
2940 !! endarticle
2942 !! test
2943 Link to category
2944 !! input
2945 [[:Category:MediaWiki User's Guide]]
2946 !! result
2947 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
2948 </p>
2949 !! end
2951 !! test
2952 Simple category
2953 !! options
2955 !! input
2956 [[Category:MediaWiki User's Guide]]
2957 !! result
2958 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
2959 !! end
2962 ### Inter-language links
2964 !! test
2965 Inter-language links
2966 !! options
2968 !! input
2969 [[es:Alimento]]
2970 [[fr:Nourriture]]
2971 [[zh:&#39135;&#21697;]]
2972 !! result
2973 es:Alimento fr:Nourriture zh:食品
2974 !! end
2977 ### Sections
2979 !! test
2980 Basic section headings
2981 !! options
2982 title=[[Parser test script]]
2983 !! input
2984 == Headline 1 ==
2985 Some text
2987 ==Headline 2==
2988 More
2989 ===Smaller headline===
2990 Blah blah
2991 !! result
2992 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
2993 <p>Some text
2994 </p>
2995 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</div><a name="Headline_2"></a><h2>Headline 2</h2>
2996 <p>More
2997 </p>
2998 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</div><a name="Smaller_headline"></a><h3>Smaller headline</h3>
2999 <p>Blah blah
3000 </p>
3001 !! end
3003 !! test
3004 Section headings with TOC
3005 !! options
3006 title=[[Parser test script]]
3007 !! input
3008 == Headline 1 ==
3009 === Subheadline 1 ===
3010 ===== Skipping a level =====
3011 ====== Skipping a level ======
3013 == Headline 2 ==
3014 Some text
3015 ===Another headline===
3016 !! result
3017 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3018 <ul>
3019 <li class='toclevel-1'><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3020 <ul>
3021 <li class='toclevel-2'><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3022 <ul>
3023 <li class='toclevel-3'><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3024 <ul>
3025 <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>
3026 </ul>
3027 </li>
3028 </ul>
3029 </li>
3030 </ul>
3031 </li>
3032 <li class='toclevel-1'><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3033 <ul>
3034 <li class='toclevel-2'><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3035 </ul>
3036 </li>
3037 </ul>
3038 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3039 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
3040 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</div><a name="Subheadline_1"></a><h3> Subheadline 1 </h3>
3041 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</div><a name="Skipping_a_level"></a><h5> Skipping a level </h5>
3042 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</div><a name="Skipping_a_level_2"></a><h6> Skipping a level </h6>
3043 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</div><a name="Headline_2"></a><h2> Headline 2 </h2>
3044 <p>Some text
3045 </p>
3046 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</div><a name="Another_headline"></a><h3>Another headline</h3>
3048 !! end
3050 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3051 !! test
3052 Handling of sections up to level 6 and beyond
3053 !! input 
3054 = Level 1 Heading=
3055 == Level 2 Heading==
3056 === Level 3 Heading===
3057 ==== Level 4 Heading====
3058 ===== Level 5 Heading=====
3059 ====== Level 6 Heading======
3060 ======= Level 7 Heading=======
3061 ======== Level 8 Heading========
3062 ========= Level 9 Heading=========
3063 ========== Level 10 Heading==========
3064 !! result
3065 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3066 <ul>
3067 <li class='toclevel-1'><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3068 <ul>
3069 <li class='toclevel-2'><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3070 <ul>
3071 <li class='toclevel-3'><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3072 <ul>
3073 <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>
3074 <ul>
3075 <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>
3076 <ul>
3077 <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>
3078 <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>
3079 <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>
3080 <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>
3081 <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>
3082 </ul>
3083 </li>
3084 </ul>
3085 </li>
3086 </ul>
3087 </li>
3088 </ul>
3089 </li>
3090 </ul>
3091 </li>
3092 </ul>
3093 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3094 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</div><a name="Level_1_Heading"></a><h1> Level 1 Heading</h1>
3095 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</div><a name="Level_2_Heading"></a><h2> Level 2 Heading</h2>
3096 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</div><a name="Level_3_Heading"></a><h3> Level 3 Heading</h3>
3097 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</div><a name="Level_4_Heading"></a><h4> Level 4 Heading</h4>
3098 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</div><a name="Level_5_Heading"></a><h5> Level 5 Heading</h5>
3099 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</div><a name="Level_6_Heading"></a><h6> Level 6 Heading</h6>
3100 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</div><a name=".3D_Level_7_Heading.3D"></a><h6>= Level 7 Heading=</h6>
3101 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</div><a name=".3D.3D_Level_8_Heading.3D.3D"></a><h6>== Level 8 Heading==</h6>
3102 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</div><a name=".3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><h6>=== Level 9 Heading===</h6>
3103 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</div><a name=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><h6>==== Level 10 Heading====</h6>
3105 !! end
3107 !! test
3108 Resolving duplicate section names
3109 !! options
3110 title=[[Parser test script]]
3111 !! input
3112 == Foo bar ==
3113 == Foo bar ==
3114 !! result
3115 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</div><a name="Foo_bar"></a><h2> Foo bar </h2>
3116 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</div><a name="Foo_bar_2"></a><h2> Foo bar </h2>
3118 !! end
3120 !! article
3121 Template:sections
3122 !! text
3123 ===Section 1===
3124 ==Section 2==
3125 !! endarticle
3127 !! test
3128 Template with sections, __NOTOC__
3129 !! options
3130 title=[[Parser test script]]
3131 !! input
3132 __NOTOC__
3133 ==Section 0==
3134 {{sections}}
3135 ==Section 4==
3136 !! result
3137 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</div><a name="Section_0"></a><h2>Section 0</h2>
3138 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</div><a name="Section_1"></a><h3>Section 1</h3>
3139 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</div><a name="Section_2"></a><h2>Section 2</h2>
3140 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</div><a name="Section_4"></a><h2>Section 4</h2>
3142 !! end
3144 !! test
3145 __NOEDITSECTION__ keyword
3146 !! input
3147 __NOEDITSECTION__
3148 ==Section 1==
3149 ==Section 2==
3150 !! result
3151 <a name="Section_1"></a><h2>Section 1</h2>
3152 <a name="Section_2"></a><h2>Section 2</h2>
3154 !! end
3156 !! test
3157 Link inside a section heading
3158 !! options
3159 title=[[Parser test script]]
3160 !! input
3161 ==Section with a [[Main Page|link]] in it==
3162 !! result
3163 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</div><a name="Section_with_a_link_in_it"></a><h2>Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</h2>
3165 !! end
3168 !! test
3169 BUG 1219 URL next to image (good)
3170 !! input
3171 http://example.com [[Image:foobar.jpg]]
3172 !! result
3173 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a> <a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3174 </p>
3175 !!end
3177 !! test
3178 BUG 1219 URL next to image (broken)
3179 !! input
3180 http://example.com[[Image:foobar.jpg]]
3181 !! result
3182 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3183 </p>
3184 !!end
3186 !! test
3187 Bug 1186 news: in the middle of text
3188 !! input
3189 http://en.wikinews.org/wiki/Wikinews:Workplace
3190 !! result
3191 <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>
3192 </p>
3193 !!end
3196 !! test
3197 Namespaced link must have a title
3198 !! input
3199 [[Project:]]
3200 !! result
3201 <p>[[Project:]]
3202 </p>
3203 !!end
3205 !! test
3206 Namespaced link must have a title (bad fragment version)
3207 !! input
3208 [[Project:#fragment]]
3209 !! result
3210 <p>[[Project:#fragment]]
3211 </p>
3212 !!end
3215 !! test
3216 div with no attributes
3217 !! input
3218 <div>HTML rocks</div>
3219 !! result
3220 <div>HTML rocks</div>
3222 !! end
3224 !! test
3225 div with double-quoted attribute
3226 !! input
3227 <div id="rock">HTML rocks</div>
3228 !! result
3229 <div id="rock">HTML rocks</div>
3231 !! end
3233 !! test
3234 div with single-quoted attribute
3235 !! input
3236 <div id='rock'>HTML rocks</div>
3237 !! result
3238 <div id="rock">HTML rocks</div>
3240 !! end
3242 !! test
3243 div with unquoted attribute
3244 !! input
3245 <div id=rock>HTML rocks</div>
3246 !! result
3247 <div id="rock">HTML rocks</div>
3249 !! end
3251 !! test
3252 div with illegal double attributes
3253 !! input
3254 <div align="center" align="right">HTML rocks</div>
3255 !! result
3256 <div align="right">HTML rocks</div>
3258 !!end
3260 !! test
3261 HTML multiple attributes correction
3262 !! input
3263 <p class="error" class="awesome">Awesome!</p>
3264 !! result
3265 <p class="awesome">Awesome!</p>
3267 !!end
3269 !! test
3270 Table multiple attributes correction
3271 !! input
3273 !+ class="error" class="awesome"| status
3275 !! result
3276 <table>
3277 <tr>
3278 <th class="awesome"> status
3279 </th></tr></table>
3281 !!end
3283 !! test
3284 DIV IN UPPERCASE
3285 !! input
3286 <DIV ALIGN="center">HTML ROCKS</DIV>
3287 !! result
3288 <div align="center">HTML ROCKS</div>
3290 !!end
3293 !! test
3294 text with amp in the middle of nowhere
3295 !! input
3296 Remember AT&T?
3297 !!result
3298 <p>Remember AT&amp;T?
3299 </p>
3300 !! end
3302 !! test
3303 text with character entity: eacute
3304 !! input
3305 I always thought &eacute; was a cute letter.
3306 !! result
3307 <p>I always thought &eacute; was a cute letter.
3308 </p>
3309 !! end
3311 !! test
3312 text with undefined character entity: xacute
3313 !! input
3314 I always thought &xacute; was a cute letter.
3315 !! result
3316 <p>I always thought &amp;xacute; was a cute letter.
3317 </p>
3318 !! end
3322 ### Media links
3325 !! test
3326 Media link
3327 !! input
3328 [[Media:Foobar.jpg]]
3329 !! result
3330 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Media:Foobar.jpg</a>
3331 </p>
3332 !! end
3334 !! test
3335 Media link with text
3336 !! input
3337 [[Media:Foobar.jpg|A neat file to look at]]
3338 !! result
3339 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">A neat file to look at</a>
3340 </p>
3341 !! end
3343 # FIXME: this is still bad HTML tag nesting
3344 !! test
3345 Media link with nasty text
3346 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3347 !! input
3348 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3349 !! result
3350 <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>
3352 !! end
3354 !! test
3355 Media link to nonexistent file (bug 1702)
3356 !! input
3357 [[Media:No such.jpg]]
3358 !! result
3359 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class='new' title="No such.jpg">Media:No such.jpg</a>
3360 </p>
3361 !! end
3363 !! test
3364 Image link to nonexistent file (bug 1850 - good)
3365 !! input
3366 [[Image:No such.jpg]]
3367 !! result
3368 <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>
3369 </p>
3370 !! end
3372 !! test
3373 :Image link to nonexistent file (bug 1850 - bad)
3374 !! input
3375 [[:Image:No such.jpg]]
3376 !! result
3377 <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>
3378 </p>
3379 !! end
3383 !! test
3384 Character reference normalization in link text (bug 1938)
3385 !! input
3386 [[Main Page|this&that]]
3387 !! result
3388 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3389 </p>
3390 !!end
3392 !! test
3393 Empty attribute crash test (bug 2067)
3394 !! input
3395 <font color="">foo</font>
3396 !! result
3397 <p><font color="">foo</font>
3398 </p>
3399 !! end
3401 !! test
3402 Empty attribute crash test single-quotes (bug 2067)
3403 !! input
3404 <font color=''>foo</font>
3405 !! result
3406 <p><font color="">foo</font>
3407 </p>
3408 !! end
3410 !! test
3411 Attribute test: equals, then nothing
3412 !! input
3413 <font color=>foo</font>
3414 !! result
3415 <p><font>foo</font>
3416 </p>
3417 !! end
3419 !! test
3420 Attribute test: unquoted value
3421 !! input
3422 <font color=x>foo</font>
3423 !! result
3424 <p><font color="x">foo</font>
3425 </p>
3426 !! end
3428 !! test
3429 Attribute test: unquoted but illegal value (hash)
3430 !! input
3431 <font color=#x>foo</font>
3432 !! result
3433 <p><font color="#x">foo</font>
3434 </p>
3435 !! end
3437 !! test
3438 Attribute test: no value
3439 !! input
3440 <font color>foo</font>
3441 !! result
3442 <p><font color="color">foo</font>
3443 </p>
3444 !! end
3446 !! test
3447 Bug 2095: link with three closing brackets
3448 !! input
3449 [[Main Page]]]
3450 !! result
3451 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3452 </p>
3453 !! end
3455 !! test
3456 Bug 2095: link with pipe and three closing brackets
3457 !! input
3458 [[Main Page|link]]]
3459 !! result
3460 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3461 </p>
3462 !! end
3464 !! test
3465 Bug 2095: link with pipe and three closing brackets, version 2
3466 !! input
3467 [[Main Page|[http://example.com/]]]
3468 !! result
3469 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3470 </p>
3471 !! end
3475 ### Safety
3478 !! article
3479 Template:Dangerous attribute
3480 !! text
3481 " onmouseover="alert(document.cookie)
3482 !! endarticle
3484 !! article
3485 Template:Dangerous style attribute
3486 !! text
3487 border-size: expression(alert(document.cookie))
3488 !! endarticle
3490 !! article
3491 Template:Div style
3492 !! text
3493 <div style="float: right; {{{1}}}">Magic div</div>
3494 !! endarticle
3496 !! test
3497 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3498 !! input
3499 <div title="{{test}}"></div>
3500 !! result
3501 <div title="This is a test template"></div>
3503 !! end
3505 !! test
3506 Bug 2304: HTML attribute safety (dangerous template; 2309)
3507 !! input
3508 <div title="{{dangerous attribute}}"></div>
3509 !! result
3510 <div title=""></div>
3512 !! end
3514 !! test
3515 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3516 !! input
3517 <div style="{{dangerous style attribute}}"></div>
3518 !! result
3519 <div></div>
3521 !! end
3523 !! test
3524 Bug 2304: HTML attribute safety (safe parameter; 2309)
3525 !! input
3526 {{div style|width: 200px}}
3527 !! result
3528 <div style="float: right; width: 200px">Magic div</div>
3530 !! end
3532 !! test
3533 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3534 !! input
3535 {{div style|width: expression(alert(document.cookie))}}
3536 !! result
3537 <div>Magic div</div>
3539 !! end
3541 !! test
3542 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3543 !! input
3544 {{div style|"><script>alert(document.cookie)</script>}}
3545 !! result
3546 <div>Magic div</div>
3548 !! end
3550 !! test
3551 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3552 !! input
3553 {{div style|" ><script>alert(document.cookie)</script>}}
3554 !! result
3555 <div style="float: right;">Magic div</div>
3557 !! end
3559 !! test
3560 Bug 2304: HTML attribute safety (link)
3561 !! input
3562 <div title="[[Main Page]]"></div>
3563 !! result
3564 <div title="&#91;&#91;Main Page]]"></div>
3566 !! end
3568 !! test
3569 Bug 2304: HTML attribute safety (italics)
3570 !! input
3571 <div title="''foobar''"></div>
3572 !! result
3573 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3575 !! end
3577 !! test
3578 Bug 2304: HTML attribute safety (bold)
3579 !! input
3580 <div title="'''foobar'''"></div>
3581 !! result
3582 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3584 !! end
3587 !! test
3588 Bug 2304: HTML attribute safety (ISBN)
3589 !! input
3590 <div title="ISBN 1234567890"></div>
3591 !! result
3592 <div title="&#73;SBN 1234567890"></div>
3594 !! end
3596 !! test
3597 Bug 2304: HTML attribute safety (RFC)
3598 !! input
3599 <div title="RFC 1234"></div>
3600 !! result
3601 <div title="&#82;FC 1234"></div>
3603 !! end
3605 !! test
3606 Bug 2304: HTML attribute safety (PMID)
3607 !! input
3608 <div title="PMID 1234567890"></div>
3609 !! result
3610 <div title="&#80;MID 1234567890"></div>
3612 !! end
3614 !! test
3615 Bug 2304: HTML attribute safety (web link)
3616 !! input
3617 <div title="http://example.com/"></div>
3618 !! result
3619 <div title="http&#58;//example.com/"></div>
3621 !! end
3623 !! test
3624 Bug 2304: HTML attribute safety (named web link)
3625 !! input
3626 <div title="[http://example.com/ link]"></div>
3627 !! result
3628 <div title="&#91;http&#58;//example.com/ link]"></div>
3630 !! end
3632 !! test
3633 Bug 3244: HTML attribute safety (extension; safe)
3634 !! input
3635 <div style="<nowiki>background:blue</nowiki>"></div>
3636 !! result
3637 <div style="background:blue"></div>
3639 !! end
3641 !! test
3642 Bug 3244: HTML attribute safety (extension; unsafe)
3643 !! input
3644 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3645 !! result
3646 <div></div>
3648 !! end
3650 !! test
3651 Math section safety when disabled
3652 !! input
3653 <math><script>alert(document.cookies);</script></math>
3654 !! result
3655 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3656 </p>
3657 !! end
3659 # More MSIE fun discovered by Tom Gilder
3661 !! test
3662 MSIE CSS safety test: spurious slash
3663 !! input
3664 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3665 !! result
3666 <div>evil</div>
3668 !! end
3670 !! test
3671 MSIE CSS safety test: hex code
3672 !! input
3673 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3674 !! result
3675 <div>evil</div>
3677 !! end
3679 !! test
3680 MSIE CSS safety test: comment in url
3681 !! input
3682 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3683 !! result
3684 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3686 !! end
3688 !! test
3689 MSIE CSS safety test: comment in expression
3690 !! input
3691 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3692 !! result
3693 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3695 !! end
3698 !! test
3699 Table attribute legitimate extension
3700 !! input
3702 !+ style="<nowiki>color:blue</nowiki>"| status
3704 !! result
3705 <table>
3706 <tr>
3707 <th style="color:blue"> status
3708 </th></tr></table>
3710 !!end
3712 !! test
3713 Table attribute safety
3714 !! input
3716 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3718 !! result
3719 <table>
3720 <tr>
3721 <th> status
3722 </th></tr></table>
3724 !! end
3727 !! article
3728 Template:Identity
3729 !! text
3730 {{{1}}}
3731 !! endarticle
3733 !! test
3734 Expansion of multi-line templates in attribute values (bug 6255)
3735 !! input
3736 <div style="background: {{identity|#00FF00}}">-</div>
3737 !! result
3738 <div style="background: #00FF00">-</div>
3740 !! end
3743 !! test
3744 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3745 !! input
3746 <div style="background: 
3747 #00FF00">-</div>
3748 !! result
3749 <div style="background: #00FF00">-</div>
3751 !! end
3753 !! test
3754 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3755 !! input
3756 <div style="background: &#10;#00FF00">-</div>
3757 !! result
3758 <div style="background: &#10;#00FF00">-</div>
3760 !! end
3763 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3765 !! test
3766 Parser hook: empty input
3767 !! input
3768 <tag></tag>
3769 !! result
3770 <pre>
3771 string(0) ""
3772 array(0) {
3774 </pre>
3776 !! end
3778 !! test
3779 Parser hook: empty input using terminated empty elements
3780 !! input
3781 <tag/>
3782 !! result
3783 <pre>
3784 NULL
3785 array(0) {
3787 </pre>
3789 !! end
3791 !! test
3792 Parser hook: empty input using terminated empty elements (space before)
3793 !! input
3794 <tag />
3795 !! result
3796 <pre>
3797 NULL
3798 array(0) {
3800 </pre>
3802 !! end
3804 !! test
3805 Parser hook: basic input
3806 !! input
3807 <tag>input</tag>
3808 !! result
3809 <pre>
3810 string(5) "input"
3811 array(0) {
3813 </pre>
3815 !! end
3818 !! test
3819 Parser hook: case insensetive
3820 !! input
3821 <TAG>input</TAG>
3822 !! result
3823 <pre>
3824 string(5) "input"
3825 array(0) {
3827 </pre>
3829 !! end
3832 !! test
3833 Parser hook: case insensetive, redux
3834 !! input
3835 <TaG>input</TAg>
3836 !! result
3837 <pre>
3838 string(5) "input"
3839 array(0) {
3841 </pre>
3843 !! end
3845 !! test
3846 Parser hook: nested tags
3847 !! options
3848 noxml
3849 !! input
3850 <tag><tag></tag></tag>
3851 !! result
3852 <pre>
3853 string(5) "<tag>"
3854 array(0) {
3856 </pre>&lt;/tag&gt;
3858 !! end
3860 !! test
3861 Parser hook: basic arguments
3862 !! input
3863 <tag width=200 height = "100" depth = '50' square></tag>
3864 !! result
3865 <pre>
3866 string(0) ""
3867 array(4) {
3868   ["width"]=>
3869   string(3) "200"
3870   ["height"]=>
3871   string(3) "100"
3872   ["depth"]=>
3873   string(2) "50"
3874   ["square"]=>
3875   string(6) "square"
3877 </pre>
3879 !! end
3881 !! test
3882 Parser hook: argument containing a forward slash (bug 5344)
3883 !! input
3884 <tag filename='/tmp/bla'></tag>
3885 !! result
3886 <pre>
3887 string(0) ""
3888 array(1) {
3889   ["filename"]=>
3890   string(8) "/tmp/bla"
3892 </pre>
3894 !! end
3896 !! test
3897 Parser hook: empty input using terminated empty elements (bug 2374)
3898 !! input
3899 <tag foo=bar/>text
3900 !! result
3901 <pre>
3902 NULL
3903 array(1) {
3904   ["foo"]=>
3905   string(3) "bar"
3907 </pre>text
3909 !! end
3911 # </tag> should be output literally since there is no matching tag that begins it
3912 !! test
3913 Parser hook: basic arguments using terminated empty elements (bug 2374)
3914 !! input
3915 <tag width=200 height = "100" depth = '50' square/>
3916 other stuff
3917 </tag>
3918 !! result
3919 <pre>
3920 NULL
3921 array(4) {
3922   ["width"]=>
3923   string(3) "200"
3924   ["height"]=>
3925   string(3) "100"
3926   ["depth"]=>
3927   string(2) "50"
3928   ["square"]=>
3929   string(6) "square"
3931 </pre>
3932 <p>other stuff
3933 &lt;/tag&gt;
3934 </p>
3935 !! end
3938 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
3941 !! test
3942 Parser hook: static parser hook not inside a comment
3943 !! input
3944 <statictag>hello, world</statictag>
3945 <statictag action=flush/>
3946 !! result
3947 <p>hello, world
3948 </p>
3949 !! end
3952 !! test
3953 Parser hook: static parser hook inside a comment
3954 !! input
3955 <!-- <statictag>hello, world</statictag> -->
3956 <statictag action=flush/>
3957 !! result
3958 <p><br />
3959 </p>
3960 !! end
3962 # Nested template calls; this case was broken by Parser.php rev 1.506,
3963 # since reverted.
3965 !! article
3966 Template:One-parameter
3967 !! text
3968 (My parameter is: {{{1}}})
3969 !! endarticle
3971 !! article
3972 Template:Map-one-parameter
3973 !! text
3974 {{{{{1}}}|{{{2}}}}}
3975 !! endarticle
3977 !! test
3978 Nested template calls
3979 !! input
3980 {{Map-one-parameter|One-parameter|param}}
3981 !! result
3982 <p>(My parameter is: param)
3983 </p>
3984 !! end
3988 ### Sanitizer
3990 !! test
3991 Sanitizer: Closing of open tags
3992 !! input
3993 <s></s><table></table>
3994 !! result
3995 <s></s><table></table>
3997 !! end
3999 !! test
4000 Sanitizer: Closing of open but not closed tags
4001 !! input
4002 <s>foo
4003 !! result
4004 <p><s>foo</s>
4005 </p>
4006 !! end
4008 !! test
4009 Sanitizer: Closing of closed but not open tags
4010 !! input
4011 </s>
4012 !! result
4013 <p>&lt;/s&gt;
4014 </p>
4015 !! end
4017 !! test
4018 Sanitizer: Closing of closed but not open table tags
4019 !! input
4020 Table not started</td></tr></table>
4021 !! result
4022 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4023 </p>
4024 !! end
4026 !! test
4027 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4028 !! input
4029 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4030 !! result
4031 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4032 </p>
4033 !! end
4035 !! test
4036 Sanitizer: Validating the contents of the id attribute (bug 4515)
4037 !! options
4038 disabled
4039 !! input
4040 <br id=9 />
4041 !! result
4042 Something, but defenetly not <br id="9" />...
4043 !! end
4045 !! test
4046 Language converter: output gets cut off unexpectedly (bug 5757)
4047 !! options
4048 language=zh
4049 !! input
4050 this bit is safe: }-
4052 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4054 then we get cut off here: }-
4056 all additional text is vanished
4057 !! result
4058 <p>this bit is safe: }-
4059 </p><p>but if we add a conversion instance: xxx
4060 </p><p>then we get cut off here: }-
4061 </p><p>all additional text is vanished
4062 </p>
4063 !! end
4065 !! test
4066 Self closed html pairs (bug 5487)
4067 !! options
4068 !! input
4069 <center><font id="bug" />Centered text</center>
4070 <div><font id="bug2" />In div text</div>
4071 !! result
4072 <center>&lt;font id="bug" /&gt;Centered text</center>
4073 <div>&lt;font id="bug2" /&gt;In div text</div>
4075 !! end
4081 !! test
4082 HTML bullet list, closed tags (bug 5497)
4083 !! input
4084 <ul>
4085 <li>One</li>
4086 <li>Two</li>
4087 </ul>
4088 !! result
4089 <ul>
4090 <li>One</li>
4091 <li>Two</li>
4092 </ul>
4094 !! end
4096 !! test
4097 HTML bullet list, unclosed tags (bug 5497)
4098 !! input
4099 <ul>
4100 <li>One
4101 <li>Two
4102 </ul>
4103 !! result
4104 <ul>
4105 <li>One
4106 </li><li>Two
4107 </li></ul>
4109 !! end
4111 !! test
4112 HTML ordered list, closed tags (bug 5497)
4113 !! input
4114 <ol>
4115 <li>One</li>
4116 <li>Two</li>
4117 </ol>
4118 !! result
4119 <ol>
4120 <li>One</li>
4121 <li>Two</li>
4122 </ol>
4124 !! end
4126 !! test
4127 HTML ordered list, unclosed tags (bug 5497)
4128 !! input
4129 <ol>
4130 <li>One
4131 <li>Two
4132 </ol>
4133 !! result
4134 <ol>
4135 <li>One
4136 </li><li>Two
4137 </li></ol>
4139 !! end
4141 !! test
4142 HTML nested bullet list, closed tags (bug 5497)
4143 !! input
4144 <ul>
4145 <li>One</li>
4146 <li>Two:
4147 <ul>
4148 <li>Sub-one</li>
4149 <li>Sub-two</li>
4150 </ul>
4151 </li>
4152 </ul>
4153 !! result
4154 <ul>
4155 <li>One</li>
4156 <li>Two:
4157 <ul>
4158 <li>Sub-one</li>
4159 <li>Sub-two</li>
4160 </ul>
4161 </li>
4162 </ul>
4164 !! end
4166 !! test
4167 HTML nested bullet list, open tags (bug 5497)
4168 !! input
4169 <ul>
4170 <li>One
4171 <li>Two:
4172 <ul>
4173 <li>Sub-one
4174 <li>Sub-two
4175 </ul>
4176 </ul>
4177 !! result
4178 <ul>
4179 <li>One
4180 </li><li>Two:
4181 <ul>
4182 <li>Sub-one
4183 </li><li>Sub-two
4184 </li></ul>
4185 </li></ul>
4187 !! end
4189 !! test
4190 HTML nested ordered list, closed tags (bug 5497)
4191 !! input
4192 <ol>
4193 <li>One</li>
4194 <li>Two:
4195 <ol>
4196 <li>Sub-one</li>
4197 <li>Sub-two</li>
4198 </ol>
4199 </li>
4200 </ol>
4201 !! result
4202 <ol>
4203 <li>One</li>
4204 <li>Two:
4205 <ol>
4206 <li>Sub-one</li>
4207 <li>Sub-two</li>
4208 </ol>
4209 </li>
4210 </ol>
4212 !! end
4214 !! test
4215 HTML nested ordered list, open tags (bug 5497)
4216 !! input
4217 <ol>
4218 <li>One
4219 <li>Two:
4220 <ol>
4221 <li>Sub-one
4222 <li>Sub-two
4223 </ol>
4224 </ol>
4225 !! result
4226 <ol>
4227 <li>One
4228 </li><li>Two:
4229 <ol>
4230 <li>Sub-one
4231 </li><li>Sub-two
4232 </li></ol>
4233 </li></ol>
4235 !! end
4237 !! test
4238 HTML ordered list item with parameters oddity
4239 !! input
4240 <ol><li id="fragment">One</li></ol>
4241 !! result
4242 <ol><li id="fragment">One</li></ol>
4244 !! end
4246 !!test
4247 bug 5918: autonumbering
4248 !! input
4249 [http://first/] [http://second] [ftp://ftp]
4251 ftp://inlineftp
4253 [mailto:enclosed@mail.tld With target]
4255 [mailto:enclosed@mail.tld]
4257 mailto:inline@mail.tld
4258 !! result
4259 <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>
4260 </p><p><a href="ftp://inlineftp" class='external free' title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4261 </p><p><a href="mailto:enclosed@mail.tld" class='external text' title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4262 </p><p><a href="mailto:enclosed@mail.tld" class='external autonumber' title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4263 </p><p><a href="mailto:inline@mail.tld" class='external free' title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4264 </p>
4265 !! end
4269 # Security and HTML correctness
4270 # From Nick Jenkins' fuzz testing
4273 !! test
4274 Fuzz testing: Parser13
4275 !! input
4276 {| 
4277 | http://a|
4278 !! result
4279 <table>
4280 <tr>
4281 <td>
4282 </td>
4283 </tr>
4284 </table>
4286 !! end
4288 !! test
4289 Fuzz testing: Parser14
4290 !! input
4291 == onmouseover= ==
4292 http://__TOC__
4293 !! result
4294 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</div><a name="onmouseover.3D"></a><h2> onmouseover= </h2>
4295 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4296 <ul>
4297 <li class='toclevel-1'><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4298 </ul>
4299 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4301 !! end
4303 !! test
4304 Fuzz testing: Parser14-table
4305 !! input
4306 ==a==
4307 {| STYLE=__TOC__
4308 !! result
4309 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</div><a name="a"></a><h2>a</h2>
4310 <table style="&#95;_TOC&#95;_">
4311 <tr><td></td></tr>
4312 </table>
4314 !! end
4316 # Known to produce bogus xml (extra </td>)
4317 !! test
4318 Fuzz testing: Parser16
4319 !! options
4320 noxml
4321 !! input
4323 !https://||||||
4324 !! result
4325 <table>
4326 <tr>
4327 <th>https://</th><th></th><th></th><th>
4328 </td>
4329 </tr>
4330 </table>
4332 !! end
4334 !! test
4335 Fuzz testing: Parser21
4336 !! input
4338 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4340 !! result
4341 <table>
4342 <tr>
4343 <th> <a href="irc://{{ftp://a" class='external free' title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4344 </th><td>
4345 </td>
4346 </tr>
4347 </table>
4349 !! end
4351 !! test
4352 Fuzz testing: Parser22
4353 !! input
4354 http://===r:::https://b
4357 !!result
4358 <p><a href="http://===r:::https://b" class='external free' title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4359 </p>
4360 <table>
4361 <tr><td></td></tr>
4362 </table>
4364 !! end
4366 # Known to produce bad XML for now
4367 !! test
4368 Fuzz testing: Parser24
4369 !! options
4370 noxml
4371 !! input
4373 {{{|
4374 <u CLASS=
4375 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4376 <br style="onmouseover='alert(document.cookie);' " />
4378 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4380 !! result
4381 <table>
4383 <u class="&#124;">} &gt;
4384 <br style="onmouseover='alert(document.cookie);'" />
4386 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4387 <tr>
4388 <td></u>
4389 </td>
4390 </tr>
4391 </table>
4393 !! end
4395 # Known to produce bad XML for now
4396 !!test
4397 Fuzz testing: Parser25 (bug 6055)
4398 !! options
4399 noxml
4400 !! input
4403 <LI CLASS=||
4405 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4406 !! result
4407 <li class="&#124;&#124;">
4408 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4410 !! end
4412 !!test
4413 Fuzz testing: URL adjacent extension (with space, clean)
4414 !! options
4415 !! input
4416 http://example.com <nowiki>junk</nowiki>
4417 !! result
4418 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a> junk
4419 </p>
4420 !!end
4422 !!test
4423 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4424 !! options
4425 !! input
4426 http://example.com<nowiki>junk</nowiki>
4427 !! result
4428 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>junk
4429 </p>
4430 !!end
4432 !!test
4433 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4434 !! options
4435 !! input
4436 http://example.com<pre>junk</pre>
4437 !! result
4438 <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4440 !!end
4442 !!test
4443 Fuzz testing: image with bogus manual thumbnail
4444 !!input
4445 [[Image:foobar.jpg|thumbnail= ]]
4446 !!result
4447 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="180" height="-1" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div></div></div></div>
4449 !!end
4451 !! test
4452 Parsing optional HTML elements (Bug 6171)
4453 !! options
4454 !! input
4455 <table>
4456   <tr>
4457     <td> Some tabular data</td>
4458     <td> More tabular data ...
4459     <td> And yet som tabular data</td>
4460   </tr>
4461 </table>
4462 !! result
4463 <table>
4464   <tr>
4465     <td> Some tabular data</td>
4466     <td> More tabular data ...
4467     </td><td> And yet som tabular data</td>
4468   </tr>
4469 </table>
4471 !! end
4473 !! test
4474 Correct handling of <td>, <tr> (Bug 6171)
4475 !! options
4476 !! input
4477 <table>
4478   <tr>
4479     <td> Some tabular data</td>
4480     <td> More tabular data ...</td>
4481     <td> And yet som tabular data</td>
4482   </tr>
4483 </table>
4484 !! result
4485 <table>
4486   <tr>
4487     <td> Some tabular data</td>
4488     <td> More tabular data ...</td>
4489     <td> And yet som tabular data</td>
4490   </tr>
4491 </table>
4493 !! end
4496 !! test
4497 Parsing crashing regression (fr:JavaScript)
4498 !! input
4499 </body></x>
4500 !! result
4501 <p>&lt;/body&gt;&lt;/x&gt;
4502 </p>
4503 !! end
4505 !! test
4506 Inline wiki vs wiki block nesting
4507 !! input
4508 '''Bold paragraph
4510 New wiki paragraph
4511 !! result
4512 <p><b>Bold paragraph</b>
4513 </p><p>New wiki paragraph
4514 </p>
4515 !! end
4517 !! test
4518 Inline HTML vs wiki block nesting
4519 !! input
4520 <b>Bold paragraph
4522 New wiki paragraph
4523 !! result
4524 <p><b>Bold paragraph</b>
4525 </p><p>New wiki paragraph
4526 </p>
4527 !! end
4530 !!test
4531 Mixing markup for italics and bold
4532 !! options
4533 !! input
4534 '''bold''''''bold''bolditalics'''''
4535 !! result
4536 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4537 </p>
4538 !! end
4541 !! article
4542 Xyzzyx
4543 !! text
4544 Article for special page transclusion test
4545 !! endarticle
4547 !! test
4548 Special page transclusion
4549 !! options
4550 !! input
4551 {{Special:Prefixindex/Xyzzyx}}
4552 !! result
4553 <p><br />
4554 </p>
4555 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4557 !! end
4559 !! test
4560 Special page transclusion twice (bug 5021)
4561 !! options
4562 !! input
4563 {{Special:Prefixindex/Xyzzyx}}
4564 {{Special:Prefixindex/Xyzzyx}}
4565 !! result
4566 <p><br />
4567 </p>
4568 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4569 <p><br />
4570 </p>
4571 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4573 !! end
4575 !! test
4576 Invalid header with following text
4577 !! input
4578 = x = y
4579 !! result
4580 <p>= x = y
4581 </p>
4582 !! end
4585 !! test
4586 Section extraction test (section 0)
4587 !! options
4588 section=0
4589 !! input
4590 start
4591 ==a==
4592 ===aa===
4593 ====aaa====
4594 ==b==
4595 ===ba===
4596 ===bb===
4597 ====bba====
4598 ===bc===
4599 ==c==
4600 ===ca===
4601 !! result
4602 start
4603 !! end
4605 !! test
4606 Section extraction test (section 1)
4607 !! options
4608 section=1
4609 !! input
4610 start
4611 ==a==
4612 ===aa===
4613 ====aaa====
4614 ==b==
4615 ===ba===
4616 ===bb===
4617 ====bba====
4618 ===bc===
4619 ==c==
4620 ===ca===
4621 !! result
4622 ==a==
4623 ===aa===
4624 ====aaa====
4625 !! end
4627 !! test
4628 Section extraction test (section 2)
4629 !! options
4630 section=2
4631 !! input
4632 start
4633 ==a==
4634 ===aa===
4635 ====aaa====
4636 ==b==
4637 ===ba===
4638 ===bb===
4639 ====bba====
4640 ===bc===
4641 ==c==
4642 ===ca===
4643 !! result
4644 ===aa===
4645 ====aaa====
4646 !! end
4648 !! test
4649 Section extraction test (section 3)
4650 !! options
4651 section=3
4652 !! input
4653 start
4654 ==a==
4655 ===aa===
4656 ====aaa====
4657 ==b==
4658 ===ba===
4659 ===bb===
4660 ====bba====
4661 ===bc===
4662 ==c==
4663 ===ca===
4664 !! result
4665 ====aaa====
4666 !! end
4668 !! test
4669 Section extraction test (section 4)
4670 !! options
4671 section=4
4672 !! input
4673 start
4674 ==a==
4675 ===aa===
4676 ====aaa====
4677 ==b==
4678 ===ba===
4679 ===bb===
4680 ====bba====
4681 ===bc===
4682 ==c==
4683 ===ca===
4684 !! result
4685 ==b==
4686 ===ba===
4687 ===bb===
4688 ====bba====
4689 ===bc===
4690 !! end
4692 !! test
4693 Section extraction test (section 5)
4694 !! options
4695 section=5
4696 !! input
4697 start
4698 ==a==
4699 ===aa===
4700 ====aaa====
4701 ==b==
4702 ===ba===
4703 ===bb===
4704 ====bba====
4705 ===bc===
4706 ==c==
4707 ===ca===
4708 !! result
4709 ===ba===
4710 !! end
4712 !! test
4713 Section extraction test (section 6)
4714 !! options
4715 section=6
4716 !! input
4717 start
4718 ==a==
4719 ===aa===
4720 ====aaa====
4721 ==b==
4722 ===ba===
4723 ===bb===
4724 ====bba====
4725 ===bc===
4726 ==c==
4727 ===ca===
4728 !! result
4729 ===bb===
4730 ====bba====
4731 !! end
4733 !! test
4734 Section extraction test (section 7)
4735 !! options
4736 section=7
4737 !! input
4738 start
4739 ==a==
4740 ===aa===
4741 ====aaa====
4742 ==b==
4743 ===ba===
4744 ===bb===
4745 ====bba====
4746 ===bc===
4747 ==c==
4748 ===ca===
4749 !! result
4750 ====bba====
4751 !! end
4753 !! test
4754 Section extraction test (section 8)
4755 !! options
4756 section=8
4757 !! input
4758 start
4759 ==a==
4760 ===aa===
4761 ====aaa====
4762 ==b==
4763 ===ba===
4764 ===bb===
4765 ====bba====
4766 ===bc===
4767 ==c==
4768 ===ca===
4769 !! result
4770 ===bc===
4771 !! end
4773 !! test
4774 Section extraction test (section 9)
4775 !! options
4776 section=9
4777 !! input
4778 start
4779 ==a==
4780 ===aa===
4781 ====aaa====
4782 ==b==
4783 ===ba===
4784 ===bb===
4785 ====bba====
4786 ===bc===
4787 ==c==
4788 ===ca===
4789 !! result
4790 ==c==
4791 ===ca===
4792 !! end
4794 !! test
4795 Section extraction test (section 10)
4796 !! options
4797 section=10
4798 !! input
4799 start
4800 ==a==
4801 ===aa===
4802 ====aaa====
4803 ==b==
4804 ===ba===
4805 ===bb===
4806 ====bba====
4807 ===bc===
4808 ==c==
4809 ===ca===
4810 !! result
4811 ===ca===
4812 !! end
4814 !! test
4815 Section extraction test (nonexistent section 11)
4816 !! options
4817 section=11
4818 !! input
4819 start
4820 ==a==
4821 ===aa===
4822 ====aaa====
4823 ==b==
4824 ===ba===
4825 ===bb===
4826 ====bba====
4827 ===bc===
4828 ==c==
4829 ===ca===
4830 !! result
4831 !! end
4833 !! test
4834 Section extraction test with bogus heading (section 1)
4835 !! options
4836 section=1
4837 !! input
4838 ==a==
4839 ==bogus== not a legal section
4840 ==b==
4841 !! result
4842 ==a==
4843 ==bogus== not a legal section
4844 !! end
4846 !! test
4847 Section extraction test with bogus heading (section 2)
4848 !! options
4849 section=2
4850 !! input
4851 ==a==
4852 ==bogus== not a legal section
4853 ==b==
4854 !! result
4855 ==b==
4856 !! end
4858 !! test
4859 Section extraction test with comment after heading (section 1)
4860 !! options
4861 section=1
4862 !! input
4863 ==a==
4864 ==legal== <!-- a legal section -->
4865 ==b==
4866 !! result
4867 ==a==
4868 !! end
4870 !! test
4871 Section extraction test with comment after heading (section 2)
4872 !! options
4873 section=2
4874 !! input
4875 ==a==
4876 ==legal== <!-- a legal section -->
4877 ==b==
4878 !! result
4879 ==legal== <!-- a legal section -->
4880 !! end
4882 !! test
4883 Section extraction test with bogus <nowiki> heading (section 1)
4884 !! options
4885 section=1
4886 !! input
4887 ==a==
4888 ==bogus== <nowiki>not a legal section</nowiki>
4889 ==b==
4890 !! result
4891 ==a==
4892 ==bogus== <nowiki>not a legal section</nowiki>
4893 !! end
4895 !! test
4896 Section extraction test with bogus <nowiki> heading (section 2)
4897 !! options
4898 section=2
4899 !! input
4900 ==a==
4901 ==bogus== <nowiki>not a legal section</nowiki>
4902 ==b==
4903 !! result
4904 ==b==
4905 !! end
4908 !! test
4909 Section extraction prefixed by comment (section 1) (bug 2587)
4910 !! options
4911 section=1
4912 !! input
4913 <!-- -->==sec1==
4914 ==sec2==
4915 !!result
4916 <!-- -->==sec1==
4917 !!end
4919 !! test
4920 Section extraction prefixed by comment (section 2) (bug 2587)
4921 !! options
4922 section=2
4923 !! input
4924 <!-- -->==sec1==
4925 ==sec2==
4926 !!result
4927 ==sec2==
4928 !!end
4931 !! test
4932 Section extraction, mixed wiki and html (section 1) (bug 2607)
4933 !! options
4934 section=1
4935 !! input
4936 <h2>1</h2>
4938 ==2==
4940 ==3==
4941 three
4942 !! result
4943 <h2>1</h2>
4945 !! end
4947 !! test
4948 Section extraction, mixed wiki and html (section 2) (bug 2607)
4949 !! options
4950 section=2
4951 !! input
4952 <h2>1</h2>
4954 ==2==
4956 ==3==
4957 three
4958 !! result
4959 ==2==
4961 !! end
4964 !! test
4965 Section extraction, heading surrounded by <noinclude> (bug 3342)
4966 !! options
4967 section=1
4968 !! input
4969 <noinclude>==a==</noinclude>
4970 text
4971 !! result
4972 <noinclude>==a==</noinclude>
4973 text
4974 !!end
4977 !! test
4978 Section extraction, HTML heading subsections (bug 5272)
4979 !! options
4980 section=1
4981 !! input
4982 <h2>a</h2>
4983 <h3>aa</h3>
4984 <h2>b</h2>
4985 !! result
4986 <h2>a</h2>
4987 <h3>aa</h3>
4988 !! end
4990 !! test
4991 Section extraction, HTML headings should be ignored in extensions (bug 3476)
4992 !! options
4993 section=2
4994 !! input
4995 <h2>a</h2>
4996 <tag>
4997 <h2>not b</h2>
4998 </tag>
4999 <h2>b</h2>
5000 !! result
5001 <h2>b</h2>
5002 !! end
5004 !! test
5005 Section replacement test (section 0)
5006 !! options
5007 replace=0,"xxx"
5008 !! input
5009 start
5010 ==a==
5011 ===aa===
5012 ====aaa====
5013 ==b==
5014 ===ba===
5015 ===bb===
5016 ====bba====
5017 ===bc===
5018 ==c==
5019 ===ca===
5020 !! result
5023 ==a==
5024 ===aa===
5025 ====aaa====
5026 ==b==
5027 ===ba===
5028 ===bb===
5029 ====bba====
5030 ===bc===
5031 ==c==
5032 ===ca===
5033 !! end
5035 !! test
5036 Section replacement test (section 1)
5037 !! options
5038 replace=1,"xxx"
5039 !! input
5040 start
5041 ==a==
5042 ===aa===
5043 ====aaa====
5044 ==b==
5045 ===ba===
5046 ===bb===
5047 ====bba====
5048 ===bc===
5049 ==c==
5050 ===ca===
5051 !! result
5052 start
5055 ==b==
5056 ===ba===
5057 ===bb===
5058 ====bba====
5059 ===bc===
5060 ==c==
5061 ===ca===
5062 !! end
5064 !! test
5065 Section replacement test (section 2)
5066 !! options
5067 replace=2,"xxx"
5068 !! input
5069 start
5070 ==a==
5071 ===aa===
5072 ====aaa====
5073 ==b==
5074 ===ba===
5075 ===bb===
5076 ====bba====
5077 ===bc===
5078 ==c==
5079 ===ca===
5080 !! result
5081 start
5082 ==a==
5085 ==b==
5086 ===ba===
5087 ===bb===
5088 ====bba====
5089 ===bc===
5090 ==c==
5091 ===ca===
5092 !! end
5094 !! test
5095 Section replacement test (section 3)
5096 !! options
5097 replace=3,"xxx"
5098 !! input
5099 start
5100 ==a==
5101 ===aa===
5102 ====aaa====
5103 ==b==
5104 ===ba===
5105 ===bb===
5106 ====bba====
5107 ===bc===
5108 ==c==
5109 ===ca===
5110 !! result
5111 start
5112 ==a==
5113 ===aa===
5116 ==b==
5117 ===ba===
5118 ===bb===
5119 ====bba====
5120 ===bc===
5121 ==c==
5122 ===ca===
5123 !! end
5125 !! test
5126 Section replacement test (section 4)
5127 !! options
5128 replace=4,"xxx"
5129 !! input
5130 start
5131 ==a==
5132 ===aa===
5133 ====aaa====
5134 ==b==
5135 ===ba===
5136 ===bb===
5137 ====bba====
5138 ===bc===
5139 ==c==
5140 ===ca===
5141 !! result
5142 start
5143 ==a==
5144 ===aa===
5145 ====aaa====
5148 ==c==
5149 ===ca===
5150 !! end
5152 !! test
5153 Section replacement test (section 5)
5154 !! options
5155 replace=5,"xxx"
5156 !! input
5157 start
5158 ==a==
5159 ===aa===
5160 ====aaa====
5161 ==b==
5162 ===ba===
5163 ===bb===
5164 ====bba====
5165 ===bc===
5166 ==c==
5167 ===ca===
5168 !! result
5169 start
5170 ==a==
5171 ===aa===
5172 ====aaa====
5173 ==b==
5176 ===bb===
5177 ====bba====
5178 ===bc===
5179 ==c==
5180 ===ca===
5181 !! end
5183 !! test
5184 Section replacement test (section 6)
5185 !! options
5186 replace=6,"xxx"
5187 !! input
5188 start
5189 ==a==
5190 ===aa===
5191 ====aaa====
5192 ==b==
5193 ===ba===
5194 ===bb===
5195 ====bba====
5196 ===bc===
5197 ==c==
5198 ===ca===
5199 !! result
5200 start
5201 ==a==
5202 ===aa===
5203 ====aaa====
5204 ==b==
5205 ===ba===
5208 ===bc===
5209 ==c==
5210 ===ca===
5211 !! end
5213 !! test
5214 Section replacement test (section 7)
5215 !! options
5216 replace=7,"xxx"
5217 !! input
5218 start
5219 ==a==
5220 ===aa===
5221 ====aaa====
5222 ==b==
5223 ===ba===
5224 ===bb===
5225 ====bba====
5226 ===bc===
5227 ==c==
5228 ===ca===
5229 !! result
5230 start
5231 ==a==
5232 ===aa===
5233 ====aaa====
5234 ==b==
5235 ===ba===
5236 ===bb===
5239 ===bc===
5240 ==c==
5241 ===ca===
5242 !! end
5244 !! test
5245 Section replacement test (section 8)
5246 !! options
5247 replace=8,"xxx"
5248 !! input
5249 start
5250 ==a==
5251 ===aa===
5252 ====aaa====
5253 ==b==
5254 ===ba===
5255 ===bb===
5256 ====bba====
5257 ===bc===
5258 ==c==
5259 ===ca===
5260 !! result
5261 start
5262 ==a==
5263 ===aa===
5264 ====aaa====
5265 ==b==
5266 ===ba===
5267 ===bb===
5268 ====bba====
5271 ==c==
5272 ===ca===
5273 !!end
5275 !! test
5276 Section replacement test (section 9)
5277 !! options
5278 replace=9,"xxx"
5279 !! input
5280 start
5281 ==a==
5282 ===aa===
5283 ====aaa====
5284 ==b==
5285 ===ba===
5286 ===bb===
5287 ====bba====
5288 ===bc===
5289 ==c==
5290 ===ca===
5291 !! result
5292 start
5293 ==a==
5294 ===aa===
5295 ====aaa====
5296 ==b==
5297 ===ba===
5298 ===bb===
5299 ====bba====
5300 ===bc===
5302 !! end
5304 !! test
5305 Section replacement test (section 10)
5306 !! options
5307 replace=10,"xxx"
5308 !! input
5309 start
5310 ==a==
5311 ===aa===
5312 ====aaa====
5313 ==b==
5314 ===ba===
5315 ===bb===
5316 ====bba====
5317 ===bc===
5318 ==c==
5319 ===ca===
5320 !! result
5321 start
5322 ==a==
5323 ===aa===
5324 ====aaa====
5325 ==b==
5326 ===ba===
5327 ===bb===
5328 ====bba====
5329 ===bc===
5330 ==c==
5332 !! end
5335 !! test
5336 Section extraction, HTML headings not at line boundaries (section 0)
5337 !! options
5338 section=0
5339 !! input
5340 <h2>Evil</h2><i>blah blah blah</i>
5342 evil blah
5344 <h2>Nice</h2>
5346 nice blah
5348 <i>extra evil</i><h2>Extra nasty</h2>
5350 extra nasty
5351 !! result
5352 !! end
5354 !! test
5355 Section extraction, HTML headings not at line boundaries (section 1)
5356 !! options
5357 section=1
5358 !! input
5359 <h2>Evil</h2><i>blah blah blah</i>
5361 evil blah
5363 <h2>Nice</h2>
5365 nice blah
5367 <i>extra evil</i><h2>Extra nasty</h2>
5369 extra nasty
5370 !! result
5371 <h2>Evil</h2><i>blah blah blah</i>
5373 evil blah
5374 !! end
5376 !! test
5377 Section extraction, HTML headings not at line boundaries (section 2)
5378 !! options
5379 section=2
5380 !! input
5381 <h2>Evil</h2><i>blah blah blah</i>
5383 evil blah
5385 <h2>Nice</h2>
5387 nice blah
5389 <i>extra evil</i><h2>Extra nasty</h2>
5391 extra nasty
5392 !! result
5393 <h2>Nice</h2>
5395 nice blah
5397 <i>extra evil</i>
5398 !! end
5400 !! test
5401 Section extraction, HTML headings not at line boundaries (section 3)
5402 !! options
5403 section=3
5404 !! input
5405 <h2>Evil</h2><i>blah blah blah</i>
5407 evil blah
5409 <h2>Nice</h2>
5411 nice blah
5413 <i>extra evil</i><h2>Extra nasty</h2>
5415 extra nasty
5416 !! result
5417 <h2>Extra nasty</h2>
5419 extra nasty
5420 !! end
5426 TODO:
5427 more images
5428 more tables
5429 math
5430 character entities
5431 and much more